@@ -26,11 +26,16 @@ import {
2626 Check ,
2727 Workflow ,
2828 Database ,
29+ Settings ,
2930} from "lucide-react" ;
3031import { Breadcrumbs } from "@/components/breadcrumbs" ;
3132import { formatAge } from "@/lib/utils" ;
3233import { YamlButton , ensembleYamlFromResource } from "@/components/yaml-panel" ;
3334import { EnsembleCanvas } from "@/components/ensemble-canvas" ;
35+ import {
36+ OnboardingWizard ,
37+ type WizardResult ,
38+ } from "@/components/onboarding-wizard" ;
3439
3540interface PersonaEditState {
3641 systemPrompt : string ;
@@ -43,6 +48,8 @@ export function EnsembleDetailPage() {
4348 const { data : skillPacks } = useSkills ( ) ;
4449 const patchMutation = useActivateEnsemble ( ) ;
4550
51+ const [ wizardOpen , setWizardOpen ] = useState ( false ) ;
52+
4653 // Track which persona is being edited (by name), and its draft state
4754 const [ editingPersona , setEditingPersona ] = useState < string | null > ( null ) ;
4855 const [ editState , setEditState ] = useState < PersonaEditState > ( {
@@ -97,6 +104,43 @@ export function EnsembleDetailPage() {
97104 } ) ) ;
98105 } ;
99106
107+ function handleProviderChange ( result : WizardResult ) {
108+ if ( ! name ) return ;
109+ let skillParams : Record < string , Record < string , string > > | undefined ;
110+ if ( result . skills . includes ( "github-gitops" ) && result . githubRepo ) {
111+ skillParams = { "github-gitops" : { repo : result . githubRepo } } ;
112+ }
113+ patchMutation . mutate (
114+ {
115+ name,
116+ provider : result . provider ,
117+ secretName : result . secretName || undefined ,
118+ apiKey : result . apiKey || undefined ,
119+ awsRegion : result . awsRegion || undefined ,
120+ awsAccessKeyId : result . awsAccessKeyId || undefined ,
121+ awsSecretAccessKey : result . awsSecretAccessKey || undefined ,
122+ awsSessionToken : result . awsSessionToken || undefined ,
123+ model : result . model ,
124+ baseURL : result . baseURL || undefined ,
125+ channels : result . channels . length > 0 ? result . channels : undefined ,
126+ channelConfigs :
127+ Object . keys ( result . channelConfigs ) . length > 0
128+ ? result . channelConfigs
129+ : undefined ,
130+ heartbeatInterval : result . heartbeatInterval || undefined ,
131+ skillParams,
132+ githubToken : result . githubToken || undefined ,
133+ agentSandbox : result . agentSandboxEnabled
134+ ? {
135+ enabled : true ,
136+ runtimeClass : result . agentSandboxRuntimeClass || "gvisor" ,
137+ }
138+ : undefined ,
139+ } ,
140+ { onSuccess : ( ) => setWizardOpen ( false ) } ,
141+ ) ;
142+ }
143+
100144 // Collect all available skill names from SkillPacks
101145 const availableSkills = skillPacks ?. flatMap ( ( sp ) => sp . metadata . name ) ?? [ ] ;
102146
@@ -133,6 +177,17 @@ export function EnsembleDetailPage() {
133177 < div className = "flex items-center gap-2 text-sm text-muted-foreground" >
134178 { pack . spec . description && < span > { pack . spec . description } </ span > }
135179 < StatusBadge phase = { pack . status ?. phase } />
180+ { pack . spec . enabled && (
181+ < Button
182+ variant = "outline"
183+ size = "sm"
184+ className = "gap-1.5 text-xs"
185+ onClick = { ( ) => setWizardOpen ( true ) }
186+ >
187+ < Settings className = "h-3.5 w-3.5" />
188+ Change Provider
189+ </ Button >
190+ ) }
136191 { pack . spec . category && (
137192 < Badge variant = "outline" className = "capitalize" >
138193 { pack . spec . category }
@@ -690,6 +745,29 @@ export function EnsembleDetailPage() {
690745 ) }
691746 </ TabsContent >
692747 </ Tabs >
748+
749+ < OnboardingWizard
750+ open = { wizardOpen }
751+ onClose = { ( ) => setWizardOpen ( false ) }
752+ mode = "persona"
753+ targetName = { pack . metadata . name }
754+ personaCount = { pack . spec . personas ?. length ?? 0 }
755+ availableSkills = { ( skillPacks || [ ] ) . map ( ( s ) => s . metadata . name ) }
756+ defaults = { {
757+ provider : pack . spec . authRefs ?. [ 0 ] ?. provider || "" ,
758+ secretName : pack . spec . authRefs ?. [ 0 ] ?. secret || "" ,
759+ model : pack . spec . personas ?. [ 0 ] ?. model || "" ,
760+ skills : Array . from (
761+ new Set ( ( pack . spec . personas || [ ] ) . flatMap ( ( p ) => p . skills || [ ] ) ) ,
762+ ) ,
763+ channelConfigs : pack . spec . channelConfigs || { } ,
764+ channels :
765+ pack . spec . personas ?. [ 0 ] ?. channels ||
766+ Object . keys ( pack . spec . channelConfigs || { } ) ,
767+ } }
768+ onComplete = { handleProviderChange }
769+ isPending = { patchMutation . isPending }
770+ />
693771 </ div >
694772 ) ;
695773}
0 commit comments