@polka-codes/core 0.0.4 → 0.1.1

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 (65) hide show
  1. package/README.md +69 -0
  2. package/dist/Agent/AgentBase.d.ts +49 -0
  3. package/dist/Agent/AgentBase.js +158 -0
  4. package/dist/Agent/AgentBase.js.map +1 -0
  5. package/dist/Agent/CoderAgent/index.d.ts +17 -0
  6. package/dist/Agent/CoderAgent/index.js +32 -0
  7. package/dist/Agent/CoderAgent/index.js.map +1 -0
  8. package/dist/Agent/CoderAgent/prompts.d.ts +20 -0
  9. package/dist/Agent/CoderAgent/prompts.js +165 -0
  10. package/dist/Agent/CoderAgent/prompts.js.map +1 -0
  11. package/dist/Agent/CoderAgent/prompts.test.d.ts +1 -0
  12. package/dist/Agent/CoderAgent/prompts.test.js +20 -0
  13. package/dist/Agent/CoderAgent/prompts.test.js.map +1 -0
  14. package/dist/Agent/index.d.ts +2 -0
  15. package/dist/Agent/index.js +3 -0
  16. package/dist/Agent/index.js.map +1 -0
  17. package/dist/Agent/parseAssistantMessage.d.ts +45 -0
  18. package/dist/Agent/parseAssistantMessage.js +103 -0
  19. package/dist/Agent/parseAssistantMessage.js.map +1 -0
  20. package/dist/Agent/parseAssistantMessage.test.d.ts +1 -0
  21. package/dist/Agent/parseAssistantMessage.test.js +172 -0
  22. package/dist/Agent/parseAssistantMessage.test.js.map +1 -0
  23. package/dist/Agent/prompts.d.ts +7 -0
  24. package/dist/Agent/prompts.js +93 -0
  25. package/dist/Agent/prompts.js.map +1 -0
  26. package/dist/AiService/AiServiceBase.d.ts +29 -0
  27. package/dist/AiService/AiServiceBase.js +3 -0
  28. package/dist/AiService/AiServiceBase.js.map +1 -0
  29. package/dist/AiService/AnthropicService.d.ts +11 -0
  30. package/dist/AiService/AnthropicService.js +185 -0
  31. package/dist/AiService/AnthropicService.js.map +1 -0
  32. package/dist/AiService/DeepSeekService.d.ts +11 -0
  33. package/dist/AiService/DeepSeekService.js +64 -0
  34. package/dist/AiService/DeepSeekService.js.map +1 -0
  35. package/dist/AiService/ModelInfo.d.ts +79 -0
  36. package/dist/AiService/ModelInfo.js +67 -0
  37. package/dist/AiService/ModelInfo.js.map +1 -0
  38. package/dist/AiService/OllamaService.d.ts +11 -0
  39. package/dist/AiService/OllamaService.js +47 -0
  40. package/dist/AiService/OllamaService.js.map +1 -0
  41. package/dist/AiService/index.d.ts +12 -0
  42. package/dist/AiService/index.js +20 -0
  43. package/dist/AiService/index.js.map +1 -0
  44. package/dist/AiService/utils.d.ts +4 -0
  45. package/dist/AiService/utils.js +187 -0
  46. package/dist/AiService/utils.js.map +1 -0
  47. package/dist/AiService/utils.test.d.ts +1 -0
  48. package/dist/AiService/utils.test.js +275 -0
  49. package/dist/AiService/utils.test.js.map +1 -0
  50. package/dist/index.d.ts +4 -10
  51. package/dist/index.js +4 -10
  52. package/dist/index.js.map +1 -1
  53. package/dist/logger.d.ts +5 -0
  54. package/dist/logger.js +25 -0
  55. package/dist/logger.js.map +1 -0
  56. package/dist/tools/index.d.ts +3 -0
  57. package/dist/tools/index.js +4 -0
  58. package/dist/tools/index.js.map +1 -0
  59. package/dist/tools/tools.d.ts +200 -0
  60. package/dist/tools/tools.js +329 -0
  61. package/dist/tools/tools.js.map +1 -0
  62. package/dist/tools/types.d.ts +49 -0
  63. package/dist/tools/types.js +9 -0
  64. package/dist/tools/types.js.map +1 -0
  65. package/package.json +9 -2
