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.
Files changed (98) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-build-manifest.json +80 -80
  3. package/app/.next/app-path-routes-manifest.json +25 -25
  4. package/app/.next/build-manifest.json +2 -2
  5. package/app/.next/prerender-manifest.json +30 -30
  6. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/_not-found.html +1 -1
  16. package/app/.next/server/app/_not-found.rsc +1 -1
  17. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  22. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  23. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  24. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  25. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  27. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  28. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  30. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  31. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  32. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  33. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  34. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  35. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  36. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  37. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  40. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  42. package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  43. package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  46. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
  48. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  52. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  54. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  57. package/app/.next/server/app/callback.html +1 -1
  58. package/app/.next/server/app/callback.rsc +1 -1
  59. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  60. package/app/.next/server/app/dashboard/cli-tools.rsc +1 -1
  61. package/app/.next/server/app/dashboard/combos.html +1 -1
  62. package/app/.next/server/app/dashboard/combos.rsc +1 -1
  63. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  64. package/app/.next/server/app/dashboard/endpoint.rsc +1 -1
  65. package/app/.next/server/app/dashboard/profile.html +1 -1
  66. package/app/.next/server/app/dashboard/profile.rsc +1 -1
  67. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  68. package/app/.next/server/app/dashboard/providers/new.rsc +1 -1
  69. package/app/.next/server/app/dashboard/providers.html +1 -1
  70. package/app/.next/server/app/dashboard/providers.rsc +1 -1
  71. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  72. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  73. package/app/.next/server/app/dashboard/settings/pricing.rsc +1 -1
  74. package/app/.next/server/app/dashboard.html +1 -1
  75. package/app/.next/server/app/dashboard.rsc +1 -1
  76. package/app/.next/server/app/index.html +1 -1
  77. package/app/.next/server/app/index.rsc +1 -1
  78. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  79. package/app/.next/server/app/landing.html +1 -1
  80. package/app/.next/server/app/landing.rsc +1 -1
  81. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  82. package/app/.next/server/app/login.html +1 -1
  83. package/app/.next/server/app/login.rsc +1 -1
  84. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  85. package/app/.next/server/app-paths-manifest.json +25 -25
  86. package/app/.next/server/chunks/1185.js +1 -1
  87. package/app/.next/server/chunks/4568.js +1 -1
  88. package/app/.next/server/chunks/9753.js +1 -1
  89. package/app/.next/server/chunks/9921.js +3 -3
  90. package/app/.next/server/middleware-manifest.json +1 -1
  91. package/app/.next/server/pages/404.html +1 -1
  92. package/app/.next/server/pages/500.html +1 -1
  93. package/app/.next/server/pages-manifest.json +1 -1
  94. package/app/open-sse/translator/request/openai-to-claude.js +41 -14
  95. package/app/open-sse/translator/response/openai-to-claude.js +11 -1
  96. package/package.json +1 -1
  97. /package/app/.next/static/{iQti2dg7WNsGLj4WOZMDH → h6LxzFqgkFBca-o0RfiZE}/_buildManifest.js +0 -0
  98. /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 capitalized tool names
119
- const toolName = originalName.charAt(0).toUpperCase() + originalName.slice(1);
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
- if (toolName !== originalName) {
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: tc.function.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
- // Un-capitalize tool names (Antigravity doesn't require capitalized names)
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
- const originalName = tool.name.charAt(0).toLowerCase() + tool.name.slice(1);
274
- return { ...tool, name: originalName };
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: tc.function?.name || "",
130
+ name: toolName,
121
131
  input: {}
122
132
  }
123
133
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "9router",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "description": "9Router CLI - Start and manage 9Router server",
5
5
  "bin": {
6
6
  "9router": "./cli.js"