@aws/agentcore 1.0.0-preview.13 → 1.0.0-preview.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +31 -17
  2. package/dist/agent-inspector/index.css +1 -1
  3. package/dist/agent-inspector/index.js +90 -85
  4. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +966 -106
  5. package/dist/assets/agents/AGENTS.md +14 -0
  6. package/dist/assets/cdk/bin/cdk.ts +42 -20
  7. package/dist/assets/cdk/lib/cdk-stack.ts +19 -14
  8. package/dist/assets/cdk/test/cdk.test.ts +2 -1
  9. package/dist/assets/container/python/Dockerfile +4 -0
  10. package/dist/assets/python/a2a/strands/capabilities/memory/session.py +4 -1
  11. package/dist/assets/python/agui/strands/capabilities/memory/session.py +4 -1
  12. package/dist/assets/python/http/googleadk/base/mcp_client/client.py +7 -7
  13. package/dist/assets/python/http/googleadk/base/pyproject.toml +1 -1
  14. package/dist/assets/python/http/langchain_langgraph/base/mcp_client/client.py +10 -8
  15. package/dist/assets/python/http/langchain_langgraph/base/pyproject.toml +1 -1
  16. package/dist/assets/python/http/openaiagents/base/main.py +19 -9
  17. package/dist/assets/python/http/openaiagents/base/mcp_client/client.py +4 -4
  18. package/dist/assets/python/http/openaiagents/base/pyproject.toml +1 -1
  19. package/dist/assets/python/http/strands/base/main.py +438 -27
  20. package/dist/assets/python/http/strands/base/mcp_client/client.py +45 -5
  21. package/dist/assets/python/http/strands/base/model/load.py +3 -3
  22. package/dist/assets/python/http/strands/base/pyproject.toml +5 -2
  23. package/dist/assets/python/http/strands/base/skills/fetcher.py +279 -0
  24. package/dist/assets/python/http/strands/capabilities/execution-limits/hooks/execution_limits.py +54 -0
  25. package/dist/assets/python/http/strands/capabilities/memory/session.py +4 -1
  26. package/dist/cli/index.mjs +1274 -1088
  27. package/dist/lib/errors/types.d.ts +18 -0
  28. package/dist/lib/errors/types.d.ts.map +1 -1
  29. package/dist/lib/errors/types.js +28 -1
  30. package/dist/lib/errors/types.js.map +1 -1
  31. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  32. package/dist/lib/schemas/io/config-io.js +0 -2
  33. package/dist/lib/schemas/io/config-io.js.map +1 -1
  34. package/dist/schema/constants.d.ts +20 -0
  35. package/dist/schema/constants.d.ts.map +1 -1
  36. package/dist/schema/constants.js +25 -1
  37. package/dist/schema/constants.js.map +1 -1
  38. package/dist/schema/schemas/agent-env.d.ts +35 -0
  39. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  40. package/dist/schema/schemas/agentcore-project.d.ts +184 -25
  41. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  42. package/dist/schema/schemas/agentcore-project.js +81 -31
  43. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  44. package/dist/schema/schemas/auth.d.ts +175 -0
  45. package/dist/schema/schemas/auth.d.ts.map +1 -1
  46. package/dist/schema/schemas/auth.js +126 -3
  47. package/dist/schema/schemas/auth.js.map +1 -1
  48. package/dist/schema/schemas/deployed-state.d.ts +140 -46
  49. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  50. package/dist/schema/schemas/deployed-state.js +39 -14
  51. package/dist/schema/schemas/deployed-state.js.map +1 -1
  52. package/dist/schema/schemas/mcp-defs.d.ts +2 -1
  53. package/dist/schema/schemas/mcp-defs.d.ts.map +1 -1
  54. package/dist/schema/schemas/mcp-defs.js +3 -2
  55. package/dist/schema/schemas/mcp-defs.js.map +1 -1
  56. package/dist/schema/schemas/mcp.d.ts +186 -0
  57. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  58. package/dist/schema/schemas/mcp.js +479 -4
  59. package/dist/schema/schemas/mcp.js.map +1 -1
  60. package/dist/schema/schemas/primitives/ab-test.d.ts +0 -6
  61. package/dist/schema/schemas/primitives/ab-test.d.ts.map +1 -1
  62. package/dist/schema/schemas/primitives/ab-test.js +0 -2
  63. package/dist/schema/schemas/primitives/ab-test.js.map +1 -1
  64. package/dist/schema/schemas/primitives/harness.d.ts +209 -11
  65. package/dist/schema/schemas/primitives/harness.d.ts.map +1 -1
  66. package/dist/schema/schemas/primitives/harness.js +268 -21
  67. package/dist/schema/schemas/primitives/harness.js.map +1 -1
  68. package/dist/schema/schemas/primitives/index.d.ts +6 -8
  69. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  70. package/dist/schema/schemas/primitives/index.js +6 -5
  71. package/dist/schema/schemas/primitives/index.js.map +1 -1
  72. package/dist/schema/schemas/primitives/knowledge-base.d.ts +104 -0
  73. package/dist/schema/schemas/primitives/knowledge-base.d.ts.map +1 -0
  74. package/dist/schema/schemas/primitives/knowledge-base.js +99 -0
  75. package/dist/schema/schemas/primitives/knowledge-base.js.map +1 -0
  76. package/dist/schema/schemas/primitives/online-eval-config.d.ts +20 -2
  77. package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
  78. package/dist/schema/schemas/primitives/online-eval-config.js +43 -5
  79. package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
  80. package/dist/schema/schemas/primitives/policy.d.ts +26 -0
  81. package/dist/schema/schemas/primitives/policy.d.ts.map +1 -1
  82. package/dist/schema/schemas/primitives/policy.js +5 -1
  83. package/dist/schema/schemas/primitives/policy.js.map +1 -1
  84. package/npm-shrinkwrap.json +195 -330
  85. package/package.json +10 -8
  86. package/scripts/bundle.mjs +51 -0
  87. package/scripts/run-e2e-local.sh +40 -8
  88. package/dist/schema/schemas/primitives/http-gateway.d.ts +0 -21
  89. package/dist/schema/schemas/primitives/http-gateway.d.ts.map +0 -1
  90. package/dist/schema/schemas/primitives/http-gateway.js +0 -34
  91. package/dist/schema/schemas/primitives/http-gateway.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentCoreMcpRuntimeToolSchema = exports.McpRuntimeBindingSchema = exports.AgentCoreGatewaySchema = exports.GatewayPolicyEngineConfigurationSchema = exports.PolicyEngineModeSchema = exports.GatewayExceptionLevelSchema = exports.AgentCoreGatewayTargetSchema = exports.SchemaSourceSchema = exports.ToolComputeConfigSchema = exports.RuntimeConfigSchema = exports.IamPolicyDocumentSchema = exports.ToolImplementationBindingSchema = exports.ComputeHostSchema = exports.McpImplLanguageSchema = exports.LambdaFunctionArnConfigSchema = exports.ApiGatewayConfigSchema = exports.ApiGatewayToolConfigurationSchema = exports.ApiGatewayToolOverrideSchema = exports.ApiGatewayToolFilterSchema = exports.ApiGatewayHttpMethodSchema = exports.TARGET_TYPE_AUTH_CONFIG = exports.OutboundAuthSchema = exports.OutboundAuthTypeSchema = exports.GatewayTargetTypeSchema = void 0;
