-
{ setOpen(false) }}
items={state.options.map((option) => {
@@ -214,7 +214,12 @@ export function AgentPresetSeat({
)}
- />
+ /> : (
+
+
+ {shownLabel}
+
+ )}
{chosen === undefined ? null : (
agentPresets: SnapshotStore
}
load: () => Promise
@@ -22,27 +21,23 @@ type CreatePluginMenuItemProps = PropsRuntime<'plugins.add.actions'>
/**
* Close the Add plugin menu before opening Creator without sending a message.
- * @param props - locale, roster, preference, dismissal and navigation callbacks.
+ * @param props - locale, roster, dismissal and navigation callbacks.
* @returns a stable menu item that explains why Creator is unavailable.
*/
export function CreatePluginMenuItem({
- t, useDeveloperTools, useAgentPresets, load, onDismiss, startCreatorDraft,
+ t, useAgentPresets, load, onDismiss, startCreatorDraft,
}: CreatePluginMenuItemProps) {
- const developerTools = useDeveloperTools(value => value)
const roster = useAgentPresets(state => state)
- const available = roster.status === 'ready' && roster.options.some(option => option.id === 'cordis')
- const enabled = developerTools && available
+ const enabled = roster.status === 'ready' && roster.options.some(option => option.id === 'cordis')
useEffect(() => { void load() }, [load])
let description = t('createPluginDescription')
- if (!developerTools) description = t('enableDevToolsToCreate')
- else if (roster.status === 'idle' || roster.status === 'loading') description = t('createPluginChecking')
+ if (roster.status === 'idle' || roster.status === 'loading') description = t('createPluginChecking')
else if (roster.status === 'error' || roster.status === 'unavailable') description = t('createPluginUnavailable')
- else if (!available) description = t('createPluginMissing')
+ else if (!enabled) description = t('createPluginMissing')
return (
} disabled={!enabled} onSelect={() => {
- if (!enabled) return
onDismiss()
startCreatorDraft()
}}>
diff --git a/packages/client/ui-agent-preset/src/client/index.ts b/packages/client/ui-agent-preset/src/client/index.ts
index 299d8f1d45..daf70a5720 100644
--- a/packages/client/ui-agent-preset/src/client/index.ts
+++ b/packages/client/ui-agent-preset/src/client/index.ts
@@ -12,9 +12,9 @@
* edited where the roster is visible — the settings section's "make default"
* — so General settings carries no duplicate control for the same field.
*
- * Developer tools (General settings) are the single gate over selection: with
- * them off the chip disappears and the card actions are disabled, while the
- * saved default keeps composing new sessions.
+ * Developer tools (General settings) gate ordinary selection. With them off,
+ * the picker and card selection stay unavailable; an explicit Creator entry
+ * still starts one Creator task without changing the saved default.
*/
// Type-only: pulls the Session Controller service merge (ctx.sessions).
@@ -102,12 +102,10 @@ export function apply(ctx: ClientContext): void {
return seat
}
const section = new AgentPresetSectionController(ctx)
- // Turning Developer tools off clears the shared stage before any apply can compose it.
+ // Let the seat's source-aware rule retire ordinary picks when Coding Tools turn off.
const developerTools = ctx.configForms.developerTools.enabled
ctx.effect(() => developerTools.subscribe(() => {
if (developerTools.getSnapshot()) return
- staged.id = undefined
- staged.introduce = false
void unboundSeat.apply()
for (const seat of seats.values) void seat.apply()
}), 'ui-agent-preset: Developer tools gate')
@@ -172,7 +170,7 @@ export function apply(ctx: ClientContext): void {
scope.effect(() => {
creatorDraft = () => {
const seat = mainBlankSeat() ?? unboundSeat
- seat.stage('cordis', true)
+ seat.stageCreator()
scope.uiWorkspace.startSession()
void seat.apply()
}
@@ -201,10 +199,10 @@ export function apply(ctx: ClientContext): void {
id: 'create-plugin',
locale: 'settings.agentPreset',
inject: () => ({
- hooks: { developerTools, agentPresets: controller.store },
+ hooks: { agentPresets: controller.store },
load: () => controller.load(),
startCreatorDraft: () => {
- if (developerTools.getSnapshot()) creatorDraft?.()
+ creatorDraft?.()
},
}),
}, CreatePluginMenuItem))
diff --git a/packages/client/ui-agent-preset/src/client/seat-store.ts b/packages/client/ui-agent-preset/src/client/seat-store.ts
index b8e974b6da..dadf8a673f 100644
--- a/packages/client/ui-agent-preset/src/client/seat-store.ts
+++ b/packages/client/ui-agent-preset/src/client/seat-store.ts
@@ -48,6 +48,8 @@ export interface AgentPresetStage {
id: string | undefined
/** Whether the receiving chip should announce the applied choice once. */
introduce: boolean
+ /** Explicit Creator entry can stage cordis while the preset picker is hidden. */
+ source?: 'creator'
}
/** Stages the next session's preset and applies it when one appears. */
@@ -83,11 +85,13 @@ export class AgentPresetSeatController {
private clearStage(): void {
this.staged.id = undefined
this.staged.introduce = false
+ delete this.staged.source
}
- /** Developer tools are the single gate over preset selection. */
+ /** Ordinary selection needs Coding Tools; an explicit Creator entry does not. */
private selectionAvailable(): boolean {
return this.ctx.configForms.developerTools.enabled.getSnapshot()
+ || (this.staged.source === 'creator' && this.staged.id === 'cordis')
}
/**
@@ -103,7 +107,7 @@ export class AgentPresetSeatController {
return
}
const { presets } = roster.value
- // A stage outlives the screen that made it; Developer tools may have gone off since.
+ // Recheck the current source and preference after the roster request settles.
if (!this.selectionAvailable()) this.clearStage()
this.fallback = presets.find(preset => preset.isDefault)?.id ?? presets[0]?.id ?? ''
const session = this.currentSession()
@@ -154,9 +158,18 @@ export class AgentPresetSeatController {
stage(id: string, introduce = false): void {
this.staged.id = id
this.staged.introduce = introduce
+ delete this.staged.source
this.set({ current: id, error: null, introduce })
}
+ /** Stage one Creator task without changing the Coding Tools preference. */
+ stageCreator(): void {
+ this.staged.id = 'cordis'
+ this.staged.introduce = true
+ this.staged.source = 'creator'
+ this.set({ current: 'cordis', error: null, introduce: true })
+ }
+
/**
* Capture the exact blank Session a Settings action may bring along.
* @returns its id, or undefined outside a blank Session.
@@ -202,7 +215,7 @@ export class AgentPresetSeatController {
async apply(): Promise {
if (this.store.getSnapshot().busy) return
const available = this.selectionAvailable()
- // A stage made while Developer tools were on must not outlive them.
+ // Only an explicit Creator entry survives hiding the ordinary preset picker.
if (!available) this.clearStage()
const staged = this.staged.id
const session = this.currentSession()
diff --git a/packages/client/ui-agent-preset/tests/apply.client.spec.ts b/packages/client/ui-agent-preset/tests/apply.client.spec.ts
index bb74d59461..b30c590a0c 100644
--- a/packages/client/ui-agent-preset/tests/apply.client.spec.ts
+++ b/packages/client/ui-agent-preset/tests/apply.client.spec.ts
@@ -21,7 +21,7 @@ import { AgentPresetSection } from '../src/client/AgentPresetSection.tsx'
import type { AgentPresetSectionInjected } from '../src/client/AgentPresetSection.tsx'
import { AgentPresetSeat } from '../src/client/AgentPresetSeat.tsx'
import type { AgentPresetSeatInjected } from '../src/client/AgentPresetSeat.tsx'
-import { AgentPresetSeatController } from '../src/client/seat-store.ts'
+import { AgentPresetSeatController, type AgentPresetStage } from '../src/client/seat-store.ts'
import { CreatePluginMenuItem, type CreatePluginMenuItemInjected } from '../src/client/CreatePluginMenuItem.tsx'
import { apply as hostApply } from '../src/index.ts'
@@ -29,7 +29,7 @@ import { apply as hostApply } from '../src/index.ts'
// so browser-language detection never runs and a fresh LocaleRuntime opens on
// FALLBACK_LOCALE (en); each bench stages zh explicitly on the locale instead.
-/** The Developer tools half of `ctx.configForms`, which gates all selection. */
+/** The Developer tools half of `ctx.configForms`, which gates ordinary selection. */
function developerTools(enabled = true): { configForms: { developerTools: { enabled: ObservableSnapshot } } } {
return { configForms: { developerTools: { enabled: createSnapshotStore(enabled) } } }
}
@@ -843,10 +843,8 @@ describe('ui-agent-preset apply', () => {
await setDeveloperTools(false)
action.startCreatorDraft()
- expect(uiWorkspace.starts).toHaveLength(0)
- await setDeveloperTools(true)
- action.startCreatorDraft()
expect(uiWorkspace.starts).toHaveLength(1)
+ expect(ctx.configForms.developerTools.enabled.getSnapshot()).toBe(false)
await feature.dispose()
expect(slots.entries('plugins.add.actions')).toHaveLength(0)
@@ -857,8 +855,9 @@ describe('ui-agent-preset apply', () => {
}
})
- it('stages the creator preset and starts a session from the section', async () => {
- const { ctx, slots } = await bench()
+ it.each([false, true])('stages Creator without a workspace (Coding Tools: %s)', async (enabled) => {
+ const { ctx, slots, setDeveloperTools } = await bench()
+ await setDeveloperTools(enabled)
declareRoot(slots)
const conversation = declareConversation(slots)
ctx.provide('conversation', {} as never)
@@ -889,11 +888,19 @@ describe('ui-agent-preset apply', () => {
expect(acknowledged.introduce).toBe(false)
seat.introduced()
expect(seat.hooks.agentPresetSeat.getSnapshot()).toBe(acknowledged)
+ await seat.load()
+ expect(seat.hooks.agentPresetSeat.getSnapshot().current).toBe('cordis')
+ expect(ctx.configForms.developerTools.enabled.getSnapshot()).toBe(enabled)
+ if (enabled) {
+ await setDeveloperTools(false)
+ expect(seat.hooks.agentPresetSeat.getSnapshot().current).toBe('cordis')
+ }
conversation()
})
- it('applies the creator preset to an existing blank main Session', async () => {
- const { ctx, slots, calls } = await bench()
+ it.each([false, true])('applies Creator to an existing blank main Session (Coding Tools: %s)', async (enabled) => {
+ const { ctx, slots, calls, setDeveloperTools } = await bench()
+ await setDeveloperTools(enabled)
declareRoot(slots)
const conversation = declareConversation(slots)
ctx.provide('conversation', {} as never)
@@ -917,6 +924,7 @@ describe('ui-agent-preset apply', () => {
await vi.waitFor(() => { expect(calls).toContain('select:cordis') })
expect(seat.hooks.agentPresetSeat.getSnapshot().current).toBe('cordis')
expect(uiWorkspace.starts).toHaveLength(1)
+ expect(ctx.configForms.developerTools.enabled.getSnapshot()).toBe(enabled)
conversation()
})
@@ -977,6 +985,31 @@ describe('ui-agent-preset apply', () => {
})
describe('AgentPresetSeatController reconciliation', () => {
+ it('consumes the Creator source before its RPC settles and keeps a waiting Settings choice gated', async () => {
+ const reply = Promise.withResolvers<{ ok: true; value: string }>()
+ const select = vi.fn(() => reply.promise)
+ const session = { id: SessionId('blank'), blank: true, projectionValues: { agentPreset: 'standard' } }
+ const staged: AgentPresetStage = { id: undefined, introduce: false }
+ const preference = developerTools(false)
+ const controller = new AgentPresetSeatController({
+ ...preference, remote: { agentPresets: { select } },
+ } as never, () => session, staged)
+ controller.stageCreator()
+ const started = controller.apply()
+ expect(select).toHaveBeenCalledExactlyOnceWith(session.id, 'cordis')
+ expect(staged).toEqual({ id: undefined, introduce: false })
+
+ const settings = controller.syncBlankSession(session.id, 'minimal')
+ session.projectionValues.agentPreset = 'cordis'
+ reply.resolve({ ok: true, value: 'cordis' })
+ await Promise.all([started, settings])
+ await controller.apply()
+ expect(select).toHaveBeenCalledOnce()
+ expect(controller.store.getSnapshot().current).toBe('cordis')
+ expect(staged).toEqual({ id: undefined, introduce: false })
+ expect(preference.configForms.developerTools.enabled.getSnapshot()).toBe(false)
+ })
+
it.each([
{ refuseFirst: false, refuseLatest: false },
{ refuseFirst: false, refuseLatest: true },
diff --git a/packages/client/ui-agent-preset/tests/components.client.spec.tsx b/packages/client/ui-agent-preset/tests/components.client.spec.tsx
index b7b24f8d2b..1c71c0b866 100644
--- a/packages/client/ui-agent-preset/tests/components.client.spec.tsx
+++ b/packages/client/ui-agent-preset/tests/components.client.spec.tsx
@@ -105,6 +105,39 @@ describe('the new-session chip', () => {
expect(screen.queryByRole('button')).toBeNull()
})
+ it('offers only read-only Creator help while Developer tools are off', () => {
+ const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }, { id: 'standard' }] },
+ undefined, undefined, false)
+ expect(screen.getByText(en.presetCordisName)).toBeTruthy()
+ expect(screen.queryByRole('menu')).toBeNull()
+ expect(document.querySelector('[aria-haspopup="menu"]')).toBeNull()
+ const trigger = screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetCordisName}` })
+ trigger.focus()
+ fireEvent.click(trigger)
+ expect(screen.getByRole('dialog', { name: en.presetCordisName })).toBeTruthy()
+ fireEvent.keyDown(document.activeElement!, { key: 'Escape' })
+ expect(screen.queryByRole('dialog')).toBeNull()
+ expect(document.activeElement).toBe(trigger)
+ expect(actions.select).not.toHaveBeenCalled()
+ expect(actions.developerTools.getSnapshot()).toBe(false)
+
+ act(() => { actions.store.set({ ...actions.store.getSnapshot(), current: 'standard' }) })
+ expect(screen.queryByRole('button')).toBeNull()
+ expect(screen.queryByText(en.presetCordisName)).toBeNull()
+ })
+
+ it('removes the Creator picker when Coding Tools turn off but keeps read-only help', () => {
+ const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }, { id: 'standard' }] })
+ fireEvent.click(seatTrigger())
+ expect(screen.getByRole('menu')).toBeTruthy()
+ act(() => { actions.developerTools.set(false) })
+ expect(screen.queryByRole('menu')).toBeNull()
+ expect(document.querySelector('[aria-haspopup="menu"]')).toBeNull()
+ expect(screen.getByText(en.presetCordisName)).toBeTruthy()
+ expect(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetCordisName}` })).toBeTruthy()
+ expect(actions.select).not.toHaveBeenCalled()
+ })
+
it('renders only for a Session retained by the main view', () => {
renderSeat({}, undefined, {
id: 's1', retainInfo: { referenceCount: 1, retainedBy: { mainView: 1 } },
@@ -232,6 +265,16 @@ describe('the new-session chip', () => {
expect(actions.select).not.toHaveBeenCalled()
})
+ it('explains a custom preset with no description without offering built-in guidance', () => {
+ const actions = renderSeat({ current: 'mine' })
+ fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: mine` }))
+ expect(screen.getByRole('dialog', { name: 'mine' }).textContent).toContain(en.noDescription)
+ expect(screen.queryByRole('tab')).toBeNull()
+ fireEvent.click(screen.getByRole('button', { name: en.close }))
+ expect(screen.queryByRole('dialog')).toBeNull()
+ expect(actions.select).not.toHaveBeenCalled()
+ })
+
it('forgets open help when developer tools turn off', () => {
const actions = renderSeat()
fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` }))
@@ -310,6 +353,23 @@ describe('the chip introduce cue', () => {
return Array.from(seatTrigger().querySelectorAll('[style]'))
}
+ it('announces a read-only Creator entry without exposing a picker or changing Coding Tools', () => {
+ vi.stubGlobal('matchMedia', vi.fn(() => ({ matches: false })))
+ vi.useFakeTimers()
+ const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }], introduce: true },
+ undefined, undefined, false)
+ const label = screen.getByTitle(en.presetCordisDescription)
+ expect(label.textContent).toBe(en.presetCordisName)
+ expect(label.querySelectorAll('[style]').length).toBeGreaterThan(0)
+ expect(document.querySelector('[aria-haspopup="menu"]')).toBeNull()
+
+ act(() => { vi.advanceTimersByTime(750) })
+ expect(actions.introduced).toHaveBeenCalledOnce()
+ expect(label.querySelectorAll('[style]')).toHaveLength(0)
+ expect(actions.developerTools.getSnapshot()).toBe(false)
+ expect(actions.select).not.toHaveBeenCalled()
+ })
+
it('reveals a long Latin name inside the shared window, then acknowledges', () => {
vi.stubGlobal('matchMedia', vi.fn(() => ({ matches: false })))
vi.useFakeTimers()
@@ -423,6 +483,18 @@ describe('the session-header label', () => {
expect(screen.queryByRole('tab')).toBeNull()
})
+ it('opens and closes help for a custom session preset that has no description', () => {
+ renderLabel({ blank: false, projectionValues: { agentPreset: 'mine' } })
+ const trigger = screen.getByRole('button', { name: `${en.modeExplanation}: mine` })
+ trigger.focus()
+ fireEvent.click(trigger)
+ expect(screen.getByRole('dialog', { name: 'mine' }).textContent).toContain(en.noDescription)
+ expect(screen.queryByRole('tab')).toBeNull()
+ fireEvent.click(screen.getByRole('button', { name: en.close }))
+ expect(screen.queryByRole('dialog')).toBeNull()
+ expect(document.activeElement).toBe(trigger)
+ })
+
it('keeps help closed when the session preset returns after leaving the roster', () => {
const { store } = renderLabel({ blank: false, projectionValues: { agentPreset: 'standard' } })
const before = store.getSnapshot()
diff --git a/packages/client/ui-agent-preset/tests/create-plugin-menu-item.client.spec.tsx b/packages/client/ui-agent-preset/tests/create-plugin-menu-item.client.spec.tsx
index 5f57fb09e1..b71bae9db1 100644
--- a/packages/client/ui-agent-preset/tests/create-plugin-menu-item.client.spec.tsx
+++ b/packages/client/ui-agent-preset/tests/create-plugin-menu-item.client.spec.tsx
@@ -16,8 +16,7 @@ function unusedHook(): never {
throw new Error('Create plugin does not read this slot source')
}
-function view(enabled = true, roster: Partial = {}, inMenu = false) {
- const developerTools = createSnapshotStore(enabled)
+function view(roster: Partial = {}, inMenu = false) {
const agentPresets = createSnapshotStore({
status: 'ready', error: null, options: [{ id: 'standard' }, { id: 'cordis' }], ...roster,
})
@@ -27,7 +26,6 @@ function view(enabled = true, roster: Partial = {}, in
const load = vi.fn(async () => {})
const props: ComponentProps = {
t: key => translations.get(key) ?? key,
- useDeveloperTools: bindSnapshotSelector(developerTools),
useAgentPresets: bindSnapshotSelector(agentPresets),
usePanelInfo: unusedHook, useSessions: unusedHook, useSessionStatus: unusedHook,
useSessionRetainInfo: unusedHook, useWorkspaces: unusedHook, useResource: unusedHook,
@@ -42,7 +40,7 @@ function view(enabled = true, roster: Partial = {}, in
}
render(inMenu ?
:
)
- return { developerTools, agentPresets, load, startCreatorDraft, onDismiss, calls }
+ return { agentPresets, load, startCreatorDraft, onDismiss, calls }
}
function item(): HTMLElement {
@@ -67,7 +65,7 @@ describe('Create plugin menu item', () => {
})
it('supports keyboard selection through the shared menu and closes before navigation', () => {
- const actions = view(true, {}, true)
+ const actions = view({}, true)
const trigger = item()
trigger.focus()
fireEvent.keyDown(trigger, { key: 'Tab' })
@@ -75,30 +73,8 @@ describe('Create plugin menu item', () => {
expect(screen.queryByRole('menu')).toBeNull()
})
- it('explains disabled Developer tools and enables the same entry after the preference changes', () => {
- const actions = view(false)
- expect(item()).toHaveProperty('disabled', true)
- expect(item().textContent).toContain(en.enableDevToolsToCreate)
- fireEvent.click(item())
- expect(actions.calls).toEqual([])
-
- act(() => { actions.developerTools.set(true) })
- expect(item()).toHaveProperty('disabled', false)
- expect(item().textContent).toContain(en.createPluginDescription)
- fireEvent.click(item())
- expect(actions.calls).toEqual(['dismiss', 'start'])
- })
-
- it('honors Developer tools turning off while the menu is open', () => {
- const actions = view()
- act(() => { actions.developerTools.set(false) })
- expect(item()).toHaveProperty('disabled', true)
- fireEvent.click(item())
- expect(actions.calls).toEqual([])
- })
-
it.each(['idle', 'loading', 'error', 'unavailable'] as const)('keeps a disabled entry while the roster is %s', (status) => {
- const actions = view(true, { status })
+ const actions = view({ status })
expect(item()).toHaveProperty('disabled', true)
const description = status === 'idle' || status === 'loading' ? en.createPluginChecking : en.createPluginUnavailable
expect(item().textContent).toContain(description)
@@ -107,7 +83,7 @@ describe('Create plugin menu item', () => {
})
it('explains why the entry is disabled when the deployment has no cordis preset', () => {
- const actions = view(true, { options: [{ id: 'standard' }] })
+ const actions = view({ options: [{ id: 'standard' }] })
expect(item()).toHaveProperty('disabled', true)
expect(item().textContent).toContain(en.createPluginMissing)
fireEvent.click(item())
@@ -126,7 +102,7 @@ describe('Create plugin menu item', () => {
})
it('keeps the same second menu item through ready, loading, and ready states', () => {
- const actions = view(true, {}, true)
+ const actions = view({}, true)
const menu = screen.getByRole('menu')
const before = screen.getAllByRole('menuitem')
const original = item()
diff --git a/packages/client/ui-agent-preset/tests/settings-store.client.spec.ts b/packages/client/ui-agent-preset/tests/settings-store.client.spec.ts
index 30e6d41c91..2c703e7cb6 100644
--- a/packages/client/ui-agent-preset/tests/settings-store.client.spec.ts
+++ b/packages/client/ui-agent-preset/tests/settings-store.client.spec.ts
@@ -509,6 +509,85 @@ describe('the new-session chip controller', () => {
})
})
+ it('keeps a Creator stage without a workspace, consumes it once, and leaves later tasks on the default', async () => {
+ const writes: Recorded[] = []
+ const developerTools = createSnapshotStore(false)
+ let current: SeatSession | undefined
+ const controller = chip([...ROSTER, { id: 'cordis', isDefault: false }], () => current, { writes, developerTools })
+ controller.stageCreator()
+ controller.introduced()
+ await controller.load()
+ await controller.apply()
+ expect(controller.store.getSnapshot()).toMatchObject({ current: 'cordis', introduce: false })
+ expect(writes).toEqual([])
+
+ current = { id: 'creator' as SessionId, blank: true, projectionValues: { agentPreset: 'standard' } }
+ await controller.apply()
+ expect(writes).toEqual([{ ns: 'select', ops: 'cordis' }])
+ expect(controller.store.getSnapshot().current).toBe('cordis')
+
+ current = { id: 'ordinary' as SessionId, blank: true, projectionValues: { agentPreset: 'standard' } }
+ await controller.load()
+ await controller.apply()
+ expect(writes).toEqual([{ ns: 'select', ops: 'cordis' }])
+ expect(controller.store.getSnapshot().current).toBe('standard')
+ expect(developerTools.getSnapshot()).toBe(false)
+ })
+
+ it('does not change a started session or carry its rejected Creator stage into another task', async () => {
+ const writes: Recorded[] = []
+ let current: SeatSession = { id: 'running' as SessionId, blank: false, projectionValues: { agentPreset: 'standard' } }
+ const controller = chip(ROSTER, () => current, { writes, developerTools: createSnapshotStore(false) })
+ await controller.load()
+ controller.stageCreator()
+ await controller.apply()
+ expect(writes).toEqual([])
+
+ current = { id: 'ordinary' as SessionId, blank: true, projectionValues: { agentPreset: 'standard' } }
+ await controller.apply()
+ expect(writes).toEqual([])
+ expect(controller.store.getSnapshot().current).toBe('standard')
+ })
+
+ it('does not let an ordinary pick inherit a pending Creator stage exemption', async () => {
+ const writes: Recorded[] = []
+ let current: SeatSession | undefined = undefined
+ const controller = chip(ROSTER, () => current, { writes, developerTools: createSnapshotStore(false) })
+ await controller.load()
+ controller.stageCreator()
+ await controller.select('cordis')
+ expect(controller.store.getSnapshot().current).toBe('standard')
+
+ current = { id: 'blank' as SessionId, blank: true, projectionValues: { agentPreset: 'standard' } }
+ await controller.apply()
+ expect(writes).toEqual([])
+ })
+
+ it('keeps a Settings default synchronization gated after an explicit Creator stage', async () => {
+ const writes: Recorded[] = []
+ const current: SeatSession = { id: 'blank' as SessionId, blank: true, projectionValues: { agentPreset: 'standard' } }
+ const controller = chip(ROSTER, current, { writes, developerTools: createSnapshotStore(false) })
+ await controller.load()
+ controller.stageCreator()
+ await controller.syncBlankSession(current.id, 'minimal')
+ await controller.apply()
+ expect(writes).toEqual([])
+ expect(controller.store.getSnapshot().current).toBe('standard')
+ })
+
+ it('rechecks a Creator stage made while its roster request was pending', async () => {
+ const reply = Promise.withResolvers
>()
+ const developerTools = createSnapshotStore(false)
+ const controller = chip(ROSTER, undefined, { developerTools, list: () => reply.promise })
+ const loaded = controller.load()
+ controller.stageCreator()
+ controller.introduced()
+ reply.resolve({ ok: true, value: { presets: [...ROSTER, { id: 'cordis', isDefault: false }] } })
+ await loaded
+ expect(controller.store.getSnapshot()).toMatchObject({ current: 'cordis', introduce: false })
+ expect(developerTools.getSnapshot()).toBe(false)
+ })
+
it('leaves the introduction cue to the chip while Developer tools stay on', async () => {
const developerTools = createSnapshotStore(true)
const session = {
diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
index 6bf54f812c..ad7c017045 100644
--- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
+++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
@@ -578,7 +578,7 @@ function CapabilitiesSummary({ rows, resolveText, t }: {
}): ReactNode {
const seen = new Set()
const capabilities = rows.flatMap((row) => {
- const metadataTitle = row.meta?.title === undefined ? undefined : resolveText(row.meta.title).trim() || undefined
+ const metadataTitle = row.meta?.title === undefined ? undefined : resolveText(row.meta.title).trim()
const title = metadataTitle === row.moduleName || metadataTitle === row.rowId ? undefined : metadataTitle
const description = row.meta?.description === undefined ? undefined : resolveText(row.meta.description).trim() || undefined
if (title === undefined && description === undefined) return []
diff --git a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx
index dc977431cc..ec9b88a8c8 100644
--- a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx
+++ b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx
@@ -219,6 +219,9 @@ describe('PluginManagerPage', () => {
expect(screen.queryByRole('menuitem', { name: 'Create a plugin' })).toBeNull()
const add = screen.getByRole('button', { name: en.chooseAddMethod })
add.focus()
+ expect(fireEvent.keyDown(add, { key: 'Tab' })).toBe(true)
+ expect(screen.queryByRole('menu')).toBeNull()
+ expect(actions.openInstall).not.toHaveBeenCalled()
fireEvent.keyDown(add, { key: 'ArrowDown' })
const install = screen.getByRole('menuitem', { name: new RegExp(en.installExisting) })
const create = screen.getByRole('menuitem', { name: 'Create a plugin' })
diff --git a/snapshots/web/minimal-preset/ui.expected.md b/snapshots/web/minimal-preset/ui.expected.md
index e489e916e6..f29261d70e 100644
--- a/snapshots/web/minimal-preset/ui.expected.md
+++ b/snapshots/web/minimal-preset/ui.expected.md
@@ -1,6 +1,6 @@
- banner:
- navigation "Session hierarchy": Use the bash tool to
- - text: Minimal mode
+ - 'button "Mode details: Minimal mode"': Minimal mode
- button "More actions"
- button "Open right sidebar"
- tablist:
From 7d88fc9b2b79fc6fffeafc7eeb02fe682ae5c3db Mon Sep 17 00:00:00 2001
From: ZiyaZhang <199893125+ZiyaZhang@users.noreply.github.com>
Date: Mon, 28 Sep 2026 06:22:01 -0700
Subject: [PATCH 3/9] refactor(web): limit plugin UX changes to add and create
flows
---
apps/web/tests/agent-preset-selection.e2e.ts | 10 +-
.../agent-preset-selection/header.expected.md | 2 +-
.../agent-preset-selection/hero.expected.md | 1 -
docs/subsystems/slots.i18n.yaml | 4 +-
docs/subsystems/slots.md | 4 +-
docs/subsystems/slots.zh.md | 4 +-
.../client/ui-agent-preset/README.i18n.yaml | 4 +-
packages/client/ui-agent-preset/README.md | 2 +-
packages/client/ui-agent-preset/README.zh.md | 2 +-
.../src/client/AgentPresetLabel.module.css | 26 +-
.../src/client/AgentPresetLabel.tsx | 39 +--
.../src/client/AgentPresetSeat.module.css | 39 +--
.../src/client/AgentPresetSeat.tsx | 33 +--
.../tests/components.client.spec.tsx | 247 ++++++------------
.../client/ui-plugin-manager/README.i18n.yaml | 12 +-
packages/client/ui-plugin-manager/README.md | 6 +-
.../client/ui-plugin-manager/README.zh.md | 6 +-
.../src/client/PluginManagerPage.module.css | 83 ------
.../src/client/PluginManagerPage.tsx | 98 +------
.../ui-plugin-manager/src/client/index.ts | 3 +-
.../ui-plugin-manager/src/client/locales.ts | 14 -
.../src/client/manager-store.ts | 3 -
.../src/client/slot-contract.ts | 8 -
.../tests/browser-plugin.client.spec.tsx | 27 +-
.../tests/components.client.spec.tsx | 99 +------
.../tests/manager-store.client.spec.ts | 6 -
packages/client/ui-schedule/README.i18n.yaml | 4 +-
packages/client/ui-schedule/README.md | 2 -
packages/client/ui-schedule/README.zh.md | 2 -
packages/client/ui-schedule/package.json | 1 -
.../src/client/SchedulePluginUsage.module.css | 53 ----
.../src/client/SchedulePluginUsage.tsx | 76 ------
.../client/ui-schedule/src/client/index.ts | 14 -
.../src/client/task-manager-locales.ts | 18 --
.../tests/browser-plugin.client.spec.ts | 42 +--
.../schedule-plugin-usage.client.spec.tsx | 97 -------
packages/client/ui-schedule/tsconfig.json | 3 -
.../src/client/slot-catalog.ts | 59 +----
pnpm-lock.yaml | 3 -
snapshots/web/minimal-preset/ui.expected.md | 2 +-
40 files changed, 163 insertions(+), 995 deletions(-)
delete mode 100644 packages/client/ui-schedule/src/client/SchedulePluginUsage.module.css
delete mode 100644 packages/client/ui-schedule/src/client/SchedulePluginUsage.tsx
delete mode 100644 packages/client/ui-schedule/tests/schedule-plugin-usage.client.spec.tsx
diff --git a/apps/web/tests/agent-preset-selection.e2e.ts b/apps/web/tests/agent-preset-selection.e2e.ts
index 500bdd82c3..48f1722d7c 100644
--- a/apps/web/tests/agent-preset-selection.e2e.ts
+++ b/apps/web/tests/agent-preset-selection.e2e.ts
@@ -269,7 +269,7 @@ describe('web e2e: agent-preset selection', () => {
it('names every preset and what it is for', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-agent-preset-menu'))
- await page.getByRole('button', { name: 'Standard mode', exact: true }).click()
+ await page.getByRole('button', { name: 'Standard mode' }).click()
const menu = page.getByRole('menu')
await menu.waitFor({ timeout: 10_000 })
@@ -285,7 +285,7 @@ describe('web e2e: agent-preset selection', () => {
it('applies the staged pick to the blank session, and the host honors it', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-agent-preset-stage'))
- await page.getByRole('button', { name: 'Standard mode', exact: true }).click()
+ await page.getByRole('button', { name: 'Standard mode' }).click()
await page.getByRole('menuitem', { name: /Minimal mode/ }).click()
// The chip stages; the blank session the workspace connect produced is
@@ -296,7 +296,7 @@ describe('web e2e: agent-preset selection', () => {
})
it('omits eagerly failed presets from selection and retains their diagnostics', async () => {
- await page.getByRole('button', { name: 'Minimal mode', exact: true }).click()
+ await page.getByRole('button', { name: 'Minimal mode' }).click()
await page.getByRole('menu').waitFor()
expect(await page.getByRole('menuitem', { name: /Refusing mode/ }).count()).toBe(0)
await page.keyboard.press('Escape')
@@ -329,7 +329,7 @@ describe('web e2e: agent-preset selection', () => {
// against its list row, so a row that never reprojected the first switch
// answers "already standard" and sends nothing — and restores the catalog
// instead of leaving the session reading the narrower composition.
- await page.getByRole('button', { name: 'Minimal mode', exact: true }).click()
+ await page.getByRole('button', { name: 'Minimal mode' }).click()
await page.getByRole('menuitem', { name: /^Standard mode/ }).first().click()
await expect.poll(() => livePreset(scaffold), { timeout: 15_000 }).toBe('standard')
@@ -373,7 +373,7 @@ describe('web e2e: agent-preset selection', () => {
await reopened.getByRole('button', { name: 'New task default: Minimal mode' }).waitFor({ timeout: 10_000 })
await reopened.getByRole('button', { name: 'Close' }).last().click()
await expect.poll(() => livePreset(scaffold), { timeout: 15_000 }).toBe('minimal')
- await page.getByRole('button', { name: 'Minimal mode', exact: true }).waitFor({ timeout: 10_000 })
+ await page.getByRole('button', { name: 'Minimal mode' }).waitFor({ timeout: 10_000 })
})
it('labels a resumed session with the preset it was created under', async () => {
diff --git a/apps/web/tests/expected/agent-preset-selection/header.expected.md b/apps/web/tests/expected/agent-preset-selection/header.expected.md
index 5880f8c97d..81cc3c1175 100644
--- a/apps/web/tests/expected/agent-preset-selection/header.expected.md
+++ b/apps/web/tests/expected/agent-preset-selection/header.expected.md
@@ -1,5 +1,5 @@
- navigation "Session hierarchy": Seeded turn
- button "1 subagent"
-- 'button "Mode details: Minimal mode"': Minimal mode
+- text: Minimal mode
- button "More actions"
- button "Open right sidebar"
diff --git a/apps/web/tests/expected/agent-preset-selection/hero.expected.md b/apps/web/tests/expected/agent-preset-selection/hero.expected.md
index 58b292e0d8..2fe7ad2c8f 100644
--- a/apps/web/tests/expected/agent-preset-selection/hero.expected.md
+++ b/apps/web/tests/expected/agent-preset-selection/hero.expected.md
@@ -1,3 +1,2 @@
- button "Choose workspace": workspace
- button "Standard mode"
-- 'button "Mode details: Standard mode"'
diff --git a/docs/subsystems/slots.i18n.yaml b/docs/subsystems/slots.i18n.yaml
index 1757552737..aec206af8c 100644
--- a/docs/subsystems/slots.i18n.yaml
+++ b/docs/subsystems/slots.i18n.yaml
@@ -3,8 +3,8 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/slots.md
/web-client-slots:
- en: 593f9ed34e925132
- zh: f82611667c858768
+ en: 8d33b164230344fa
+ zh: 13a930ab96280744
/web-client-slots/declaration-and-lifecycle:
en: f2d2c0d3b8f14ec7
zh: 441ed13ff3f81d2a
diff --git a/docs/subsystems/slots.md b/docs/subsystems/slots.md
index bf4df4d478..42da307ddd 100644
--- a/docs/subsystems/slots.md
+++ b/docs/subsystems/slots.md
@@ -8,7 +8,7 @@ This page documents slot ownership, component inputs, extension APIs, and the sh
`plugins.bundle.config` supplies bundle detail configuration, keyed by npm package name. `plugins.bundle.activation` renders optional guidance after user-requested enablement, with owner callbacks to dismiss or open that bundle’s details. `conversation.input.activity` supplies one action between the model selector and Send, with toolbar expansion released on unmount.
-The plugin catalog declares `plugins.add.actions`, a root-scoped list for `MenuItemButton` rows after installation in the Add plugin menu. Its owner supplies `onDismiss()` to close the menu before starting an action. It also declares `plugins.bundle.usage`, a root-scoped keyed slot for usage guidance before component details. The latter dispatches the npm package name and supplies `{ pkg: PluginPackageRef }`; its occupant decides which actions apply to the bundle's installed and enabled state. Both follow the owning Plugins page declaration lifetime.
+The plugin catalog declares `plugins.add.actions`, a root-scoped list for `MenuItemButton` rows after installation in the Add plugin menu. Its owner supplies `onDismiss()` to close the menu before starting an action. The slot follows the owning Plugins page declaration lifetime.
## Declaration and lifecycle
@@ -137,8 +137,6 @@ root
├─ main
│ ├─ plugins.add.actions
│ ├─ plugins.item
-│ ├─ plugins.bundle.activation
-│ ├─ plugins.bundle.usage
│ ├─ plugins.bundle.config
│ ├─ plugins.row.config
│ ├─ plugins.detail.actions
diff --git a/docs/subsystems/slots.zh.md b/docs/subsystems/slots.zh.md
index cfebe63101..10e6338d0f 100644
--- a/docs/subsystems/slots.zh.md
+++ b/docs/subsystems/slots.zh.md
@@ -8,7 +8,7 @@ Slots 是 Web Client 的类型化 React 组合系统。[`dsh-client-ui-slots`](.
`plugins.bundle.config` 以 npm 包名为 key,提供 Bundle 详情配置。`plugins.bundle.activation` 在用户显式启用后渲染可选引导,由拥有者提供关闭引导和打开该 Bundle 详情的回调。`conversation.input.activity` 提供模型选择器与发送按钮之间的单个活动控件,可展开工具栏并在卸载时释放展开状态。
-插件目录声明 `plugins.add.actions`,它是 root 作用域的 list,在添加插件菜单的安装项之后提供 `MenuItemButton` 行。owner 提供 `onDismiss()`,用于开始动作前关闭菜单。同时声明 `plugins.bundle.usage`,它是 root 作用域的 keyed slot,在组件详情之前提供使用指引。后者以 npm 包名分派,并传入 `{ pkg: PluginPackageRef }`;占用者根据组合包的安装和启用状态决定适用动作。两者均遵循所属插件页面声明的生命周期。
+插件目录声明 `plugins.add.actions`,它是 root 作用域的 list,在添加插件菜单的安装项之后提供 `MenuItemButton` 行。owner 提供 `onDismiss()`,用于开始动作前关闭菜单。该 slot 遵循所属插件页面声明的生命周期。
## 声明与生命周期
@@ -137,8 +137,6 @@ root
├─ main
│ ├─ plugins.add.actions
│ ├─ plugins.item
-│ ├─ plugins.bundle.activation
-│ ├─ plugins.bundle.usage
│ ├─ plugins.bundle.config
│ ├─ plugins.row.config
│ ├─ plugins.detail.actions
diff --git a/packages/client/ui-agent-preset/README.i18n.yaml b/packages/client/ui-agent-preset/README.i18n.yaml
index 11cb1aeee2..5f556eca51 100644
--- a/packages/client/ui-agent-preset/README.i18n.yaml
+++ b/packages/client/ui-agent-preset/README.i18n.yaml
@@ -15,8 +15,8 @@
en: d152484eb41ac6b4
zh: b3ad7867f23dad1c
/deepseek-ai-dsh-client-ui-agent-preset/use-this-package:
- en: d778cf8ed737f5f8
- zh: 3cf1a1d9f8c14d38
+ en: 3f1c4b7b23f9b379
+ zh: b87af50275888cb1
/deepseek-ai-dsh-client-ui-agent-preset/understand-the-implementation:
en: 7813f0063c15e241
zh: 6eabc242edfc45ec
diff --git a/packages/client/ui-agent-preset/README.md b/packages/client/ui-agent-preset/README.md
index 957944bf3e..2d34e810c3 100644
--- a/packages/client/ui-agent-preset/README.md
+++ b/packages/client/ui-agent-preset/README.md
@@ -31,7 +31,7 @@ Coding Tools in General Settings control ordinary preset selection: with them of
Known shipped presets offer mode details and usage examples in a read-only dialog. Its tabs preserve each page's scroll position; closing returns focus to the opening action. Help does not change the new-task default. The default badge replaces the card's group badge, and the preset id appears beside the title. Guide copy and examples belong to this package.
-The new-task picker and session header also open the same read-only help. The Plugins page’s “Add plugin” menu offers “Let the agent create a plugin”, including when Coding Tools are off. Choosing it closes the menu and stages Creator for one task without submitting a message, replacing a draft, or changing global preferences. With Coding Tools off, the new-task page shows only a read-only Creator label and help; it offers no preset switching. The next ordinary task uses the saved default. The menu item stays in place while the roster loads or refreshes, and explains why it is disabled when Creator mode is unavailable. The optional slot contribution disappears with its owner.
+The Plugins page’s “Add plugin” menu offers “Let the agent create a plugin”, including when Coding Tools are off. Choosing it closes the menu and stages Creator for one task without submitting a message, replacing a draft, or changing global preferences. With Coding Tools off, the new-task page shows a read-only Creator label that opens its help; it offers no preset switching. The next ordinary task uses the saved default. The menu item stays in place while the roster loads or refreshes, and explains why it is disabled when Creator mode is unavailable. The optional slot contribution disappears with its owner.
## Understand the implementation
diff --git a/packages/client/ui-agent-preset/README.zh.md b/packages/client/ui-agent-preset/README.zh.md
index f4d8474c41..7be610ad2a 100644
--- a/packages/client/ui-agent-preset/README.zh.md
+++ b/packages/client/ui-agent-preset/README.zh.md
@@ -31,7 +31,7 @@ kind: "package-reference"
已知的内置预设提供只读的模式说明与使用示例对话框。各页签保留各自的滚动位置;关闭后焦点回到打开它的操作。帮助不会改变新任务默认值。默认徽标取代卡片的分组徽标,预设 id 显示在标题旁。指南文案与示例归本包所有。
-新任务选择器和任务标题也可打开同一份只读说明。插件页的「添加插件」菜单提供「让 Agent 创建插件」,代码工作工具关闭时也可使用。选择后关闭菜单,为一次任务暂存创造模式,不发送消息、不替换草稿,也不修改全局偏好。代码工作工具关闭时,新任务页仅显示只读的创造模式标签和说明,不提供预设切换;之后的普通任务继续使用已保存的默认值。预设列表加载或刷新时菜单项保持原位;创造模式不可用时禁用,并解释原因。菜单项由可选插槽贡献,随所属插件卸载而移除。
+插件页的「添加插件」菜单提供「让 Agent 创建插件」,代码工作工具关闭时也可使用。选择后关闭菜单,为一次任务暂存创造模式,不发送消息、不替换草稿,也不修改全局偏好。代码工作工具关闭时,新任务页显示只读的创造模式标签,点击可打开说明,不提供预设切换;之后的普通任务继续使用已保存的默认值。预设列表加载或刷新时菜单项保持原位;创造模式不可用时禁用,并解释原因。菜单项由可选插槽贡献,随所属插件卸载而移除。
## 理解实现
diff --git a/packages/client/ui-agent-preset/src/client/AgentPresetLabel.module.css b/packages/client/ui-agent-preset/src/client/AgentPresetLabel.module.css
index dc08b0ce98..f828de9af1 100644
--- a/packages/client/ui-agent-preset/src/client/AgentPresetLabel.module.css
+++ b/packages/client/ui-agent-preset/src/client/AgentPresetLabel.module.css
@@ -1,4 +1,4 @@
-/* Session-header preset details never change the task's selected mode. */
+/* Session-header agent-preset label: static chrome, never a control. */
.label {
display: inline-flex;
@@ -7,7 +7,6 @@
max-width: 180px;
padding: 0 2px 0 0;
height: 22px;
- border: none;
border-radius: var(--dsw-radius-xs);
background: var(--dsw-alias-fill-tsp-secondary);
font-size: 12px;
@@ -18,33 +17,14 @@
text-overflow: ellipsis;
}
-.name {
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.details {
- cursor: pointer;
-}
-
-.details:hover {
- background: var(--dsw-alias-interactive-bg-hover);
- color: var(--dsw-alias-label-primary);
-}
-
-.details:focus-visible {
- outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);
- outline-offset: 2px;
-}
-
.icon {
flex: none;
opacity: 0.7;
}
/* First sacrifice when the title row (the enclosing inline-size container)
- runs out of width: mode help yields before task actions lose their labels. */
+ runs out of width: the preset is passive chrome, so it yields before any
+ interactive header action loses its label. */
@container (max-width: 540px) {
.label {
display: none;
diff --git a/packages/client/ui-agent-preset/src/client/AgentPresetLabel.tsx b/packages/client/ui-agent-preset/src/client/AgentPresetLabel.tsx
index 968cc14ce4..26fdcfcbf6 100644
--- a/packages/client/ui-agent-preset/src/client/AgentPresetLabel.tsx
+++ b/packages/client/ui-agent-preset/src/client/AgentPresetLabel.tsx
@@ -3,21 +3,20 @@
*
* Read-only by construction: a session's composition is fixed once its
* conversation starts, and a header is only worth reading after that. Offering
- * a selection control here would promise a switch the host refuses. Its
- * read-only details explain the mode, and the choice itself lives on the
+ * a control here would promise a switch the host refuses; naming what the
+ * session runs is the honest affordance, and the choice itself lives on the
* new-session screen ({@link AgentPresetSeat}).
*/
-import { useEffect, useState } from 'react'
+import { useEffect } from 'react'
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
-import { IconAgentPresetOutlineRegular, Modal } from '@deepseek-ai/dsh-client-ui-primitives'
+import { IconAgentPresetOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
// Type-only: pulls the ui-conversation SlotMap merge (the header actions).
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
import type {} from '@deepseek-ai/dsh-agent-preset-registry/types'
import type { AgentPresetSettingsState } from './settings-store.ts'
-import { isBuiltInPreset, presetDisplayText } from './locales.ts'
-import { PresetGuideDialog, presetGuide } from './PresetGuideDialog.tsx'
+import { presetDisplayText } from './locales.ts'
import css from './AgentPresetLabel.module.css'
/** Registration-side business face for the header label. */
@@ -49,10 +48,6 @@ export function AgentPresetLabel({
return typeof value === 'string' ? value : undefined
})
const options = useAgentPresets(state => state.options)
- const [detailsOpen, setDetailsOpen] = useState(false)
- const option = options.find(entry => entry.id === preset)
-
- useEffect(() => { setDetailsOpen(false) }, [sessionId, preset, option?.id])
useEffect(() => {
// Deployments that compose no presets never label anything, so the roster
@@ -62,28 +57,12 @@ export function AgentPresetLabel({
if (preset === undefined) return null
+ const option = options.find(entry => entry.id === preset)
const text = option === undefined ? undefined : presetDisplayText(option, t)
- const label = text?.name ?? preset
- const guide = option === undefined ? undefined : presetGuide(option.id, isBuiltInPreset(option) ? 'system' : 'user')
- if (option === undefined) return (
-
+ return (
+
- {label}
+ {text?.name ?? preset}
)
- return (
- <>
- { setDetailsOpen(true) }}>
-
- {label}
-
- {!detailsOpen ? null : guide === undefined ? (
- { setDetailsOpen(false) }} />
- ) : (
- { setDetailsOpen(false) }} />
- )}
- >
- )
}
diff --git a/packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css b/packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css
index da8988db87..04f27d122d 100644
--- a/packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css
+++ b/packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css
@@ -1,39 +1,6 @@
/* Agent-preset chip on the new-session screen, beside the workspace picker.
Geometry mirrors HeroShell's .workspace so the two read as one row. */
-.controls {
- display: inline-flex;
- align-items: center;
- gap: 2px;
- min-width: 0;
- max-width: 100%;
-}
-
-.details {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- flex: none;
- width: 24px;
- height: 28px;
- padding: 0;
- border: none;
- border-radius: var(--dsw-radius-sm);
- background: transparent;
- color: var(--dsw-alias-label-caption);
- cursor: pointer;
-}
-
-.details:hover {
- background: var(--dsw-alias-interactive-bg-hover);
- color: var(--dsw-alias-label-primary);
-}
-
-.details:focus-visible {
- outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);
- outline-offset: 2px;
-}
-
/* Overflow-driven degradation (mirrors HeroShell's .workspace), no
breakpoint: the label shrinks with an ellipsis down to nothing, so the
preset icon and chevron always sit snug against whatever text remains —
@@ -67,7 +34,7 @@
cursor: pointer;
}
-button.seat:not(:disabled):hover,
+.seat:not(:disabled):hover,
.seat[aria-expanded='true'] {
background: var(--dsw-alias-interactive-bg-hover);
}
@@ -77,10 +44,6 @@ button.seat:not(:disabled):hover,
color: var(--dsw-alias-label-quaternary);
}
-.readOnly {
- cursor: default;
-}
-
.seatIcon {
flex: none;
color: var(--dsw-alias-label-primary);
diff --git a/packages/client/ui-agent-preset/src/client/AgentPresetSeat.tsx b/packages/client/ui-agent-preset/src/client/AgentPresetSeat.tsx
index 29bf6ec0da..8f2a5c4d7c 100644
--- a/packages/client/ui-agent-preset/src/client/AgentPresetSeat.tsx
+++ b/packages/client/ui-agent-preset/src/client/AgentPresetSeat.tsx
@@ -16,8 +16,7 @@ import { useEffect, useRef, useState } from 'react'
import type { ObservableSnapshot, SnapshotStore } from '@deepseek-ai/dsh-client-store'
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
import {
- IconAgentPresetOutlineRegular, IconChevronDownOutlineRegular, IconInfoOutlineRegular, IconWarningOutlineRegular,
- Menu, Modal, Toast, Tooltip,
+ IconAgentPresetOutlineRegular, IconChevronDownOutlineRegular, IconWarningOutlineRegular, Menu, Modal, Toast,
} from '@deepseek-ai/dsh-client-ui-primitives'
// Type-only: pulls the ui-conversation SlotMap merge (the hero seat).
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
@@ -29,7 +28,7 @@ import css from './AgentPresetSeat.module.css'
/** Registration-side business face for the hero chip. */
export interface AgentPresetSeatInjected {
hooks: {
- /** Shared Developer tools preference; off hides the chip. */
+ /** Shared Developer tools preference; off hides ordinary preset selection. */
developerTools: ObservableSnapshot
/** Seat snapshot bound by the renderer as useAgentPresetSeat. */
agentPresetSeat: SnapshotStore
@@ -104,12 +103,11 @@ export function AgentPresetSeat({
useEffect(() => {
if (developerTools) return
setOpen(false)
- setDetailsOpen(false)
setToast(null)
}, [developerTools])
const chosen = state.options.find(option => option.id === state.current)
- useEffect(() => { setDetailsOpen(false) }, [state.current, chosen?.id])
+ useEffect(() => { setDetailsOpen(false) }, [developerTools, state.current, chosen?.id])
const chosenText = chosen === undefined ? undefined : presetDisplayText(chosen, t)
const label = chosenText?.name ?? state.current
@@ -161,7 +159,7 @@ export function AgentPresetSeat({
: label
return (
-
+ <>
{developerTools ?
{ setOpen(false) }}
@@ -215,25 +213,14 @@ export function AgentPresetSeat({
)}
/> : (
-
+ { setDetailsOpen(true) }}>
{shownLabel}
-
+
)}
- {chosen === undefined ? null : (
-
- { setOpen(false); setDetailsOpen(true) }}
- >
-
-
-
- )}
- {!detailsOpen || chosen === undefined ? null : guide === undefined ? (
+ {!detailsOpen || developerTools || chosen === undefined ? null : guide === undefined ? (
{ setDetailsOpen(false) }} />
) : (
@@ -253,6 +240,6 @@ export function AgentPresetSeat({
onDone={() => { setToast(null) }}
/>
)}
-
+ >
)
}
diff --git a/packages/client/ui-agent-preset/tests/components.client.spec.tsx b/packages/client/ui-agent-preset/tests/components.client.spec.tsx
index 1c71c0b866..97914c2b3a 100644
--- a/packages/client/ui-agent-preset/tests/components.client.spec.tsx
+++ b/packages/client/ui-agent-preset/tests/components.client.spec.tsx
@@ -49,12 +49,6 @@ function translate(key: keyof typeof en, params?: Record): stri
: template.replace(/\{(\w+)\}/g, (match, name: string) => name in params ? String(params[name]) : match)
}
-function seatTrigger(): HTMLElement {
- const button = screen.getAllByRole('button').find(item => item.getAttribute('aria-haspopup') === 'menu')
- if (button === undefined) throw new Error('No preset selection trigger')
- return button
-}
-
function renderSeat(
state: Partial = {},
select: () => Promise = () => Promise.resolve(undefined),
@@ -95,7 +89,7 @@ function renderLabel(
useAgentPresets: bindSnapshotSelector(store),
t: (key: keyof typeof en) => en[key],
} as unknown as AgentPresetLabelProps)} />)
- return { load, view, store }
+ return { load, view }
}
describe('the new-session chip', () => {
@@ -105,44 +99,11 @@ describe('the new-session chip', () => {
expect(screen.queryByRole('button')).toBeNull()
})
- it('offers only read-only Creator help while Developer tools are off', () => {
- const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }, { id: 'standard' }] },
- undefined, undefined, false)
- expect(screen.getByText(en.presetCordisName)).toBeTruthy()
- expect(screen.queryByRole('menu')).toBeNull()
- expect(document.querySelector('[aria-haspopup="menu"]')).toBeNull()
- const trigger = screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetCordisName}` })
- trigger.focus()
- fireEvent.click(trigger)
- expect(screen.getByRole('dialog', { name: en.presetCordisName })).toBeTruthy()
- fireEvent.keyDown(document.activeElement!, { key: 'Escape' })
- expect(screen.queryByRole('dialog')).toBeNull()
- expect(document.activeElement).toBe(trigger)
- expect(actions.select).not.toHaveBeenCalled()
- expect(actions.developerTools.getSnapshot()).toBe(false)
-
- act(() => { actions.store.set({ ...actions.store.getSnapshot(), current: 'standard' }) })
- expect(screen.queryByRole('button')).toBeNull()
- expect(screen.queryByText(en.presetCordisName)).toBeNull()
- })
-
- it('removes the Creator picker when Coding Tools turn off but keeps read-only help', () => {
- const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }, { id: 'standard' }] })
- fireEvent.click(seatTrigger())
- expect(screen.getByRole('menu')).toBeTruthy()
- act(() => { actions.developerTools.set(false) })
- expect(screen.queryByRole('menu')).toBeNull()
- expect(document.querySelector('[aria-haspopup="menu"]')).toBeNull()
- expect(screen.getByText(en.presetCordisName)).toBeTruthy()
- expect(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetCordisName}` })).toBeTruthy()
- expect(actions.select).not.toHaveBeenCalled()
- })
-
it('renders only for a Session retained by the main view', () => {
renderSeat({}, undefined, {
id: 's1', retainInfo: { referenceCount: 1, retainedBy: { mainView: 1 } },
})
- expect(seatTrigger()).toBeTruthy()
+ expect(screen.getByRole('button')).toBeTruthy()
cleanup()
renderSeat({}, undefined, { id: 's1', retainInfo: undefined })
@@ -153,14 +114,14 @@ describe('the new-session chip', () => {
const actions = renderSeat()
await waitFor(() => { expect(actions.load).toHaveBeenCalledTimes(1) })
- expect(seatTrigger().textContent).toContain(en.presetStandardName)
- expect(seatTrigger().getAttribute('title')).toBe(en.seatHint)
+ expect(screen.getByRole('button').textContent).toContain(en.presetStandardName)
+ expect(screen.getByRole('button').getAttribute('title')).toBe(en.seatHint)
})
it('offers each preset with what it is for', () => {
renderSeat()
- fireEvent.click(seatTrigger())
+ fireEvent.click(screen.getByRole('button'))
// The id alone never said what a preset does; the description is the
// whole reason a preset can publish metadata at all.
@@ -173,49 +134,49 @@ describe('the new-session chip', () => {
it('closes the picker immediately when developer tools turn off without changing the staged preset', () => {
const actions = renderSeat()
- fireEvent.click(seatTrigger())
+ fireEvent.click(screen.getByRole('button'))
expect(screen.getByText(en.presetStandardDescription)).toBeTruthy()
act(() => { actions.developerTools.set(false) })
expect(screen.queryByRole('button')).toBeNull()
expect(screen.queryByText(en.presetStandardDescription)).toBeNull()
expect(actions.select).not.toHaveBeenCalled()
act(() => { actions.developerTools.set(true) })
- expect(seatTrigger().getAttribute('aria-expanded')).toBe('false')
- expect(seatTrigger().textContent).toContain(en.presetStandardName)
+ expect(screen.getByRole('button').getAttribute('aria-expanded')).toBe('false')
+ expect(screen.getByRole('button').textContent).toContain(en.presetStandardName)
})
it('falls back to the id when the staged preset published no name', () => {
renderSeat({ current: 'mine' })
- expect(seatTrigger().textContent).toContain('mine')
+ expect(screen.getByRole('button').textContent).toContain('mine')
})
it('shows the staged id until a stale roster contains it', () => {
renderSeat({ current: 'arriving' })
- expect(seatTrigger().textContent).toContain('arriving')
+ expect(screen.getByRole('button').textContent).toContain('arriving')
})
it('stages the picked preset and closes the menu', () => {
const actions = renderSeat()
- fireEvent.click(seatTrigger())
+ fireEvent.click(screen.getByRole('button'))
fireEvent.click(screen.getByText('mine'))
expect(actions.select).toHaveBeenCalledWith('mine')
- expect(seatTrigger().getAttribute('aria-expanded')).toBe('false')
+ expect(screen.getByRole('button').getAttribute('aria-expanded')).toBe('false')
})
it('disables the trigger while a switch is in flight', () => {
renderSeat({ busy: true })
- expect(seatTrigger()).toHaveProperty('disabled', true)
+ expect(screen.getByRole('button')).toHaveProperty('disabled', true)
})
it('shows a refused switch on the trigger', () => {
renderSeat({ error: 'session has already started' })
- expect(seatTrigger().getAttribute('title')).toBe('session has already started')
+ expect(screen.getByRole('button').getAttribute('title')).toBe('session has already started')
})
it('renders nothing before the roster arrives or when there is none', () => {
@@ -230,76 +191,73 @@ describe('the new-session chip', () => {
it('closes on an outside dismissal', () => {
renderSeat()
- fireEvent.click(seatTrigger())
+ fireEvent.click(screen.getByRole('button'))
fireEvent.keyDown(document, { key: 'Escape' })
- expect(seatTrigger().getAttribute('aria-expanded')).toBe('false')
+ expect(screen.getByRole('button').getAttribute('aria-expanded')).toBe('false')
})
+})
- it('opens mode help without selecting and returns keyboard focus after Escape', () => {
- const actions = renderSeat()
- const trigger = screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` })
- trigger.focus()
- fireEvent.click(trigger)
-
- expect(screen.getByRole('dialog', { name: en.presetStandardName })).toBeTruthy()
- expect(document.activeElement).toBe(screen.getByRole('tab', { name: en.modeExplanation }))
- fireEvent.click(screen.getByRole('tab', { name: en.howToUse }))
- expect(screen.getByRole('tab', { name: en.howToUse }).getAttribute('aria-selected')).toBe('true')
- fireEvent.keyDown(document.activeElement!, { key: 'Escape' })
-
+describe('Creator with Coding Tools off', () => {
+ it('opens read-only help from the label without offering a preset switch or changing preferences', () => {
+ const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }] }, undefined, undefined, false)
+ const label = screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetCordisName}` })
+ expect(label.getAttribute('aria-haspopup')).toBe('dialog')
+ expect(document.querySelector('[aria-haspopup="menu"]')).toBeNull()
+ label.focus()
+ fireEvent.click(label)
+ expect(screen.getByRole('dialog', { name: en.presetCordisName })).toBeTruthy()
+ fireEvent.keyDown(screen.getByRole('tab', { name: en.modeExplanation }), { key: 'Escape' })
expect(screen.queryByRole('dialog')).toBeNull()
- expect(document.activeElement).toBe(trigger)
+ expect(document.activeElement).toBe(label)
expect(actions.select).not.toHaveBeenCalled()
+ expect(actions.developerTools.getSnapshot()).toBe(false)
+
+ act(() => { actions.store.set({ ...SEAT_READY }) })
+ expect(screen.queryByRole('button')).toBeNull()
})
- it('uses only a custom preset description even when it names a built-in id', () => {
- const actions = renderSeat({ options: [{ id: 'standard', name: 'My workflow', description: 'Our review workflow' }] })
- fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: My workflow` }))
-
- expect(screen.getByRole('dialog', { name: 'My workflow' }).textContent).toContain('Our review workflow')
- expect(screen.queryByRole('tab')).toBeNull()
- fireEvent.click(screen.getByRole('button', { name: en.close }))
- expect(screen.queryByRole('dialog')).toBeNull()
- expect(actions.select).not.toHaveBeenCalled()
- })
-
- it('explains a custom preset with no description without offering built-in guidance', () => {
- const actions = renderSeat({ current: 'mine' })
- fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: mine` }))
- expect(screen.getByRole('dialog', { name: 'mine' }).textContent).toContain(en.noDescription)
- expect(screen.queryByRole('tab')).toBeNull()
- fireEvent.click(screen.getByRole('button', { name: en.close }))
- expect(screen.queryByRole('dialog')).toBeNull()
- expect(actions.select).not.toHaveBeenCalled()
- })
-
- it('forgets open help when developer tools turn off', () => {
- const actions = renderSeat()
- fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` }))
+ it('replaces an open picker with the read-only label and clears help when Coding Tools return', () => {
+ const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }] })
+ fireEvent.click(screen.getByRole('button'))
+ expect(screen.getByRole('menu')).toBeTruthy()
act(() => { actions.developerTools.set(false) })
- expect(screen.queryByRole('dialog')).toBeNull()
+ expect(screen.queryByRole('menu')).toBeNull()
+ fireEvent.click(screen.getByRole('button'))
+ expect(screen.getByRole('dialog')).toBeTruthy()
act(() => { actions.developerTools.set(true) })
expect(screen.queryByRole('dialog')).toBeNull()
+ expect(screen.getByRole('button').getAttribute('aria-haspopup')).toBe('menu')
+ act(() => { actions.developerTools.set(false) })
+ expect(screen.queryByRole('dialog')).toBeNull()
+ expect(actions.select).not.toHaveBeenCalled()
})
- it.each([
- { name: 'no presets', options: [] },
- { name: 'another preset', options: [{ id: 'mine' }] },
- ])('keeps help closed when the current preset returns after removal leaves $name', ({ options }) => {
- const actions = renderSeat()
- const before = actions.store.getSnapshot()
- fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` }))
- expect(screen.getByRole('dialog', { name: en.presetStandardName })).toBeTruthy()
-
- act(() => { actions.store.set({ ...before, options }) })
+ it.each<{ description?: string; expected: string }>([
+ { description: 'My own plugin authoring setup', expected: 'My own plugin authoring setup' },
+ { expected: en.noDescription },
+ ])('shows only declared help for a custom Creator preset: $expected', (copy) => {
+ const option = { id: 'cordis', name: 'My creator', ...(copy.description === undefined ? {} : { description: copy.description }) }
+ renderSeat({ current: 'cordis', options: [option] }, undefined, undefined, false)
+ fireEvent.click(screen.getByRole('button'))
+ expect(screen.getByRole('dialog', { name: 'My creator' }).textContent).toContain(copy.expected)
+ expect(screen.queryByRole('tab')).toBeNull()
+ fireEvent.click(screen.getByRole('button', { name: en.close }))
expect(screen.queryByRole('dialog')).toBeNull()
- act(() => { actions.store.set(before) })
+ })
+ it('closes help when the preset disappears and does not reopen it when the roster recovers', () => {
+ const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }] }, undefined, undefined, false)
+ fireEvent.click(screen.getByRole('button'))
+ expect(screen.getByRole('dialog')).toBeTruthy()
+ act(() => { actions.store.set({ ...actions.store.getSnapshot(), options: [{ id: 'standard' }], error: 'Unavailable' }) })
expect(screen.queryByRole('dialog')).toBeNull()
- expect(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` })).toBeTruthy()
- expect(actions.select).not.toHaveBeenCalled()
+ expect(screen.getByRole('button')).toHaveProperty('disabled', true)
+ expect(screen.getByRole('button').getAttribute('title')).toBe('Unavailable')
+ act(() => { actions.store.set({ ...actions.store.getSnapshot(), options: [{ id: 'cordis' }], error: null }) })
+ expect(screen.queryByRole('dialog')).toBeNull()
+ expect(screen.getByRole('button')).toHaveProperty('disabled', false)
})
})
@@ -312,7 +270,7 @@ describe('a refused switch', () => {
const reason = 'failed to import loader entry live-on-mac (@deepseek-ai/dsh-also-gone)'
renderSeat({}, () => Promise.resolve(reason))
- fireEvent.click(seatTrigger())
+ fireEvent.click(screen.getByRole('button'))
fireEvent.click(screen.getByRole('menuitem', { name: /mine/ }))
// The host refuses a mount discovery reported healthy, so this banner is
@@ -334,7 +292,7 @@ describe('a refused switch', () => {
it('says nothing when the switch lands', async () => {
const actions = renderSeat()
- fireEvent.click(seatTrigger())
+ fireEvent.click(screen.getByRole('button'))
fireEvent.click(screen.getByRole('menuitem', { name: /mine/ }))
await waitFor(() => { expect(actions.select).toHaveBeenCalledWith('mine') })
@@ -350,22 +308,19 @@ describe('the chip introduce cue', () => {
/** Character spans carry inline animation delays; nothing else does. */
function delayedChars(): HTMLElement[] {
- return Array.from(seatTrigger().querySelectorAll('[style]'))
+ return Array.from(screen.getByRole('button').querySelectorAll('[style]'))
}
- it('announces a read-only Creator entry without exposing a picker or changing Coding Tools', () => {
+ it('announces Creator on its read-only label while Coding Tools remain off', () => {
vi.stubGlobal('matchMedia', vi.fn(() => ({ matches: false })))
vi.useFakeTimers()
- const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }], introduce: true },
- undefined, undefined, false)
- const label = screen.getByTitle(en.presetCordisDescription)
- expect(label.textContent).toBe(en.presetCordisName)
- expect(label.querySelectorAll('[style]').length).toBeGreaterThan(0)
- expect(document.querySelector('[aria-haspopup="menu"]')).toBeNull()
-
+ const actions = renderSeat({ current: 'cordis', options: [{ id: 'cordis' }], introduce: true }, undefined, undefined, false)
+ expect(delayedChars().map(span => span.textContent).join('')).toBe(en.presetCordisName)
+ expect(screen.getByRole('button').getAttribute('aria-haspopup')).toBe('dialog')
+ expect(actions.introduced).not.toHaveBeenCalled()
act(() => { vi.advanceTimersByTime(750) })
- expect(actions.introduced).toHaveBeenCalledOnce()
- expect(label.querySelectorAll('[style]')).toHaveLength(0)
+ expect(actions.introduced).toHaveBeenCalledTimes(1)
+ expect(delayedChars()).toHaveLength(0)
expect(actions.developerTools.getSnapshot()).toBe(false)
expect(actions.select).not.toHaveBeenCalled()
})
@@ -455,61 +410,11 @@ describe('the session-header label', () => {
})
await waitFor(() => { expect(load).toHaveBeenCalledTimes(1) })
- // Reading details never offers a change to the task's preset.
- expect(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` })).toBeTruthy()
- expect(screen.queryByRole('menu')).toBeNull()
+ // A control here would promise a switch the host refuses outright.
+ expect(screen.queryByRole('button')).toBeNull()
expect(screen.getByTitle(en.presetStandardDescription).textContent).toBe(en.presetStandardName)
})
- it('opens read-only mode help from a running task and restores focus on close', () => {
- renderLabel({ blank: false, projectionValues: { agentPreset: 'standard' } })
- const trigger = screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` })
- trigger.focus()
- fireEvent.click(trigger)
-
- expect(screen.getByRole('dialog', { name: en.presetStandardName })).toBeTruthy()
- expect(screen.queryByRole('menu')).toBeNull()
- fireEvent.click(screen.getByRole('button', { name: en.close }))
- expect(screen.queryByRole('dialog')).toBeNull()
- expect(document.activeElement).toBe(trigger)
- })
-
- it('displays the custom description without claiming built-in capabilities', () => {
- renderLabel({ blank: false, projectionValues: { agentPreset: 'standard' } }, {
- options: [{ id: 'standard', name: 'Review only', description: 'Describe changes for review' }],
- })
- fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: Review only` }))
- expect(screen.getByRole('dialog', { name: 'Review only' }).textContent).toContain('Describe changes for review')
- expect(screen.queryByRole('tab')).toBeNull()
- })
-
- it('opens and closes help for a custom session preset that has no description', () => {
- renderLabel({ blank: false, projectionValues: { agentPreset: 'mine' } })
- const trigger = screen.getByRole('button', { name: `${en.modeExplanation}: mine` })
- trigger.focus()
- fireEvent.click(trigger)
- expect(screen.getByRole('dialog', { name: 'mine' }).textContent).toContain(en.noDescription)
- expect(screen.queryByRole('tab')).toBeNull()
- fireEvent.click(screen.getByRole('button', { name: en.close }))
- expect(screen.queryByRole('dialog')).toBeNull()
- expect(document.activeElement).toBe(trigger)
- })
-
- it('keeps help closed when the session preset returns after leaving the roster', () => {
- const { store } = renderLabel({ blank: false, projectionValues: { agentPreset: 'standard' } })
- const before = store.getSnapshot()
- fireEvent.click(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` }))
- expect(screen.getByRole('dialog', { name: en.presetStandardName })).toBeTruthy()
-
- act(() => { store.set({ ...before, options: [{ id: 'mine' }] }) })
- expect(screen.queryByRole('dialog')).toBeNull()
- expect(screen.getByTitle(en.headerHint).textContent).toBe('standard')
- act(() => { store.set(before) })
-
- expect(screen.queryByRole('dialog')).toBeNull()
- expect(screen.getByRole('button', { name: `${en.modeExplanation}: ${en.presetStandardName}` })).toBeTruthy()
- })
-
it('falls back to the id, and to the generic hint, when metadata is absent', () => {
renderLabel({ blank: true, projectionValues: { agentPreset: 'mine' } })
diff --git a/packages/client/ui-plugin-manager/README.i18n.yaml b/packages/client/ui-plugin-manager/README.i18n.yaml
index 29049aeef2..732e4f9659 100644
--- a/packages/client/ui-plugin-manager/README.i18n.yaml
+++ b/packages/client/ui-plugin-manager/README.i18n.yaml
@@ -18,11 +18,11 @@
en: b7d2396da72ecac4
zh: 4ec8336478dd39c7
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/installing-a-bundle:
- en: ea02185c3ec03a41
- zh: 0e1e5d641fa1c8f6
+ en: 7fe665944e8b8377
+ zh: faf09d639eca62dd
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-a-bundle:
- en: a5f9da50f4fb3b23
- zh: c2160c918574616a
+ en: abc90531efa889d5
+ zh: 0562570f85e69c35
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-one-row-of-a-bundle:
en: 620c6a3ee20848bd
zh: a9429f047a12bb4c
@@ -30,8 +30,8 @@
en: c32019330fd9586d
zh: dd22110abd10159c
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/detail-page-extension-points:
- en: a5bd63206fa48e20
- zh: 335b8dac564554df
+ en: 87f6d96467dc2383
+ zh: e0fb91aa4c4d5a12
/deepseek-ai-dsh-client-ui-plugin-manager/understand-the-implementation:
en: 8ca48e1365f18adf
zh: 91eadd683d2d8b5b
diff --git a/packages/client/ui-plugin-manager/README.md b/packages/client/ui-plugin-manager/README.md
index ea4afd5203..110db393b4 100644
--- a/packages/client/ui-plugin-manager/README.md
+++ b/packages/client/ui-plugin-manager/README.md
@@ -39,6 +39,8 @@ The **Refresh** button shows its tooltip after 500 ms of hovering or keyboard fo
The **Add plugin** primary button directly opens the existing installation dialog. Its separate arrow button, **Choose how to add a plugin**, opens a menu: **Install a third-party plugin** opens that same dialog with focus in its package-name field; plugin-contributed creation actions follow it. The two buttons have independent click targets and accessible names. Arrow keys move between menu rows, Escape closes back to the arrow button, and the menu stays within the viewport. While an installation is tracked, **View installation** opens that task directly.
+`plugins.add.actions` adds root-scoped `MenuItemButton` rows after installation in this menu. Its owner supplies `onDismiss()`, which a contribution calls before starting its action.
+
On first use, when pnpm uses the unconfigured official npm registry and npmmirror is offered, the Host probes both registries in parallel. The first successful HTTPS ping response selects the initial source. The dialog preserves remembered choices, manual selections, explicit manager configuration, and custom or unknown pnpm registries. An install clicked during initial probing waits for that bounded operation; a late result cannot overwrite a manual choice or reopen a closed dialog.
The Host sends GET requests to `https://registry.npmjs.org/-/ping` and `https://registry.npmmirror.com/-/ping` through its normal fetch proxy. A 2xx response wins; redirects and failures do not. The remaining request is cancelled, both response bodies are discarded, and cleanup completes before the result returns. The default deadline is 1500 ms and results, including unavailable results, are cached for five minutes. Configure `registryProbeTimeoutMs` and `registryProbeCacheTtlMs` on `ui-plugin-manager`; `registryProbeEnabled: false` disables probing. If both requests fail or time out, the existing default remains selected. No IP-location service or Session content is involved.
@@ -51,7 +53,7 @@ When the Host attributes a network failure or timeout to a GitHub address and of
### Switching a bundle
-A bundle's page shows its readable row names and descriptions under **What this plugin provides**, with duplicate descriptions grouped once and unavailable metadata omitted. Its scope is all sessions in this deployment; each session's mode still determines its tools. **Components and runtime status** folds package names, row identifiers, switches, and diagnostics by default and opens when a package, metadata, or row failure is reported. Declared changes to existing rows appear as a count under **Changes to existing capabilities**, with their ids inside the folded section. A bundle's switch changes its layer selection. A profile with HMR recomposes before the operation completes; one without HMR, and a bundle a higher layer overrides, say so in a toast. A bundle the Host cannot read carries a problem tag and its reason on its page and cannot be switched on; one that provides the management components stays locked. The Host answers with error codes, which the page's dictionary words; pnpm's and the Loader's own diagnostics are shown as they are. The page excludes built-in profile bundles from cards and counts even when the profile holds them as dependencies or the Host reports an error. The Host inventory remains complete; the Settings Plugins section's Plugin list tab inspects their plugins.
+A bundle's page shows its full package name under the title, the spec that installs it elsewhere. A bundle's switch changes its layer selection. A profile with HMR recomposes before the operation completes; one without HMR, and a bundle a higher layer overrides, say so in a toast. A bundle the Host cannot read carries a problem tag and its reason on its page and cannot be switched on; one that provides the management components stays locked. The Host answers with error codes, which the page's dictionary words; pnpm's and the Loader's own diagnostics are shown as they are. The page excludes built-in profile bundles from cards and counts even when the profile holds them as dependencies or the Host reports an error. The Host inventory remains complete; the Settings Plugins section's Plugin list tab inspects their plugins.
### Switching one row of a bundle
@@ -73,8 +75,6 @@ The bundle's patch must declare the row under that id, and the registration exis
### Detail page extension points
-`plugins.add.actions` adds root-scoped `MenuItemButton` rows after installation in the Add plugin menu. Its owner supplies `onDismiss()`, which a contribution calls before starting its action. `plugins.bundle.usage` is keyed by package name and receives `{ pkg: PluginPackageRef }`; it renders usage guidance and entry actions after the bundle description and before component details. Both follow the page declaration lifetime and accept contributions without importing feature components.
-
A plugin with something to say about a bundle, a row, or an official plugin it does not own contributes to that object's page through three list slots the page declares: `plugins.detail.actions` for a control at the head of the page, before the page's own switch and uninstall; `plugins.detail.badge` for a tag beside the title, after the version, experimental, and problem tags; and `plugins.detail.section` for a section under the page's own content — after the rows on a bundle's page, after the configuration on a row's or an official plugin's page. Every entry is rendered with the page's `subject`: `{ kind: 'bundle', pkg }`, `{ kind: 'row', pkg, row }`, or `{ kind: 'item', id }`, where `pkg` and `row` carry the name, version, installed and enabled facts, and the row list a contribution decides on. An entry renders null for a subject it has nothing for and draws its own section chrome; the page orders entries by `order`.
```tsx ignore-check
diff --git a/packages/client/ui-plugin-manager/README.zh.md b/packages/client/ui-plugin-manager/README.zh.md
index 1900e8909d..8d61561eb6 100644
--- a/packages/client/ui-plugin-manager/README.zh.md
+++ b/packages/client/ui-plugin-manager/README.zh.md
@@ -39,6 +39,8 @@ kind: "package-reference"
**添加插件**主按钮直接打开原安装对话框。旁边独立的箭头按钮**选择添加插件方式**打开菜单:**安装第三方插件**打开同一个对话框并聚焦包名输入框,插件贡献的创造动作接在其后。两个按钮有独立的点击区域和无障碍名称。方向键在菜单条目间移动,Escape 关闭菜单并返回箭头按钮,菜单位置受视口边界约束。已有安装任务时,**查看安装任务**直接打开该任务。
+`plugins.add.actions` 在此菜单的安装项之后提供 root 作用域的 `MenuItemButton` 行。owner 提供 `onDismiss()`,贡献者在开始动作前调用它关闭菜单。
+
首次使用时,如果未显式配置安装源、pnpm 使用官方 npm 源,且列表提供 npmmirror,Host 会并发探测这两个源,选择最先成功响应 HTTPS ping 的源。已记住的选择、用户手选、管理器显式配置,以及自定义或未知的 pnpm 源均保留。在初次探测期间点击安装会等待这次有时限的操作;迟到结果不会覆盖手选或重新打开已关闭的对话框。
Host 通过普通 fetch 代理向 `https://registry.npmjs.org/-/ping` 和 `https://registry.npmmirror.com/-/ping` 发送 GET 请求,以最先返回 2xx 的源为结果;重定向和失败不参与选择。随后取消另一条请求、丢弃两个响应体,并在清理完成后返回。默认时限为 1500 毫秒,包括不可用结果在内的探测结果均缓存五分钟。在 `ui-plugin-manager` 上配置 `registryProbeTimeoutMs` 和 `registryProbeCacheTtlMs`;`registryProbeEnabled: false` 关闭探测。两条请求都失败或超时时保留现有默认源。不使用 IP 地区服务,也不发送 Session 内容。
@@ -51,7 +53,7 @@ Host 将网络失败或超时归因于 GitHub 地址,且提供 npmmirror 时
### 切换一个组合包
-组合包页面在**这个插件提供**中展示组件的人类可读名称和说明,相同内容只列一次,缺少元信息时不补造。作用范围是此部署的所有会话,每个会话可用的工具仍由它的模式决定。**组件与运行状态**默认折叠包名、行标识、开关和诊断,出现包错误、元信息错误或组件运行异常时展开。声明的现有组件调整以数量显示在**调整现有能力**中,具体行 id 位于折叠区。组合包开关改变其层选择。启用了 HMR 的 profile 在操作完成前重组;没有 HMR 的 profile,以及被更高层覆盖的组合包,会以 toast 说明。Host 读不了的组合包带异常标签,其页面给出原因,且不能打开;提供管理组件的组合包保持锁定。Host 以错误码作答,由页面字典措辞;pnpm 与 Loader 自己的诊断原样显示。页面从卡片与数量中排除内置 profile 组合包,即使 profile 将它们列为依赖或 Host 报告了异常。Host 清单仍保留完整数据;设置中「插件」分区的「插件列表」标签页负责查看它们的插件。
+组合包页面在标题下方显示完整包名,也就是在别处安装它所需的 spec。组合包开关改变其层选择。启用了 HMR 的 profile 在操作完成前重组;没有 HMR 的 profile,以及被更高层覆盖的组合包,会以 toast 说明。Host 读不了的组合包带异常标签,其页面给出原因,且不能打开;提供管理组件的组合包保持锁定。Host 以错误码作答,由页面字典措辞;pnpm 与 Loader 自己的诊断原样显示。页面从卡片与数量中排除内置 profile 组合包,即使 profile 将它们列为依赖或 Host 报告了异常。Host 清单仍保留完整数据;设置中「插件」分区的「插件列表」标签页负责查看它们的插件。
### 切换组合包里的一行
@@ -73,8 +75,6 @@ ctx.slots.inject('plugins.row.config', () => ctx.slots.register({
### 详情页扩展点
-`plugins.add.actions` 在添加插件菜单的安装项之后提供 root 作用域的 `MenuItemButton` 行。owner 提供 `onDismiss()`,贡献者在开始动作前调用它关闭菜单。`plugins.bundle.usage` 以包名为键,接收 `{ pkg: PluginPackageRef }`,在组合包说明之后、组件详情之前渲染使用指引和入口动作。两者随页面声明的生命周期存在,贡献者无需导入其他功能组件。
-
对某个不属于自己的组合包、行或官方插件有话要说的插件,通过本页声明的三个 list slot 向该对象的页面贡献内容:`plugins.detail.actions` 在页头放一个控件,位于页面自己的开关和卸载之前;`plugins.detail.badge` 在标题旁放一个标签,位于版本、实验性和异常标签之后;`plugins.detail.section` 在页面自身内容之下放一个区块——组合包页在组件列表之后,行页和官方插件页在配置之后。每个条目都以页面的 `subject` 渲染:`{ kind: 'bundle', pkg }`、`{ kind: 'row', pkg, row }` 或 `{ kind: 'item', id }`,其中 `pkg` 与 `row` 携带包名、版本、是否已安装、是否启用以及行列表这些供贡献者判断的事实。条目对无话可说的 subject 返回 null,自绘区块外观;页面按 `order` 排列条目。
```tsx ignore-check
diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css
index 0479c5c899..f003556b49 100644
--- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css
+++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css
@@ -1292,89 +1292,6 @@ label.registryOption {
gap: 12px;
}
-.scope {
- display: flex;
- align-items: center;
- gap: 4px;
- margin-top: 8px;
- font-size: 12px;
- line-height: 18px;
- color: var(--dsw-alias-label-secondary);
-}
-
-.capabilities,
-.overrideIds {
- display: grid;
- gap: 12px;
- margin: 0;
- padding: 0;
- list-style: none;
-}
-
-.capability {
- display: flex;
- flex-direction: column;
- gap: 4px;
- padding-left: 12px;
- border-left: 0.5px solid var(--dsw-alias-border-l2);
-}
-
-.capabilityTitle {
- font-size: 13px;
- line-height: 20px;
- font-weight: 500;
-}
-
-.capabilityDescription {
- margin: 0;
- font-size: 13px;
- line-height: 20px;
- color: var(--dsw-alias-label-secondary);
- overflow-wrap: anywhere;
-}
-
-.componentsToggle {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 8px;
- padding: 0;
- border: 0;
- background: none;
- color: var(--dsw-alias-label-secondary);
- font: inherit;
- font-size: 13px;
- line-height: 20px;
- text-align: left;
- cursor: pointer;
-}
-
-.componentsToggle[aria-expanded='false'] .detailsChevron {
- transform: rotate(-90deg);
-}
-
-.componentsToggle:focus-visible {
- outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
- outline-offset: 4px;
-}
-
-.componentsBody {
- display: flex;
- flex-direction: column;
- gap: 20px;
-}
-
-.componentsBody[hidden] {
- display: none;
-}
-
-.overrideIds {
- font-size: 12px;
- line-height: 18px;
- color: var(--dsw-alias-label-secondary);
- overflow-wrap: anywhere;
-}
-
.sectionHead {
display: flex;
align-items: baseline;
diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
index ad7c017045..baf14a04ca 100644
--- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
+++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
@@ -41,7 +41,7 @@ export type PluginManagerPageProps =
& PropsLocale<'pluginManager'>
& PropsRenderSlots<
| 'plugins.item' | 'plugins.bundle.config' | 'plugins.row.config' | 'plugins.bundle.activation'
- | 'plugins.add.actions' | 'plugins.bundle.usage'
+ | 'plugins.add.actions'
| 'plugins.detail.actions' | 'plugins.detail.badge' | 'plugins.detail.section'
>
& InjectFace
@@ -246,6 +246,7 @@ function RowsSection({ rows, t, resolveText, toggle, configure }: {
{t('partsLabel')}
+ {rows.length === 0 ? null : {partsSummary(rows, t)} }
{rows.length === 0 ? {t('partsEmpty')}
: null}
{rows.length > ROW_FILTER_THRESHOLD
@@ -570,44 +571,13 @@ function RowDetail({ pkg, row, t, resolveText, onBack, renderSlot, form }: {
)
}
-/** Human-readable row metadata, without technical identifiers or runtime controls. */
-function CapabilitiesSummary({ rows, resolveText, t }: {
- readonly rows: readonly PackageRow[]
- readonly resolveText: ResolveText
- readonly t: Translate
-}): ReactNode {
- const seen = new Set()
- const capabilities = rows.flatMap((row) => {
- const metadataTitle = row.meta?.title === undefined ? undefined : resolveText(row.meta.title).trim()
- const title = metadataTitle === row.moduleName || metadataTitle === row.rowId ? undefined : metadataTitle
- const description = row.meta?.description === undefined ? undefined : resolveText(row.meta.description).trim() || undefined
- if (title === undefined && description === undefined) return []
- const identity = JSON.stringify([title, description])
- if (seen.has(identity)) return []
- seen.add(identity)
- return [{ rowId: row.rowId, title, description }]
- })
- if (capabilities.length === 0) return null
- return (
-
- {t('capabilitiesTitle')}
-
- {capabilities.map(({ rowId, title, description }) => (
-
- {title === undefined ? null : {title} }
- {description === undefined || description === title ? null : {description} }
-
- ))}
-
-
- )
-}
-
/**
* One package's page: the crumb back to the list; its icon with its switch
* and, for a package the profile installed, uninstall; its title beside its
- * version, beta, and problem tags; usage guidance, readable capabilities,
- * configuration, and component diagnostics folded until requested or failed.
+ * version tag, its beta tag, and its problem tag; the package name the title
+ * stands for, which is what installs it elsewhere; its one-liner; the Host's
+ * problem when it reports one; the configuration the bundle registered for
+ * itself; and its rows with their switches and configure controls.
*/
function PackageDetail({
pkg, t, resolveText, busy, rowBusy, configured, configure, renderSlot,
@@ -631,11 +601,6 @@ function PackageDetail({
const { title, description, beta } = packageText(pkg, resolveText)
const status = packageStatus(pkg)
const subject: PluginsSubject = { kind: 'bundle', pkg: packageRef(pkg) }
- const hasProblem = pkg.error !== undefined || pkg.meta?.error !== undefined
- || pkg.rows.some(row => row.phase === 'failed' || row.meta?.error !== undefined)
- const [componentsOpen, setComponentsOpen] = useState(hasProblem)
- const componentsId = useId()
- useEffect(() => { if (hasProblem) setComponentsOpen(true) }, [hasProblem])
return (
{t('statusProblem')} : null}
{renderSlot('plugins.detail.badge', { subject })}
+ {pkg.name}
{description === undefined ? null : {description}
}
-
- {t('deploymentScope')}
-
-
-
-
-
-