@fudrouter/fsrouter 0.6.65 → 0.6.66
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/open-sse/config/credentialLoader.js +1 -1
- package/open-sse/executors/blackbox-web.js +1 -1
- package/open-sse/executors/claude-web.js +1 -1
- package/open-sse/executors/cliproxyapi.js +2 -2
- package/open-sse/executors/gitlab.js +1 -1
- package/open-sse/executors/huggingchat.js +1 -1
- package/open-sse/executors/kimi-web.js +1 -1
- package/open-sse/executors/ninerouter.js +2 -2
- package/open-sse/executors/qoder.js +3 -3
- package/open-sse/executors/qwen-web.js +1 -1
- package/open-sse/executors/yuanbao-web.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/chatCore.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/audit.js +1 -1
- package/open-sse/mcp-server/catalog.js +2 -2
- package/open-sse/mcp-server/descriptionCompressor.js +1 -1
- package/open-sse/mcp-server/mcpCallerIdentity.js +2 -2
- package/open-sse/mcp-server/schemas/tools.js +1 -1
- package/open-sse/mcp-server/server.js +4 -4
- package/open-sse/mcp-server/tools/advancedTools.js +5 -5
- 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 +3 -3
- 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/shadowRouting.js +1 -1
- package/open-sse/services/combo/targetSorters.js +4 -4
- package/open-sse/services/combo/validateQuality.js +1 -1
- package/open-sse/services/evalRouting.js +1 -1
- package/open-sse/services/modelCapabilities.js +1 -1
- package/open-sse/services/modelFamilyFallback.js +1 -1
- package/open-sse/services/providerCooldownTracker.js +1 -1
- package/open-sse/services/rateLimitManager.js +5 -5
- package/open-sse/services/thinkingBudget.js +1 -1
- package/open-sse/services/tokenRefresh/providers.js +3 -3
- package/open-sse/utils/logger.js +1 -1
- package/open-sse/utils/providerRequestLogging.js +1 -1
- package/open-sse/utils/responsesStatePolicy.js +1 -1
- package/open-sse/utils/stream.js +1 -1
- package/open-sse/utils/streamFailureFinalization.js +1 -1
- package/open-sse/utils/usageTracking.js +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ function credGlobals() {
|
|
|
16
16
|
function resolveCredentialsPath() {
|
|
17
17
|
let resolveDataDir;
|
|
18
18
|
try {
|
|
19
|
-
resolveDataDir = require(
|
|
19
|
+
resolveDataDir = require("@/lib/dataPaths").resolveDataDir;
|
|
20
20
|
} catch (err) {
|
|
21
21
|
const fallbackDataDir = process.env.DATA_DIR || join(process.cwd(), "data");
|
|
22
22
|
console.warn(
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
mergeUpstreamExtraHeaders
|
|
5
5
|
} from "./base.ts";
|
|
6
6
|
import { FETCH_TIMEOUT_MS } from "../config/constants.ts";
|
|
7
|
-
import { normalizeSessionCookieHeader } from '
|
|
7
|
+
import { normalizeSessionCookieHeader } from '../../dist/lib/providers/webCookieAuth.js';
|
|
8
8
|
import { prepareToolMessages, buildToolAwareResult } from "../translator/webTools.ts";
|
|
9
9
|
const BLACKBOX_CHAT_API = "https://app.blackbox.ai/api/chat";
|
|
10
10
|
const BLACKBOX_DEFAULT_COOKIE = "next-auth.session-token";
|
|
@@ -2,7 +2,7 @@ import { BaseExecutor, mergeAbortSignals } from "./base.ts";
|
|
|
2
2
|
import { FETCH_TIMEOUT_MS } from "../config/constants.ts";
|
|
3
3
|
import { tlsFetchClaude } from "../services/claudeTlsClient.ts";
|
|
4
4
|
import { getCfClearanceToken } from "../services/claudeTurnstileSolver.ts";
|
|
5
|
-
import { normalizeSessionCookieHeader } from '
|
|
5
|
+
import { normalizeSessionCookieHeader } from '../../dist/lib/providers/webCookieAuth.js';
|
|
6
6
|
import { randomUUID } from "crypto";
|
|
7
7
|
import { sanitizeErrorMessage } from "../utils/error.js";
|
|
8
8
|
import { tryBackedChat } from "../services/browserBackedChat.ts";
|
|
@@ -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();
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
isGitLabDirectAccessDisabled,
|
|
21
21
|
parseGitLabDirectAccessDetails,
|
|
22
22
|
resolveGitLabOAuthBaseUrl
|
|
23
|
-
} from '
|
|
23
|
+
} from '../../dist/lib/oauth/gitlab.js';
|
|
24
24
|
const MAX_TOOL_EXCHANGE_CHARS = 24e3;
|
|
25
25
|
const MAX_TOOL_RESULT_CHARS = 8e3;
|
|
26
26
|
const MAX_USER_INSTRUCTION_CHARS = 4e3;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./base.ts";
|
|
6
6
|
import { FETCH_TIMEOUT_MS } from "../config/constants.ts";
|
|
7
7
|
import { buildErrorBody, sanitizeErrorMessage } from "../utils/error.js";
|
|
8
|
-
import { normalizeSessionCookieHeader } from '
|
|
8
|
+
import { normalizeSessionCookieHeader } from '../../dist/lib/providers/webCookieAuth.js';
|
|
9
9
|
import { streamJsonlToOpenAi, readJsonlResponse } from "./huggingchat/jsonlStream.ts";
|
|
10
10
|
const HUGGINGFACE_BASE = "https://huggingface.co";
|
|
11
11
|
const CONVERSATION_URL = `${HUGGINGFACE_BASE}/chat/conversation`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseExecutor } from "./base.ts";
|
|
2
2
|
import { makeExecutorErrorResult as makeErrorResult, sanitizeErrorMessage } from "../utils/error.js";
|
|
3
|
-
import { extractKimiJwt } from '
|
|
3
|
+
import { extractKimiJwt } from '../../dist/lib/providers/webCookieAuth.js';
|
|
4
4
|
const BASE_URL = "https://www.kimi.com";
|
|
5
5
|
const CHAT_URL = `${BASE_URL}/apiv2/kimi.gateway.chat.v1.ChatService/Chat`;
|
|
6
6
|
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36";
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
} from "./base.ts";
|
|
6
6
|
import { FETCH_TIMEOUT_MS } from "../config/constants.ts";
|
|
7
7
|
import { buildErrorBody } from "../utils/error.js";
|
|
8
|
-
import { getSupervisor } from '
|
|
9
|
-
import { getOrCreateApiKey } from '
|
|
8
|
+
import { getSupervisor } from '../../dist/lib/services/registry.js';
|
|
9
|
+
import { getOrCreateApiKey } from '../../dist/lib/services/apiKey.js';
|
|
10
10
|
const DEFAULT_PORT = 20130;
|
|
11
11
|
const DEFAULT_HOST = "127.0.0.1";
|
|
12
12
|
const HEALTH_CHECK_TIMEOUT_MS = 3e3;
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* different model upstream, so a missing entry is a hard error.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import { qoderEncodeBody } from '
|
|
24
|
-
import { buildCosyHeaders } from '
|
|
23
|
+
import { qoderEncodeBody } from '../../dist/lib/qoder/encoding.js';
|
|
24
|
+
import { buildCosyHeaders } from '../../dist/lib/qoder/cosy.js';
|
|
25
25
|
import { v4 as uuidv4 } from "uuid";
|
|
26
26
|
import { createHash } from "crypto";
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ import { proxyAwareFetch } from "../utils/proxyFetch.js";
|
|
|
31
31
|
import {
|
|
32
32
|
QODER_CHAT_URL_ENCODED,
|
|
33
33
|
QODER_MODEL_MAP,
|
|
34
|
-
} from '
|
|
34
|
+
} from '../../dist/lib/qoder/constants.js';
|
|
35
35
|
import { getQoderModelConfig, resolveQoderModels } from "../services/qoderModels.js";
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseExecutor } from "./base.ts";
|
|
2
2
|
import { makeExecutorErrorResult as makeErrorResult } from "../utils/error.js";
|
|
3
3
|
import { prepareToolMessages, buildToolAwareResult } from "../translator/webTools.ts";
|
|
4
|
-
import { buildQwenCookieHeader, extractQwenToken } from '
|
|
4
|
+
import { buildQwenCookieHeader, extractQwenToken } from '../../dist/lib/providers/webCookieAuth.js';
|
|
5
5
|
const BASE_URL = "https://chat.qwen.ai";
|
|
6
6
|
const CHATS_NEW_URL = `${BASE_URL}/api/v2/chats/new`;
|
|
7
7
|
const CHAT_COMPLETIONS_URL = `${BASE_URL}/api/v2/chat/completions`;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./base.ts";
|
|
6
6
|
import { FETCH_TIMEOUT_MS } from "../config/constants.ts";
|
|
7
7
|
import { buildErrorBody, sanitizeErrorMessage } from "../utils/error.js";
|
|
8
|
-
import { extractCookieValue, stripCookieInputPrefix } from '
|
|
8
|
+
import { extractCookieValue, stripCookieInputPrefix } from '../../dist/lib/providers/webCookieAuth.js';
|
|
9
9
|
const YUANBAO_BASE = "https://yuanbao.tencent.com";
|
|
10
10
|
const CREATE_URL = `${YUANBAO_BASE}/api/user/agent/conversation/create`;
|
|
11
11
|
const CHAT_URL = `${YUANBAO_BASE}/api/chat`;
|
|
@@ -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",
|
|
@@ -11,7 +11,7 @@ import { PROVIDERS } from "../config/providers.js";
|
|
|
11
11
|
import { createErrorResult, parseUpstreamError, formatProviderError } from "../utils/error.js";
|
|
12
12
|
import { HTTP_STATUS } from "../config/runtimeConfig.js";
|
|
13
13
|
import { handleBypassRequest } from "../utils/bypassHandler.js";
|
|
14
|
-
import { trackPendingRequest, appendRequestLog, saveRequestDetail } from '
|
|
14
|
+
import { trackPendingRequest, appendRequestLog, saveRequestDetail } from '../../dist/lib/usageDb.js';
|
|
15
15
|
import { getExecutor } from "../executors/index.js";
|
|
16
16
|
import { buildRequestDetail, extractRequestConfig } from "./chatCore/requestDetail.js";
|
|
17
17
|
import { handleForcedSSEToJson } from "./chatCore/sseToJsonHandler.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;
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import { hashInput, summarizeOutput } from "./schemas/audit.ts";
|
|
2
|
-
import { isNativeSqliteLoadError } from "../../lib/db/core.ts";
|
|
2
|
+
import { isNativeSqliteLoadError } from "../../src/lib/db/core.ts";
|
|
3
3
|
function createNodeSqliteAuditAdapter(db) {
|
|
4
4
|
let _isOpen = true;
|
|
5
5
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getCodexRequestDefaults } from "../../lib/providers/requestDefaults.ts";
|
|
2
|
-
import { getProviderConnections } from "../../lib/db/providers.ts";
|
|
1
|
+
import { getCodexRequestDefaults } from "../../src/lib/providers/requestDefaults.ts";
|
|
2
|
+
import { getProviderConnections } from "../../src/lib/db/providers.ts";
|
|
3
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 : {};
|
|
@@ -133,7 +133,7 @@ async function snapshotMcpDescriptionCompressionStats() {
|
|
|
133
133
|
}
|
|
134
134
|
const originalTokens = Math.max(delta.estimatedTokensSaved, Math.ceil(delta.charsBefore / 4));
|
|
135
135
|
const compressedTokens = Math.max(0, originalTokens - delta.estimatedTokensSaved);
|
|
136
|
-
const { insertCompressionAnalyticsRow } = await import("../../lib/db/compressionAnalytics.ts");
|
|
136
|
+
const { insertCompressionAnalyticsRow } = await import("../../src/lib/db/compressionAnalytics.ts");
|
|
137
137
|
insertCompressionAnalyticsRow({
|
|
138
138
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
139
139
|
mode: "mcp-description",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getMcpHttpAuthHeadersForInternalFetch } from "./httpAuthContext.ts";
|
|
2
|
-
import { extractApiKey } from "../../sse/services/auth.ts";
|
|
3
|
-
import { getApiKeyMetadata } from "../../lib/db/apiKeys.ts";
|
|
2
|
+
import { extractApiKey } from "../../src/sse/services/auth.ts";
|
|
3
|
+
import { getApiKeyMetadata } from "../../src/lib/db/apiKeys.ts";
|
|
4
4
|
async function resolvePrincipalFromHeaders(headers, lookup = getApiKeyMetadata) {
|
|
5
5
|
if (!headers.Authorization && !headers["x-api-key"]) return void 0;
|
|
6
6
|
const rawKey = extractApiKey({ headers: new Headers(headers) }, { allowUrl: false });
|
|
@@ -4,7 +4,7 @@ import { pickFastestModelTool } from "./pickFastestModel.ts";
|
|
|
4
4
|
import {
|
|
5
5
|
AUTO_ROUTING_STRATEGY_VALUES,
|
|
6
6
|
ROUTING_STRATEGY_VALUES
|
|
7
|
-
} from "../../../shared/constants/routingStrategies.ts";
|
|
7
|
+
} from "../../../src/shared/constants/routingStrategies.ts";
|
|
8
8
|
import { pickFastestModelInput, pickFastestModelOutput } from "./pickFastestModel.ts";
|
|
9
9
|
const getHealthInput = z.object({}).describe("No parameters required");
|
|
10
10
|
const getHealthOutput = z.object({
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getComboModelProvider,
|
|
5
5
|
getComboModelString,
|
|
6
6
|
getComboStepTarget
|
|
7
|
-
} from "../../lib/combos/steps.ts";
|
|
7
|
+
} from "../../src/lib/combos/steps.ts";
|
|
8
8
|
import { registerToolSearchTool } from "./toolSearch/register.ts";
|
|
9
9
|
import {
|
|
10
10
|
MCP_TOOLS,
|
|
@@ -67,8 +67,8 @@ import { memoryTools } from "./tools/memoryTools.ts";
|
|
|
67
67
|
import { skillTools } from "./tools/skillTools.ts";
|
|
68
68
|
import { agentSkillTools } from "./tools/agentSkillTools.ts";
|
|
69
69
|
import { githubSkillTools } from "./tools/githubSkillTools.ts";
|
|
70
|
-
import { skillRegistry } from "../../lib/skills/registry.ts";
|
|
71
|
-
import { skillExecutor } from "../../lib/skills/executor.ts";
|
|
70
|
+
import { skillRegistry } from "../../src/lib/skills/registry.ts";
|
|
71
|
+
import { skillExecutor } from "../../src/lib/skills/executor.ts";
|
|
72
72
|
import { pluginTools } from "./tools/pluginTools.ts";
|
|
73
73
|
import { compressionTools } from "./tools/compressionTools.ts";
|
|
74
74
|
import { poolTools } from "./tools/poolTools.ts";
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
DEFAULT_MCP_ACCESSIBILITY_CONFIG,
|
|
83
83
|
clampMcpAccessibilityConfig
|
|
84
84
|
} from "../services/compression/engines/mcpAccessibility/constants.ts";
|
|
85
|
-
import { getDbInstance } from "../../lib/db/core.ts";
|
|
85
|
+
import { getDbInstance } from "../../src/lib/db/core.ts";
|
|
86
86
|
import { normalizeQuotaResponse } from '../../dist/shared/contracts/quota.ts.js';
|
|
87
87
|
import { resolveOmniRouteBaseUrl } from '../../dist/shared/utils/resolveOmniRouteBaseUrl.ts.js';
|
|
88
88
|
import { getMcpModelsCatalog } from "./catalog.ts";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { logToolCall } from "../audit.ts";
|
|
2
2
|
import { getMcpHttpAuthHeadersForInternalFetch } from "../httpAuthContext.ts";
|
|
3
|
-
import { normalizeQuotaResponse } from "../../../shared/contracts/quota.ts";
|
|
4
|
-
import { resolveOmniRouteBaseUrl } from "../../../shared/utils/resolveOmniRouteBaseUrl.ts";
|
|
3
|
+
import { normalizeQuotaResponse } from "../../../src/shared/contracts/quota.ts";
|
|
4
|
+
import { resolveOmniRouteBaseUrl } from "../../../src/shared/utils/resolveOmniRouteBaseUrl.ts";
|
|
5
5
|
import {
|
|
6
6
|
getComboModelProvider,
|
|
7
7
|
getComboModelString,
|
|
8
8
|
getComboStepTarget
|
|
9
|
-
} from '
|
|
10
|
-
import { normalizeRoutingStrategy } from "../../../shared/constants/routingStrategies.ts";
|
|
9
|
+
} from '../../dist/lib/combos/steps.ts.js';
|
|
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 || "";
|
|
13
13
|
async function apiFetch(path, options = {}) {
|
|
@@ -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;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { logToolCall } from "../audit.ts";
|
|
2
2
|
import { getMcpHttpAuthHeadersForInternalFetch } from "../httpAuthContext.ts";
|
|
3
|
-
import { normalizeQuotaResponse } from "../../../shared/contracts/quota.ts";
|
|
4
|
-
import { resolveOmniRouteBaseUrl } from "../../../shared/utils/resolveOmniRouteBaseUrl.ts";
|
|
3
|
+
import { normalizeQuotaResponse } from "../../../src/shared/contracts/quota.ts";
|
|
4
|
+
import { resolveOmniRouteBaseUrl } from "../../../src/shared/utils/resolveOmniRouteBaseUrl.ts";
|
|
5
5
|
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,4 +1,4 @@
|
|
|
1
|
-
import { secureRandomFloat } from "../../../shared/utils/secureRandom";
|
|
1
|
+
import { secureRandomFloat } from "../../../src/shared/utils/secureRandom";
|
|
2
2
|
import { recordComboShadowRequest } from "../comboMetrics.ts";
|
|
3
3
|
import { isRecord } from "./comboData.ts";
|
|
4
4
|
import { resolveNestedComboTargets } from "./comboStructure.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getCircuitBreaker } from "../../../shared/utils/circuitBreaker";
|
|
2
|
-
import { secureRandomFloat, secureRandomInt } from "../../../shared/utils/secureRandom";
|
|
3
|
-
import { getComboStepTarget, getComboStepWeight } from '
|
|
1
|
+
import { getCircuitBreaker } from "../../../src/shared/utils/circuitBreaker";
|
|
2
|
+
import { secureRandomFloat, secureRandomInt } from "../../../src/shared/utils/secureRandom";
|
|
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 { getModelContextLimit } from "../../lib/modelCapabilities";
|
|
1
|
+
import { getModelContextLimit } from "../../src/lib/modelCapabilities";
|
|
2
2
|
import { parseModel } from "./model.js";
|
|
3
3
|
import { CONTEXT_OVERFLOW_REGEX } from "./errorClassifier.js";
|
|
4
4
|
import { getRegistryEntry } from "../config/providerRegistry.js";
|
|
@@ -6,7 +6,7 @@ import { awaitProviderDefaultSlot } from "./providerDefaultRateLimit.js";
|
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_RESILIENCE_SETTINGS,
|
|
8
8
|
resolveResilienceSettings
|
|
9
|
-
} from "../../lib/resilience/settings";
|
|
9
|
+
} from "../../src/lib/resilience/settings";
|
|
10
10
|
import {
|
|
11
11
|
STANDARD_HEADERS,
|
|
12
12
|
ANTHROPIC_HEADERS,
|
|
@@ -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;
|
|
@@ -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 } } : {};
|
package/open-sse/utils/logger.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAppLogFormat, getAppLogLevel } from "../../lib/logEnv";
|
|
1
|
+
import { getAppLogFormat, getAppLogLevel } from "../../src/lib/logEnv";
|
|
2
2
|
const LEVELS = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
3
3
|
function isLogLevel(value) {
|
|
4
4
|
return Object.prototype.hasOwnProperty.call(LEVELS, value);
|
|
@@ -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
|
package/open-sse/utils/stream.js
CHANGED
|
@@ -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
|