3
+ exports.AgentCoreMcpRuntimeToolSchema = exports.McpRuntimeBindingSchema = exports.AgentCoreGatewaySchema = exports.GatewayProtocolTypeSchema = exports.GatewayPolicyEngineConfigurationSchema = exports.PolicyEngineModeSchema = exports.GatewayExceptionLevelSchema = exports.AgentCoreGatewayTargetSchema = exports.PassthroughConfigSchema = exports.PassthroughProtocolTypeSchema = exports.StickinessConfigSchema = exports.HttpRuntimeConfigSchema = exports.SchemaSourceSchema = exports.ToolComputeConfigSchema = exports.RuntimeConfigSchema = exports.IamPolicyDocumentSchema = exports.ToolImplementationBindingSchema = exports.ComputeHostSchema = exports.McpImplLanguageSchema = exports.LambdaFunctionArnConfigSchema = exports.ApiGatewayConfigSchema = exports.ApiGatewayToolConfigurationSchema = exports.ApiGatewayToolOverrideSchema = exports.ApiGatewayToolFilterSchema = exports.ApiGatewayHttpMethodSchema = exports.TARGET_TYPE_AUTH_CONFIG = exports.OutboundAuthSchema = exports.OutboundAuthTypeSchema = exports.REAL_KB_ID_PATTERN = exports.ConnectorIdSchema = exports.CONNECTOR_ID_VALUES = exports.CONNECTOR_ID = exports.MCP_TARGET_TYPES = exports.NON_MCP_TARGET_TYPES = exports.GatewayTargetTypeSchema = void 0;
4
4
  const constants_1 = require("../constants");
5
5
  const agent_env_1 = require("./agent-env");
6
6
  const auth_1 = require("./auth");
@@ -17,18 +17,67 @@ exports.GatewayTargetTypeSchema = zod_1.z.enum([
17
17
  'smithyModel',
18
18
  'apiGateway',
19
19
  'lambdaFunctionArn',
20
+ 'httpRuntime',
21
+ 'connector',
22
+ 'passthrough',
23
+ 'webSearch',
20
24
  ]);
