@tyvm/knowhow 0.0.69 → 0.0.71

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 (214) hide show
  1. package/docs/shell-commands.md +174 -0
  2. package/package.json +1 -1
  3. package/src/agents/base/base.ts +4 -5
  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/agents/tools/stringReplace.ts +42 -12
  9. package/src/chat/CliChatService.ts +57 -11
  10. package/src/chat/modules/AgentModule.ts +72 -12
  11. package/src/chat/modules/CustomCommandsModule.ts +79 -0
  12. package/src/chat/modules/InternalChatModule.ts +11 -1
  13. package/src/chat/modules/ShellCommandModule.ts +96 -0
  14. package/src/chat/modules/index.ts +1 -0
  15. package/src/chat/types.ts +14 -2
  16. package/src/chat.ts +16 -13
  17. package/src/cli.ts +16 -6
  18. package/src/clients/anthropic.ts +82 -112
  19. package/src/clients/gemini.ts +445 -87
  20. package/src/clients/index.ts +125 -0
  21. package/src/clients/knowhow.ts +81 -0
  22. package/src/clients/openai.ts +256 -145
  23. package/src/clients/pricing/anthropic.ts +90 -0
  24. package/src/clients/pricing/google.ts +65 -0
  25. package/src/clients/pricing/index.ts +4 -0
  26. package/src/clients/pricing/openai.ts +134 -0
  27. package/src/clients/pricing/xai.ts +62 -0
  28. package/src/clients/types.ts +170 -1
  29. package/src/clients/xai.ts +275 -46
  30. package/src/config.ts +61 -15
  31. package/src/embeddings.ts +9 -1
  32. package/src/microphone.ts +15 -16
  33. package/src/migrations.ts +151 -0
  34. package/src/plugins/AgentsMdPlugin.ts +118 -0
  35. package/src/plugins/PluginBase.ts +8 -0
  36. package/src/plugins/downloader/downloader.ts +5 -6
  37. package/src/plugins/embedding.ts +10 -8
  38. package/src/plugins/exec.ts +70 -0
  39. package/src/plugins/github.ts +120 -74
  40. package/src/plugins/language.ts +11 -13
  41. package/src/plugins/plugins.ts +25 -4
  42. package/src/plugins/tmux.ts +132 -0
  43. package/src/plugins/types.ts +1 -0
  44. package/src/plugins/vim.ts +14 -1
  45. package/src/services/AgentSyncFs.ts +417 -0
  46. package/src/services/{AgentSynchronization.ts → AgentSyncKnowhowWeb.ts} +2 -2
  47. package/src/services/EventService.ts +0 -1
  48. package/src/services/KnowhowClient.ts +106 -0
  49. package/src/services/index.ts +4 -2
  50. package/src/types.ts +57 -4
  51. package/src/worker.ts +11 -6
  52. package/tests/manual/modalities/README.md +157 -0
  53. package/tests/manual/modalities/google.modalities.test.ts +335 -0
  54. package/tests/manual/modalities/openai.modalities.test.ts +329 -0
  55. package/tests/manual/modalities/streaming.test.ts +260 -0
  56. package/tests/manual/modalities/xai.modalities.test.ts +307 -0
  57. package/tests/plugins/language/languagePlugin-content-triggers.test.ts +5 -5
  58. package/tests/plugins/language/languagePlugin-integration.test.ts +1 -1
  59. package/tests/plugins/language/languagePlugin.test.ts +17 -8
  60. package/ts_build/package.json +1 -1
  61. package/ts_build/src/agents/base/base.d.ts +3 -3
  62. package/ts_build/src/agents/base/base.js +1 -1
  63. package/ts_build/src/agents/base/base.js.map +1 -1
  64. package/ts_build/src/agents/developer/developer.js +21 -12
  65. package/ts_build/src/agents/developer/developer.js.map +1 -1
  66. package/ts_build/src/agents/tools/agentCall.js +4 -2
  67. package/ts_build/src/agents/tools/agentCall.js.map +1 -1
  68. package/ts_build/src/agents/tools/executeScript/index.d.ts +1 -1
  69. package/ts_build/src/agents/tools/fileSearch.js +2 -1
  70. package/ts_build/src/agents/tools/fileSearch.js.map +1 -1
  71. package/ts_build/src/agents/tools/github/index.d.ts +1 -1
  72. package/ts_build/src/agents/tools/startAgentTask.d.ts +2 -1
  73. package/ts_build/src/agents/tools/startAgentTask.js +118 -17
  74. package/ts_build/src/agents/tools/startAgentTask.js.map +1 -1
  75. package/ts_build/src/agents/tools/stringReplace.js +29 -12
  76. package/ts_build/src/agents/tools/stringReplace.js.map +1 -1
  77. package/ts_build/src/chat/CliChatService.d.ts +4 -0
  78. package/ts_build/src/chat/CliChatService.js +39 -5
  79. package/ts_build/src/chat/CliChatService.js.map +1 -1
  80. package/ts_build/src/chat/modules/AgentModule.d.ts +4 -1
  81. package/ts_build/src/chat/modules/AgentModule.js +49 -11
  82. package/ts_build/src/chat/modules/AgentModule.js.map +1 -1
  83. package/ts_build/src/chat/modules/CustomCommandsModule.d.ts +9 -0
  84. package/ts_build/src/chat/modules/CustomCommandsModule.js +58 -0
  85. package/ts_build/src/chat/modules/CustomCommandsModule.js.map +1 -0
  86. package/ts_build/src/chat/modules/InternalChatModule.d.ts +2 -0
  87. package/ts_build/src/chat/modules/InternalChatModule.js +10 -0
  88. package/ts_build/src/chat/modules/InternalChatModule.js.map +1 -1
  89. package/ts_build/src/chat/modules/ShellCommandModule.d.ts +8 -0
  90. package/ts_build/src/chat/modules/ShellCommandModule.js +83 -0
  91. package/ts_build/src/chat/modules/ShellCommandModule.js.map +1 -0
  92. package/ts_build/src/chat/modules/index.d.ts +1 -0
  93. package/ts_build/src/chat/modules/index.js +3 -1
  94. package/ts_build/src/chat/modules/index.js.map +1 -1
  95. package/ts_build/src/chat/types.d.ts +11 -1
  96. package/ts_build/src/chat.js +16 -13
  97. package/ts_build/src/chat.js.map +1 -1
  98. package/ts_build/src/cli.js +10 -3
  99. package/ts_build/src/cli.js.map +1 -1
  100. package/ts_build/src/clients/anthropic.d.ts +5 -1
  101. package/ts_build/src/clients/anthropic.js +61 -112
  102. package/ts_build/src/clients/anthropic.js.map +1 -1
  103. package/ts_build/src/clients/gemini.d.ts +80 -2
  104. package/ts_build/src/clients/gemini.js +336 -74
  105. package/ts_build/src/clients/gemini.js.map +1 -1
  106. package/ts_build/src/clients/index.d.ts +9 -1
  107. package/ts_build/src/clients/index.js +65 -0
  108. package/ts_build/src/clients/index.js.map +1 -1
  109. package/ts_build/src/clients/knowhow.d.ts +9 -1
  110. package/ts_build/src/clients/knowhow.js +43 -0
  111. package/ts_build/src/clients/knowhow.js.map +1 -1
  112. package/ts_build/src/clients/openai.d.ts +9 -1
  113. package/ts_build/src/clients/openai.js +201 -133
  114. package/ts_build/src/clients/openai.js.map +1 -1
  115. package/ts_build/src/clients/pricing/anthropic.d.ts +17 -0
  116. package/ts_build/src/clients/pricing/anthropic.js +93 -0
  117. package/ts_build/src/clients/pricing/anthropic.js.map +1 -0
  118. package/ts_build/src/clients/pricing/google.d.ts +73 -0
  119. package/ts_build/src/clients/pricing/google.js +68 -0
  120. package/ts_build/src/clients/pricing/google.js.map +1 -0
  121. package/ts_build/src/clients/pricing/index.d.ts +4 -0
  122. package/ts_build/src/clients/pricing/index.js +14 -0
  123. package/ts_build/src/clients/pricing/index.js.map +1 -0
  124. package/ts_build/src/clients/pricing/openai.d.ts +7 -0
  125. package/ts_build/src/clients/pricing/openai.js +137 -0
  126. package/ts_build/src/clients/pricing/openai.js.map +1 -0
  127. package/ts_build/src/clients/pricing/xai.d.ts +26 -0
  128. package/ts_build/src/clients/pricing/xai.js +59 -0
  129. package/ts_build/src/clients/pricing/xai.js.map +1 -0
  130. package/ts_build/src/clients/types.d.ts +135 -0
  131. package/ts_build/src/clients/xai.d.ts +9 -1
  132. package/ts_build/src/clients/xai.js +178 -46
  133. package/ts_build/src/clients/xai.js.map +1 -1
  134. package/ts_build/src/config.d.ts +1 -0
  135. package/ts_build/src/config.js +45 -16
  136. package/ts_build/src/config.js.map +1 -1
  137. package/ts_build/src/embeddings.js +8 -1
  138. package/ts_build/src/embeddings.js.map +1 -1
  139. package/ts_build/src/microphone.js +7 -9
  140. package/ts_build/src/microphone.js.map +1 -1
  141. package/ts_build/src/migrations.d.ts +17 -0
  142. package/ts_build/src/migrations.js +86 -0
  143. package/ts_build/src/migrations.js.map +1 -0
  144. package/ts_build/src/plugins/AgentsMdPlugin.d.ts +13 -0
  145. package/ts_build/src/plugins/AgentsMdPlugin.js +118 -0
  146. package/ts_build/src/plugins/AgentsMdPlugin.js.map +1 -0
  147. package/ts_build/src/plugins/PluginBase.d.ts +1 -0
  148. package/ts_build/src/plugins/PluginBase.js +3 -0
  149. package/ts_build/src/plugins/PluginBase.js.map +1 -1
  150. package/ts_build/src/plugins/downloader/downloader.js +5 -5
  151. package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
  152. package/ts_build/src/plugins/embedding.js +9 -8
  153. package/ts_build/src/plugins/embedding.js.map +1 -1
  154. package/ts_build/src/plugins/exec.d.ts +10 -0
  155. package/ts_build/src/plugins/exec.js +56 -0
  156. package/ts_build/src/plugins/exec.js.map +1 -0
  157. package/ts_build/src/plugins/github.js +93 -51
  158. package/ts_build/src/plugins/github.js.map +1 -1
  159. package/ts_build/src/plugins/language.js +14 -11
  160. package/ts_build/src/plugins/language.js.map +1 -1
  161. package/ts_build/src/plugins/plugins.d.ts +1 -0
  162. package/ts_build/src/plugins/plugins.js +19 -1
  163. package/ts_build/src/plugins/plugins.js.map +1 -1
  164. package/ts_build/src/plugins/tmux.d.ts +14 -0
  165. package/ts_build/src/plugins/tmux.js +108 -0
  166. package/ts_build/src/plugins/tmux.js.map +1 -0
  167. package/ts_build/src/plugins/types.d.ts +1 -0
  168. package/ts_build/src/plugins/vim.js +11 -1
  169. package/ts_build/src/plugins/vim.js.map +1 -1
  170. package/ts_build/src/services/AgentSyncFs.d.ts +34 -0
  171. package/ts_build/src/services/AgentSyncFs.js +325 -0
  172. package/ts_build/src/services/AgentSyncFs.js.map +1 -0
  173. package/ts_build/src/services/AgentSyncKnowhowWeb.d.ts +29 -0
  174. package/ts_build/src/services/AgentSyncKnowhowWeb.js +178 -0
  175. package/ts_build/src/services/AgentSyncKnowhowWeb.js.map +1 -0
  176. package/ts_build/src/services/AgentSynchronization.d.ts +1 -1
  177. package/ts_build/src/services/AgentSynchronization.js +3 -3
  178. package/ts_build/src/services/AgentSynchronization.js.map +1 -1
  179. package/ts_build/src/services/EventService.js.map +1 -1
  180. package/ts_build/src/services/KnowhowClient.d.ts +9 -1
  181. package/ts_build/src/services/KnowhowClient.js +58 -0
  182. package/ts_build/src/services/KnowhowClient.js.map +1 -1
  183. package/ts_build/src/services/index.d.ts +2 -1
  184. package/ts_build/src/services/index.js +2 -1
  185. package/ts_build/src/services/index.js.map +1 -1
  186. package/ts_build/src/types.d.ts +26 -1
  187. package/ts_build/src/types.js +45 -4
  188. package/ts_build/src/types.js.map +1 -1
  189. package/ts_build/src/utils/PersistentInputManager.d.ts +28 -0
  190. package/ts_build/src/utils/PersistentInputManager.js +293 -0
  191. package/ts_build/src/utils/PersistentInputManager.js.map +1 -0
  192. package/ts_build/src/worker.js +2 -2
  193. package/ts_build/src/worker.js.map +1 -1
  194. package/ts_build/tests/manual/modalities/google.modalities.test.d.ts +1 -0
  195. package/ts_build/tests/manual/modalities/google.modalities.test.js +252 -0
  196. package/ts_build/tests/manual/modalities/google.modalities.test.js.map +1 -0
  197. package/ts_build/tests/manual/modalities/openai.modalities.test.d.ts +1 -0
  198. package/ts_build/tests/manual/modalities/openai.modalities.test.js +252 -0
  199. package/ts_build/tests/manual/modalities/openai.modalities.test.js.map +1 -0
  200. package/ts_build/tests/manual/modalities/streaming.test.d.ts +1 -0
  201. package/ts_build/tests/manual/modalities/streaming.test.js +206 -0
  202. package/ts_build/tests/manual/modalities/streaming.test.js.map +1 -0
  203. package/ts_build/tests/manual/modalities/xai.modalities.test.d.ts +1 -0
  204. package/ts_build/tests/manual/modalities/xai.modalities.test.js +226 -0
  205. package/ts_build/tests/manual/modalities/xai.modalities.test.js.map +1 -0
  206. package/ts_build/tests/manual/persistent-input-test.d.ts +1 -0
  207. package/ts_build/tests/manual/persistent-input-test.js +35 -0
  208. package/ts_build/tests/manual/persistent-input-test.js.map +1 -0
  209. package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js +5 -5
  210. package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js.map +1 -1
  211. package/ts_build/tests/plugins/language/languagePlugin-integration.test.js +1 -1
  212. package/ts_build/tests/plugins/language/languagePlugin-integration.test.js.map +1 -1
  213. package/ts_build/tests/plugins/language/languagePlugin.test.js +17 -7
  214. package/ts_build/tests/plugins/language/languagePlugin.test.js.map +1 -1
