@tyvm/knowhow 0.0.145 → 0.0.147

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 (320) hide show
  1. package/autodoc/cli-reference.md +36 -7
  2. package/bin/knowhow.js +8 -6
  3. package/package.json +1 -1
  4. package/src/agents/base/base.ts +24 -0
  5. package/src/agents/historyRollback.ts +36 -0
  6. package/src/agents/tools/startAgentTask.ts +41 -9
  7. package/src/auth/browserLogin.ts +9 -3
  8. package/src/auth/keyAuth.ts +115 -0
  9. package/src/auth/keyManager.ts +166 -0
  10. package/src/chat/CliChatService.ts +16 -0
  11. package/src/chat/modules/AgentModule.ts +144 -56
  12. package/src/chat/modules/AskModule.ts +2 -0
  13. package/src/chat/modules/BaseChatModule.ts +0 -1
  14. package/src/chat/modules/CustomCommandsModule.ts +2 -0
  15. package/src/chat/modules/InternalChatModule.ts +2 -0
  16. package/src/chat/modules/RemoteSyncModule.ts +4 -0
  17. package/src/chat/modules/RendererModule.ts +2 -0
  18. package/src/chat/modules/SearchModule.ts +2 -0
  19. package/src/chat/modules/SessionsModule.ts +110 -39
  20. package/src/chat/modules/SetupModule.ts +2 -0
  21. package/src/chat/modules/ShellCommandModule.ts +2 -0
  22. package/src/chat/modules/SystemModule.ts +2 -0
  23. package/src/chat/types.ts +5 -2
  24. package/src/cli.ts +1 -1
  25. package/src/clients/anthropic.ts +24 -0
  26. package/src/clients/fireworks.ts +3 -0
  27. package/src/clients/gemini.ts +8 -0
  28. package/src/clients/index.ts +2 -0
  29. package/src/clients/openai.ts +7 -4
  30. package/src/clients/types.ts +30 -7
  31. package/src/clients/xai.ts +23 -4
  32. package/src/commands/agent.ts +11 -39
  33. package/src/commands/agents.ts +403 -53
  34. package/src/commands/misc.ts +3 -2
  35. package/src/commands/services.ts +49 -3
  36. package/src/login.ts +89 -28
  37. package/src/plugins/plugins.ts +16 -0
  38. package/src/processors/TokenCompressor.ts +40 -8
  39. package/src/processors/ToolResponseCache.ts +17 -8
  40. package/src/processors/tools/boundedToolResponse.ts +49 -0
  41. package/src/processors/tools/grepToolResponse.ts +164 -38
  42. package/src/processors/tools/index.ts +2 -0
  43. package/src/processors/tools/jqToolResponse.ts +40 -10
  44. package/src/processors/tools/listStoredToolResponses.ts +51 -10
  45. package/src/processors/tools/tailToolResponse.ts +85 -17
  46. package/src/services/AgentService.ts +2 -0
  47. package/src/services/AgentSyncFs.ts +65 -0
  48. package/src/services/AgentSyncKnowhowWeb.ts +22 -4
  49. package/src/services/BehaviorsService.ts +2 -0
  50. package/src/services/DockerService.ts +2 -0
  51. package/src/services/EmbeddingService.ts +2 -0
  52. package/src/services/EmbeddingsService.ts +3 -0
  53. package/src/services/KnowhowClient.ts +68 -7
  54. package/src/services/LazyToolsService.ts +16 -0
  55. package/src/services/Mcp.ts +11 -2
  56. package/src/services/McpServer.ts +2 -0
  57. package/src/services/MessageProcessor.ts +2 -0
  58. package/src/services/MinimalToolsService.ts +2 -0
  59. package/src/services/RuntimeReloadService.ts +31 -0
  60. package/src/services/SessionManager.ts +5 -0
  61. package/src/services/SkillsService.ts +2 -0
  62. package/src/services/SyncedAgentWatcher.ts +2 -0
  63. package/src/services/SyncerService.ts +23 -8
  64. package/src/services/TaskRegistry.ts +2 -0
  65. package/src/services/Tools.ts +13 -0
  66. package/src/services/TracingService.ts +116 -0
  67. package/src/services/index.ts +10 -0
  68. package/src/services/modules/index.ts +49 -3
  69. package/src/services/modules/types.ts +8 -0
  70. package/src/types.ts +2 -0
  71. package/src/util/Trace.ts +236 -0
  72. package/src/utils/http.ts +18 -2
  73. package/tests/clients/fireworks.test.ts +65 -0
  74. package/tests/clients/reasoningEffort.test.ts +79 -0
  75. package/tests/compressor/toolResponseCache.test.ts +2 -1
  76. package/tests/manual/clients/completions.test.ts +27 -10
  77. package/tests/processors/TokenCompressor.test.ts +17 -3
  78. package/tests/processors/tools/boundedRetrievalTools.test.ts +68 -0
  79. package/tests/processors/tools/grepToolResponse.test.ts +88 -1
  80. package/tests/unit/agents/historyRollback.test.ts +53 -0
  81. package/tests/unit/auth/keyAuth.test.ts +102 -0
  82. package/tests/unit/auth/keyManager.test.ts +67 -0
  83. package/tests/unit/chat/historyCommandArgs.test.ts +37 -0
  84. package/tests/unit/commands/agents.test.ts +68 -0
  85. package/tests/unit/login.test.ts +119 -0
  86. package/tests/unit/plugins/pluginLoading.test.ts +31 -0
  87. package/tests/unit/services/AgentSyncKnowhowWeb.test.ts +38 -0
  88. package/tests/unit/services/LazyToolsService.test.ts +29 -0
  89. package/tests/unit/services/RuntimeReloadService.test.ts +29 -0
  90. package/tests/unit/services/SessionManager.test.ts +43 -0
  91. package/tests/unit/services/SyncerService.test.ts +45 -0
  92. package/tests/unit/util/Trace.test.ts +119 -0
  93. package/tests/unit/utils/http.test.ts +43 -0
  94. package/ts_build/package.json +1 -1
  95. package/ts_build/src/agents/base/base.d.ts +1 -0
  96. package/ts_build/src/agents/base/base.js +31 -2
  97. package/ts_build/src/agents/base/base.js.map +1 -1
  98. package/ts_build/src/agents/historyRollback.d.ts +2 -0
  99. package/ts_build/src/agents/historyRollback.js +22 -0
  100. package/ts_build/src/agents/historyRollback.js.map +1 -0
  101. package/ts_build/src/agents/tools/startAgentTask.d.ts +2 -0
  102. package/ts_build/src/agents/tools/startAgentTask.js +36 -9
  103. package/ts_build/src/agents/tools/startAgentTask.js.map +1 -1
  104. package/ts_build/src/auth/browserLogin.d.ts +1 -0
  105. package/ts_build/src/auth/browserLogin.js +5 -2
  106. package/ts_build/src/auth/browserLogin.js.map +1 -1
  107. package/ts_build/src/auth/keyAuth.d.ts +5 -0
  108. package/ts_build/src/auth/keyAuth.js +79 -0
  109. package/ts_build/src/auth/keyAuth.js.map +1 -0
  110. package/ts_build/src/auth/keyManager.d.ts +14 -0
  111. package/ts_build/src/auth/keyManager.js +145 -0
  112. package/ts_build/src/auth/keyManager.js.map +1 -0
  113. package/ts_build/src/chat/CliChatService.js +15 -0
  114. package/ts_build/src/chat/CliChatService.js.map +1 -1
  115. package/ts_build/src/chat/modules/AgentModule.d.ts +13 -1
  116. package/ts_build/src/chat/modules/AgentModule.js +96 -43
  117. package/ts_build/src/chat/modules/AgentModule.js.map +1 -1
  118. package/ts_build/src/chat/modules/AskModule.js +12 -2
  119. package/ts_build/src/chat/modules/AskModule.js.map +1 -1
  120. package/ts_build/src/chat/modules/BaseChatModule.js.map +1 -1
  121. package/ts_build/src/chat/modules/CustomCommandsModule.js +12 -2
  122. package/ts_build/src/chat/modules/CustomCommandsModule.js.map +1 -1
  123. package/ts_build/src/chat/modules/InternalChatModule.js +16 -2
  124. package/ts_build/src/chat/modules/InternalChatModule.js.map +1 -1
  125. package/ts_build/src/chat/modules/RemoteSyncModule.js +19 -2
  126. package/ts_build/src/chat/modules/RemoteSyncModule.js.map +1 -1
  127. package/ts_build/src/chat/modules/RendererModule.js +17 -2
  128. package/ts_build/src/chat/modules/RendererModule.js.map +1 -1
  129. package/ts_build/src/chat/modules/SearchModule.js +12 -2
  130. package/ts_build/src/chat/modules/SearchModule.js.map +1 -1
  131. package/ts_build/src/chat/modules/SessionsModule.d.ts +6 -0
  132. package/ts_build/src/chat/modules/SessionsModule.js +114 -24
  133. package/ts_build/src/chat/modules/SessionsModule.js.map +1 -1
  134. package/ts_build/src/chat/modules/SetupModule.js +17 -2
  135. package/ts_build/src/chat/modules/SetupModule.js.map +1 -1
  136. package/ts_build/src/chat/modules/ShellCommandModule.js +12 -2
  137. package/ts_build/src/chat/modules/ShellCommandModule.js.map +1 -1
  138. package/ts_build/src/chat/modules/SystemModule.js +12 -2
  139. package/ts_build/src/chat/modules/SystemModule.js.map +1 -1
  140. package/ts_build/src/chat/types.d.ts +5 -2
  141. package/ts_build/src/cli.js +1 -1
  142. package/ts_build/src/cli.js.map +1 -1
  143. package/ts_build/src/clients/anthropic.d.ts +1 -0
  144. package/ts_build/src/clients/anthropic.js +12 -0
  145. package/ts_build/src/clients/anthropic.js.map +1 -1
  146. package/ts_build/src/clients/fireworks.js +1 -0
  147. package/ts_build/src/clients/fireworks.js.map +1 -1
  148. package/ts_build/src/clients/gemini.js +8 -0
  149. package/ts_build/src/clients/gemini.js.map +1 -1
  150. package/ts_build/src/clients/index.js +19 -4
  151. package/ts_build/src/clients/index.js.map +1 -1
  152. package/ts_build/src/clients/openai.js +4 -2
  153. package/ts_build/src/clients/openai.js.map +1 -1
  154. package/ts_build/src/clients/types.d.ts +4 -1
  155. package/ts_build/src/clients/types.js +14 -0
  156. package/ts_build/src/clients/types.js.map +1 -1
  157. package/ts_build/src/clients/xai.d.ts +1 -0
  158. package/ts_build/src/clients/xai.js +23 -4
  159. package/ts_build/src/clients/xai.js.map +1 -1
  160. package/ts_build/src/commands/agent.js +7 -22
  161. package/ts_build/src/commands/agent.js.map +1 -1
  162. package/ts_build/src/commands/agents.d.ts +1 -1
  163. package/ts_build/src/commands/agents.js +174 -16
  164. package/ts_build/src/commands/agents.js.map +1 -1
  165. package/ts_build/src/commands/misc.js +3 -2
  166. package/ts_build/src/commands/misc.js.map +1 -1
  167. package/ts_build/src/commands/services.d.ts +2 -0
  168. package/ts_build/src/commands/services.js +45 -3
  169. package/ts_build/src/commands/services.js.map +1 -1
  170. package/ts_build/src/login.d.ts +1 -1
  171. package/ts_build/src/login.js +53 -15
  172. package/ts_build/src/login.js.map +1 -1
  173. package/ts_build/src/plugins/plugins.d.ts +1 -0
  174. package/ts_build/src/plugins/plugins.js +14 -0
  175. package/ts_build/src/plugins/plugins.js.map +1 -1
  176. package/ts_build/src/processors/TokenCompressor.js +15 -6
  177. package/ts_build/src/processors/TokenCompressor.js.map +1 -1
  178. package/ts_build/src/processors/ToolResponseCache.d.ts +3 -3
  179. package/ts_build/src/processors/ToolResponseCache.js +8 -8
  180. package/ts_build/src/processors/ToolResponseCache.js.map +1 -1
  181. package/ts_build/src/processors/tools/boundedToolResponse.d.ts +7 -0
  182. package/ts_build/src/processors/tools/boundedToolResponse.js +27 -0
  183. package/ts_build/src/processors/tools/boundedToolResponse.js.map +1 -0
  184. package/ts_build/src/processors/tools/grepToolResponse.d.ts +4 -0
  185. package/ts_build/src/processors/tools/grepToolResponse.js +101 -25
  186. package/ts_build/src/processors/tools/grepToolResponse.js.map +1 -1
  187. package/ts_build/src/processors/tools/index.d.ts +2 -2
  188. package/ts_build/src/processors/tools/index.js.map +1 -1
  189. package/ts_build/src/processors/tools/jqToolResponse.d.ts +5 -1
  190. package/ts_build/src/processors/tools/jqToolResponse.js +26 -9
  191. package/ts_build/src/processors/tools/jqToolResponse.js.map +1 -1
  192. package/ts_build/src/processors/tools/listStoredToolResponses.d.ts +7 -1
  193. package/ts_build/src/processors/tools/listStoredToolResponses.js +39 -9
  194. package/ts_build/src/processors/tools/listStoredToolResponses.js.map +1 -1
  195. package/ts_build/src/processors/tools/tailToolResponse.d.ts +5 -0
  196. package/ts_build/src/processors/tools/tailToolResponse.js +56 -13
  197. package/ts_build/src/processors/tools/tailToolResponse.js.map +1 -1
  198. package/ts_build/src/services/AgentService.js +18 -2
  199. package/ts_build/src/services/AgentService.js.map +1 -1
  200. package/ts_build/src/services/AgentSyncFs.d.ts +3 -0
  201. package/ts_build/src/services/AgentSyncFs.js +62 -15
  202. package/ts_build/src/services/AgentSyncFs.js.map +1 -1
  203. package/ts_build/src/services/AgentSyncKnowhowWeb.d.ts +2 -0
  204. package/ts_build/src/services/AgentSyncKnowhowWeb.js +28 -6
  205. package/ts_build/src/services/AgentSyncKnowhowWeb.js.map +1 -1
  206. package/ts_build/src/services/BehaviorsService.js +12 -2
  207. package/ts_build/src/services/BehaviorsService.js.map +1 -1
  208. package/ts_build/src/services/DockerService.js +20 -8
  209. package/ts_build/src/services/DockerService.js.map +1 -1
  210. package/ts_build/src/services/EmbeddingService.js +16 -2
  211. package/ts_build/src/services/EmbeddingService.js.map +1 -1
  212. package/ts_build/src/services/EmbeddingsService.js +12 -2
  213. package/ts_build/src/services/EmbeddingsService.js.map +1 -1
  214. package/ts_build/src/services/KnowhowClient.d.ts +7 -2
  215. package/ts_build/src/services/KnowhowClient.js +108 -10
  216. package/ts_build/src/services/KnowhowClient.js.map +1 -1
  217. package/ts_build/src/services/LazyToolsService.d.ts +2 -0
  218. package/ts_build/src/services/LazyToolsService.js +26 -2
  219. package/ts_build/src/services/LazyToolsService.js.map +1 -1
  220. package/ts_build/src/services/Mcp.js +20 -4
  221. package/ts_build/src/services/Mcp.js.map +1 -1
  222. package/ts_build/src/services/McpServer.js +17 -2
  223. package/ts_build/src/services/McpServer.js.map +1 -1
  224. package/ts_build/src/services/MessageProcessor.js +16 -2
  225. package/ts_build/src/services/MessageProcessor.js.map +1 -1
  226. package/ts_build/src/services/MinimalToolsService.js +16 -2
  227. package/ts_build/src/services/MinimalToolsService.js.map +1 -1
  228. package/ts_build/src/services/RuntimeReloadService.d.ts +12 -0
  229. package/ts_build/src/services/RuntimeReloadService.js +26 -0
  230. package/ts_build/src/services/RuntimeReloadService.js.map +1 -0
  231. package/ts_build/src/services/SessionManager.js +19 -2
  232. package/ts_build/src/services/SessionManager.js.map +1 -1
  233. package/ts_build/src/services/SkillsService.js +16 -2
  234. package/ts_build/src/services/SkillsService.js.map +1 -1
  235. package/ts_build/src/services/SyncedAgentWatcher.js +16 -2
  236. package/ts_build/src/services/SyncedAgentWatcher.js.map +1 -1
  237. package/ts_build/src/services/SyncerService.d.ts +1 -0
  238. package/ts_build/src/services/SyncerService.js +27 -5
  239. package/ts_build/src/services/SyncerService.js.map +1 -1
  240. package/ts_build/src/services/TaskRegistry.js +12 -2
  241. package/ts_build/src/services/TaskRegistry.js.map +1 -1
  242. package/ts_build/src/services/Tools.d.ts +1 -0
  243. package/ts_build/src/services/Tools.js +21 -2
  244. package/ts_build/src/services/Tools.js.map +1 -1
  245. package/ts_build/src/services/TracingService.d.ts +16 -0
  246. package/ts_build/src/services/TracingService.js +35 -0
  247. package/ts_build/src/services/TracingService.js.map +1 -0
  248. package/ts_build/src/services/index.d.ts +8 -0
  249. package/ts_build/src/services/index.js +9 -1
  250. package/ts_build/src/services/index.js.map +1 -1
  251. package/ts_build/src/services/modules/index.d.ts +6 -0
  252. package/ts_build/src/services/modules/index.js +29 -3
  253. package/ts_build/src/services/modules/index.js.map +1 -1
  254. package/ts_build/src/services/modules/types.d.ts +3 -0
  255. package/ts_build/src/types.d.ts +1 -0
  256. package/ts_build/src/types.js.map +1 -1
  257. package/ts_build/src/util/Trace.d.ts +11 -0
  258. package/ts_build/src/util/Trace.js +107 -0
  259. package/ts_build/src/util/Trace.js.map +1 -0
  260. package/ts_build/src/utils/http.d.ts +6 -2
  261. package/ts_build/src/utils/http.js +8 -2
  262. package/ts_build/src/utils/http.js.map +1 -1
  263. package/ts_build/tests/clients/fireworks.test.d.ts +1 -0
  264. package/ts_build/tests/clients/fireworks.test.js +65 -0
  265. package/ts_build/tests/clients/fireworks.test.js.map +1 -0
  266. package/ts_build/tests/clients/reasoningEffort.test.d.ts +1 -0
  267. package/ts_build/tests/clients/reasoningEffort.test.js +68 -0
  268. package/ts_build/tests/clients/reasoningEffort.test.js.map +1 -0
  269. package/ts_build/tests/compressor/toolResponseCache.test.js +1 -1
  270. package/ts_build/tests/compressor/toolResponseCache.test.js.map +1 -1
  271. package/ts_build/tests/manual/clients/completions.test.js +19 -6
  272. package/ts_build/tests/manual/clients/completions.test.js.map +1 -1
  273. package/ts_build/tests/processors/TokenCompressor.test.js +11 -2
  274. package/ts_build/tests/processors/TokenCompressor.test.js.map +1 -1
  275. package/ts_build/tests/processors/tools/boundedRetrievalTools.test.d.ts +1 -0
  276. package/ts_build/tests/processors/tools/boundedRetrievalTools.test.js +57 -0
  277. package/ts_build/tests/processors/tools/boundedRetrievalTools.test.js.map +1 -0
  278. package/ts_build/tests/processors/tools/grepToolResponse.test.js +37 -0
  279. package/ts_build/tests/processors/tools/grepToolResponse.test.js.map +1 -1
  280. package/ts_build/tests/unit/agents/historyRollback.test.d.ts +1 -0
  281. package/ts_build/tests/unit/agents/historyRollback.test.js +42 -0
  282. package/ts_build/tests/unit/agents/historyRollback.test.js.map +1 -0
  283. package/ts_build/tests/unit/auth/keyAuth.test.d.ts +1 -0
  284. package/ts_build/tests/unit/auth/keyAuth.test.js +77 -0
  285. package/ts_build/tests/unit/auth/keyAuth.test.js.map +1 -0
  286. package/ts_build/tests/unit/auth/keyManager.test.d.ts +1 -0
  287. package/ts_build/tests/unit/auth/keyManager.test.js +52 -0
  288. package/ts_build/tests/unit/auth/keyManager.test.js.map +1 -0
  289. package/ts_build/tests/unit/chat/historyCommandArgs.test.d.ts +1 -0
  290. package/ts_build/tests/unit/chat/historyCommandArgs.test.js +29 -0
  291. package/ts_build/tests/unit/chat/historyCommandArgs.test.js.map +1 -0
  292. package/ts_build/tests/unit/commands/agents.test.d.ts +1 -0
  293. package/ts_build/tests/unit/commands/agents.test.js +91 -0
  294. package/ts_build/tests/unit/commands/agents.test.js.map +1 -0
  295. package/ts_build/tests/unit/login.test.d.ts +1 -0
  296. package/ts_build/tests/unit/login.test.js +97 -0
  297. package/ts_build/tests/unit/login.test.js.map +1 -0
  298. package/ts_build/tests/unit/plugins/pluginLoading.test.js +59 -0
  299. package/ts_build/tests/unit/plugins/pluginLoading.test.js.map +1 -1
  300. package/ts_build/tests/unit/services/AgentSyncKnowhowWeb.test.d.ts +1 -0
  301. package/ts_build/tests/unit/services/AgentSyncKnowhowWeb.test.js +32 -0
  302. package/ts_build/tests/unit/services/AgentSyncKnowhowWeb.test.js.map +1 -0
  303. package/ts_build/tests/unit/services/LazyToolsService.test.d.ts +1 -0
  304. package/ts_build/tests/unit/services/LazyToolsService.test.js +27 -0
  305. package/ts_build/tests/unit/services/LazyToolsService.test.js.map +1 -0
  306. package/ts_build/tests/unit/services/RuntimeReloadService.test.d.ts +1 -0
  307. package/ts_build/tests/unit/services/RuntimeReloadService.test.js +26 -0
  308. package/ts_build/tests/unit/services/RuntimeReloadService.test.js.map +1 -0
  309. package/ts_build/tests/unit/services/SessionManager.test.d.ts +1 -0
  310. package/ts_build/tests/unit/services/SessionManager.test.js +72 -0
  311. package/ts_build/tests/unit/services/SessionManager.test.js.map +1 -0
  312. package/ts_build/tests/unit/services/SyncerService.test.d.ts +1 -0
  313. package/ts_build/tests/unit/services/SyncerService.test.js +40 -0
  314. package/ts_build/tests/unit/services/SyncerService.test.js.map +1 -0
  315. package/ts_build/tests/unit/util/Trace.test.d.ts +1 -0
  316. package/ts_build/tests/unit/util/Trace.test.js +107 -0
  317. package/ts_build/tests/unit/util/Trace.test.js.map +1 -0
  318. package/ts_build/tests/unit/utils/http.test.d.ts +1 -0
  319. package/ts_build/tests/unit/utils/http.test.js +69 -0
  320. package/ts_build/tests/unit/utils/http.test.js.map +1 -0
