feat: single-source projection keys via domain ./client/types pure outlets
This commit is contained in:
@@ -15,12 +15,17 @@
|
||||
"types": "./lib/types/invariant.d.ts",
|
||||
"default": "./lib/invariant.js"
|
||||
},
|
||||
"./client/types": {
|
||||
"types": "./lib/types/client/types.d.ts",
|
||||
"default": "./lib/types/client/types.js"
|
||||
},
|
||||
"./src/*": "./src/*",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"lib/index.js",
|
||||
"lib/invariant.js",
|
||||
"lib/types/**/*.js",
|
||||
"lib/types/**/*.d.ts",
|
||||
"lib/types/**/*.d.ts.map",
|
||||
"src"
|
||||
|
||||
24
packages/todo/tool-todo/src/client/types.ts
Normal file
24
packages/todo/tool-todo/src/client/types.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Pure-type client outlet of the todo domain: the ONE home of the `todos`
|
||||
* projection-key declaration, importable from client aggregates without
|
||||
* dragging this package's host-side value imports (dsh-tools, zod). The host
|
||||
* entry (`index.ts`) imports this module type-only to reuse the same merge —
|
||||
* one declaration serves both program sides.
|
||||
*
|
||||
* @module @deepseek-ai/dsh-tool-todo/client/types
|
||||
*/
|
||||
|
||||
import type { TodoItem } from '@deepseek-ai/dsh-session/types'
|
||||
|
||||
export type { TodoItem } from '@deepseek-ai/dsh-session/types'
|
||||
|
||||
declare module '@deepseek-ai/dsh-session-projection/types' {
|
||||
interface SessionProjectionMap {
|
||||
/**
|
||||
* The agent's current whole todo list (the latest `todo/write` snapshot),
|
||||
* or `null` before the first write. Whole-value rule: every `todo/write`
|
||||
* carries the complete replacement list, so the fold is last-wins.
|
||||
*/
|
||||
todos: TodoItem[] | null
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,12 @@ import { defineTool } from '@deepseek-ai/dsh-tools'
|
||||
import type { TodoItem } from '@deepseek-ai/dsh-session'
|
||||
// Type-only: resolves ctx.sessionProjections for the optional unit child.
|
||||
import type {} from '@deepseek-ai/dsh-session-projection'
|
||||
|
||||
declare module '@deepseek-ai/dsh-session-projection/types' {
|
||||
interface SessionProjectionMap {
|
||||
/**
|
||||
* The agent's current whole todo list (the latest `todo/write` snapshot),
|
||||
* or `null` before the first write. Whole-value rule: every `todo/write`
|
||||
* carries the complete replacement list, so the fold is last-wins.
|
||||
*/
|
||||
todos: TodoItem[] | null
|
||||
}
|
||||
}
|
||||
// The `todos` projection-key declaration lives in the client outlet (its one
|
||||
// home). A PLAIN side-effect import, not `import type`: declaration emit
|
||||
// elides type-only imports, and the aggregate programs resolve this package
|
||||
// through its emitted declarations — the merge must survive in index.d.ts.
|
||||
// The imported module is types-only, so the runtime edge is an empty module.
|
||||
import './client/types.ts'
|
||||
|
||||
export const name = 'tool-todo'
|
||||
export const inject = ['tools']
|
||||
|
||||
Reference in New Issue
Block a user