DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
refactor: centralize official plugin types
hairyfa3670b22ebb8
diff --git a/packages/dsh-tauri-rightclick/src/client/service/menu.ts b/packages/dsh-tauri-rightclick/src/client/service/menu.tsindex e7c0dc9e..03d6a4e6 100644--- a/packages/dsh-tauri-rightclick/src/client/service/menu.ts+++ b/packages/dsh-tauri-rightclick/src/client/service/menu.ts@@ -157,7 +157,7 @@ export function installContextMenu(ctx: ClientContext): () => void {}else if (workspaceTarget) {const workspace = workspaceTarget.workspace- add(root, text('newSession'), () => workspaces.startSession(workspace.workspaceId))+ add(root, text('newSession'), () => workspaces.startSession?.(workspace.workspaceId))add(root, text('openInExplorer'), () => openInExplorer(workspace.path))split(root)add(root, text('renameWorkspace'), () => officialSelect(diff --git a/packages/dsh-tauri-rightclick/src/client/types/runtime.ts b/packages/dsh-tauri-rightclick/src/client/types/runtime.tsindex 00ea2452..8f1faf99 100644--- a/packages/dsh-tauri-rightclick/src/client/types/runtime.ts+++ b/packages/dsh-tauri-rightclick/src/client/types/runtime.ts@@ -1,19 +1,29 @@-/** runtime.ts — 右键菜单的运行时面:会话/工作区最小快照、扩展协议、事件 detail。 */+/**+ * client/types/runtime.ts — 右键菜单的运行时面与官方 controller 投影。+ *+ * 【来源】官方 `dsh-tauri/client` 的 `ISessions`、`IWorkspaces`、+ * `SessionListState`、`SessionSummary`、`WorkspaceSnapshot`、`WorkspaceView`。+ * 【版本】@deepseek-ai/[email protected];+ * @deepseek-ai/[email protected]。+ * 【修订】2026-01:删除重复的官方摘要/快照声明;仅保留右键菜单扩展协议,+ * 并把 alpha/桌面专属 `startSession` 标注为兼容扩展。+ */-/** 会话列表摘要(最小 `ctx.sessions.list` 快照面)。 */-export interface SessionSummaryLike {- id: string- title?: string- displayTitle?: string- cwd?: string- blank?: boolean-}+import type {+ ISessions,+ IWorkspaces,+ SessionId,+ SessionListState,+ SessionSummary,+ WorkspaceId,+ WorkspaceSnapshot,+ WorkspaceView,+} from 'dsh-tauri/client'-export interface SessionListSnapshotLike {- ids: string[]- byId: Record<string, SessionSummaryLike>- current?: string-}+export type { SessionId, SessionListState, SessionSummary, WorkspaceId, WorkspaceSnapshot, WorkspaceView }++export type SessionSummaryLike = SessionSummary+export type SessionListSnapshotLike = Pick<SessionListState, 'ids' | 'byId' | 'current'>/** 会话绑定(`ctx.sessions.binding` 返回面的最小子集)。 */export interface SessionBindingLike {@@ -22,37 +32,15 @@ export interface SessionBindingLike {}}-/** 最小 `ctx.sessions` 面(客户端用到的子集)。 */-export interface SessionsRuntimeLike {- list: {- getSnapshot: () => SessionListSnapshotLike- }- binding: (sessionId: string) => SessionBindingLike | undefined- fork: (opts: { sessionId: string, increaseTitle?: boolean }) => Promise<string>- open: (sessionId: string) => void-}--/** 工作区视图(`ctx.workspaces.list` 快照项)。 */-export interface WorkspaceViewLike {- workspaceId: string- title: string- path: string- sessionIds: string[]-}+/** 官方 sessions 服务加上右键菜单 fork 所需能力。 */+export type SessionsRuntimeLike = Pick<ISessions, 'list' | 'open' | 'binding' | 'fork'>-export interface WorkspaceListSnapshotLike {- items: WorkspaceViewLike[]- archivedSessionIds: string[]-}+export type WorkspaceViewLike = WorkspaceView+export type WorkspaceListSnapshotLike = Pick<WorkspaceSnapshot, 'items' | 'archivedSessionIds'>-/** 最小 `ctx.workspaces` 面(客户端用到的子集)。 */-export interface WorkspacesRuntimeLike {- list: {- getSnapshot: () => WorkspaceListSnapshotLike- }- archiveSession: (sessionId: string) => Promise<void>- startSession: (workspaceId: string) => void- delete: (workspaceId: string) => Promise<void>+/** 官方 workspaces 服务加上 alpha/桌面导航兼容扩展。 */+export type WorkspacesRuntimeLike = Pick<IWorkspaces, 'list' | 'archiveSession' | 'delete'> & {+ startSession?: (workspaceId: WorkspaceId) => void}/** 右键菜单扩展协议:其他 Web 插件登记到全局注册表的一条扩展项。 */diff --git a/packages/dsh-tauri-session/src/client/types/index.ts b/packages/dsh-tauri-session/src/client/types/index.tsindex 30e05f86..e9146ca2 100644--- a/packages/dsh-tauri-session/src/client/types/index.ts+++ b/packages/dsh-tauri-session/src/client/types/index.ts@@ -8,4 +8,3 @@export * from './archive'export * from './locale'export * from './runtime'-export * from './ui'diff --git a/packages/dsh-tauri-session/src/client/types/ui.ts b/packages/dsh-tauri-session/src/client/types/ui.tsdeleted file mode 100644index 46e04da1..00000000--- a/packages/dsh-tauri-session/src/client/types/ui.ts+++ /dev/null@@ -1,25 +0,0 @@-/** types/ui.ts — 通用 UI 组件类型(图标 / 下拉选择器)。 */--/** Shared props for the local gravity-ui icon components. */-export interface IconProps {- size?: number- className?: string-}--/** One option of the official-style dropdown (primitives Menu select). */-export interface MenuSelectOption {- id: string- label: string-}--/** Props for the official-style `Menu`-based select trigger. */-export interface MenuSelectProps {- /** Selected option id. */- value: string- /** Ordered options. */- options: MenuSelectOption[]- /** Called with the picked option id. */- onSelect: (id: string) => void- /** Accessible trigger name (aria-label). */- label: string-}diff --git a/packages/dsh-tauri-worktree/src/client/types/runtime.ts b/packages/dsh-tauri-worktree/src/client/types/runtime.tsindex 14843d4d..40a96b4a 100644--- a/packages/dsh-tauri-worktree/src/client/types/runtime.ts+++ b/packages/dsh-tauri-worktree/src/client/types/runtime.ts@@ -1,4 +1,28 @@-/** types/runtime.ts — 宿主运行时快照与槽位注入类型。 */+/**+ * client/types/runtime.ts — 工作树客户端协议与官方 controller 类型。+ *+ * 【来源】官方 `dsh-tauri/client` 的 `ISessions`、`IWorkspaces`、+ * `SessionListState`、`WorkspaceSnapshot`、`WorkspaceView`。+ * 【版本】@deepseek-ai/[email protected];+ * @deepseek-ai/[email protected]。+ * 【修订】2026-01:官方 branded id 在 DOM/HTTP 字符串边界通过本地 adapter 投影,+ * 删除原先把官方服务重新手写成无来源运行时接口的做法。+ */++import type { SessionListState } from 'dsh-tauri/client'++export type { SessionListState }++/** Stable local projection used at the worktree's string-id boundary. */+export interface WorkspaceView {+ workspaceId: string+ path: string+ sessionIds: readonly string[]+}++export interface WorkspaceSnapshot {+ items: readonly WorkspaceView[]+}export interface InputState {draft: string@@ -12,11 +36,11 @@ export interface InputActions {submit: () => void}+/** 工作树 DOM/槽位 adapter:内部把字符串 id 转换到官方 branded controller。 */export interface SessionsRuntime {create: (opts: { cwd: string, sessionId: string }) => Promise<string>open: (sessionId: string) => voidprovideInfo: (sessionId: string) => { props?: { inputActions?: InputActions } } | undefined- /** 刷新会话列表(宿主侧 seed 创建的会话会发布进来;本插件在 waitForSessionListed 中调用)。 */refresh: () => Promise<void>list: { getSnapshot: () => { ids: string[], current?: string } }}@@ -34,12 +58,14 @@ export interface SurfaceBarProps {sessionId: string}+/** 官方 WorkspaceView 的工作树消费投影;id 在 adapter 边界保持字符串。 */export interface WorkspaceSessionOrder {workspaceId: stringpath: stringsessionIds: readonly string[]}+/** 工作树调用的官方 Workspace controller adapter。 */export interface WorkspacesRuntime {archiveSession: (sessionId: string) => Promise<void>list: { getSnapshot: () => { items: WorkspaceSessionOrder[] } }@@ -56,6 +82,7 @@ export interface WorktreeDialogProps {workspacesRuntime: WorkspacesRuntime}+/** 官方 SessionListState 的工作树 adapter 子集。 */export interface DialogListState {phase: stringcurrent?: stringdiff --git a/packages/dsh-tauri/src/client/types/agent.ts b/packages/dsh-tauri/src/client/types/agent.tsnew file mode 100644index 00000000..011dd2e8--- /dev/null+++ b/packages/dsh-tauri/src/client/types/agent.ts@@ -0,0 +1,8 @@+/**+ * 官方 Agent/Tools 类型统一客户端出口。+ * 【来源】@deepseek-ai/dsh-agent、@deepseek-ai/dsh-tools 官方 d.ts。+ * 【版本】[email protected];[email protected]。+ * 【修订】2026-01:新增 dsh-tauri type-only 出口,运行时仍由 loader 注入。+ */+export type { ModelSelection } from '@deepseek-ai/dsh-agent'+export type { ToolExecution, ToolRunContext } from '@deepseek-ai/dsh-tools'diff --git a/packages/dsh-tauri/src/client/types/index.ts b/packages/dsh-tauri/src/client/types/index.tsindex 611d8df2..3287de25 100644--- a/packages/dsh-tauri/src/client/types/index.ts+++ b/packages/dsh-tauri/src/client/types/index.ts@@ -1,7 +1,7 @@+export * from './agent'export * from './bridge'export * from './context'export * from './global'export * from './inject'+export * from './json'export * from './runtime'-// Loads the alpha slot standard-props compat augmentation.-export * from './slots'diff --git a/packages/dsh-tauri/src/client/types/json.ts b/packages/dsh-tauri/src/client/types/json.tsnew file mode 100644index 00000000..25166375--- /dev/null+++ b/packages/dsh-tauri/src/client/types/json.ts@@ -0,0 +1,8 @@+/**+ * 官方 branded id 与 JSON 类型统一出口。+ * 【来源】@deepseek-ai/dsh-session、@deepseek-ai/dsh-workspace 官方 d.ts。+ * 【版本】dsh-session/[email protected]。+ * 【修订】2026-01:新增 dsh-tauri type-only 出口。+ */+export type { JsonValue, SessionId } from '@deepseek-ai/dsh-session'+export type { WorkspaceId } from '@deepseek-ai/dsh-workspace'diff --git a/packages/dsh-tauri/src/client/types/runtime.ts b/packages/dsh-tauri/src/client/types/runtime.tsindex 7be6286a..70a53aa4 100644--- a/packages/dsh-tauri/src/client/types/runtime.ts+++ b/packages/dsh-tauri/src/client/types/runtime.ts@@ -1,36 +1,15 @@-import type {- ISessions,- SessionListState,- SessionSummary,-} from '@deepseek-ai/dsh-api-session-controller/client'-import type {- IWorkspaces,- WorkspaceId,-} from '@deepseek-ai/dsh-api-workspace-controller/client'+/**+ * 官方 controller 客户端类型统一出口。+ * 【来源】@deepseek-ai/dsh-api-session-controller/client 与+ * @deepseek-ai/dsh-api-workspace-controller/client。+ * 【版本】当前 lockfile 解析版本 0.1.2-alpha.3。+ * 【修订】2026-01:删除重复快照接口;startSession 仅保留为兼容扩展。+ */+import type { ISessions, SessionListState, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/client'+import type { IWorkspaces, WorkspaceSnapshot, WorkspaceSource, WorkspaceView } from '@deepseek-ai/dsh-api-workspace-controller/client'import type { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client'+import type { WorkspaceId as WorkspaceIdType } from './json'-/** Real runtime slot registry contract (alpha: ui-renderer owns the Service layer). */-export type { SlotRegistry }-/** Real runtime session list state and summary contracts. */-export type { SessionListState, SessionSummary }-/** Real runtime workspace identifier contract. */-export type { WorkspaceId }-/** Real runtime outward session/workspace faces. */-export type { ISessions, IWorkspaces }--/** Runtime session service projection used by legacy plugin helpers. */-export interface SessionsRuntime {- list: {- getSnapshot: () => unknown- subscribe: (listener: () => void) => () => void- }-}--/** Runtime workspace service projection used by legacy plugin helpers. */-export interface WorkspacesRuntime {- list: {- getSnapshot: () => unknown- subscribe: (listener: () => void) => () => void- }- startSession: (workspaceId?: WorkspaceId) => void-}+export type { ISessions, IWorkspaces, SessionListState, SessionSummary, SlotRegistry, WorkspaceSnapshot, WorkspaceSource, WorkspaceView }+export type SessionsRuntime = ISessions+export type WorkspacesRuntime = IWorkspaces & { startSession?: (workspaceId?: WorkspaceIdType) => void }diff --git a/packages/dsh-tauri/src/client/types/slots.ts b/packages/dsh-tauri/src/client/types/slots.tsdeleted file mode 100644index ca213980..00000000--- a/packages/dsh-tauri/src/client/types/slots.ts+++ /dev/null@@ -1,30 +0,0 @@-/**- * slots.ts — Alpha 兼容垫片:恢复 rc.2 客户端槽系统的「标准 props」类型契约。- *- * rc.2 的 `dsh-client-runtime` 通过 `declare module '@deepseek-ai/dsh-client-ui-slots'`- * 把 `useSessions`/`useWorkspaces`/`useSession`/`sessionId`/`useProjection` 合并进- * `GlobalStandardProps`/`SessionStandardProps`/`SessionMaybeStandardProps`,使各插件- * 的槽组件 props 能声明这些标准钩子。alpha.3 的 `dsh-client-ui-slots` 把这三个 seat- * 接口留空(具体成员由框架侧 UI 包——如 `dsh-client-ui-session`——合并),但桌面端- * 插件(`dsh-tauri-panel` 独立行之外)并未安装这些 UI 系包。- *- * 本文件以「编译期类型契约」的形式恢复这些标准成员(运行时仍由框架注入,行为与- * rc.2 一致),从而让桌面端插件在 alpha.3 编译下不改写槽组件即可通过类型检查。- * 这是纯类型增广:不产生任何运行时副作用,向后兼容,alpha 与 rc.2 均安全。- */--import type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client'-import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'--declare module '@deepseek-ai/dsh-client-ui-slots' {- /** 全局标准 seat:每个 root 作用域槽组件都收到这些钩子。 */- interface GlobalStandardProps {- /**- * 会话列表快照选择器(rc.2 `useSessions` 标准钩子)。运行时由框架注入,- * 事件来自 `ctx.sessions.list` 快照源。- */- useSessions: SnapshotSelectorHook<ReturnType<ISessions['list']['getSnapshot']>>- }-}--export {}diff --git a/packages/dsh-tauri/src/host/types/index.ts b/packages/dsh-tauri/src/host/types/index.tsindex 2a361d6e..c43f0044 100644--- a/packages/dsh-tauri/src/host/types/index.ts+++ b/packages/dsh-tauri/src/host/types/index.ts@@ -1,16 +1,27 @@/**- * host/types.ts — dsh-tauri 宿主侧共享类型(HTTP 路由契约)。- * 插件宿主模块(worktree/session/panel-extension 等)经 `dsh-tauri` 导入使用。+ * dsh-tauri 宿主共享类型出口。+ * 【来源】HTTP 是桌面端自报协议;其余服务类型来自官方 @deepseek-ai d.ts。+ * 【版本】[email protected];session/tools/[email protected]。+ * 【修订】2026-01:收口 HostContext 与 HTTP fallback,均为 type-only。*/-+import type { Context } from '@deepseek-ai/cordis'+import type { AgentRegistry, ModelSelection } from '@deepseek-ai/dsh-agent'+import type { ContentBlock, LlmRuntime } from '@deepseek-ai/dsh-llm'+import type { SessionStore } from '@deepseek-ai/dsh-session'+import type { ToolDefinition, ToolRuntime } from '@deepseek-ai/dsh-tools'+import type { WorkspaceRegistry } from '@deepseek-ai/dsh-workspace'import type { IncomingMessage, ServerResponse } from 'node:http'export type JsonBody = Record<string, unknown>export type RouteResult = [number, unknown]export type RouteFunction = (body: JsonBody, req: IncomingMessage) => Promise<RouteResult>export type RouteHandler = (request: IncomingMessage, response: ServerResponse) => void | Promise<void>--/** DSH Connection 的浏览器信任与鉴权边界(路由注册时包装用)。 */-export interface ConnectionGate {- requestRejection: (request: IncomingMessage) => 401 | 403 | undefined-}+export interface ConnectionGate { requestRejection: (request: IncomingMessage) => 401 | 403 | undefined }+export interface HostRoute { kind: 'exact', path: string, handler: RouteHandler }+export interface AgentDefaultModelService { currentSelection?: () => ModelSelection | undefined }+export interface AgentPresetsService { mount?: (agentCtx: unknown, presetId: string) => Promise<unknown> | unknown }+export interface PermissionPresetsService { names: readonly string[], defaultPreset: string, optionOf: (name: string) => { value: string, name: string, description?: string }, set: (session: unknown, name: string) => void }+export interface WebServerService { register: (route: HostRoute) => () => void }+export interface ToolRegistrationService { register: (definition: ToolDefinition | unknown) => () => void | undefined }+export type HostContext = Context & { agents: AgentRegistry, sessions: SessionStore, workspaceRegistry: WorkspaceRegistry, tools: ToolRuntime & ToolRegistrationService, webServer: WebServerService, connection?: ConnectionGate, llm?: LlmRuntime, agentDefaultModel?: AgentDefaultModelService, agentPresets?: AgentPresetsService, permissionPresets?: PermissionPresetsService, loader: { import: (name: string) => Promise<unknown>, unwrapExports: (exports: unknown) => unknown } }+export type { AgentRegistry, ContentBlock, LlmRuntime, ModelSelection, SessionStore, ToolDefinition, ToolRuntime, WorkspaceRegistry }diff --git a/packages/dsh-tauri/src/index.ts b/packages/dsh-tauri/src/index.tsindex b3070c94..f5874608 100644--- a/packages/dsh-tauri/src/index.ts+++ b/packages/dsh-tauri/src/index.ts@@ -18,3 +18,9 @@ export * from './host/service/open.js'export * from './host/storage/index.js'export * from './host/types/index.js'export * from './host/utils/http.js'+export type { Context } from '@deepseek-ai/cordis'+export type { AgentHandle, ModelSelection } from '@deepseek-ai/dsh-agent'+export type { ContentBlock, MessageSource, UserMessage } from '@deepseek-ai/dsh-llm'+export type { JsonValue, SessionId } from '@deepseek-ai/dsh-session'+export type { ToolDefinition, ToolExecution, ToolRunContext } from '@deepseek-ai/dsh-tools'+export type { WorkspaceId } from '@deepseek-ai/dsh-workspace'