@@ -0,0 +1,68 @@
1
+ import * as fs from "fs";
2
+ import * as os from "os";
3
+ import * as path from "path";
4
+ import { Command } from "commander";
5
+
6
+ const startChat = jest.fn().mockResolvedValue(undefined);
7
+ const setupServices = jest.fn().mockResolvedValue(undefined);
8
+
9
+ jest.mock("../../../src/chat", () => ({ startChat }));
10
+ jest.mock("../../../src/commands/services", () => ({ setupServices }));
11
+
12
+ import { addAgentsCommand } from "../../../src/commands/agents";
13
+
14
+ describe("agents resume terminal UX", () => {
15
+ let previousCwd: string;
16
+ let tempDir: string;
17
+ let isTTYDescriptor: PropertyDescriptor | undefined;
18
+
19
+ beforeEach(() => {
20
+ jest.clearAllMocks();
21
+ previousCwd = process.cwd();
22
+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "knowhow-agents-command-"));
23
+ process.chdir(tempDir);
24
+ const taskId = "1700000000-resumable-task";
25
+ fs.mkdirSync(path.join(".knowhow", "processes", "agents", taskId), {
26
+ recursive: true,
27
+ });
28
+ fs.writeFileSync(
29
+ path.join(".knowhow", "processes", "agents", taskId, "metadata.json"),
30
+ JSON.stringify({ taskId, status: "completed", threads: [[]] })
31
+ );
32
+ isTTYDescriptor = Object.getOwnPropertyDescriptor(process.stdin, "isTTY");
33
+ Object.defineProperty(process.stdin, "isTTY", {
34
+ configurable: true,
35
+ value: true,
36
+ });
37
+ });
38
+
39
+ afterEach(() => {
40
+ process.chdir(previousCwd);
41
+ fs.rmSync(tempDir, { recursive: true, force: true });
42
+ if (isTTYDescriptor) {
43
+ Object.defineProperty(process.stdin, "isTTY", isTTYDescriptor);
44
+ } else {
45
+ delete (process.stdin as NodeJS.ReadStream & { isTTY?: boolean }).isTTY;
46
+ }
47
+ });
48
+
49
+ test("opens chat with the interactive resume command by default", async () => {
50
+ const program = new Command();
51
+ addAgentsCommand(program, jest.fn());
52
+
53
+ await program.parseAsync([
54
+ "node",
55
+ "knowhow",
56
+ "agents",
57
+ "resume",
58
+ "1700000000-resumable-task",
59
+ "--rollback",
60
+ "2",
61
+ ]);
62
+
63
+ expect(setupServices).toHaveBeenCalledTimes(1);
64
+ expect(startChat).toHaveBeenCalledWith(
65
+ "/resume 1700000000-resumable-task --rollback 2"
66
+ );
67
+ });
68
+ });
@@ -0,0 +1,119 @@
1
+ const httpGet = jest.fn();
2
+ const browserLogin = jest.fn();
3
+ const hasKeyPair = jest.fn();
4
+ const authenticateWithKey = jest.fn();
5
+ const registerPublicKey = jest.fn();
6
+ const getOrCreatePublicKey = jest.fn();
7
+ const getConfig = jest.fn();
8
+ const updateConfig = jest.fn();
9
+
10
+ jest.mock("../../src/utils/http", () => ({
11
+ __esModule: true,
12
+ default: { get: httpGet, isHttpError: () => false },
13
+ }));
14
+
15
+ jest.mock("../../src/services/KnowhowClient", () => ({
16
+ KNOWHOW_API_URL: "https://api.example",
17
+ }));
18
+
19
+ jest.mock("../../src/auth/browserLogin", () => ({
20
+ BrowserLoginService: jest.fn().mockImplementation(() => ({ login: browserLogin })),
21
+ }));
22
+
23
+ jest.mock("../../src/auth/keyAuth", () => ({
24
+ hasKeyPair,
25
+ authenticateWithKey,
26
+ registerPublicKey,
27
+ }));
28
+
29
+ jest.mock("../../src/auth/keyManager", () => ({ getOrCreatePublicKey }));
30
+ jest.mock("../../src/config", () => ({ getConfig, updateConfig }));
31
+ jest.mock("../../src/utils", () => ({ ask: jest.fn() }));
32
+
33
+ import fs from "fs";
34
+ import os from "os";
35
+ import path from "path";
36
+ import { login } from "../../src/login";
37
+
38
+ describe("login public-key bootstrap", () => {
39
+ const originalCwd = process.cwd();
40
+ let workingDirectory: string;
41
+
42
+ beforeEach(() => {
43
+ jest.clearAllMocks();
44
+ jest.spyOn(console, "log").mockImplementation(() => undefined);
45
+ jest.spyOn(console, "warn").mockImplementation(() => undefined);
46
+ workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "knowhow-login-"));
47
+ fs.mkdirSync(path.join(workingDirectory, ".knowhow"));
48
+ fs.writeFileSync(path.join(workingDirectory, ".knowhow", ".jwt"), "raw-jwt");
49
+ process.chdir(workingDirectory);
50
+ hasKeyPair.mockReturnValue(false);
51
+ browserLogin.mockResolvedValue(undefined);
52
+ getConfig.mockResolvedValue({ modelProviders: [] });
53
+ getOrCreatePublicKey.mockReturnValue({
54
+ publicKeyBase64: "raw-key",
55
+ fingerprint: "SHA256:key",
56
+ });
57
+ httpGet.mockResolvedValue({
58
+ data: {
59
+ orgId: "org-1",
60
+ user: {
61
+ email: "user@example.com",
62
+ orgs: [{ organizationId: "org-1", organization: { id: "org-1", name: "Org" } }],
63
+ },
64
+ },
65
+ });
66
+ });
67
+
68
+ afterEach(() => {
69
+ process.chdir(originalCwd);
70
+ fs.rmSync(workingDirectory, { recursive: true, force: true });
71
+ jest.restoreAllMocks();
72
+ });
73
+
74
+ it("bootstraps the selected identity after PKCE without invalidating browser login on registration failure", async () => {
75
+ registerPublicKey.mockRejectedValueOnce(new Error("endpoint unavailable"));
76
+
77
+ await expect(login(false, "/keys/custom")).resolves.toBeUndefined();
78
+
79
+ expect(browserLogin).toHaveBeenCalledTimes(1);
80
+ expect(getOrCreatePublicKey).toHaveBeenCalledWith("/keys/custom");
81
+ expect(registerPublicKey).toHaveBeenCalledWith(
82
+ "raw-jwt",
83
+ "raw-key",
84
+ "https://api.example"
85
+ );
86
+ expect(updateConfig).toHaveBeenCalledWith(
87
+ expect.objectContaining({ orgId: "org-1", modelProviders: [{ provider: "knowhow" }] })
88
+ );
89
+ });
90
+
91
+ it("safely falls back to browser PKCE when the selected key cannot authenticate", async () => {
92
+ hasKeyPair.mockReturnValue(true);
93
+ getConfig.mockResolvedValue({ orgId: "org-1", modelProviders: [] });
94
+ authenticateWithKey.mockRejectedValueOnce(new Error("old backend"));
95
+ registerPublicKey.mockResolvedValueOnce(undefined);
96
+
97
+ await expect(login(false, "/keys/dev")).resolves.toBeUndefined();
98
+
99
+ expect(authenticateWithKey).toHaveBeenCalledWith(
100
+ "org-1",
101
+ "https://api.example",
102
+ "/keys/dev"
103
+ );
104
+ expect(browserLogin).toHaveBeenCalledTimes(1);
105
+ expect(getOrCreatePublicKey).toHaveBeenCalledWith("/keys/dev");
106
+ });
107
+
108
+ it("does not attempt key authentication without a configured organization", async () => {
109
+ hasKeyPair.mockReturnValue(true);
110
+ getConfig.mockResolvedValue({ modelProviders: [] });
111
+ registerPublicKey.mockResolvedValueOnce(undefined);
112
+
113
+ await expect(login(false, "/keys/dev")).resolves.toBeUndefined();
114
+
115
+ expect(hasKeyPair).not.toHaveBeenCalled();
116
+ expect(authenticateWithKey).not.toHaveBeenCalled();
117
+ expect(browserLogin).toHaveBeenCalledTimes(1);
118
+ });
119
+ });
@@ -1,5 +1,6 @@
1
1
  import { PluginService } from "../../../src/plugins/plugins";
