) => (
-
)}
- {renderSlot('conversation.input.model.options', {
- locked: locked || busy,
- openPage: (page) => { drill(page) },
- dismiss: () => {
- close()
- triggerRef.current?.focus()
- },
- reportFailure: (message) => { setToast({ seq: ++toastSeq.current, text: message }) },
- })}
+ {renderSlot('conversation.input.model.options', { ...controls, openPage: drill })}
>
)}
@@ -671,14 +672,7 @@ export function ModelSelect(
)}
{typeof pane === 'object' && (
- {renderSlot('conversation.input.model.page', {
- locked: locked || busy,
- dismiss: () => {
- close()
- triggerRef.current?.focus()
- },
- reportFailure: (message) => { setToast({ seq: ++toastSeq.current, text: message }) },
- }, { entryKey: pane.key })}
+ {renderSlot('conversation.input.model.page', controls, { entryKey: pane.key })}
)}
,
diff --git a/packages/client/ui-model-selection/src/client/slots.ts b/packages/client/ui-model-selection/src/client/slots.ts
index 5b0b589b19..491cb030f8 100644
--- a/packages/client/ui-model-selection/src/client/slots.ts
+++ b/packages/client/ui-model-selection/src/client/slots.ts
@@ -35,16 +35,22 @@ export interface ModelMenuControls {
reportFailure: (message: string) => void
}
+/** Root-menu controls for opening plugin-owned settings pages. */
+export type ModelMenuOptions = ModelMenuControls & {
+ /**
+ * Open page.key in conversation.input.model.page with page.title as its localized accessible name.
+ * The root button's data-model-menu-page must match page.key for focus return.
+ */
+ openPage: (page: ModelMenuPage) => void
+}
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
interface SlotMap {
/** Session options appended after model and reasoning controls in the root menu. */
'conversation.input.model.options': {
kind: 'list'
scope: 'session'
- owner: ModelMenuControls & {
- /** Open a keyed detail page inside this menu; its root button supplies data-model-menu-page for focus return. */
- openPage: (page: ModelMenuPage) => void
- }
+ owner: ModelMenuOptions
}
/** Plugin-owned content displayed as a model-menu detail page. */
'conversation.input.model.page': {
diff --git a/packages/client/ui-model-selection/tests/model-menu-page.client.spec.tsx b/packages/client/ui-model-selection/tests/model-menu-page.client.spec.tsx
index 859bb53344..126d89c119 100644
--- a/packages/client/ui-model-selection/tests/model-menu-page.client.spec.tsx
+++ b/packages/client/ui-model-selection/tests/model-menu-page.client.spec.tsx
@@ -11,7 +11,7 @@ import { en } from '../src/client/locales.ts'
afterEach(cleanup)
-function setup(locked = false) {
+function setup() {
const directory = createSnapshotStore({
current: { provider: 'fixture', model: 'fixture' }, routable: true,
groups: [{ id: 'fixture', name: 'Fixture', models: [{ id: 'fixture', name: 'Fixture' }] }],
@@ -33,7 +33,7 @@ function setup(locked = false) {
}
return options?.fallback ?? null
}
- render( typeof text === 'string' ? text : text.en} t={makeTranslate(en)} renderSlot={renderSlot} />)
const trigger = screen.getByRole('button', { name: /^Select model/ })
fireEvent.click(trigger)
diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts
index 99667674df..7bcafd9def 100644
--- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts
+++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts
@@ -1619,7 +1619,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [
occupants: [],
replaceRisk: 'none',
example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.model.label\', () => ctx.slots.register(\n { name: \'conversation.input.model.label\' },\n ({ provider, model }) => React.createElement(\'span\', { title: provider.name }, model.name),\n ))\n },\n}',
- source: 'packages/client/ui-model-selection/src/client/slots.ts:70',
+ source: 'packages/client/ui-model-selection/src/client/slots.ts:76',
},
{
key: 'conversation.input.model.options',
@@ -1649,9 +1649,11 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [
],
ownerProps: [
'/** Selection state and feedback shared by menu option entries and detail pages. */\nexport interface ModelMenuControls {\n /** Whether the composer refuses changes, including while a model selection is saving. */\n locked: boolean\n /** Close the menu and focus its trigger synchronously before opening another overlay. */\n dismiss: () => void\n /** Report a failed selection through the menu owner\'s persistent toast. */\n reportFailure: (message: string) => void\n}',
- '/** A keyed contribution displayed as a second page of the model menu. */\nexport interface ModelMenuPage {\n /** Registration key in conversation.input.model.page; also marks its root button\'s data-model-menu-page. */\n key: string\n /** Localized accessible name of the detail page. */\n title: string\n}',
+ '/** Root-menu controls for opening plugin-owned settings pages. */\nexport type ModelMenuOptions = ModelMenuControls & {\n /**\n * Open page.key in conversation.input.model.page with page.title as its localized accessible name.\n * The root button\'s data-model-menu-page must match page.key for focus return.\n */\n openPage: (page: ModelMenuPage) => void\n}',
+ ],
+ ownerPropsReferences: [
+ 'ModelMenuPage',
],
- ownerPropsReferences: [],
standardProps: [
'useRemoteAccess: (action: RemoteEndpoint) => boolean',
'useResource: UseResource',
@@ -1682,7 +1684,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [
],
replaceRisk: 'none',
example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.model.options\', () => ctx.slots.register(\n { name: \'conversation.input.model.options\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}',
- source: 'packages/client/ui-model-selection/src/client/slots.ts:41',
+ source: 'packages/client/ui-model-selection/src/client/slots.ts:50',
},
{
key: 'conversation.input.model.page',
@@ -1732,7 +1734,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [
],
replaceRisk: 'shadows-shipped-ui',
example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.model.page\', () => ctx.slots.register(\n { name: \'conversation.input.model.page\', key: \'\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}',
- source: 'packages/client/ui-model-selection/src/client/slots.ts:50',
+ source: 'packages/client/ui-model-selection/src/client/slots.ts:56',
},
{
key: 'conversation.input.overlay',
diff --git a/packages/extensions/cordis-client-runner/tests/providers.client.spec.ts b/packages/extensions/cordis-client-runner/tests/providers.client.spec.ts
index 9965ae63c6..8ff04a1c25 100644
--- a/packages/extensions/cordis-client-runner/tests/providers.client.spec.ts
+++ b/packages/extensions/cordis-client-runner/tests/providers.client.spec.ts
@@ -7,7 +7,7 @@ import { clientInspectProviders } from '../src/client/providers.ts'
const Component = () => null
describe('Client inspect providers', () => {
- it('exposes Tool owner fields and phases through the live slot lookup', async () => {
+ it('exposes Tool and model-menu owner fields through the live slot lookup', async () => {
const ctx = new Context()
const fiber = ctx.plugin(SlotRegistry)
try {
@@ -15,7 +15,10 @@ describe('Client inspect providers', () => {
const slots = ctx.slots as { registerFactory(options: object, component: unknown): () => void }
slots.registerFactory({
name: 'provider.tool-owner', scope: 'root',
- children: { 'tool.call.toolview': { kind: 'keyed', scope: 'session' } },
+ children: {
+ 'tool.call.toolview': { kind: 'keyed', scope: 'session' },
+ 'conversation.input.model.options': { kind: 'list', scope: 'session' },
+ },
}, Component)
const provider = clientInspectProviders(ctx).find(item => item.manifest.id === 'Slots')!
const result = await provider.query('listSubTree', { root: 'tool.call.toolview' }, {} as never)
@@ -26,6 +29,10 @@ describe('Client inspect providers', () => {
}
for (const phase of ['preparing', 'start', 'result']) expect(owner).toContain(`phase: '${phase}'`)
expect(owner).not.toContain('truncated')
+ const options = await provider.query('listSubTree', { root: 'conversation.input.model.options' }, {} as never)
+ const menuOwner = (options as typeof selected).selected.catalog.ownerProps.join('\n')
+ expect(menuOwner).toContain('ModelMenuOptions')
+ expect(menuOwner).toContain('openPage: (page: ModelMenuPage) => void')
} finally {
await fiber.dispose()
}