@codeany/open-agent-sdk 0.2.1 → 0.2.2
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/.env.example +8 -0
- package/examples/01-simple-query.ts +43 -0
- package/examples/02-multi-tool.ts +44 -0
- package/examples/03-multi-turn.ts +39 -0
- package/examples/04-prompt-api.ts +29 -0
- package/examples/05-custom-system-prompt.ts +26 -0
- package/examples/06-mcp-server.ts +49 -0
- package/examples/07-custom-tools.ts +87 -0
- package/examples/08-official-api-compat.ts +38 -0
- package/examples/09-subagents.ts +48 -0
- package/examples/10-permissions.ts +40 -0
- package/examples/11-custom-mcp-tools.ts +101 -0
- package/examples/12-skills.ts +88 -0
- package/examples/13-hooks.ts +88 -0
- package/examples/14-openai-compat.ts +71 -0
- package/examples/web/index.html +365 -0
- package/examples/web/server.ts +157 -0
- package/package.json +1 -7
- package/src/engine.ts +3 -0
- package/tsconfig.json +19 -0
- package/dist/agent.d.ts +0 -113
- package/dist/agent.d.ts.map +0 -1
- package/dist/agent.js +0 -446
- package/dist/agent.js.map +0 -1
- package/dist/engine.d.ts +0 -62
- package/dist/engine.d.ts.map +0 -1
- package/dist/engine.js +0 -494
- package/dist/engine.js.map +0 -1
- package/dist/hooks.d.ts +0 -111
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js +0 -179
- package/dist/hooks.js.map +0 -1
- package/dist/index.d.ts +0 -66
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -133
- package/dist/index.js.map +0 -1
- package/dist/mcp/client.d.ts +0 -19
- package/dist/mcp/client.d.ts.map +0 -1
- package/dist/mcp/client.js +0 -126
- package/dist/mcp/client.js.map +0 -1
- package/dist/providers/anthropic.d.ts +0 -17
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js +0 -47
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/index.d.ts +0 -20
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -26
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/openai.d.ts +0 -26
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js +0 -212
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/types.d.ts +0 -84
- package/dist/providers/types.d.ts.map +0 -1
- package/dist/providers/types.js +0 -11
- package/dist/providers/types.js.map +0 -1
- package/dist/sdk-mcp-server.d.ts +0 -52
- package/dist/sdk-mcp-server.d.ts.map +0 -1
- package/dist/sdk-mcp-server.js +0 -57
- package/dist/sdk-mcp-server.js.map +0 -1
- package/dist/session.d.ts +0 -73
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -159
- package/dist/session.js.map +0 -1
- package/dist/skills/bundled/commit.d.ts +0 -7
- package/dist/skills/bundled/commit.d.ts.map +0 -1
- package/dist/skills/bundled/commit.js +0 -35
- package/dist/skills/bundled/commit.js.map +0 -1
- package/dist/skills/bundled/debug.d.ts +0 -7
- package/dist/skills/bundled/debug.d.ts.map +0 -1
- package/dist/skills/bundled/debug.js +0 -46
- package/dist/skills/bundled/debug.js.map +0 -1
- package/dist/skills/bundled/index.d.ts +0 -11
- package/dist/skills/bundled/index.d.ts.map +0 -1
- package/dist/skills/bundled/index.js +0 -26
- package/dist/skills/bundled/index.js.map +0 -1
- package/dist/skills/bundled/review.d.ts +0 -7
- package/dist/skills/bundled/review.d.ts.map +0 -1
- package/dist/skills/bundled/review.js +0 -38
- package/dist/skills/bundled/review.js.map +0 -1
- package/dist/skills/bundled/simplify.d.ts +0 -8
- package/dist/skills/bundled/simplify.d.ts.map +0 -1
- package/dist/skills/bundled/simplify.js +0 -48
- package/dist/skills/bundled/simplify.js.map +0 -1
- package/dist/skills/bundled/test.d.ts +0 -7
- package/dist/skills/bundled/test.d.ts.map +0 -1
- package/dist/skills/bundled/test.js +0 -40
- package/dist/skills/bundled/test.js.map +0 -1
- package/dist/skills/index.d.ts +0 -7
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js +0 -8
- package/dist/skills/index.js.map +0 -1
- package/dist/skills/registry.d.ts +0 -43
- package/dist/skills/registry.d.ts.map +0 -1
- package/dist/skills/registry.js +0 -111
- package/dist/skills/registry.js.map +0 -1
- package/dist/skills/types.d.ts +0 -83
- package/dist/skills/types.d.ts.map +0 -1
- package/dist/skills/types.js +0 -8
- package/dist/skills/types.js.map +0 -1
- package/dist/tool-helper.d.ts +0 -73
- package/dist/tool-helper.d.ts.map +0 -1
- package/dist/tool-helper.js +0 -86
- package/dist/tool-helper.js.map +0 -1
- package/dist/tools/agent-tool.d.ts +0 -17
- package/dist/tools/agent-tool.d.ts.map +0 -1
- package/dist/tools/agent-tool.js +0 -146
- package/dist/tools/agent-tool.js.map +0 -1
- package/dist/tools/ask-user.d.ts +0 -18
- package/dist/tools/ask-user.d.ts.map +0 -1
- package/dist/tools/ask-user.js +0 -72
- package/dist/tools/ask-user.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -5
- package/dist/tools/bash.d.ts.map +0 -1
- package/dist/tools/bash.js +0 -67
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/config-tool.d.ts +0 -20
- package/dist/tools/config-tool.d.ts.map +0 -1
- package/dist/tools/config-tool.js +0 -83
- package/dist/tools/config-tool.js.map +0 -1
- package/dist/tools/cron-tools.d.ts +0 -33
- package/dist/tools/cron-tools.d.ts.map +0 -1
- package/dist/tools/cron-tools.js +0 -128
- package/dist/tools/cron-tools.js.map +0 -1
- package/dist/tools/edit.d.ts +0 -5
- package/dist/tools/edit.d.ts.map +0 -1
- package/dist/tools/edit.js +0 -70
- package/dist/tools/edit.js.map +0 -1
- package/dist/tools/glob.d.ts +0 -5
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -75
- package/dist/tools/glob.js.map +0 -1
- package/dist/tools/grep.d.ts +0 -5
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -168
- package/dist/tools/grep.js.map +0 -1
- package/dist/tools/index.d.ts +0 -45
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -162
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/lsp-tool.d.ts +0 -9
- package/dist/tools/lsp-tool.d.ts.map +0 -1
- package/dist/tools/lsp-tool.js +0 -137
- package/dist/tools/lsp-tool.js.map +0 -1
- package/dist/tools/mcp-resource-tools.d.ts +0 -14
- package/dist/tools/mcp-resource-tools.d.ts.map +0 -1
- package/dist/tools/mcp-resource-tools.js +0 -117
- package/dist/tools/mcp-resource-tools.js.map +0 -1
- package/dist/tools/notebook-edit.d.ts +0 -5
- package/dist/tools/notebook-edit.d.ts.map +0 -1
- package/dist/tools/notebook-edit.js +0 -85
- package/dist/tools/notebook-edit.js.map +0 -1
- package/dist/tools/plan-tools.d.ts +0 -12
- package/dist/tools/plan-tools.d.ts.map +0 -1
- package/dist/tools/plan-tools.js +0 -77
- package/dist/tools/plan-tools.js.map +0 -1
- package/dist/tools/read.d.ts +0 -5
- package/dist/tools/read.d.ts.map +0 -1
- package/dist/tools/read.js +0 -66
- package/dist/tools/read.js.map +0 -1
- package/dist/tools/send-message.d.ts +0 -31
- package/dist/tools/send-message.d.ts.map +0 -1
- package/dist/tools/send-message.js +0 -77
- package/dist/tools/send-message.js.map +0 -1
- package/dist/tools/skill-tool.d.ts +0 -9
- package/dist/tools/skill-tool.d.ts.map +0 -1
- package/dist/tools/skill-tool.js +0 -115
- package/dist/tools/skill-tool.js.map +0 -1
- package/dist/tools/task-tools.d.ts +0 -48
- package/dist/tools/task-tools.d.ts.map +0 -1
- package/dist/tools/task-tools.js +0 -242
- package/dist/tools/task-tools.js.map +0 -1
- package/dist/tools/team-tools.d.ts +0 -34
- package/dist/tools/team-tools.d.ts.map +0 -1
- package/dist/tools/team-tools.js +0 -103
- package/dist/tools/team-tools.js.map +0 -1
- package/dist/tools/todo-tool.d.ts +0 -22
- package/dist/tools/todo-tool.d.ts.map +0 -1
- package/dist/tools/todo-tool.js +0 -93
- package/dist/tools/todo-tool.js.map +0 -1
- package/dist/tools/tool-search.d.ts +0 -13
- package/dist/tools/tool-search.d.ts.map +0 -1
- package/dist/tools/tool-search.js +0 -76
- package/dist/tools/tool-search.js.map +0 -1
- package/dist/tools/types.d.ts +0 -29
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -52
- package/dist/tools/types.js.map +0 -1
- package/dist/tools/web-fetch.d.ts +0 -5
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -60
- package/dist/tools/web-fetch.js.map +0 -1
- package/dist/tools/web-search.d.ts +0 -5
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -77
- package/dist/tools/web-search.js.map +0 -1
- package/dist/tools/worktree-tools.d.ts +0 -10
- package/dist/tools/worktree-tools.d.ts.map +0 -1
- package/dist/tools/worktree-tools.js +0 -130
- package/dist/tools/worktree-tools.js.map +0 -1
- package/dist/tools/write.d.ts +0 -5
- package/dist/tools/write.d.ts.map +0 -1
- package/dist/tools/write.js +0 -40
- package/dist/tools/write.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
- package/dist/utils/compact.d.ts +0 -44
- package/dist/utils/compact.d.ts.map +0 -1
- package/dist/utils/compact.js +0 -162
- package/dist/utils/compact.js.map +0 -1
- package/dist/utils/context.d.ts +0 -35
- package/dist/utils/context.d.ts.map +0 -1
- package/dist/utils/context.js +0 -174
- package/dist/utils/context.js.map +0 -1
- package/dist/utils/fileCache.d.ts +0 -64
- package/dist/utils/fileCache.d.ts.map +0 -1
- package/dist/utils/fileCache.js +0 -117
- package/dist/utils/fileCache.js.map +0 -1
- package/dist/utils/messages.d.ts +0 -57
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js +0 -152
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/retry.d.ts +0 -48
- package/dist/utils/retry.d.ts.map +0 -1
- package/dist/utils/retry.js +0 -111
- package/dist/utils/retry.js.map +0 -1
- package/dist/utils/tokens.d.ts +0 -57
- package/dist/utils/tokens.d.ts.map +0 -1
- package/dist/utils/tokens.js +0 -134
- package/dist/utils/tokens.js.map +0 -1
package/dist/mcp/client.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Client - Connect to Model Context Protocol servers
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Connect to an MCP server and fetch its tools.
|
|
6
|
-
*/
|
|
7
|
-
export async function connectMCPServer(name, config) {
|
|
8
|
-
try {
|
|
9
|
-
const { Client } = await import('@modelcontextprotocol/sdk/client/index.js');
|
|
10
|
-
let transport;
|
|
11
|
-
if (!config.type || config.type === 'stdio') {
|
|
12
|
-
const stdioConfig = config;
|
|
13
|
-
const { StdioClientTransport } = await import('@modelcontextprotocol/sdk/client/stdio.js');
|
|
14
|
-
transport = new StdioClientTransport({
|
|
15
|
-
command: stdioConfig.command,
|
|
16
|
-
args: stdioConfig.args || [],
|
|
17
|
-
env: { ...process.env, ...stdioConfig.env },
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
else if (config.type === 'sse') {
|
|
21
|
-
const sseConfig = config;
|
|
22
|
-
const { SSEClientTransport } = await import('@modelcontextprotocol/sdk/client/sse.js');
|
|
23
|
-
transport = new SSEClientTransport(new URL(sseConfig.url), {
|
|
24
|
-
requestInit: sseConfig.headers ? { headers: sseConfig.headers } : undefined,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
else if (config.type === 'http') {
|
|
28
|
-
const httpConfig = config;
|
|
29
|
-
const { StreamableHTTPClientTransport } = await import('@modelcontextprotocol/sdk/client/streamableHttp.js');
|
|
30
|
-
transport = new StreamableHTTPClientTransport(new URL(httpConfig.url), {
|
|
31
|
-
requestInit: httpConfig.headers ? { headers: httpConfig.headers } : undefined,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
throw new Error(`Unsupported MCP transport type: ${config.type}`);
|
|
36
|
-
}
|
|
37
|
-
const client = new Client({ name: `agent-sdk-${name}`, version: '1.0.0' }, { capabilities: {} });
|
|
38
|
-
await client.connect(transport);
|
|
39
|
-
// Fetch available tools
|
|
40
|
-
const toolList = await client.listTools();
|
|
41
|
-
const tools = (toolList.tools || []).map((mcpTool) => createMCPToolDefinition(name, mcpTool, client));
|
|
42
|
-
return {
|
|
43
|
-
name,
|
|
44
|
-
status: 'connected',
|
|
45
|
-
tools,
|
|
46
|
-
async close() {
|
|
47
|
-
try {
|
|
48
|
-
await client.close();
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
// ignore close errors
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
console.error(`[MCP] Failed to connect to "${name}": ${err.message}`);
|
|
58
|
-
return {
|
|
59
|
-
name,
|
|
60
|
-
status: 'error',
|
|
61
|
-
tools: [],
|
|
62
|
-
async close() { },
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Create a ToolDefinition wrapping an MCP server tool.
|
|
68
|
-
*/
|
|
69
|
-
function createMCPToolDefinition(serverName, mcpTool, client) {
|
|
70
|
-
const toolName = `mcp__${serverName}__${mcpTool.name}`;
|
|
71
|
-
return {
|
|
72
|
-
name: toolName,
|
|
73
|
-
description: mcpTool.description || `MCP tool: ${mcpTool.name} from ${serverName}`,
|
|
74
|
-
inputSchema: mcpTool.inputSchema || { type: 'object', properties: {} },
|
|
75
|
-
isReadOnly: () => false,
|
|
76
|
-
isConcurrencySafe: () => false,
|
|
77
|
-
isEnabled: () => true,
|
|
78
|
-
async prompt() {
|
|
79
|
-
return mcpTool.description || '';
|
|
80
|
-
},
|
|
81
|
-
async call(input) {
|
|
82
|
-
try {
|
|
83
|
-
const result = await client.callTool({
|
|
84
|
-
name: mcpTool.name,
|
|
85
|
-
arguments: input,
|
|
86
|
-
});
|
|
87
|
-
// Extract text content from MCP result
|
|
88
|
-
let output = '';
|
|
89
|
-
if (result.content) {
|
|
90
|
-
for (const block of result.content) {
|
|
91
|
-
if (block.type === 'text') {
|
|
92
|
-
output += block.text;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
output += JSON.stringify(block);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
output = JSON.stringify(result);
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
type: 'tool_result',
|
|
104
|
-
tool_use_id: '',
|
|
105
|
-
content: output,
|
|
106
|
-
is_error: result.isError || false,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
return {
|
|
111
|
-
type: 'tool_result',
|
|
112
|
-
tool_use_id: '',
|
|
113
|
-
content: `MCP tool error: ${err.message}`,
|
|
114
|
-
is_error: true,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Close all MCP connections.
|
|
122
|
-
*/
|
|
123
|
-
export async function closeAllConnections(connections) {
|
|
124
|
-
await Promise.allSettled(connections.map((c) => c.close()));
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=client.js.map
|
package/dist/mcp/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAY,EACZ,MAAuB;IAEvB,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,2CAA2C,CAAC,CAAA;QAE5E,IAAI,SAAc,CAAA;QAElB,IAAI,CAAC,MAAM,CAAC,IAAI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E,CAAC;gBAClB,OAAO;oBACL,IAAI,EAAE,aAAa;oBACnB,WAAW,EAAE,EAAE;oBACf,OAAO,EAAE,mBAAmB,GAAG,CAAC,OAAO,EAAE;oBACzC,QAAQ,EAAE,IAAI;iBACf,CAAA;YACH,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,WAA4B;IACpE,MAAM,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;AAC7D,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Anthropic Messages API Provider
|
|
3
|
-
*
|
|
4
|
-
* Wraps the @anthropic-ai/sdk client. Since our internal format is
|
|
5
|
-
* Anthropic-like, this is mostly a thin pass-through.
|
|
6
|
-
*/
|
|
7
|
-
import type { LLMProvider, CreateMessageParams, CreateMessageResponse } from './types.js';
|
|
8
|
-
export declare class AnthropicProvider implements LLMProvider {
|
|
9
|
-
readonly apiType: "anthropic-messages";
|
|
10
|
-
private client;
|
|
11
|
-
constructor(opts: {
|
|
12
|
-
apiKey?: string;
|
|
13
|
-
baseURL?: string;
|
|
14
|
-
});
|
|
15
|
-
createMessage(params: CreateMessageParams): Promise<CreateMessageResponse>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAEnB,qBAAa,iBAAkB,YAAW,WAAW;IACnD,QAAQ,CAAC,OAAO,EAAG,oBAAoB,CAAS;IAChD,OAAO,CAAC,MAAM,CAAW;gBAEb,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAOjD,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAkCjF"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Anthropic Messages API Provider
|
|
3
|
-
*
|
|
4
|
-
* Wraps the @anthropic-ai/sdk client. Since our internal format is
|
|
5
|
-
* Anthropic-like, this is mostly a thin pass-through.
|
|
6
|
-
*/
|
|
7
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
8
|
-
export class AnthropicProvider {
|
|
9
|
-
apiType = 'anthropic-messages';
|
|
10
|
-
client;
|
|
11
|
-
constructor(opts) {
|
|
12
|
-
this.client = new Anthropic({
|
|
13
|
-
apiKey: opts.apiKey,
|
|
14
|
-
baseURL: opts.baseURL,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
async createMessage(params) {
|
|
18
|
-
const requestParams = {
|
|
19
|
-
model: params.model,
|
|
20
|
-
max_tokens: params.maxTokens,
|
|
21
|
-
system: params.system,
|
|
22
|
-
messages: params.messages,
|
|
23
|
-
tools: params.tools
|
|
24
|
-
? params.tools
|
|
25
|
-
: undefined,
|
|
26
|
-
};
|
|
27
|
-
// Add extended thinking if configured
|
|
28
|
-
if (params.thinking?.type === 'enabled' && params.thinking.budget_tokens) {
|
|
29
|
-
requestParams.thinking = {
|
|
30
|
-
type: 'enabled',
|
|
31
|
-
budget_tokens: params.thinking.budget_tokens,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const response = await this.client.messages.create(requestParams);
|
|
35
|
-
return {
|
|
36
|
-
content: response.content,
|
|
37
|
-
stopReason: response.stop_reason || 'end_turn',
|
|
38
|
-
usage: {
|
|
39
|
-
input_tokens: response.usage.input_tokens,
|
|
40
|
-
output_tokens: response.usage.output_tokens,
|
|
41
|
-
cache_creation_input_tokens: response.usage.cache_creation_input_tokens,
|
|
42
|
-
cache_read_input_tokens: response.usage.cache_read_input_tokens,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAA;AAOzC,MAAM,OAAO,iBAAiB;IACnB,OAAO,GAAG,oBAA6B,CAAA;IACxC,MAAM,CAAW;IAEzB,YAAY,IAA2C;QACrD,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC;YAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,aAAa,GAA8C;YAC/D,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU,EAAE,MAAM,CAAC,SAAS;YAC5B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAoC;YACrD,KAAK,EAAE,MAAM,CAAC,KAAK;gBACjB,CAAC,CAAE,MAAM,CAAC,KAA0B;gBACpC,CAAC,CAAC,SAAS;SACd,CAAA;QAED,sCAAsC;QACtC,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YACxE,aAAqB,CAAC,QAAQ,GAAG;gBAChC,IAAI,EAAE,SAAS;gBACf,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,aAAa;aAC7C,CAAA;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QAEjE,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,OAA2C;YAC7D,UAAU,EAAE,QAAQ,CAAC,WAAW,IAAI,UAAU;YAC9C,KAAK,EAAE;gBACL,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;gBACzC,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa;gBAC3C,2BAA2B,EACxB,QAAQ,CAAC,KAAa,CAAC,2BAA2B;gBACrD,uBAAuB,EACpB,QAAQ,CAAC,KAAa,CAAC,uBAAuB;aAClD;SACF,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM Provider Factory
|
|
3
|
-
*
|
|
4
|
-
* Creates the appropriate provider based on API type configuration.
|
|
5
|
-
*/
|
|
6
|
-
export type { ApiType, LLMProvider, CreateMessageParams, CreateMessageResponse, NormalizedMessageParam, NormalizedContentBlock, NormalizedTool, NormalizedResponseBlock } from './types.js';
|
|
7
|
-
export { AnthropicProvider } from './anthropic.js';
|
|
8
|
-
export { OpenAIProvider } from './openai.js';
|
|
9
|
-
import type { ApiType, LLMProvider } from './types.js';
|
|
10
|
-
/**
|
|
11
|
-
* Create an LLM provider based on the API type.
|
|
12
|
-
*
|
|
13
|
-
* @param apiType - 'anthropic-messages' or 'openai-completions'
|
|
14
|
-
* @param opts - API credentials
|
|
15
|
-
*/
|
|
16
|
-
export declare function createProvider(apiType: ApiType, opts: {
|
|
17
|
-
apiKey?: string;
|
|
18
|
-
baseURL?: string;
|
|
19
|
-
}): LLMProvider;
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAE3L,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAItD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,WAAW,CASb"}
|
package/dist/providers/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM Provider Factory
|
|
3
|
-
*
|
|
4
|
-
* Creates the appropriate provider based on API type configuration.
|
|
5
|
-
*/
|
|
6
|
-
export { AnthropicProvider } from './anthropic.js';
|
|
7
|
-
export { OpenAIProvider } from './openai.js';
|
|
8
|
-
import { AnthropicProvider } from './anthropic.js';
|
|
9
|
-
import { OpenAIProvider } from './openai.js';
|
|
10
|
-
/**
|
|
11
|
-
* Create an LLM provider based on the API type.
|
|
12
|
-
*
|
|
13
|
-
* @param apiType - 'anthropic-messages' or 'openai-completions'
|
|
14
|
-
* @param opts - API credentials
|
|
15
|
-
*/
|
|
16
|
-
export function createProvider(apiType, opts) {
|
|
17
|
-
switch (apiType) {
|
|
18
|
-
case 'anthropic-messages':
|
|
19
|
-
return new AnthropicProvider(opts);
|
|
20
|
-
case 'openai-completions':
|
|
21
|
-
return new OpenAIProvider(opts);
|
|
22
|
-
default:
|
|
23
|
-
throw new Error(`Unsupported API type: ${apiType}. Use 'anthropic-messages' or 'openai-completions'.`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB,EAChB,IAA2C;IAE3C,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,oBAAoB;YACvB,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACpC,KAAK,oBAAoB;YACvB,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAA;QACjC;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,qDAAqD,CAAC,CAAA;IAC1G,CAAC;AACH,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAI Chat Completions API Provider
|
|
3
|
-
*
|
|
4
|
-
* Converts between the SDK's internal Anthropic-like message format
|
|
5
|
-
* and OpenAI's Chat Completions API format.
|
|
6
|
-
*
|
|
7
|
-
* Uses native fetch (no openai SDK dependency required).
|
|
8
|
-
*/
|
|
9
|
-
import type { LLMProvider, CreateMessageParams, CreateMessageResponse } from './types.js';
|
|
10
|
-
export declare class OpenAIProvider implements LLMProvider {
|
|
11
|
-
readonly apiType: "openai-completions";
|
|
12
|
-
private apiKey;
|
|
13
|
-
private baseURL;
|
|
14
|
-
constructor(opts: {
|
|
15
|
-
apiKey?: string;
|
|
16
|
-
baseURL?: string;
|
|
17
|
-
});
|
|
18
|
-
createMessage(params: CreateMessageParams): Promise<CreateMessageResponse>;
|
|
19
|
-
private convertMessages;
|
|
20
|
-
private convertUserMessage;
|
|
21
|
-
private convertAssistantMessage;
|
|
22
|
-
private convertTools;
|
|
23
|
-
private convertResponse;
|
|
24
|
-
private mapFinishReason;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EAKtB,MAAM,YAAY,CAAA;AAqDnB,qBAAa,cAAe,YAAW,WAAW;IAChD,QAAQ,CAAC,OAAO,EAAG,oBAAoB,CAAS;IAChD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAQ;gBAEX,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAKjD,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA4ChF,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,kBAAkB;IAuC1B,OAAO,CAAC,uBAAuB;IA8C/B,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,eAAe;IAsDvB,OAAO,CAAC,eAAe;CAcxB"}
|
package/dist/providers/openai.js
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAI Chat Completions API Provider
|
|
3
|
-
*
|
|
4
|
-
* Converts between the SDK's internal Anthropic-like message format
|
|
5
|
-
* and OpenAI's Chat Completions API format.
|
|
6
|
-
*
|
|
7
|
-
* Uses native fetch (no openai SDK dependency required).
|
|
8
|
-
*/
|
|
9
|
-
// --------------------------------------------------------------------------
|
|
10
|
-
// Provider
|
|
11
|
-
// --------------------------------------------------------------------------
|
|
12
|
-
export class OpenAIProvider {
|
|
13
|
-
apiType = 'openai-completions';
|
|
14
|
-
apiKey;
|
|
15
|
-
baseURL;
|
|
16
|
-
constructor(opts) {
|
|
17
|
-
this.apiKey = opts.apiKey || '';
|
|
18
|
-
this.baseURL = (opts.baseURL || 'https://api.openai.com/v1').replace(/\/$/, '');
|
|
19
|
-
}
|
|
20
|
-
async createMessage(params) {
|
|
21
|
-
// Convert to OpenAI format
|
|
22
|
-
const messages = this.convertMessages(params.system, params.messages);
|
|
23
|
-
const tools = params.tools ? this.convertTools(params.tools) : undefined;
|
|
24
|
-
const body = {
|
|
25
|
-
model: params.model,
|
|
26
|
-
max_tokens: params.maxTokens,
|
|
27
|
-
messages,
|
|
28
|
-
};
|
|
29
|
-
if (tools && tools.length > 0) {
|
|
30
|
-
body.tools = tools;
|
|
31
|
-
}
|
|
32
|
-
// Make API call
|
|
33
|
-
const response = await fetch(`${this.baseURL}/chat/completions`, {
|
|
34
|
-
method: 'POST',
|
|
35
|
-
headers: {
|
|
36
|
-
'Content-Type': 'application/json',
|
|
37
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
38
|
-
},
|
|
39
|
-
body: JSON.stringify(body),
|
|
40
|
-
});
|
|
41
|
-
if (!response.ok) {
|
|
42
|
-
const errBody = await response.text().catch(() => '');
|
|
43
|
-
const err = new Error(`OpenAI API error: ${response.status} ${response.statusText}: ${errBody}`);
|
|
44
|
-
err.status = response.status;
|
|
45
|
-
throw err;
|
|
46
|
-
}
|
|
47
|
-
const data = (await response.json());
|
|
48
|
-
// Convert response back to normalized format
|
|
49
|
-
return this.convertResponse(data);
|
|
50
|
-
}
|
|
51
|
-
// --------------------------------------------------------------------------
|
|
52
|
-
// Message Conversion: Internal → OpenAI
|
|
53
|
-
// --------------------------------------------------------------------------
|
|
54
|
-
convertMessages(system, messages) {
|
|
55
|
-
const result = [];
|
|
56
|
-
// System prompt as first message
|
|
57
|
-
if (system) {
|
|
58
|
-
result.push({ role: 'system', content: system });
|
|
59
|
-
}
|
|
60
|
-
for (const msg of messages) {
|
|
61
|
-
if (msg.role === 'user') {
|
|
62
|
-
this.convertUserMessage(msg, result);
|
|
63
|
-
}
|
|
64
|
-
else if (msg.role === 'assistant') {
|
|
65
|
-
this.convertAssistantMessage(msg, result);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
convertUserMessage(msg, result) {
|
|
71
|
-
if (typeof msg.content === 'string') {
|
|
72
|
-
result.push({ role: 'user', content: msg.content });
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// Content blocks may contain text and/or tool_result blocks
|
|
76
|
-
const textParts = [];
|
|
77
|
-
const toolResults = [];
|
|
78
|
-
for (const block of msg.content) {
|
|
79
|
-
if (block.type === 'text') {
|
|
80
|
-
textParts.push(block.text);
|
|
81
|
-
}
|
|
82
|
-
else if (block.type === 'tool_result') {
|
|
83
|
-
toolResults.push({
|
|
84
|
-
tool_use_id: block.tool_use_id,
|
|
85
|
-
content: block.content,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Tool results become separate tool messages
|
|
90
|
-
for (const tr of toolResults) {
|
|
91
|
-
result.push({
|
|
92
|
-
role: 'tool',
|
|
93
|
-
tool_call_id: tr.tool_use_id,
|
|
94
|
-
content: tr.content,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
// Text parts become a user message
|
|
98
|
-
if (textParts.length > 0) {
|
|
99
|
-
result.push({ role: 'user', content: textParts.join('\n') });
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
convertAssistantMessage(msg, result) {
|
|
103
|
-
if (typeof msg.content === 'string') {
|
|
104
|
-
result.push({ role: 'assistant', content: msg.content });
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// Extract text and tool_use blocks
|
|
108
|
-
const textParts = [];
|
|
109
|
-
const toolCalls = [];
|
|
110
|
-
for (const block of msg.content) {
|
|
111
|
-
if (block.type === 'text') {
|
|
112
|
-
textParts.push(block.text);
|
|
113
|
-
}
|
|
114
|
-
else if (block.type === 'tool_use') {
|
|
115
|
-
toolCalls.push({
|
|
116
|
-
id: block.id,
|
|
117
|
-
type: 'function',
|
|
118
|
-
function: {
|
|
119
|
-
name: block.name,
|
|
120
|
-
arguments: typeof block.input === 'string'
|
|
121
|
-
? block.input
|
|
122
|
-
: JSON.stringify(block.input),
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const assistantMsg = {
|
|
128
|
-
role: 'assistant',
|
|
129
|
-
content: textParts.length > 0 ? textParts.join('\n') : null,
|
|
130
|
-
};
|
|
131
|
-
if (toolCalls.length > 0) {
|
|
132
|
-
assistantMsg.tool_calls = toolCalls;
|
|
133
|
-
}
|
|
134
|
-
result.push(assistantMsg);
|
|
135
|
-
}
|
|
136
|
-
// --------------------------------------------------------------------------
|
|
137
|
-
// Tool Conversion: Internal → OpenAI
|
|
138
|
-
// --------------------------------------------------------------------------
|
|
139
|
-
convertTools(tools) {
|
|
140
|
-
return tools.map((t) => ({
|
|
141
|
-
type: 'function',
|
|
142
|
-
function: {
|
|
143
|
-
name: t.name,
|
|
144
|
-
description: t.description,
|
|
145
|
-
parameters: t.input_schema,
|
|
146
|
-
},
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
// --------------------------------------------------------------------------
|
|
150
|
-
// Response Conversion: OpenAI → Internal
|
|
151
|
-
// --------------------------------------------------------------------------
|
|
152
|
-
convertResponse(data) {
|
|
153
|
-
const choice = data.choices[0];
|
|
154
|
-
if (!choice) {
|
|
155
|
-
return {
|
|
156
|
-
content: [{ type: 'text', text: '' }],
|
|
157
|
-
stopReason: 'end_turn',
|
|
158
|
-
usage: { input_tokens: 0, output_tokens: 0 },
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
const content = [];
|
|
162
|
-
// Add text content
|
|
163
|
-
if (choice.message.content) {
|
|
164
|
-
content.push({ type: 'text', text: choice.message.content });
|
|
165
|
-
}
|
|
166
|
-
// Add tool calls
|
|
167
|
-
if (choice.message.tool_calls) {
|
|
168
|
-
for (const tc of choice.message.tool_calls) {
|
|
169
|
-
let input;
|
|
170
|
-
try {
|
|
171
|
-
input = JSON.parse(tc.function.arguments);
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
input = tc.function.arguments;
|
|
175
|
-
}
|
|
176
|
-
content.push({
|
|
177
|
-
type: 'tool_use',
|
|
178
|
-
id: tc.id,
|
|
179
|
-
name: tc.function.name,
|
|
180
|
-
input,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
// If no content at all, add empty text
|
|
185
|
-
if (content.length === 0) {
|
|
186
|
-
content.push({ type: 'text', text: '' });
|
|
187
|
-
}
|
|
188
|
-
// Map finish_reason to our normalized stop reasons
|
|
189
|
-
const stopReason = this.mapFinishReason(choice.finish_reason);
|
|
190
|
-
return {
|
|
191
|
-
content,
|
|
192
|
-
stopReason,
|
|
193
|
-
usage: {
|
|
194
|
-
input_tokens: data.usage?.prompt_tokens || 0,
|
|
195
|
-
output_tokens: data.usage?.completion_tokens || 0,
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
mapFinishReason(reason) {
|
|
200
|
-
switch (reason) {
|
|
201
|
-
case 'stop':
|
|
202
|
-
return 'end_turn';
|
|
203
|
-
case 'length':
|
|
204
|
-
return 'max_tokens';
|
|
205
|
-
case 'tool_calls':
|
|
206
|
-
return 'tool_use';
|
|
207
|
-
default:
|
|
208
|
-
return reason;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
//# sourceMappingURL=openai.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2DH,6EAA6E;AAC7E,WAAW;AACX,6EAA6E;AAE7E,MAAM,OAAO,cAAc;IAChB,OAAO,GAAG,oBAA6B,CAAA;IACxC,MAAM,CAAQ;IACd,OAAO,CAAQ;IAEvB,YAAY,IAA2C;QACrD,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;QACH,CAAC;QAED,uCAAuC;QACvC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;QAC1C,CAAC;QAED,mDAAmD;QACnD,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QAE7D,OAAO;YACL,OAAO;YACP,UAAU;YACV,KAAK,EAAE;gBACL,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,aAAa,IAAI,CAAC;gBAC5C,aAAa,EAAE,IAAI,CAAC,KAAK,EAAE,iBAAiB,IAAI,CAAC;aAClD;SACF,CAAA;IACH,CAAC;IAEO,eAAe,CACrB,MAAc;QAEd,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,MAAM;gBACT,OAAO,UAAU,CAAA;YACnB,KAAK,QAAQ;gBACX,OAAO,YAAY,CAAA;YACrB,KAAK,YAAY;gBACf,OAAO,UAAU,CAAA;YACnB;gBACE,OAAO,MAAM,CAAA;QACjB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM Provider Abstraction Types
|
|
3
|
-
*
|
|
4
|
-
* Defines a provider interface that normalizes API differences between
|
|
5
|
-
* Anthropic Messages API and OpenAI Chat Completions API.
|
|
6
|
-
*
|
|
7
|
-
* Internally the SDK uses Anthropic-like message format as the canonical
|
|
8
|
-
* representation. Providers convert to/from their native API format.
|
|
9
|
-
*/
|
|
10
|
-
export type ApiType = 'anthropic-messages' | 'openai-completions';
|
|
11
|
-
export interface CreateMessageParams {
|
|
12
|
-
model: string;
|
|
13
|
-
maxTokens: number;
|
|
14
|
-
system: string;
|
|
15
|
-
messages: NormalizedMessageParam[];
|
|
16
|
-
tools?: NormalizedTool[];
|
|
17
|
-
thinking?: {
|
|
18
|
-
type: string;
|
|
19
|
-
budget_tokens?: number;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Normalized message format (Anthropic-like).
|
|
24
|
-
* This is the internal representation used throughout the SDK.
|
|
25
|
-
*/
|
|
26
|
-
export interface NormalizedMessageParam {
|
|
27
|
-
role: 'user' | 'assistant';
|
|
28
|
-
content: string | NormalizedContentBlock[];
|
|
29
|
-
}
|
|
30
|
-
export type NormalizedContentBlock = {
|
|
31
|
-
type: 'text';
|
|
32
|
-
text: string;
|
|
33
|
-
} | {
|
|
34
|
-
type: 'tool_use';
|
|
35
|
-
id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
input: any;
|
|
38
|
-
} | {
|
|
39
|
-
type: 'tool_result';
|
|
40
|
-
tool_use_id: string;
|
|
41
|
-
content: string;
|
|
42
|
-
is_error?: boolean;
|
|
43
|
-
} | {
|
|
44
|
-
type: 'image';
|
|
45
|
-
source: any;
|
|
46
|
-
} | {
|
|
47
|
-
type: 'thinking';
|
|
48
|
-
thinking: string;
|
|
49
|
-
};
|
|
50
|
-
export interface NormalizedTool {
|
|
51
|
-
name: string;
|
|
52
|
-
description: string;
|
|
53
|
-
input_schema: {
|
|
54
|
-
type: 'object';
|
|
55
|
-
properties: Record<string, any>;
|
|
56
|
-
required?: string[];
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export interface CreateMessageResponse {
|
|
60
|
-
content: NormalizedResponseBlock[];
|
|
61
|
-
stopReason: 'end_turn' | 'max_tokens' | 'tool_use' | string;
|
|
62
|
-
usage: {
|
|
63
|
-
input_tokens: number;
|
|
64
|
-
output_tokens: number;
|
|
65
|
-
cache_creation_input_tokens?: number;
|
|
66
|
-
cache_read_input_tokens?: number;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
export type NormalizedResponseBlock = {
|
|
70
|
-
type: 'text';
|
|
71
|
-
text: string;
|
|
72
|
-
} | {
|
|
73
|
-
type: 'tool_use';
|
|
74
|
-
id: string;
|
|
75
|
-
name: string;
|
|
76
|
-
input: any;
|
|
77
|
-
};
|
|
78
|
-
export interface LLMProvider {
|
|
79
|
-
/** The API type this provider implements. */
|
|
80
|
-
readonly apiType: ApiType;
|
|
81
|
-
/** Send a message and get a response. */
|
|
82
|
-
createMessage(params: CreateMessageParams): Promise<CreateMessageResponse>;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,MAAM,OAAO,GAAG,oBAAoB,GAAG,oBAAoB,CAAA;AAMjE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,sBAAsB,EAAE,CAAA;IAClC,KAAK,CAAC,EAAE,cAAc,EAAE,CAAA;IACxB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IAC1B,OAAO,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAAA;CAC3C;AAED,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EA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-
* LLM Provider Abstraction Types
|
|
3
|
-
*
|
|
4
|
-
* Defines a provider interface that normalizes API differences between
|
|
5
|
-
* Anthropic Messages API and OpenAI Chat Completions API.
|
|
6
|
-
*
|
|
7
|
-
* Internally the SDK uses Anthropic-like message format as the canonical
|
|
8
|
-
* representation. Providers convert to/from their native API format.
|
|
9
|
-
*/
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|