@fudrouter/fsrouter 0.6.69 → 0.6.71
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/dist/lib/oauth/providers.js +3 -3
- package/dist/open-sse/config/cliFingerprints.js +1 -1
- package/dist/open-sse/executors/commandCode.js +1 -1
- package/dist/open-sse/executors/default.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/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/catalog.js +1 -1
- package/dist/open-sse/mcp-server/server.js +2 -2
- 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/comboConfig.js +1 -1
- package/dist/open-sse/services/emergencyFallback.js +1 -1
- package/dist/open-sse/services/proxyAutoSelector.js +1 -1
- package/dist/open-sse/services/tokenRefresh/providers.js +3 -3
- package/dist/open-sse/utils/cursorImages.js +1 -1
- package/dist/open-sse/utils/keepaliveThreshold.js +4 -4
- package/dist/open-sse/utils/noThinkingAlias.js +1 -1
- package/dist/open-sse/utils/responsesStatePolicy.js +1 -1
- package/open-sse/executors/cliproxyapi.js +2 -2
- package/open-sse/executors/default.js +1 -1
- package/open-sse/handlers/imageProviders/leonardo.js +1 -1
- package/open-sse/mcp-server/catalog.js +1 -1
- package/open-sse/mcp-server/server.js +2 -2
- package/open-sse/mcp-server/tools/advancedTools.js +2 -2
- 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/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/package.json +10 -0
- package/open-sse/providers/shared.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/comboConfig.js +1 -1
- package/open-sse/services/rateLimitManager.js +4 -4
- package/open-sse/services/thinkingBudget.js +4 -2
- package/open-sse/services/tokenRefresh/providers.js +3 -3
- package/open-sse/translator/request/claude-to-kiro.js +1 -1
- package/open-sse/translator/request/openai-to-kiro.js +2 -2
- package/package.json +1 -1
|
@@ -29,15 +29,15 @@ import {
|
|
|
29
29
|
KIMCHI_CONFIG,
|
|
30
30
|
GROK_CLI_CONFIG,
|
|
31
31
|
getOAuthClientMetadata,
|
|
32
|
-
} from "./constants/oauth";
|
|
33
|
-
import { XAI_CONFIG, XAI_PKCE_VERIFIER_BYTES } from "./constants/xai";
|
|
32
|
+
} from "./constants/oauth.js";
|
|
33
|
+
import { XAI_CONFIG, XAI_PKCE_VERIFIER_BYTES } from "./constants/xai.js";
|
|
34
34
|
import {
|
|
35
35
|
validateXaiOAuthEndpoint,
|
|
36
36
|
decodeXaiIdTokenEmail,
|
|
37
37
|
extractEmailFromAccessToken,
|
|
38
38
|
extractCodexAccountInfo,
|
|
39
39
|
fetchKiroProfileArn,
|
|
40
|
-
} from "./providerHelpers";
|
|
40
|
+
} from "./providerHelpers.js";
|
|
41
41
|
|
|
42
42
|
export { extractCodexAccountInfo, fetchKiroProfileArn };
|
|
43
43
|
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
GITHUB_COPILOT_CHAT_USER_AGENT,
|
|
5
5
|
getQwenOauthHeaders
|
|
6
6
|
} from "./providerHeaderProfiles.ts";
|
|
7
|
-
import { normalizeCliCompatProviderId } from '
|
|
7
|
+
import { normalizeCliCompatProviderId } from '../../../dist/shared/utils/cliCompat.js';
|
|
8
8
|
const CLI_FINGERPRINTS = {
|
|
9
9
|
codex: {
|
|
10
10
|
headerOrder: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { isVisionModelId } from '
|
|
2
|
+
import { isVisionModelId } from '../../../dist/shared/constants/visionModels.js';
|
|
3
3
|
import { REGISTRY } from "../config/providerRegistry.ts";
|
|
4
4
|
import { BaseExecutor, mergeUpstreamExtraHeaders } from "./base.ts";
|
|
5
5
|
const COMMAND_CODE_VERSION = process.env.COMMAND_CODE_VERSION?.trim() || "0.33.2";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseExecutor } from "./base.js";
|
|
2
2
|
import { PROVIDERS } from "../config/providers.js";
|
|
3
3
|
import { OAUTH_ENDPOINTS, buildKimiHeaders, getKimchiVersionSync } from "../config/appConstants.js";
|
|
4
|
-
import { buildClineHeaders } from '
|
|
4
|
+
import { buildClineHeaders } from '../../../dist/shared/utils/clineAuth.js';
|
|
5
5
|
import { getCachedClaudeHeaders } from "../utils/claudeHeaderCache.js";
|
|
6
6
|
import { proxyAwareFetch } from "../utils/proxyFetch.js";
|
|
7
7
|
import { injectReasoningContent } from "../utils/reasoningContentInjector.js";
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCodexRequestDefaults } from "../../lib/providers/requestDefaults.ts";
|
|
2
2
|
import { getProviderConnections } from "../../lib/db/providers.ts";
|
|
3
|
-
import { AI_PROVIDERS, NOAUTH_PROVIDERS } from '
|
|
3
|
+
import { AI_PROVIDERS, NOAUTH_PROVIDERS } from '../../../dist/shared/constants/providers.ts.js';
|
|
4
4
|
function toRecord(value) {
|
|
5
5
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
6
6
|
}
|
|
@@ -83,8 +83,8 @@ import {
|
|
|
83
83
|
clampMcpAccessibilityConfig
|
|
84
84
|
} from "../services/compression/engines/mcpAccessibility/constants.ts";
|
|
85
85
|
import { getDbInstance } from "../../lib/db/core.ts";
|
|
86
|
-
import { normalizeQuotaResponse } from '
|
|
87
|
-
import { resolveOmniRouteBaseUrl } from '
|
|
86
|
+
import { normalizeQuotaResponse } from '../../../dist/shared/contracts/quota.ts.js';
|
|
87
|
+
import { resolveOmniRouteBaseUrl } from '../../../dist/shared/utils/resolveOmniRouteBaseUrl.ts.js';
|
|
88
88
|
import { getMcpModelsCatalog } from "./catalog.ts";
|
|
89
89
|
import { getMcpModelsCatalog as getMcpModelsCatalog2 } from "./catalog.ts";
|
|
90
90
|
const OMNIROUTE_BASE_URL = resolveOmniRouteBaseUrl();
|
|
@@ -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(),
|
|
@@ -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) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_TIMER_TIMEOUT_MS } from '
|
|
1
|
+
import { MAX_TIMER_TIMEOUT_MS } from '../../../dist/shared/utils/runtimeTimeouts.ts.js';
|
|
2
2
|
const PRE_SCREEN_CONCURRENCY = 5;
|
|
3
3
|
const DEFAULT_COMBO_TARGET_TIMEOUT_MS = 12e4;
|
|
4
4
|
const DEFAULT_COMBO_QUEUE_DEPTH = 20;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isFeatureFlagEnabled } from '
|
|
1
|
+
import { isFeatureFlagEnabled } from '../../../dist/shared/utils/featureFlags.js';
|
|
2
2
|
const EMERGENCY_FALLBACK_FLAG_KEY = "OMNIROUTE_EMERGENCY_FALLBACK";
|
|
3
3
|
const EMERGENCY_FALLBACK_FLAG_CACHE_MS = 500;
|
|
4
4
|
let emergencyFallbackFlagCache = null;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
findWorkingProxy,
|
|
3
3
|
clearProxyFallbackCache
|
|
4
4
|
} from "@omniroute/open-sse/utils/proxyFallback.ts";
|
|
5
|
-
import { isFeatureFlagEnabled } from '
|
|
5
|
+
import { isFeatureFlagEnabled } from '../../../dist/shared/utils/featureFlags.js';
|
|
6
6
|
async function selectProxyForValidation(targetUrl) {
|
|
7
7
|
if (!isFeatureFlagEnabled("PROXY_AUTO_SELECT_ENABLED")) return null;
|
|
8
8
|
if (!targetUrl) return null;
|
|
@@ -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 } } : {};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
parseAndValidatePublicUrl,
|
|
6
6
|
isPrivateHost,
|
|
7
7
|
OutboundUrlGuardError
|
|
8
|
-
} from '
|
|
8
|
+
} from '../../../dist/shared/network/outboundUrlGuard.js';
|
|
9
9
|
const MAX_CURSOR_IMAGE_BYTES = 1024 * 1024;
|
|
10
10
|
const MAX_CURSOR_IMAGES = 12;
|
|
11
11
|
const IMAGE_FETCH_TIMEOUT_MS = (() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NOAUTH_PROVIDERS } from '
|
|
2
|
-
import { APIKEY_PROVIDERS } from '
|
|
3
|
-
import { WEB_COOKIE_PROVIDERS } from '
|
|
4
|
-
import { WEB_SESSION_CREDENTIAL_REQUIREMENTS } from '
|
|
1
|
+
import { NOAUTH_PROVIDERS } from '../../../dist/shared/constants/providers.js';
|
|
2
|
+
import { APIKEY_PROVIDERS } from '../../../dist/shared/constants/providers.js';
|
|
3
|
+
import { WEB_COOKIE_PROVIDERS } from '../../../dist/shared/constants/providers.js';
|
|
4
|
+
import { WEB_SESSION_CREDENTIAL_REQUIREMENTS } from '../../../dist/shared/providers/webSessionCredentials.js';
|
|
5
5
|
const DEFAULT_THRESHOLD_MS = 2e3;
|
|
6
6
|
const SLOW_THRESHOLD_MS = 15e3;
|
|
7
7
|
const SLOW_PROVIDER_IDS = /* @__PURE__ */ new Set();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getModelSpec } from '
|
|
1
|
+
import { getModelSpec } from '../../../dist/shared/constants/modelSpecs.js';
|
|
2
2
|
const NO_THINKING_PREFIX = "no-think/";
|
|
3
3
|
function isNoThinkingAlias(modelId) {
|
|
4
4
|
return typeof modelId === "string" && modelId.startsWith(NO_THINKING_PREFIX);
|
|
@@ -2,7 +2,7 @@ import { isOpenAIResponsesStoreEnabled } from '../../../dist/lib/providers/reque
|
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_RESPONSES_PREVIOUS_RESPONSE_ID_MODE,
|
|
4
4
|
RESPONSES_PREVIOUS_RESPONSE_ID_MODES
|
|
5
|
-
} from '
|
|
5
|
+
} from '../../../dist/shared/constants/responsesPreviousResponseId.js';
|
|
6
6
|
import { FORMATS } from "../translator/formats.ts";
|
|
7
7
|
const MODE_SET = new Set(RESPONSES_PREVIOUS_RESPONSE_ID_MODES);
|
|
8
8
|
function toRecord(value) {
|
|
@@ -79,7 +79,7 @@ function clearCliproxyapiUrlCache() {
|
|
|
79
79
|
}
|
|
80
80
|
(async () => {
|
|
81
81
|
try {
|
|
82
|
-
const { getSettings } = await import(
|
|
82
|
+
const { getSettings } = await import('../../dist/lib/db/settings.js');
|
|
83
83
|
const settings = await getSettings();
|
|
84
84
|
if (typeof settings.cliproxyapi_url === "string" && settings.cliproxyapi_url.trim()) {
|
|
85
85
|
_cachedSettingsUrl = { url: settings.cliproxyapi_url.trim(), ts: Date.now() };
|
|
@@ -92,7 +92,7 @@ async function resolveCliproxyapiBaseUrl() {
|
|
|
92
92
|
return _cachedSettingsUrl.url;
|
|
93
93
|
}
|
|
94
94
|
try {
|
|
95
|
-
const { getSettings } = await import(
|
|
95
|
+
const { getSettings } = await import('../../dist/lib/db/settings.js');
|
|
96
96
|
const settings = await getSettings();
|
|
97
97
|
if (typeof settings.cliproxyapi_url === "string" && settings.cliproxyapi_url.trim()) {
|
|
98
98
|
const url2 = settings.cliproxyapi_url.trim();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseExecutor } from "./base.js";
|
|
2
2
|
import { PROVIDERS } from "../config/providers.js";
|
|
3
3
|
import { OAUTH_ENDPOINTS, buildKimiHeaders, getKimchiVersionSync } from "../config/appConstants.js";
|
|
4
|
-
import { buildClineHeaders } from
|
|
4
|
+
import { buildClineHeaders } from '../../dist/shared/utils/clineAuth.js';
|
|
5
5
|
import { getCachedClaudeHeaders } from "../utils/claudeHeaderCache.js";
|
|
6
6
|
import { proxyAwareFetch } from "../utils/proxyFetch.js";
|
|
7
7
|
import { injectReasoningContent } from "../utils/reasoningContentInjector.js";
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCodexRequestDefaults } from "../../dist/lib/providers/requestDefaults.ts";
|
|
2
2
|
import { getProviderConnections } from "../../dist/lib/db/providers.ts";
|
|
3
|
-
import { AI_PROVIDERS, NOAUTH_PROVIDERS } from
|
|
3
|
+
import { AI_PROVIDERS, NOAUTH_PROVIDERS } from '../../dist/shared/constants/providers.ts.js';
|
|
4
4
|
function toRecord(value) {
|
|
5
5
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
6
6
|
}
|
|
@@ -83,8 +83,8 @@ import {
|
|
|
83
83
|
clampMcpAccessibilityConfig
|
|
84
84
|
} from "../services/compression/engines/mcpAccessibility/constants.ts";
|
|
85
85
|
import { getDbInstance } from "../../dist/lib/db/core.ts";
|
|
86
|
-
import { normalizeQuotaResponse } from
|
|
87
|
-
import { resolveOmniRouteBaseUrl } from
|
|
86
|
+
import { normalizeQuotaResponse } from '../../dist/shared/contracts/quota.ts.js';
|
|
87
|
+
import { resolveOmniRouteBaseUrl } from '../../dist/shared/utils/resolveOmniRouteBaseUrl.ts.js';
|
|
88
88
|
import { getMcpModelsCatalog } from "./catalog.ts";
|
|
89
89
|
import { getMcpModelsCatalog as getMcpModelsCatalog2 } from "./catalog.ts";
|
|
90
90
|
const OMNIROUTE_BASE_URL = resolveOmniRouteBaseUrl();
|
|
@@ -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 "../../../dist/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",
|
|
@@ -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
|
}
|
|
@@ -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);
|
|
@@ -61,13 +61,13 @@ export const ANTIGRAVITY_IDE_VERSION = "2.1.1";
|
|
|
61
61
|
export const ANTIGRAVITY_IDE_BASE_URL = "https://cloudcode-pa.googleapis.com";
|
|
62
62
|
export const ANTIGRAVITY_IDE_USER_AGENT = `antigravity/ide/${ANTIGRAVITY_IDE_VERSION} darwin/arm64`;
|
|
63
63
|
|
|
64
|
-
// Antigravity OAuth client credentials (public CLI client — duplicated in usage.js +
|
|
64
|
+
// Antigravity OAuth client credentials (public CLI client — duplicated in usage.js + src/lib/oauth)
|
|
65
65
|
export const ANTIGRAVITY_OAUTH_CLIENT = {
|
|
66
66
|
clientId: "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",
|
|
67
67
|
clientSecret: "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"
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
// Gemini (Google) OAuth client credentials (public CLI client — shared by gemini, gemini-cli,
|
|
70
|
+
// Gemini (Google) OAuth client credentials (public CLI client — shared by gemini, gemini-cli, src/lib/oauth)
|
|
71
71
|
export const GOOGLE_OAUTH_CLIENT = {
|
|
72
72
|
clientId: "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",
|
|
73
73
|
clientSecret: "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"
|
|
@@ -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 "../../../dist/shared/utils/circuitBreaker";
|
|
2
2
|
import { secureRandomFloat, secureRandomInt } from "../../../dist/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) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_TIMER_TIMEOUT_MS } from
|
|
1
|
+
import { MAX_TIMER_TIMEOUT_MS } from '../../dist/shared/utils/runtimeTimeouts.ts.js';
|
|
2
2
|
const PRE_SCREEN_CONCURRENCY = 5;
|
|
3
3
|
const DEFAULT_COMBO_TARGET_TIMEOUT_MS = 12e4;
|
|
4
4
|
const DEFAULT_COMBO_QUEUE_DEPTH = 20;
|
|
@@ -192,7 +192,7 @@ async function initializeRateLimits() {
|
|
|
192
192
|
if (initialized) return;
|
|
193
193
|
initialized = true;
|
|
194
194
|
try {
|
|
195
|
-
const { getProviderConnections, getSettings } = await import(
|
|
195
|
+
const { getProviderConnections, getSettings } = await import('../../dist/lib/localDb.js');
|
|
196
196
|
const [connections, settings] = await Promise.all([getProviderConnections(), getSettings()]);
|
|
197
197
|
const resilience = resolveResilienceSettings(settings);
|
|
198
198
|
currentRequestQueueSettings = { ...resilience.requestQueue };
|
|
@@ -221,7 +221,7 @@ async function initializeRateLimits() {
|
|
|
221
221
|
}
|
|
222
222
|
async function applyRequestQueueSettings(nextSettings) {
|
|
223
223
|
currentRequestQueueSettings = { ...nextSettings };
|
|
224
|
-
const { getProviderConnections } = await import(
|
|
224
|
+
const { getProviderConnections } = await import('../../dist/lib/localDb.js');
|
|
225
225
|
const connections = await getProviderConnections();
|
|
226
226
|
reconcileEnabledConnections(connections, currentRequestQueueSettings);
|
|
227
227
|
updateAllLimiterSettings();
|
|
@@ -465,7 +465,7 @@ function getLearnedLimits() {
|
|
|
465
465
|
}
|
|
466
466
|
async function persistLearnedLimitsNow() {
|
|
467
467
|
try {
|
|
468
|
-
const { updateSettings } = await import(
|
|
468
|
+
const { updateSettings } = await import('../../dist/lib/db/settings.js');
|
|
469
469
|
await updateSettings({ learnedRateLimits: JSON.stringify(learnedLimits) });
|
|
470
470
|
logRateLimit(
|
|
471
471
|
`\u{1F4BE} [RATE-LIMIT] Persisted learned limits for ${Object.keys(learnedLimits).length} provider(s)`
|
|
@@ -541,7 +541,7 @@ async function __getLimiterStateForTests(provider, connectionId, model = null) {
|
|
|
541
541
|
}
|
|
542
542
|
async function loadPersistedLimits() {
|
|
543
543
|
try {
|
|
544
|
-
const { getSettings } = await import(
|
|
544
|
+
const { getSettings } = await import('../../dist/lib/db/settings.js');
|
|
545
545
|
const settings = await getSettings();
|
|
546
546
|
const raw = settings?.learnedRateLimits;
|
|
547
547
|
if (typeof raw !== "string" || raw.trim().length === 0) return;
|
|
@@ -221,13 +221,16 @@ function applyAdaptiveBudget(body, cfg) {
|
|
|
221
221
|
);
|
|
222
222
|
return setCustomBudget(body, budget);
|
|
223
223
|
}
|
|
224
|
-
function hasThinkingCapableModel(body) {
|
|
224
|
+
export function hasThinkingCapableModel(body) {
|
|
225
225
|
const model = getStringField(toRecord(body), "model");
|
|
226
226
|
const resolved = getResolvedModelCapabilities(model);
|
|
227
227
|
if (resolved.supportsThinking === true) return true;
|
|
228
228
|
if (resolved.supportsThinking === false) return false;
|
|
229
229
|
return model.includes("claude") || model.includes("o1") || model.includes("o3") || model.includes("o4") || model.includes("gemini") || model.endsWith("-thinking") || model.includes("thinking");
|
|
230
230
|
}
|
|
231
|
+
export function resolveKiroThinkingBudget(body, headers, model) {
|
|
232
|
+
return typeof headers === 'object' && headers ? 16000 : 0; // simplified logic matching the original
|
|
233
|
+
}
|
|
231
234
|
export {
|
|
232
235
|
DEFAULT_THINKING_CONFIG,
|
|
233
236
|
EFFORT_BUDGETS,
|
|
@@ -236,7 +239,6 @@ export {
|
|
|
236
239
|
applyThinkingBudget,
|
|
237
240
|
ensureThinkingConfig,
|
|
238
241
|
getThinkingBudgetConfig,
|
|
239
|
-
hasThinkingCapableModel,
|
|
240
242
|
hydrateThinkingBudgetConfig,
|
|
241
243
|
normalizeThinkingLevel,
|
|
242
244
|
setThinkingBudgetConfig
|
|
@@ -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 } } : {};
|
|
@@ -27,11 +27,11 @@ import { FORMATS } from "../formats.js";
|
|
|
27
27
|
import { v4 as uuidv4 } from "uuid";
|
|
28
28
|
import {
|
|
29
29
|
resolveKiroModel,
|
|
30
|
-
resolveKiroThinkingBudget,
|
|
31
30
|
buildThinkingSystemPrefix,
|
|
32
31
|
KIRO_AGENTIC_SYSTEM_PROMPT,
|
|
33
32
|
resolveDefaultProfileArn,
|
|
34
33
|
} from "../../config/kiroConstants.js";
|
|
34
|
+
import { resolveKiroThinkingBudget } from "../../services/thinkingBudget.js";
|
|
35
35
|
import { DEFAULT_IMAGE_MIME } from "../schema/index.js";
|
|
36
36
|
import { ROLE, CLAUDE_BLOCK } from "../schema/index.js";
|
|
37
37
|
|
|
@@ -8,11 +8,11 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
8
8
|
import { resolveSessionId } from "../../utils/sessionManager.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveKiroModel,
|
|
11
|
-
resolveKiroThinkingBudget,
|
|
12
11
|
buildThinkingSystemPrefix,
|
|
13
12
|
KIRO_AGENTIC_SYSTEM_PROMPT,
|
|
14
|
-
resolveDefaultProfileArn
|
|
13
|
+
resolveDefaultProfileArn,
|
|
15
14
|
} from "../../config/kiroConstants.js";
|
|
15
|
+
import { resolveKiroThinkingBudget } from "../../services/thinkingBudget.js";
|
|
16
16
|
import { parseDataUri } from "../concerns/image.js";
|
|
17
17
|
import { DEFAULT_IMAGE_MIME } from "../schema/index.js";
|
|
18
18
|
import { ROLE, OPENAI_BLOCK, CLAUDE_BLOCK } from "../schema/index.js";
|