codehere 0.1.0 → 0.2.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.

Potentially problematic release.


This version of codehere might be problematic. Click here for more details.

Files changed (603) hide show
  1. package/README.md +51 -25
  2. package/dist/agents/base.d.ts +107 -0
  3. package/dist/agents/base.d.ts.map +1 -0
  4. package/dist/agents/base.js +101 -0
  5. package/dist/agents/base.js.map +1 -0
  6. package/dist/agents/orchestrator-model-driven.d.ts +41 -0
  7. package/dist/agents/orchestrator-model-driven.d.ts.map +1 -0
  8. package/dist/agents/orchestrator-model-driven.js +141 -0
  9. package/dist/agents/orchestrator-model-driven.js.map +1 -0
  10. package/dist/agents/react-orchestrator-agent.d.ts +15 -0
  11. package/dist/agents/react-orchestrator-agent.d.ts.map +1 -0
  12. package/dist/agents/react-orchestrator-agent.js +54 -0
  13. package/dist/agents/react-orchestrator-agent.js.map +1 -0
  14. package/dist/application/agents/execution-agent.d.ts +68 -0
  15. package/dist/application/agents/execution-agent.d.ts.map +1 -0
  16. package/dist/application/agents/execution-agent.js +299 -0
  17. package/dist/application/agents/execution-agent.js.map +1 -0
  18. package/dist/application/agents/multi-agent-orchestrator.d.ts +64 -0
  19. package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -0
  20. package/dist/application/agents/multi-agent-orchestrator.js +209 -0
  21. package/dist/application/agents/multi-agent-orchestrator.js.map +1 -0
  22. package/dist/application/agents/planning-agent.d.ts +61 -0
  23. package/dist/application/agents/planning-agent.d.ts.map +1 -0
  24. package/dist/application/agents/planning-agent.js +357 -0
  25. package/dist/application/agents/planning-agent.js.map +1 -0
  26. package/dist/application/agents/validation-agent.d.ts +64 -0
  27. package/dist/application/agents/validation-agent.d.ts.map +1 -0
  28. package/dist/application/agents/validation-agent.js +182 -0
  29. package/dist/application/agents/validation-agent.js.map +1 -0
  30. package/dist/application/architectures/plan-and-act.d.ts +94 -0
  31. package/dist/application/architectures/plan-and-act.d.ts.map +1 -0
  32. package/dist/application/architectures/plan-and-act.js +242 -0
  33. package/dist/application/architectures/plan-and-act.js.map +1 -0
  34. package/dist/application/index.d.ts +12 -0
  35. package/dist/application/index.d.ts.map +1 -0
  36. package/dist/application/index.js +12 -0
  37. package/dist/application/index.js.map +1 -0
  38. package/dist/application/services/agent-factory.d.ts +9 -0
  39. package/dist/application/services/agent-factory.d.ts.map +1 -0
  40. package/dist/application/services/agent-factory.js +28 -0
  41. package/dist/application/services/agent-factory.js.map +1 -0
  42. package/dist/application/services/dependency-container.d.ts +140 -0
  43. package/dist/application/services/dependency-container.d.ts.map +1 -0
  44. package/dist/application/services/dependency-container.js +402 -0
  45. package/dist/application/services/dependency-container.js.map +1 -0
  46. package/dist/application/services/git-context-service.d.ts +30 -0
  47. package/dist/application/services/git-context-service.d.ts.map +1 -0
  48. package/dist/application/services/git-context-service.js +83 -0
  49. package/dist/application/services/git-context-service.js.map +1 -0
  50. package/dist/application/services/intelligent-router.d.ts +74 -0
  51. package/dist/application/services/intelligent-router.d.ts.map +1 -0
  52. package/dist/application/services/intelligent-router.js +711 -0
  53. package/dist/application/services/intelligent-router.js.map +1 -0
  54. package/dist/application/services/tool-executor-service.d.ts +14 -0
  55. package/dist/application/services/tool-executor-service.d.ts.map +1 -0
  56. package/dist/application/services/tool-executor-service.js +94 -0
  57. package/dist/application/services/tool-executor-service.js.map +1 -0
  58. package/dist/application/use-cases/ask-question-use-case.d.ts +36 -0
  59. package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -0
  60. package/dist/application/use-cases/ask-question-use-case.js +150 -0
  61. package/dist/application/use-cases/ask-question-use-case.js.map +1 -0
  62. package/dist/application/use-cases/edit-file-use-case.d.ts +76 -0
  63. package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -0
  64. package/dist/application/use-cases/edit-file-use-case.js +685 -0
  65. package/dist/application/use-cases/edit-file-use-case.js.map +1 -0
  66. package/dist/application/use-cases/explain-file-use-case.d.ts +21 -0
  67. package/dist/application/use-cases/explain-file-use-case.d.ts.map +1 -0
  68. package/dist/application/use-cases/explain-file-use-case.js +50 -0
  69. package/dist/application/use-cases/explain-file-use-case.js.map +1 -0
  70. package/dist/application/use-cases/index-codebase-use-case.d.ts +46 -0
  71. package/dist/application/use-cases/index-codebase-use-case.d.ts.map +1 -0
  72. package/dist/application/use-cases/index-codebase-use-case.js +113 -0
  73. package/dist/application/use-cases/index-codebase-use-case.js.map +1 -0
  74. package/dist/application/use-cases/planning-use-case.d.ts +46 -0
  75. package/dist/application/use-cases/planning-use-case.d.ts.map +1 -0
  76. package/dist/application/use-cases/planning-use-case.js +267 -0
  77. package/dist/application/use-cases/planning-use-case.js.map +1 -0
  78. package/dist/application/use-cases/react-orchestration-use-case.d.ts +51 -0
  79. package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -0
  80. package/dist/application/use-cases/react-orchestration-use-case.js +325 -0
  81. package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -0
  82. package/dist/application/use-cases/reflexion-use-case.d.ts +24 -0
  83. package/dist/application/use-cases/reflexion-use-case.d.ts.map +1 -0
  84. package/dist/application/use-cases/reflexion-use-case.js +30 -0
  85. package/dist/application/use-cases/reflexion-use-case.js.map +1 -0
  86. package/dist/application/workflows/deterministic-workflows.d.ts +61 -0
  87. package/dist/application/workflows/deterministic-workflows.d.ts.map +1 -0
  88. package/dist/application/workflows/deterministic-workflows.js +189 -0
  89. package/dist/application/workflows/deterministic-workflows.js.map +1 -0
  90. package/dist/cache.d.ts.map +1 -1
  91. package/dist/cache.js +1 -3
  92. package/dist/cache.js.map +1 -1
  93. package/dist/chat.js +10 -10
  94. package/dist/chat.js.map +1 -1
  95. package/dist/docs.d.ts.map +1 -1
  96. package/dist/docs.js +1 -2
  97. package/dist/docs.js.map +1 -1
  98. package/dist/domain/entities/code-chunk.d.ts +26 -0
  99. package/dist/domain/entities/code-chunk.d.ts.map +1 -0
  100. package/dist/domain/entities/code-chunk.js +6 -0
  101. package/dist/domain/entities/code-chunk.js.map +1 -0
  102. package/dist/domain/entities/decision.d.ts +37 -0
  103. package/dist/domain/entities/decision.d.ts.map +1 -0
  104. package/dist/domain/entities/decision.js +9 -0
  105. package/dist/domain/entities/decision.js.map +1 -0
  106. package/dist/domain/entities/edit.d.ts +35 -0
  107. package/dist/domain/entities/edit.d.ts.map +1 -0
  108. package/dist/domain/entities/edit.js +6 -0
  109. package/dist/domain/entities/edit.js.map +1 -0
  110. package/dist/domain/entities/knowledge-node.d.ts +83 -0
  111. package/dist/domain/entities/knowledge-node.d.ts.map +1 -0
  112. package/dist/domain/entities/knowledge-node.js +9 -0
  113. package/dist/domain/entities/knowledge-node.js.map +1 -0
  114. package/dist/domain/entities/knowledge-preservation.d.ts +42 -0
  115. package/dist/domain/entities/knowledge-preservation.d.ts.map +1 -0
  116. package/dist/domain/entities/knowledge-preservation.js +10 -0
  117. package/dist/domain/entities/knowledge-preservation.js.map +1 -0
  118. package/dist/domain/entities/memory.d.ts +36 -0
  119. package/dist/domain/entities/memory.d.ts.map +1 -0
  120. package/dist/domain/entities/memory.js +6 -0
  121. package/dist/domain/entities/memory.js.map +1 -0
  122. package/dist/domain/entities/pattern.d.ts +49 -0
  123. package/dist/domain/entities/pattern.d.ts.map +1 -0
  124. package/dist/domain/entities/pattern.js +7 -0
  125. package/dist/domain/entities/pattern.js.map +1 -0
  126. package/dist/domain/entities/plan.d.ts +42 -0
  127. package/dist/domain/entities/plan.d.ts.map +1 -0
  128. package/dist/domain/entities/plan.js +6 -0
  129. package/dist/domain/entities/plan.js.map +1 -0
  130. package/dist/domain/entities/query.d.ts +17 -0
  131. package/dist/domain/entities/query.d.ts.map +1 -0
  132. package/dist/domain/entities/query.js +6 -0
  133. package/dist/domain/entities/query.js.map +1 -0
  134. package/dist/domain/index.d.ts +16 -0
  135. package/dist/domain/index.d.ts.map +1 -0
  136. package/dist/domain/index.js +19 -0
  137. package/dist/domain/index.js.map +1 -0
  138. package/dist/domain/interfaces/ai-service.interface.d.ts +62 -0
  139. package/dist/domain/interfaces/ai-service.interface.d.ts.map +1 -0
  140. package/dist/domain/interfaces/ai-service.interface.js +6 -0
  141. package/dist/domain/interfaces/ai-service.interface.js.map +1 -0
  142. package/dist/domain/interfaces/code-analyzer.interface.d.ts +38 -0
  143. package/dist/domain/interfaces/code-analyzer.interface.d.ts.map +1 -0
  144. package/dist/domain/interfaces/code-analyzer.interface.js +6 -0
  145. package/dist/domain/interfaces/code-analyzer.interface.js.map +1 -0
  146. package/dist/domain/interfaces/decision-repository.interface.d.ts +51 -0
  147. package/dist/domain/interfaces/decision-repository.interface.d.ts.map +1 -0
  148. package/dist/domain/interfaces/decision-repository.interface.js +9 -0
  149. package/dist/domain/interfaces/decision-repository.interface.js.map +1 -0
  150. package/dist/domain/interfaces/embedding-repository.interface.d.ts +28 -0
  151. package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -0
  152. package/dist/domain/interfaces/embedding-repository.interface.js +6 -0
  153. package/dist/domain/interfaces/embedding-repository.interface.js.map +1 -0
  154. package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts +91 -0
  155. package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts.map +1 -0
  156. package/dist/domain/interfaces/knowledge-graph-repository.interface.js +9 -0
  157. package/dist/domain/interfaces/knowledge-graph-repository.interface.js.map +1 -0
  158. package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts +50 -0
  159. package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts.map +1 -0
  160. package/dist/domain/interfaces/knowledge-preservation-repository.interface.js +8 -0
  161. package/dist/domain/interfaces/knowledge-preservation-repository.interface.js.map +1 -0
  162. package/dist/domain/interfaces/memory-repository.interface.d.ts +49 -0
  163. package/dist/domain/interfaces/memory-repository.interface.d.ts.map +1 -0
  164. package/dist/domain/interfaces/memory-repository.interface.js +6 -0
  165. package/dist/domain/interfaces/memory-repository.interface.js.map +1 -0
  166. package/dist/domain/interfaces/pattern-repository.interface.d.ts +48 -0
  167. package/dist/domain/interfaces/pattern-repository.interface.d.ts.map +1 -0
  168. package/dist/domain/interfaces/pattern-repository.interface.js +6 -0
  169. package/dist/domain/interfaces/pattern-repository.interface.js.map +1 -0
  170. package/dist/domain/interfaces/verification-service.interface.d.ts +20 -0
  171. package/dist/domain/interfaces/verification-service.interface.d.ts.map +1 -0
  172. package/dist/domain/interfaces/verification-service.interface.js +6 -0
  173. package/dist/domain/interfaces/verification-service.interface.js.map +1 -0
  174. package/dist/domain/services/codebase-detector.d.ts +18 -0
  175. package/dist/domain/services/codebase-detector.d.ts.map +1 -0
  176. package/dist/domain/services/codebase-detector.js +91 -0
  177. package/dist/domain/services/codebase-detector.js.map +1 -0
  178. package/dist/domain/services/cross-team-pattern-sharing.d.ts +65 -0
  179. package/dist/domain/services/cross-team-pattern-sharing.d.ts.map +1 -0
  180. package/dist/domain/services/cross-team-pattern-sharing.js +125 -0
  181. package/dist/domain/services/cross-team-pattern-sharing.js.map +1 -0
  182. package/dist/domain/services/decision-recorder.d.ts +76 -0
  183. package/dist/domain/services/decision-recorder.d.ts.map +1 -0
  184. package/dist/domain/services/decision-recorder.js +223 -0
  185. package/dist/domain/services/decision-recorder.js.map +1 -0
  186. package/dist/domain/services/decision-retriever.d.ts +75 -0
  187. package/dist/domain/services/decision-retriever.d.ts.map +1 -0
  188. package/dist/domain/services/decision-retriever.js +133 -0
  189. package/dist/domain/services/decision-retriever.js.map +1 -0
  190. package/dist/domain/services/graded-memory-activation.d.ts +37 -0
  191. package/dist/domain/services/graded-memory-activation.d.ts.map +1 -0
  192. package/dist/domain/services/graded-memory-activation.js +69 -0
  193. package/dist/domain/services/graded-memory-activation.js.map +1 -0
  194. package/dist/domain/services/knowledge-access.d.ts +63 -0
  195. package/dist/domain/services/knowledge-access.d.ts.map +1 -0
  196. package/dist/domain/services/knowledge-access.js +132 -0
  197. package/dist/domain/services/knowledge-access.js.map +1 -0
  198. package/dist/domain/services/knowledge-extractor.d.ts +54 -0
  199. package/dist/domain/services/knowledge-extractor.d.ts.map +1 -0
  200. package/dist/domain/services/knowledge-extractor.js +247 -0
  201. package/dist/domain/services/knowledge-extractor.js.map +1 -0
  202. package/dist/domain/services/knowledge-graph-builder.d.ts +70 -0
  203. package/dist/domain/services/knowledge-graph-builder.d.ts.map +1 -0
  204. package/dist/domain/services/knowledge-graph-builder.js +268 -0
  205. package/dist/domain/services/knowledge-graph-builder.js.map +1 -0
  206. package/dist/domain/services/knowledge-graph-query.d.ts +69 -0
  207. package/dist/domain/services/knowledge-graph-query.d.ts.map +1 -0
  208. package/dist/domain/services/knowledge-graph-query.js +187 -0
  209. package/dist/domain/services/knowledge-graph-query.js.map +1 -0
  210. package/dist/domain/services/memory-retriever.d.ts +30 -0
  211. package/dist/domain/services/memory-retriever.d.ts.map +1 -0
  212. package/dist/domain/services/memory-retriever.js +82 -0
  213. package/dist/domain/services/memory-retriever.js.map +1 -0
  214. package/dist/domain/services/memory-synthesizer.d.ts +57 -0
  215. package/dist/domain/services/memory-synthesizer.d.ts.map +1 -0
  216. package/dist/domain/services/memory-synthesizer.js +91 -0
  217. package/dist/domain/services/memory-synthesizer.js.map +1 -0
  218. package/dist/domain/services/pattern-extractor.d.ts +108 -0
  219. package/dist/domain/services/pattern-extractor.d.ts.map +1 -0
  220. package/dist/domain/services/pattern-extractor.js +442 -0
  221. package/dist/domain/services/pattern-extractor.js.map +1 -0
  222. package/dist/domain/services/query-intent-classifier.d.ts +16 -0
  223. package/dist/domain/services/query-intent-classifier.d.ts.map +1 -0
  224. package/dist/domain/services/query-intent-classifier.js +140 -0
  225. package/dist/domain/services/query-intent-classifier.js.map +1 -0
  226. package/dist/domain/services/react-loop.d.ts +44 -0
  227. package/dist/domain/services/react-loop.d.ts.map +1 -0
  228. package/dist/domain/services/react-loop.js +110 -0
  229. package/dist/domain/services/react-loop.js.map +1 -0
  230. package/dist/edit.d.ts +0 -12
  231. package/dist/edit.d.ts.map +1 -1
  232. package/dist/edit.js +76 -351
  233. package/dist/edit.js.map +1 -1
  234. package/dist/embed.d.ts +0 -4
  235. package/dist/embed.d.ts.map +1 -1
  236. package/dist/embed.js +100 -174
  237. package/dist/embed.js.map +1 -1
  238. package/dist/error-handler.d.ts +1 -0
  239. package/dist/error-handler.d.ts.map +1 -1
  240. package/dist/error-handler.js +46 -3
  241. package/dist/error-handler.js.map +1 -1
  242. package/dist/index.js +228 -231
  243. package/dist/index.js.map +1 -1
  244. package/dist/infrastructure/ai/cohere-ai-service.d.ts +54 -0
  245. package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -0
  246. package/dist/infrastructure/ai/cohere-ai-service.js +547 -0
  247. package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -0
  248. package/dist/infrastructure/ai/command-r-evaluation.d.ts +42 -0
  249. package/dist/infrastructure/ai/command-r-evaluation.d.ts.map +1 -0
  250. package/dist/infrastructure/ai/command-r-evaluation.js +206 -0
  251. package/dist/infrastructure/ai/command-r-evaluation.js.map +1 -0
  252. package/dist/infrastructure/ai/model-config.d.ts +47 -0
  253. package/dist/infrastructure/ai/model-config.d.ts.map +1 -0
  254. package/dist/infrastructure/ai/model-config.js +84 -0
  255. package/dist/infrastructure/ai/model-config.js.map +1 -0
  256. package/dist/infrastructure/cache/embedding-cache.d.ts +46 -0
  257. package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -0
  258. package/dist/infrastructure/cache/embedding-cache.js +104 -0
  259. package/dist/infrastructure/cache/embedding-cache.js.map +1 -0
  260. package/dist/infrastructure/chunking/ast-code-chunker.d.ts +12 -0
  261. package/dist/infrastructure/chunking/ast-code-chunker.d.ts.map +1 -0
  262. package/dist/infrastructure/chunking/ast-code-chunker.js +19 -0
  263. package/dist/infrastructure/chunking/ast-code-chunker.js.map +1 -0
  264. package/dist/infrastructure/chunking/code-aware-chunker.d.ts +63 -0
  265. package/dist/infrastructure/chunking/code-aware-chunker.d.ts.map +1 -0
  266. package/dist/infrastructure/chunking/code-aware-chunker.js +397 -0
  267. package/dist/infrastructure/chunking/code-aware-chunker.js.map +1 -0
  268. package/dist/infrastructure/config/config-manager.d.ts +79 -0
  269. package/dist/infrastructure/config/config-manager.d.ts.map +1 -0
  270. package/dist/infrastructure/config/config-manager.js +162 -0
  271. package/dist/infrastructure/config/config-manager.js.map +1 -0
  272. package/dist/infrastructure/cost/cost-tracker.d.ts +90 -0
  273. package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -0
  274. package/dist/infrastructure/cost/cost-tracker.js +353 -0
  275. package/dist/infrastructure/cost/cost-tracker.js.map +1 -0
  276. package/dist/infrastructure/file-scanner/file-scanner.d.ts +31 -0
  277. package/dist/infrastructure/file-scanner/file-scanner.d.ts.map +1 -0
  278. package/dist/infrastructure/file-scanner/file-scanner.js +106 -0
  279. package/dist/infrastructure/file-scanner/file-scanner.js.map +1 -0
  280. package/dist/infrastructure/governance/nist-ai-rmf.d.ts +107 -0
  281. package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -0
  282. package/dist/infrastructure/governance/nist-ai-rmf.js +294 -0
  283. package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -0
  284. package/dist/infrastructure/governance/policy-as-code.d.ts +90 -0
  285. package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -0
  286. package/dist/infrastructure/governance/policy-as-code.js +244 -0
  287. package/dist/infrastructure/governance/policy-as-code.js.map +1 -0
  288. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +138 -0
  289. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -0
  290. package/dist/infrastructure/governance/prompt-to-code-lineage.js +241 -0
  291. package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -0
  292. package/dist/infrastructure/index.d.ts +7 -0
  293. package/dist/infrastructure/index.d.ts.map +1 -0
  294. package/dist/infrastructure/index.js +7 -0
  295. package/dist/infrastructure/index.js.map +1 -0
  296. package/dist/infrastructure/observability/execution-tracer.d.ts +105 -0
  297. package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -0
  298. package/dist/infrastructure/observability/execution-tracer.js +190 -0
  299. package/dist/infrastructure/observability/execution-tracer.js.map +1 -0
  300. package/dist/infrastructure/observability/prompt-versioner.d.ts +67 -0
  301. package/dist/infrastructure/observability/prompt-versioner.d.ts.map +1 -0
  302. package/dist/infrastructure/observability/prompt-versioner.js +145 -0
  303. package/dist/infrastructure/observability/prompt-versioner.js.map +1 -0
  304. package/dist/infrastructure/protocols/a2a-metadata.d.ts +278 -0
  305. package/dist/infrastructure/protocols/a2a-metadata.d.ts.map +1 -0
  306. package/dist/infrastructure/protocols/a2a-metadata.js +137 -0
  307. package/dist/infrastructure/protocols/a2a-metadata.js.map +1 -0
  308. package/dist/infrastructure/protocols/a2a-protocol.d.ts +132 -0
  309. package/dist/infrastructure/protocols/a2a-protocol.d.ts.map +1 -0
  310. package/dist/infrastructure/protocols/a2a-protocol.js +314 -0
  311. package/dist/infrastructure/protocols/a2a-protocol.js.map +1 -0
  312. package/dist/infrastructure/protocols/mcp-oauth.d.ts +91 -0
  313. package/dist/infrastructure/protocols/mcp-oauth.d.ts.map +1 -0
  314. package/dist/infrastructure/protocols/mcp-oauth.js +184 -0
  315. package/dist/infrastructure/protocols/mcp-oauth.js.map +1 -0
  316. package/dist/infrastructure/protocols/mcp-server.d.ts +126 -0
  317. package/dist/infrastructure/protocols/mcp-server.d.ts.map +1 -0
  318. package/dist/infrastructure/protocols/mcp-server.js +333 -0
  319. package/dist/infrastructure/protocols/mcp-server.js.map +1 -0
  320. package/dist/infrastructure/protocols/streaming-handler.d.ts +57 -0
  321. package/dist/infrastructure/protocols/streaming-handler.d.ts.map +1 -0
  322. package/dist/infrastructure/protocols/streaming-handler.js +103 -0
  323. package/dist/infrastructure/protocols/streaming-handler.js.map +1 -0
  324. package/dist/infrastructure/security/ai-sast-scanner.d.ts +55 -0
  325. package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -0
  326. package/dist/infrastructure/security/ai-sast-scanner.js +163 -0
  327. package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -0
  328. package/dist/infrastructure/security/docker-sandbox.d.ts +57 -0
  329. package/dist/infrastructure/security/docker-sandbox.d.ts.map +1 -0
  330. package/dist/infrastructure/security/docker-sandbox.js +178 -0
  331. package/dist/infrastructure/security/docker-sandbox.js.map +1 -0
  332. package/dist/infrastructure/security/enhanced-security-gate.d.ts +51 -0
  333. package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -0
  334. package/dist/infrastructure/security/enhanced-security-gate.js +92 -0
  335. package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -0
  336. package/dist/infrastructure/security/input-validator.d.ts +33 -0
  337. package/dist/infrastructure/security/input-validator.d.ts.map +1 -0
  338. package/dist/infrastructure/security/input-validator.js +152 -0
  339. package/dist/infrastructure/security/input-validator.js.map +1 -0
  340. package/dist/infrastructure/security/license-scanner.d.ts +55 -0
  341. package/dist/infrastructure/security/license-scanner.d.ts.map +1 -0
  342. package/dist/infrastructure/security/license-scanner.js +167 -0
  343. package/dist/infrastructure/security/license-scanner.js.map +1 -0
  344. package/dist/infrastructure/security/provider-bias-detector.d.ts +53 -0
  345. package/dist/infrastructure/security/provider-bias-detector.d.ts.map +1 -0
  346. package/dist/infrastructure/security/provider-bias-detector.js +164 -0
  347. package/dist/infrastructure/security/provider-bias-detector.js.map +1 -0
  348. package/dist/infrastructure/security/sandbox-executor.d.ts +34 -0
  349. package/dist/infrastructure/security/sandbox-executor.d.ts.map +1 -0
  350. package/dist/infrastructure/security/sandbox-executor.js +64 -0
  351. package/dist/infrastructure/security/sandbox-executor.js.map +1 -0
  352. package/dist/infrastructure/storage/memory-stream-service.d.ts +47 -0
  353. package/dist/infrastructure/storage/memory-stream-service.d.ts.map +1 -0
  354. package/dist/infrastructure/storage/memory-stream-service.js +204 -0
  355. package/dist/infrastructure/storage/memory-stream-service.js.map +1 -0
  356. package/dist/infrastructure/storage/sqlite-decision-repository.d.ts +29 -0
  357. package/dist/infrastructure/storage/sqlite-decision-repository.d.ts.map +1 -0
  358. package/dist/infrastructure/storage/sqlite-decision-repository.js +232 -0
  359. package/dist/infrastructure/storage/sqlite-decision-repository.js.map +1 -0
  360. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +24 -0
  361. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -0
  362. package/dist/infrastructure/storage/sqlite-embedding-repository.js +162 -0
  363. package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -0
  364. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts +41 -0
  365. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts.map +1 -0
  366. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +417 -0
  367. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js.map +1 -0
  368. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts +29 -0
  369. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts.map +1 -0
  370. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +230 -0
  371. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js.map +1 -0
  372. package/dist/infrastructure/storage/sqlite-memory-repository.d.ts +40 -0
  373. package/dist/infrastructure/storage/sqlite-memory-repository.d.ts.map +1 -0
  374. package/dist/infrastructure/storage/sqlite-memory-repository.js +229 -0
  375. package/dist/infrastructure/storage/sqlite-memory-repository.js.map +1 -0
  376. package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts +25 -0
  377. package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts.map +1 -0
  378. package/dist/infrastructure/storage/sqlite-pattern-repository.js +249 -0
  379. package/dist/infrastructure/storage/sqlite-pattern-repository.js.map +1 -0
  380. package/dist/infrastructure/ux/appropriate-friction.d.ts +77 -0
  381. package/dist/infrastructure/ux/appropriate-friction.d.ts.map +1 -0
  382. package/dist/infrastructure/ux/appropriate-friction.js +213 -0
  383. package/dist/infrastructure/ux/appropriate-friction.js.map +1 -0
  384. package/dist/infrastructure/ux/bi-directional-learning.d.ts +109 -0
  385. package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -0
  386. package/dist/infrastructure/ux/bi-directional-learning.js +200 -0
  387. package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -0
  388. package/dist/infrastructure/ux/expectation-management.d.ts +65 -0
  389. package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -0
  390. package/dist/infrastructure/ux/expectation-management.js +193 -0
  391. package/dist/infrastructure/ux/expectation-management.js.map +1 -0
  392. package/dist/infrastructure/ux/hitl-validation.d.ts +104 -0
  393. package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -0
  394. package/dist/infrastructure/ux/hitl-validation.js +211 -0
  395. package/dist/infrastructure/ux/hitl-validation.js.map +1 -0
  396. package/dist/infrastructure/ux/progressive-disclosure.d.ts +84 -0
  397. package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -0
  398. package/dist/infrastructure/ux/progressive-disclosure.js +235 -0
  399. package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -0
  400. package/dist/infrastructure/ux/team-standards.d.ts +94 -0
  401. package/dist/infrastructure/ux/team-standards.d.ts.map +1 -0
  402. package/dist/infrastructure/ux/team-standards.js +196 -0
  403. package/dist/infrastructure/ux/team-standards.js.map +1 -0
  404. package/dist/infrastructure/verification/verification-service.d.ts +12 -0
  405. package/dist/infrastructure/verification/verification-service.d.ts.map +1 -0
  406. package/dist/infrastructure/verification/verification-service.js +47 -0
  407. package/dist/infrastructure/verification/verification-service.js.map +1 -0
  408. package/dist/infrastructure/xai/attention-visualizer.d.ts +73 -0
  409. package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -0
  410. package/dist/infrastructure/xai/attention-visualizer.js +174 -0
  411. package/dist/infrastructure/xai/attention-visualizer.js.map +1 -0
  412. package/dist/infrastructure/xai/cot-visualizer.d.ts +105 -0
  413. package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -0
  414. package/dist/infrastructure/xai/cot-visualizer.js +239 -0
  415. package/dist/infrastructure/xai/cot-visualizer.js.map +1 -0
  416. package/dist/infrastructure/xai/decision-tree-log.d.ts +104 -0
  417. package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -0
  418. package/dist/infrastructure/xai/decision-tree-log.js +216 -0
  419. package/dist/infrastructure/xai/decision-tree-log.js.map +1 -0
  420. package/dist/infrastructure/xai/interactive-xai.d.ts +106 -0
  421. package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -0
  422. package/dist/infrastructure/xai/interactive-xai.js +262 -0
  423. package/dist/infrastructure/xai/interactive-xai.js.map +1 -0
  424. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +80 -0
  425. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -0
  426. package/dist/infrastructure/xai/uncertainty-quantifier.js +201 -0
  427. package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -0
  428. package/dist/intelligent-retrieval.d.ts.map +1 -1
  429. package/dist/intelligent-retrieval.js +8 -1
  430. package/dist/intelligent-retrieval.js.map +1 -1
  431. package/dist/intent/classifier.d.ts +6 -0
  432. package/dist/intent/classifier.d.ts.map +1 -0
  433. package/dist/intent/classifier.js +2 -0
  434. package/dist/intent/classifier.js.map +1 -0
  435. package/dist/intent/context.d.ts +4 -0
  436. package/dist/intent/context.d.ts.map +1 -0
  437. package/dist/intent/context.js +2 -0
  438. package/dist/intent/context.js.map +1 -0
  439. package/dist/iterative-refinement.d.ts.map +1 -1
  440. package/dist/iterative-refinement.js +20 -3
  441. package/dist/iterative-refinement.js.map +1 -1
  442. package/dist/learning.d.ts.map +1 -1
  443. package/dist/learning.js +1 -2
  444. package/dist/learning.js.map +1 -1
  445. package/dist/monitoring.d.ts.map +1 -1
  446. package/dist/monitoring.js +1 -2
  447. package/dist/monitoring.js.map +1 -1
  448. package/dist/parallel-processor.d.ts +3 -2
  449. package/dist/parallel-processor.d.ts.map +1 -1
  450. package/dist/parallel-processor.js +183 -56
  451. package/dist/parallel-processor.js.map +1 -1
  452. package/dist/presentation/cli/commands/ask-command.d.ts +8 -0
  453. package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -0
  454. package/dist/presentation/cli/commands/ask-command.js +133 -0
  455. package/dist/presentation/cli/commands/ask-command.js.map +1 -0
  456. package/dist/presentation/cli/commands/config-command.d.ts +9 -0
  457. package/dist/presentation/cli/commands/config-command.d.ts.map +1 -0
  458. package/dist/presentation/cli/commands/config-command.js +123 -0
  459. package/dist/presentation/cli/commands/config-command.js.map +1 -0
  460. package/dist/presentation/cli/commands/cost-command.d.ts +8 -0
  461. package/dist/presentation/cli/commands/cost-command.d.ts.map +1 -0
  462. package/dist/presentation/cli/commands/cost-command.js +191 -0
  463. package/dist/presentation/cli/commands/cost-command.js.map +1 -0
  464. package/dist/presentation/cli/commands/decision-command.d.ts +12 -0
  465. package/dist/presentation/cli/commands/decision-command.d.ts.map +1 -0
  466. package/dist/presentation/cli/commands/decision-command.js +207 -0
  467. package/dist/presentation/cli/commands/decision-command.js.map +1 -0
  468. package/dist/presentation/cli/commands/help-command.d.ts +9 -0
  469. package/dist/presentation/cli/commands/help-command.d.ts.map +1 -0
  470. package/dist/presentation/cli/commands/help-command.js +281 -0
  471. package/dist/presentation/cli/commands/help-command.js.map +1 -0
  472. package/dist/presentation/cli/commands/knowledge-command.d.ts +13 -0
  473. package/dist/presentation/cli/commands/knowledge-command.d.ts.map +1 -0
  474. package/dist/presentation/cli/commands/knowledge-command.js +129 -0
  475. package/dist/presentation/cli/commands/knowledge-command.js.map +1 -0
  476. package/dist/presentation/cli/commands/learning-dashboard-command.d.ts +8 -0
  477. package/dist/presentation/cli/commands/learning-dashboard-command.d.ts.map +1 -0
  478. package/dist/presentation/cli/commands/learning-dashboard-command.js +183 -0
  479. package/dist/presentation/cli/commands/learning-dashboard-command.js.map +1 -0
  480. package/dist/presentation/cli/commands/orchestrate-command.d.ts +8 -0
  481. package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -0
  482. package/dist/presentation/cli/commands/orchestrate-command.js +112 -0
  483. package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -0
  484. package/dist/presentation/cli/commands/plan-command.d.ts +8 -0
  485. package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -0
  486. package/dist/presentation/cli/commands/plan-command.js +114 -0
  487. package/dist/presentation/cli/commands/plan-command.js.map +1 -0
  488. package/dist/presentation/cli/commands/react-command.d.ts +8 -0
  489. package/dist/presentation/cli/commands/react-command.d.ts.map +1 -0
  490. package/dist/presentation/cli/commands/react-command.js +99 -0
  491. package/dist/presentation/cli/commands/react-command.js.map +1 -0
  492. package/dist/presentation/cli/commands/setup-command.d.ts +10 -0
  493. package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -0
  494. package/dist/presentation/cli/commands/setup-command.js +231 -0
  495. package/dist/presentation/cli/commands/setup-command.js.map +1 -0
  496. package/dist/presentation/cli/commands/smart-command.d.ts +6 -0
  497. package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -0
  498. package/dist/presentation/cli/commands/smart-command.js +212 -0
  499. package/dist/presentation/cli/commands/smart-command.js.map +1 -0
  500. package/dist/presentation/cli/commands/trace-command.d.ts +8 -0
  501. package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -0
  502. package/dist/presentation/cli/commands/trace-command.js +125 -0
  503. package/dist/presentation/cli/commands/trace-command.js.map +1 -0
  504. package/dist/presentation/cli/commands/undo-command.d.ts +8 -0
  505. package/dist/presentation/cli/commands/undo-command.d.ts.map +1 -0
  506. package/dist/presentation/cli/commands/undo-command.js +141 -0
  507. package/dist/presentation/cli/commands/undo-command.js.map +1 -0
  508. package/dist/presentation/cli/error-display.d.ts +23 -0
  509. package/dist/presentation/cli/error-display.d.ts.map +1 -0
  510. package/dist/presentation/cli/error-display.js +122 -0
  511. package/dist/presentation/cli/error-display.js.map +1 -0
  512. package/dist/refactor.d.ts.map +1 -1
  513. package/dist/refactor.js +2 -4
  514. package/dist/refactor.js.map +1 -1
  515. package/dist/search.d.ts.map +1 -1
  516. package/dist/search.js +2 -63
  517. package/dist/search.js.map +1 -1
  518. package/dist/session.d.ts.map +1 -1
  519. package/dist/session.js +52 -3
  520. package/dist/session.js.map +1 -1
  521. package/dist/testgen.d.ts.map +1 -1
  522. package/dist/testgen.js +1 -2
  523. package/dist/testgen.js.map +1 -1
  524. package/dist/tools/bash.d.ts +53 -0
  525. package/dist/tools/bash.d.ts.map +1 -0
  526. package/dist/tools/bash.js +213 -0
  527. package/dist/tools/bash.js.map +1 -0
  528. package/dist/tools/edit.d.ts +48 -0
  529. package/dist/tools/edit.d.ts.map +1 -0
  530. package/dist/tools/edit.js +235 -0
  531. package/dist/tools/edit.js.map +1 -0
  532. package/dist/tools/executor.d.ts +29 -0
  533. package/dist/tools/executor.d.ts.map +1 -0
  534. package/dist/tools/executor.js +153 -0
  535. package/dist/tools/executor.js.map +1 -0
  536. package/dist/tools/git-tool.d.ts +87 -0
  537. package/dist/tools/git-tool.d.ts.map +1 -0
  538. package/dist/tools/git-tool.js +292 -0
  539. package/dist/tools/git-tool.js.map +1 -0
  540. package/dist/tools/parser.d.ts +33 -0
  541. package/dist/tools/parser.d.ts.map +1 -0
  542. package/dist/tools/parser.js +158 -0
  543. package/dist/tools/parser.js.map +1 -0
  544. package/dist/tools/registry.d.ts +74 -0
  545. package/dist/tools/registry.d.ts.map +1 -0
  546. package/dist/tools/registry.js +302 -0
  547. package/dist/tools/registry.js.map +1 -0
  548. package/dist/tools/search.d.ts +41 -0
  549. package/dist/tools/search.d.ts.map +1 -0
  550. package/dist/tools/search.js +100 -0
  551. package/dist/tools/search.js.map +1 -0
  552. package/dist/ui.d.ts.map +1 -1
  553. package/dist/ui.js +4 -2
  554. package/dist/ui.js.map +1 -1
  555. package/dist/utils/check-api-status.d.ts +12 -0
  556. package/dist/utils/check-api-status.d.ts.map +1 -0
  557. package/dist/utils/check-api-status.js +82 -0
  558. package/dist/utils/check-api-status.js.map +1 -0
  559. package/dist/utils/diff-parser.d.ts +22 -0
  560. package/dist/utils/diff-parser.d.ts.map +1 -0
  561. package/dist/utils/diff-parser.js +160 -0
  562. package/dist/utils/diff-parser.js.map +1 -0
  563. package/dist/utils/logger.d.ts +34 -0
  564. package/dist/utils/logger.d.ts.map +1 -0
  565. package/dist/utils/logger.js +56 -0
  566. package/dist/utils/logger.js.map +1 -0
  567. package/dist/utils/version.d.ts +21 -0
  568. package/dist/utils/version.d.ts.map +1 -0
  569. package/dist/utils/version.js +52 -0
  570. package/dist/utils/version.js.map +1 -0
  571. package/dist/verification/backup.d.ts +30 -0
  572. package/dist/verification/backup.d.ts.map +1 -0
  573. package/dist/verification/backup.js +238 -0
  574. package/dist/verification/backup.js.map +1 -0
  575. package/dist/verification/compiler.d.ts +20 -0
  576. package/dist/verification/compiler.d.ts.map +1 -0
  577. package/dist/verification/compiler.js +228 -0
  578. package/dist/verification/compiler.js.map +1 -0
  579. package/dist/verification/index.d.ts +59 -0
  580. package/dist/verification/index.d.ts.map +1 -0
  581. package/dist/verification/index.js +273 -0
  582. package/dist/verification/index.js.map +1 -0
  583. package/dist/verification/test-runner.d.ts +27 -0
  584. package/dist/verification/test-runner.d.ts.map +1 -0
  585. package/dist/verification/test-runner.js +379 -0
  586. package/dist/verification/test-runner.js.map +1 -0
  587. package/package.json +39 -14
  588. package/ARCHITECTURE.md +0 -240
  589. package/CHANGELOG.md +0 -44
  590. package/CONTRIBUTING.md +0 -171
  591. package/dist/benchmark.d.ts +0 -39
  592. package/dist/benchmark.d.ts.map +0 -1
  593. package/dist/benchmark.js +0 -195
  594. package/dist/benchmark.js.map +0 -1
  595. package/dist/scaffold.d.ts +0 -14
  596. package/dist/scaffold.d.ts.map +0 -1
  597. package/dist/scaffold.js +0 -85
  598. package/dist/scaffold.js.map +0 -1
  599. package/templates/next-page/app/layout.tsx +0 -19
  600. package/templates/next-page/app/page.tsx +0 -10
  601. package/templates/next-page/package.json +0 -22
  602. package/templates/node-api/index.js +0 -57
  603. package/templates/node-api/package.json +0 -13
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Infrastructure: Cost Tracker
3
+ * Tracks API costs per operation and provides budget alerts
4
+ *
5
+ * IMPORTANT: This is a LOCAL ESTIMATE based on token counts and pricing.
6
+ * It does NOT sync with actual Cohere billing dashboard.
7
+ * Use `codehere cost reset` to reset for new billing period.
8
+ *
9
+ * Clean Architecture: Infrastructure Layer
10
+ * Strategic: Provides cost visibility and budget alerts (local estimate only)
11
+ */
12
+ export interface CostRecord {
13
+ id: string;
14
+ timestamp: number;
15
+ operation: string;
16
+ operationType: 'chat' | 'embed' | 'rerank' | 'other';
17
+ model?: string;
18
+ inputTokens?: number;
19
+ outputTokens?: number;
20
+ cost: number;
21
+ runId?: string;
22
+ metadata?: Record<string, any>;
23
+ }
24
+ export interface CostSummary {
25
+ totalCost: number;
26
+ operationCount: number;
27
+ byOperation: Record<string, {
28
+ count: number;
29
+ cost: number;
30
+ }>;
31
+ byModel: Record<string, {
32
+ count: number;
33
+ cost: number;
34
+ }>;
35
+ dailyCost: number;
36
+ monthlyCost: number;
37
+ }
38
+ export declare class CostTracker {
39
+ private db;
40
+ private dbPath;
41
+ private budgetLimit;
42
+ private alertThreshold;
43
+ constructor(budgetLimit?: number | null, alertThreshold?: number);
44
+ private getDb;
45
+ private saveDb;
46
+ /**
47
+ * Calculate cost for an operation
48
+ */
49
+ calculateCost(operationType: 'chat' | 'embed' | 'rerank' | 'other', model?: string, inputTokens?: number, outputTokens?: number): number;
50
+ /**
51
+ * Record a cost
52
+ */
53
+ recordCost(record: Omit<CostRecord, 'id' | 'timestamp'>): Promise<void>;
54
+ /**
55
+ * Get cost summary
56
+ */
57
+ getSummary(timeRange?: {
58
+ start: number;
59
+ end: number;
60
+ }): Promise<CostSummary>;
61
+ /**
62
+ * Get costs for a specific run
63
+ */
64
+ getRunCosts(runId: string): Promise<CostRecord[]>;
65
+ /**
66
+ * Check budget and alert if threshold exceeded
67
+ * NOTE: This does NOT block API calls - it only warns
68
+ */
69
+ private checkBudget;
70
+ /**
71
+ * Get current budget status
72
+ */
73
+ getBudgetStatus(): Promise<{
74
+ spent: number;
75
+ limit: number | null;
76
+ remaining: number | null;
77
+ percentage: number | null;
78
+ alert: boolean;
79
+ }>;
80
+ /**
81
+ * Get budget limit
82
+ */
83
+ getBudgetLimit(): number | null;
84
+ /**
85
+ * Reset costs (for testing or new billing period)
86
+ */
87
+ resetCosts(): Promise<void>;
88
+ }
89
+ export declare function getCostTracker(budgetLimit?: number | null): CostTracker;
90
+ //# sourceMappingURL=cost-tracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost-tracker.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cost/cost-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD,SAAS,EAAE,M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C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAQvE"}
@@ -0,0 +1,353 @@
1
+ /**
2
+ * Infrastructure: Cost Tracker
3
+ * Tracks API costs per operation and provides budget alerts
4
+ *
5
+ * IMPORTANT: This is a LOCAL ESTIMATE based on token counts and pricing.
6
+ * It does NOT sync with actual Cohere billing dashboard.
7
+ * Use `codehere cost reset` to reset for new billing period.
8
+ *
9
+ * Clean Architecture: Infrastructure Layer
10
+ * Strategic: Provides cost visibility and budget alerts (local estimate only)
11
+ */
12
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
13
+ import { join, dirname } from 'path';
14
+ import { fileURLToPath } from 'url';
15
+ import initSqlJs from 'sql.js';
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+ // Cohere pricing (as of 2024, update as needed)
19
+ // These are approximate - check Cohere pricing page for exact rates
20
+ const PRICING = {
21
+ 'command-r-plus': {
22
+ input: 0.000003, // $3 per 1M input tokens
23
+ output: 0.000015, // $15 per 1M output tokens
24
+ },
25
+ 'command-r': {
26
+ input: 0.0000005, // $0.5 per 1M input tokens
27
+ output: 0.0000015, // $1.5 per 1M output tokens
28
+ },
29
+ 'embed-english-v3.0': {
30
+ input: 0.0000001, // $0.1 per 1M tokens
31
+ output: 0,
32
+ },
33
+ 'rerank-english-v3': {
34
+ input: 0.000001, // $1 per 1M tokens
35
+ output: 0,
36
+ },
37
+ 'default': {
38
+ input: 0.000003, // Conservative default
39
+ output: 0.000015,
40
+ },
41
+ };
42
+ export class CostTracker {
43
+ db = null;
44
+ dbPath;
45
+ budgetLimit; // null = no budget limit
46
+ alertThreshold; // Alert at 80% of budget
47
+ constructor(budgetLimit, alertThreshold = 0.8) {
48
+ const agentDir = join(__dirname, '../../..');
49
+ const dataDir = join(agentDir, 'data');
50
+ if (!existsSync(dataDir)) {
51
+ mkdirSync(dataDir, { recursive: true });
52
+ }
53
+ this.dbPath = join(dataDir, 'costs.sqlite');
54
+ // Only set budget if explicitly provided via env var or parameter
55
+ // null = no budget tracking (default)
56
+ if (budgetLimit !== undefined) {
57
+ this.budgetLimit = (budgetLimit !== null && budgetLimit > 0) ? budgetLimit : null;
58
+ }
59
+ else {
60
+ const envBudget = process.env.COHERE_BUDGET_LIMIT;
61
+ this.budgetLimit = envBudget ? parseFloat(envBudget) : null;
62
+ if (this.budgetLimit !== null && this.budgetLimit <= 0) {
63
+ this.budgetLimit = null;
64
+ }
65
+ }
66
+ this.alertThreshold = alertThreshold;
67
+ }
68
+ async getDb() {
69
+ if (this.db)
70
+ return this.db;
71
+ const SQL = await initSqlJs();
72
+ const dbDir = dirname(this.dbPath);
73
+ if (!existsSync(dbDir)) {
74
+ mkdirSync(dbDir, { recursive: true });
75
+ }
76
+ if (existsSync(this.dbPath)) {
77
+ const buffer = readFileSync(this.dbPath);
78
+ this.db = new SQL.Database(buffer);
79
+ }
80
+ else {
81
+ this.db = new SQL.Database();
82
+ }
83
+ // Initialize schema
84
+ this.db.run(`
85
+ CREATE TABLE IF NOT EXISTS costs (
86
+ id TEXT PRIMARY KEY,
87
+ timestamp INTEGER NOT NULL,
88
+ operation TEXT NOT NULL,
89
+ operation_type TEXT NOT NULL,
90
+ model TEXT,
91
+ input_tokens INTEGER,
92
+ output_tokens INTEGER,
93
+ cost REAL NOT NULL,
94
+ run_id TEXT,
95
+ metadata TEXT
96
+ );
97
+ `);
98
+ // Create indices (sql.js doesn't support CREATE INDEX IF NOT EXISTS, so we'll handle errors)
99
+ try {
100
+ this.db.run('CREATE INDEX idx_timestamp ON costs(timestamp);');
101
+ }
102
+ catch { }
103
+ try {
104
+ this.db.run('CREATE INDEX idx_operation ON costs(operation);');
105
+ }
106
+ catch { }
107
+ try {
108
+ this.db.run('CREATE INDEX idx_run_id ON costs(run_id);');
109
+ }
110
+ catch { }
111
+ return this.db;
112
+ }
113
+ async saveDb() {
114
+ if (!this.db)
115
+ return;
116
+ const buffer = this.db.export();
117
+ writeFileSync(this.dbPath, buffer);
118
+ }
119
+ /**
120
+ * Calculate cost for an operation
121
+ */
122
+ calculateCost(operationType, model = 'default', inputTokens, outputTokens) {
123
+ const pricing = PRICING[model] || PRICING.default;
124
+ let cost = 0;
125
+ if (operationType === 'chat') {
126
+ const inputCost = (inputTokens || 0) * pricing.input;
127
+ const outputCost = (outputTokens || 0) * pricing.output;
128
+ cost = inputCost + outputCost;
129
+ }
130
+ else if (operationType === 'embed') {
131
+ cost = (inputTokens || 0) * pricing.input;
132
+ }
133
+ else if (operationType === 'rerank') {
134
+ cost = (inputTokens || 0) * pricing.input;
135
+ }
136
+ return cost;
137
+ }
138
+ /**
139
+ * Record a cost
140
+ */
141
+ async recordCost(record) {
142
+ const db = await this.getDb();
143
+ const id = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
144
+ const timestamp = Date.now();
145
+ db.run(`
146
+ INSERT INTO costs (id, timestamp, operation, operation_type, model, input_tokens, output_tokens, cost, run_id, metadata)
147
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
148
+ `, [
149
+ id,
150
+ timestamp,
151
+ record.operation,
152
+ record.operationType,
153
+ record.model || null,
154
+ record.inputTokens || null,
155
+ record.outputTokens || null,
156
+ record.cost,
157
+ record.runId || null,
158
+ record.metadata ? JSON.stringify(record.metadata) : null
159
+ ]);
160
+ await this.saveDb();
161
+ // Check budget and alert if needed
162
+ await this.checkBudget();
163
+ }
164
+ /**
165
+ * Get cost summary
166
+ */
167
+ async getSummary(timeRange) {
168
+ const db = await this.getDb();
169
+ let query = `
170
+ SELECT
171
+ operation,
172
+ operation_type,
173
+ model,
174
+ COUNT(*) as count,
175
+ SUM(cost) as total_cost
176
+ FROM costs
177
+ `;
178
+ const params = [];
179
+ if (timeRange) {
180
+ query += ' WHERE timestamp >= ? AND timestamp <= ?';
181
+ params.push(timeRange.start, timeRange.end);
182
+ }
183
+ query += ' GROUP BY operation, operation_type, model';
184
+ const stmt = db.prepare(query);
185
+ if (params.length > 0) {
186
+ stmt.bind(params);
187
+ }
188
+ const rows = [];
189
+ while (stmt.step()) {
190
+ const row = stmt.getAsObject();
191
+ rows.push({
192
+ operation: row.operation,
193
+ operation_type: row.operation_type,
194
+ model: row.model,
195
+ count: row.count,
196
+ total_cost: row.total_cost,
197
+ });
198
+ }
199
+ stmt.free();
200
+ const byOperation = {};
201
+ const byModel = {};
202
+ let totalCost = 0;
203
+ let operationCount = 0;
204
+ rows.forEach(row => {
205
+ totalCost += row.total_cost;
206
+ operationCount += row.count;
207
+ if (!byOperation[row.operation]) {
208
+ byOperation[row.operation] = { count: 0, cost: 0 };
209
+ }
210
+ byOperation[row.operation].count += row.count;
211
+ byOperation[row.operation].cost += row.total_cost;
212
+ const modelKey = row.model || 'default';
213
+ if (!byModel[modelKey]) {
214
+ byModel[modelKey] = { count: 0, cost: 0 };
215
+ }
216
+ byModel[modelKey].count += row.count;
217
+ byModel[modelKey].cost += row.total_cost;
218
+ });
219
+ // Calculate daily and monthly costs
220
+ const now = Date.now();
221
+ const oneDayAgo = now - (24 * 60 * 60 * 1000);
222
+ const oneMonthAgo = now - (30 * 24 * 60 * 60 * 1000);
223
+ const dailyStmt = db.prepare('SELECT SUM(cost) as total FROM costs WHERE timestamp >= ?');
224
+ dailyStmt.bind([oneDayAgo]);
225
+ dailyStmt.step();
226
+ const dailyRow = dailyStmt.getAsObject();
227
+ dailyStmt.free();
228
+ const monthlyStmt = db.prepare('SELECT SUM(cost) as total FROM costs WHERE timestamp >= ?');
229
+ monthlyStmt.bind([oneMonthAgo]);
230
+ monthlyStmt.step();
231
+ const monthlyRow = monthlyStmt.getAsObject();
232
+ monthlyStmt.free();
233
+ return {
234
+ totalCost,
235
+ operationCount,
236
+ byOperation,
237
+ byModel,
238
+ dailyCost: dailyRow.total || 0,
239
+ monthlyCost: monthlyRow.total || 0,
240
+ };
241
+ }
242
+ /**
243
+ * Get costs for a specific run
244
+ */
245
+ async getRunCosts(runId) {
246
+ const db = await this.getDb();
247
+ const stmt = db.prepare('SELECT * FROM costs WHERE run_id = ? ORDER BY timestamp');
248
+ stmt.bind([runId]);
249
+ const rows = [];
250
+ while (stmt.step()) {
251
+ const row = stmt.getAsObject();
252
+ rows.push({
253
+ id: row.id,
254
+ timestamp: row.timestamp,
255
+ operation: row.operation,
256
+ operation_type: row.operation_type,
257
+ model: row.model,
258
+ input_tokens: row.input_tokens,
259
+ output_tokens: row.output_tokens,
260
+ cost: row.cost,
261
+ run_id: row.run_id,
262
+ metadata: row.metadata,
263
+ });
264
+ }
265
+ stmt.free();
266
+ return rows.map(row => ({
267
+ id: row.id,
268
+ timestamp: row.timestamp,
269
+ operation: row.operation,
270
+ operationType: row.operation_type,
271
+ model: row.model || undefined,
272
+ inputTokens: row.input_tokens || undefined,
273
+ outputTokens: row.output_tokens || undefined,
274
+ cost: row.cost,
275
+ runId: row.run_id || undefined,
276
+ metadata: row.metadata ? JSON.parse(row.metadata) : undefined,
277
+ }));
278
+ }
279
+ /**
280
+ * Check budget and alert if threshold exceeded
281
+ * NOTE: This does NOT block API calls - it only warns
282
+ */
283
+ async checkBudget() {
284
+ // Only check budget if limit is set
285
+ if (this.budgetLimit === null || this.budgetLimit <= 0) {
286
+ return;
287
+ }
288
+ const summary = await this.getSummary();
289
+ const percentage = (summary.totalCost / this.budgetLimit) * 100;
290
+ const threshold = this.budgetLimit * this.alertThreshold;
291
+ if (summary.totalCost >= threshold && summary.totalCost < this.budgetLimit) {
292
+ console.warn(`⚠️ Budget Alert (LOCAL ESTIMATE ONLY): $${summary.totalCost.toFixed(4)} / $${this.budgetLimit} (${percentage.toFixed(1)}%)`);
293
+ console.warn(` This is a LOCAL ESTIMATE - check https://dashboard.cohere.com for actual usage`);
294
+ console.warn(` API calls will continue. Run 'codehere cost reset' to reset local tracking.`);
295
+ }
296
+ else if (summary.totalCost >= this.budgetLimit) {
297
+ console.warn(`⚠️ Budget Exceeded (LOCAL ESTIMATE ONLY): $${summary.totalCost.toFixed(4)} / $${this.budgetLimit}`);
298
+ console.warn(` This is a LOCAL ESTIMATE - check https://dashboard.cohere.com for actual usage`);
299
+ console.warn(` API calls will continue. Run 'codehere cost reset' to reset local tracking.`);
300
+ }
301
+ }
302
+ /**
303
+ * Get current budget status
304
+ */
305
+ async getBudgetStatus() {
306
+ const summary = await this.getSummary();
307
+ if (this.budgetLimit === null || this.budgetLimit <= 0) {
308
+ return {
309
+ spent: summary.totalCost,
310
+ limit: null,
311
+ remaining: null,
312
+ percentage: null,
313
+ alert: false,
314
+ };
315
+ }
316
+ const remaining = Math.max(0, this.budgetLimit - summary.totalCost);
317
+ const percentage = (summary.totalCost / this.budgetLimit) * 100;
318
+ const alert = summary.totalCost >= (this.budgetLimit * this.alertThreshold);
319
+ return {
320
+ spent: summary.totalCost,
321
+ limit: this.budgetLimit,
322
+ remaining,
323
+ percentage,
324
+ alert,
325
+ };
326
+ }
327
+ /**
328
+ * Get budget limit
329
+ */
330
+ getBudgetLimit() {
331
+ return this.budgetLimit;
332
+ }
333
+ /**
334
+ * Reset costs (for testing or new billing period)
335
+ */
336
+ async resetCosts() {
337
+ const db = await this.getDb();
338
+ db.run('DELETE FROM costs');
339
+ await this.saveDb();
340
+ }
341
+ }
342
+ // Singleton instance
343
+ let costTrackerInstance = null;
344
+ export function getCostTracker(budgetLimit) {
345
+ if (!costTrackerInstance) {
346
+ // Only set budget if explicitly provided via env var or parameter
347
+ // null = no budget tracking (default behavior)
348
+ const budget = budgetLimit ?? (process.env.COHERE_BUDGET_LIMIT ? parseFloat(process.env.COHERE_BUDGET_LIMIT) : null);
349
+ costTrackerInstance = new CostTracker(budget);
350
+ }
351
+ return costTrackerInstance;
352
+ }
353
+ //# sourceMappingURL=cost-tracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost-tracker.js","sourceRoot":"","sources":["../../../src/infrastructure/cost/cost-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,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C,GAAG,GAAG,CAAC;QAChE,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;QAE5E,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,SAAS;YACxB,KAAK,EAAE,IAAI,CAAC,WAAW;YACvB,SAAS;YACT,UAAU;YACV,KAAK;SACN,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC5B,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;IACtB,CAAC;CACF;AAED,qBAAqB;AACrB,IAAI,mBAAmB,GAAuB,IAAI,CAAC;AAEnD,MAAM,UAAU,cAAc,CAAC,WAA2B;IACxD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,kEAAkE;QAClE,+CAA+C;QAC/C,MAAM,MAAM,GAAG,WAAW,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrH,mBAAmB,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Infrastructure: File Scanner
3
+ * Scans repository for code files to index
4
+ */
5
+ import type { IFileScanner } from '../../application/use-cases/index-codebase-use-case.js';
6
+ export declare class FileScanner implements IFileScanner {
7
+ private readonly CODE_EXTENSIONS;
8
+ private readonly DOC_EXTENSIONS;
9
+ private readonly IGNORE_PATTERNS;
10
+ /**
11
+ * Scan repository for code files
12
+ */
13
+ scan(repoPath: string): Promise<string[]>;
14
+ /**
15
+ * Recursively scan directory
16
+ */
17
+ private scanDirectory;
18
+ /**
19
+ * Check if file should be ignored
20
+ */
21
+ private shouldIgnore;
22
+ /**
23
+ * Check if file is a code file
24
+ */
25
+ private isCodeFile;
26
+ /**
27
+ * Check if file is a documentation file
28
+ */
29
+ private isDocFile;
30
+ }
31
+ //# sourceMappingURL=file-scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-scanner.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/file-scanner/file-scanner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC;AAE3F,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAI7B;IAEH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE5B;IAEH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAgB9B;IAEF;;OAEG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAU/C;;OAEG;IACH,OAAO,CAAC,aAAa;IA+BrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;OAEG;IACH,OAAO,CAAC,SAAS;CAIlB"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Infrastructure: File Scanner
3
+ * Scans repository for code files to index
4
+ */
5
+ import { readdirSync, statSync, existsSync } from 'fs';
6
+ import { join, extname } from 'path';
7
+ export class FileScanner {
8
+ CODE_EXTENSIONS = new Set([
9
+ '.ts', '.tsx', '.js', '.jsx', '.py', '.java', '.go', '.rs',
10
+ '.cpp', '.c', '.h', '.hpp', '.cs', '.rb', '.php', '.swift',
11
+ '.kt', '.scala', '.clj', '.sh', '.bash', '.zsh',
12
+ ]);
13
+ DOC_EXTENSIONS = new Set([
14
+ '.md', '.txt', '.rst', '.adoc',
15
+ ]);
16
+ IGNORE_PATTERNS = [
17
+ /^node_modules$/,
18
+ /^\.git$/,
19
+ /^\.next$/,
20
+ /^\.nuxt$/,
21
+ /^dist$/,
22
+ /^build$/,
23
+ /^\.build$/,
24
+ /^coverage$/,
25
+ /^\.coverage$/,
26
+ /^\.venv$/,
27
+ /^venv$/,
28
+ /^\.env$/,
29
+ /^\.DS_Store$/,
30
+ /^\.vscode$/,
31
+ /^\.idea$/,
32
+ ];
33
+ /**
34
+ * Scan repository for code files
35
+ */
36
+ async scan(repoPath) {
37
+ if (!existsSync(repoPath)) {
38
+ throw new Error(`Repository path does not exist: ${repoPath}`);
39
+ }
40
+ const files = [];
41
+ this.scanDirectory(repoPath, repoPath, files);
42
+ return files;
43
+ }
44
+ /**
45
+ * Recursively scan directory
46
+ */
47
+ scanDirectory(dirPath, basePath, files) {
48
+ try {
49
+ const entries = readdirSync(dirPath);
50
+ for (const entry of entries) {
51
+ const fullPath = join(dirPath, entry);
52
+ const relativePath = fullPath.replace(basePath + '/', '').replace(basePath, '');
53
+ // Skip ignored patterns
54
+ if (this.shouldIgnore(entry, relativePath)) {
55
+ continue;
56
+ }
57
+ const stat = statSync(fullPath);
58
+ if (stat.isDirectory()) {
59
+ // Recursively scan subdirectories
60
+ this.scanDirectory(fullPath, basePath, files);
61
+ }
62
+ else if (stat.isFile()) {
63
+ // Check if file is code or documentation
64
+ if (this.isCodeFile(entry) || this.isDocFile(entry)) {
65
+ files.push(fullPath);
66
+ }
67
+ }
68
+ }
69
+ }
70
+ catch (error) {
71
+ // Skip directories we can't read (permissions, etc.)
72
+ console.warn(`Warning: Could not scan directory ${dirPath}:`, error instanceof Error ? error.message : String(error));
73
+ }
74
+ }
75
+ /**
76
+ * Check if file should be ignored
77
+ */
78
+ shouldIgnore(filename, relativePath) {
79
+ // Check ignore patterns
80
+ for (const pattern of this.IGNORE_PATTERNS) {
81
+ if (pattern.test(filename) || pattern.test(relativePath)) {
82
+ return true;
83
+ }
84
+ }
85
+ // Ignore hidden files (except .env.example, .gitignore, etc.)
86
+ if (filename.startsWith('.') && !['.env.example', '.gitignore', '.eslintrc', '.prettierrc'].includes(filename)) {
87
+ return true;
88
+ }
89
+ return false;
90
+ }
91
+ /**
92
+ * Check if file is a code file
93
+ */
94
+ isCodeFile(filename) {
95
+ const ext = extname(filename).toLowerCase();
96
+ return this.CODE_EXTENSIONS.has(ext);
97
+ }
98
+ /**
99
+ * Check if file is a documentation file
100
+ */
101
+ isDocFile(filename) {
102
+ const ext = extname(filename).toLowerCase();
103
+ return this.DOC_EXTENSIONS.has(ext);
104
+ }
105
+ }
106
+ //# sourceMappingURL=file-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-scanner.js","sourceRoot":"","sources":["../../../src/infrastructure/file-scanner/file-scanner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGrC,MAAM,OAAO,WAAW;IACL,eAAe,GAAG,IAAI,GAAG,CAAC;QACzC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK;QAC1D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ;QAC1D,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM;KAChD,CAAC,CAAC;IAEc,cAAc,GAAG,IAAI,GAAG,CAAC;QACxC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;KAC/B,CAAC,CAAC;IAEc,eAAe,GAAG;QACjC,gBAAgB;QAChB,SAAS;QACT,UAAU;QACV,UAAU;QACV,QAAQ;QACR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