9router 0.2.21 → 0.2.23
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/app/.next/BUILD_ID +1 -1
- package/app/.next/app-build-manifest.json +80 -80
- package/app/.next/app-path-routes-manifest.json +25 -25
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/prerender-manifest.json +30 -30
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +1 -1
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +1 -1
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +25 -25
- package/app/.next/server/chunks/1185.js +1 -1
- package/app/.next/server/chunks/4568.js +1 -1
- package/app/.next/server/chunks/9753.js +1 -1
- package/app/.next/server/chunks/9921.js +3 -3
- package/app/.next/server/middleware-manifest.json +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/pages-manifest.json +1 -1
- package/app/open-sse/translator/request/openai-to-claude.js +41 -14
- package/app/open-sse/translator/response/openai-to-claude.js +11 -1
- package/package.json +1 -1
- /package/app/.next/static/{iQti2dg7WNsGLj4WOZMDH → h6LxzFqgkFBca-o0RfiZE}/_buildManifest.js +0 -0
- /package/app/.next/static/{iQti2dg7WNsGLj4WOZMDH → h6LxzFqgkFBca-o0RfiZE}/_ssgManifest.js +0 -0
|
@@ -3,6 +3,9 @@ import { FORMATS } from "../formats.js";
|
|
|
3
3
|
import { CLAUDE_SYSTEM_PROMPT } from "../../config/constants.js";
|
|
4
4
|
import { adjustMaxTokens } from "../helpers/maxTokensHelper.js";
|
|
5
5
|
|
|
6
|
+
// Prefix for Claude OAuth tool names to avoid conflicts
|
|
7
|
+
const CLAUDE_OAUTH_TOOL_PREFIX = "proxy_";
|
|
8
|
+
|
|
6
9
|
// Convert OpenAI request to Claude format
|
|
7
10
|
function openaiToClaudeRequest(model, body, stream) {
|
|
8
11
|
// Tool name mapping for Claude OAuth (capitalizedName → originalName)
|
|
@@ -47,7 +50,7 @@ function openaiToClaudeRequest(model, body, stream) {
|
|
|
47
50
|
|
|
48
51
|
for (const msg of nonSystemMessages) {
|
|
49
52
|
const newRole = (msg.role === "user" || msg.role === "tool") ? "user" : "assistant";
|
|
50
|
-
const blocks = getContentBlocksFromMessage(msg);
|
|
53
|
+
const blocks = getContentBlocksFromMessage(msg, toolNameMap);
|
|
51
54
|
const hasToolUse = blocks.some(b => b.type === "tool_use");
|
|
52
55
|
const hasToolResult = blocks.some(b => b.type === "tool_result");
|
|
53
56
|
|
|
@@ -109,19 +112,17 @@ function openaiToClaudeRequest(model, body, stream) {
|
|
|
109
112
|
result.system = [claudeCodePrompt];
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
// Tools - convert from OpenAI format to Claude format
|
|
115
|
+
// Tools - convert from OpenAI format to Claude format with prefix for OAuth
|
|
113
116
|
if (body.tools && Array.isArray(body.tools)) {
|
|
114
117
|
result.tools = body.tools.map(tool => {
|
|
115
118
|
const toolData = tool.type === "function" && tool.function ? tool.function : tool;
|
|
116
119
|
const originalName = toolData.name;
|
|
117
120
|
|
|
118
|
-
// Claude requires
|
|
119
|
-
const toolName =
|
|
121
|
+
// Claude OAuth requires prefixed tool names to avoid conflicts
|
|
122
|
+
const toolName = CLAUDE_OAUTH_TOOL_PREFIX + originalName;
|
|
120
123
|
|
|
121
|
-
// Store mapping for response translation
|
|
122
|
-
|
|
123
|
-
toolNameMap.set(toolName, originalName);
|
|
124
|
-
}
|
|
124
|
+
// Store mapping for response translation (prefixed → original)
|
|
125
|
+
toolNameMap.set(toolName, originalName);
|
|
125
126
|
|
|
126
127
|
return {
|
|
127
128
|
name: toolName,
|
|
@@ -149,7 +150,7 @@ function openaiToClaudeRequest(model, body, stream) {
|
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
// Get content blocks from single message
|
|
152
|
-
function getContentBlocksFromMessage(msg) {
|
|
153
|
+
function getContentBlocksFromMessage(msg, toolNameMap = new Map()) {
|
|
153
154
|
const blocks = [];
|
|
154
155
|
|
|
155
156
|
if (msg.role === "tool") {
|
|
@@ -194,6 +195,7 @@ function getContentBlocksFromMessage(msg) {
|
|
|
194
195
|
if (part.type === "text" && part.text) {
|
|
195
196
|
blocks.push({ type: "text", text: part.text });
|
|
196
197
|
} else if (part.type === "tool_use") {
|
|
198
|
+
// Tool name already has prefix from tool declarations, keep as-is
|
|
197
199
|
blocks.push({ type: "tool_use", id: part.id, name: part.name, input: part.input });
|
|
198
200
|
}
|
|
199
201
|
}
|
|
@@ -207,10 +209,12 @@ function getContentBlocksFromMessage(msg) {
|
|
|
207
209
|
if (msg.tool_calls && Array.isArray(msg.tool_calls)) {
|
|
208
210
|
for (const tc of msg.tool_calls) {
|
|
209
211
|
if (tc.type === "function") {
|
|
212
|
+
// Apply prefix to tool name
|
|
213
|
+
const toolName = CLAUDE_OAUTH_TOOL_PREFIX + tc.function.name;
|
|
210
214
|
blocks.push({
|
|
211
215
|
type: "tool_use",
|
|
212
216
|
id: tc.id,
|
|
213
|
-
name:
|
|
217
|
+
name: toolName,
|
|
214
218
|
input: tryParseJSON(tc.function.arguments)
|
|
215
219
|
});
|
|
216
220
|
}
|
|
@@ -266,17 +270,40 @@ function openaiToClaudeRequestForAntigravity(model, body, stream) {
|
|
|
266
270
|
}
|
|
267
271
|
}
|
|
268
272
|
|
|
269
|
-
//
|
|
273
|
+
// Strip prefix from tool names for Antigravity (doesn't use Claude OAuth)
|
|
270
274
|
if (result.tools && Array.isArray(result.tools)) {
|
|
271
275
|
result.tools = result.tools.map(tool => {
|
|
272
|
-
if (tool.name) {
|
|
273
|
-
|
|
274
|
-
|
|
276
|
+
if (tool.name && tool.name.startsWith(CLAUDE_OAUTH_TOOL_PREFIX)) {
|
|
277
|
+
return {
|
|
278
|
+
...tool,
|
|
279
|
+
name: tool.name.slice(CLAUDE_OAUTH_TOOL_PREFIX.length)
|
|
280
|
+
};
|
|
275
281
|
}
|
|
276
282
|
return tool;
|
|
277
283
|
});
|
|
278
284
|
}
|
|
279
285
|
|
|
286
|
+
// Strip prefix from tool_use in messages
|
|
287
|
+
if (result.messages && Array.isArray(result.messages)) {
|
|
288
|
+
result.messages = result.messages.map(msg => {
|
|
289
|
+
if (!msg.content || !Array.isArray(msg.content)) {
|
|
290
|
+
return msg;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const updatedContent = msg.content.map(block => {
|
|
294
|
+
if (block.type === "tool_use" && block.name && block.name.startsWith(CLAUDE_OAUTH_TOOL_PREFIX)) {
|
|
295
|
+
return {
|
|
296
|
+
...block,
|
|
297
|
+
name: block.name.slice(CLAUDE_OAUTH_TOOL_PREFIX.length)
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
return block;
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
return { ...msg, content: updatedContent };
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
280
307
|
return result;
|
|
281
308
|
}
|
|
282
309
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { register } from "../index.js";
|
|
2
2
|
import { FORMATS } from "../formats.js";
|
|
3
3
|
|
|
4
|
+
// Prefix for Claude OAuth tool names (must match request translator)
|
|
5
|
+
const CLAUDE_OAUTH_TOOL_PREFIX = "proxy_";
|
|
6
|
+
|
|
4
7
|
// Helper: stop thinking block if started
|
|
5
8
|
function stopThinkingBlock(state, results) {
|
|
6
9
|
if (!state.thinkingBlockStarted) return;
|
|
@@ -111,13 +114,20 @@ function openaiToClaudeResponse(chunk, state) {
|
|
|
111
114
|
|
|
112
115
|
const toolBlockIndex = state.nextBlockIndex++;
|
|
113
116
|
state.toolCalls.set(idx, { id: tc.id, name: tc.function?.name || "", blockIndex: toolBlockIndex });
|
|
117
|
+
|
|
118
|
+
// Strip prefix from tool name for response
|
|
119
|
+
let toolName = tc.function?.name || "";
|
|
120
|
+
if (toolName.startsWith(CLAUDE_OAUTH_TOOL_PREFIX)) {
|
|
121
|
+
toolName = toolName.slice(CLAUDE_OAUTH_TOOL_PREFIX.length);
|
|
122
|
+
}
|
|
123
|
+
|
|
114
124
|
results.push({
|
|
115
125
|
type: "content_block_start",
|
|
116
126
|
index: toolBlockIndex,
|
|
117
127
|
content_block: {
|
|
118
128
|
type: "tool_use",
|
|
119
129
|
id: tc.id,
|
|
120
|
-
name:
|
|
130
|
+
name: toolName,
|
|
121
131
|
input: {}
|
|
122
132
|
}
|
|
123
133
|
});
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|