2
2
  import { PluginContext } from "../../../src/plugins/types";
3
+ import * as configModule from "../../../src/config";
3
4
 
4
5
  // Minimal mock context for PluginService construction
5
6
  // EmbeddingPlugin calls context.Events.on() in its constructor, so we must mock it.
@@ -63,4 +64,34 @@ describe("PluginService.loadPlugin", () => {
63
64
  expect(plugin).toBeDefined();
64
65
  expect(plugin!.meta.key).toBe(mockKey);
65
66
  });
67
+
68
+ it("applies disabled plugins from config and re-enables removed entries", async () => {
69
+ const service = new PluginService(makeContext());
70
+ const plugin = {
71
+ meta: { key: "git", name: "Git Plugin" },
72
+ isEnabled: jest.fn(() => true),
73
+ enable: jest.fn(),
74
+ disable: jest.fn(),
75
+ call: jest.fn(async () => ""),
76
+ callMany: jest.fn(async () => ""),
77
+ };
78
+ service.registerPlugin("git", plugin);
79
+
80
+ const configSpy = jest.spyOn(configModule, "getConfig");
81
+ configSpy.mockResolvedValueOnce({
82
+ plugins: { enabled: [], disabled: ["git"] },
83
+ } as any);
84
+ await service.refreshConfiguredState();
85
+
86
+ expect(plugin.disable).toHaveBeenCalledTimes(1);
87
+ expect(plugin.enable).not.toHaveBeenCalled();
88
+
89
+ configSpy.mockResolvedValueOnce({
90
+ plugins: { enabled: ["git"], disabled: [] },
91
+ } as any);
92
+ await service.refreshConfiguredState();
93
+
94
+ expect(plugin.enable).toHaveBeenCalledTimes(1);
95
+ configSpy.mockRestore();
96
+ });
66
97
  });
