@aws/nx-plugin 1.0.0-rc.57 → 1.0.0-rc.59

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 (223) hide show
  1. package/LICENSE-THIRD-PARTY +2917 -1295
  2. package/generators.json +17 -1
  3. package/migrations.json +36 -26
  4. package/package.json +13 -13
  5. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +273 -0
  6. package/src/agentcore-gateway/agent-connection/generator.d.ts +19 -0
  7. package/src/agentcore-gateway/agent-connection/generator.js +90 -0
  8. package/src/agentcore-gateway/agent-connection/generator.js.map +1 -0
  9. package/src/agentcore-gateway/agent-connection/schema.d.js +6 -0
  10. package/src/agentcore-gateway/agent-connection/schema.d.js.map +1 -0
  11. package/src/agentcore-gateway/agent-connection/schema.d.ts +13 -0
  12. package/src/agentcore-gateway/agent-connection/schema.json +31 -0
  13. package/src/agentcore-gateway/attach-upstream.d.ts +16 -0
  14. package/src/agentcore-gateway/attach-upstream.js +32 -11
  15. package/src/agentcore-gateway/attach-upstream.js.map +1 -1
  16. package/src/agentcore-gateway/files/project/http/local-dev.ts.template +77 -0
  17. package/src/agentcore-gateway/generator.d.ts +17 -1
  18. package/src/agentcore-gateway/generator.js +25 -12
  19. package/src/agentcore-gateway/generator.js.map +1 -1
  20. package/src/agentcore-gateway/react-connection/__snapshots__/generator.spec.ts.snap +68 -0
  21. package/src/agentcore-gateway/react-connection/generator.d.ts +19 -0
  22. package/src/agentcore-gateway/react-connection/generator.js +119 -0
  23. package/src/agentcore-gateway/react-connection/generator.js.map +1 -0
  24. package/src/agentcore-gateway/react-connection/schema.d.js +6 -0
  25. package/src/agentcore-gateway/react-connection/schema.d.js.map +1 -0
  26. package/src/agentcore-gateway/react-connection/schema.d.ts +13 -0
  27. package/src/agentcore-gateway/react-connection/schema.json +31 -0
  28. package/src/agentcore-gateway/schema.d.js.map +1 -1
  29. package/src/agentcore-gateway/schema.d.ts +1 -1
  30. package/src/agentcore-gateway/schema.json +3 -2
  31. package/src/connection/agent-local-dev.d.ts +16 -0
  32. package/src/connection/agent-local-dev.js +44 -2
  33. package/src/connection/agent-local-dev.js.map +1 -1
  34. package/src/connection/gateway-runtime-config.d.ts +19 -0
  35. package/src/connection/gateway-runtime-config.js +47 -0
  36. package/src/connection/gateway-runtime-config.js.map +1 -0
  37. package/src/connection/generator.js +5 -0
  38. package/src/connection/generator.js.map +1 -1
  39. package/src/connection/scaffold-catalog.d.ts +267 -0
  40. package/src/connection/scaffold-catalog.js +347 -0
  41. package/src/connection/scaffold-catalog.js.map +1 -0
  42. package/src/connection/schema-resolver.d.ts +5 -0
  43. package/src/connection/schema-resolver.js +27 -0
  44. package/src/connection/schema-resolver.js.map +1 -0
  45. package/src/connection/supported-connections.d.ts +9 -0
  46. package/src/connection/supported-connections.js +12 -0
  47. package/src/connection/supported-connections.js.map +1 -1
  48. package/src/infra/app/__snapshots__/generator.spec.ts.snap +7 -7
  49. package/src/internal/test-matrix/generator.js +39 -1
  50. package/src/internal/test-matrix/generator.js.map +1 -1
  51. package/src/migrations/latest/gateway-agent-targets/__snapshots__/migration.spec.ts.snap +223 -0
  52. package/src/migrations/latest/gateway-agent-targets/metadata.json +3 -0
  53. package/src/migrations/latest/gateway-agent-targets/migration.js +217 -0
  54. package/src/migrations/latest/gateway-agent-targets/migration.js.map +1 -0
  55. package/src/migrations/latest/smithy-ssdk-bundle-pins/metadata.json +3 -0
  56. package/src/migrations/latest/smithy-ssdk-bundle-pins/migration.js +78 -0
  57. package/src/migrations/latest/smithy-ssdk-bundle-pins/migration.js.map +1 -0
  58. package/src/migrations/v1.0.0-rc.50/modernize-function-props-cast/metadata.json +3 -0
  59. package/src/migrations/v1.0.0-rc.50/modernize-function-props-cast/migration.js.map +1 -0
  60. package/src/migrations/v1.0.0-rc.50/restrict-cors-to-custom-domains/metadata.json +3 -0
  61. package/src/migrations/v1.0.0-rc.50/restrict-cors-to-custom-domains/migration.js.map +1 -0
  62. package/src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/metadata.json +3 -0
  63. package/src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/migration.js.map +1 -0
  64. package/src/migrations/v1.0.0-rc.52/user-identity-waf-allow-localhost-callback/metadata.json +3 -0
  65. package/src/migrations/v1.0.0-rc.52/user-identity-waf-allow-localhost-callback/migration.js.map +1 -0
  66. package/src/migrations/v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy/metadata.json +3 -0
  67. package/src/migrations/v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy/migration.js.map +1 -0
  68. package/src/migrations/v1.0.0-rc.55/backfill-generator-metadata/metadata.json +3 -0
  69. package/src/migrations/v1.0.0-rc.55/backfill-generator-metadata/migration.js.map +1 -0
  70. package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/metadata.json +3 -0
  71. package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/migration.d.ts +6 -0
  72. package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/migration.js.map +1 -0
  73. package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/metadata.json +3 -0
  74. package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.d.ts +6 -0
  75. package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.js.map +1 -0
  76. package/src/preset/__snapshots__/generator.spec.ts.snap +5 -5
  77. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +10 -8
  78. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +8 -8
  79. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +2 -2
  80. package/src/py/agent/a2a-connection/generator.d.ts +1 -1
  81. package/src/py/agent/gateway-connection/generator.d.ts +1 -1
  82. package/src/py/agent/mcp-connection/generator.d.ts +1 -1
  83. package/src/py/agent/react-connection/generator.d.ts +4 -1
  84. package/src/py/agent/react-connection/generator.js +35 -14
  85. package/src/py/agent/react-connection/generator.js.map +1 -1
  86. package/src/py/agent/schema.json +1 -0
  87. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  88. package/src/py/dynamodb/schema.json +1 -0
  89. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  90. package/src/py/fast-api/generator.d.ts +5 -0
  91. package/src/py/fast-api/generator.js +3 -2
  92. package/src/py/fast-api/generator.js.map +1 -1
  93. package/src/py/fast-api/schema.json +1 -0
  94. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  95. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +5 -5
  96. package/src/py/mcp-server/schema.json +1 -0
  97. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2 -2
  98. package/src/py/rdb/schema.json +1 -0
  99. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +4 -4
  100. package/src/smithy/project/files/service/build.Dockerfile.template +2 -2
  101. package/src/smithy/project/generator.d.ts +25 -0
  102. package/src/smithy/project/generator.js +24 -3
  103. package/src/smithy/project/generator.js.map +1 -1
  104. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
  105. package/src/smithy/ts/api/generator.d.ts +6 -1
  106. package/src/smithy/ts/api/generator.js +3 -2
  107. package/src/smithy/ts/api/generator.js.map +1 -1
  108. package/src/smithy/ts/api/schema.json +1 -0
  109. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  110. package/src/trpc/backend/generator.d.ts +6 -1
  111. package/src/trpc/backend/generator.js +3 -2
  112. package/src/trpc/backend/generator.js.map +1 -1
  113. package/src/trpc/backend/schema.json +1 -0
  114. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +9 -5
  115. package/src/ts/agent/generator.d.ts +32 -1
  116. package/src/ts/agent/generator.js +7 -4
  117. package/src/ts/agent/generator.js.map +1 -1
  118. package/src/ts/agent/react-connection/generator.d.ts +16 -1
  119. package/src/ts/agent/react-connection/generator.js +21 -8
  120. package/src/ts/agent/react-connection/generator.js.map +1 -1
  121. package/src/ts/agent/schema.json +1 -0
  122. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
  123. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  124. package/src/ts/dynamodb/schema.json +1 -0
  125. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  126. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
  127. package/src/ts/mcp-server/generator.d.ts +32 -1
  128. package/src/ts/mcp-server/generator.js +7 -4
  129. package/src/ts/mcp-server/generator.js.map +1 -1
  130. package/src/ts/mcp-server/schema.json +1 -0
  131. package/src/ts/nx-migration/generator.js +40 -27
  132. package/src/ts/nx-migration/generator.js.map +1 -1
  133. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +6 -6
  134. package/src/ts/rdb/generator.d.ts +8 -0
  135. package/src/ts/rdb/generator.js +3 -2
  136. package/src/ts/rdb/generator.js.map +1 -1
  137. package/src/ts/rdb/schema.json +1 -0
  138. package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +16 -0
  139. package/src/ts/react-website/agui/generator.d.ts +11 -0
  140. package/src/ts/react-website/agui/generator.js +11 -7
  141. package/src/ts/react-website/agui/generator.js.map +1 -1
  142. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +61 -45
  143. package/src/ts/react-website/app/generator.d.ts +6 -1
  144. package/src/ts/react-website/app/generator.js +3 -2
  145. package/src/ts/react-website/app/generator.js.map +1 -1
  146. package/src/ts/react-website/app/schema.json +1 -0
  147. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  148. package/src/ts/react-website/cognito-auth/generator.d.ts +6 -1
  149. package/src/ts/react-website/cognito-auth/generator.js +3 -2
  150. package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
  151. package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +23 -0
  152. package/src/utils/agent-core-constructs/agent-core-constructs.js +24 -1
  153. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  154. package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +3 -0
  155. package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +6 -4
  156. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +119 -3
  157. package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +17 -0
  158. package/src/utils/api-constructs/api-constructs.d.ts +9 -0
  159. package/src/utils/api-constructs/api-constructs.js +11 -1
  160. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  161. package/src/utils/config/utils.d.ts +5 -0
  162. package/src/utils/config/utils.js +7 -1
  163. package/src/utils/config/utils.js.map +1 -1
  164. package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +13 -2
  165. package/src/utils/connection/open-api/react.d.ts +10 -1
  166. package/src/utils/connection/open-api/react.js +3 -2
  167. package/src/utils/connection/open-api/react.js.map +1 -1
  168. package/src/utils/docker.d.ts +27 -2
  169. package/src/utils/docker.js +31 -2
  170. package/src/utils/docker.js.map +1 -1
  171. package/src/utils/identity-constructs/identity-constructs.d.ts +10 -0
  172. package/src/utils/identity-constructs/identity-constructs.js +11 -1
  173. package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
  174. package/src/utils/migration-manifest.d.ts +58 -0
  175. package/src/utils/migration-manifest.js +76 -0
  176. package/src/utils/migration-manifest.js.map +1 -0
  177. package/src/utils/migration-versions.d.ts +2 -0
  178. package/src/utils/migration-versions.js.map +1 -1
  179. package/src/utils/shared-constructs-constants.d.ts +6 -0
  180. package/src/utils/shared-constructs-constants.js +5 -0
  181. package/src/utils/shared-constructs-constants.js.map +1 -1
  182. package/src/utils/version-upgrade-migration/owned-dependencies.d.ts +26 -0
  183. package/src/utils/version-upgrade-migration/owned-dependencies.js +52 -4
  184. package/src/utils/version-upgrade-migration/owned-dependencies.js.map +1 -1
  185. package/src/utils/version-upgrade-migration/register.d.ts +9 -3
  186. package/src/utils/version-upgrade-migration/register.js +18 -14
  187. package/src/utils/version-upgrade-migration/register.js.map +1 -1
  188. package/src/utils/version-upgrade-migration/sync-embedded-versions.d.ts +26 -0
  189. package/src/utils/version-upgrade-migration/sync-embedded-versions.js +304 -0
  190. package/src/utils/version-upgrade-migration/sync-embedded-versions.js.map +1 -0
  191. package/src/utils/version-upgrade-migration/sync-vended-versions.js +14 -0
  192. package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
  193. package/src/utils/versions.d.ts +90 -77
  194. package/src/utils/versions.js +86 -75
  195. package/src/utils/versions.js.map +1 -1
  196. package/src/utils/website-constructs/website-constructs.d.ts +11 -0
  197. package/src/utils/website-constructs/website-constructs.js +12 -1
  198. package/src/utils/website-constructs/website-constructs.js.map +1 -1
  199. package/src/migrations/latest/backfill-generator-metadata/migration.js.map +0 -1
  200. package/src/migrations/latest/dynamodb-local-remove-optimize-flag/migration.js.map +0 -1
  201. package/src/migrations/latest/modernize-function-props-cast/migration.js.map +0 -1
  202. package/src/migrations/latest/order-access-log-delivery-after-bucket-policy/migration.js.map +0 -1
  203. package/src/migrations/latest/restrict-cors-to-custom-domains/migration.js.map +0 -1
  204. package/src/migrations/latest/terraform-bootstrap-adopt-existing-bucket/migration.js.map +0 -1
  205. package/src/migrations/latest/ts-agent-session-management-support/migration.js.map +0 -1
  206. package/src/migrations/latest/user-identity-waf-allow-localhost-callback/migration.js.map +0 -1
  207. /package/src/agentcore-gateway/files/project/{local-dev.ts.template → mcp/local-dev.ts.template} +0 -0
  208. /package/src/migrations/latest/{dynamodb-local-remove-optimize-flag → gateway-agent-targets}/migration.d.ts +0 -0
  209. /package/src/migrations/latest/{modernize-function-props-cast → smithy-ssdk-bundle-pins}/migration.d.ts +0 -0
  210. /package/src/migrations/{latest/restrict-cors-to-custom-domains → v1.0.0-rc.50/modernize-function-props-cast}/migration.d.ts +0 -0
  211. /package/src/migrations/{latest → v1.0.0-rc.50}/modernize-function-props-cast/migration.js +0 -0
  212. /package/src/migrations/{latest/terraform-bootstrap-adopt-existing-bucket → v1.0.0-rc.50/restrict-cors-to-custom-domains}/migration.d.ts +0 -0
  213. /package/src/migrations/{latest → v1.0.0-rc.50}/restrict-cors-to-custom-domains/migration.js +0 -0
  214. /package/src/migrations/{latest/ts-agent-session-management-support → v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket}/migration.d.ts +0 -0
  215. /package/src/migrations/{latest → v1.0.0-rc.50}/terraform-bootstrap-adopt-existing-bucket/migration.js +0 -0
  216. /package/src/migrations/{latest/order-access-log-delivery-after-bucket-policy → v1.0.0-rc.52/user-identity-waf-allow-localhost-callback}/migration.d.ts +0 -0
  217. /package/src/migrations/{latest → v1.0.0-rc.52}/user-identity-waf-allow-localhost-callback/migration.js +0 -0
  218. /package/src/migrations/{latest/user-identity-waf-allow-localhost-callback → v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy}/migration.d.ts +0 -0
  219. /package/src/migrations/{latest → v1.0.0-rc.54}/order-access-log-delivery-after-bucket-policy/migration.js +0 -0
  220. /package/src/migrations/{latest → v1.0.0-rc.55}/backfill-generator-metadata/migration.d.ts +0 -0
  221. /package/src/migrations/{latest → v1.0.0-rc.55}/backfill-generator-metadata/migration.js +0 -0
  222. /package/src/migrations/{latest → v1.0.0-rc.56}/dynamodb-local-remove-optimize-flag/migration.js +0 -0
  223. /package/src/migrations/{latest → v1.0.0-rc.57}/ts-agent-session-management-support/migration.js +0 -0
