@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.
- package/docs/shell-commands.md +174 -0
- package/package.json +1 -1
- package/src/agents/base/base.ts +1 -3
- package/src/agents/developer/developer.ts +21 -13
- package/src/agents/tools/agentCall.ts +4 -2
- package/src/agents/tools/fileSearch.ts +5 -1
- package/src/agents/tools/startAgentTask.ts +131 -22
- package/src/chat/CliChatService.ts +57 -11
- package/src/chat/modules/AgentModule.ts +72 -12
- package/src/chat/modules/CustomCommandsModule.ts +79 -0
- package/src/chat/modules/InternalChatModule.ts +11 -1
- package/src/chat/modules/ShellCommandModule.ts +96 -0
- package/src/chat/modules/index.ts +1 -0
- package/src/chat/types.ts +14 -2
- package/src/chat.ts +16 -13
- package/src/cli.ts +16 -6
- package/src/clients/anthropic.ts +41 -90
- package/src/clients/gemini.ts +445 -87
- package/src/clients/index.ts +125 -0
- package/src/clients/knowhow.ts +81 -0
- package/src/clients/openai.ts +256 -145
- package/src/clients/pricing/anthropic.ts +90 -0
- package/src/clients/pricing/google.ts +65 -0
- package/src/clients/pricing/index.ts +4 -0
- package/src/clients/pricing/openai.ts +134 -0
- package/src/clients/pricing/xai.ts +62 -0
- package/src/clients/types.ts +170 -1
- package/src/clients/xai.ts +275 -46
- package/src/config.ts +61 -15
- package/src/embeddings.ts +9 -1
- package/src/microphone.ts +15 -16
- package/src/migrations.ts +151 -0
- package/src/plugins/AgentsMdPlugin.ts +118 -0
- package/src/plugins/PluginBase.ts +8 -0
- package/src/plugins/downloader/downloader.ts +5 -6
- package/src/plugins/embedding.ts +10 -8
- package/src/plugins/exec.ts +70 -0
- package/src/plugins/github.ts +120 -74
- package/src/plugins/language.ts +11 -13
- package/src/plugins/plugins.ts +25 -4
- package/src/plugins/tmux.ts +132 -0
- package/src/plugins/types.ts +1 -0
- package/src/plugins/vim.ts +14 -1
- package/src/services/AgentSyncFs.ts +417 -0
- package/src/services/{AgentSynchronization.ts → AgentSyncKnowhowWeb.ts} +2 -2
- package/src/services/EventService.ts +0 -1
- package/src/services/KnowhowClient.ts +106 -0
- package/src/services/index.ts +4 -2
- package/src/types.ts +57 -4
- package/src/worker.ts +11 -6
- package/tests/manual/modalities/README.md +157 -0
- package/tests/manual/modalities/google.modalities.test.ts +335 -0
- package/tests/manual/modalities/openai.modalities.test.ts +329 -0
- package/tests/manual/modalities/streaming.test.ts +260 -0
- package/tests/manual/modalities/xai.modalities.test.ts +307 -0
- package/tests/plugins/language/languagePlugin-content-triggers.test.ts +5 -5
- package/tests/plugins/language/languagePlugin-integration.test.ts +1 -1
- package/tests/plugins/language/languagePlugin.test.ts +17 -8
- package/ts_build/package.json +1 -1
- package/ts_build/src/agents/base/base.js +1 -1
- package/ts_build/src/agents/base/base.js.map +1 -1
- package/ts_build/src/agents/developer/developer.js +21 -12
- package/ts_build/src/agents/developer/developer.js.map +1 -1
- package/ts_build/src/agents/tools/agentCall.js +4 -2
- package/ts_build/src/agents/tools/agentCall.js.map +1 -1
- package/ts_build/src/agents/tools/executeScript/index.d.ts +1 -1
- package/ts_build/src/agents/tools/fileSearch.js +2 -1
- package/ts_build/src/agents/tools/fileSearch.js.map +1 -1
- package/ts_build/src/agents/tools/github/index.d.ts +1 -1
- package/ts_build/src/agents/tools/startAgentTask.d.ts +2 -1
- package/ts_build/src/agents/tools/startAgentTask.js +118 -17
- package/ts_build/src/agents/tools/startAgentTask.js.map +1 -1
- package/ts_build/src/chat/CliChatService.d.ts +4 -0
- package/ts_build/src/chat/CliChatService.js +39 -5
- package/ts_build/src/chat/CliChatService.js.map +1 -1
- package/ts_build/src/chat/modules/AgentModule.d.ts +4 -1
- package/ts_build/src/chat/modules/AgentModule.js +49 -11
- package/ts_build/src/chat/modules/AgentModule.js.map +1 -1
- package/ts_build/src/chat/modules/CustomCommandsModule.d.ts +9 -0
- package/ts_build/src/chat/modules/CustomCommandsModule.js +58 -0
- package/ts_build/src/chat/modules/CustomCommandsModule.js.map +1 -0
- package/ts_build/src/chat/modules/InternalChatModule.d.ts +2 -0
- package/ts_build/src/chat/modules/InternalChatModule.js +10 -0
- package/ts_build/src/chat/modules/InternalChatModule.js.map +1 -1
- package/ts_build/src/chat/modules/ShellCommandModule.d.ts +8 -0
- package/ts_build/src/chat/modules/ShellCommandModule.js +83 -0
- package/ts_build/src/chat/modules/ShellCommandModule.js.map +1 -0
- package/ts_build/src/chat/modules/index.d.ts +1 -0
- package/ts_build/src/chat/modules/index.js +3 -1
- package/ts_build/src/chat/modules/index.js.map +1 -1
- package/ts_build/src/chat/types.d.ts +11 -1
- package/ts_build/src/chat.js +16 -13
- package/ts_build/src/chat.js.map +1 -1
- package/ts_build/src/cli.js +10 -3
- package/ts_build/src/cli.js.map +1 -1
- package/ts_build/src/clients/anthropic.d.ts +5 -1
- package/ts_build/src/clients/anthropic.js +18 -91
- package/ts_build/src/clients/anthropic.js.map +1 -1
- package/ts_build/src/clients/gemini.d.ts +80 -2
- package/ts_build/src/clients/gemini.js +336 -74
- package/ts_build/src/clients/gemini.js.map +1 -1
- package/ts_build/src/clients/index.d.ts +9 -1
- package/ts_build/src/clients/index.js +65 -0
- package/ts_build/src/clients/index.js.map +1 -1
- package/ts_build/src/clients/knowhow.d.ts +9 -1
- package/ts_build/src/clients/knowhow.js +43 -0
- package/ts_build/src/clients/knowhow.js.map +1 -1
- package/ts_build/src/clients/openai.d.ts +9 -1
- package/ts_build/src/clients/openai.js +201 -133
- package/ts_build/src/clients/openai.js.map +1 -1
- package/ts_build/src/clients/pricing/anthropic.d.ts +17 -0
- package/ts_build/src/clients/pricing/anthropic.js +93 -0
- package/ts_build/src/clients/pricing/anthropic.js.map +1 -0
- package/ts_build/src/clients/pricing/google.d.ts +73 -0
- package/ts_build/src/clients/pricing/google.js +68 -0
- package/ts_build/src/clients/pricing/google.js.map +1 -0
- package/ts_build/src/clients/pricing/index.d.ts +4 -0
- package/ts_build/src/clients/pricing/index.js +14 -0
- package/ts_build/src/clients/pricing/index.js.map +1 -0
- package/ts_build/src/clients/pricing/openai.d.ts +7 -0
- package/ts_build/src/clients/pricing/openai.js +137 -0
- package/ts_build/src/clients/pricing/openai.js.map +1 -0
- package/ts_build/src/clients/pricing/xai.d.ts +26 -0
- package/ts_build/src/clients/pricing/xai.js +59 -0
- package/ts_build/src/clients/pricing/xai.js.map +1 -0
- package/ts_build/src/clients/types.d.ts +135 -0
- package/ts_build/src/clients/xai.d.ts +9 -1
- package/ts_build/src/clients/xai.js +178 -46
- package/ts_build/src/clients/xai.js.map +1 -1
- package/ts_build/src/config.d.ts +1 -0
- package/ts_build/src/config.js +45 -16
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/embeddings.js +8 -1
- package/ts_build/src/embeddings.js.map +1 -1
- package/ts_build/src/microphone.js +7 -9
- package/ts_build/src/microphone.js.map +1 -1
- package/ts_build/src/migrations.d.ts +17 -0
- package/ts_build/src/migrations.js +86 -0
- package/ts_build/src/migrations.js.map +1 -0
- package/ts_build/src/plugins/AgentsMdPlugin.d.ts +13 -0
- package/ts_build/src/plugins/AgentsMdPlugin.js +118 -0
- package/ts_build/src/plugins/AgentsMdPlugin.js.map +1 -0
- package/ts_build/src/plugins/PluginBase.d.ts +1 -0
- package/ts_build/src/plugins/PluginBase.js +3 -0
- package/ts_build/src/plugins/PluginBase.js.map +1 -1
- package/ts_build/src/plugins/downloader/downloader.js +5 -5
- package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
- package/ts_build/src/plugins/embedding.js +9 -8
- package/ts_build/src/plugins/embedding.js.map +1 -1
- package/ts_build/src/plugins/exec.d.ts +10 -0
- package/ts_build/src/plugins/exec.js +56 -0
- package/ts_build/src/plugins/exec.js.map +1 -0
- package/ts_build/src/plugins/github.js +93 -51
- package/ts_build/src/plugins/github.js.map +1 -1
- package/ts_build/src/plugins/language.js +14 -11
- package/ts_build/src/plugins/language.js.map +1 -1
- package/ts_build/src/plugins/plugins.d.ts +1 -0
- package/ts_build/src/plugins/plugins.js +19 -1
- package/ts_build/src/plugins/plugins.js.map +1 -1
- package/ts_build/src/plugins/tmux.d.ts +14 -0
- package/ts_build/src/plugins/tmux.js +108 -0
- package/ts_build/src/plugins/tmux.js.map +1 -0
- package/ts_build/src/plugins/types.d.ts +1 -0
- package/ts_build/src/plugins/vim.js +11 -1
- package/ts_build/src/plugins/vim.js.map +1 -1
- package/ts_build/src/services/AgentSyncFs.d.ts +34 -0
- package/ts_build/src/services/AgentSyncFs.js +325 -0
- package/ts_build/src/services/AgentSyncFs.js.map +1 -0
- package/ts_build/src/services/AgentSyncKnowhowWeb.d.ts +29 -0
- package/ts_build/src/services/AgentSyncKnowhowWeb.js +178 -0
- package/ts_build/src/services/AgentSyncKnowhowWeb.js.map +1 -0
- package/ts_build/src/services/AgentSynchronization.d.ts +1 -1
- package/ts_build/src/services/AgentSynchronization.js +3 -3
- package/ts_build/src/services/AgentSynchronization.js.map +1 -1
- package/ts_build/src/services/EventService.js.map +1 -1
- package/ts_build/src/services/KnowhowClient.d.ts +9 -1
- package/ts_build/src/services/KnowhowClient.js +58 -0
- package/ts_build/src/services/KnowhowClient.js.map +1 -1
- package/ts_build/src/services/index.d.ts +2 -1
- package/ts_build/src/services/index.js +2 -1
- package/ts_build/src/services/index.js.map +1 -1
- package/ts_build/src/types.d.ts +26 -1
- package/ts_build/src/types.js +45 -4
- package/ts_build/src/types.js.map +1 -1
- package/ts_build/src/utils/PersistentInputManager.d.ts +28 -0
- package/ts_build/src/utils/PersistentInputManager.js +293 -0
- package/ts_build/src/utils/PersistentInputManager.js.map +1 -0
- package/ts_build/src/worker.js +2 -2
- package/ts_build/src/worker.js.map +1 -1
- package/ts_build/tests/manual/modalities/google.modalities.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/google.modalities.test.js +252 -0
- package/ts_build/tests/manual/modalities/google.modalities.test.js.map +1 -0
- package/ts_build/tests/manual/modalities/openai.modalities.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/openai.modalities.test.js +252 -0
- package/ts_build/tests/manual/modalities/openai.modalities.test.js.map +1 -0
- package/ts_build/tests/manual/modalities/streaming.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/streaming.test.js +206 -0
- package/ts_build/tests/manual/modalities/streaming.test.js.map +1 -0
- package/ts_build/tests/manual/modalities/xai.modalities.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/xai.modalities.test.js +226 -0
- package/ts_build/tests/manual/modalities/xai.modalities.test.js.map +1 -0
- package/ts_build/tests/manual/persistent-input-test.d.ts +1 -0
- package/ts_build/tests/manual/persistent-input-test.js +35 -0
- package/ts_build/tests/manual/persistent-input-test.js.map +1 -0
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js +5 -5
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin-integration.test.js +1 -1
- package/ts_build/tests/plugins/language/languagePlugin-integration.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin.test.js +17 -7
- package/ts_build/tests/plugins/language/languagePlugin.test.js.map +1 -1
package/src/clients/anthropic.ts
CHANGED
|
@@ -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 ||
|
|
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
|
|
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
|
}
|