Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

refactor(plugins): align the plugins with the upstream 0.1.5-rc.2 APIs

hairyf4f8fd8959041
diff --git a/packages/dsh-tauri-panel-extension/src/host/apply.ts b/packages/dsh-tauri-panel-extension/src/host/apply.ts
index 5f294080..59f21331 100644
--- a/packages/dsh-tauri-panel-extension/src/host/apply.ts
+++ b/packages/dsh-tauri-panel-extension/src/host/apply.ts
@@ -68,7 +68,7 @@ interface PluginFiber {
export function apply(ctx: HostContext, config?: Config): void {
const profile = config?.profile ?? argvProfile() ?? 'web'
- ctx.inject(['webServer', 'skills', 'connection'], (hostCtx: HostContext) => {
+ ctx.inject(['webServer', 'skills', 'connection'], (hostCtx) => {
// The web bundle disables the host-plane `skill-filesystem` row on
// purpose (presets own per-session discovery). The Settings manager
// mounts its own host-plane provider as a CHILD of this plugin: it dies
@@ -146,7 +146,7 @@ export function apply(ctx: HostContext, config?: Config): void {
profileDirPath: profileDir(profile),
remountProvider,
}
- ctx.effect(() => routes(hostCtx, deps), 'dsh-tauri-panel-extension: routes')
+ ctx.effect(() => routes(hostCtx as unknown as HostContext, deps), 'dsh-tauri-panel-extension: routes')
return disposer
}, 'dsh-tauri-panel-extension: skill provider')
})
diff --git a/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts b/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts
index 5ad6fe1c..ac553b54 100644
--- a/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts
+++ b/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts
@@ -17,6 +17,7 @@
import type { ModelSelection } from '@deepseek-ai/dsh-agent'
import type {} from '@deepseek-ai/dsh-agent-default-model'
import type {} from '@deepseek-ai/dsh-agent-presets'
+import type { ReasoningEffortId } from '@deepseek-ai/dsh-llm'
import type { HostContext, RunTrigger, SchedulerTask } from '../types'
import type { PermissionPresetService } from './permission-presets'
import { randomUUID } from 'node:crypto'
@@ -277,7 +278,7 @@ export async function executeTask(
// 3. 解析模型选择
const selection: ModelSelection | undefined = task.provider && task.model
- ? { provider: task.provider, model: task.model, ...(task.reasoningEffort ? { reasoningEffort: task.reasoningEffort } : {}) }
+ ? { provider: task.provider, model: task.model, ...(task.reasoningEffort ? { reasoningEffort: task.reasoningEffort as ReasoningEffortId } : {}) }
: ((): ModelSelection | undefined => {
try {
return (ctx.get?.('agentDefaultModel') as { currentSelection?: () => ModelSelection })?.currentSelection?.()
diff --git a/packages/dsh-tauri-panel-scheduler/src/types/dsh.d.ts b/packages/dsh-tauri-panel-scheduler/src/types/dsh.d.ts
deleted file mode 100644
index c7402dfb..00000000
--- a/packages/dsh-tauri-panel-scheduler/src/types/dsh.d.ts
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Host 运行时由 DSH 提供的最小编译期声明(对齐 MichengAI/dsh-automation 的 src/types/dsh.d.ts)。
- * 不引入任何 @deepseek-ai/dsh-* 运行时依赖 —— 这些模块由宿主在运行时解析。
- */
-
-declare module '@deepseek-ai/cordis' {
- export interface Context {
- // 刻意不声明 `agent`:`ctx.agent` 是 0.1.2 的 DX accessor,0.1.5-rc.1 已移除,
- // 此时读取会被 Cordis 代理抛出 `cannot get property "agent" without inject`。
- // Agent 只经 agents.create() 的 setup 第二参数获取(见 host/service/executor.ts)。
- readonly agents: any
- readonly agentDefaultModel: any
- readonly agentPresets: any
- readonly permissionPresets: import('../host/service/permission-presets.ts').PermissionPresetService
- readonly sessions: any
- readonly sessionTitle?: { rename: (session: unknown, title: string) => unknown }
- readonly workspaceRegistry: any
- readonly storageDomain: any
- readonly connection: any
- readonly tools: any
- readonly llm?: any
- readonly systemPrompt?: { section: (input: { name: string, order: number, text: string }) => () => void }
- readonly logger: { warn: (message: string) => void }
- effect: <T>(factory: () => T | Promise<T>, label?: string) => T
- on: (name: string, listener: (...args: any[]) => any) => () => void
- get: (name: string) => unknown
- }
-}
-
-declare module '@deepseek-ai/schemastery' {
- const z: any
- export default z
-}
-
-declare module '@deepseek-ai/dsh-agent' {
- export interface ModelSelection {
- provider: string
- model: string
- reasoningEffort?: string
- }
- export function installModelSelection(agentCtx: unknown, selection: {
- current: ModelSelection | undefined
- assembled: ModelSelection | undefined
- }): () => void
-}
-
-declare module '@deepseek-ai/dsh-agent-default-model' {}
-declare module '@deepseek-ai/dsh-agent-presets' {}
-declare module '@deepseek-ai/dsh-permission-presets' {}
-declare module '@deepseek-ai/dsh-client-connection' {}
-
-declare module '@deepseek-ai/dsh-client-ui-primitives' {
- import type { ReactNode } from 'react'
-
- export function Toast(props: { text: string, icon?: ReactNode, anchor?: HTMLElement | null, onDone: () => void }): JSX.Element
- export function Menu(props: { open: boolean, onClose: () => void, items: readonly any[], onSelect: (id: string) => void, selectedId?: string, portal?: boolean, align?: string, side?: string, anchor: ReactNode }): JSX.Element
- export function Modal(props: any): JSX.Element
- export function IconWarningOutline16(): JSX.Element
-}
-
-declare module '@deepseek-ai/dsh-llm' {
- export function createUserMessage(value: {
- content: readonly { type: 'text', text: string }[]
- source: unknown
- }): unknown
-}
-
-declare module '@deepseek-ai/dsh-session' {
- export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }
- export type SessionId = string & { readonly __sessionId: unique symbol }
- export function SessionId(value: string): SessionId
-}
-
-declare module '@deepseek-ai/dsh-user-approval' {
- export function setApprovalPolicy(session: unknown, policy: 'ask' | 'never'): void
-}
-
-declare module '@deepseek-ai/dsh-workspace' {
- export type WorkspaceId = string & { readonly __workspaceId: unique symbol }
- export function WorkspaceId(value: string): WorkspaceId
-}
-
-declare module '@deepseek-ai/dsh-storage-domain' {
- import type { ZodType } from 'zod'
-
- export interface DomainSpec {
- readonly name: string
- readonly version: number
- readonly tables: Record<string, { readonly valueSchema: ZodType }>
- }
- export function defineDomain<S extends DomainSpec>(spec: S): S
- export function domainTable<K extends string, V>(schema: ZodType<V>): {
- readonly valueSchema: ZodType<V>
- readonly __key?: K
- }
- export interface KvTable<K extends string, V> {
- get: (key: K) => V | undefined
- entries: () => IterableIterator<[K, V]>
- keys: () => IterableIterator<K>
- readonly size: number
- put: (key: K, value: V) => Promise<void>
- delete: (key: K) => Promise<boolean>
- update: (key: K, transform: (current: V) => V) => Promise<V>
- }
- export interface Domain<S> {
- readonly name: string
- table: (name: string) => KvTable<string, any>
- close: () => Promise<void>
- }
-}
-
-declare module '@deepseek-ai/dsh-tools' {
- export type { JsonValue } from '@deepseek-ai/dsh-session'
- export interface ToolRunContext {
- readonly signal: AbortSignal
- readonly agent?: { readonly id: string }
- }
- export interface ToolExecution {
- readonly name: string
- readonly arguments: unknown
- }
- export function defineTool(definition: any): any
-}
-
-declare module 'react-dom' {
- import type { ReactNode, ReactPortal } from 'react'
-
- export function createPortal(children: ReactNode, container: Element | DocumentFragment): ReactPortal
-}
diff --git a/packages/dsh-tauri-panel/src/client/register/panel-service.tsx b/packages/dsh-tauri-panel/src/client/register/panel-service.tsx
index d0defba7..80d17316 100644
--- a/packages/dsh-tauri-panel/src/client/register/panel-service.tsx
+++ b/packages/dsh-tauri-panel/src/client/register/panel-service.tsx
@@ -142,14 +142,10 @@ export function registerPanelService(ctx: ClientContext): void {
resetPanelWidth: () => controller.width.resetWidth(),
getPanelWidth: () => controller.width.getWidth(),
}
- if (typeof ctx.layout.openDetails === 'function')
- api.openDetails = () => ctx.layout.openDetails()
- if (typeof ctx.layout.closeDetails === 'function')
- api.closeDetails = () => ctx.layout.closeDetails()
if (typeof ctx.layout.openRightbar === 'function')
- api.openRightPanel = (track, fullscreen) => ctx.layout.openRightbar?.(track, fullscreen)
+ api.openRightPanel = (track, fullscreen) => ctx.layout.openRightbar(track, fullscreen)
if (typeof ctx.layout.closeRightbar === 'function')
- api.closeRightPanel = () => ctx.layout.closeRightbar?.()
+ api.closeRightPanel = () => ctx.layout.closeRightbar()
// Publish synchronously during apply: alpha slot injections can run before
// sibling effects, so publishing from inside ctx.effect makes consumers see
// an absent protocol and permanently skip their action registration.
diff --git a/packages/dsh-tauri-panel/src/client/register/sidebar.ts b/packages/dsh-tauri-panel/src/client/register/sidebar.ts
index 3ed4381a..bedbd34a 100644
--- a/packages/dsh-tauri-panel/src/client/register/sidebar.ts
+++ b/packages/dsh-tauri-panel/src/client/register/sidebar.ts
@@ -1,4 +1,4 @@
-import type { ClientContext, WorkspaceId } from 'dsh-tauri/client'
+import type { ClientContext, MainPanelId, WorkspaceId } from 'dsh-tauri/client'
import type { PanelListService } from '../service/panel-list'
import { defineRegister } from 'dsh-tauri/client'
import { SidebarRootClone } from '../components/sidebar'
@@ -52,7 +52,7 @@ export function registerSidebarRoot(ctx: ClientContext, panelList: PanelListServ
toggleSidebar: () => clientCtx.layout.toggleSidebar(),
selectPanel: (panelId: string | null) => {
// 旧核心没有全局面板:静默忽略,绝不向 ctx.layout 断言方法存在。
- clientCtx.layout.selectPanel?.(panelId)
+ clientCtx.layout.selectPanel?.(panelId as MainPanelId | null)
},
panels: panelList.store,
}),
diff --git a/packages/dsh-tauri-panel/src/client/service/panel-list.ts b/packages/dsh-tauri-panel/src/client/service/panel-list.ts
index eb8db7bb..6d3baea6 100644
--- a/packages/dsh-tauri-panel/src/client/service/panel-list.ts
+++ b/packages/dsh-tauri-panel/src/client/service/panel-list.ts
@@ -43,7 +43,7 @@ function resolveLabel(label: string | (() => string) | undefined): string | unde
function projectPanels(ctx: ClientContext): PanelListEntry[] | undefined {
let entries: readonly SlotEntryLike[] | undefined
try {
- entries = ctx.slots.entriesOfSlot?.(PANEL_LIST_SLOT)
+ entries = ctx.slots.entriesOfSlot?.(PANEL_LIST_SLOT as never)
}
catch {
// 未知 key / 版本不符的 slots 服务不应让侧栏整体崩掉:按「无注册」处理。
@@ -102,7 +102,7 @@ export function createPanelList(ctx: ClientContext): PanelListService {
panelList.setRows([])
sync()
if (available) {
- controller.add(ctx.slots.subscribe?.(PANEL_LIST_SLOT, sync) ?? (() => {}))
+ controller.add(ctx.slots.subscribe?.(PANEL_LIST_SLOT as never, sync) ?? (() => {}))
controller.add(ctx.locale.subscribe(sync))
}
}),
diff --git a/packages/dsh-tauri-panel/src/client/utils/official-panels.ts b/packages/dsh-tauri-panel/src/client/utils/official-panels.ts
index 35a05766..28b6631f 100644
--- a/packages/dsh-tauri-panel/src/client/utils/official-panels.ts
+++ b/packages/dsh-tauri-panel/src/client/utils/official-panels.ts
@@ -7,7 +7,7 @@
* 而我们的调用点常在注册/渲染流程中,所以调用前自查 `main` 的 key 集合。
*/
-import type { ClientContext } from 'dsh-tauri/client'
+import type { ClientContext, MainPanelId } from 'dsh-tauri/client'
import { PANEL_MAIN_SLOT } from '../constants'
/** 核心是否提供官方全局面板切换(selectPanel 存在 ⇔ 布局是 ≥0.1.5-rc.1)。 */
@@ -31,5 +31,5 @@ export function selectMainPanel(ctx: ClientContext, id: string): void {
console.error(`[dsh-tauri-panel] panel "${id}" is not registered in the "${PANEL_MAIN_SLOT}" slot`)
return
}
- ctx.layout.selectPanel?.(id)
+ ctx.layout.selectPanel?.(id as MainPanelId)
}
diff --git a/packages/dsh-tauri-session/src/client/types/runtime.ts b/packages/dsh-tauri-session/src/client/types/runtime.ts
index d3462a95..ecf535fe 100644
--- a/packages/dsh-tauri-session/src/client/types/runtime.ts
+++ b/packages/dsh-tauri-session/src/client/types/runtime.ts
@@ -1,3 +1,40 @@
-/** types/runtime.ts — 宿主运行时快照类型(ctx.sessions / ctx.workspaces 投影)。共享面见 dsh-tauri/client。 */
+/**
+ * types/runtime.ts — 宿主运行时快照投影(`ctx.sessions` / `ctx.workspaces`)。
+ *
+ * 【来源】`dsh-tauri/client` 转出的上游 controller 面
+ * (@deepseek-ai/dsh-api-session-controller/client、@deepseek-ai/dsh-api-workspace-controller/client,0.1.5-rc.2)。
+ * 上游用 branded `SessionId` 参与集合运算,插件侧一律处理裸字符串,故快照投影把 id
+ * 位放宽为 `string`;服务面直接取上游 `ISessions` / `IWorkspaces` 的成员子集。
+ */
-export type { SessionListSnapshot, SessionsRuntimeLike, SessionSummaryLike, WorkspaceListSnapshot, WorkspacesRuntimeLike, WorkspaceViewLike } from 'dsh-tauri/client'
+import type {
+ ISessions,
+ IWorkspaces,
+ SessionListState,
+ SessionSummary,
+ WorkspaceId,
+ WorkspaceSnapshot,
+ WorkspaceView,
+} from 'dsh-tauri/client'
+
+export type SessionSummaryLike = SessionSummary
+export type WorkspaceViewLike = WorkspaceView
+
+/** 会话列表快照投影(`sessions.list` 的 `getSnapshot()` 值,id 放宽为 string)。 */
+export type SessionListSnapshot = Omit<SessionListState, 'ids' | 'byId' | 'current'> & {
+ ids: string[]
+ byId: Record<string, SessionSummary>
+ current?: string
+}
+
+/** 工作区快照投影(`workspaces.list` 的 `getSnapshot()` 值)。 */
+export type WorkspaceListSnapshot = Pick<WorkspaceSnapshot, 'items' | 'archivedSessionIds'>
+
+/** 官方 sessions 服务面:列表订阅 + 刷新 + 打开 + 绑定 + fork。 */
+export type SessionsRuntimeLike = Pick<ISessions, 'list' | 'refresh' | 'open' | 'binding' | 'fork'>
+
+/** 官方 workspaces 服务面 + 桌面导航扩展(`manager` / `startSession` 为核心版本兼容扩展)。 */
+export type WorkspacesRuntimeLike = Pick<IWorkspaces, 'list' | 'archiveSession' | 'delete'> & {
+ manager?: { refresh?: () => Promise<void> }
+ startSession?: (workspaceId: WorkspaceId) => void
+}
diff --git a/packages/dsh-tauri-session/src/client/utils/archive-rows.ts b/packages/dsh-tauri-session/src/client/utils/archive-rows.ts
index e37fb1d9..2f12075a 100644
--- a/packages/dsh-tauri-session/src/client/utils/archive-rows.ts
+++ b/packages/dsh-tauri-session/src/client/utils/archive-rows.ts
@@ -50,7 +50,7 @@ export function buildRows(
continue
if (summary?.blank === true)
continue
- let workspace = workspaces.items.find(ws => ws.sessionIds.includes(sessionId))
+ let workspace = workspaces.items.find(ws => (ws.sessionIds as readonly string[]).includes(sessionId))
const cwd = summary?.cwd ?? entry?.cwd
if (!workspace && cwd)
workspace = byPath.get(cwd)
diff --git a/packages/dsh-tauri-worktree/src/client/register/dialog.ts b/packages/dsh-tauri-worktree/src/client/register/dialog.ts
index c2dadf16..7c23cdd5 100644
--- a/packages/dsh-tauri-worktree/src/client/register/dialog.ts
+++ b/packages/dsh-tauri-worktree/src/client/register/dialog.ts
@@ -28,6 +28,8 @@ export const dialogFeature = defineRegister<ClientContext>((controller, ctx, ada
sessionsRuntime: adapter.sessions as unknown as WorktreeDialogProps['sessionsRuntime'],
}),
},
- WorktreeDialog,
+ // WorktreeDialog 需要官方 session UI 提供的标准 prop `useSessions`;该包不在本
+ // workspace 的 d.ts 集合里,故注册面按已注册条目形状断言。
+ WorktreeDialog as never,
)))
})