25
+ /**
26
+ * Target types that use the non-MCP (HTTP) protocol.
27
+ * These targets require a gateway with protocolType: "None".
28
+ */
29
+ exports.NON_MCP_TARGET_TYPES = ['httpRuntime', 'passthrough'];
30
+ /**
31
+ * Target types that use the MCP protocol.
32
+ */
33
+ exports.MCP_TARGET_TYPES = [
34
+ 'lambda',
35
+ 'mcpServer',
36
+ 'openApiSchema',
37
+ 'smithyModel',
38
+ 'apiGateway',
39
+ 'lambdaFunctionArn',
40
+ ];
41
+ // ============================================================================
42
+ // Connector (managed-service gateway target)
43
+ // ============================================================================
44
+ /**
45
+ * Managed-service connector identifiers. The L3 maps each one to an operation
46
+ * name + Enabled list via CONNECTOR_DEFAULTS.
47
+ *
48
+ * Spec note: the original DevEx doc (cli-knowledge-bases-devex.md) uses
49
+ * `agentic-retrieve`, but the service accepts `bedrock-agentic-retrieve`. The
50
+ * latter is canonical.
51
+ */
52
+ exports.CONNECTOR_ID = {
53
+ BEDROCK_KNOWLEDGE_BASES: 'bedrock-knowledge-bases',
54
+ BEDROCK_AGENTIC_RETRIEVE: 'bedrock-agentic-retrieve',
55
+ };
56
+ exports.CONNECTOR_ID_VALUES = [
57
+ exports.CONNECTOR_ID.BEDROCK_KNOWLEDGE_BASES,
58
+ exports.CONNECTOR_ID.BEDROCK_AGENTIC_RETRIEVE,
59
+ ];
60
+ exports.ConnectorIdSchema = zod_1.z.enum(exports.CONNECTOR_ID_VALUES);
61
+ /**
62
+ * Real Bedrock Knowledge Base IDs are 10 uppercase alphanumeric chars.
63
+ * KB names follow the standard primitive-name shape (1-48 chars, starts with a letter).
64
+ * The two formats can never collide, so a connector target's `knowledgeBaseId`
65
+ * field is unambiguously a project KB name or a literal external KB ID.
66
+ */
67
+ exports.REAL_KB_ID_PATTERN = /^[A-Z0-9]{10}$/;
21
68
  // ============================================================================
22
69
  // Gateway Authorization Schemas
23
70
  // ============================================================================
24
71
  // Auth schemas (GatewayAuthorizerTypeSchema, CustomJwtAuthorizerConfigSchema, etc.)
25
72
  // are defined in ./auth.ts and exported via the barrel (index.ts).
26
- exports.OutboundAuthTypeSchema = zod_1.z.enum(['OAUTH', 'API_KEY', 'NONE']);
73
+ exports.OutboundAuthTypeSchema = zod_1.z.enum(['OAUTH', 'API_KEY', 'NONE', 'GATEWAY_IAM_ROLE', 'JWT_PASSTHROUGH']);
27
74
  exports.OutboundAuthSchema = zod_1.z
28
75
  .object({
29
76
  type: exports.OutboundAuthTypeSchema.default('NONE'),
30
77
  credentialName: zod_1.z.string().min(1).optional(),
31
78
  scopes: zod_1.z.array(zod_1.z.string()).optional(),
79
+ service: zod_1.z.string().min(1).max(64).optional(),
80
+ region: zod_1.z.string().min(1).max(32).optional(),
32
81
  })
33
82
  .strict();
34
83
  // ============================================================================
@@ -48,6 +97,17 @@ exports.TARGET_TYPE_AUTH_CONFIG = {
48
97
  mcpServer: { authRequired: false, validAuthTypes: ['OAUTH', 'NONE'], iamRoleFallback: false },
49
98
  lambda: { authRequired: false, validAuthTypes: ['OAUTH', 'NONE'], iamRoleFallback: true },
50
99
  lambdaFunctionArn: { authRequired: false, validAuthTypes: ['OAUTH', 'NONE'], iamRoleFallback: true },
100
+ httpRuntime: { authRequired: false, validAuthTypes: ['OAUTH', 'NONE'], iamRoleFallback: true },
101
+ // Connector targets call the underlying managed service (Bedrock KB, etc.)
102
+ // via the gateway's IAM role. No outbound auth applies.
103
+ connector: { authRequired: false, validAuthTypes: [], iamRoleFallback: true },
104
+ passthrough: {
105
+ authRequired: true,
106
+ validAuthTypes: ['GATEWAY_IAM_ROLE', 'OAUTH', 'JWT_PASSTHROUGH'],
107
+ iamRoleFallback: false,
108
+ },
109
+ // Amazon Web Search is invoked via the gateway's IAM role. No outbound auth.
110
+ webSearch: { authRequired: false, validAuthTypes: [], iamRoleFallback: true },
51
111
  };
