codehere 0.5.2-alpha → 0.5.3-alpha

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 (375) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +126 -102
  3. package/dist/application/agents/execution-agent.js +2 -2
  4. package/dist/application/agents/multi-agent-orchestrator.d.ts +0 -1
  5. package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
  6. package/dist/application/agents/multi-agent-orchestrator.js +2 -9
  7. package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
  8. package/dist/application/agents/planning-agent.d.ts.map +1 -1
  9. package/dist/application/agents/planning-agent.js +11 -15
  10. package/dist/application/agents/planning-agent.js.map +1 -1
  11. package/dist/application/services/context-importer.d.ts +71 -0
  12. package/dist/application/services/context-importer.d.ts.map +1 -0
  13. package/dist/application/services/context-importer.js +436 -0
  14. package/dist/application/services/context-importer.js.map +1 -0
  15. package/dist/application/services/context-manager.d.ts +132 -0
  16. package/dist/application/services/context-manager.d.ts.map +1 -0
  17. package/dist/application/services/context-manager.js +369 -0
  18. package/dist/application/services/context-manager.js.map +1 -0
  19. package/dist/application/services/dependency-container.d.ts.map +1 -1
  20. package/dist/application/services/dependency-container.js +7 -5
  21. package/dist/application/services/dependency-container.js.map +1 -1
  22. package/dist/application/services/intelligent-router.d.ts +8 -5
  23. package/dist/application/services/intelligent-router.d.ts.map +1 -1
  24. package/dist/application/services/intelligent-router.js +78 -82
  25. package/dist/application/services/intelligent-router.js.map +1 -1
  26. package/dist/application/services/token-counting-service.d.ts +87 -0
  27. package/dist/application/services/token-counting-service.d.ts.map +1 -0
  28. package/dist/application/services/token-counting-service.js +196 -0
  29. package/dist/application/services/token-counting-service.js.map +1 -0
  30. package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
  31. package/dist/application/use-cases/ask-question-use-case.js +109 -21
  32. package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
  33. package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
  34. package/dist/application/use-cases/edit-file-use-case.js +19 -0
  35. package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
  36. package/dist/application/use-cases/planning-use-case.d.ts +1 -14
  37. package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
  38. package/dist/application/use-cases/planning-use-case.js +2 -109
  39. package/dist/application/use-cases/planning-use-case.js.map +1 -1
  40. package/dist/chat.d.ts.map +1 -1
  41. package/dist/chat.js +6 -17
  42. package/dist/chat.js.map +1 -1
  43. package/dist/domain/entities/conversation-context.d.ts +245 -0
  44. package/dist/domain/entities/conversation-context.d.ts.map +1 -0
  45. package/dist/domain/entities/conversation-context.js +50 -0
  46. package/dist/domain/entities/conversation-context.js.map +1 -0
  47. package/dist/domain/entities/memory.d.ts.map +1 -1
  48. package/dist/domain/interfaces/context-repository.interface.d.ts +71 -0
  49. package/dist/domain/interfaces/context-repository.interface.d.ts.map +1 -0
  50. package/dist/domain/interfaces/context-repository.interface.js +10 -0
  51. package/dist/domain/interfaces/context-repository.interface.js.map +1 -0
  52. package/dist/domain/services/query-intent-classifier.d.ts.map +1 -1
  53. package/dist/domain/services/query-intent-classifier.js +37 -23
  54. package/dist/domain/services/query-intent-classifier.js.map +1 -1
  55. package/dist/embed.d.ts.map +1 -1
  56. package/dist/embed.js +8 -3
  57. package/dist/embed.js.map +1 -1
  58. package/dist/index.js +267 -143
  59. package/dist/index.js.map +1 -1
  60. package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
  61. package/dist/infrastructure/ai/cohere-ai-service.js +14 -5
  62. package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
  63. package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -1
  64. package/dist/infrastructure/ai/provider-ai-service.js +64 -14
  65. package/dist/infrastructure/ai/provider-ai-service.js.map +1 -1
  66. package/dist/infrastructure/config/config-manager.d.ts +78 -9
  67. package/dist/infrastructure/config/config-manager.d.ts.map +1 -1
  68. package/dist/infrastructure/config/config-manager.js +127 -9
  69. package/dist/infrastructure/config/config-manager.js.map +1 -1
  70. package/dist/infrastructure/context/conversation-context.d.ts +39 -12
  71. package/dist/infrastructure/context/conversation-context.d.ts.map +1 -1
  72. package/dist/infrastructure/context/conversation-context.js +91 -4
  73. package/dist/infrastructure/context/conversation-context.js.map +1 -1
  74. package/dist/infrastructure/context/direct-context-provider.d.ts +18 -0
  75. package/dist/infrastructure/context/direct-context-provider.d.ts.map +1 -0
  76. package/dist/infrastructure/context/direct-context-provider.js +222 -0
  77. package/dist/infrastructure/context/direct-context-provider.js.map +1 -0
  78. package/dist/infrastructure/context/git-context-provider.d.ts +30 -0
  79. package/dist/infrastructure/context/git-context-provider.d.ts.map +1 -0
  80. package/dist/infrastructure/context/git-context-provider.js +140 -0
  81. package/dist/infrastructure/context/git-context-provider.js.map +1 -0
  82. package/dist/infrastructure/context/project-context-loader.d.ts +35 -0
  83. package/dist/infrastructure/context/project-context-loader.d.ts.map +1 -0
  84. package/dist/infrastructure/context/project-context-loader.js +184 -0
  85. package/dist/infrastructure/context/project-context-loader.js.map +1 -0
  86. package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
  87. package/dist/infrastructure/cost/cost-tracker.js +3 -2
  88. package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
  89. package/dist/infrastructure/cost/session-token-tracker.d.ts +68 -0
  90. package/dist/infrastructure/cost/session-token-tracker.d.ts.map +1 -0
  91. package/dist/infrastructure/cost/session-token-tracker.js +178 -0
  92. package/dist/infrastructure/cost/session-token-tracker.js.map +1 -0
  93. package/dist/infrastructure/index.d.ts +1 -0
  94. package/dist/infrastructure/index.d.ts.map +1 -1
  95. package/dist/infrastructure/index.js +1 -2
  96. package/dist/infrastructure/index.js.map +1 -1
  97. package/dist/infrastructure/observability/execution-tracer.d.ts +21 -0
  98. package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -1
  99. package/dist/infrastructure/observability/execution-tracer.js +157 -4
  100. package/dist/infrastructure/observability/execution-tracer.js.map +1 -1
  101. package/dist/infrastructure/protocols/a2a-metadata.js +1 -1
  102. package/dist/infrastructure/protocols/mcp-oauth.js +1 -1
  103. package/dist/infrastructure/providers/cohere-provider.d.ts +1 -2
  104. package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -1
  105. package/dist/infrastructure/providers/cohere-provider.js +44 -42
  106. package/dist/infrastructure/providers/cohere-provider.js.map +1 -1
  107. package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -1
  108. package/dist/infrastructure/providers/fake-provider.js +8 -0
  109. package/dist/infrastructure/providers/fake-provider.js.map +1 -1
  110. package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -1
  111. package/dist/infrastructure/providers/local-llm-provider.js +8 -2
  112. package/dist/infrastructure/providers/local-llm-provider.js.map +1 -1
  113. package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -1
  114. package/dist/infrastructure/providers/openai-provider.js +40 -7
  115. package/dist/infrastructure/providers/openai-provider.js.map +1 -1
  116. package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -1
  117. package/dist/infrastructure/providers/openrouter-provider.js +13 -7
  118. package/dist/infrastructure/providers/openrouter-provider.js.map +1 -1
  119. package/dist/infrastructure/security/enhanced-security-gate.d.ts +13 -0
  120. package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -1
  121. package/dist/infrastructure/security/enhanced-security-gate.js +56 -1
  122. package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -1
  123. package/dist/infrastructure/security/input-validator.d.ts +17 -0
  124. package/dist/infrastructure/security/input-validator.d.ts.map +1 -1
  125. package/dist/infrastructure/security/input-validator.js +140 -25
  126. package/dist/infrastructure/security/input-validator.js.map +1 -1
  127. package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -1
  128. package/dist/infrastructure/storage/embeddings-path.js +14 -4
  129. package/dist/infrastructure/storage/embeddings-path.js.map +1 -1
  130. package/dist/infrastructure/storage/memory-stream-service.d.ts.map +1 -1
  131. package/dist/infrastructure/storage/memory-stream-service.js +58 -88
  132. package/dist/infrastructure/storage/memory-stream-service.js.map +1 -1
  133. package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
  134. package/dist/infrastructure/storage/plan-repository.js +4 -5
  135. package/dist/infrastructure/storage/plan-repository.js.map +1 -1
  136. package/dist/infrastructure/storage/sqlite-context-repository.d.ts +95 -0
  137. package/dist/infrastructure/storage/sqlite-context-repository.d.ts.map +1 -0
  138. package/dist/infrastructure/storage/sqlite-context-repository.js +467 -0
  139. package/dist/infrastructure/storage/sqlite-context-repository.js.map +1 -0
  140. package/dist/infrastructure/storage/sqlite-decision-repository.d.ts.map +1 -1
  141. package/dist/infrastructure/storage/sqlite-decision-repository.js +4 -8
  142. package/dist/infrastructure/storage/sqlite-decision-repository.js.map +1 -1
  143. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts.map +1 -1
  144. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +4 -8
  145. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js.map +1 -1
  146. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts.map +1 -1
  147. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +4 -8
  148. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js.map +1 -1
  149. package/dist/infrastructure/storage/sqlite-memory-repository.d.ts.map +1 -1
  150. package/dist/infrastructure/storage/sqlite-memory-repository.js +4 -8
  151. package/dist/infrastructure/storage/sqlite-memory-repository.js.map +1 -1
  152. package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts.map +1 -1
  153. package/dist/infrastructure/storage/sqlite-pattern-repository.js +4 -8
  154. package/dist/infrastructure/storage/sqlite-pattern-repository.js.map +1 -1
  155. package/dist/infrastructure/storage/task-repository.d.ts +0 -1
  156. package/dist/infrastructure/storage/task-repository.d.ts.map +1 -1
  157. package/dist/infrastructure/storage/task-repository.js +2 -13
  158. package/dist/infrastructure/storage/task-repository.js.map +1 -1
  159. package/dist/infrastructure/ux/cli-style-guide.d.ts +105 -0
  160. package/dist/infrastructure/ux/cli-style-guide.d.ts.map +1 -0
  161. package/dist/infrastructure/ux/cli-style-guide.js +220 -0
  162. package/dist/infrastructure/ux/cli-style-guide.js.map +1 -0
  163. package/dist/infrastructure/ux/progress-indicator.d.ts +49 -10
  164. package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
  165. package/dist/infrastructure/ux/progress-indicator.js +112 -9
  166. package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
  167. package/dist/infrastructure/validation/agent-feedback.d.ts +14 -1
  168. package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -1
  169. package/dist/infrastructure/validation/agent-feedback.js +57 -3
  170. package/dist/infrastructure/validation/agent-feedback.js.map +1 -1
  171. package/dist/parallel-processor.d.ts.map +1 -1
  172. package/dist/parallel-processor.js +39 -11
  173. package/dist/parallel-processor.js.map +1 -1
  174. package/dist/presentation/cli/commands/ask-command.d.ts +1 -2
  175. package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
  176. package/dist/presentation/cli/commands/ask-command.js +66 -150
  177. package/dist/presentation/cli/commands/ask-command.js.map +1 -1
  178. package/dist/presentation/cli/commands/audit-command.d.ts +13 -0
  179. package/dist/presentation/cli/commands/audit-command.d.ts.map +1 -0
  180. package/dist/presentation/cli/commands/audit-command.js +96 -0
  181. package/dist/presentation/cli/commands/audit-command.js.map +1 -0
  182. package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
  183. package/dist/presentation/cli/commands/config-command.js +2 -14
  184. package/dist/presentation/cli/commands/config-command.js.map +1 -1
  185. package/dist/presentation/cli/commands/context-command.d.ts +32 -0
  186. package/dist/presentation/cli/commands/context-command.d.ts.map +1 -0
  187. package/dist/presentation/cli/commands/context-command.js +295 -0
  188. package/dist/presentation/cli/commands/context-command.js.map +1 -0
  189. package/dist/presentation/cli/commands/context-helper.d.ts +16 -0
  190. package/dist/presentation/cli/commands/context-helper.d.ts.map +1 -0
  191. package/dist/presentation/cli/commands/context-helper.js +88 -0
  192. package/dist/presentation/cli/commands/context-helper.js.map +1 -0
  193. package/dist/presentation/cli/commands/decision-command.js +6 -23
  194. package/dist/presentation/cli/commands/decision-command.js.map +1 -1
  195. package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -1
  196. package/dist/presentation/cli/commands/fix-command.js +19 -23
  197. package/dist/presentation/cli/commands/fix-command.js.map +1 -1
  198. package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
  199. package/dist/presentation/cli/commands/help-command.js +1 -21
  200. package/dist/presentation/cli/commands/help-command.js.map +1 -1
  201. package/dist/presentation/cli/commands/orchestrate-command.d.ts +0 -1
  202. package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
  203. package/dist/presentation/cli/commands/orchestrate-command.js +19 -126
  204. package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
  205. package/dist/presentation/cli/commands/plan-command.d.ts +0 -1
  206. package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
  207. package/dist/presentation/cli/commands/plan-command.js +42 -132
  208. package/dist/presentation/cli/commands/plan-command.js.map +1 -1
  209. package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
  210. package/dist/presentation/cli/commands/react-command.js +1 -5
  211. package/dist/presentation/cli/commands/react-command.js.map +1 -1
  212. package/dist/presentation/cli/commands/review-command.d.ts.map +1 -1
  213. package/dist/presentation/cli/commands/review-command.js +2 -21
  214. package/dist/presentation/cli/commands/review-command.js.map +1 -1
  215. package/dist/presentation/cli/commands/smart-command.d.ts +3 -0
  216. package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
  217. package/dist/presentation/cli/commands/smart-command.js +127 -93
  218. package/dist/presentation/cli/commands/smart-command.js.map +1 -1
  219. package/dist/presentation/cli/commands/status-command.d.ts.map +1 -1
  220. package/dist/presentation/cli/commands/status-command.js +1 -5
  221. package/dist/presentation/cli/commands/status-command.js.map +1 -1
  222. package/dist/presentation/cli/commands/trust-command.d.ts +28 -0
  223. package/dist/presentation/cli/commands/trust-command.d.ts.map +1 -0
  224. package/dist/presentation/cli/commands/trust-command.js +301 -0
  225. package/dist/presentation/cli/commands/trust-command.js.map +1 -0
  226. package/dist/presentation/cli/error-display.d.ts.map +1 -1
  227. package/dist/presentation/cli/error-display.js +17 -75
  228. package/dist/presentation/cli/error-display.js.map +1 -1
  229. package/dist/search.d.ts.map +1 -1
  230. package/dist/search.js +5 -18
  231. package/dist/search.js.map +1 -1
  232. package/dist/session.d.ts.map +1 -1
  233. package/dist/session.js +221 -57
  234. package/dist/session.js.map +1 -1
  235. package/dist/token-optimizer.d.ts.map +1 -1
  236. package/dist/token-optimizer.js +6 -1
  237. package/dist/token-optimizer.js.map +1 -1
  238. package/dist/tools/bash.d.ts.map +1 -1
  239. package/dist/tools/bash.js +0 -3
  240. package/dist/tools/bash.js.map +1 -1
  241. package/dist/tools/git-tool.js +7 -7
  242. package/dist/tools/git-tool.js.map +1 -1
  243. package/dist/ui.d.ts +0 -5
  244. package/dist/ui.d.ts.map +1 -1
  245. package/dist/ui.js +0 -19
  246. package/dist/ui.js.map +1 -1
  247. package/dist/utils/provider-check.d.ts +21 -0
  248. package/dist/utils/provider-check.d.ts.map +1 -0
  249. package/dist/utils/provider-check.js +124 -0
  250. package/dist/utils/provider-check.js.map +1 -0
  251. package/package.json +17 -14
  252. package/dist/application/agents/documentation-agent.d.ts +0 -24
  253. package/dist/application/agents/documentation-agent.d.ts.map +0 -1
  254. package/dist/application/agents/documentation-agent.js +0 -399
  255. package/dist/application/agents/documentation-agent.js.map +0 -1
  256. package/dist/application/agents/product-requirements-agent.d.ts +0 -21
  257. package/dist/application/agents/product-requirements-agent.d.ts.map +0 -1
  258. package/dist/application/agents/product-requirements-agent.js +0 -247
  259. package/dist/application/agents/product-requirements-agent.js.map +0 -1
  260. package/dist/application/reasoning/multi-model-planning-strategy.d.ts +0 -21
  261. package/dist/application/reasoning/multi-model-planning-strategy.d.ts.map +0 -1
  262. package/dist/application/reasoning/multi-model-planning-strategy.js +0 -158
  263. package/dist/application/reasoning/multi-model-planning-strategy.js.map +0 -1
  264. package/dist/application/reasoning/reasoning-config.d.ts +0 -15
  265. package/dist/application/reasoning/reasoning-config.d.ts.map +0 -1
  266. package/dist/application/reasoning/reasoning-config.js +0 -50
  267. package/dist/application/reasoning/reasoning-config.js.map +0 -1
  268. package/dist/application/reasoning/reasoning-orchestrator.d.ts +0 -18
  269. package/dist/application/reasoning/reasoning-orchestrator.d.ts.map +0 -1
  270. package/dist/application/reasoning/reasoning-orchestrator.js +0 -170
  271. package/dist/application/reasoning/reasoning-orchestrator.js.map +0 -1
  272. package/dist/application/reasoning/reasoning-strategy.interface.d.ts +0 -24
  273. package/dist/application/reasoning/reasoning-strategy.interface.d.ts.map +0 -1
  274. package/dist/application/reasoning/reasoning-strategy.interface.js +0 -6
  275. package/dist/application/reasoning/reasoning-strategy.interface.js.map +0 -1
  276. package/dist/application/reasoning/role-provider-resolver.d.ts +0 -36
  277. package/dist/application/reasoning/role-provider-resolver.d.ts.map +0 -1
  278. package/dist/application/reasoning/role-provider-resolver.js +0 -74
  279. package/dist/application/reasoning/role-provider-resolver.js.map +0 -1
  280. package/dist/application/reasoning/simple-planning-strategy.d.ts +0 -22
  281. package/dist/application/reasoning/simple-planning-strategy.d.ts.map +0 -1
  282. package/dist/application/reasoning/simple-planning-strategy.js +0 -217
  283. package/dist/application/reasoning/simple-planning-strategy.js.map +0 -1
  284. package/dist/application/reasoning/types.d.ts +0 -65
  285. package/dist/application/reasoning/types.d.ts.map +0 -1
  286. package/dist/application/reasoning/types.js +0 -6
  287. package/dist/application/reasoning/types.js.map +0 -1
  288. package/dist/application/reasoning/validator-strategy.d.ts +0 -56
  289. package/dist/application/reasoning/validator-strategy.d.ts.map +0 -1
  290. package/dist/application/reasoning/validator-strategy.js +0 -103
  291. package/dist/application/reasoning/validator-strategy.js.map +0 -1
  292. package/dist/domain/entities/documentation.d.ts +0 -35
  293. package/dist/domain/entities/documentation.d.ts.map +0 -1
  294. package/dist/domain/entities/documentation.js +0 -6
  295. package/dist/domain/entities/documentation.js.map +0 -1
  296. package/dist/domain/entities/product-requirements.d.ts +0 -50
  297. package/dist/domain/entities/product-requirements.d.ts.map +0 -1
  298. package/dist/domain/entities/product-requirements.js +0 -6
  299. package/dist/domain/entities/product-requirements.js.map +0 -1
  300. package/dist/domain/interfaces/agent.interface.d.ts +0 -15
  301. package/dist/domain/interfaces/agent.interface.d.ts.map +0 -1
  302. package/dist/domain/interfaces/agent.interface.js +0 -6
  303. package/dist/domain/interfaces/agent.interface.js.map +0 -1
  304. package/dist/infrastructure/ai/fake-ai-service.d.ts +0 -22
  305. package/dist/infrastructure/ai/fake-ai-service.d.ts.map +0 -1
  306. package/dist/infrastructure/ai/fake-ai-service.js +0 -59
  307. package/dist/infrastructure/ai/fake-ai-service.js.map +0 -1
  308. package/dist/infrastructure/completion/completion-generator.d.ts +0 -42
  309. package/dist/infrastructure/completion/completion-generator.d.ts.map +0 -1
  310. package/dist/infrastructure/completion/completion-generator.js +0 -184
  311. package/dist/infrastructure/completion/completion-generator.js.map +0 -1
  312. package/dist/infrastructure/security/network-guard.d.ts +0 -8
  313. package/dist/infrastructure/security/network-guard.d.ts.map +0 -1
  314. package/dist/infrastructure/security/network-guard.js +0 -70
  315. package/dist/infrastructure/security/network-guard.js.map +0 -1
  316. package/dist/infrastructure/security/offline.d.ts +0 -16
  317. package/dist/infrastructure/security/offline.d.ts.map +0 -1
  318. package/dist/infrastructure/security/offline.js +0 -24
  319. package/dist/infrastructure/security/offline.js.map +0 -1
  320. package/dist/infrastructure/storage/sqljs-init.d.ts +0 -8
  321. package/dist/infrastructure/storage/sqljs-init.d.ts.map +0 -1
  322. package/dist/infrastructure/storage/sqljs-init.js +0 -23
  323. package/dist/infrastructure/storage/sqljs-init.js.map +0 -1
  324. package/dist/infrastructure/ux/hitl-review-portal.d.ts +0 -47
  325. package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +0 -1
  326. package/dist/infrastructure/ux/hitl-review-portal.js +0 -228
  327. package/dist/infrastructure/ux/hitl-review-portal.js.map +0 -1
  328. package/dist/infrastructure/ux/meta-query.d.ts +0 -9
  329. package/dist/infrastructure/ux/meta-query.d.ts.map +0 -1
  330. package/dist/infrastructure/ux/meta-query.js +0 -63
  331. package/dist/infrastructure/ux/meta-query.js.map +0 -1
  332. package/dist/infrastructure/ux/proportional-friction.d.ts +0 -73
  333. package/dist/infrastructure/ux/proportional-friction.d.ts.map +0 -1
  334. package/dist/infrastructure/ux/proportional-friction.js +0 -200
  335. package/dist/infrastructure/ux/proportional-friction.js.map +0 -1
  336. package/dist/infrastructure/ux/repo-fingerprint.d.ts +0 -10
  337. package/dist/infrastructure/ux/repo-fingerprint.d.ts.map +0 -1
  338. package/dist/infrastructure/ux/repo-fingerprint.js +0 -55
  339. package/dist/infrastructure/ux/repo-fingerprint.js.map +0 -1
  340. package/dist/infrastructure/validation/feedback-stats.d.ts +0 -99
  341. package/dist/infrastructure/validation/feedback-stats.d.ts.map +0 -1
  342. package/dist/infrastructure/validation/feedback-stats.js +0 -173
  343. package/dist/infrastructure/validation/feedback-stats.js.map +0 -1
  344. package/dist/infrastructure/validation/trust-config.d.ts +0 -27
  345. package/dist/infrastructure/validation/trust-config.d.ts.map +0 -1
  346. package/dist/infrastructure/validation/trust-config.js +0 -113
  347. package/dist/infrastructure/validation/trust-config.js.map +0 -1
  348. package/dist/presentation/cli/commands/memory-command.d.ts +0 -17
  349. package/dist/presentation/cli/commands/memory-command.d.ts.map +0 -1
  350. package/dist/presentation/cli/commands/memory-command.js +0 -252
  351. package/dist/presentation/cli/commands/memory-command.js.map +0 -1
  352. package/dist/presentation/cli/keyboard-shortcuts.d.ts +0 -27
  353. package/dist/presentation/cli/keyboard-shortcuts.d.ts.map +0 -1
  354. package/dist/presentation/cli/keyboard-shortcuts.js +0 -77
  355. package/dist/presentation/cli/keyboard-shortcuts.js.map +0 -1
  356. package/dist/test_cohere.d.ts +0 -2
  357. package/dist/test_cohere.d.ts.map +0 -1
  358. package/dist/test_cohere.js +0 -68
  359. package/dist/test_cohere.js.map +0 -1
  360. package/dist/test_env.d.ts +0 -2
  361. package/dist/test_env.d.ts.map +0 -1
  362. package/dist/test_env.js +0 -24
  363. package/dist/test_env.js.map +0 -1
  364. package/dist/test_retrieval.d.ts +0 -2
  365. package/dist/test_retrieval.d.ts.map +0 -1
  366. package/dist/test_retrieval.js +0 -84
  367. package/dist/test_retrieval.js.map +0 -1
  368. package/dist/tools/bash.d 2.ts +0 -53
  369. package/dist/tools/bash.js 2.map +0 -1
  370. package/dist/tools/edit 2.js +0 -235
  371. package/dist/tools/edit.d.ts 2.map +0 -1
  372. package/dist/utils/logger.d.ts +0 -34
  373. package/dist/utils/logger.d.ts.map +0 -1
  374. package/dist/utils/logger.js +0 -56
  375. package/dist/utils/logger.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAgC/C,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CA4DjB;AAED,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAsEjB"}
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAoB/C,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CA4DjB;AAED,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAsEjB"}
package/dist/chat.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { config } from 'dotenv';
2
2
  import { join, dirname } from 'path';
