codehere 0.3.0 → 0.5.0-alpha.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 (389) hide show
  1. package/README.md +230 -42
  2. package/dist/application/agents/documentation-agent.d.ts +24 -0
  3. package/dist/application/agents/documentation-agent.d.ts.map +1 -0
  4. package/dist/application/agents/documentation-agent.js +399 -0
  5. package/dist/application/agents/documentation-agent.js.map +1 -0
  6. package/dist/application/agents/execution-agent.d.ts +11 -0
  7. package/dist/application/agents/execution-agent.d.ts.map +1 -1
  8. package/dist/application/agents/execution-agent.js +289 -80
  9. package/dist/application/agents/execution-agent.js.map +1 -1
  10. package/dist/application/agents/multi-agent-orchestrator.d.ts +3 -0
  11. package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
  12. package/dist/application/agents/multi-agent-orchestrator.js +86 -0
  13. package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
  14. package/dist/application/agents/planning-agent.d.ts +3 -0
  15. package/dist/application/agents/planning-agent.d.ts.map +1 -1
  16. package/dist/application/agents/planning-agent.js +146 -70
  17. package/dist/application/agents/planning-agent.js.map +1 -1
  18. package/dist/application/agents/product-requirements-agent.d.ts +21 -0
  19. package/dist/application/agents/product-requirements-agent.d.ts.map +1 -0
  20. package/dist/application/agents/product-requirements-agent.js +247 -0
  21. package/dist/application/agents/product-requirements-agent.js.map +1 -0
  22. package/dist/application/agents/validation-agent.d.ts +5 -1
  23. package/dist/application/agents/validation-agent.d.ts.map +1 -1
  24. package/dist/application/agents/validation-agent.js +156 -21
  25. package/dist/application/agents/validation-agent.js.map +1 -1
  26. package/dist/application/services/dependency-container.d.ts +46 -2
  27. package/dist/application/services/dependency-container.d.ts.map +1 -1
  28. package/dist/application/services/dependency-container.js +177 -7
  29. package/dist/application/services/dependency-container.js.map +1 -1
  30. package/dist/application/services/intelligent-router.d.ts +13 -0
  31. package/dist/application/services/intelligent-router.d.ts.map +1 -1
  32. package/dist/application/services/intelligent-router.js +306 -90
  33. package/dist/application/services/intelligent-router.js.map +1 -1
  34. package/dist/application/use-cases/ask-question-use-case.d.ts +19 -0
  35. package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
  36. package/dist/application/use-cases/ask-question-use-case.js +125 -46
  37. package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
  38. package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
  39. package/dist/application/use-cases/edit-file-use-case.js +16 -1
  40. package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
  41. package/dist/domain/entities/documentation.d.ts +35 -0
  42. package/dist/domain/entities/documentation.d.ts.map +1 -0
  43. package/dist/domain/entities/documentation.js +6 -0
  44. package/dist/domain/entities/documentation.js.map +1 -0
  45. package/dist/domain/entities/product-requirements.d.ts +50 -0
  46. package/dist/domain/entities/product-requirements.d.ts.map +1 -0
  47. package/dist/domain/entities/product-requirements.js +6 -0
  48. package/dist/domain/entities/product-requirements.js.map +1 -0
  49. package/dist/domain/entities/task.d.ts +152 -0
  50. package/dist/domain/entities/task.d.ts.map +1 -0
  51. package/dist/domain/entities/task.js +61 -0
  52. package/dist/domain/entities/task.js.map +1 -0
  53. package/dist/domain/errors/embeddings-not-found-error.d.ts +9 -0
  54. package/dist/domain/errors/embeddings-not-found-error.d.ts.map +1 -0
  55. package/dist/domain/errors/embeddings-not-found-error.js +13 -0
  56. package/dist/domain/errors/embeddings-not-found-error.js.map +1 -0
  57. package/dist/domain/interfaces/agent.interface.d.ts +15 -0
  58. package/dist/domain/interfaces/agent.interface.d.ts.map +1 -0
  59. package/dist/domain/interfaces/agent.interface.js +6 -0
  60. package/dist/domain/interfaces/agent.interface.js.map +1 -0
  61. package/dist/domain/interfaces/embedding-repository.interface.d.ts +5 -0
  62. package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -1
  63. package/dist/domain/services/environment-mode-manager.d.ts +12 -0
  64. package/dist/domain/services/environment-mode-manager.d.ts.map +1 -0
  65. package/dist/domain/services/environment-mode-manager.js +22 -0
  66. package/dist/domain/services/environment-mode-manager.js.map +1 -0
  67. package/dist/domain/services/risk-tier-detector.d.ts +17 -0
  68. package/dist/domain/services/risk-tier-detector.d.ts.map +1 -0
  69. package/dist/domain/services/risk-tier-detector.js +78 -0
  70. package/dist/domain/services/risk-tier-detector.js.map +1 -0
  71. package/dist/embed.d.ts.map +1 -1
  72. package/dist/embed.js +18 -8
  73. package/dist/embed.js.map +1 -1
  74. package/dist/formatter.d.ts.map +1 -1
  75. package/dist/formatter.js +10 -3
  76. package/dist/formatter.js.map +1 -1
  77. package/dist/index.js +398 -164
  78. package/dist/index.js.map +1 -1
  79. package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
  80. package/dist/infrastructure/ai/cohere-ai-service.js +18 -5
  81. package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
  82. package/dist/infrastructure/ai/fake-ai-service.d.ts +22 -0
  83. package/dist/infrastructure/ai/fake-ai-service.d.ts.map +1 -0
  84. package/dist/infrastructure/ai/fake-ai-service.js +59 -0
  85. package/dist/infrastructure/ai/fake-ai-service.js.map +1 -0
  86. package/dist/infrastructure/ai/provider-ai-service.d.ts +59 -0
  87. package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -0
  88. package/dist/infrastructure/ai/provider-ai-service.js +477 -0
  89. package/dist/infrastructure/ai/provider-ai-service.js.map +1 -0
  90. package/dist/infrastructure/cache/embedding-cache.d.ts +13 -1
  91. package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -1
  92. package/dist/infrastructure/cache/embedding-cache.js +80 -9
  93. package/dist/infrastructure/cache/embedding-cache.js.map +1 -1
  94. package/dist/infrastructure/cache/query-result-cache.d.ts +14 -55
  95. package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -1
  96. package/dist/infrastructure/cache/query-result-cache.js +40 -112
  97. package/dist/infrastructure/cache/query-result-cache.js.map +1 -1
  98. package/dist/infrastructure/cache/response-cache.d.ts +18 -0
  99. package/dist/infrastructure/cache/response-cache.d.ts.map +1 -0
  100. package/dist/infrastructure/cache/response-cache.js +48 -0
  101. package/dist/infrastructure/cache/response-cache.js.map +1 -0
  102. package/dist/infrastructure/cache/security-scan-cache.d.ts +8 -49
  103. package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -1
  104. package/dist/infrastructure/cache/security-scan-cache.js +25 -102
  105. package/dist/infrastructure/cache/security-scan-cache.js.map +1 -1
  106. package/dist/infrastructure/completion/bash-completion.d.ts +2 -3
  107. package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -1
  108. package/dist/infrastructure/completion/bash-completion.js +11 -87
  109. package/dist/infrastructure/completion/bash-completion.js.map +1 -1
  110. package/dist/infrastructure/completion/fish-completion.d.ts +2 -3
  111. package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -1
  112. package/dist/infrastructure/completion/fish-completion.js +15 -58
  113. package/dist/infrastructure/completion/fish-completion.js.map +1 -1
  114. package/dist/infrastructure/completion/zsh-completion.d.ts +2 -3
  115. package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -1
  116. package/dist/infrastructure/completion/zsh-completion.js +18 -73
  117. package/dist/infrastructure/completion/zsh-completion.js.map +1 -1
  118. package/dist/infrastructure/config/config-manager.js +2 -2
  119. package/dist/infrastructure/config/config-manager.js.map +1 -1
  120. package/dist/infrastructure/context/conversation-context.d.ts +54 -0
  121. package/dist/infrastructure/context/conversation-context.d.ts.map +1 -0
  122. package/dist/infrastructure/context/conversation-context.js +128 -0
  123. package/dist/infrastructure/context/conversation-context.js.map +1 -0
  124. package/dist/infrastructure/context/session-manager.d.ts +42 -0
  125. package/dist/infrastructure/context/session-manager.d.ts.map +1 -0
  126. package/dist/infrastructure/context/session-manager.js +94 -0
  127. package/dist/infrastructure/context/session-manager.js.map +1 -0
  128. package/dist/infrastructure/cost/cost-tracker.d.ts +1 -0
  129. package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
  130. package/dist/infrastructure/cost/cost-tracker.js +12 -5
  131. package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
  132. package/dist/infrastructure/governance/nist-ai-rmf.d.ts +6 -8
  133. package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -1
  134. package/dist/infrastructure/governance/nist-ai-rmf.js +6 -8
  135. package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -1
  136. package/dist/infrastructure/governance/policy-as-code.d.ts +6 -8
  137. package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
  138. package/dist/infrastructure/governance/policy-as-code.js +6 -8
  139. package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
  140. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +7 -9
  141. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -1
  142. package/dist/infrastructure/governance/prompt-to-code-lineage.js +7 -9
  143. package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -1
  144. package/dist/infrastructure/providers/cohere-provider.d.ts +39 -0
  145. package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -0
  146. package/dist/infrastructure/providers/cohere-provider.js +444 -0
  147. package/dist/infrastructure/providers/cohere-provider.js.map +1 -0
  148. package/dist/infrastructure/providers/fake-provider.d.ts +43 -0
  149. package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -0
  150. package/dist/infrastructure/providers/fake-provider.js +130 -0
  151. package/dist/infrastructure/providers/fake-provider.js.map +1 -0
  152. package/dist/infrastructure/providers/local-llm-provider.d.ts +49 -0
  153. package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -0
  154. package/dist/infrastructure/providers/local-llm-provider.js +330 -0
  155. package/dist/infrastructure/providers/local-llm-provider.js.map +1 -0
  156. package/dist/infrastructure/providers/model-config.types.d.ts +70 -0
  157. package/dist/infrastructure/providers/model-config.types.d.ts.map +1 -0
  158. package/dist/infrastructure/providers/model-config.types.js +9 -0
  159. package/dist/infrastructure/providers/model-config.types.js.map +1 -0
  160. package/dist/infrastructure/providers/model-provider.interface.d.ts +113 -0
  161. package/dist/infrastructure/providers/model-provider.interface.d.ts.map +1 -0
  162. package/dist/infrastructure/providers/model-provider.interface.js +8 -0
  163. package/dist/infrastructure/providers/model-provider.interface.js.map +1 -0
  164. package/dist/infrastructure/providers/openai-provider.d.ts +38 -0
  165. package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -0
  166. package/dist/infrastructure/providers/openai-provider.js +413 -0
  167. package/dist/infrastructure/providers/openai-provider.js.map +1 -0
  168. package/dist/infrastructure/providers/openrouter-provider.d.ts +42 -0
  169. package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -0
  170. package/dist/infrastructure/providers/openrouter-provider.js +399 -0
  171. package/dist/infrastructure/providers/openrouter-provider.js.map +1 -0
  172. package/dist/infrastructure/providers/operation-provider-resolver.d.ts +48 -0
  173. package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -0
  174. package/dist/infrastructure/providers/operation-provider-resolver.js +105 -0
  175. package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -0
  176. package/dist/infrastructure/providers/provider-config-loader.d.ts +37 -0
  177. package/dist/infrastructure/providers/provider-config-loader.d.ts.map +1 -0
  178. package/dist/infrastructure/providers/provider-config-loader.js +120 -0
  179. package/dist/infrastructure/providers/provider-config-loader.js.map +1 -0
  180. package/dist/infrastructure/providers/provider-registry.d.ts +53 -0
  181. package/dist/infrastructure/providers/provider-registry.d.ts.map +1 -0
  182. package/dist/infrastructure/providers/provider-registry.js +88 -0
  183. package/dist/infrastructure/providers/provider-registry.js.map +1 -0
  184. package/dist/infrastructure/serialization/toon-serializer.d.ts +45 -0
  185. package/dist/infrastructure/serialization/toon-serializer.d.ts.map +1 -0
  186. package/dist/infrastructure/serialization/toon-serializer.js +119 -0
  187. package/dist/infrastructure/serialization/toon-serializer.js.map +1 -0
  188. package/dist/infrastructure/storage/embeddings-path.d.ts +18 -0
  189. package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -0
  190. package/dist/infrastructure/storage/embeddings-path.js +37 -0
  191. package/dist/infrastructure/storage/embeddings-path.js.map +1 -0
  192. package/dist/infrastructure/storage/plan-repository.d.ts +2 -0
  193. package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
  194. package/dist/infrastructure/storage/plan-repository.js +36 -73
  195. package/dist/infrastructure/storage/plan-repository.js.map +1 -1
  196. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +10 -1
  197. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
  198. package/dist/infrastructure/storage/sqlite-embedding-repository.js +37 -3
  199. package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
  200. package/dist/infrastructure/storage/task-helpers.d.ts +69 -0
  201. package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -0
  202. package/dist/infrastructure/storage/task-helpers.js +197 -0
  203. package/dist/infrastructure/storage/task-helpers.js.map +1 -0
  204. package/dist/infrastructure/storage/task-repository.d.ts +67 -0
  205. package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
  206. package/dist/infrastructure/storage/task-repository.js +205 -0
  207. package/dist/infrastructure/storage/task-repository.js.map +1 -0
  208. package/dist/infrastructure/ux/bi-directional-learning.d.ts +22 -0
  209. package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -1
  210. package/dist/infrastructure/ux/bi-directional-learning.js +144 -7
  211. package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -1
  212. package/dist/infrastructure/ux/capability-boundaries.d.ts +22 -0
  213. package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -0
  214. package/dist/infrastructure/ux/capability-boundaries.js +42 -0
  215. package/dist/infrastructure/ux/capability-boundaries.js.map +1 -0
  216. package/dist/infrastructure/ux/comprehensive-formatter.d.ts +21 -0
  217. package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -0
  218. package/dist/infrastructure/ux/comprehensive-formatter.js +117 -0
  219. package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -0
  220. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +5 -18
  221. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -1
  222. package/dist/infrastructure/ux/contextual-feature-discovery.js +5 -139
  223. package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -1
  224. package/dist/infrastructure/ux/feature-discovery.d.ts +3 -33
  225. package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -1
  226. package/dist/infrastructure/ux/feature-discovery.js +5 -181
  227. package/dist/infrastructure/ux/feature-discovery.js.map +1 -1
  228. package/dist/infrastructure/ux/feedback-prompt.d.ts +26 -0
  229. package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -0
  230. package/dist/infrastructure/ux/feedback-prompt.js +45 -0
  231. package/dist/infrastructure/ux/feedback-prompt.js.map +1 -0
  232. package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -1
  233. package/dist/infrastructure/ux/hitl-review-portal.js +4 -1
  234. package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -1
  235. package/dist/infrastructure/ux/hitl-validation.d.ts +35 -0
  236. package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -1
  237. package/dist/infrastructure/ux/hitl-validation.js +86 -0
  238. package/dist/infrastructure/ux/hitl-validation.js.map +1 -1
  239. package/dist/infrastructure/ux/progress-indicator.d.ts +4 -5
  240. package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
  241. package/dist/infrastructure/ux/progress-indicator.js +35 -40
  242. package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
  243. package/dist/infrastructure/ux/proportional-friction.d.ts +73 -0
  244. package/dist/infrastructure/ux/proportional-friction.d.ts.map +1 -0
  245. package/dist/infrastructure/ux/proportional-friction.js +200 -0
  246. package/dist/infrastructure/ux/proportional-friction.js.map +1 -0
  247. package/dist/infrastructure/ux/review-checkpoint.d.ts +3 -1
  248. package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -1
  249. package/dist/infrastructure/ux/review-checkpoint.js +33 -80
  250. package/dist/infrastructure/ux/review-checkpoint.js.map +1 -1
  251. package/dist/infrastructure/ux/staged-feature-intro.d.ts +14 -39
  252. package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -1
  253. package/dist/infrastructure/ux/staged-feature-intro.js +12 -132
  254. package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -1
  255. package/dist/infrastructure/ux/syntax-highlighter.d.ts +1 -2
  256. package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -1
  257. package/dist/infrastructure/ux/syntax-highlighter.js +67 -148
  258. package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -1
  259. package/dist/infrastructure/validation/agent-feedback.d.ts +51 -0
  260. package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -0
  261. package/dist/infrastructure/validation/agent-feedback.js +55 -0
  262. package/dist/infrastructure/validation/agent-feedback.js.map +1 -0
  263. package/dist/infrastructure/validation/agent-validation-helper.d.ts +75 -0
  264. package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -0
  265. package/dist/infrastructure/validation/agent-validation-helper.js +137 -0
  266. package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -0
  267. package/dist/infrastructure/validation/feedback-stats.d.ts +99 -0
  268. package/dist/infrastructure/validation/feedback-stats.d.ts.map +1 -0
  269. package/dist/infrastructure/validation/feedback-stats.js +173 -0
  270. package/dist/infrastructure/validation/feedback-stats.js.map +1 -0
  271. package/dist/infrastructure/validation/review-handler.d.ts +26 -0
  272. package/dist/infrastructure/validation/review-handler.d.ts.map +1 -0
  273. package/dist/infrastructure/validation/review-handler.js +40 -0
  274. package/dist/infrastructure/validation/review-handler.js.map +1 -0
  275. package/dist/infrastructure/validation/summary-aggregator.d.ts +45 -0
  276. package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -0
  277. package/dist/infrastructure/validation/summary-aggregator.js +70 -0
  278. package/dist/infrastructure/validation/summary-aggregator.js.map +1 -0
  279. package/dist/infrastructure/validation/summary-extractor.d.ts +24 -0
  280. package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -0
  281. package/dist/infrastructure/validation/summary-extractor.js +45 -0
  282. package/dist/infrastructure/validation/summary-extractor.js.map +1 -0
  283. package/dist/infrastructure/validation/trace-summary.d.ts +45 -0
  284. package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -0
  285. package/dist/infrastructure/validation/trace-summary.js +52 -0
  286. package/dist/infrastructure/validation/trace-summary.js.map +1 -0
  287. package/dist/infrastructure/validation/trust-config.d.ts +27 -0
  288. package/dist/infrastructure/validation/trust-config.d.ts.map +1 -0
  289. package/dist/infrastructure/validation/trust-config.js +113 -0
  290. package/dist/infrastructure/validation/trust-config.js.map +1 -0
  291. package/dist/infrastructure/xai/attention-visualizer.d.ts +6 -8
  292. package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -1
  293. package/dist/infrastructure/xai/attention-visualizer.js +6 -8
  294. package/dist/infrastructure/xai/attention-visualizer.js.map +1 -1
  295. package/dist/infrastructure/xai/cot-visualizer.d.ts +6 -9
  296. package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
  297. package/dist/infrastructure/xai/cot-visualizer.js +6 -9
  298. package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
  299. package/dist/infrastructure/xai/decision-tree-log.d.ts +6 -10
  300. package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -1
  301. package/dist/infrastructure/xai/decision-tree-log.js +6 -10
  302. package/dist/infrastructure/xai/decision-tree-log.js.map +1 -1
  303. package/dist/infrastructure/xai/interactive-xai.d.ts +6 -8
  304. package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -1
  305. package/dist/infrastructure/xai/interactive-xai.js +6 -8
  306. package/dist/infrastructure/xai/interactive-xai.js.map +1 -1
  307. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +6 -9
  308. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -1
  309. package/dist/infrastructure/xai/uncertainty-quantifier.js +6 -9
  310. package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -1
  311. package/dist/monitoring.d.ts +1 -1
  312. package/dist/monitoring.d.ts.map +1 -1
  313. package/dist/monitoring.js +12 -9
  314. package/dist/monitoring.js.map +1 -1
  315. package/dist/parallel-processor.d.ts.map +1 -1
  316. package/dist/parallel-processor.js +124 -45
  317. package/dist/parallel-processor.js.map +1 -1
  318. package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
  319. package/dist/presentation/cli/commands/ask-command.js +225 -86
  320. package/dist/presentation/cli/commands/ask-command.js.map +1 -1
  321. package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
  322. package/dist/presentation/cli/commands/config-command.js +8 -6
  323. package/dist/presentation/cli/commands/config-command.js.map +1 -1
  324. package/dist/presentation/cli/commands/docs-command.d.ts +14 -0
  325. package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -0
  326. package/dist/presentation/cli/commands/docs-command.js +25 -0
  327. package/dist/presentation/cli/commands/docs-command.js.map +1 -0
  328. package/dist/presentation/cli/commands/fix-command.d.ts +10 -0
  329. package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -0
  330. package/dist/presentation/cli/commands/fix-command.js +53 -0
  331. package/dist/presentation/cli/commands/fix-command.js.map +1 -0
  332. package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
  333. package/dist/presentation/cli/commands/help-command.js +2 -0
  334. package/dist/presentation/cli/commands/help-command.js.map +1 -1
  335. package/dist/presentation/cli/commands/models-command.d.ts +13 -0
  336. package/dist/presentation/cli/commands/models-command.d.ts.map +1 -0
  337. package/dist/presentation/cli/commands/models-command.js +194 -0
  338. package/dist/presentation/cli/commands/models-command.js.map +1 -0
  339. package/dist/presentation/cli/commands/orchestrate-command.d.ts +1 -0
  340. package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
  341. package/dist/presentation/cli/commands/orchestrate-command.js +68 -7
  342. package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
  343. package/dist/presentation/cli/commands/plan-command.d.ts +1 -0
  344. package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
  345. package/dist/presentation/cli/commands/plan-command.js +88 -8
  346. package/dist/presentation/cli/commands/plan-command.js.map +1 -1
  347. package/dist/presentation/cli/commands/product-command.d.ts +14 -0
  348. package/dist/presentation/cli/commands/product-command.d.ts.map +1 -0
  349. package/dist/presentation/cli/commands/product-command.js +22 -0
  350. package/dist/presentation/cli/commands/product-command.js.map +1 -0
  351. package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
  352. package/dist/presentation/cli/commands/react-command.js +3 -1
  353. package/dist/presentation/cli/commands/react-command.js.map +1 -1
  354. package/dist/presentation/cli/commands/review-command.d.ts +14 -0
  355. package/dist/presentation/cli/commands/review-command.d.ts.map +1 -0
  356. package/dist/presentation/cli/commands/review-command.js +154 -0
  357. package/dist/presentation/cli/commands/review-command.js.map +1 -0
  358. package/dist/presentation/cli/commands/run-command.d.ts +13 -0
  359. package/dist/presentation/cli/commands/run-command.d.ts.map +1 -0
  360. package/dist/presentation/cli/commands/run-command.js +188 -0
  361. package/dist/presentation/cli/commands/run-command.js.map +1 -0
  362. package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
  363. package/dist/presentation/cli/commands/setup-command.js +15 -0
  364. package/dist/presentation/cli/commands/setup-command.js.map +1 -1
  365. package/dist/presentation/cli/commands/smart-command.d.ts +3 -1
  366. package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
  367. package/dist/presentation/cli/commands/smart-command.js +92 -6
  368. package/dist/presentation/cli/commands/smart-command.js.map +1 -1
  369. package/dist/presentation/cli/commands/status-command.d.ts +14 -0
  370. package/dist/presentation/cli/commands/status-command.d.ts.map +1 -0
  371. package/dist/presentation/cli/commands/status-command.js +167 -0
  372. package/dist/presentation/cli/commands/status-command.js.map +1 -0
  373. package/dist/presentation/cli/commands/suggest-command.d.ts +11 -0
  374. package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -0
  375. package/dist/presentation/cli/commands/suggest-command.js +138 -0
  376. package/dist/presentation/cli/commands/suggest-command.js.map +1 -0
  377. package/dist/presentation/cli/error-display.d.ts.map +1 -1
  378. package/dist/presentation/cli/error-display.js +43 -0
  379. package/dist/presentation/cli/error-display.js.map +1 -1
  380. package/dist/search.d.ts.map +1 -1
  381. package/dist/search.js +6 -1
  382. package/dist/search.js.map +1 -1
  383. package/dist/session.js +19 -2
  384. package/dist/session.js.map +1 -1
  385. package/dist/ui.d.ts +6 -0
  386. package/dist/ui.d.ts.map +1 -1
  387. package/dist/ui.js +43 -6
  388. package/dist/ui.js.map +1 -1
  389. package/package.json +16 -3
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Provider Layer: LocalLLMProvider
3
+ * OpenAI-compatible local LLM provider (Ollama, LM Studio, on-prem gateways)
4
+ *
5
+ * Phase 4E: Local LLM Provider Implementation
6
+ * Supports any OpenAI-compatible endpoint for chat and embeddings
7
+ */
8
+ import type { IModelProvider, ProviderCapabilities, ModelInfo, ChatOptions, ChatResponse, StreamEvent, RerankResponse } from './model-provider.interface.js';
9
+ /**
10
+ * LocalLLMProvider
11
+ * Implements IModelProvider for OpenAI-compatible local endpoints
12
+ *
13
+ * Designed for:
14
+ * - Ollama (http://localhost:11434)
15
+ * - LM Studio (http://localhost:1234)
16
+ * - On-prem OpenAI-compatible gateways
17
+ *
18
+ * API Assumptions:
19
+ * - POST {baseUrl}/v1/chat/completions (OpenAI-compatible)
20
+ * - POST {baseUrl}/v1/embeddings (OpenAI-compatible)
21
+ * - Streaming via Server-Sent Events (SSE) if supported
22
+ */
23
+ export declare class LocalLLMProvider implements IModelProvider {
24
+ readonly id = "local";
25
+ readonly name = "Local LLM Provider";
26
+ readonly capabilities: ProviderCapabilities;
27
+ private baseUrl;
28
+ private defaultChatModel;
29
+ private defaultEmbedModel;
30
+ constructor(baseUrl?: string, defaultChatModel?: string, defaultEmbedModel?: string);
31
+ getModels(): Promise<ModelInfo[]>;
32
+ getDefaultModel(): string;
33
+ chat(prompt: string, options?: ChatOptions): Promise<ChatResponse>;
34
+ chatStream(prompt: string, options?: ChatOptions, onEvent?: (event: StreamEvent) => void): Promise<ChatResponse>;
35
+ embed(text: string | string[]): Promise<number[] | number[][]>;
36
+ embedQuery(query: string): Promise<number[]>;
37
+ rerank?(_query: string, _documents: string[], _options?: {
38
+ topN?: number;
39
+ model?: string;
40
+ }): Promise<RerankResponse>;
41
+ countTokens(text: string, _model?: string): Promise<number>;
42
+ isAvailable(): Promise<boolean>;
43
+ handleError?(error: unknown): {
44
+ type: string;
45
+ retryable: boolean;
46
+ message: string;
47
+ };
48
+ }
49
+ //# sourceMappingURL=local-llm-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-llm-provider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/local-llm-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EAEf,MAAM,+BAA+B,CAAC;AA2BvC;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAiB,YAAW,cAAc;IACrD,QAAQ,CAAC,EAAE,WAAW;IACtB,QAAQ,CAAC,IAAI,wBAAwB;IAErC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAOzC;IAEF,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,iBAAiB,CAAS;gBAGhC,OAAO,CAAC,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,MAAM,EACzB,iBAAiB,CAAC,EAAE,MAAM;IActB,SAAS,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAevC,eAAe,IAAI,MAAM;IAInB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAqDlE,UAAU,CACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GACrC,OAAO,CAAC,YAAY,CAAC;IA8FlB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;IAuC9D,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAOlD,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAM9G,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI3D,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IA6BrC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAqCpF"}
@@ -0,0 +1,330 @@
1
+ /**
2
+ * Provider Layer: LocalLLMProvider
3
+ * OpenAI-compatible local LLM provider (Ollama, LM Studio, on-prem gateways)
4
+ *
5
+ * Phase 4E: Local LLM Provider Implementation
6
+ * Supports any OpenAI-compatible endpoint for chat and embeddings
7
+ */
8
+ import { retryWithBackoff } from '../../error-handler.js';
9
+ import { encoding_for_model } from 'tiktoken';
10
+ // Token counting (tiktoken for OpenAI-compatible models)
11
+ let tokenEncoder = null;
12
+ function getTokenEncoder() {
13
+ if (!tokenEncoder) {
14
+ try {
15
+ tokenEncoder = encoding_for_model('gpt-3.5-turbo'); // OpenAI-compatible encoding
16
+ }
17
+ catch {
18
+ tokenEncoder = encoding_for_model('gpt-4'); // Fallback
19
+ }
20
+ }
21
+ return tokenEncoder;
22
+ }
23
+ function countTokens(text) {
24
+ try {
25
+ const encoder = getTokenEncoder();
26
+ return encoder.encode(text).length;
27
+ }
28
+ catch (error) {
29
+ console.warn('Warning: tiktoken failed for LocalLLMProvider, using character-based estimate (less accurate)');
30
+ return Math.ceil(text.length / 4);
31
+ }
32
+ }
33
+ /**
34
+ * LocalLLMProvider
35
+ * Implements IModelProvider for OpenAI-compatible local endpoints
36
+ *
37
+ * Designed for:
38
+ * - Ollama (http://localhost:11434)
39
+ * - LM Studio (http://localhost:1234)
40
+ * - On-prem OpenAI-compatible gateways
41
+ *
42
+ * API Assumptions:
43
+ * - POST {baseUrl}/v1/chat/completions (OpenAI-compatible)
44
+ * - POST {baseUrl}/v1/embeddings (OpenAI-compatible)
45
+ * - Streaming via Server-Sent Events (SSE) if supported
46
+ */
47
+ export class LocalLLMProvider {
48
+ id = 'local';
49
+ name = 'Local LLM Provider';
50
+ capabilities = {
51
+ chat: true,
52
+ streaming: true, // Assume streaming is supported (will gracefully fall back if not)
53
+ embedding: true,
54
+ embeddingQuery: false, // Local LLMs typically don't have separate query embeddings
55
+ rerank: false, // Local LLMs typically don't have rerank
56
+ toolCalling: false, // Not supported initially
57
+ };
58
+ baseUrl;
59
+ defaultChatModel;
60
+ defaultEmbedModel;
61
+ constructor(baseUrl, defaultChatModel, defaultEmbedModel) {
62
+ this.baseUrl = baseUrl || process.env.CODEHERE_LOCAL_BASE_URL || '';
63
+ if (!this.baseUrl) {
64
+ throw new Error('CODEHERE_LOCAL_BASE_URL not found in environment for LocalLLMProvider initialization.');
65
+ }
66
+ // Remove trailing slash if present
67
+ this.baseUrl = this.baseUrl.replace(/\/$/, '');
68
+ this.defaultChatModel = defaultChatModel || process.env.CODEHERE_LOCAL_MODEL || 'local-default';
69
+ this.defaultEmbedModel = defaultEmbedModel || process.env.CODEHERE_LOCAL_EMBED_MODEL || this.defaultChatModel;
70
+ }
71
+ async getModels() {
72
+ // Return a basic model info for the configured model
73
+ // In the future, could query the local endpoint for available models
74
+ return [
75
+ {
76
+ id: this.defaultChatModel,
77
+ name: `Local Model: ${this.defaultChatModel}`,
78
+ providerId: this.id,
79
+ providerModelId: this.defaultChatModel,
80
+ contextWindow: 4096, // Conservative default, actual may vary
81
+ capabilities: { ...this.capabilities },
82
+ },
83
+ ];
84
+ }
85
+ getDefaultModel() {
86
+ return this.defaultChatModel;
87
+ }
88
+ async chat(prompt, options) {
89
+ const model = options?.model || this.defaultChatModel;
90
+ return await retryWithBackoff(async () => {
91
+ const response = await fetch(`${this.baseUrl}/v1/chat/completions`, {
92
+ method: 'POST',
93
+ headers: {
94
+ 'Content-Type': 'application/json',
95
+ },
96
+ body: JSON.stringify({
97
+ model,
98
+ messages: [{ role: 'user', content: prompt }],
99
+ temperature: options?.temperature ?? 0.7,
100
+ max_tokens: options?.maxTokens,
101
+ }),
102
+ });
103
+ if (!response.ok) {
104
+ const errorText = await response.text();
105
+ let errorMessage = `Local LLM API error: ${response.status} ${errorText}`;
106
+ try {
107
+ const errorJson = JSON.parse(errorText);
108
+ errorMessage = errorJson.error?.message || errorMessage;
109
+ }
110
+ catch {
111
+ // ignore
112
+ }
113
+ throw new Error(errorMessage);
114
+ }
115
+ const data = await response.json();
116
+ const text = data.choices?.[0]?.message?.content || 'No response generated';
117
+ const usage = data.usage || {};
118
+ return {
119
+ text,
120
+ model: data.model || model,
121
+ usage: {
122
+ inputTokens: usage.prompt_tokens || countTokens(prompt),
123
+ outputTokens: usage.completion_tokens || countTokens(text),
124
+ },
125
+ finishReason: data.choices?.[0]?.finish_reason,
126
+ };
127
+ }, {
128
+ maxRetries: 3, // Fewer retries for local endpoints
129
+ baseDelay: 1000,
130
+ maxDelay: 5000,
131
+ operationName: 'local-llm-provider-chat',
132
+ });
133
+ }
134
+ async chatStream(prompt, options, onEvent) {
135
+ const model = options?.model || this.defaultChatModel;
136
+ let fullText = '';
137
+ try {
138
+ const response = await fetch(`${this.baseUrl}/v1/chat/completions`, {
139
+ method: 'POST',
140
+ headers: {
141
+ 'Content-Type': 'application/json',
142
+ },
143
+ body: JSON.stringify({
144
+ model,
145
+ messages: [{ role: 'user', content: prompt }],
146
+ temperature: options?.temperature ?? 0.7,
147
+ max_tokens: options?.maxTokens,
148
+ stream: true,
149
+ }),
150
+ });
151
+ if (!response.ok || !response.body) {
152
+ const errorText = await response.text();
153
+ let errorMessage = `Local LLM API error: ${response.status} ${errorText}`;
154
+ try {
155
+ const errorJson = JSON.parse(errorText);
156
+ errorMessage = errorJson.error?.message || errorMessage;
157
+ }
158
+ catch {
159
+ // ignore
160
+ }
161
+ if (onEvent) {
162
+ onEvent({ type: 'error', error: new Error(errorMessage) });
163
+ }
164
+ throw new Error(errorMessage);
165
+ }
166
+ if (onEvent) {
167
+ onEvent({ type: 'start' });
168
+ }
169
+ const reader = response.body.getReader();
170
+ const decoder = new TextDecoder('utf-8');
171
+ while (true) {
172
+ const { done, value } = await reader.read();
173
+ if (done)
174
+ break;
175
+ const chunk = decoder.decode(value, { stream: true });
176
+ const lines = chunk.split('\n').filter(line => line.trim() !== '');
177
+ for (const line of lines) {
178
+ if (line.startsWith('data: ')) {
179
+ const data = line.substring(6);
180
+ if (data === '[DONE]') {
181
+ break;
182
+ }
183
+ try {
184
+ const json = JSON.parse(data);
185
+ const delta = json.choices?.[0]?.delta?.content;
186
+ if (delta) {
187
+ fullText += delta;
188
+ if (onEvent) {
189
+ onEvent({ type: 'delta', text: delta });
190
+ }
191
+ }
192
+ }
193
+ catch (e) {
194
+ // Ignore parse errors for malformed SSE chunks
195
+ console.warn('Error parsing stream chunk:', e);
196
+ }
197
+ }
198
+ }
199
+ }
200
+ if (onEvent) {
201
+ onEvent({ type: 'complete', text: fullText });
202
+ }
203
+ const inputTokens = await this.countTokens(prompt, model);
204
+ const outputTokens = await this.countTokens(fullText, model);
205
+ return {
206
+ text: fullText,
207
+ model: model,
208
+ usage: {
209
+ inputTokens,
210
+ outputTokens,
211
+ },
212
+ };
213
+ }
214
+ catch (error) {
215
+ if (onEvent) {
216
+ onEvent({ type: 'error', error: error instanceof Error ? error : new Error(String(error)) });
217
+ }
218
+ throw error;
219
+ }
220
+ }
221
+ async embed(text) {
222
+ const texts = Array.isArray(text) ? text : [text];
223
+ const model = this.defaultEmbedModel;
224
+ return await retryWithBackoff(async () => {
225
+ const response = await fetch(`${this.baseUrl}/v1/embeddings`, {
226
+ method: 'POST',
227
+ headers: {
228
+ 'Content-Type': 'application/json',
229
+ },
230
+ body: JSON.stringify({
231
+ model,
232
+ input: texts,
233
+ }),
234
+ });
235
+ if (!response.ok) {
236
+ const errorText = await response.text();
237
+ throw new Error(`Local LLM API error: ${response.status} ${errorText}`);
238
+ }
239
+ const data = await response.json();
240
+ const embeddings = data.data?.map((item) => item.embedding) || [];
241
+ if (texts.length === 1) {
242
+ return embeddings[0];
243
+ }
244
+ return embeddings;
245
+ }, {
246
+ maxRetries: 3,
247
+ baseDelay: 1000,
248
+ maxDelay: 5000,
249
+ operationName: 'local-llm-provider-embed',
250
+ });
251
+ }
252
+ async embedQuery(query) {
253
+ // Local LLMs typically don't have separate query embeddings
254
+ // Fall back to regular embed
255
+ const result = await this.embed(query);
256
+ return Array.isArray(result[0]) ? result[0] : result;
257
+ }
258
+ rerank(_query, _documents, _options) {
259
+ // Local LLMs typically don't have rerank
260
+ // ProviderAIService will handle this gracefully by falling back to original order
261
+ throw new Error('LocalLLMProvider does not support rerank directly.');
262
+ }
263
+ async countTokens(text, _model) {
264
+ return Promise.resolve(countTokens(text));
265
+ }
266
+ async isAvailable() {
267
+ try {
268
+ // Simple availability check - try to list models or health check
269
+ // Many local endpoints have a /v1/models endpoint
270
+ const response = await fetch(`${this.baseUrl}/v1/models`, {
271
+ method: 'GET',
272
+ });
273
+ return response.ok;
274
+ }
275
+ catch {
276
+ // If /v1/models doesn't exist, try a simple chat completion check
277
+ try {
278
+ const response = await fetch(`${this.baseUrl}/v1/chat/completions`, {
279
+ method: 'POST',
280
+ headers: {
281
+ 'Content-Type': 'application/json',
282
+ },
283
+ body: JSON.stringify({
284
+ model: this.defaultChatModel,
285
+ messages: [{ role: 'user', content: 'test' }],
286
+ max_tokens: 1,
287
+ }),
288
+ });
289
+ return response.ok;
290
+ }
291
+ catch {
292
+ return false;
293
+ }
294
+ }
295
+ }
296
+ handleError(error) {
297
+ const errorMessage = error instanceof Error ? error.message : String(error);
298
+ // Network errors (connection refused, timeout)
299
+ if (errorMessage.includes('network') || errorMessage.includes('timeout') || errorMessage.includes('ECONNREFUSED') || errorMessage.includes('fetch failed')) {
300
+ return {
301
+ type: 'network_error',
302
+ retryable: true,
303
+ message: 'Network error connecting to local LLM endpoint',
304
+ };
305
+ }
306
+ // Invalid request (400, 404, etc.)
307
+ if (errorMessage.includes('400') || errorMessage.includes('404') || errorMessage.includes('invalid_request_error')) {
308
+ return {
309
+ type: 'invalid_request',
310
+ retryable: false,
311
+ message: 'Invalid request to local LLM API',
312
+ };
313
+ }
314
+ // Server errors (500, 502, 503)
315
+ if (errorMessage.includes('500') || errorMessage.includes('502') || errorMessage.includes('503')) {
316
+ return {
317
+ type: 'server_error',
318
+ retryable: true,
319
+ message: 'Local LLM server error',
320
+ };
321
+ }
322
+ // Default to unknown and retryable
323
+ return {
324
+ type: 'unknown',
325
+ retryable: true,
326
+ message: errorMessage,
327
+ };
328
+ }
329
+ }
330
+ //# sourceMappingURL=local-llm-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-llm-provider.js","sourceRoot":"","sources":["../../../src/infrastructure/providers/local-llm-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,yDAAyD;AACzD,IAAI,YAAY,GAAiD,IAAI,CAAC;AACtE,SAAS,eAAe;IACtB,IAAI,CAAC,YAAY,EA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AAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE5E,+CAA+C;QAC/C,IAAI,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YAC3J,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,gDAAgD;aAC1D,CAAC;QACJ,CAAC;QAED,mCAAmC;QACnC,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;YACnH,OAAO;gBACL,IAAI,EAAE,iBAAiB;gBACvB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,kCAAkC;aAC5C,CAAC;QACJ,CAAC;QAED,gCAAgC;QAChC,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACjG,OAAO;gBACL,IAAI,EAAE,cAAc;gBACpB,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,wBAAwB;aAClC,CAAC;QACJ,CAAC;QAED,mCAAmC;QACnC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,YAAY;SACtB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Provider Layer: Model Configuration Types
3
+ * Provider-agnostic model configuration structures
4
+ *
5
+ * Phase 4A: Foundation Implementation (No Behavior Change)
6
+ * Minimal types for internal use only - no CLI/config file changes yet
7
+ */
8
+ import type { ProviderCapabilities } from './model-provider.interface.js';
9
+ /**
10
+ * Provider model configuration
11
+ */
12
+ export interface ProviderModelConfig {
13
+ id: string;
14
+ enabled: boolean;
15
+ apiKey?: string;
16
+ baseUrl?: string;
17
+ defaultModel?: string;
18
+ models: {
19
+ [modelId: string]: {
20
+ providerModelId: string;
21
+ contextWindow: number;
22
+ capabilities: ProviderCapabilities;
23
+ };
24
+ };
25
+ }
26
+ /**
27
+ * Operation-specific provider selection
28
+ */
29
+ export interface OperationProviderConfig {
30
+ chat?: string;
31
+ embedding?: string;
32
+ rerank?: string;
33
+ default?: string;
34
+ }
35
+ /**
36
+ * Enhanced model configuration
37
+ *
38
+ * Phase 4A: Types only - not yet wired into config files
39
+ */
40
+ export interface ModelConfig {
41
+ /** Default provider selection */
42
+ defaultProvider: string;
43
+ /** Operation-specific provider selection */
44
+ operationProviders?: OperationProviderConfig;
45
+ /** Provider configurations */
46
+ providers: {
47
+ [providerId: string]: ProviderModelConfig;
48
+ };
49
+ /** Fallback provider chain (for future) */
50
+ fallbackProviders?: string[];
51
+ /** Model selection per use case (for future) */
52
+ useCaseModels?: {
53
+ planning?: string;
54
+ chat?: string;
55
+ reasoning?: string;
56
+ default?: string;
57
+ };
58
+ }
59
+ /**
60
+ * Minimal provider configuration for Phase 4A
61
+ * Internal use only - not yet exposed to users
62
+ */
63
+ export interface MinimalProviderConfig {
64
+ id: string;
65
+ name: string;
66
+ apiKey?: string;
67
+ baseUrl?: string;
68
+ defaultModel?: string;
69
+ }
70
+ //# sourceMappingURL=model-config.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-config.types.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/model-config.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,mBAAmB;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B"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Provider Layer: Model Configuration Types
3
+ * Provider-agnostic model configuration structures
4
+ *
5
+ * Phase 4A: Foundation Implementation (No Behavior Change)
6
+ * Minimal types for internal use only - no CLI/config file changes yet
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=model-config.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-config.types.js","sourceRoot":"","sources":["../../../src/infrastructure/providers/model-config.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Provider Layer: IModelProvider Interface
3
+ * Core abstraction for any AI model provider
4
+ *
5
+ * Phase 4A: Foundation Implementation (No Behavior Change)
6
+ */
7
+ /**
8
+ * Core provider capabilities
9
+ */
10
+ export interface ProviderCapabilities {
11
+ chat: boolean;
12
+ streaming: boolean;
13
+ embedding: boolean;
14
+ embeddingQuery: boolean;
15
+ rerank: boolean;
16
+ toolCalling: boolean;
17
+ }
18
+ /**
19
+ * Model information
20
+ */
21
+ export interface ModelInfo {
22
+ id: string;
23
+ name: string;
24
+ providerId: string;
25
+ providerModelId: string;
26
+ contextWindow: number;
27
+ capabilities: ProviderCapabilities;
28
+ }
29
+ /**
30
+ * Chat options
31
+ */
32
+ export interface ChatOptions {
33
+ temperature?: number;
34
+ maxTokens?: number;
35
+ model?: string;
36
+ stream?: boolean;
37
+ }
38
+ /**
39
+ * Chat response
40
+ */
41
+ export interface ChatResponse {
42
+ text: string;
43
+ model: string;
44
+ usage?: {
45
+ inputTokens: number;
46
+ outputTokens: number;
47
+ };
48
+ finishReason?: string;
49
+ }
50
+ /**
51
+ * Streaming event
52
+ */
53
+ export interface StreamEvent {
54
+ type: 'start' | 'delta' | 'complete' | 'error';
55
+ text?: string;
56
+ error?: Error;
57
+ }
58
+ /**
59
+ * Rerank result
60
+ */
61
+ export interface RerankResult {
62
+ index: number;
63
+ relevanceScore: number;
64
+ text?: string;
65
+ }
66
+ /**
67
+ * Rerank response
68
+ */
69
+ export interface RerankResponse {
70
+ results: RerankResult[];
71
+ model: string;
72
+ }
73
+ /**
74
+ * Core provider interface
75
+ *
76
+ * Phase 4A: Minimal implementation - wraps existing CohereAIService behavior
77
+ */
78
+ export interface IModelProvider {
79
+ /** Provider identifier */
80
+ readonly id: string;
81
+ /** Provider display name */
82
+ readonly name: string;
83
+ /** Provider capabilities */
84
+ readonly capabilities: ProviderCapabilities;
85
+ /** Available models */
86
+ getModels(): Promise<ModelInfo[]>;
87
+ /** Get default model */
88
+ getDefaultModel(): string;
89
+ /** Chat completion */
90
+ chat(prompt: string, options?: ChatOptions): Promise<ChatResponse>;
91
+ /** Streaming chat completion */
92
+ chatStream?(prompt: string, options?: ChatOptions, onEvent?: (event: StreamEvent) => void): Promise<ChatResponse>;
93
+ /** Generate embeddings (documents) */
94
+ embed(text: string | string[]): Promise<number[] | number[][]>;
95
+ /** Generate query embedding (optional, provider-specific) */
96
+ embedQuery?(query: string): Promise<number[]>;
97
+ /** Rerank documents (optional) */
98
+ rerank?(query: string, documents: string[], options?: {
99
+ topN?: number;
100
+ model?: string;
101
+ }): Promise<RerankResponse>;
102
+ /** Count tokens (provider-specific tokenizer) */
103
+ countTokens(text: string, model?: string): Promise<number>;
104
+ /** Check if provider is available */
105
+ isAvailable(): Promise<boolean>;
106
+ /** Get provider-specific error handler (optional) */
107
+ handleError?(error: unknown): {
108
+ type: string;
109
+ retryable: boolean;
110
+ message: string;
111
+ };
112
+ }
113
+ //# sourceMappingURL=model-provider.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-provider.interface.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/model-provider.interface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CA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AAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACrF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Provider Layer: IModelProvider Interface
3
+ * Core abstraction for any AI model provider
4
+ *
5
+ * Phase 4A: Foundation Implementation (No Behavior Change)
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=model-provider.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-provider.interface.js","sourceRoot":"","sources":["../../../src/infrastructure/providers/model-provider.interface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Provider Layer: OpenAIProvider
3
+ * Implements IModelProvider for OpenAI API
4
+ *
5
+ * Phase 4C: OpenAI Provider Implementation
6
+ *
7
+ * Uses OpenAI REST API directly (no SDK dependency) to keep dependencies minimal.
8
+ * Supports GPT-4, GPT-3.5, and text-embedding models.
9
+ */
10
+ import type { IModelProvider, ProviderCapabilities, ModelInfo, ChatOptions, ChatResponse, StreamEvent } from './model-provider.interface.js';
11
+ /**
12
+ * OpenAI Provider
13
+ * Implements IModelProvider using OpenAI REST API
14
+ */
15
+ export declare class OpenAIProvider implements IModelProvider {
16
+ readonly id = "openai";
17
+ readonly name = "OpenAI";
18
+ readonly capabilities: ProviderCapabilities;
19
+ private apiKey;
20
+ private baseUrl;
21
+ private defaultChatModel;
22
+ private defaultEmbedModel;
23
+ constructor(apiKey?: string, baseUrl?: string);
24
+ getModels(): Promise<ModelInfo[]>;
25
+ getDefaultModel(): string;
26
+ chat(prompt: string, options?: ChatOptions): Promise<ChatResponse>;
27
+ chatStream(prompt: string, options?: ChatOptions, onEvent?: (event: StreamEvent) => void): Promise<ChatResponse>;
28
+ embed(text: string | string[]): Promise<number[] | number[][]>;
29
+ embedQuery(query: string): Promise<number[]>;
30
+ countTokens(text: string, _model?: string): Promise<number>;
31
+ isAvailable(): Promise<boolean>;
32
+ handleError?(error: unknown): {
33
+ type: string;
34
+ retryable: boolean;
35
+ message: string;
36
+ };
37
+ }
38
+ //# sourceMappingURL=openai-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-provider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/openai-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EAEZ,MAAM,+BAA+B,CAAC;AAmCvC;;;GAGG;AACH,qBAAa,cAAe,YAAW,cAAc;IACnD,QAAQ,CAAC,EAAE,YAAY;IACvB,QAAQ,CAAC,IAAI,YAAY;IAEzB,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAOzC;IAEF,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAWvC,SAAS,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAgGvC,eAAe,IAAI,MAAM;IAInB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IA2DlE,UAAU,CACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GACrC,OAAO,CAAC,YAAY,CAAC;IAoGlB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;IAuC9D,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAM5C,WAAW,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