diff --git a/src/cli/commands/deploy/actions.ts b/src/cli/commands/deploy/actions.ts index b3e349f69..168fc34a0 100644 --- a/src/cli/commands/deploy/actions.ts +++ b/src/cli/commands/deploy/actions.ts @@ -768,6 +768,19 @@ export async function handleDeploy(options: ValidatedDeployOptions): Promise> { + ): Promise> { try { const project = await this.readProjectSpec(); // payments is optional in the schema (absent on projects with no payment @@ -189,7 +190,20 @@ export class PaymentManagerPrimitive extends BasePrimitive 0) { console.warn( `\nWarning: payment capability auto-wiring skipped for non-Strands runtime(s): ${result.skippedRuntimes.join(', ')}.` diff --git a/src/cli/primitives/__tests__/PaymentManagerPrimitive.test.ts b/src/cli/primitives/__tests__/PaymentManagerPrimitive.test.ts index 7bc1d47c5..c98497e82 100644 --- a/src/cli/primitives/__tests__/PaymentManagerPrimitive.test.ts +++ b/src/cli/primitives/__tests__/PaymentManagerPrimitive.test.ts @@ -207,6 +207,27 @@ describe('PaymentManagerPrimitive', () => { expect(result.error.message).toBe('disk read failure'); } }); + + it('returns an auto-payment warning when enabled (default)', async () => { + mockReadProjectSpec.mockResolvedValue(makeProject({ runtimes: [] })); + + const result = await primitive.add({ name: 'mgr1', authorizerType: 'AWS_IAM' }); + + expect(result.success).toBe(true); + if (!result.success) throw new Error('expected success'); + expect(result.autoPaymentWarning).toMatch(/auto-payment is enabled/i); + expect(result.autoPaymentWarning).toContain('--auto-payment false'); + }); + + it('returns no auto-payment warning when explicitly disabled', async () => { + mockReadProjectSpec.mockResolvedValue(makeProject({ runtimes: [] })); + + const result = await primitive.add({ name: 'mgr2', authorizerType: 'AWS_IAM', autoPayment: false }); + + expect(result.success).toBe(true); + if (!result.success) throw new Error('expected success'); + expect(result.autoPaymentWarning).toBeUndefined(); + }); }); describe('remove()', () => { diff --git a/src/cli/tui/screens/payment/AddPaymentFlow.tsx b/src/cli/tui/screens/payment/AddPaymentFlow.tsx index cea6f19d0..e2c15f574 100644 --- a/src/cli/tui/screens/payment/AddPaymentFlow.tsx +++ b/src/cli/tui/screens/payment/AddPaymentFlow.tsx @@ -348,9 +348,19 @@ export function AddPaymentFlow({ ] : []; - const warningFields = !flow.connectorConfig - ? [{ label: '⚠ Warning', value: 'No connector — deploy will fail until you add one' }] - : []; + const warningFields = [ + ...(flow.managerConfig.autoPayment + ? [ + { + label: '⚠ Warning', + value: `Auto-payment ENABLED — agent settles 402s automatically up to $${flow.managerConfig.defaultSpendLimit}/session with no human approval`, + }, + ] + : []), + ...(!flow.connectorConfig + ? [{ label: '⚠ Warning', value: 'No connector — deploy will fail until you add one' }] + : []), + ]; const allFields = [...managerFields, ...connectorFields, ...warningFields];