package/generators.json CHANGED
@@ -30,6 +30,20 @@
30
30
  "metric": "g65",
31
31
  "hidden": true
32
32
  },
33
+ "agentcore-gateway#agent-connection": {
34
+ "factory": "./src/agentcore-gateway/agent-connection/generator",
35
+ "schema": "./src/agentcore-gateway/agent-connection/schema.json",
36
+ "description": "Connect an AgentCore Gateway to an agent, adding the agent as a gateway target",
37
+ "metric": "g69",
38
+ "hidden": true
39
+ },
40
+ "agentcore-gateway#react-connection": {
41
+ "factory": "./src/agentcore-gateway/react-connection/generator",
42
+ "schema": "./src/agentcore-gateway/react-connection/schema.json",
43
+ "description": "Connect a React website to an AgentCore Gateway fronting agents",
44
+ "metric": "g70",
45
+ "hidden": true
46
+ },
33
47
  "connection": {
34
48
  "factory": "./src/connection/generator",
35
49
  "schema": "./src/connection/schema.json",
@@ -54,7 +68,9 @@
54
68
  "connection/ts-agent-gateway",
55
69
  "connection/py-agent-gateway",
56
70
  "connection/agentcore-gateway-mcp",
57
- "connection/agentcore-gateway-gateway"
71
+ "connection/agentcore-gateway-gateway",
72
+ "connection/agentcore-gateway-agent",
73
+ "connection/react-agentcore-gateway"
58
74
  ]