52
112
  // ============================================================================
53
113
  // API Gateway Target Schemas
@@ -255,6 +315,39 @@ exports.SchemaSourceSchema = zod_1.z.union([
255
315
  zod_1.z.object({ s3: SchemaS3SourceSchema }).strict(),
256
316
  ]);
257
317
  // ============================================================================
318
+ // HTTP Runtime Configuration
319
+ // ============================================================================
320
+ exports.HttpRuntimeConfigSchema = zod_1.z
321
+ .object({
322
+ runtime: zod_1.z.string().min(1),
323
+ runtimeEndpoint: zod_1.z.string().min(1).optional(),
324
+ })
325
+ .strict();
326
+ // ============================================================================
327
+ // Passthrough Target Configuration
328
+ // ============================================================================
329
+ exports.StickinessConfigSchema = zod_1.z
330
+ .object({
331
+ identifier: zod_1.z.string().min(1).max(256),
332
+ timeout: zod_1.z.number().int().min(1).max(86400).optional(),
333
+ })
334
+ .strict();
335
+ /**
336
+ * Passthrough protocol type. HTTP is NOT valid — use CUSTOM for plain HTTP/REST backends.
337
+ */
338
+ exports.PassthroughProtocolTypeSchema = zod_1.z.enum(['MCP', 'A2A', 'INFERENCE', 'CUSTOM']);
339
+ exports.PassthroughConfigSchema = zod_1.z
340
+ .object({
341
+ endpoint: zod_1.z
342
+ .string()
343
+ .min(1)
344
+ .regex(/^https:\/\/[a-zA-Z0-9\-.]+(:[0-9]{1,5})?(\/.*)?$/, 'Must be a valid HTTPS URL'),
345
+ /** Protocol type for the passthrough backend. Defaults to CUSTOM (generic HTTP/REST). */
346
+ protocolType: exports.PassthroughProtocolTypeSchema.default('CUSTOM'),
347
+ stickinessConfiguration: exports.StickinessConfigSchema.optional(),
348
+ })
349
+ .strict();
350
+ // ============================================================================
258
351
  // Gateway Target
259
352
  // ============================================================================
260
353
  /**
@@ -273,7 +366,7 @@ exports.AgentCoreGatewayTargetSchema = zod_1.z
273
366
  toolDefinitions: zod_1.z.array(mcp_defs_1.ToolDefinitionSchema).optional(),
274
367
  /** Compute configuration. Required for Lambda/Runtime scaffold targets. */
275
368
  compute: exports.ToolComputeConfigSchema.optional(),
276
- /** MCP Server endpoint URL. Required for external MCP Server targets. */
369
+ /** Endpoint URL for mcpServer targets. */
277
370
  endpoint: zod_1.z.string().url().optional(),
278
371
  /** Outbound auth configuration for the target. */
279
372
  outboundAuth: exports.OutboundAuthSchema.optional(),
@@ -283,6 +376,47 @@ exports.AgentCoreGatewayTargetSchema = zod_1.z
283
376
  schemaSource: exports.SchemaSourceSchema.optional(),
284
377
  /** Lambda Function ARN configuration. Required for lambdaFunctionArn target type. */
285
378
  lambdaFunctionArn: exports.LambdaFunctionArnConfigSchema.optional(),
379
+ /** HTTP Runtime configuration. Required for httpRuntime target type. */
380
+ httpRuntime: exports.HttpRuntimeConfigSchema.optional(),
381
+ /**
382
+ * Managed-service connector identifier. Required for `connector` target type.
383
+ */
384
+ connectorId: exports.ConnectorIdSchema.optional(),
385
+ /**
386
+ * For `bedrock-knowledge-bases` connector targets: either a project KB
387
+ * name (references an entry in `knowledgeBases[]` on the project spec)
388
+ * or a literal 10-character KB ID (refers to an external KB this project
389
+ * does not own). The L3 disambiguates by regex match. Mutually exclusive
390
+ * with `knowledgeBaseIds`.
391
+ */
392
+ knowledgeBaseId: zod_1.z
393
+ .string()
394
+ .min(1)
395
+ .max(48)
396
+ .regex(/^[a-zA-Z0-9_-]+$/, 'Must be a KB name (1-48 chars, letters/digits/dash/underscore) or a 10-char KB ID')
397
+ .optional(),
398
+ /**
399
+ * For `bedrock-agentic-retrieve` connector targets only. List of project
400
+ * KB names or literal 10-char external KB IDs that this orchestrated
401
+ * retriever should fan out across. Each entry is disambiguated the same
402
+ * way `knowledgeBaseId` is. Mutually exclusive with `knowledgeBaseId`.
403
+ */
404
+ knowledgeBaseIds: zod_1.z
405
+ .array(zod_1.z
406
+ .string()
407
+ .min(1)
408
+ .max(48)
409
+ .regex(/^[a-zA-Z0-9_-]+$/, 'Each entry must be a KB name (1-48 chars) or a 10-char KB ID'))
410
+ .min(1)
411
+ .optional(),
412
+ /** Passthrough configuration. Required for passthrough target type. */
413
+ passthrough: exports.PassthroughConfigSchema.optional(),
414
+ /**
415
+ * For `webSearch` target type only. Domains to exclude from web search
416
+ * results. Maps to the connector's `domainFilter.exclude` parameterValue
417
+ * at synth time.
418
+ */
419
+ excludeDomains: zod_1.z.array(zod_1.z.string().min(1)).min(1).optional(),
286
420
  })
