@hileeon/mcc 0.1.0

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 (138) hide show
  1. package/.claude/CLAUDE.md +204 -0
  2. package/.claude/agents/.gitkeep +0 -0
  3. package/.claude/settings.json +9 -0
  4. package/.claude/skills/.gitkeep +0 -0
  5. package/README.md +127 -0
  6. package/dist/accounts/instance-manager.d.ts +11 -0
  7. package/dist/accounts/instance-manager.d.ts.map +1 -0
  8. package/dist/accounts/instance-manager.js +89 -0
  9. package/dist/accounts/instance-manager.js.map +1 -0
  10. package/dist/accounts/shared-manager.d.ts +25 -0
  11. package/dist/accounts/shared-manager.d.ts.map +1 -0
  12. package/dist/accounts/shared-manager.js +186 -0
  13. package/dist/accounts/shared-manager.js.map +1 -0
  14. package/dist/accounts/store.d.ts +30 -0
  15. package/dist/accounts/store.d.ts.map +1 -0
  16. package/dist/accounts/store.js +128 -0
  17. package/dist/accounts/store.js.map +1 -0
  18. package/dist/core/model-router.d.ts +30 -0
  19. package/dist/core/model-router.d.ts.map +1 -0
  20. package/dist/core/model-router.js +64 -0
  21. package/dist/core/model-router.js.map +1 -0
  22. package/dist/dashboard-server.d.ts +5 -0
  23. package/dist/dashboard-server.d.ts.map +1 -0
  24. package/dist/dashboard-server.js +387 -0
  25. package/dist/dashboard-server.js.map +1 -0
  26. package/dist/mcc.d.ts +8 -0
  27. package/dist/mcc.d.ts.map +1 -0
  28. package/dist/mcc.js +474 -0
  29. package/dist/mcc.js.map +1 -0
  30. package/dist/mcp/external-registry.d.ts +24 -0
  31. package/dist/mcp/external-registry.d.ts.map +1 -0
  32. package/dist/mcp/external-registry.js +99 -0
  33. package/dist/mcp/external-registry.js.map +1 -0
  34. package/dist/mcp/installer.d.ts +31 -0
  35. package/dist/mcp/installer.d.ts.map +1 -0
  36. package/dist/mcp/installer.js +273 -0
  37. package/dist/mcp/installer.js.map +1 -0
  38. package/dist/mcp/mcp-config.d.ts +86 -0
  39. package/dist/mcp/mcp-config.d.ts.map +1 -0
  40. package/dist/mcp/mcp-config.js +178 -0
  41. package/dist/mcp/mcp-config.js.map +1 -0
  42. package/dist/mcp/registry.d.ts +23 -0
  43. package/dist/mcp/registry.d.ts.map +1 -0
  44. package/dist/mcp/registry.js +100 -0
  45. package/dist/mcp/registry.js.map +1 -0
  46. package/dist/proxy/proxy-daemon.d.ts +27 -0
  47. package/dist/proxy/proxy-daemon.d.ts.map +1 -0
  48. package/dist/proxy/proxy-daemon.js +192 -0
  49. package/dist/proxy/proxy-daemon.js.map +1 -0
  50. package/dist/proxy/proxy-entry.d.ts +11 -0
  51. package/dist/proxy/proxy-entry.d.ts.map +1 -0
  52. package/dist/proxy/proxy-entry.js +74 -0
  53. package/dist/proxy/proxy-entry.js.map +1 -0
  54. package/dist/proxy/proxy-paths.d.ts +27 -0
  55. package/dist/proxy/proxy-paths.d.ts.map +1 -0
  56. package/dist/proxy/proxy-paths.js +125 -0
  57. package/dist/proxy/proxy-paths.js.map +1 -0
  58. package/dist/proxy/proxy-server.d.ts +20 -0
  59. package/dist/proxy/proxy-server.d.ts.map +1 -0
  60. package/dist/proxy/proxy-server.js +280 -0
  61. package/dist/proxy/proxy-server.js.map +1 -0
  62. package/dist/proxy/upstream-url.d.ts +7 -0
  63. package/dist/proxy/upstream-url.d.ts.map +1 -0
  64. package/dist/proxy/upstream-url.js +38 -0
  65. package/dist/proxy/upstream-url.js.map +1 -0
  66. package/dist/shared/logger.d.ts +23 -0
  67. package/dist/shared/logger.d.ts.map +1 -0
  68. package/dist/shared/logger.js +184 -0
  69. package/dist/shared/logger.js.map +1 -0
  70. package/dist/shared/provider-preset-catalog.d.ts +41 -0
  71. package/dist/shared/provider-preset-catalog.d.ts.map +1 -0
  72. package/dist/shared/provider-preset-catalog.js +299 -0
  73. package/dist/shared/provider-preset-catalog.js.map +1 -0
  74. package/docs/decisions.md +33 -0
  75. package/docs/lessons.md +8 -0
  76. package/docs/product.md +37 -0
  77. package/lib/mcp/mcc-image-analysis-server.cjs +454 -0
  78. package/lib/mcp/mcc-websearch-server.cjs +339 -0
  79. package/lib/mcp-hooks/image-analysis-runtime.cjs +510 -0
  80. package/lib/mcp-hooks/image-analyzer-transformer.cjs +526 -0
  81. package/lib/mcp-hooks/websearch-transformer.cjs +1421 -0
  82. package/lib/proxy/config/config-loader-facade.js +24 -0
  83. package/lib/proxy/glmt/delta-accumulator.js +363 -0
  84. package/lib/proxy/glmt/glmt-transformer.js +204 -0
  85. package/lib/proxy/glmt/index.js +41 -0
  86. package/lib/proxy/glmt/locale-enforcer.js +69 -0
  87. package/lib/proxy/glmt/pipeline/content-transformer.js +162 -0
  88. package/lib/proxy/glmt/pipeline/index.js +20 -0
  89. package/lib/proxy/glmt/pipeline/request-transformer.js +116 -0
  90. package/lib/proxy/glmt/pipeline/response-builder.js +205 -0
  91. package/lib/proxy/glmt/pipeline/stream-parser.js +234 -0
  92. package/lib/proxy/glmt/pipeline/tool-call-handler.js +78 -0
  93. package/lib/proxy/glmt/pipeline/types.js +6 -0
  94. package/lib/proxy/glmt/reasoning-enforcer.js +151 -0
  95. package/lib/proxy/glmt/sse-parser.js +102 -0
  96. package/lib/proxy/services/logging.js +13 -0
  97. package/lib/proxy/transformers/request-transformer.js +452 -0
  98. package/lib/proxy/transformers/sse-stream-transformer.js +199 -0
  99. package/lib/shared/logger.cjs +138 -0
  100. package/package.json +35 -0
  101. package/src/accounts/instance-manager.ts +58 -0
  102. package/src/accounts/shared-manager.ts +154 -0
  103. package/src/accounts/store.ts +111 -0
  104. package/src/core/model-router.ts +82 -0
  105. package/src/dashboard-server.ts +407 -0
  106. package/src/mcc.ts +474 -0
  107. package/src/mcp/external-registry.ts +73 -0
  108. package/src/mcp/installer.ts +258 -0
  109. package/src/mcp/mcp-config.ts +168 -0
  110. package/src/mcp/registry.ts +89 -0
  111. package/src/proxy/proxy-daemon.ts +184 -0
  112. package/src/proxy/proxy-entry.ts +63 -0
  113. package/src/proxy/proxy-paths.ts +97 -0
  114. package/src/proxy/proxy-server.ts +278 -0
  115. package/src/proxy/upstream-url.ts +38 -0
  116. package/src/shared/logger.ts +140 -0
  117. package/src/shared/provider-preset-catalog.ts +340 -0
  118. package/tsconfig.json +33 -0
  119. package/ui/.prettierrc +9 -0
  120. package/ui/index.html +12 -0
  121. package/ui/package.json +33 -0
  122. package/ui/postcss.config.js +6 -0
  123. package/ui/src/App.tsx +753 -0
  124. package/ui/src/components/ui/button.tsx +48 -0
  125. package/ui/src/components/ui/card.tsx +50 -0
  126. package/ui/src/components/ui/input.tsx +21 -0
  127. package/ui/src/components/ui/label.tsx +20 -0
  128. package/ui/src/components/ui/select.tsx +80 -0
  129. package/ui/src/components/ui/switch.tsx +26 -0
  130. package/ui/src/components/ui/tabs.tsx +52 -0
  131. package/ui/src/index.css +33 -0
  132. package/ui/src/lib/api.ts +185 -0
  133. package/ui/src/lib/utils.ts +6 -0
  134. package/ui/src/main.tsx +10 -0
  135. package/ui/src/vite-env.d.ts +1 -0
  136. package/ui/tailwind.config.js +49 -0
  137. package/ui/tsconfig.json +25 -0
  138. package/ui/vite.config.ts +20 -0
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ /**
3
+ * Proxy Server - Simplified translation proxy for MCC
4
+ *
5
+ * Accepts Anthropic /v1/messages requests, translates to OpenAI chat/completions,
6
+ * forwards to upstream provider, translates response back.
7
+ *
8
+ * Ported from CCS proxy/server/proxy-server.js + messages-route.js + http-helpers.js
9
+ * Simplified: single-profile, no multi-profile routing, no CCS logging, native fetch.
10
+ */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || (function () {
28
+ var ownKeys = function(o) {
29
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30
+ var ar = [];
31
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
+ return ar;
33
+ };
34
+ return ownKeys(o);
35
+ };
36
+ return function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ })();
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.startProxyServer = startProxyServer;
46
+ const http = __importStar(require("http"));
47
+ const stream = __importStar(require("stream"));
48
+ const module_1 = require("module");
49
+ const path = __importStar(require("path"));
50
+ const upstream_url_1 = require("./upstream-url");
51
+ const proxy_paths_1 = require("./proxy-paths");
52
+ // Load compiled JS modules from CCS (copied to lib/proxy/)
53
+ const libProxyDir = path.resolve(__dirname, '..', '..', 'lib', 'proxy');
54
+ const requireFromLib = (0, module_1.createRequire)(path.join(libProxyDir, 'noop.js'));
55
+ const { ProxyRequestTransformer } = requireFromLib('./transformers/request-transformer');
56
+ const { ProxySseStreamTransformer } = requireFromLib('./transformers/sse-stream-transformer');
57
+ const REQUEST_TIMEOUT_MS = 600000; // 10 minutes
58
+ // --- HTTP Helpers (from CCS http-helpers.js) ---
59
+ function writeJson(res, statusCode, payload) {
60
+ res.writeHead(statusCode, { 'Content-Type': 'application/json' });
61
+ res.end(JSON.stringify(payload));
62
+ }
63
+ const MAX_BODY_SIZE = 10 * 1024 * 1024;
64
+ function readJsonBody(req) {
65
+ return new Promise((resolve, reject) => {
66
+ const chunks = [];
67
+ let total = 0;
68
+ let settled = false;
69
+ const resolveOnce = (payload) => {
70
+ if (!settled) {
71
+ settled = true;
72
+ resolve(payload);
73
+ }
74
+ };
75
+ const rejectOnce = (error) => {
76
+ if (!settled) {
77
+ settled = true;
78
+ reject(error);
79
+ }
80
+ };
81
+ req.on('data', (chunk) => {
82
+ total += chunk.length;
83
+ if (total > MAX_BODY_SIZE) {
84
+ req.pause();
85
+ rejectOnce(new Error('Request body too large (max 10MB)'));
86
+ return;
87
+ }
88
+ chunks.push(chunk);
89
+ });
90
+ req.on('end', () => {
91
+ const raw = Buffer.concat(chunks).toString('utf8').trim();
92
+ if (!raw) {
93
+ resolveOnce({});
94
+ return;
95
+ }
96
+ try {
97
+ resolveOnce(JSON.parse(raw));
98
+ }
99
+ catch {
100
+ rejectOnce(new Error('Invalid JSON in request body'));
101
+ }
102
+ });
103
+ req.on('error', (error) => { rejectOnce(error); });
104
+ });
105
+ }
106
+ async function pipeWebResponseToNode(response, res) {
107
+ res.statusCode = response.status;
108
+ response.headers.forEach((value, key) => { res.setHeader(key, value); });
109
+ if (!response.body) {
110
+ res.end();
111
+ return;
112
+ }
113
+ const nodeStream = stream.Readable.fromWeb(response.body);
114
+ await new Promise((resolve, reject) => {
115
+ nodeStream.on('error', reject);
116
+ nodeStream.on('end', resolve);
117
+ nodeStream.pipe(res);
118
+ });
119
+ }
120
+ // --- Auth ---
121
+ function extractIncomingToken(headers) {
122
+ const xApiKey = headers['x-api-key'];
123
+ if (typeof xApiKey === 'string' && xApiKey.trim().length > 0)
124
+ return xApiKey.trim();
125
+ const anthropicApiKey = headers['anthropic-api-key'];
126
+ if (typeof anthropicApiKey === 'string' && anthropicApiKey.trim().length > 0)
127
+ return anthropicApiKey.trim();
128
+ const authHeader = headers.authorization;
129
+ if (typeof authHeader === 'string' && authHeader.trim().length > 0) {
130
+ const trimmed = authHeader.trim();
131
+ const bearerPrefix = 'Bearer ';
132
+ return trimmed.startsWith(bearerPrefix) ? trimmed.slice(bearerPrefix.length).trim() : trimmed;
133
+ }
134
+ return null;
135
+ }
136
+ function validateAuth(headers, expectedToken) {
137
+ return extractIncomingToken(headers) === expectedToken;
138
+ }
139
+ // --- Request Translation ---
140
+ function buildUpstreamRequest(rawBody, options) {
141
+ const transformer = new ProxyRequestTransformer();
142
+ const transformed = transformer.transform(rawBody);
143
+ const body = {
144
+ ...transformed,
145
+ model: transformed.model || options.model || 'gpt-4',
146
+ stream: transformed.stream === true,
147
+ };
148
+ return JSON.stringify(body);
149
+ }
150
+ // --- Server ---
151
+ function startProxyServer(options) {
152
+ const server = http.createServer(async (req, res) => {
153
+ const method = req.method || 'GET';
154
+ const requestUrl = req.url || '/';
155
+ const parsedUrl = new URL(requestUrl, 'http://127.0.0.1');
156
+ const pathname = parsedUrl.pathname.length > 1
157
+ ? parsedUrl.pathname.replace(/\/+$/, '')
158
+ : parsedUrl.pathname;
159
+ try {
160
+ await handleRequest(req, res, method, pathname, options);
161
+ }
162
+ catch (err) {
163
+ const message = err instanceof Error ? err.message : 'Unknown error';
164
+ if (!res.headersSent) {
165
+ writeJson(res, 500, { type: 'error', error: { type: 'api_error', message } });
166
+ }
167
+ }
168
+ });
169
+ server.listen(options.port, options.host);
170
+ return server;
171
+ }
172
+ async function handleRequest(req, res, method, pathname, options) {
173
+ // Health check
174
+ if ((method === 'GET' || method === 'HEAD') && pathname === '/health') {
175
+ if (method === 'HEAD') {
176
+ res.writeHead(200, { 'Content-Type': 'application/json' });
177
+ res.end();
178
+ }
179
+ else {
180
+ writeJson(res, 200, {
181
+ ok: true,
182
+ service: proxy_paths_1.PROXY_SERVICE_NAME,
183
+ host: options.host,
184
+ port: options.port,
185
+ });
186
+ }
187
+ return;
188
+ }
189
+ // Root info
190
+ if ((method === 'GET' || method === 'HEAD') && pathname === '/') {
191
+ if (method === 'HEAD') {
192
+ res.writeHead(200, { 'Content-Type': 'application/json' });
193
+ res.end();
194
+ }
195
+ else {
196
+ writeJson(res, 200, {
197
+ ok: true,
198
+ service: proxy_paths_1.PROXY_SERVICE_NAME,
199
+ bind: { host: options.host, port: options.port },
200
+ endpoints: ['/health', '/v1/messages', '/v1/models'],
201
+ });
202
+ }
203
+ return;
204
+ }
205
+ // Models endpoint
206
+ if (method === 'GET' && pathname === '/v1/models') {
207
+ if (!validateAuth(req.headers, options.authToken)) {
208
+ writeJson(res, 401, {
209
+ type: 'error',
210
+ error: { type: 'authentication_error', message: 'Missing or invalid local proxy token' },
211
+ });
212
+ return;
213
+ }
214
+ const models = [options.model].filter(Boolean).map((id) => ({
215
+ id,
216
+ object: 'model',
217
+ created: 0,
218
+ owned_by: 'mcc-proxy',
219
+ }));
220
+ writeJson(res, 200, { object: 'list', data: models });
221
+ return;
222
+ }
223
+ // Messages endpoint (main translation)
224
+ if (method === 'POST' && pathname === '/v1/messages') {
225
+ await handleMessages(req, res, options);
226
+ return;
227
+ }
228
+ writeJson(res, 404, { error: 'Not found' });
229
+ }
230
+ async function handleMessages(req, res, options) {
231
+ const transformer = new ProxySseStreamTransformer();
232
+ if (!validateAuth(req.headers, options.authToken)) {
233
+ await pipeWebResponseToNode(transformer.error(401, 'authentication_error', 'Missing or invalid local proxy token'), res);
234
+ return;
235
+ }
236
+ let timeoutMs = REQUEST_TIMEOUT_MS;
237
+ try {
238
+ const rawBody = await readJsonBody(req);
239
+ const upstreamBody = buildUpstreamRequest(rawBody, options);
240
+ const upstreamUrl = (0, upstream_url_1.resolveOpenAIChatCompletionsUrl)(options.baseUrl);
241
+ const controller = new AbortController();
242
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
243
+ // Client disconnect detection
244
+ const abortOnDisconnect = (_source) => {
245
+ if (!controller.signal.aborted && !res.writableEnded) {
246
+ controller.abort();
247
+ }
248
+ };
249
+ req.on('aborted', () => abortOnDisconnect('req.aborted'));
250
+ req.socket?.on('close', () => abortOnDisconnect('socket.close'));
251
+ try {
252
+ const upstreamResponse = await fetch(upstreamUrl, {
253
+ method: 'POST',
254
+ headers: {
255
+ 'Content-Type': 'application/json',
256
+ Authorization: `Bearer ${options.apiKey}`,
257
+ 'User-Agent': 'MCC-OpenAI-Compat-Proxy/1.0',
258
+ },
259
+ body: upstreamBody,
260
+ signal: controller.signal,
261
+ });
262
+ const response = await transformer.transform(upstreamResponse);
263
+ await pipeWebResponseToNode(response, res);
264
+ }
265
+ finally {
266
+ clearTimeout(timeout);
267
+ }
268
+ }
269
+ catch (error) {
270
+ const message = error instanceof Error ? error.message : 'Unknown proxy error';
271
+ const isAbort = error instanceof Error && error.name === 'AbortError';
272
+ const status = isAbort ? 502 : message.includes('Request body too large') ? 413 : message.includes('Invalid JSON') ? 400 : 502;
273
+ const type = status >= 500 ? 'api_error' : 'invalid_request_error';
274
+ const errorMessage = isAbort
275
+ ? `The upstream provider did not respond within ${timeoutMs / 1000} seconds`
276
+ : message;
277
+ await pipeWebResponseToNode(transformer.error(status, type, errorMessage), res);
278
+ }
279
+ }
280
+ //# sourceMappingURL=proxy-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy-server.js","sourceRoot":"","sources":["../../src/proxy/proxy-server.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHH,4CAqBC;AAzID,2CAA6B;AAC7B,+CAAiC;AACjC,mCAAuC;AACvC,2CAA6B;AAC7B,iDAAiE;AACjE,+CAAmD;AAEnD,2DAA2D;AAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxE,MAAM,cAAc,GAAG,IAAA,sBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AACxE,MAAM,EAAE,uBAAuB,EAAE,GAAG,cAAc,CAAC,oCAAoC,CAAC,CAAC;AACzF,MAAM,EAAE,yBAAyB,EAAE,GAAG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,UAAU;YAC5E,CAAC,CAAC,OAAO,CAAC;QAEZ,MAAM,qBAAqB,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Upstream URL resolution
3
+ * Ported from CCS proxy/upstream-url.js
4
+ */
5
+ export declare function resolveOpenAIChatCompletionsUrl(baseUrl: string): string;
6
+ export declare function resolveOpenAIModelsUrl(baseUrl: string): string;
7
+ //# sourceMappingURL=upstream-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-url.d.ts","sourceRoot":"","sources":["../../src/proxy/upstream-url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Upstream URL resolution
4
+ * Ported from CCS proxy/upstream-url.js
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolveOpenAIChatCompletionsUrl = resolveOpenAIChatCompletionsUrl;
8
+ exports.resolveOpenAIModelsUrl = resolveOpenAIModelsUrl;
9
+ function normalizePathname(pathname) {
10
+ const trimmed = pathname.replace(/\/+$/, '');
11
+ return trimmed || '';
12
+ }
13
+ function ensureSupportedProtocol(parsed) {
14
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
15
+ throw new Error(`Unsupported upstream protocol: ${parsed.protocol}`);
16
+ }
17
+ }
18
+ function buildResolvedUrl(baseUrl, suffix) {
19
+ const parsed = new URL(baseUrl);
20
+ ensureSupportedProtocol(parsed);
21
+ const pathname = normalizePathname(parsed.pathname);
22
+ if (pathname.endsWith(suffix)) {
23
+ return parsed.toString();
24
+ }
25
+ if (pathname.endsWith('/v1') || pathname.endsWith('/api')) {
26
+ parsed.pathname = `${pathname}${suffix.startsWith('/') ? suffix : `/${suffix}`}`;
27
+ return parsed.toString();
28
+ }
29
+ parsed.pathname = pathname ? `${pathname}/v1${suffix}` : `/v1${suffix}`;
30
+ return parsed.toString();
31
+ }
32
+ function resolveOpenAIChatCompletionsUrl(baseUrl) {
33
+ return buildResolvedUrl(baseUrl, '/chat/completions');
34
+ }
35
+ function resolveOpenAIModelsUrl(baseUrl) {
36
+ return buildResolvedUrl(baseUrl, '/models');
37
+ }
38
+ //# sourceMappingURL=upstream-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-url.js","sourceRoot":"","sources":["../../src/proxy/upstream-url.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA4BH,0EAEC;AAED,wDAEC;AAhCD,SAAS,iBAAiB,CAAC,QAAgB;IACzC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,OAAO,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAW;IAC1C,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAe,EAAE,MAAc;IACvD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACpD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,MAAM,CAAC,QAAQ,GAAG,GAAG,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,EAAE,CAAC;QACjF,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IACD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC;IACxE,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED,SAAgB,+BAA+B,CAAC,OAAe;IAC7D,OAAO,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAAe;IACpD,OAAO,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * MCC Logger (TypeScript)
3
+ *
4
+ * lib/shared/logger.cjs 的 TS 版本,编译到 dist/shared/logger.js
5
+ * 逻辑完全一致,只是加了类型。
6
+ */
7
+ declare function getLogDir(): string;
8
+ export declare function init(sessionId: string, logDir?: string): string;
9
+ export declare function initFromEnv(): void;
10
+ declare const log: {
11
+ error: (c: string, m: string) => void;
12
+ warn: (c: string, m: string) => void;
13
+ info: (c: string, m: string) => void;
14
+ debug: (c: string, m: string) => void;
15
+ init: typeof init;
16
+ initFromEnv: typeof initFromEnv;
17
+ getSessionId: () => string;
18
+ getLogDir: typeof getLogDir;
19
+ };
20
+ export { log };
21
+ export declare function isDebugEnabled(): boolean;
22
+ export declare function makeSessionId(): string;
23
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwBH,iBAAS,SAAS,IAAI,MAAM,CAO3B;AA+DD,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED,wBAAgB,WAAW,IAAI,IAAI,CAIlC;AAGD,QAAA,MAAM,GAAG;eACM,MAAM,KAAK,MAAM;cACjB,MAAM,KAAK,MAAM;cACjB,MAAM,KAAK,MAAM;eACjB,MAAM,KAAK,MAAM;;;;;CAK/B,CAAC;AACF,OAAO,EAAE,GAAG,EAAE,CAAC;AAEf,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAItC"}
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ /**
3
+ * MCC Logger (TypeScript)
4
+ *
5
+ * lib/shared/logger.cjs 的 TS 版本,编译到 dist/shared/logger.js
6
+ * 逻辑完全一致,只是加了类型。
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.log = void 0;
43
+ exports.init = init;
44
+ exports.initFromEnv = initFromEnv;
45
+ exports.isDebugEnabled = isDebugEnabled;
46
+ exports.makeSessionId = makeSessionId;
47
+ const fs = __importStar(require("fs"));
48
+ const path = __importStar(require("path"));
49
+ const os = __importStar(require("os"));
50
+ const LEVELS = { error: 0, warn: 1, info: 2, debug: 3 };
51
+ function env(key, fallback) {
52
+ return process.env[key] ?? fallback;
53
+ }
54
+ function levelValue(level) {
55
+ return LEVELS[level?.toLowerCase()] ?? LEVELS.info;
56
+ }
57
+ let _sessionId = '';
58
+ let _logDir = '';
59
+ let _currentFile = '';
60
+ let _currentSize = 0;
61
+ let _maxSize = 5 * 1024 * 1024;
62
+ let _maxFiles = 3;
63
+ let _minLevel = LEVELS.info;
64
+ function getLogDir() {
65
+ if (_logDir)
66
+ return _logDir;
67
+ const logDirEnv = env('MCC_LOG_DIR', '');
68
+ if (logDirEnv)
69
+ return logDirEnv;
70
+ const mccHome = env('MCC_HOME', path.join(os.homedir(), '.mcc'));
71
+ const profile = env('MCC_CURRENT_PROFILE', 'default');
72
+ return path.join(mccHome, 'logs', profile, _sessionId || 'nosession');
73
+ }
74
+ function getLogPath() {
75
+ return path.join(getLogDir(), 'mcc.log');
76
+ }
77
+ function rotate() {
78
+ const logPath = getLogPath();
79
+ if (!fs.existsSync(logPath))
80
+ return;
81
+ try {
82
+ fs.unlinkSync(`${logPath}.${_maxFiles}`);
83
+ }
84
+ catch { }
85
+ for (let i = _maxFiles - 1; i >= 1; i--) {
86
+ const from = `${logPath}.${i}`;
87
+ const to = `${logPath}.${i + 1}`;
88
+ try {
89
+ if (fs.existsSync(from))
90
+ fs.renameSync(from, to);
91
+ }
92
+ catch { }
93
+ }
94
+ try {
95
+ fs.renameSync(logPath, `${logPath}.1`);
96
+ }
97
+ catch { }
98
+ _currentSize = 0;
99
+ _currentFile = '';
100
+ }
101
+ function ensureDir() {
102
+ const dir = getLogDir();
103
+ if (!fs.existsSync(dir))
104
+ fs.mkdirSync(dir, { recursive: true, mode: 0o755 });
105
+ return dir;
106
+ }
107
+ function writeFile(line) {
108
+ if (!_sessionId)
109
+ return;
110
+ ensureDir();
111
+ const logPath = getLogPath();
112
+ const lineBytes = Buffer.byteLength(line, 'utf8') + 1;
113
+ if (_currentFile !== logPath || _currentSize + lineBytes > _maxSize) {
114
+ rotate();
115
+ }
116
+ try {
117
+ fs.appendFileSync(logPath, line + '\n', { mode: 0o644 });
118
+ _currentFile = logPath;
119
+ _currentSize += lineBytes;
120
+ }
121
+ catch (err) {
122
+ process.stderr.write(`[logger] write failed: ${err.message}\n`);
123
+ }
124
+ }
125
+ function timestamp() {
126
+ const now = new Date();
127
+ const p = (n, l = 2) => String(n).padStart(l, '0');
128
+ return `${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())} ` +
129
+ `${p(now.getHours())}:${p(now.getMinutes())}:${p(now.getSeconds())}.${p(now.getMilliseconds(), 3)}`;
130
+ }
131
+ function format(level, message, component) {
132
+ const sid = _sessionId ? `[${_sessionId}]` : '';
133
+ const comp = component ? `[${component}]` : '';
134
+ return `${timestamp()} ${(level || 'info').toUpperCase().padEnd(5)} ${sid}${comp} ${message}`;
135
+ }
136
+ function write(level, component, message) {
137
+ if (levelValue(level) > _minLevel)
138
+ return;
139
+ const line = format(level, message, component);
140
+ process.stderr.write(line + '\n');
141
+ writeFile(line);
142
+ }
143
+ function init(sessionId, logDir) {
144
+ _sessionId = sessionId;
145
+ _logDir = logDir || '';
146
+ _currentFile = '';
147
+ _currentSize = 0;
148
+ _minLevel = levelValue(env('MCC_LOG_LEVEL', 'info'));
149
+ _maxSize = parseInt(env('MCC_LOG_MAX_SIZE', ''), 10) || 5 * 1024 * 1024;
150
+ _maxFiles = parseInt(env('MCC_LOG_MAX_FILES', ''), 10) || 3;
151
+ const dir = ensureDir();
152
+ try {
153
+ fs.writeFileSync(path.join(dir, '.session'), `${sessionId}\n${Date.now()}\n`, { mode: 0o644 });
154
+ }
155
+ catch { }
156
+ return dir;
157
+ }
158
+ function initFromEnv() {
159
+ const sid = env('MCC_LOG_SESSION_ID', '');
160
+ const dir = env('MCC_LOG_DIR', '');
161
+ if (sid)
162
+ init(sid, dir);
163
+ }
164
+ // --- 统一 API:log.info(component, message) ---
165
+ const log = {
166
+ error: (c, m) => write('error', m, c),
167
+ warn: (c, m) => write('warn', m, c),
168
+ info: (c, m) => write('info', m, c),
169
+ debug: (c, m) => write('debug', m, c),
170
+ init,
171
+ initFromEnv,
172
+ getSessionId: () => _sessionId,
173
+ getLogDir,
174
+ };
175
+ exports.log = log;
176
+ function isDebugEnabled() {
177
+ return _minLevel >= LEVELS.debug;
178
+ }
179
+ function makeSessionId() {
180
+ const now = new Date();
181
+ const p = (n, l = 2) => String(n).padStart(l, '0');
182
+ return `${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())}_${p(now.getHours())}-${p(now.getMinutes())}-${p(now.getSeconds())}`;
183
+ }
184
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FH,oBAWC;AAED,kCAIC;AAeD,wCAEC;AAED,sCAIC;AApID,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,MAAM,MAAM,GAA2B,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC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AAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;AAChJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Shared provider preset catalog for CLI + Dashboard.
3
+ *
4
+ * Keep this file runtime-agnostic (no Node/browser APIs) so both
5
+ * backend and UI can import the same source of truth.
6
+ */
7
+ export type PresetCategory = 'recommended' | 'alternative';
8
+ export type ProviderPresetTarget = 'claude' | 'droid';
9
+ export declare const PROVIDER_PRESET_IDS: readonly ["openrouter", "alibaba-coding-plan", "huggingface", "ollama", "llamacpp", "anthropic", "glm", "km", "foundry", "mm", "deepseek", "qwen", "ollama-cloud", "novita"];
10
+ export type ProviderPresetId = (typeof PROVIDER_PRESET_IDS)[number];
11
+ export interface ProviderPresetDefinition {
12
+ id: ProviderPresetId;
13
+ name: string;
14
+ description: string;
15
+ baseUrl: string;
16
+ defaultProfileName: string;
17
+ defaultModel: string;
18
+ apiKeyPlaceholder: string;
19
+ apiKeyHint: string;
20
+ category: PresetCategory;
21
+ requiresApiKey: boolean;
22
+ defaultTarget?: ProviderPresetTarget;
23
+ /** Additional env vars for thinking mode, etc. */
24
+ extraEnv?: Record<string, string>;
25
+ /** Enable always thinking mode. */
26
+ alwaysThinkingEnabled?: boolean;
27
+ /** UI metadata */
28
+ badge?: string;
29
+ featured?: boolean;
30
+ icon?: string;
31
+ }
32
+ export declare const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
33
+ /**
34
+ * Legacy aliases mapped to canonical preset IDs.
35
+ * Keep this minimal and explicit to avoid hidden implicit behavior.
36
+ */
37
+ export declare const PROVIDER_PRESET_ALIASES: Readonly<Record<string, ProviderPresetId>>;
38
+ export declare const PROVIDER_PRESET_DEFINITIONS: readonly ProviderPresetDefinition[];
39
+ export declare function createProviderPresetDefinitions(): ProviderPresetDefinition[];
40
+ export declare function normalizeProviderPresetId(id: string): string;
41
+ //# sourceMappingURL=provider-preset-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-preset-catalog.d.ts","sourceRoot":"","sources":["../../src/shared/provider-preset-catalog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,CAAC;AAC3D,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,eAAO,MAAM,mBAAmB,8KAetB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,gBAAgB,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,mCAAmC;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,kBAAkB;IAClB,KAAK,CAA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