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.
Files changed (770) hide show
  1. package/README.md +162 -267
  2. package/dist/__tests__/CommitSuggesterCmd.test.js +112 -0
  3. package/dist/__tests__/CommitSuggesterCmd.test.js.map +1 -0
  4. package/dist/__tests__/EvalReportCmd.test.js +645 -0
  5. package/dist/__tests__/EvalReportCmd.test.js.map +1 -0
  6. package/dist/__tests__/ModelCmd.test.js +64 -0
  7. package/dist/__tests__/ModelCmd.test.js.map +1 -0
  8. package/dist/__tests__/agents/agentActions.test.js +345 -0
  9. package/dist/__tests__/agents/agentActions.test.js.map +1 -0
  10. package/dist/__tests__/agents/agentFeedback.test.js +118 -0
  11. package/dist/__tests__/agents/agentFeedback.test.js.map +1 -0
  12. package/dist/__tests__/agents/agentGeneralScope.test.js +74 -0
  13. package/dist/__tests__/agents/agentGeneralScope.test.js.map +1 -0
  14. package/dist/__tests__/agents/agentLoop.test.js +1723 -0
  15. package/dist/__tests__/agents/agentLoop.test.js.map +1 -0
  16. package/dist/__tests__/agents/agentPolicyState.test.js +948 -0
  17. package/dist/__tests__/agents/agentPolicyState.test.js.map +1 -0
  18. package/dist/__tests__/agents/agentReadEvidence.test.js +170 -0
  19. package/dist/__tests__/agents/agentReadEvidence.test.js.map +1 -0
  20. package/dist/__tests__/agents/agentReadPersistence.test.js +129 -0
  21. package/dist/__tests__/agents/agentReadPersistence.test.js.map +1 -0
  22. package/dist/__tests__/agents/agentResumeCheckpoint.test.js +90 -0
  23. package/dist/__tests__/agents/agentResumeCheckpoint.test.js.map +1 -0
  24. package/dist/__tests__/agents/agentSearchBatchPlanner.test.js +289 -0
  25. package/dist/__tests__/agents/agentSearchBatchPlanner.test.js.map +1 -0
  26. package/dist/__tests__/agents/agentSearchOwnership.test.js +166 -0
  27. package/dist/__tests__/agents/agentSearchOwnership.test.js.map +1 -0
  28. package/dist/__tests__/agents/agentSearchRanking.test.js +139 -0
  29. package/dist/__tests__/agents/agentSearchRanking.test.js.map +1 -0
  30. package/dist/__tests__/agents/agentSearchRouting.test.js +584 -0
  31. package/dist/__tests__/agents/agentSearchRouting.test.js.map +1 -0
  32. package/dist/__tests__/agents/agentSearchScoring.test.js +23 -0
  33. package/dist/__tests__/agents/agentSearchScoring.test.js.map +1 -0
  34. package/dist/__tests__/agents/agentSearchShared.test.js +78 -0
  35. package/dist/__tests__/agents/agentSearchShared.test.js.map +1 -0
  36. package/dist/__tests__/agents/agentStateMachine.test.js +58 -0
  37. package/dist/__tests__/agents/agentStateMachine.test.js.map +1 -0
  38. package/dist/__tests__/agents/agentTaskPersistence.test.js +156 -0
  39. package/dist/__tests__/agents/agentTaskPersistence.test.js.map +1 -0
  40. package/dist/__tests__/agents/agentTools.test.js +69 -0
  41. package/dist/__tests__/agents/agentTools.test.js.map +1 -0
  42. package/dist/__tests__/agents/agentTransform.test.js +779 -0
  43. package/dist/__tests__/agents/agentTransform.test.js.map +1 -0
  44. package/dist/__tests__/agents/analysisPlanGenStep.test.js +157 -0
  45. package/dist/__tests__/agents/analysisPlanGenStep.test.js.map +1 -0
  46. package/dist/__tests__/agents/answerOnlyCompletion.test.js +75 -0
  47. package/dist/__tests__/agents/answerOnlyCompletion.test.js.map +1 -0
  48. package/dist/__tests__/agents/decideNextAction.test.js +1662 -0
  49. package/dist/__tests__/agents/decideNextAction.test.js.map +1 -0
  50. package/dist/__tests__/agents/deriveFocusFromSearchStep.test.js +258 -0
  51. package/dist/__tests__/agents/deriveFocusFromSearchStep.test.js.map +1 -0
  52. package/dist/__tests__/agents/evidenceVerifierStep.test.js +113 -0
  53. package/dist/__tests__/agents/evidenceVerifierStep.test.js.map +1 -0
  54. package/dist/__tests__/agents/executionPolicyResolver.test.js +208 -0
  55. package/dist/__tests__/agents/executionPolicyResolver.test.js.map +1 -0
  56. package/dist/__tests__/agents/fileCheckStep.test.js +299 -0
  57. package/dist/__tests__/agents/fileCheckStep.test.js.map +1 -0
  58. package/dist/__tests__/agents/giveUpEvaluatorStep.test.js +35 -0
  59. package/dist/__tests__/agents/giveUpEvaluatorStep.test.js.map +1 -0
  60. package/dist/__tests__/agents/guardState.test.js +297 -0
  61. package/dist/__tests__/agents/guardState.test.js.map +1 -0
  62. package/dist/__tests__/agents/mainAgentHeuristics.test.js +72 -0
  63. package/dist/__tests__/agents/mainAgentHeuristics.test.js.map +1 -0
  64. package/dist/__tests__/agents/objectiveEvaluatorStep.test.js +60 -0
  65. package/dist/__tests__/agents/objectiveEvaluatorStep.test.js.map +1 -0
  66. package/dist/__tests__/agents/outerLoopRecoveryEvaluator.test.js +207 -0
  67. package/dist/__tests__/agents/outerLoopRecoveryEvaluator.test.js.map +1 -0
  68. package/dist/__tests__/agents/prompting.test.js +363 -0
  69. package/dist/__tests__/agents/prompting.test.js.map +1 -0
  70. package/dist/__tests__/agents/readinessGateStep.test.js +180 -0
  71. package/dist/__tests__/agents/readinessGateStep.test.js.map +1 -0
  72. package/dist/__tests__/agents/reasonNextStep.test.js +56 -0
  73. package/dist/__tests__/agents/reasonNextStep.test.js.map +1 -0
  74. package/dist/__tests__/agents/reasonNextTaskStep.test.js +284 -0
  75. package/dist/__tests__/agents/reasonNextTaskStep.test.js.map +1 -0
  76. package/dist/__tests__/agents/resolveAgentTargetClassification.test.js +170 -0
  77. package/dist/__tests__/agents/resolveAgentTargetClassification.test.js.map +1 -0
  78. package/dist/__tests__/agents/resolveProgressState.test.js +526 -0
  79. package/dist/__tests__/agents/resolveProgressState.test.js.map +1 -0
  80. package/dist/__tests__/agents/resumeCheckpoint.test.js +50 -0
  81. package/dist/__tests__/agents/resumeCheckpoint.test.js.map +1 -0
  82. package/dist/__tests__/agents/routingDecisionStep.test.js +134 -0
  83. package/dist/__tests__/agents/routingDecisionStep.test.js.map +1 -0
  84. package/dist/__tests__/agents/scopeClassificationStep.test.js +118 -0
  85. package/dist/__tests__/agents/scopeClassificationStep.test.js.map +1 -0
  86. package/dist/__tests__/agents/searchContext.test.js +97 -0
  87. package/dist/__tests__/agents/searchContext.test.js.map +1 -0
  88. package/dist/__tests__/agents/selectRelevantSourcesStep.test.js +73 -0
  89. package/dist/__tests__/agents/selectRelevantSourcesStep.test.js.map +1 -0
  90. package/dist/__tests__/agents/structuredOutput.test.js +45 -0
  91. package/dist/__tests__/agents/structuredOutput.test.js.map +1 -0
  92. package/dist/__tests__/agents/transformPlanGenStep.fallback.test.js +59 -0
  93. package/dist/__tests__/agents/transformPlanGenStep.fallback.test.js.map +1 -0
  94. package/dist/__tests__/agents/transformPlanGenStep.test.js +92 -0
  95. package/dist/__tests__/agents/transformPlanGenStep.test.js.map +1 -0
  96. package/dist/__tests__/agents/understandIntentStep.test.js +237 -0
  97. package/dist/__tests__/agents/understandIntentStep.test.js.map +1 -0
  98. package/dist/__tests__/agents/understandResumeContext.test.js +65 -0
  99. package/dist/__tests__/agents/understandResumeContext.test.js.map +1 -0
  100. package/dist/__tests__/agents/understandScope.test.js +227 -0
  101. package/dist/__tests__/agents/understandScope.test.js.map +1 -0
  102. package/dist/__tests__/agents/validateChangesStep.test.js +52 -0
  103. package/dist/__tests__/agents/validateChangesStep.test.js.map +1 -0
  104. package/dist/__tests__/askCommandTaskBinding.test.js +176 -0
  105. package/dist/__tests__/askCommandTaskBinding.test.js.map +1 -0
  106. package/dist/__tests__/commandVisibility.test.js +25 -0
  107. package/dist/__tests__/commandVisibility.test.js.map +1 -0
  108. package/dist/__tests__/config.devOutput.test.js +82 -0
  109. package/dist/__tests__/config.devOutput.test.js.map +1 -0
  110. package/dist/__tests__/currentContext.test.js +43 -0
  111. package/dist/__tests__/currentContext.test.js.map +1 -0
  112. package/dist/__tests__/daemonWorker.test.js +51 -0
  113. package/dist/__tests__/daemonWorker.test.js.map +1 -0
  114. package/dist/__tests__/dialogState.test.js +113 -0
  115. package/dist/__tests__/dialogState.test.js.map +1 -0
  116. package/dist/__tests__/evalCommands.test.js +506 -0
  117. package/dist/__tests__/evalCommands.test.js.map +1 -0
  118. package/dist/__tests__/evalCommandsSummary.test.js +68 -0
  119. package/dist/__tests__/evalCommandsSummary.test.js.map +1 -0
  120. package/dist/__tests__/example.test.js +1 -0
  121. package/dist/__tests__/example.test.js.map +1 -0
  122. package/dist/__tests__/factory.commitCommand.test.js +45 -0
  123. package/dist/__tests__/factory.commitCommand.test.js.map +1 -0
  124. package/dist/__tests__/factory.devOutputCommand.test.js +122 -0
  125. package/dist/__tests__/factory.devOutputCommand.test.js.map +1 -0
  126. package/dist/__tests__/factory.evalCommands.test.js +38 -0
  127. package/dist/__tests__/factory.evalCommands.test.js.map +1 -0
  128. package/dist/__tests__/factory.planCommand.test.js +35 -0
  129. package/dist/__tests__/factory.planCommand.test.js.map +1 -0
  130. package/dist/__tests__/factory.setupCommand.test.js +34 -0
  131. package/dist/__tests__/factory.setupCommand.test.js.map +1 -0
  132. package/dist/__tests__/factory.statusCommand.test.js +54 -0
  133. package/dist/__tests__/factory.statusCommand.test.js.map +1 -0
  134. package/dist/__tests__/fileRules/queryTokenRules.test.js +35 -0
  135. package/dist/__tests__/fileRules/queryTokenRules.test.js.map +1 -0
  136. package/dist/__tests__/fileRules/searchPathClassification.test.js +57 -0
  137. package/dist/__tests__/fileRules/searchPathClassification.test.js.map +1 -0
  138. package/dist/__tests__/generate.ollamaRecovery.test.js +344 -0
  139. package/dist/__tests__/generate.ollamaRecovery.test.js.map +1 -0
  140. package/dist/__tests__/index.modelStartup.test.js +24 -0
  141. package/dist/__tests__/index.modelStartup.test.js.map +1 -0
  142. package/dist/__tests__/indexCmd.test.js +85 -0
  143. package/dist/__tests__/indexCmd.test.js.map +1 -0
  144. package/dist/__tests__/indexSlashCommand.test.js +50 -0
  145. package/dist/__tests__/indexSlashCommand.test.js.map +1 -0
  146. package/dist/__tests__/ollamaService.test.js +103 -0
  147. package/dist/__tests__/ollamaService.test.js.map +1 -0
  148. package/dist/__tests__/pipeline/modules/codeTransformModule.small-file.test.js +68 -0
  149. package/dist/__tests__/pipeline/modules/codeTransformModule.small-file.test.js.map +1 -0
  150. package/dist/__tests__/pipeline/modules/commitSuggesterModule.test.js +68 -0
  151. package/dist/__tests__/pipeline/modules/commitSuggesterModule.test.js.map +1 -0
  152. package/dist/__tests__/pipeline/modules/fileSearchModule.test.js +284 -0
  153. package/dist/__tests__/pipeline/modules/fileSearchModule.test.js.map +1 -0
  154. package/dist/__tests__/pipeline/modules/finalAnswerModule.test.js +1139 -0
  155. package/dist/__tests__/pipeline/modules/finalAnswerModule.test.js.map +1 -0
  156. package/dist/__tests__/pipeline/modules/readFileModule.test.js +146 -0
  157. package/dist/__tests__/pipeline/modules/readFileModule.test.js.map +1 -0
  158. package/dist/__tests__/pipeline/modules/semanticAnalysisModule.test.js +192 -0
  159. package/dist/__tests__/pipeline/modules/semanticAnalysisModule.test.js.map +1 -0
  160. package/dist/__tests__/repoIdentity.test.js +31 -0
  161. package/dist/__tests__/repoIdentity.test.js.map +1 -0
  162. package/dist/__tests__/resumeContext.test.js +87 -0
  163. package/dist/__tests__/resumeContext.test.js.map +1 -0
  164. package/dist/__tests__/resumeState.test.js +239 -0
  165. package/dist/__tests__/resumeState.test.js.map +1 -0
  166. package/dist/__tests__/search/SearchOrchestrator.test.js +836 -0
  167. package/dist/__tests__/search/SearchOrchestrator.test.js.map +1 -0
  168. package/dist/__tests__/shellDialogUi.test.js +52 -0
  169. package/dist/__tests__/shellDialogUi.test.js.map +1 -0
  170. package/dist/__tests__/shellSession.test.js +102 -0
  171. package/dist/__tests__/shellSession.test.js.map +1 -0
  172. package/dist/__tests__/statusOwner.test.js +215 -0
  173. package/dist/__tests__/statusOwner.test.js.map +1 -0
  174. package/dist/__tests__/testing/contextEval.test.js +244 -0
  175. package/dist/__tests__/testing/contextEval.test.js.map +1 -0
  176. package/dist/__tests__/testing/harnessArtifacts.test.js +124 -0
  177. package/dist/__tests__/testing/harnessArtifacts.test.js.map +1 -0
  178. package/dist/__tests__/testing/llmTraceSession.test.js +67 -0
  179. package/dist/__tests__/testing/llmTraceSession.test.js.map +1 -0
  180. package/dist/__tests__/testing/registerDevCliCommands.test.js +35 -0
  181. package/dist/__tests__/testing/registerDevCliCommands.test.js.map +1 -0
  182. package/dist/__tests__/testing/runDiagnosis.test.js +159 -0
  183. package/dist/__tests__/testing/runDiagnosis.test.js.map +1 -0
  184. package/dist/__tests__/testing/runtimeLogReader.test.js +66 -0
  185. package/dist/__tests__/testing/runtimeLogReader.test.js.map +1 -0
  186. package/dist/__tests__/testing/testCommands.test.js +53 -0
  187. package/dist/__tests__/testing/testCommands.test.js.map +1 -0
  188. package/dist/__tests__/utils/compileSearchQuery.test.js +38 -0
  189. package/dist/__tests__/utils/compileSearchQuery.test.js.map +1 -0
  190. package/dist/__tests__/utils/consolePresentation.test.js +105 -0
  191. package/dist/__tests__/utils/consolePresentation.test.js.map +1 -0
  192. package/dist/__tests__/utils/extractFileReferences.test.js +41 -0
  193. package/dist/__tests__/utils/extractFileReferences.test.js.map +1 -0
  194. package/dist/__tests__/utils/log.test.js +34 -0
  195. package/dist/__tests__/utils/log.test.js.map +1 -0
  196. package/dist/__tests__/utils/runtimeLogger.test.js +200 -0
  197. package/dist/__tests__/utils/runtimeLogger.test.js.map +1 -0
  198. package/dist/__tests__/utils/spinner.test.js +31 -0
  199. package/dist/__tests__/utils/spinner.test.js.map +1 -0
  200. package/dist/__tests__/utils/verifyFocusPreference.test.js +41 -0
  201. package/dist/__tests__/utils/verifyFocusPreference.test.js.map +1 -0
  202. package/dist/agent/actions/index.js +301 -0
  203. package/dist/agent/actions/index.js.map +1 -0
  204. package/dist/agent/actions/normalize.js +360 -0
  205. package/dist/agent/actions/normalize.js.map +1 -0
  206. package/dist/agent/actions/schemas.js +129 -0
  207. package/dist/agent/actions/schemas.js.map +1 -0
  208. package/dist/agent/evidence/index.js +320 -0
  209. package/dist/agent/evidence/index.js.map +1 -0
  210. package/dist/agent/feedback/index.js +187 -0
  211. package/dist/agent/feedback/index.js.map +1 -0
  212. package/dist/agent/finalization/index.js +35 -0
  213. package/dist/agent/finalization/index.js.map +1 -0
  214. package/dist/agent/index.js +126 -0
  215. package/dist/agent/index.js.map +1 -0
  216. package/dist/agent/logging/index.js +350 -0
  217. package/dist/agent/logging/index.js.map +1 -0
  218. package/dist/agent/persistence/boot.js +58 -0
  219. package/dist/agent/persistence/boot.js.map +1 -0
  220. package/dist/agent/persistence/currentTask.js +36 -0
  221. package/dist/agent/persistence/currentTask.js.map +1 -0
  222. package/dist/agent/persistence/hydrate.js +42 -0
  223. package/dist/agent/persistence/hydrate.js.map +1 -0
  224. package/dist/agent/persistence/index.js +15 -0
  225. package/dist/agent/persistence/index.js.map +1 -0
  226. package/dist/agent/persistence/snapshots.js +97 -0
  227. package/dist/agent/persistence/snapshots.js.map +1 -0
  228. package/dist/agent/persistence/steps.js +95 -0
  229. package/dist/agent/persistence/steps.js.map +1 -0
  230. package/dist/agent/persistence/tasks.js +195 -0
  231. package/dist/agent/persistence/tasks.js.map +1 -0
  232. package/dist/agent/persistence/turns.js +92 -0
  233. package/dist/agent/persistence/turns.js.map +1 -0
  234. package/dist/agent/policy/ambiguityResolution.js +226 -0
  235. package/dist/agent/policy/ambiguityResolution.js.map +1 -0
  236. package/dist/agent/policy/contracts.js +2 -0
  237. package/dist/agent/policy/contracts.js.map +1 -0
  238. package/dist/agent/policy/coveragePolicy.js +309 -0
  239. package/dist/agent/policy/coveragePolicy.js.map +1 -0
  240. package/dist/agent/policy/endDecisionPolicy.js +31 -0
  241. package/dist/agent/policy/endDecisionPolicy.js.map +1 -0
  242. package/dist/agent/policy/index.js +344 -0
  243. package/dist/agent/policy/index.js.map +1 -0
  244. package/dist/agent/policy/loopReview.js +778 -0
  245. package/dist/agent/policy/loopReview.js.map +1 -0
  246. package/dist/agent/policy/readinessPolicy.js +108 -0
  247. package/dist/agent/policy/readinessPolicy.js.map +1 -0
  248. package/dist/agent/policy/resolutionPipeline.js +356 -0
  249. package/dist/agent/policy/resolutionPipeline.js.map +1 -0
  250. package/dist/agent/policy/targetClassification.js +33 -0
  251. package/dist/agent/policy/targetClassification.js.map +1 -0
  252. package/dist/agent/prompting/actionChoice.js +90 -0
  253. package/dist/agent/prompting/actionChoice.js.map +1 -0
  254. package/dist/agent/prompting/finalAnswer.js +38 -0
  255. package/dist/agent/prompting/finalAnswer.js.map +1 -0
  256. package/dist/agent/prompting/index.js +14 -0
  257. package/dist/agent/prompting/index.js.map +1 -0
  258. package/dist/agent/prompting/plan.js +59 -0
  259. package/dist/agent/prompting/plan.js.map +1 -0
  260. package/dist/agent/prompting/transform.js +175 -0
  261. package/dist/agent/prompting/transform.js.map +1 -0
  262. package/dist/agent/prompting/understand.js +70 -0
  263. package/dist/agent/prompting/understand.js.map +1 -0
  264. package/dist/agent/read/freshness.js +29 -0
  265. package/dist/agent/read/freshness.js.map +1 -0
  266. package/dist/agent/read/fullReadPrompt.js +43 -0
  267. package/dist/agent/read/fullReadPrompt.js.map +1 -0
  268. package/dist/agent/read/index.js +140 -0
  269. package/dist/agent/read/index.js.map +1 -0
  270. package/dist/agent/read/persistence.js +88 -0
  271. package/dist/agent/read/persistence.js.map +1 -0
  272. package/dist/agent/read/summarizeReadEvidence.js +733 -0
  273. package/dist/agent/read/summarizeReadEvidence.js.map +1 -0
  274. package/dist/agent/read/targetResolution.js +126 -0
  275. package/dist/agent/read/targetResolution.js.map +1 -0
  276. package/dist/agent/resume/checkpoint.js +41 -0
  277. package/dist/agent/resume/checkpoint.js.map +1 -0
  278. package/dist/agent/runtime/lifecycle.js +67 -0
  279. package/dist/agent/runtime/lifecycle.js.map +1 -0
  280. package/dist/agent/runtime/progress.js +178 -0
  281. package/dist/agent/runtime/progress.js.map +1 -0
  282. package/dist/agent/runtime/runAgentLoop.js +402 -0
  283. package/dist/agent/runtime/runAgentLoop.js.map +1 -0
  284. package/dist/agent/runtime/runAgentPlanOnly.js +127 -0
  285. package/dist/agent/runtime/runAgentPlanOnly.js.map +1 -0
  286. package/dist/agent/runtime/understand.js +336 -0
  287. package/dist/agent/runtime/understand.js.map +1 -0
  288. package/dist/agent/search/batchPlanner.js +274 -0
  289. package/dist/agent/search/batchPlanner.js.map +1 -0
  290. package/dist/agent/search/candidateRetentionPolicy.js +184 -0
  291. package/dist/agent/search/candidateRetentionPolicy.js.map +1 -0
  292. package/dist/agent/search/directory.js +51 -0
  293. package/dist/agent/search/directory.js.map +1 -0
  294. package/dist/agent/search/exactTarget.js +151 -0
  295. package/dist/agent/search/exactTarget.js.map +1 -0
  296. package/dist/agent/search/fragment.js +110 -0
  297. package/dist/agent/search/fragment.js.map +1 -0
  298. package/dist/agent/search/index.js +166 -0
  299. package/dist/agent/search/index.js.map +1 -0
  300. package/dist/agent/search/laneClassifier.js +119 -0
  301. package/dist/agent/search/laneClassifier.js.map +1 -0
  302. package/dist/agent/search/limits.js +10 -0
  303. package/dist/agent/search/limits.js.map +1 -0
  304. package/dist/agent/search/ranking.js +22 -0
  305. package/dist/agent/search/ranking.js.map +1 -0
  306. package/dist/agent/search/regex.js +83 -0
  307. package/dist/agent/search/regex.js.map +1 -0
  308. package/dist/agent/search/routePolicy.js +11 -0
  309. package/dist/agent/search/routePolicy.js.map +1 -0
  310. package/dist/agent/search/searchContext.js +128 -0
  311. package/dist/agent/search/searchContext.js.map +1 -0
  312. package/dist/agent/search/semantic.js +113 -0
  313. package/dist/agent/search/semantic.js.map +1 -0
  314. package/dist/agent/search/semanticIndexSearch.js +202 -0
  315. package/dist/agent/search/semanticIndexSearch.js.map +1 -0
  316. package/dist/agent/search/shared.js +283 -0
  317. package/dist/agent/search/shared.js.map +1 -0
  318. package/dist/agent/search/shell.js +202 -0
  319. package/dist/agent/search/shell.js.map +1 -0
  320. package/dist/agent/search/snippetEvidence.js +57 -0
  321. package/dist/agent/search/snippetEvidence.js.map +1 -0
  322. package/dist/agent/search/types.js +2 -0
  323. package/dist/agent/search/types.js.map +1 -0
  324. package/dist/agent/state/index.js +99 -0
  325. package/dist/agent/state/index.js.map +1 -0
  326. package/dist/agent/state/memory.js +56 -0
  327. package/dist/agent/state/memory.js.map +1 -0
  328. package/dist/agent/structuredOutput/index.js +28 -0
  329. package/dist/agent/structuredOutput/index.js.map +1 -0
  330. package/dist/agent/tools/index.js +199 -0
  331. package/dist/agent/tools/index.js.map +1 -0
  332. package/dist/agent/transform/index.js +519 -0
  333. package/dist/agent/transform/index.js.map +1 -0
  334. package/dist/agent/transform/syntax.js +49 -0
  335. package/dist/agent/transform/syntax.js.map +1 -0
  336. package/dist/agent/types.js +20 -0
  337. package/dist/agent/types.js.map +1 -0
  338. package/dist/agents/actionRegistry.js +114 -0
  339. package/dist/agents/actionRegistry.js.map +1 -0
  340. package/dist/agents/agent.js +5 -0
  341. package/dist/agents/agent.js.map +1 -0
  342. package/dist/agents/agentActions.js +5 -0
  343. package/dist/agents/agentActions.js.map +1 -0
  344. package/dist/agents/agentEvidence.js +5 -0
  345. package/dist/agents/agentEvidence.js.map +1 -0
  346. package/dist/agents/agentFeedback.js +5 -0
  347. package/dist/agents/agentFeedback.js.map +1 -0
  348. package/dist/agents/agentLogging.js +5 -0
  349. package/dist/agents/agentLogging.js.map +1 -0
  350. package/dist/agents/agentLoop.js +5 -0
  351. package/dist/agents/agentLoop.js.map +1 -0
  352. package/dist/agents/agentMemory.js +5 -0
  353. package/dist/agents/agentMemory.js.map +1 -0
  354. package/dist/agents/agentPlanMode.js +5 -0
  355. package/dist/agents/agentPlanMode.js.map +1 -0
  356. package/dist/agents/agentPolicyState.js +5 -0
  357. package/dist/agents/agentPolicyState.js.map +1 -0
  358. package/dist/agents/agentProgress.js +93 -0
  359. package/dist/agents/agentProgress.js.map +1 -0
  360. package/dist/agents/agentSchemas.js +5 -0
  361. package/dist/agents/agentSchemas.js.map +1 -0
  362. package/dist/agents/agentSearchScoring.js +5 -0
  363. package/dist/agents/agentSearchScoring.js.map +1 -0
  364. package/dist/agents/agentStateMachine.js +5 -0
  365. package/dist/agents/agentStateMachine.js.map +1 -0
  366. package/dist/agents/agentTools.js +5 -0
  367. package/dist/agents/agentTools.js.map +1 -0
  368. package/dist/agents/agentTypes.js +5 -0
  369. package/dist/agents/agentTypes.js.map +1 -0
  370. package/dist/agents/agentUnderstand.js +5 -0
  371. package/dist/agents/agentUnderstand.js.map +1 -0
  372. package/dist/agents/analysisPlanGenStep.js +194 -17
  373. package/dist/agents/analysisPlanGenStep.js.map +1 -0
  374. package/dist/agents/answerOnlyCompletion.js +32 -0
  375. package/dist/agents/answerOnlyCompletion.js.map +1 -0
  376. package/dist/agents/collaboratorStep.js +1 -0
  377. package/dist/agents/collaboratorStep.js.map +1 -0
  378. package/dist/agents/decideNextAction.js +444 -0
  379. package/dist/agents/decideNextAction.js.map +1 -0
  380. package/dist/agents/deriveFocusFromSearchStep.js +83 -0
  381. package/dist/agents/deriveFocusFromSearchStep.js.map +1 -0
  382. package/dist/agents/evidenceVerifierStep.js +104 -13
  383. package/dist/agents/evidenceVerifierStep.js.map +1 -0
  384. package/dist/agents/fileCheckStep.js +381 -12
  385. package/dist/agents/fileCheckStep.js.map +1 -0
  386. package/dist/agents/giveUpEvaluatorStep.js +63 -0
  387. package/dist/agents/giveUpEvaluatorStep.js.map +1 -0
  388. package/dist/agents/guardPolicy.js +20 -0
  389. package/dist/agents/guardPolicy.js.map +1 -0
  390. package/dist/agents/guards/executionPolicyResolver.js +165 -0
  391. package/dist/agents/guards/executionPolicyResolver.js.map +1 -0
  392. package/dist/agents/guards/guardState.js +195 -0
  393. package/dist/agents/guards/guardState.js.map +1 -0
  394. package/dist/agents/guards/resolveProgressState.js +403 -0
  395. package/dist/agents/guards/resolveProgressState.js.map +1 -0
  396. package/dist/agents/infoPlanGenStep.js +66 -8
  397. package/dist/agents/infoPlanGenStep.js.map +1 -0
  398. package/dist/agents/integrateFeedbackStep.js +1 -0
  399. package/dist/agents/integrateFeedbackStep.js.map +1 -0
  400. package/dist/agents/iterationFileSelector.js +8 -7
  401. package/dist/agents/iterationFileSelector.js.map +1 -0
  402. package/dist/agents/mainAgentActivityLog.js +85 -0
  403. package/dist/agents/mainAgentActivityLog.js.map +1 -0
  404. package/dist/agents/mainAgentHeuristics.js +173 -0
  405. package/dist/agents/mainAgentHeuristics.js.map +1 -0
  406. package/dist/agents/mainAgentVerify.js +159 -0
  407. package/dist/agents/mainAgentVerify.js.map +1 -0
  408. package/dist/agents/objectiveEvaluatorStep.js +103 -0
  409. package/dist/agents/objectiveEvaluatorStep.js.map +1 -0
  410. package/dist/agents/outerLoopRecoveryEvaluator.js +108 -0
  411. package/dist/agents/outerLoopRecoveryEvaluator.js.map +1 -0
  412. package/dist/agents/readinessGateStep.js +95 -9
  413. package/dist/agents/readinessGateStep.js.map +1 -0
  414. package/dist/agents/reasonNextStep.js +9 -8
  415. package/dist/agents/reasonNextStep.js.map +1 -0
  416. package/dist/agents/reasonNextTaskStep.js +267 -144
  417. package/dist/agents/reasonNextTaskStep.js.map +1 -0
  418. package/dist/agents/researchPlanGenStep.js +61 -25
  419. package/dist/agents/researchPlanGenStep.js.map +1 -0
  420. package/dist/agents/resolveAgentTargetClassification.js +5 -0
  421. package/dist/agents/resolveAgentTargetClassification.js.map +1 -0
  422. package/dist/agents/resolveExecutionModeStep.js +1 -0
  423. package/dist/agents/resolveExecutionModeStep.js.map +1 -0
  424. package/dist/agents/resolveExplicitTargetsStep.js +74 -0
  425. package/dist/agents/resolveExplicitTargetsStep.js.map +1 -0
  426. package/dist/agents/routingDecisionStep.js +58 -11
  427. package/dist/agents/routingDecisionStep.js.map +1 -0
  428. package/dist/agents/scopeClassificationStep.js +66 -3
  429. package/dist/agents/scopeClassificationStep.js.map +1 -0
  430. package/dist/agents/selectRelevantSourcesStep.js +13 -5
  431. package/dist/agents/selectRelevantSourcesStep.js.map +1 -0
  432. package/dist/agents/structuralPreloadStep.js +3 -4
  433. package/dist/agents/structuralPreloadStep.js.map +1 -0
  434. package/dist/agents/transformPlanGenStep.js +105 -18
  435. package/dist/agents/transformPlanGenStep.js.map +1 -0
  436. package/dist/agents/understandIntentStep.js +237 -17
  437. package/dist/agents/understandIntentStep.js.map +1 -0
  438. package/dist/agents/validateChangesStep.js +16 -2
  439. package/dist/agents/validateChangesStep.js.map +1 -0
  440. package/dist/agents/writeFileStep.js +1 -0
  441. package/dist/agents/writeFileStep.js.map +1 -0
  442. package/dist/commands/AskCmd.js +139 -44
  443. package/dist/commands/AskCmd.js.map +1 -0
  444. package/dist/commands/BackupCmd.js +1 -0
  445. package/dist/commands/BackupCmd.js.map +1 -0
  446. package/dist/commands/ChangeLogUpdateCmd.js +1 -0
  447. package/dist/commands/ChangeLogUpdateCmd.js.map +1 -0
  448. package/dist/commands/CommitSuggesterCmd.js +55 -13
  449. package/dist/commands/CommitSuggesterCmd.js.map +1 -0
  450. package/dist/commands/DaemonCmd.js +52 -14
  451. package/dist/commands/DaemonCmd.js.map +1 -0
  452. package/dist/commands/DeleteIndex.js +1 -0
  453. package/dist/commands/DeleteIndex.js.map +1 -0
  454. package/dist/commands/EvalReportCmd.js +374 -0
  455. package/dist/commands/EvalReportCmd.js.map +1 -0
  456. package/dist/commands/FindCmd.js +1 -0
  457. package/dist/commands/FindCmd.js.map +1 -0
  458. package/dist/commands/GitCmd.js +1 -0
  459. package/dist/commands/GitCmd.js.map +1 -0
  460. package/dist/commands/IndexCmd.js +11 -79
  461. package/dist/commands/IndexCmd.js.map +1 -0
  462. package/dist/commands/InspectCmd.js +1 -0
  463. package/dist/commands/InspectCmd.js.map +1 -0
  464. package/dist/commands/ModelCmd.js +24 -0
  465. package/dist/commands/ModelCmd.js.map +1 -0
  466. package/dist/commands/ReadlineSingleton.js +1 -0
  467. package/dist/commands/ReadlineSingleton.js.map +1 -0
  468. package/dist/commands/ResetDbCmd.js +18 -1
  469. package/dist/commands/ResetDbCmd.js.map +1 -0
  470. package/dist/commands/ReviewCmd.js +1 -0
  471. package/dist/commands/ReviewCmd.js.map +1 -0
  472. package/dist/commands/StatusCmd.js +22 -0
  473. package/dist/commands/StatusCmd.js.map +1 -0
  474. package/dist/commands/StopDaemonCmd.js +1 -0
  475. package/dist/commands/StopDaemonCmd.js.map +1 -0
  476. package/dist/commands/SummaryCmd.js +1 -0
  477. package/dist/commands/SummaryCmd.js.map +1 -0
  478. package/dist/commands/SwitchCmd.js +9 -15
  479. package/dist/commands/SwitchCmd.js.map +1 -0
  480. package/dist/commands/TasksCmd.js +142 -57
  481. package/dist/commands/TasksCmd.js.map +1 -0
  482. package/dist/commands/TestCmd.js +66 -0
  483. package/dist/commands/TestCmd.js.map +1 -0
  484. package/dist/commands/WorkflowCmd.js +1 -0
  485. package/dist/commands/WorkflowCmd.js.map +1 -0
  486. package/dist/commands/commandVisibility.js +27 -0
  487. package/dist/commands/commandVisibility.js.map +1 -0
  488. package/dist/commands/evalCommands.js +1337 -0
  489. package/dist/commands/evalCommands.js.map +1 -0
  490. package/dist/commands/factory.js +206 -38
  491. package/dist/commands/factory.js.map +1 -0
  492. package/dist/config.js +62 -11
  493. package/dist/config.js.map +1 -0
  494. package/dist/constants.js +21 -3
  495. package/dist/constants.js.map +1 -0
  496. package/dist/context.js +33 -32
  497. package/dist/context.js.map +1 -0
  498. package/dist/daemon/daemonQueues.js +1 -20
  499. package/dist/daemon/daemonQueues.js.map +1 -0
  500. package/dist/daemon/daemonWorker.js +26 -37
  501. package/dist/daemon/daemonWorker.js.map +1 -0
  502. package/dist/daemon/generateSummaries.js +1 -0
  503. package/dist/daemon/generateSummaries.js.map +1 -0
  504. package/dist/daemon/runFolderCapsuleBatch.js +1 -0
  505. package/dist/daemon/runFolderCapsuleBatch.js.map +1 -0
  506. package/dist/daemon/runIndexingBatch.js +1 -0
  507. package/dist/daemon/runIndexingBatch.js.map +1 -0
  508. package/dist/daemon/runKgBatch.js +9 -1
  509. package/dist/daemon/runKgBatch.js.map +1 -0
  510. package/dist/db/backup.js +1 -0
  511. package/dist/db/backup.js.map +1 -0
  512. package/dist/db/client.js +18 -3
  513. package/dist/db/client.js.map +1 -0
  514. package/dist/db/fileIndex.js +110 -152
  515. package/dist/db/fileIndex.js.map +1 -0
  516. package/dist/db/functionExtractors/extractFromJava.js +1 -0
  517. package/dist/db/functionExtractors/extractFromJava.js.map +1 -0
  518. package/dist/db/functionExtractors/extractFromJs.js +1 -0
  519. package/dist/db/functionExtractors/extractFromJs.js.map +1 -0
  520. package/dist/db/functionExtractors/extractFromTs.js +1 -0
  521. package/dist/db/functionExtractors/extractFromTs.js.map +1 -0
  522. package/dist/db/functionExtractors/extractFromXML.js +1 -0
  523. package/dist/db/functionExtractors/extractFromXML.js.map +1 -0
  524. package/dist/db/functionExtractors/index.js +1 -0
  525. package/dist/db/functionExtractors/index.js.map +1 -0
  526. package/dist/db/functionIndex.js +9 -0
  527. package/dist/db/functionIndex.js.map +1 -0
  528. package/dist/db/schema.js +314 -99
  529. package/dist/db/schema.js.map +1 -0
  530. package/dist/db/sqlTemplates.js +1 -0
  531. package/dist/db/sqlTemplates.js.map +1 -0
  532. package/dist/fileRules/builtins.js +1 -0
  533. package/dist/fileRules/builtins.js.map +1 -0
  534. package/dist/fileRules/classifyFile.js +1 -0
  535. package/dist/fileRules/classifyFile.js.map +1 -0
  536. package/dist/fileRules/codeAllowedExtensions.js +1 -0
  537. package/dist/fileRules/codeAllowedExtensions.js.map +1 -0
  538. package/dist/fileRules/detectFileType.js +1 -0
  539. package/dist/fileRules/detectFileType.js.map +1 -0
  540. package/dist/fileRules/fileClassifier.js +1 -0
  541. package/dist/fileRules/fileClassifier.js.map +1 -0
  542. package/dist/fileRules/fileExceptions.js +1 -0
  543. package/dist/fileRules/fileExceptions.js.map +1 -0
  544. package/dist/fileRules/ignoredExtensions.js +1 -0
  545. package/dist/fileRules/ignoredExtensions.js.map +1 -0
  546. package/dist/fileRules/ignoredPaths.js +48 -5
  547. package/dist/fileRules/ignoredPaths.js.map +1 -0
  548. package/dist/fileRules/queryTokenRules.js +176 -0
  549. package/dist/fileRules/queryTokenRules.js.map +1 -0
  550. package/dist/fileRules/searchPathClassification.js +58 -0
  551. package/dist/fileRules/searchPathClassification.js.map +1 -0
  552. package/dist/fileRules/shouldIgnoreFiles.js +1 -0
  553. package/dist/fileRules/shouldIgnoreFiles.js.map +1 -0
  554. package/dist/fileRules/stopWords.js +9 -0
  555. package/dist/fileRules/stopWords.js.map +1 -0
  556. package/dist/fileRules/wellKnownRepoFiles.js +1 -0
  557. package/dist/fileRules/wellKnownRepoFiles.js.map +1 -0
  558. package/dist/git/commitSummary.js +227 -0
  559. package/dist/git/commitSummary.js.map +1 -0
  560. package/dist/github/api.js +1 -0
  561. package/dist/github/api.js.map +1 -0
  562. package/dist/github/auth.js +1 -0
  563. package/dist/github/auth.js.map +1 -0
  564. package/dist/github/github.js +1 -0
  565. package/dist/github/github.js.map +1 -0
  566. package/dist/github/githubAuthCheck.js +1 -0
  567. package/dist/github/githubAuthCheck.js.map +1 -0
  568. package/dist/github/postComments.js +1 -0
  569. package/dist/github/postComments.js.map +1 -0
  570. package/dist/github/repo.js +15 -24
  571. package/dist/github/repo.js.map +1 -0
  572. package/dist/github/token.js +1 -0
  573. package/dist/github/token.js.map +1 -0
  574. package/dist/github/types.js +1 -0
  575. package/dist/github/types.js.map +1 -0
  576. package/dist/index.js +318 -37
  577. package/dist/index.js.map +1 -0
  578. package/dist/lib/generate.js +264 -20
  579. package/dist/lib/generate.js.map +1 -0
  580. package/dist/lib/generateFolderCapsules.js +1 -0
  581. package/dist/lib/generateFolderCapsules.js.map +1 -0
  582. package/dist/lib/ollamaModelPolicy.js +59 -0
  583. package/dist/lib/ollamaModelPolicy.js.map +1 -0
  584. package/dist/lib/spinner.js +29 -9
  585. package/dist/lib/spinner.js.map +1 -0
  586. package/dist/modelSetup.js +25 -78
  587. package/dist/modelSetup.js.map +1 -0
  588. package/dist/pipeline/modules/changeLogModule.js +10 -1
  589. package/dist/pipeline/modules/changeLogModule.js.map +1 -0
  590. package/dist/pipeline/modules/cleanupModule.js +1 -0
  591. package/dist/pipeline/modules/cleanupModule.js.map +1 -0
  592. package/dist/pipeline/modules/codeTransformModule.js +10 -16
  593. package/dist/pipeline/modules/codeTransformModule.js.map +1 -0
  594. package/dist/pipeline/modules/commentModule.js +12 -0
  595. package/dist/pipeline/modules/commentModule.js.map +1 -0
  596. package/dist/pipeline/modules/commitSuggesterModule.js +82 -12
  597. package/dist/pipeline/modules/commitSuggesterModule.js.map +1 -0
  598. package/dist/pipeline/modules/contextReviewModule.js +12 -1
  599. package/dist/pipeline/modules/contextReviewModule.js.map +1 -0
  600. package/dist/pipeline/modules/dialogAnswerModule.js +58 -0
  601. package/dist/pipeline/modules/dialogAnswerModule.js.map +1 -0
  602. package/dist/pipeline/modules/fileSearchModule.js +5 -143
  603. package/dist/pipeline/modules/fileSearchModule.js.map +1 -0
  604. package/dist/pipeline/modules/finalAnswerModule.js +1176 -151
  605. package/dist/pipeline/modules/finalAnswerModule.js.map +1 -0
  606. package/dist/pipeline/modules/kgModule.js +18 -1
  607. package/dist/pipeline/modules/kgModule.js.map +1 -0
  608. package/dist/pipeline/modules/planAnswerModule.js +99 -0
  609. package/dist/pipeline/modules/planAnswerModule.js.map +1 -0
  610. package/dist/pipeline/modules/readFileModule.js +300 -0
  611. package/dist/pipeline/modules/readFileModule.js.map +1 -0
  612. package/dist/pipeline/modules/reviewModule.js +10 -1
  613. package/dist/pipeline/modules/reviewModule.js.map +1 -0
  614. package/dist/pipeline/modules/searchDbModule.js +159 -0
  615. package/dist/pipeline/modules/searchDbModule.js.map +1 -0
  616. package/dist/pipeline/modules/searchListDirectoryModule.js +62 -0
  617. package/dist/pipeline/modules/searchListDirectoryModule.js.map +1 -0
  618. package/dist/pipeline/modules/searchModuleShared.js +71 -0
  619. package/dist/pipeline/modules/searchModuleShared.js.map +1 -0
  620. package/dist/pipeline/modules/searchRegexModule.js +59 -0
  621. package/dist/pipeline/modules/searchRegexModule.js.map +1 -0
  622. package/dist/pipeline/modules/semanticAnalysisModule.js +185 -28
  623. package/dist/pipeline/modules/semanticAnalysisModule.js.map +1 -0
  624. package/dist/pipeline/modules/summaryModule.js +11 -1
  625. package/dist/pipeline/modules/summaryModule.js.map +1 -0
  626. package/dist/pipeline/registry/moduleRegistry.js +9 -0
  627. package/dist/pipeline/registry/moduleRegistry.js.map +1 -0
  628. package/dist/pipeline/runModulePipeline.js +1 -0
  629. package/dist/pipeline/runModulePipeline.js.map +1 -0
  630. package/dist/scripts/dbScriptSupport.js +172 -0
  631. package/dist/scripts/dbScriptSupport.js.map +1 -0
  632. package/dist/scripts/dbcheck.js +173 -267
  633. package/dist/scripts/dbcheck.js.map +1 -0
  634. package/dist/scripts/dboverview.js +161 -0
  635. package/dist/scripts/dboverview.js.map +1 -0
  636. package/dist/scripts/migrateDb.js +1 -0
  637. package/dist/scripts/migrateDb.js.map +1 -0
  638. package/dist/search/SearchOrchestrator.js +928 -0
  639. package/dist/search/SearchOrchestrator.js.map +1 -0
  640. package/dist/search/sharedRankingPolicy.js +283 -0
  641. package/dist/search/sharedRankingPolicy.js.map +1 -0
  642. package/dist/setup/reindexOwner.js +97 -0
  643. package/dist/setup/reindexOwner.js.map +1 -0
  644. package/dist/setup/setupOwner.js +100 -0
  645. package/dist/setup/setupOwner.js.map +1 -0
  646. package/dist/shell/dialogUi.js +81 -0
  647. package/dist/shell/dialogUi.js.map +1 -0
  648. package/dist/shellSession.js +126 -0
  649. package/dist/shellSession.js.map +1 -0
  650. package/dist/status/statusOwner.js +239 -0
  651. package/dist/status/statusOwner.js.map +1 -0
  652. package/dist/testing/contextEval.js +514 -0
  653. package/dist/testing/contextEval.js.map +1 -0
  654. package/dist/testing/fixtures/transform/small-file.input.js +5 -0
  655. package/dist/testing/fixtures/transform/small-file.input.js.map +1 -0
  656. package/dist/testing/harnessArtifacts.js +112 -0
  657. package/dist/testing/harnessArtifacts.js.map +1 -0
  658. package/dist/testing/llmTraceSession.js +67 -0
  659. package/dist/testing/llmTraceSession.js.map +1 -0
  660. package/dist/testing/registerDevCliCommands.js +43 -0
  661. package/dist/testing/registerDevCliCommands.js.map +1 -0
  662. package/dist/testing/runDiagnosis.js +248 -0
  663. package/dist/testing/runDiagnosis.js.map +1 -0
  664. package/dist/testing/runtimeLogReader.js +144 -0
  665. package/dist/testing/runtimeLogReader.js.map +1 -0
  666. package/dist/testing/testCommands.js +35 -303
  667. package/dist/testing/testCommands.js.map +1 -0
  668. package/dist/testing/testRegistry.js +233 -0
  669. package/dist/testing/testRegistry.js.map +1 -0
  670. package/dist/types.js +1 -0
  671. package/dist/types.js.map +1 -0
  672. package/dist/utils/buildContextualPrompt.js +26 -75
  673. package/dist/utils/buildContextualPrompt.js.map +1 -0
  674. package/dist/utils/changeLogPrompt.js +1 -0
  675. package/dist/utils/changeLogPrompt.js.map +1 -0
  676. package/dist/utils/checkModel.js +17 -92
  677. package/dist/utils/checkModel.js.map +1 -0
  678. package/dist/utils/commentMap.js +1 -0
  679. package/dist/utils/commentMap.js.map +1 -0
  680. package/dist/utils/compileSearchQuery.js +23 -9
  681. package/dist/utils/compileSearchQuery.js.map +1 -0
  682. package/dist/utils/consolePresentation.js +208 -0
  683. package/dist/utils/consolePresentation.js.map +1 -0
  684. package/dist/utils/contentUtils.js +17 -2
  685. package/dist/utils/contentUtils.js.map +1 -0
  686. package/dist/utils/debugContext.js +1 -0
  687. package/dist/utils/debugContext.js.map +1 -0
  688. package/dist/utils/dialogState.js +201 -0
  689. package/dist/utils/dialogState.js.map +1 -0
  690. package/dist/utils/editor.js +1 -0
  691. package/dist/utils/editor.js.map +1 -0
  692. package/dist/utils/executionEvidence.js +50 -0
  693. package/dist/utils/executionEvidence.js.map +1 -0
  694. package/dist/utils/extractFileReferences.js +140 -6
  695. package/dist/utils/extractFileReferences.js.map +1 -0
  696. package/dist/utils/fileEvidenceCache.js +50 -0
  697. package/dist/utils/fileEvidenceCache.js.map +1 -0
  698. package/dist/utils/fileTree.js +1 -0
  699. package/dist/utils/fileTree.js.map +1 -0
  700. package/dist/utils/loadRelevantFolderCapsules.js +35 -5
  701. package/dist/utils/loadRelevantFolderCapsules.js.map +1 -0
  702. package/dist/utils/log.js +10 -1
  703. package/dist/utils/log.js.map +1 -0
  704. package/dist/utils/normalizeData.js +1 -0
  705. package/dist/utils/normalizeData.js.map +1 -0
  706. package/dist/utils/ollamaModelStatus.js +28 -0
  707. package/dist/utils/ollamaModelStatus.js.map +1 -0
  708. package/dist/utils/ollamaService.js +294 -0
  709. package/dist/utils/ollamaService.js.map +1 -0
  710. package/dist/utils/outputFormatter.js +1 -0
  711. package/dist/utils/outputFormatter.js.map +1 -0
  712. package/dist/utils/parseTaggedContent.js +1 -0
  713. package/dist/utils/parseTaggedContent.js.map +1 -0
  714. package/dist/utils/planActions.js +27 -46
  715. package/dist/utils/planActions.js.map +1 -0
  716. package/dist/utils/promptBuilderHelper.js +1 -0
  717. package/dist/utils/promptBuilderHelper.js.map +1 -0
  718. package/dist/utils/promptLogHelper.js +29 -13
  719. package/dist/utils/promptLogHelper.js.map +1 -0
  720. package/dist/utils/queryAnchors.js +71 -0
  721. package/dist/utils/queryAnchors.js.map +1 -0
  722. package/dist/utils/repoIdentity.js +82 -0
  723. package/dist/utils/repoIdentity.js.map +1 -0
  724. package/dist/utils/repoKey.js +1 -0
  725. package/dist/utils/repoKey.js.map +1 -0
  726. package/dist/utils/resolveTargetsToFiles.js +1 -0
  727. package/dist/utils/resolveTargetsToFiles.js.map +1 -0
  728. package/dist/utils/resumeContext.js +219 -0
  729. package/dist/utils/resumeContext.js.map +1 -0
  730. package/dist/utils/resumeState.js +310 -0
  731. package/dist/utils/resumeState.js.map +1 -0
  732. package/dist/utils/rollingPlan.js +118 -0
  733. package/dist/utils/rollingPlan.js.map +1 -0
  734. package/dist/utils/runQueryWithDaemonControl.js +11 -3
  735. package/dist/utils/runQueryWithDaemonControl.js.map +1 -0
  736. package/dist/utils/runtimeLogger.js +252 -0
  737. package/dist/utils/runtimeLogger.js.map +1 -0
  738. package/dist/utils/sanitizeQuery.js +1 -0
  739. package/dist/utils/sanitizeQuery.js.map +1 -0
  740. package/dist/utils/sharedUtils.js +1 -0
  741. package/dist/utils/sharedUtils.js.map +1 -0
  742. package/dist/utils/sleep.js +1 -0
  743. package/dist/utils/sleep.js.map +1 -0
  744. package/dist/utils/splitCodeIntoChunk.js +1 -0
  745. package/dist/utils/splitCodeIntoChunk.js.map +1 -0
  746. package/dist/utils/time.js +66 -0
  747. package/dist/utils/time.js.map +1 -0
  748. package/dist/utils/verifyFocusPreference.js +107 -0
  749. package/dist/utils/verifyFocusPreference.js.map +1 -0
  750. package/dist/utils/vscode.js +1 -0
  751. package/dist/utils/vscode.js.map +1 -0
  752. package/dist/workflow/workflowResolver.js +1 -0
  753. package/dist/workflow/workflowResolver.js.map +1 -0
  754. package/dist/workflow/workflowRunner.js +1 -0
  755. package/dist/workflow/workflowRunner.js.map +1 -0
  756. package/package.json +3 -3
  757. package/dist/agents/MainAgent.js +0 -1886
  758. package/dist/agents/contextReviewStep.js +0 -101
  759. package/dist/agents/finalPlanGenStep.js +0 -107
  760. package/dist/agents/structuralAnalysisStep.js +0 -46
  761. package/dist/agents/validationAnalysisStep.js +0 -87
  762. package/dist/pipeline/modules/chunkManagerModule.js +0 -24
  763. package/dist/pipeline/modules/cleanGeneratedTestsModule.js +0 -33
  764. package/dist/pipeline/modules/fileReaderModule.js +0 -72
  765. package/dist/pipeline/modules/gatherInfoModule.js +0 -181
  766. package/dist/pipeline/modules/generateTestsModule.js +0 -68
  767. package/dist/pipeline/modules/preserveCodeModule.js +0 -195
  768. package/dist/pipeline/modules/refactorModule.js +0 -40
  769. package/dist/pipeline/modules/repairTestsModule.js +0 -48
  770. package/dist/pipeline/modules/runTestsModule.js +0 -37
