Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli/primitives/AgentPrimitive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export class AgentPrimitive extends BasePrimitive<AddAgentOptions, RemovableReso
const { clear, unmount } = render(
React.createElement(AddFlow, {
isInteractive: false,
initialResource: 'agent',
onExit: () => {
clear();
unmount();
Expand Down
1 change: 1 addition & 0 deletions src/cli/primitives/CredentialPrimitive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ export class CredentialPrimitive extends BasePrimitive<AddCredentialOptions, Rem
const { clear, unmount } = render(
React.createElement(AddFlow, {
isInteractive: false,
initialResource: 'credential',
onExit: () => {
clear();
unmount();
Expand Down
1 change: 1 addition & 0 deletions src/cli/primitives/EvaluatorPrimitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class EvaluatorPrimitive extends BasePrimitive<AddEvaluatorOptions, Remov
const { clear, unmount } = render(
React.createElement(AddFlow, {
isInteractive: false,
initialResource: 'evaluator',
onExit: () => {
clear();
unmount();
Expand Down
1 change: 1 addition & 0 deletions src/cli/primitives/MemoryPrimitive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class MemoryPrimitive extends BasePrimitive<AddMemoryOptions, RemovableMe
const { clear, unmount } = render(
React.createElement(AddFlow, {
isInteractive: false,
initialResource: 'memory',
onExit: () => {
clear();
unmount();
Expand Down
1 change: 1 addition & 0 deletions src/cli/primitives/OnlineEvalConfigPrimitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export class OnlineEvalConfigPrimitive extends BasePrimitive<AddOnlineEvalConfig
const { clear, unmount } = render(
React.createElement(AddFlow, {
isInteractive: false,
initialResource: 'online-eval',
onExit: () => {
clear();
unmount();
Expand Down
1 change: 1 addition & 0 deletions src/cli/primitives/PolicyPrimitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export class PolicyPrimitive extends BasePrimitive<AddPolicyOptions, RemovablePo
const { clear, unmount } = render(
React.createElement(AddFlow, {
isInteractive: false,
initialResource: 'policy',
onExit: () => {
clear();
unmount();
Expand Down
27 changes: 26 additions & 1 deletion src/cli/tui/screens/add/AddFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,37 @@ interface AddFlowProps {
onDev?: () => void;
/** Called when user selects deploy from success screen */
onDeploy?: () => void;
/** Skip the selection screen and go directly to a specific resource wizard */
initialResource?: AddResourceType;
}

function getInitialFlowState(resource?: AddResourceType): FlowState {
switch (resource) {
case 'agent':
return { name: 'agent-wizard' };
case 'gateway':
return { name: 'gateway-wizard' };
case 'gateway-target':
return { name: 'tool-wizard' };
case 'memory':
return { name: 'memory-wizard' };
case 'credential':
return { name: 'identity-wizard' };
case 'evaluator':
return { name: 'evaluator-wizard' };
case 'online-eval':
return { name: 'online-eval-wizard' };
case 'policy':
return { name: 'policy-wizard' };
default:
return { name: 'select' };
}
}

export function AddFlow(props: AddFlowProps) {
const { addAgent, reset: resetAgent } = useAddAgent();
const { agents, refresh: refreshAgents } = useAvailableAgents();
const [flow, setFlow] = useState<FlowState>({ name: 'select' });
const [flow, setFlow] = useState<FlowState>(() => getInitialFlowState(props.initialResource));

// In non-interactive mode, exit after success (but not while loading)
useEffect(() => {
Expand Down
Loading