codehere 0.2.0 → 0.4.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 (405) hide show
  1. package/README.md +223 -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 +4 -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 +132 -64
  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 +25 -2
  27. package/dist/application/services/dependency-container.d.ts.map +1 -1
  28. package/dist/application/services/dependency-container.js +163 -1
  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 +300 -87
  33. package/dist/application/services/intelligent-router.js.map +1 -1
  34. package/dist/application/use-cases/ask-question-use-case.d.ts +31 -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 +254 -55
  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 +86 -4
  40. package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
  41. package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
  42. package/dist/application/use-cases/planning-use-case.js +10 -1
  43. package/dist/application/use-cases/planning-use-case.js.map +1 -1
  44. package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -1
  45. package/dist/application/use-cases/react-orchestration-use-case.js +6 -2
  46. package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -1
  47. package/dist/domain/entities/documentation.d.ts +35 -0
  48. package/dist/domain/entities/documentation.d.ts.map +1 -0
  49. package/dist/domain/entities/documentation.js +6 -0
  50. package/dist/domain/entities/documentation.js.map +1 -0
  51. package/dist/domain/entities/product-requirements.d.ts +50 -0
  52. package/dist/domain/entities/product-requirements.d.ts.map +1 -0
  53. package/dist/domain/entities/product-requirements.js +6 -0
  54. package/dist/domain/entities/product-requirements.js.map +1 -0
  55. package/dist/domain/entities/task.d.ts +152 -0
  56. package/dist/domain/entities/task.d.ts.map +1 -0
  57. package/dist/domain/entities/task.js +61 -0
  58. package/dist/domain/entities/task.js.map +1 -0
  59. package/dist/domain/interfaces/agent.interface.d.ts +15 -0
  60. package/dist/domain/interfaces/agent.interface.d.ts.map +1 -0
  61. package/dist/domain/interfaces/agent.interface.js +6 -0
  62. package/dist/domain/interfaces/agent.interface.js.map +1 -0
  63. package/dist/domain/services/environment-mode-manager.d.ts +18 -0
  64. package/dist/domain/services/environment-mode-manager.d.ts.map +1 -0
  65. package/dist/domain/services/environment-mode-manager.js +37 -0
  66. package/dist/domain/services/environment-mode-manager.js.map +1 -0
  67. package/dist/domain/services/react-loop.d.ts +8 -0
  68. package/dist/domain/services/react-loop.d.ts.map +1 -1
  69. package/dist/domain/services/react-loop.js +82 -6
  70. package/dist/domain/services/react-loop.js.map +1 -1
  71. package/dist/domain/services/risk-tier-detector.d.ts +18 -0
  72. package/dist/domain/services/risk-tier-detector.d.ts.map +1 -0
  73. package/dist/domain/services/risk-tier-detector.js +65 -0
  74. package/dist/domain/services/risk-tier-detector.js.map +1 -0
  75. package/dist/formatter.d.ts +2 -2
  76. package/dist/formatter.d.ts.map +1 -1
  77. package/dist/formatter.js +40 -20
  78. package/dist/formatter.js.map +1 -1
  79. package/dist/index.js +218 -125
  80. package/dist/index.js.map +1 -1
  81. package/dist/infrastructure/ai/cohere-ai-service.d.ts +3 -1
  82. package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
  83. package/dist/infrastructure/ai/cohere-ai-service.js +65 -5
  84. package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
  85. package/dist/infrastructure/ai/fake-ai-service.d.ts +22 -0
  86. package/dist/infrastructure/ai/fake-ai-service.d.ts.map +1 -0
  87. package/dist/infrastructure/ai/fake-ai-service.js +59 -0
  88. package/dist/infrastructure/ai/fake-ai-service.js.map +1 -0
  89. package/dist/infrastructure/ai/provider-ai-service.d.ts +59 -0
  90. package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -0
  91. package/dist/infrastructure/ai/provider-ai-service.js +477 -0
  92. package/dist/infrastructure/ai/provider-ai-service.js.map +1 -0
  93. package/dist/infrastructure/cache/embedding-cache.d.ts +13 -1
  94. package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -1
  95. package/dist/infrastructure/cache/embedding-cache.js +80 -9
  96. package/dist/infrastructure/cache/embedding-cache.js.map +1 -1
  97. package/dist/infrastructure/cache/query-result-cache.d.ts +68 -0
  98. package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -0
  99. package/dist/infrastructure/cache/query-result-cache.js +138 -0
  100. package/dist/infrastructure/cache/query-result-cache.js.map +1 -0
  101. package/dist/infrastructure/cache/response-cache.d.ts +86 -0
  102. package/dist/infrastructure/cache/response-cache.d.ts.map +1 -0
  103. package/dist/infrastructure/cache/response-cache.js +224 -0
  104. package/dist/infrastructure/cache/response-cache.js.map +1 -0
  105. package/dist/infrastructure/cache/security-scan-cache.d.ts +57 -0
  106. package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -0
  107. package/dist/infrastructure/cache/security-scan-cache.js +124 -0
  108. package/dist/infrastructure/cache/security-scan-cache.js.map +1 -0
  109. package/dist/infrastructure/completion/bash-completion.d.ts +8 -0
  110. package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -0
  111. package/dist/infrastructure/completion/bash-completion.js +101 -0
  112. package/dist/infrastructure/completion/bash-completion.js.map +1 -0
  113. package/dist/infrastructure/completion/completion-generator.d.ts +42 -0
  114. package/dist/infrastructure/completion/completion-generator.d.ts.map +1 -0
  115. package/dist/infrastructure/completion/completion-generator.js +184 -0
  116. package/dist/infrastructure/completion/completion-generator.js.map +1 -0
  117. package/dist/infrastructure/completion/fish-completion.d.ts +8 -0
  118. package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -0
  119. package/dist/infrastructure/completion/fish-completion.js +65 -0
  120. package/dist/infrastructure/completion/fish-completion.js.map +1 -0
  121. package/dist/infrastructure/completion/zsh-completion.d.ts +8 -0
  122. package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -0
  123. package/dist/infrastructure/completion/zsh-completion.js +85 -0
  124. package/dist/infrastructure/completion/zsh-completion.js.map +1 -0
  125. package/dist/infrastructure/context/context-compressor.d.ts +94 -0
  126. package/dist/infrastructure/context/context-compressor.d.ts.map +1 -0
  127. package/dist/infrastructure/context/context-compressor.js +329 -0
  128. package/dist/infrastructure/context/context-compressor.js.map +1 -0
  129. package/dist/infrastructure/context/conversation-context.d.ts +58 -0
  130. package/dist/infrastructure/context/conversation-context.d.ts.map +1 -0
  131. package/dist/infrastructure/context/conversation-context.js +170 -0
  132. package/dist/infrastructure/context/conversation-context.js.map +1 -0
  133. package/dist/infrastructure/context/session-manager.d.ts +26 -0
  134. package/dist/infrastructure/context/session-manager.d.ts.map +1 -0
  135. package/dist/infrastructure/context/session-manager.js +98 -0
  136. package/dist/infrastructure/context/session-manager.js.map +1 -0
  137. package/dist/infrastructure/cost/cost-tracker.d.ts +1 -0
  138. package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
  139. package/dist/infrastructure/cost/cost-tracker.js +12 -5
  140. package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
  141. package/dist/infrastructure/governance/nist-ai-rmf.d.ts +6 -8
  142. package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -1
  143. package/dist/infrastructure/governance/nist-ai-rmf.js +6 -8
  144. package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -1
  145. package/dist/infrastructure/governance/policy-as-code.d.ts +6 -8
  146. package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
  147. package/dist/infrastructure/governance/policy-as-code.js +24 -11
  148. package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
  149. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +7 -9
  150. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -1
  151. package/dist/infrastructure/governance/prompt-to-code-lineage.js +7 -9
  152. package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -1
  153. package/dist/infrastructure/observability/execution-tracer.d.ts +5 -2
  154. package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -1
  155. package/dist/infrastructure/observability/execution-tracer.js +45 -8
  156. package/dist/infrastructure/observability/execution-tracer.js.map +1 -1
  157. package/dist/infrastructure/providers/cohere-provider.d.ts +39 -0
  158. package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -0
  159. package/dist/infrastructure/providers/cohere-provider.js +359 -0
  160. package/dist/infrastructure/providers/cohere-provider.js.map +1 -0
  161. package/dist/infrastructure/providers/fake-provider.d.ts +43 -0
  162. package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -0
  163. package/dist/infrastructure/providers/fake-provider.js +130 -0
  164. package/dist/infrastructure/providers/fake-provider.js.map +1 -0
  165. package/dist/infrastructure/providers/local-llm-provider.d.ts +49 -0
  166. package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -0
  167. package/dist/infrastructure/providers/local-llm-provider.js +330 -0
  168. package/dist/infrastructure/providers/local-llm-provider.js.map +1 -0
  169. package/dist/infrastructure/providers/model-config.types.d.ts +70 -0
  170. package/dist/infrastructure/providers/model-config.types.d.ts.map +1 -0
  171. package/dist/infrastructure/providers/model-config.types.js +9 -0
  172. package/dist/infrastructure/providers/model-config.types.js.map +1 -0
  173. package/dist/infrastructure/providers/model-provider.interface.d.ts +113 -0
  174. package/dist/infrastructure/providers/model-provider.interface.d.ts.map +1 -0
  175. package/dist/infrastructure/providers/model-provider.interface.js +8 -0
  176. package/dist/infrastructure/providers/model-provider.interface.js.map +1 -0
  177. package/dist/infrastructure/providers/openai-provider.d.ts +38 -0
  178. package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -0
  179. package/dist/infrastructure/providers/openai-provider.js +413 -0
  180. package/dist/infrastructure/providers/openai-provider.js.map +1 -0
  181. package/dist/infrastructure/providers/operation-provider-resolver.d.ts +48 -0
  182. package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -0
  183. package/dist/infrastructure/providers/operation-provider-resolver.js +105 -0
  184. package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -0
  185. package/dist/infrastructure/providers/provider-config-loader.d.ts +37 -0
  186. package/dist/infrastructure/providers/provider-config-loader.d.ts.map +1 -0
  187. package/dist/infrastructure/providers/provider-config-loader.js +120 -0
  188. package/dist/infrastructure/providers/provider-config-loader.js.map +1 -0
  189. package/dist/infrastructure/providers/provider-registry.d.ts +53 -0
  190. package/dist/infrastructure/providers/provider-registry.d.ts.map +1 -0
  191. package/dist/infrastructure/providers/provider-registry.js +88 -0
  192. package/dist/infrastructure/providers/provider-registry.js.map +1 -0
  193. package/dist/infrastructure/security/ai-sast-scanner.d.ts +4 -0
  194. package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -1
  195. package/dist/infrastructure/security/ai-sast-scanner.js +82 -4
  196. package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -1
  197. package/dist/infrastructure/security/enhanced-security-gate.d.ts +2 -0
  198. package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -1
  199. package/dist/infrastructure/security/enhanced-security-gate.js +74 -15
  200. package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -1
  201. package/dist/infrastructure/storage/plan-repository.d.ts +38 -0
  202. package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -0
  203. package/dist/infrastructure/storage/plan-repository.js +133 -0
  204. package/dist/infrastructure/storage/plan-repository.js.map +1 -0
  205. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +11 -0
  206. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
  207. package/dist/infrastructure/storage/sqlite-embedding-repository.js +121 -6
  208. package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
  209. package/dist/infrastructure/storage/task-helpers.d.ts +58 -0
  210. package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -0
  211. package/dist/infrastructure/storage/task-helpers.js +157 -0
  212. package/dist/infrastructure/storage/task-helpers.js.map +1 -0
  213. package/dist/infrastructure/storage/task-repository.d.ts +67 -0
  214. package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
  215. package/dist/infrastructure/storage/task-repository.js +205 -0
  216. package/dist/infrastructure/storage/task-repository.js.map +1 -0
  217. package/dist/infrastructure/ux/bi-directional-learning.d.ts +22 -0
  218. package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -1
  219. package/dist/infrastructure/ux/bi-directional-learning.js +144 -7
  220. package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -1
  221. package/dist/infrastructure/ux/capability-boundaries.d.ts +50 -0
  222. package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -0
  223. package/dist/infrastructure/ux/capability-boundaries.js +167 -0
  224. package/dist/infrastructure/ux/capability-boundaries.js.map +1 -0
  225. package/dist/infrastructure/ux/comprehensive-formatter.d.ts +63 -0
  226. package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -0
  227. package/dist/infrastructure/ux/comprehensive-formatter.js +212 -0
  228. package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -0
  229. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +24 -0
  230. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -0
  231. package/dist/infrastructure/ux/contextual-feature-discovery.js +144 -0
  232. package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -0
  233. package/dist/infrastructure/ux/expectation-management.d.ts +33 -0
  234. package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -1
  235. package/dist/infrastructure/ux/expectation-management.js +138 -4
  236. package/dist/infrastructure/ux/expectation-management.js.map +1 -1
  237. package/dist/infrastructure/ux/feature-discovery.d.ts +47 -0
  238. package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -0
  239. package/dist/infrastructure/ux/feature-discovery.js +190 -0
  240. package/dist/infrastructure/ux/feature-discovery.js.map +1 -0
  241. package/dist/infrastructure/ux/feedback-prompt.d.ts +42 -0
  242. package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -0
  243. package/dist/infrastructure/ux/feedback-prompt.js +181 -0
  244. package/dist/infrastructure/ux/feedback-prompt.js.map +1 -0
  245. package/dist/infrastructure/ux/hitl-review-portal.d.ts +47 -0
  246. package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -0
  247. package/dist/infrastructure/ux/hitl-review-portal.js +228 -0
  248. package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -0
  249. package/dist/infrastructure/ux/hitl-validation.d.ts +35 -0
  250. package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -1
  251. package/dist/infrastructure/ux/hitl-validation.js +86 -0
  252. package/dist/infrastructure/ux/hitl-validation.js.map +1 -1
  253. package/dist/infrastructure/ux/progress-indicator.d.ts +55 -0
  254. package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -0
  255. package/dist/infrastructure/ux/progress-indicator.js +131 -0
  256. package/dist/infrastructure/ux/progress-indicator.js.map +1 -0
  257. package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -1
  258. package/dist/infrastructure/ux/progressive-disclosure.js +2 -1
  259. package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -1
  260. package/dist/infrastructure/ux/proportional-friction.d.ts +73 -0
  261. package/dist/infrastructure/ux/proportional-friction.d.ts.map +1 -0
  262. package/dist/infrastructure/ux/proportional-friction.js +200 -0
  263. package/dist/infrastructure/ux/proportional-friction.js.map +1 -0
  264. package/dist/infrastructure/ux/review-checkpoint.d.ts +35 -0
  265. package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -0
  266. package/dist/infrastructure/ux/review-checkpoint.js +119 -0
  267. package/dist/infrastructure/ux/review-checkpoint.js.map +1 -0
  268. package/dist/infrastructure/ux/staged-feature-intro.d.ts +47 -0
  269. package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -0
  270. package/dist/infrastructure/ux/staged-feature-intro.js +144 -0
  271. package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -0
  272. package/dist/infrastructure/ux/syntax-highlighter.d.ts +21 -0
  273. package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -0
  274. package/dist/infrastructure/ux/syntax-highlighter.js +172 -0
  275. package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -0
  276. package/dist/infrastructure/validation/agent-feedback.d.ts +115 -0
  277. package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -0
  278. package/dist/infrastructure/validation/agent-feedback.js +227 -0
  279. package/dist/infrastructure/validation/agent-feedback.js.map +1 -0
  280. package/dist/infrastructure/validation/agent-validation-helper.d.ts +75 -0
  281. package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -0
  282. package/dist/infrastructure/validation/agent-validation-helper.js +88 -0
  283. package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -0
  284. package/dist/infrastructure/validation/feedback-stats.d.ts +99 -0
  285. package/dist/infrastructure/validation/feedback-stats.d.ts.map +1 -0
  286. package/dist/infrastructure/validation/feedback-stats.js +173 -0
  287. package/dist/infrastructure/validation/feedback-stats.js.map +1 -0
  288. package/dist/infrastructure/validation/review-handler.d.ts +54 -0
  289. package/dist/infrastructure/validation/review-handler.d.ts.map +1 -0
  290. package/dist/infrastructure/validation/review-handler.js +206 -0
  291. package/dist/infrastructure/validation/review-handler.js.map +1 -0
  292. package/dist/infrastructure/validation/summary-aggregator.d.ts +42 -0
  293. package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -0
  294. package/dist/infrastructure/validation/summary-aggregator.js +156 -0
  295. package/dist/infrastructure/validation/summary-aggregator.js.map +1 -0
  296. package/dist/infrastructure/validation/summary-extractor.d.ts +59 -0
  297. package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -0
  298. package/dist/infrastructure/validation/summary-extractor.js +102 -0
  299. package/dist/infrastructure/validation/summary-extractor.js.map +1 -0
  300. package/dist/infrastructure/validation/trace-summary.d.ts +72 -0
  301. package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -0
  302. package/dist/infrastructure/validation/trace-summary.js +371 -0
  303. package/dist/infrastructure/validation/trace-summary.js.map +1 -0
  304. package/dist/infrastructure/validation/trust-config.d.ts +27 -0
  305. package/dist/infrastructure/validation/trust-config.d.ts.map +1 -0
  306. package/dist/infrastructure/validation/trust-config.js +113 -0
  307. package/dist/infrastructure/validation/trust-config.js.map +1 -0
  308. package/dist/infrastructure/xai/attention-visualizer.d.ts +6 -8
  309. package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -1
  310. package/dist/infrastructure/xai/attention-visualizer.js +6 -8
  311. package/dist/infrastructure/xai/attention-visualizer.js.map +1 -1
  312. package/dist/infrastructure/xai/cot-visualizer.d.ts +6 -8
  313. package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
  314. package/dist/infrastructure/xai/cot-visualizer.js +62 -18
  315. package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
  316. package/dist/infrastructure/xai/decision-tree-log.d.ts +6 -10
  317. package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -1
  318. package/dist/infrastructure/xai/decision-tree-log.js +6 -10
  319. package/dist/infrastructure/xai/decision-tree-log.js.map +1 -1
  320. package/dist/infrastructure/xai/interactive-xai.d.ts +6 -8
  321. package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -1
  322. package/dist/infrastructure/xai/interactive-xai.js +6 -8
  323. package/dist/infrastructure/xai/interactive-xai.js.map +1 -1
  324. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +6 -9
  325. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -1
  326. package/dist/infrastructure/xai/uncertainty-quantifier.js +6 -9
  327. package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -1
  328. package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
  329. package/dist/presentation/cli/commands/ask-command.js +152 -13
  330. package/dist/presentation/cli/commands/ask-command.js.map +1 -1
  331. package/dist/presentation/cli/commands/docs-command.d.ts +12 -0
  332. package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -0
  333. package/dist/presentation/cli/commands/docs-command.js +196 -0
  334. package/dist/presentation/cli/commands/docs-command.js.map +1 -0
  335. package/dist/presentation/cli/commands/fix-command.d.ts +8 -0
  336. package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -0
  337. package/dist/presentation/cli/commands/fix-command.js +309 -0
  338. package/dist/presentation/cli/commands/fix-command.js.map +1 -0
  339. package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
  340. package/dist/presentation/cli/commands/help-command.js +2 -0
  341. package/dist/presentation/cli/commands/help-command.js.map +1 -1
  342. package/dist/presentation/cli/commands/orchestrate-command.d.ts +2 -0
  343. package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
  344. package/dist/presentation/cli/commands/orchestrate-command.js +88 -1
  345. package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
  346. package/dist/presentation/cli/commands/plan-command.d.ts +1 -0
  347. package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
  348. package/dist/presentation/cli/commands/plan-command.js +136 -7
  349. package/dist/presentation/cli/commands/plan-command.js.map +1 -1
  350. package/dist/presentation/cli/commands/product-command.d.ts +12 -0
  351. package/dist/presentation/cli/commands/product-command.d.ts.map +1 -0
  352. package/dist/presentation/cli/commands/product-command.js +188 -0
  353. package/dist/presentation/cli/commands/product-command.js.map +1 -0
  354. package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
  355. package/dist/presentation/cli/commands/react-command.js +98 -16
  356. package/dist/presentation/cli/commands/react-command.js.map +1 -1
  357. package/dist/presentation/cli/commands/review-command.d.ts +14 -0
  358. package/dist/presentation/cli/commands/review-command.d.ts.map +1 -0
  359. package/dist/presentation/cli/commands/review-command.js +22 -0
  360. package/dist/presentation/cli/commands/review-command.js.map +1 -0
  361. package/dist/presentation/cli/commands/run-command.d.ts +15 -0
  362. package/dist/presentation/cli/commands/run-command.d.ts.map +1 -0
  363. package/dist/presentation/cli/commands/run-command.js +29 -0
  364. package/dist/presentation/cli/commands/run-command.js.map +1 -0
  365. package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
  366. package/dist/presentation/cli/commands/setup-command.js +67 -12
  367. package/dist/presentation/cli/commands/setup-command.js.map +1 -1
  368. package/dist/presentation/cli/commands/smart-command.d.ts +3 -1
  369. package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
  370. package/dist/presentation/cli/commands/smart-command.js +227 -23
  371. package/dist/presentation/cli/commands/smart-command.js.map +1 -1
  372. package/dist/presentation/cli/commands/status-command.d.ts +11 -0
  373. package/dist/presentation/cli/commands/status-command.d.ts.map +1 -0
  374. package/dist/presentation/cli/commands/status-command.js +176 -0
  375. package/dist/presentation/cli/commands/status-command.js.map +1 -0
  376. package/dist/presentation/cli/commands/suggest-command.d.ts +13 -0
  377. package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -0
  378. package/dist/presentation/cli/commands/suggest-command.js +25 -0
  379. package/dist/presentation/cli/commands/suggest-command.js.map +1 -0
  380. package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -1
  381. package/dist/presentation/cli/commands/trace-command.js +9 -5
  382. package/dist/presentation/cli/commands/trace-command.js.map +1 -1
  383. package/dist/presentation/cli/commands/undo-command.js +15 -6
  384. package/dist/presentation/cli/commands/undo-command.js.map +1 -1
  385. package/dist/presentation/cli/error-display.d.ts +2 -0
  386. package/dist/presentation/cli/error-display.d.ts.map +1 -1
  387. package/dist/presentation/cli/error-display.js +220 -2
  388. package/dist/presentation/cli/error-display.js.map +1 -1
  389. package/dist/presentation/cli/keyboard-shortcuts.d.ts +27 -0
  390. package/dist/presentation/cli/keyboard-shortcuts.d.ts.map +1 -0
  391. package/dist/presentation/cli/keyboard-shortcuts.js +77 -0
  392. package/dist/presentation/cli/keyboard-shortcuts.js.map +1 -0
  393. package/dist/session.d.ts.map +1 -1
  394. package/dist/session.js +39 -2
  395. package/dist/session.js.map +1 -1
  396. package/dist/ui.d.ts.map +1 -1
  397. package/dist/ui.js +8 -5
  398. package/dist/ui.js.map +1 -1
  399. package/dist/utils/version.js +2 -2
  400. package/dist/verification/backup.d.ts.map +1 -1
  401. package/dist/verification/backup.js +24 -3
  402. package/dist/verification/backup.js.map +1 -1
  403. package/dist/verification/compiler.js +47 -12
  404. package/dist/verification/compiler.js.map +1 -1
  405. package/package.json +10 -2
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Syntax Highlighter for Terminal
3
+ * Provides basic syntax highlighting for code snippets using chalk
4
+ *
5
+ * Lightweight implementation - no heavy dependencies
6
+ * Supports: TypeScript, JavaScript, Python, JSON, YAML, Markdown, Shell
7
+ */
8
+ import { colors } from '../../ui.js';
9
+ /**
10
+ * Detect language from file extension
11
+ */
12
+ export function detectLanguage(filepath) {
13
+ const ext = filepath.split('.').pop()?.toLowerCase() || '';
14
+ const languageMap = {
15
+ 'ts': 'typescript',
16
+ 'tsx': 'typescript',
17
+ 'js': 'javascript',
18
+ 'jsx': 'javascript',
19
+ 'mjs': 'javascript',
20
+ 'cjs': 'javascript',
21
+ 'py': 'python',
22
+ 'json': 'json',
23
+ 'yaml': 'yaml',
24
+ 'yml': 'yaml',
25
+ 'md': 'markdown',
26
+ 'sh': 'shell',
27
+ 'bash': 'bash',
28
+ };
29
+ return languageMap[ext] || 'text';
30
+ }
31
+ /**
32
+ * Highlight TypeScript/JavaScript code
33
+ */
34
+ function highlightTypeScript(code) {
35
+ const lines = code.split('\n');
36
+ return lines.map(line => {
37
+ let highlighted = line;
38
+ // Keywords (const, let, var, function, class, interface, type, etc.)
39
+ highlighted = highlighted.replace(/\b(const|let|var|function|class|interface|type|enum|namespace|import|export|from|as|default|extends|implements|public|private|protected|static|readonly|async|await|return|if|else|for|while|switch|case|break|continue|try|catch|finally|throw|new|this|super|typeof|instanceof|in|of)\b/g, (match) => colors.magenta(match));
40
+ // Strings (single, double, template literals)
41
+ highlighted = highlighted.replace(/(['"`])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
42
+ // Numbers
43
+ highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
44
+ // Comments
45
+ highlighted = highlighted.replace(/(\/\/.*$|\/\*[\s\S]*?\*\/)/gm, (match) => colors.dim(match));
46
+ // Function/class names (before opening paren)
47
+ highlighted = highlighted.replace(/\b([A-Z][a-zA-Z0-9]*)\s*(?=\()/g, (match) => colors.cyan(match.trim()));
48
+ return highlighted;
49
+ }).join('\n');
50
+ }
51
+ /**
52
+ * Highlight Python code
53
+ */
54
+ function highlightPython(code) {
55
+ const lines = code.split('\n');
56
+ return lines.map(line => {
57
+ let highlighted = line;
58
+ // Keywords
59
+ highlighted = highlighted.replace(/\b(def|class|if|elif|else|for|while|try|except|finally|with|import|from|as|return|yield|lambda|pass|break|continue|raise|assert|and|or|not|in|is|None|True|False)\b/g, (match) => colors.magenta(match));
60
+ // Strings
61
+ highlighted = highlighted.replace(/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
62
+ // Numbers
63
+ highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
64
+ // Comments
65
+ highlighted = highlighted.replace(/(#.*$)/gm, (match) => colors.dim(match));
66
+ // Function/class names
67
+ highlighted = highlighted.replace(/\b(def|class)\s+([a-zA-Z_][a-zA-Z0-9_]*)/g, (match, keyword, name) => colors.magenta(keyword) + ' ' + colors.cyan(name));
68
+ return highlighted;
69
+ }).join('\n');
70
+ }
71
+ /**
72
+ * Highlight JSON code
73
+ */
74
+ function highlightJSON(code) {
75
+ const lines = code.split('\n');
76
+ return lines.map(line => {
77
+ let highlighted = line;
78
+ // Keys (before colon)
79
+ highlighted = highlighted.replace(/"([^"]+)":/g, (match, key) => colors.green(`"${key}"`) + colors.dim(':'));
80
+ // Strings
81
+ highlighted = highlighted.replace(/"([^"]+)"/g, (match, value) => {
82
+ // Don't highlight keys again
83
+ if (match.includes(':'))
84
+ return match;
85
+ return colors.green(match);
86
+ });
87
+ // Numbers
88
+ highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
89
+ // Booleans/null
90
+ highlighted = highlighted.replace(/\b(true|false|null)\b/g, (match) => colors.magenta(match));
91
+ return highlighted;
92
+ }).join('\n');
93
+ }
94
+ /**
95
+ * Highlight Shell/Bash code
96
+ */
97
+ function highlightShell(code) {
98
+ const lines = code.split('\n');
99
+ return lines.map(line => {
100
+ let highlighted = line;
101
+ // Commands (first word)
102
+ highlighted = highlighted.replace(/^(\s*)([a-zA-Z_][a-zA-Z0-9_-]*)\s/, (match, indent, cmd) => indent + colors.cyan(cmd) + ' ');
103
+ // Variables
104
+ highlighted = highlighted.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g, (match) => colors.yellow(match));
105
+ // Strings
106
+ highlighted = highlighted.replace(/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
107
+ // Comments
108
+ highlighted = highlighted.replace(/(#.*$)/gm, (match) => colors.dim(match));
109
+ return highlighted;
110
+ }).join('\n');
111
+ }
112
+ /**
113
+ * Highlight code based on language
114
+ */
115
+ export function highlightCode(code, language) {
116
+ if (!code)
117
+ return '';
118
+ const lang = (language || 'text');
119
+ // Check if terminal supports colors
120
+ if (!process.stdout.isTTY || process.env.NO_COLOR) {
121
+ return code; // Return unhighlighted if colors disabled
122
+ }
123
+ switch (lang) {
124
+ case 'typescript':
125
+ case 'javascript':
126
+ return highlightTypeScript(code);
127
+ case 'python':
128
+ return highlightPython(code);
129
+ case 'json':
130
+ return highlightJSON(code);
131
+ case 'shell':
132
+ case 'bash':
133
+ return highlightShell(code);
134
+ case 'yaml':
135
+ case 'markdown':
136
+ case 'text':
137
+ default:
138
+ // Basic highlighting for other languages
139
+ return code.split('\n').map(line => {
140
+ // Highlight comments
141
+ let highlighted = line.replace(/(#.*$)/gm, (match) => colors.dim(match));
142
+ // Highlight strings
143
+ highlighted = highlighted.replace(/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
144
+ return highlighted;
145
+ }).join('\n');
146
+ }
147
+ }
148
+ /**
149
+ * Format code block with syntax highlighting
150
+ */
151
+ export function formatCodeBlockWithHighlight(code, language, filepath) {
152
+ const detectedLang = filepath ? detectLanguage(filepath) : (language || 'text');
153
+ const highlighted = highlightCode(code, detectedLang);
154
+ const lines = highlighted.split('\n');
155
+ const maxWidth = process.stdout.columns || 80;
156
+ const indent = ' ';
157
+ let output = colors.dim('┌─ Code');
158
+ if (detectedLang !== 'text') {
159
+ output += colors.dim(` (${detectedLang})`);
160
+ }
161
+ output += colors.dim(' ─'.repeat(Math.max(0, Math.floor((maxWidth - 20) / 2))) + '┐\n');
162
+ for (const line of lines) {
163
+ // Truncate very long lines
164
+ const displayLine = line.length > maxWidth - 10
165
+ ? line.substring(0, maxWidth - 13) + '...'
166
+ : line;
167
+ output += indent + displayLine + '\n';
168
+ }
169
+ output += colors.dim('└' + '─'.repeat(Math.max(0, maxWidth - 4)) + '┘');
170
+ return output;
171
+ }
172
+ //# sourceMappingURL=syntax-highlighter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syntax-highlighter.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/syntax-highlighter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAarC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAE3D,MAAM,WAAW,GAAsC;QACrD,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,MAAM;KACf,CAAC;IAEF,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,IAAY;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,KAAK,CAA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,IAAI,KAAK,EAAE,CAAC;QACzB,2BAA2B;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,QAAQ,GAAG,EAAE;YAC7C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,KAAK;YAC1C,CAAC,CAAC,IAAI,CAAC;QACT,MAAM,IAAI,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;IACxC,CAAC;IAED,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAExE,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Infrastructure: Agent Feedback Module
3
+ * Unified evaluation & feedback capture layer for Validation Mode
4
+ *
5
+ * Features:
6
+ * - Record success/failure, user approval, user modifications, errors
7
+ * - Store anonymously in local memory for pattern improvements
8
+ * - JSON-based, appended per operation
9
+ * - Privacy-first design with opt-out support
10
+ */
11
+ export type FeedbackOutcome = 'success' | 'failure' | 'partial_success' | 'cancelled' | 'error';
12
+ export type UserAction = 'approved' | 'rejected' | 'modified' | 'skipped' | 'not_required';
13
+ export interface AgentFeedback {
14
+ feedbackId: string;
15
+ runId: string;
16
+ agentName: string;
17
+ timestamp: number;
18
+ operation: string;
19
+ query?: string;
20
+ outcome: FeedbackOutcome;
21
+ userAction: UserAction;
22
+ filesChanged?: string[];
23
+ filesCreated?: string[];
24
+ filesDeleted?: string[];
25
+ userModifications?: Array<{
26
+ filepath: string;
27
+ modificationType: 'edited' | 'reverted' | 'accepted' | 'rejected';
28
+ description?: string;
29
+ }>;
30
+ errors?: string[];
31
+ warnings?: string[];
32
+ validationChecks?: Array<{
33
+ check: string;
34
+ passed: boolean;
35
+ message?: string;
36
+ }>;
37
+ metrics?: {
38
+ tokensUsed?: number;
39
+ duration?: number;
40
+ filesAnalyzed?: number;
41
+ changesProposed?: number;
42
+ changesApplied?: number;
43
+ };
44
+ context?: {
45
+ codebaseType?: string;
46
+ fileCount?: number;
47
+ operationType?: string;
48
+ };
49
+ userFeedback?: {
50
+ rating?: number;
51
+ comment?: string;
52
+ };
53
+ }
54
+ export interface AgentFeedbackConfig {
55
+ enabled: boolean;
56
+ storagePath?: string;
57
+ anonymize: boolean;
58
+ optOut: boolean;
59
+ }
60
+ /**
61
+ * Agent Feedback Manager
62
+ * Lightweight, privacy-first feedback capture
63
+ */
64
+ export declare class AgentFeedbackManager {
65
+ private config;
66
+ private feedbackDir;
67
+ private feedbackHistory;
68
+ constructor(config?: Partial<AgentFeedbackConfig>);
69
+ /**
70
+ * Record feedback for an agent operation
71
+ * userAction is required - must be provided by caller
72
+ */
73
+ recordFeedback(feedback: Omit<AgentFeedback, 'feedbackId' | 'timestamp'> & {
74
+ userAction: UserAction;
75
+ }): string;
76
+ /**
77
+ * Get feedback for a run
78
+ */
79
+ getFeedbackForRun(runId: string): AgentFeedback | null;
80
+ /**
81
+ * Get recent feedback patterns (for learning)
82
+ */
83
+ getRecentFeedback(limit?: number): AgentFeedback[];
84
+ /**
85
+ * Get feedback statistics
86
+ */
87
+ getFeedbackStats(): {
88
+ total: number;
89
+ byOutcome: Record<FeedbackOutcome, number>;
90
+ byAgent: Record<string, number>;
91
+ averageRating?: number;
92
+ };
93
+ /**
94
+ * Anonymize feedback (remove sensitive data)
95
+ */
96
+ private anonymizeFeedback;
97
+ /**
98
+ * Anonymize file path (keep structure, not actual names)
99
+ */
100
+ private anonymizePath;
101
+ /**
102
+ * Load recent feedback from disk
103
+ */
104
+ private loadRecentFeedback;
105
+ /**
106
+ * Clear all feedback (privacy control)
107
+ */
108
+ clearFeedback(): void;
109
+ /**
110
+ * Check if feedback collection is enabled
111
+ */
112
+ isEnabled(): boolean;
113
+ }
114
+ export declare const agentFeedbackManager: AgentFeedbackManager;
115
+ //# sourceMappingURL=agent-feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-feedback.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,WAAW,GAAG,OAAO,CAAC;AAChG,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;AAE3F,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IAGvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAGxB,iBAAiB,CAAC,EAAE,KAAK,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;QAClE,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IAGH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpB,gBAAgB,CAAC,EAAE,KAAK,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IAGH,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,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C;QAChC,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;IAgCD;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAkCzB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA2B1B;;OAEG;IACH,aAAa,IAAI,IAAI;IAYrB;;OAEG;IACH,SAAS,IAAI,OAAO;CAGrB;AAGD,eAAO,MAAM,oBAAoB,sBAA6B,CAAC"}
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Infrastructure: Agent Feedback Module
3
+ * Unified evaluation & feedback capture layer for Validation Mode
4
+ *
5
+ * Features:
6
+ * - Record success/failure, user approval, user modifications, errors
7
+ * - Store anonymously in local memory for pattern improvements
8
+ * - JSON-based, appended per operation
9
+ * - Privacy-first design with opt-out support
10
+ */
11
+ import { writeFileSync, readFileSync, existsSync, mkdirSync, appendFileSync } from 'fs';
12
+ import { join, dirname } from 'path';
13
+ import { fileURLToPath } from 'url';
14
+ import { randomUUID } from 'crypto';
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = dirname(__filename);
17
+ /**
18
+ * Agent Feedback Manager
19
+ * Lightweight, privacy-first feedback capture
20
+ */
21
+ export class AgentFeedbackManager {
22
+ config;
23
+ feedbackDir = '';
24
+ feedbackHistory = [];
25
+ constructor(config) {
26
+ // Check opt-out preference
27
+ const optOut = process.env.CODEHERE_FEEDBACK_OPT_OUT === 'true' ||
28
+ process.env.CODEHERE_TELEMETRY_DISABLED === 'true';
29
+ this.config = {
30
+ enabled: !optOut && (config?.enabled !== false),
31
+ anonymize: config?.anonymize !== false,
32
+ optOut: optOut || (config?.optOut === true),
33
+ storagePath: config?.storagePath,
34
+ };
35
+ if (this.config.optOut || !this.config.enabled) {
36
+ return;
37
+ }
38
+ // Set up feedback storage directory
39
+ if (this.config.storagePath) {
40
+ this.feedbackDir = this.config.storagePath;
41
+ }
42
+ else {
43
+ const agentDir = join(__dirname, '../../..');
44
+ this.feedbackDir = join(agentDir, 'data', 'feedback');
45
+ }
46
+ if (!existsSync(this.feedbackDir)) {
47
+ mkdirSync(this.feedbackDir, { recursive: true });
48
+ }
49
+ // Load recent feedback history (for pattern analysis)
50
+ this.loadRecentFeedback();
51
+ }
52
+ /**
53
+ * Record feedback for an agent operation
54
+ * userAction is required - must be provided by caller
55
+ */
56
+ recordFeedback(feedback) {
57
+ if (this.config.optOut || !this.config.enabled) {
58
+ return 'feedback-disabled';
59
+ }
60
+ const feedbackId = randomUUID();
61
+ const fullFeedback = {
62
+ ...feedback,
63
+ feedbackId,
64
+ timestamp: Date.now(),
65
+ };
66
+ // Anonymize if configured
67
+ const processedFeedback = this.config.anonymize
68
+ ? this.anonymizeFeedback(fullFeedback)
69
+ : fullFeedback;
70
+ // Store in memory
71
+ this.feedbackHistory.push(processedFeedback);
72
+ if (this.feedbackHistory.length > 1000) {
73
+ // Keep only last 1000 in memory
74
+ this.feedbackHistory = this.feedbackHistory.slice(-1000);
75
+ }
76
+ // Append to JSON file (one JSON object per line for easy parsing)
77
+ const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
78
+ try {
79
+ appendFileSync(feedbackFile, JSON.stringify(processedFeedback) + '\n', 'utf-8');
80
+ }
81
+ catch (error) {
82
+ // Silent failure - don't break user workflow
83
+ console.error('[AgentFeedback] Failed to write feedback:', error);
84
+ }
85
+ return feedbackId;
86
+ }
87
+ /**
88
+ * Get feedback for a run
89
+ */
90
+ getFeedbackForRun(runId) {
91
+ return this.feedbackHistory.find(f => f.runId === runId) || null;
92
+ }
93
+ /**
94
+ * Get recent feedback patterns (for learning)
95
+ */
96
+ getRecentFeedback(limit = 100) {
97
+ return this.feedbackHistory.slice(-limit);
98
+ }
99
+ /**
100
+ * Get feedback statistics
101
+ */
102
+ getFeedbackStats() {
103
+ const stats = {
104
+ total: this.feedbackHistory.length,
105
+ byOutcome: {},
106
+ byAgent: {},
107
+ averageRating: undefined,
108
+ };
109
+ let totalRating = 0;
110
+ let ratingCount = 0;
111
+ for (const feedback of this.feedbackHistory) {
112
+ // Count by outcome
113
+ stats.byOutcome[feedback.outcome] = (stats.byOutcome[feedback.outcome] || 0) + 1;
114
+ // Count by agent
115
+ stats.byAgent[feedback.agentName] = (stats.byAgent[feedback.agentName] || 0) + 1;
116
+ // Calculate average rating
117
+ if (feedback.userFeedback?.rating) {
118
+ totalRating += feedback.userFeedback.rating;
119
+ ratingCount++;
120
+ }
121
+ }
122
+ if (ratingCount > 0) {
123
+ stats.averageRating = totalRating / ratingCount;
124
+ }
125
+ return stats;
126
+ }
127
+ /**
128
+ * Anonymize feedback (remove sensitive data)
129
+ */
130
+ anonymizeFeedback(feedback) {
131
+ const anonymized = { ...feedback };
132
+ // Remove query content if it might contain sensitive info
133
+ if (anonymized.query) {
134
+ // Keep only intent keywords, not full query
135
+ const keywords = anonymized.query
136
+ .split(/\s+/)
137
+ .filter(w => w.length > 3)
138
+ .slice(0, 5)
139
+ .join(' ');
140
+ anonymized.query = keywords || '[anonymized]';
141
+ }
142
+ // Remove file contents from modifications
143
+ if (anonymized.userModifications) {
144
+ anonymized.userModifications = anonymized.userModifications.map(mod => ({
145
+ filepath: this.anonymizePath(mod.filepath),
146
+ modificationType: mod.modificationType,
147
+ description: mod.description ? '[anonymized]' : undefined,
148
+ }));
149
+ }
150
+ // Anonymize file paths (keep structure, not names)
151
+ if (anonymized.filesChanged) {
152
+ anonymized.filesChanged = anonymized.filesChanged.map(p => this.anonymizePath(p));
153
+ }
154
+ if (anonymized.filesCreated) {
155
+ anonymized.filesCreated = anonymized.filesCreated.map(p => this.anonymizePath(p));
156
+ }
157
+ return anonymized;
158
+ }
159
+ /**
160
+ * Anonymize file path (keep structure, not actual names)
161
+ */
162
+ anonymizePath(filepath) {
163
+ // Replace actual file names with placeholders but keep structure
164
+ const parts = filepath.split('/');
165
+ return parts.map((part, index) => {
166
+ if (index === parts.length - 1) {
167
+ // Last part is filename
168
+ const ext = part.split('.').pop();
169
+ return `file${ext ? '.' + ext : ''}`;
170
+ }
171
+ return part;
172
+ }).join('/');
173
+ }
174
+ /**
175
+ * Load recent feedback from disk
176
+ */
177
+ loadRecentFeedback() {
178
+ const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
179
+ if (!existsSync(feedbackFile)) {
180
+ return;
181
+ }
182
+ try {
183
+ const content = readFileSync(feedbackFile, 'utf-8');
184
+ const lines = content.trim().split('\n').filter(line => line.trim());
185
+ // Load last 100 entries
186
+ const recentLines = lines.slice(-100);
187
+ this.feedbackHistory = recentLines
188
+ .map(line => {
189
+ try {
190
+ return JSON.parse(line);
191
+ }
192
+ catch {
193
+ return null;
194
+ }
195
+ })
196
+ .filter((f) => f !== null);
197
+ }
198
+ catch (error) {
199
+ // Silent failure
200
+ console.error('[AgentFeedback] Failed to load feedback history:', error);
201
+ }
202
+ }
203
+ /**
204
+ * Clear all feedback (privacy control)
205
+ */
206
+ clearFeedback() {
207
+ this.feedbackHistory = [];
208
+ const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
209
+ if (existsSync(feedbackFile)) {
210
+ try {
211
+ writeFileSync(feedbackFile, '', 'utf-8');
212
+ }
213
+ catch {
214
+ // Silent failure
215
+ }
216
+ }
217
+ }
218
+ /**
219
+ * Check if feedback collection is enabled
220
+ */
221
+ isEnabled() {
222
+ return !this.config.optOut && this.config.enabled;
223
+ }
224
+ }
225
+ // Singleton instance
226
+ export const agentFeedbackManager = new AgentFeedbackManager();
227
+ //# sourceMappingURL=agent-feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-feedback.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,M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AG,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YACtC,IAAI,CAAC,eAAe,GAAG,WAAW;iBAC/B,GAAG,CAAC,IAAI,CAAC,EAAE;gBACV,IAAI,CAAC;oBACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAkB,CAAC;gBAC3C,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC,CAAC;iBACD,MAAM,CAAC,CAAC,CAAC,EAAsB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAiB;YACjB,OAAO,CAAC,KAAK,CAAC,kDAAkD,EAAE,KAAK,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;QACpE,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,aAAa,CAAC,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;YAC3C,CAAC;YAAC,MAAM,CAAC;gBACP,iBAAiB;YACnB,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IACpD,CAAC;CACF;AAED,qBAAqB;AACrB,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Infrastructure: Agent Validation Helper
3
+ * Shared utilities for integrating Validation Layer into agents
4
+ *
5
+ * Provides:
6
+ * - Automatic TraceSummary generation
7
+ * - AgentFeedback recording
8
+ * - Run context tracking
9
+ */
10
+ import type { TraceSummary } from './trace-summary.js';
11
+ import type { FeedbackOutcome, UserAction } from './agent-feedback.js';
12
+ export interface AgentValidationContext {
13
+ runId: string;
14
+ agentName: string;
15
+ operation: string;
16
+ startTime: number;
17
+ }
18
+ export interface AgentValidationResult<T = any> {
19
+ result: T;
20
+ summary: TraceSummary;
21
+ feedbackId: string;
22
+ runId: string;
23
+ }
24
+ /**
25
+ * Helper class for agent validation integration
26
+ */
27
+ export declare class AgentValidationHelper {
28
+ /**
29
+ * Start validation context for an agent operation
30
+ */
31
+ startAgentOperation(agentName: string, operation: string, context?: {
32
+ query?: string;
33
+ codebaseId?: string;
34
+ }): AgentValidationContext;
35
+ /**
36
+ * Complete agent operation and generate validation artifacts
37
+ */
38
+ completeAgentOperation<T>(validationContext: AgentValidationContext, result: T, metadata: {
39
+ outcome: FeedbackOutcome;
40
+ userAction?: UserAction;
41
+ filesChanged?: string[];
42
+ filesCreated?: string[];
43
+ filesDeleted?: string[];
44
+ errors?: string[];
45
+ warnings?: string[];
46
+ validationChecks?: Array<{
47
+ check: string;
48
+ passed: boolean;
49
+ message?: string;
50
+ critical?: boolean;
51
+ }>;
52
+ metrics?: {
53
+ tokensUsed?: number;
54
+ duration?: number;
55
+ filesAnalyzed?: number;
56
+ changesProposed?: number;
57
+ changesApplied?: number;
58
+ };
59
+ additionalContext?: Record<string, any>;
60
+ }): Promise<AgentValidationResult<T>>;
61
+ /**
62
+ * Record a trace during agent operation
63
+ */
64
+ trace(operation: {
65
+ operationType: 'llm_call' | 'tool_invocation' | 'memory_operation' | 'plan_generation' | 'code_analysis' | 'file_operation' | 'git_operation' | 'other';
66
+ operationName: string;
67
+ input?: any;
68
+ output?: any;
69
+ error?: Error;
70
+ metadata?: Record<string, any>;
71
+ duration?: number;
72
+ }): string;
73
+ }
74
+ export declare const agentValidationHelper: AgentValidationHelper;
75
+ //# sourceMappingURL=agent-validation-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-validation-helper.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-validation-helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAiB,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtF,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,GAAG;IAC5C,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAChC;;OAEG;IACH,mBAAmB,CACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GACA,sBAAsB;IAczB;;OAEG;IACG,sBAAsB,CAAC,CAAC,EAC5B,iBAAiB,EAAE,sBAAsB,EACzC,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE;QACR,OAAO,EAAE,eAAe,CAAC;QACzB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,gBAAgB,CAAC,EAAE,KAAK,CAAC;YACvB,KAAK,EAAE,MAAM,CAAC;YACd,MAAM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