浏览代码

refactor(gui): source SessionProjectionMap from the interface package's pure-type outlet

Swap the client runtime's parallel-construction placeholder for
import type from @deepseek-ai/dsh-session-projection/types — the zero-import
outlet, never the package root, whose dsh-agent → dsh-session chain would drag
the host Context.sessions merge into the client program. One type table end to
end (host provider, wire block, client cell, React hook); the spec's test key
now declare-merges the real module. Adds the workspace dep and the tsconfig
project reference.
imccyu 2 月之前
父节点
当前提交
95a3794e68

+ 1 - 0
packages/client/runtime/package.json

@@ -36,6 +36,7 @@
     "@deepseek-ai/dsh-host-apiproxy": "workspace:^",
     "@deepseek-ai/dsh-llm": "workspace:^",
     "@deepseek-ai/dsh-session": "workspace:^",
+    "@deepseek-ai/dsh-session-projection": "workspace:^",
     "immer": "^10.1.1",
     "react": "^18.2.0",
     "zustand": "~4.4.7"

+ 8 - 12
packages/client/runtime/src/client/sessions/projection-cell.ts

@@ -8,21 +8,17 @@
  * (useProjection) happens in web-react.
  */
 import type { SessionEvent } from '@deepseek-ai/dsh-session/types'
+import type { SessionProjectionMap } from '@deepseek-ai/dsh-session-projection/types'
 import type { ObservableSnapshot } from '../contract/store.ts'
 import { Notifier } from './notifier.ts'
 
-/**
- * The single projection type table, typed end to end (host provider, wire
- * block, client cell, React hook). Domain packages merge their keys in.
- *
- * TODO(gui): switch to `import type { SessionProjectionMap } from
- * '@deepseek-ai/dsh-session-projection'` (pure type-only edge) once the host
- * interface package lands; this placeholder is structurally identical and
- * exists only because the two bases are built in parallel. No second
- * client-side "views" table — one map end to end (user ruling, RFC
- * Alternatives).
- */
-export interface SessionProjectionMap {}
+// The single projection type table, typed end to end (host provider, wire
+// block, client cell, React hook) — the interface package's pure-type outlet
+// (`/types`, zero imports), never the package root: the root's dsh-agent →
+// dsh-session chain would drag the host `Context.sessions` merge into the
+// client program (one program must not hold both sides). No second
+// client-side "views" table (user ruling, RFC Alternatives).
+export type { SessionProjectionMap } from '@deepseek-ai/dsh-session-projection/types'
 
 /**
  * Minimal validating-schema face (zod-compatible: `ZodType<T>` satisfies it

+ 3 - 3
packages/client/runtime/tests/projection-cell.spec.ts

@@ -15,9 +15,9 @@ import { SessionsService } from '../src/client/sessions/service.ts'
 import { FakeApiClient, ok } from './fake-api.ts'
 import { entries, plainTurn } from './event-script.ts'
 
-// Test-domain key merged into the (placeholder) projection map: a whole-value
-// marker list, the smallest last-wins shape.
-declare module '../src/client/sessions/projection-cell.ts' {
+// Test-domain key merged into the projection map (the interface package's
+// pure-type outlet): a whole-value marker list, the smallest last-wins shape.
+declare module '@deepseek-ai/dsh-session-projection/types' {
   interface SessionProjectionMap {
     'test/marks': { marks: string[] }
   }

+ 3 - 0
packages/client/runtime/tsconfig.json

@@ -23,6 +23,9 @@
     {
       "path": "../../host/apiproxy"
     },
+    {
+      "path": "../../session-projection/session-projection"
+    },
     {
       "path": "../../llm/llm"
     },