blackriver-gateway 3.8.46 → 3.8.48
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/package.json +1 -1
- package/src/domain/assessment/migration.ts +2 -2
- package/src/domain/connectionModelRules.ts +1 -1
- package/src/domain/modelAvailability.ts +1 -1
- package/src/domain/omnirouteResponseMeta.ts +30 -30
- package/src/domain/quotaCache.ts +3 -3
- package/src/domain/types.ts +1 -1
- package/src/lib/a2a/routingLogger.ts +1 -1
- package/src/lib/a2a/skills/costAnalysis.ts +5 -5
- package/src/lib/a2a/skills/healthReport.ts +5 -5
- package/src/lib/a2a/skills/listCapabilities.ts +2 -2
- package/src/lib/a2a/skills/providerDiscovery.ts +1 -1
- package/src/lib/a2a/skills/quotaManagement.ts +5 -5
- package/src/lib/a2a/skills/smartRouting.ts +6 -6
- package/src/lib/accessTokens/scopes.ts +2 -2
- package/src/lib/acp/manager.ts +1 -1
- package/src/lib/acp/registry.ts +1 -1
- package/src/lib/agentSkills/generator.ts +4 -4
- package/src/lib/api/comboErrorResponse.ts +1 -1
- package/src/lib/api/modelTestRunner.ts +7 -7
- package/src/lib/api/proxyRegistryRouteHandlers.ts +1 -1
- package/src/lib/api/serverErrorMessage.ts +1 -1
- package/src/lib/apiBridgeServer.ts +3 -3
- package/src/lib/arenaEloSync.ts +5 -5
- package/src/lib/build-profile/featureDisabled.ts +3 -3
- package/src/lib/cacheControlSettings.ts +1 -1
- package/src/lib/catalog/openrouterCatalog.ts +1 -1
- package/src/lib/cli-helper/claudeProfileAutoSync.ts +4 -4
- package/src/lib/cli-helper/codexProfileAutoSync.ts +3 -3
- package/src/lib/cli-helper/config-generator/continue.ts +1 -1
- package/src/lib/cli-helper/config-generator/hermes-agent.ts +10 -10
- package/src/lib/cli-helper/config-generator/hermes.ts +2 -2
- package/src/lib/cli-helper/config-generator/hermesHome.ts +1 -1
- package/src/lib/cli-helper/config-generator/opencode.ts +10 -10
- package/src/lib/cli-helper/doctor/checks.ts +1 -1
- package/src/lib/cli-helper/tool-detector.ts +4 -4
- package/src/lib/cliTools/checkToolConfigStatus.ts +13 -13
- package/src/lib/cloudSync.stub.ts +1 -1
- package/src/lib/cloudSync.ts +6 -6
- package/src/lib/cloudflaredTunnel.ts +1 -1
- package/src/lib/combos/autoPromote.ts +1 -1
- package/src/lib/combos/builderOptions.ts +1 -1
- package/src/lib/compression/judgeModelClient.ts +3 -3
- package/src/lib/config/hotReload.ts +1 -1
- package/src/lib/config/runtimeSettings.ts +11 -11
- package/src/lib/consoleInterceptor.ts +3 -3
- package/src/lib/copilot/engine.ts +16 -16
- package/src/lib/copilot/systemPrompt.ts +12 -12
- package/src/lib/copilot/tools.ts +13 -13
- package/src/lib/credentialHealth/cache.ts +4 -4
- package/src/lib/credentialHealth/scheduler.ts +5 -5
- package/src/lib/dataPaths.ts +1 -1
- package/src/lib/db/adapters/driverFactory.ts +4 -4
- package/src/lib/db/apiKeys/modelPermissions.ts +1 -1
- package/src/lib/db/apiKeys.ts +5 -5
- package/src/lib/db/backup.ts +1 -1
- package/src/lib/db/cliToolState.ts +2 -2
- package/src/lib/db/compression.ts +3 -3
- package/src/lib/db/compressionCombos.ts +1 -1
- package/src/lib/db/core.ts +13 -13
- package/src/lib/db/databaseSettings.ts +1 -1
- package/src/lib/db/detailedLogs.ts +1 -1
- package/src/lib/db/encryption.ts +3 -3
- package/src/lib/db/healthCheck.ts +2 -2
- package/src/lib/db/jsonMigration.ts +1 -1
- package/src/lib/db/migrationRunner.ts +29 -29
- package/src/lib/db/settings/pricing.ts +1 -1
- package/src/lib/db/settings.ts +3 -3
- package/src/lib/db/tierConfig.ts +1 -1
- package/src/lib/db/usageAnalytics.ts +1 -1
- package/src/lib/db/webhookDeliveries.ts +1 -1
- package/src/lib/discovery/index.ts +2 -2
- package/src/lib/embeddings/familyGuard.ts +2 -2
- package/src/lib/embeddings/service.ts +9 -9
- package/src/lib/env/runtimeEnv.ts +4 -4
- package/src/lib/evals/evalRunner/builtinSuites.ts +1 -1
- package/src/lib/events/eventBus.ts +4 -4
- package/src/lib/freeProviderRankings.ts +1 -1
- package/src/lib/gamification/badges.ts +2 -2
- package/src/lib/gamification/servers.ts +1 -1
- package/src/lib/gamification/streaks.ts +1 -1
- package/src/lib/gamification/xp.ts +2 -2
- package/src/lib/gracefulShutdown.ts +5 -5
- package/src/lib/guardrails/registry.ts +1 -1
- package/src/lib/guardrails/visionBridge.ts +1 -1
- package/src/lib/guardrails/visionBridgeHelpers.ts +15 -15
- package/src/lib/guardrails/visionBridgeRouter.ts +1 -1
- package/src/lib/headroom/detect.ts +1 -1
- package/src/lib/images/imageRouteModel.ts +2 -2
- package/src/lib/initCloudSync.ts +2 -2
- package/src/lib/inspector/harExport.ts +5 -5
- package/src/lib/jobs/budgetResetJob.ts +1 -1
- package/src/lib/jobs/reasoningCacheCleanupJob.ts +1 -1
- package/src/lib/localHealthCheck.ts +5 -5
- package/src/lib/machineToken.ts +2 -2
- package/src/lib/memory/embedding/index.ts +1 -1
- package/src/lib/memory/embedding/remote.ts +1 -1
- package/src/lib/memory/embedding/staticPotion.ts +2 -2
- package/src/lib/memory/embedding/transformersLocal.ts +1 -1
- package/src/lib/memory/qdrant.ts +4 -4
- package/src/lib/memory/settings.ts +1 -1
- package/src/lib/memory/types.ts +1 -1
- package/src/lib/middleware/cliTokenAuth.ts +4 -4
- package/src/lib/middleware/registry.ts +5 -5
- package/src/lib/modelCapabilities.ts +2 -2
- package/src/lib/modelMetadataRegistry.ts +1 -1
- package/src/lib/modelsDevSync/transform.ts +14 -14
- package/src/lib/monitoring/providerHealthAutopilot.ts +3 -3
- package/src/lib/monitoring/providerHealthMatrix.ts +2 -2
- package/src/lib/oauth/codexDeviceFlow.ts +1 -1
- package/src/lib/oauth/config/index.ts +4 -4
- package/src/lib/oauth/constants/oauth.ts +5 -5
- package/src/lib/oauth/credentialBlob.ts +2 -2
- package/src/lib/oauth/providers/antigravity.ts +2 -2
- package/src/lib/oauth/providers/claude.ts +1 -1
- package/src/lib/oauth/providers/windsurf.ts +1 -1
- package/src/lib/oauth/providers/zed-hosted.ts +1 -1
- package/src/lib/oauth/providers/zed.ts +1 -1
- package/src/lib/oauth/providers.ts +3 -3
- package/src/lib/oauth/services/cursor.ts +1 -1
- package/src/lib/oauth/utils/agyAuthImport.ts +2 -2
- package/src/lib/oauth/utils/claudeAuthFile.ts +1 -1
- package/src/lib/oauth/utils/cliProxyAuthImport.ts +1 -1
- package/src/lib/oauth/utils/codexAuthFile.ts +1 -1
- package/src/lib/oauth/utils/codexAuthImport.ts +1 -1
- package/src/lib/obsidian/api.ts +1 -1
- package/src/lib/obsidianSync.ts +1 -1
- package/src/lib/playground/codeExport.ts +5 -5
- package/src/lib/plugins/hooks.ts +1 -1
- package/src/lib/plugins/loader.ts +1 -1
- package/src/lib/plugins/manifest.ts +3 -3
- package/src/lib/plugins/marketplace.ts +4 -4
- package/src/lib/plugins/pluginWorker.ts +3 -3
- package/src/lib/plugins/scanner.ts +3 -3
- package/src/lib/plugins/sdk.ts +3 -3
- package/src/lib/pricingSync.ts +9 -9
- package/src/lib/providerModels/geminiModelsParser.ts +1 -1
- package/src/lib/providerModels/managedModelImport.ts +1 -1
- package/src/lib/providers/imageValidation.ts +1 -1
- package/src/lib/providers/requestDefaults.ts +1 -1
- package/src/lib/providers/serviceKindIndex.ts +0 -0
- package/src/lib/providers/staticModels.ts +7 -7
- package/src/lib/providers/validation/anthropicFormat.ts +2 -2
- package/src/lib/providers/validation/audioMiscProviders.ts +4 -4
- package/src/lib/providers/validation/cloudProviders.ts +6 -6
- package/src/lib/providers/validation/openaiFormat.ts +3 -3
- package/src/lib/providers/validation/transport.ts +1 -1
- package/src/lib/providers/validation/urlHelpers.ts +1 -1
- package/src/lib/providers/validation/webProvidersA.ts +3 -3
- package/src/lib/providers/validation/webProvidersB.ts +2 -2
- package/src/lib/providers/validation.ts +7 -7
- package/src/lib/proxyEgress.ts +2 -2
- package/src/lib/proxyHealth/scheduler.ts +3 -3
- package/src/lib/proxyHealth.ts +2 -2
- package/src/lib/proxyRelay/cloudflareWorkerScript.ts +3 -3
- package/src/lib/quota/connectionRecovery.ts +9 -9
- package/src/lib/quota/quotaCombos.ts +1 -1
- package/src/lib/quota/redisQuotaStore.ts +2 -2
- package/src/lib/quota/saturationSignals.ts +4 -4
- package/src/lib/resilience/settings.ts +1 -1
- package/src/lib/runtime/ports.ts +2 -2
- package/src/lib/search/executeWebSearch.ts +3 -3
- package/src/lib/security/localEndpoints.ts +5 -5
- package/src/lib/semanticCache.ts +3 -3
- package/src/lib/services/ServiceSupervisor.ts +1 -1
- package/src/lib/services/embedWsProxy.ts +4 -4
- package/src/lib/services/htmlRewriter.ts +1 -1
- package/src/lib/services/installers/bifrost.ts +1 -1
- package/src/lib/services/installers/mux.ts +1 -1
- package/src/lib/services/installers/ninerouter.stub.ts +1 -1
- package/src/lib/services/installers/ninerouter.ts +2 -2
- package/src/lib/services/installers/utils.ts +2 -2
- package/src/lib/services/modelSync.ts +1 -1
- package/src/lib/services/reverseProxy.ts +7 -7
- package/src/lib/skills/builtins.ts +1 -1
- package/src/lib/skills/interception.ts +3 -3
- package/src/lib/skills/sandbox.ts +3 -3
- package/src/lib/spend/batchWriter.ts +2 -2
- package/src/lib/system/autoUpdate.ts +9 -9
- package/src/lib/system/globalPackagePath.ts +5 -5
- package/src/lib/system/versionCheck.ts +5 -5
- package/src/lib/tailscaleTunnel.ts +4 -4
- package/src/lib/tokenHealthCheck.ts +10 -10
- package/src/lib/translator/streamTransform.ts +1 -1
- package/src/lib/usage/apiKeyUsageLimits.ts +1 -1
- package/src/lib/usage/callLogArtifacts.ts +4 -4
- package/src/lib/usage/callLogs/format.ts +1 -1
- package/src/lib/usage/callLogs.ts +1 -1
- package/src/lib/usage/codexResetCredits.ts +3 -3
- package/src/lib/usage/comboForecast.ts +1 -1
- package/src/lib/usage/comboHealth.ts +2 -2
- package/src/lib/usage/comboScoringInspector.ts +2 -2
- package/src/lib/usage/fetcher.ts +8 -8
- package/src/lib/usage/flatRateProviders.ts +1 -1
- package/src/lib/usage/internalUsageCommand.ts +4 -4
- package/src/lib/usage/providerLimits/quotaNormalize.ts +2 -2
- package/src/lib/usage/providerLimits.ts +5 -5
- package/src/lib/usage/resilienceExplain.ts +1 -1
- package/src/lib/usage/routeExplain.ts +2 -2
- package/src/lib/usage/usageStats.ts +4 -4
- package/src/lib/versionManager/binaryManager.ts +1 -1
- package/src/lib/versionManager/healthMonitor.ts +1 -1
- package/src/lib/vscode/modelPresentation.ts +1 -1
- package/src/lib/vscode/reasoningMetadata.ts +2 -2
- package/src/lib/webhookDispatcher.ts +2 -2
- package/src/lib/webhooks/eventDescriptions.ts +1 -1
- package/src/lib/webhooks/integrations/discord.ts +1 -1
- package/src/lib/webhooks/integrations/slack.ts +1 -1
- package/src/lib/webhooks/integrations/telegram.ts +1 -1
- package/src/lib/zed-oauth/dockerDetect.ts +1 -1
- package/src/lib/zed-oauth/keychain-reader.stub.ts +1 -1
- package/src/lib/zed-oauth/keychain-reader.ts +1 -1
- package/src/mitm/cert/install.stub.ts +1 -1
- package/src/mitm/cert/install.ts +7 -7
- package/src/mitm/dataDir.ts +1 -1
- package/src/mitm/handlers/antigravity.ts +4 -4
- package/src/mitm/handlers/base.ts +9 -9
- package/src/mitm/handlers/claudeCode.ts +2 -2
- package/src/mitm/handlers/codex.ts +2 -2
- package/src/mitm/handlers/copilot.ts +2 -2
- package/src/mitm/handlers/cursor.ts +2 -2
- package/src/mitm/handlers/kiro.ts +2 -2
- package/src/mitm/handlers/openCode.ts +2 -2
- package/src/mitm/handlers/zed.ts +2 -2
- package/src/mitm/inspector/agentBridgeHook.ts +1 -1
- package/src/mitm/inspector/httpProxyServer.ts +1 -1
- package/src/mitm/inspector/llmMetadataExtractor.ts +2 -2
- package/src/mitm/inspector/systemProxyConfig.ts +2 -2
- package/src/mitm/manager.ts +4 -4
- package/src/mitm/systemCommands.ts +10 -10
- package/src/mitm/targets/antigravity.ts +3 -3
- package/src/mitm/targets/claudeCode.ts +2 -2
- package/src/mitm/targets/codex.ts +1 -1
- package/src/mitm/targets/copilot.ts +1 -1
- package/src/mitm/targets/cursor.ts +2 -2
- package/src/mitm/targets/kiro.ts +5 -5
- package/src/mitm/targets/openCode.ts +2 -2
- package/src/mitm/targets/zed.ts +2 -2
- package/src/mitm/tproxy/caTrust.ts +7 -7
- package/src/mitm/tproxy/dynamicCert.ts +2 -2
- package/src/mitm/tproxy/tlsCapture.ts +1 -1
- package/src/server/authz/csrf.ts +1 -1
- package/src/server/authz/headers.ts +11 -11
- package/src/server/authz/peerStamp.ts +1 -1
- package/src/server/authz/pipeline.ts +3 -3
- package/src/server/authz/policies/clientApi.ts +2 -2
- package/src/server/authz/policies/management.ts +5 -5
- package/src/server/cors/origins.ts +2 -2
- package/src/server/origin/publicOrigin.ts +4 -4
- package/src/server/ws/liveServer.ts +3 -3
- package/src/server/ws/liveServerAllowList.ts +1 -1
- package/src/shared/components/Collapsible.tsx +1 -1
- package/src/shared/components/ConsoleLogViewer.tsx +1 -1
- package/src/shared/components/Footer.tsx +8 -8
- package/src/shared/components/Header.tsx +1 -1
- package/src/shared/components/OAuthModal.tsx +7 -7
- package/src/shared/components/OmniRouteLogo.tsx +3 -3
- package/src/shared/components/RequestLoggerDetail.tsx +3 -3
- package/src/shared/components/Sidebar.tsx +3 -3
- package/src/shared/components/compression/EngineConfigForm.tsx +1 -1
- package/src/shared/components/compression/EngineConfigPage.tsx +1 -1
- package/src/shared/components/docs/CodeBlock.stories.tsx +1 -1
- package/src/shared/components/docs/DocsSidebar.tsx +1 -1
- package/src/shared/components/flow/FlowCanvas.tsx +1 -1
- package/src/shared/components/layouts/DashboardLayout.tsx +1 -1
- package/src/shared/components/oauthBlobSubmit.ts +1 -1
- package/src/shared/constants/agentSkills.ts +14 -14
- package/src/shared/constants/appConfig.ts +3 -3
- package/src/shared/constants/cliCompatProviders.ts +1 -1
- package/src/shared/constants/cliTools.ts +12 -12
- package/src/shared/constants/dashboardCsrf.ts +1 -1
- package/src/shared/constants/featureFlagDefinitions.ts +31 -31
- package/src/shared/constants/headers.ts +15 -15
- package/src/shared/constants/mcpScopes.ts +36 -36
- package/src/shared/constants/models.ts +2 -2
- package/src/shared/constants/providers/apikey/enterprise-cloud.ts +5 -5
- package/src/shared/constants/providers/apikey/frontier-labs.ts +3 -3
- package/src/shared/constants/providers/apikey/gateways.ts +7 -7
- package/src/shared/constants/providers/apikey/specialty-media.ts +5 -5
- package/src/shared/constants/providers/noauth.ts +3 -3
- package/src/shared/constants/providers/oauth.ts +2 -2
- package/src/shared/constants/providers.ts +1 -1
- package/src/shared/constants/sidebarVisibility/sections.ts +1 -1
- package/src/shared/constants/sidebarVisibility.ts +1 -1
- package/src/shared/hooks/useDisplayBaseUrl.ts +1 -1
- package/src/shared/http/apiErrorMessage.ts +1 -1
- package/src/shared/middleware/chatBodyAdmission.ts +3 -3
- package/src/shared/network/outboundUrlGuard.ts +6 -6
- package/src/shared/network/safeOutboundFetch.ts +1 -1
- package/src/shared/reasoning/effortStandardization.ts +1 -1
- package/src/shared/schemas/qdrant.ts +1 -1
- package/src/shared/services/apiKeyResolver.ts +2 -2
- package/src/shared/services/cliRuntime.ts +1 -1
- package/src/shared/services/droidCustomModels.ts +8 -8
- package/src/shared/services/modelSyncScheduler.ts +6 -6
- package/src/shared/services/opencodeConfig.ts +5 -5
- package/src/shared/utils/apiKeyPolicy.ts +5 -5
- package/src/shared/utils/classify429.ts +1 -1
- package/src/shared/utils/clineAuth.ts +2 -2
- package/src/shared/utils/codexConfig.ts +1 -1
- package/src/shared/utils/compressionHeaderEcho.ts +7 -7
- package/src/shared/utils/cors.ts +1 -1
- package/src/shared/utils/featureFlags.ts +2 -2
- package/src/shared/utils/fetchError.ts +1 -1
- package/src/shared/utils/fetchTimeout.ts +1 -1
- package/src/shared/utils/freeModels.ts +1 -1
- package/src/shared/utils/logger.ts +2 -2
- package/src/shared/utils/nodeRuntimeSupport.ts +3 -3
- package/src/shared/utils/releaseNotes.ts +3 -3
- package/src/shared/utils/resolveOmniRouteBaseUrl.ts +7 -7
- package/src/shared/utils/secretsValidator.ts +1 -1
- package/src/shared/utils/secureRandom.ts +1 -1
- package/src/shared/validation/freeProxySchemas.ts +3 -3
- package/src/shared/validation/schemas/auth.ts +1 -1
- package/src/shared/validation/settingsSchemas.ts +1 -1
- package/src/sse/handlers/chat.ts +36 -36
- package/src/sse/handlers/chatHelpers.ts +14 -14
- package/src/sse/services/auth.ts +13 -13
- package/src/sse/services/cooldownAwareRetry.ts +1 -1
- package/src/sse/services/model.ts +2 -2
- package/src/sse/services/sessionAffinityPin.ts +1 -1
- package/src/sse/services/tokenRefresh.ts +1 -1
- package/src/types/global.d.ts +7 -7
- package/src/types/index.ts +1 -1
|
@@ -17,11 +17,11 @@ type SyncResult =
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
function isAutoSyncEnabled() {
|
|
20
|
-
// Opt-in, default OFF. Backed by the
|
|
20
|
+
// Opt-in, default OFF. Backed by the BlackRiver Gateway_AUTO_SYNC_CLAUDE_PROFILES feature flag
|
|
21
21
|
// (resolver precedence: DB/dashboard-toggle override > env > default "false"), so a
|
|
22
22
|
// provider model sync never silently writes ~/.claude/profiles/<name>/settings.json
|
|
23
23
|
// unless the operator turned it on — via the providers-dashboard toggle or the env var.
|
|
24
|
-
return isFeatureFlagEnabled("
|
|
24
|
+
return isFeatureFlagEnabled("BlackRiver Gateway_AUTO_SYNC_CLAUDE_PROFILES");
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function forwardAuthHeaders(request: Request): Record<string, string> {
|
|
@@ -69,11 +69,11 @@ export async function autoSyncClaudeProfilesFromLiveCatalog(
|
|
|
69
69
|
}
|
|
70
70
|
const claudeHome = path.dirname(claudePaths.settings);
|
|
71
71
|
|
|
72
|
-
// Each generated profile points ANTHROPIC_BASE_URL at the
|
|
72
|
+
// Each generated profile points ANTHROPIC_BASE_URL at the BlackRiver Gateway this server serves.
|
|
73
73
|
// Strip a trailing /v1 (Claude Code appends the version segment itself).
|
|
74
74
|
const profileBaseUrl = internalBase.replace(/\/v1$/, "");
|
|
75
75
|
|
|
76
|
-
// Reuse the CLI generator so automatic sync and `
|
|
76
|
+
// Reuse the CLI generator so automatic sync and `BlackRiver Gateway setup-claude` stay
|
|
77
77
|
// behaviorally identical.
|
|
78
78
|
// @ts-ignore - bin CLI modules are shipped as ESM JavaScript, without TS declarations.
|
|
79
79
|
const { syncClaudeProfilesFromModels } =
|
|
@@ -17,11 +17,11 @@ type SyncResult =
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
function isAutoSyncEnabled() {
|
|
20
|
-
// Opt-in, default OFF. Backed by the
|
|
20
|
+
// Opt-in, default OFF. Backed by the BlackRiver Gateway_AUTO_SYNC_CODEX_PROFILES feature flag
|
|
21
21
|
// (resolver precedence: DB/dashboard-toggle override > env > default "false"), so a
|
|
22
22
|
// provider model sync never silently writes ~/.codex/*.config.toml unless the operator
|
|
23
23
|
// turned it on — via the providers-dashboard toggle or the env var.
|
|
24
|
-
return isFeatureFlagEnabled("
|
|
24
|
+
return isFeatureFlagEnabled("BlackRiver Gateway_AUTO_SYNC_CODEX_PROFILES");
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function forwardAuthHeaders(request: Request): Record<string, string> {
|
|
@@ -65,7 +65,7 @@ export async function autoSyncCodexProfilesFromLiveCatalog(
|
|
|
65
65
|
}
|
|
66
66
|
const codexHome = path.dirname(codexPaths.config);
|
|
67
67
|
|
|
68
|
-
// Reuse the CLI generator so automatic sync and `
|
|
68
|
+
// Reuse the CLI generator so automatic sync and `BlackRiver Gateway setup-codex`
|
|
69
69
|
// stay behaviorally identical.
|
|
70
70
|
// @ts-ignore - bin CLI modules are shipped as ESM JavaScript, without TS declarations.
|
|
71
71
|
const { syncCodexProfilesFromModels } = await import("../../../bin/cli/commands/setup-codex.mjs");
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*
|
|
16
16
|
* interface HermesAgentRoleSelection {
|
|
17
17
|
* role: 'default' | 'delegation' | 'vision' | 'compression' | 'web_extract' | 'skills_hub' | 'approval' | ...;
|
|
18
|
-
* model: string; // the model name the user chose from
|
|
18
|
+
* model: string; // the model name the user chose from BlackRiver Gateway
|
|
19
19
|
* }
|
|
20
20
|
*
|
|
21
21
|
* interface HermesAgentConfigPayload {
|
|
22
|
-
* baseUrl: string; // usually the
|
|
22
|
+
* baseUrl: string; // usually the BlackRiver Gateway base URL
|
|
23
23
|
* keyId?: string | null; // preferred: reference to a stored key
|
|
24
24
|
* apiKey?: string | null; // fallback plaintext key
|
|
25
25
|
* selections: HermesAgentRoleSelection[];
|
|
@@ -71,7 +71,7 @@ function normalizeBaseUrl(base: string): string {
|
|
|
71
71
|
function getProviderBlock(baseUrl: string, apiKey: string) {
|
|
72
72
|
const normalized = normalizeBaseUrl(baseUrl);
|
|
73
73
|
return {
|
|
74
|
-
provider: "
|
|
74
|
+
provider: "BlackRiver Gateway",
|
|
75
75
|
model: "", // will be filled per-role
|
|
76
76
|
base_url: `${normalized}/v1`,
|
|
77
77
|
api_key: apiKey,
|
|
@@ -92,7 +92,7 @@ export async function generateHermesAgentConfig(
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// Resolve the actual key to use (in real impl we would look up keyId)
|
|
95
|
-
const resolvedKey = apiKey || "
|
|
95
|
+
const resolvedKey = apiKey || "YOUR_BlackRiver Gateway_API_KEY_HERE";
|
|
96
96
|
|
|
97
97
|
// Read existing config if present (non-destructive merge)
|
|
98
98
|
let existing: any = {};
|
|
@@ -104,9 +104,9 @@ export async function generateHermesAgentConfig(
|
|
|
104
104
|
// no existing file — start fresh
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
// Build the providers.
|
|
107
|
+
// Build the providers.BlackRiver Gateway entry (shared)
|
|
108
108
|
const normalizedBase = normalizeBaseUrl(baseUrl);
|
|
109
|
-
const
|
|
109
|
+
const BlackRiver GatewayProvider = {
|
|
110
110
|
base_url: `${normalizedBase}/v1`,
|
|
111
111
|
api_key: resolvedKey,
|
|
112
112
|
};
|
|
@@ -116,7 +116,7 @@ export async function generateHermesAgentConfig(
|
|
|
116
116
|
...existing,
|
|
117
117
|
providers: {
|
|
118
118
|
...(existing.providers || {}),
|
|
119
|
-
|
|
119
|
+
BlackRiver Gateway: BlackRiver GatewayProvider,
|
|
120
120
|
},
|
|
121
121
|
};
|
|
122
122
|
|
|
@@ -128,14 +128,14 @@ export async function generateHermesAgentConfig(
|
|
|
128
128
|
next.model = {
|
|
129
129
|
...(existing.model || {}),
|
|
130
130
|
default: model,
|
|
131
|
-
provider: "
|
|
131
|
+
provider: "BlackRiver Gateway",
|
|
132
132
|
base_url: `${normalizedBase}/v1`,
|
|
133
133
|
};
|
|
134
134
|
} else if (role === "delegation") {
|
|
135
135
|
next.delegation = {
|
|
136
136
|
...(existing.delegation || {}),
|
|
137
137
|
model,
|
|
138
|
-
provider: "
|
|
138
|
+
provider: "BlackRiver Gateway",
|
|
139
139
|
base_url: `${normalizedBase}/v1`,
|
|
140
140
|
api_key: resolvedKey,
|
|
141
141
|
};
|
|
@@ -144,7 +144,7 @@ export async function generateHermesAgentConfig(
|
|
|
144
144
|
if (!next.auxiliary) next.auxiliary = {};
|
|
145
145
|
next.auxiliary[role] = {
|
|
146
146
|
...(existing.auxiliary?.[role] || {}),
|
|
147
|
-
provider: "
|
|
147
|
+
provider: "BlackRiver Gateway",
|
|
148
148
|
model,
|
|
149
149
|
base_url: `${normalizedBase}/v1`,
|
|
150
150
|
api_key: resolvedKey,
|
|
@@ -32,11 +32,11 @@ export async function generateHermesConfig(options: {
|
|
|
32
32
|
const config = {
|
|
33
33
|
model: {
|
|
34
34
|
default: model,
|
|
35
|
-
provider: "
|
|
35
|
+
provider: "BlackRiver Gateway",
|
|
36
36
|
base_url: `${base}/v1`,
|
|
37
37
|
},
|
|
38
38
|
providers: {
|
|
39
|
-
|
|
39
|
+
BlackRiver Gateway: {
|
|
40
40
|
base_url: `${base}/v1`,
|
|
41
41
|
api_key: options.apiKey,
|
|
42
42
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Shared Hermes home-directory resolver (#3628).
|
|
3
3
|
*
|
|
4
4
|
* The Hermes PowerShell installer (Windows) writes its default config under
|
|
5
|
-
* `%LOCALAPPDATA%\hermes`, exposed as the `HERMES_HOME` env var.
|
|
5
|
+
* `%LOCALAPPDATA%\hermes`, exposed as the `HERMES_HOME` env var. BlackRiver Gateway
|
|
6
6
|
* previously hard-coded `~/.hermes` everywhere, so the two config files never
|
|
7
7
|
* met on Windows.
|
|
8
8
|
*
|
|
@@ -11,7 +11,7 @@ const CONFIG_PATH = path.join(os.homedir(), ".config", "opencode", "opencode.jso
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* SSRF guard for the catalog fetch (CodeQL js/request-forgery #326). The catalog
|
|
14
|
-
* source is the user's OWN
|
|
14
|
+
* source is the user's OWN BlackRiver Gateway instance, so loopback/private hosts are the
|
|
15
15
|
* legitimate default and must stay allowed — we cannot use the public-only guard
|
|
16
16
|
* here. What has NO legitimate use as a catalog source is the cloud-metadata /
|
|
17
17
|
* link-local pivot (169.254.169.254, metadata.google.internal, …): that is the
|
|
@@ -95,11 +95,11 @@ export interface CatalogFetchResult {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Fetch the live `/v1/models` catalog from
|
|
98
|
+
* Fetch the live `/v1/models` catalog from BlackRiver Gateway. The catalog is the
|
|
99
99
|
* single source of truth for context windows — opencode.json must NOT
|
|
100
100
|
* hardcode values, otherwise we drift from the provider's actual limits.
|
|
101
101
|
*/
|
|
102
|
-
export async function
|
|
102
|
+
export async function fetchBlackRiver GatewayCatalog(
|
|
103
103
|
baseUrl: string,
|
|
104
104
|
apiKey: string,
|
|
105
105
|
timeoutMs = 5_000
|
|
@@ -128,7 +128,7 @@ export async function fetchOmniRouteCatalog(
|
|
|
128
128
|
});
|
|
129
129
|
if (!response.ok) {
|
|
130
130
|
throw new Error(
|
|
131
|
-
`
|
|
131
|
+
`BlackRiver Gateway /v1/models returned ${response.status} ${response.statusText}`
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
134
|
const body = (await response.json()) as unknown;
|
|
@@ -288,7 +288,7 @@ export interface GenerateOpencodeOptions {
|
|
|
288
288
|
model?: string;
|
|
289
289
|
/**
|
|
290
290
|
* Override the default `provider.id` used in the generated config.
|
|
291
|
-
* Defaults to `"
|
|
291
|
+
* Defaults to `"BlackRiver Gateway"`.
|
|
292
292
|
*/
|
|
293
293
|
providerId?: string;
|
|
294
294
|
/**
|
|
@@ -308,7 +308,7 @@ export interface GenerateOpencodeOptions {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
/**
|
|
311
|
-
* Generate a full `opencode.json` document for
|
|
311
|
+
* Generate a full `opencode.json` document for BlackRiver Gateway. The catalog is the
|
|
312
312
|
* single source of truth for context windows — we never hardcode values.
|
|
313
313
|
*
|
|
314
314
|
* Behavior:
|
|
@@ -330,7 +330,7 @@ export async function generateOpencodeConfig(
|
|
|
330
330
|
const cleanBase = options.baseUrl.replace(/\/+$/, "");
|
|
331
331
|
const baseURL = cleanBase.endsWith("/v1") ? cleanBase : `${cleanBase}/v1`;
|
|
332
332
|
|
|
333
|
-
const providerId = options.providerId?.trim() || "
|
|
333
|
+
const providerId = options.providerId?.trim() || "BlackRiver Gateway";
|
|
334
334
|
const fetchCatalog = options.fetchCatalog !== false;
|
|
335
335
|
const timeoutMs = options.catalogTimeoutMs ?? 5_000;
|
|
336
336
|
|
|
@@ -339,7 +339,7 @@ export async function generateOpencodeConfig(
|
|
|
339
339
|
// picking the wrong context window.
|
|
340
340
|
let catalogById = new Map<string, CatalogModelEntry>();
|
|
341
341
|
if (fetchCatalog) {
|
|
342
|
-
const result = await
|
|
342
|
+
const result = await fetchBlackRiver GatewayCatalog(baseURL, options.apiKey, timeoutMs);
|
|
343
343
|
catalogById = result.byId;
|
|
344
344
|
} else {
|
|
345
345
|
throw new Error(
|
|
@@ -365,7 +365,7 @@ export async function generateOpencodeConfig(
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
const provider: Record<string, unknown> = {
|
|
368
|
-
name: existingProvider?.name ?? "
|
|
368
|
+
name: existingProvider?.name ?? "BlackRiver Gateway",
|
|
369
369
|
npm: existingProvider?.npm ?? "@ai-sdk/openai-compatible",
|
|
370
370
|
options: {
|
|
371
371
|
baseURL,
|
|
@@ -428,7 +428,7 @@ export function generateOpencodeConfigSync(options: {
|
|
|
428
428
|
const base = cleanBase.endsWith("/v1") ? cleanBase.slice(0, -3) : cleanBase;
|
|
429
429
|
|
|
430
430
|
const config = {
|
|
431
|
-
provider: "
|
|
431
|
+
provider: "BlackRiver Gateway",
|
|
432
432
|
baseURL: `${base}/v1`,
|
|
433
433
|
apiKey: options.apiKey,
|
|
434
434
|
model: options.model || "opencode",
|
|
@@ -26,7 +26,7 @@ export async function collectCliToolChecks(): Promise<DoctorCheckResult[]> {
|
|
|
26
26
|
return {
|
|
27
27
|
name: `CLI: ${tool.name}`,
|
|
28
28
|
status: "warn" as const,
|
|
29
|
-
message: `${tool.name} not configured for
|
|
29
|
+
message: `${tool.name} not configured for BlackRiver Gateway`,
|
|
30
30
|
details: { id: tool.id, configured: false },
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -36,7 +36,7 @@ export interface DetectedTool {
|
|
|
36
36
|
{
|
|
37
37
|
model: string;
|
|
38
38
|
provider?: string;
|
|
39
|
-
|
|
39
|
+
usingBlackRiver Gateway: boolean;
|
|
40
40
|
}
|
|
41
41
|
>;
|
|
42
42
|
}
|
|
@@ -75,7 +75,7 @@ function isConfigured(content: string, baseUrl: string): boolean {
|
|
|
75
75
|
return (
|
|
76
76
|
content.includes(normalized) ||
|
|
77
77
|
content.includes("localhost:20128") ||
|
|
78
|
-
content.includes("
|
|
78
|
+
content.includes("BlackRiver Gateway_BASE_URL")
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -136,14 +136,14 @@ export async function detectTool(id: string): Promise<DetectedTool | null> {
|
|
|
136
136
|
|
|
137
137
|
Object.entries(roles).forEach(([role, info]) => {
|
|
138
138
|
const usingOmni =
|
|
139
|
-
info?.provider === "
|
|
139
|
+
info?.provider === "BlackRiver Gateway" ||
|
|
140
140
|
(info?.base_url || "").includes("20128") ||
|
|
141
141
|
(info?.base_url || "").includes("localhost:20128");
|
|
142
142
|
|
|
143
143
|
richRoles[role] = {
|
|
144
144
|
model: info.model,
|
|
145
145
|
provider: info.provider,
|
|
146
|
-
|
|
146
|
+
usingBlackRiver Gateway: usingOmni,
|
|
147
147
|
};
|
|
148
148
|
});
|
|
149
149
|
|
|
@@ -7,7 +7,7 @@ import { getRuntimePorts } from "@/lib/runtime/ports";
|
|
|
7
7
|
const { apiPort } = getRuntimePorts();
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Check if a tool has
|
|
10
|
+
* Check if a tool has BlackRiver Gateway configured by reading its config file directly.
|
|
11
11
|
* This replaces the expensive self-referential HTTP calls to /api/cli-tools/*-settings.
|
|
12
12
|
*
|
|
13
13
|
* @param toolId - CLI tool identifier (e.g. "claude", "codex", "cline")
|
|
@@ -28,11 +28,11 @@ export async function checkToolConfigStatus(
|
|
|
28
28
|
// Codex uses TOML config — parse as raw text, not JSON
|
|
29
29
|
if (toolId === "codex") {
|
|
30
30
|
const lower = content.toLowerCase();
|
|
31
|
-
const
|
|
32
|
-
lower.includes("
|
|
31
|
+
const hasBlackRiver Gateway =
|
|
32
|
+
lower.includes("BlackRiver Gateway") ||
|
|
33
33
|
lower.includes(`localhost:${apiPort}`) ||
|
|
34
34
|
lower.includes(`127.0.0.1:${apiPort}`);
|
|
35
|
-
if (!
|
|
35
|
+
if (!hasBlackRiver Gateway) return "not_configured";
|
|
36
36
|
|
|
37
37
|
// Also verify auth.json has an API key (not masked/empty)
|
|
38
38
|
try {
|
|
@@ -52,27 +52,27 @@ export async function checkToolConfigStatus(
|
|
|
52
52
|
|
|
53
53
|
if (toolId === "hermes") {
|
|
54
54
|
const lower = content.toLowerCase();
|
|
55
|
-
const
|
|
56
|
-
lower.includes("
|
|
55
|
+
const hasBlackRiver Gateway =
|
|
56
|
+
lower.includes("BlackRiver Gateway") ||
|
|
57
57
|
lower.includes(`localhost:${apiPort}`) ||
|
|
58
58
|
lower.includes(`127.0.0.1:${apiPort}`);
|
|
59
|
-
return
|
|
59
|
+
return hasBlackRiver Gateway ? "configured" : "not_configured";
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const config = JSON.parse(content) as Record<string, unknown>;
|
|
63
63
|
|
|
64
|
-
// Each tool stores
|
|
64
|
+
// Each tool stores BlackRiver Gateway config differently
|
|
65
65
|
switch (toolId) {
|
|
66
66
|
case "claude":
|
|
67
67
|
return (config?.env as Record<string, unknown>)?.ANTHROPIC_BASE_URL
|
|
68
68
|
? "configured"
|
|
69
69
|
: "not_configured";
|
|
70
70
|
case "qwen": {
|
|
71
|
-
// Check modelProviders for
|
|
71
|
+
// Check modelProviders for BlackRiver Gateway entries
|
|
72
72
|
const mp = config?.modelProviders;
|
|
73
73
|
if (!mp) return "not_configured";
|
|
74
74
|
const qwenConfigStr = JSON.stringify(mp).toLowerCase();
|
|
75
|
-
return qwenConfigStr.includes("
|
|
75
|
+
return qwenConfigStr.includes("BlackRiver Gateway") ||
|
|
76
76
|
qwenConfigStr.includes(`localhost:${apiPort}`) ||
|
|
77
77
|
qwenConfigStr.includes(`127.0.0.1:${apiPort}`)
|
|
78
78
|
? "configured"
|
|
@@ -82,11 +82,11 @@ export async function checkToolConfigStatus(
|
|
|
82
82
|
case "openclaw":
|
|
83
83
|
case "cline":
|
|
84
84
|
case "kilo": {
|
|
85
|
-
// Generic check: look for
|
|
85
|
+
// Generic check: look for BlackRiver Gateway-specific markers in the config
|
|
86
86
|
const configStr = JSON.stringify(config).toLowerCase();
|
|
87
87
|
if (
|
|
88
|
-
configStr.includes("
|
|
89
|
-
configStr.includes("
|
|
88
|
+
configStr.includes("BlackRiver Gateway") ||
|
|
89
|
+
configStr.includes("sk_BlackRiver Gateway") ||
|
|
90
90
|
configStr.includes(`localhost:${apiPort}`) ||
|
|
91
91
|
configStr.includes(`127.0.0.1:${apiPort}`)
|
|
92
92
|
) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stub for `src/lib/cloudSync.ts` activated by
|
|
3
|
-
* `
|
|
3
|
+
* `BlackRiver Gateway_BUILD_PROFILE=minimal`. All Cloud Sync code paths
|
|
4
4
|
* (signature verification, remote-credential merge, fetch with timeout) are
|
|
5
5
|
* physically absent from the built bundle. See SECURITY.md and
|
|
6
6
|
* docs/security/SOCKET_DEV_FINDINGS.md.
|
package/src/lib/cloudSync.ts
CHANGED
|
@@ -4,14 +4,14 @@ import { buildConfigSyncEnvelope, toLegacyCloudSyncPayload } from "@/lib/sync/bu
|
|
|
4
4
|
|
|
5
5
|
const CLOUD_URL = process.env.CLOUD_URL || process.env.NEXT_PUBLIC_CLOUD_URL;
|
|
6
6
|
const CLOUD_SYNC_TIMEOUT_MS = Number(process.env.CLOUD_SYNC_TIMEOUT_MS || 12000);
|
|
7
|
-
const CLOUD_SYNC_SECRET = process.env.
|
|
7
|
+
const CLOUD_SYNC_SECRET = process.env.BlackRiver Gateway_CLOUD_SYNC_SECRET || "";
|
|
8
8
|
|
|
9
9
|
// Opt-in: only when explicitly set to "true" will updateLocalTokens overwrite
|
|
10
10
|
// accessToken/refreshToken/providerSpecificData from the Cloud response. Default
|
|
11
11
|
// behaviour from v3.8.6 onward syncs only non-credential metadata (expiresAt,
|
|
12
12
|
// status, lastError*, rateLimitedUntil, updatedAt) so a misconfigured or
|
|
13
13
|
// hostile CLOUD_URL cannot silently swap user OAuth tokens.
|
|
14
|
-
const CLOUD_SYNC_SECRETS_ENABLED = process.env.
|
|
14
|
+
const CLOUD_SYNC_SECRETS_ENABLED = process.env.BlackRiver Gateway_CLOUD_SYNC_SECRETS === "true";
|
|
15
15
|
|
|
16
16
|
type JsonRecord = Record<string, unknown>;
|
|
17
17
|
|
|
@@ -35,12 +35,12 @@ function toDateMs(value: unknown): number {
|
|
|
35
35
|
// Closes the silent-credential-swap surface flagged by Socket.dev (finding for
|
|
36
36
|
// `app/.next/server/app/api/keys/[id]/route.js`). Two-leg defence:
|
|
37
37
|
// 1. The Cloud endpoint signs each response body with
|
|
38
|
-
// `HMAC-SHA256(
|
|
38
|
+
// `HMAC-SHA256(BlackRiver Gateway_CLOUD_SYNC_SECRET, rawBody)` and returns the hex
|
|
39
39
|
// digest in `X-Cloud-Sig`.
|
|
40
40
|
// 2. We verify the signature with `crypto.timingSafeEqual` before parsing the
|
|
41
41
|
// JSON, so a MITM on the CLOUD_URL channel — or a misconfigured CLOUD_URL
|
|
42
42
|
// pointing at an attacker — cannot inject providers/tokens.
|
|
43
|
-
// If `
|
|
43
|
+
// If `BlackRiver Gateway_CLOUD_SYNC_SECRET` is unset, signature validation is logged but
|
|
44
44
|
// not enforced (back-compat for users on v3.8.x who haven't issued a shared
|
|
45
45
|
// secret yet). The enforce-by-default switch will flip in v3.9.
|
|
46
46
|
export function verifyCloudSignature(rawBody: string, sigHeader: string | null): boolean {
|
|
@@ -50,7 +50,7 @@ export function verifyCloudSignature(rawBody: string, sigHeader: string | null):
|
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
52
|
console.warn(
|
|
53
|
-
"[cloudSync]
|
|
53
|
+
"[cloudSync] BlackRiver Gateway_CLOUD_SYNC_SECRET is not set and the Cloud response carries no X-Cloud-Sig. " +
|
|
54
54
|
"Token sync runs in legacy unverified mode — set the secret to enforce HMAC verification."
|
|
55
55
|
);
|
|
56
56
|
return true;
|
|
@@ -160,7 +160,7 @@ export async function syncToCloud(machineId, createdKey = null) {
|
|
|
160
160
|
* SECURITY-AUDITOR-NOTE: This function appears in Socket.dev finding for
|
|
161
161
|
* `app/.next/server/app/api/keys/[id]/route.js`. From v3.8.6 onward,
|
|
162
162
|
* `accessToken` / `refreshToken` / `providerSpecificData` are only synced when
|
|
163
|
-
* `
|
|
163
|
+
* `BlackRiver Gateway_CLOUD_SYNC_SECRETS=true`. The default mode syncs non-credential
|
|
164
164
|
* metadata only. Combined with `verifyCloudSignature()` above, this closes the
|
|
165
165
|
* silent-credential-overwrite path. See docs/security/SOCKET_DEV_FINDINGS.md §5.
|
|
166
166
|
*/
|
|
@@ -4,7 +4,7 @@ import { promisify } from "util";
|
|
|
4
4
|
import fs from "fs/promises";
|
|
5
5
|
import fsSync from "fs";
|
|
6
6
|
import path from "path";
|
|
7
|
-
import proxyFetch from "@
|
|
7
|
+
import proxyFetch from "@BlackRiver Gateway/open-sse/utils/proxyFetch.ts";
|
|
8
8
|
import { resolveDataDir } from "@/lib/dataPaths";
|
|
9
9
|
import { getRuntimePorts } from "@/lib/runtime/ports";
|
|
10
10
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* successfully, the winning model is moved to position #1 of the persisted
|
|
7
7
|
* combo so future requests try it first.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* BlackRiver Gateway stores `combo.models` as an array of `ComboStep` objects
|
|
10
10
|
* (`{ kind: "model", model, ... }`), unlike the upstream project which stores
|
|
11
11
|
* plain model strings. This helper accepts both shapes and reorders in place
|
|
12
12
|
* without mutating the input, returning `null` when no change is required
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
isClaudeCodeCompatibleProvider,
|
|
20
20
|
isOpenAICompatibleProvider,
|
|
21
21
|
} from "@/shared/constants/providers";
|
|
22
|
-
import type { RegistryModel } from "@
|
|
22
|
+
import type { RegistryModel } from "@BlackRiver Gateway/open-sse/config/providerRegistry.ts";
|
|
23
23
|
|
|
24
24
|
type JsonRecord = Record<string, unknown>;
|
|
25
25
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getExecutor } from "@
|
|
2
|
-
import type { ExecuteInput, ProviderCredentials } from "@
|
|
1
|
+
import { getExecutor } from "@BlackRiver Gateway/open-sse/executors/index";
|
|
2
|
+
import type { ExecuteInput, ProviderCredentials } from "@BlackRiver Gateway/open-sse/executors/base";
|
|
3
3
|
import type {
|
|
4
4
|
ChatTurn,
|
|
5
5
|
ModelCallResult,
|
|
6
6
|
ModelClient,
|
|
7
|
-
} from "@
|
|
7
|
+
} from "@BlackRiver Gateway/open-sse/services/compression/eval/types";
|
|
8
8
|
import { calculateCost } from "@/lib/usage/costCalculator";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -13,7 +13,7 @@ let pollTimer: ReturnType<typeof setInterval> | null = null;
|
|
|
13
13
|
let sqliteWatcher: fs.FSWatcher | null = null;
|
|
14
14
|
|
|
15
15
|
function getPollIntervalMs() {
|
|
16
|
-
const parsed = Number.parseInt(process.env.
|
|
16
|
+
const parsed = Number.parseInt(process.env.BlackRiver Gateway_CONFIG_HOT_RELOAD_MS || "", 10);
|
|
17
17
|
if (!Number.isFinite(parsed) || parsed < MIN_POLL_INTERVAL_MS) {
|
|
18
18
|
return DEFAULT_POLL_INTERVAL_MS;
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clearHealthCheckLogCache } from "@/lib/tokenHealthCheck";
|
|
2
|
-
import { setCustomBannedSignals } from "@
|
|
2
|
+
import { setCustomBannedSignals } from "@BlackRiver Gateway/open-sse/services/accountFallback.ts";
|
|
3
3
|
|
|
4
4
|
type JsonRecord = Record<string, unknown>;
|
|
5
5
|
|
|
@@ -260,7 +260,7 @@ function getPreviousSnapshot(): RuntimeSettingsSnapshot {
|
|
|
260
260
|
|
|
261
261
|
async function applyPayloadRulesSection(payloadRules: unknown) {
|
|
262
262
|
const { clearPayloadRulesConfigOverride, setPayloadRulesConfig } =
|
|
263
|
-
await import("@
|
|
263
|
+
await import("@BlackRiver Gateway/open-sse/services/payloadRules.ts");
|
|
264
264
|
|
|
265
265
|
if (payloadRules === null || payloadRules === undefined) {
|
|
266
266
|
clearPayloadRulesConfigOverride();
|
|
@@ -271,13 +271,13 @@ async function applyPayloadRulesSection(payloadRules: unknown) {
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
async function applyModelAliasesSection(modelAliases: Record<string, string>) {
|
|
274
|
-
const { setCustomAliases } = await import("@
|
|
274
|
+
const { setCustomAliases } = await import("@BlackRiver Gateway/open-sse/services/modelDeprecation.ts");
|
|
275
275
|
setCustomAliases(modelAliases);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
async function applyBackgroundDegradationSection(backgroundDegradation: JsonRecord | null) {
|
|
279
279
|
const { getDefaultDegradationMap, getDefaultDetectionPatterns, setBackgroundDegradationConfig } =
|
|
280
|
-
await import("@
|
|
280
|
+
await import("@BlackRiver Gateway/open-sse/services/backgroundTaskDetector.ts");
|
|
281
281
|
|
|
282
282
|
if (!backgroundDegradation) {
|
|
283
283
|
setBackgroundDegradationConfig({
|
|
@@ -302,7 +302,7 @@ async function applyBackgroundDegradationSection(backgroundDegradation: JsonReco
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
async function applyCliCompatProvidersSection(cliCompatProviders: string[]) {
|
|
305
|
-
const { setCliCompatProviders } = await import("@
|
|
305
|
+
const { setCliCompatProviders } = await import("@BlackRiver Gateway/open-sse/config/cliFingerprints");
|
|
306
306
|
setCliCompatProviders(cliCompatProviders);
|
|
307
307
|
}
|
|
308
308
|
|
|
@@ -313,7 +313,7 @@ async function applyCacheControlSection() {
|
|
|
313
313
|
|
|
314
314
|
async function applyUsageTrackingSection(newBuffer: number | null) {
|
|
315
315
|
const { invalidateBufferTokensCache, setBufferTokensCache } =
|
|
316
|
-
await import("@
|
|
316
|
+
await import("@BlackRiver Gateway/open-sse/utils/usageTracking.ts");
|
|
317
317
|
if (typeof newBuffer === "number" && newBuffer >= 0) {
|
|
318
318
|
// Set the value directly so the first request after a settings save gets the
|
|
319
319
|
// correct count synchronously — no race window back to DEFAULT (2000).
|
|
@@ -325,7 +325,7 @@ async function applyUsageTrackingSection(newBuffer: number | null) {
|
|
|
325
325
|
|
|
326
326
|
async function applyThoughtSignatureSection(mode: string) {
|
|
327
327
|
const { setGeminiThoughtSignatureMode } =
|
|
328
|
-
await import("@
|
|
328
|
+
await import("@BlackRiver Gateway/open-sse/services/geminiThoughtSignatureStore.ts");
|
|
329
329
|
setGeminiThoughtSignatureMode(mode);
|
|
330
330
|
}
|
|
331
331
|
|
|
@@ -346,7 +346,7 @@ async function applyCorsOriginsSection(corsOrigins: string) {
|
|
|
346
346
|
*/
|
|
347
347
|
async function applyCcBridgeTransformsSection(ccBridgeTransforms: unknown) {
|
|
348
348
|
const { setSystemTransformsConfig } =
|
|
349
|
-
await import("@
|
|
349
|
+
await import("@BlackRiver Gateway/open-sse/services/systemTransforms.ts");
|
|
350
350
|
if (ccBridgeTransforms && typeof ccBridgeTransforms === "object") {
|
|
351
351
|
setSystemTransformsConfig(ccBridgeTransforms);
|
|
352
352
|
}
|
|
@@ -362,7 +362,7 @@ function applyAuthzBypassSection(snapshot: AuthzBypassSnapshot) {
|
|
|
362
362
|
|
|
363
363
|
async function applySystemTransformsSection(systemTransforms: unknown) {
|
|
364
364
|
const { setSystemTransformsConfig, resetSystemTransformsConfig } =
|
|
365
|
-
await import("@
|
|
365
|
+
await import("@BlackRiver Gateway/open-sse/services/systemTransforms.ts");
|
|
366
366
|
|
|
367
367
|
if (
|
|
368
368
|
systemTransforms === null ||
|
|
@@ -383,8 +383,8 @@ async function applyModelsDevSyncSection(
|
|
|
383
383
|
) {
|
|
384
384
|
const { startPeriodicSync, stopPeriodicSync } = await import("@/lib/modelsDevSync");
|
|
385
385
|
const skipBackgroundSyncInTests =
|
|
386
|
-
(isAutomatedTestProcess() && process.env.
|
|
387
|
-
isTruthyEnvFlag(process.env.
|
|
386
|
+
(isAutomatedTestProcess() && process.env.BlackRiver Gateway_ENABLE_RUNTIME_BACKGROUND_TASKS !== "1") ||
|
|
387
|
+
isTruthyEnvFlag(process.env.BlackRiver Gateway_DISABLE_BACKGROUND_SERVICES);
|
|
388
388
|
|
|
389
389
|
if (skipBackgroundSyncInTests) {
|
|
390
390
|
stopPeriodicSync();
|
|
@@ -18,7 +18,7 @@ const logToFile = getAppLogToFile();
|
|
|
18
18
|
const logFilePath = resolve(getAppLogFilePath());
|
|
19
19
|
|
|
20
20
|
declare global {
|
|
21
|
-
var
|
|
21
|
+
var __BlackRiver GatewayConsoleInterceptorInit: boolean | undefined;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -99,7 +99,7 @@ function shouldIgnoreConsoleWriteError(error: unknown): boolean {
|
|
|
99
99
|
* Safe to call multiple times — only initializes once.
|
|
100
100
|
*/
|
|
101
101
|
export function initConsoleInterceptor(): void {
|
|
102
|
-
if (!logToFile || globalThis.
|
|
102
|
+
if (!logToFile || globalThis.__BlackRiver GatewayConsoleInterceptorInit) return;
|
|
103
103
|
|
|
104
104
|
try {
|
|
105
105
|
ensureDir();
|
|
@@ -108,7 +108,7 @@ export function initConsoleInterceptor(): void {
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
globalThis.
|
|
111
|
+
globalThis.__BlackRiver GatewayConsoleInterceptorInit = true;
|
|
112
112
|
|
|
113
113
|
// Save original methods
|
|
114
114
|
const originalMethods = {
|