@fudrouter/fsrouter 0.6.57 → 0.6.59
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/copyJs.js +9 -0
- package/bin/rewriteSseImports.js +15 -5
- package/dist/open-sse/executors/blackbox-web.js +1 -1
- package/dist/open-sse/executors/claude-web.js +1 -1
- package/dist/open-sse/executors/gitlab.js +1 -1
- package/dist/open-sse/executors/glm.js +2 -2
- package/dist/open-sse/executors/huggingchat.js +1 -1
- package/dist/open-sse/executors/kimi-web.js +1 -1
- package/dist/open-sse/executors/ninerouter.js +2 -2
- package/dist/open-sse/executors/qoder.js +3 -3
- package/dist/open-sse/executors/qwen-web.js +1 -1
- package/dist/open-sse/executors/yuanbao-web.js +1 -1
- 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/chatCore.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/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/thinkingBudget.js +1 -1
- package/dist/open-sse/services/tokenRefresh/providers.js +3 -3
- package/dist/open-sse/translator/index.js +30 -32
- package/dist/open-sse/utils/providerRequestLogging.js +1 -1
- package/dist/open-sse/utils/responsesStatePolicy.js +1 -1
- package/dist/open-sse/utils/stream.js +1 -1
- package/dist/open-sse/utils/streamFailureFinalization.js +1 -1
- package/dist/open-sse/utils/usageTracking.js +1 -1
- package/open-sse/executors/glm.js +2 -2
- 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/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/open-sse/translator/index.js +30 -32
- package/package.json +1 -1
|
@@ -10,11 +10,36 @@ import { AntigravityExecutor } from "../executors/antigravity.js";
|
|
|
10
10
|
const requestRegistry = new Map();
|
|
11
11
|
const responseRegistry = new Map();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Eagerly pre-load all translators at module load time
|
|
14
|
+
// (prevents race condition with mixed sync require() + dynamic import())
|
|
15
|
+
const reqMods = [
|
|
16
|
+
"./request/claude-to-openai.js",
|
|
17
|
+
"./request/openai-to-claude.js",
|
|
18
|
+
"./request/gemini-to-openai.js",
|
|
19
|
+
"./request/openai-to-gemini.js",
|
|
20
|
+
"./request/openai-to-vertex.js",
|
|
21
|
+
"./request/antigravity-to-openai.js",
|
|
22
|
+
"./request/openai-responses.js",
|
|
23
|
+
"./request/openai-to-kiro.js",
|
|
24
|
+
"./request/openai-to-cursor.js",
|
|
25
|
+
"./request/openai-to-ollama.js",
|
|
26
|
+
"./request/openai-to-commandcode.js",
|
|
27
|
+
];
|
|
28
|
+
const resMods = [
|
|
29
|
+
"./response/claude-to-openai.js",
|
|
30
|
+
"./response/openai-to-claude.js",
|
|
31
|
+
"./response/gemini-to-openai.js",
|
|
32
|
+
"./response/openai-to-antigravity.js",
|
|
33
|
+
"./response/openai-responses.js",
|
|
34
|
+
"./response/kiro-to-openai.js",
|
|
35
|
+
"./response/cursor-to-openai.js",
|
|
36
|
+
"./response/ollama-to-openai.js",
|
|
37
|
+
"./response/commandcode-to-openai.js",
|
|
38
|
+
];
|
|
39
|
+
await Promise.all([...reqMods, ...resMods].map(m => import(m)));
|
|
15
40
|
|
|
16
41
|
// Track initialization state
|
|
17
|
-
let initialized =
|
|
42
|
+
let initialized = true;
|
|
18
43
|
|
|
19
44
|
// Register translator
|
|
20
45
|
export function register(from, to, requestFn, responseFn) {
|
|
@@ -27,35 +52,8 @@ export function register(from, to, requestFn, responseFn) {
|
|
|
27
52
|
}
|
|
28
53
|
}
|
|
29
54
|
|
|
30
|
-
// Lazy load translators (
|
|
31
|
-
function ensureInitialized() {
|
|
32
|
-
if (initialized) return;
|
|
33
|
-
initialized = true;
|
|
34
|
-
|
|
35
|
-
// Request translators - sync require pattern for bundler
|
|
36
|
-
require("./request/claude-to-openai.js");
|
|
37
|
-
require("./request/openai-to-claude.js");
|
|
38
|
-
require("./request/gemini-to-openai.js");
|
|
39
|
-
require("./request/openai-to-gemini.js");
|
|
40
|
-
require("./request/openai-to-vertex.js");
|
|
41
|
-
require("./request/antigravity-to-openai.js");
|
|
42
|
-
require("./request/openai-responses.js");
|
|
43
|
-
require("./request/openai-to-kiro.js");
|
|
44
|
-
require("./request/openai-to-cursor.js");
|
|
45
|
-
require("./request/openai-to-ollama.js");
|
|
46
|
-
require("./request/openai-to-commandcode.js");
|
|
47
|
-
|
|
48
|
-
// Response translators
|
|
49
|
-
require("./response/claude-to-openai.js");
|
|
50
|
-
require("./response/openai-to-claude.js");
|
|
51
|
-
require("./response/gemini-to-openai.js");
|
|
52
|
-
require("./response/openai-to-antigravity.js");
|
|
53
|
-
require("./response/openai-responses.js");
|
|
54
|
-
require("./response/kiro-to-openai.js");
|
|
55
|
-
require("./response/cursor-to-openai.js");
|
|
56
|
-
require("./response/ollama-to-openai.js");
|
|
57
|
-
require("./response/commandcode-to-openai.js");
|
|
58
|
-
}
|
|
55
|
+
// Lazy load translators (no-op, loaded eagerly at module level)
|
|
56
|
+
async function ensureInitialized() {}
|
|
59
57
|
|
|
60
58
|
// Strip specific content types from messages (explicit opt-in via strip[] in PROVIDER_MODELS)
|
|
61
59
|
function stripContentTypes(body, stripList = []) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
|
|
3
|
-
import { updatePendingScope } from '
|
|
3
|
+
import { updatePendingScope } from '../../../dist/lib/usage/pendingRequestScope.js';
|
|
4
4
|
|
|
5
5
|
const CAPTURE_STATE_KEY = Symbol.for("omniroute.providerRequestCapture.state");
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isOpenAIResponsesStoreEnabled } from '
|
|
1
|
+
import { isOpenAIResponsesStoreEnabled } from '../../../dist/lib/providers/requestDefaults.js';
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_RESPONSES_PREVIOUS_RESPONSE_ID_MODE,
|
|
4
4
|
RESPONSES_PREVIOUS_RESPONSE_ID_MODES
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { translateResponse, initState } from "../translator/index.js";
|
|
2
2
|
import { FORMATS } from "../translator/formats.js";
|
|
3
|
-
import { trackPendingRequest, appendRequestLog } from '
|
|
3
|
+
import { trackPendingRequest, appendRequestLog } from '../../../dist/lib/usageDb.js';
|
|
4
4
|
import { extractUsage, hasValidUsage, estimateUsage, logUsage, addBufferToUsage, filterUsageForFormat, COLORS } from "./usageTracking.js";
|
|
5
5
|
import { parseSSELine, hasValuableContent, fixInvalidId, formatSSE } from "./streamHelpers.js";
|
|
6
6
|
import { getOpenAIResponsesEventName, isOpenAIResponsesTerminalEvent, formatIncompleteOpenAIResponsesStreamFailure } from "./responsesStreamHelpers.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
finalizeMostRecentPendingRequest,
|
|
3
3
|
finalizePendingRequestById,
|
|
4
|
-
} from '
|
|
4
|
+
} from '../../../dist/lib/usage/usageHistory.js';
|
|
5
5
|
|
|
6
6
|
import { HTTP_STATUS } from "../config/constants.js";
|
|
7
7
|
import { buildErrorBody } from "./error.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Token Usage Tracking - Extract, normalize, estimate and log token usage
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { saveRequestUsage, appendRequestLog } from '
|
|
5
|
+
import { saveRequestUsage, appendRequestLog } from '../../../dist/lib/usageDb.js';
|
|
6
6
|
import { FORMATS } from "../translator/formats.js";
|
|
7
7
|
|
|
8
8
|
// ANSI color codes
|
|
@@ -176,7 +176,7 @@ class GlmExecutor extends DefaultExecutor {
|
|
|
176
176
|
const cleanedBody = super.transformRequest(model, body, stream, credentials);
|
|
177
177
|
return applyGlmRequestDefaults(cleanedBody, this.config.requestDefaults);
|
|
178
178
|
}
|
|
179
|
-
transformForTransport(model, body, stream, credentials, transport) {
|
|
179
|
+
async transformForTransport(model, body, stream, credentials, transport) {
|
|
180
180
|
const effortTier = parseGlm52Effort(model);
|
|
181
181
|
const effectiveModel = effortTier ? effortTier.baseModel : model;
|
|
182
182
|
const transformed = this.transformRequest(effectiveModel, body, stream, credentials);
|
|
@@ -197,7 +197,7 @@ class GlmExecutor extends DefaultExecutor {
|
|
|
197
197
|
}
|
|
198
198
|
return transformed;
|
|
199
199
|
}
|
|
200
|
-
const translated = translateRequest(
|
|
200
|
+
const translated = await translateRequest(
|
|
201
201
|
FORMATS.OPENAI,
|
|
202
202
|
FORMATS.CLAUDE,
|
|
203
203
|
effectiveModel,
|
|
@@ -6,7 +6,7 @@ import { createErrorResult } from "../../utils/error.js";
|
|
|
6
6
|
import { HTTP_STATUS } from "../../config/runtimeConfig.js";
|
|
7
7
|
import { parseSSEToOpenAIResponse } from "./sseToJsonHandler.js";
|
|
8
8
|
import { buildRequestDetail, extractRequestConfig, extractUsageFromResponse, saveUsageStats } from "./requestDetail.js";
|
|
9
|
-
import { appendRequestLog, saveRequestDetail } from '
|
|
9
|
+
import { appendRequestLog, saveRequestDetail } from '../../dist/lib/usageDb.js';
|
|
10
10
|
import { decloakToolNames } from "../../utils/claudeCloaking.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -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
|
|
|
4
4
|
const OPTIONAL_PARAMS = [
|
|
@@ -3,7 +3,7 @@ import { createErrorResult } from "../../utils/error.js";
|
|
|
3
3
|
import { HTTP_STATUS } from "../../config/runtimeConfig.js";
|
|
4
4
|
import { FORMATS } from "../../translator/formats.js";
|
|
5
5
|
import { buildRequestDetail, extractRequestConfig, saveUsageStats } from "./requestDetail.js";
|
|
6
|
-
import { saveRequestDetail, appendRequestLog } from '
|
|
6
|
+
import { saveRequestDetail, appendRequestLog } from '../../dist/lib/usageDb.js';
|
|
7
7
|
|
|
8
8
|
function textFromResponsesMessageItem(item) {
|
|
9
9
|
if (!item?.content || !Array.isArray(item.content)) return "";
|
|
@@ -4,7 +4,7 @@ import { createSSETransformStreamWithLogger, createPassthroughStreamWithLogger }
|
|
|
4
4
|
import { pipeWithDisconnect } from "../../utils/streamHandler.js";
|
|
5
5
|
import { buildAbortedResponsesTerminalBytes } from "../../utils/responsesStreamHelpers.js";
|
|
6
6
|
import { buildRequestDetail, extractRequestConfig, saveUsageStats } from "./requestDetail.js";
|
|
7
|
-
import { saveRequestDetail } from '
|
|
7
|
+
import { saveRequestDetail } from '../../dist/lib/usageDb.js';
|
|
8
8
|
|
|
9
9
|
const SSE_HEADERS = {
|
|
10
10
|
"Content-Type": "text/event-stream",
|
|
@@ -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 "../../../src/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(),
|
|
@@ -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 "../../../src/shared/utils/circuitBreaker";
|
|
2
2
|
import { secureRandomFloat, secureRandomInt } from "../../../src/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 } } : {};
|
|
@@ -10,11 +10,36 @@ import { AntigravityExecutor } from "../executors/antigravity.js";
|
|
|
10
10
|
const requestRegistry = new Map();
|
|
11
11
|
const responseRegistry = new Map();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Eagerly pre-load all translators at module load time
|
|
14
|
+
// (prevents race condition with mixed sync require() + dynamic import())
|
|
15
|
+
const reqMods = [
|
|
16
|
+
"./request/claude-to-openai.js",
|
|
17
|
+
"./request/openai-to-claude.js",
|
|
18
|
+
"./request/gemini-to-openai.js",
|
|
19
|
+
"./request/openai-to-gemini.js",
|
|
20
|
+
"./request/openai-to-vertex.js",
|
|
21
|
+
"./request/antigravity-to-openai.js",
|
|
22
|
+
"./request/openai-responses.js",
|
|
23
|
+
"./request/openai-to-kiro.js",
|
|
24
|
+
"./request/openai-to-cursor.js",
|
|
25
|
+
"./request/openai-to-ollama.js",
|
|
26
|
+
"./request/openai-to-commandcode.js",
|
|
27
|
+
];
|
|
28
|
+
const resMods = [
|
|
29
|
+
"./response/claude-to-openai.js",
|
|
30
|
+
"./response/openai-to-claude.js",
|
|
31
|
+
"./response/gemini-to-openai.js",
|
|
32
|
+
"./response/openai-to-antigravity.js",
|
|
33
|
+
"./response/openai-responses.js",
|
|
34
|
+
"./response/kiro-to-openai.js",
|
|
35
|
+
"./response/cursor-to-openai.js",
|
|
36
|
+
"./response/ollama-to-openai.js",
|
|
37
|
+
"./response/commandcode-to-openai.js",
|
|
38
|
+
];
|
|
39
|
+
await Promise.all([...reqMods, ...resMods].map(m => import(m)));
|
|
15
40
|
|
|
16
41
|
// Track initialization state
|
|
17
|
-
let initialized =
|
|
42
|
+
let initialized = true;
|
|
18
43
|
|
|
19
44
|
// Register translator
|
|
20
45
|
export function register(from, to, requestFn, responseFn) {
|
|
@@ -27,35 +52,8 @@ export function register(from, to, requestFn, responseFn) {
|
|
|
27
52
|
}
|
|
28
53
|
}
|
|
29
54
|
|
|
30
|
-
// Lazy load translators (
|
|
31
|
-
function ensureInitialized() {
|
|
32
|
-
if (initialized) return;
|
|
33
|
-
initialized = true;
|
|
34
|
-
|
|
35
|
-
// Request translators - sync require pattern for bundler
|
|
36
|
-
require("./request/claude-to-openai.js");
|
|
37
|
-
require("./request/openai-to-claude.js");
|
|
38
|
-
require("./request/gemini-to-openai.js");
|
|
39
|
-
require("./request/openai-to-gemini.js");
|
|
40
|
-
require("./request/openai-to-vertex.js");
|
|
41
|
-
require("./request/antigravity-to-openai.js");
|
|
42
|
-
require("./request/openai-responses.js");
|
|
43
|
-
require("./request/openai-to-kiro.js");
|
|
44
|
-
require("./request/openai-to-cursor.js");
|
|
45
|
-
require("./request/openai-to-ollama.js");
|
|
46
|
-
require("./request/openai-to-commandcode.js");
|
|
47
|
-
|
|
48
|
-
// Response translators
|
|
49
|
-
require("./response/claude-to-openai.js");
|
|
50
|
-
require("./response/openai-to-claude.js");
|
|
51
|
-
require("./response/gemini-to-openai.js");
|
|
52
|
-
require("./response/openai-to-antigravity.js");
|
|
53
|
-
require("./response/openai-responses.js");
|
|
54
|
-
require("./response/kiro-to-openai.js");
|
|
55
|
-
require("./response/cursor-to-openai.js");
|
|
56
|
-
require("./response/ollama-to-openai.js");
|
|
57
|
-
require("./response/commandcode-to-openai.js");
|
|
58
|
-
}
|
|
55
|
+
// Lazy load translators (no-op, loaded eagerly at module level)
|
|
56
|
+
async function ensureInitialized() {}
|
|
59
57
|
|
|
60
58
|
// Strip specific content types from messages (explicit opt-in via strip[] in PROVIDER_MODELS)
|
|
61
59
|
function stripContentTypes(body, stripList = []) {
|