mirror of
https://ghproxy.cflmy.top/https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-12-01 09:39:36 +08:00
The MCP manager takes each server from its own `@deepseek-ai/dsh-mcp-manager/server` row and no longer reads a `servers` list, so the Connectors tab cannot keep custom servers in the manager's Settings namespace. The `connectors` Host service now keeps each custom server as the row `mcp-server-<name>` of the profile patch, and it lists every MCP server row of the composition, including a row that is switched off and a row that did not start. Reading: the stream `watchServers` replaces `listServers()`. It sends the list when the browser subscribes, after each change made through the service, after `app-boot/config-reload`, and after `plugin-manager/changed`. Each server carries its row id and one of three states: on, off, or failed with the row's error. The revision a change names is a digest of the rows instead of the Settings revision. The config field `mcpManagerNamespace` and the list's `writable` flag are removed: the service needs the configuration editor, the plugin manager, credentials, and the MCP manager, and it reports the section as unavailable when one of them is absent. Writing: `saveServer(draft, revision, id?)` inserts a new row through the configuration editor, or replaces the config of the row `id` names, after it checks the config against the row plugin's exported `Config`. A row that is switched on must run after the write; when it does not, the configuration editor restores the profile patch and the save is refused with the row's failure. A row that is off is written without starting, and a row that did not start is started with the new config, so both can be edited. Secrets are stored after the row is written, and a reference is deleted only when no other row uses it, whether that row is on or off. `removeServer(id, revision)` removes only a row the profile patch adds. `setServerEnabled(id, enabled, revision)` switches the row through `pluginManager.setPluginEnabled` and reports every outcome other than `applied` as a refusal. OAuth: a server that is on signs out through the manager. The manager does not hold a server that is off or did not start, so the service deletes that row's grant record itself, unless another row or a registered server uses the same key. Accounts are registered for the OAuth rows that are on. Browser: the store follows the stream instead of reading after each change and after each Settings event. A row shows why it did not start. The page of a server that is off or did not start keeps the form; only a server that is on has Test connection and the account section. Switching a local command on asks for the risk confirmation, as saving one that the save starts does, and the form no longer has an `enabled` field. When the row of an open page is removed or can no longer be read, a notice takes the page's place. The rows of the header, environment, and argument lists keep their keys while rows are added and removed. Two style defects seen on the real page are fixed: the validation lines named a color token that does not exist and fell back to the secondary label color, and the button of a notice wrapped below a long message. The save checks a config with `Config` of `@deepseek-ai/dsh-mcp-manager/server`, and the grant deletion builds the record key with `credentialKey` of `@deepseek-ai/dsh-credentials`, so the package declares both packages as peer dependencies. `scripts/package-dependency-policy.ts` lists the `Config` export under `PEER_REQUIRED_HOST_EXPORTS`; this policy entry needs the domain owner's confirmation. The Web e2e asserts the row and its override in the profile patch, the stored token, the switch, and the removal of both. The READMEs, the Agent Notes that described the Settings namespace, and the generated catalogs describe the rows.
155 lines
8.7 KiB
TypeScript
155 lines
8.7 KiB
TypeScript
/** Explicit exceptions and Host packages for the published dependency policy. */
|
|
|
|
/** Packages treated as Client/Host packages without declaring `dsh.client`. */
|
|
const CLIENT_FACE_INCLUDE: readonly string[] = []
|
|
|
|
/** Packages exempted from automatic Client/Host treatment despite declaring `dsh.client`. */
|
|
const CLIENT_FACE_EXCLUDE: readonly string[] = [
|
|
'@deepseek-ai/dsh-api-session-controller',
|
|
'@deepseek-ai/dsh-api-workspace-controller',
|
|
]
|
|
|
|
/** Host-only packages whose peer relays are deliberately flattened. */
|
|
const HOST_DEPENDENCY_PACKAGES: readonly string[] = [
|
|
'@deepseek-ai/dsh-llm',
|
|
'@deepseek-ai/dsh-session',
|
|
]
|
|
|
|
/** Required Cordis services whose Host imports are type-only. */
|
|
const REQUIRED_SERVICE_PEERS = {
|
|
'@deepseek-ai/dsh-api-terminal-controller': ['@deepseek-ai/dsh-subprocess'],
|
|
} as const satisfies Readonly<Record<string, readonly string[]>>
|
|
|
|
/** Development-only package relationships not represented by source imports. */
|
|
const CONFIGURATION_ONLY_DEV_DEPENDENCIES = {
|
|
'@deepseek-ai/dsh-client-locale': ['@deepseek-ai/dsh-api-remotes'],
|
|
'@deepseek-ai/dsh-client-ui-conversation': [
|
|
'@deepseek-ai/dsh-api-remotes',
|
|
'@deepseek-ai/dsh-client-ui-workspace',
|
|
],
|
|
'@deepseek-ai/dsh-client-ui-model-selection': ['@deepseek-ai/dsh-client-ui-input-trigger'],
|
|
'@deepseek-ai/dsh-client-ui-sidebar': ['@deepseek-ai/dsh-client-ui-workspace'],
|
|
'@deepseek-ai/dsh-client-ui-subagent': ['@deepseek-ai/dsh-client-ui-input-trigger'],
|
|
'@deepseek-ai/dsh-client-ui-theme': ['@deepseek-ai/dsh-api-remotes'],
|
|
'@deepseek-ai/dsh-client-ui-tool': ['@deepseek-ai/dsh-api-remotes'],
|
|
} as const satisfies Readonly<Record<string, readonly string[]>>
|
|
|
|
/** Workspace packages whose complete runtime surface is safe across duplicate installations. */
|
|
const DUPLICATE_SAFE_PACKAGES: readonly string[] = [
|
|
'@deepseek-ai/dsh-brand',
|
|
'@deepseek-ai/dsh-lazy-require',
|
|
'@deepseek-ai/dsh-typert-protocol',
|
|
'@deepseek-ai/dsh-util-code-language',
|
|
'@deepseek-ai/dsh-util-crypto',
|
|
'@deepseek-ai/dsh-util-text-search',
|
|
'@deepseek-ai/dsh-util-values',
|
|
]
|
|
|
|
/**
|
|
* Runtime exports whose values remain valid when npm installs another package copy.
|
|
* New entries are forbidden by default. Automated agents must not add an
|
|
* exception; every addition requires explicit human review and a dedicated,
|
|
* prominent heading in the pull request description.
|
|
*/
|
|
const SAFE_HOST_DEPENDENCY_EXPORTS = {
|
|
'@deepseek-ai/dsh-atomic-write': ['withFileLock', 'writeFileAtomic'],
|
|
'@deepseek-ai/dsh-deque': ['Deque'],
|
|
// Builds a dispatcher from the resolved proxy policy; the caller owns and closes it.
|
|
'@deepseek-ai/dsh-http-proxy': ['createRouteDispatcher'],
|
|
// The Liveshare wire codec and identity helpers are stateless functions over caller-owned values.
|
|
'@deepseek-ai/dsh-experimental-liveshare-protocol': [
|
|
'LIVESHARE_CAPABILITIES', 'LIVESHARE_PROTOCOL_VERSION', 'parseRelayFrame', 'parseShareAccessState',
|
|
'parseTunnelWorkerCommand', 'parseTunnelWorkerEvent', 'rawText', 'sendFrame', 'unsupportedFrameRefusal',
|
|
'viewerRequestFields', 'identityFromKey', 'identityKeyOf',
|
|
],
|
|
// The shipped profile templates are plain data; a consumer reads their bundle names only.
|
|
'@deepseek-ai/dsh-official-bundles': ['PROFILE_TEMPLATES'],
|
|
// Messages and assembled blocks are plain data. Each caller owns its assembler.
|
|
'@deepseek-ai/dsh-llm': ['BlockAssembler', 'callConfigEquals', 'createUserMessage'],
|
|
'@deepseek-ai/dsh-session-format': ['sessionFormatLogFilename'],
|
|
'@deepseek-ai/dsh-storage-domain': ['defineDomain'],
|
|
'@deepseek-ai/dsh-timeout': ['MAX_TIMER_DELAY_MS'],
|
|
// Both operate only on the caller's subprocess service and handle; the module memoizes only the binary path.
|
|
'@deepseek-ai/dsh-util-ripgrep': ['readRipgrepLines', 'spawnRipgrep'],
|
|
'@deepseek-ai/schemastery': ['default'],
|
|
} as const satisfies HostDependencyExports
|
|
|
|
/** Runtime exports that require every consumer to resolve the provider's shared peer instance. */
|
|
const PEER_REQUIRED_HOST_EXPORTS = {
|
|
// Agent notifications must use the installed Agent and scope dispatch implementation.
|
|
'@deepseek-ai/dsh-agent': ['emitAgentEvent'],
|
|
// Profile settings must match the installed Node provider's configuration schema.
|
|
'@deepseek-ai/dsh-ptc-runtime-node/configuration': ['resolvePersistentExecution'],
|
|
// CUA mounts the installed provider and shares registry error classes with PTC.
|
|
'@deepseek-ai/dsh-ptc-runtime-node': ['default'],
|
|
'@deepseek-ai/dsh-tool-registry-ptc': ['PtcToolRegistry'],
|
|
// CUA checks UserQuestionError and preserves AttachmentError from image admission; longEdgeDimensions is pure
|
|
// arithmetic that rides the same peer.
|
|
'@deepseek-ai/dsh-attachment': ['admitEncodedImages', 'longEdgeDimensions'],
|
|
'@deepseek-ai/dsh-user-questions': ['UserQuestionError'],
|
|
// The tool registry and every subclass rely on `instanceof` against one HarnessError class.
|
|
'@deepseek-ai/dsh-error': ['HarnessError'],
|
|
// The Remote plugin uses the injected credential service; its key helper follows that peer.
|
|
'@deepseek-ai/dsh-credentials': ['credentialKey'],
|
|
// `instanceof` checks need the translator's own class instance.
|
|
'@deepseek-ai/dsh-experimental-translator': ['TranslationError'],
|
|
// Stateless; a safe classification would turn the forge panel's forge and worktree peers into dependencies.
|
|
'@deepseek-ai/dsh-experimental-forge': ['changeRequestKey'],
|
|
'@deepseek-ai/dsh-experimental-worktree': ['generatedWorktreeName', 'CREATED_RECORD', 'createdWorktreeSchema'],
|
|
// Stateless; the injected WebServer remains a peer.
|
|
'@deepseek-ai/dsh-host-webserver': ['normalizeBindAddress'],
|
|
// A server saved from the Connectors form must match the installed MCP manager's server row schema.
|
|
'@deepseek-ai/dsh-mcp-manager/server': ['Config'],
|
|
// The forge panel matches ctx.fs failures with `instanceof FsError`.
|
|
'@deepseek-ai/dsh-fs': ['FsError'],
|
|
'@deepseek-ai/dsh-scope': ['carrierKeyOf', 'createScope', 'scopeChainOf', 'scopeOf', 'scopeTarget'],
|
|
// appendPluginRecord writes through the Session class's private log; pluginRecordOf is stateless.
|
|
// The DeepSeek chat importer validates its seed with the installed Session log validation before storing it.
|
|
'@deepseek-ai/dsh-session': ['SESSION_FORMAT_VERSION', 'appendPluginRecord', 'pluginRecordOf', 'validateSessionLog'],
|
|
'@deepseek-ai/dsh-session-persistence': ['SessionPersistenceNotFoundError'],
|
|
// Imported titles follow the installed title service's normalization.
|
|
'@deepseek-ai/dsh-session-title': ['normalizeSessionTitle'],
|
|
// Error classes have instance identity; CUA and Liveshare throw the registry's own copy so `instanceof` against it matches.
|
|
'@deepseek-ai/dsh-tools': ['defineTool', 'ToolArgsError', 'ToolContextUnavailableError', 'RUN_CODE_NAME'],
|
|
// Readers recognize a deadline's TimeoutReason only by `instanceof` against their own copy.
|
|
'@deepseek-ai/dsh-timeout': ['deadline', 'timeoutOf'],
|
|
// Imported web tool results must render exactly like the installed web tools' results and cards.
|
|
'@deepseek-ai/dsh-tool-web': ['fetchMetaFromValue', 'formatFetchOutput', 'formatSearchOutput', 'searchMetaFromValue'],
|
|
} as const satisfies HostDependencyExports
|
|
|
|
/** Exact import specifier to reviewed runtime exports. */
|
|
type HostDependencyExports = Readonly<Record<string, readonly string[]>>
|
|
|
|
/** Complete configurable input to package dependency classification. */
|
|
export interface PackageDependencyPolicy {
|
|
readonly clientFaceInclude: readonly string[]
|
|
readonly clientFaceExclude: readonly string[]
|
|
readonly hostPackages: readonly string[]
|
|
readonly requiredServicePeers?: Readonly<Record<string, readonly string[]>>
|
|
readonly configurationOnlyDevDependencies: Readonly<Record<string, readonly string[]>>
|
|
readonly duplicateSafePackages?: readonly string[]
|
|
readonly safeHostDependencyExports: HostDependencyExports
|
|
readonly peerRequiredHostExports: HostDependencyExports
|
|
}
|
|
|
|
/** Repository dependency policy consumed by verification and benchmarking. */
|
|
export const PACKAGE_DEPENDENCY_POLICY: PackageDependencyPolicy = {
|
|
clientFaceInclude: CLIENT_FACE_INCLUDE,
|
|
clientFaceExclude: CLIENT_FACE_EXCLUDE,
|
|
hostPackages: HOST_DEPENDENCY_PACKAGES,
|
|
requiredServicePeers: REQUIRED_SERVICE_PEERS,
|
|
configurationOnlyDevDependencies: CONFIGURATION_ONLY_DEV_DEPENDENCIES,
|
|
duplicateSafePackages: DUPLICATE_SAFE_PACKAGES,
|
|
safeHostDependencyExports: SAFE_HOST_DEPENDENCY_EXPORTS,
|
|
peerRequiredHostExports: PEER_REQUIRED_HOST_EXPORTS,
|
|
}
|
|
|
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
}
|
|
|
|
/** Whether a package manifest declares a dynamically loaded Client entry. */
|
|
export function hasClientDeclaration(dshField: unknown): boolean {
|
|
return isRecord(dshField) && Object.hasOwn(dshField, 'client')
|
|
}
|