aigetwey 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/LICENSE +21 -0
  3. package/README.md +302 -0
  4. package/assets/logo.svg +8 -0
  5. package/assets/screenshot.png +0 -0
  6. package/assets/wordmark.svg +9 -0
  7. package/config.example.yaml +56 -0
  8. package/dashboard/.env.example +12 -0
  9. package/dashboard/next-env.d.ts +6 -0
  10. package/dashboard/next.config.ts +12 -0
  11. package/dashboard/package-lock.json +1771 -0
  12. package/dashboard/package.json +29 -0
  13. package/dashboard/postcss.config.mjs +5 -0
  14. package/dashboard/src/app/(console)/combos/page.tsx +10 -0
  15. package/dashboard/src/app/(console)/config/page.tsx +5 -0
  16. package/dashboard/src/app/(console)/console/page.tsx +92 -0
  17. package/dashboard/src/app/(console)/endpoint/page.tsx +5 -0
  18. package/dashboard/src/app/(console)/layout.tsx +17 -0
  19. package/dashboard/src/app/(console)/page.tsx +8 -0
  20. package/dashboard/src/app/(console)/providers/[id]/page.tsx +6 -0
  21. package/dashboard/src/app/(console)/providers/page.tsx +5 -0
  22. package/dashboard/src/app/(console)/quota/page.tsx +5 -0
  23. package/dashboard/src/app/(console)/tools/[id]/page.tsx +6 -0
  24. package/dashboard/src/app/(console)/tools/page.tsx +5 -0
  25. package/dashboard/src/app/(console)/usage/page.tsx +24 -0
  26. package/dashboard/src/app/api/cli-detect/[tool]/route.ts +253 -0
  27. package/dashboard/src/app/api/gw/[...path]/route.ts +89 -0
  28. package/dashboard/src/app/api/login/route.ts +30 -0
  29. package/dashboard/src/app/api/logout/route.ts +9 -0
  30. package/dashboard/src/app/api/password/route.ts +34 -0
  31. package/dashboard/src/app/globals.css +340 -0
  32. package/dashboard/src/app/icon.svg +8 -0
  33. package/dashboard/src/app/layout.tsx +28 -0
  34. package/dashboard/src/app/login/page.tsx +60 -0
  35. package/dashboard/src/components/AreaChart.tsx +115 -0
  36. package/dashboard/src/components/Badge.tsx +32 -0
  37. package/dashboard/src/components/Button.tsx +60 -0
  38. package/dashboard/src/components/CapacityBadges.tsx +40 -0
  39. package/dashboard/src/components/Checkbox.tsx +40 -0
  40. package/dashboard/src/components/CliToolConfig.tsx +63 -0
  41. package/dashboard/src/components/ConfigEditor.tsx +199 -0
  42. package/dashboard/src/components/ConfirmModal.tsx +36 -0
  43. package/dashboard/src/components/CooldownTimer.tsx +42 -0
  44. package/dashboard/src/components/EndpointView.tsx +439 -0
  45. package/dashboard/src/components/Icon.tsx +25 -0
  46. package/dashboard/src/components/KeyReveal.tsx +78 -0
  47. package/dashboard/src/components/Lamp.tsx +8 -0
  48. package/dashboard/src/components/LogTable.tsx +223 -0
  49. package/dashboard/src/components/LogoutButton.tsx +20 -0
  50. package/dashboard/src/components/ModelPicker.tsx +121 -0
  51. package/dashboard/src/components/ModelSelectModal.tsx +126 -0
  52. package/dashboard/src/components/PasswordEditor.tsx +86 -0
  53. package/dashboard/src/components/PricingEditor.tsx +171 -0
  54. package/dashboard/src/components/ProviderDetail.tsx +566 -0
  55. package/dashboard/src/components/ProviderManager.tsx +311 -0
  56. package/dashboard/src/components/QuotaView.tsx +78 -0
  57. package/dashboard/src/components/Rail.tsx +82 -0
  58. package/dashboard/src/components/RichCard.tsx +46 -0
  59. package/dashboard/src/components/RoutingView.tsx +329 -0
  60. package/dashboard/src/components/ThemeProvider.tsx +36 -0
  61. package/dashboard/src/components/ToastProvider.tsx +58 -0
  62. package/dashboard/src/components/ToolDetail.tsx +475 -0
  63. package/dashboard/src/components/TopBar.tsx +128 -0
  64. package/dashboard/src/components/UsageView.tsx +151 -0
  65. package/dashboard/src/components/ui.tsx +54 -0
  66. package/dashboard/src/lib/capabilities.ts +318 -0
  67. package/dashboard/src/lib/cliTools.ts +120 -0
  68. package/dashboard/src/lib/client.ts +190 -0
  69. package/dashboard/src/lib/gateway.ts +269 -0
  70. package/dashboard/src/lib/session.ts +71 -0
  71. package/dashboard/src/middleware.ts +37 -0
  72. package/dashboard/tsconfig.json +21 -0
  73. package/dist/adapters/anthropic.js +289 -0
  74. package/dist/adapters/anthropic.js.map +1 -0
  75. package/dist/adapters/gemini.js +268 -0
  76. package/dist/adapters/gemini.js.map +1 -0
  77. package/dist/adapters/index.js +8 -0
  78. package/dist/adapters/index.js.map +1 -0
  79. package/dist/adapters/openai.js +13 -0
  80. package/dist/adapters/openai.js.map +1 -0
  81. package/dist/cli/tray/autostart.js +152 -0
  82. package/dist/cli/tray/autostart.js.map +1 -0
  83. package/dist/cli/tray/icon.js +4 -0
  84. package/dist/cli/tray/icon.js.map +1 -0
  85. package/dist/cli/tray/tray.js +141 -0
  86. package/dist/cli/tray/tray.js.map +1 -0
  87. package/dist/cli/tray/trayRuntime.js +91 -0
  88. package/dist/cli/tray/trayRuntime.js.map +1 -0
  89. package/dist/cli.js +361 -0
  90. package/dist/cli.js.map +1 -0
  91. package/dist/config.js +728 -0
  92. package/dist/config.js.map +1 -0
  93. package/dist/core/authStore.js +78 -0
  94. package/dist/core/authStore.js.map +1 -0
  95. package/dist/core/canonical.js +9 -0
  96. package/dist/core/canonical.js.map +1 -0
  97. package/dist/core/console-buffer.js +25 -0
  98. package/dist/core/console-buffer.js.map +1 -0
  99. package/dist/core/fallback.js +62 -0
  100. package/dist/core/fallback.js.map +1 -0
  101. package/dist/core/handler.js +174 -0
  102. package/dist/core/handler.js.map +1 -0
  103. package/dist/core/keypool.js +105 -0
  104. package/dist/core/keypool.js.map +1 -0
  105. package/dist/core/quota.js +165 -0
  106. package/dist/core/quota.js.map +1 -0
  107. package/dist/core/state.js +52 -0
  108. package/dist/core/state.js.map +1 -0
  109. package/dist/db.js +193 -0
  110. package/dist/db.js.map +1 -0
  111. package/dist/headroom/compress.js +44 -0
  112. package/dist/headroom/compress.js.map +1 -0
  113. package/dist/headroom/detect.js +108 -0
  114. package/dist/headroom/detect.js.map +1 -0
  115. package/dist/headroom/process.js +158 -0
  116. package/dist/headroom/process.js.map +1 -0
  117. package/dist/inject/caveman.js +30 -0
  118. package/dist/inject/caveman.js.map +1 -0
  119. package/dist/inject/index.js +24 -0
  120. package/dist/inject/index.js.map +1 -0
  121. package/dist/inject/ponytail.js +19 -0
  122. package/dist/inject/ponytail.js.map +1 -0
  123. package/dist/middleware/auth.js +66 -0
  124. package/dist/middleware/auth.js.map +1 -0
  125. package/dist/providers/capabilities.js +246 -0
  126. package/dist/providers/capabilities.js.map +1 -0
  127. package/dist/providers/free.js +43 -0
  128. package/dist/providers/free.js.map +1 -0
  129. package/dist/providers/pricing.js +224 -0
  130. package/dist/providers/pricing.js.map +1 -0
  131. package/dist/providers/vertex.js +97 -0
  132. package/dist/providers/vertex.js.map +1 -0
  133. package/dist/routes/admin.js +622 -0
  134. package/dist/routes/admin.js.map +1 -0
  135. package/dist/routes/health.js +4 -0
  136. package/dist/routes/health.js.map +1 -0
  137. package/dist/routes/index.js +12 -0
  138. package/dist/routes/index.js.map +1 -0
  139. package/dist/routes/v1.js +75 -0
  140. package/dist/routes/v1.js.map +1 -0
  141. package/dist/rtk/detect.js +50 -0
  142. package/dist/rtk/detect.js.map +1 -0
  143. package/dist/rtk/filters.js +85 -0
  144. package/dist/rtk/filters.js.map +1 -0
  145. package/dist/rtk/index.js +39 -0
  146. package/dist/rtk/index.js.map +1 -0
  147. package/dist/server.js +100 -0
  148. package/dist/server.js.map +1 -0
  149. package/dist/stream/anthropic-stream.js +239 -0
  150. package/dist/stream/anthropic-stream.js.map +1 -0
  151. package/dist/stream/chunk.js +7 -0
  152. package/dist/stream/chunk.js.map +1 -0
  153. package/dist/stream/gemini-stream.js +135 -0
  154. package/dist/stream/gemini-stream.js.map +1 -0
  155. package/dist/stream/index.js +12 -0
  156. package/dist/stream/index.js.map +1 -0
  157. package/dist/stream/openai-stream.js +34 -0
  158. package/dist/stream/openai-stream.js.map +1 -0
  159. package/dist/stream/sse.js +64 -0
  160. package/dist/stream/sse.js.map +1 -0
  161. package/dist/translator/thinking.js +70 -0
  162. package/dist/translator/thinking.js.map +1 -0
  163. package/dist/translator/thinkingUnified.js +322 -0
  164. package/dist/translator/thinkingUnified.js.map +1 -0
  165. package/dist/upstream/client.js +120 -0
  166. package/dist/upstream/client.js.map +1 -0
  167. package/package.json +76 -0
  168. package/run.sh +27 -0
  169. package/src/adapters/anthropic.ts +377 -0
  170. package/src/adapters/gemini.ts +341 -0
  171. package/src/adapters/index.ts +17 -0
  172. package/src/adapters/openai.ts +22 -0
  173. package/src/cli/tray/autostart.ts +133 -0
  174. package/src/cli/tray/icon.ts +4 -0
  175. package/src/cli/tray/tray.ts +156 -0
  176. package/src/cli/tray/trayRuntime.ts +90 -0
  177. package/src/cli.ts +379 -0
  178. package/src/config.ts +777 -0
  179. package/src/core/authStore.ts +86 -0
  180. package/src/core/canonical.ts +93 -0
  181. package/src/core/console-buffer.ts +39 -0
  182. package/src/core/fallback.ts +116 -0
  183. package/src/core/handler.ts +236 -0
  184. package/src/core/keypool.ts +152 -0
  185. package/src/core/quota.ts +214 -0
  186. package/src/core/state.ts +65 -0
  187. package/src/db.ts +280 -0
  188. package/src/headroom/compress.ts +78 -0
  189. package/src/headroom/detect.ts +119 -0
  190. package/src/headroom/process.ts +166 -0
  191. package/src/inject/caveman.ts +35 -0
  192. package/src/inject/index.ts +46 -0
  193. package/src/inject/ponytail.ts +31 -0
  194. package/src/middleware/auth.ts +76 -0
  195. package/src/providers/capabilities.ts +297 -0
  196. package/src/providers/free.ts +53 -0
  197. package/src/providers/pricing.ts +261 -0
  198. package/src/providers/vertex.ts +117 -0
  199. package/src/routes/admin.ts +716 -0
  200. package/src/routes/health.ts +5 -0
  201. package/src/routes/index.ts +24 -0
  202. package/src/routes/v1.ts +87 -0
  203. package/src/rtk/detect.ts +55 -0
  204. package/src/rtk/filters.ts +94 -0
  205. package/src/rtk/index.ts +58 -0
  206. package/src/server.ts +108 -0
  207. package/src/stream/anthropic-stream.ts +310 -0
  208. package/src/stream/chunk.ts +46 -0
  209. package/src/stream/gemini-stream.ts +158 -0
  210. package/src/stream/index.ts +23 -0
  211. package/src/stream/openai-stream.ts +41 -0
  212. package/src/stream/sse.ts +72 -0
  213. package/src/translator/thinking.ts +64 -0
  214. package/src/translator/thinkingUnified.ts +319 -0
  215. package/src/upstream/client.ts +155 -0
  216. package/tsconfig.json +20 -0
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Headroom proxy lifecycle — start/stop the external `headroom proxy` as a
3
+ * detached child of the gateway, tracked by a PID file under the data dir.
4
+ *
5
+ * aigetwey's own implementation.
6
+ */
7
+ import fs from "node:fs";
8
+ import path from "node:path";
9
+ import { spawn } from "node:child_process";
10
+ import { findHeadroomBinary } from "./detect.js";
11
+ const DATA_DIR = path.resolve(process.env.AIGETWEY_DATA_DIR ?? "data");
12
+ const HEADROOM_DIR = path.join(DATA_DIR, "headroom");
13
+ const PID_FILE = path.join(HEADROOM_DIR, "proxy.pid");
14
+ const LOG_FILE = path.join(HEADROOM_DIR, "proxy.log");
15
+ const DEFAULT_PORT = 8787;
16
+ const STARTUP_TIMEOUT_MS = 8000;
17
+ function ensureDir() {
18
+ if (!fs.existsSync(HEADROOM_DIR))
19
+ fs.mkdirSync(HEADROOM_DIR, { recursive: true });
20
+ }
21
+ function readPid() {
22
+ try {
23
+ if (fs.existsSync(PID_FILE))
24
+ return parseInt(fs.readFileSync(PID_FILE, "utf8"), 10);
25
+ }
26
+ catch {
27
+ /* ignore */
28
+ }
29
+ return null;
30
+ }
31
+ function writePid(pid) {
32
+ ensureDir();
33
+ fs.writeFileSync(PID_FILE, String(pid));
34
+ }
35
+ function clearPid() {
36
+ try {
37
+ if (fs.existsSync(PID_FILE))
38
+ fs.unlinkSync(PID_FILE);
39
+ }
40
+ catch {
41
+ /* ignore */
42
+ }
43
+ }
44
+ /** process.kill(pid, 0) throws if the pid is dead — use it to probe liveness. */
45
+ export function isPidAlive(pid) {
46
+ if (!pid || typeof pid !== "number")
47
+ return false;
48
+ try {
49
+ process.kill(pid, 0);
50
+ return true;
51
+ }
52
+ catch {
53
+ return false;
54
+ }
55
+ }
56
+ export function getManagedPid() {
57
+ const pid = readPid();
58
+ return pid && isPidAlive(pid) ? pid : null;
59
+ }
60
+ export async function startHeadroomProxy({ port = DEFAULT_PORT } = {}) {
61
+ const safePort = Number(port) > 0 && Number(port) < 65536 ? Number(port) : DEFAULT_PORT;
62
+ const binary = findHeadroomBinary();
63
+ if (!binary) {
64
+ const err = new Error("Headroom CLI not installed");
65
+ err.code = "NOT_INSTALLED";
66
+ throw err;
67
+ }
68
+ const existing = getManagedPid();
69
+ if (existing)
70
+ return { pid: existing, alreadyRunning: true };
71
+ ensureDir();
72
+ // spawn stdio requires fd numbers, not WriteStream objects.
73
+ const outFd = fs.openSync(LOG_FILE, "a");
74
+ const child = spawn(binary, ["proxy", "--port", String(safePort)], {
75
+ stdio: ["ignore", outFd, outFd],
76
+ detached: true,
77
+ windowsHide: true,
78
+ env: { ...process.env },
79
+ });
80
+ if (!child.pid) {
81
+ fs.closeSync(outFd);
82
+ const err = new Error("Failed to spawn headroom proxy");
83
+ err.code = "SPAWN_FAILED";
84
+ throw err;
85
+ }
86
+ child.unref();
87
+ writePid(child.pid);
88
+ // Wait until the process either stays alive briefly (success) or exits fast (failure).
89
+ await new Promise((resolve, reject) => {
90
+ const startupTimer = setTimeout(() => {
91
+ if (isPidAlive(child.pid ?? null))
92
+ resolve();
93
+ else
94
+ reject(new Error("headroom proxy exited during startup — see proxy.log"));
95
+ }, STARTUP_TIMEOUT_MS);
96
+ child.once("exit", (code) => {
97
+ clearTimeout(startupTimer);
98
+ clearPid();
99
+ try {
100
+ fs.closeSync(outFd);
101
+ }
102
+ catch {
103
+ /* already closed */
104
+ }
105
+ const e = new Error(`headroom proxy exited early (code=${code}) — see proxy.log`);
106
+ e.code = "EARLY_EXIT";
107
+ reject(e);
108
+ });
109
+ });
110
+ // Close parent's copy of the fd; child retains its own after unref.
111
+ try {
112
+ fs.closeSync(outFd);
113
+ }
114
+ catch {
115
+ /* already closed */
116
+ }
117
+ return { pid: child.pid, alreadyRunning: false };
118
+ }
119
+ export function stopHeadroomProxy() {
120
+ const pid = getManagedPid();
121
+ if (!pid)
122
+ return { stopped: false, reason: "not_running" };
123
+ try {
124
+ process.kill(pid, "SIGTERM");
125
+ // Give it a moment, then force if still alive.
126
+ setTimeout(() => {
127
+ if (isPidAlive(pid)) {
128
+ try {
129
+ process.kill(pid, "SIGKILL");
130
+ }
131
+ catch {
132
+ /* already gone */
133
+ }
134
+ }
135
+ }, 2000);
136
+ clearPid();
137
+ return { stopped: true, pid };
138
+ }
139
+ catch (e) {
140
+ clearPid();
141
+ const err = new Error(`Failed to stop headroom proxy: ${e.message}`);
142
+ err.code = "STOP_FAILED";
143
+ throw err;
144
+ }
145
+ }
146
+ export function getHeadroomLogTail(maxLines = 200) {
147
+ try {
148
+ if (!fs.existsSync(LOG_FILE))
149
+ return "";
150
+ const content = fs.readFileSync(LOG_FILE, "utf8");
151
+ const lines = content.split(/\r?\n/).filter(Boolean);
152
+ return lines.slice(-maxLines).join("\n");
153
+ }
154
+ catch {
155
+ return "";
156
+ }
157
+ }
158
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/headroom/process.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM,CAAC,CAAC;AACvE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY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AC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Caveman injection. Prepends a system instruction telling the model to answer
3
+ * in terse "caveman speak" — dropping articles, filler and pleasantries while
4
+ * keeping full technical substance — to cut OUTPUT tokens.
5
+ *
6
+ * Four intensities trade brevity against readability. Returns null for "off" so
7
+ * the handler can skip injection entirely.
8
+ */
9
+ const PROMPTS = {
10
+ lite: "Trim filler. Drop pleasantries (sure/certainly/happy to), hedging, and " +
11
+ "restating the question. Keep all technical substance, code, and exact error " +
12
+ "text verbatim. Prefer short words.",
13
+ full: "Answer like a terse expert. Drop articles (a/an/the), filler " +
14
+ "(just/really/basically/actually), pleasantries, and hedging. Fragments OK. " +
15
+ "Short synonyms (big not extensive, fix not implement-a-solution-for). " +
16
+ "Keep ALL technical substance, exact identifiers, and code blocks unchanged. " +
17
+ "Quote error messages exactly. Pattern: [thing] [action] [reason].",
18
+ ultra: "Maximum compression. Telegraphic fragments only — no articles, no filler, no " +
19
+ "pleasantries, no transitions. One idea per line where possible. Keep every " +
20
+ "technical fact, identifier, number, and code block exact and complete; never " +
21
+ "drop substance to save words. Quote errors verbatim. Prose is the enemy; " +
22
+ "information is not.",
23
+ };
24
+ /** System-prompt text for a caveman level, or null when off. */
25
+ export function cavemanPrompt(level) {
26
+ if (level === "off")
27
+ return null;
28
+ return PROMPTS[level];
29
+ }
30
+ //# sourceMappingURL=caveman.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caveman.js","sourceRoot":"","sources":["../../src/inject/caveman.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,OAAO,GAAgD;IAC3D,IAAI,EACF,yEAAyE;QACzE,8EAA8E;QAC9E,oCAAoC;IACtC,IAAI,EACF,+DAA+D;QAC/D,6EAA6E;QAC7E,wEAAwE;QACxE,8EAA8E;QAC9E,mEAAmE;IACrE,KAAK,EACH,+EAA+E;QAC/E,6EAA6E;QAC7E,+EAA+E;QAC/E,2EAA2E;QAC3E,qBAAqB;CACxB,CAAC;AAEF,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAAC,KAAkB;IAC9C,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { cavemanPrompt } from "./caveman.js";
2
+ import { ponytailPrompt } from "./ponytail.js";
3
+ /** Combined system-prompt text for the active toggles, or null if both off. */
4
+ export function buildInjection(settings) {
5
+ const parts = [cavemanPrompt(settings.caveman), ponytailPrompt(settings.ponytail)].filter((p) => p !== null);
6
+ return parts.length > 0 ? parts.join("\n\n") : null;
7
+ }
8
+ /**
9
+ * Prepend the injection as the FIRST system message. A dedicated leading system
10
+ * message (rather than merging into an existing one) keeps the gateway's
11
+ * instruction separate from the client's own system prompt, and works for every
12
+ * provider format since the adapter collapses system messages on egress.
13
+ *
14
+ * Returns true if anything was injected.
15
+ */
16
+ export function injectInto(req, settings) {
17
+ const text = buildInjection(settings);
18
+ if (!text)
19
+ return false;
20
+ const sys = { role: "system", content: text };
21
+ req.messages.unshift(sys);
22
+ return true;
23
+ }
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inject/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAoB,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAS/C,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAAC,QAAwB;IACrD,MAAM,KAAK,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CACvF,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAC/B,CAAC;IACF,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,GAAqB,EAAE,QAAwB;IACxE,MAAM,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,GAAG,GAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,19 @@
1
+ const PROMPTS = {
2
+ lite: "Prefer the smallest change that solves the problem. Don't add features, " +
3
+ "abstractions, or error handling beyond what was asked.",
4
+ full: "Code like a lazy senior dev: do the minimum that fully solves the task. " +
5
+ "YAGNI — no speculative abstractions, config, or future-proofing. Prefer " +
6
+ "deleting code over adding it. No defensive checks for cases that can't " +
7
+ "happen. Don't explain code that's self-evident. Don't refactor unrelated code.",
8
+ ultra: "Ruthless minimalism. Smallest possible diff. No new abstractions, no " +
9
+ "helpers for single callers, no comments unless a non-obvious WHY. Delete " +
10
+ "before you add. Skip boilerplate, validation, and error handling unless " +
11
+ "explicitly required. Output only the code that changed plus a one-line note.",
12
+ };
13
+ /** System-prompt text for a ponytail level, or null when off. */
14
+ export function ponytailPrompt(level) {
15
+ if (level === "off")
16
+ return null;
17
+ return PROMPTS[level];
18
+ }
19
+ //# sourceMappingURL=ponytail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ponytail.js","sourceRoot":"","sources":["../../src/inject/ponytail.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,GAAgD;IAC3D,IAAI,EACF,0EAA0E;QAC1E,wDAAwD;IAC1D,IAAI,EACF,0EAA0E;QAC1E,0EAA0E;QAC1E,yEAAyE;QACzE,gFAAgF;IAClF,KAAK,EACH,uEAAuE;QACvE,2EAA2E;QAC3E,0EAA0E;QAC1E,8EAA8E;CACjF,CAAC;AAEF,iEAAiE;AACjE,MAAM,UAAU,cAAc,CAAC,KAAkB;IAC/C,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Gateway-level auth. Clients present one of `server.api_keys` — OUR keys (handed
3
+ * to your devices), distinct from the upstream provider keys in each provider.
4
+ *
5
+ * Accepted in either header so both client families work unchanged:
6
+ * - Authorization: Bearer <key> (OpenAI-style clients)
7
+ * - x-api-key: <key> (Anthropic-style clients)
8
+ *
9
+ * Empty `server.api_keys` disables auth (localhost dev mode).
10
+ */
11
+ import { createHash, timingSafeEqual } from "node:crypto";
12
+ function digest(s) {
13
+ return createHash("sha256").update(s).digest();
14
+ }
15
+ /** Constant-time membership test over fixed-length digests. */
16
+ export function isValidKey(presented, validKeys) {
17
+ const p = digest(presented);
18
+ // compare against every key so timing can't reveal which one matched.
19
+ let ok = false;
20
+ for (const k of validKeys) {
21
+ if (timingSafeEqual(p, digest(k)))
22
+ ok = true;
23
+ }
24
+ return ok;
25
+ }
26
+ export function extractKey(req) {
27
+ const auth = req.headers["authorization"];
28
+ if (typeof auth === "string" && auth.startsWith("Bearer ")) {
29
+ return auth.slice("Bearer ".length).trim();
30
+ }
31
+ const xkey = req.headers["x-api-key"];
32
+ if (typeof xkey === "string" && xkey.length > 0)
33
+ return xkey;
34
+ return null;
35
+ }
36
+ export function checkAuth(req, validKeys) {
37
+ if (validKeys.length === 0)
38
+ return { ok: true }; // auth disabled
39
+ const key = extractKey(req);
40
+ if (!key)
41
+ return { ok: false, status: 401, error: "missing API key" };
42
+ if (!isValidKey(key, validKeys))
43
+ return { ok: false, status: 401, error: "invalid API key" };
44
+ return { ok: true };
45
+ }
46
+ /**
47
+ * Admin auth for /admin/* — the password is presented as a Bearer token (the
48
+ * dashboard proxies it server-side; never reaches the browser) and checked
49
+ * against the hash store (seeded from AIGETWEY_ADMIN_PASSWORD, changeable at
50
+ * runtime).
51
+ *
52
+ * If no password is set, admin routes LOCK (503) rather than open — admin
53
+ * surfaces provider keys, so failing open would leak secrets.
54
+ */
55
+ export function checkAdminAuth(req, auth) {
56
+ if (!auth || !auth.enabled) {
57
+ return { ok: false, status: 503, error: "admin disabled (set AIGETWEY_ADMIN_PASSWORD)" };
58
+ }
59
+ const key = extractKey(req);
60
+ if (!key)
61
+ return { ok: false, status: 401, error: "missing admin password" };
62
+ if (!auth.verify(key))
63
+ return { ok: false, status: 401, error: "invalid admin password" };
64
+ return { ok: true };
65
+ }
66
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/middleware/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG1D,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACjD,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,SAAmB;IAC/D,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5B,sEAAsE;IACtE,IAAI,EAAE,GAAG,KAAK,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1B,IAAI,eAAe,CAAC,C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jF,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,8CAA8C,EAAE,CAAC;IAC3F,CAAC;IACD,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAC7E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAC1F,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,246 @@
1
+ // Model capabilities — what each model can read/do beyond plain text.
2
+ //
3
+ // Fallback order (first match wins), result merged over DEFAULT_CAPABILITIES:
4
+ // 1. PROVIDER_CAPABILITIES[provider][model] — provider-specific override
5
+ // 2. MODEL_CAPABILITIES[model] — canonical exact id (handles exceptions)
6
+ // 3. PATTERN_CAPABILITIES — glob match, ordered specific -> generic
7
+ // 4. DEFAULT_CAPABILITIES — safe floor (always returned)
8
+ //
9
+ // ── HOW TO ADD / UPDATE A MODEL ──────────────────────────────────────
10
+ // Authoritative data source: https://models.dev/api.json (145 providers, 4000+
11
+ // models, MIT). Each model exposes the exact fields we map below:
12
+ // modalities.input ["text","image","pdf","audio","video"] -> vision / pdf / audioInput / videoInput
13
+ // modalities.output ["text","image","audio"] -> imageOutput / audioOutput
14
+ // reasoning -> reasoning tool_call -> tools
15
+ // limit.context -> contextWindow limit.output -> maxOutput
16
+ // Look up the model id, then:
17
+ // • If a PATTERN below already covers it correctly -> nothing to do.
18
+ // • If it is an exception (pattern would mis-match) -> add an exact entry to
19
+ // MODEL_CAPABILITIES (only the fields that differ from DEFAULT).
20
+ // • If a whole new family -> add an ordered PATTERN (specific before generic).
21
+ // NOTE: models.dev has NO "search" flag (web search is a runtime tool, not a
22
+ // model spec); set `search` from vendor docs (Claude 4.x+, GPT-5.x/4o, Gemini
23
+ // 2.0+, Grok, Perplexity). Verify with: curl -s https://models.dev/api.json
24
+ /**
25
+ * Glob (* = wildcard) match, anchored + case-insensitive. aigetwey's
26
+ * pricing.matchPattern so capabilities resolve identically.
27
+ */
28
+ export function matchPattern(pattern, model) {
29
+ const regex = new RegExp("^" + pattern.split("*").map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join(".*") + "$", "i");
30
+ return regex.test(model);
31
+ }
32
+ export const DEFAULT_CAPABILITIES = {
33
+ // input modalities
34
+ vision: false, // read images
35
+ pdf: false, // read PDF / documents
36
+ audioInput: false, // read audio
37
+ videoInput: false, // read video
38
+ // output modalities
39
+ imageOutput: false, // generate images
40
+ audioOutput: false, // generate audio
41
+ // features
42
+ search: false, // built-in web search tool / grounding
43
+ tools: true, // function / tool calling
44
+ reasoning: false, // thinking / reasoning
45
+ // thinking wire format (only meaningful when reasoning:true). null → derive from transport.format.
46
+ // enum: openai|claude-adaptive|claude-budget|gemini-level|gemini-budget|zai|qwen|deepseek|kimi|minimax|hunyuan|step
47
+ thinkingFormat: null,
48
+ thinkingCanDisable: true, // false → model cannot turn thinking off (clamp to min instead of disable)
49
+ thinkingRange: null, // { min, max } for budget formats; null = no clamp
50
+ // limits (tokens)
51
+ contextWindow: 200000,
52
+ maxOutput: 64000,
53
+ };
54
+ // User-added model metadata can carry dashboard service kinds instead of the
55
+ // runtime capability names used here. Map those typed model kinds into input /
56
+ // output capabilities so custom vision models are not treated as text-only.
57
+ const SERVICE_KIND_CAPABILITIES = {
58
+ imageToText: { vision: true },
59
+ image: { imageOutput: true },
60
+ stt: { audioInput: true },
61
+ tts: { audioOutput: true },
62
+ embedding: { tools: false },
63
+ };
64
+ export function capabilitiesFromServiceKind(kind) {
65
+ return SERVICE_KIND_CAPABILITIES[kind] || null;
66
+ }
67
+ /**
68
+ * Canonical exact-id overrides — used for exceptions that patterns would
69
+ * otherwise mis-match. Only declare deltas vs DEFAULT.
70
+ */
71
+ export const MODEL_CAPABILITIES = {
72
+ // Claude 4.6/4.7 have 1M context + adaptive thinking (override generic claude pattern)
73
+ "claude-opus-4.6": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 },
74
+ "claude-opus-4.7": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 },
75
+ "claude-opus-4-6": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 },
76
+ "claude-sonnet-4.6": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 64000 },
77
+ "claude-sonnet-4-6": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 64000 },
78
+ // Gemini image-gen / OpenAI image / xai image variants
79
+ "gpt-image-1": { imageOutput: true, tools: false },
80
+ // GLM vision variant (text GLM has no vision)
81
+ "glm-4.6v": { vision: true, reasoning: true, thinkingFormat: "zai", contextWindow: 128000 },
82
+ // Qwen plain coder/text (no vision) — registry "vision-model" / "coder-model" aliases
83
+ "vision-model": { vision: true, reasoning: true, thinkingFormat: "qwen", contextWindow: 1000000 },
84
+ "coder-model": { reasoning: true, thinkingFormat: "qwen", contextWindow: 1000000 },
85
+ };
86
+ /**
87
+ * Provider-specific capability overrides. Keyed by provider alias/id.
88
+ */
89
+ export const PROVIDER_CAPABILITIES = {
90
+ // CodeBuddy.cn — authoritative per-model metadata from the gateway's model
91
+ // config (contextWindow=maxInputTokens, maxOutput=maxOutputTokens, vision=
92
+ // supportsImages). Every model reasons via OpenAI-style reasoning_effort
93
+ // (see registry thinkingFormat). `onlyReasoning` models can't turn thinking
94
+ // off → thinkingCanDisable:false (clamped to minimal instead of disabled).
95
+ "codebuddy-cn": {
96
+ "glm-5.2": { reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 1000000, maxOutput: 48000 },
97
+ "glm-5.1": { reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 200000, maxOutput: 48000 },
98
+ "glm-5.0": { reasoning: true, thinkingFormat: "openai", contextWindow: 200000, maxOutput: 48000 },
99
+ "glm-5.0-turbo": { reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 200000, maxOutput: 48000 },
100
+ "glm-5v-turbo": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 200000, maxOutput: 38000 },
101
+ "glm-4.7": { reasoning: true, thinkingFormat: "openai", contextWindow: 200000, maxOutput: 48000 },
102
+ "minimax-m3": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 512000, maxOutput: 48000 },
103
+ "minimax-m2.7": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 200000, maxOutput: 48000 },
104
+ "kimi-k2.7": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 256000, maxOutput: 32000 },
105
+ "kimi-k2.6": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 256000, maxOutput: 32000 },
106
+ "kimi-k2.5": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 164000, maxOutput: 32000 },
107
+ "hy3-preview": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 192000, maxOutput: 64000 },
108
+ "deepseek-v4-pro": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 1000000, maxOutput: 50000 },
109
+ "deepseek-v4-flash": { vision: true, reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 1000000, maxOutput: 50000 },
110
+ "deepseek-v3-2-volc": { reasoning: true, thinkingFormat: "openai", thinkingCanDisable: false, contextWindow: 96000, maxOutput: 32000 },
111
+ },
112
+ };
113
+ /**
114
+ * Pattern fallback — glob (* = wildcard), matched case-insensitively and
115
+ * anchored (^...$) so a pattern must match the full model id. ORDER MATTERS:
116
+ * vision/specific variants first, text-only/generic families last, to avoid
117
+ * a broad family pattern swallowing an exception (e.g. glm-4.6v vs glm-5).
118
+ */
119
+ export const PATTERN_CAPABILITIES = [
120
+ // ── Claude (4.6+ = adaptive thinking; older/haiku = budget) ──────
121
+ { pattern: "*claude*opus-4.6*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } },
122
+ { pattern: "*claude*opus-4.7*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } },
123
+ { pattern: "*claude*opus-4.8*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } },
124
+ { pattern: "*claude*sonnet-4.6*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } },
125
+ { pattern: "*claude*sonnet-4.7*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } },
126
+ { pattern: "*claude*haiku*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-budget" } },
127
+ { pattern: "*claude*opus*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-budget" } },
128
+ { pattern: "*claude*sonnet*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-budget" } },
129
+ { pattern: "*claude*fable*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-budget", contextWindow: 1000000, maxOutput: 128000 } },
130
+ { pattern: "*claude*mythos*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-budget", contextWindow: 1000000, maxOutput: 128000 } },
131
+ { pattern: "*claude-3*", caps: { vision: true } },
132
+ { pattern: "*claude*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-budget" } },
133
+ // ── Gemini (all 2.0+ multimodal + google_search grounding, 1M ctx) ─
134
+ { pattern: "*gemini*image*", caps: { vision: true, imageOutput: true, contextWindow: 1048576 } },
135
+ { pattern: "*gemini-3*pro*", caps: { vision: true, audioInput: true, videoInput: true, reasoning: true, search: true, thinkingFormat: "gemini-level", thinkingCanDisable: false, contextWindow: 1048576, maxOutput: 65535 } },
136
+ { pattern: "*gemini-3*", caps: { vision: true, audioInput: true, videoInput: true, reasoning: true, search: true, thinkingFormat: "gemini-level", thinkingCanDisable: false, contextWindow: 1048576, maxOutput: 65536 } },
137
+ { pattern: "*gemini-2.5*", caps: { vision: true, audioInput: true, videoInput: true, reasoning: true, search: true, thinkingFormat: "gemini-budget", thinkingRange: { min: 0, max: 24576 }, contextWindow: 1048576, maxOutput: 65536 } },
138
+ { pattern: "*gemini-2*", caps: { vision: true, audioInput: true, videoInput: true, search: true, contextWindow: 1048576, maxOutput: 65536 } },
139
+ { pattern: "*gemini*", caps: { vision: true, search: true, contextWindow: 1048576 } },
140
+ { pattern: "*gemma*", caps: { vision: true, contextWindow: 128000 } },
141
+ { pattern: "*nanobanana*", caps: { vision: true, imageOutput: true } },
142
+ // ── OpenAI GPT-5.x (vision + thinking + web search) ──────────────
143
+ { pattern: "*gpt-5*image*", caps: { imageOutput: true } },
144
+ { pattern: "*gpt-5*codex*", caps: { reasoning: true, search: true, thinkingFormat: "openai", contextWindow: 400000, maxOutput: 128000 } },
145
+ { pattern: "*gpt-5*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "openai", contextWindow: 400000, maxOutput: 128000 } },
146
+ { pattern: "*gpt-4o*", caps: { vision: true, search: true, contextWindow: 128000, maxOutput: 16384 } },
147
+ { pattern: "*gpt-4.1*", caps: { vision: true, contextWindow: 1000000, maxOutput: 32768 } },
148
+ { pattern: "*gpt-4-turbo*", caps: { vision: true, contextWindow: 128000 } },
149
+ { pattern: "*gpt-4*", caps: { contextWindow: 128000 } },
150
+ { pattern: "*gpt-3.5*", caps: { contextWindow: 16385, maxOutput: 4096 } },
151
+ { pattern: "*gpt-oss*", caps: { reasoning: true, thinkingFormat: "openai", contextWindow: 128000 } },
152
+ // ── OpenAI o-series (reasoning, vision) ──────────────────────────
153
+ { pattern: "*o1-mini*", caps: { reasoning: true, thinkingFormat: "openai", contextWindow: 128000 } },
154
+ { pattern: "*o1*", caps: { vision: true, reasoning: true, thinkingFormat: "openai", contextWindow: 200000, maxOutput: 100000 } },
155
+ { pattern: "*o3*", caps: { vision: true, reasoning: true, thinkingFormat: "openai", contextWindow: 200000, maxOutput: 100000 } },
156
+ { pattern: "*o4*", caps: { vision: true, reasoning: true, thinkingFormat: "openai", contextWindow: 200000, maxOutput: 100000 } },
157
+ // ── Grok (vision + Live Search) ──────────────────────────────────
158
+ { pattern: "*grok*image*", caps: { imageOutput: true } },
159
+ { pattern: "*grok-code*", caps: { reasoning: true, thinkingFormat: "openai", contextWindow: 256000 } },
160
+ { pattern: "*grok-4*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "openai", contextWindow: 256000 } },
161
+ { pattern: "*grok-3*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "openai", contextWindow: 131072 } },
162
+ { pattern: "*grok*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "openai", contextWindow: 256000 } },
163
+ // ── Qwen (enable_thinking + thinking_budget; QwQ = thinking-only) ─
164
+ { pattern: "*qwen*vl*", caps: { vision: true, reasoning: true, thinkingFormat: "qwen", contextWindow: 262144 } },
165
+ { pattern: "*qwen*max*", caps: { vision: true, reasoning: true, thinkingFormat: "qwen", contextWindow: 1000000, maxOutput: 65536 } },
166
+ { pattern: "*qwen*plus*", caps: { vision: true, reasoning: true, thinkingFormat: "qwen", contextWindow: 1000000, maxOutput: 65536 } },
167
+ { pattern: "*qwen*235b*", caps: { reasoning: true, thinkingFormat: "qwen", contextWindow: 262144 } },
168
+ { pattern: "*qwen*coder*", caps: { reasoning: true, thinkingFormat: "qwen", contextWindow: 1000000 } },
169
+ { pattern: "*qwq*", caps: { reasoning: true, thinkingFormat: "qwen", thinkingCanDisable: false, contextWindow: 131072 } },
170
+ { pattern: "*qwen*", caps: { reasoning: true, thinkingFormat: "qwen", contextWindow: 262144 } },
171
+ // ── Kimi (enabled→reasoning_effort; K2.7-code cannot disable) ─────
172
+ { pattern: "*kimi*k2.7*code*", caps: { vision: true, reasoning: true, thinkingFormat: "kimi", thinkingCanDisable: false, contextWindow: 262144, maxOutput: 262144 } },
173
+ { pattern: "*kimi*k2*", caps: { vision: true, reasoning: true, thinkingFormat: "kimi", contextWindow: 262144, maxOutput: 262144 } },
174
+ { pattern: "*kimi*", caps: { reasoning: true, thinkingFormat: "kimi", contextWindow: 262144 } },
175
+ // ── GLM / Z.ai (thinking.enabled; disable via enable_thinking:false) ─
176
+ { pattern: "*glm-5*", caps: { reasoning: true, thinkingFormat: "zai", contextWindow: 200000, maxOutput: 128000 } },
177
+ { pattern: "*glm-4.7*", caps: { reasoning: true, thinkingFormat: "zai", contextWindow: 200000, maxOutput: 128000 } },
178
+ { pattern: "*glm-4*", caps: { reasoning: true, thinkingFormat: "zai", contextWindow: 200000 } },
179
+ { pattern: "*glm*", caps: { reasoning: true, thinkingFormat: "zai", contextWindow: 200000 } },
180
+ // ── DeepSeek (thinking.enabled + reasoning_effort; r1 = thinking-only) ─
181
+ { pattern: "*deepseek-v4*", caps: { reasoning: true, thinkingFormat: "deepseek", contextWindow: 1000000, maxOutput: 384000 } },
182
+ { pattern: "*reasoner*", caps: { reasoning: true, thinkingFormat: "deepseek", thinkingCanDisable: false, contextWindow: 128000 } },
183
+ { pattern: "*deepseek-r*", caps: { reasoning: true, thinkingFormat: "deepseek", thinkingCanDisable: false, contextWindow: 128000 } },
184
+ { pattern: "*deepseek-chat*", caps: { contextWindow: 128000 } },
185
+ { pattern: "*deepseek*", caps: { reasoning: true, thinkingFormat: "deepseek", contextWindow: 128000 } },
186
+ // ── MiniMax (M3 = adaptive; M2.x cannot disable) ─────────────────
187
+ { pattern: "*minimax*image*", caps: { imageOutput: true } },
188
+ { pattern: "*minimax-m3*", caps: { vision: true, reasoning: true, thinkingFormat: "minimax", contextWindow: 1048576, maxOutput: 512000 } },
189
+ { pattern: "*minimax-m2.7*", caps: { reasoning: true, thinkingFormat: "minimax", thinkingCanDisable: false, contextWindow: 204800, maxOutput: 131072 } },
190
+ { pattern: "*minimax*", caps: { reasoning: true, thinkingFormat: "minimax", thinkingCanDisable: false, contextWindow: 200000, maxOutput: 131072 } },
191
+ // ── Xiaomi MiMo (vision, 1M / 262K ctx) ──────────────────────────
192
+ { pattern: "*mimo*v2.5*", caps: { vision: true, contextWindow: 1048576, maxOutput: 131072 } },
193
+ { pattern: "*mimo*omni*", caps: { vision: true, audioInput: true, contextWindow: 262144, maxOutput: 131072 } },
194
+ { pattern: "*mimo*", caps: { vision: true, contextWindow: 262144, maxOutput: 131072 } },
195
+ // ── Llama (4 = vision/1M; 3.x = text-only/128K) ──────────────────
196
+ { pattern: "*llama-4*", caps: { vision: true, contextWindow: 1000000 } },
197
+ { pattern: "*llama*", caps: { contextWindow: 128000 } },
198
+ // ── Mistral (Large 3 = vision/256K; codestral text) ──────────────
199
+ { pattern: "*codestral*", caps: { contextWindow: 256000 } },
200
+ { pattern: "*mistral-large*", caps: { vision: true, contextWindow: 256000 } },
201
+ { pattern: "*mistral*", caps: { contextWindow: 128000 } },
202
+ // ── Cohere (Command A Vision = vision; others text) ──────────────
203
+ { pattern: "*command-a-vision*", caps: { vision: true, contextWindow: 128000 } },
204
+ { pattern: "*command*", caps: { contextWindow: 128000 } },
205
+ // ── Perplexity (web search native) ───────────────────────────────
206
+ { pattern: "*sonar*", caps: { search: true, contextWindow: 128000 } },
207
+ { pattern: "*pplx*", caps: { search: true, contextWindow: 128000 } },
208
+ { pattern: "*perplexity*", caps: { search: true, contextWindow: 128000 } },
209
+ // ── Others ───────────────────────────────────────────────────────
210
+ { pattern: "*hunyuan*", caps: { reasoning: true, thinkingFormat: "hunyuan", contextWindow: 262144, maxOutput: 262144 } },
211
+ { pattern: "hy3*", caps: { reasoning: true, thinkingFormat: "hunyuan", contextWindow: 262144, maxOutput: 262144 } },
212
+ { pattern: "*step-*", caps: { reasoning: true, thinkingFormat: "step", contextWindow: 128000 } },
213
+ { pattern: "*nemotron*", caps: { reasoning: true, contextWindow: 128000 } },
214
+ { pattern: "*ling-*", caps: { reasoning: true, contextWindow: 128000 } },
215
+ ];
216
+ /**
217
+ * Resolve capabilities for a model using the 4-step fallback chain,
218
+ * merged over DEFAULT_CAPABILITIES so the result is always complete.
219
+ *
220
+ * @param {string} provider
221
+ * @param {string} model
222
+ * @returns {object} full capabilities object
223
+ */
224
+ export function getCapabilitiesForModel(provider, model) {
225
+ if (!model)
226
+ return { ...DEFAULT_CAPABILITIES };
227
+ // 1. Provider-specific override
228
+ if (provider && PROVIDER_CAPABILITIES[provider]?.[model]) {
229
+ return { ...DEFAULT_CAPABILITIES, ...PROVIDER_CAPABILITIES[provider][model] };
230
+ }
231
+ // 2. Canonical exact (strip vendor prefix: "anthropic/claude-opus-4.7" -> "claude-opus-4.7")
232
+ const baseModel = (model.includes("/") ? model.split("/").pop() : model) ?? model;
233
+ if (MODEL_CAPABILITIES[baseModel])
234
+ return { ...DEFAULT_CAPABILITIES, ...MODEL_CAPABILITIES[baseModel] };
235
+ if (MODEL_CAPABILITIES[model])
236
+ return { ...DEFAULT_CAPABILITIES, ...MODEL_CAPABILITIES[model] };
237
+ // 3. Pattern match (first match wins)
238
+ for (const { pattern, caps } of PATTERN_CAPABILITIES) {
239
+ if (matchPattern(pattern, baseModel) || matchPattern(pattern, model)) {
240
+ return { ...DEFAULT_CAPABILITIES, ...caps };
241
+ }
242
+ }
243
+ // 4. Floor
244
+ return { ...DEFAULT_CAPABILITIES };
245
+ }
246
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/providers/capabilities.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,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