@@ -0,0 +1,38 @@
1
+ import { AgentSyncKnowhowWeb } from "../../../src/services/AgentSyncKnowhowWeb";
2
+
3
+ describe("AgentSyncKnowhowWeb sync error reporting", () => {
4
+ let errorSpy: jest.SpyInstance;
5
+
6
+ beforeEach(() => {
7
+ errorSpy = jest.spyOn(console, "error").mockImplementation(() => undefined);
8
+ });
9
+
10
+ afterEach(() => {
11
+ errorSpy.mockRestore();
12
+ });
13
+
14
+ it("reports only the first remote failure for a task", async () => {
15
+ const sync = new AgentSyncKnowhowWeb();
16
+ (sync as any).client = {
17
+ createChatTask: jest.fn().mockRejectedValue(new Error("offline")),
18
+ };
19
+
20
+ await sync.createChatTask({ messageId: "message-1", prompt: "test" });
21
+ await sync.createChatTask({ messageId: "message-1", prompt: "test" });
22
+
23
+ expect(errorSpy).toHaveBeenCalledTimes(1);
24
+ });
25
+
26
+ it("allows the next task to report its first failure after reset", async () => {
27
+ const sync = new AgentSyncKnowhowWeb();
28
+ (sync as any).client = {
29
+ createChatTask: jest.fn().mockRejectedValue(new Error("offline")),
30
+ };
31
+
32
+ await sync.createChatTask({ messageId: "message-1", prompt: "test" });
33
+ sync.reset();
34
+ await sync.createChatTask({ messageId: "message-2", prompt: "test" });
35
+
36
+ expect(errorSpy).toHaveBeenCalledTimes(2);
37
+ });
38
+ });
@@ -0,0 +1,29 @@
1
+ import { LazyToolsService } from "../../../src/services/LazyToolsService";
2
+ import { Tool } from "../../../src/clients/types";
3
+
4
+ function tool(name: string): Tool {
5
+ return {
6
+ type: "function",
7
+ function: {
8
+ name,
9
+ description: name,
10
+ parameters: { type: "object", properties: {}, required: [] },
11
+ },
12
+ };
13
+ }
14
+
15
+ describe("LazyToolsService persisted tool restoration", () => {
16
+ test("replaces pattern state with the exact saved tool list", () => {
17
+ const tools = new LazyToolsService();
18
+ tools.addTools([tool("alpha"), tool("beta"), tool("finalAnswer")]);
19
+ tools.enableTools(["*"]);
20
+ tools.disableTools(["alpha"]);
21
+
22
+ tools.restoreEnabledTools(["alpha", "finalAnswer"]);
23
+
24
+ expect(tools.getTools().map((entry) => entry.function.name).sort()).toEqual([
25
+ "alpha",
26
+ "finalAnswer",
27
+ ]);
28
+ });
29
+ });
@@ -0,0 +1,29 @@
1
+ import { RuntimeReloadService } from "../../../src/services/RuntimeReloadService";
2
+
3
+ describe("RuntimeReloadService", () => {
4
+ it("reports when reload has not been configured", async () => {
5
+ await expect(new RuntimeReloadService().reload()).rejects.toThrow(
6
+ "Runtime reload is unavailable"
7
+ );
8
+ });
9
+
10
+ it("coalesces concurrent reload requests", async () => {
11
+ const service = new RuntimeReloadService();
12
+ let resolve!: (value: { tools: number; mcps: number; modules: number }) => void;
13
+ const result = { tools: 2, mcps: 1, modules: 3 };
14
+ const handler = jest.fn()
15
+ .mockImplementationOnce(() => new Promise<typeof result>((done) => (resolve = done)))
16
+ .mockResolvedValue(result);
17
+ service.configure(handler);
18
+
19
+ const first = service.reload();
20
+ const second = service.reload();
21
+ expect(handler).toHaveBeenCalledTimes(1);
22
+ expect(second).toBe(first);
23
+
24
+ resolve(result);
25
+ await expect(first).resolves.toEqual(result);
26
+ await service.reload();
27
+ expect(handler).toHaveBeenCalledTimes(2);
28
+ });
29
+ });
@@ -0,0 +1,43 @@
1
+ import * as fs from "fs";
2
+ import * as os from "os";
3
+ import * as path from "path";
4
+ import { SessionManager } from "../../../src/services/SessionManager";
5
+ import { TaskInfo } from "../../../src/chat/types";
6
+
7
+ describe("SessionManager persisted run settings", () => {
8
+ let sessionsDir: string;
9
+
10
+ beforeEach(() => {
11
+ sessionsDir = fs.mkdtempSync(path.join(os.tmpdir(), "knowhow-sessions-"));
12
+ });
13
+
14
+ afterEach(() => {
15
+ fs.rmSync(sessionsDir, { recursive: true, force: true });
16
+ });
17
+
18
+ test("saves and updates the exact enabled tool list", () => {
19
+ const manager = new SessionManager(sessionsDir);
20
+ const taskInfo = {
21
+ taskId: "local-task",
22
+ agentName: "Patcher",
23
+ initialInput: "continue",
24
+ status: "running",
25
+ startTime: Date.now(),
26
+ totalCost: 0,
27
+ enabledTools: ["alpha", "finalAnswer"],
28
+ } as TaskInfo;
29
+
30
+ manager.saveSession(taskInfo.taskId, taskInfo, [[]]);
31
+ expect(manager.loadSession(taskInfo.taskId)?.enabledTools).toEqual([
32
+ "alpha",
33
+ "finalAnswer",
34
+ ]);
35
+
36
+ taskInfo.enabledTools = ["beta", "finalAnswer"];
37
+ manager.updateSession(taskInfo.taskId, taskInfo, [[]]);
38
+ expect(manager.loadSession(taskInfo.taskId)?.enabledTools).toEqual([
39
+ "beta",
40
+ "finalAnswer",
41
+ ]);
42
+ });
43
+ });
@@ -0,0 +1,45 @@
1
+ import { AgentSyncFs } from "../../../src/services/AgentSyncFs";
2
+ import { SyncerService } from "../../../src/services/SyncerService";
3
+
4
+ describe("SyncerService remote identity", () => {
5
+ beforeEach(() => {
6
+ jest
7
+ .spyOn(AgentSyncFs.prototype, "createTask")
8
+ .mockImplementation(async (options) => options.taskId);
9
+ jest
10
+ .spyOn(AgentSyncFs.prototype, "setRemoteIdentity")
11
+ .mockResolvedValue(undefined);
12
+ });
13
+
14
+ afterEach(() => {
15
+ jest.restoreAllMocks();
16
+ });
17
+
18
+ it("never attaches a local filesystem slug as a remote task", async () => {
19
+ const syncer = new SyncerService();
20
+ await syncer.createTask({
21
+ taskId: "1785905990-local-task-slug",
22
+ prompt: "resume",
23
+ syncRemote: true,
24
+ });
25
+
26
+ expect(syncer.getCreatedWebTaskId()).toBeUndefined();
27
+ expect(AgentSyncFs.prototype.setRemoteIdentity).not.toHaveBeenCalled();
28
+ });
29
+
30
+ it("attaches and persists an explicit remote task UUID", async () => {
31
+ const remoteTaskId = "123e4567-e89b-42d3-a456-426614174000";
32
+ const syncer = new SyncerService();
33
+ await syncer.createTask({
34
+ taskId: "1785905990-local-task-slug",
35
+ remoteTaskId,
36
+ prompt: "resume",
37
+ syncRemote: true,
38
+ });
39
+
40
+ expect(syncer.getCreatedWebTaskId()).toBe(remoteTaskId);
41
+ expect(AgentSyncFs.prototype.setRemoteIdentity).toHaveBeenCalledWith(
42
+ remoteTaskId
43
+ );
44
+ });
45
+ });
@@ -0,0 +1,119 @@
1
+ import { Trace, TraceAll } from "../../../src/util/Trace";
2
+ import {
3
+ SpanHandle,
4
+ TracerImpl,
5
+ TracingService,
6
+ } from "../../../src/services/TracingService";
7
+ import { ToolsService } from "../../../src/services/Tools";
8
+
9
+ class TestSpan implements SpanHandle {
10
+ ended = false;
11
+ error?: unknown;
12
+
13
+ setAttribute() {}
14
+
15
+ recordError(error: unknown) {
16
+ this.error = error;
17
+ }
18
+
19
+ end() {
20
+ this.ended = true;
21
+ }
22
+ }
23
+
24
+ class TestTracer implements TracerImpl {
25
+ spans: Array<{
26
+ name: string;
27
+ attributes?: Record<string, string | number | boolean>;
28
+ span: TestSpan;
29
+ }> = [];
30
+
31
+ startSpan(
32
+ name: string,
33
+ attributes?: Record<string, string | number | boolean>
34
+ ): SpanHandle {
35
+ const span = new TestSpan();
36
+ this.spans.push({ name, attributes, span });
37
+ return span;
38
+ }
39
+
40
+ withSpan<T>(_span: SpanHandle, fn: () => T): T {
41
+ return fn();
42
+ }
43
+ }
44
+
45
+ describe("tracing decorators", () => {
46
+ const tracer = new TestTracer();
47
+
48
+ beforeEach(() => {
49
+ tracer.spans = [];
50
+ TracingService.register(tracer);
51
+ });
52
+
53
+ afterAll(() => TracingService.reset());
54
+
55
+ it("traces and closes synchronous and asynchronous methods", async () => {
56
+ @TraceAll()
57
+ class Subject {
58
+ sync() {
59
+ return "sync";
60
+ }
61
+
62
+ async asyncMethod() {
63
+ return "async";
64
+ }
65
+ }
66
+
67
+ const subject = new Subject();
68
+ expect(subject.sync()).toBe("sync");
69
+ expect(await subject.asyncMethod()).toBe("async");
70
+
71
+ expect(tracer.spans.map(({ name }) => name)).toEqual([
72
+ "Subject.sync",
73
+ "Subject.asyncMethod",
74
+ ]);
75
+ expect(tracer.spans.every(({ span }) => span.ended)).toBe(true);
76
+ });
77
+
78
+ it("records rejected method errors before rethrowing them", async () => {
79
+ const failure = new Error("failed");
80
+
81
+ class Subject {
82
+ @Trace()
83
+ async fail() {
84
+ throw failure;
85
+ }
86
+ }
87
+
88
+ await expect(new Subject().fail()).rejects.toBe(failure);
89
+ expect(tracer.spans[0].span.error).toBe(failure);
90
+ expect(tracer.spans[0].span.ended).toBe(true);
91
+ });
92
+
93
+ it("traces the concrete ToolsService.callTool path", async () => {
94
+ const tools = new ToolsService();
95
+ tools.addTool({
96
+ type: "function",
97
+ function: {
98
+ name: "echo",
99
+ description: "Echo a value",
100
+ parameters: {
101
+ type: "object",
102
+ properties: { value: { type: "string" } },
103
+ required: ["value"],
104
+ },
105
+ },
106
+ });
107
+ tools.setFunction("echo", ({ value }: { value: string }) => value);
108
+
109
+ const result = await tools.callTool({
110
+ id: "trace-test",
111
+ type: "function",
112
+ function: { name: "echo", arguments: JSON.stringify({ value: "ok" }) },
113
+ });
114
+
115
+ expect(result.functionResp).toBe("ok");
116
+ expect(tracer.spans.some(({ name }) => name === "ToolsService.callTool"))
117
+ .toBe(true);
118
+ });
119
+ });
@@ -0,0 +1,43 @@
1
+ import http, { HTTP_UNAUTHORIZED_HANDLER, RefreshableHeaders } from "../../../src/utils/http";
2
+
3
+ describe("HTTP unauthorized renewal", () => {
4
+ const originalFetch = global.fetch;
5
+
6
+ afterEach(() => {
7
+ global.fetch = originalFetch;
8
+ jest.restoreAllMocks();
9
+ });
10
+
11
+ it("renews and retries a 401 once with the updated headers", async () => {
12
+ const headers: RefreshableHeaders = { Authorization: "Bearer old" };
13
+ const renew = jest.fn(async () => {
14
+ headers.Authorization = "Bearer new";
15
+ });
16
+ Object.defineProperty(headers, HTTP_UNAUTHORIZED_HANDLER, { value: renew });
17
+ global.fetch = jest
18
+ .fn()
19
+ .mockResolvedValueOnce(new Response("unauthorized", { status: 401 }))
20
+ .mockResolvedValueOnce(new Response(JSON.stringify({ ok: true }), { status: 200 }));
21
+
22
+ await expect(http.get("https://example.test", { headers })).resolves.toMatchObject({
23
+ data: { ok: true },
24
+ });
25
+ expect(renew).toHaveBeenCalledTimes(1);
26
+ expect(global.fetch).toHaveBeenNthCalledWith(
27
+ 2,
28
+ "https://example.test",
29
+ expect.objectContaining({ headers: { Authorization: "Bearer new" } })
30
+ );
31
+ });
32
+
33
+ it("does not renew or retry a second 401", async () => {
34
+ const headers: RefreshableHeaders = { Authorization: "Bearer old" };
35
+ const renew = jest.fn(async () => undefined);
36
+ Object.defineProperty(headers, HTTP_UNAUTHORIZED_HANDLER, { value: renew });
37
+ global.fetch = jest.fn().mockResolvedValue(new Response("unauthorized", { status: 401 }));
38
+
39
+ await expect(http.get("https://example.test", { headers })).rejects.toMatchObject({ status: 401 });
40
+ expect(renew).toHaveBeenCalledTimes(1);
41
+ expect(global.fetch).toHaveBeenCalledTimes(2);
42
+ });
43
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tyvm/knowhow",
3
- "version": "0.0.145",
3
+ "version": "0.0.147",
4
4
  "description": "ai cli with plugins and agents",
5
5
  "main": "ts_build/src/index.js",
6
6
  "bin": {
@@ -137,6 +137,7 @@ export declare abstract class BaseAgent implements IAgent {
137
137
  protected isTerminationResponse(content: string): boolean;
138
138
  getEnabledTools(): Tool[];
139
139
  getEnabledToolNames(): string[];
140
+ restoreEnabledTools(names: string[]): void;
140
141
  disableTool(toolName: string): void;
141
142
  isToolEnabled(toolName: string): boolean;
142
143
  enableTool(toolName: string): void;
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.BaseAgent = void 0;
4
13
  const utils_1 = require("../../utils");
@@ -7,7 +16,8 @@ const clients_1 = require("../../clients");
7
16
  const ai_1 = require("../../ai");
8
17
  const MessageProcessor_1 = require("../../services/MessageProcessor");
9
18
  const contextLimits_1 = require("../../clients/contextLimits");
10
- class BaseAgent {
19
+ const Trace_1 = require("../../util/Trace");
20
+ let BaseAgent = class BaseAgent {
11
21
  status = "not_started";
12
22
  lastHealthCheckTime = 0;
13
23
  provider = "openai";
@@ -273,6 +283,21 @@ class BaseAgent {
273
283
  getEnabledToolNames() {
274
284
  return this.getEnabledTools().map((t) => t.function.name);
275
285
  }
286
+ restoreEnabledTools(names) {
287
+ const uniqueNames = [...new Set(names)];
288
+ const lazyTools = this.tools;
289
+ if (lazyTools.restoreEnabledTools) {
290
+ lazyTools.restoreEnabledTools(uniqueNames);
291
+ }
292
+ else {
293
+ lazyTools.enableTools?.(uniqueNames);
294
+ }
295
+ const savedNames = new Set(uniqueNames);
296
+ this.disabledTools = this.tools
297
+ .getTools()
298
+ .map((tool) => tool.function.name)
299
+ .filter((name) => !savedNames.has(name));
300
+ }
276
301
  disableTool(toolName) {
277
302
  this.disabledTools.push(toolName);
278
303
  }
@@ -1088,6 +1113,10 @@ class BaseAgent {
1088
1113
  this.log(`Compressed messages from ${oldLength} to ${newLength}, ${compressionRatio}% reduction in size`);
1089
1114
  return newMessages;
1090
1115
  }
1091
- }
1116
+ };
1092
1117
  exports.BaseAgent = BaseAgent;
1118
+ exports.BaseAgent = BaseAgent = __decorate([
1119
+ (0, Trace_1.TraceAll)(),
1120
+ __metadata("design:paramtypes", [Object])
1121
+ ], BaseAgent);
1093
1122
  //# sourceMappingURL=base.js.map