1
/**2
* Types for the TypeScript SDK client: launch options, notification shapes,3
* and owned activity results.4
*5
* @module @deepseek-ai/dsh-sdk-client/types6
*/8
import type { ContentBlock, ReasoningEffortId } from '@deepseek-ai/dsh-llm'9
import type { SdkPromptContentBlock } from '@deepseek-ai/dsh-sdk-protocol'10
import type { SessionEvent } from '@deepseek-ai/dsh-session'12
/** One server-to-client notification as received off the wire. */13
export interface HarnessNotification {14
/** The JSON-RPC notification method name. */15
method: string16
/** The raw params object; see `HarnessSdkNotificationMap` for the shapes per method. */17
params: Record<string, unknown>18
}20
/** Predicate deciding whether a subscription receives a notification. */21
export type NotificationFilter = (notification: HarnessNotification) => boolean23
/** Launch and timeout options for {@link HarnessClient}. */24
export interface HarnessClientOptions {25
/** Absolute or caller-relative dsh CLI module; omitted resolves this package's same-version dependency. */26
dshBin?: string27
/** Named profile serving the SDK protocol (default `sdk`). */28
profile?: string29
/** Ordered per-launch profile patches; relative paths resolve before spawn. */30
patches?: string[]31
/** Explicit Harness home for this child; relative paths resolve before spawn. */32
dshHome?: string33
/** Working directory for the dsh process itself. */34
processCwd?: string35
/**36
* The complete child environment, read when {@link HarnessClient.start}37
* spawns. `undefined` reads the parent env at that time; passing an object38
* reads that object at spawn and replaces the parent environment entirely, so callers own39
* credential policy (see `scrubbedParentEnv` in `@deepseek-ai/dsh-subprocess`40
* for the shared scrub-then-merge base).41
*/42
env?: NodeJS.ProcessEnv43
/** Bound (ms) on the initial profile handshake (default 10000). */44
initializeTimeoutMs?: number45
/** Per-request timeout (ms); `undefined` waits indefinitely (a turn can legitimately run long). */46
requestTimeoutMs?: number47
/** Bound (ms) on the protocol `shutdown` exchange inside `close()` (default 1000). */48
shutdownTimeoutMs?: number49
/** Grace (ms) for the runtime's stdin-EOF quiesce during `close()` (default 6000). */50
disposeEofGraceMs?: number51
/** Termination confirmation window (ms) after SIGTERM/SIGKILL during `close()` (default 3000). */52
disposeGraceMs?: number53
}55
/** Options for the high-level {@link DeepSeekHarness} wrapper. */56
export interface DeepSeekHarnessOptions extends HarnessClientOptions {57
/** Workspace cwd recorded on every SDK-created session (default: the process cwd, else `process.cwd()`). */58
cwd?: string59
/** Provider route for SDK-created agents (default `deepseek-official`). */60
provider?: string61
/** Model for SDK-created agents (default `deepseek-v4-flash`). */62
model?: string63
/** Adapter-owned reasoning effort for the selected provider/model route. */64
reasoningEffort?: ReasoningEffortId65
/** Maximum output tokens for each conversation-model request. */66
maxTokens?: number67
}69
/** One owned session activity interval, from enqueue receipt through idle. */70
export interface RunResult {71
/** The session the activity ran on. */72
sessionId: string73
/** Concatenated text of the interval's last assistant message (empty when none). */74
finalResponse: string75
/** Every `session.event` payload for the root session, in wire order. */76
events: SessionEvent[]77
/** Every notification for the root session and discovered descendants, in wire order. */78
notifications: HarnessNotification[]79
}81
/** Re-exported content-block alias so SDK callers need no extra import. */82
export type { ContentBlock }83
export type { SdkPromptContentBlock }