package/src/cli.ts CHANGED
@@ -7,7 +7,7 @@ import { Command } from "commander";
7
7
  import { execSync } from "child_process";
8
8
  import { version } from "../package.json";
9
9
  import { generate, embed, upload } from "./index";
10
- import { init } from "./config";
10
+ import { init, migrateConfig } from "./config";
11
11
 
12
12
  import { download, purge } from ".";
13
13
  import { includedTools } from "./agents/tools/list";
@@ -26,6 +26,7 @@ import { startChat } from "./chat";
26
26
  import { askAI } from "./chat-old";
27
27
  import { getConfiguredEmbeddingMap, queryEmbedding } from "./embeddings";
28
28
  import { getConfig } from "./config";
29
+ import { getEnabledPlugins } from "./types";
29
30
  import { marked } from "marked";
30
31
  import { BaseAgent } from "./agents/base/base";
31
32
  import { AskModule } from "./chat/modules/AskModule";
@@ -36,9 +37,16 @@ import { SetupModule } from "./chat/modules/SetupModule";
36
37
  import { CliChatService } from "./chat/CliChatService";
37
38
 
38
39
  async function setupServices() {
39
- const { Agents, Mcp, Clients } = services();
40
+ await migrateConfig();
41
+
42
+ const { Agents, Mcp, Clients, Tools: OldTools } = services();
40
43
  const Tools = new LazyToolsService();
41
44
 
45
+ // We need to wireup the LazyTools to be connected to the same singletons that are in services()
46
+ Tools.setContext({
47
+ ...OldTools.getContext(),
48
+ });
49
+
42
50
  const { Researcher, Developer, Patcher, Setup } = agents({
43
51
  ...services(),
44
52
  Tools,
@@ -85,7 +93,7 @@ async function readStdin(): Promise<string> {
85
93
  async function main() {
86
94
  const program = new Command();
87
95
  const config = await getConfig();
88
- const chatService = new CliChatService(config.plugins);
96
+ const chatService = new CliChatService(getEnabledPlugins(config.plugins));
89
97
 
90
98
  program
91
99
  .name("knowhow")
@@ -114,13 +122,13 @@ async function main() {
114
122
  try {
115
123
  console.log("🔄 Checking for knowhow updates...");
116
124
  console.log(`Current version: ${version}`);
117
-
125
+
118
126
  console.log("📦 Installing latest version from npm...");
119
127
  execSync("npm install -g knowhow@latest", {
120
128
  stdio: "inherit",
121
129
  encoding: "utf-8",
122
130
  });
123
-
131
+
124
132
  console.log("✓ knowhow has been updated successfully!");
125
133
  console.log("Run 'knowhow --version' to see the new version.");
126
134
  } catch (error) {
@@ -195,6 +203,8 @@ async function main() {
195
203
  "10"
196
204
  )
197
205
  .option("--message-id <messageId>", "Knowhow message ID for task tracking")
206
+ .option("--sync-fs", "Enable filesystem-based synchronization")
207
+ .option("--task-id <taskId>", "Pre-generated task ID (used with --sync-fs for predictable agent directory path)")
198
208
  .option("--prompt-file <path>", "Custom prompt template file with {text}")
199
209
  .option("--input <text>", "Task input (fallback to stdin if not provided)")
200
210
  .action(async (options) => {
@@ -255,7 +265,7 @@ async function main() {
255
265
  const askModule = new AskModule();
256
266
  await askModule.initialize(chatService);
257
267
  await askModule.processAIQuery(input, {
258
- plugins: config.plugins,
268
+ plugins: config.plugins.enabled,
259
269
  currentModel: options.model,
260
270
  currentProvider: options.provider,
261
271
  });
@@ -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;
@@ -234,19 +243,29 @@ export class GenericAnthropicClient implements GenericClient {
234
243
  if (item.type === "image_url") {
235
244
  const url = item.image_url.url;
236
245
  const isDataUrl = url.startsWith("data:");
237
- const base64Data = isDataUrl ? url.split(",")[1] : url;
238
- const mediaType = isDataUrl
239
- ? url.match(/data:([^;]+);/)?.[1] || "image/jpeg"
240
- : "image/jpeg";
241
-
242
- return {
243
- type: "image" as const,
244
- source: {
245
- type: "base64" as const,
246
- media_type: mediaType as any,
247
- data: base64Data,
248
- },
249
- };
246
+ const isHttpUrl = url.startsWith("http");
247
+ if (isHttpUrl) {
248
+ return {
249
+ type: "image" as const,
250
+ source: {
251
+ type: "url" as const,
252
+ url,
253
+ },
254
+ } as Anthropic.ImageBlockParam;
255
+ } else {
256
+ const base64Data = isDataUrl ? url.split(",")[1] : url;
257
+ const mediaType = isDataUrl
258
+ ? url.match(/data:([^;]+);/)?.[1] || "image/jpeg"
259
+ : "image/jpeg";
260
+ return {
261
+ type: "image" as const,
262
+ source: {
263
+ type: "base64" as const,
264
+ media_type: mediaType as any,
265
+ data: base64Data,
266
+ },
267
+ };
268
+ }
250
269
  } else if (item.type === "text") {
251
270
  return { type: "text" as const, text: item.text };
252
271
  }
@@ -299,15 +318,24 @@ export class GenericAnthropicClient implements GenericClient {
299
318
  }
300
319
  if (typeof e === "object" && e.type === "image_url") {
301
320
  const isUrl = e.image_url.url.startsWith("http");
302
- return {
303
- type: "image",
304
- source: {
305
- data: isUrl ? e.image_url.url : undefined,
306
- media_type: "image/jpeg",
307
- type: isUrl ? ("url" as const) : ("base64" as const),
308
- url: isUrl ? e.image_url.url : undefined,
309
- },
310
- };
321
+ if (isUrl) {
322
+ return {
323
+ type: "image",
324
+ source: {
325
+ type: "url" as const,
326
+ url: e.image_url.url,
327
+ },
328
+ } as Anthropic.ContentBlockParam;
329
+ } else {
330
+ return {
331
+ type: "image",
332
+ source: {
333
+ type: "base64" as const,
334
+ media_type: "image/jpeg",
335
+ data: e.image_url.url,
336
+ },
337
+ } as Anthropic.ContentBlockParam;
338
+ }
311
339
  }
312
340
  };
313
341
 
@@ -340,7 +368,7 @@ export class GenericAnthropicClient implements GenericClient {
340
368
  },
341
369
  ]
342
370
  : undefined,
343
- max_tokens: options.max_tokens || 4096,
371
+ max_tokens: options.max_tokens || 8000,
344
372
  ...(tools.length && {
345
373
  tool_choice: { type: "auto" },
346
374
  tools,
@@ -398,98 +426,14 @@ export class GenericAnthropicClient implements GenericClient {
398
426
  }
399
427
 
400
428
  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
- };
429
+ return AnthropicTextPricing;
489
430
  }
490
431
 
491
432
  calculateCost(model: string, usage: Usage): number | undefined {
492
- const p = this.pricesPerMillion()[model];
433
+ const rawP = this.pricesPerMillion()[model];
434
+ // Fall back to pricing file for unknown/newer models
435
+ const fallback = AnthropicTextPricing[model as keyof typeof AnthropicTextPricing];
436
+ const p: any = rawP || fallback || undefined;
493
437
  if (!p) return undefined;
494
438
 
495
439
  const inputTokens = usage.input_tokens ?? 0;
@@ -532,4 +476,30 @@ export class GenericAnthropicClient implements GenericClient {
532
476
  async createEmbedding(options: EmbeddingOptions): Promise<EmbeddingResponse> {
533
477
  throw new Error("Provider does not support embeddings");
534
478
  }
479
+
480
+ async createAudioTranscription(
481
+ options: AudioTranscriptionOptions
482
+ ): Promise<AudioTranscriptionResponse> {
483
+ throw new Error("Anthropic does not support audio transcription");
484
+ }
485
+
486
+ async createAudioGeneration(
487
+ options: AudioGenerationOptions
488
+ ): Promise<AudioGenerationResponse> {
489
+ throw new Error("Anthropic does not support audio generation");
490
+ }
491
+
492
+ async createImageGeneration(
493
+ options: ImageGenerationOptions
494
+ ): Promise<ImageGenerationResponse> {
495
+ throw new Error("Anthropic does not support image generation");
496
+ }
497
+
498
+ async createVideoGeneration(
499
+ options: VideoGenerationOptions
500
+ ): Promise<VideoGenerationResponse> {
501
+ throw new Error(
502
+ "Video generation is not supported by the Anthropic provider."
503
+ );
504
+ }
535
505
  }