Each official settings page now lives in a client package of its own: `ui-settings-shell`, `ui-settings-agent-loop`, `ui-settings-subagent` and `ui-settings-web-search` register into `plugins.item` while the Host serves their namespaces, through the new `settingsScope.whileServed` watch, each with its own dictionary and styles. The form model, the fields and the form move to `ui-primitives` as the shared settings kit, so a community package's browser half builds a page the same way. `ui-settings-plugins` keeps only the Built-in plugins section shell around the inventory tab. The companions hold Loader rows in `web-app` behind the section; the client catalog, config catalog and module graph regenerate; the settings-card cookbook walks through a companion package.
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
/** The agent-loop page's form over a scripted settings scope. */
|
|
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
import { stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime'
|
|
import { AgentLoopCardController, type AgentLoopSettings } from '../src/client/agent-loop-card-controller.ts'
|
|
|
|
describe('AgentLoopCardController', () => {
|
|
it('saves the only field it owns', async () => {
|
|
const host = stubSettingsScope<AgentLoopSettings>()
|
|
host.set.mockImplementation((field: string, value: unknown) => {
|
|
host.publish({ value: { [field]: value }, user: { [field]: value } })
|
|
})
|
|
const controller = new AgentLoopCardController(host.scope)
|
|
host.publish({
|
|
status: 'ready',
|
|
writable: true,
|
|
value: { maxParallelToolCalls: 10 },
|
|
base: { maxParallelToolCalls: 10 },
|
|
user: {},
|
|
})
|
|
const face = controller.inject()
|
|
|
|
face.edit('maxParallelToolCalls', '4')
|
|
face.save()
|
|
await vi.waitFor(() => { expect(host.set).toHaveBeenCalledWith('maxParallelToolCalls', 4) })
|
|
|
|
expect(face.hooks.agentLoopCard.getSnapshot()).toMatchObject({
|
|
dirty: false,
|
|
maxParallelToolCalls: { text: '4', overridden: true },
|
|
})
|
|
})
|
|
|
|
it('reports a read-only document so the page can disable its controls', () => {
|
|
const host = stubSettingsScope<AgentLoopSettings>()
|
|
const controller = new AgentLoopCardController(host.scope)
|
|
|
|
host.publish({ status: 'ready', writable: false, value: { maxParallelToolCalls: 10 } })
|
|
|
|
expect(controller.inject().hooks.agentLoopCard.getSnapshot().writable).toBe(false)
|
|
})
|
|
})
|