@@ -0,0 +1,64 @@
1
+ // source: https://github.com/cline/cline/blob/ce2610a6eafd860305ba9b12533db19f2a5385ad/src/api/providers/deepseek.ts
2
+ import OpenAI from 'openai';
3
+ import { createServiceLogger } from '../logger';
4
+ import { AiServiceBase } from './AiServiceBase';
5
+ import { deepSeekDefaultModelId, deepSeekModels } from './ModelInfo';
6
+ import { convertToOpenAiMessages } from './utils';
7
+ const logger = createServiceLogger('DeepSeekService');
8
+ export class DeepSeekService extends AiServiceBase {
9
+ #client;
10
+ model;
11
+ constructor(options) {
12
+ super();
13
+ this.#client = new OpenAI({
14
+ baseURL: 'https://api.deepseek.com/v1',
15
+ apiKey: options.apiKey,
16
+ });
17
+ const id = (options.modelId || deepSeekDefaultModelId);
18
+ this.model = {
19
+ id,
20
+ info: deepSeekModels[id] ?? deepSeekModels[deepSeekDefaultModelId],
21
+ };
22
+ }
23
+ async *send(systemPrompt, messages) {
24
+ logger.debug({ modelId: this.model.id, messagesCount: messages.length }, 'Starting message stream');
25
+ const openAiMessages = [
26
+ { role: 'system', content: systemPrompt },
27
+ ...convertToOpenAiMessages(messages),
28
+ ];
29
+ logger.trace({ modelId: this.model.id, messagesCount: messages.length }, 'Sending messages to Ollama');
30
+ const stream = await this.#client.chat.completions.create({
31
+ model: this.model.id,
32
+ max_completion_tokens: this.model.info.maxTokens,
33
+ messages: openAiMessages,
34
+ temperature: 0,
35
+ stream: true,
36
+ stream_options: { include_usage: true },
37
+ });
38
+ for await (const chunk of stream) {
39
+ const delta = chunk.choices[0]?.delta;
40
+ if (delta?.content) {
41
+ yield {
42
+ type: 'text',
43
+ text: delta.content,
44
+ };
45
+ }
46
+ if (chunk.usage) {
47
+ yield {
48
+ type: 'usage',
49
+ // deepseek reports total input AND cache reads/writes, see context caching: https://api-docs.deepseek.com/guides/kv_cache
50
+ // where the input tokens is the sum of the cache hits/misses, while anthropic reports them as separate tokens.
51
+ // This is important to know for
52
+ // 1) context management truncation algorithm, and
53
+ // 2) cost calculation (NOTE: we report both input and cache stats but for now set input price to 0 since all the cost calculation will be done using cache hits/misses)
54
+ inputTokens: chunk.usage.prompt_tokens,
55
+ outputTokens: chunk.usage.completion_tokens,
56
+ cacheWriteTokens: chunk.usage.prompt_cache_hit_tokens || 0,
57
+ cacheReadTokens: chunk.usage.prompt_cache_miss_tokens || 0,
58
+ };
59
+ }
60
+ }
61
+ logger.debug('Stream ended');
62
+ }
63
+ }
64
+ //# sourceMappingURL=DeepSeekService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeepS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0,0 +1,79 @@
1
+ export interface ModelInfo {
2
+ maxTokens?: number;
3
+ contextWindow?: number;
4
+ supportsImages?: boolean;
5
+ supportsComputerUse?: boolean;
6
+ supportsPromptCache: boolean;
7
+ inputPrice?: number;
8
+ outputPrice?: number;
9
+ cacheWritesPrice?: number;
10
+ cacheReadsPrice?: number;
11
+ description?: string;
12
+ }
13
+ export type AnthropicModelId = keyof typeof anthropicModels;
14
+ export declare const anthropicDefaultModelId: AnthropicModelId;
15
+ export declare const anthropicModels: {
16
+ readonly 'claude-3-5-sonnet-20241022': {
17
+ readonly maxTokens: 8192;
18
+ readonly contextWindow: 200000;
19
+ readonly supportsImages: true;
20
+ readonly supportsComputerUse: true;
21
+ readonly supportsPromptCache: true;
22
+ readonly inputPrice: 3;
23
+ readonly outputPrice: 15;
24
+ readonly cacheWritesPrice: 3.75;
25
+ readonly cacheReadsPrice: 0.3;
26
+ };
27
+ readonly 'claude-3-5-haiku-20241022': {
28
+ readonly maxTokens: 8192;
29
+ readonly contextWindow: 200000;
30
+ readonly supportsImages: false;
31
+ readonly supportsPromptCache: true;
32
+ readonly inputPrice: 0.8;
33
+ readonly outputPrice: 4;
34
+ readonly cacheWritesPrice: 1;
35
+ readonly cacheReadsPrice: 0.08;
36
+ };
37
+ readonly 'claude-3-opus-20240229': {
38
+ readonly maxTokens: 4096;
39
+ readonly contextWindow: 200000;
40
+ readonly supportsImages: true;
41
+ readonly supportsPromptCache: true;
42
+ readonly inputPrice: 15;
43
+ readonly outputPrice: 75;
44
+ readonly cacheWritesPrice: 18.75;
45
+ readonly cacheReadsPrice: 1.5;
46
+ };
47
+ readonly 'claude-3-haiku-20240307': {
48
+ readonly maxTokens: 4096;
49
+ readonly contextWindow: 200000;
50
+ readonly supportsImages: true;
51
+ readonly supportsPromptCache: true;
52
+ readonly inputPrice: 0.25;
53
+ readonly outputPrice: 1.25;
54
+ readonly cacheWritesPrice: 0.3;
55
+ readonly cacheReadsPrice: 0.03;
56
+ };
57
+ };
58
+ export declare const openAiModelInfoSaneDefaults: {
59
+ readonly maxTokens: -1;
60
+ readonly contextWindow: 128000;
61
+ readonly supportsImages: true;
62
+ readonly supportsPromptCache: false;
63
+ readonly inputPrice: 0;
64
+ readonly outputPrice: 0;
65
+ };
66
+ export type DeepSeekModelId = keyof typeof deepSeekModels;
67
+ export declare const deepSeekDefaultModelId: DeepSeekModelId;
68
+ export declare const deepSeekModels: {
69
+ readonly 'deepseek-chat': {
70
+ readonly maxTokens: 8000;
71
+ readonly contextWindow: 64000;
72
+ readonly supportsImages: false;
73
+ readonly supportsPromptCache: true;
74
+ readonly inputPrice: 0;
75
+ readonly outputPrice: 0.28;
76
+ readonly cacheWritesPrice: 0.14;
77
+ readonly cacheReadsPrice: 0.014;
78
+ };
79
+ };
@@ -0,0 +1,67 @@
1
+ // source: https://github.com/cline/cline/blob/1f2acc519bc71bd8f38f4df87af0e07876cba0f6/src/shared/api.ts
2
+ export const anthropicDefaultModelId = 'claude-3-5-sonnet-20241022';
3
+ export const anthropicModels = {
4
+ 'claude-3-5-sonnet-20241022': {
5
+ maxTokens: 8192,
6
+ contextWindow: 200_000,
7
+ supportsImages: true,
8
+ supportsComputerUse: true,
9
+ supportsPromptCache: true,
10
+ inputPrice: 3.0, // $3 per million input tokens
11
+ outputPrice: 15.0, // $15 per million output tokens
12
+ cacheWritesPrice: 3.75, // $3.75 per million tokens
13
+ cacheReadsPrice: 0.3, // $0.30 per million tokens
14
+ },
15
+ 'claude-3-5-haiku-20241022': {
16
+ maxTokens: 8192,
17
+ contextWindow: 200_000,
18
+ supportsImages: false,
19
+ supportsPromptCache: true,
20
+ inputPrice: 0.8,
21
+ outputPrice: 4.0,
22
+ cacheWritesPrice: 1.0,
23
+ cacheReadsPrice: 0.08,
24
+ },
25
+ 'claude-3-opus-20240229': {
26
+ maxTokens: 4096,
27
+ contextWindow: 200_000,
28
+ supportsImages: true,
29
+ supportsPromptCache: true,
30
+ inputPrice: 15.0,
31
+ outputPrice: 75.0,
32
+ cacheWritesPrice: 18.75,
33
+ cacheReadsPrice: 1.5,
34
+ },
35
+ 'claude-3-haiku-20240307': {
36
+ maxTokens: 4096,
37
+ contextWindow: 200_000,
38
+ supportsImages: true,
39
+ supportsPromptCache: true,
40
+ inputPrice: 0.25,
41
+ outputPrice: 1.25,
42
+ cacheWritesPrice: 0.3,
43
+ cacheReadsPrice: 0.03,
44
+ },
45
+ };
46
+ export const openAiModelInfoSaneDefaults = {
47
+ maxTokens: -1,
48
+ contextWindow: 128_000,
49
+ supportsImages: true,
50
+ supportsPromptCache: false,
51
+ inputPrice: 0,
52
+ outputPrice: 0,
53
+ };
54
+ export const deepSeekDefaultModelId = 'deepseek-chat';
55
+ export const deepSeekModels = {
56
+ 'deepseek-chat': {
57
+ maxTokens: 8_000,
58
+ contextWindow: 64_000,
59
+ supportsImages: false,
60
+ supportsPromptCache: true, // supports context caching, but not in the way anthropic does it (deepseek reports input tokens and reads/writes in the same usage report) FIXME: we need to show users cache stats how deepseek does it
61
+ inputPrice: 0, // technically there is no input price, it's all either a cache hit or miss (ApiOptions will not show this)
62
+ outputPrice: 0.28,
63
+ cacheWritesPrice: 0.14,
64
+ cacheReadsPrice: 0.014,
65
+ },
66
+ };
67
+ //# sourceMappingURL=ModelInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelInfo.js","sourceRoot":"","sources":["../../src/AiService/ModelInfo.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAkBzG,MAAM,CAAC,MAAM,uBAAuB,GAAqB,4BAA4B,CAAA;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,4BAA4B,EAAE;QAC5B,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,OAAO;QACtB,cAAc,EAAE,IAAI;QACpB,mBAAmB,EAAE,IAAI;QACzB,mBAAmB,EAAE,IAAI;QACzB,UAAU,EAAE,GAAG,EAAE,8BAA8B;QAC/C,WAAW,EAAE,IAAI,EAAE,gCAAgC;QACnD,gBAAgB,EAAE,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B,gBAAgB,EAAE,IAAI;QACtB,eAAe,EAAE,KAAK;KACvB;CAC2C,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { AiServiceBase, type AiServiceOptions, type ApiStream, type MessageParam } from './AiServiceBase';
2
+ import { type ModelInfo } from './ModelInfo';
3
+ export declare class OllamaService extends AiServiceBase {
4
+ #private;
5
+ readonly model: {
6
+ id: string;
7
+ info: ModelInfo;
8
+ };
9
+ constructor(options: AiServiceOptions);
10
+ send(systemPrompt: string, messages: MessageParam[]): ApiStream;
11
+ }
@@ -0,0 +1,47 @@
1
+ // source: https://github.com/cline/cline/blob/f6c19c29a64ca84e9360df7ab2c07d128dcebe64/src/api/providers/ollama.ts
2
+ import OpenAI from 'openai';
3
+ import { createServiceLogger } from '../logger';
4
+ import { AiServiceBase } from './AiServiceBase';
5
+ import { openAiModelInfoSaneDefaults } from './ModelInfo';
6
+ import { convertToOpenAiMessages } from './utils';
7
+ const logger = createServiceLogger('OllamaService');
8
+ export class OllamaService extends AiServiceBase {
9
+ #client;
10
+ model;
11
+ constructor(options) {
12
+ super();
13
+ this.#client = new OpenAI({
14
+ baseURL: `${options.baseUrl || 'http://localhost:11434'}/v1`,
15
+ apiKey: 'ollama',
16
+ });
17
+ this.model = {
18
+ id: options.modelId || '',
19
+ info: openAiModelInfoSaneDefaults,
20
+ };
21
+ }
22
+ async *send(systemPrompt, messages) {
23
+ logger.debug({ modelId: this.model.id, messagesCount: messages.length }, 'Starting message stream');
24
+ const openAiMessages = [
25
+ { role: 'system', content: systemPrompt },
26
+ ...convertToOpenAiMessages(messages),
27
+ ];
28
+ logger.trace({ modelId: this.model.id, messagesCount: messages.length }, 'Sending messages to Ollama');
29
+ const stream = await this.#client.chat.completions.create({
30
+ model: this.model.id,
31
+ messages: openAiMessages,
32
+ temperature: 0,
33
+ stream: true,
34
+ });
35
+ for await (const chunk of stream) {
36
+ const delta = chunk.choices[0]?.delta;
37
+ if (delta?.content) {
38
+ yield {
39
+ type: 'text',
40
+ text: delta.content,
41
+ };
42
+ }
43
+ }
44
+ logger.debug('Stream ended');
45
+ }
46
+ }
47
+ //# sourceMappingURL=OllamaService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OllamaService.js","sourceRoot":"","sources":["../../src/AiService/OllamaService.ts"],"names":[],"mappings":"AAAA,mHAAmH;AAEnH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,aAAa,EAA4D,MAAM,iBAAiB,CAAA;AACzG,OAAO,EAAkB,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEjD,MAAM,MAAM,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAA;AAEnD,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C,OAAO,CAAQ;IAEN,KAAK,CAAiC;IAE/C,YAAY,OAAyB;QACnC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC;YACxB,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,wBAAwB,KAAK;YAC5D,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;QAEF,IAAI,CAAC,KAAK,GAAG;YACX,EAAE,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;YACzB,IAAI,EAAE,2BAA2B;SAClC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,CAAC,IAAI,CAAC,YAAoB,EAAE,QAAwB;QACxD,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,aAAa,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,yBAAyB,CAAC,CAAA;QAEnG,MAAM,cAAc,GAA6C;YAC/D,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE;YACzC,GAAG,uBAAuB,CAAC,QAAQ,CAAC;SACrC,CAAA;QAED,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,aAAa,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,4BAA4B,CAAC,CAAA;QAEtG,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACxD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;YACpB,QAAQ,EAAE,cAAc;YACxB,WAAW,EAAE,CAAC;YACd,MAAM,EAAE,IAAI;SACb,CAAC,CAAA;QACF,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,CAAA;YACrC,IAAI,KAAK,EAAE,OAAO,EAAE,CAAC;gBACnB,MAAM;oBACJ,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,KAAK,CAAC,OAAO;iBACpB,CAAA;YACH,CAAC;QACH,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAC9B,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import type { AiServiceBase, AiServiceOptions, MessageParam } from './AiServiceBase';
2
+ import { AnthropicService } from './AnthropicService';
3
+ import { DeepSeekService } from './DeepSeekService';
4
+ import type { ModelInfo } from './ModelInfo';
5
+ import { OllamaService } from './OllamaService';
6
+ export declare enum AiServiceProvider {
7
+ Anthropic = "anthropic",
8
+ Ollama = "ollama",
9
+ DeepSeek = "deepseek"
10
+ }
11
+ export declare const createService: (provider: AiServiceProvider, options: AiServiceOptions) => AnthropicService | DeepSeekService | OllamaService;
12
+ export type { MessageParam, AiServiceOptions, AiServiceBase, ModelInfo };
@@ -0,0 +1,20 @@
1
+ import { AnthropicService } from './AnthropicService';
2
+ import { DeepSeekService } from './DeepSeekService';
3
+ import { OllamaService } from './OllamaService';
4
+ export var AiServiceProvider;
5
+ (function (AiServiceProvider) {
6
+ AiServiceProvider["Anthropic"] = "anthropic";
7
+ AiServiceProvider["Ollama"] = "ollama";
8
+ AiServiceProvider["DeepSeek"] = "deepseek";
9
+ })(AiServiceProvider || (AiServiceProvider = {}));
10
+ export const createService = (provider, options) => {
11
+ switch (provider) {
12
+ case AiServiceProvider.Anthropic:
13
+ return new AnthropicService(options);
14
+ case AiServiceProvider.Ollama:
15
+ return new OllamaService(options);
16
+ case AiServiceProvider.DeepSeek:
17
+ return new DeepSeekService(options);
18
+ }
19
+ };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AiService/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,4CAAuB,CAAA;IACvB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;AACvB,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA2B,EAAE,OAAyB,EAAE,EAAE;IACtF,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,iBAAiB,CAAC,SAAS;YAC9B,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAA;QACtC,KAAK,iBAAiB,CAAC,MAAM;YAC3B,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;QACnC,KAAK,iBAAiB,CAAC,QAAQ;YAC7B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Anthropic } from '@anthropic-ai/sdk';
2
+ import type OpenAI from 'openai';
3
+ export declare function convertToOpenAiMessages(anthropicMessages: Anthropic.Messages.MessageParam[]): OpenAI.Chat.ChatCompletionMessageParam[];
4
+ export declare function convertToAnthropicMessage(completion: OpenAI.Chat.Completions.ChatCompletion): Anthropic.Messages.Message;
@@ -0,0 +1,187 @@
1
+ // source: https://github.com/cline/cline/blob/f6c19c29a64ca84e9360df7ab2c07d128dcebe64/src/api/transform/openai-format.ts
2
+ import { createServiceLogger } from '../logger';
3
+ const logger = createServiceLogger('utils');
4
+ export function convertToOpenAiMessages(anthropicMessages) {
5
+ const openAiMessages = [];
6
+ for (const anthropicMessage of anthropicMessages) {
7
+ if (typeof anthropicMessage.content === 'string') {
8
+ openAiMessages.push({
9
+ role: anthropicMessage.role,
10
+ content: anthropicMessage.content,
11
+ });
12
+ }
13
+ else {
14
+ // image_url.url is base64 encoded image data
15
+ // ensure it contains the content-type of the image: data:image/png;base64,
16
+ /*
17
+ { role: "user", content: "" | { type: "text", text: string } | { type: "image_url", image_url: { url: string } } },
18
+ // content required unless tool_calls is present
19
+ { role: "assistant", content?: "" | null, tool_calls?: [{ id: "", function: { name: "", arguments: "" }, type: "function" }] },
20
+ { role: "tool", tool_call_id: "", content: ""}
21
+ */
22
+ if (anthropicMessage.role === 'user') {
23
+ const { nonToolMessages, toolMessages } = anthropicMessage.content.reduce((acc, part) => {
24
+ if (part.type === 'tool_result') {
25
+ acc.toolMessages.push(part);
26
+ }
27
+ else if (part.type === 'text' || part.type === 'image') {
28
+ acc.nonToolMessages.push(part);
29
+ } // user cannot send tool_use messages
30
+ return acc;
31
+ }, { nonToolMessages: [], toolMessages: [] });
32
+ // Process tool result messages FIRST since they must follow the tool use messages
33
+ const toolResultImages = [];
34
+ for (const toolMessage of toolMessages) {
35
+ // The Anthropic SDK allows tool results to be a string or an array of text and image blocks, enabling rich and structured content. In contrast, the OpenAI SDK only supports tool results as a single string, so we map the Anthropic tool result parts into one concatenated string to maintain compatibility.
36
+ let content;
37
+ if (typeof toolMessage.content === 'string') {
38
+ content = toolMessage.content;
39
+ }
40
+ else {
41
+ content =
42
+ toolMessage.content
43
+ ?.map((part) => {
44
+ if (part.type === 'image') {
45
+ toolResultImages.push(part);
46
+ return '(see following user message for image)';
47
+ }
48
+ return part.text;
49
+ })
50
+ .join('\n') ?? '';
51
+ }
52
+ openAiMessages.push({
53
+ role: 'tool',
54
+ tool_call_id: toolMessage.tool_use_id,
55
+ content: content,
56
+ });
57
+ }
58
+ // If tool results contain images, send as a separate user message
59
+ // I ran into an issue where if I gave feedback for one of many tool uses, the request would fail.
60
+ // "Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks."
61
+ // Therefore we need to send these images after the tool result messages
62
+ // NOTE: it's actually okay to have multiple user messages in a row, the model will treat them as a continuation of the same input (this way works better than combining them into one message, since the tool result specifically mentions (see following user message for image)
63
+ // UPDATE v2.0: we don't use tools anymore, but if we did it's important to note that the openrouter prompt caching mechanism requires one user message at a time, so we would need to add these images to the user content array instead.
64
+ // if (toolResultImages.length > 0) {
65
+ // openAiMessages.push({
66
+ // role: "user",
67
+ // content: toolResultImages.map((part) => ({
68
+ // type: "image_url",
69
+ // image_url: { url: `data:${part.source.media_type};base64,${part.source.data}` },
70
+ // })),
71
+ // })
72
+ // }
73
+ // Process non-tool messages
74
+ if (nonToolMessages.length > 0) {
75
+ openAiMessages.push({
76
+ role: 'user',
77
+ content: nonToolMessages.map((part) => {
78
+ if (part.type === 'image') {
79
+ return {
80
+ type: 'image_url',
81
+ image_url: {
82
+ url: `data:${part.source.media_type};base64,${part.source.data}`,
83
+ },
84
+ };
85
+ }
86
+ return { type: 'text', text: part.text };
87
+ }),
88
+ });
89
+ }
90
+ }
91
+ else if (anthropicMessage.role === 'assistant') {
92
+ const { nonToolMessages, toolMessages } = anthropicMessage.content.reduce((acc, part) => {
93
+ if (part.type === 'tool_use') {
94
+ acc.toolMessages.push(part);
95
+ }
96
+ else if (part.type === 'text' || part.type === 'image') {
97
+ acc.nonToolMessages.push(part);
98
+ } // assistant cannot send tool_result messages
99
+ return acc;
100
+ }, { nonToolMessages: [], toolMessages: [] });
101
+ // Process non-tool messages
102
+ let content;
103
+ if (nonToolMessages.length > 0) {
104
+ content = nonToolMessages
105
+ .map((part) => {
106
+ if (part.type === 'image') {
107
+ return ''; // impossible as the assistant cannot send images
108
+ }
109
+ return part.text;
110
+ })
111
+ .join('\n');
112
+ }
113
+ // Process tool use messages
114
+ const tool_calls = toolMessages.map((toolMessage) => ({
115
+ id: toolMessage.id,
116
+ type: 'function',
117
+ function: {
118
+ name: toolMessage.name,
119
+ // json string
120
+ arguments: JSON.stringify(toolMessage.input),
121
+ },
122
+ }));
123
+ openAiMessages.push({
124
+ role: 'assistant',
125
+ content,
126
+ // Cannot be an empty array. API expects an array with minimum length 1, and will respond with an error if it's empty
127
+ tool_calls: tool_calls.length > 0 ? tool_calls : undefined,
128
+ });
129
+ }
130
+ }
131
+ }
132
+ return openAiMessages;
133
+ }
134
+ // Convert OpenAI response to Anthropic format
135
+ export function convertToAnthropicMessage(completion) {
136
+ const openAiMessage = completion.choices[0].message;
137
+ const anthropicMessage = {
138
+ id: completion.id,
139
+ type: 'message',
140
+ role: openAiMessage.role, // always "assistant"
141
+ content: [
142
+ {
143
+ type: 'text',
144
+ text: openAiMessage.content || '',
145
+ },
146
+ ],
147
+ model: completion.model,
148
+ stop_reason: (() => {
149
+ switch (completion.choices[0].finish_reason) {
150
+ case 'stop':
151
+ return 'end_turn';
152
+ case 'length':
153
+ return 'max_tokens';
154
+ case 'tool_calls':
155
+ return 'tool_use';
156
+ default:
157
+ return null;
158
+ }
159
+ })(),
160
+ stop_sequence: null, // which custom stop_sequence was generated, if any (not applicable if you don't use stop_sequence)
161
+ usage: {
162
+ input_tokens: completion.usage?.prompt_tokens || 0,
163
+ output_tokens: completion.usage?.completion_tokens || 0,
164
+ cache_creation_input_tokens: null,
165
+ cache_read_input_tokens: null,
166
+ },
167
+ };
168
+ if (openAiMessage.tool_calls && openAiMessage.tool_calls.length > 0) {
169
+ anthropicMessage.content.push(...openAiMessage.tool_calls.map((toolCall) => {
170
+ let parsedInput = {};
171
+ try {
172
+ parsedInput = JSON.parse(toolCall.function.arguments || '{}');
173
+ }
174
+ catch (error) {
175
+ logger.warn('Failed to parse tool arguments:', error);
176
+ }
177
+ return {
178
+ type: 'tool_use',
179
+ id: toolCall.id,
180
+ name: toolCall.function.name,
181
+ input: parsedInput,
182
+ };
183
+ }));
184
+ }
185
+ return anthropicMessage;
186
+ }
187
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/AiService/utils.ts"],"names":[],"mappings":"AAAA,0HAA0H;AAK1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAE/C,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;AAE3C,MAAM,UAAU,uBAAuB,CAAC,iBAAoD;IAC1F,MAAM,cAAc,GAA6C,EAAE,CAAA;IAEnE,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE,CAAC;QACjD,IAAI,OAAO,gBAAgB,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACjD,cAAc,CAAC,IAAI,CAAC;gBAClB,IAAI,EAAE,gBAAgB,CAAC,IAAI;gBAC3B,OAAO,EAAE,gBAAgB,CAAC,OAAO;aAClC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,6CAA6C;YAC7C,2EAA2E;YAC3E;;;;;iBAKK;YACL,IAAI,gBAAgB,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBACrC,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAIvE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;oBACZ,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;wBAChC,GAAG,CAAC,YAAY,CAAC,IAAI,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