287
421
  .strict()
288
422
  .superRefine((data, ctx) => {
@@ -426,6 +560,101 @@ exports.AgentCoreGatewayTargetSchema = zod_1.z
426
560
  });
427
561
  }
428
562
  }
563
+ if (data.targetType === 'httpRuntime') {
564
+ if (!data.httpRuntime) {
565
+ ctx.addIssue({
566
+ code: zod_1.z.ZodIssueCode.custom,
567
+ message: 'httpRuntime targets require an httpRuntime configuration (with a runtime reference).',
568
+ path: ['httpRuntime'],
569
+ });
570
+ }
571
+ if (data.endpoint) {
572
+ ctx.addIssue({
573
+ code: zod_1.z.ZodIssueCode.custom,
574
+ message: 'httpRuntime targets should use httpRuntime.runtimeEndpoint instead of endpoint.',
575
+ path: ['endpoint'],
576
+ });
577
+ }
578
+ if (data.compute) {
579
+ ctx.addIssue({
580
+ code: zod_1.z.ZodIssueCode.custom,
581
+ message: 'compute is not applicable for httpRuntime target type',
582
+ path: ['compute'],
583
+ });
584
+ }
585
+ if (data.apiGateway) {
586
+ ctx.addIssue({
587
+ code: zod_1.z.ZodIssueCode.custom,
588
+ message: 'apiGateway is not applicable for httpRuntime target type',
589
+ path: ['apiGateway'],
590
+ });
591
+ }
592
+ if (data.lambdaFunctionArn) {
593
+ ctx.addIssue({
594
+ code: zod_1.z.ZodIssueCode.custom,
595
+ message: 'lambdaFunctionArn is not applicable for httpRuntime target type',
596
+ path: ['lambdaFunctionArn'],
597
+ });
598
+ }
599
+ if (data.toolDefinitions && data.toolDefinitions.length > 0) {
600
+ ctx.addIssue({
601
+ code: zod_1.z.ZodIssueCode.custom,
602
+ message: 'toolDefinitions is not applicable for httpRuntime target type',
603
+ path: ['toolDefinitions'],
604
+ });
605
+ }
606
+ }
607
+ if (data.targetType === 'passthrough') {
608
+ if (!data.passthrough) {
609
+ ctx.addIssue({
610
+ code: zod_1.z.ZodIssueCode.custom,
611
+ message: 'passthrough targets require a passthrough configuration (with an endpoint).',
612
+ path: ['passthrough'],
613
+ });
614
+ }
615
+ if (data.endpoint) {
616
+ ctx.addIssue({
617
+ code: zod_1.z.ZodIssueCode.custom,
618
+ message: 'passthrough targets should use passthrough.endpoint instead of endpoint.',
619
+ path: ['endpoint'],
620
+ });
621
+ }
622
+ if (data.compute) {
623
+ ctx.addIssue({
624
+ code: zod_1.z.ZodIssueCode.custom,
625
+ message: 'compute is not applicable for passthrough target type',
626
+ path: ['compute'],
627
+ });
628
+ }
629
+ if (data.apiGateway) {
630
+ ctx.addIssue({
631
+ code: zod_1.z.ZodIssueCode.custom,
632
+ message: 'apiGateway is not applicable for passthrough target type',
633
+ path: ['apiGateway'],
634
+ });
635
+ }
636
+ if (data.lambdaFunctionArn) {
637
+ ctx.addIssue({
638
+ code: zod_1.z.ZodIssueCode.custom,
639
+ message: 'lambdaFunctionArn is not applicable for passthrough target type',
640
+ path: ['lambdaFunctionArn'],
641
+ });
642
+ }
643
+ if (data.httpRuntime) {
644
+ ctx.addIssue({
645
+ code: zod_1.z.ZodIssueCode.custom,
646
+ message: 'httpRuntime is not applicable for passthrough target type',
647
+ path: ['httpRuntime'],
648
+ });
649
+ }
650
+ if (data.toolDefinitions && data.toolDefinitions.length > 0) {
651
+ ctx.addIssue({
652
+ code: zod_1.z.ZodIssueCode.custom,
653
+ message: 'toolDefinitions is not applicable for passthrough target type',
654
+ path: ['toolDefinitions'],
655
+ });
656
+ }
657
+ }
429
658
  if (data.targetType === 'lambda' && !data.compute) {
430
659
  ctx.addIssue({
431
660
  code: zod_1.z.ZodIssueCode.custom,
@@ -440,6 +669,214 @@ exports.AgentCoreGatewayTargetSchema = zod_1.z
440
669
  path: ['toolDefinitions'],
441
670
  });
442
671
  }