3
3
  import { fileURLToPath } from 'url';
4
+ import { CohereClient } from 'cohere-ai';
4
5
  import { retryWithBackoff, cohereCircuitBreaker, handleError } from './error-handler.js';
5
6
  import { optimizeContext } from './token-optimizer.js';
6
7
  import { optimizeQuery } from './query-optimizer.js';
@@ -15,21 +16,9 @@ catch {
15
16
  // Fallback
16
17
  }
17
18
  config(); // Also try current directory
18
- // Lazy initialization to prevent cohere-ai from loading when CODEHERE_FAKE_AI=1
19
- let cohere = null;
20
- async function getCohereClient() {
21
- if (!cohere) {
22
- if (process.env.CODEHERE_FAKE_AI === '1') {
23
- throw new Error('CohereClient should not be used when CODEHERE_FAKE_AI=1');
24
- }
25
- // Dynamic import to prevent loading cohere-ai at module load time
26
- const { CohereClient: CohereClientClass } = await import('cohere-ai');
27
- cohere = new CohereClientClass({
28
- token: process.env.COHERE_API_KEY || '',
29
- });
30
- }
31
- return cohere;
32
- }
19
+ const cohere = new CohereClient({
20
+ token: process.env.COHERE_API_KEY || '',
21
+ });
33
22
  export async function chatWithContext(query, context) {
34
23
  // Optimize query to understand intent and select strategy
35
24
  const { optimizedQuery, strategy } = optimizeQuery(query);
@@ -52,7 +41,7 @@ USER QUERY:
52
41
  ${optimizedQuery}`;
53
42
  return await retryWithBackoff(async () => {
54
43
  return await cohereCircuitBreaker.execute(async () => {
55
- const response = await (await getCohereClient()).chat({
44
+ const response = await cohere.chat({
56
45
  message: prompt,
57
46
  });
58
47
  return response.text || 'No response generated';
@@ -104,7 +93,7 @@ Instruction: ${instruction}
104
93
  Return the unified diff patch:`;
105
94
  return await retryWithBackoff(async () => {
106
95
  return await cohereCircuitBreaker.execute(async () => {
107
- const response = await (await getCohereClient()).chat({
96
+ const response = await cohere.chat({
108
97
  message: prompt,
109
98
  });
110
99
  let diffText = response.text || '';
package/dist/chat.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAIpC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,WAAW,EAAa,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,iCAAiC;AACjC,IAAI,CAAC;IACH,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC;AAAC,MAAM,CAAC;IACP,WAAW;AACb,CAAC;AACD,MAAM,EAAE,CAAC,CAAC,6BAA6B;AAEvC,gFAAgF;AAChF,IAAI,MAAM,GAAQ,IAAI,CAAC;AACvB,KAAK,UAAU,eAAe;IAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,GAAG,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;QACD,kEAAkE;QAClE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;QACtE,MAAM,GAAG,I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BACnB,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,EACD;QACE,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,cAAc;QAC7B,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YAC1B,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvH,CAAC;KACF,CACF,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QACd,WAAW,CAAC,KAAK,EAAE;YACjB,SAAS,EAAE,cAAc;YACzB,QAAQ;YACR,QAAQ,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE;SAC1D,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Domain Entity: Conversation Context
3
+ *
4
+ * Represents a complete conversation session with auto-compaction support
5
+ * for context continuity across AI tools and providers.
6
+ *
7
+ * Design Goals:
8
+ * - Support cross-tool import (Claude Code, OpenCode, Cursor)
9
+ * - Auto-compact at 90% token limit to prevent context loss
10
+ * - Preserve key information through summarization
11
+ * - Enable seamless provider switching
12
+ *
13
+ * @since v0.5.0 (Context Continuity Feature)
14
+ */
15
+ /**
16
+ * Conversation message role types
17
+ */
18
+ export type MessageRole = 'user' | 'assistant' | 'system';
19
+ /**
20
+ * Source format for imported contexts
21
+ */
22
+ export type SourceFormat = 'claude-code' | 'cursor' | 'codehere' | 'opencode';
23
+ /**
24
+ * Compaction trigger reasons
25
+ */
26
+ export type CompactionTrigger = '90%_limit' | 'manual' | 'import';
27
+ /**
28
+ * Individual message in a conversation
29
+ */
30
+ export interface ConversationMessage {
31
+ /**
32
+ * Message role (user, assistant, system)
33
+ */
34
+ role: MessageRole;
35
+ /**
36
+ * Message content
37
+ */
38
+ content: string;
39
+ /**
40
+ * Message timestamp
41
+ */
42
+ timestamp: Date;
43
+ /**
44
+ * Token count for this message
45
+ */
46
+ tokenCount: number;
47
+ /**
48
+ * Optional metadata
49
+ */
50
+ metadata?: MessageMetadata;
51
+ }
52
+ /**
53
+ * Metadata attached to a message
54
+ */
55
+ export interface MessageMetadata {
56
+ /**
57
+ * Files referenced in this message
58
+ */
59
+ files?: string[];
60
+ /**
61
+ * Command that triggered this message
62
+ */
63
+ command?: string;
64
+ /**
65
+ * AI provider used for this message
66
+ */
67
+ provider?: string;
68
+ /**
69
+ * Model used for this message
70
+ */
71
+ model?: string;
72
+ /**
73
+ * Cost of this message (if available)
74
+ */
75
+ cost?: number;
76
+ /**
77
+ * Source of this message (for imports)
78
+ */
79
+ source?: string;
80
+ /**
81
+ * Original ID from imported source
82
+ */
83
+ originalId?: string;
84
+ /**
85
+ * Raw import flag
86
+ */
87
+ raw?: boolean;
88
+ }
89
+ /**
90
+ * Summary created during context compaction
91
+ */
92
+ export interface CompactedSummary {
93
+ /**
94
+ * Number of messages before compaction
95
+ */
96
+ originalMessageCount: number;
97
+ /**
98
+ * Number of messages after compaction
99
+ */
100
+ compactedMessageCount: number;
101
+ /**
102
+ * Summary text
103
+ */
104
+ summaryText: string;
105
+ /**
106
+ * When this summary was created
107
+ */
108
+ compactedAt: Date;
109
+ /**
110
+ * Key points preserved from compacted messages
111
+ */
112
+ preservedKeyPoints: string[];
113
+ /**
114
+ * Number of tokens saved by compaction
115
+ */
116
+ tokensSaved: number;
117
+ }
118
+ /**
119
+ * Record of a compaction event
120
+ */
121
+ export interface CompactionEvent {
122
+ /**
123
+ * When compaction occurred
124
+ */
125
+ timestamp: Date;
126
+ /**
127
+ * Why compaction was triggered
128
+ */
129
+ triggerReason: CompactionTrigger;
130
+ /**
131
+ * Message count before compaction
132
+ */
133
+ messagesBefore: number;
134
+ /**
135
+ * Message count after compaction
136
+ */
137
+ messagesAfter: number;
138
+ /**
139
+ * Token count before compaction
140
+ */
141
+ tokensBefore: number;
142
+ /**
143
+ * Token count after compaction
144
+ */
145
+ tokensAfter: number;
146
+ }
147
+ /**
148
+ * Project metadata
149
+ */
150
+ export interface ProjectMetadata {
151
+ /**
152
+ * Absolute path to project root
153
+ */
154
+ path: string;
155
+ /**
156
+ * Project name
157
+ */
158
+ name: string;
159
+ /**
160
+ * Detected programming languages
161
+ */
162
+ languages: string[];
163
+ }
164
+ /**
165
+ * Complete conversation context
166
+ *
167
+ * Represents a full conversation session with all metadata needed
168
+ * for context continuity, auto-compaction, and cross-tool import/export.
169
+ */
170
+ export interface ConversationContext {
171
+ /**
172
+ * Unique session identifier
173
+ */
174
+ sessionId: string;
175
+ /**
176
+ * When this session was created
177
+ */
178
+ createdAt: Date;
179
+ /**
180
+ * Last update timestamp
181
+ */
182
+ lastUpdatedAt: Date;
183
+ /**
184
+ * All messages in this conversation
185
+ * After compaction, includes summary message + recent messages
186
+ */
187
+ messages: ConversationMessage[];
188
+ /**
189
+ * Total token count (sum of all message tokens)
190
+ */
191
+ totalTokenCount: number;
192
+ /**
193
+ * Maximum token limit for this model
194
+ * Used to determine when auto-compact triggers (90% threshold)
195
+ */
196
+ maxTokenLimit: number;
197
+ /**
198
+ * Summary created during last compaction (if any)
199
+ */
200
+ summary?: CompactedSummary;
201
+ /**
202
+ * History of all compaction events
203
+ */
204
+ compactionHistory: CompactionEvent[];
205
+ /**
206
+ * AI model being used (e.g., "claude-3-5-sonnet", "gpt-4o")
207
+ */
208
+ model: string;
209
+ /**
210
+ * AI provider being used (e.g., "anthropic", "openai", "cohere")
211
+ */
212
+ provider: string;
213
+ /**
214
+ * Project metadata
215
+ */
216
+ project: ProjectMetadata;
217
+ /**
218
+ * Source format if imported from another tool
219
+ */
220
+ sourceFormat?: SourceFormat;
221
+ /**
222
+ * When this context was exported (for export tracking)
223
+ */
224
+ exportedAt?: Date;
225
+ }
226
+ /**
227
+ * Factory function to create a new ConversationContext
228
+ */
229
+ export declare function createConversationContext(params: {
230
+ sessionId: string;
231
+ model: string;
232
+ provider: string;
233
+ maxTokenLimit: number;
234
+ project: ProjectMetadata;
235
+ sourceFormat?: SourceFormat;
236
+ }): ConversationContext;
237
+ /**
238
+ * Type guard to check if a context needs compaction
239
+ */
240
+ export declare function needsCompaction(context: ConversationContext, threshold?: number): boolean;
241
+ /**
242
+ * Calculate total token count from messages
243
+ */
244
+ export declare function calculateTotalTokens(messages: ConversationMessage[]): number;
245
+ //# sourceMappingURL=conversation-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-context.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/conversation-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;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EG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;OAEG;IACH,aAAa,EAAE,IAAI,CAAC;IAEpB;;;OAGG;IACH,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAEhC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B;;OAEG;IACH,iBAAiB,EAAE,eAAe,EAAE,CAAC;IAErC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,GAAG,mBAAmB,CAgBtB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,mBAAmB,EAC5B,SAAS,GAAE,MAAa,GACvB,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAE5E"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Domain Entity: Conversation Context
3
+ *
4
+ * Represents a complete conversation session with auto-compaction support
5
+ * for context continuity across AI tools and providers.
6
+ *
7
+ * Design Goals:
8
+ * - Support cross-tool import (Claude Code, OpenCode, Cursor)
9
+ * - Auto-compact at 90% token limit to prevent context loss
10
+ * - Preserve key information through summarization
11
+ * - Enable seamless provider switching
12
+ *
13
+ * @since v0.5.0 (Context Continuity Feature)
14
+ */
15
+ /**
16
+ * Factory function to create a new ConversationContext
17
+ */
18
+ export function createConversationContext(params) {
19
+ const now = new Date();
20
+ return {
21
+ sessionId: params.sessionId,
22
+ createdAt: now,
23
+ lastUpdatedAt: now,
24
+ messages: [],
25
+ totalTokenCount: 0,
26
+ maxTokenLimit: params.maxTokenLimit,
27
+ compactionHistory: [],
28
+ model: params.model,
29
+ provider: params.provider,
30
+ project: params.project,
31
+ sourceFormat: params.sourceFormat,
32
+ };
33
+ }
34
+ /**
35
+ * Type guard to check if a context needs compaction
36
+ */
37
+ export function needsCompaction(context, threshold = 0.90) {
38
+ if (context.maxTokenLimit === 0) {
39
+ return false;
40
+ }
41
+ const usage = context.totalTokenCount / context.maxTokenLimit;
42
+ return usage >= threshold;
43
+ }
44
+ /**
45
+ * Calculate total token count from messages
46
+ */
47
+ export function calculateTotalTokens(messages) {
48
+ return messages.reduce((sum, msg) => sum + msg.tokenCount, 0);
49
+ }
50
+ //# sourceMappingURL=conversation-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-context.js","sourceRoot":"","sources":["../../../src/domain/entities/conversation-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiQH;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAOzC;IACC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,GAAG;QACd,aAAa,EAAE,GAAG;QAClB,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,iBAAiB,EAAE,EAAE;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB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AC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Repository Interface: Context Repository
3
+ *
4
+ * Defines persistence operations for conversation contexts
5
+ * Following repository pattern for clean architecture
6
+ *
7
+ * @since v0.5.0 (Context Continuity Feature)
8
+ */
9
+ import type { ConversationContext, ConversationMessage } from '../entities/conversation-context.js';
10
+ /**
11
+ * Repository interface for conversation context persistence
12
+ */
13
+ export interface IContextRepository {
14
+ /**
15
+ * Store a complete conversation context
16
+ * @param context - The context to store
17
+ */
18
+ store(context: ConversationContext): Promise<void>;
19
+ /**
20
+ * Retrieve a conversation context by session ID
21
+ * @param sessionId - Session identifier
22
+ * @returns Context if found, null otherwise
23
+ */
24
+ findById(sessionId: string): Promise<ConversationContext | null>;
25
+ /**
26
+ * Retrieve the most recent conversation context
27
+ * @returns Most recent context if any exists, null otherwise
28
+ */
29
+ findLatest(): Promise<ConversationContext | null>;
30
+ /**
31
+ * List all conversation contexts, ordered by last updated
32
+ * @param limit - Maximum number of contexts to return
33
+ * @returns Array of contexts
34
+ */
35
+ findAll(limit?: number): Promise<ConversationContext[]>;
36
+ /**
37
+ * Add a message to an existing context
38
+ * @param sessionId - Session identifier
39
+ * @param message - Message to add
40
+ */
41
+ addMessage(sessionId: string, message: ConversationMessage): Promise<void>;
42
+ /**
43
+ * Update an existing conversation context
44
+ * @param context - Updated context
45
+ */
46
+ update(context: ConversationContext): Promise<void>;
47
+ /**
48
+ * Delete a conversation context
49
+ * @param sessionId - Session identifier
50
+ */
51
+ delete(sessionId: string): Promise<void>;
52
+ /**
53
+ * Get contexts by source format (for import tracking)
54
+ * @param sourceFormat - Source format to filter by
55
+ * @returns Array of contexts from that source
56
+ */
57
+ findBySource(sourceFormat: string): Promise<ConversationContext[]>;
58
+ /**
59
+ * Get session statistics
60
+ * @param sessionId - Session identifier
61
+ * @returns Stats object with message count, token count, etc.
62
+ */
63
+ getStats(sessionId: string): Promise<{
64
+ messageCount: number;
65
+ totalTokens: number;
66
+ compactionCount: number;
67
+ tokensSaved: number;
68
+ age: number;
69
+ } | null>;
70
+ }
71
+ //# sourceMappingURL=context-repository.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-repository.interface.d.ts","sourceRoot":"","sources":["../../../src/domain/interfaces/context-repository.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IAEjE;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IAElD;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAExD;;;;OAIG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;OAIG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAEnE;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QACnC,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,GAAG,EAAE,MAAM,CAAC;KACb,GAAG,IAAI,CAAC,CAAC;CACX"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Repository Interface: Context Repository
3
+ *
4
+ * Defines persistence operations for conversation contexts
5
+ * Following repository pattern for clean architecture
6
+ *
7
+ * @since v0.5.0 (Context Continuity Feature)
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=context-repository.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-repository.interface.js","sourceRoot":"","sources":["../../../src/domain/interfaces/context-repository.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -1 +1 @@
1
- {"version":3,"file":"query-intent-classifier.d.ts","sourceRoot":"","sources":["../../../src/domain/services/query-intent-classifier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAS,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE/D,qBAAa,qBAAqB;IAChC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IA0IpC;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CA0BxC"}
1
+ {"version":3,"file":"query-intent-classifier.d.ts","sourceRoot":"","sources":["../../../src/domain/services/query-intent-classifier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAS,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE/D,qBAAa,qBAAqB;IAChC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IA0JpC;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CA0BxC"}
@@ -60,6 +60,30 @@ export class QueryIntentClassifier {
60
60
  return 'multi-file-modify';
61
61
  }
62
62
  }
63
+ // EARLY CHECK: Open questions about codebase state (before action intents!)
64
+ // Must come BEFORE modify/debug/implement to catch "what changed?" correctly
65
+ const openQuestionPatterns = [
66
+ /^what\s+(changed|is\s+new|happened|did\s+i|files?\s+changed)/i, // "what changed"
67
+ /what\s+has\s+(changed|happened|been\s+modified)/i, // "what has changed"
68
+ /what\s+are\s+the\s+(recent|latest|new)\s+(changes|updates|modifications)/i,
69
+ /what\s+are\s+the\s+(main|key|important|recent)/i,
70
+ /how\s+does\s+the\s+(project|codebase|system|app)/i,
71
+ /how\s+does\s+(it|this)\s+work/i,
72
+ /tell\s+me\s+about/i,
73
+ /overview\s+of/i,
74
+ /summary\s+of/i,
75
+ /what\s+is\s+this\s+(project|codebase|app|repo)/i,
76
+ /^what\s+is\s+\w+\??$/i, // "What is X?" without file context
77
+ /what\s+is\s+this\??$/i, // "What is this?"
78
+ /show\s+me\s+(recent|latest|new)\s+(changes|updates)/i,
79
+ /what\s+did\s+(i|we)\s+(change|modify|update)/i,
80
+ /recently\s+(changed|modified|updated)/i,
81
+ ];
82
+ for (const pattern of openQuestionPatterns) {
83
+ if (pattern.test(query)) {
84
+ return 'understand'; // Route to ask handler for semantic search
85
+ }
86
+ }
63
87
  // Refactor intent (single-file)
64
88
  if (lowerQuery.includes('refactor') || lowerQuery.includes('rename') ||
65
89
  lowerQuery.includes('extract') || lowerQuery.includes('move') ||
@@ -72,26 +96,7 @@ export class QueryIntentClassifier {
72
96
  lowerQuery.includes('problem') || lowerQuery.includes('wrong')) {
73
97
  return 'debug';
74
98
  }
75
- // Plan intent (product/business/architecture planning - check BEFORE implement)
76
- // These are high-level planning queries, not code implementation
77
- const planPatterns = [
78
- /brainstorm/i,
79
- /plan.*(product|business|saas|startup|app|feature|architecture|system)/i,
80
- /(product|business|saas|startup|app|feature|architecture|system).*plan/i,
81
- /build.*(micro.*saas|saas|product|business|startup|app)/i,
82
- /(micro.*saas|saas|product|business|startup|app).*build/i,
83
- /earn.*(month|monthly|\$|usd)/i,
84
- /(month|monthly|\$|usd).*earn/i,
85
- /ideat/i, // "ideate" or "ideation"
86
- /let.*brainstorm/i,
87
- /want.*build/i,
88
- ];
89
- for (const pattern of planPatterns) {
90
- if (pattern.test(query)) {
91
- return 'plan';
92
- }
93
- }
94
- // Implement intent (code implementation - only if not a planning query)
99
+ // Implement intent
95
100
  if (lowerQuery.includes('implement') || lowerQuery.includes('create') ||
96
101
  lowerQuery.includes('add') || lowerQuery.includes('write') ||
97
102
  lowerQuery.includes('build')) {
@@ -107,12 +112,21 @@ export class QueryIntentClassifier {
107
112
  lowerQuery.includes('update') || lowerQuery.includes('edit')) {
108
113
  return 'modify';
109
114
  }
110
- // Explain intent
111
- if (lowerQuery.includes('how') || lowerQuery.includes('what') ||
115
+ // Explain intent - requires file/function context
116
+ // Only match if query mentions a specific file, function, or code element
117
+ const hasFileContext = /\.(ts|js|tsx|jsx|py|go|java|rs|cpp|c|h|json|yaml|yml|md)\b/i.test(query) ||
118
+ /function|class|interface|type|const|method|component/i.test(lowerQuery) ||
119
+ /src\/|lib\/|app\/|components\/|utils\/|services\//i.test(query);
120
+ if (hasFileContext && (lowerQuery.includes('how') || lowerQuery.includes('what') ||
112
121
  lowerQuery.includes('explain') || lowerQuery.includes('understand') ||
113
- lowerQuery.includes('does') || lowerQuery.includes('work')) {
122
+ lowerQuery.includes('does') || lowerQuery.includes('work'))) {
114
123
  return 'explain';
115
124
  }
125
+ // General understanding questions without file context → ask handler
126
+ if (lowerQuery.includes('how') || lowerQuery.includes('what') ||
127
+ lowerQuery.includes('explain') || lowerQuery.includes('understand')) {
128
+ return 'understand';
129
+ }
116
130
  // Review intent
117
131
  if (lowerQuery.includes('review') || lowerQuery.includes('check') ||
118
132
  lowerQuery.includes('analyze') || lowerQuery.includes('audit')) {
@@ -1 +1 @@
1
- {"version":3,"file":"query-intent-classifier.js","sourceRoot":"","sources":["../../../src/domain/services/query-intent-classifier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,qBAAqB;IAChC;;OAEG;IACH,QAAQ,CAAC,KAAa;QACpB,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAEvC,qEAAqE;QACrE,6DAA6D;QAC7D,MAAM,iBAAiB,GAAG;YACxB,4EAA4E;YAC5E,oCAAoC,EAAE,gDAAgD;YACtF,8CAA8C,EAAE,+BAA+B;YAC/E,+CAA+C,EAAE,iDAAiD;YAClG,oDAAoD;YACpD,wCAAwC,EAAE,6BAA6B;YACvE,qCAAqC,EAAE,0BAA0B;YACjE,0BAA0B;YAC1B,oEAAoE;YACpE,0DAA0D;YAC1D,oFAAoF;YACpF,qBAAqB;YACrB,0DAA0D;YAC1D,yCAAyC;YACzC,wBAAwB;YACxB,iDAAiD;YACjD,+CAA+C;YAC/C,2CAA2C;YAC3C,yDAAyD;YACzD,wDAAwD;YACxD,qGAAqG;YACrG,gDAAgD;YAChD,oFAAoF;YACpF,iFAAiF;YACjF,qBAAqB;YACrB,0FAA0F;YAC1F,qHAAqH;YACrH,wBAAwB;YACxB,wCAAwC;YACxC,uCAAuC;YACvC,sBAAsB;YACtB,cAAc;YACd,gBAAgB;YAChB,4CAA4C;YAC5C,iEAAiE;YACjE,8DAA8D;YAC9D,2DAA2D;YAC3D,2CAA2C;YAC3C,4DAA4D;YAC5D,4DAA4D;YAC5D,4CAA4C;YAC5C,wBAAwB;YACxB,0BAA0B;SAC3B,CAAC;QAEF,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;YACxC,IAAI,OAAO,CAAC,IAAI,CAAC,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C,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC1D,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACpC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,eAAe;QACf,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACjE,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,KAAa;QAC1B,MAAM,QAAQ,GAAG;YACf,oBAAoB;YACpB,iBAAiB;YACjB,qBAAqB;YACrB,gBAAgB;YAChB,iBAAiB;YACjB,eAAe;YACf,eAAe;YACf,sBAAsB,EAAE,oBAAoB;YAC5C,0BAA0B,EAAE,sBAAsB;SACnD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAElC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACxC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;oBACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACF"}
1
+ {"version":3,"file":"query-intent-classifier.js","sourceRoot":"","sources":["../../../src/domain/services/query-intent-classifier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,qBAAqB;IAChC;;OAEG;IACH,QAAQ,CAAC,KAAa;QACpB,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAEvC,qEAAqE;QACrE,6DA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"","sources":["../src/embed.ts"],"names":[],"mappings":"AAsMA,wBAAsB,eAAe,CAAC,QAAQ,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2JrF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACpB,GACL,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAkJD"}
1
+ {"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AA2MA,wBAAsB,eAAe,CAAC,QAAQ,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2JrF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACpB,GACL,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAkJD"}
package/dist/embed.js CHANGED
@@ -41,9 +41,14 @@ function getLegacyDbPath() {
41
41
  // Legacy DB_PATH - only used by deprecated indexRepository() function
42
42
  // Active CLI uses indexRepositoryParallel() with per-repo paths
43
43
  const DB_PATH = getLegacyDbPath();
44
- const CHUNK_SIZE = 300; // target tokens per chunk
45
- const OVERLAP = 50; // overlap tokens between chunks
46
- const enc = encoding_for_model('gpt-3.5-turbo');
44
+ // Token encoder and chunking - use config
45
+ import { getConfigManager } from './infrastructure/config/config-manager.js';
46
+ const embedConfig = getConfigManager();
47
+ const defaultModel = embedConfig.getModel('default') || embedConfig.getPreference('defaultModel') || 'command-r-08-2024';
48
+ const tiktokenModel = defaultModel.includes('gpt') ? defaultModel : 'gpt-3.5-turbo';
49
+ const enc = encoding_for_model(tiktokenModel);
50
+ const CHUNK_SIZE = embedConfig.getChunking('chunkSize') || 300; // target tokens per chunk
51
+ const OVERLAP = embedConfig.getChunking('overlap') || 50; // overlap tokens between chunks
47
52
  function shouldIgnorePath(filepath) {
48
53
  const ignorePatterns = [
49
54
  'node_modules',