@amir83nasr/10router 0.1.4 → 0.1.6
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +7 -7
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +5 -0
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +5 -5
- package/.next/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/changelog/route.js +1 -1
- package/.next/server/app/api/cli-tools/all-statuses/route.js +1 -1
- package/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/dsh-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/.next/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/.next/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/.next/server/app/api/providers/client/route.js +1 -1
- package/.next/server/app/api/translator/send/route.js +1 -1
- package/.next/server/app/api/translator/translate/route.js +1 -1
- package/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/.next/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/.next/server/app/callback.html +1 -1
- package/.next/server/app/callback.rsc +6 -6
- package/.next/server/app/callback.segments/_full.segment.rsc +6 -6
- package/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/basic-chat.html +1 -1
- package/.next/server/app/dashboard/basic-chat.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/cli-tools.html +1 -1
- package/.next/server/app/dashboard/cli-tools.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/combos.html +1 -1
- package/.next/server/app/dashboard/combos.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/endpoint.html +1 -1
- package/.next/server/app/dashboard/endpoint.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/media-providers/systemone.html +1 -1
- package/.next/server/app/dashboard/media-providers/systemone.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/systemone/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/profile.html +1 -1
- package/.next/server/app/dashboard/profile.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/providers/new.html +1 -1
- package/.next/server/app/dashboard/providers/new.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/providers.html +1 -1
- package/.next/server/app/dashboard/providers.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/.next/server/app/dashboard/proxy-pools.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/pxpipe.html +1 -1
- package/.next/server/app/dashboard/pxpipe.rsc +6 -6
- package/.next/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/pxpipe.segments/_full.segment.rsc +6 -6
- package/.next/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/quota.html +2 -2
- package/.next/server/app/dashboard/quota.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/.next/server/app/dashboard/settings/pricing.rsc +5 -5
- package/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
- package/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/dashboard/token-saver.html +1 -1
- package/.next/server/app/dashboard/token-saver.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/usage.html +2 -2
- package/.next/server/app/dashboard/usage.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard.html +1 -1
- package/.next/server/app/dashboard.rsc +7 -7
- package/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/landing.html +1 -1
- package/.next/server/app/landing.rsc +6 -6
- package/.next/server/app/landing.segments/_full.segment.rsc +6 -6
- package/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -5
- package/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +7 -7
- package/.next/server/chunks/1011.js +1 -1
- package/.next/server/chunks/1194.js +1 -1
- package/.next/server/chunks/1289.js +1 -1
- package/.next/server/chunks/1633.js +1 -1
- package/.next/server/chunks/2282.js +7 -7
- package/.next/server/chunks/2339.js +1 -1
- package/.next/server/chunks/2801.js +1 -1
- package/.next/server/chunks/3425.js +1 -1
- package/.next/server/chunks/537.js +5 -1
- package/.next/server/chunks/6056.js +1 -1
- package/.next/server/chunks/6343.js +6 -6
- package/.next/server/chunks/9429.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/1278-16cc8ebc3a4c8af5.js +1 -0
- package/.next/static/chunks/{1471-69a7c30abf98c656.js → 1471-10f225f62f7469cc.js} +1 -1
- package/.next/static/chunks/{1699-49be310981e2759e.js → 1699-13ee6864a8a31a96.js} +2 -2
- package/.next/static/chunks/{3577-1f02993330d7fba7.js → 3577-cd98d40e3099e1b0.js} +1 -1
- package/.next/static/chunks/{5862-6f3a3a6d4c00100d.js → 5862-f98c2f3d480b80d2.js} +1 -1
- package/.next/static/chunks/{9ce8c186-6cd204e9c27ecee1.js → 9ce8c186-3c7d7dbc5d428052.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/console-log/{page-c803a3376280f0e8.js → page-30d1f039dfdca294.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/new/{page-cef3c079d15c9349.js → page-fc4d1c1291545177.js} +1 -1
- package/.next/static/chunks/app/{layout-101b832aa6789b60.js → layout-43bf918527d2f137.js} +1 -1
- package/CHANGELOG.md +66 -0
- package/next.config.mjs +5 -0
- package/open-sse/executors/opencode-zen.js +38 -98
- package/open-sse/executors/opencode.js +41 -198
- package/open-sse/handlers/chatCore/nonStreamingHandler.js +2 -1
- package/open-sse/handlers/chatCore/sseToJsonHandler.js +5 -3
- package/open-sse/handlers/chatCore.js +6 -0
- package/open-sse/translator/index.js +6 -2
- package/open-sse/utils/opencodeFingerprint.js +385 -0
- package/package.json +3 -2
- package/src/app/api/changelog/{route.js → route.ts} +2 -1
- package/src/app/api/version/route.js +1 -1
- package/src/lib/versionCheck.js +18 -16
- package/src/shared/components/UpdateDialog.tsx +1 -1
- package/.next/static/chunks/1278-ad2cb39d11b4a5f2.js +0 -1
- /package/.next/static/{nOEr8lKXMARlP2mV3XFuF → kcbgqbQp7PqJfusgfYenC}/_buildManifest.js +0 -0
- /package/.next/static/{nOEr8lKXMARlP2mV3XFuF → kcbgqbQp7PqJfusgfYenC}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for the OpenCode free-tier client fingerprint.
|
|
3
|
+
*
|
|
4
|
+
* Live upstream probes (OpenCode v2, /inference/v1) show that free-tier
|
|
5
|
+
* requests must declare OpenCode's own `read` and `shell` tools with their exact
|
|
6
|
+
* descriptions and parameter schemas; stubbed descriptions, renamed schemas or
|
|
7
|
+
* tool_choice "none" are answered with 403 FreeTierError. Caller tools are sent
|
|
8
|
+
* untouched, except one that already uses an exact fingerprint name with a
|
|
9
|
+
* different definition: it travels under an alias and the response side
|
|
10
|
+
* restores the caller's original name.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Names required by the upstream free-tier gate. */
|
|
14
|
+
export const OPENCODE_FINGERPRINT_TOOLS = ["read", "shell"];
|
|
15
|
+
|
|
16
|
+
// Verbatim from the OpenCode v2.0.26 CLI. Upstream compares description and
|
|
17
|
+
// parameters, so do not reword or reformat these.
|
|
18
|
+
const FINGERPRINT_TOOL_DEFINITIONS = {
|
|
19
|
+
read: {
|
|
20
|
+
description:
|
|
21
|
+
"Read the contents of a file or directory. Supports text files, images, and PDFs. Images and PDFs are presented directly to the model. Each text line is prefixed by its 1-based line number as <line>: <content>. The prefix is for reference and is not part of the file content. Directory entries are returned one per line. Use offset and limit to read large files or directories in sections. Prefer one larger read over many small slices, and use grep to find specific content in large files.",
|
|
22
|
+
parameters: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {
|
|
25
|
+
path: { type: "string", description: "File or directory to read" },
|
|
26
|
+
offset: {
|
|
27
|
+
type: "integer",
|
|
28
|
+
minimum: 0,
|
|
29
|
+
description: "The line or directory entry to start reading from (1-based)",
|
|
30
|
+
},
|
|
31
|
+
limit: {
|
|
32
|
+
type: "integer",
|
|
33
|
+
minimum: 0,
|
|
34
|
+
description:
|
|
35
|
+
"The maximum number of lines or directory entries to read (defaults to and capped at 2000)",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ["path"],
|
|
39
|
+
additionalProperties: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
shell: {
|
|
43
|
+
description:
|
|
44
|
+
"Execute a shell command and return its output. Commands run on Linux using bash. Quote file paths containing spaces or special characters. Prefer dedicated tools over shell commands when possible. When output is large, the full result is saved to a file and a truncated preview is returned. Rely on automatic truncation unless filtering the output is more useful. Commands accept an optional timeout, background commands have no timeout by default. Background commands return immediately, and you will be notified when they complete.",
|
|
45
|
+
parameters: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
command: { type: "string", description: "Shell command string to execute" },
|
|
49
|
+
workdir: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description:
|
|
52
|
+
"Working directory to execute the command in. Defaults to the current working directory. When possible, avoid changing directories in the command and set the working directory here instead.",
|
|
53
|
+
},
|
|
54
|
+
timeout: {
|
|
55
|
+
type: "integer",
|
|
56
|
+
minimum: 0,
|
|
57
|
+
description:
|
|
58
|
+
"Timeout in milliseconds. Set to 0 to disable the timeout. Defaults to 120000 for foreground commands. Background commands have no timeout by default.",
|
|
59
|
+
},
|
|
60
|
+
background: {
|
|
61
|
+
type: "boolean",
|
|
62
|
+
description:
|
|
63
|
+
"Run the command in the background and return immediately (useful for dev servers and long-running builds). You do not need to use '&' at the end of the command when using this parameter. You will be notified when it completes. DO NOT poll for completion.",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
required: ["command"],
|
|
67
|
+
additionalProperties: false,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Request body -> names renamed for that request. transformRequest() mutates the
|
|
73
|
+
// same body object that chatCore passed into the executor, so a WeakMap keeps the
|
|
74
|
+
// mapping request-local without putting transport metadata on the wire.
|
|
75
|
+
const renamedToolNames = new WeakMap();
|
|
76
|
+
|
|
77
|
+
/** The fingerprint name when `name` is exactly one; "" otherwise. */
|
|
78
|
+
export function fingerprintToolKey(name) {
|
|
79
|
+
const trimmed = String(name ?? "").trim();
|
|
80
|
+
return OPENCODE_FINGERPRINT_TOOLS.includes(trimmed) ? trimmed : "";
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Read a tool name from either flat ({name}) or chat ({function:{name}}) shape. */
|
|
84
|
+
function toolNameOf(tool) {
|
|
85
|
+
if (!tool || typeof tool !== "object" || Array.isArray(tool)) return "";
|
|
86
|
+
if (typeof tool.name === "string" && tool.name.trim()) return tool.name.trim();
|
|
87
|
+
const fn = tool.function;
|
|
88
|
+
if (fn && typeof fn === "object" && !Array.isArray(fn) && typeof fn.name === "string") {
|
|
89
|
+
return fn.name.trim();
|
|
90
|
+
}
|
|
91
|
+
return "";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function chatFunctionOf(tool) {
|
|
95
|
+
const fn = tool?.function;
|
|
96
|
+
return fn && typeof fn === "object" && !Array.isArray(fn) ? fn : null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** True when `tool` already carries OpenCode's exact definition for `key`. */
|
|
100
|
+
function isFingerprintDefinition(tool, key) {
|
|
101
|
+
const def = tool && (chatFunctionOf(tool) || tool);
|
|
102
|
+
const want = FINGERPRINT_TOOL_DEFINITIONS[key];
|
|
103
|
+
return (
|
|
104
|
+
!!def &&
|
|
105
|
+
def.description === want.description &&
|
|
106
|
+
JSON.stringify(def.parameters) === JSON.stringify(want.parameters)
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function withToolName(tool, name) {
|
|
111
|
+
const fn = chatFunctionOf(tool);
|
|
112
|
+
return fn ? { ...tool, function: { ...fn, name } } : { ...tool, name };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Move caller tools off the fingerprint names when their definition differs
|
|
117
|
+
* from OpenCode's, so the exact definitions can be appended without a
|
|
118
|
+
* duplicate name. Everything else, including case variants such as `Read`, is
|
|
119
|
+
* preserved verbatim; upstream accepts them alongside `read`.
|
|
120
|
+
*
|
|
121
|
+
* @param {Array} tools
|
|
122
|
+
* @returns {{ tools: Array, map: Map<string,string> }} map: sent name -> original name
|
|
123
|
+
*/
|
|
124
|
+
export function concealFingerprintToolNames(tools) {
|
|
125
|
+
const map = new Map();
|
|
126
|
+
if (!Array.isArray(tools) || tools.length === 0) return { tools, map };
|
|
127
|
+
|
|
128
|
+
const taken = new Set(tools.map(toolNameOf));
|
|
129
|
+
const seen = new Set();
|
|
130
|
+
const out = [];
|
|
131
|
+
for (const tool of tools) {
|
|
132
|
+
if (!tool || typeof tool !== "object" || Array.isArray(tool)) {
|
|
133
|
+
out.push(tool);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const key = fingerprintToolKey(toolNameOf(tool));
|
|
138
|
+
if (!key) {
|
|
139
|
+
out.push(tool);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Duplicate declarations of one name are rejected upstream; keep the first.
|
|
144
|
+
if (seen.has(key)) continue;
|
|
145
|
+
seen.add(key);
|
|
146
|
+
|
|
147
|
+
if (isFingerprintDefinition(tool, key)) {
|
|
148
|
+
out.push(tool);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
let alias = `${key}_client`;
|
|
153
|
+
for (let i = 2; taken.has(alias); i++) alias = `${key}_client${i}`;
|
|
154
|
+
taken.add(alias);
|
|
155
|
+
map.set(alias, key);
|
|
156
|
+
out.push(withToolName(tool, alias));
|
|
157
|
+
}
|
|
158
|
+
return { tools: out, map };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Append OpenCode's definition for each fingerprint tool not already declared.
|
|
163
|
+
*
|
|
164
|
+
* @returns {string[]} names that were appended
|
|
165
|
+
*/
|
|
166
|
+
export function appendMissingFingerprintTools(tools, flat) {
|
|
167
|
+
const appended = [];
|
|
168
|
+
if (!Array.isArray(tools)) return appended;
|
|
169
|
+
for (const name of OPENCODE_FINGERPRINT_TOOLS) {
|
|
170
|
+
if (tools.some((tool) => fingerprintToolKey(toolNameOf(tool)) === name)) continue;
|
|
171
|
+
const { description, parameters } = FINGERPRINT_TOOL_DEFINITIONS[name];
|
|
172
|
+
tools.push(
|
|
173
|
+
flat
|
|
174
|
+
? { type: "function", name, description, parameters, strict: false }
|
|
175
|
+
: { type: "function", function: { name, description, parameters } },
|
|
176
|
+
);
|
|
177
|
+
appended.push(name);
|
|
178
|
+
}
|
|
179
|
+
return appended;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Invert a sent -> original rename map. */
|
|
183
|
+
function aliasesByOriginal(map) {
|
|
184
|
+
return new Map([...map].map(([alias, original]) => [original, alias]));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Point an explicit tool_choice at the alias of a concealed caller tool. */
|
|
188
|
+
export function retargetToolChoice(body, map) {
|
|
189
|
+
if (!body || typeof body !== "object" || !map?.size) return;
|
|
190
|
+
const choice = body.tool_choice;
|
|
191
|
+
if (!choice || typeof choice !== "object" || Array.isArray(choice)) return;
|
|
192
|
+
const aliases = aliasesByOriginal(map);
|
|
193
|
+
|
|
194
|
+
if (typeof choice.name === "string") {
|
|
195
|
+
const alias = aliases.get(choice.name.trim());
|
|
196
|
+
if (alias) body.tool_choice = { ...choice, name: alias };
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const fn = choice.function;
|
|
201
|
+
if (fn && typeof fn === "object" && !Array.isArray(fn) && typeof fn.name === "string") {
|
|
202
|
+
const alias = aliases.get(fn.name.trim());
|
|
203
|
+
if (alias) body.tool_choice = { ...choice, function: { ...fn, name: alias } };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Rename prior-turn calls to concealed caller tools as well; otherwise the model
|
|
209
|
+
* reads its own earlier calls as calls to OpenCode's tool of the same name.
|
|
210
|
+
*/
|
|
211
|
+
export function aliasHistoryToolCalls(body, map) {
|
|
212
|
+
if (!body || typeof body !== "object" || !map?.size) return;
|
|
213
|
+
const aliases = aliasesByOriginal(map);
|
|
214
|
+
|
|
215
|
+
if (Array.isArray(body.input)) {
|
|
216
|
+
body.input = body.input.map((item) =>
|
|
217
|
+
item?.type === "function_call" && aliases.has(item.name)
|
|
218
|
+
? { ...item, name: aliases.get(item.name) }
|
|
219
|
+
: item,
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (Array.isArray(body.messages)) {
|
|
224
|
+
body.messages = body.messages.map((msg) => {
|
|
225
|
+
if (!Array.isArray(msg?.tool_calls)) return msg;
|
|
226
|
+
return {
|
|
227
|
+
...msg,
|
|
228
|
+
tool_calls: msg.tool_calls.map((call) =>
|
|
229
|
+
aliases.has(call?.function?.name)
|
|
230
|
+
? { ...call, function: { ...call.function, name: aliases.get(call.function.name) } }
|
|
231
|
+
: call,
|
|
232
|
+
),
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Without the old "must not be used" descriptions the model does call the
|
|
239
|
+
// appended tools (live probe: `read` on "what files are in /etc?"), so tell it
|
|
240
|
+
// in the system prompt instead. Upstream does not gate on the prompt text.
|
|
241
|
+
// Wording matters: "not available" made the model also refuse the caller's own
|
|
242
|
+
// Read/Bash; "placeholders ... use the other tools" kept those working.
|
|
243
|
+
function noteUnavailableTools(body, flat, names) {
|
|
244
|
+
const list = names.map((name) => `\`${name}\``).join(" or ");
|
|
245
|
+
const note =
|
|
246
|
+
names.length > 1
|
|
247
|
+
? `Do not call the ${list} tools; they are placeholders that do nothing. Use the other tools you have been given instead.`
|
|
248
|
+
: `Do not call the ${list} tool; it is a placeholder that does nothing. Use the other tools you have been given instead.`;
|
|
249
|
+
if (flat) {
|
|
250
|
+
body.instructions =
|
|
251
|
+
typeof body.instructions === "string" && body.instructions.trim()
|
|
252
|
+
? `${body.instructions}\n\n${note}`
|
|
253
|
+
: note;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
// OpenAI chat shape only; Claude-shaped bodies carry `system` instead.
|
|
257
|
+
if (!Array.isArray(body.messages) || body.system !== undefined) return;
|
|
258
|
+
const first = body.messages[0];
|
|
259
|
+
if (first?.role === "system" && typeof first.content === "string") {
|
|
260
|
+
body.messages = [
|
|
261
|
+
{ ...first, content: `${first.content}\n\n${note}` },
|
|
262
|
+
...body.messages.slice(1),
|
|
263
|
+
];
|
|
264
|
+
} else {
|
|
265
|
+
body.messages = [{ role: "system", content: note }, ...body.messages];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Full request-side pass: alias conflicting caller tools, append OpenCode's
|
|
271
|
+
* fingerprint definitions, and tell the model the appended ones are off-limits.
|
|
272
|
+
*
|
|
273
|
+
* @param {object} body
|
|
274
|
+
* @param {boolean} flat - true for Responses tools ({name}), false for chat tools
|
|
275
|
+
* @returns {Map<string,string>} map: sent name -> original name
|
|
276
|
+
*/
|
|
277
|
+
export function applyFingerprintTools(body, flat) {
|
|
278
|
+
if (!body || typeof body !== "object") return new Map();
|
|
279
|
+
|
|
280
|
+
const { tools, map } = concealFingerprintToolNames(body.tools);
|
|
281
|
+
body.tools = Array.isArray(tools) ? tools : [];
|
|
282
|
+
const appended = appendMissingFingerprintTools(body.tools, flat);
|
|
283
|
+
retargetToolChoice(body, map);
|
|
284
|
+
aliasHistoryToolCalls(body, map);
|
|
285
|
+
if (appended.length) noteUnavailableTools(body, flat, appended);
|
|
286
|
+
|
|
287
|
+
// Responses keeps its explicit auto default. Never default to "none": upstream
|
|
288
|
+
// answers tool_choice "none" with 403 FreeTierError.
|
|
289
|
+
if (!body.tool_choice && flat) body.tool_choice = "auto";
|
|
290
|
+
|
|
291
|
+
recordRenamedToolNames(body, map);
|
|
292
|
+
return map;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** Store the rename map for `body`. */
|
|
296
|
+
export function recordRenamedToolNames(body, map) {
|
|
297
|
+
if (!body || typeof body !== "object" || !map?.size) return;
|
|
298
|
+
renamedToolNames.set(body, map);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Retrieve the rename map for `body`. */
|
|
302
|
+
export function takeRenamedToolNames(body) {
|
|
303
|
+
if (!body || typeof body !== "object") return null;
|
|
304
|
+
return renamedToolNames.get(body) || null;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Response side -------------------------------------------------------------
|
|
308
|
+
|
|
309
|
+
/** Restore caller tool spellings in supported response/event shapes. */
|
|
310
|
+
export function restoreToolNames(payload, map) {
|
|
311
|
+
if (!map?.size || !payload) return payload;
|
|
312
|
+
if (Array.isArray(payload)) return payload.map((item) => restoreToolNames(item, map));
|
|
313
|
+
if (typeof payload !== "object") return payload;
|
|
314
|
+
|
|
315
|
+
let out = payload;
|
|
316
|
+
const put = (key, value) => {
|
|
317
|
+
if (out === payload) out = { ...payload };
|
|
318
|
+
out[key] = value;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// Claude streaming content_block_start event.
|
|
322
|
+
if (payload.type === "content_block_start") {
|
|
323
|
+
const block = payload.content_block;
|
|
324
|
+
if (block?.type === "tool_use" && typeof block.name === "string" && map.has(block.name)) {
|
|
325
|
+
put("content_block", { ...block, name: map.get(block.name) });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Claude non-streaming message body.
|
|
330
|
+
if (Array.isArray(payload.content)) {
|
|
331
|
+
put(
|
|
332
|
+
"content",
|
|
333
|
+
payload.content.map((block) =>
|
|
334
|
+
block?.type === "tool_use" && typeof block.name === "string" && map.has(block.name)
|
|
335
|
+
? { ...block, name: map.get(block.name) }
|
|
336
|
+
: block,
|
|
337
|
+
),
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// OpenAI Chat Completions, both streaming delta and JSON message shapes.
|
|
342
|
+
if (Array.isArray(payload.choices)) {
|
|
343
|
+
put(
|
|
344
|
+
"choices",
|
|
345
|
+
payload.choices.map((choice) => {
|
|
346
|
+
let changed = false;
|
|
347
|
+
const next = { ...choice };
|
|
348
|
+
for (const holder of ["delta", "message"]) {
|
|
349
|
+
const value = choice?.[holder];
|
|
350
|
+
if (!value || !Array.isArray(value.tool_calls) || value.tool_calls.length === 0) continue;
|
|
351
|
+
const calls = value.tool_calls.map((call) => {
|
|
352
|
+
const name = call?.function?.name;
|
|
353
|
+
if (typeof name === "string" && map.has(name)) {
|
|
354
|
+
changed = true;
|
|
355
|
+
return { ...call, function: { ...call.function, name: map.get(name) } };
|
|
356
|
+
}
|
|
357
|
+
return call;
|
|
358
|
+
});
|
|
359
|
+
next[holder] = { ...value, tool_calls: calls };
|
|
360
|
+
}
|
|
361
|
+
return changed ? next : choice;
|
|
362
|
+
}),
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// OpenAI Responses final JSON body.
|
|
367
|
+
if (Array.isArray(payload.output)) {
|
|
368
|
+
put(
|
|
369
|
+
"output",
|
|
370
|
+
payload.output.map((item) =>
|
|
371
|
+
item?.type === "function_call" && typeof item.name === "string" && map.has(item.name)
|
|
372
|
+
? { ...item, name: map.get(item.name) }
|
|
373
|
+
: item,
|
|
374
|
+
),
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// OpenAI Responses SSE events such as response.output_item.added/done.
|
|
379
|
+
const item = payload.item;
|
|
380
|
+
if (item?.type === "function_call" && typeof item.name === "string" && map.has(item.name)) {
|
|
381
|
+
put("item", { ...item, name: map.get(item.name) });
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return out;
|
|
385
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amir83nasr/10router",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Amir83Nasr/10Router.git"
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"bin/",
|
|
15
|
+
"CHANGELOG.md",
|
|
15
16
|
"custom-server.js",
|
|
16
17
|
"src/",
|
|
17
18
|
"open-sse/",
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"jose": "^6.1.3",
|
|
65
66
|
"lucide-react": "^1.47.0",
|
|
66
67
|
"marked": "^18.0.1",
|
|
67
|
-
"next": "
|
|
68
|
+
"next": "16.3.5",
|
|
68
69
|
"node-machine-id": "^1.1.12",
|
|
69
70
|
"open": "^11.0.0",
|
|
70
71
|
"ora": "^9.1.0",
|
|
@@ -12,7 +12,8 @@ export async function GET() {
|
|
|
12
12
|
let markdown = "";
|
|
13
13
|
try {
|
|
14
14
|
markdown = await fs.promises.readFile(path.join(process.cwd(), "CHANGELOG.md"), "utf8");
|
|
15
|
-
} catch {
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error("GET /api/changelog: failed to read CHANGELOG.md", error);
|
|
16
17
|
return NextResponse.json(
|
|
17
18
|
{ error: "changelog unavailable" },
|
|
18
19
|
{ status: 500, headers: CORS_HEADERS },
|
|
@@ -3,7 +3,7 @@ import { getLatestVersion, isNewerVersion } from "@/lib/versionCheck";
|
|
|
3
3
|
|
|
4
4
|
export async function GET() {
|
|
5
5
|
const currentVersion = pkg.version;
|
|
6
|
-
// Fail-open:
|
|
6
|
+
// Fail-open: npm registry unreachable → latestVersion falls back to current.
|
|
7
7
|
const { version, reason } = await getLatestVersion();
|
|
8
8
|
const latestVersion = version || currentVersion;
|
|
9
9
|
return Response.json({
|
package/src/lib/versionCheck.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Single source of truth for the dashboard update check (/api/version →
|
|
2
|
+
// sidebar VersionLabel). Uses the npm registry — not GitHub tags — so the
|
|
3
|
+
// offered version always matches `npm i -g <pkg>@latest`.
|
|
4
|
+
import pkg from "../../package.json" with { type: "json" };
|
|
5
|
+
|
|
6
|
+
const NPM_PKG = pkg.name || "@amir83nasr/10router";
|
|
7
|
+
const LATEST_URL = `https://registry.npmjs.org/${NPM_PKG.replace("/", "%2F")}/latest`;
|
|
3
8
|
const CACHE_TTL_MS = 6 * 60 * 60 * 1000;
|
|
4
|
-
// Short negative cache so one
|
|
9
|
+
// Short negative cache so one npm failure (rate limit / no egress on
|
|
5
10
|
// docker) doesn't turn every /api/version hit into another upstream call.
|
|
6
11
|
const FAIL_TTL_MS = 10 * 60 * 1000;
|
|
7
12
|
|
|
@@ -36,26 +41,23 @@ export async function getLatestVersion({ fetchFn = fetch, now = Date.now } = {})
|
|
|
36
41
|
return { version: cache.latest, reason: "cache-fresh" };
|
|
37
42
|
if (!cache.latest && now() - cache.failAt < FAIL_TTL_MS)
|
|
38
43
|
return { version: null, reason: "cooldown" };
|
|
39
|
-
const headers = { Accept: "application/vnd.github+json", "User-Agent": "10router" };
|
|
40
|
-
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
|
41
|
-
if (token) headers.Authorization = `Bearer ${token}`;
|
|
42
44
|
try {
|
|
43
|
-
const res = await fetchFn(
|
|
44
|
-
headers,
|
|
45
|
+
const res = await fetchFn(LATEST_URL, {
|
|
46
|
+
headers: { Accept: "application/json" },
|
|
45
47
|
signal: AbortSignal.timeout(8000),
|
|
46
48
|
});
|
|
47
49
|
if (!res.ok) {
|
|
48
50
|
cache.failAt = now();
|
|
49
|
-
return { version: cache.latest, reason: `
|
|
51
|
+
return { version: cache.latest, reason: `npm-${res.status}` };
|
|
50
52
|
}
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const data = await res.json();
|
|
54
|
+
const v = normalizeVersion(data?.version);
|
|
55
|
+
if (!/^\d+\.\d+\.\d+/.test(v)) {
|
|
56
|
+
cache.failAt = now();
|
|
57
|
+
return { version: cache.latest, reason: "no-version" };
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
return { version:
|
|
59
|
+
cache = { at: now(), latest: v, failAt: 0 };
|
|
60
|
+
return { version: v, reason: "npm" };
|
|
59
61
|
} catch (err) {
|
|
60
62
|
cache.failAt = now();
|
|
61
63
|
return { version: cache.latest, reason: "fetch-error" };
|
|
@@ -203,7 +203,7 @@ export default function UpdateDialog({
|
|
|
203
203
|
const status = !info ? (
|
|
204
204
|
<p className="rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm text-muted-foreground">
|
|
205
205
|
{checkFailed
|
|
206
|
-
? "Could not reach
|
|
206
|
+
? "Could not reach npm registry to check for updates — the manual steps below still work."
|
|
207
207
|
: "Checking for updates…"}
|
|
208
208
|
</p>
|
|
209
209
|
) : info.hasUpdate ? (
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1278],{738:(e,t,a)=>{a.d(t,{A:()=>n});var r=a(29798),s=a(15814),i=a(63729);function n({src:e,providerId:t,alt:a,size:o=32,className:l="",fallbackText:d="?",fallbackColor:c}){let u=function(e,t){if(t)return(0,i.HY)(t);if(!e)return null;let a=String(e).match(/^\/providers\/([^/]+)\.png$/i);return a?(0,i.HY)(a[1]):e}(e,t),[m,p]=(0,s.useState)(!1);return!u||m?(0,r.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${l}`.trim(),style:{width:o,height:o,color:c,fontSize:Math.max(10,Math.floor(.38*o))},children:d}):(0,r.jsx)("img",{src:u,alt:a,width:o,height:o,className:l,loading:"lazy",decoding:"async",onError:()=>{let e=u.match(/^\/providers\/([^/]+)\.png$/i);e&&(0,i.Kw)(e[1]),t&&(0,i.Kw)(t),p(!0)}})}},3537:(e,t,a)=>{a.d(t,{ConfirmModal:()=>u,default:()=>c});var r=a(29798),s=a(15814),i=a(69221),n=a(13008),o=a(18055),l=a(49787);let d={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"};function c({isOpen:e,onClose:t,title:a,children:i,footer:o,size:u="md",closeOnOverlay:m=!0,className:p}){return(0,s.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,r.jsx)(l.lG,{open:!!e,onOpenChange:e=>{e||t()},children:(0,r.jsxs)(l.Cf,{className:(0,n.cn)(d[u],p),onPointerDownOutside:m?void 0:e=>e.preventDefault(),onInteractOutside:m?void 0:e=>e.preventDefault(),children:[a&&(0,r.jsx)(l.c7,{children:(0,r.jsx)(l.L3,{children:a})}),(0,r.jsx)("div",{className:"max-h-[calc(85vh-100px)] overflow-y-auto p-4",children:i}),o&&(0,r.jsx)(l.Es,{children:o})]})})}function u({isOpen:e,onClose:t,onConfirm:a,title:s="Confirm",message:n,confirmText:l="Confirm",cancelText:d="Cancel",variant:m="danger",loading:p=!1}){return(0,r.jsx)(c,{isOpen:e,onClose:t,title:s,size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.$,{variant:"ghost",onClick:t,disabled:p,children:d}),(0,r.jsxs)(o.$,{variant:"danger"===m?"destructive":"primary"===m?"default":m,onClick:a,disabled:p,children:[p&&(0,r.jsx)(i.A,{className:"animate-spin"}),l]})]}),children:(0,r.jsx)("p",{className:"text-muted-foreground",children:n})})}},13008:(e,t,a)=>{a.d(t,{cn:()=>s});var r=a(5471);function s(...e){return(0,r.cn)(...e)}},16675:(e,t,a)=>{a.d(t,{default:()=>em});var r=a(29798),s=a(58913),i=a(70782),n=a(41671),o=a(42535),l=a(15814),d=a(16653),c=a(50141),u=a.n(c),m=a(51660),p=a(1352),x=a(69221),h=a(53784),f=a(18055),g=a(75669),b=a(49787),v=a(63523),j=a(63175);let w=["docker compose pull","docker compose up -d"],y=["docker pull ghcr.io/amir83nasr/10router:latest","docker stop 10router && docker rm 10router",'docker run -d --name 10router -p 20128:20128 -v "$HOME/.10router:/app/data" -e DATA_DIR=/app/data ghcr.io/amir83nasr/10router:latest'],k=["git pull","pnpm install","pnpm run build && PORT=20128 pnpm run start"];function N({id:e,steps:t}){let{copied:a,copy:i}=(0,v.C)();return(0,r.jsx)("ol",{className:"flex flex-col gap-1.5",children:t.map((t,n)=>{let o=`${e}-${n}`,l=a===o;return(0,r.jsxs)("li",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-medium text-muted-foreground",children:n+1}),(0,r.jsx)("code",{className:"min-w-0 flex-1 rounded bg-muted px-2 py-1 font-mono text-xs break-all",children:t}),(0,r.jsx)(f.$,{variant:"ghost",size:"icon-xs",onClick:()=>i(t,o),"aria-label":`Copy step ${n+1}: ${t}`,children:(0,r.jsx)(s.default,{name:l?"check":"content_copy",className:"size-3.5"})})]},o)})})}function C({title:e,icon:t,id:a,steps:i}){return(0,r.jsxs)("details",{className:"group rounded-lg border border-border",children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-sm font-medium text-foreground [&::-webkit-details-marker]:hidden",children:[(0,r.jsx)(s.default,{name:t,className:"size-4 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"flex-1",children:e}),(0,r.jsx)(s.default,{name:"expand_more",className:"size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),(0,r.jsx)("div",{className:"px-3 py-2",children:(0,r.jsx)(N,{id:a,steps:i})})]})}function _(){return(0,r.jsxs)("details",{className:"group flex flex-col gap-2 rounded-lg border border-border p-3",children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 text-sm font-medium text-foreground [&::-webkit-details-marker]:hidden",children:[(0,r.jsx)(s.default,{name:"terminal",className:"size-4 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"flex-1",children:"Other install methods"}),(0,r.jsx)(s.default,{name:"expand_more",className:"size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 py-2",children:[(0,r.jsx)(C,{title:"Docker Compose",icon:"lan",id:"compose",steps:w}),(0,r.jsx)(C,{title:"Plain Docker run",icon:"dns",id:"docker",steps:y}),(0,r.jsx)(C,{title:"From source",icon:"code",id:"source",steps:k})]})]})}function S(){let{copied:e,copy:t}=(0,v.C)(),a=(0,j.c)(),i="npm i -g @amir83nasr/10router@latest",n="npm-0",o=e===n;return(0,r.jsxs)(g.Zp,{size:"sm",className:"border-primary/30 bg-primary/5",children:[(0,r.jsx)(g.aR,{children:(0,r.jsxs)(g.ZB,{className:"flex items-center gap-2",children:[(0,r.jsx)(s.default,{name:"upload",className:"size-4 shrink-0 text-primary"}),"npm ",(0,r.jsx)(h.E,{variant:"default",children:"recommended"})]})}),(0,r.jsxs)(g.Wu,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)("code",{className:"min-w-0 flex-1 rounded bg-muted px-2 py-1 font-mono text-xs break-all",children:i}),(0,r.jsx)(f.$,{variant:"ghost",size:"icon-xs",onClick:()=>t(i,n),"aria-label":`Copy: ${i}`,children:(0,r.jsx)(s.default,{name:o?"check":"content_copy",className:"size-3.5"})})]}),o&&!a.stopped&&!a.timedOut&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Copied. Stop the server, paste the command in your terminal, then run"," ",(0,r.jsx)("code",{className:"rounded bg-muted px-1 font-mono",children:"10router start"}),"."]}),(0,r.jsxs)(f.$,{variant:"destructive",size:"sm",className:"self-start",onClick:a.confirm,disabled:a.shuttingDown,children:[a.shuttingDown?(0,r.jsx)(x.A,{className:"animate-spin"}):(0,r.jsx)(s.default,{name:"power_settings_new",className:"size-4"}),a.shuttingDown?"Stopping…":"Stop server"]})]}),a.stopped&&(0,r.jsxs)("p",{className:"rounded-lg border border-green-500/30 bg-green-500/10 px-3 py-2 text-xs text-green-600 dark:text-green-400",children:["Server stopped — run the copied command in your terminal, then"," ",(0,r.jsx)("code",{className:"font-mono",children:"10router start"}),"."]}),a.timedOut&&(0,r.jsxs)("p",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-600 dark:text-amber-400",children:["The server did not stop in time — stop it manually (",(0,r.jsx)("code",{className:"font-mono",children:"10router stop"}),"), then run the copied command."]})]})]})}function z({open:e,onOpenChange:t,info:a,checkFailed:i,onRetry:n}){let o=a?a.hasUpdate?(0,r.jsxs)("p",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-600 dark:text-amber-400",children:["New version v",a.latestVersion," available (you run v",a.currentVersion,"). npm is the fastest way — or run the steps for your install method, in order:"]}):(0,r.jsxs)("p",{className:"rounded-lg border border-green-500/30 bg-green-500/10 px-3 py-2 text-sm text-green-600 dark:text-green-400",children:["Up to date — v",a.currentVersion," is the latest."]}):(0,r.jsx)("p",{className:"rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm text-muted-foreground",children:i?"Could not reach GitHub to check for updates — the manual steps below still work.":"Checking for updates…"});return(0,r.jsx)(b.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(b.Cf,{className:"sm:max-w-lg",children:[(0,r.jsxs)(b.c7,{children:[(0,r.jsx)(b.L3,{children:"Updates"}),(0,r.jsx)(b.rr,{children:a?`Current v${a.currentVersion} \xb7 latest v${a.latestVersion}`:"Compare your version against the latest release"})]}),(0,r.jsxs)("div",{className:"flex max-h-[70vh] flex-col gap-4 overflow-y-auto p-4",children:[o,(0,r.jsx)(S,{}),(0,r.jsx)(_,{})]}),(0,r.jsxs)(b.Es,{children:[(0,r.jsxs)(f.$,{variant:"ghost",onClick:n,children:[(0,r.jsx)(s.default,{name:"refresh",className:"size-4"}),"Check again"]}),(0,r.jsx)(f.$,{variant:"outline",onClick:()=>t(!1),children:"Close"})]})]})})}var O=a(13008);function A({collapsed:e}){let[t,a]=(0,l.useState)(null),[i,n]=(0,l.useState)(!1),[o,d]=(0,l.useState)(!1),c=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/version",{cache:"no-store"});if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();a({currentVersion:t?.currentVersion??m.vQ.version,latestVersion:t?.latestVersion??m.vQ.version,hasUpdate:!!t?.hasUpdate}),n(!1)}catch{n(!0)}},[]);(0,l.useEffect)(()=>{c();let e=setInterval(c,18e5);return()=>clearInterval(e)},[c]);let u=t?.hasUpdate??!1,x=u?`v${t?.latestVersion} available`:t?`v${t.currentVersion} \xb7 up to date`:`v${m.vQ.version}`,h=e?(0,r.jsxs)(p.m_,{children:[(0,r.jsx)(p.k$,{asChild:!0,children:u?(0,r.jsxs)("button",{type:"button",onClick:()=>d(!0),"aria-label":`Update available. ${x}`,className:"relative mx-auto flex size-8 items-center justify-center rounded-md bg-amber-500/15 text-amber-600 transition-colors hover:bg-amber-500/25 dark:text-amber-400",children:[(0,r.jsx)(s.default,{name:"download",className:"size-4"}),(0,r.jsx)("span",{className:"absolute right-1.5 top-1.5 size-1.5 rounded-full bg-amber-500"})]}):(0,r.jsx)("span",{className:"mx-auto flex size-8 items-center justify-center rounded-md text-muted-foreground",children:(0,r.jsx)(s.default,{name:"refresh",className:"size-4"})})}),(0,r.jsx)(p.ZI,{children:u?`${x} — click to update`:x})]}):u?(0,r.jsxs)("button",{type:"button",onClick:()=>d(!0),className:"flex w-full items-center gap-2 rounded-md bg-amber-500/15 px-1 py-1 text-left transition-colors hover:bg-amber-500/25","aria-label":`Update available. ${x}`,children:[(0,r.jsxs)("span",{className:"relative flex shrink-0 items-center text-muted-foreground",children:[(0,r.jsx)(s.default,{name:"download",className:"size-4"}),(0,r.jsx)("span",{className:"absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-amber-500"})]}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("span",{className:"block truncate text-[11px] text-muted-foreground",children:[m.vQ.name," v",t?.currentVersion??m.vQ.version]}),(0,r.jsx)("span",{className:"block truncate text-[11px] font-medium text-amber-600 dark:text-amber-400",children:x})]}),(0,r.jsx)(s.default,{name:"chevron_right",className:"size-3.5 shrink-0 text-muted-foreground"})]}):(0,r.jsxs)("div",{className:"flex w-full items-center gap-2 rounded-md px-1 py-1 text-left",children:[(0,r.jsx)("span",{className:"flex shrink-0 items-center text-muted-foreground",children:(0,r.jsx)(s.default,{name:"refresh",className:"size-4"})}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("span",{className:"block truncate text-[11px] text-muted-foreground",children:[m.vQ.name," v",t?.currentVersion??m.vQ.version]}),(0,r.jsx)("span",{className:(0,O.cn)("block truncate text-[11px] font-medium",i||!t?"text-muted-foreground":"text-green-600 dark:text-green-400"),children:x})]})]});return(0,r.jsxs)(r.Fragment,{children:[h,(0,r.jsx)(z,{open:o&&u,onOpenChange:d,info:t,checkFailed:i,onRetry:c})]})}var L=a(54366),E=a(5471),T=a(80954);a(77345);var P=a(73639);function I({className:e,orientation:t="horizontal",decorative:a=!0,...s}){return(0,r.jsx)(P.b,{"data-slot":"separator",decorative:a,orientation:t,className:(0,E.cn)("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...s})}var $=a(69260),M=a(6403);function D({...e}){return(0,r.jsx)($.bL,{"data-slot":"sheet",...e})}function U({...e}){return(0,r.jsx)($.ZL,{"data-slot":"sheet-portal",...e})}function R({className:e,...t}){return(0,r.jsx)($.hJ,{"data-slot":"sheet-overlay",className:(0,E.cn)("fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function F({className:e,children:t,side:a="right",showCloseButton:s=!0,...i}){return(0,r.jsxs)(U,{children:[(0,r.jsx)(R,{}),(0,r.jsxs)($.UC,{"data-slot":"sheet-content","data-side":a,className:(0,E.cn)("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10",e),...i,children:[t,s&&(0,r.jsx)($.bm,{"data-slot":"sheet-close",asChild:!0,children:(0,r.jsxs)(f.$,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm",children:[(0,r.jsx)(M.A,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})})]})]})}function H({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sheet-header",className:(0,E.cn)("flex flex-col gap-1.5 p-4",e),...t})}function B({className:e,...t}){return(0,r.jsx)($.hE,{"data-slot":"sheet-title",className:(0,E.cn)("font-heading font-medium text-foreground",e),...t})}function V({className:e,...t}){return(0,r.jsx)($.VY,{"data-slot":"sheet-description",className:(0,E.cn)("text-sm text-muted-foreground",e),...t})}a(99118);let q=l.createContext(null);function Q(){let e=l.useContext(q);if(!e)throw Error("useSidebar must be used within a SidebarProvider.");return e}function K({defaultOpen:e=!0,open:t,onOpenChange:a,className:s,style:i,children:n,...o}){let d=function(){let[e,t]=l.useState(void 0);return l.useEffect(()=>{let e=window.matchMedia("(max-width: 767px)"),a=()=>{t(window.innerWidth<768)};return e.addEventListener("change",a),t(window.innerWidth<768),()=>e.removeEventListener("change",a)},[]),!!e}(),[c,u]=l.useState(!1),[m,p]=l.useState(e),x=t??m,h=l.useCallback(e=>{let t="function"==typeof e?e(x):e;a?a(t):p(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[a,x]),f=l.useCallback(()=>d?u(e=>!e):h(e=>!e),[d,h,u]);l.useEffect(()=>{let e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);let g=x?"expanded":"collapsed",b=l.useMemo(()=>({state:g,open:x,setOpen:h,isMobile:d,openMobile:c,setOpenMobile:u,toggleSidebar:f}),[g,x,h,d,c,u,f]);return(0,r.jsx)(q.Provider,{value:b,children:(0,r.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...i},className:(0,E.cn)("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",s),...o,children:n})})}function W({side:e="left",variant:t="sidebar",collapsible:a="offcanvas",className:s,children:i,dir:n,...o}){let{isMobile:l,state:d,openMobile:c,setOpenMobile:u}=Q();return"none"===a?(0,r.jsx)("div",{"data-slot":"sidebar",className:(0,E.cn)("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",s),...o,children:i}):l?(0,r.jsx)(D,{open:c,onOpenChange:u,...o,children:(0,r.jsxs)(F,{dir:n,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:e,children:[(0,r.jsxs)(H,{className:"sr-only",children:[(0,r.jsx)(B,{children:"Sidebar"}),(0,r.jsx)(V,{children:"Displays the mobile sidebar."})]}),(0,r.jsx)("div",{className:"flex h-full w-full flex-col",children:i})]})}):(0,r.jsxs)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":"collapsed"===d?a:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[(0,r.jsx)("div",{"data-slot":"sidebar-gap",className:(0,E.cn)("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),(0,r.jsx)("div",{"data-slot":"sidebar-container","data-side":e,className:(0,E.cn)("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...o,children:(0,r.jsx)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full min-w-0 flex-col overflow-x-hidden bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:i})})]})}function Z({className:e,...t}){return(0,r.jsx)("main",{"data-slot":"sidebar-inset",className:(0,E.cn)("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function G({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:(0,E.cn)("flex flex-col gap-2 p-2",e),...t})}function Y({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:(0,E.cn)("flex flex-col gap-2 p-2",e),...t})}function X({className:e,...t}){return(0,r.jsx)(I,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:(0,E.cn)("mx-2 w-auto bg-sidebar-border",e),...t})}function J({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:(0,E.cn)("flex min-h-0 w-full min-w-0 flex-1 flex-col gap-2 overflow-x-hidden overflow-y-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function ee({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:(0,E.cn)("relative flex w-full min-w-0 flex-col p-2",e),...t})}function et({className:e,asChild:t=!1,...a}){let s=t?T.bL:"div";return(0,r.jsx)(s,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:(0,E.cn)("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e),...a})}function ea({className:e,...t}){return(0,r.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:(0,E.cn)("flex w-full min-w-0 flex-col gap-1",e),...t})}function er({className:e,...t}){return(0,r.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:(0,E.cn)("group/menu-item relative",e),...t})}let es=(0,L.F)("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function ei({asChild:e=!1,isActive:t=!1,variant:a="default",size:s="default",tooltip:i,className:n,...o}){let l=e?T.bL:"button",{isMobile:d,state:c}=Q(),u=(0,r.jsx)(l,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":t,className:(0,E.cn)(es({variant:a,size:s}),n),...o});return i?("string"==typeof i&&(i={children:i}),(0,r.jsxs)(p.m_,{children:[(0,r.jsx)(p.k$,{asChild:!0,children:u}),(0,r.jsx)(p.ZI,{side:"right",align:"center",hidden:"collapsed"!==c||d,...i})]})):u}let en=[{id:"endpoint",href:"/dashboard",label:"Endpoint & Key",icon:"api",match:e=>"/dashboard"===e||e.startsWith("/dashboard/endpoint")},{id:"providers",href:"/dashboard/providers",label:"Providers",icon:"dns"},{id:"combos",href:"/dashboard/combos",label:"Combo",icon:"layers"},{id:"usage",href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{id:"token-saver",href:"/dashboard/token-saver",label:"Token Saver",icon:"scissors"},{id:"cli-tools",href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"},{id:"systemone",href:"/dashboard/media-providers/systemone",label:"System One",icon:"bolt"}],eo=[{id:"proxy-pools",href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"waypoints"}],el=[{id:"profile",href:"/dashboard/profile",label:"Settings",icon:"settings"}];function ed({item:e}){var t;let a=(t=(0,i.usePathname)(),e.match?e.match(t):"/dashboard/profile"===e.href?"/dashboard/profile"===t:t.startsWith(e.href));return(0,r.jsx)(er,{children:(0,r.jsx)(ei,{asChild:!0,isActive:a,children:(0,r.jsxs)(u(),{href:e.href,className:"gap-3",children:[(0,r.jsx)(s.default,{name:e.icon,className:"text-[18px]"}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label})]})})})}function ec({...e}){(0,i.usePathname)();let{state:t}=Q(),a="collapsed"===t;return(0,r.jsxs)(W,{...e,children:[(0,r.jsx)(G,{className:"h-20 justify-center border-b border-sidebar-border px-4",children:(0,r.jsxs)(u(),{href:"/dashboard",className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)(d.default,{src:"/icons/icon.svg",alt:"10Router logo",width:36,height:36,className:"size-9 rounded-[10px] shrink-0"}),!a&&(0,r.jsxs)("div",{className:"flex min-w-0 flex-col leading-tight",children:[(0,r.jsx)("span",{className:"truncate text-lg font-semibold tracking-tight text-foreground",children:m.vQ.name}),(0,r.jsxs)("span",{className:"truncate text-xs text-muted-foreground",children:["v",m.vQ.version]})]})]})}),(0,r.jsxs)(J,{className:"pt-2",children:[(0,r.jsxs)(ee,{children:[(0,r.jsx)(et,{children:"Overview"}),(0,r.jsx)(ea,{children:en.map(e=>(0,r.jsx)(ed,{item:e},e.id))})]}),(0,r.jsx)(X,{}),(0,r.jsxs)(ee,{children:[(0,r.jsx)(et,{children:"System"}),(0,r.jsxs)(ea,{children:[eo.map(e=>(0,r.jsx)(ed,{item:e},e.id)),el.map(e=>(0,r.jsx)(ed,{item:e},e.id))]})]})]}),(0,r.jsx)(Y,{className:"border-t border-sidebar-border p-4",children:(0,r.jsx)(A,{collapsed:a})})]})}function eu({children:e}){let t=(0,i.usePathname)(),a=(0,n.i)(e=>e.notifications),l=(0,n.i)(e=>e.removeNotification),{toggleSidebar:d}=Q();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:a.map(e=>{var t;let a="success"===(t=e.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===t?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===t?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,r.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${a.wrapper}`,children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(s.default,{name:a.icon,className:"text-[18px] leading-5"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,r.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,r.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,r.jsx)("button",{type:"button",onClick:()=>l(e.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,r.jsx)(s.default,{name:"close",className:"text-[16px]"})}):null]})},e.id)})}),(0,r.jsx)(ec,{}),(0,r.jsxs)(Z,{className:"flex flex-col h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,r.jsx)(o.default,{onMenuClick:d},t),(0,r.jsx)("div",{className:`dashboard-grid-bg flex-1 overflow-y-auto ${"/dashboard/basic-chat"===t?"":"p-6 lg:p-10"} ${"/dashboard/basic-chat"===t?"flex flex-col overflow-hidden":""}`,children:(0,r.jsx)("div",{className:`${"/dashboard/basic-chat"===t?"flex-1 w-full h-full flex flex-col":"max-w-7xl mx-auto"}`,children:e})})]})]})}function em({children:e}){return(0,r.jsx)(K,{children:(0,r.jsx)("div",{className:"flex h-screen w-full overflow-hidden bg-background",children:(0,r.jsx)(eu,{children:e})})})}},29575:(e,t,a)=>{a.d(t,{CardGrid:()=>p,Page:()=>c,PageHeader:()=>u,Section:()=>m});var r=a(29798),s=a(50141),i=a.n(s),n=a(13008),o=a(18055),l=a(58913);let d={default:"",narrow:"mx-auto w-full max-w-2xl",wide:"mx-auto w-full max-w-5xl"};function c({children:e,width:t="default",className:a}){return(0,r.jsx)("div",{className:(0,n.cn)("flex min-w-0 flex-col gap-6",d[t],a),children:e})}function u({title:e,description:t,actions:a,backHref:s,backLabel:d,className:c}){let m=null!=a;return(0,r.jsxs)("div",{className:(0,n.cn)(c),children:[s?(0,r.jsx)(o.$,{variant:"outline",size:"sm",asChild:!0,className:"mb-4 self-start",children:(0,r.jsxs)(i(),{href:s,children:[(0,r.jsx)(l.default,{name:"arrow_back",className:"text-lg"}),d??"Back"]})}):null,(0,r.jsxs)("div",{className:(0,n.cn)("flex flex-col gap-3",m&&"sm:flex-row sm:items-center sm:justify-between"),children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:e}),t?(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:t}):null]}),m?(0,r.jsx)("div",{className:"grid shrink-0 grid-cols-1 gap-2 sm:flex sm:items-center",children:a}):null]})]})}function m({title:e,actions:t,children:a,className:s}){let i=void 0!==e||void 0!==t;return(0,r.jsxs)("section",{className:(0,n.cn)("flex min-w-0 flex-col gap-4",s),children:[i?(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e?(0,r.jsx)("h2",{className:"text-lg font-semibold leading-tight sm:text-xl",children:e}):(0,r.jsx)("span",{}),t?(0,r.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:w-auto sm:items-center",children:t}):null]}):null,a]})}function p({children:e,variant:t="cards",className:a}){return(0,r.jsx)("div",{className:(0,n.cn)("grid min-w-0 grid-cols-1 gap-3 sm:gap-4","cards"===t&&"sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","stat"===t&&"sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5",a),children:e})}},41671:(e,t,a)=>{a.d(t,{i:()=>i});var r=a(58013);let s=0,i=(0,r.v)((e,t)=>({notifications:[],addNotification:a=>{let r=++s,i={id:r,type:a.type||"info",message:a.message,title:a.title||null,duration:a.duration??5e3,dismissible:a.dismissible??!0,createdAt:Date.now()};return e(e=>({notifications:[...e.notifications,i]})),i.duration>0&&setTimeout(()=>t().removeNotification(r),i.duration),r},removeNotification:t=>{e(e=>({notifications:e.notifications.filter(e=>e.id!==t)}))},clearAll:()=>e({notifications:[]}),success:(e,a)=>t().addNotification({type:"success",message:e,title:a}),error:(e,a)=>t().addNotification({type:"error",message:e,title:a,duration:8e3}),warning:(e,a)=>t().addNotification({type:"warning",message:e,title:a}),info:(e,a)=>t().addNotification({type:"info",message:e,title:a})}))},42535:(e,t,a)=>{a.d(t,{default:()=>w});var r=a(29798),s=a(58913),i=a(15814),n=a(70782),o=a(50141),l=a.n(o),d=a(738),c=a(56776);let u=(0,a(58013).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}));var m=a(51660),p=a(13794),x=a(90046),h=a(63729),f=a(51780),g=a(53784),b=a(18055),v=a(77345),j=a(1352);function w({onMenuClick:e,showMenuButton:t=!0}){let a=(0,n.usePathname)(),[o,u]=(0,i.useState)(""),[b,v]=(0,i.useState)(""),{title:k,description:N,icon:C,breadcrumbs:_}=(0,i.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/providers\/([^/]+)$/);if(t){let e=t[1],a=m.zN[e]||m.fg[e];if(a)return{title:a.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:a.name,image:(0,h.HY)(a.id)}]}}let a=e.match(/\/media-providers\/systemone\/([^/]+)$/);if(a){let e=decodeURIComponent(a[1]),t=p.Q2[e]||Object.values(p.Q2).find(t=>t.alias===e);if(t)return{title:t.name,description:"",breadcrumbs:[{label:"System One",href:"/dashboard/media-providers/systemone"},{label:t.name,image:(0,h.HY)(t.id)}]}}let r=e.match(/\/cli-tools\/([^/]+)$/);if(r){let e=decodeURIComponent(r[1]),t=x.d[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"CLI Tools",href:"/dashboard/cli-tools"},{label:t.name,image:t.image}]}}return e.includes("/media-providers/systemone")?{title:"System One",description:"Decision models — native POST /v1/systemone endpoint",icon:"bolt",breadcrumbs:[]}:e.includes("/providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/token-saver")?{title:"Token Saver",description:"Compress prompts and outputs to save tokens",icon:"scissors",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"waypoints",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(a),[a]);(0,i.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let a=await t.json();e||(u(a?.displayName||a?.samlName||a?.samlEmail||a?.oidcName||a?.oidcEmail||""),v(a?.loginMethod||""))}catch{e||(u(""),v(""))}}(),()=>{e=!0}},[]);let S=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(e){console.error("Failed to logout:",e)}};return(0,r.jsxs)("header",{className:"sticky top-0 flex h-20 shrink-0 items-center justify-between gap-3 px-4 lg:px-8 border-b border-border bg-card/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",children:t&&(0,r.jsx)("button",{onClick:e,className:"text-foreground hover:text-primary transition-colors",children:(0,r.jsx)(s.default,{name:"menu",className:""})})}),(0,r.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:_.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:_.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,r.jsx)(s.default,{name:"chevron_right",className:"text-muted-foreground text-base"}),e.href?(0,r.jsx)(l(),{href:e.href,className:"text-muted-foreground hover:text-primary transition-colors",children:e.label}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,r.jsx)(d.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold text-foreground tracking-tight truncate",children:(0,f.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):k?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[C&&(0,r.jsx)(s.default,{name:C,className:"text-primary text-xl lg:text-2xl"}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold tracking-tight truncate",children:(0,f.Tl)(k)})]}),N&&(0,r.jsx)("p",{className:"hidden lg:block text-sm text-muted-foreground truncate",children:(0,f.Tl)(N)})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[o&&("OIDC"===b||"SAML"===b)&&(0,r.jsxs)(j.m_,{children:[(0,r.jsx)(j.k$,{asChild:!0,children:(0,r.jsxs)(g.E,{variant:"secondary",className:"hidden max-w-55 sm:inline-flex",children:[(0,r.jsx)(s.default,{name:"person",className:"size-3.5 text-primary"}),(0,r.jsx)("span",{className:"truncate",children:o}),(0,r.jsx)("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-primary",children:b})]})}),(0,r.jsx)(j.ZI,{children:o})]}),(0,r.jsx)(y,{}),(0,r.jsx)(c.default,{onLogout:S})]})]})}function y(){let e=u(e=>e.visible),t=u(e=>e.query),a=u(e=>e.placeholder),i=u(e=>e.setQuery);return e?(0,r.jsxs)("div",{className:"relative w-40 sm:w-55",children:[(0,r.jsx)(s.default,{name:"search",className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground size-4 pointer-events-none"}),(0,r.jsx)(v.p,{type:"text",value:t,onChange:e=>i(e.target.value),placeholder:a,className:"h-8 pl-7 pr-7"}),t&&(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>i(""),className:"absolute right-1 top-1/2 -translate-y-1/2","aria-label":"Clear search",children:(0,r.jsx)(s.default,{name:"close",className:"size-4"})})]}):null}},51660:(e,t,a)=>{a.d(t,{Q2:()=>r.Q2,fg:()=>r.fg,vQ:()=>s,_$:()=>n,MA:()=>r.MA,UY:()=>l,Nu:()=>i,zN:()=>r.zN,B2:()=>o});var r=a(13794);a(80159);let s={name:"10Router Proxy",description:"AI Infrastructure Management",version:"0.1.4"},i={changelogUrl:"/api/changelog"},n=20128,o={storageKey:"theme",defaultTheme:"light"},l={maxLines:500,pollIntervalMs:1e3}},53599:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(29798),s=a(69221),i=a(18055),n=a(3537);function o({isOpen:e,shuttingDown:t,stopped:a,timedOut:l,onClose:d,onConfirm:c}){let u=t&&!a&&!l;return(0,r.jsx)(n.default,{isOpen:e,onClose:d,title:a?"Server Stopped":l?"Still Running":"Close Proxy",size:"sm",closeOnOverlay:!u,footer:a||l?(0,r.jsx)(i.$,{variant:"default",onClick:d,children:"Close"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$,{variant:"ghost",onClick:d,disabled:u,children:"Cancel"}),(0,r.jsxs)(i.$,{variant:"destructive",onClick:c,disabled:u,children:[u&&(0,r.jsx)(s.A,{className:"animate-spin"}),u?"Stopping…":"Close"]})]}),children:(0,r.jsx)("p",{className:"text-muted-foreground",children:a?"The proxy server has stopped. You can close this tab now.":l?"The server did not stop in time. It may need a manual stop (10router stop).":"Are you sure you want to close the proxy server?"})})}},53784:(e,t,a)=>{a.d(t,{E:()=>l});var r=a(29798);a(15814);var s=a(54366),i=a(5471),n=a(80954);let o=(0,s.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function l({className:e,variant:t="default",asChild:a=!1,...s}){let d=a?n.bL:"span";return(0,r.jsx)(d,{"data-slot":"badge","data-variant":t,className:(0,i.cn)(o({variant:t}),e),...s})}},56776:(e,t,a)=>{a.d(t,{default:()=>m});var r=a(29798),s=a(58913),i=a(15814),n=a(88336),o=a(63175),l=a(53599),d=a(18055),c=a(1352),u=a(76120);function m({onLogout:e}){let[t,a]=(0,i.useState)(!1),p=(0,o.c)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.rI,{children:[(0,r.jsxs)(c.m_,{children:[(0,r.jsx)(c.k$,{asChild:!0,children:(0,r.jsx)(u.ty,{asChild:!0,children:(0,r.jsx)(d.$,{variant:"ghost",size:"icon","aria-label":"Settings menu",children:(0,r.jsx)(s.default,{name:"settings",className:"size-5"})})})}),(0,r.jsx)(c.ZI,{children:"Settings"})]}),(0,r.jsxs)(u.SQ,{align:"end",className:"w-60",children:[(0,r.jsx)(u.lp,{children:"System"}),(0,r.jsx)(u.mB,{}),(0,r.jsxs)(u._2,{onSelect:()=>a(!0),children:[(0,r.jsx)(s.default,{name:"history",className:"size-4 text-muted-foreground"}),"Change Log"]}),(0,r.jsx)(u.mB,{}),(0,r.jsxs)(u._2,{variant:"destructive",onSelect:()=>p.open(),children:[(0,r.jsx)(s.default,{name:"power_settings_new",className:"size-4"}),"Shutdown"]}),(0,r.jsxs)(u._2,{variant:"destructive",onSelect:()=>e(),children:[(0,r.jsx)(s.default,{name:"logout",className:"size-4"}),"Logout"]})]})]}),(0,r.jsx)(n.default,{isOpen:t,onClose:()=>a(!1)}),(0,r.jsx)(l.default,{isOpen:p.confirmOpen||p.stopped||p.timedOut,onClose:p.reset,onConfirm:p.confirm,shuttingDown:p.shuttingDown,stopped:p.stopped,timedOut:p.timedOut})]})}},58913:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(29798);a(15814);var s=a(36256);let i={add:"Plus",account_circle:"CircleUser",account_tree:"GitFork",api:"Plug",apps:"LayoutGrid",arrow_back:"ArrowLeft",arrow_downward:"ArrowDown",arrow_forward:"ArrowRight",arrow_upward:"ArrowUp",attach_file:"Paperclip",bar_chart:"BarChart3",block:"Ban",bolt:"Zap",business:"Briefcase",cancel:"X",cast:"Cast",chat:"MessageSquare",check:"Check",check_circle:"CheckCircle2",checklist:"ClipboardCheck",chevron_down:"ChevronDown",chevron_left:"ChevronLeft",chevron_right:"ChevronRight",chevron_up:"ChevronUp",close:"X",cloud:"Cloud",cloud_off:"CloudOff",cloud_sync:"CloudSync",cloud_upload:"CloudUpload",code:"Code2",computer:"Monitor",content_copy:"Copy",cookie:"Cookie",dashboard:"LayoutDashboard",data_array:"Table",data_object:"Braces",data_usage:"BarChart3",dark_mode:"Moon",delete:"Trash2",devices:"MonitorSmartphone",dns:"Network",download:"Download",edit:"Pencil",error:"CircleAlert",expand_more:"ChevronDown",extension:"Blocks",file_upload:"UploadCloud",filter_alt_off:"SlidersHorizontal",folder_open:"FolderOpen",gavel:"Scale",graphic_eq:"AudioWaveform",grid_view:"Grid2X2",group:"Users",help:"CircleHelp",history:"History",hourglass_top:"Timer",hub:"Router",image:"Image",image_search:"ScanSearch",info:"Info",input:"FileInput",key:"Key",keyboard_arrow_down:"ArrowDown",keyboard_arrow_up:"ArrowUp",lan:"Layers",language:"Languages",layers:"Layers",legend_toggle:"ListTree",light_mode:"Sun",link:"Link",link_off:"Link2Off",lock:"Lock",lock_open:"LockOpen",logout:"LogOut",menu:"Menu",menu_book:"BookOpen",mic:"Mic",monitoring:"Activity",monitor:"Monitor",movie:"Clapperboard",music_note:"Music",neurology:"Brain",open_in_new:"ExternalLink",output:"FileOutput",pause_circle:"CirclePause",person:"User",play_arrow:"Play",play_circle:"CirclePlay",playlist_add:"ListPlus",power:"Power",power_off:"PowerOff",power_settings_new:"Power",progress_activity:"Loader2",psychology:"BrainCircuit",public:"Earth",qr_code_scanner:"ScanQrCode",record_voice_over:"Mic",refresh:"RefreshCw",restart_alt:"RotateCcw",restore:"RotateCcw",rocket_launch:"Rocket",route:"Route",save:"Save",savings:"PiggyBank",scatter_plot:"ScatterChart",schedule:"Clock",science:"FlaskConical",search:"Search",search_off:"SearchX",security:"ShieldCheck",send:"Send",settings:"Settings",shield:"Shield",shield_lock:"ShieldCheck",shield_with_heart:"HeartPulse",smart_toy:"Bot",star:"Star",stop:"Square",stop_circle:"CircleStop",sync:"RefreshCw",sync_alt:"RefreshCw",terminal:"Terminal",toggle_off:"ToggleLeft",toggle_on:"ToggleRight",translate:"Languages",travel_explore:"Music4",upload:"Upload",upload_file:"UploadCloud",verified:"BadgeCheck",verified_user:"ShieldCheck",visibility:"Eye",visibility_off:"EyeOff",vpn_key:"KeyRound",vpn_lock:"Lock",warning:"TriangleAlert",wifi:"Wifi",wifi_off:"WifiOff",wifi_tethering:"Wifi"};function n(e){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){let t=e.trim().match(/^(\d+(?:\.\d+)?)px$/);if(t)return Number(t[1])}return null}function o({name:e="",className:t,style:a,...l}){let d=s[e]??s[i[e]||String(e).split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join("")]??s.Circle,c=function(e=""){let t=String(e).match(/\[(\d+(?:\.\d+)?)px\]/);return t?Number(t[1]):({"text-xs":12,"text-sm":14,"text-base":16,"text-lg":18,"text-xl":20,"text-2xl":24,"text-3xl":30,"text-4xl":36})[String(e).match(/\btext-(xs|sm|base|lg|xl|2xl|3xl|4xl)\b/)?.[0]]||null}(t)??(a&&"object"==typeof a?n(a.width)??n(a.height)??n(a.fontSize):null),u=c?{width:c,height:c}:void 0,m=String(t??"").replace(/\bmaterial-symbols-outlined\b/g,"").replace(/\bfill-1\b/g,"").replace(/\s+/g," ").trim();return(0,r.jsx)(d,{className:m,style:u?{...u,...a}:a,"aria-hidden":"true",...l})}function l({name:e,className:t,style:a}){return(0,r.jsx)(o,{name:e,className:t,style:a})}},63175:(e,t,a)=>{a.d(t,{c:()=>s});var r=a(15814);function s(){let[e,t]=(0,r.useState)(!1),[a,s]=(0,r.useState)(!1),[i,n]=(0,r.useState)(!1),[o,l]=(0,r.useState)(!1),d=(0,r.useRef)([]);(0,r.useEffect)(()=>()=>d.current.forEach(clearTimeout),[]);let c=(0,r.useCallback)(async()=>{let e=Date.now()+15e3;for(;Date.now()<e;){try{if(!(await fetch("/api/health",{cache:"no-store"})).ok)break}catch{break}await new Promise(e=>{let t=setTimeout(e,1e3);d.current.push(t)})}Date.now()>=e-1e3?l(!0):n(!0)},[]),u=(0,r.useCallback)(async()=>{s(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch{}t(!1),c()},[c]),m=(0,r.useCallback)(()=>{l(!1),n(!1),t(!0)},[]),p=(0,r.useCallback)(()=>{t(!1),s(!1),n(!1),l(!1)},[]);return(0,r.useEffect)(()=>{(i||o)&&s(!1)},[i,o]),{confirmOpen:e,shuttingDown:a,stopped:i,timedOut:o,open:m,confirm:u,reset:p}}},63729:(e,t,a)=>{a.d(t,{HY:()=>n,IM:()=>m,Kw:()=>o,uM:()=>u});let r={antigravity:"gemini","perplexity-agent":"perplexity","gitlab-duo":"gitlab","vercel-ai-gateway":"vercel","ollama-search":"ollama","opencode-zen":"opencode"},s=new Set;function i(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function n(e){let t=function(e){let t=i(e);if(!t||s.has(t))return"";let a=r[t]||t;return s.has(a)?"":a}(e);return t?`/providers/${t}.png`:null}function o(e){let t=i(e);t&&s.add(t);let a=r[t];a&&s.add(a)}let l=new Set(["www","api","apis","rest","rpc","gateway","proxy","llm","chat","v1","v2","ai","app","dev","cloud","com","net","org","io","co","us","eu","cn"]),d={generativelanguage:"gemini",googleapis:"gemini",x:"xai"},c=new Set(["agentrouter","alicode","alicode-intl","alims-intl","alitp-intl","amp","anthropic","api-airforce","assemblyai","aws-polly","azure","baidu","bazaarlink","black-forest-labs","blackbox","bluesminds","brave-search","byteplus","cartesia","cerebras","chutes","claude","clinepass","codebuddy-cn","codebuddy-intl","codex","cohere","comfyui","commandcode","continue","coqui","cursor","deepgram","deepseek","deepseek-tui","devin-cli","droid","edge-tts","elevenlabs","exa","fal-ai","featherless","firecrawl","fireworks","fish-audio","gemini","github","gitlab","glm","glm-cn","google-pse","google-tts","grok-cli","grok-web","groq","hermes","huggingface","hyperbolic","iflow","inworld","jcode","jina-ai","jina-reader","kilo-gateway","kilocode","kimchi","linkup","llm7","local-device","longcat","mimo-free","minimax","minimax-cn","mistral","mmf","morph","nanobanana","nebius","novita","nvidia","ollama","ollama-local","openai","openclaw","opencode","opencode-go","opendesign","openrouter","perplexity","perplexity-agent","perplexity-web","playht","poolside","qoder","qwen","recraft","reka","roo","runwayml","sambanova","sdwebui","searchapi","searxng","selfhosted-embedding","selfhosted-stt","selfhosted-tts","serper","siliconflow","stability-ai","tavily","tencent","together","tokenrouter","topaz","tortoise","trae","venice","vercel","vercel-ai-gateway","volcengine-ark","voyage-ai","windsurf","workbuddy","xai","xiaomi-mimo","xiaomi-tokenplan","xquik","youcom","zed"]);function u(e){let t="";try{t=new URL(String(e||"")).hostname.toLowerCase()}catch{return""}if(!t||"localhost"===t||t.startsWith("127.")||t.includes(":")||t.startsWith("[")||/^\d+\.\d+\.\d+\.\d+$/.test(t))return"";let a=t.split(".").filter(Boolean).find(e=>!l.has(e)&&!/^\d+$/.test(e));if(!a)return"";let s=d[a]||r[a]||a;return c.has(s)?s:""}function m(e){let t=String(e||"").trim().split(/\s+/).filter(Boolean);return t.length?1===t.length?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[t.length-1][0]}`.toUpperCase():""}},72778:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(29798);function s({children:e}){return(0,r.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-background transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-foreground",children:[(0,r.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,r.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}},76120:(e,t,a)=>{a.d(t,{SQ:()=>l,_2:()=>d,lp:()=>c,mB:()=>u,rI:()=>n,ty:()=>o});var r=a(29798);a(15814);var s=a(5471),i=a(47151);function n({...e}){return(0,r.jsx)(i.bL,{"data-slot":"dropdown-menu",...e})}function o({...e}){return(0,r.jsx)(i.l9,{"data-slot":"dropdown-menu-trigger",...e})}function l({className:e,align:t="start",sideOffset:a=4,...n}){return(0,r.jsx)(i.ZL,{children:(0,r.jsx)(i.UC,{"data-slot":"dropdown-menu-content",sideOffset:a,align:t,className:(0,s.cn)("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})})}function d({className:e,inset:t,variant:a="default",...n}){return(0,r.jsx)(i.q7,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:(0,s.cn)("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...n})}function c({className:e,inset:t,...a}){return(0,r.jsx)(i.JU,{"data-slot":"dropdown-menu-label","data-inset":t,className:(0,s.cn)("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8",e),...a})}function u({className:e,...t}){return(0,r.jsx)(i.wv,{"data-slot":"dropdown-menu-separator",className:(0,s.cn)("-mx-1 my-1 h-px bg-border",e),...t})}},88336:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(29798),s=a(58913),i=a(15814),n=a(62392),o=a(51660),l=a(49787);function d({isOpen:e,onClose:t}){let[a,c]=(0,i.useState)(""),[u,m]=(0,i.useState)(!1),[p,x]=(0,i.useState)(!1),[h,f]=(0,i.useState)("");(0,i.useEffect)(()=>{e&&!a&&(x(!0),f(""),fetch(o.Nu.changelogUrl).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>c(e)).catch(e=>f(e.message||"Failed to load")).finally(()=>x(!1)))},[e,a]);let g=a?a.split(/(?=^## )/m).filter(e=>e.startsWith("## ")):[],b=u?g:g.slice(0,3),v=g.length-b.length,j=b.length?n.xI.parse(b.join("\n")):"";return(0,r.jsx)(l.lG,{open:!!e,onOpenChange:e=>!e&&t?.(),children:(0,r.jsxs)(l.Cf,{className:"sm:max-w-3xl",children:[(0,r.jsx)(l.c7,{children:(0,r.jsx)(l.L3,{children:"Change Log"})}),(0,r.jsxs)("div",{className:"max-h-[75vh] overflow-y-auto p-6",children:[p&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-10 text-muted-foreground",children:[(0,r.jsx)(s.default,{name:"progress_activity",className:"animate-spin mr-2"}),"Loading..."]}),h&&(0,r.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",h]}),!p&&!h&&j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"changelog-body text-foreground",dangerouslySetInnerHTML:{__html:j}}),v>0&&(0,r.jsxs)("button",{onClick:()=>m(!0),className:"mt-4 w-full py-2 rounded-lg text-sm font-medium text-foreground bg-black/5 dark:bg-white/5 hover:bg-black/10 dark:hover:bg-white/10 transition-colors",children:["Show ",v," more"]})]})]})]})})}n.xI.setOptions({gfm:!0,breaks:!0})},90046:(e,t,a)=>{a.d(t,{d:()=>r});let r={claude:{id:"claude",name:"Claude Code",image:"/providers/claude.png",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",fableModel:"ANTHROPIC_DEFAULT_FABLE_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","fable","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"fable",name:"Claude Fable",alias:"fable",envKey:"ANTHROPIC_DEFAULT_FABLE_MODEL",defaultValue:"cc/claude-fable-5"},{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-5"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-5"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},codex:{id:"codex",name:"OpenAI Codex CLI / App",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},cowork:{id:"cowork",name:"Claude Cowork",image:"/providers/claude.png",color:"#D97757",description:"Claude Desktop Cowork (third-party inference)",configType:"custom"},dsh:{id:"dsh",name:"DSH - DeepSeek Harness",image:"/providers/deepseek.png",color:"#4D6BFE",description:"DeepSeek Harness (dsh web) provider",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]}}},99118:(e,t,a)=>{a.d(t,{E:()=>i});var r=a(29798),s=a(5471);function i({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"skeleton",className:(0,s.cn)("animate-pulse rounded-md bg-muted",e),...t})}}}]);
|
|
File without changes
|
|
File without changes
|