@@ -0,0 +1,233 @@
1
+ export const REGISTERED_TEST_TARGETS = [
2
+ {
3
+ id: "agent-loop-read-answer",
4
+ area: "agent",
5
+ description: "New agent reads one explicit file and produces a final answer.",
6
+ file: "cli/src/__tests__/agents/agentLoop.test.ts",
7
+ testName: "reads one explicit file and produces a final answer",
8
+ },
9
+ {
10
+ id: "agent-loop-triage-before-read",
11
+ area: "agent",
12
+ description: "New agent triages broad candidate sets before promoting one file into a full read.",
13
+ file: "cli/src/__tests__/agents/agentLoop.test.ts",
14
+ testName: "uses triage-file before full reads on broad candidate sets",
15
+ },
16
+ {
17
+ id: "agent-loop-path-guard",
18
+ area: "agent",
19
+ description: "New agent rejects absolute file reads outside the active repo/worktree.",
20
+ file: "cli/src/__tests__/agents/agentLoop.test.ts",
21
+ testName: "rejects absolute paths outside the active repo/worktree",
22
+ },
23
+ {
24
+ id: "agent-state-machine",
25
+ area: "agent",
26
+ description: "New agent uses explicit task and step transition helpers.",
27
+ file: "cli/src/__tests__/agents/agentStateMachine.test.ts",
28
+ },
29
+ {
30
+ id: "agent-shell-binding",
31
+ area: "agent",
32
+ description: "Shell binding can be updated from agent memory.",
33
+ file: "cli/src/__tests__/shellSession.test.ts",
34
+ testName: "binds agent memory into shell task state",
35
+ },
36
+ {
37
+ id: "agent-ask-final-answer-print",
38
+ area: "agent",
39
+ description: "Ask command prints the simple-agent final answer block before completion.",
40
+ file: "cli/src/__tests__/askCommandTaskBinding.test.ts",
41
+ testName: "uses the new agent runtime for one-shot agent runs",
42
+ },
43
+ {
44
+ id: "intent-command-bypass",
45
+ area: "intent",
46
+ description: "Intent detection bypasses the model for slash commands.",
47
+ file: "cli/src/__tests__/agents/understandIntentStep.test.ts",
48
+ testName: "bypasses the model for slash commands and extracts file targets directly",
49
+ },
50
+ {
51
+ id: "intent-fallback-file-extraction",
52
+ area: "intent",
53
+ description: "Intent fallback keeps explicit file targets when model output is invalid.",
54
+ file: "cli/src/__tests__/agents/understandIntentStep.test.ts",
55
+ testName: "falls back safely on invalid model output and extracts file targets from the raw query",
56
+ },
57
+ {
58
+ id: "intent-folder-basename-extraction",
59
+ area: "intent",
60
+ description: "Intent fallback extracts basename-only folder refs like guards.",
61
+ file: "cli/src/__tests__/agents/understandIntentStep.test.ts",
62
+ testName: "extracts folder refs and extensionless file refs from the raw query fallback",
63
+ },
64
+ {
65
+ id: "intent-folder-natural-language-extraction",
66
+ area: "intent",
67
+ description: "Explicit-ref extraction detects natural folder phrasing like guards folder.",
68
+ file: "cli/src/__tests__/utils/extractFileReferences.test.ts",
69
+ testName: "extracts natural-language folder refs without requiring a path",
70
+ },
71
+ {
72
+ id: "scope-multifile-normalization",
73
+ area: "scope",
74
+ description: "Scope classification keeps explicit two-file requests in multi-file mode.",
75
+ file: "cli/src/__tests__/agents/scopeClassificationStep.test.ts",
76
+ testName: "normalizes obvious multi-file requests when the LLM returns single-file",
77
+ },
78
+ {
79
+ id: "scope-single-file",
80
+ area: "scope",
81
+ description: "Scope classification preserves a clear single-file request.",
82
+ file: "cli/src/__tests__/agents/scopeClassificationStep.test.ts",
83
+ testName: "preserves a clear single-file request",
84
+ },
85
+ {
86
+ id: "scope-repo-wide",
87
+ area: "scope",
88
+ description: "Scope classification preserves repo-wide architecture analysis.",
89
+ file: "cli/src/__tests__/agents/scopeClassificationStep.test.ts",
90
+ testName: "preserves a repo-wide architecture query",
91
+ },
92
+ {
93
+ id: "routing-multifile-bounded",
94
+ area: "routing",
95
+ description: "Routing keeps multi-file docs work in bounded execution mode.",
96
+ file: "cli/src/__tests__/agents/routingDecisionStep.test.ts",
97
+ testName: "routes explicit multi-file docs work to bounded execution",
98
+ },
99
+ {
100
+ id: "routing-folder-explicit-target",
101
+ area: "routing",
102
+ description: "Routing keeps resolved folders on the explicit-target lane while allowing scoped search.",
103
+ file: "cli/src/__tests__/agents/routingDecisionStep.test.ts",
104
+ testName: "keeps explicit folder targets on the explicit-target lane while still allowing search",
105
+ },
106
+ {
107
+ id: "routing-repo-research",
108
+ area: "routing",
109
+ description: "Routing enables research for repo-wide explanation requests without writes.",
110
+ file: "cli/src/__tests__/agents/routingDecisionStep.test.ts",
111
+ testName: "enables research for repo-wide explanation requests without allowing transforms",
112
+ },
113
+ {
114
+ id: "execution-lock-single-file",
115
+ area: "execution-policy",
116
+ description: "Execution policy locks only when a single explicit target has strong verify confidence.",
117
+ file: "cli/src/__tests__/agents/executionPolicyResolver.test.ts",
118
+ testName: "enables a single-file execution lock when explicit targeting and verify confidence are strong",
119
+ },
120
+ {
121
+ id: "search-folder-basename-resolution",
122
+ area: "search",
123
+ description: "Exact-target search resolves basename-only folders like guards.",
124
+ file: "cli/src/__tests__/search/SearchOrchestrator.test.ts",
125
+ testName: "resolves basename-only and natural-language folder refs into folder-scoped child candidates",
126
+ },
127
+ {
128
+ id: "search-folder-child-candidates",
129
+ area: "search",
130
+ description: "Exact-target folder hits expand into candidate child files, not selected files.",
131
+ file: "cli/src/__tests__/agents/deriveFocusFromSearchStep.test.ts",
132
+ testName: "keeps resolved folder children in candidateFiles without promoting them to selectedFiles",
133
+ },
134
+ {
135
+ id: "search-filename-spaced-words",
136
+ area: "search",
137
+ description: "Search can still find a file when the user uses spaced filename words.",
138
+ file: "cli/src/__tests__/search/SearchOrchestrator.test.ts",
139
+ testName: "keeps semantic retrieval separate from exact-target resolution",
140
+ },
141
+ {
142
+ id: "agent-search-ranking-owner-boost",
143
+ area: "search",
144
+ description: "New agent ranking keeps owner-file and exact-anchor boosts inside the search area.",
145
+ file: "cli/src/__tests__/agents/agentSearchRanking.test.ts",
146
+ testName: "boosts likely owner files for method-selection questions",
147
+ },
148
+ {
149
+ id: "search-snippet-no-filename",
150
+ area: "search",
151
+ description: "Sentence-fragment search preserves snippet-only lookups with no filename.",
152
+ file: "cli/src/__tests__/search/SearchOrchestrator.test.ts",
153
+ testName: "preserves identical sentence fragments across multiple files",
154
+ },
155
+ {
156
+ id: "search-operator-pattern-mode",
157
+ area: "search",
158
+ description: "Operator-pattern search stays separate from semantic retrieval.",
159
+ file: "cli/src/__tests__/search/SearchOrchestrator.test.ts",
160
+ testName: "returns raw operator-pattern matches without semantic guessing",
161
+ },
162
+ {
163
+ id: "execution-lock-invariant",
164
+ area: "execution-policy",
165
+ description: "Execution policy invariant restores dropped lock files.",
166
+ file: "cli/src/__tests__/agents/executionPolicyResolver.test.ts",
167
+ testName: "restores locked files if later focus state drops them",
168
+ },
169
+ {
170
+ id: "readiness-no-selection",
171
+ area: "readiness",
172
+ description: "Readiness stays not-ready when no files are selected.",
173
+ file: "cli/src/__tests__/agents/readinessGateStep.test.ts",
174
+ testName: "returns not-ready when no files are selected",
175
+ },
176
+ {
177
+ id: "readiness-weak-anchor-expansion",
178
+ area: "readiness",
179
+ description: "Readiness forces one expansion wave when anchors are weak.",
180
+ file: "cli/src/__tests__/agents/readinessGateStep.test.ts",
181
+ testName: "forces one expansion wave when primary files are weakly aligned to anchors",
182
+ },
183
+ {
184
+ id: "source-selection-execution-only",
185
+ area: "selection",
186
+ description: "Source selection mirrors execution files without promoting candidates.",
187
+ file: "cli/src/__tests__/agents/selectRelevantSourcesStep.test.ts",
188
+ testName: "mirrors execution files into working files without promoting candidates",
189
+ },
190
+ {
191
+ id: "reason-next-analyze-only",
192
+ area: "completion",
193
+ description: "Step reasoning completes analyze-only work once semantic analysis exists.",
194
+ file: "cli/src/__tests__/agents/reasonNextStep.test.ts",
195
+ testName: "completes analyze-only steps once semantic analysis exists",
196
+ },
197
+ {
198
+ id: "reason-next-redo",
199
+ area: "completion",
200
+ description: "Step reasoning requests redo when validation fails.",
201
+ file: "cli/src/__tests__/agents/reasonNextStep.test.ts",
202
+ testName: "requests redo when validation requires it",
203
+ },
204
+ {
205
+ id: "objective-multifile-gate",
206
+ area: "completion",
207
+ description: "Reasoning does not complete a multi-file task from one-file objective evidence.",
208
+ file: "cli/src/__tests__/agents/reasonNextTaskStep.test.ts",
209
+ testName: "does not complete a multi-file task when objective criteria cover only one required file",
210
+ },
211
+ {
212
+ id: "objective-multifile-complete",
213
+ area: "completion",
214
+ description: "Reasoning completes once all required files are covered by satisfied criteria.",
215
+ file: "cli/src/__tests__/agents/reasonNextTaskStep.test.ts",
216
+ testName: "completes once satisfied objective criteria cover every required file",
217
+ },
218
+ {
219
+ id: "objective-evaluator-invalid-regex",
220
+ area: "completion",
221
+ description: "Objective evaluation treats invalid regex criteria as unresolved.",
222
+ file: "cli/src/__tests__/agents/objectiveEvaluatorStep.test.ts",
223
+ testName: "marks invalid regex criteria as unsatisfied instead of succeeding",
224
+ },
225
+ {
226
+ id: "validation-preserve-history",
227
+ area: "validation",
228
+ description: "Validation preserves earlier file results when validating another file.",
229
+ file: "cli/src/__tests__/agents/validateChangesStep.test.ts",
230
+ testName: "preserves earlier validations when adding a new file result",
231
+ },
232
+ ];
233
+ //# sourceMappingURL=testRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testRegistry.js","sourceRoot":"","sources":["../../src/testing/testRegistry.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D;QACE,EAAE,EAAE,wBAAwB;QAC5B,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,gEAAgE;QAC7E,IAAI,EAAE,4CAA4C;QAClD,QAAQ,EAAE,qDAAqD;KAChE;IACD;QACE,EAAE,EAAE,+BAA+B;QACnC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,oFAAoF;QACjG,IAAI,EAAE,4CAA4C;QAClD,QAAQ,EAAE,4DAA4D;KACvE;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,yEAAyE;QACtF,IAAI,EAAE,4CAA4C;QAClD,QAAQ,EAAE,yDAAyD;KACpE;IACD;QACE,EAAE,EAAE,qBAAqB;QACzB,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,2DAA2D;QACxE,IAAI,EAAE,oDAAoD;KAC3D;IACD;QACE,EAAE,EAAE,qBAAqB;QACzB,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,iDAAiD;QAC9D,IAAI,EAAE,wCAAwC;QAC9C,QAAQ,EAAE,0CAA0C;KACrD;IACD;QACE,EAAE,EAAE,8BAA8B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,iDAAiD;QACvD,QAAQ,EAAE,oDAAoD;KAC/D;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,IAAI,EA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C,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,yEAAyE;QACtF,IAAI,EAAE,sDAAsD;QAC5D,QAAQ,EAAE,6DAA6D;KACxE;CACF,CAAC","sourcesContent":["export interface RegisteredTestTarget {\n id: string;\n description: string;\n file: string;\n area?: string;\n testName?: string;\n}\n\nexport const REGISTERED_TEST_TARGETS: RegisteredTestTarget[] = [\n {\n id: \"agent-loop-read-answer\",\n area: \"agent\",\n description: \"New agent reads one explicit file and produces a final answer.\",\n file: \"cli/src/__tests__/agents/agentLoop.test.ts\",\n testName: \"reads one explicit file and produces a final answer\",\n },\n {\n id: \"agent-loop-triage-before-read\",\n area: \"agent\",\n description: \"New agent triages broad candidate sets before promoting one file into a full read.\",\n file: \"cli/src/__tests__/agents/agentLoop.test.ts\",\n testName: \"uses triage-file before full reads on broad candidate sets\",\n },\n {\n id: \"agent-loop-path-guard\",\n area: \"agent\",\n description: \"New agent rejects absolute file reads outside the active repo/worktree.\",\n file: \"cli/src/__tests__/agents/agentLoop.test.ts\",\n testName: \"rejects absolute paths outside the active repo/worktree\",\n },\n {\n id: \"agent-state-machine\",\n area: \"agent\",\n description: \"New agent uses explicit task and step transition helpers.\",\n file: \"cli/src/__tests__/agents/agentStateMachine.test.ts\",\n },\n {\n id: \"agent-shell-binding\",\n area: \"agent\",\n description: \"Shell binding can be updated from agent memory.\",\n file: \"cli/src/__tests__/shellSession.test.ts\",\n testName: \"binds agent memory into shell task state\",\n },\n {\n id: \"agent-ask-final-answer-print\",\n area: \"agent\",\n description: \"Ask command prints the simple-agent final answer block before completion.\",\n file: \"cli/src/__tests__/askCommandTaskBinding.test.ts\",\n testName: \"uses the new agent runtime for one-shot agent runs\",\n },\n {\n id: \"intent-command-bypass\",\n area: \"intent\",\n description: \"Intent detection bypasses the model for slash commands.\",\n file: \"cli/src/__tests__/agents/understandIntentStep.test.ts\",\n testName: \"bypasses the model for slash commands and extracts file targets directly\",\n },\n {\n id: \"intent-fallback-file-extraction\",\n area: \"intent\",\n description: \"Intent fallback keeps explicit file targets when model output is invalid.\",\n file: \"cli/src/__tests__/agents/understandIntentStep.test.ts\",\n testName: \"falls back safely on invalid model output and extracts file targets from the raw query\",\n },\n {\n id: \"intent-folder-basename-extraction\",\n area: \"intent\",\n description: \"Intent fallback extracts basename-only folder refs like guards.\",\n file: \"cli/src/__tests__/agents/understandIntentStep.test.ts\",\n testName: \"extracts folder refs and extensionless file refs from the raw query fallback\",\n },\n {\n id: \"intent-folder-natural-language-extraction\",\n area: \"intent\",\n description: \"Explicit-ref extraction detects natural folder phrasing like guards folder.\",\n file: \"cli/src/__tests__/utils/extractFileReferences.test.ts\",\n testName: \"extracts natural-language folder refs without requiring a path\",\n },\n {\n id: \"scope-multifile-normalization\",\n area: \"scope\",\n description: \"Scope classification keeps explicit two-file requests in multi-file mode.\",\n file: \"cli/src/__tests__/agents/scopeClassificationStep.test.ts\",\n testName: \"normalizes obvious multi-file requests when the LLM returns single-file\",\n },\n {\n id: \"scope-single-file\",\n area: \"scope\",\n description: \"Scope classification preserves a clear single-file request.\",\n file: \"cli/src/__tests__/agents/scopeClassificationStep.test.ts\",\n testName: \"preserves a clear single-file request\",\n },\n {\n id: \"scope-repo-wide\",\n area: \"scope\",\n description: \"Scope classification preserves repo-wide architecture analysis.\",\n file: \"cli/src/__tests__/agents/scopeClassificationStep.test.ts\",\n testName: \"preserves a repo-wide architecture query\",\n },\n {\n id: \"routing-multifile-bounded\",\n area: \"routing\",\n description: \"Routing keeps multi-file docs work in bounded execution mode.\",\n file: \"cli/src/__tests__/agents/routingDecisionStep.test.ts\",\n testName: \"routes explicit multi-file docs work to bounded execution\",\n },\n {\n id: \"routing-folder-explicit-target\",\n area: \"routing\",\n description: \"Routing keeps resolved folders on the explicit-target lane while allowing scoped search.\",\n file: \"cli/src/__tests__/agents/routingDecisionStep.test.ts\",\n testName: \"keeps explicit folder targets on the explicit-target lane while still allowing search\",\n },\n {\n id: \"routing-repo-research\",\n area: \"routing\",\n description: \"Routing enables research for repo-wide explanation requests without writes.\",\n file: \"cli/src/__tests__/agents/routingDecisionStep.test.ts\",\n testName: \"enables research for repo-wide explanation requests without allowing transforms\",\n },\n {\n id: \"execution-lock-single-file\",\n area: \"execution-policy\",\n description: \"Execution policy locks only when a single explicit target has strong verify confidence.\",\n file: \"cli/src/__tests__/agents/executionPolicyResolver.test.ts\",\n testName: \"enables a single-file execution lock when explicit targeting and verify confidence are strong\",\n },\n {\n id: \"search-folder-basename-resolution\",\n area: \"search\",\n description: \"Exact-target search resolves basename-only folders like guards.\",\n file: \"cli/src/__tests__/search/SearchOrchestrator.test.ts\",\n testName: \"resolves basename-only and natural-language folder refs into folder-scoped child candidates\",\n },\n {\n id: \"search-folder-child-candidates\",\n area: \"search\",\n description: \"Exact-target folder hits expand into candidate child files, not selected files.\",\n file: \"cli/src/__tests__/agents/deriveFocusFromSearchStep.test.ts\",\n testName: \"keeps resolved folder children in candidateFiles without promoting them to selectedFiles\",\n },\n {\n id: \"search-filename-spaced-words\",\n area: \"search\",\n description: \"Search can still find a file when the user uses spaced filename words.\",\n file: \"cli/src/__tests__/search/SearchOrchestrator.test.ts\",\n testName: \"keeps semantic retrieval separate from exact-target resolution\",\n },\n {\n id: \"agent-search-ranking-owner-boost\",\n area: \"search\",\n description: \"New agent ranking keeps owner-file and exact-anchor boosts inside the search area.\",\n file: \"cli/src/__tests__/agents/agentSearchRanking.test.ts\",\n testName: \"boosts likely owner files for method-selection questions\",\n },\n {\n id: \"search-snippet-no-filename\",\n area: \"search\",\n description: \"Sentence-fragment search preserves snippet-only lookups with no filename.\",\n file: \"cli/src/__tests__/search/SearchOrchestrator.test.ts\",\n testName: \"preserves identical sentence fragments across multiple files\",\n },\n {\n id: \"search-operator-pattern-mode\",\n area: \"search\",\n description: \"Operator-pattern search stays separate from semantic retrieval.\",\n file: \"cli/src/__tests__/search/SearchOrchestrator.test.ts\",\n testName: \"returns raw operator-pattern matches without semantic guessing\",\n },\n {\n id: \"execution-lock-invariant\",\n area: \"execution-policy\",\n description: \"Execution policy invariant restores dropped lock files.\",\n file: \"cli/src/__tests__/agents/executionPolicyResolver.test.ts\",\n testName: \"restores locked files if later focus state drops them\",\n },\n {\n id: \"readiness-no-selection\",\n area: \"readiness\",\n description: \"Readiness stays not-ready when no files are selected.\",\n file: \"cli/src/__tests__/agents/readinessGateStep.test.ts\",\n testName: \"returns not-ready when no files are selected\",\n },\n {\n id: \"readiness-weak-anchor-expansion\",\n area: \"readiness\",\n description: \"Readiness forces one expansion wave when anchors are weak.\",\n file: \"cli/src/__tests__/agents/readinessGateStep.test.ts\",\n testName: \"forces one expansion wave when primary files are weakly aligned to anchors\",\n },\n {\n id: \"source-selection-execution-only\",\n area: \"selection\",\n description: \"Source selection mirrors execution files without promoting candidates.\",\n file: \"cli/src/__tests__/agents/selectRelevantSourcesStep.test.ts\",\n testName: \"mirrors execution files into working files without promoting candidates\",\n },\n {\n id: \"reason-next-analyze-only\",\n area: \"completion\",\n description: \"Step reasoning completes analyze-only work once semantic analysis exists.\",\n file: \"cli/src/__tests__/agents/reasonNextStep.test.ts\",\n testName: \"completes analyze-only steps once semantic analysis exists\",\n },\n {\n id: \"reason-next-redo\",\n area: \"completion\",\n description: \"Step reasoning requests redo when validation fails.\",\n file: \"cli/src/__tests__/agents/reasonNextStep.test.ts\",\n testName: \"requests redo when validation requires it\",\n },\n {\n id: \"objective-multifile-gate\",\n area: \"completion\",\n description: \"Reasoning does not complete a multi-file task from one-file objective evidence.\",\n file: \"cli/src/__tests__/agents/reasonNextTaskStep.test.ts\",\n testName: \"does not complete a multi-file task when objective criteria cover only one required file\",\n },\n {\n id: \"objective-multifile-complete\",\n area: \"completion\",\n description: \"Reasoning completes once all required files are covered by satisfied criteria.\",\n file: \"cli/src/__tests__/agents/reasonNextTaskStep.test.ts\",\n testName: \"completes once satisfied objective criteria cover every required file\",\n },\n {\n id: \"objective-evaluator-invalid-regex\",\n area: \"completion\",\n description: \"Objective evaluation treats invalid regex criteria as unresolved.\",\n file: \"cli/src/__tests__/agents/objectiveEvaluatorStep.test.ts\",\n testName: \"marks invalid regex criteria as unsatisfied instead of succeeding\",\n },\n {\n id: \"validation-preserve-history\",\n area: \"validation\",\n description: \"Validation preserves earlier file results when validating another file.\",\n file: \"cli/src/__tests__/agents/validateChangesStep.test.ts\",\n testName: \"preserves earlier validations when adding a new file result\",\n },\n];\n"]}
package/dist/types.js CHANGED
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Shared runtime and data model types for the SCAI CLI.\r\n *\r\n * This file is still the single source of truth for now, but it is grouped by ownership:\r\n * - runtime contracts and action specs\r\n * - policy / guard state\r\n * - progress / completion state\r\n * - evidence and analysis state\r\n * - durable task / session persistence shapes\r\n * - module / planner I/O\r\n *\r\n * Canonical source rules:\r\n * - `GuardState` is the authoritative policy snapshot for the loop.\r\n * - `ExecutionPolicySnapshot` is the authoritative pre-guard policy input.\r\n * - `ProgressState` is the authoritative progress snapshot for the loop.\r\n * - `executionOutcome.validations` is the authoritative validation fact source.\r\n * - `objectiveEvaluation` is the authoritative objective fact source.\r\n * - `Task` and `Session` store durable state; they do not own loop decisions.\r\n */\r\nexport type SupportedLanguage = 'ts' | 'js' | 'java' | 'rust' | 'python';\nexport type SupportedModel = \"qwen3-coder:30b\" | \"qwen3.5:35b\" | \"granite4.1:30b\" | \"gpt-oss:20b\" | \"glm-4.7-flash:latest\" | \"glm-4.7-flash:q4_K_M\" | \"nemotron-cascade-2:30b\" | \"aratan/qwen3.5-agent-multimodal:9b\";\n\r\nexport interface DaemonConfig {\r\n sleepMs: number;\r\n idleSleepMs: number;\r\n}\r\n\r\nexport interface ScaiConfig {\n model: SupportedModel;\n contextLength: number;\n maxOutputTokens: number;\n transformMaxFileLines?: number;\n language: SupportedLanguage;\n devOutput?: boolean;\n indexDir: string;\n githubToken: string;\r\n repos: Record<string, Partial<ScaiConfig>>;\r\n activeRepo: string | null;\r\n daemon?: DaemonConfig;\r\n}\r\n\r\nexport interface ResumeDebugInfo {\r\n sourceTaskId?: number;\r\n restoredSnapshot?: unknown;\r\n resumedContextCapsule?: string;\r\n reloadedFileContext?: Array<{\r\n path: string;\r\n reason: string;\r\n }>;\r\n}\r\n\r\nexport interface AgentUI {\n update(text: string): void;\n message(text: string): void;\n pause(fn: () => void): void;\n succeed(msg?: string): void;\n fail(msg: string): void;\n stop(): void;\n}\n\r\nexport type RepoConfig = {\r\n model?: SupportedModel;\r\n language?: SupportedLanguage;\r\n githubToken?: string;\r\n indexDir?: string;\r\n path?: string;\r\n};\r\n\r\nexport type TopFile = {\r\n id?: number;\r\n path: string;\r\n summary?: string;\r\n code?: string;\r\n bm25Score?: number;\r\n};\r\n\r\nexport interface BuildContextualPromptArgs {\r\n topFiles?: TopFile[];\r\n relatedFiles: {\r\n id: number;\r\n path: string;\r\n summary?: string;\r\n bm25Score?: number;\r\n }[];\r\n query: string;\r\n queryExpansionTerms?: string[];\r\n}\r\n\r\nexport type OutputMode = \"overwrite\" | \"append\" | \"newFile\" | \"skip\";\r\n\r\n// File: src/pipeline/types.ts\r\nexport interface PromptInput<TMeta = any> {\r\n originalContent?: string;\r\n content: string;\r\n filepath?: string;\r\n chunkIndex?: number;\r\n chunkCount?: number;\r\n language?: string;\r\n metadata?: TMeta; // šŸ‘ˆ module-specific data\r\n summary?: string;\r\n\r\n // Optional plan context\r\n stepIndex?: number;\r\n totalSteps?: number;\r\n actionName?: string;\r\n}\r\n\r\nexport type PromptOutput<TData = any, TDiag = any> = {\r\n originalContent?: string;\r\n content: string;\r\n filepath?: string;\r\n suggestions?: string[];\r\n mode?: OutputMode;\r\n newFilepath?: string;\r\n data?: TData; // šŸ‘ˆ structured module result (AST, search hits, etc.)\r\n summary?: string;\r\n\r\n // Diagnostics (timing, token usage, warnings, etc.)\r\n diagnostics?: TDiag;\r\n};\r\n\r\nexport type PromptModule<TIn = any, TOut = any> = {\r\n name: string;\r\n description: string;\r\n run: (input: PromptInput<TIn>) => Promise<PromptOutput<TOut>>;\r\n};\r\n\r\n// Runtime action contract (single source of truth for execution).\r\n// Example: actionId=\"codeTransform\" -> phase=\"transform\", executorKind=\"module\".\r\nexport type ActionPhase =\r\n | \"info\"\r\n | \"analysis\"\r\n | \"transform\"\r\n | \"finalize\"\r\n | \"research\"\r\n | \"system\";\r\n\r\nexport type ExecutorKind = \"module\" | \"research\" | \"system\";\r\nexport type ActionSafety = \"read-only\" | \"repo-write\" | \"external-io\" | \"shell\";\r\n\r\nexport interface RegexSuccessCriterion {\r\n type: \"regex\";\r\n filePath: string;\r\n pattern: string;\r\n flags?: string;\r\n scope?: \"line\" | \"file\";\r\n mustMatch?: boolean;\r\n expectedCaptures?: string[];\r\n}\r\n\r\nexport interface ExactValueSuccessCriterion {\r\n type: \"exact-value\";\r\n filePath: string;\r\n value: string;\r\n mustContain?: boolean;\r\n}\r\n\r\nexport type SuccessCriterion = RegexSuccessCriterion | ExactValueSuccessCriterion;\r\n\r\nexport interface CompletionSemantics {\r\n criteria?: SuccessCriterion[];\r\n}\r\n\r\nexport interface GiveUpPolicy {\r\n maxVerifyWaves?: number;\r\n maxNoGrowthWaves?: number;\r\n maxRetriesPerTarget?: number;\r\n maxExpansionPromotionsPerWave?: number;\r\n}\r\n\r\nexport interface ActionSpec {\r\n id: string;\r\n phase: ActionPhase;\r\n executorKind: ExecutorKind;\r\n argsSchema?: {\r\n required?: string[];\r\n };\r\n safety: ActionSafety;\r\n completionSemantics?: CompletionSemantics;\r\n giveUpPolicy?: GiveUpPolicy;\r\n}\r\n\r\nexport type ActionRegistry = Record<string, ActionSpec>;\r\n\r\nexport interface RegexEvidence {\r\n filePath: string;\r\n pattern: string;\r\n flags?: string;\r\n matches: number;\r\n captures?: string[];\r\n error?: string;\r\n}\r\n\r\nexport interface ObjectiveEvaluationResult {\r\n status: \"satisfied\" | \"unsatisfied\" | \"inconclusive\";\r\n rationale: string;\r\n evidence: RegexEvidence[];\r\n}\r\n\r\nexport type GiveUpReason =\r\n | \"not-found\"\r\n | \"unsafe\"\r\n | \"no-growth\"\r\n | \"retry-exhausted\"\r\n | \"policy-blocked\";\r\n\r\nexport interface AttemptCounters {\r\n verifyWaves?: number;\r\n noGrowthWaves?: number;\r\n retriesByTarget?: Record<string, number>;\r\n expansionPromotions?: number;\r\n}\r\n\r\nexport interface GiveUpEvaluationResult {\r\n triggered: boolean;\r\n reason?: GiveUpReason;\r\n rationale: string;\r\n counters?: AttemptCounters;\r\n}\r\n\r\nexport interface ObjectiveState {\r\n objective?: string;\r\n successCriteria?: SuccessCriterion[];\r\n completionStatus?: \"unknown\" | \"satisfied\" | \"unsatisfied\";\r\n completionEvidence?: RegexEvidence[];\r\n}\r\n\r\nexport interface GiveUpState {\r\n status?: \"none\" | \"triggered\";\r\n reason?: GiveUpReason;\r\n rationale?: string;\r\n}\r\n\r\nexport interface PlannerPromptState {\r\n targetFile: string;\r\n rationaleText: string;\r\n currentQuestionId?: string;\r\n promptMode: \"full\" | \"delta\";\r\n signature?: string;\r\n frontierSignature?: string;\r\n repeatCount?: number;\r\n}\r\n\r\nexport interface PlannerRetryProgress {\r\n targetFile: string;\r\n signature: string;\r\n count: number;\r\n stalled: boolean;\r\n frontierSignature?: string;\r\n reason: string;\r\n}\r\n\r\n\r\n/** A single step the planner returns */\r\nexport type AgentPlanStep = {\r\n id: string;\r\n action: string;\r\n actionId?: string;\r\n actionArgs?: Record<string, unknown>;\r\n questionId?: string;\r\n subQuery?: string[];\r\n targetFile?: string;\r\n description?: string;\r\n modules?: Array<PromptModule | string>;\r\n moduleHint?: string;\r\n metadata?: Record<string, any>; // ā¬…ļø added so translator can attach extra info\r\n groups?: string[];\r\n};\r\n\r\n/** The plan returned by the planner */\r\nexport type AgentPlan = {\r\n steps: AgentPlanStep[];\r\n};\r\n\r\nexport interface AutonomousAgentArgs extends AgentContext {\r\n promptContent: string;\r\n}\r\n\r\nexport interface AgentContext {\r\n query: string;\r\n topFiles?: TopFile[];\r\n globalContext?: Record<string, any>;\r\n}\r\n\r\nexport interface FolderCapsule {\r\n path: string;\r\n depth: number;\r\n\r\n stats: {\r\n fileCount: number;\r\n byType: Record<string, number>; // ts, js, json, md\r\n };\r\n\r\n roles: string[]; // [\"cli\", \"utils\", \"api\", \"infra\"]\r\n concerns: string[]; // [\"logging\", \"parsing\", \"auth\"]\r\n\r\n keyFiles: {\r\n path: string;\r\n reason: string; // \"entrypoint\", \"core logic\", \"config\"\r\n }[];\r\n\r\n dependencies: {\r\n importsFrom: string[]; // other folders\r\n usedBy: string[];\r\n };\r\n\r\n confidence: number; // 0–1, how confident the model is\r\n summary?: string;\r\n}\r\n\r\nexport type ScopeType = \"none\" | \"single-file\" | \"multi-file\" | \"repo-wide\";\r\nexport type ScopeBand = \"none\" | \"single-file\" | \"multi-file\" | \"repo-wide\";\r\nexport type GuardPhase = \"analysis\" | \"planning\" | \"transform\" | \"write\";\r\nexport type GuardContinuationMode =\r\n | \"need-search\"\r\n | \"need-verify\"\r\n | \"can-research\"\r\n | \"can-plan\"\r\n | \"can-execute\"\r\n | \"terminal\";\r\n\r\n/**\r\n * Pre-guard policy input built from routing, readiness, and focus state.\r\n * This is the canonical policy source before `GuardState` is resolved.\r\n */\r\nexport interface ExecutionPolicySnapshot {\r\n phaseAllowed: Record<GuardPhase, boolean>;\r\n routeAllowed: {\r\n searchExpand: boolean;\r\n research: boolean;\r\n transform: boolean;\r\n };\r\n scopeType: ScopeType;\r\n scopeBand: ScopeBand;\r\n executionRequired: string[];\r\n explorationCandidates: string[];\r\n executionLock: {\r\n enabled: boolean;\r\n files: string[];\r\n reason?: string;\r\n };\r\n executionReady: boolean;\r\n explorationReady: boolean;\r\n policyNotes: string[];\r\n}\r\n\r\n/**\r\n * Authoritative policy snapshot for the current loop turn.\r\n * `GuardState` answers \"what moves are allowed right now?\"\r\n */\r\nexport interface GuardState {\r\n lane: \"explicit-target\" | \"resume-continuity\" | \"evidence\" | \"coding\" | \"direct-answer\";\r\n readiness: \"not-ready\" | \"ready\";\r\n continuationMode: GuardContinuationMode;\r\n allowSearchExpand: boolean;\r\n allowResearch: boolean;\r\n allowTransform: boolean;\r\n executionReady: boolean;\r\n executionLockEnabled: boolean;\r\n executionRequired: string[];\r\n blockingReason?: string;\r\n terminalReason?: \"complete\" | \"give-up\" | \"request-feedback\";\r\n}\r\n\r\nexport type ProgressMode =\r\n | \"direct-answer\"\r\n | \"evidence\"\r\n | \"coding\"\r\n | \"continuity\";\r\n\r\nexport type ProgressResearchStatus =\r\n | \"not-needed\"\r\n | \"required\"\r\n | \"optional\"\r\n | \"exhausted\";\r\n\r\n/**\r\n * Authoritative progress snapshot for the current loop turn.\r\n * `ProgressState` answers \"what work is still needed right now?\"\r\n */\r\nexport interface ProgressState {\r\n mode: ProgressMode;\r\n requiredTargets: string[];\r\n completedTargets: string[];\r\n redoTargets: string[];\r\n blockedTargets: string[];\r\n optionalTargets: string[];\r\n evidenceSatisfied: boolean;\r\n research: {\r\n status: ProgressResearchStatus;\r\n pendingSteps: string[];\r\n lastPlanSignature?: string;\r\n lastFrontierSignature?: string;\r\n plannerRetry?: PlannerRetryProgress;\r\n noNewInfoCount: number;\r\n reason: string;\r\n };\r\n completion: {\r\n objectiveSatisfied: boolean;\r\n validationSatisfied: boolean;\r\n evidenceSatisfied: boolean;\r\n eligible: boolean;\r\n blockedBy: \"missing-scope\" | \"missing-evidence\" | \"pending-research\" | null;\r\n reason: string;\r\n };\r\n continuity: {\r\n localOnly: boolean;\r\n answerNow: boolean;\r\n reason: string;\r\n };\r\n}\r\n\r\nexport type RoutingDecision = {\r\n decision: \"has-info\" | \"needs-info\";\r\n allowSearch: boolean;\r\n allowResearch: boolean;\r\n allowTransform: boolean;\r\n scopeLocked: boolean;\r\n rationale: string;\r\n confidence?: number;\r\n};\r\n\r\n/** \r\n * Outcome of the readiness gate step. \r\n * Determines if agent has enough evidence to proceed.\r\n */\r\nexport interface ReadinessDecision {\r\n decision: 'ready' | 'not-ready'; // Ready to proceed or need more info\r\n reason: 'sufficient-evidence' | 'insufficient-evidence' | 'query-repo-mismatch' | 'internal-error';\r\n confidence: number; // 0..1\r\n rationale: string; // Short explanation based only on evidence\r\n}\r\n\r\nexport type ExecutionMode = \"analyze\" | \"transform\";\r\nexport interface ExecutionControl {\r\n /**\r\n * Hard execution mode.\r\n * Set exactly once after intent understanding.\r\n * NEVER mutated afterwards.\r\n */\r\n mode: ExecutionMode;\r\n\r\n /**\r\n * Why this mode was chosen.\r\n * For debugging / transparency only.\r\n */\r\n rationale?: string;\r\n\r\n /**\r\n * Confidence in the mode decision (0–1).\r\n */\r\n confidence?: number;\r\n\r\n /**\r\n * Optional guardrails inferred from intent.\r\n * These are authoritative and must be respected by all downstream steps.\r\n */\r\n constraints?: {\r\n allowFileWrites: boolean;\r\n allowPlanning: boolean;\r\n allowAnalysis: boolean;\r\n\r\n /**\r\n * If true, transformations must be limited to\r\n * documentation and comments only.\r\n */\r\n docsOnly?: boolean;\r\n };\r\n}\r\n\r\nexport type EvidenceType =\r\n | \"sentence\"\r\n | \"symbol\"\r\n | \"filename\"\r\n | \"keyword-cluster\"\r\n | \"structural\";\r\n\r\nexport type FileEvidence = {\r\n claim: string; // factual statement grounded in code\r\n type: EvidenceType; // deterministic evidence category\r\n excerpt?: string; // contextual snippet (± lines if available)\r\n span?: {\r\n startLine?: number;\r\n endLine?: number;\r\n };\r\n confidence: number; // 0–1 deterministic confidence score\r\n};\r\n\r\nexport type ChangeValidation = {\r\n filePath: string;\r\n\r\n /**\r\n * What we expected to happen (from plan / intent)\r\n */\r\n expectedChange?: string;\r\n\r\n /**\r\n * What actually happened (derived from execution artifacts)\r\n */\r\n actualChange: string;\r\n\r\n /**\r\n * Outcome of validation\r\n */\r\n status: \"valid\" | \"partial\" | \"invalid\";\r\n\r\n /**\r\n * Why this status was chosen\r\n */\r\n rationale?: string;\r\n\r\n /**\r\n * Whether this file needs another pass\r\n */\r\n requiresRedo?: boolean;\r\n};\r\n\r\nexport interface ReadFileFact {\r\n key: string;\r\n value?: string;\r\n found: boolean;\r\n snippet?: string;\r\n}\r\n\r\nexport interface ReadQueryFit {\r\n judgment: \"strong\" | \"partial\" | \"weak\" | \"wrong-shape\" | \"unknown\";\r\n rationale: string;\r\n}\r\n\r\nexport interface ReadFileResult {\r\n status: \"ok\" | \"missing-working-file\" | \"unsupported\" | \"error\";\r\n fileKind: \"package-json\" | \"json\" | \"markdown\" | \"source\" | \"text\" | \"unknown\";\r\n facts: ReadFileFact[];\r\n missingFacts: string[];\r\n snippets: string[];\r\n queryFit: ReadQueryFit;\r\n confidence: number;\r\n readAt: string;\r\n mode?: string;\r\n requestedFacts?: string[];\r\n contentFingerprint?: string;\r\n queryFingerprint?: string;\r\n callId?: string;\r\n}\r\n\r\nexport type OuterLoopRecoveryDecision =\r\n | \"continue\"\r\n | \"redo-step\"\r\n | \"expand-scope\"\r\n | \"rework-scope\"\r\n | \"request-feedback\"\r\n | \"complete\";\r\n\r\nexport interface RecoveryEvaluationState {\r\n decision: OuterLoopRecoveryDecision;\r\n reason: string;\r\n targetFile?: string;\r\n evaluatedAt: string;\r\n sourceAction: string;\r\n}\r\n\r\nexport type ExecutionOutcome = {\r\n /**\r\n * Steps that actually ran (by id)\r\n */\r\n executedStepIds: string[];\r\n\r\n /**\r\n * Validation results per file\r\n */\r\n validations?: ChangeValidation[];\r\n};\r\n\r\nexport type IterationReasoning = {\r\n summary: string;\r\n\r\n /**\r\n * High-level action to take after validation / iteration\r\n */\r\n nextAction:\r\n | \"continue\" // proceed to next planned step\r\n | \"redo-step\" // re-run one or more steps\r\n | \"expand-scope\" // include additional files or context\r\n | \"rework-scope\" // clear stale target lock and retarget\r\n | \"request-feedback\" // ask user / collaborator\r\n | \"complete\" // iteration complete\r\n | \"give-up\" // bounded failure reached\r\n | undefined; // no further work\r\n\r\n /**\r\n * Why this action was chosen\r\n */\r\n rationale: string;\r\n\r\n /**\r\n * šŸ” Files that must be re-processed regardless of lifecycle state\r\n */\r\n redoFiles?: string[];\r\n\r\n /**\r\n * Steps or files to re-queue for next iteration\r\n */\r\n nextTargets?: {\r\n stepIds?: string[];\r\n files?: string[];\r\n searchQueries?: string[];\r\n };\r\n\r\n confidence?: number;\r\n};\r\n\r\nexport type NextActionName =\r\n | \"run-search\"\r\n | \"run-verify\"\r\n | \"seed-research\"\r\n | \"seed-plan\"\r\n | \"continue\"\r\n | \"expand-scope\"\r\n | \"rework-scope\"\r\n | \"request-feedback\"\r\n | \"complete\"\r\n | \"give-up\";\r\n\r\nexport interface NextActionInput {\r\n taskStatus: Task[\"status\"];\r\n routeLane: AgentRuntimeState[\"lane\"];\r\n allowedActions: NextActionName[];\r\n guardState?: GuardState;\r\n progressState?: ProgressState;\r\n executionPolicy?: ExecutionPolicySnapshot;\r\n readiness?: ReadinessDecision;\r\n iterationReasoning?: IterationReasoning;\r\n recentActionWindow?: RecentActionWindow;\r\n currentStep?: Step;\r\n pendingSteps: Array<Pick<Step, \"filePath\" | \"action\" | \"status\">>;\r\n completedSteps: Array<Pick<Step, \"filePath\" | \"action\" | \"status\">>;\r\n retryCounters?: AttemptCounters[\"retriesByTarget\"];\r\n giveUpState?: GiveUpState;\r\n}\r\n\r\nexport interface NextActionDecision {\r\n action: NextActionName;\r\n reason: string;\r\n confidence: number;\r\n targetFile?: string;\r\n source: \"reason-next-step-selection\";\r\n}\r\n\r\nexport interface NextActionValidationResult {\r\n accepted: boolean;\r\n normalizedAction: NextActionName;\r\n rejectionReason?: string;\r\n}\r\n\r\nexport interface NextActionMenuState {\r\n allowedActions: NextActionName[];\r\n}\r\n\r\nexport type CollaboratorFeedback = {\r\n /**\r\n * Human-readable summary shown to the user\r\n */\r\n summaryForUser: string;\r\n\r\n /**\r\n * Explicit corrections or objections\r\n */\r\n corrections?: {\r\n filePath?: string;\r\n description: string;\r\n severity?: \"suggestion\" | \"blocking\";\r\n }[];\r\n\r\n /**\r\n * Whether feedback blocks continuation\r\n */\r\n requiresAction?: boolean;\r\n\r\n /**\r\n * Lifecycle tracking\r\n */\r\n status?: \"pending\" | \"received\" | \"applied\";\r\n};\r\n\r\n\r\n// analysis types\r\nexport type FileAnalysis = {\r\n /**\r\n * 🚦 FILE RELEVANCE STATUS\r\n * Authoritative for readiness decisions.\r\n */\r\n intent?: \"relevant\" | \"irrelevant\";\r\n\r\n /**\r\n * 🧠 Human-readable explanation of relevance judgment\r\n */\r\n relevanceExplanation?: string;\r\n\r\n /**\r\n * 🧩 Semantic role IF relevant\r\n */\r\n role?: \"primary\" | \"supporting\" | \"contextual\";\r\n\r\n /**\r\n * 🧪 These are only used up and until the readiness gate. \r\n * After that, we don't re-reason about relevance or should-modify anymore.\r\n */\r\n action?: {\r\n isRelevant?: boolean;\r\n shouldModify: boolean;\r\n }\r\n\r\n /**\r\n * šŸ› ļø Proposed changes\r\n */\r\n proposedChanges?: {\r\n summary: string;\r\n scope: \"none\" | \"minor\" | \"moderate\" | \"major\";\r\n targets?: string[];\r\n rationale?: string;\r\n };\r\n\r\n semanticAnalyzed?: boolean;\r\n contentFingerprint?: string;\r\n queryFingerprint?: string;\r\n\r\n excerpts?: Array<{\r\n description: string;\r\n startLine?: number;\r\n endLine?: number;\r\n symbols?: string[];\r\n code: string;\r\n }>;\r\n\r\n /**\r\n * āš ļø Risks\r\n */\r\n risks?: string[];\r\n\r\n structural?: {\r\n kgTags?: string[];\r\n kgNeighborhood?: string[];\r\n imports?: string[];\r\n exports?: string[];\r\n functions?: {\r\n name?: string;\r\n start?: number;\r\n end?: number;\r\n }[];\r\n classes?: {\r\n name?: string;\r\n start?: number;\r\n end?: number;\r\n }[];\r\n focusedTree?: string;\r\n };\r\n};\r\n\r\nexport type CombinedAnalysis = {\r\n sharedPatterns?: string[];\r\n architectureSummary?: string;\r\n hotspots?: string[];\r\n};\r\n\r\nexport type ResearchActionType =\r\n | \"research-impact-map\"\r\n | \"research-symbol-trace\"\r\n | \"research-risk-check\"\r\n | \"research-architecture-synthesis\"\r\n | \"research-trail-expand\";\r\n\r\nexport interface ResearchArtifactEntry {\r\n action: ResearchActionType;\r\n summary: string;\r\n collectedData?: Record<string, unknown>;\r\n selectedFileCount?: number;\r\n completedAt: string;\r\n}\r\n\r\nexport interface ResearchArtifactsState {\r\n latestByAction?: Partial<Record<ResearchActionType, ResearchArtifactEntry>>;\r\n history?: ResearchArtifactEntry[];\r\n touchedFiles?: string[];\r\n lastUpdatedAt?: string;\r\n}\r\n\r\nexport type TrailSourceType = \"import\" | \"export\" | \"symbol\" | \"kg\";\r\n\r\nexport interface TrailCandidate {\r\n filePath: string;\r\n fromFile?: string;\r\n source: TrailSourceType;\r\n confidence: number;\r\n reason: string;\r\n depth: number;\r\n}\r\n\r\nexport interface TrailDiscard {\r\n filePath: string;\r\n fromFile?: string;\r\n confidence: number;\r\n reason: string;\r\n at: string;\r\n}\r\n\r\nexport interface TrailState {\r\n frontier: TrailCandidate[];\r\n visited: string[];\r\n promoted: string[];\r\n discarded: TrailDiscard[];\r\n parent: Record<string, string>;\r\n depthByFile: Record<string, number>;\r\n pendingQueries?: string[];\r\n wave?: number;\r\n}\r\n\r\nexport interface ExpansionRequest {\r\n reason: string;\r\n files?: string[];\r\n queries?: string[];\r\n}\r\n\r\nexport interface VerifyFileState {\r\n fileConfidence?: number;\r\n role?: \"primary\" | \"supporting\" | \"contextual\";\r\n isRelevant?: boolean;\r\n rationale?: string;\r\n evidence?: FileEvidence[];\r\n searchScore?: {\r\n bm25Raw?: number;\r\n bm25Normalized?: number;\r\n bm25Prior?: number;\r\n };\r\n}\r\n\r\nexport interface VerifyState {\r\n byFile?: Record<string, VerifyFileState>;\r\n}\r\n\r\nexport interface ResumeIntentState {\r\n kind: \"continuity-summary\" | \"continuity-next-step\" | \"normal-resumed-query\";\r\n fastTrackEligible: boolean;\r\n answerFromResumeOnly: boolean;\r\n relevantResumeFiles: string[];\r\n rationale: string;\r\n}\r\n\r\nexport interface ContinuityInferenceState {\r\n mode: \"explicit-resume\" | \"implicit-continue\" | \"new-task\";\r\n confidence: number;\r\n reasons: string[];\r\n}\r\n\r\nexport interface ResumeSection {\r\n label: string;\r\n percent: number;\r\n status: \"pending\" | \"active\" | \"done\" | \"blocked\";\r\n}\r\n\r\nexport interface ResumeState {\r\n source: \"db-guidance\" | \"legacy-snapshot\" | \"none\";\r\n objective: string;\r\n activeStage?: string;\r\n summary: string;\r\n sections: ResumeSection[];\r\n blockers: string[];\r\n nextFocus: string[];\r\n pendingSteps: string[];\r\n relevantFiles: string[];\r\n}\r\n\r\nexport interface ResumePacket {\r\n objective: string;\r\n activeStage?: string;\r\n summary: string;\r\n blockers: string[];\r\n nextFocus: string[];\r\n pendingSteps: string[];\r\n relevantFiles: string[];\r\n}\r\n\r\nexport interface ContinuityDecisionState {\r\n kind: \"direct-resume-answer\" | \"direct-synthesized-answer\" | \"fallback-normal-flow\";\r\n answerNow: boolean;\r\n fallbackRequired: boolean;\r\n rationale: string;\r\n}\r\n\r\nexport interface AgentRuntimeState {\r\n phase: \"read\" | \"understand\" | \"route\" | \"evidence\" | \"plan\" | \"execute\" | \"finalize\";\r\n lane: \"explicit-target\" | \"resume-continuity\" | \"coding\" | \"evidence\" | \"direct-answer\";\r\n status: \"active\" | \"blocked\" | \"ready\" | \"paused\" | \"complete\" | \"gave-up\";\r\n rationale?: string;\r\n}\r\n\r\nexport type SearchMode =\r\n | \"exact-target\"\r\n | \"sentence-fragment\"\r\n | \"semantic-retrieval\"\r\n | \"operator-pattern\"\r\n | \"regex-execution\"\r\n | \"directory-listing\";\r\n\r\nexport type SearchRoute = \"db\" | \"regex\" | \"list-directory\";\r\n\r\nexport type SearchActionType =\r\n | \"search-db\"\r\n | \"search-regex\"\r\n | \"search-list-directory\";\r\n\r\nexport type SearchStageName =\n | \"explicit-target-resolver\"\n | \"sentence-fragment-resolver\"\n | \"semantic-retriever\"\n | \"fallback-semantic-retriever\"\n | \"fallback-content-scanner\"\n | \"operator-pattern-searcher\"\n | \"regex-searcher\"\n | \"directory-listing\"\r\n | \"result-merger-and-ranker\";\r\n\r\nexport type RegexSearchTarget = \"path\" | \"content\" | \"both\";\r\n\r\nexport interface RegexSearchScope {\r\n files?: string[];\r\n folders?: string[];\r\n}\r\n\r\nexport interface RegexSearchSpec {\r\n target: RegexSearchTarget;\r\n pattern: string;\r\n flags?: string;\r\n scope?: RegexSearchScope;\r\n rationale?: string;\r\n}\r\n\r\nexport interface SearchDirectoryEntry {\r\n path: string;\r\n name: string;\r\n kind: \"file\" | \"folder\";\r\n}\r\n\r\nexport type SearchFailureClass =\r\n | \"no-match\"\r\n | \"too-broad\"\r\n | \"ambiguous\"\r\n | \"invalid-regex\"\r\n | \"scope-missing\"\r\n | \"executor-error\";\r\n\r\nexport interface SearchFailureResult {\r\n status: \"failed\";\r\n failureClass: SearchFailureClass;\r\n message: string;\r\n pattern?: string;\r\n flags?: string;\r\n}\r\n\r\nexport interface SearchAttemptRecord {\r\n actionId: string;\r\n searchType: SearchActionType;\r\n query?: string;\r\n regexSpec?: RegexSearchSpec;\r\n scope?: RegexSearchScope;\r\n resultCount: number;\r\n failureClass?: SearchFailureClass;\r\n recordedAt: string;\r\n}\r\n\r\nexport interface DecomposedQuestion {\r\n id: string;\r\n order: number;\r\n text: string;\r\n normalizedQuery: string;\r\n intentCategory: string;\r\n targetFiles?: string[];\r\n targetSymbols?: string[];\r\n}\r\n\r\nexport interface PlanModeState {\r\n enabled: boolean;\r\n source: \"auto\" | \"explicit\" | \"none\";\r\n executionMode: \"execute\" | \"plan-only\";\r\n rationale: string;\r\n}\r\n\r\n/**\r\n * Dialog option ids stay simple on purpose.\r\n * Common values include: execute, revise, add-info, continue, approve, cancel.\r\n */\r\nexport type DialogOption =\r\n | \"execute\"\r\n | \"revise\"\r\n | \"add-info\"\r\n | \"continue\"\r\n | \"approve\"\r\n | \"cancel\"\r\n | (string & {});\r\n\r\nexport type DialogKind =\r\n | \"plan-followup\"\r\n | \"clarification\"\r\n | \"execution-approval\"\r\n | \"step-feedback\"\r\n | \"task-feedback\";\r\n\r\nexport interface DialogState {\r\n status: \"idle\" | \"awaiting-user\" | \"answered\";\r\n kind: DialogKind;\r\n prompt: string;\r\n options: DialogOption[];\r\n selectedOption?: DialogOption;\r\n comment?: string;\r\n response?: string;\r\n relatedQuestionId?: string;\r\n relatedStepId?: number;\r\n createdAt: string;\r\n answeredAt?: string;\r\n}\r\n\r\nexport interface DialogIntent {\r\n kind: DialogKind;\r\n reason: string;\r\n promptHint?: string;\r\n suggestedOptions?: DialogOption[];\r\n relatedQuestionId?: string;\r\n relatedStepId?: number;\r\n}\r\n\r\nexport interface RollingPlanState {\r\n mode: \"none\" | \"initial\" | \"rolling\";\r\n summary: string;\r\n activeBranch?: string;\r\n subgoals: Array<{\r\n id: string;\r\n label: string;\r\n status: \"pending\" | \"active\" | \"done\" | \"blocked\";\r\n questionId?: string;\r\n }>;\r\n nextActions: string[];\r\n lastUpdatedAt: string;\r\n}\r\n\r\nexport type ActionLedgerOutcome = \"success\" | \"empty\" | \"failed\" | \"partial\";\r\n\r\nexport interface ActionLedgerEntry {\r\n id?: number;\r\n taskId: number;\r\n actionKind: string;\r\n target: string;\r\n reason: string;\r\n outcome: ActionLedgerOutcome;\r\n summary: string;\r\n touchedFiles: string[];\r\n touchedSymbols?: string[];\r\n usefulness?: number;\r\n priorActionId?: number;\r\n questionId?: string;\r\n createdAt: string;\r\n}\r\n\r\nexport interface RecentActionWindow {\r\n entries: ActionLedgerEntry[];\r\n latest?: ActionLedgerEntry;\r\n}\r\n\r\nexport interface SearchSymbolResolution {\r\n symbol: string;\r\n filePath: string;\r\n}\r\n\r\nexport interface SearchContentMatch {\r\n path: string;\r\n line: number;\r\n column: number;\r\n snippet: string;\r\n}\r\n\r\nexport interface SearchOrchestratorResult {\r\n route: SearchRoute;\r\n mode: SearchMode;\r\n stagesRun: SearchStageName[];\r\n resolvedFiles: SearchResult[];\r\n resolvedFolders: string[];\r\n resolvedSymbols: SearchSymbolResolution[];\r\n unresolvedRefs: string[];\r\n ambiguousRefs: string[];\r\n fileCandidates: SearchResult[];\r\n folderCandidates: string[];\r\n symbolCandidates: SearchSymbolResolution[];\r\n fragmentMatches: SearchContentMatch[];\r\n patternMatches: SearchContentMatch[];\r\n directoryEntries: SearchDirectoryEntry[];\r\n regexSpec?: RegexSearchSpec;\r\n failure?: SearchFailureResult;\r\n fallbackUsed: boolean;\r\n}\r\n\r\nexport interface AnalysisState {\r\n /**\r\n * Tracing-only runtime mirror. This is not a decision owner.\r\n */\r\n runtimeState?: AgentRuntimeState;\r\n readinessGuard?: {\r\n weakAlignmentExpansionForced?: boolean;\r\n };\r\n\r\n intent?: {\r\n intent: string;\r\n intentCategory: string;\r\n normalizedQuery: string;\r\n confidence: number;\r\n questions?: DecomposedQuestion[];\r\n targetFiles?: string[];\r\n resolvedTargetFiles?: string[];\r\n targetSymbols?: string[];\r\n };\r\n\r\n /**\r\n * Search packet is discovery-only state.\r\n * Focus and execution decisions must be derived from this, not mixed into it.\r\n */\r\n search?: SearchOrchestratorResult;\r\n searchAttempts?: SearchAttemptRecord[];\r\n planMode?: PlanModeState;\r\n rollingPlan?: RollingPlanState;\r\n recentActionWindow?: RecentActionWindow;\r\n dialogIntent?: DialogIntent;\r\n directoryListingAnswer?: {\r\n query: string;\r\n folderPath?: string;\r\n entries: SearchDirectoryEntry[];\r\n summary: string;\r\n };\r\n\r\n continuityInference?: ContinuityInferenceState;\r\n resumeState?: ResumeState;\r\n resumeIntent?: ResumeIntentState;\r\n continuityDecision?: ContinuityDecisionState;\r\n\r\n focus?: {\r\n resolvedTargetFiles?: string[];\r\n resolvedTargetFolders?: string[];\r\n resolvedTargetSymbols?: string[];\r\n selectedFiles: string[];\r\n candidateFiles?: string[];\r\n discardedFiles?: string[];\r\n executionRequired?: string[];\r\n explorationCandidates?: string[];\r\n executionLock?: {\r\n enabled: boolean;\r\n files: string[];\r\n reason?: string;\r\n };\r\n rationale?: string;\r\n };\r\n\r\n scopeType?: ScopeType;\r\n\r\n routingDecision?: RoutingDecision;\r\n\r\n readiness?: ReadinessDecision;\r\n\r\n structure?: {\r\n files: {\r\n path: string;\r\n imports?: string[];\r\n exports?: string[];\r\n functions?: number;\r\n classes?: number;\r\n }[];\r\n };\r\n\r\n understanding?: {\r\n problemStatement?: string;\r\n constraints?: string[];\r\n assumptions?: string[];\r\n risks?: string[];\r\n sharedPatterns?: string[];\r\n hotspots?: string[];\r\n couplingPoints?: string[];\r\n };\r\n\r\n /**\r\n * FILE-LEVEL SEMANTIC ANALYSIS\r\n */\r\n fileAnalysis?: {\r\n [filePath: string]: FileAnalysis;\r\n };\r\n\r\n /**\r\n * CROSS-FILE ANALYSIS\r\n */\r\n combinedAnalysis?: CombinedAnalysis;\r\n\r\n /**\r\n * Structured research outputs produced by research-* task steps.\r\n * Used by later planning/final-answer phases.\r\n */\r\n researchArtifacts?: ResearchArtifactsState;\r\n trail?: TrailState;\r\n expansionRequest?: ExpansionRequest;\r\n\r\n /**\r\n * Verify-phase grounding outputs (evidence/confidence by file).\r\n * Produced in runVerify and consumed by readiness/file-check.\r\n */\r\n verify?: VerifyState;\r\n\r\n /**\r\n * Quick-read evidence produced by the `read-file` small action.\r\n * Keeps compact interpreted facts separate from raw loaded file content.\r\n */\r\n readResults?: {\r\n byFile: Record<string, ReadFileResult>;\r\n };\r\n\r\n /**\r\n * Policy / progress snapshots for the current loop turn.\r\n * `executionPolicy` is the pre-guard policy input.\r\n * `guardState` is the authoritative policy handoff.\r\n * `progressState` is the authoritative progress handoff.\r\n *\r\n * Canonical split:\r\n * - `guardState`: allowed moves\r\n * - `progressState`: needed moves\r\n */\r\n executionPolicy?: ExecutionPolicySnapshot;\r\n guardState?: GuardState;\r\n progressState?: ProgressState;\r\n\r\n /**\r\n * Objective and give-up state are fact inputs into progress resolution.\r\n */\r\n objective?: ObjectiveState;\r\n objectiveEvaluation?: ObjectiveEvaluationResult;\r\n giveUp?: GiveUpState;\r\n giveUpEvaluation?: GiveUpEvaluationResult;\r\n recoveryEvaluation?: RecoveryEvaluationState;\r\n plannerPromptState?: PlannerPromptState;\r\n attemptCounters?: AttemptCounters;\r\n\r\n\r\n /**\r\n * EXECUTION RESULTS (derived, authoritative)\r\n */\r\n executionOutcome?: ExecutionOutcome;\r\n\r\n /**\r\n * POST-EXECUTION REASONING\r\n * Decides whether and how the agent loops\r\n */\r\n iterationReasoning?: IterationReasoning;\r\n nextActionMenu?: NextActionMenuState;\r\n nextActionDecision?: NextActionDecision;\r\n nextActionValidation?: NextActionValidationResult;\r\n\r\n /**\r\n * Legacy compatibility field while older helpers are removed.\r\n * New user interaction should use `task.dialogState` and `analysis.dialogIntent`.\r\n */\r\n collaboratorFeedback?: CollaboratorFeedback;\r\n\r\n planSuggestion?: {\r\n text?: string;\r\n confidence?: number;\r\n plan?: AgentPlan;\r\n };\r\n\r\n folderCapsulesHuman?: string;\r\n\r\n finalAnswer?: string;\r\n}\r\n\r\n// -----------------------------------------------------------------------------\r\n// āœ… StructuredContext\r\n// Durable, machine-owned context shared across steps\r\n// Mental model: git → discovery (status/log) → working tree → staging & commit\r\n// -----------------------------------------------------------------------------\r\n\r\nexport interface StructuredContext {\r\n session?: Session;\r\n\r\n /* ======================================================================\r\n * 🧠 ANALYSIS STATE (authoritative, continuously refined)\r\n * Sits ABOVE phases; updated at phase boundaries\r\n * ====================================================================== */\r\n analysis?: AnalysisState;\r\n\r\n /**\r\n * 🚦 EXECUTION CONTROL (authoritative, immutable)\r\n * Determines which phases are allowed to run.\r\n */\r\n executionControl?: ExecutionControl;\r\n\r\n /**\r\n * Keep track of current step so modules for a given step can access the \r\n * step description, targetFile etc. \r\n */\r\n currentStep?: AgentPlanStep;\r\n\r\n\r\n /**\r\n * šŸ“ Task-level state (durable)\r\n * Holds the Task object including steps, progress, metadata.\r\n */\r\n task: Task;\r\n\r\n\r\n /* ======================================================================\r\n * šŸ“¦ PHASE 1 — DISCOVERY & NAVIGATION (cheap, non-binding)\r\n * Comparable to: git log / git grep / browsing the repo\r\n\r\n * 🧊 INIT CONTEXT — IMMUTABLE BASELINE\r\n * Collected once before reasoning begins\r\n *\r\n * Rules:\r\n * - Raw, non-interpretive\r\n * - Cheap to compute\r\n * - NEVER mutated\r\n * ====================================================================== */\r\n\r\n initContext?: {\r\n\r\n /**\r\n * Original user request.\r\n * Raw input, never rewritten.\r\n */\r\n userQuery: string;\r\n canonicalTaskQuery?: string;\r\n followUpQuery?: string;\r\n resumedContextCapsule?: string;\r\n\r\n repoRootPath?: string;\r\n executionPath?: string;\r\n currentBranch?: string;\r\n worktreePath?: string;\r\n\r\n /**\r\n * Raw repository structure.\r\n */\r\n repoTree?: string;\r\n\r\n /**\r\n * High-level understanding of the repository.\r\n * Informational only — never used for execution decisions.\r\n */\r\n projectSummary?: string;\r\n\r\n /**\r\n * Shallow summaries from indexing, KG sampling, or heuristics.\r\n * These do NOT imply the files are loaded or correct.\r\n */\r\n moduleSummaries?: {\r\n path: string;\r\n summary?: string;\r\n }[];\r\n\r\n folderSummaries?: {\r\n path: string;\r\n summary?: string;\r\n }[];\r\n\r\n /**\r\n * šŸ—‚ Folder capsules\r\n * Structural + semantic orientation units.\r\n * - Cheap to load\r\n * - Never mutated\r\n * - May be partial / probabilistic\r\n */\r\n folderCapsules?: FolderCapsule[];\r\n\r\n /**\r\n * Search- or KG-derived candidate paths.\r\n * Paths only; no guarantees of relevance or loading.\r\n */\r\n relatedFiles?: string[];\r\n\r\n /**\r\n * Optional path-indexed retrieval scores from semantic search.\r\n */\r\n relatedFileScores?: Record<string, number>;\r\n\r\n /**\r\n * Query terms expanded by retrieval for downstream grounding/evidence.\r\n */\r\n queryExpansionTerms?: string[];\r\n\r\n /**\r\n * Obvious root or entry-point files.\r\n */\r\n rootFiles?: string[];\r\n\r\n /**\r\n * Environment or platform hints.\r\n */\r\n environment?: {\r\n language?: string;\r\n framework?: string;\r\n runtime?: string;\r\n };\r\n\r\n /**\r\n * Small, partial knowledge-graph sample for orientation only.\r\n */\r\n kgSample?: {\r\n source: string;\r\n relation: string;\r\n target: string;\r\n }[];\r\n };\r\n\r\n\r\n /* ======================================================================\r\n * šŸ”§ PHASE 2 — WORKING SET (authoritative, code-loaded)\r\n * Comparable to: git checkout / working tree\r\n * \r\n * Move files to this phase as we select relevant files. From here after\r\n * further analysis they'll be selected for the planning phase. \r\n * ====================================================================== */\r\n\r\n /**\r\n * Files that have been explicitly selected and loaded with code.\r\n * This is the ONLY place executable code may exist in context.\r\n */\r\n workingFiles?: StructuredFileCapsule[];\r\n\r\n /* ======================================================================\r\n * šŸŽÆ PHASE 3 — PLANNING & DECISIONS (no code, no duplication)\r\n * Comparable to: git add / index / commit plan\r\n * ====================================================================== */\r\n\r\n plan?: {\r\n /**\r\n * Files the agent intends to modify.\r\n * Must be a subset of workingFiles (by path).\r\n */\r\n targetFiles?: string[];\r\n\r\n /**\r\n * Files that were actually modified during execution.\r\n * Append-only; used for reporting and validation.\r\n */\r\n touchedFiles?: string[];\r\n\r\n /**\r\n * Structured execution plan produced by the planner.\r\n */\r\n generatedPlan?: AgentPlan;\r\n };\r\n\r\n\r\n /* ======================================================================\r\n * šŸ›  EXECUTION ARTIFACTS (ephemeral, module-owned)\r\n * Materialized outputs of transformation steps\r\n * ====================================================================== */\r\n\r\n /**\r\n * Temporary artifacts produced during execution.\r\n * Valid only for the current run; safe to discard.\r\n */\r\n execution?: {\r\n codeTransformArtifacts?: {\r\n files: {\r\n filePath: string; // absolute or normalized path to overwrite\r\n content: string; // FULL file content AFTER transformation\r\n notes?: string; // optional per-file notes from the transform\r\n written?: boolean;\r\n }[];\r\n };\r\n };\r\n\r\n resumeDebug?: ResumeDebugInfo;\r\n}\r\n\r\n\r\n\r\n// -----------------------------------------------------------------------------\r\n// šŸ“„ StructuredFileCapsule\r\n// Represents a SINGLE loaded file in the working set (Phase 2).\r\n// Comparable to: a checked-out file in the git working tree.\r\n// -----------------------------------------------------------------------------\r\n\r\nexport interface StructuredFileCapsule {\r\n /**\r\n * Absolute or repo-relative path.\r\n * Acts as the stable identity key.\r\n */\r\n path: string;\r\n\r\n /* ======================================================================\r\n * šŸ“¦ DISCOVERY METADATA (cheap, optional)\r\n * May exist even if code is partially loaded or summarized.\r\n * ====================================================================== */\r\n\r\n /**\r\n * Human- or LLM-generated summary.\r\n * Must never contradict code.\r\n */\r\n summary?: string;\r\n\r\n /**\r\n * Knowledge-graph or index tags associated with this file.\r\n * Non-authoritative; used for navigation and recall.\r\n */\r\n kgTags?: string[];\r\n\r\n /**\r\n * Local KG neighborhood (paths, symbols, or concepts).\r\n * Optional and partial by design.\r\n */\r\n kgNeighborhood?: string[];\r\n\r\n /**\r\n * Focused subtree or file-local hierarchy\r\n * (e.g. extracted view from repoTree).\r\n */\r\n focusedTree?: string;\r\n\r\n /**\r\n * Optional reason why this file was selected into workingFiles.\r\n * Useful for logging/debugging — purely informational.\r\n */\r\n selectionReason?: string;\r\n\r\n /* ======================================================================\r\n * šŸ”§ CODE PAYLOAD (authoritative when present)\r\n * ====================================================================== */\r\n\r\n /**\r\n * Full source code of the file.\r\n * If present, this is the source of truth.\r\n */\r\n code?: string;\r\n\r\n /* ======================================================================\r\n * 🧠 STRUCTURAL FACTS (derived, non-semantic)\r\n * Must be derivable from `code` if present.\r\n * ====================================================================== */\r\n\r\n hierarchy?: string[];\r\n\r\n imports?: string[];\r\n exports?: string[];\r\n\r\n functions?: {\r\n name?: string;\r\n start?: number;\r\n end?: number;\r\n }[];\r\n\r\n classes?: {\r\n name?: string;\r\n start?: number;\r\n end?: number;\r\n }[];\r\n}\r\n\r\nexport interface Step {\r\n id?: number;\r\n taskId: number;\r\n filePath: string;\r\n action?: string;\r\n status: \"pending\" | \"completed\" | \"skipped\";\r\n startTime?: number;\r\n endTime?: number;\r\n result?: any;\r\n notes?: string;\r\n stepIndex?: number;\r\n\r\n stepQuestions?: string[];\r\n questionId?: string;\r\n}\r\n\r\nexport interface Session {\r\n id: number;\r\n projectId: number;\r\n hostType: \"cli\" | \"editor\";\r\n activeTaskId?: number;\r\n repoRootPath?: string;\r\n executionPath?: string;\r\n worktreePath?: string;\r\n routeLane?: string;\r\n runtimeState?: AnalysisState[\"runtimeState\"];\r\n status: \"active\" | \"completed\" | \"paused\" | \"gave-up\";\r\n createdAt: string;\r\n updatedAt: string;\r\n}\r\n\r\nexport interface Task {\r\n id: number;\r\n projectId: number;\r\n sessionId?: number;\r\n resumeTaskId?: number;\r\n resumeSource?: \"explicit\" | \"implicit\";\r\n bindAsCurrentTask?: boolean;\r\n status: \"active\" | \"completed\" | \"paused\" | \"deferred\" | \"gave-up\";\r\n reason?: string; // if deferred or paused, why?\r\n initialQuery: string;\r\n repoRootPath?: string;\r\n worktreePath?: string;\r\n worktreeBranch?: string;\r\n worktreeName?: string;\r\n baseBranch?: string;\r\n hasResumeContext?: boolean;\r\n summary?: string;\r\n\r\n agreedIntent?: string;\r\n intentCategory?: string;\r\n normalizedQuery?: string;\r\n intentConfidence?: number;\r\n\r\n relevantFiles?: string[];\r\n missingFiles?: string[];\r\n\r\n routingDecision?: any;\r\n objectiveJson?: string;\r\n completionStatus?: \"unknown\" | \"satisfied\" | \"unsatisfied\";\r\n giveUpStatus?: \"none\" | \"triggered\";\r\n giveUpReason?: GiveUpReason;\r\n attemptCountersJson?: string;\r\n\r\n createdAt: string;\r\n updatedAt: string;\r\n\r\n currentStep?: Step;\r\n steps: Step[];\r\n dialogState?: DialogState;\r\n taskQuestionDetails?: DecomposedQuestion[];\r\n taskQuestions?: string[];\r\n}\r\n\r\n\r\n// --------------------------------------------------------\r\n// āœ… New interface for gradual migration of modules\r\n// --------------------------------------------------------\r\n\r\n/**\r\n * Simplified, generic I/O interface for modules.\r\n * All new modules should read from `query` and `content` and\r\n * write to `query` and `data`. The `content` can be free-form\r\n * (string or structured object). This keeps modules decoupled\r\n * from the full PromptInput/Output shape.\r\n */\r\nexport interface ModuleIO {\n query: string;\n content?: string | object; // free-form input for reasoning or context\n data?: string | object; // structured output or model results\n trace?: {\n callId?: string;\n startedAt?: string;\n finishedAt?: string;\n durationMs?: number;\n attemptCount?: number;\n };\n context?: StructuredContext; // NEVER passed on module output (input only via mainagent)\n // Modules may write to context, but never read\r\n // Analysis modules / helpers read\r\n}\r\n\r\nexport interface TaskPlanStage {\r\n id: string;\r\n label: string;\r\n status: \"pending\" | \"active\" | \"done\" | \"blocked\";\r\n notes?: string;\r\n}\r\n\r\nexport interface TaskPlan {\r\n id: number;\r\n taskId: number;\r\n revision: number;\r\n status: \"active\" | \"superseded\" | \"completed\";\r\n objective: string;\r\n stages: TaskPlanStage[];\r\n risks: string[];\r\n assumptions: string[];\r\n acceptanceCriteria: string[];\r\n nextActions: string[];\r\n summary?: string;\r\n source: \"model\" | \"deterministic\" | \"hybrid\";\r\n createdAt: string;\r\n updatedAt: string;\r\n}\r\n\r\nexport interface TaskProgressSection {\r\n label: string;\r\n percent: number;\r\n status: \"pending\" | \"active\" | \"done\" | \"blocked\";\r\n}\r\n\r\nexport interface TaskProgressSnapshot {\r\n id: number;\r\n taskId: number;\r\n planId?: number;\r\n status: \"active\" | \"stale\" | \"final\";\r\n summary: string;\r\n sections: TaskProgressSection[];\r\n blockers: string[];\r\n nextFocus: string[];\r\n recentChanges: string[];\r\n progressPercent: number;\r\n createdAt: string;\r\n updatedAt: string;\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// āœ… New generic module type\r\n// --------------------------------------------------------\r\n\r\nexport type ModuleGroup = \"context\" | \"analysis\" | \"routing\" | \"transform\" | \"finalize\";\r\n\r\nexport type Module = {\r\n name: string;\r\n description: string;\r\n run: (input: ModuleIO) => Promise<ModuleIO>;\r\n groups?: ModuleGroup[];\r\n};\r\n\r\n\r\nexport interface KnowledgeGraphInput {\r\n fileId: number;\r\n filepath: string;\r\n summary?: string;\r\n}\r\n\r\nexport interface KnowledgeGraph {\r\n entities: { name: string; type: string; tags: string[] }[];\r\n edges: { from: string; to: string; type: string }[];\r\n}\r\n\r\nexport type FtsResult = {\r\n id: number;\r\n filename: string;\r\n path: string;\r\n summary: string;\r\n type: string;\r\n bm25Score: number;\r\n lastModified: string;\r\n};\r\n\r\n\r\nexport interface FileRow {\r\n id: number;\r\n path: string;\r\n type: string;\r\n summary: string | null;\r\n last_modified: string;\r\n indexed_at: string | null;\r\n functions_extracted: number | null;\r\n functions_extracted_at: string | null;\r\n processing_status: 'unprocessed' | 'extracted' | 'skipped' | 'failed';\r\n}\r\n\r\n// Narrow, query-specific rows\r\nexport interface FilePathRow {\r\n path: string;\r\n}\r\n\r\nexport interface FileSummaryRow {\r\n path: string;\r\n summary: string | null;\r\n}\r\n\r\nexport interface DaemonFileRow {\r\n id: number;\r\n path: string;\r\n summary: string | null;\r\n last_modified: string;\r\n indexed_at: string | null;\r\n processing_status: 'unprocessed' | 'extracted' | 'skipped' | 'failed';\r\n}\r\n\r\nexport interface SearchResult {\r\n id: number;\r\n path: string;\r\n filename: string;\r\n summary: string | null;\r\n type: string;\r\n lastModified: string;\r\n bm25Score?: number;\r\n queryExpansionTerms?: string[];\r\n}\r\n\r\nexport interface ExtractedFunction {\r\n id?: number;\r\n name: string;\r\n start_line: number;\r\n end_line: number;\r\n content: string;\r\n uniqueId?: string;\r\n}\r\n\r\nexport interface FunctionCall {\r\n calleeName: string;\r\n}\r\n\r\nexport type ReviewEvent = 'APPROVE' | 'REQUEST_CHANGES' | 'COMMENT';\r\n\r\nexport interface PullRequest {\r\n number: number;\r\n title: string;\r\n draft?: boolean;\r\n merged_at?: string | null;\r\n requested_reviewers?: Array<{ login: string }>;\r\n reviewers?: string[];\r\n review_status?: string;\r\n diff_url: string;\r\n body?: string;\r\n user?: { login: string };\r\n created_at?: string;\r\n\r\n head: {\r\n sha: string;\r\n ref: string;\r\n repo: {\r\n id: number;\r\n name: string;\r\n owner: {\r\n login: string;\r\n };\r\n };\r\n };\r\n}\r\n\r\n\r\nexport interface PullRequestWithDiff {\r\n pr: PullRequest;\r\n diff: string;\r\n}\r\n\r\n\r\nexport type DiffLine = {\r\n review_id?: string;\r\n line: string;\r\n lineNumberNew?: number;\r\n lineNumberOld?: number;\r\n type: 'add' | 'del' | 'context';\r\n position?: number;\r\n};\r\n\r\nexport type DiffHunk = {\r\n review_id?: string;\r\n oldStart: number;\r\n newStart: number;\r\n oldLines: number;\r\n newLines: number;\r\n lines: DiffLine[];\r\n};\r\n\r\nexport type DiffChunk = {\r\n review_id?: string;\r\n filePath: string;\r\n content: string;\r\n hunks: DiffHunk[];\r\n};\r\n\r\nexport interface RefineSearchResult {\r\n id?: number;\r\n path: string;\r\n summary?: string; // undefined is fine; null will be normalized\r\n score?: number;\r\n}\r\n"]}
@@ -1,61 +1,31 @@
1
- // src/utils/buildContextualPrompt.ts
1
+ /**
2
+ * Builds the lightweight contextual prompt and seed context used before deeper agent work starts.
3
+ *
4
+ * Why this exists:
5
+ * - small local models need compact, structured repo context instead of a full transcript
6
+ * - prompt seeding should stay deterministic enough to reuse across routing and retrieval flows
7
+ */
2
8
  import path from "path";