59
75
  },
60
76
  "license": {
package/migrations.json CHANGED
@@ -2,82 +2,92 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "name": "@aws/nx-plugin",
4
4
  "generators": {
5
- "latest-modernize-function-props-cast": {
5
+ "latest-gateway-agent-targets": {
6
+ "version": "1.0.0-rc.59",
7
+ "description": "Add agent runtime target support to the vended AgentCoreGateway construct and an agentName member to vended agent constructs",
8
+ "implementation": "./src/migrations/latest/gateway-agent-targets/migration"
9
+ },
10
+ "latest-smithy-ssdk-bundle-pins": {
11
+ "version": "1.0.0-rc.58",
12
+ "description": "Bump the rolldown and dts plugin pins in the Smithy build.Dockerfile so the bundled SSDK type declaration resolves",
13
+ "implementation": "./src/migrations/latest/smithy-ssdk-bundle-pins/migration"
14
+ },
15
+ "v1.0.0-rc.50-modernize-function-props-cast": {
6
16
  "version": "1.0.0-rc.50",
7
17
  "description": "Replace the legacy angle-bracket FunctionProps type assertion with the modern as syntax in generated API constructs",
8
- "implementation": "./src/migrations/latest/modernize-function-props-cast/migration"
18
+ "implementation": "./src/migrations/v1.0.0-rc.50/modernize-function-props-cast/migration"
9
19
  },
10
- "latest-restrict-cors-to-custom-domains": {
20
+ "v1.0.0-rc.50-restrict-cors-to-custom-domains": {
11
21
  "version": "1.0.0-rc.50",
12
22
  "description": "Include CloudFront custom domain aliases in restrictCorsTo and UserIdentity callback URLs",
13
- "implementation": "./src/migrations/latest/restrict-cors-to-custom-domains/migration"
23
+ "implementation": "./src/migrations/v1.0.0-rc.50/restrict-cors-to-custom-domains/migration"
14
24
  },
15
- "latest-terraform-bootstrap-adopt-existing-bucket": {
25
+ "v1.0.0-rc.50-terraform-bootstrap-adopt-existing-bucket": {
16
26
  "version": "1.0.0-rc.50",
17
27
  "description": "Adopt an existing Terraform state bucket in the vended bootstrap script when its state object is missing",
18
- "implementation": "./src/migrations/latest/terraform-bootstrap-adopt-existing-bucket/migration"
28
+ "implementation": "./src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/migration"
19
29
  },
20
- "latest-user-identity-waf-allow-localhost-callback": {
30
+ "v1.0.0-rc.52-user-identity-waf-allow-localhost-callback": {
21
31
  "version": "1.0.0-rc.52",
22
32
  "description": "Count the EC2MetaDataSSRF_QUERYARGUMENTS WAF rule on the UserIdentity Web ACL so sign-in from a local dev server is not blocked",
23
- "implementation": "./src/migrations/latest/user-identity-waf-allow-localhost-callback/migration"
33
+ "implementation": "./src/migrations/v1.0.0-rc.52/user-identity-waf-allow-localhost-callback/migration"
24
34
  },
25
- "latest-order-access-log-delivery-after-bucket-policy": {
35
+ "v1.0.0-rc.54-order-access-log-delivery-after-bucket-policy": {
26
36
  "version": "1.0.0-rc.54",
27
37
  "description": "Order the S3 server access log delivery source after the bucket policy to avoid a 409 from concurrent bucket configuration writes",
28
- "implementation": "./src/migrations/latest/order-access-log-delivery-after-bucket-policy/migration"
38
+ "implementation": "./src/migrations/v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy/migration"
29
39
  },
30
- "latest-backfill-generator-metadata": {
40
+ "v1.0.0-rc.55-backfill-generator-metadata": {
31
41
  "version": "1.0.0-rc.55",
32
42
  "description": "Backfill the project metadata the version sync reads, recovered from the files the generators left behind",
33
- "implementation": "./src/migrations/latest/backfill-generator-metadata/migration"
43
+ "implementation": "./src/migrations/v1.0.0-rc.55/backfill-generator-metadata/migration"
34
44
  },
35
- "latest-dynamodb-local-remove-optimize-flag": {
45
+ "v1.0.0-rc.56-dynamodb-local-remove-optimize-flag": {
36
46
  "version": "1.0.0-rc.56",
37
47
  "description": "Drop -optimizeDbBeforeStartup from the vended DynamoDB Local container script, which can corrupt shared-local-instance.db",
38
- "implementation": "./src/migrations/latest/dynamodb-local-remove-optimize-flag/migration"
48
+ "implementation": "./src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/migration"
39
49
  },
40
- "latest-ts-agent-session-management-support": {
50
+ "v1.0.0-rc.57-ts-agent-session-management-support": {
41
51
  "version": "1.0.0-rc.57",
42
52
  "description": "Add session management support to ts#agent",
43
- "implementation": "./src/migrations/latest/ts-agent-session-management-support/migration"
53
+ "implementation": "./src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration"
44
54
  },
45
55
  "sync-vended-versions": {
46
- "version": "1.0.0-rc.57",
56
+ "version": "1.0.0-rc.59",
47
57
  "description": "Sync vended dependency versions and the tracked plugin version to those vended by this release",
48
58
  "implementation": "./src/utils/version-upgrade-migration/migration"
49
59
  }
50
60
  },
51
61
  "packageJsonUpdates": {
52
- "nx-23.1.0-nx-packages": {
53
- "version": "1.0.0-rc.57",
62
+ "nx-23.1.1-nx-packages": {
63
+ "version": "1.0.0-rc.59",
54
64
  "packages": {
55
65
  "nx": {
56
- "version": "23.1.0",
66
+ "version": "23.1.1",
57
67
  "alwaysAddToPackageJson": false
58
68
  },
59
69
  "@nx/devkit": {
60
- "version": "23.1.0",
70
+ "version": "23.1.1",
61
71
  "alwaysAddToPackageJson": false
62
72
  },
63
73
  "@nx/js": {
64
- "version": "23.1.0",
74
+ "version": "23.1.1",
65
75
  "alwaysAddToPackageJson": false
66
76
  },
67
77
  "@nx/react": {
68
- "version": "23.1.0",
78
+ "version": "23.1.1",
69
79
  "alwaysAddToPackageJson": false
70
80
  },
71
81
  "@nx/vite": {
72
- "version": "23.1.0",
82
+ "version": "23.1.1",
73
83
  "alwaysAddToPackageJson": false
74
84
  },
75
85
  "@nx/vitest": {
76
- "version": "23.1.0",
86
+ "version": "23.1.1",
77
87
  "alwaysAddToPackageJson": false
78
88
  },
79
89
  "@nx/workspace": {
80
- "version": "23.1.0",
90
+ "version": "23.1.1",
81
91
  "alwaysAddToPackageJson": false
82
92
  }
83
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "1.0.0-rc.57",
3
+ "version": "1.0.0-rc.59",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -36,20 +36,20 @@
36
36
  "node": ">=20.19.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "nx": "23.1.0"
39
+ "nx": "23.1.1"
40
40
  },
41
41
  "dependencies": {
42
42
  "@apidevtools/swagger-parser": "12.1.0",
43
- "@astral-sh/ruff-wasm-nodejs": "0.15.22",
43
+ "@astral-sh/ruff-wasm-nodejs": "0.16.1",
44
44
  "@biomejs/js-api": "6.0.0",
45
- "@biomejs/wasm-nodejs": "2.5.4",
45
+ "@biomejs/wasm-nodejs": "2.5.6",
46
46
  "@getgrit/gritql": "0.0.3",
47
47
  "@iarna/toml": "2.2.5",
48
- "@modelcontextprotocol/sdk": "1.29.0",
49
- "@nx/devkit": "23.1.0",
50
- "@nx/js": "23.1.0",
51
- "@nx/react": "23.1.0",
52
- "@nx/vite": "23.1.0",
48
+ "@modelcontextprotocol/sdk": "1.30.0",
49
+ "@nx/devkit": "23.1.1",
50
+ "@nx/js": "23.1.1",
51
+ "@nx/react": "23.1.1",
52
+ "@nx/vite": "23.1.1",
53
53
  "@nxlv/python": "22.2.2",
54
54
  "@phenomnomnominal/tsquery": "6.2.0",
55
55
  "@types/estree": "1.0.9",
@@ -58,7 +58,7 @@
58
58
  "enquirer": "2.4.1",
59
59
  "fast-glob": "3.3.3",
60
60
  "jiti": "2.7.0",
61
- "js-yaml": "4.3.0",
61
+ "js-yaml": "4.3.1",
62
62
  "license-checker-rseidelsohn": "4.4.2",
63
63
  "lodash.camelcase": "4.3.0",
64
64
  "lodash.clonedeepwith": "4.5.0",
@@ -67,7 +67,7 @@
67
67
  "lodash.trim": "4.18.0",
68
68
  "lodash.uniqby": "4.7.0",
69
69
  "mdast-util-mdx-jsx": "3.2.0",
70
- "minimatch": "10.2.5",
70
+ "minimatch": "10.2.6",
71
71
  "openapi-types": "12.1.3",
72
72
  "pip-requirements-js": "1.0.3",
73
73
  "remark-frontmatter": "5.0.0",
@@ -79,11 +79,11 @@
79
79
  "typescript": "6.0.3",
80
80
  "unified": "11.0.5",
81
81
  "unist-util-visit": "5.1.0",
82
- "vite": "8.1.5",
82
+ "vite": "8.2.0",
83
83
  "vitest": "4.1.10",
84
84
  "zod": "4.4.3"
85
85
  },
86
86
  "devDependencies": {
87
- "@types/semver": "7.7.1"
87
+ "@types/semver": "7.8.0"
88
88
  }
89
89
  }
@@ -0,0 +1,273 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`agentcore-gateway generator > protocol: http > omits protocol_type from the Terraform gateway > my-gateway.tf 1`] = `
4
+ "terraform {
5
+ required_version = ">= 1.0"
6
+
7
+ required_providers {
8
+ aws = {
9
+ source = "hashicorp/aws"
10
+ version = "6.57.1"
11
+ }
12
+ random = {
13
+ source = "hashicorp/random"
14
+ version = "3.9.0"
15
+ }
16
+ }
17
+ }
18
+
19
+ variable "additional_iam_policy_statements" {
20
+ description = "Additional IAM policy statements to attach to the gateway service role. Connection generators (e.g. agentcore-gateway#mcp-connection) append \`InvokeAgentRuntime*\` entries here."
21
+ type = list(object({
22
+ Effect = string
23
+ Action = list(string)
24
+ Resource = list(string)
25
+ }))
26
+ default = []
27
+ }
28
+
29
+
30
+ variable "enable_waf" {
31
+ description = "Associate a regional WAFv2 web ACL (default AWS managed rule groups) with the gateway to inspect inbound requests."
32
+ type = bool
33
+ default = true
34
+ }
35
+
36
+ data "aws_caller_identity" "current" {}
37
+ data "aws_region" "current" {}
38
+
39
+ locals {
40
+ aws_account_id = data.aws_caller_identity.current.account_id
41
+ aws_region = data.aws_region.current.id
42
+ }
43
+
44
+ resource "random_id" "unique_suffix" {
45
+ byte_length = 4
46
+ }
47
+
48
+ # IAM role for the gateway service
49
+ resource "aws_iam_role" "gateway_role" {
50
+ name = "MyGateway-GatewayRole-\${random_id.unique_suffix.hex}"
51
+
52
+ assume_role_policy = jsonencode({
53
+ Version = "2012-10-17"
54
+ Statement = [
55
+ {
56
+ Sid = "AgentCoreGatewayAssumeRolePolicy"
57
+ Effect = "Allow"
58
+ Principal = {
59
+ Service = "bedrock-agentcore.amazonaws.com"
60
+ }
61
+ Action = "sts:AssumeRole"
62
+ Condition = {
63
+ StringEquals = {
64
+ "aws:SourceAccount" = local.aws_account_id
65
+ }
66
+ ArnLike = {
67
+ "aws:SourceArn" = "arn:aws:bedrock-agentcore:\${local.aws_region}:\${local.aws_account_id}:*"
68
+ }
69
+ }
70
+ }
71
+ ]
72
+ })
73
+ }
74
+
75
+ # Inline policy for statements appended by connection generators
76
+ # (e.g. InvokeAgentRuntime*)
77
+ resource "aws_iam_role_policy" "gateway_role_policy" {
78
+ count = length(var.additional_iam_policy_statements) > 0 ? 1 : 0
79
+ name = "MyGateway-GatewayPolicy"
80
+ role = aws_iam_role.gateway_role.id
81
+
82
+ policy = jsonencode({
83
+ Version = "2012-10-17"
84
+ Statement = var.additional_iam_policy_statements
85
+ })
86
+ }
87
+
88
+ resource "aws_bedrockagentcore_gateway" "this" {
89
+ # Cap the name so the 11-char service suffix keeps the gateway id within its
90
+ # 50-char limit (30 prefix + "-<8 hex>" + 11 = 50).
91
+ name = "\${substr("MyGateway", 0, 30)}-\${random_id.unique_suffix.hex}"
92
+ description = "AgentCore Gateway for MyGateway"
93
+ role_arn = aws_iam_role.gateway_role.arn
94
+
95
+ # No protocol type: AgentCore Runtime targets require a gateway without one.
96
+ # The gateway proxies requests to its runtime targets via path-based routing
97
+ # (\`/<targetName>/invocations\`).
98
+
99
+ authorizer_type = "AWS_IAM"
100
+ }
101
+
102
+ # WAFv2 protection for the gateway. AgentCore Gateway requires a REGIONAL web
103
+ # ACL; CloudFront (global) is not supported.
104
+ resource "aws_wafv2_web_acl" "gateway_waf" {
105
+ #checkov:skip=CKV2_AWS_31:Logging configuration is defined below in aws_wafv2_web_acl_logging_configuration.gateway_waf_logging; Checkov does not resolve the separate resource
106
+ count = var.enable_waf ? 1 : 0
107
+
108
+ name = "MyGateway-waf-\${random_id.unique_suffix.hex}"
109
+ scope = "REGIONAL"
110
+
111
+ default_action {
112
+ allow {}
113
+ }
114
+
115
+ rule {
116
+ name = "CRSRule"
117
+ priority = 0
118
+
119
+ override_action {
120
+ none {}
121
+ }
122
+
123
+ statement {
124
+ managed_rule_group_statement {
125
+ name = "AWSManagedRulesCommonRuleSet"
126
+ vendor_name = "AWS"
127
+
128
+ # Count instead of Block: the CRS 8 KB body limit is too restrictive
129
+ # for typical MCP tool payloads.
130
+ rule_action_override {
131
+ name = "SizeRestrictions_BODY"
132
+ action_to_use {
133
+ count {}
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ visibility_config {
140
+ cloudwatch_metrics_enabled = true
141
+ metric_name = "MyGatewayWebAcl-CRS"
142
+ sampled_requests_enabled = true
143
+ }
144
+ }
145
+
146
+ rule {
147
+ name = "KnownBadInputsRule"
148
+ priority = 1
149
+
150
+ override_action {
151
+ none {}
152
+ }
153
+
154
+ statement {
155
+ managed_rule_group_statement {
156
+ name = "AWSManagedRulesKnownBadInputsRuleSet"
157
+ vendor_name = "AWS"
158
+ }
159
+ }
160
+
161
+ visibility_config {
162
+ cloudwatch_metrics_enabled = true
163
+ metric_name = "MyGatewayWebAcl-KnownBadInputs"
164
+ sampled_requests_enabled = true
165
+ }
166
+ }
167
+
168
+ visibility_config {
169
+ cloudwatch_metrics_enabled = true
170
+ metric_name = "MyGatewayWebAcl"
171
+ sampled_requests_enabled = true
172
+ }
173
+
174
+ lifecycle {
175
+ create_before_destroy = true
176
+ }
177
+ }
178
+
179
+ resource "aws_wafv2_web_acl_association" "gateway_waf" {
180
+ count = var.enable_waf ? 1 : 0
181
+
182
+ resource_arn = aws_bedrockagentcore_gateway.this.gateway_arn
183
+ web_acl_arn = aws_wafv2_web_acl.gateway_waf[0].arn
184
+ }
185
+
186
+ # WAF request logs. WAFv2 requires the \`aws-waf-logs-\` name prefix.
187
+ resource "aws_cloudwatch_log_group" "gateway_waf_logs" {
188
+ #checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
189
+ #checkov:skip=CKV_AWS_338:Log retention set to one year which is sufficient for WAF logs
190
+ count = var.enable_waf ? 1 : 0
191
+
192
+ name = "aws-waf-logs-my-gateway-\${random_id.unique_suffix.hex}"
193
+ retention_in_days = 365
194
+ }
195
+
196
+ resource "aws_wafv2_web_acl_logging_configuration" "gateway_waf_logging" {
197
+ count = var.enable_waf ? 1 : 0
198
+
199
+ log_destination_configs = [aws_cloudwatch_log_group.gateway_waf_logs[0].arn]
200
+ resource_arn = aws_wafv2_web_acl.gateway_waf[0].arn
201
+ }
202
+
203
+
204
+ # Add gateway URL to runtime config
205
+ module "add_gateway_url_to_runtime_config" {
206
+ source = "../../../core/runtime-config/entry"
207
+
208
+ namespace = "agentcore"
209
+ key = "gateways"
210
+ value = { "MyGateway" = aws_bedrockagentcore_gateway.this.gateway_url }
211
+
212
+ depends_on = [aws_bedrockagentcore_gateway.this]
213
+ }
214
+
215
+ output "gateway_id" {
216
+ description = "ID of the Bedrock AgentCore Gateway"
217
+ value = aws_bedrockagentcore_gateway.this.gateway_id
218
+ }
219
+
220
+ output "gateway_arn" {
221
+ description = "ARN of the Bedrock AgentCore Gateway"
222
+ value = aws_bedrockagentcore_gateway.this.gateway_arn
223
+ }
224
+
225
+ output "gateway_url" {
226
+ description = "Endpoint URL of the Bedrock AgentCore Gateway. Runtime targets are served under \`<gateway_url minus /mcp>/<targetName>/invocations\`."
227
+ value = aws_bedrockagentcore_gateway.this.gateway_url
228
+ }
229
+
230
+ output "gateway_role_arn" {
231
+ description = "ARN of the IAM role assumed by the gateway service"
232
+ value = aws_iam_role.gateway_role.arn
233
+ }
234
+
235
+ output "waf_web_acl_arn" {
236
+ description = "ARN of the WAFv2 web ACL associated with the gateway, or null if WAF is disabled"
237
+ value = var.enable_waf ? aws_wafv2_web_acl.gateway_waf[0].arn : null
238
+ }
239
+ "
240
+ `;
241
+
242
+ exports[`agentcore-gateway generator > protocol: http > wires the CDK construct with the http protocol > my-gateway.ts 1`] = `
243
+ "import { Construct } from 'constructs';
244
+ import {
245
+ AgentCoreGateway,
246
+ AgentCoreGatewayProps,
247
+ } from '../../../core/agentcore-gateway/agentcore-gateway.js';
248
+ import { RuntimeConfig } from '../../../core/runtime-config.js';
249
+
250
+ export type MyGatewayProps = Omit<AgentCoreGatewayProps, 'protocol'>;
251
+
252
+ /**
253
+ * AgentCore Gateway wired for HTTP proxying of agent runtime targets with IAM inbound auth.
254
+ */
255
+ export class MyGateway extends AgentCoreGateway {
256
+ /** Default Gateway target name when added to another Gateway. */
257
+ public readonly gatewayName = 'my-gateway';
258
+
259
+ constructor(scope: Construct, id: string, props?: MyGatewayProps) {
260
+ super(scope, id, {
261
+ protocol: 'http',
262
+ ...props,
263
+ });
264
+
265
+ const rc = RuntimeConfig.ensure(this);
266
+ rc.set('agentcore', 'gateways', {
267
+ ...rc.get('agentcore').gateways,
268
+ MyGateway: this.gateway.gatewayUrl,
269
+ });
270
+ }
271
+ }
272
+ "
273
+ `;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import type { GeneratorCallback, Tree } from '@nx/devkit';
6
+ import { type NxGeneratorInfo } from '../../utils/nx';
7
+ import type { AgentcoreGatewayAgentConnectionGeneratorSchema } from './schema';
8
+ export declare const AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO: NxGeneratorInfo;
9
+ /**
10
+ * Connect an AgentCore Gateway to an agent, so the agent is added as a
11
+ * gateway target and served under `<gatewayUrl>/<targetName>/invocations`.
12
+ *
13
+ * Chains the gateway's dev target to the agent's dev target, and registers
14
+ * the agent in the gateway's local-dev.ts so the local gateway proxies to it.
15
+ * Users must still call `gateway.addAgent(...)` in their application stack to
16
+ * create the actual CDK/Terraform resource.
17
+ */
18
+ export declare const agentcoreGatewayAgentConnectionGenerator: (tree: Tree, options: AgentcoreGatewayAgentConnectionGeneratorSchema) => Promise<GeneratorCallback>;
19
+ export default agentcoreGatewayAgentConnectionGenerator;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { formatFilesInSubtree } from "../../utils/format.js";
5
+ import { installDependencies } from "../../utils/install.js";
6
+ import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
7
+ import { kebabCase, toClassName } from "../../utils/names.js";
8
+ import { addComponentGeneratorMetadata, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../utils/nx.js";
9
+ import { attachAgentToLocalGateway } from "../attach-upstream.js";
10
+ import { readAgentCoreGatewayMetadata } from "../generator.js";
11
+ export const AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
12
+ /**
13
+ * The agent protocols an http gateway can front, by agent language. The
14
+ * gateway proxies plain HTTP request/response and SSE streams:
15
+ *
16
+ * - `ag-ui` (ts + py) and `http` (py) serve POST /invocations with streamed
17
+ * responses, which proxy cleanly.
18
+ * - `a2a` (ts + py) is JSON-RPC over POST, which AgentCore applies a default
19
+ * schema for.
20
+ * - `http` (ts) is tRPC over WebSocket, and the gateway does not support
21
+ * WebSocket / bidirectional streaming, so it cannot sit behind one.
22
+ */ const SUPPORTED_AGENT_PROTOCOLS = {
23
+ 'ts#agent': [
24
+ 'ag-ui',
25
+ 'a2a'
26
+ ],
27
+ 'py#agent': [
28
+ 'ag-ui',
29
+ 'http',
30
+ 'a2a'
31
+ ]
32
+ };
33
+ /**
34
+ * Connect an AgentCore Gateway to an agent, so the agent is added as a
35
+ * gateway target and served under `<gatewayUrl>/<targetName>/invocations`.
36
+ *
37
+ * Chains the gateway's dev target to the agent's dev target, and registers
38
+ * the agent in the gateway's local-dev.ts so the local gateway proxies to it.
39
+ * Users must still call `gateway.addAgent(...)` in their application stack to
40
+ * create the actual CDK/Terraform resource.
41
+ */ export const agentcoreGatewayAgentConnectionGenerator = async (tree, options)=>{
42
+ const sourceProject = readProjectConfigurationUnqualified(tree, options.sourceProject);
43
+ const targetProject = readProjectConfigurationUnqualified(tree, options.targetProject);
44
+ const gateway = readAgentCoreGatewayMetadata(sourceProject);
45
+ const agentComponent = options.targetComponent;
46
+ if (!agentComponent) {
47
+ throw new Error(`Target project '${options.targetProject}' has no agent component metadata. Did you run the 'ts#agent' or 'py#agent' generator?`);
48
+ }
49
+ if (gateway.protocol !== 'http') {
50
+ throw new Error(`Gateway '${gateway.name}' has protocol='${gateway.protocol}'. Agent targets can only be attached to http-protocol gateways — generate one with the 'agentcore-gateway' generator and --protocol=http.`);
51
+ }
52
+ const agentGenerator = agentComponent.generator ?? 'ts#agent';
53
+ const agentProtocol = (agentComponent.protocol ?? 'http').toLowerCase();
54
+ const supportedProtocols = SUPPORTED_AGENT_PROTOCOLS[agentGenerator] ?? [];
55
+ if (!supportedProtocols.includes(agentProtocol)) {
56
+ throw new Error(`Agent '${agentComponent.name}' uses protocol='${agentProtocol}', which cannot be fronted by a gateway` + (agentGenerator === 'ts#agent' && agentProtocol === 'http' ? ` — a TypeScript HTTP agent serves tRPC over WebSocket, and AgentCore Gateway does not support WebSocket streaming. Consider the ag-ui protocol instead.` : `. Supported protocols: ${supportedProtocols.join(', ')}.`));
57
+ }
58
+ if (agentComponent.auth && agentComponent.auth !== 'iam') {
59
+ throw new Error(`Agent '${agentComponent.name}' uses auth='${agentComponent.auth}'. Gateway->agent connections currently require the agent to use IAM authentication.`);
60
+ }
61
+ // The target name must match what the deployed Gateway uses (`agentName` on
62
+ // the agent construct, derived from the project's class name) so the
63
+ // `/<target>/invocations` path resolves identically locally and deployed.
64
+ const agentComponentName = agentComponent.name ?? 'agent';
65
+ const agentTargetName = kebabCase(agentComponent.rc ?? toClassName(agentComponentName));
66
+ await attachAgentToLocalGateway(tree, sourceProject, 'dev', {
67
+ targetName: agentTargetName,
68
+ port: agentComponent.port ?? 8081,
69
+ upstreamProjectName: targetProject.name,
70
+ upstreamDevTargetName: `${agentComponentName}-dev`,
71
+ // The deployed gateway maps an A2A target's `/invocations/...` paths onto
72
+ // the agent container's root; HTTP and AG-UI agents serve /invocations
73
+ // themselves.
74
+ stripInvocations: agentProtocol === 'a2a'
75
+ });
76
+ // Recorded so the version sync can identify this connection.
77
+ addComponentGeneratorMetadata(tree, sourceProject.name, AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO, targetProject.root, agentTargetName);
78
+ await addGeneratorMetricsIfApplicable(tree, [
79
+ AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO
80
+ ]);
81
+ await formatFilesInSubtree(tree);
82
+ return ()=>installDependencies(tree, options.preferInstallDependencies, {
83
+ languages: [
84
+ 'typescript'
85
+ ]
86
+ });
87
+ };
88
+ export default agentcoreGatewayAgentConnectionGenerator;
89
+
90
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/agentcore-gateway/agent-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { GeneratorCallback, Tree } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport {\n addComponentGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { attachAgentToLocalGateway } from '../attach-upstream';\nimport { readAgentCoreGatewayMetadata } from '../generator';\nimport type { AgentcoreGatewayAgentConnectionGeneratorSchema } from './schema';\n\nexport const AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\n/**\n * The agent protocols an http gateway can front, by agent language. The\n * gateway proxies plain HTTP request/response and SSE streams:\n *\n * - `ag-ui` (ts + py) and `http` (py) serve POST /invocations with streamed\n * responses, which proxy cleanly.\n * - `a2a` (ts + py) is JSON-RPC over POST, which AgentCore applies a default\n * schema for.\n * - `http` (ts) is tRPC over WebSocket, and the gateway does not support\n * WebSocket / bidirectional streaming, so it cannot sit behind one.\n */\nconst SUPPORTED_AGENT_PROTOCOLS: Record<string, string[]> = {\n 'ts#agent': ['ag-ui', 'a2a'],\n 'py#agent': ['ag-ui', 'http', 'a2a'],\n};\n\n/**\n * Connect an AgentCore Gateway to an agent, so the agent is added as a\n * gateway target and served under `<gatewayUrl>/<targetName>/invocations`.\n *\n * Chains the gateway's dev target to the agent's dev target, and registers\n * the agent in the gateway's local-dev.ts so the local gateway proxies to it.\n * Users must still call `gateway.addAgent(...)` in their application stack to\n * create the actual CDK/Terraform resource.\n */\nexport const agentcoreGatewayAgentConnectionGenerator = async (\n tree: Tree,\n options: AgentcoreGatewayAgentConnectionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const gateway = readAgentCoreGatewayMetadata(sourceProject);\n const agentComponent = options.targetComponent;\n\n if (!agentComponent) {\n throw new Error(\n `Target project '${options.targetProject}' has no agent component metadata. Did you run the 'ts#agent' or 'py#agent' generator?`,\n );\n }\n\n if (gateway.protocol !== 'http') {\n throw new Error(\n `Gateway '${gateway.name}' has protocol='${gateway.protocol}'. Agent targets can only be attached to http-protocol gateways — generate one with the 'agentcore-gateway' generator and --protocol=http.`,\n );\n }\n\n const agentGenerator = agentComponent.generator ?? 'ts#agent';\n const agentProtocol = (\n (agentComponent.protocol as string | undefined) ?? 'http'\n ).toLowerCase();\n const supportedProtocols = SUPPORTED_AGENT_PROTOCOLS[agentGenerator] ?? [];\n if (!supportedProtocols.includes(agentProtocol)) {\n throw new Error(\n `Agent '${agentComponent.name}' uses protocol='${agentProtocol}', which cannot be fronted by a gateway` +\n (agentGenerator === 'ts#agent' && agentProtocol === 'http'\n ? ` — a TypeScript HTTP agent serves tRPC over WebSocket, and AgentCore Gateway does not support WebSocket streaming. Consider the ag-ui protocol instead.`\n : `. Supported protocols: ${supportedProtocols.join(', ')}.`),\n );\n }\n if (agentComponent.auth && agentComponent.auth !== 'iam') {\n throw new Error(\n `Agent '${agentComponent.name}' uses auth='${agentComponent.auth}'. Gateway->agent connections currently require the agent to use IAM authentication.`,\n );\n }\n\n // The target name must match what the deployed Gateway uses (`agentName` on\n // the agent construct, derived from the project's class name) so the\n // `/<target>/invocations` path resolves identically locally and deployed.\n const agentComponentName = agentComponent.name ?? 'agent';\n const agentTargetName = kebabCase(\n (agentComponent.rc as string | undefined) ??\n toClassName(agentComponentName),\n );\n\n await attachAgentToLocalGateway(tree, sourceProject, 'dev', {\n targetName: agentTargetName,\n port: (agentComponent.port as number | undefined) ?? 8081,\n upstreamProjectName: targetProject.name,\n upstreamDevTargetName: `${agentComponentName}-dev`,\n // The deployed gateway maps an A2A target's `/invocations/...` paths onto\n // the agent container's root; HTTP and AG-UI agents serve /invocations\n // themselves.\n stripInvocations: agentProtocol === 'a2a',\n });\n\n // Recorded so the version sync can identify this connection.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO,\n targetProject.root,\n agentTargetName,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default agentcoreGatewayAgentConnectionGenerator;\n"],"names":["formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","addComponentGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","attachAgentToLocalGateway","readAgentCoreGatewayMetadata","AGENTCORE_GATEWAY_AGENT_CONNECTION_GENERATOR_INFO","filename","SUPPORTED_AGENT_PROTOCOLS","agentcoreGatewayAgentConnectionGenerator","tree","options","sourceProject","targetProject","gateway","agentComponent","targetComponent","Error","protocol","name","agentGenerator","generator","agentProtocol","toLowerCase","supportedProtocols","includes","join","auth","agentComponentName","agentTargetName","rc","targetName","port","upstreamProjectName","upstreamDevTargetName","stripInvocations","root","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GAED,SAASA,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,mBAAmB,QAAQ,yBAAsB;AAC1D,SAASC,+BAA+B,QAAQ,yBAAsB;AACtE,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAoB;AAC3D,SACEC,6BAA6B,EAC7BC,gBAAgB,EAEhBC,mCAAmC,QAC9B,oBAAiB;AACxB,SAASC,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,kBAAe;AAG5D,OAAO,MAAMC,oDACXJ,iBAAiB,YAAYK,QAAQ,EAAE;AAEzC;;;;;;;;;;CAUC,GACD,MAAMC,4BAAsD;IAC1D,YAAY;QAAC;QAAS;KAAM;IAC5B,YAAY;QAAC;QAAS;QAAQ;KAAM;AACtC;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,2CAA2C,OACtDC,MACAC;IAEA,MAAMC,gBAAgBT,oCACpBO,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBV,oCACpBO,MACAC,QAAQE,aAAa;IAGvB,MAAMC,UAAUT,6BAA6BO;IAC7C,MAAMG,iBAAiBJ,QAAQK,eAAe;IAE9C,IAAI,CAACD,gBAAgB;QACnB,MAAM,IAAIE,MACR,CAAC,gBAAgB,EAAEN,QAAQE,aAAa,CAAC,sFAAsF,CAAC;IAEpI;IAEA,IAAIC,QAAQI,QAAQ,KAAK,QAAQ;QAC/B,MAAM,IAAID,MACR,CAAC,SAAS,EAAEH,QAAQK,IAAI,CAAC,gBAAgB,EAAEL,QAAQI,QAAQ,CAAC,0IAA0I,CAAC;IAE3M;IAEA,MAAME,iBAAiBL,eAAeM,SAAS,IAAI;IACnD,MAAMC,gBAAgB,AACpB,CAAA,AAACP,eAAeG,QAAQ,IAA2B,MAAK,EACxDK,WAAW;IACb,MAAMC,qBAAqBhB,yBAAyB,CAACY,eAAe,IAAI,EAAE;IAC1E,IAAI,CAACI,mBAAmBC,QAAQ,CAACH,gBAAgB;QAC/C,MAAM,IAAIL,MACR,CAAC,OAAO,EAAEF,eAAeI,IAAI,CAAC,iBAAiB,EAAEG,cAAc,uCAAuC,CAAC,GACpGF,CAAAA,mBAAmB,cAAcE,kBAAkB,SAChD,CAAC,uJAAuJ,CAAC,GACzJ,CAAC,uBAAuB,EAAEE,mBAAmBE,IAAI,CAAC,MAAM,CAAC,CAAC,AAAD;IAEnE;IACA,IAAIX,eAAeY,IAAI,IAAIZ,eAAeY,IAAI,KAAK,OAAO;QACxD,MAAM,IAAIV,MACR,CAAC,OAAO,EAAEF,eAAeI,IAAI,CAAC,aAAa,EAAEJ,eAAeY,IAAI,CAAC,oFAAoF,CAAC;IAE1J;IAEA,4EAA4E;IAC5E,qEAAqE;IACrE,0EAA0E;IAC1E,MAAMC,qBAAqBb,eAAeI,IAAI,IAAI;IAClD,MAAMU,kBAAkB9B,UACtB,AAACgB,eAAee,EAAE,IAChB9B,YAAY4B;IAGhB,MAAMxB,0BAA0BM,MAAME,eAAe,OAAO;QAC1DmB,YAAYF;QACZG,MAAM,AAACjB,eAAeiB,IAAI,IAA2B;QACrDC,qBAAqBpB,cAAcM,IAAI;QACvCe,uBAAuB,GAAGN,mBAAmB,IAAI,CAAC;QAClD,0EAA0E;QAC1E,uEAAuE;QACvE,cAAc;QACdO,kBAAkBb,kBAAkB;IACtC;IAEA,6DAA6D;IAC7DrB,8BACES,MACAE,cAAcO,IAAI,EAClBb,mDACAO,cAAcuB,IAAI,EAClBP;IAGF,MAAM/B,gCAAgCY,MAAM;QAC1CJ;KACD;IAED,MAAMV,qBAAqBc;IAE3B,OAAO,IACLb,oBAAoBa,MAAMC,QAAQ0B,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAe7B,yCAAyC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ export { };
5
+
6
+ //# sourceMappingURL=schema.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/agentcore-gateway/agent-connection/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { ComponentMetadata } from '../../utils/nx';\n\nexport interface AgentcoreGatewayAgentConnectionGeneratorSchema {\n sourceProject: string;\n targetProject: string;\n sourceComponent?: ComponentMetadata;\n targetComponent?: ComponentMetadata;\n preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAGD,WAMC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import type { ComponentMetadata } from '../../utils/nx';
6
+
7
+ export interface AgentcoreGatewayAgentConnectionGeneratorSchema {
8
+ sourceProject: string;
9
+ targetProject: string;
10
+ sourceComponent?: ComponentMetadata;
11
+ targetComponent?: ComponentMetadata;
12
+ preferInstallDependencies?: boolean;
13
+ }