codehere 0.5.1-alpha → 0.5.3-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +126 -102
  3. package/dist/application/agents/execution-agent.js +2 -2
  4. package/dist/application/agents/multi-agent-orchestrator.d.ts +0 -1
  5. package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
  6. package/dist/application/agents/multi-agent-orchestrator.js +2 -9
  7. package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
  8. package/dist/application/agents/planning-agent.d.ts.map +1 -1
  9. package/dist/application/agents/planning-agent.js +11 -15
  10. package/dist/application/agents/planning-agent.js.map +1 -1
  11. package/dist/application/services/context-importer.d.ts +71 -0
  12. package/dist/application/services/context-importer.d.ts.map +1 -0
  13. package/dist/application/services/context-importer.js +436 -0
  14. package/dist/application/services/context-importer.js.map +1 -0
  15. package/dist/application/services/context-manager.d.ts +132 -0
  16. package/dist/application/services/context-manager.d.ts.map +1 -0
  17. package/dist/application/services/context-manager.js +369 -0
  18. package/dist/application/services/context-manager.js.map +1 -0
  19. package/dist/application/services/dependency-container.d.ts.map +1 -1
  20. package/dist/application/services/dependency-container.js +7 -5
  21. package/dist/application/services/dependency-container.js.map +1 -1
  22. package/dist/application/services/intelligent-router.d.ts +8 -5
  23. package/dist/application/services/intelligent-router.d.ts.map +1 -1
  24. package/dist/application/services/intelligent-router.js +78 -82
  25. package/dist/application/services/intelligent-router.js.map +1 -1
  26. package/dist/application/services/token-counting-service.d.ts +87 -0
  27. package/dist/application/services/token-counting-service.d.ts.map +1 -0
  28. package/dist/application/services/token-counting-service.js +196 -0
  29. package/dist/application/services/token-counting-service.js.map +1 -0
  30. package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
  31. package/dist/application/use-cases/ask-question-use-case.js +109 -21
  32. package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
  33. package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
  34. package/dist/application/use-cases/edit-file-use-case.js +19 -0
  35. package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
  36. package/dist/application/use-cases/planning-use-case.d.ts +1 -14
  37. package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
  38. package/dist/application/use-cases/planning-use-case.js +2 -109
  39. package/dist/application/use-cases/planning-use-case.js.map +1 -1
  40. package/dist/chat.d.ts.map +1 -1
  41. package/dist/chat.js +6 -17
  42. package/dist/chat.js.map +1 -1
  43. package/dist/domain/entities/conversation-context.d.ts +245 -0
  44. package/dist/domain/entities/conversation-context.d.ts.map +1 -0
  45. package/dist/domain/entities/conversation-context.js +50 -0
  46. package/dist/domain/entities/conversation-context.js.map +1 -0
  47. package/dist/domain/entities/memory.d.ts.map +1 -1
  48. package/dist/domain/interfaces/context-repository.interface.d.ts +71 -0
  49. package/dist/domain/interfaces/context-repository.interface.d.ts.map +1 -0
  50. package/dist/domain/interfaces/context-repository.interface.js +10 -0
  51. package/dist/domain/interfaces/context-repository.interface.js.map +1 -0
  52. package/dist/domain/services/query-intent-classifier.d.ts.map +1 -1
  53. package/dist/domain/services/query-intent-classifier.js +37 -23
  54. package/dist/domain/services/query-intent-classifier.js.map +1 -1
  55. package/dist/embed.d.ts.map +1 -1
  56. package/dist/embed.js +8 -3
  57. package/dist/embed.js.map +1 -1
  58. package/dist/index.js +267 -143
  59. package/dist/index.js.map +1 -1
  60. package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
  61. package/dist/infrastructure/ai/cohere-ai-service.js +14 -5
  62. package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
  63. package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -1
  64. package/dist/infrastructure/ai/provider-ai-service.js +64 -14
  65. package/dist/infrastructure/ai/provider-ai-service.js.map +1 -1
  66. package/dist/infrastructure/config/config-manager.d.ts +78 -9
  67. package/dist/infrastructure/config/config-manager.d.ts.map +1 -1
  68. package/dist/infrastructure/config/config-manager.js +127 -9
  69. package/dist/infrastructure/config/config-manager.js.map +1 -1
  70. package/dist/infrastructure/context/conversation-context.d.ts +39 -12
  71. package/dist/infrastructure/context/conversation-context.d.ts.map +1 -1
  72. package/dist/infrastructure/context/conversation-context.js +91 -4
  73. package/dist/infrastructure/context/conversation-context.js.map +1 -1
  74. package/dist/infrastructure/context/direct-context-provider.d.ts +18 -0
  75. package/dist/infrastructure/context/direct-context-provider.d.ts.map +1 -0
  76. package/dist/infrastructure/context/direct-context-provider.js +222 -0
  77. package/dist/infrastructure/context/direct-context-provider.js.map +1 -0
  78. package/dist/infrastructure/context/git-context-provider.d.ts +30 -0
  79. package/dist/infrastructure/context/git-context-provider.d.ts.map +1 -0
  80. package/dist/infrastructure/context/git-context-provider.js +140 -0
  81. package/dist/infrastructure/context/git-context-provider.js.map +1 -0
  82. package/dist/infrastructure/context/project-context-loader.d.ts +35 -0
  83. package/dist/infrastructure/context/project-context-loader.d.ts.map +1 -0
  84. package/dist/infrastructure/context/project-context-loader.js +184 -0
  85. package/dist/infrastructure/context/project-context-loader.js.map +1 -0
  86. package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
  87. package/dist/infrastructure/cost/cost-tracker.js +3 -2
  88. package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
  89. package/dist/infrastructure/cost/session-token-tracker.d.ts +68 -0
  90. package/dist/infrastructure/cost/session-token-tracker.d.ts.map +1 -0
  91. package/dist/infrastructure/cost/session-token-tracker.js +178 -0
  92. package/dist/infrastructure/cost/session-token-tracker.js.map +1 -0
  93. package/dist/infrastructure/index.d.ts +1 -0
  94. package/dist/infrastructure/index.d.ts.map +1 -1
  95. package/dist/infrastructure/index.js +1 -2
  96. package/dist/infrastructure/index.js.map +1 -1
  97. package/dist/infrastructure/observability/execution-tracer.d.ts +21 -0
  98. package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -1
  99. package/dist/infrastructure/observability/execution-tracer.js +157 -4
  100. package/dist/infrastructure/observability/execution-tracer.js.map +1 -1
  101. package/dist/infrastructure/protocols/a2a-metadata.js +1 -1
  102. package/dist/infrastructure/protocols/mcp-oauth.js +1 -1
  103. package/dist/infrastructure/providers/cohere-provider.d.ts +1 -2
  104. package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -1
  105. package/dist/infrastructure/providers/cohere-provider.js +44 -42
  106. package/dist/infrastructure/providers/cohere-provider.js.map +1 -1
  107. package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -1
  108. package/dist/infrastructure/providers/fake-provider.js +8 -0
  109. package/dist/infrastructure/providers/fake-provider.js.map +1 -1
  110. package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -1
  111. package/dist/infrastructure/providers/local-llm-provider.js +8 -2
  112. package/dist/infrastructure/providers/local-llm-provider.js.map +1 -1
  113. package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -1
  114. package/dist/infrastructure/providers/openai-provider.js +40 -7
  115. package/dist/infrastructure/providers/openai-provider.js.map +1 -1
  116. package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -1
  117. package/dist/infrastructure/providers/openrouter-provider.js +13 -7
  118. package/dist/infrastructure/providers/openrouter-provider.js.map +1 -1
  119. package/dist/infrastructure/security/enhanced-security-gate.d.ts +13 -0
  120. package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -1
  121. package/dist/infrastructure/security/enhanced-security-gate.js +56 -1
  122. package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -1
  123. package/dist/infrastructure/security/input-validator.d.ts +17 -0
  124. package/dist/infrastructure/security/input-validator.d.ts.map +1 -1
  125. package/dist/infrastructure/security/input-validator.js +140 -25
  126. package/dist/infrastructure/security/input-validator.js.map +1 -1
  127. package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -1
  128. package/dist/infrastructure/storage/embeddings-path.js +14 -4
  129. package/dist/infrastructure/storage/embeddings-path.js.map +1 -1
  130. package/dist/infrastructure/storage/memory-stream-service.d.ts.map +1 -1
  131. package/dist/infrastructure/storage/memory-stream-service.js +58 -88
  132. package/dist/infrastructure/storage/memory-stream-service.js.map +1 -1
  133. package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
  134. package/dist/infrastructure/storage/plan-repository.js +4 -5
  135. package/dist/infrastructure/storage/plan-repository.js.map +1 -1
  136. package/dist/infrastructure/storage/sqlite-context-repository.d.ts +95 -0
  137. package/dist/infrastructure/storage/sqlite-context-repository.d.ts.map +1 -0
  138. package/dist/infrastructure/storage/sqlite-context-repository.js +467 -0
  139. package/dist/infrastructure/storage/sqlite-context-repository.js.map +1 -0
  140. package/dist/infrastructure/storage/sqlite-decision-repository.d.ts.map +1 -1
  141. package/dist/infrastructure/storage/sqlite-decision-repository.js +4 -8
  142. package/dist/infrastructure/storage/sqlite-decision-repository.js.map +1 -1
  143. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts.map +1 -1
  144. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +4 -8
  145. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js.map +1 -1
  146. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts.map +1 -1
  147. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +4 -8
  148. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js.map +1 -1
  149. package/dist/infrastructure/storage/sqlite-memory-repository.d.ts.map +1 -1
  150. package/dist/infrastructure/storage/sqlite-memory-repository.js +4 -8
  151. package/dist/infrastructure/storage/sqlite-memory-repository.js.map +1 -1
  152. package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts.map +1 -1
  153. package/dist/infrastructure/storage/sqlite-pattern-repository.js +4 -8
  154. package/dist/infrastructure/storage/sqlite-pattern-repository.js.map +1 -1
  155. package/dist/infrastructure/storage/task-repository.d.ts +0 -1
  156. package/dist/infrastructure/storage/task-repository.d.ts.map +1 -1
  157. package/dist/infrastructure/storage/task-repository.js +2 -13
  158. package/dist/infrastructure/storage/task-repository.js.map +1 -1
  159. package/dist/infrastructure/ux/cli-style-guide.d.ts +105 -0
  160. package/dist/infrastructure/ux/cli-style-guide.d.ts.map +1 -0
  161. package/dist/infrastructure/ux/cli-style-guide.js +220 -0
  162. package/dist/infrastructure/ux/cli-style-guide.js.map +1 -0
  163. package/dist/infrastructure/ux/progress-indicator.d.ts +49 -10
  164. package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
  165. package/dist/infrastructure/ux/progress-indicator.js +112 -9
  166. package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
  167. package/dist/infrastructure/validation/agent-feedback.d.ts +14 -1
  168. package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -1
  169. package/dist/infrastructure/validation/agent-feedback.js +57 -3
  170. package/dist/infrastructure/validation/agent-feedback.js.map +1 -1
  171. package/dist/parallel-processor.d.ts.map +1 -1
  172. package/dist/parallel-processor.js +39 -11
  173. package/dist/parallel-processor.js.map +1 -1
  174. package/dist/presentation/cli/commands/ask-command.d.ts +1 -2
  175. package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
  176. package/dist/presentation/cli/commands/ask-command.js +66 -150
  177. package/dist/presentation/cli/commands/ask-command.js.map +1 -1
  178. package/dist/presentation/cli/commands/audit-command.d.ts +13 -0
  179. package/dist/presentation/cli/commands/audit-command.d.ts.map +1 -0
  180. package/dist/presentation/cli/commands/audit-command.js +96 -0
  181. package/dist/presentation/cli/commands/audit-command.js.map +1 -0
  182. package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
  183. package/dist/presentation/cli/commands/config-command.js +2 -14
  184. package/dist/presentation/cli/commands/config-command.js.map +1 -1
  185. package/dist/presentation/cli/commands/context-command.d.ts +32 -0
  186. package/dist/presentation/cli/commands/context-command.d.ts.map +1 -0
  187. package/dist/presentation/cli/commands/context-command.js +295 -0
  188. package/dist/presentation/cli/commands/context-command.js.map +1 -0
  189. package/dist/presentation/cli/commands/context-helper.d.ts +16 -0
  190. package/dist/presentation/cli/commands/context-helper.d.ts.map +1 -0
  191. package/dist/presentation/cli/commands/context-helper.js +88 -0
  192. package/dist/presentation/cli/commands/context-helper.js.map +1 -0
  193. package/dist/presentation/cli/commands/decision-command.js +6 -23
  194. package/dist/presentation/cli/commands/decision-command.js.map +1 -1
  195. package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -1
  196. package/dist/presentation/cli/commands/fix-command.js +19 -23
  197. package/dist/presentation/cli/commands/fix-command.js.map +1 -1
  198. package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
  199. package/dist/presentation/cli/commands/help-command.js +1 -21
  200. package/dist/presentation/cli/commands/help-command.js.map +1 -1
  201. package/dist/presentation/cli/commands/orchestrate-command.d.ts +0 -1
  202. package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
  203. package/dist/presentation/cli/commands/orchestrate-command.js +19 -126
  204. package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
  205. package/dist/presentation/cli/commands/plan-command.d.ts +0 -1
  206. package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
  207. package/dist/presentation/cli/commands/plan-command.js +42 -132
  208. package/dist/presentation/cli/commands/plan-command.js.map +1 -1
  209. package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
  210. package/dist/presentation/cli/commands/react-command.js +1 -5
  211. package/dist/presentation/cli/commands/react-command.js.map +1 -1
  212. package/dist/presentation/cli/commands/review-command.d.ts.map +1 -1
  213. package/dist/presentation/cli/commands/review-command.js +2 -21
  214. package/dist/presentation/cli/commands/review-command.js.map +1 -1
  215. package/dist/presentation/cli/commands/smart-command.d.ts +3 -0
  216. package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
  217. package/dist/presentation/cli/commands/smart-command.js +127 -93
  218. package/dist/presentation/cli/commands/smart-command.js.map +1 -1
  219. package/dist/presentation/cli/commands/status-command.d.ts.map +1 -1
  220. package/dist/presentation/cli/commands/status-command.js +1 -5
  221. package/dist/presentation/cli/commands/status-command.js.map +1 -1
  222. package/dist/presentation/cli/commands/trust-command.d.ts +28 -0
  223. package/dist/presentation/cli/commands/trust-command.d.ts.map +1 -0
  224. package/dist/presentation/cli/commands/trust-command.js +301 -0
  225. package/dist/presentation/cli/commands/trust-command.js.map +1 -0
  226. package/dist/presentation/cli/error-display.d.ts.map +1 -1
  227. package/dist/presentation/cli/error-display.js +17 -75
  228. package/dist/presentation/cli/error-display.js.map +1 -1
  229. package/dist/search.d.ts.map +1 -1
  230. package/dist/search.js +5 -18
  231. package/dist/search.js.map +1 -1
  232. package/dist/session.d.ts.map +1 -1
  233. package/dist/session.js +221 -57
  234. package/dist/session.js.map +1 -1
  235. package/dist/token-optimizer.d.ts.map +1 -1
  236. package/dist/token-optimizer.js +6 -1
  237. package/dist/token-optimizer.js.map +1 -1
  238. package/dist/tools/bash.d.ts.map +1 -1
  239. package/dist/tools/bash.js +0 -3
  240. package/dist/tools/bash.js.map +1 -1
  241. package/dist/tools/git-tool.js +7 -7
  242. package/dist/tools/git-tool.js.map +1 -1
  243. package/dist/ui.d.ts +0 -5
  244. package/dist/ui.d.ts.map +1 -1
  245. package/dist/ui.js +0 -19
  246. package/dist/ui.js.map +1 -1
  247. package/dist/utils/provider-check.d.ts +21 -0
  248. package/dist/utils/provider-check.d.ts.map +1 -0
  249. package/dist/utils/provider-check.js +124 -0
  250. package/dist/utils/provider-check.js.map +1 -0
  251. package/package.json +16 -13
  252. package/dist/application/agents/documentation-agent.d.ts +0 -24
  253. package/dist/application/agents/documentation-agent.d.ts.map +0 -1
  254. package/dist/application/agents/documentation-agent.js +0 -399
  255. package/dist/application/agents/documentation-agent.js.map +0 -1
  256. package/dist/application/agents/product-requirements-agent.d.ts +0 -21
  257. package/dist/application/agents/product-requirements-agent.d.ts.map +0 -1
  258. package/dist/application/agents/product-requirements-agent.js +0 -247
  259. package/dist/application/agents/product-requirements-agent.js.map +0 -1
  260. package/dist/application/reasoning/multi-model-planning-strategy.d.ts +0 -21
  261. package/dist/application/reasoning/multi-model-planning-strategy.d.ts.map +0 -1
  262. package/dist/application/reasoning/multi-model-planning-strategy.js +0 -158
  263. package/dist/application/reasoning/multi-model-planning-strategy.js.map +0 -1
  264. package/dist/application/reasoning/reasoning-config.d.ts +0 -15
  265. package/dist/application/reasoning/reasoning-config.d.ts.map +0 -1
  266. package/dist/application/reasoning/reasoning-config.js +0 -50
  267. package/dist/application/reasoning/reasoning-config.js.map +0 -1
  268. package/dist/application/reasoning/reasoning-orchestrator.d.ts +0 -18
  269. package/dist/application/reasoning/reasoning-orchestrator.d.ts.map +0 -1
  270. package/dist/application/reasoning/reasoning-orchestrator.js +0 -170
  271. package/dist/application/reasoning/reasoning-orchestrator.js.map +0 -1
  272. package/dist/application/reasoning/reasoning-strategy.interface.d.ts +0 -24
  273. package/dist/application/reasoning/reasoning-strategy.interface.d.ts.map +0 -1
  274. package/dist/application/reasoning/reasoning-strategy.interface.js +0 -6
  275. package/dist/application/reasoning/reasoning-strategy.interface.js.map +0 -1
  276. package/dist/application/reasoning/role-provider-resolver.d.ts +0 -36
  277. package/dist/application/reasoning/role-provider-resolver.d.ts.map +0 -1
  278. package/dist/application/reasoning/role-provider-resolver.js +0 -74
  279. package/dist/application/reasoning/role-provider-resolver.js.map +0 -1
  280. package/dist/application/reasoning/simple-planning-strategy.d.ts +0 -22
  281. package/dist/application/reasoning/simple-planning-strategy.d.ts.map +0 -1
  282. package/dist/application/reasoning/simple-planning-strategy.js +0 -217
  283. package/dist/application/reasoning/simple-planning-strategy.js.map +0 -1
  284. package/dist/application/reasoning/types.d.ts +0 -65
  285. package/dist/application/reasoning/types.d.ts.map +0 -1
  286. package/dist/application/reasoning/types.js +0 -6
  287. package/dist/application/reasoning/types.js.map +0 -1
  288. package/dist/application/reasoning/validator-strategy.d.ts +0 -56
  289. package/dist/application/reasoning/validator-strategy.d.ts.map +0 -1
  290. package/dist/application/reasoning/validator-strategy.js +0 -103
  291. package/dist/application/reasoning/validator-strategy.js.map +0 -1
  292. package/dist/domain/entities/documentation.d.ts +0 -35
  293. package/dist/domain/entities/documentation.d.ts.map +0 -1
  294. package/dist/domain/entities/documentation.js +0 -6
  295. package/dist/domain/entities/documentation.js.map +0 -1
  296. package/dist/domain/entities/product-requirements.d.ts +0 -50
  297. package/dist/domain/entities/product-requirements.d.ts.map +0 -1
  298. package/dist/domain/entities/product-requirements.js +0 -6
  299. package/dist/domain/entities/product-requirements.js.map +0 -1
  300. package/dist/domain/interfaces/agent.interface.d.ts +0 -15
  301. package/dist/domain/interfaces/agent.interface.d.ts.map +0 -1
  302. package/dist/domain/interfaces/agent.interface.js +0 -6
  303. package/dist/domain/interfaces/agent.interface.js.map +0 -1
  304. package/dist/infrastructure/ai/fake-ai-service.d.ts +0 -22
  305. package/dist/infrastructure/ai/fake-ai-service.d.ts.map +0 -1
  306. package/dist/infrastructure/ai/fake-ai-service.js +0 -59
  307. package/dist/infrastructure/ai/fake-ai-service.js.map +0 -1
  308. package/dist/infrastructure/completion/completion-generator.d.ts +0 -42
  309. package/dist/infrastructure/completion/completion-generator.d.ts.map +0 -1
  310. package/dist/infrastructure/completion/completion-generator.js +0 -184
  311. package/dist/infrastructure/completion/completion-generator.js.map +0 -1
  312. package/dist/infrastructure/security/network-guard.d.ts +0 -8
  313. package/dist/infrastructure/security/network-guard.d.ts.map +0 -1
  314. package/dist/infrastructure/security/network-guard.js +0 -70
  315. package/dist/infrastructure/security/network-guard.js.map +0 -1
  316. package/dist/infrastructure/security/offline.d.ts +0 -16
  317. package/dist/infrastructure/security/offline.d.ts.map +0 -1
  318. package/dist/infrastructure/security/offline.js +0 -24
  319. package/dist/infrastructure/security/offline.js.map +0 -1
  320. package/dist/infrastructure/storage/sqljs-init.d.ts +0 -8
  321. package/dist/infrastructure/storage/sqljs-init.d.ts.map +0 -1
  322. package/dist/infrastructure/storage/sqljs-init.js +0 -23
  323. package/dist/infrastructure/storage/sqljs-init.js.map +0 -1
  324. package/dist/infrastructure/ux/hitl-review-portal.d.ts +0 -47
  325. package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +0 -1
  326. package/dist/infrastructure/ux/hitl-review-portal.js +0 -228
  327. package/dist/infrastructure/ux/hitl-review-portal.js.map +0 -1
  328. package/dist/infrastructure/ux/meta-query.d.ts +0 -9
  329. package/dist/infrastructure/ux/meta-query.d.ts.map +0 -1
  330. package/dist/infrastructure/ux/meta-query.js +0 -63
  331. package/dist/infrastructure/ux/meta-query.js.map +0 -1
  332. package/dist/infrastructure/ux/proportional-friction.d.ts +0 -73
  333. package/dist/infrastructure/ux/proportional-friction.d.ts.map +0 -1
  334. package/dist/infrastructure/ux/proportional-friction.js +0 -200
  335. package/dist/infrastructure/ux/proportional-friction.js.map +0 -1
  336. package/dist/infrastructure/ux/repo-fingerprint.d.ts +0 -10
  337. package/dist/infrastructure/ux/repo-fingerprint.d.ts.map +0 -1
  338. package/dist/infrastructure/ux/repo-fingerprint.js +0 -55
  339. package/dist/infrastructure/ux/repo-fingerprint.js.map +0 -1
  340. package/dist/infrastructure/validation/feedback-stats.d.ts +0 -99
  341. package/dist/infrastructure/validation/feedback-stats.d.ts.map +0 -1
  342. package/dist/infrastructure/validation/feedback-stats.js +0 -173
  343. package/dist/infrastructure/validation/feedback-stats.js.map +0 -1
  344. package/dist/infrastructure/validation/trust-config.d.ts +0 -27
  345. package/dist/infrastructure/validation/trust-config.d.ts.map +0 -1
  346. package/dist/infrastructure/validation/trust-config.js +0 -113
  347. package/dist/infrastructure/validation/trust-config.js.map +0 -1
  348. package/dist/presentation/cli/commands/memory-command.d.ts +0 -17
  349. package/dist/presentation/cli/commands/memory-command.d.ts.map +0 -1
  350. package/dist/presentation/cli/commands/memory-command.js +0 -252
  351. package/dist/presentation/cli/commands/memory-command.js.map +0 -1
  352. package/dist/presentation/cli/keyboard-shortcuts.d.ts +0 -27
  353. package/dist/presentation/cli/keyboard-shortcuts.d.ts.map +0 -1
  354. package/dist/presentation/cli/keyboard-shortcuts.js +0 -77
  355. package/dist/presentation/cli/keyboard-shortcuts.js.map +0 -1
  356. package/dist/test_cohere.d.ts +0 -2
  357. package/dist/test_cohere.d.ts.map +0 -1
  358. package/dist/test_cohere.js +0 -68
  359. package/dist/test_cohere.js.map +0 -1
  360. package/dist/test_env.d.ts +0 -2
  361. package/dist/test_env.d.ts.map +0 -1
  362. package/dist/test_env.js +0 -24
  363. package/dist/test_env.js.map +0 -1
  364. package/dist/test_retrieval.d.ts +0 -2
  365. package/dist/test_retrieval.d.ts.map +0 -1
  366. package/dist/test_retrieval.js +0 -84
  367. package/dist/test_retrieval.js.map +0 -1
  368. package/dist/tools/bash.d 2.ts +0 -53
  369. package/dist/tools/bash.js 2.map +0 -1
  370. package/dist/tools/edit 2.js +0 -235
  371. package/dist/tools/edit.d.ts 2.map +0 -1
  372. package/dist/utils/logger.d.ts +0 -34
  373. package/dist/utils/logger.d.ts.map +0 -1
  374. package/dist/utils/logger.js +0 -56
  375. package/dist/utils/logger.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyboard-shortcuts.d.ts","sourceRoot":"","sources":["../../../src/presentation/cli/keyboard-shortcuts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,QAAQ,CAAC,SAAS,EACtB,OAAO,EAAE,MAAM,EAAE,GAChB,cAAc,CAsChB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAWjD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,GAAE;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACf,GAAG,QAAQ,CAAC,SAAS,CAiB1B"}