3
9
  import fs from "fs";
4
10
  import { getDbForRepo } from "../db/client.js";
5
11
  import { generateFileTree, generateFocusedFileTree } from "./fileTree.js";
6
12
  import { RELATED_FILES_LIMIT } from "../constants.js";
7
13
  import { loadRelevantFolderCapsules } from "./loadRelevantFolderCapsules.js";
8
- import { extractFileReferences } from "./extractFileReferences.js";
14
+ import { getContextExecutionPath, mapExecutionPathToCanonicalPath, resolveCanonicalRepoIdentity, } from "./repoIdentity.js";
9
15
  /* --- Constants --- */
10
16
  const MAX_FUNCTIONS = 50;
11
- const MAX_KG_NEIGHBORS = 50;
12
- const DEFAULT_KG_DEPTH = 3;
13
17
  /* --- Helpers --- */
14
18
  function fileRowIdForPath(db, filePath) {
15
19
  try {
16
20
  const row = db
17
21
  .prepare(`SELECT id FROM files WHERE path = ?`)
18
- .get(filePath);
22
+ .get(mapExecutionPathToCanonicalPath(filePath));
19
23
  return row?.id;
20
24
  }
21
25
  catch {
22
26
  return undefined;
23
27
  }
24
28
  }
25
- /* ---------------- KG helpers ---------------- */
26
- function loadKgTags(db, entityUniqueId, limit = MAX_KG_NEIGHBORS) {
27
- try {
28
- const rows = db
29
- .prepare(`
30
- SELECT tm.name as tag
31
- FROM graph_entity_tags et
32
- JOIN graph_tags_master tm ON tm.id = et.tag_id
33
- WHERE et.entity_unique_id = ?
34
- LIMIT ?
35
- `)
36
- .all(entityUniqueId, limit);
37
- return rows.map((r) => r.tag);
38
- }
39
- catch {
40
- return [];
41
- }
42
- }
43
- function loadKgNeighbors(db, sourceUniqueId, limit = MAX_KG_NEIGHBORS) {
44
- try {
45
- const rows = db
46
- .prepare(`
47
- SELECT relation, target_unique_id as target
48
- FROM graph_edges
49
- WHERE source_unique_id = ?
50
- LIMIT ?
51
- `)
52
- .all(sourceUniqueId, limit);
53
- return rows.map((r) => ({ relation: r.relation, target: r.target }));
54
- }
55
- catch {
56
- return [];
57
- }
58
- }
59
29
  /* ---------------- Functions / classes ---------------- */
