fix(market): 移除公开版 cordis peer 并迁移类型基底到 @deepseek-ai/cordis

DSH 市场(dsh-community-market)预览硬拒依赖字段出现 'cordis'
(dependencies/peerDependencies/optionalDependencies 任一字段、
optional 均无效),导致 dshfind/1024Store 目录拿不到
repository_backlink 验证目标,点击安装报
"This catalog item has no verified install target"。

- package.json: 删除 cordis peer + peerDependenciesMeta;版本 0.15.2
- context-types.ts: Context 基底改 @deepseek-ai/cordis,结构服务面改
  交集(避免 DS host/client 对同一成员类型不同导致的 TS2717 merge
  冲突),仅保留 betterSidebar 的 module augmentation;删除
  declare module 'cordis'
- client/index.tsx: 4 处 effect 体失败分支改返回 no-op disposer
  (vendored cordis effect 契约拒绝 undefined 形状)
- 新增 tests/market-manifest.spec.ts:无 cordis 依赖字段、打包产物
  无生命周期脚本、bundle patch 安全路径、仓库身份、精确稳定版本
- 消费者检查扩展:@deepseek-ai/cordis 路径的 Context augmentation
  断言;文档示例同步迁移
This commit is contained in:
Menghuan1918
2026-08-23 00:26:39 +08:00
parent 22a5d372be
commit ddb66c9c08
12 changed files with 251 additions and 135 deletions
+4 -4
View File
@@ -259,7 +259,7 @@ export function apply(ctx: Context): void {
return registerTurnTailInterception(ctx, sidebarStore)
} catch (error) {
fail('interception', error)
return undefined
return () => {}
}
},
'dsh-better-sidebar: turn-tail interception',
@@ -271,7 +271,7 @@ export function apply(ctx: Context): void {
return registerOpenPathInterception(ctx, sidebarStore)
} catch (error) {
fail('interception', error)
return undefined
return () => {}
}
},
'dsh-better-sidebar: open-path interception',
@@ -315,7 +315,7 @@ export function apply(ctx: Context): void {
})
} catch (error) {
fail('interception', error)
return undefined
return () => {}
}
},
'dsh-better-sidebar: link interception',
@@ -335,7 +335,7 @@ export function apply(ctx: Context): void {
return registerImeGuard()
} catch (error) {
fail('ime guard', error)
return undefined
return () => {}
}
},
'dsh-better-sidebar: IME composition guard',
+1 -1
View File
@@ -470,7 +470,7 @@ export function matchUrlTarget(tabs: readonly TabDescriptor[], url: URL): TabDes
* The plugin version this service instance reports. Keep in lockstep with
* `package.json`'s version — `tests/service.spec.ts` asserts the pair.
*/
export const SIDEBAR_SERVICE_VERSION = '0.15.1'
export const SIDEBAR_SERVICE_VERSION = '0.15.2'
/**
* Monotonic capability list consumers use to gate new API usage (features
+87 -103
View File
@@ -1,31 +1,34 @@
/**
* Structural types for the cordis services this plugin consumes, plus the
* Context augmentation both halves share. A third-party plugin resolves
* outside the DSH monorepo's single cordis instance, so the upstream
* `declare module 'cordis'` augmentations do not reach this Context — and
* the npm cordis package does not declare the DSH-vendored runtime members
* (`ctx.effect`, service properties). The members below mirror the actual
* runtime shapes this plugin touches:
* - webServer: @deepseek-ai/dsh-host-webserver (the WebServer)
* - sessions: host side @deepseek-ai/dsh-session (SessionStore), client
* side the runtime ISessions list feed
* - conversation: client side ui-conversation's IConversation (composer
* draft), read lazily through `ctx.get` — cross-plugin service reads need
* an inject declaration, so the direct property is never typed here
* - webRuntime: @deepseek-ai/dsh-web-app (bind-derived trusted hosts)
* - slots: the client runtime SlotRegistry
* - effect: the DSH-vendored cordis lifecycle helper
* Drift from upstream is contained to this file.
* Context face both halves share.
*
* The type base is the vendored `@deepseek-ai/cordis` Context (the runtime
* DSH actually runs); the service members this plugin touches are restated
* below as structural mirrors and combined with the base by INTERSECTION.
* Intersection (not `declare module` augmentation) is deliberate: DSH's own
* packages already augment `@deepseek-ai/cordis`, and the host and client
* packages declare *different* types for the same member — host
* `sessions: SessionStore` vs client runtime `sessions: ISessions` — so a
* single program that re-declares them would fail interface merging
* (TS2717). Intersecting keeps every face available and lets each call site
* resolve against the member it needs without any module-level conflict.
*
* `effect`, `get`, `provide`, `inject`, `logger`, `emit`, `isolate` and the
* event helpers come from the vendored cordis base and are intentionally NOT
* restated here: their strict shapes are the runtime contract (e.g. an
* effect body must return a disposer). Only the string-keyed session-feed
* `on` overload is added, because the cordis `on` is keyed to its own
* typed `Events` map and the harness session feed is a plain string event.
*
* This file must stay FREE of Node.js types (`node:http`, `node:stream`,
* `Buffer`): it is part of the CLIENT-reachable declaration graph (the
* `Context` in `TabComponentProps` and the `declare module` augmentation),
* `Context` in `TabComponentProps` and the `betterSidebar` augmentation),
* so a Node import here would leak into browser-only consumer builds. The
* webServer faces below are therefore structural mirrors with plain
* interfaces (the host casts to real Node types at the few boundaries that
* need them — e.g. the `ws` upgrade hook in src/index.ts).
*/
import type { Context } from 'cordis'
import type { Context as CordisContext } from '@deepseek-ai/cordis'
import type { BetterSidebarService } from './client/service.ts'
/** The request face route handlers see (structural subset of node's
@@ -514,97 +517,78 @@ export interface SidebarAgent {
}
}
declare module 'cordis' {
interface Context {
webServer: SidebarWebServer
sessions: SidebarSessionStore & SidebarSessionsService
connection: SidebarConnectionHandle
webRuntime: SidebarWebRuntime
slots: SidebarSlotsService
workspaces: SidebarWorkspacesService
settings: SidebarSettingsService
invariants: SidebarInvariantsService
tools: SidebarToolsService
/**
* The client locale service (`@deepseek-ai/dsh-client-locale`): the
* sidebar's copy follows its active locale and registers its
* dictionaries under the `betterSidebar` namespace. Client side only.
*/
locale: SidebarLocaleService
/**
* The client module system (rc.8+): resolves module-table specifiers
* (seed words, graph rows) — the chunk loader's externals go through it
* (`ctx.modules.import`). rc.7 exposed the same surface as the
* `window.__DSH_MODULES__` page global; the loader keeps that fallback.
*/
modules: { import(specifier: string): Promise<unknown> }
/**
* The host background-job registry (`ctx.get('jobs')`; optional — the
* sidebar routes degrade to a 503 when the deployment lacks it).
*/
jobs: SidebarJobsService
/**
* The host live-agent registry (`ctx.get('agents')`; optional — used to
* resolve the caller the jobs fence compares against, and to create /
* resume the Side Chat thread agents).
*/
agents: SidebarAgentsService
/**
* The host subagent runtime (`ctx.subagents`; optional — the Subagent
* page's live batch route reads descendant catalogs through it).
*/
subagents: SidebarSubagentsService
/**
* The host agent-presets service (`ctx.get('agentPresets')`; optional —
* absent deployments compose nothing and every session shares the host
* composition).
*/
agentPresets: SidebarAgentPresetsService
/**
* The host session-title service (`ctx.get('sessionTitle')`; optional —
* the Side Chat thread label pin degrades to the auto-generated title).
*/
sessionTitle: SidebarSessionTitleService
/**
* The host session-persistence service (`ctx.get('sessionPersistence')`;
* optional — needed only for the Side Chat cold-resume composition).
*/
sessionPersistence: SidebarSessionPersistenceService
/**
* The client-side sidebar registry: external plugins register tab types
* and file previewers here. Provided by the client half (see
* {@link ./client/index.tsx}); undefined on the host side.
*/
betterSidebar: BetterSidebarService
/**
* Subscribe to the session append feed (mirror of the cordis event API):
* the listener receives every appended session event with the LIVE
* Session instance that appended it. The api-proxy pushes the same feed
* to browsers; the sidebar uses it to mirror job_output events the
* session store's own log can lag behind (restart divergence). Returns
* the disposer.
*/
on(event: string, listener: (session: unknown, event: SidebarSessionEvent) => void): () => void
/**
* Register a lifecycle callback (DSH-vendored cordis): runs at plugin
* activation; its returned cleanup runs at disposal.
*/
effect(fn: () => void | (() => void), label?: string): void
}
/**
* The shape this plugin actually consumes, intersected with the vendored
* cordis `Context` below (see the file header for why intersection is used
* instead of module augmentation).
*/
export interface SidebarContextShape {
/** The webServer service face this plugin uses. */
webServer: SidebarWebServer
/** The session store (host `.get`) and the client list feed (`.list`) faces. */
sessions: SidebarSessionStore & SidebarSessionsService
/** The wire handle the Side Chat transcript polls through. */
connection: SidebarConnectionHandle
/** The web runtime trust list (bind-derived). */
webRuntime: SidebarWebRuntime
/** The client slot registry (register/inject). */
slots: SidebarSlotsService
/** The client workspaces service face (file-open funnel). */
workspaces: SidebarWorkspacesService
/** The settings service face (prefs persistence + namespace reads). */
settings: SidebarSettingsService
/** The invariant registry face. */
invariants: SidebarInvariantsService
/** The tool registry face. */
tools: SidebarToolsService
/** The client locale service face. */
locale: SidebarLocaleService
/** The client module system (rc.8+ chunk-loader externals). */
modules: { import(specifier: string): Promise<unknown> }
/** The host background-job registry (optional; routes degrade to 503). */
jobs: SidebarJobsService
/** The host live-agent registry (optional; side chat thread agents). */
agents: SidebarAgentsService
/** The host subagent runtime (optional; live topology batch route). */
subagents: SidebarSubagentsService
/** The host agent-presets service (optional; side chat cold resume). */
agentPresets: SidebarAgentPresetsService
/** The host session-title service (optional; side chat thread label pin). */
sessionTitle: SidebarSessionTitleService
/** The host session-persistence service (optional; side chat cold resume). */
sessionPersistence: SidebarSessionPersistenceService
/** The composer draft face (client ui-conversation, lazy `ctx.get` probe). */
conversation: SidebarConversation
/**
* The client-side sidebar registry: external plugins register tab types
* and file previewers here. Provided by the client half (see
* {@link ./client/index.tsx}); undefined on the host side.
*/
betterSidebar: BetterSidebarService
/**
* String-keyed session feed subscribe (the vendored cordis `on` is keyed
* to its typed Events map; the harness session feed is a plain string
* event). The listener receives every appended session event with the
* LIVE Session instance that appended it.
*/
on(event: string, listener: (session: unknown, event: SidebarSessionEvent) => void): () => void
}
/**
* Dual cordis-scope augmentation: DSH's runtime (and the public packages)
* resolve against the vendored `@deepseek-ai/cordis` scope, which DSH's own
* packages already augment with `effect`/`on`/service members. This side only
* adds the sidebar service member so consumers importing `Context` from
* `@deepseek-ai/cordis` (instead of the public `cordis` above) still see
* `ctx.betterSidebar`.
* The Context this plugin sees: the vendored cordis Context intersected with
* the structural service faces above. Re-exported from the package root so a
* consumer can `import type { Context } from 'dsh-better-sidebar'`.
*/
export type Context = CordisContext & SidebarContextShape
/**
* Consumer-facing augmentation (deliberately the only one kept): a plugin
* that imports `Context` from `@deepseek-ai/cordis` and does
* `import type {} from 'dsh-better-sidebar'` sees `ctx.betterSidebar`
* without importing this package's own Context type.
*/
declare module '@deepseek-ai/cordis' {
interface Context {
betterSidebar: BetterSidebarService
}
}
export type { Context }
+4 -2
View File
@@ -54,8 +54,10 @@ import { readJsonBody, requireString, SidebarError, writeError, writeJson, write
export { Config }
export type { SidebarConfig, ResolvedSidebarConfig }
// Re-export the Context augmentation (declare module 'cordis') so consumers
// `import type {} from 'dsh-better-sidebar'` and gain `ctx.betterSidebar`.
// Re-export the Context augmentation (`declare module '@deepseek-ai/cordis'`)
// so consumers `import type {} from 'dsh-better-sidebar'` and gain
// `ctx.betterSidebar`; the Context re-export below is the vendored cordis
// Context intersected with the structural service faces.
// Also re-export the service descriptor types so consumers can type their
// registerTab / registerFileViewer arguments without reaching into /client.
export type { Context } from './context-types.ts'