672
+ if (data.targetType === 'connector') {
673
+ if (!data.connectorId) {
674
+ ctx.addIssue({
675
+ code: zod_1.z.ZodIssueCode.custom,
676
+ message: 'connectorId is required for connector target type',
677
+ path: ['connectorId'],
678
+ });
679
+ }
680
+ if (data.connectorId === exports.CONNECTOR_ID.BEDROCK_KNOWLEDGE_BASES) {
681
+ if (!data.knowledgeBaseId) {
682
+ ctx.addIssue({
683
+ code: zod_1.z.ZodIssueCode.custom,
684
+ message: `knowledgeBaseId is required for connectorId '${data.connectorId}'`,
685
+ path: ['knowledgeBaseId'],
686
+ });
687
+ }
688
+ if (data.knowledgeBaseIds) {
689
+ ctx.addIssue({
690
+ code: zod_1.z.ZodIssueCode.custom,
691
+ message: `knowledgeBaseIds is not applicable for connectorId '${data.connectorId}' (use knowledgeBaseId)`,
692
+ path: ['knowledgeBaseIds'],
693
+ });
694
+ }
695
+ }
696
+ if (data.connectorId === exports.CONNECTOR_ID.BEDROCK_AGENTIC_RETRIEVE) {
697
+ if (!data.knowledgeBaseIds || data.knowledgeBaseIds.length === 0) {
698
+ ctx.addIssue({
699
+ code: zod_1.z.ZodIssueCode.custom,
700
+ message: `knowledgeBaseIds (non-empty) is required for connectorId '${data.connectorId}'`,
701
+ path: ['knowledgeBaseIds'],
702
+ });
703
+ }
704
+ if (data.knowledgeBaseId) {
705
+ ctx.addIssue({
706
+ code: zod_1.z.ZodIssueCode.custom,
707
+ message: `knowledgeBaseId is not applicable for connectorId '${data.connectorId}' (use knowledgeBaseIds)`,
708
+ path: ['knowledgeBaseId'],
709
+ });
710
+ }
711
+ }
712
+ if (data.excludeDomains) {
713
+ ctx.addIssue({
714
+ code: zod_1.z.ZodIssueCode.custom,
715
+ message: `excludeDomains only applies to webSearch target type`,
716
+ path: ['excludeDomains'],
717
+ });
718
+ }
719
+ if (data.compute) {
720
+ ctx.addIssue({
721
+ code: zod_1.z.ZodIssueCode.custom,
722
+ message: 'compute is not applicable for connector target type',
723
+ path: ['compute'],
724
+ });
725
+ }
726
+ if (data.endpoint) {
727
+ ctx.addIssue({
728
+ code: zod_1.z.ZodIssueCode.custom,
729
+ message: 'endpoint is not applicable for connector target type',
730
+ path: ['endpoint'],
731
+ });
732
+ }
733
+ if (data.toolDefinitions && data.toolDefinitions.length > 0) {
734
+ ctx.addIssue({
735
+ code: zod_1.z.ZodIssueCode.custom,
736
+ message: 'toolDefinitions is not applicable for connector target type',
737
+ path: ['toolDefinitions'],
738
+ });
739
+ }
740
+ if (data.apiGateway) {
741
+ ctx.addIssue({
742
+ code: zod_1.z.ZodIssueCode.custom,
743
+ message: 'apiGateway is not applicable for connector target type',
744
+ path: ['apiGateway'],
745
+ });
746
+ }
747
+ if (data.lambdaFunctionArn) {
748
+ ctx.addIssue({
749
+ code: zod_1.z.ZodIssueCode.custom,
750
+ message: 'lambdaFunctionArn is not applicable for connector target type',
751
+ path: ['lambdaFunctionArn'],
752
+ });
753
+ }
754
+ if (data.schemaSource) {
755
+ ctx.addIssue({
756
+ code: zod_1.z.ZodIssueCode.custom,
757
+ message: 'schemaSource is not applicable for connector target type',
758
+ path: ['schemaSource'],
759
+ });
760
+ }
761
+ }
762
+ if (data.targetType === 'webSearch') {
763
+ // Web search is invoked via the gateway's IAM role and takes only an
764
+ // optional excludeDomains list. Reject anything else.
765
+ if (data.compute) {
766
+ ctx.addIssue({
767
+ code: zod_1.z.ZodIssueCode.custom,
768
+ message: 'compute is not applicable for webSearch target type',
769
+ path: ['compute'],
770
+ });
771
+ }
772
+ if (data.endpoint) {
773
+ ctx.addIssue({
774
+ code: zod_1.z.ZodIssueCode.custom,
775
+ message: 'endpoint is not applicable for webSearch target type',
776
+ path: ['endpoint'],
777
+ });
778
+ }
779
+ if (data.toolDefinitions && data.toolDefinitions.length > 0) {
780
+ ctx.addIssue({
781
+ code: zod_1.z.ZodIssueCode.custom,
782
+ message: 'toolDefinitions is not applicable for webSearch target type',
783
+ path: ['toolDefinitions'],
784
+ });
785
+ }
786
+ if (data.apiGateway) {
787
+ ctx.addIssue({
788
+ code: zod_1.z.ZodIssueCode.custom,
789
+ message: 'apiGateway is not applicable for webSearch target type',
790
+ path: ['apiGateway'],
791
+ });
792
+ }
793
+ if (data.lambdaFunctionArn) {
794
+ ctx.addIssue({
795
+ code: zod_1.z.ZodIssueCode.custom,
796
+ message: 'lambdaFunctionArn is not applicable for webSearch target type',
797
+ path: ['lambdaFunctionArn'],
798
+ });
799
+ }
800
+ if (data.schemaSource) {
801
+ ctx.addIssue({
802
+ code: zod_1.z.ZodIssueCode.custom,
803
+ message: 'schemaSource is not applicable for webSearch target type',
804
+ path: ['schemaSource'],
805
+ });
806
+ }
807
+ if (data.httpRuntime) {
808
+ ctx.addIssue({
809
+ code: zod_1.z.ZodIssueCode.custom,
810
+ message: 'httpRuntime is not applicable for webSearch target type',
811
+ path: ['httpRuntime'],
812
+ });
813
+ }
814
+ if (data.passthrough) {
815
+ ctx.addIssue({
816
+ code: zod_1.z.ZodIssueCode.custom,
817
+ message: 'passthrough is not applicable for webSearch target type',
818
+ path: ['passthrough'],
819
+ });
820
+ }
821
+ if (data.outboundAuth && data.outboundAuth.type !== 'NONE') {
822
+ ctx.addIssue({
823
+ code: zod_1.z.ZodIssueCode.custom,
824
+ message: 'outboundAuth is not applicable for webSearch target type (uses gateway IAM role)',
825
+ path: ['outboundAuth'],
826
+ });
827
+ }
828
+ if (data.connectorId) {
829
+ ctx.addIssue({
830
+ code: zod_1.z.ZodIssueCode.custom,
831
+ message: 'connectorId is not applicable for webSearch target type',
832
+ path: ['connectorId'],
833
+ });
834
+ }
835
+ if (data.knowledgeBaseId) {
836
+ ctx.addIssue({
837
+ code: zod_1.z.ZodIssueCode.custom,
838
+ message: 'knowledgeBaseId is not applicable for webSearch target type',
839
+ path: ['knowledgeBaseId'],
840
+ });
841
+ }
842
+ if (data.knowledgeBaseIds) {
843
+ ctx.addIssue({
844
+ code: zod_1.z.ZodIssueCode.custom,
845
+ message: 'knowledgeBaseIds is not applicable for webSearch target type',
846
+ path: ['knowledgeBaseIds'],
847
+ });
848
+ }
849
+ }
850
+ if (data.targetType !== 'connector' && data.targetType !== 'webSearch') {
851
+ if (data.connectorId) {
852
+ ctx.addIssue({
853
+ code: zod_1.z.ZodIssueCode.custom,
854
+ message: `connectorId only applies to connector target type`,
855
+ path: ['connectorId'],
856
+ });
857
+ }
858
+ if (data.knowledgeBaseId) {
859
+ ctx.addIssue({
860
+ code: zod_1.z.ZodIssueCode.custom,
861
+ message: `knowledgeBaseId only applies to connector target type`,
862
+ path: ['knowledgeBaseId'],
863
+ });
864
+ }
865
+ if (data.knowledgeBaseIds) {
866
+ ctx.addIssue({
867
+ code: zod_1.z.ZodIssueCode.custom,
868
+ message: `knowledgeBaseIds only applies to connector target type`,
869
+ path: ['knowledgeBaseIds'],
870
+ });
871
+ }
872
+ if (data.excludeDomains) {
873
+ ctx.addIssue({
874
+ code: zod_1.z.ZodIssueCode.custom,
875
+ message: `excludeDomains only applies to webSearch target type`,
876
+ path: ['excludeDomains'],
877
+ });
878
+ }
879
+ }
443
880
  // Centralized outbound auth validation (driven by TARGET_TYPE_AUTH_CONFIG)