60
30
  function loadFunctions(db, fileId, limit = MAX_FUNCTIONS) {
61
31
  if (!fileId)
@@ -110,7 +80,7 @@ function safeGenerateFocusedTree(filePath, depth = 2) {
110
80
  }
111
81
  function safeGenerateRepoTree(depth = 2) {
112
82
  try {
113
- const root = process.cwd();
83
+ const root = getContextExecutionPath();
114
84
  return generateFileTree(root, depth) || undefined;
115
85
  }
116
86
  catch {
@@ -121,7 +91,7 @@ function safeGenerateRepoTree(depth = 2) {
121
91
  LIGHT CONTEXT
122
92
  ====================================================== */
123
93
  export async function buildLightContext(args) {
124
- const db = getDbForRepo();
94
+ const repoIdentity = resolveCanonicalRepoIdentity();
125
95
  const safeTopFiles = Array.isArray(args.topFiles) ? args.topFiles : [];
126
96
  const safeRelated = Array.isArray(args.relatedFiles)
127
97
  ? args.relatedFiles
@@ -129,6 +99,10 @@ export async function buildLightContext(args) {
129
99
  const ctx = {
130
100
  initContext: {
131
101
  userQuery: args.query?.trim() ?? "",
102
+ repoRootPath: repoIdentity.repoRootPath,
103
+ executionPath: repoIdentity.executionPath,
104
+ currentBranch: repoIdentity.currentBranch,
105
+ worktreePath: repoIdentity.worktreePath,
132
106
  repoTree: undefined,
133
107
  relatedFiles: [],
134
108
  relatedFileScores: {},
@@ -141,7 +115,7 @@ export async function buildLightContext(args) {
141
115
  initialQuery: args.query?.trim() ?? "",
142
116
  createdAt: new Date().toISOString(),
143
117
  updatedAt: new Date().toISOString(),
144
- taskSteps: [],
118
+ steps: [],
145
119
  },
146
120
  };
147
121
  /* -------- Collect related file paths -------- */
@@ -163,22 +137,6 @@ export async function buildLightContext(args) {
163
137
  relatedFileScores[p] = candidate.bm25Score;
164
138
  }
165
139
  }
166
- /* -------- Add file references from user query -------- */
167
- const referencedFiles = extractFileReferences(ctx.initContext.userQuery, {
168
- lowercase: true,
169
- });
170
- const topFilePaths = [];
171
- for (const ref of referencedFiles) {
172
- const found = safeTopFiles.find(f => f.path.toLowerCase().includes(ref));
173
- if (found && !topFilePaths.includes(found.path)) {
174
- topFilePaths.push(found.path);
175
- }
176
- }
177
- // Merge query references into relatedPaths
178
- for (const tf of topFilePaths) {
179
- if (!relatedPaths.includes(tf))
180
- relatedPaths.push(tf);
181
- }
182
140
  ctx.initContext.relatedFiles = relatedPaths;
183
141
  ctx.initContext.relatedFileScores = Object.fromEntries(Object.entries(relatedFileScores).filter(([filePath]) => relatedPaths.includes(filePath)));
184
142
  ctx.initContext.queryExpansionTerms = Array.from(new Set((args.queryExpansionTerms ?? [])
@@ -186,7 +144,10 @@ export async function buildLightContext(args) {
186
144
  .filter(term => term.length >= 2)));
187
145
  /* -------- Folder capsules (orientation layer) -------- */
188
146
  const folderPaths = normalizeToFolders(relatedPaths);
189
- let folderCapsules = loadRelevantFolderCapsules(folderPaths);
147
+ let folderCapsules = loadRelevantFolderCapsules(folderPaths, {
148
+ repoRootPath: repoIdentity.repoRootPath,
149
+ executionPath: repoIdentity.executionPath,
150
+ });
190
151
  // Ensure root capsule exists
191
152
  const rootExists = folderCapsules.some(c => c.path === '/');
192
153
  if (!rootExists) {
@@ -227,7 +188,7 @@ function normalizeToFolders(paths) {
227
188
  /* ======================================================
228
189
  IN-DEPTH CONTEXT (Structural-Only)
229
190
  ====================================================== */
230
- export async function buildInDepthContext({ filenames, kgDepth = DEFAULT_KG_DEPTH, relatedFiles, query, }) {
191
+ export async function buildInDepthContext({ filenames, }) {
231
192
  const db = getDbForRepo();
232
193
  const safeFilenames = Array.isArray(filenames) ? filenames : [];
233
194
  const result = {};
@@ -238,23 +199,13 @@ export async function buildInDepthContext({ filenames, kgDepth = DEFAULT_KG_DEPT
238
199
  structural.functions = loadFunctions(db, fileId, MAX_FUNCTIONS);
239
200
  structural.classes = loadClasses(db, fileId, 200);
240
201
  }
241
- const neighbors = loadKgNeighbors(db, p, MAX_KG_NEIGHBORS);
242
- structural.kgTags = loadKgTags(db, p, MAX_KG_NEIGHBORS);
243
- if (neighbors.length) {
244
- structural.kgNeighborhood = neighbors.map((e) => `${e.relation}:${e.target}`);
245
- const imports = neighbors
246
- .filter((e) => e.relation === "imports")
247
- .map((e) => e.target);
248
- const exports = neighbors
249
- .filter((e) => e.relation === "exports")
250
- .map((e) => e.target);
251
- if (imports.length)
252
- structural.imports = imports.slice(0, 200);
253
- if (exports.length)
254
- structural.exports = exports.slice(0, 200);
255
- }
202
+ structural.kgTags = [];
203
+ structural.kgNeighborhood = [];
204
+ structural.imports = [];
205
+ structural.exports = [];
256
206
  structural.focusedTree = safeGenerateFocusedTree(p, 3);
257
207
  result[p] = structural;
258
208
  }
259
209
  return result;
260
210
  }
211
+ //# sourceMappingURL=buildContextualPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildContextualPrompt.js","sourceRoot":"","sources":["../../src/utils/buildContextualPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;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C;QAAC,MAAM,CAAC;YACP,uBAAuB;QACzB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC;AAED;;4DAE4D;AAE5D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,SAAS,GAGV;IASC,MAAM,EAAE,GAAG,YAAY,EAAE,CAAC;IAC1B,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhE,MAAM,MAAM,GAQP,EAAE,CAAC;IAER,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAEvC,MAAM,UAAU,GAQZ,EAAE,CAAC;QAEP,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,UAAU,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YAChE,UAAU,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACpD,CAAC;QAED,UAAU,CAAC,MAAM,GAAG,EAAE,CAAC;QACvB,UAAU,CAAC,cAAc,GAAG,EAAE,CAAC;QAC/B,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;QACxB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;QAExB,UAAU,CAAC,WAAW,GAAG,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEvD,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IACzB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Builds the lightweight contextual prompt and seed context used before deeper agent work starts.\n *\n * Why this exists:\n * - small local models need compact, structured repo context instead of a full transcript\n * - prompt seeding should stay deterministic enough to reuse across routing and retrieval flows\n */\nimport path from \"path\";\nimport fs from \"fs\";\r\nimport { getDbForRepo } from \"../db/client.js\";\nimport {\r\n BuildContextualPromptArgs,\r\n TopFile,\r\n StructuredContext,\r\n StructuredFileCapsule,\r\n FolderCapsule,\r\n} from \"../types.js\";\r\nimport { generateFileTree, generateFocusedFileTree } from \"./fileTree.js\";\nimport { RELATED_FILES_LIMIT } from \"../constants.js\";\nimport { loadRelevantFolderCapsules } from \"./loadRelevantFolderCapsules.js\";\nimport {\n getContextExecutionPath,\n mapExecutionPathToCanonicalPath,\n resolveCanonicalRepoIdentity,\n} from \"./repoIdentity.js\";\n\r\n\r\n/* --- Constants --- */\r\nconst MAX_FUNCTIONS = 50;\n\r\n/* --- Helpers --- */\r\nfunction fileRowIdForPath(db: any, filePath: string): number | undefined {\n try {\n const row = db\n .prepare(`SELECT id FROM files WHERE path = ?`)\n .get(mapExecutionPathToCanonicalPath(filePath)) as { id: number } | undefined;\n return row?.id;\n } catch {\n return undefined;\n }\n}\n\r\n/* ---------------- Functions / classes ---------------- */\n\r\nfunction loadFunctions(\r\n db: any,\r\n fileId?: number,\r\n limit = MAX_FUNCTIONS\r\n): { name?: string; start?: number; end?: number }[] {\r\n if (!fileId) return [];\r\n try {\r\n const rows = db\r\n .prepare(\r\n `SELECT name, start_line, end_line\r\n FROM functions\r\n WHERE file_id = ?\r\n ORDER BY start_line\r\n LIMIT ?`\r\n )\r\n .all(fileId, limit) as {\r\n name: string | null;\r\n start_line: number;\r\n end_line: number;\r\n }[];\r\n return rows.map((r) => ({\r\n name: r.name ?? undefined,\r\n start: r.start_line,\r\n end: r.end_line,\r\n }));\r\n } catch {\r\n return [];\r\n }\r\n}\r\n\r\nfunction loadClasses(\r\n db: any,\r\n fileId?: number,\r\n limit = 50\r\n): { name?: string; start?: number; end?: number }[] {\r\n if (!fileId) return [];\r\n try {\r\n const rows = db\r\n .prepare(\r\n `SELECT name, start_line, end_line\r\n FROM graph_classes\r\n WHERE file_id = ?\r\n ORDER BY start_line\r\n LIMIT ?`\r\n )\r\n .all(fileId, limit) as {\r\n name: string | null;\r\n start_line: number;\r\n end_line: number;\r\n }[];\r\n return rows.map((r) => ({\r\n name: r.name ?? undefined,\r\n start: r.start_line,\r\n end: r.end_line,\r\n }));\r\n } catch {\r\n return [];\r\n }\r\n}\r\n\r\n/* ---------------- Trees ---------------- */\r\n\r\nfunction safeGenerateFocusedTree(\r\n filePath: string,\r\n depth = 2\r\n): string | undefined {\r\n try {\r\n return generateFocusedFileTree(filePath, depth) || undefined;\r\n } catch {\r\n return undefined;\r\n }\r\n}\r\n\r\nfunction safeGenerateRepoTree(depth = 2): string | undefined {\n try {\n const root = getContextExecutionPath();\n return generateFileTree(root, depth) || undefined;\n } catch {\n return undefined;\n }\n}\n\r\n/* ======================================================\r\n LIGHT CONTEXT\r\n ====================================================== */\r\n\r\nexport async function buildLightContext(\n args: BuildContextualPromptArgs\n): Promise<StructuredContext> {\n const repoIdentity = resolveCanonicalRepoIdentity();\n\r\n const safeTopFiles = Array.isArray(args.topFiles) ? args.topFiles : [];\r\n const safeRelated = Array.isArray(args.relatedFiles)\r\n ? args.relatedFiles\r\n : [];\r\n\r\n const ctx: StructuredContext = {\n initContext: {\n userQuery: args.query?.trim() ?? \"\",\n repoRootPath: repoIdentity.repoRootPath,\n executionPath: repoIdentity.executionPath,\n currentBranch: repoIdentity.currentBranch,\n worktreePath: repoIdentity.worktreePath,\n repoTree: undefined,\n relatedFiles: [],\n relatedFileScores: {},\n folderCapsules: [],\n },\n task: {\r\n id: 0,\r\n projectId: 0,\r\n status: \"active\",\r\n initialQuery: args.query?.trim() ?? \"\",\r\n createdAt: new Date().toISOString(),\r\n updatedAt: new Date().toISOString(),\r\n steps: [],\n },\r\n };\r\n\r\n /* -------- Collect related file paths -------- */\r\n const relatedPaths: string[] = [];\n const relatedFileScores: Record<string, number> = {};\n\n for (const tf of safeTopFiles) {\n if (!relatedPaths.includes(tf.path)) relatedPaths.push(tf.path);\n if (typeof tf.bm25Score === \"number\" && Number.isFinite(tf.bm25Score)) {\n relatedFileScores[tf.path] = tf.bm25Score;\n }\n }\n\r\n for (\n let i = 0;\n i < Math.min(RELATED_FILES_LIMIT, safeRelated.length);\n i++\n ) {\n const candidate = safeRelated[i];\n const p = candidate.path;\n if (!relatedPaths.includes(p)) relatedPaths.push(p);\n if (typeof candidate.bm25Score === \"number\" && Number.isFinite(candidate.bm25Score)) {\n relatedFileScores[p] = candidate.bm25Score;\n }\n }\n\r\n ctx.initContext!.relatedFiles = relatedPaths;\n ctx.initContext!.relatedFileScores = Object.fromEntries(\n Object.entries(relatedFileScores).filter(([filePath]) => relatedPaths.includes(filePath))\n );\n ctx.initContext!.queryExpansionTerms = Array.from(\n new Set(\n (args.queryExpansionTerms ?? [])\n .map(term => String(term).trim().toLowerCase())\n .filter(term => term.length >= 2)\n )\n );\n\r\n /* -------- Folder capsules (orientation layer) -------- */\n const folderPaths = normalizeToFolders(relatedPaths);\n let folderCapsules = loadRelevantFolderCapsules(folderPaths, {\n repoRootPath: repoIdentity.repoRootPath,\n executionPath: repoIdentity.executionPath,\n });\n\r\n // Ensure root capsule exists\r\n const rootExists = folderCapsules.some(c => c.path === '/');\r\n if (!rootExists) {\r\n const rootCapsule: FolderCapsule = {\r\n path: '/',\r\n depth: 1,\r\n stats: { fileCount: 0, byType: {} },\r\n roles: [],\r\n concerns: [],\r\n keyFiles: [],\r\n dependencies: { importsFrom: [], usedBy: [] },\r\n confidence: 0.5,\r\n };\r\n folderCapsules.unshift(rootCapsule);\r\n }\r\n\r\n ctx.initContext!.folderCapsules = folderCapsules;\r\n return ctx;\r\n}\r\n\r\n/* -------- Helper: get folders from filepaths -------- */\r\nfunction normalizeToFolders(paths: string[]): string[] {\r\n const out = new Set<string>();\r\n\r\n for (const p of paths) {\r\n try {\r\n const stat = fs.statSync(p);\r\n if (stat.isDirectory()) {\r\n out.add(p);\r\n } else if (stat.isFile()) {\r\n out.add(path.dirname(p));\r\n }\r\n } catch {\r\n // ignore invalid paths\r\n }\r\n }\r\n\r\n return [...out];\r\n}\r\n\r\n/* ======================================================\n IN-DEPTH CONTEXT (Structural-Only)\n ====================================================== */\n\r\nexport async function buildInDepthContext({\n filenames,\n}: {\n filenames: string[];\n}): Promise<Record<string, {\n kgTags?: string[];\r\n kgNeighborhood?: string[];\r\n imports?: string[];\r\n exports?: string[];\r\n functions?: { name?: string; start?: number; end?: number }[];\r\n classes?: { name?: string; start?: number; end?: number }[];\r\n focusedTree?: string;\r\n}>> {\r\n const db = getDbForRepo();\r\n const safeFilenames = Array.isArray(filenames) ? filenames : [];\r\n\r\n const result: Record<string, {\r\n kgTags?: string[];\r\n kgNeighborhood?: string[];\r\n imports?: string[];\r\n exports?: string[];\r\n functions?: { name?: string; start?: number; end?: number }[];\r\n classes?: { name?: string; start?: number; end?: number }[];\r\n focusedTree?: string;\r\n }> = {};\r\n\r\n for (const p of safeFilenames) {\r\n const fileId = fileRowIdForPath(db, p);\r\n\r\n const structural: {\r\n kgTags?: string[];\r\n kgNeighborhood?: string[];\r\n imports?: string[];\r\n exports?: string[];\r\n functions?: { name?: string; start?: number; end?: number }[];\r\n classes?: { name?: string; start?: number; end?: number }[];\r\n focusedTree?: string;\r\n } = {};\r\n\r\n if (typeof fileId === \"number\") {\r\n structural.functions = loadFunctions(db, fileId, MAX_FUNCTIONS);\r\n structural.classes = loadClasses(db, fileId, 200);\r\n }\r\n\r\n structural.kgTags = [];\n structural.kgNeighborhood = [];\n structural.imports = [];\n structural.exports = [];\n\n structural.focusedTree = safeGenerateFocusedTree(p, 3);\n\r\n result[p] = structural;\r\n }\r\n\r\n return result;\r\n}\r\n\r\n"]}
@@ -32,3 +32,4 @@ export async function askChangelogApproval(changelogEntry) {
32
32
  });
33
33
  });
34
34
  }
35
+ //# sourceMappingURL=changeLogPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changeLogPrompt.js","sourceRoot":"","sources":["../../src/utils/changeLogPrompt.ts"],"names":[],"mappings":"AAAA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AC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// src/utils/changelogPrompt.ts\r\nimport chalk from 'chalk';\r\nimport readline from 'readline';\r\n\r\nexport async function askChangelogApproval(changelogEntry: string): Promise<'yes' | 'redo' | 'skip' | 'edit'> {\r\n return new Promise((resolve) => {\r\n console.log('\\n---');\r\n console.log(chalk.yellow('Suggested changelog entry:\\n'));\r\n console.log(changelogEntry);\r\n console.log('\\nOptions:');\r\n console.log('1) āœ… Accept');\r\n console.log('2) šŸ” Regenerate');\r\n console.log('3) šŸ–‹ļø Edit');\r\n console.log('4) āŒ Skip');\r\n\r\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\r\n rl.question('\\nšŸ‘‰ Choose an option [1-4]: ', (answer) => {\r\n rl.close();\r\n switch (answer) {\r\n case '1': resolve('yes'); break;\r\n case '2': resolve('redo'); break;\r\n case '3': resolve('edit'); break;\r\n case '4': default: resolve('skip'); break;\r\n }\r\n });\r\n });\r\n}\r\n"]}