@tyvm/knowhow 0.0.69 → 0.0.70

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 (210) hide show
  1. package/docs/shell-commands.md +174 -0
  2. package/package.json +1 -1
  3. package/src/agents/base/base.ts +1 -3
  4. package/src/agents/developer/developer.ts +21 -13
  5. package/src/agents/tools/agentCall.ts +4 -2
  6. package/src/agents/tools/fileSearch.ts +5 -1
  7. package/src/agents/tools/startAgentTask.ts +131 -22
  8. package/src/chat/CliChatService.ts +57 -11
  9. package/src/chat/modules/AgentModule.ts +72 -12
  10. package/src/chat/modules/CustomCommandsModule.ts +79 -0
  11. package/src/chat/modules/InternalChatModule.ts +11 -1
  12. package/src/chat/modules/ShellCommandModule.ts +96 -0
  13. package/src/chat/modules/index.ts +1 -0
  14. package/src/chat/types.ts +14 -2
  15. package/src/chat.ts +16 -13
  16. package/src/cli.ts +16 -6
  17. package/src/clients/anthropic.ts +41 -90
  18. package/src/clients/gemini.ts +445 -87
  19. package/src/clients/index.ts +125 -0
  20. package/src/clients/knowhow.ts +81 -0
  21. package/src/clients/openai.ts +256 -145
  22. package/src/clients/pricing/anthropic.ts +90 -0
  23. package/src/clients/pricing/google.ts +65 -0
  24. package/src/clients/pricing/index.ts +4 -0
  25. package/src/clients/pricing/openai.ts +134 -0
  26. package/src/clients/pricing/xai.ts +62 -0
  27. package/src/clients/types.ts +170 -1
  28. package/src/clients/xai.ts +275 -46
  29. package/src/config.ts +61 -15
  30. package/src/embeddings.ts +9 -1
  31. package/src/microphone.ts +15 -16
  32. package/src/migrations.ts +151 -0
  33. package/src/plugins/AgentsMdPlugin.ts +118 -0
  34. package/src/plugins/PluginBase.ts +8 -0
  35. package/src/plugins/downloader/downloader.ts +5 -6
  36. package/src/plugins/embedding.ts +10 -8
  37. package/src/plugins/exec.ts +70 -0
  38. package/src/plugins/github.ts +120 -74
  39. package/src/plugins/language.ts +11 -13
  40. package/src/plugins/plugins.ts +25 -4
  41. package/src/plugins/tmux.ts +132 -0
  42. package/src/plugins/types.ts +1 -0
  43. package/src/plugins/vim.ts +14 -1
  44. package/src/services/AgentSyncFs.ts +417 -0
  45. package/src/services/{AgentSynchronization.ts → AgentSyncKnowhowWeb.ts} +2 -2
  46. package/src/services/EventService.ts +0 -1
  47. package/src/services/KnowhowClient.ts +106 -0
  48. package/src/services/index.ts +4 -2
  49. package/src/types.ts +57 -4
  50. package/src/worker.ts +11 -6
  51. package/tests/manual/modalities/README.md +157 -0
  52. package/tests/manual/modalities/google.modalities.test.ts +335 -0
  53. package/tests/manual/modalities/openai.modalities.test.ts +329 -0
  54. package/tests/manual/modalities/streaming.test.ts +260 -0
  55. package/tests/manual/modalities/xai.modalities.test.ts +307 -0
  56. package/tests/plugins/language/languagePlugin-content-triggers.test.ts +5 -5
  57. package/tests/plugins/language/languagePlugin-integration.test.ts +1 -1
  58. package/tests/plugins/language/languagePlugin.test.ts +17 -8
  59. package/ts_build/package.json +1 -1
  60. package/ts_build/src/agents/base/base.js +1 -1
  61. package/ts_build/src/agents/base/base.js.map +1 -1
  62. package/ts_build/src/agents/developer/developer.js +21 -12
  63. package/ts_build/src/agents/developer/developer.js.map +1 -1
  64. package/ts_build/src/agents/tools/agentCall.js +4 -2
  65. package/ts_build/src/agents/tools/agentCall.js.map +1 -1
  66. package/ts_build/src/agents/tools/executeScript/index.d.ts +1 -1
  67. package/ts_build/src/agents/tools/fileSearch.js +2 -1
  68. package/ts_build/src/agents/tools/fileSearch.js.map +1 -1
  69. package/ts_build/src/agents/tools/github/index.d.ts +1 -1
  70. package/ts_build/src/agents/tools/startAgentTask.d.ts +2 -1
  71. package/ts_build/src/agents/tools/startAgentTask.js +118 -17
  72. package/ts_build/src/agents/tools/startAgentTask.js.map +1 -1
  73. package/ts_build/src/chat/CliChatService.d.ts +4 -0
  74. package/ts_build/src/chat/CliChatService.js +39 -5
  75. package/ts_build/src/chat/CliChatService.js.map +1 -1
  76. package/ts_build/src/chat/modules/AgentModule.d.ts +4 -1
  77. package/ts_build/src/chat/modules/AgentModule.js +49 -11
  78. package/ts_build/src/chat/modules/AgentModule.js.map +1 -1
  79. package/ts_build/src/chat/modules/CustomCommandsModule.d.ts +9 -0
  80. package/ts_build/src/chat/modules/CustomCommandsModule.js +58 -0
  81. package/ts_build/src/chat/modules/CustomCommandsModule.js.map +1 -0
  82. package/ts_build/src/chat/modules/InternalChatModule.d.ts +2 -0
  83. package/ts_build/src/chat/modules/InternalChatModule.js +10 -0
  84. package/ts_build/src/chat/modules/InternalChatModule.js.map +1 -1
  85. package/ts_build/src/chat/modules/ShellCommandModule.d.ts +8 -0
  86. package/ts_build/src/chat/modules/ShellCommandModule.js +83 -0
  87. package/ts_build/src/chat/modules/ShellCommandModule.js.map +1 -0
  88. package/ts_build/src/chat/modules/index.d.ts +1 -0
  89. package/ts_build/src/chat/modules/index.js +3 -1
  90. package/ts_build/src/chat/modules/index.js.map +1 -1
  91. package/ts_build/src/chat/types.d.ts +11 -1
  92. package/ts_build/src/chat.js +16 -13
  93. package/ts_build/src/chat.js.map +1 -1
  94. package/ts_build/src/cli.js +10 -3
  95. package/ts_build/src/cli.js.map +1 -1
  96. package/ts_build/src/clients/anthropic.d.ts +5 -1
  97. package/ts_build/src/clients/anthropic.js +18 -91
  98. package/ts_build/src/clients/anthropic.js.map +1 -1
  99. package/ts_build/src/clients/gemini.d.ts +80 -2
  100. package/ts_build/src/clients/gemini.js +336 -74
  101. package/ts_build/src/clients/gemini.js.map +1 -1
  102. package/ts_build/src/clients/index.d.ts +9 -1
  103. package/ts_build/src/clients/index.js +65 -0
  104. package/ts_build/src/clients/index.js.map +1 -1
  105. package/ts_build/src/clients/knowhow.d.ts +9 -1
  106. package/ts_build/src/clients/knowhow.js +43 -0
  107. package/ts_build/src/clients/knowhow.js.map +1 -1
  108. package/ts_build/src/clients/openai.d.ts +9 -1
  109. package/ts_build/src/clients/openai.js +201 -133
  110. package/ts_build/src/clients/openai.js.map +1 -1
  111. package/ts_build/src/clients/pricing/anthropic.d.ts +17 -0
  112. package/ts_build/src/clients/pricing/anthropic.js +93 -0
  113. package/ts_build/src/clients/pricing/anthropic.js.map +1 -0
  114. package/ts_build/src/clients/pricing/google.d.ts +73 -0
  115. package/ts_build/src/clients/pricing/google.js +68 -0
  116. package/ts_build/src/clients/pricing/google.js.map +1 -0
  117. package/ts_build/src/clients/pricing/index.d.ts +4 -0
  118. package/ts_build/src/clients/pricing/index.js +14 -0
  119. package/ts_build/src/clients/pricing/index.js.map +1 -0
  120. package/ts_build/src/clients/pricing/openai.d.ts +7 -0
  121. package/ts_build/src/clients/pricing/openai.js +137 -0
  122. package/ts_build/src/clients/pricing/openai.js.map +1 -0
  123. package/ts_build/src/clients/pricing/xai.d.ts +26 -0
  124. package/ts_build/src/clients/pricing/xai.js +59 -0
  125. package/ts_build/src/clients/pricing/xai.js.map +1 -0
  126. package/ts_build/src/clients/types.d.ts +135 -0
  127. package/ts_build/src/clients/xai.d.ts +9 -1
  128. package/ts_build/src/clients/xai.js +178 -46
  129. package/ts_build/src/clients/xai.js.map +1 -1
  130. package/ts_build/src/config.d.ts +1 -0
  131. package/ts_build/src/config.js +45 -16
  132. package/ts_build/src/config.js.map +1 -1
  133. package/ts_build/src/embeddings.js +8 -1
  134. package/ts_build/src/embeddings.js.map +1 -1
  135. package/ts_build/src/microphone.js +7 -9
  136. package/ts_build/src/microphone.js.map +1 -1
  137. package/ts_build/src/migrations.d.ts +17 -0
  138. package/ts_build/src/migrations.js +86 -0
  139. package/ts_build/src/migrations.js.map +1 -0
  140. package/ts_build/src/plugins/AgentsMdPlugin.d.ts +13 -0
  141. package/ts_build/src/plugins/AgentsMdPlugin.js +118 -0
  142. package/ts_build/src/plugins/AgentsMdPlugin.js.map +1 -0
  143. package/ts_build/src/plugins/PluginBase.d.ts +1 -0
  144. package/ts_build/src/plugins/PluginBase.js +3 -0
  145. package/ts_build/src/plugins/PluginBase.js.map +1 -1
  146. package/ts_build/src/plugins/downloader/downloader.js +5 -5
  147. package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
  148. package/ts_build/src/plugins/embedding.js +9 -8
  149. package/ts_build/src/plugins/embedding.js.map +1 -1
  150. package/ts_build/src/plugins/exec.d.ts +10 -0
  151. package/ts_build/src/plugins/exec.js +56 -0
  152. package/ts_build/src/plugins/exec.js.map +1 -0
  153. package/ts_build/src/plugins/github.js +93 -51
  154. package/ts_build/src/plugins/github.js.map +1 -1
  155. package/ts_build/src/plugins/language.js +14 -11
  156. package/ts_build/src/plugins/language.js.map +1 -1
  157. package/ts_build/src/plugins/plugins.d.ts +1 -0
  158. package/ts_build/src/plugins/plugins.js +19 -1
  159. package/ts_build/src/plugins/plugins.js.map +1 -1
  160. package/ts_build/src/plugins/tmux.d.ts +14 -0
  161. package/ts_build/src/plugins/tmux.js +108 -0
  162. package/ts_build/src/plugins/tmux.js.map +1 -0
  163. package/ts_build/src/plugins/types.d.ts +1 -0
  164. package/ts_build/src/plugins/vim.js +11 -1
  165. package/ts_build/src/plugins/vim.js.map +1 -1
  166. package/ts_build/src/services/AgentSyncFs.d.ts +34 -0
  167. package/ts_build/src/services/AgentSyncFs.js +325 -0
  168. package/ts_build/src/services/AgentSyncFs.js.map +1 -0
  169. package/ts_build/src/services/AgentSyncKnowhowWeb.d.ts +29 -0
  170. package/ts_build/src/services/AgentSyncKnowhowWeb.js +178 -0
  171. package/ts_build/src/services/AgentSyncKnowhowWeb.js.map +1 -0
  172. package/ts_build/src/services/AgentSynchronization.d.ts +1 -1
  173. package/ts_build/src/services/AgentSynchronization.js +3 -3
  174. package/ts_build/src/services/AgentSynchronization.js.map +1 -1
  175. package/ts_build/src/services/EventService.js.map +1 -1
  176. package/ts_build/src/services/KnowhowClient.d.ts +9 -1
  177. package/ts_build/src/services/KnowhowClient.js +58 -0
  178. package/ts_build/src/services/KnowhowClient.js.map +1 -1
  179. package/ts_build/src/services/index.d.ts +2 -1
  180. package/ts_build/src/services/index.js +2 -1
  181. package/ts_build/src/services/index.js.map +1 -1
  182. package/ts_build/src/types.d.ts +26 -1
  183. package/ts_build/src/types.js +45 -4
  184. package/ts_build/src/types.js.map +1 -1
  185. package/ts_build/src/utils/PersistentInputManager.d.ts +28 -0
  186. package/ts_build/src/utils/PersistentInputManager.js +293 -0
  187. package/ts_build/src/utils/PersistentInputManager.js.map +1 -0
  188. package/ts_build/src/worker.js +2 -2
  189. package/ts_build/src/worker.js.map +1 -1
  190. package/ts_build/tests/manual/modalities/google.modalities.test.d.ts +1 -0
  191. package/ts_build/tests/manual/modalities/google.modalities.test.js +252 -0
  192. package/ts_build/tests/manual/modalities/google.modalities.test.js.map +1 -0
  193. package/ts_build/tests/manual/modalities/openai.modalities.test.d.ts +1 -0
  194. package/ts_build/tests/manual/modalities/openai.modalities.test.js +252 -0
  195. package/ts_build/tests/manual/modalities/openai.modalities.test.js.map +1 -0
  196. package/ts_build/tests/manual/modalities/streaming.test.d.ts +1 -0
  197. package/ts_build/tests/manual/modalities/streaming.test.js +206 -0
  198. package/ts_build/tests/manual/modalities/streaming.test.js.map +1 -0
  199. package/ts_build/tests/manual/modalities/xai.modalities.test.d.ts +1 -0
  200. package/ts_build/tests/manual/modalities/xai.modalities.test.js +226 -0
  201. package/ts_build/tests/manual/modalities/xai.modalities.test.js.map +1 -0
  202. package/ts_build/tests/manual/persistent-input-test.d.ts +1 -0
  203. package/ts_build/tests/manual/persistent-input-test.js +35 -0
  204. package/ts_build/tests/manual/persistent-input-test.js.map +1 -0
  205. package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js +5 -5
  206. package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js.map +1 -1
  207. package/ts_build/tests/plugins/language/languagePlugin-integration.test.js +1 -1
  208. package/ts_build/tests/plugins/language/languagePlugin-integration.test.js.map +1 -1
  209. package/ts_build/tests/plugins/language/languagePlugin.test.js +17 -7
  210. package/ts_build/tests/plugins/language/languagePlugin.test.js.map +1 -1
