1010 */
1111
1212import type { APIClient } from "@/browser/contexts/API" ;
13+ import type { TaskSettings } from "@/common/orpc/schemas/taskSettings" ;
1314import { appMeta , AppWithMocks , type AppStory } from "./meta.js" ;
1415import { createWorkspace , groupWorkspacesByProject } from "./mockFactory" ;
1516import { selectWorkspace } from "./storyHelpers" ;
@@ -32,6 +33,8 @@ function setupSettingsStory(options: {
3233 providersList ?: string [ ] ;
3334 /** Pre-set experiment states in localStorage before render */
3435 experiments ?: Partial < Record < string , boolean > > ;
36+ /** Initial task settings values */
37+ taskSettings ?: TaskSettings ;
3538} ) : APIClient {
3639 const workspaces = [ createWorkspace ( { id : "ws-1" , name : "main" , projectName : "my-app" } ) ] ;
3740
@@ -47,6 +50,7 @@ function setupSettingsStory(options: {
4750
4851 return createMockORPCClient ( {
4952 projects : groupWorkspacesByProject ( workspaces ) ,
53+ taskSettings : options . taskSettings ,
5054 workspaces,
5155 providersConfig : options . providersConfig ?? { } ,
5256 providersList : options . providersList ?? [ "anthropic" , "openai" , "xai" ] ,
@@ -168,6 +172,32 @@ export const ModelsConfigured: AppStory = {
168172 } ,
169173} ;
170174
175+ /** Tasks section - shows agent task settings */
176+ export const Tasks : AppStory = {
177+ render : ( ) => (
178+ < AppWithMocks
179+ setup = { ( ) =>
180+ setupSettingsStory ( {
181+ taskSettings : {
182+ maxParallelAgentTasks : 5 ,
183+ maxTaskNestingDepth : 2 ,
184+ } ,
185+ } )
186+ }
187+ />
188+ ) ,
189+ play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
190+ await openSettingsToSection ( canvasElement , "tasks" ) ;
191+
192+ const body = within ( canvasElement . ownerDocument . body ) ;
193+ await body . findByText ( / A g e n t t a s k l i m i t s / i) ;
194+
195+ // Ensure the values were loaded from the API mock (not just initial defaults)
196+ await body . findByDisplayValue ( "5" ) ;
197+ await body . findByDisplayValue ( "2" ) ;
198+ } ,
199+ } ;
200+
171201/** Experiments section - shows available experiments */
172202export const Experiments : AppStory = {
173203 render : ( ) => < AppWithMocks setup = { ( ) => setupSettingsStory ( { } ) } /> ,
0 commit comments