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
8 changes: 0 additions & 8 deletions src/cli/commands/add/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,9 @@ async function handleByoPath(

// Gateway handler
function buildGatewayConfig(options: ValidatedAddGatewayOptions): AddGatewayConfig {
const agents = options.agents
? options.agents
.split(',')
.map(s => s.trim())
.filter(Boolean)
: [];

const config: AddGatewayConfig = {
name: options.name,
description: options.description ?? `Gateway for ${options.name}`,
agents,
authorizerType: options.authorizerType,
jwtConfig: undefined,
};
Expand Down
1 change: 0 additions & 1 deletion src/cli/commands/add/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ export function registerAdd(program: Command) {
.option('--discovery-url <url>', 'OIDC discovery URL (required for CUSTOM_JWT)')
.option('--allowed-audience <values>', 'Comma-separated allowed audience values (required for CUSTOM_JWT)')
.option('--allowed-clients <values>', 'Comma-separated allowed client IDs (required for CUSTOM_JWT)')
.option('--agents <names>', 'Comma-separated agent names to attach gateway to')
.option('--json', 'Output as JSON')
.action(async options => {
requireProject();
Expand Down
1 change: 0 additions & 1 deletion src/cli/tui/screens/add/AddFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ export function AddFlow(props: AddFlowProps) {
return (
<AddGatewayFlow
isInteractive={props.isInteractive}
availableAgents={agents}
onExit={props.onExit}
onBack={() => setFlow({ name: 'select' })}
onDev={props.onDev}
Expand Down
4 changes: 0 additions & 4 deletions src/cli/tui/screens/mcp/AddGatewayFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ type FlowState =
interface AddGatewayFlowProps {
/** Whether running in interactive TUI mode */
isInteractive?: boolean;
/** Available agents for the create wizard */
availableAgents: string[];
onExit: () => void;
onBack: () => void;
/** Called when user selects dev from success screen to run agent locally */
Expand All @@ -25,7 +23,6 @@ interface AddGatewayFlowProps {

export function AddGatewayFlow({
isInteractive = true,
availableAgents,
onExit,
onBack,
onDev,
Expand Down Expand Up @@ -69,7 +66,6 @@ export function AddGatewayFlow({
return (
<AddGatewayScreen
existingGateways={existingGateways}
availableAgents={availableAgents}
unassignedTargets={unassignedTargets}
onComplete={handleCreateComplete}
onExit={onBack}
Expand Down
47 changes: 7 additions & 40 deletions src/cli/tui/screens/mcp/AddGatewayScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ interface AddGatewayScreenProps {
onComplete: (config: AddGatewayConfig) => void;
onExit: () => void;
existingGateways: string[];
availableAgents: string[];
unassignedTargets: string[];
}

export function AddGatewayScreen({
onComplete,
onExit,
existingGateways,
availableAgents,
unassignedTargets,
}: AddGatewayScreenProps) {
const wizard = useAddGatewayWizard(unassignedTargets.length);
Expand All @@ -41,11 +39,6 @@ export function AddGatewayScreen({
const [jwtDiscoveryUrl, setJwtDiscoveryUrl] = useState('');
const [jwtAudience, setJwtAudience] = useState('');

const agentItems: SelectableItem[] = useMemo(
() => availableAgents.map(name => ({ id: name, title: name })),
[availableAgents]
);

const unassignedTargetItems: SelectableItem[] = useMemo(
() => unassignedTargets.map(name => ({ id: name, title: name })),
[unassignedTargets]
Expand All @@ -59,7 +52,6 @@ export function AddGatewayScreen({
const isNameStep = wizard.step === 'name';
const isAuthorizerStep = wizard.step === 'authorizer';
const isJwtConfigStep = wizard.step === 'jwt-config';
const isAgentsStep = wizard.step === 'agents';
const isIncludeTargetsStep = wizard.step === 'include-targets';
const isConfirmStep = wizard.step === 'confirm';

Expand All @@ -70,15 +62,6 @@ export function AddGatewayScreen({
isActive: isAuthorizerStep,
});

const agentsNav = useMultiSelectNavigation({
items: agentItems,
getId: item => item.id,
onConfirm: ids => wizard.setAgents(ids),
onExit: () => wizard.goBack(),
isActive: isAgentsStep,
requireSelection: false,
});

const targetsNav = useMultiSelectNavigation({
items: unassignedTargetItems,
getId: item => item.id,
Expand Down Expand Up @@ -135,14 +118,13 @@ export function AddGatewayScreen({
}
};

const helpText =
isAgentsStep || isIncludeTargetsStep
? 'Space toggle · Enter confirm · Esc back'
: isConfirmStep
? HELP_TEXT.CONFIRM_CANCEL
: isAuthorizerStep
? HELP_TEXT.NAVIGATE_SELECT
: HELP_TEXT.TEXT_INPUT;
const helpText = isIncludeTargetsStep
? 'Space toggle · Enter confirm · Esc back'
: isConfirmStep
? HELP_TEXT.CONFIRM_CANCEL
: isAuthorizerStep
? HELP_TEXT.NAVIGATE_SELECT
: HELP_TEXT.TEXT_INPUT;

const headerContent = <StepIndicator steps={wizard.steps} currentStep={wizard.step} labels={GATEWAY_STEP_LABELS} />;

Expand Down Expand Up @@ -187,20 +169,6 @@ export function AddGatewayScreen({
/>
)}

{isAgentsStep &&
(agentItems.length > 0 ? (
<WizardMultiSelect
title="Select agents to use this gateway"
items={agentItems}
cursorIndex={agentsNav.cursorIndex}
selectedIds={agentsNav.selectedIds}
/>
) : (
<Text dimColor>
No agents defined. Add agents first via `agentcore add agent`. Press Enter to continue.
</Text>
))}

{isIncludeTargetsStep &&
(unassignedTargetItems.length > 0 ? (
<WizardMultiSelect
Expand All @@ -226,7 +194,6 @@ export function AddGatewayScreen({
{ label: 'Allowed Clients', value: wizard.config.jwtConfig.allowedClients.join(', ') },
]
: []),
{ label: 'Agents', value: wizard.config.agents.length > 0 ? wizard.config.agents.join(', ') : '(none)' },
{
label: 'Targets',
value:
Expand Down
5 changes: 1 addition & 4 deletions src/cli/tui/screens/mcp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import type { GatewayAuthorizerType, NodeRuntime, PythonRuntime, ToolDefinition
// Gateway Flow Types
// ─────────────────────────────────────────────────────────────────────────────

export type AddGatewayStep = 'name' | 'authorizer' | 'jwt-config' | 'agents' | 'include-targets' | 'confirm';
export type AddGatewayStep = 'name' | 'authorizer' | 'jwt-config' | 'include-targets' | 'confirm';

export interface AddGatewayConfig {
name: string;
description: string;
/** Agent names that will use this gateway */
agents: string[];
/** Authorization type for the gateway */
authorizerType: GatewayAuthorizerType;
/** JWT authorizer configuration (when authorizerType is 'CUSTOM_JWT') */
Expand All @@ -27,7 +25,6 @@ export const GATEWAY_STEP_LABELS: Record<AddGatewayStep, string> = {
name: 'Name',
authorizer: 'Authorizer',
'jwt-config': 'JWT Config',
agents: 'Agents',
'include-targets': 'Include Targets',
confirm: 'Confirm',
};
Expand Down
19 changes: 2 additions & 17 deletions src/cli/tui/screens/mcp/useAddGatewayWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import { useCallback, useMemo, useState } from 'react';

/** Maps authorizer type to the next step after authorizer selection */
const AUTHORIZER_NEXT_STEP: Record<GatewayAuthorizerType, AddGatewayStep> = {
NONE: 'agents',
AWS_IAM: 'agents',
NONE: 'confirm',
AWS_IAM: 'confirm',
CUSTOM_JWT: 'jwt-config',
};

function getDefaultConfig(): AddGatewayConfig {
return {
name: '',
description: '',
agents: [],
authorizerType: 'NONE',
jwtConfig: undefined,
selectedTargets: [],
Expand All @@ -32,8 +31,6 @@ export function useAddGatewayWizard(unassignedTargetsCount = 0) {
baseSteps.push('jwt-config');
}

baseSteps.push('agents');

if (unassignedTargetsCount > 0) {
baseSteps.push('include-targets');
}
Expand Down Expand Up @@ -76,17 +73,6 @@ export function useAddGatewayWizard(unassignedTargetsCount = 0) {
...c,
jwtConfig,
}));
setStep('agents');
},
[]
);

const setAgents = useCallback(
(agents: string[]) => {
setConfig(c => ({
...c,
agents,
}));
setStep(unassignedTargetsCount > 0 ? 'include-targets' : 'confirm');
},
[unassignedTargetsCount]
Expand Down Expand Up @@ -114,7 +100,6 @@ export function useAddGatewayWizard(unassignedTargetsCount = 0) {
setName,
setAuthorizerType,
setJwtConfig,
setAgents,
setSelectedTargets,
reset,
};
Expand Down
Loading