This commit is contained in:
07akioni
2026-08-18 20:04:18 +08:00
parent b8670e3fbe
commit 996f6e49a5
7 changed files with 26 additions and 22 deletions
+2 -8
View File
@@ -1,5 +1,5 @@
/** Register the Tool call tree, details renderer, and built-in atomic views. */
import type { ConnectionHandle, HostDescriptionSource } from '@deepseek-ai/dsh-client-connection/client'
import type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'
import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
import { ToolCallTree } from './tool/ToolCallTree.tsx'
@@ -16,19 +16,13 @@ import { webToolview } from './tool/toolviews/web-row.tsx'
/** Required services: the slot registry and the Host description used for POSIX `~`. */
export const inject = ['slots', 'connection']
const absentHostDescription: HostDescriptionSource = {
getSnapshot: () => undefined,
subscribe: () => () => {},
}
/**
* Mount the whole-Tool renderers and built-in atomic Tool registrations.
* @param ctx - Client root context.
*/
export function apply(ctx: ClientContext): void {
const connection = ctx.get('connection') as ConnectionHandle
const hostDescription = connection.hostDescription ?? absentHostDescription
const toolInject = () => ({ hooks: { hostDescription } })
const toolInject = () => ({ hooks: { hostDescription: connection.hostDescription } })
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register({
name: 'conversation.chat.node',
key: 'tool-call',
@@ -68,7 +68,11 @@ const LAYOUT_CHILDREN = {
async function bench(nodes: ToolResultNode[]) {
const runtime = await SlotTestRuntime.create()
runtime.provide('connection', { api: { settings: {} }, isLoopback: false })
runtime.provide('connection', {
api: { settings: {} },
isLoopback: false,
hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} },
})
// ui-theme's Appearance row binds a durable scope through these two.
runtime.provide('remote', { $on: () => () => {} })
runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never)
@@ -158,7 +158,11 @@ async function bench(snapshot: ConversationSnapshot) {
}
ctx.provide('workspaces', workspaces)
ctx.provide('layout', layout)
ctx.provide('connection', { api: { settings: {} }, isLoopback: false } as never)
ctx.provide('connection', {
api: { settings: {} },
isLoopback: false,
hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} },
} as never)
// ui-theme's Appearance row binds a durable scope through these two.
ctx.provide('remote', { $on: () => () => {} } as never)
ctx.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never)
@@ -4,7 +4,6 @@ import type {
} from '@deepseek-ai/dsh-client-runtime/client'
import type { SessionProviderComponent, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots'
import type { DetailsSlotProps, DetailsToolOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/src/client/contract/slots.ts'
import type { ToolDetailsProps } from '../src/client/contract/slots.ts'
import { ToolDetails } from '../src/client/tool/ToolDetails.tsx'
/** Framework session-area seat used by direct DetailsPanel tests. */
@@ -62,7 +61,7 @@ export function renderToolDetails(t: TranslateNS<'conversation'>): DetailsSlotPr
return <ToolDetails
block={details.block}
cwd={details.cwd}
useHostDescription={(selector => selector(undefined)) as ToolDetailsProps['useHostDescription']}
useHostDescription={selector => selector(undefined)}
t={t}
/>
}
@@ -64,7 +64,11 @@ const LAYOUT_CHILDREN = {
*/
async function bench(nodes: ToolResultNode[]) {
const runtime = await SlotTestRuntime.create()
runtime.provide('connection', { api: { settings: {} }, isLoopback: false })
runtime.provide('connection', {
api: { settings: {} },
isLoopback: false,
hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} },
})
// ui-theme's Appearance row binds a durable scope through these two.
runtime.provide('remote', { $on: () => () => {} })
runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never)
@@ -203,7 +207,11 @@ describe('keyed toolview hole through the real machinery', () => {
describe('registrant declaration injection', () => {
it('runs a registrant before ui-tool and waits on the actual toolview declaration', async () => {
const runtime = await SlotTestRuntime.create()
runtime.provide('connection', { api: { settings: {} }, isLoopback: false })
runtime.provide('connection', {
api: { settings: {} },
isLoopback: false,
hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} },
})
// ui-theme's Appearance row binds a durable scope through these two.
runtime.provide('remote', { $on: () => () => {} })
runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never)
@@ -8,7 +8,7 @@
* client half (see the contract module doc). Export discipline:
* packages/client/AGENTS.md.
*/
import type { ConnectionHandle, HostDescriptionSource } from '@deepseek-ai/dsh-client-connection/client'
import type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'
// Type-only: pulls the locale plugin's Context merge (ctx.locale).
@@ -45,11 +45,6 @@ const NS = 'workspace'
*/
export const inject = ['slots', 'sessions', 'workspaces', 'locale', 'connection']
const absentHostDescription: HostDescriptionSource = {
getSnapshot: () => undefined,
subscribe: () => () => {},
}
/**
* Register the browser and picker once their slot declarations are on the
* ledger. Inject factories return plain callbacks; data reads use the
@@ -58,7 +53,7 @@ const absentHostDescription: HostDescriptionSource = {
*/
export function apply(ctx: ClientContext): void {
const connection = ctx.get('connection') as ConnectionHandle
const hostDescription = connection.hostDescription ?? absentHostDescription
const hostDescription = connection.hostDescription
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'ui-workspace: dictionaries')
const searchSessions: WorkspaceBrowserInjected['searchSessions'] = async (query, signal) => {
@@ -33,7 +33,7 @@ async function createRuntime(): Promise<SlotTestRuntime> {
const runtime = await SlotTestRuntime.create()
runtime.provide('connection', {
hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} },
} as never)
})
const locale = new LocaleRuntime(runtime.ctx)
runtime.provide('locale', locale)
runtime.slots.installLocale(locale)