feat: customize model provider requests

Model connections can now save bounded JSON request headers and top-level body fields. Direct requests and Continue support both; local OpenCode and DeepSeek Harness use only native header support, while the managed remote OpenCode gateway applies both.

Runtime, protocol, and authentication fields keep precedence. Custom values are ordinary connection settings, not credential storage. This migrates Runtime settings from v20 to v21 and updates the DeepSeek control and managed Runtime ACP capabilities.

Release note: 模型连接详情新增自定义请求头和请求体;直连与 Continue 支持两者,本地 OpenCode 和 DeepSeek Harness 仅应用原生支持的请求头,受管远程 OpenCode 支持两者,界面会明确提示生效范围。
This commit is contained in:
mesalogo
2026-09-03 22:34:01 +08:00
parent 3765a937bd
commit 4e60a4ca61
53 changed files with 2009 additions and 365 deletions
@@ -16,7 +16,11 @@ import {
acpReplayChannelResultSchema,
acpReconcilePromptRequestSchema as promptReconciliationRequestSchema,
acpReconcilePromptResultSchema as promptReconciliationResultSchema,
acpResumeChannelResultSchema
acpResumeChannelResultSchema,
RUNTIME_ACP_CAPABILITY_NAME,
RUNTIME_ACP_CAPABILITY_VERSION,
RUNTIME_MODEL_BRIDGE_CAPABILITY_NAME,
RUNTIME_MODEL_BRIDGE_CAPABILITY_VERSION
} from '../../shared/agent-protocol'
import { AgentFrameError } from '../../shared/agent-protocol/frame'
import {
@@ -75,10 +79,6 @@ import type {
MainModelBridgePoison
} from './main-model-bridge-dispatcher'
const RUNTIME_ACP_CAPABILITY = 'runtime/acp'
const RUNTIME_ACP_CAPABILITY_VERSION = 4
const RUNTIME_MODEL_BRIDGE_CAPABILITY = 'runtime/model-bridge'
const RUNTIME_MODEL_BRIDGE_CAPABILITY_VERSION = 1
const DEFAULT_CONTROL_TIMEOUT_MS = 15_000
const DEFAULT_MAXIMUM_PENDING_CONTROL_REQUESTS = 32
const UNBOUNDED_REMOTE_PROMPT_DEADLINE_MS = Date.parse(
@@ -1817,13 +1817,14 @@ function assertRuntimeCapability(
requireModelBridge: boolean
): RuntimeProtocolConnection['capabilities']['runtimes'][number] {
const capability = capabilities.capabilities.find(
(entry) => entry.name === RUNTIME_ACP_CAPABILITY
(entry) => entry.name === RUNTIME_ACP_CAPABILITY_NAME
)
const runtimes = capabilities.runtimes.filter(
(entry) => entry.runtimeId === runtimeId
)
const modelBridgeCapability = capabilities.capabilities.find(
(entry) => entry.name === RUNTIME_MODEL_BRIDGE_CAPABILITY
(entry) =>
entry.name === RUNTIME_MODEL_BRIDGE_CAPABILITY_NAME
)
if (
!Number.isSafeInteger(capabilities.generation) ||