@@ -1,77 +0,0 @@
1
- /**
2
- * Keyboard Shortcuts and Navigation
3
- * Enhanced keyboard navigation for interactive sessions - Task 7.5
4
- */
5
- import * as readline from 'readline';
6
- import { colors } from '../../ui.js';
7
- /**
8
- * Setup enhanced keyboard navigation for readline interface
9
- */
10
- export function setupKeyboardNavigation(rl, history) {
11
- const commandHistory = {
12
- commands: [...history],
13
- currentIndex: history.length,
14
- searchTerm: '',
15
- isSearching: false,
16
- };
17
- // Handle history navigation and shortcuts
18
- if (process.stdin.isTTY) {
19
- const stdin = process.stdin;
20
- // Enable raw mode for advanced key handling (if supported)
21
- if (stdin.setRawMode) {
22
- stdin.setRawMode(true);
23
- }
24
- stdin.on('keypress', (str, key) => {
25
- // Handle Ctrl+C gracefully
26
- if (key && key.ctrl && key.name === 'c') {
27
- console.log(colors.dim('\n\nOperation cancelled. Press Ctrl+D to exit or continue typing.'));
28
- rl.prompt();
29
- return;
30
- }
31
- // Handle Ctrl+L (clear screen)
32
- if (key && key.ctrl && key.name === 'l') {
33
- console.clear();
34
- rl.prompt();
35
- return;
36
- }
37
- // Handle Ctrl+R (search history) - would require more complex implementation
38
- // For now, basic arrow key navigation is handled by readline
39
- });
40
- }
41
- return commandHistory;
42
- }
43
- /**
44
- * Get keyboard shortcuts help text
45
- */
46
- export function getKeyboardShortcutsHelp() {
47
- return `
48
- Keyboard Shortcuts:
49
- ${colors.cyan('↑/↓')} Navigate command history
50
- ${colors.cyan('Tab')} Autocomplete (when available)
51
- ${colors.cyan('Ctrl+C')} Cancel current operation
52
- ${colors.cyan('Ctrl+D')} Exit session
53
- ${colors.cyan('Ctrl+L')} Clear screen
54
- ${colors.cyan('Esc')} Cancel current input
55
- ${colors.cyan('Enter')} Execute command
56
- `;
57
- }
58
- /**
59
- * Enhanced readline configuration with history support
60
- */
61
- export function createEnhancedReadline(config = {}) {
62
- const rl = readline.createInterface({
63
- input: process.stdin,
64
- output: process.stdout,
65
- prompt: config.prompt || colors.cyan('codehere> '),
66
- historySize: 100, // Store up to 100 commands
67
- completer: undefined, // Can be enhanced with tab completion
68
- });
69
- // Load history if provided
70
- if (config.history && config.history.length > 0) {
71
- // Readline history is managed internally, but we can prepopulate
72
- // by simulating key presses (complex, skip for now)
73
- // History navigation will work automatically via arrow keys
74
- }
75
- return rl;
76
- }
77
- //# sourceMappingURL=keyboard-shortcuts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyboard-shortcuts.js","sourceRoot":"","sources":["../../../src/presentation/cli/keyboard-shortcuts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,EAAsB,EACtB,OAAiB;IAEjB,MAAM,cAAc,GAAmB;QACrC,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC,MAAM;QAC5B,UAAU,EAAE,EAAE;QACd,WAAW,EAAE,KAAK;KACnB,CAAC;IAEF,0CAA0C;IAC1C,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,2DAA2D;QAC3D,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACrB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAED,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAChC,2BAA2B;YAC3B,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC,CAAC;gBAC7F,EAAE,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YAED,+B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0,0 @@
1
- export {};
2
- //# sourceMappingURL=test_cohere.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test_cohere.d.ts","sourceRoot":"","sources":["../src/test_cohere.ts"],"names":[],"mappings":""}
@@ -1,68 +0,0 @@
1
- import { config } from 'dotenv';
2
- import { join, dirname } from 'path';
3
- import { fileURLToPath } from 'url';
4
- import { CohereClient } from 'cohere-ai';
5
- // Load environment variables
6
- try {
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
- const agentDir = join(__dirname, '..');
10
- config({ path: join(agentDir, '.env') });
11
- }
12
- catch {
13
- // Fallback to current directory
14
- }
15
- config(); // Also try current directory
16
- async function testCohere() {
17
- const apiKey = process.env.COHERE_API_KEY;
18
- if (!apiKey) {
19
- console.error('❌ COHERE_API_KEY not found in environment');
20
- console.error('Please create .env file with: COHERE_API_KEY=your_key');
21
- process.exit(1);
22
- }
23
- console.log('✓ COHERE_API_KEY found');
24
- console.log('Testing Cohere connectivity...\n');
25
- const cohere = new CohereClient({
26
- token: apiKey,
27
- });
28
- try {
29
- console.log('Calling cohere.embed(["hello world"])...');
30
- const response = await cohere.embed({
31
- texts: ['hello world'],
32
- model: 'embed-english-v3.0',
33
- inputType: 'search_document',
34
- });
35
- const embeddings = Array.isArray(response.embeddings)
36
- ? response.embeddings
37
- : response.embeddings.embeddings || [];
38
- const embedding = embeddings[0];
39
- if (!embedding) {
40
- console.error('❌ No embedding returned');
41
- process.exit(1);
42
- }
43
- console.log('✓ Embedding successful!');
44
- console.log(` Shape: [${embedding.length}]`);
45
- console.log(` First 5 values: [${embedding.slice(0, 5).join(', ')}...]`);
46
- console.log(` Min: ${Math.min(...embedding).toFixed(4)}`);
47
- console.log(` Max: ${Math.max(...embedding).toFixed(4)}`);
48
- console.log(` Mean: ${(embedding.reduce((a, b) => a + b, 0) / embedding.length).toFixed(4)}`);
49
- }
50
- catch (error) {
51
- console.error('❌ Cohere API error:');
52
- if (error instanceof Error) {
53
- console.error(` ${error.message}`);
54
- if ('status' in error) {
55
- console.error(` Status: ${error.status}`);
56
- }
57
- if ('body' in error) {
58
- console.error(` Body: ${JSON.stringify(error.body, null, 2)}`);
59
- }
60
- }
61
- else {
62
- console.error(` ${String(error)}`);
63
- }
64
- process.exit(1);
65
- }
66
- }
67
- testCohere();
68
- //# sourceMappingURL=test_cohere.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test_cohere.js","sourceRoot":"","sources":["../src/test_cohere.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,6BAA6B;AAC7B,IAAI,CAAC;IACH,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC;AAAC,MAAM,CAAC;IACP,gCAAgC;AAClC,CAAC;AACD,MAAM,EAAE,CAAC,CAAC,6BAA6B;AAEvC,KAAK,UAAU,UAAU;IACvB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAE1C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC3D,OAAO,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,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,CAAC,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEjG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACrC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACpC,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;gBACtB,OAAO,CAAC,KAAK,CAAC,aAAc,KAAa,CAAC,MAAM,EAAE,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,SAAS,CAAE,KAAa,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,UAAU,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=test_env.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test_env.d.ts","sourceRoot":"","sources":["../src/test_env.ts"],"names":[],"mappings":""}
package/dist/test_env.js DELETED
@@ -1,24 +0,0 @@
1
- import { config } from 'dotenv';
2
- import { join, dirname } from 'path';
3
- import { fileURLToPath } from 'url';
4
- // Load environment variables
5
- try {
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = dirname(__filename);
8
- const agentDir = join(__dirname, '..');
9
- config({ path: join(agentDir, '.env') });
10
- }
11
- catch {
12
- // Fallback to current directory
13
- }
14
- config(); // Also try current directory
15
- console.log('Environment check:');
16
- console.log('COHERE_API_KEY exists:', !!process.env.COHERE_API_KEY);
17
- console.log('COHERE_API_KEY length:', process.env.COHERE_API_KEY?.length || 0);
18
- if (process.env.COHERE_API_KEY) {
19
- console.log('COHERE_API_KEY prefix:', process.env.COHERE_API_KEY.substring(0, 10) + '...');
20
- }
21
- else {
22
- console.log('⚠️ COHERE_API_KEY not found! Please create .env file with COHERE_API_KEY=your_key');
23
- }
24
- //# sourceMappingURL=test_env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test_env.js","sourceRoot":"","sources":["../src/test_env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,6BAA6B;AAC7B,IAAI,CAAC;IACH,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC;AAAC,MAAM,CAAC;IACP,gCAAgC;AAClC,CAAC;AACD,MAAM,EAAE,CAAC,CAAC,6BAA6B;AAEvC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACpE,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;AAC/E,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;AAC7F,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,GAAG,CAAC,oFAAoF,CAAC,CAAC;AACpG,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=test_retrieval.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test_retrieval.d.ts","sourceRoot":"","sources":["../src/test_retrieval.ts"],"names":[],"mappings":""}
@@ -1,84 +0,0 @@
1
- import initSqlJs from 'sql.js';
2
- import { readFileSync, existsSync } from 'fs';
3
- import { join } from 'path';
4
- import { searchSimilar } from './search.js';
5
- const DB_PATH = join(process.cwd(), 'agent', 'data', 'embeddings.sqlite');
6
- async function testRetrieval() {
7
- console.log('Testing retrieval system...\n');
8
- // Test 1: Verify database structure
9
- if (!existsSync(DB_PATH)) {
10
- console.error('❌ Database file not found');
11
- process.exit(1);
12
- }
13
- const SQL = await initSqlJs();
14
- const buffer = readFileSync(DB_PATH);
15
- const db = new SQL.Database(buffer);
16
- // Count chunks
17
- const countStmt = db.prepare('SELECT COUNT(*) as count FROM embeddings');
18
- countStmt.step();
19
- const totalChunks = countStmt.getAsObject().count;
20
- countStmt.free();
21
- // Count files
22
- const filesStmt = db.prepare('SELECT COUNT(DISTINCT filepath) as count FROM embeddings');
23
- filesStmt.step();
24
- const totalFiles = filesStmt.getAsObject().count;
25
- filesStmt.free();
26
- // Check embedding vector consistency
27
- const sampleStmt = db.prepare('SELECT embedding FROM embeddings LIMIT 10');
28
- let validEmbeddings = 0;
29
- let invalidEmbeddings = 0;
30
- const embeddingLengths = [];
31
- while (sampleStmt.step()) {
32
- const row = sampleStmt.getAsObject();
33
- try {
34
- const embedding = JSON.parse(row.embedding);
35
- if (Array.isArray(embedding) && embedding.length > 0) {
36
- validEmbeddings++;
37
- embeddingLengths.push(embedding.length);
38
- }
39
- else {
40
- invalidEmbeddings++;
41
- }
42
- }
43
- catch (e) {
44
- invalidEmbeddings++;
45
- }
46
- }
47
- sampleStmt.free();
48
- db.close();
49
- console.log('Database Verification:');
50
- console.log(` ✓ Total chunks: ${totalChunks}`);
51
- console.log(` ✓ Total files: ${totalFiles}`);
52
- console.log(` ✓ Valid embeddings: ${validEmbeddings}/10 samples`);
53
- console.log(` ✓ Invalid embeddings: ${invalidEmbeddings}`);
54
- if (embeddingLengths.length > 0) {
55
- const uniqueLengths = [...new Set(embeddingLengths)];
56
- console.log(` ✓ Embedding vector lengths: ${uniqueLengths.join(', ')}`);
57
- }
58
- // Test 2: Test retrieval
59
- console.log('\nTesting retrieval...');
60
- try {
61
- const results = await searchSimilar('test function', 5);
62
- console.log(` ✓ Retrieved ${results.length} chunks`);
63
- if (results.length === 0) {
64
- console.error(' ❌ No chunks retrieved!');
65
- process.exit(1);
66
- }
67
- console.log(' ✓ Chunks retrieved:');
68
- results.forEach((r, i) => {
69
- console.log(` ${i + 1}. ${r.filepath} (score: ${r.score.toFixed(4)})`);
70
- });
71
- // Verify all chunks have content
72
- const hasContent = results.every(r => r.content && r.content.length > 0);
73
- const hasFilepath = results.every(r => r.filepath && r.filepath.length > 0);
74
- console.log(` ✓ All chunks have content: ${hasContent}`);
75
- console.log(` ✓ All chunks have filepath: ${hasFilepath}`);
76
- }
77
- catch (error) {
78
- console.error(' ❌ Retrieval failed:', error);
79
- process.exit(1);
80
- }
81
- console.log('\n✅ All retrieval tests passed!');
82
- }
83
- testRet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,CAAC,gCAAgC,UAAU,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC;IAE9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AACjD,CAAC;AAED,aAAa,EAAE,CAAC"}
@@ -1,53 +0,0 @@
1
- /**
2
- * Bash Tool
3
- * Execute shell commands safely with detailed descriptions for the model
4
- * Following Claude Code approach: detailed tool descriptions, error-proofing
5
- *
6
- * SECURITY: Uses Docker sandbox when available for isolated execution
7
- */
8
- export interface BashOptions {
9
- /** Working directory (will be resolved to absolute path) */
10
- cwd?: string;
11
- /** Timeout in milliseconds (default: 30000 = 30s) */
12
- timeout?: number;
13
- /** Maximum output size in bytes (default: 1MB) */
14
- maxOutputSize?: number;
15
- /** Environment variables */
16
- env?: Record<string, string>;
17
- }
18
- export interface BashResult {
19
- /** Exit code (0 = success) */
20
- exitCode: number;
21
- /** Standard output */
22
- stdout: string;
23
- /** Standard error */
24
- stderr: string;
25
- /** Command that was executed */
26
- command: string;
27
- /** Execution time in milliseconds */
28
- duration: number;
29
- /** Whether command succeeded */
30
- success: boolean;
31
- /** Whether command was executed in sandbox */
32
- sandboxed?: boolean;
33
- /** Sandbox status message */
34
- sandboxStatus?: string;
35
- }
36
- /**
37
- * Execute a bash command safely
38
- *
39
- * SECURITY & ERROR-PROOFING:
40
- * - All paths are resolved to absolute paths
41
- * - Commands are executed in Docker sandbox when available (MANDATORY for production)
42
- * - Falls back to direct execution with warning if sandbox unavailable
43
- * - Timeout protection prevents hanging
44
- * - Output size limits prevent memory issues
45
- * - Command injection attempts are logged
46
- */
47
- export declare function executeBash(command: string, options?: BashOptions): Promise<BashResult>;
48
- /**
49
- * Tool description for the model
50
- * This is critical - the model needs to understand how to use this tool
51
- */
52
- export declare const BASH_TOOL_DESCRIPTION = "\nBash Tool - Execute shell commands\n\nDESCRIPTION:\nExecute bash/shell commands in a controlled environment. All paths are automatically resolved to absolute paths.\n\nAVAILABLE COMMANDS:\n- Any valid bash/shell command\n- Commands run in the project directory by default\n- Working directory can be specified\n\nIMPORTANT CONSTRAINTS:\n1. **Absolute Paths Required**: Always use absolute paths or paths relative to the working directory\n2. **No Internet Access**: Commands run in isolated environment (no network access)\n3. **Available Packages**: Standard Unix utilities (ls, cat, grep, find, etc.)\n4. **Timeout**: Commands timeout after 30 seconds (configurable)\n5. **Output Limit**: Maximum 1MB output (configurable)\n\nESCAPING:\n- Use single quotes for strings: 'string with spaces'\n- Escape special characters: Use backslash before $, backtick, or double quote\n- For complex commands, consider breaking into multiple steps\n\nBACKGROUND PROCESSES:\n- Background processes (&) are NOT supported\n- Use sequential commands instead\n\nPATH HANDLING:\n- All paths are resolved to absolute paths automatically\n- Use resolve() or absolute paths to avoid relative path issues\n- Example: /Users/username/project/file.txt (absolute)\n- Example: ./file.txt (relative to cwd)\n\nERROR HANDLING:\n- Exit code 0 = success\n- Exit code != 0 = failure\n- Check stderr for error messages\n- Timeout errors are reported in stderr\n\nEXAMPLES:\n- executeBash('ls -la', { cwd: '/path/to/dir' })\n- executeBash('grep -r \"pattern\" .', { cwd: '/path/to/project' })\n- executeBash('cat /absolute/path/to/file.txt')\n- executeBash('find . -name \"*.ts\" -type f', { cwd: '/path/to/project' })\n\nSECURITY NOTES:\n- Commands execute in Docker sandbox when available (MANDATORY for production)\n- Falls back to direct execution with warning if Docker unavailable\n- Potentially dangerous commands are logged but not blocked\n- Use with caution for destructive operations\n- Always verify paths before executing\n\nSANDBOX STATUS:\n- Check result.sandboxed to see if command ran in sandbox\n- Check result.sandboxStatus for sandbox availability information\n- Production deployments should always have Docker available\n";
53
- //# sourceMappingURL=bash.d.ts.map
@@ -1 +0,0 @@
1
-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AAE,CAAC;YACX,MAAM,EAAE,MAAM,IAAI,EAAE;YACpB,MAAM,EAAE,MAAM,IAAI,EAAE;YACpB,OAAO;YACP,QAAQ;YACR,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,gBAAgB;gBAC7B,CAAC,CAAC,+DAA+D;gBACjE,CAAC,CAAC,mEAAmE;SACxE,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QAExC,+BAA+B;QAC/B,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,OAAO;YACL,QAAQ;YACR,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;YAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE;YAC3C,OAAO;YACP,QAAQ;YACR,OAAO,EAAE,QAAQ,KAAK,CAAC;YACvB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,gBAAgB;gBAC7B,CAAC,CAAC,+DAA+D;gBACjE,CAAC,CAAC,mEAAmE;SACxE,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDpC,CAAC"}
@@ -1,235 +0,0 @@
1
- /**
2
- * Edit Tool
3
- * String replacement-based file editing (like Claude Code)
4
- * Requires exact matches for safety
5
- */
6
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
7
- import { resolve, dirname } from 'path';
8
- // Undo stack (simple in-memory, could be persisted later)
9
- const undoStack = new Map();
10
- /**
11
- * View file content
12
- */
13
- export function viewFile(filepath, options = {}) {
14
- const absPath = resolve(options.cwd || process.cwd(), filepath);
15
- if (!existsSync(absPath)) {
16
- return {
17
- success: false,
18
- filepath: absPath,
19
- operation: 'view',
20
- error: `File not found: ${absPath}`,
21
- };
22
- }
23
- try {
24
- const content = readFileSync(absPath, 'utf-8');
25
- return {
26
- success: true,
27
- filepath: absPath,
28
- operation: 'view',
29
- content,
30
- };
31
- }
32
- catch (error) {
33
- return {
34
- success: false,
35
- filepath: absPath,
36
- operation: 'view',
37
- error: error instanceof Error ? error.message : String(error),
38
- };
39
- }
40
- }
41
- /**
42
- * Create a new file
43
- */
44
- export function createFile(filepath, content, options = {}) {
45
- const absPath = resolve(options.cwd || process.cwd(), filepath);
46
- // Check if file exists
47
- if (existsSync(absPath) && !options.createIfNotExists) {
48
- return {
49
- success: false,
50
- filepath: absPath,
51
- operation: 'create',
52
- error: `File already exists: ${absPath}`,
53
- };
54
- }
55
- try {
56
- // Ensure directory exists
57
- const dir = dirname(absPath);
58
- if (!existsSync(dir)) {
59
- mkdirSync(dir, { recursive: true });
60
- }
61
- // Save to undo stack
62
- if (existsSync(absPath)) {
63
- const oldContent = readFileSync(absPath, 'utf-8');
64
- if (!undoStack.has(absPath)) {
65
- undoStack.set(absPath, []);
66
- }
67
- undoStack.get(absPath).push(oldContent);
68
- }
69
- // Write file
70
- writeFileSync(absPath, content, 'utf-8');
71
- return {
72
- success: true,
73
- filepath: absPath,
74
- operation: 'create',
75
- };
76
- }
77
- catch (error) {
78
- return {
79
- success: false,
80
- filepath: absPath,
81
- operation: 'create',
82
- error: error instanceof Error ? error.message : String(error),
83
- };
84
- }
85
- }
86
- /**
87
- * String replacement (exact match required)
88
- * CRITICAL: Must match exactly, or error if multiple matches
89
- */
90
- export function strReplace(filepath, oldString, newString, options = {}) {
91
- const absPath = resolve(options.cwd || process.cwd(), filepath);
92
- if (!existsSync(absPath)) {
93
- return {
94
- success: false,
95
- filepath: absPath,
96
- operation: 'str_replace',
97
- error: `File not found: ${absPath}`,
98
- };
99
- }
100
- try {
101
- // Read file
102
- const content = readFileSync(absPath, 'utf-8');
103
- // Save to undo stack
104
- if (!undoStack.has(absPath)) {
105
- undoStack.set(absPath, []);
106
- }
107
- undoStack.get(absPath).push(content);
108
- // Count matches
109
- const matches = content.split(oldString).length - 1;
110
- if (matches === 0) {
111
- return {
112
- success: false,
113
- filepath: absPath,
114
- operation: 'str_replace',
115
- error: `String not found in file. Exact match required.`,
116
- };
117
- }
118
- if (matches > 1) {
119
- return {
120
- success: false,
121
- filepath: absPath,
122
- operation: 'str_replace',
123
- error: `Multiple matches found (${matches}). Provide more context to make the match unique.`,
124
- };
125
- }
126
- // Perform replacement
127
- const newContent = content.replace(oldString, newString);
128
- // Write file
129
- writeFileSync(absPath, newContent, 'utf-8');
130
- return {
131
- success: true,
132
- filepath: absPath,
133
- operation: 'str_replace',
134
- replacements: 1,
135
- };
136
- }
137
- catch (error) {
138
- return {
139
- success: false,
140
- filepath: absPath,
141
- operation: 'str_replace',
142
- error: error instanceof Error ? error.message : String(error),
143
- };
144
- }
145
- }
146
- /**
147
- * Undo last edit
148
- */
149
- export function undoEdit(filepath, options = {}) {
150
- const absPath = resolve(options.cwd || process.cwd(), filepath);
151
- const stack = undoStack.get(absPath);
152
- if (!stack || stack.length === 0) {
153
- return {
154
- success: false,
155
- filepath: absPath,
156
- operation: 'undo',
157
- error: 'No undo history available',
158
- };
159
- }
160
- try {
161
- const previousContent = stack.pop();
162
- writeFileSync(absPath, previousContent, 'utf-8');
163
- return {
164
- success: true,
165
- filepath: absPath,
166
- operation: 'undo',
167
- };
168
- }
169
- catch (error) {
170
- return {
171
- success: false,
172
- filepath: absPath,
173
- operation: 'undo',
174
- error: error instanceof Error ? error.message : String(error),
175
- };
176
- }
177
- }
178
- /**
179
- * Tool description for the model
180
- * This is critical - the model needs to understand how to use this tool
181
- */
182
- export const EDIT_TOOL_DESCRIPTION = `
183
- Edit Tool - String replacement-based file editing
184
-
185
- DESCRIPTION:
186
- Edit files using string replacement. Requires exact matches for safety.
187
-
188
- AVAILABLE OPERATIONS:
189
- 1. **view(filepath)**: View file content
190
- 2. **create(filepath, content)**: Create new file
191
- 3. **str_replace(filepath, oldString, newString)**: Replace string in file
192
- 4. **undo(filepath)**: Undo last edit
193
-
194
- CRITICAL RULES:
195
- 1. **Exact Match Required**: oldString must match EXACTLY in the file
196
- 2. **Unique Match Required**: If multiple matches found, provide more context
197
- 3. **Absolute Paths**: All paths are resolved to absolute paths automatically
198
- 4. **Context for Uniqueness**: Include surrounding lines if needed to make match unique
199
-
200
- STRING REPLACEMENT:
201
- - oldString must appear EXACTLY ONCE in the file
202
- - If 0 matches: Error - string not found
203
- - If 2+ matches: Error - provide more context
204
- - Include surrounding code/whitespace to ensure uniqueness
205
-
206
- EXAMPLES:
207
- - str_replace('/path/to/file.ts', 'function old()', 'function new()')
208
- - str_replace('/path/to/file.ts', 'const x = 1;\\n', 'const x = 2;\\n')
209
- - Include context: str_replace('/path/to/file.ts', ' // Comment\\n function old()', ' // Comment\\n function new()')
210
-
211
- PATH HANDLING:
212
- - All paths are resolved to absolute paths
213
- - Use absolute paths or paths relative to cwd
214
- - Example: '/Users/username/project/file.ts' (absolute)
215
- - Example: './file.ts' (relative to cwd)
216
-
217
- UNDO:
218
- - undo() restores file to previous state
219
- - Only one level of undo (last edit)
220
- - Undo stack is in-memory (lost on restart)
221
-
222
- ERROR HANDLING:
223
- - Check success field in result
224
- - Check error field for error message
225
- - Common errors:
226
- - File not found
227
- - String not found (0 matches)
228
- - Multiple matches (need more context)
229
-
230
- SECURITY:
231
- - All paths are validated
232
- - No file system traversal beyond project directory
233
- - Exact match requirement prevents accidental replacements
234
- `;
235
- //# sourceMappingURL=edit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/tools/edit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,UAAU;IACzB,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;IACtD,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAKD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,UAAU,CA4BhF;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,WAAgB,GACxB,UAAU,CA6CZ;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,WAAgB,GACxB,UAAU,CA+DZ;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,UAAU,CA8BhF;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,83DAoDjC,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Custom Logger class for application logging.
3
- * Uses Winston as the underlying logging library.
4
- */
5
- export declare class Logger {
6
- private logger;
7
- constructor();
8
- /**
9
- * Logs a debug message.
10
- * @param message The message to log.
11
- * @param meta Optional metadata to include with the log.
12
- */
13
- debug(message: string, meta?: Record<string, any>): void;
14
- /**
15
- * Logs an info message.
16
- * @param message The message to log.
17
- * @param meta Optional metadata to include with the log.
18
- */
19
- info(message: string, meta?: Record<string, any>): void;
20
- /**
21
- * Logs a warning message.
22
- * @param message The message to log.
23
- * @param meta Optional metadata to include with the log.
24
- */
25
- warn(message: string, meta?: Record<string, any>): void;
26
- /**
27
- * Logs an error message.
28
- * @param message The message to log.
29
- * @param meta Optional metadata to include with the log.
30
- */
31
- error(message: string, meta?: Record<string, any>): void;
32
- }
33
- export declare const logger: Logger;
34
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAgB;;IAwB9B;;;;OAIG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAI/D;;;;OAIG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAI9D;;;;OAIG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAI9D;;;;OAIG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;CAGhE;AAGD,eAAO,MAAM,MAAM,QAAe,CAAC"}