444
881
  const authConfig = exports.TARGET_TYPE_AUTH_CONFIG[data.targetType];
445
882
  const authType = data.outboundAuth?.type ?? 'NONE';
@@ -464,13 +901,35 @@ exports.AgentCoreGatewayTargetSchema = zod_1.z
464
901
  path: ['outboundAuth'],
465
902
  });
466
903
  }
467
- if (data.outboundAuth && data.outboundAuth.type !== 'NONE' && !data.outboundAuth.credentialName) {
904
+ if (data.outboundAuth &&
905
+ data.outboundAuth.type !== 'NONE' &&
906
+ data.outboundAuth.type !== 'GATEWAY_IAM_ROLE' &&
907
+ data.outboundAuth.type !== 'JWT_PASSTHROUGH' &&
908
+ !data.outboundAuth.credentialName) {
468
909
  ctx.addIssue({
469
910
  code: zod_1.z.ZodIssueCode.custom,
470
911
  message: `${data.outboundAuth.type} outbound auth requires a credentialName.`,
471
912
  path: ['outboundAuth', 'credentialName'],
472
913
  });
473
914
  }
915
+ // GATEWAY_IAM_ROLE on passthrough requires service
916
+ if (data.targetType === 'passthrough' &&
917
+ data.outboundAuth?.type === 'GATEWAY_IAM_ROLE' &&
918
+ !data.outboundAuth.service) {
919
+ ctx.addIssue({
920
+ code: zod_1.z.ZodIssueCode.custom,
921
+ message: 'GATEWAY_IAM_ROLE outbound auth on passthrough targets requires a service name.',
922
+ path: ['outboundAuth', 'service'],
923
+ });
924
+ }
925
+ // JWT_PASSTHROUGH is only valid for passthrough targets
926
+ if (data.outboundAuth?.type === 'JWT_PASSTHROUGH' && data.targetType !== 'passthrough') {
927
+ ctx.addIssue({
928
+ code: zod_1.z.ZodIssueCode.custom,
929
+ message: 'JWT_PASSTHROUGH outbound auth is only valid for passthrough targets.',
930
+ path: ['outboundAuth', 'type'],
931
+ });
932
+ }
474
933
  });