@@ -1,5 +1,6 @@
1
1
  import Anthropic from "@anthropic-ai/sdk";
2
2
  import { wait } from "../utils";
3
+ import { AnthropicTextPricing } from "./pricing";
3
4
  import { Models } from "../types";
4
5
  import {
5
6
  GenericClient,
@@ -9,6 +10,14 @@ import {
9
10
  Message,
10
11
  EmbeddingOptions,
11
12
  EmbeddingResponse,
13
+ AudioTranscriptionOptions,
14
+ AudioTranscriptionResponse,
15
+ AudioGenerationOptions,
16
+ AudioGenerationResponse,
17
+ ImageGenerationOptions,
18
+ ImageGenerationResponse,
19
+ VideoGenerationOptions,
20
+ VideoGenerationResponse,
12
21
  } from "./types";
13
22
 
14
23
  type MessageParam = Anthropic.MessageParam;
@@ -340,7 +349,7 @@ export class GenericAnthropicClient implements GenericClient {
340
349
  },
341
350
  ]
342
351
  : undefined,
343
- max_tokens: options.max_tokens || 4096,
352
+ max_tokens: options.max_tokens || 8000,
344
353
  ...(tools.length && {
345
354
  tool_choice: { type: "auto" },
346
355
  tools,
@@ -398,98 +407,14 @@ export class GenericAnthropicClient implements GenericClient {
398
407
  }
399
408
 
400
409
  pricesPerMillion() {
401
- return {
402
- [Models.anthropic.Opus4_6]: {
403
- input: 5.0,
404
- input_gt_200k: 10.0,
405
- cache_write: 6.25,
406
- cache_hit: 0.5,
407
- output: 25.0,
408
- output_gt_200k: 37.5,
409
- },
410
- [Models.anthropic.Sonnet4_6]: {
411
- input: 3.0,
412
- input_gt_200k: 6.0,
413
- cache_write: 3.75,
414
- cache_hit: 0.3,
415
- output: 15.0,
416
- output_gt_200k: 22.5,
417
- },
418
- [Models.anthropic.Opus4_5]: {
419
- input: 5.0,
420
- cache_write: 6.25,
421
- cache_hit: 0.5,
422
- output: 25.0,
423
- },
424
- [Models.anthropic.Opus4_1]: {
425
- input: 15.0,
426
- cache_write: 18.75,
427
- cache_hit: 1.5,
428
- output: 75.0,
429
- },
430
- [Models.anthropic.Opus4]: {
431
- input: 15.0,
432
- cache_write: 18.75,
433
- cache_hit: 1.5,
434
- output: 75.0,
435
- },
436
- [Models.anthropic.Sonnet4]: {
437
- input: 3.0,
438
- input_gt_200k: 6.0,
439
- cache_write: 3.75,
440
- cache_hit: 0.3,
441
- output: 15.0,
442
- output_gt_200k: 22.5,
443
- },
444
- [Models.anthropic.Sonnet4_5]: {
445
- input: 3.0,
446
- input_gt_200k: 6.0,
447
- cache_write: 3.75,
448
- cache_hit: 0.3,
449
- output: 15.0,
450
- output_gt_200k: 22.5,
451
- },
452
- [Models.anthropic.Haiku4_5]: {
453
- input: 1,
454
- cache_write: 1.25,
455
- cache_hit: 0.1,
456
- output: 5,
457
- },
458
- [Models.anthropic.Sonnet3_7]: {
459
- input: 3.0,
460
- cache_write: 3.75,
461
- cache_hit: 0.3,
462
- output: 15.0,
463
- },
464
- [Models.anthropic.Sonnet3_5]: {
465
- input: 3.0,
466
- cache_write: 3.75,
467
- cache_hit: 0.3,
468
- output: 15.0,
469
- },
470
- [Models.anthropic.Haiku3_5]: {
471
- input: 0.8,
472
- cache_write: 1.0,
473
- cache_hit: 0.08,
474
- output: 4.0,
475
- },
476
- [Models.anthropic.Opus3]: {
477
- input: 15.0,
478
- cache_write: 18.75,
479
- cache_hit: 1.5,
480
- output: 75.0,
481
- },
482
- [Models.anthropic.Haiku3]: {
483
- input: 0.25,
484
- cache_write: 0.3125,
485
- cache_hit: 0.025,
486
- output: 1.25,
487
- },
488
- };
410
+ return AnthropicTextPricing;
489
411
  }
490
412
 
491
413
  calculateCost(model: string, usage: Usage): number | undefined {
492
- const p = this.pricesPerMillion()[model];
414
+ const rawP = this.pricesPerMillion()[model];
415
+ // Fall back to pricing file for unknown/newer models
416
+ const fallback = AnthropicTextPricing[model as keyof typeof AnthropicTextPricing];
417
+ const p: any = rawP || fallback || undefined;
493
418
  if (!p) return undefined;
494
419
 
495
420
  const inputTokens = usage.input_tokens ?? 0;
@@ -532,4 +457,30 @@ export class GenericAnthropicClient implements GenericClient {
532
457
  async createEmbedding(options: EmbeddingOptions): Promise<EmbeddingResponse> {
533
458
  throw new Error("Provider does not support embeddings");
534
459
  }
460
+
461
+ async createAudioTranscription(
462
+ options: AudioTranscriptionOptions
463
+ ): Promise<AudioTranscriptionResponse> {
464
+ throw new Error("Anthropic does not support audio transcription");
465
+ }
466
+
467
+ async createAudioGeneration(
468
+ options: AudioGenerationOptions
469
+ ): Promise<AudioGenerationResponse> {
470
+ throw new Error("Anthropic does not support audio generation");
471
+ }
472
+
473
+ async createImageGeneration(
474
+ options: ImageGenerationOptions
475
+ ): Promise<ImageGenerationResponse> {
476
+ throw new Error("Anthropic does not support image generation");
477
+ }
478
+
479
+ async createVideoGeneration(
480
+ options: VideoGenerationOptions
481
+ ): Promise<VideoGenerationResponse> {
482
+ throw new Error(
483
+ "Video generation is not supported by the Anthropic provider."
484
+ );
485
+ }
535
486
  }