@aws/nx-plugin 1.0.0-rc.23 → 1.0.0-rc.24

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 (652) hide show
  1. package/LICENSE-THIRD-PARTY +2088 -971
  2. package/package.json +25 -10
  3. package/src/agentcore-gateway/attach-upstream.d.ts +7 -7
  4. package/src/agentcore-gateway/attach-upstream.js +19 -22
  5. package/src/agentcore-gateway/attach-upstream.js.map +1 -1
  6. package/src/agentcore-gateway/gateway-connection/generator.d.ts +3 -3
  7. package/src/agentcore-gateway/gateway-connection/generator.js +42 -45
  8. package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -1
  9. package/src/agentcore-gateway/gateway-connection/schema.d.js +6 -0
  10. package/src/agentcore-gateway/gateway-connection/schema.d.js.map +1 -0
  11. package/src/agentcore-gateway/generator.js +89 -72
  12. package/src/agentcore-gateway/generator.js.map +1 -1
  13. package/src/agentcore-gateway/mcp-connection/generator.d.ts +2 -2
  14. package/src/agentcore-gateway/mcp-connection/generator.js +24 -30
  15. package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -1
  16. package/src/agentcore-gateway/mcp-connection/schema.d.js +6 -0
  17. package/src/agentcore-gateway/mcp-connection/schema.d.js.map +1 -0
  18. package/src/agentcore-gateway/schema.d.js +6 -0
  19. package/src/agentcore-gateway/schema.d.js.map +1 -0
  20. package/src/bin/aws-nx-mcp.js +14 -0
  21. package/src/bin/aws-nx-mcp.js.map +1 -0
  22. package/src/connection/{agent-serve-local.d.ts → agent-local-dev.d.ts} +5 -5
  23. package/src/connection/agent-local-dev.js +42 -0
  24. package/src/connection/agent-local-dev.js.map +1 -0
  25. package/src/connection/agent-runtime-config.js +9 -14
  26. package/src/connection/agent-runtime-config.js.map +1 -1
  27. package/src/connection/generator.js +262 -207
  28. package/src/connection/generator.js.map +1 -1
  29. package/src/connection/{serve-local.d.ts → local-dev.d.ts} +3 -3
  30. package/src/connection/local-dev.js +37 -0
  31. package/src/connection/local-dev.js.map +1 -0
  32. package/src/connection/schema.d.js +6 -0
  33. package/src/connection/schema.d.js.map +1 -0
  34. package/src/index.js +2 -5
  35. package/src/index.js.map +1 -1
  36. package/src/infra/app/__snapshots__/generator.spec.ts.snap +4 -26
  37. package/src/infra/app/generator.js +133 -123
  38. package/src/infra/app/generator.js.map +1 -1
  39. package/src/infra/app/schema.d.js +6 -0
  40. package/src/infra/app/schema.d.js.map +1 -0
  41. package/src/license/config-types.js +5 -3
  42. package/src/license/config-types.js.map +1 -1
  43. package/src/license/config.d.ts +1 -1
  44. package/src/license/config.js +267 -242
  45. package/src/license/config.js.map +1 -1
  46. package/src/license/dependency-check/check.js +51 -46
  47. package/src/license/dependency-check/check.js.map +1 -1
  48. package/src/license/dependency-check/collectors/collector.js +41 -71
  49. package/src/license/dependency-check/collectors/collector.js.map +1 -1
  50. package/src/license/dependency-check/collectors/npm-collector.js +34 -41
  51. package/src/license/dependency-check/collectors/npm-collector.js.map +1 -1
  52. package/src/license/dependency-check/collectors/python-collector.js +55 -62
  53. package/src/license/dependency-check/collectors/python-collector.js.map +1 -1
  54. package/src/license/dependency-check/evaluator.js +40 -68
  55. package/src/license/dependency-check/evaluator.js.map +1 -1
  56. package/src/license/dependency-check/executor.js +30 -22
  57. package/src/license/dependency-check/executor.js.map +1 -1
  58. package/src/license/dependency-check/pre-approved.js +949 -336
  59. package/src/license/dependency-check/pre-approved.js.map +1 -1
  60. package/src/license/dependency-check/types.js +2 -3
  61. package/src/license/dependency-check/types.js.map +1 -1
  62. package/src/license/generator.js +55 -60
  63. package/src/license/generator.js.map +1 -1
  64. package/src/license/index.js +3 -9
  65. package/src/license/index.js.map +1 -1
  66. package/src/license/known-exceptions.js +14 -13
  67. package/src/license/known-exceptions.js.map +1 -1
  68. package/src/license/schema.d.js +6 -0
  69. package/src/license/schema.d.js.map +1 -0
  70. package/src/license/sync/generator.js +94 -119
  71. package/src/license/sync/generator.js.map +1 -1
  72. package/src/license/sync/project-file-sync.js +28 -35
  73. package/src/license/sync/project-file-sync.js.map +1 -1
  74. package/src/mcp-server/generator-info.js +130 -160
  75. package/src/mcp-server/generator-info.js.map +1 -1
  76. package/src/mcp-server/guide-pipeline.js +184 -206
  77. package/src/mcp-server/guide-pipeline.js.map +1 -1
  78. package/src/mcp-server/guide-render.js +10 -25
  79. package/src/mcp-server/guide-render.js.map +1 -1
  80. package/src/mcp-server/index.js +6 -10
  81. package/src/mcp-server/index.js.map +1 -1
  82. package/src/mcp-server/mdx-ast.js +39 -57
  83. package/src/mcp-server/mdx-ast.js.map +1 -1
  84. package/src/mcp-server/option-filter.js +33 -47
  85. package/src/mcp-server/option-filter.js.map +1 -1
  86. package/src/mcp-server/schema-registry.js +27 -40
  87. package/src/mcp-server/schema-registry.js.map +1 -1
  88. package/src/mcp-server/schema.js +9 -7
  89. package/src/mcp-server/schema.js.map +1 -1
  90. package/src/mcp-server/server.js +20 -24
  91. package/src/mcp-server/server.js.map +1 -1
  92. package/src/mcp-server/tools/create-workspace-command.js +23 -24
  93. package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
  94. package/src/mcp-server/tools/general-guidance.js +28 -25
  95. package/src/mcp-server/tools/general-guidance.js.map +1 -1
  96. package/src/mcp-server/tools/generator-guide.js +29 -37
  97. package/src/mcp-server/tools/generator-guide.js.map +1 -1
  98. package/src/mcp-server/tools/list-generators.js +19 -25
  99. package/src/mcp-server/tools/list-generators.js.map +1 -1
  100. package/src/open-api/ts-client/generator.js +16 -26
  101. package/src/open-api/ts-client/generator.js.map +1 -1
  102. package/src/open-api/ts-client/schema.d.js +6 -0
  103. package/src/open-api/ts-client/schema.d.js.map +1 -0
  104. package/src/open-api/ts-hooks/generator.js +13 -21
  105. package/src/open-api/ts-hooks/generator.js.map +1 -1
  106. package/src/open-api/ts-hooks/schema.d.js +6 -0
  107. package/src/open-api/ts-hooks/schema.d.js.map +1 -0
  108. package/src/open-api/ts-metadata/generator.js +12 -20
  109. package/src/open-api/ts-metadata/generator.js.map +1 -1
  110. package/src/open-api/ts-metadata/schema.d.js +6 -0
  111. package/src/open-api/ts-metadata/schema.d.js.map +1 -0
  112. package/src/open-api/utils/codegen-data/languages.js +42 -60
  113. package/src/open-api/utils/codegen-data/languages.js.map +1 -1
  114. package/src/open-api/utils/codegen-data/types.js +31 -30
  115. package/src/open-api/utils/codegen-data/types.js.map +1 -1
  116. package/src/open-api/utils/codegen-data.js +253 -269
  117. package/src/open-api/utils/codegen-data.js.map +1 -1
  118. package/src/open-api/utils/normalise.js +242 -241
  119. package/src/open-api/utils/normalise.js.map +1 -1
  120. package/src/open-api/utils/parse.js +8 -14
  121. package/src/open-api/utils/parse.js.map +1 -1
  122. package/src/open-api/utils/refs.js +12 -22
  123. package/src/open-api/utils/refs.js.map +1 -1
  124. package/src/open-api/utils/types.js +5 -2
  125. package/src/open-api/utils/types.js.map +1 -1
  126. package/src/preset/__snapshots__/generator.spec.ts.snap +31 -6
  127. package/src/preset/generator.d.ts +1 -1
  128. package/src/preset/generator.js +130 -112
  129. package/src/preset/generator.js.map +1 -1
  130. package/src/preset/schema.d.js +6 -0
  131. package/src/preset/schema.d.js.map +1 -0
  132. package/src/preset/schema.d.ts +0 -1
  133. package/src/preset/schema.json +0 -5
  134. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +304 -0
  135. package/src/py/agent/__snapshots__/{generator.spec.ts.snap → generator.frameworks.spec.ts.snap} +6 -843
  136. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +535 -0
  137. package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +1 -2
  138. package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +1 -1
  139. package/src/py/agent/a2a-connection/files/langchain/agent-connection/app/__targetAgentSnakeCase___client_langchain.py.template +1 -1
  140. package/src/py/agent/a2a-connection/generator.js +70 -74
  141. package/src/py/agent/a2a-connection/generator.js.map +1 -1
  142. package/src/py/agent/a2a-connection/schema.d.js +8 -0
  143. package/src/py/agent/a2a-connection/schema.d.js.map +1 -0
  144. package/src/py/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +6 -8
  145. package/src/py/agent/gateway-connection/files/agent-connection/app/__gatewaySnakeCase___client_strands.py.template +3 -3
  146. package/src/py/agent/gateway-connection/files/langchain/agent-connection/app/__gatewaySnakeCase___client_langchain.py.template +3 -3
  147. package/src/py/agent/gateway-connection/generator.js +61 -57
  148. package/src/py/agent/gateway-connection/generator.js.map +1 -1
  149. package/src/py/agent/gateway-connection/schema.d.js +6 -0
  150. package/src/py/agent/gateway-connection/schema.d.js.map +1 -0
  151. package/src/py/agent/generator.js +227 -193
  152. package/src/py/agent/generator.js.map +1 -1
  153. package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +5 -12
  154. package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client_strands.py.template +1 -1
  155. package/src/py/agent/mcp-connection/files/langchain/agent-connection/app/__mcpServerSnakeCase___client_langchain.py.template +1 -1
  156. package/src/py/agent/mcp-connection/generator.js +53 -51
  157. package/src/py/agent/mcp-connection/generator.js.map +1 -1
  158. package/src/py/agent/mcp-connection/schema.d.js +8 -0
  159. package/src/py/agent/mcp-connection/schema.d.js.map +1 -0
  160. package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +3 -2
  161. package/src/py/agent/react-connection/generator.js +51 -58
  162. package/src/py/agent/react-connection/generator.js.map +1 -1
  163. package/src/py/agent/react-connection/{serve-local.d.ts → local-dev.d.ts} +4 -4
  164. package/src/py/agent/react-connection/local-dev.js +36 -0
  165. package/src/py/agent/react-connection/local-dev.js.map +1 -0
  166. package/src/py/agent/react-connection/schema.d.js +8 -0
  167. package/src/py/agent/react-connection/schema.d.js.map +1 -0
  168. package/src/py/agent/schema.d.js +6 -0
  169. package/src/py/agent/schema.d.js.map +1 -0
  170. package/src/py/api/generator.js +12 -12
  171. package/src/py/api/generator.js.map +1 -1
  172. package/src/py/api/schema.d.js +6 -0
  173. package/src/py/api/schema.d.js.map +1 -0
  174. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +68 -28
  175. package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +5 -5
  176. package/src/py/dynamodb/agent-connection/generator.js +27 -29
  177. package/src/py/dynamodb/agent-connection/generator.js.map +1 -1
  178. package/src/py/dynamodb/agent-connection/schema.d.js +8 -0
  179. package/src/py/dynamodb/agent-connection/schema.d.js.map +1 -0
  180. package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +3 -3
  181. package/src/py/dynamodb/fast-api-connection/generator.js +26 -28
  182. package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -1
  183. package/src/py/dynamodb/fast-api-connection/schema.d.js +8 -0
  184. package/src/py/dynamodb/fast-api-connection/schema.d.js.map +1 -0
  185. package/src/py/dynamodb/files/__name__/client.py.template +5 -5
  186. package/src/py/dynamodb/files/__name__/entities/base.py.template +2 -2
  187. package/src/py/dynamodb/files/config.json.template +1 -1
  188. package/src/py/dynamodb/generator.js +63 -62
  189. package/src/py/dynamodb/generator.js.map +1 -1
  190. package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +5 -5
  191. package/src/py/dynamodb/mcp-server-connection/generator.js +27 -29
  192. package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -1
  193. package/src/py/dynamodb/mcp-server-connection/schema.d.js +8 -0
  194. package/src/py/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
  195. package/src/py/dynamodb/schema.d.js +6 -0
  196. package/src/py/dynamodb/schema.d.js.map +1 -0
  197. package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +45 -4632
  198. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +4833 -0
  199. package/src/py/fast-api/generator.js +79 -85
  200. package/src/py/fast-api/generator.js.map +1 -1
  201. package/src/py/fast-api/react/__snapshots__/generator.spec.ts.snap +3 -2
  202. package/src/py/fast-api/react/generator.js +22 -24
  203. package/src/py/fast-api/react/generator.js.map +1 -1
  204. package/src/py/fast-api/react/open-api.js +28 -29
  205. package/src/py/fast-api/react/open-api.js.map +1 -1
  206. package/src/py/fast-api/react/schema.d.js +6 -0
  207. package/src/py/fast-api/react/schema.d.js.map +1 -0
  208. package/src/py/fast-api/schema.d.js +6 -0
  209. package/src/py/fast-api/schema.d.js.map +1 -0
  210. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +4 -4
  211. package/src/py/lambda-function/generator.js +57 -58
  212. package/src/py/lambda-function/generator.js.map +1 -1
  213. package/src/py/lambda-function/schema.d.js +6 -0
  214. package/src/py/lambda-function/schema.d.js.map +1 -0
  215. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
  216. package/src/py/mcp-server/generator.js +149 -131
  217. package/src/py/mcp-server/generator.js.map +1 -1
  218. package/src/py/mcp-server/schema.d.js +6 -0
  219. package/src/py/mcp-server/schema.d.js.map +1 -0
  220. package/src/py/project/generator.js +128 -89
  221. package/src/py/project/generator.js.map +1 -1
  222. package/src/py/project/schema.d.js +6 -0
  223. package/src/py/project/schema.d.js.map +1 -0
  224. package/src/sdk/agentcore-gateway.d.ts +6 -0
  225. package/src/sdk/agentcore-gateway.js +7 -0
  226. package/src/sdk/agentcore-gateway.js.map +1 -0
  227. package/src/sdk/connection.d.ts +6 -0
  228. package/src/sdk/connection.js +6 -0
  229. package/src/sdk/connection.js.map +1 -0
  230. package/{sdk → src/sdk}/license.d.ts +4 -4
  231. package/src/sdk/license.js +7 -0
  232. package/src/sdk/license.js.map +1 -0
  233. package/src/sdk/open-api.d.ts +10 -0
  234. package/src/sdk/open-api.js +8 -0
  235. package/src/sdk/open-api.js.map +1 -0
  236. package/src/sdk/py.d.ts +14 -0
  237. package/src/sdk/py.js +10 -0
  238. package/src/sdk/py.js.map +1 -0
  239. package/src/sdk/terraform.d.ts +6 -0
  240. package/src/sdk/terraform.js +7 -0
  241. package/src/sdk/terraform.js.map +1 -0
  242. package/src/sdk/ts.d.ts +33 -0
  243. package/src/sdk/ts.js +35 -0
  244. package/src/sdk/ts.js.map +1 -0
  245. package/{sdk → src/sdk}/utils/ast.d.ts +2 -2
  246. package/src/sdk/utils/ast.js +7 -0
  247. package/src/sdk/utils/ast.js.map +1 -0
  248. package/{sdk → src/sdk}/utils/format.d.ts +1 -1
  249. package/src/sdk/utils/format.js +6 -0
  250. package/src/sdk/utils/format.js.map +1 -0
  251. package/{sdk → src/sdk}/utils/test.d.ts +1 -1
  252. package/src/sdk/utils/test.js +6 -0
  253. package/src/sdk/utils/test.js.map +1 -0
  254. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +2 -8
  255. package/src/smithy/project/files/build.Dockerfile.template +1 -4
  256. package/src/smithy/project/generator.js +44 -42
  257. package/src/smithy/project/generator.js.map +1 -1
  258. package/src/smithy/project/schema.d.js +6 -0
  259. package/src/smithy/project/schema.d.js.map +1 -0
  260. package/src/smithy/react-connection/generator.js +35 -46
  261. package/src/smithy/react-connection/generator.js.map +1 -1
  262. package/src/smithy/react-connection/schema.d.js +6 -0
  263. package/src/smithy/react-connection/schema.d.js.map +1 -0
  264. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +395 -72
  265. package/src/smithy/ts/api/generator.js +121 -111
  266. package/src/smithy/ts/api/generator.js.map +1 -1
  267. package/src/smithy/ts/api/schema.d.js +6 -0
  268. package/src/smithy/ts/api/schema.d.js.map +1 -0
  269. package/src/terraform/project/files/application/src/providers.tf.template +1 -1
  270. package/src/terraform/project/generator.js +141 -103
  271. package/src/terraform/project/generator.js.map +1 -1
  272. package/src/terraform/project/schema.d.js +9 -0
  273. package/src/terraform/project/schema.d.js.map +1 -0
  274. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +336 -92
  275. package/src/trpc/backend/generator.js +93 -86
  276. package/src/trpc/backend/generator.js.map +1 -1
  277. package/src/trpc/backend/schema.d.js +6 -0
  278. package/src/trpc/backend/schema.d.js.map +1 -0
  279. package/src/trpc/react/__snapshots__/generator.spec.ts.snap +1 -1
  280. package/src/trpc/react/generator.js +59 -58
  281. package/src/trpc/react/generator.js.map +1 -1
  282. package/src/trpc/react/schema.d.js +6 -0
  283. package/src/trpc/react/schema.d.js.map +1 -0
  284. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +10 -10
  285. package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +1 -1
  286. package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client-strands.ts.template +1 -1
  287. package/src/ts/agent/a2a-connection/generator.js +58 -54
  288. package/src/ts/agent/a2a-connection/generator.js.map +1 -1
  289. package/src/ts/agent/a2a-connection/schema.d.js +8 -0
  290. package/src/ts/agent/a2a-connection/schema.d.js.map +1 -0
  291. package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +5 -5
  292. package/src/ts/agent/gateway-connection/files/agent-connection/app/__gatewayKebabCase__-client-strands.ts.template +3 -3
  293. package/src/ts/agent/gateway-connection/generator.js +57 -52
  294. package/src/ts/agent/gateway-connection/generator.js.map +1 -1
  295. package/src/ts/agent/gateway-connection/schema.d.js +6 -0
  296. package/src/ts/agent/gateway-connection/schema.d.js.map +1 -0
  297. package/src/ts/agent/generator.js +165 -136
  298. package/src/ts/agent/generator.js.map +1 -1
  299. package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +1 -1
  300. package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +1 -1
  301. package/src/ts/agent/mcp-connection/generator.js +48 -46
  302. package/src/ts/agent/mcp-connection/generator.js.map +1 -1
  303. package/src/ts/agent/mcp-connection/schema.d.js +8 -0
  304. package/src/ts/agent/mcp-connection/schema.d.js.map +1 -0
  305. package/src/ts/agent/react-connection/generator.js +79 -79
  306. package/src/ts/agent/react-connection/generator.js.map +1 -1
  307. package/src/ts/agent/react-connection/{serve-local.d.ts → local-dev.d.ts} +2 -2
  308. package/src/ts/agent/react-connection/local-dev.js +17 -0
  309. package/src/ts/agent/react-connection/local-dev.js.map +1 -0
  310. package/src/ts/agent/react-connection/schema.d.js +8 -0
  311. package/src/ts/agent/react-connection/schema.d.js.map +1 -0
  312. package/src/ts/agent/schema.d.js +6 -0
  313. package/src/ts/agent/schema.d.js.map +1 -0
  314. package/src/ts/api/generator.js +16 -18
  315. package/src/ts/api/generator.js.map +1 -1
  316. package/src/ts/api/schema.d.js +6 -0
  317. package/src/ts/api/schema.d.js.map +1 -0
  318. package/src/ts/astro-docs/__snapshots__/generator.spec.ts.snap +8 -8
  319. package/src/ts/astro-docs/generator.js +59 -48
  320. package/src/ts/astro-docs/generator.js.map +1 -1
  321. package/src/ts/astro-docs/schema.d.js +6 -0
  322. package/src/ts/astro-docs/schema.d.js.map +1 -0
  323. package/src/ts/docs/generator.js +10 -10
  324. package/src/ts/docs/generator.js.map +1 -1
  325. package/src/ts/docs/schema.d.js +6 -0
  326. package/src/ts/docs/schema.d.js.map +1 -0
  327. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +68 -30
  328. package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +5 -5
  329. package/src/ts/dynamodb/agent-connection/generator.js +21 -23
  330. package/src/ts/dynamodb/agent-connection/generator.js.map +1 -1
  331. package/src/ts/dynamodb/agent-connection/schema.d.js +8 -0
  332. package/src/ts/dynamodb/agent-connection/schema.d.js.map +1 -0
  333. package/src/ts/dynamodb/files/config.json.template +1 -1
  334. package/src/ts/dynamodb/files/src/client.ts.template +7 -7
  335. package/src/ts/dynamodb/generator.js +64 -63
  336. package/src/ts/dynamodb/generator.js.map +1 -1
  337. package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +5 -5
  338. package/src/ts/dynamodb/mcp-server-connection/generator.js +21 -23
  339. package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -1
  340. package/src/ts/dynamodb/mcp-server-connection/schema.d.js +8 -0
  341. package/src/ts/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
  342. package/src/ts/dynamodb/schema.d.js +6 -0
  343. package/src/ts/dynamodb/schema.d.js.map +1 -0
  344. package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
  345. package/src/ts/dynamodb/smithy-connection/generator.js +20 -22
  346. package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -1
  347. package/src/ts/dynamodb/smithy-connection/schema.d.js +8 -0
  348. package/src/ts/dynamodb/smithy-connection/schema.d.js.map +1 -0
  349. package/src/ts/dynamodb/trpc-connection/__snapshots__/generator.spec.ts.snap +3 -3
  350. package/src/ts/dynamodb/trpc-connection/generator.js +20 -22
  351. package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -1
  352. package/src/ts/dynamodb/trpc-connection/schema.d.js +8 -0
  353. package/src/ts/dynamodb/trpc-connection/schema.d.js.map +1 -0
  354. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +4 -4
  355. package/src/ts/lambda-function/generator.js +55 -55
  356. package/src/ts/lambda-function/generator.js.map +1 -1
  357. package/src/ts/lambda-function/io.js +83 -52
  358. package/src/ts/lambda-function/io.js.map +1 -1
  359. package/src/ts/lambda-function/schema.d.js +6 -0
  360. package/src/ts/lambda-function/schema.d.js.map +1 -0
  361. package/src/ts/lib/__snapshots__/generator.spec.ts.snap +23 -36
  362. package/src/ts/lib/biome.js +37 -37
  363. package/src/ts/lib/biome.js.map +1 -1
  364. package/src/ts/lib/generator.js +75 -77
  365. package/src/ts/lib/generator.js.map +1 -1
  366. package/src/ts/lib/schema.d.js +6 -0
  367. package/src/ts/lib/schema.d.js.map +1 -0
  368. package/src/ts/lib/ts-project-utils.js +65 -70
  369. package/src/ts/lib/ts-project-utils.js.map +1 -1
  370. package/src/ts/lib/types.js +5 -2
  371. package/src/ts/lib/types.js.map +1 -1
  372. package/src/ts/lib/vitest.js +29 -26
  373. package/src/ts/lib/vitest.js.map +1 -1
  374. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
  375. package/src/ts/mcp-server/generator.js +157 -138
  376. package/src/ts/mcp-server/generator.js.map +1 -1
  377. package/src/ts/mcp-server/schema.d.js +6 -0
  378. package/src/ts/mcp-server/schema.d.js.map +1 -0
  379. package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +14 -9
  380. package/src/ts/nx-generator/files/local/generator.ts.template +3 -3
  381. package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.ts.template +4 -4
  382. package/src/ts/nx-generator/generator.js +84 -83
  383. package/src/ts/nx-generator/generator.js.map +1 -1
  384. package/src/ts/nx-generator/schema.d.js +6 -0
  385. package/src/ts/nx-generator/schema.d.js.map +1 -0
  386. package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +30 -18
  387. package/src/ts/nx-plugin/files/mcp-server/server.ts.template +5 -5
  388. package/src/ts/nx-plugin/files/mcp-server/tools/create-workspace-command.ts.template +2 -2
  389. package/src/ts/nx-plugin/files/mcp-server/tools/general-guidance.ts.template +1 -1
  390. package/src/ts/nx-plugin/files/mcp-server/tools/generator-guide.ts.template +2 -2
  391. package/src/ts/nx-plugin/files/mcp-server/tools/list-generators.ts.template +2 -2
  392. package/src/ts/nx-plugin/files/mcp-server/utils.ts.template +3 -3
  393. package/src/ts/nx-plugin/generator.js +49 -48
  394. package/src/ts/nx-plugin/generator.js.map +1 -1
  395. package/src/ts/nx-plugin/schema.d.js +9 -0
  396. package/src/ts/nx-plugin/schema.d.js.map +1 -0
  397. package/src/ts/nx-plugin/utils.js +32 -44
  398. package/src/ts/nx-plugin/utils.js.map +1 -1
  399. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +30 -30
  400. package/src/ts/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +6 -6
  401. package/src/ts/rdb/agent-connection/generator.js +38 -39
  402. package/src/ts/rdb/agent-connection/generator.js.map +1 -1
  403. package/src/ts/rdb/agent-connection/schema.d.js +8 -0
  404. package/src/ts/rdb/agent-connection/schema.d.js.map +1 -0
  405. package/src/ts/rdb/files/config.json.template +1 -1
  406. package/src/ts/rdb/files/prisma.config.ts.template +2 -2
  407. package/src/ts/rdb/files/src/prisma.ts.template +7 -7
  408. package/src/ts/rdb/files/src/utils.ts.template +1 -0
  409. package/src/ts/rdb/generator.js +130 -117
  410. package/src/ts/rdb/generator.js.map +1 -1
  411. package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +6 -6
  412. package/src/ts/rdb/mcp-server-connection/generator.js +36 -37
  413. package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
  414. package/src/ts/rdb/mcp-server-connection/schema.d.js +8 -0
  415. package/src/ts/rdb/mcp-server-connection/schema.d.js.map +1 -0
  416. package/src/ts/rdb/schema.d.js +6 -0
  417. package/src/ts/rdb/schema.d.js.map +1 -0
  418. package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
  419. package/src/ts/rdb/smithy-connection/generator.js +46 -43
  420. package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
  421. package/src/ts/rdb/smithy-connection/schema.d.js +8 -0
  422. package/src/ts/rdb/smithy-connection/schema.d.js.map +1 -0
  423. package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +3 -3
  424. package/src/ts/rdb/trpc-connection/generator.js +36 -31
  425. package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
  426. package/src/ts/rdb/trpc-connection/schema.d.js +8 -0
  427. package/src/ts/rdb/trpc-connection/schema.d.js.map +1 -0
  428. package/src/ts/rdb/utils.js +9 -11
  429. package/src/ts/rdb/utils.js.map +1 -1
  430. package/src/ts/react-website/agui/generator.js +69 -61
  431. package/src/ts/react-website/agui/generator.js.map +1 -1
  432. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +154 -260
  433. package/src/ts/react-website/app/generator.js +197 -188
  434. package/src/ts/react-website/app/generator.js.map +1 -1
  435. package/src/ts/react-website/app/schema.d.js +6 -0
  436. package/src/ts/react-website/app/schema.d.js.map +1 -0
  437. package/src/ts/react-website/app/schema.json +6 -6
  438. package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +118 -4
  439. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +10 -3
  440. package/src/ts/react-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +2 -2
  441. package/src/ts/react-website/cognito-auth/generator.js +60 -60
  442. package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
  443. package/src/ts/react-website/cognito-auth/schema.d.js +6 -0
  444. package/src/ts/react-website/cognito-auth/schema.d.js.map +1 -0
  445. package/src/ts/react-website/cognito-auth/utils.js +34 -32
  446. package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
  447. package/src/ts/react-website/runtime-config/__snapshots__/generator.spec.ts.snap +2 -2
  448. package/src/ts/react-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +2 -2
  449. package/src/ts/react-website/runtime-config/generator.js +29 -31
  450. package/src/ts/react-website/runtime-config/generator.js.map +1 -1
  451. package/src/ts/react-website/runtime-config/schema.d.js +6 -0
  452. package/src/ts/react-website/runtime-config/schema.d.js.map +1 -0
  453. package/src/ts/sync/generator.js +60 -59
  454. package/src/ts/sync/generator.js.map +1 -1
  455. package/src/ts/website/app/generator.js +10 -10
  456. package/src/ts/website/app/generator.js.map +1 -1
  457. package/src/ts/website/app/schema.d.js +6 -0
  458. package/src/ts/website/app/schema.d.js.map +1 -0
  459. package/src/ts/website/app/schema.json +6 -6
  460. package/src/ts/website/auth/generator.js +11 -11
  461. package/src/ts/website/auth/generator.js.map +1 -1
  462. package/src/ts/website/auth/schema.d.js +6 -0
  463. package/src/ts/website/auth/schema.d.js.map +1 -0
  464. package/src/utils/agent-chat/agent-chat.d.ts +1 -1
  465. package/src/utils/agent-chat/agent-chat.js +11 -12
  466. package/src/utils/agent-chat/agent-chat.js.map +1 -1
  467. package/src/utils/agent-chat/files/a2a/chat.ts.template +1 -1
  468. package/src/utils/agent-chat/files/ag-ui/chat.ts.template +1 -1
  469. package/src/utils/agent-chat/files/http-py/chat.ts.template +1 -1
  470. package/src/utils/agent-chat/files/http-ts/chat.ts.template +1 -1
  471. package/src/utils/agent-connection/agent-connection.js +129 -146
  472. package/src/utils/agent-connection/agent-connection.js.map +1 -1
  473. package/src/utils/agent-connection/files/core-gateway/agentcore-gateway-mcp-transport.ts.template +1 -1
  474. package/src/utils/agent-connection/files/core-strands/gateway/agentcore-gateway-mcp-client-strands.ts.template +1 -1
  475. package/src/utils/agent-connection/files/py-core-gateway/agentcore_gateway_mcp_transport.py.template +1 -1
  476. package/src/utils/agent-connection/files/py-core-langchain/gateway/agentcore_gateway_mcp_client_langchain.py.template +1 -1
  477. package/src/utils/agent-connection/files/py-core-strands/gateway/agentcore_gateway_mcp_client_strands.py.template +1 -1
  478. package/src/utils/agent-core-constructs/agent-core-constructs.js +53 -50
  479. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  480. package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
  481. package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +4 -4
  482. package/src/utils/agent-core-constructs/files/terraform/core/agentcore-gateway/gateway.tf.template +2 -2
  483. package/src/utils/api-constructs/api-constructs.js +30 -31
  484. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  485. package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +14 -6
  486. package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account/index.js.template +58 -0
  487. package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account.ts.template +82 -0
  488. package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +28 -14
  489. package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +1 -8
  490. package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +91 -4
  491. package/src/utils/api-constructs/files/terraform/core/api/http/http-api/http-api.tf.template +1 -1
  492. package/src/utils/api-constructs/files/terraform/core/api/rest/api-gateway-account/api-gateway-account.tf.template +83 -0
  493. package/src/utils/api-constructs/files/terraform/core/api/rest/rest-api/rest-api.tf.template +5 -11
  494. package/src/utils/api-constructs/open-api-metadata.js +22 -22
  495. package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
  496. package/src/utils/ast/website.js +17 -19
  497. package/src/utils/ast/website.js.map +1 -1
  498. package/src/utils/ast.js +72 -97
  499. package/src/utils/ast.js.map +1 -1
  500. package/src/utils/bundle/bundle.js +50 -47
  501. package/src/utils/bundle/bundle.js.map +1 -1
  502. package/src/utils/commands.js +47 -26
  503. package/src/utils/commands.js.map +1 -1
  504. package/src/utils/config/index.d.ts +2 -2
  505. package/src/utils/config/index.js +5 -4
  506. package/src/utils/config/index.js.map +1 -1
  507. package/src/utils/config/utils.js +48 -58
  508. package/src/utils/config/utils.js.map +1 -1
  509. package/src/utils/connection/open-api/react.d.ts +5 -5
  510. package/src/utils/connection/open-api/react.js +81 -77
  511. package/src/utils/connection/open-api/react.js.map +1 -1
  512. package/src/utils/containers.js +22 -23
  513. package/src/utils/containers.js.map +1 -1
  514. package/src/utils/dynamodb-constructs/dynamodb-constructs.js +32 -33
  515. package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -1
  516. package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +12 -2
  517. package/src/utils/dynamodb-constructs/files/terraform/core/dynamodb/dynamodb.tf.template +1 -1
  518. package/src/utils/files/common/scripts/src/dynamodb/create-local-table.ts.template +2 -2
  519. package/src/utils/files/common/scripts/src/dynamodb/pull-image.ts.template +1 -1
  520. package/src/utils/files/common/scripts/src/dynamodb/start-container.ts.template +17 -2
  521. package/src/utils/files/common/scripts/src/rdb/mysql/wait-for-mysql-db.ts.template +32 -0
  522. package/src/utils/files/common/scripts/src/rdb/postgres/wait-for-postgres-db.ts.template +32 -0
  523. package/src/utils/files/common/scripts/src/rdb/{pull-image.ts.template → shared/pull-image.ts.template} +1 -1
  524. package/src/utils/files/common/scripts/src/rdb/{start-container.ts.template → shared/start-container.ts.template} +16 -1
  525. package/src/utils/files/terraform/src/core/asset-bucket/asset-bucket.tf.template +2 -2
  526. package/src/utils/files/terraform/src/core/runtime-config/appconfig/appconfig.tf.template +1 -1
  527. package/src/utils/files/terraform/src/core/runtime-config/appconfig-deployment/appconfig-deployment.tf.template +3 -3
  528. package/src/utils/files/terraform/src/core/runtime-config/entry/entry.tf.template +1 -1
  529. package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +2 -2
  530. package/src/utils/files/website/hooks/sigv4/useSigV4.tsx.template +1 -1
  531. package/src/utils/format.js +153 -99
  532. package/src/utils/format.js.map +1 -1
  533. package/src/utils/fs.js +14 -13
  534. package/src/utils/fs.js.map +1 -1
  535. package/src/utils/function-constructs/files/terraform/app/lambda-functions/__nameKebabCase__/__nameKebabCase__.tf.template +2 -2
  536. package/src/utils/function-constructs/function-constructs.js +21 -26
  537. package/src/utils/function-constructs/function-constructs.js.map +1 -1
  538. package/src/utils/generators.js +18 -20
  539. package/src/utils/generators.js.map +1 -1
  540. package/src/utils/git.js +19 -34
  541. package/src/utils/git.js.map +1 -1
  542. package/src/utils/iac-providers.js +5 -5
  543. package/src/utils/iac-providers.js.map +1 -1
  544. package/src/utils/iac.js +12 -14
  545. package/src/utils/iac.js.map +1 -1
  546. package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +112 -2
  547. package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +2 -2
  548. package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +104 -2
  549. package/src/utils/identity-constructs/files/terraform/core/user-identity/main.tf.template +7 -0
  550. package/src/utils/identity-constructs/identity-constructs.js +24 -28
  551. package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
  552. package/src/utils/js.js +27 -20
  553. package/src/utils/js.js.map +1 -1
  554. package/src/utils/mcp.js +34 -41
  555. package/src/utils/mcp.js.map +1 -1
  556. package/src/utils/metrics.js +30 -45
  557. package/src/utils/metrics.js.map +1 -1
  558. package/src/utils/mock-project-graph.js +8 -12
  559. package/src/utils/mock-project-graph.js.map +1 -1
  560. package/src/utils/names.js +25 -51
  561. package/src/utils/names.js.map +1 -1
  562. package/src/utils/npm-scope.js +9 -17
  563. package/src/utils/npm-scope.js.map +1 -1
  564. package/src/utils/nx.d.ts +18 -2
  565. package/src/utils/nx.js +111 -74
  566. package/src/utils/nx.js.map +1 -1
  567. package/src/utils/nxlv-python.js +27 -15
  568. package/src/utils/nxlv-python.js.map +1 -1
  569. package/src/utils/object.js +5 -11
  570. package/src/utils/object.js.map +1 -1
  571. package/src/utils/paths.js +11 -15
  572. package/src/utils/paths.js.map +1 -1
  573. package/src/utils/pkg-manager.js +4 -9
  574. package/src/utils/pkg-manager.js.map +1 -1
  575. package/src/utils/pnpm-workspace.js +22 -22
  576. package/src/utils/pnpm-workspace.js.map +1 -1
  577. package/src/utils/port.js +26 -36
  578. package/src/utils/port.js.map +1 -1
  579. package/src/utils/py.js +43 -52
  580. package/src/utils/py.js.map +1 -1
  581. package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
  582. package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +3 -3
  583. package/src/utils/rdb-constructs/rdb-constructs.js +31 -33
  584. package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
  585. package/src/utils/shared-constructs-constants.js +16 -16
  586. package/src/utils/shared-constructs-constants.js.map +1 -1
  587. package/src/utils/shared-constructs.js +57 -54
  588. package/src/utils/shared-constructs.js.map +1 -1
  589. package/src/utils/shared-dynamodb-scripts.js +16 -14
  590. package/src/utils/shared-dynamodb-scripts.js.map +1 -1
  591. package/src/utils/shared-infra-config.js +30 -31
  592. package/src/utils/shared-infra-config.js.map +1 -1
  593. package/src/utils/shared-infra-scripts.js +30 -25
  594. package/src/utils/shared-infra-scripts.js.map +1 -1
  595. package/src/utils/shared-rdb-scripts.d.ts +8 -3
  596. package/src/utils/shared-rdb-scripts.js +21 -13
  597. package/src/utils/shared-rdb-scripts.js.map +1 -1
  598. package/src/utils/shared-scripts.js +12 -17
  599. package/src/utils/shared-scripts.js.map +1 -1
  600. package/src/utils/shared-shadcn.js +64 -60
  601. package/src/utils/shared-shadcn.js.map +1 -1
  602. package/src/utils/test.d.ts +8 -0
  603. package/src/utils/test.js +33 -25
  604. package/src/utils/test.js.map +1 -1
  605. package/src/utils/toml.js +7 -15
  606. package/src/utils/toml.js.map +1 -1
  607. package/src/utils/versions.d.ts +31 -4
  608. package/src/utils/versions.js +40 -23
  609. package/src/utils/versions.js.map +1 -1
  610. package/src/utils/website-constructs/files/terraform/app/static-websites/__websiteNameKebabCase__/__websiteNameKebabCase__.tf.template +1 -1
  611. package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +4 -4
  612. package/src/utils/website-constructs/website-constructs.js +31 -30
  613. package/src/utils/website-constructs/website-constructs.js.map +1 -1
  614. package/bin/aws-nx-mcp.js +0 -17
  615. package/bin/aws-nx-mcp.js.map +0 -1
  616. package/sdk/agentcore-gateway.d.ts +0 -6
  617. package/sdk/agentcore-gateway.js +0 -11
  618. package/sdk/agentcore-gateway.js.map +0 -1
  619. package/sdk/connection.d.ts +0 -6
  620. package/sdk/connection.js +0 -10
  621. package/sdk/connection.js.map +0 -1
  622. package/sdk/license.js +0 -14
  623. package/sdk/license.js.map +0 -1
  624. package/sdk/open-api.d.ts +0 -10
  625. package/sdk/open-api.js +0 -15
  626. package/sdk/open-api.js.map +0 -1
  627. package/sdk/py.d.ts +0 -14
  628. package/sdk/py.js +0 -18
  629. package/sdk/py.js.map +0 -1
  630. package/sdk/terraform.d.ts +0 -6
  631. package/sdk/terraform.js +0 -11
  632. package/sdk/terraform.js.map +0 -1
  633. package/sdk/ts.d.ts +0 -33
  634. package/sdk/ts.js +0 -53
  635. package/sdk/ts.js.map +0 -1
  636. package/sdk/utils/ast.js +0 -12
  637. package/sdk/utils/ast.js.map +0 -1
  638. package/sdk/utils/format.js +0 -10
  639. package/sdk/utils/format.js.map +0 -1
  640. package/sdk/utils/test.js +0 -10
  641. package/sdk/utils/test.js.map +0 -1
  642. package/src/connection/agent-serve-local.js +0 -48
  643. package/src/connection/agent-serve-local.js.map +0 -1
  644. package/src/connection/serve-local.js +0 -41
  645. package/src/connection/serve-local.js.map +0 -1
  646. package/src/py/agent/react-connection/serve-local.js +0 -38
  647. package/src/py/agent/react-connection/serve-local.js.map +0 -1
  648. package/src/ts/agent/react-connection/serve-local.js +0 -19
  649. package/src/ts/agent/react-connection/serve-local.js.map +0 -1
  650. package/src/utils/files/common/scripts/src/rdb/wait-for-db.ts.template +0 -59
  651. /package/src/agentcore-gateway/files/project/{serve-local.ts.template → local-dev.ts.template} +0 -0
  652. /package/{bin → src/bin}/aws-nx-mcp.d.ts +0 -0