475
934
  // ============================================================================
476
935
  // Gateway Exception Level
@@ -493,11 +952,14 @@ exports.GatewayPolicyEngineConfigurationSchema = zod_1.z
493
952
  * Gateway abstraction with opinionated defaults.
494
953
  * Supports NONE (default) or CUSTOM_JWT authorizer types.
495
954
  */
955
+ exports.GatewayProtocolTypeSchema = zod_1.z.enum(['MCP', 'None']);
496
956
  exports.AgentCoreGatewaySchema = zod_1.z
497
957
  .object({
498
958
  name: agent_env_1.GatewayNameSchema,
499
959
  /** Actual AWS resource name for imported gateways. When set, CDK uses this instead of generating projectName-name. */
500
960
  resourceName: agent_env_1.GatewayNameSchema.optional(),
961
+ /** Protocol type for this gateway. */
962
+ protocolType: exports.GatewayProtocolTypeSchema.optional(),
501
963
  description: zod_1.z.string().optional(),
502
964
  targets: zod_1.z.array(exports.AgentCoreGatewayTargetSchema),
503
965
  /** Authorization type for the gateway. Defaults to 'NONE'. */
@@ -528,6 +990,19 @@ exports.AgentCoreGatewaySchema = zod_1.z
528
990
  }, {
529
991
  message: 'customJwtAuthorizer configuration is required when authorizerType is CUSTOM_JWT',
530
992
  path: ['authorizerConfiguration'],
993
+ })
994
+ .superRefine((gw, ctx) => {
995
+ // A protocolType: "None" (HTTP) gateway is a superset: it can host any target
996
+ // type, including MCP targets (mcpServer, connector, KB, etc.). Only an MCP
997
+ // gateway is restrictive — it cannot host the HTTP-only target types.
998
+ for (const target of gw.targets) {
999
+ if (gw.protocolType !== 'None' && exports.NON_MCP_TARGET_TYPES.includes(target.targetType)) {
1000
+ ctx.addIssue({
1001
+ code: zod_1.z.ZodIssueCode.custom,
1002
+ message: `Target "${target.name}" is ${target.targetType} but gateway does not have protocolType: "None". Add --protocol-type None when creating the gateway.`,
1003
+ });
1004
+ }
1005
+ }
531
1006
  });
532
1007
  // ============================================================================
533
1008
  // MCP Runtime Tool