Files
deepseek-harness/scripts/package-dependency-policy.ts
T
MagolorandZiyaZhang d997173e45 feat(timeline): integrate Timeline as an experimental plugin (#7973)
* Add Timeline as an experimental Harness plugin

* fix(timeline): align prompt counters and release inactive views

* fix(timeline): refine frontend motion and document features

* test(timeline): refresh recorded context after upstream update

* fix(timeline): satisfy UI locale and module graph checks

* test(timeline): align integration checks with CI test lanes

* docs(timeline): document exported locale dictionaries

* fix(timeline): use session records and native client interfaces

* fix(timeline): mount edit RPC and align integration checks

* fix(timeline): follow Harness theme rules

* test(timeline): cover session recovery and client interactions

* fix(timeline): address integration review findings

* fix(timeline): isolate forked plan continuation

* docs(timeline): record the 0.4.0 integration changes

* docs(timeline): clarify the plugin description

* test(timeline): cover integration behavior and recovery edges

* fix(timeline): align dependency metadata and test lint

* fix(timeline): isolate scoped work and harden replay

* docs(timeline): refresh persistence catalog source links

* docs(timeline): document planning ownership predicate

* test(timeline): refresh the recommendation description snapshot

* build(timeline): classify Host dependency exports

* test(web): pace the Goal queue snapshot replay

* feat(timeline): make sidebar auto-open configurable

* docs(timeline): clarify sibling task weights

* fix(timeline): harden report updates and checkpoint recovery

* refactor(timeline): share detail view props

* fix(timeline): clarify progress, reports, and sidebar settings (#8347)

* fix(timeline): align the integration with current Harness contracts

* fix(timeline): preserve navigation when removing a task tree

* Reduce Timeline report replay allocations

Reuse the discussion list when report retention leaves its targets intact.
Clarify that the integrated package follows the Harness release version.

Node 24.21.0 on macOS arm64, median of three measured replays after warmup.
With 17,640 reports, replay took 5650 ms before and 804 ms after.
Peak RSS fell from 343 MiB to 288 MiB. Retained heap stayed near 33 MiB.
The serialized view stayed at 5,297,849 bytes.

---------

Co-authored-by: ZiyaZhang <[email protected]>
2026-11-13 11:54:22 +08:00

141 lines
7.6 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-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 = {
// 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 executor error classes with PTC.
'@deepseek-ai/dsh-ptc-runtime-node': ['default'],
'@deepseek-ai/dsh-tool-executor-ptc/run-code': ['RunCodeConfig', 'createRunCodeTool'],
// 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'],
// `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'],
// The forge panel matches ctx.fs failures with `instanceof FsError`.
'@deepseek-ai/dsh-fs': ['FsError'],
'@deepseek-ai/dsh-scope': ['carrierKeyOf', 'createScope', 'scopeOf', 'scopeParentOf', 'scopeTarget'],
// appendPluginRecord writes through the Session class's private log; pluginRecordOf is stateless.
'@deepseek-ai/dsh-session': ['SESSION_FORMAT_VERSION', 'appendPluginRecord', 'pluginRecordOf'],
'@deepseek-ai/dsh-session-persistence': ['SessionPersistenceNotFoundError'],
// 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'],
// Readers recognize a deadline's TimeoutReason only by `instanceof` against their own copy.
'@deepseek-ai/dsh-timeout': ['deadline', 'timeoutOf'],
} 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')
}