@@ -65,7 +65,7 @@ export const createAgentCoreFetch = (): typeof fetch => {
65
65
 
66
66
  exports[`py#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with cognito auth > chat.ts (a2a, cognito) 1`] = `
67
67
  "// Chat CLI for TestProjectAgent (A2A protocol). Connects to the local
68
- // \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
68
+ // \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
69
69
  import {
70
70
  ClientFactory,
71
71
  ClientFactoryOptions,
@@ -160,7 +160,7 @@ export const createAgentCoreFetch = (region: string): typeof fetch => {
160
160
 
161
161
  exports[`py#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with iam auth > chat.ts (a2a, iam) 1`] = `
162
162
  "// Chat CLI for TestProjectAgent (A2A protocol). Connects to the local
163
- // \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
163
+ // \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
164
164
  import {
165
165
  ClientFactory,
166
166
  ClientFactoryOptions,
@@ -260,7 +260,7 @@ export const createAgentCoreFetch = (): typeof fetch => {
260
260
 
261
261
  exports[`py#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with cognito auth > chat.ts (ag-ui, cognito) 1`] = `
262
262
  "// Chat CLI for TestProjectAgent (AG-UI protocol). Connects to the local
263
- // \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
263
+ // \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
264
264
  import { AGUIChatAdapter, chatLoop } from 'agent-chat-cli';
265
265
  import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
266
266
 
@@ -337,7 +337,7 @@ export const createAgentCoreFetch = (region: string): typeof fetch => {
337
337
 
338
338
  exports[`py#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with iam auth > chat.ts (ag-ui, iam) 1`] = `
339
339
  "// Chat CLI for TestProjectAgent (AG-UI protocol). Connects to the local
340
- // \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
340
+ // \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
341
341
  import { AGUIChatAdapter, chatLoop } from 'agent-chat-cli';
342
342
  import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
343
343
 
@@ -419,7 +419,7 @@ export const createAgentCoreFetch = (): typeof fetch => {
419
419
 
420
420
  exports[`py#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with cognito auth > chat.ts (http, cognito) 1`] = `
421
421
  "// Chat CLI for TestProjectAgent (Python FastAPI / JSONL streaming), using the
422
- // generated client. Connects to the local \`serve-local\` server, or the deployed
422
+ // generated client. Connects to the local \`dev\` server, or the deployed
423
423
  // agent when \`RUNTIME_CONFIG_APP_ID\` is set.
424
424
  import { chatLoop, type ChatAdapter } from 'agent-chat-cli';
425
425
  import { TestProjectAgent } from './generated/client.gen.js';
@@ -524,7 +524,7 @@ export const createAgentCoreFetch = (region: string): typeof fetch => {
524
524
 
525
525
  exports[`py#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with iam auth > chat.ts (http, iam) 1`] = `
526
526
  "// Chat CLI for TestProjectAgent (Python FastAPI / JSONL streaming), using the
527
- // generated client. Connects to the local \`serve-local\` server, or the deployed
527
+ // generated client. Connects to the local \`dev\` server, or the deployed
528
528
  // agent when \`RUNTIME_CONFIG_APP_ID\` is set.
529
529
  import { chatLoop, type ChatAdapter } from 'agent-chat-cli';
530
530
  import { TestProjectAgent } from './generated/client.gen.js';
@@ -732,840 +732,3 @@ dev-dependencies = [ ]
732
732
  workspace = true
733
733
  "
734
734
  `;
735
-
736
- exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agent-Dockerfile 1`] = `
737
- "FROM public.ecr.aws/docker/library/python:3.14-slim
738
-
739
- WORKDIR /app
740
-
741
- # Copy bundled package
742
- COPY . /app
743
-
744
- EXPOSE 8080
745
-
746
- ENV PYTHONPATH=/app
747
- ENV PATH="/app/bin:\${PATH}"
748
-
749
- # Auto-instrument with AWS Distro for OpenTelemetry
750
- # https://aws-otel.github.io/docs/getting-started/python-sdk/auto-instr
751
- CMD ["python", "bin/opentelemetry-instrument", "python", "-m", "proj_test_project.snapshot_bedrock_agent.main"]
752
- "
753
- `;
754
-
755
- exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agent-construct.ts 1`] = `
756
- "import { Lazy, Names } from 'aws-cdk-lib';
757
- import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
758
- import { Connections, IConnectable } from 'aws-cdk-lib/aws-ec2';
759
- import { Construct } from 'constructs';
760
- import * as path from 'path';
761
- import * as url from 'url';
762
- import {
763
- AgentRuntimeArtifact,
764
- ProtocolType,
765
- Runtime,
766
- RuntimeProps,
767
- } from 'aws-cdk-lib/aws-bedrockagentcore';
768
- import {
769
- PolicyStatement,
770
- IGrantable,
771
- IPrincipal,
772
- Grant,
773
- } from 'aws-cdk-lib/aws-iam';
774
- import { RuntimeConfig } from '../../../core/runtime-config.js';
775
- import { findWorkspaceRoot } from '../../../core/workspace.js';
776
-
777
- export type SnapshotBedrockAgentProps = Omit<
778
- RuntimeProps,
779
- | 'runtimeName'
780
- | 'protocolConfiguration'
781
- | 'agentRuntimeArtifact'
782
- | 'authorizerConfiguration'
783
- >;
784
-
785
- export class SnapshotBedrockAgent
786
- extends Construct
787
- implements IGrantable, IConnectable
788
- {
789
- public readonly dockerImage: AgentRuntimeArtifact;
790
- public readonly agentCoreRuntime: Runtime;
791
-
792
- constructor(scope: Construct, id: string, props?: SnapshotBedrockAgentProps) {
793
- super(scope, id);
794
-
795
- const rc = RuntimeConfig.ensure(this);
796
-
797
- // Resolve the bundle output directory containing the Dockerfile and built artifacts
798
- const bundleDir = path.join(
799
- findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
800
- 'dist/apps/test-project/docker/snapshot-bedrock-agent',
801
- );
802
-
803
- this.dockerImage = AgentRuntimeArtifact.fromAsset(bundleDir, {
804
- platform: Platform.LINUX_ARM64,
805
- });
806
-
807
- this.agentCoreRuntime = new Runtime(this, 'SnapshotBedrockAgent', {
808
- runtimeName: Lazy.string({
809
- produce: () =>
810
- Names.uniqueResourceName(this.agentCoreRuntime, { maxLength: 40 }),
811
- }),
812
- protocolConfiguration: ProtocolType.HTTP,
813
- agentRuntimeArtifact: this.dockerImage,
814
- ...props,
815
- environmentVariables: {
816
- RUNTIME_CONFIG_APP_ID: rc.appConfigApplicationId,
817
- ...props?.environmentVariables,
818
- },
819
- });
820
-
821
- // Grant access for the agent to invoke bedrock models
822
- this.agentCoreRuntime.addToRolePolicy(
823
- new PolicyStatement({
824
- actions: [
825
- 'bedrock:InvokeModel',
826
- 'bedrock:InvokeModelWithResponseStream',
827
- ],
828
- resources: [
829
- 'arn:aws:bedrock:*:*:foundation-model/*',
830
- 'arn:aws:bedrock:*:*:inference-profile/*',
831
- ],
832
- }),
833
- );
834
-
835
- rc.grantReadAppConfig(this.agentCoreRuntime);
836
-
837
- rc.set('agentcore', 'agentRuntimes', {
838
- ...rc.get('agentcore').agentRuntimes,
839
- SnapshotBedrockAgent: this.agentCoreRuntime.agentRuntimeArn,
840
- });
841
- }
842
-
843
- /**
844
- * The principal to grant permissions to.
845
- */
846
- public get grantPrincipal(): IPrincipal {
847
- return this.agentCoreRuntime.grantPrincipal;
848
- }
849
-
850
- /**
851
- * Network connections for this agent runtime.
852
- */
853
- public get connections(): Connections {
854
- return this.agentCoreRuntime.connections;
855
- }
856
-
857
- /**
858
- * Grants IAM permissions to invoke this agent runtime.
859
- *
860
- * @param grantee - The IAM principal to grant permissions to
861
- */
862
- public grantInvokeAccess(grantee: IGrantable) {
863
- this.agentCoreRuntime.grantInvoke(grantee);
864
-
865
- Grant.addToPrincipal({
866
- grantee,
867
- actions: ['bedrock-agentcore:InvokeAgentRuntimeWithWebSocketStream'],
868
- resourceArns: [
869
- this.agentCoreRuntime.agentRuntimeArn,
870
- \`\${this.agentCoreRuntime.agentRuntimeArn}/*\`,
871
- ],
872
- });
873
- }
874
- }
875
- "
876
- `;
877
-
878
- exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agents-index.ts 1`] = `
879
- "export * from './snapshot-bedrock-agent/snapshot-bedrock-agent.js';
880
- "
881
- `;
882
-
883
- exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > app-index.ts 1`] = `
884
- "export * from './agents/index.js';
885
- "
886
- `;
887
-
888
- exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > core-index.ts 1`] = `
889
- "export * from './app.js';
890
- export * from './checkov.js';
891
- export * from './runtime-config.js';
892
- export * from './workspace.js';
893
- "
894
- `;
895
-
896
- exports[`py#agent generator > should match snapshot for Terraform generated files > terraform-agent.tf 1`] = `
897
- "variable "env" {
898
- description = "Environment variables to pass to the agent core runtime"
899
- type = map(string)
900
- default = {}
901
- }
902
-
903
- variable "additional_iam_policy_statements" {
904
- description = "Additional IAM policy statements to attach to the agent core runtime role"
905
- type = list(object({
906
- Effect = string
907
- Action = list(string)
908
- Resource = list(string)
909
- }))
910
- default = []
911
- }
912
-
913
- variable "tags" {
914
- description = "Tags to apply to resources"
915
- type = map(string)
916
- default = {}
917
- }
918
-
919
- variable "appconfig_application_id" {
920
- description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). The agent reads its runtime configuration from this application."
921
- type = string
922
- }
923
-
924
- variable "appconfig_application_arn" {
925
- description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the agent runtime."
926
- type = string
927
- }
928
-
929
- module "agent_core_runtime" {
930
- source = "../../../core/agent-core"
931
- agent_runtime_name = "TerraformSnapshotAgent"
932
- docker_image_tag = "proj-terraform-snapshot-agent:latest"
933
- server_protocol = "HTTP"
934
-
935
- env = merge({
936
- RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
937
- }, var.env)
938
- additional_iam_policy_statements = concat([
939
- {
940
- Effect = "Allow"
941
- Action = [
942
- "appconfig:StartConfigurationSession",
943
- "appconfig:GetLatestConfiguration"
944
- ]
945
- Resource = ["\${var.appconfig_application_arn}/*"]
946
- },
947
- # Grant access for the agent to invoke bedrock models
948
- {
949
- Effect = "Allow"
950
- Action = [
951
- "bedrock:InvokeModel",
952
- "bedrock:InvokeModelWithResponseStream"
953
- ]
954
- Resource = [
955
- "arn:aws:bedrock:*:*:foundation-model/*",
956
- "arn:aws:bedrock:*:*:inference-profile/*"
957
- ]
958
- }
959
- ], var.additional_iam_policy_statements)
960
- tags = var.tags
961
- }
962
-
963
- # Add agent runtime ARN to runtime config
964
- module "add_agent_runtime_to_runtime_config" {
965
- source = "../../../core/runtime-config/entry"
966
-
967
- namespace = "agentcore"
968
- key = "agentRuntimes"
969
- value = { "TerraformSnapshotAgent" = module.agent_core_runtime.agent_core_runtime_arn }
970
-
971
- depends_on = [module.agent_core_runtime]
972
- }
973
-
974
- output "agent_core_runtime_role_arn" {
975
- description = "ARN of the agent core runtime role"
976
- value = module.agent_core_runtime.agent_core_runtime_role_arn
977
- }
978
-
979
- output "agent_core_runtime_arn" {
980
- description = "ARN of the Bedrock Agent Core runtime"
981
- value = module.agent_core_runtime.agent_core_runtime_arn
982
- }
983
-
984
- output "appconfig_application_id" {
985
- description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
986
- value = var.appconfig_application_id
987
- }
988
- "
989
- `;
990
-
991
- exports[`py#agent generator > should match snapshot for Terraform generated files > terraform-agent-core-runtime.tf 1`] = `
992
- "terraform {
993
- required_version = ">= 1.0"
994
-
995
- required_providers {
996
- aws = {
997
- source = "hashicorp/aws"
998
- version = ">= 6.23"
999
- }
1000
- null = {
1001
- source = "hashicorp/null"
1002
- version = ">= 3.0"
1003
- }
1004
- random = {
1005
- source = "hashicorp/random"
1006
- version = ">= 3.0"
1007
- }
1008
- }
1009
- }
1010
-
1011
- # Variables
1012
- variable "agent_runtime_name" {
1013
- description = "Name of the agent runtime"
1014
- type = string
1015
- validation {
1016
- condition = can(regex("^[a-zA-Z][a-zA-Z0-9_]{0,42}$", var.agent_runtime_name))
1017
- error_message = "Value must start with a letter and contain only letters, numbers, and underscores (1-43 characters)."
1018
- }
1019
- }
1020
-
1021
- variable "server_protocol" {
1022
- description = "Server protocol for the agent runtime (HTTP, MCP, or A2A)"
1023
- type = string
1024
- default = "HTTP"
1025
- validation {
1026
- condition = contains(["MCP", "HTTP", "A2A"], var.server_protocol)
1027
- error_message = "Protocol type must be either 'mcp', 'http', or 'a2a'."
1028
- }
1029
- }
1030
-
1031
- variable "authorizer_configuration" {
1032
- description = "Authorization configuration for authenticating incoming requests"
1033
- type = object({
1034
- custom_jwt_authorizer = optional(object({
1035
- discovery_url = string
1036
- allowed_audience = optional(list(string))
1037
- allowed_clients = optional(list(string))
1038
- }))
1039
- })
1040
- default = null
1041
- }
1042
-
1043
- variable "docker_image_tag" {
1044
- description = "Name of the docker image tag to use as the agent core runtime"
1045
- type = string
1046
- }
1047
-
1048
- variable "env" {
1049
- description = "Environment variables to pass to the agent core runtime"
1050
- type = map(string)
1051
- default = {}
1052
- }
1053
-
1054
- variable "additional_iam_policy_statements" {
1055
- description = "Additional IAM policy statements to attach to the agent core runtime role"
1056
- type = list(object({
1057
- Effect = string
1058
- Action = list(string)
1059
- Resource = list(string)
1060
- }))
1061
- default = []
1062
- }
1063
-
1064
- variable "tags" {
1065
- description = "Tags to apply to resources"
1066
- type = map(string)
1067
- default = {}
1068
- }
1069
-
1070
- # Data sources
1071
- data "aws_caller_identity" "current" {}
1072
- data "aws_region" "current" {}
1073
-
1074
- locals {
1075
- aws_account_id = data.aws_caller_identity.current.account_id
1076
- aws_region = data.aws_region.current.id
1077
- }
1078
-
1079
- # Random ID for bucket suffix to ensure uniqueness
1080
- resource "random_id" "unique_suffix" {
1081
- byte_length = 4
1082
- }
1083
-
1084
- # ECR Repository
1085
- resource "aws_ecr_repository" "agent_core_repository" {
1086
- #checkov:skip=CKV_AWS_136:AES256 encryption is sufficient for ECR repositories
1087
- name = "\${lower(var.agent_runtime_name)}_repository_\${random_id.unique_suffix.hex}"
1088
-
1089
- image_tag_mutability = "IMMUTABLE"
1090
- force_delete = true
1091
-
1092
- image_scanning_configuration {
1093
- scan_on_push = true
1094
- }
1095
-
1096
- tags = var.tags
1097
- }
1098
-
1099
- # ECR Repository Policy
1100
- resource "aws_ecr_repository_policy" "agent_core_ecr_policy" {
1101
- repository = aws_ecr_repository.agent_core_repository.name
1102
-
1103
- policy = jsonencode({
1104
- Version = "2012-10-17"
1105
- Statement = [
1106
- {
1107
- Sid = "AllowPushPull"
1108
- Effect = "Allow"
1109
- Principal = {
1110
- AWS = "arn:aws:iam::\${local.aws_account_id}:root"
1111
- }
1112
- Action = [
1113
- "ecr:GetDownloadUrlForLayer",
1114
- "ecr:BatchGetImage",
1115
- "ecr:BatchCheckLayerAvailability",
1116
- "ecr:PutImage",
1117
- "ecr:InitiateLayerUpload",
1118
- "ecr:UploadLayerPart",
1119
- "ecr:CompleteLayerUpload"
1120
- ]
1121
- }
1122
- ]
1123
- })
1124
- }
1125
-
1126
- # IAM Role for Agent Core Runtime
1127
- resource "aws_iam_role" "agent_core_runtime_role" {
1128
- name = "\${var.agent_runtime_name}-AgentCoreRuntimeRole-\${random_id.unique_suffix.hex}"
1129
-
1130
- assume_role_policy = jsonencode({
1131
- Version = "2012-10-17"
1132
- Statement = [
1133
- {
1134
- Sid = "AgentCoreAssumeRolePolicy"
1135
- Effect = "Allow"
1136
- Principal = {
1137
- Service = "bedrock-agentcore.amazonaws.com"
1138
- }
1139
- Action = "sts:AssumeRole"
1140
- Condition = {
1141
- StringEquals = {
1142
- "aws:SourceAccount" = local.aws_account_id
1143
- }
1144
- ArnLike = {
1145
- "aws:SourceArn" = "arn:aws:bedrock-agentcore:\${local.aws_region}:\${local.aws_account_id}:*"
1146
- }
1147
- }
1148
- }
1149
- ]
1150
- })
1151
-
1152
- tags = var.tags
1153
- }
1154
-
1155
- # IAM Policy for Agent Core Runtime
1156
- resource "aws_iam_policy" "agent_core_runtime_policy" {
1157
- name = "\${var.agent_runtime_name}-QueryAgentPolicy-\${random_id.unique_suffix.hex}"
1158
- description = "Restricted policy for Agent"
1159
-
1160
- policy = jsonencode({
1161
- Version = "2012-10-17"
1162
- Statement = concat([
1163
- {
1164
- Sid = "ECRImageAccess"
1165
- Effect = "Allow"
1166
- Action = [
1167
- "ecr:BatchGetImage",
1168
- "ecr:GetDownloadUrlForLayer"
1169
- ]
1170
- Resource = [
1171
- aws_ecr_repository.agent_core_repository.arn
1172
- ]
1173
- },
1174
- {
1175
- Sid = "ECRTokenAccess"
1176
- Effect = "Allow"
1177
- Action = [
1178
- "ecr:GetAuthorizationToken"
1179
- ]
1180
- Resource = [
1181
- "*"
1182
- ]
1183
- },
1184
- {
1185
- "Effect" : "Allow",
1186
- "Action" : [
1187
- "logs:DescribeLogStreams",
1188
- "logs:CreateLogGroup"
1189
- ],
1190
- "Resource" : [
1191
- "arn:aws:logs:\${local.aws_region}:\${local.aws_account_id}:log-group:/aws/bedrock-agentcore/runtimes/*"
1192
- ]
1193
- },
1194
- {
1195
- "Effect" : "Allow",
1196
- "Action" : [
1197
- "logs:DescribeLogGroups"
1198
- ],
1199
- "Resource" : [
1200
- "arn:aws:logs:\${local.aws_region}:\${local.aws_account_id}:log-group:*"
1201
- ]
1202
- },
1203
- {
1204
- "Effect" : "Allow",
1205
- "Action" : [
1206
- "logs:CreateLogStream",
1207
- "logs:PutLogEvents"
1208
- ],
1209
- "Resource" : [
1210
- "arn:aws:logs:\${local.aws_region}:\${local.aws_account_id}:log-group:/aws/bedrock-agentcore/runtimes/*:log-stream:*"
1211
- ]
1212
- },
1213
- {
1214
- "Effect" : "Allow",
1215
- "Action" : [
1216
- "xray:PutTraceSegments",
1217
- "xray:PutTelemetryRecords",
1218
- "xray:GetSamplingRules",
1219
- "xray:GetSamplingTargets"
1220
- ],
1221
- "Resource" : ["*"]
1222
- },
1223
- {
1224
- "Effect" : "Allow",
1225
- "Resource" : "*",
1226
- "Action" : "cloudwatch:PutMetricData",
1227
- "Condition" : {
1228
- "StringEquals" : {
1229
- "cloudwatch:namespace" : "bedrock-agentcore"
1230
- }
1231
- }
1232
- },
1233
- {
1234
- "Sid" : "GetAgentAccessToken",
1235
- "Effect" : "Allow",
1236
- "Action" : [
1237
- "bedrock-agentcore:GetWorkloadAccessToken",
1238
- "bedrock-agentcore:GetWorkloadAccessTokenForJWT",
1239
- "bedrock-agentcore:GetWorkloadAccessTokenForUserId"
1240
- ],
1241
- "Resource" : [
1242
- "arn:aws:bedrock-agentcore:\${local.aws_region}:\${local.aws_account_id}:workload-identity-directory/default",
1243
- "arn:aws:bedrock-agentcore:\${local.aws_region}:\${local.aws_account_id}:workload-identity-directory/default/workload-identity/*"
1244
- ]
1245
- }
1246
- ], var.additional_iam_policy_statements)
1247
- })
1248
-
1249
- tags = var.tags
1250
- }
1251
-
1252
- # Attach the restricted policy to the role
1253
- resource "aws_iam_role_policy_attachment" "agent_core_policy" {
1254
- role = aws_iam_role.agent_core_runtime_role.name
1255
- policy_arn = aws_iam_policy.agent_core_runtime_policy.arn
1256
- }
1257
-
1258
- # Data source to get container image digest
1259
- data "external" "docker_digest" {
1260
- program = ["sh", "-c", "echo '{\\"digest\\":\\"'$(docker inspect \${var.docker_image_tag} --format '{{.Id}}')'\\"}' "]
1261
- }
1262
-
1263
- locals {
1264
- # Content-based, immutable image tag derived from the local image digest
1265
- image_tag = replace(data.external.docker_digest.result.digest, "sha256:", "")
1266
- }
1267
-
1268
- # Null resource for container image publish
1269
- resource "null_resource" "docker_publish" {
1270
- triggers = {
1271
- docker_digest = data.external.docker_digest.result.digest
1272
- repository_url = aws_ecr_repository.agent_core_repository.repository_url
1273
- docker_image_tag = var.docker_image_tag
1274
- image_tag = local.image_tag
1275
- }
1276
-
1277
- provisioner "local-exec" {
1278
- command = <<-EOT
1279
- # Get ECR login token
1280
- aws ecr get-login-password --region "$AWS_REGION" | docker login --username AWS --password-stdin "$REPOSITORY_URL"
1281
-
1282
- # Tag the image with the immutable content-based tag
1283
- docker tag "$DOCKER_IMAGE_TAG" "$REPOSITORY_URL:$IMAGE_TAG"
1284
-
1285
- # Push the image
1286
- docker push "$REPOSITORY_URL:$IMAGE_TAG"
1287
- EOT
1288
- environment = {
1289
- AWS_REGION = local.aws_region
1290
- REPOSITORY_URL = self.triggers.repository_url
1291
- DOCKER_IMAGE_TAG = self.triggers.docker_image_tag
1292
- IMAGE_TAG = self.triggers.image_tag
1293
- }
1294
- }
1295
-
1296
- depends_on = [aws_ecr_repository_policy.agent_core_ecr_policy]
1297
- }
1298
-
1299
- # Bedrock AgentCore Agent Runtime
1300
- resource "aws_bedrockagentcore_agent_runtime" "agent_runtime" {
1301
- agent_runtime_name = "\${var.agent_runtime_name}_\${random_id.unique_suffix.hex}"
1302
- description = "Agent Runtime for \${var.agent_runtime_name}"
1303
- role_arn = aws_iam_role.agent_core_runtime_role.arn
1304
-
1305
- agent_runtime_artifact {
1306
- container_configuration {
1307
- container_uri = "\${aws_ecr_repository.agent_core_repository.repository_url}:\${local.image_tag}"
1308
- }
1309
- }
1310
-
1311
- environment_variables = length(var.env) > 0 ? var.env : null
1312
-
1313
- dynamic "authorizer_configuration" {
1314
- for_each = var.authorizer_configuration != null && try(var.authorizer_configuration.custom_jwt_authorizer, null) != null ? [var.authorizer_configuration.custom_jwt_authorizer] : []
1315
- content {
1316
- custom_jwt_authorizer {
1317
- discovery_url = authorizer_configuration.value.discovery_url
1318
- allowed_audience = authorizer_configuration.value.allowed_audience
1319
- allowed_clients = authorizer_configuration.value.allowed_clients
1320
- }
1321
- }
1322
- }
1323
-
1324
- network_configuration {
1325
- network_mode = "PUBLIC"
1326
- }
1327
-
1328
- protocol_configuration {
1329
- server_protocol = var.server_protocol
1330
- }
1331
-
1332
- tags = var.tags
1333
-
1334
- depends_on = [
1335
- null_resource.docker_publish,
1336
- aws_iam_role_policy_attachment.agent_core_policy
1337
- ]
1338
- }
1339
-
1340
- # MCP consumers (e.g. gateway targets, which fetch tools at creation) can race
1341
- # the runtime's first cold start, so probe it until it serves MCP. The ARN
1342
- # output is routed through this resource so consumers wait for readiness.
1343
- resource "null_resource" "runtime_ready" {
1344
- count = var.server_protocol == "MCP" ? 1 : 0
1345
-
1346
- triggers = {
1347
- runtime_arn = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
1348
- }
1349
-
1350
- provisioner "local-exec" {
1351
- command = <<-EOT
1352
- uv run --with boto3 python -c "
1353
- import boto3
1354
- import json
1355
- import os
1356
- import time
1357
- import uuid
1358
-
1359
- runtime_arn = os.environ['RUNTIME_ARN']
1360
- client = boto3.client('bedrock-agentcore')
1361
- initialize_request = json.dumps({
1362
- 'jsonrpc': '2.0',
1363
- 'id': 1,
1364
- 'method': 'initialize',
1365
- 'params': {
1366
- 'protocolVersion': '2025-03-26',
1367
- 'capabilities': {},
1368
- 'clientInfo': {'name': 'readiness-probe', 'version': '1.0'},
1369
- },
1370
- })
1371
-
1372
- deadline = time.time() + 5 * 60
1373
- while True:
1374
- try:
1375
- client.invoke_agent_runtime(
1376
- agentRuntimeArn=runtime_arn,
1377
- runtimeSessionId=f'readiness-probe-{uuid.uuid4()}',
1378
- contentType='application/json',
1379
- accept='application/json, text/event-stream',
1380
- payload=initialize_request,
1381
- )
1382
- break
1383
- except Exception:
1384
- if time.time() >= deadline:
1385
- raise
1386
- time.sleep(5)
1387
-
1388
- print(f'Runtime {runtime_arn} is serving MCP')
1389
- "
1390
- EOT
1391
- environment = {
1392
- RUNTIME_ARN = self.triggers.runtime_arn
1393
- }
1394
- }
1395
- }
1396
-
1397
- # Outputs
1398
- output "agent_core_runtime_role_arn" {
1399
- description = "ARN of the Agent Core Runtime IAM role"
1400
- value = aws_iam_role.agent_core_runtime_role.arn
1401
- }
1402
-
1403
- output "agent_core_runtime_role_name" {
1404
- description = "Name of the Agent Core Runtime IAM role"
1405
- value = aws_iam_role.agent_core_runtime_role.name
1406
- }
1407
-
1408
- output "agent_runtime_name" {
1409
- description = "Name of the deployed agent runtime"
1410
- value = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_name
1411
- }
1412
-
1413
- output "agent_core_runtime_arn" {
1414
- description = "ARN of the Bedrock Agent Core runtime. For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
1415
- value = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
1416
- }
1417
-
1418
- output "agent_runtime_id" {
1419
- description = "ID of the Bedrock Agent Core runtime"
1420
- value = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_id
1421
- }
1422
-
1423
- output "agent_runtime_version" {
1424
- description = "Version of the Bedrock Agent Core runtime"
1425
- value = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_version
1426
- }
1427
- "
1428
- `;
1429
-
1430
- exports[`py#agent generator > should match snapshot for generated files > agent-__init__.py 1`] = `""`;
1431
-
1432
- exports[`py#agent generator > should match snapshot for generated files > agent-agent.py 1`] = `
1433
- "from contextlib import contextmanager
1434
-
1435
- from strands import Agent, tool
1436
- from strands_tools import current_time
1437
- from proj_agent_connection import log_model_errors
1438
-
1439
-
1440
- @tool
1441
- def subtract(a: int, b: int) -> int:
1442
- return a - b
1443
-
1444
-
1445
- @contextmanager
1446
- def get_agent():
1447
- yield Agent(
1448
- name="SnapshotAgent",
1449
- description="SnapshotAgent Strands Agent",
1450
- system_prompt="""
1451
- You are a mathematical wizard.
1452
- Use your tools for mathematical tasks.
1453
- Refer to tools as your 'spellbook'.
1454
- """,
1455
- tools=[subtract, current_time],
1456
- hooks=[log_model_errors],
1457
- )
1458
- "
1459
- `;
1460
-
1461
- exports[`py#agent generator > should match snapshot for generated files > agent-main.py 1`] = `
1462
- "import uuid
1463
-
1464
- import uvicorn
1465
- from bedrock_agentcore.runtime.models import PingStatus
1466
- from fastapi import Request
1467
- from pydantic import BaseModel, Field
1468
- from starlette.middleware.base import BaseHTTPMiddleware
1469
- from proj_agent_connection import session_id_context, with_session_id
1470
-
1471
- from .agent import get_agent
1472
- from .init import JsonStreamingResponse, app
1473
-
1474
- SESSION_ID_HEADER = "x-amzn-bedrock-agentcore-runtime-session-id"
1475
-
1476
- _agent_ctx = with_session_id(
1477
- get_agent,
1478
- name="SnapshotAgent",
1479
- description="A Strands Agent exposed via HTTP streaming.",
1480
- )
1481
- _agent = _agent_ctx.__enter__()
1482
-
1483
-
1484
- class InvokeInput(BaseModel):
1485
- message: str = Field(max_length=100000)
1486
-
1487
-
1488
- class StreamChunk(BaseModel):
1489
- content: str
1490
-
1491
-
1492
- async def handle_invoke(input: InvokeInput):
1493
- """Streaming handler for agent invocation"""
1494
- stream = _agent.stream_async(input.message)
1495
- async for event in stream:
1496
- text = (
1497
- event.get("event", {})
1498
- .get("contentBlockDelta", {})
1499
- .get("delta", {})
1500
- .get("text")
1501
- )
1502
- if text is not None:
1503
- yield StreamChunk(content=text)
1504
- elif event.get("event", {}).get("messageStop") is not None:
1505
- yield StreamChunk(content="\\n")
1506
-
1507
-
1508
- @app.post(
1509
- "/invocations",
1510
- response_class=JsonStreamingResponse,
1511
- responses={
1512
- 200: JsonStreamingResponse.openapi_response(
1513
- StreamChunk, "Stream of agent response chunks"
1514
- )
1515
- },
1516
- )
1517
- async def invoke(input: InvokeInput) -> JsonStreamingResponse:
1518
- """Entry point for agent invocation"""
1519
- return JsonStreamingResponse(handle_invoke(input))
1520
-
1521
-
1522
- class _SessionIdMiddleware(BaseHTTPMiddleware):
1523
- """Bind the inbound session (or a fresh UUID) to async context."""
1524
-
1525
- async def dispatch(self, request: Request, call_next):
1526
- session_id = request.headers.get(SESSION_ID_HEADER) or str(uuid.uuid4())
1527
- with session_id_context(session_id):
1528
- return await call_next(request)
1529
-
1530
-
1531
- app.add_middleware(_SessionIdMiddleware)
1532
-
1533
-
1534
- @app.get("/ping")
1535
- def ping() -> str:
1536
- # TODO: if running an async task, return PingStatus.HEALTHY_BUSY
1537
- return PingStatus.HEALTHY
1538
-
1539
-
1540
- if __name__ == "__main__":
1541
- uvicorn.run("proj_test_project.snapshot_agent.main:app", port=8080)
1542
- "
1543
- `;
1544
-
1545
- exports[`py#agent generator > should match snapshot for generated files > updated-pyproject.toml 1`] = `
1546
- "[project]
1547
- name = "proj.test_project"
1548
- version = "0.1.0"
1549
- dependencies = [
1550
- "proj-agent-connection",
1551
- "aws-lambda-powertools==3.29.0",
1552
- "aws-opentelemetry-distro==0.17.1",
1553
- "bedrock-agentcore==1.14.1",
1554
- "boto3==1.43.29",
1555
- "fastapi==0.137.1",
1556
- "mcp==1.27.2",
1557
- "strands-agents==1.43.0",
1558
- "strands-agents-tools==0.8.0",
1559
- "uvicorn==0.49.0"
1560
- ]
1561
-
1562
- [dependency-groups]
1563
- dev = [ "fastapi[standard]==0.137.1" ]
1564
-
1565
- [tool.uv]
1566
- dev-dependencies = [ ]
1567
-
1568
- [tool.uv.sources.proj-agent-connection]
1569
- workspace = true
1570
- "
1571
- `;