@fudrouter/fsrouter 0.6.77 → 0.6.79
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/bin/rewriteSseImports.js +13 -15
- package/dist/lib/oauth/constants/oauth.js +2 -0
- package/dist/lib/oauth/providers.js +72 -0
- package/dist/open-sse/handlers/chatCore/nonStreamingHandler.js +1 -1
- package/dist/open-sse/handlers/chatCore/requestDetail.js +1 -1
- package/dist/open-sse/handlers/chatCore/sseToJsonHandler.js +1 -1
- package/dist/open-sse/handlers/chatCore/streamingHandler.js +1 -1
- package/dist/open-sse/handlers/imageProviders/leonardo.js +1 -1
- package/dist/open-sse/handlers/imageProviders/weavy.js +1 -1
- package/dist/open-sse/handlers/videoProviders/weavy.js +1 -1
- package/dist/open-sse/mcp-server/tools/advancedTools.js +2 -2
- package/dist/open-sse/mcp-server/tools/agentSkillTools.js +1 -1
- package/dist/open-sse/mcp-server/tools/compressionTools.js +4 -4
- package/dist/open-sse/mcp-server/tools/gamificationTools.js +10 -10
- package/dist/open-sse/mcp-server/tools/githubSkillTools.js +1 -1
- package/dist/open-sse/mcp-server/tools/memoryTools.js +3 -3
- package/dist/open-sse/mcp-server/tools/notionTools.js +2 -2
- package/dist/open-sse/mcp-server/tools/obsidianTools.js +2 -2
- package/dist/open-sse/mcp-server/tools/pickFastestModel.js +1 -1
- package/dist/open-sse/mcp-server/tools/pluginTools.js +4 -4
- package/dist/open-sse/mcp-server/tools/skillTools.js +2 -2
- package/dist/open-sse/providers/index.js +1 -1
- package/dist/open-sse/providers/registry/nous-research.js +10 -2
- package/dist/open-sse/services/combo/quotaExhaustionCutoff.js +2 -2
- package/dist/open-sse/services/combo/quotaShareStrategy.js +1 -1
- package/dist/open-sse/services/combo/resolveAutoStrategy.js +1 -1
- package/dist/open-sse/services/combo/sessionStickiness.js +1 -1
- package/dist/open-sse/services/combo/targetSorters.js +2 -2
- package/dist/open-sse/services/combo/validateQuality.js +1 -1
- package/dist/open-sse/services/tokenRefresh/providers.js +3 -3
- package/dist/routes/headroom/extras/route.js +2 -2
- package/dist/shared/constants/providers.js +1 -1
- package/open-sse/handlers/chatCore/nonStreamingHandler.js +1 -1
- package/open-sse/handlers/chatCore/requestDetail.js +1 -1
- package/open-sse/handlers/chatCore/sseToJsonHandler.js +1 -1
- package/open-sse/handlers/chatCore/streamingHandler.js +1 -1
- package/open-sse/handlers/imageProviders/leonardo.js +1 -1
- package/open-sse/handlers/imageProviders/weavy.js +1 -1
- package/open-sse/handlers/videoProviders/weavy.js +1 -1
- package/open-sse/mcp-server/tools/advancedTools.js +2 -2
- package/open-sse/mcp-server/tools/agentSkillTools.js +1 -1
- package/open-sse/mcp-server/tools/compressionTools.js +4 -4
- package/open-sse/mcp-server/tools/gamificationTools.js +10 -10
- package/open-sse/mcp-server/tools/githubSkillTools.js +1 -1
- package/open-sse/mcp-server/tools/memoryTools.js +3 -3
- package/open-sse/mcp-server/tools/notionTools.js +2 -2
- package/open-sse/mcp-server/tools/obsidianTools.js +2 -2
- package/open-sse/mcp-server/tools/pickFastestModel.js +1 -1
- package/open-sse/mcp-server/tools/pluginTools.js +4 -4
- package/open-sse/mcp-server/tools/skillTools.js +2 -2
- package/open-sse/providers/index.js +1 -1
- package/open-sse/providers/registry/nous-research.js +10 -2
- package/open-sse/services/combo/quotaExhaustionCutoff.js +2 -2
- package/open-sse/services/combo/quotaShareStrategy.js +1 -1
- package/open-sse/services/combo/resolveAutoStrategy.js +1 -1
- package/open-sse/services/combo/sessionStickiness.js +1 -1
- package/open-sse/services/combo/targetSorters.js +2 -2
- package/open-sse/services/combo/validateQuality.js +1 -1
- package/open-sse/services/tokenRefresh/providers.js +3 -3
- package/package.json +1 -1
- package/public/.vite/manifest.json +197 -85
- package/public/assets/EndpointPageClient.BNiu_vhL.js +6 -0
- package/public/assets/Loading.CRvAR61e.js +1 -0
- package/public/assets/NoAuthProxyCard.BARTPHmg.js +89 -0
- package/public/assets/index.BbQSujX0.js +89 -0
- package/public/assets/page.2cfQ0soc.js +5 -0
- package/public/assets/page.Azr84Ml-.js +1 -0
- package/public/assets/page.B57i00nL.js +1 -0
- package/public/assets/page.BTTzRlp6.js +1 -0
- package/public/assets/page.BY5IysJR.js +2 -0
- package/public/assets/page.BYy5vdYY.js +1 -0
- package/public/assets/page.Bkhxy2VJ.js +1 -0
- package/public/assets/page.BrLVxn10.js +1 -0
- package/public/assets/page.C0TLs5yW.js +1 -0
- package/public/assets/page.C1MGHZJw.js +1 -0
- package/public/assets/page.C5qOhBBX.js +1 -0
- package/public/assets/page.CL7pbImn.js +1 -0
- package/public/assets/page.CLbi_S1p.js +1 -0
- package/public/assets/page.CNUurvtj.js +23 -0
- package/public/assets/page.CWyZKaVw.js +31 -0
- package/public/assets/page.CXKvW0hn.js +1 -0
- package/public/assets/page.CXXS5Pj6.js +4 -0
- package/public/assets/page.CavjztiR.js +1 -0
- package/public/assets/page.CiURc2ed.js +64 -0
- package/public/assets/page.CjbJHAqY.js +1 -0
- package/public/assets/page.CqKdcCXs.js +5 -0
- package/public/assets/page.CuZp1ItQ.js +1 -0
- package/public/assets/page.Cx7iFgCR.js +1 -0
- package/public/assets/page.D023izTv.js +6 -0
- package/public/assets/page.D5dHsYMc.js +1 -0
- package/public/assets/page.DIBe8_S7.js +1 -0
- package/public/assets/page.DOS_9ovb.js +1 -0
- package/public/assets/page.DTfhMnYX.js +1 -0
- package/public/assets/page.D_dG62bf.js +1 -0
- package/public/assets/page.DjsFF4p7.js +1 -0
- package/public/assets/page.DmjQJ44n.js +6 -0
- package/public/assets/page.Dsd5yK6z.js +1 -0
- package/public/assets/page.EBdicyw3.js +2 -0
- package/public/assets/page.K07l9G5d.js +1 -0
- package/public/assets/page.N_CNyJfs.js +1 -0
- package/public/assets/page.cIm7s2zC.js +1 -0
- package/public/assets/page.u8Bt3ap8.js +1 -0
- package/public/index.html +1 -1
package/bin/rewriteSseImports.js
CHANGED
|
@@ -19,23 +19,23 @@ function rewrite(file) {
|
|
|
19
19
|
const prefix = "../".repeat(depth) + "dist/";
|
|
20
20
|
|
|
21
21
|
content = content
|
|
22
|
-
.replace(/from\s+['
|
|
22
|
+
.replace(/from\s+['"]@\/lib\/([^'"]+)['"]/g, (m, imp) => {
|
|
23
23
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
24
24
|
return `from '${prefix}lib/${resolved}'`;
|
|
25
25
|
})
|
|
26
|
-
.replace(/from\s+['
|
|
26
|
+
.replace(/from\s+['"]@\/shared\/([^'"]+)['"]/g, (m, imp) => {
|
|
27
27
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
28
28
|
return `from '${prefix}shared/${resolved}'`;
|
|
29
29
|
})
|
|
30
|
-
.replace(/from\s+['
|
|
30
|
+
.replace(/from\s+['"]@\/store\/([^'"]+)['"]/g, (m, imp) => {
|
|
31
31
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
32
32
|
return `from '${prefix}store/${resolved}'`;
|
|
33
33
|
})
|
|
34
|
-
.replace(/from\s+['
|
|
34
|
+
.replace(/from\s+['"]@\/utils\/([^'"]+)['"]/g, (m, imp) => {
|
|
35
35
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
36
36
|
return `from '${prefix}utils/${resolved}'`;
|
|
37
37
|
})
|
|
38
|
-
.replace(/from\s+['
|
|
38
|
+
.replace(/from\s+['"]@\/services\/([^'"]+)['"]/g, (m, imp) => {
|
|
39
39
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
40
40
|
return `from '${prefix}services/${resolved}'`;
|
|
41
41
|
})
|
|
@@ -47,25 +47,23 @@ function rewrite(file) {
|
|
|
47
47
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
48
48
|
return `import('${prefix}lib/${resolved}')`;
|
|
49
49
|
})
|
|
50
|
-
// Fix relative imports pointing to ../../../src/lib →
|
|
51
|
-
// For open-sse/services/*.js (depth=2): ../../../src/lib/ = open-sse/src/lib/ (wrong)
|
|
52
|
-
// correct: ../../dist/lib/
|
|
50
|
+
// Fix relative imports pointing to ../../../src/lib → dist/lib (depth-aware)
|
|
53
51
|
.replace(/['"]\.\.\/\.\.\/\.\.\/src\/lib\/([^'"]+)['"]/g, (m, imp) => {
|
|
54
52
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
55
|
-
return `'
|
|
53
|
+
return `'${prefix}lib/${resolved}'`;
|
|
56
54
|
})
|
|
57
55
|
.replace(/import\(\s*['"]\.\.\/\.\.\/\.\.\/src\/lib\/([^'"]+)['"]\s*\)/g, (m, imp) => {
|
|
58
56
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
59
|
-
return `import('
|
|
57
|
+
return `import('${prefix}lib/${resolved}')`;
|
|
60
58
|
})
|
|
61
|
-
//
|
|
62
|
-
.replace(/['"]
|
|
59
|
+
// Normalize any ../-chain pointing at dist/lib to the depth-correct prefix
|
|
60
|
+
.replace(/['"](?:\.\.\/)+dist\/lib\/([^'"]+)['"]/g, (m, imp) => {
|
|
63
61
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
64
|
-
return `'
|
|
62
|
+
return `'${prefix}lib/${resolved}'`;
|
|
65
63
|
})
|
|
66
|
-
.replace(/import\(\s*['"]
|
|
64
|
+
.replace(/import\(\s*['"](?:\.\.\/)+dist\/lib\/([^'"]+)['"]\s*\)/g, (m, imp) => {
|
|
67
65
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
68
|
-
return `import('
|
|
66
|
+
return `import('${prefix}lib/${resolved}')`;
|
|
69
67
|
})
|
|
70
68
|
.replace(/['"]\.\.\/\.\.\/src\/shared\/([^'"]+)['"]/g, (m, imp) => {
|
|
71
69
|
const resolved = imp.endsWith(".js") ? imp : imp + ".js";
|
|
@@ -118,6 +118,8 @@ export const KIMCHI_CONFIG = { ...PROVIDER_OAUTH["kimchi"] };
|
|
|
118
118
|
// Endpoint: cli-chat-proxy.grok.com — same client_id as xai, different flow + scopes
|
|
119
119
|
export const GROK_CLI_CONFIG = { ...PROVIDER_OAUTH["grok-cli"] };
|
|
120
120
|
|
|
121
|
+
export const NOUS_CONFIG = { ...PROVIDER_OAUTH["nous-research"] };
|
|
122
|
+
|
|
121
123
|
// OAuth timeout (5 minutes)
|
|
122
124
|
export const OAUTH_TIMEOUT = 300000;
|
|
123
125
|
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
CODEBUDDY_CONFIG,
|
|
29
29
|
KIMCHI_CONFIG,
|
|
30
30
|
GROK_CLI_CONFIG,
|
|
31
|
+
NOUS_CONFIG,
|
|
31
32
|
getOAuthClientMetadata,
|
|
32
33
|
} from "./constants/oauth.js";
|
|
33
34
|
import { XAI_CONFIG, XAI_PKCE_VERIFIER_BYTES } from "./constants/xai.js";
|
|
@@ -372,6 +373,77 @@ const PROVIDERS = {
|
|
|
372
373
|
},
|
|
373
374
|
},
|
|
374
375
|
|
|
376
|
+
// Nous Research (Nous Portal) — OAuth device code flow.
|
|
377
|
+
// Portal has no manual API-key page; auth is device-code only (client_id hermes-cli).
|
|
378
|
+
"nous-research": {
|
|
379
|
+
config: NOUS_CONFIG,
|
|
380
|
+
flowType: "device_code",
|
|
381
|
+
requestDeviceCode: async (config) => {
|
|
382
|
+
const body = new URLSearchParams({ client_id: config.clientId });
|
|
383
|
+
if (config.scope) body.set("scope", config.scope);
|
|
384
|
+
const response = await fetch(config.deviceCodeUrl, {
|
|
385
|
+
method: "POST",
|
|
386
|
+
headers: {
|
|
387
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
388
|
+
Accept: "application/json",
|
|
389
|
+
},
|
|
390
|
+
body,
|
|
391
|
+
});
|
|
392
|
+
if (!response.ok) {
|
|
393
|
+
const error = await response.text();
|
|
394
|
+
throw new Error(`Nous device code request failed: ${error}`);
|
|
395
|
+
}
|
|
396
|
+
return await response.json();
|
|
397
|
+
},
|
|
398
|
+
pollToken: async (config, deviceCode) => {
|
|
399
|
+
const response = await fetch(config.tokenUrl, {
|
|
400
|
+
method: "POST",
|
|
401
|
+
headers: {
|
|
402
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
403
|
+
Accept: "application/json",
|
|
404
|
+
},
|
|
405
|
+
body: new URLSearchParams({
|
|
406
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
407
|
+
device_code: deviceCode,
|
|
408
|
+
client_id: config.clientId,
|
|
409
|
+
}),
|
|
410
|
+
});
|
|
411
|
+
let data;
|
|
412
|
+
try {
|
|
413
|
+
data = await response.json();
|
|
414
|
+
} catch {
|
|
415
|
+
const text = await response.text();
|
|
416
|
+
data = { error: "invalid_response", error_description: text };
|
|
417
|
+
}
|
|
418
|
+
const pending =
|
|
419
|
+
data?.error === "authorization_pending" || data?.error === "slow_down";
|
|
420
|
+
return { ok: response.ok || pending, data };
|
|
421
|
+
},
|
|
422
|
+
mapTokens: (tokens) => {
|
|
423
|
+
let email = null;
|
|
424
|
+
try {
|
|
425
|
+
const parts = String(tokens.access_token || "").split(".");
|
|
426
|
+
if (parts.length >= 2) {
|
|
427
|
+
const b64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
428
|
+
const padded = b64 + "=".repeat((4 - (b64.length % 4)) % 4);
|
|
429
|
+
const claims = JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
|
|
430
|
+
email = claims.email || claims.sub || null;
|
|
431
|
+
}
|
|
432
|
+
} catch { /* ignore */ }
|
|
433
|
+
return {
|
|
434
|
+
accessToken: tokens.access_token,
|
|
435
|
+
refreshToken: tokens.refresh_token || null,
|
|
436
|
+
expiresIn: tokens.expires_in,
|
|
437
|
+
scope: tokens.scope,
|
|
438
|
+
email: email || undefined,
|
|
439
|
+
providerSpecificData: {
|
|
440
|
+
authMethod: "device_code",
|
|
441
|
+
email: email || null,
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
|
|
375
447
|
"gemini-cli": {
|
|
376
448
|
config: GEMINI_CONFIG,
|
|
377
449
|
flowType: "authorization_code",
|
|
@@ -7,7 +7,7 @@ import { createErrorResult } from "../../utils/error.js";
|
|
|
7
7
|
import { HTTP_STATUS } from "../../config/runtimeConfig.js";
|
|
8
8
|
import { parseSSEToOpenAIResponse } from "./sseToJsonHandler.js";
|
|
9
9
|
import { buildRequestDetail, extractRequestConfig, extractUsageFromResponse, saveUsageStats, formatDoneLine } from "./requestDetail.js";
|
|
10
|
-
import { appendRequestLog, saveRequestDetail } from '
|
|
10
|
+
import { appendRequestLog, saveRequestDetail } from '../../../../dist/lib/usageDb.js';
|
|
11
11
|
import { decloakToolNames } from "../../utils/claudeCloaking.js";
|
|
12
12
|
|
|
13
13
|
function parseToolArguments(value) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { saveRequestUsage, appendRequestLog, saveRequestDetail } from '
|
|
1
|
+
import { saveRequestUsage, appendRequestLog, saveRequestDetail } from '../../../../dist/lib/usageDb.js';
|
|
2
2
|
import { COLORS } from "../../utils/stream.js";
|
|
3
3
|
import { canonicalizeUsage } from "../../utils/usageTracking.js";
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ import { buildRequestDetail, extractRequestConfig, saveUsageStats, formatDoneLin
|
|
|
7
7
|
|
|
8
8
|
// Responses-API providers (e.g. codex) may emit SSE without content-type + use Responses output shape
|
|
9
9
|
const isResponsesProvider = (p) => PROVIDERS[p]?.format === FORMATS.OPENAI_RESPONSES;
|
|
10
|
-
import { saveRequestDetail, appendRequestLog } from '
|
|
10
|
+
import { saveRequestDetail, appendRequestLog } from '../../../../dist/lib/usageDb.js';
|
|
11
11
|
|
|
12
12
|
function textFromResponsesMessageItem(item) {
|
|
13
13
|
if (!item?.content || !Array.isArray(item.content)) return "";
|
|
@@ -6,7 +6,7 @@ import { PROVIDERS } from "../../config/providers.js";
|
|
|
6
6
|
import { STREAM_STALL_TIMEOUT_MS } from "../../config/runtimeConfig.js";
|
|
7
7
|
import { buildAbortedResponsesTerminalBytes } from "../../utils/responsesStreamHelpers.js";
|
|
8
8
|
import { buildRequestDetail, extractRequestConfig, saveUsageStats, formatDoneLine } from "./requestDetail.js";
|
|
9
|
-
import { saveRequestDetail } from '
|
|
9
|
+
import { saveRequestDetail } from '../../../../dist/lib/usageDb.js';
|
|
10
10
|
import { SSE_HEADERS_CORS as SSE_HEADERS } from "../../utils/sseConstants.js";
|
|
11
11
|
|
|
12
12
|
// Codex returns Responses API SSE → which client format to translate INTO, by request sourceFormat.
|
|
@@ -34,7 +34,7 @@ import { randomBytes } from "crypto";
|
|
|
34
34
|
// Falls back to empty object if DB not available (e.g., first boot).
|
|
35
35
|
async function getLeonardoAdminConfig() {
|
|
36
36
|
try {
|
|
37
|
-
const { getAdapter } = await import('
|
|
37
|
+
const { getAdapter } = await import('../../../../dist/lib/db/driver.js');
|
|
38
38
|
const db = await getAdapter();
|
|
39
39
|
const row = db.get(`SELECT value FROM kv WHERE scope = 'leonardo' AND key = 'admin_config'`);
|
|
40
40
|
if (!row?.value) return null;
|
|
@@ -39,7 +39,7 @@ import path from "path";
|
|
|
39
39
|
import { execFile } from "child_process";
|
|
40
40
|
import { promisify } from "util";
|
|
41
41
|
import { PROVIDER_MODELS } from "../../config/providerModels.js";
|
|
42
|
-
import { updateProviderConnection } from '
|
|
42
|
+
import { updateProviderConnection } from '../../../../dist/lib/localDb.js';
|
|
43
43
|
|
|
44
44
|
const TEMPLATE_ID = "SZXXYN7L9PN2SCTVYAlt";
|
|
45
45
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { execFile } from "child_process";
|
|
3
3
|
import { promisify } from "util";
|
|
4
|
-
import { updateProviderConnection } from '
|
|
4
|
+
import { updateProviderConnection } from '../../../../dist/lib/localDb.js';
|
|
5
5
|
|
|
6
6
|
// 10 MB buffer — video polling can produce large stderr logs
|
|
7
7
|
const MAX_BUFFER = 10 * 1024 * 1024;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getComboModelProvider,
|
|
7
7
|
getComboModelString,
|
|
8
8
|
getComboStepTarget
|
|
9
|
-
} from '
|
|
9
|
+
} from '../../../../dist/lib/combos/steps.ts.js';
|
|
10
10
|
import { normalizeRoutingStrategy } from "../../../shared/constants/routingStrategies.ts";
|
|
11
11
|
const OMNIROUTE_BASE_URL = resolveOmniRouteBaseUrl();
|
|
12
12
|
const OMNIROUTE_API_KEY = process.env.OMNIROUTE_API_KEY || "";
|
|
@@ -684,7 +684,7 @@ async function handleDbHealthCheck(args) {
|
|
|
684
684
|
const start = Date.now();
|
|
685
685
|
const autoRepair = args.autoRepair === true;
|
|
686
686
|
try {
|
|
687
|
-
const { runManagedDbHealthCheck } = await import('
|
|
687
|
+
const { runManagedDbHealthCheck } = await import('../../../../dist/lib/db/core.ts.js');
|
|
688
688
|
const result = runManagedDbHealthCheck({ autoRepair });
|
|
689
689
|
await logToolCall(
|
|
690
690
|
"omniroute_db_health_check",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { getCatalog, getSkillById, filterCatalog, computeCoverage, fetchSkillMarkdown } from '
|
|
2
|
+
import { getCatalog, getSkillById, filterCatalog, computeCoverage, fetchSkillMarkdown } from '../../../../dist/lib/agentSkills/catalog.js';
|
|
3
3
|
const AgentSkillsListSchema = z.object({
|
|
4
4
|
category: z.enum(["api", "cli"]).optional().describe("Filter by category: 'api' or 'cli'"),
|
|
5
5
|
area: z.string().optional().describe("Filter by area (e.g. 'providers', 'models', 'cli-serve')")
|
|
@@ -2,10 +2,10 @@ import { logToolCall } from "../audit.ts";
|
|
|
2
2
|
import {
|
|
3
3
|
getCompressionSettings,
|
|
4
4
|
updateCompressionSettings
|
|
5
|
-
} from '
|
|
6
|
-
import { getCompressionAnalyticsSummary } from '
|
|
7
|
-
import { getCacheStatsSummary } from '
|
|
8
|
-
import { listCompressionCombos } from '
|
|
5
|
+
} from '../../../../dist/lib/db/compression.ts.js';
|
|
6
|
+
import { getCompressionAnalyticsSummary } from '../../../../dist/lib/db/compressionAnalytics.ts.js';
|
|
7
|
+
import { getCacheStatsSummary } from '../../../../dist/lib/db/compressionCacheStats.ts.js';
|
|
8
|
+
import { listCompressionCombos } from '../../../../dist/lib/db/compressionCombos.ts.js';
|
|
9
9
|
import {
|
|
10
10
|
getMcpDescriptionCompressionStats,
|
|
11
11
|
snapshotMcpDescriptionCompressionStats
|
|
@@ -9,7 +9,7 @@ const gamificationTools = [
|
|
|
9
9
|
limit: z.number().min(1).max(100).default(50)
|
|
10
10
|
}),
|
|
11
11
|
handler: async (args) => {
|
|
12
|
-
const { getTopN } = await import('
|
|
12
|
+
const { getTopN } = await import('../../../../dist/lib/gamification/leaderboard.js');
|
|
13
13
|
const entries = await getTopN(args.scope, args.limit);
|
|
14
14
|
return { entries };
|
|
15
15
|
}
|
|
@@ -23,7 +23,7 @@ const gamificationTools = [
|
|
|
23
23
|
scope: z.enum(["global", "weekly", "monthly", "tokens_shared"]).default("global")
|
|
24
24
|
}),
|
|
25
25
|
handler: async (args) => {
|
|
26
|
-
const { getRank } = await import('
|
|
26
|
+
const { getRank } = await import('../../../../dist/lib/gamification/leaderboard.js');
|
|
27
27
|
const rank = await getRank(args.apiKeyId, args.scope);
|
|
28
28
|
return { rank };
|
|
29
29
|
}
|
|
@@ -36,9 +36,9 @@ const gamificationTools = [
|
|
|
36
36
|
apiKeyId: z.string()
|
|
37
37
|
}),
|
|
38
38
|
handler: async (args) => {
|
|
39
|
-
const { getXp, getBadges } = await import('
|
|
40
|
-
const { calculateLevel, getLevelTitle, getLevelTier } = await import('
|
|
41
|
-
const { getStreak } = await import('
|
|
39
|
+
const { getXp, getBadges } = await import('../../../../dist/lib/db/gamification.js');
|
|
40
|
+
const { calculateLevel, getLevelTitle, getLevelTier } = await import('../../../../dist/lib/gamification/xp.js');
|
|
41
|
+
const { getStreak } = await import('../../../../dist/lib/gamification/streaks.js');
|
|
42
42
|
const xp = getXp(args.apiKeyId);
|
|
43
43
|
const badges = getBadges(args.apiKeyId);
|
|
44
44
|
const streak = await getStreak(args.apiKeyId);
|
|
@@ -63,7 +63,7 @@ const gamificationTools = [
|
|
|
63
63
|
category: z.string().optional()
|
|
64
64
|
}),
|
|
65
65
|
handler: async (args) => {
|
|
66
|
-
const { getBadgeDefinitions, getBadges } = await import('
|
|
66
|
+
const { getBadgeDefinitions, getBadges } = await import('../../../../dist/lib/db/gamification.js');
|
|
67
67
|
if (args.apiKeyId) {
|
|
68
68
|
const badges = getBadges(args.apiKeyId);
|
|
69
69
|
return { earned: badges };
|
|
@@ -83,7 +83,7 @@ const gamificationTools = [
|
|
|
83
83
|
reason: z.string().optional()
|
|
84
84
|
}),
|
|
85
85
|
handler: async (args) => {
|
|
86
|
-
const { transferTokens } = await import('
|
|
86
|
+
const { transferTokens } = await import('../../../../dist/lib/gamification/sharing.js');
|
|
87
87
|
const result = await transferTokens(
|
|
88
88
|
args.fromApiKeyId,
|
|
89
89
|
args.toApiKeyId,
|
|
@@ -103,7 +103,7 @@ const gamificationTools = [
|
|
|
103
103
|
maxUses: z.number().positive().default(1)
|
|
104
104
|
}),
|
|
105
105
|
handler: async (args) => {
|
|
106
|
-
const { createInvite } = await import('
|
|
106
|
+
const { createInvite } = await import('../../../../dist/lib/gamification/invites.js');
|
|
107
107
|
const result = await createInvite(args.apiKeyId, args.serverUrl, args.maxUses);
|
|
108
108
|
return result;
|
|
109
109
|
}
|
|
@@ -114,7 +114,7 @@ const gamificationTools = [
|
|
|
114
114
|
scopes: ["read:gamification"],
|
|
115
115
|
inputSchema: z.object({}),
|
|
116
116
|
handler: async () => {
|
|
117
|
-
const { listServers } = await import('
|
|
117
|
+
const { listServers } = await import('../../../../dist/lib/gamification/servers.js');
|
|
118
118
|
return { servers: await listServers() };
|
|
119
119
|
}
|
|
120
120
|
},
|
|
@@ -124,7 +124,7 @@ const gamificationTools = [
|
|
|
124
124
|
scopes: ["read:gamification"],
|
|
125
125
|
inputSchema: z.object({}),
|
|
126
126
|
handler: async () => {
|
|
127
|
-
const { getAnomalies } = await import('
|
|
127
|
+
const { getAnomalies } = await import('../../../../dist/lib/gamification/antiCheat.js');
|
|
128
128
|
return { anomalies: await getAnomalies() };
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
GitHubSkillsSearchSchema,
|
|
7
7
|
GitHubSkillsScanSchema,
|
|
8
8
|
GitHubSkillsInstallSchema
|
|
9
|
-
} from '
|
|
9
|
+
} from '../../../../dist/lib/skills/githubCollector.js';
|
|
10
10
|
async function handleSearch(args) {
|
|
11
11
|
const { repos, errors } = await searchGitHubSkills({
|
|
12
12
|
minStars: args.minStars,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { retrieveMemories } from '
|
|
3
|
-
import { createMemory, deleteMemory, listMemories } from '
|
|
2
|
+
import { retrieveMemories } from '../../../../dist/lib/memory/retrieval.js';
|
|
3
|
+
import { createMemory, deleteMemory, listMemories } from '../../../../dist/lib/memory/store.js';
|
|
4
4
|
import {
|
|
5
5
|
getMemorySettings,
|
|
6
6
|
toMemoryRetrievalConfig,
|
|
7
7
|
DEFAULT_MEMORY_SETTINGS
|
|
8
|
-
} from '
|
|
8
|
+
} from '../../../../dist/lib/memory/settings.js';
|
|
9
9
|
const MemorySearchSchema = z.object({
|
|
10
10
|
apiKeyId: z.string(),
|
|
11
11
|
query: z.string().optional(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createNotionClient } from '
|
|
3
|
-
import { getNotionToken } from '
|
|
2
|
+
import { createNotionClient } from '../../../../dist/lib/notion/api.ts.js';
|
|
3
|
+
import { getNotionToken } from '../../../../dist/lib/db/notion.ts.js';
|
|
4
4
|
function requireToken() {
|
|
5
5
|
const token = getNotionToken();
|
|
6
6
|
if (!token) throw new Error("Notion integration token not configured. Set it in Settings > Context Sources.");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createObsidianClient, createSyncServerClient, getSyncToken } from '
|
|
2
|
+
import { createObsidianClient, createSyncServerClient, getSyncToken } from '../../../../dist/lib/obsidian/api.ts.js';
|
|
3
3
|
import {
|
|
4
4
|
getObsidianConfigForApiKey
|
|
5
|
-
} from '
|
|
5
|
+
} from '../../../../dist/lib/db/obsidian.ts.js';
|
|
6
6
|
function extractApiKeyId(extra) {
|
|
7
7
|
const id = extra?.authInfo?.clientId;
|
|
8
8
|
return typeof id === "string" && id.length > 0 && id !== "anonymous" && id !== "env-key" ? id : void 0;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getComboModelProvider,
|
|
7
7
|
getComboModelString,
|
|
8
8
|
getComboStepTarget
|
|
9
|
-
} from '
|
|
9
|
+
} from '../../../../dist/lib/combos/steps.ts.js';
|
|
10
10
|
import { rankBySpeed, DEFAULT_SPEED_WEIGHTS } from "../../services/autoCombo/speedRanking.ts";
|
|
11
11
|
const OMNIROUTE_BASE_URL = resolveOmniRouteBaseUrl();
|
|
12
12
|
const OMNIROUTE_API_KEY = process.env.OMNIROUTE_API_KEY || "";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { resolve, normalize, isAbsolute } from "path";
|
|
3
|
-
import { listPlugins, getPluginByName, updatePluginConfig } from '
|
|
4
|
-
import { pluginManager } from '
|
|
5
|
-
import { validatePluginConfig } from '
|
|
3
|
+
import { listPlugins, getPluginByName, updatePluginConfig } from '../../../../dist/lib/db/plugins.js';
|
|
4
|
+
import { pluginManager } from '../../../../dist/lib/plugins/manager.js';
|
|
5
|
+
import { validatePluginConfig } from '../../../../dist/lib/plugins/manifest.js';
|
|
6
6
|
function validatePluginPath(path) {
|
|
7
7
|
if (path.includes("\0")) {
|
|
8
8
|
throw new Error("Invalid path: contains null bytes");
|
|
@@ -151,7 +151,7 @@ const pluginTools = [
|
|
|
151
151
|
limit: z.number().min(1).max(100).default(20).describe("Max results to return")
|
|
152
152
|
}),
|
|
153
153
|
handler: async (args) => {
|
|
154
|
-
const { getPluginAnalytics, getPluginAnalyticsSummary } = await import('
|
|
154
|
+
const { getPluginAnalytics, getPluginAnalyticsSummary } = await import('../../../../dist/lib/db/plugins.js');
|
|
155
155
|
const limit = args.limit || 20;
|
|
156
156
|
if (args.name) {
|
|
157
157
|
const rows = getPluginAnalytics(args.name).slice(0, limit);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { skillRegistry } from '
|
|
3
|
-
import { skillExecutor } from '
|
|
2
|
+
import { skillRegistry } from '../../../../dist/lib/skills/registry.js';
|
|
3
|
+
import { skillExecutor } from '../../../../dist/lib/skills/executor.js';
|
|
4
4
|
const SkillListSchema = z.object({
|
|
5
5
|
apiKeyId: z.string().optional(),
|
|
6
6
|
name: z.string().optional(),
|
|
@@ -6,7 +6,7 @@ import { buildTtsProviderModels } from "../config/ttsModels.js";
|
|
|
6
6
|
|
|
7
7
|
// oauth block is canonical for these fields; inject into transport so executors reading
|
|
8
8
|
// this.config.{clientId,clientSecret,tokenUrl} keep working without duplicating in transport
|
|
9
|
-
const OAUTH_INJECT_FIELDS = ["clientId", "clientSecret", "tokenUrl"];
|
|
9
|
+
const OAUTH_INJECT_FIELDS = ["clientId", "clientSecret", "tokenUrl", "refreshUrl"];
|
|
10
10
|
|
|
11
11
|
// transport: re-apply shared default (format:"openai") + inject oauth-canonical fields
|
|
12
12
|
function buildTransport(transport, oauth) {
|
|
@@ -14,8 +14,16 @@ export default {
|
|
|
14
14
|
apiKeyUrl: "https://portal.nousresearch.com",
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
category: "
|
|
18
|
-
authModes: ["
|
|
17
|
+
category: "oauth",
|
|
18
|
+
authModes: ["oauth"],
|
|
19
|
+
oauth: {
|
|
20
|
+
clientId: "hermes-cli",
|
|
21
|
+
deviceCodeUrl: "https://portal.nousresearch.com/api/oauth/device/code",
|
|
22
|
+
tokenUrl: "https://portal.nousresearch.com/api/oauth/token",
|
|
23
|
+
refreshUrl: "https://portal.nousresearch.com/api/oauth/token",
|
|
24
|
+
scope: "inference:invoke",
|
|
25
|
+
refreshLeadMs: 5 * 60 * 1000,
|
|
26
|
+
},
|
|
19
27
|
transport: {
|
|
20
28
|
baseUrl: "https://inference-api.nousresearch.com/v1/chat/completions",
|
|
21
29
|
format: "openai",
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
evaluateQuotaCutoff,
|
|
3
3
|
getQuotaFetcher
|
|
4
4
|
} from "../quotaPreflight.ts";
|
|
5
|
-
import { getProviderConnectionById } from '
|
|
5
|
+
import { getProviderConnectionById } from '../../../../dist/lib/db/providers.js';
|
|
6
6
|
import {
|
|
7
7
|
resolveResilienceSettings
|
|
8
|
-
} from '
|
|
8
|
+
} from '../../../../dist/lib/resilience/settings.js';
|
|
9
9
|
import { fetchResetAwareQuotaWithCache } from "./quotaStrategies.ts";
|
|
10
10
|
function asThresholdMap(value) {
|
|
11
11
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBucketSaturated } from '
|
|
1
|
+
import { isBucketSaturated } from '../../../../dist/lib/quota/accountBuckets.ts.js';
|
|
2
2
|
import { incrementInflight, decrementInflight, getInflight } from "./quotaShareInflight.ts";
|
|
3
3
|
const MAX_DRR_COMBOS = 200;
|
|
4
4
|
const _drrState = /* @__PURE__ */ new Map();
|
|
@@ -100,7 +100,7 @@ async function resolveAutoStrategyOrder(deps) {
|
|
|
100
100
|
}
|
|
101
101
|
let lastKnownGoodProvider;
|
|
102
102
|
try {
|
|
103
|
-
const { getLKGP } = await import('
|
|
103
|
+
const { getLKGP } = await import('../../../../dist/lib/localDb.js');
|
|
104
104
|
const lkgp = await getLKGP(combo.name, combo.id || combo.name);
|
|
105
105
|
if (lkgp) lastKnownGoodProvider = lkgp.provider;
|
|
106
106
|
} catch (err) {
|
|
@@ -10,7 +10,7 @@ function __setStickinessHeadroomFetcherForTests(fetcher) {
|
|
|
10
10
|
async function resolveSaturation(connectionId, provider) {
|
|
11
11
|
if (_fetcherOverride) return _fetcherOverride(connectionId);
|
|
12
12
|
try {
|
|
13
|
-
const mod = await import('
|
|
13
|
+
const mod = await import('../../../../dist/lib/quota/saturationSignals.js');
|
|
14
14
|
const getSaturation = mod.getSaturation;
|
|
15
15
|
const [util5h, util7d] = await Promise.all([
|
|
16
16
|
getSaturation(connectionId, provider, { unit: "percent", window: "5h" }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCircuitBreaker } from "../../../shared/utils/circuitBreaker";
|
|
2
2
|
import { secureRandomFloat, secureRandomInt } from "../../../shared/utils/secureRandom";
|
|
3
|
-
import { getComboStepTarget, getComboStepWeight } from '
|
|
3
|
+
import { getComboStepTarget, getComboStepWeight } from '../../../../dist/lib/combos/steps.ts.js';
|
|
4
4
|
import { getComboMetrics } from "../comboMetrics.ts";
|
|
5
5
|
import { parseModel } from "../model.ts";
|
|
6
6
|
function normalizeModelEntry(entry) {
|
|
@@ -32,7 +32,7 @@ function orderTargetsForWeightedFallback(targets, selectedExecutionKey, preserve
|
|
|
32
32
|
}
|
|
33
33
|
async function sortModelsByCost(models) {
|
|
34
34
|
try {
|
|
35
|
-
const { getPricingForModel } = await import('
|
|
35
|
+
const { getPricingForModel } = await import('../../../../dist/lib/localDb.js');
|
|
36
36
|
const withCost = await Promise.all(
|
|
37
37
|
models.map(async (modelStr) => {
|
|
38
38
|
const parsed = parseModel(modelStr);
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isKnownNonClaudeStreamPayload
|
|
4
4
|
} from "../../utils/streamHelpers.ts";
|
|
5
5
|
import { evaluateResponseValidation } from "./responseValidation.ts";
|
|
6
|
-
import { getReasoningTokens } from '
|
|
6
|
+
import { getReasoningTokens } from '../../../../dist/lib/usage/tokenAccounting.ts.js';
|
|
7
7
|
function toRetryAfterDisplayValue(value) {
|
|
8
8
|
if (typeof value !== "number") return value;
|
|
9
9
|
if (value > 0 && value < 1e9) {
|
|
@@ -2,7 +2,7 @@ import { PROVIDERS, PROVIDER_OAUTH } from "../../config/providers.js";
|
|
|
2
2
|
import { OAUTH_ENDPOINTS, GITHUB_COPILOT } from "../../config/appConstants.js";
|
|
3
3
|
import { proxyAwareFetch } from "../../utils/proxyFetch.js";
|
|
4
4
|
import { dedupRefresh } from "./dedup.js";
|
|
5
|
-
import { buildExternalIdpRefreshParams } from '
|
|
5
|
+
import { buildExternalIdpRefreshParams } from '../../../../dist/lib/oauth/kiroExternalIdp.js';
|
|
6
6
|
|
|
7
7
|
let _xaiServiceSingleton = null;
|
|
8
8
|
export async function refreshXaiToken(refreshToken, log) {
|
|
@@ -10,7 +10,7 @@ export async function refreshXaiToken(refreshToken, log) {
|
|
|
10
10
|
return dedupRefresh("xai", refreshToken, async () => {
|
|
11
11
|
try {
|
|
12
12
|
if (!_xaiServiceSingleton) {
|
|
13
|
-
const mod = await import('
|
|
13
|
+
const mod = await import('../../../../dist/lib/oauth/services/xai.js');
|
|
14
14
|
_xaiServiceSingleton = new mod.XaiService();
|
|
15
15
|
}
|
|
16
16
|
const tokens = await _xaiServiceSingleton.refreshAccessToken(refreshToken);
|
|
@@ -296,7 +296,7 @@ async function resolveKiroProfileArnPatch(providerSpecificData, accessToken, ref
|
|
|
296
296
|
if (providerSpecificData?.profileArn) return {};
|
|
297
297
|
let profileArn = refreshedArn?.trim?.() || null;
|
|
298
298
|
if (!profileArn) {
|
|
299
|
-
const { fetchKiroProfileArn } = await import('
|
|
299
|
+
const { fetchKiroProfileArn } = await import('../../../../dist/lib/oauth/providers.js');
|
|
300
300
|
profileArn = await fetchKiroProfileArn(accessToken);
|
|
301
301
|
}
|
|
302
302
|
return profileArn ? { providerSpecificData: { profileArn } } : {};
|
|
@@ -16,7 +16,7 @@ export async function GET(req, res) {
|
|
|
16
16
|
}
|
|
17
17
|
export async function POST(req, res) {
|
|
18
18
|
try {
|
|
19
|
-
const body =
|
|
19
|
+
const body = req.body || {};
|
|
20
20
|
const extras = Array.isArray(body.extras) ? body.extras : [];
|
|
21
21
|
if (extras.length === 0) {
|
|
22
22
|
return res.status(400).json({ error: "No extras requested" });
|
|
@@ -37,7 +37,7 @@ export async function POST(req, res) {
|
|
|
37
37
|
}
|
|
38
38
|
export async function DELETE(req, res) {
|
|
39
39
|
try {
|
|
40
|
-
const body =
|
|
40
|
+
const body = req.body || {};
|
|
41
41
|
const extras = Array.isArray(body.extras) ? body.extras : [];
|
|
42
42
|
if (extras.length === 0) {
|
|
43
43
|
return res.status(400).json({ error: "No extras requested" });
|
|
@@ -147,7 +147,7 @@ export const APIKEY_PROVIDERS = {
|
|
|
147
147
|
// nscale: { id: "nscale", alias: "nscale", name: "nScale", icon: "token", color: "#0891B2", textIcon: "NS", website: "https://nscale.com", notice: { text: "$5 free credits on signup.", apiKeyUrl: "https://console.nscale.com/api-keys" }, serviceKinds: ["llm"] },
|
|
148
148
|
// baseten: { id: "baseten", alias: "baseten", name: "Baseten", icon: "deployed_code", color: "#111827", textIcon: "BT", website: "https://baseten.co", notice: { text: "$30 free trial credits for GPU inference.", apiKeyUrl: "https://app.baseten.co/settings/api_keys" }, serviceKinds: ["llm"] },
|
|
149
149
|
// publicai: { id: "publicai", alias: "publicai", name: "PublicAI", icon: "public", color: "#059669", textIcon: "PA", website: "https://publicai.co", notice: { text: "Free community inference tier.", apiKeyUrl: "https://publicai.co" }, serviceKinds: ["llm"] },
|
|
150
|
-
"nous-research": { id: "nous-research", alias: "nous", name: "Nous Research", icon: "hub", color: "#2563EB", textIcon: "NO", website: "https://portal.nousresearch.com", notice: { text: "Free tier: 50 RPM, 500K TPM — no credit card.",
|
|
150
|
+
"nous-research": { id: "nous-research", alias: "nous", name: "Nous Research", icon: "hub", color: "#2563EB", textIcon: "NO", website: "https://portal.nousresearch.com", notice: { text: "Free tier: 50 RPM, 500K TPM — no credit card. Sign in with your Nous Portal account (device login, no API key needed).", signupUrl: "https://portal.nousresearch.com" }, serviceKinds: ["llm"], authModes: ["oauth"], hasOAuth: true },
|
|
151
151
|
// glhf: { id: "glhf", alias: "glhf", name: "GLHF Chat", icon: "hub", color: "#10B981", textIcon: "GH", website: "https://glhf.chat", notice: { text: "Free tier for open-source model inference.", apiKeyUrl: "https://glhf.chat/users/settings/api" }, passthroughModels: true, serviceKinds: ["llm"] },
|
|
152
152
|
"ollama-local": { id: "ollama-local", alias: "ollama-local", name: "Ollama Local", icon: "cloud", color: "#ffffffff", textIcon: "OL", website: "https://ollama.com" },
|
|
153
153
|
"vertex-partner": { id: "vertex-partner", alias: "vxp", name: "Vertex Partner", icon: "cloud", color: "#34A853", textIcon: "VP", website: "https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models", notice: { apiKeyUrl: "https://console.cloud.google.com/iam-admin/serviceaccounts" } },
|
|
@@ -7,7 +7,7 @@ import { createErrorResult } from "../../utils/error.js";
|
|
|
7
7
|
import { HTTP_STATUS } from "../../config/runtimeConfig.js";
|
|
8
8
|
import { parseSSEToOpenAIResponse } from "./sseToJsonHandler.js";
|
|
9
9
|
import { buildRequestDetail, extractRequestConfig, extractUsageFromResponse, saveUsageStats, formatDoneLine } from "./requestDetail.js";
|
|
10
|
-
import { appendRequestLog, saveRequestDetail } from '
|
|
10
|
+
import { appendRequestLog, saveRequestDetail } from '../../../dist/lib/usageDb.js';
|
|
11
11
|
import { decloakToolNames } from "../../utils/claudeCloaking.js";
|
|
12
12
|
|
|
13
13
|
function parseToolArguments(value) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { saveRequestUsage, appendRequestLog, saveRequestDetail } from '
|
|
1
|
+
import { saveRequestUsage, appendRequestLog, saveRequestDetail } from '../../../dist/lib/usageDb.js';
|
|
2
2
|
import { COLORS } from "../../utils/stream.js";
|
|
3
3
|
import { canonicalizeUsage } from "../../utils/usageTracking.js";
|
|
4
4
|
|