@aws/nx-plugin 0.99.1 → 0.101.0

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 (69) hide show
  1. package/LICENSE-THIRD-PARTY +14 -94
  2. package/generators.json +27 -19
  3. package/package.json +1 -1
  4. package/src/preset/__snapshots__/generator.spec.ts.snap +2 -0
  5. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +10 -10
  6. package/src/py/mcp-server/files/deploy/Dockerfile.template +1 -1
  7. package/src/py/mcp-server/generator.js +10 -2
  8. package/src/py/mcp-server/generator.js.map +1 -1
  9. package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +43 -12
  10. package/src/py/strands-agent/files/ag-ui/main.py.template +19 -0
  11. package/src/py/strands-agent/files/deploy/Dockerfile.template +3 -1
  12. package/src/py/strands-agent/generator.js +20 -7
  13. package/src/py/strands-agent/generator.js.map +1 -1
  14. package/src/py/strands-agent/react-connection/__snapshots__/generator.spec.ts.snap +133 -0
  15. package/src/py/strands-agent/react-connection/generator.js +69 -56
  16. package/src/py/strands-agent/react-connection/generator.js.map +1 -1
  17. package/src/py/strands-agent/react-connection/serve-local.d.ts +6 -2
  18. package/src/py/strands-agent/react-connection/serve-local.js +11 -6
  19. package/src/py/strands-agent/react-connection/serve-local.js.map +1 -1
  20. package/src/py/strands-agent/schema.d.ts +1 -1
  21. package/src/py/strands-agent/schema.json +2 -2
  22. package/src/ts/astro-docs/__snapshots__/generator.spec.ts.snap +223 -0
  23. package/src/ts/astro-docs/files/base/README.md.template +63 -0
  24. package/src/ts/astro-docs/files/base/astro.config.mjs.template +47 -0
  25. package/src/ts/astro-docs/files/base/src/components/link.astro.template +25 -0
  26. package/src/ts/astro-docs/files/base/src/components/snippet.astro.template +20 -0
  27. package/src/ts/astro-docs/files/base/src/content/docs/en/blog/welcome.mdx.template +13 -0
  28. package/src/ts/astro-docs/files/base/src/content/docs/en/guides/getting-started.mdx.template +64 -0
  29. package/src/ts/astro-docs/files/base/src/content/docs/en/index.mdx.template +29 -0
  30. package/src/ts/astro-docs/files/base/src/content/docs/en/snippets/example.mdx.template +7 -0
  31. package/src/ts/astro-docs/files/base/src/content.config.ts.template +13 -0
  32. package/src/ts/astro-docs/files/base/src/styles/custom.css.template +1 -0
  33. package/src/ts/astro-docs/files/base/tsconfig.json.template +12 -0
  34. package/src/ts/astro-docs/files/translation/scripts/translate.config.json.template +10 -0
  35. package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +430 -0
  36. package/src/ts/astro-docs/generator.d.ts +10 -0
  37. package/src/ts/astro-docs/generator.js +113 -0
  38. package/src/ts/astro-docs/generator.js.map +1 -0
  39. package/src/ts/astro-docs/schema.d.ts +30 -0
  40. package/src/ts/astro-docs/schema.json +62 -0
  41. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +10 -10
  42. package/src/ts/mcp-server/files/Dockerfile.template +1 -1
  43. package/src/ts/mcp-server/generator.js +9 -1
  44. package/src/ts/mcp-server/generator.js.map +1 -1
  45. package/src/ts/react-website/agui/files/src/components/AguiProvider.tsx.template +19 -0
  46. package/src/ts/react-website/agui/files/src/hooks/useAgui__agentNameClassName__.tsx.template +142 -0
  47. package/src/ts/react-website/agui/generator.d.ts +26 -0
  48. package/src/ts/react-website/agui/generator.js +98 -0
  49. package/src/ts/react-website/agui/generator.js.map +1 -0
  50. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +49 -0
  51. package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +2 -0
  52. package/src/ts/strands-agent/__snapshots__/generator.spec.ts.snap +43 -12
  53. package/src/ts/strands-agent/files/deploy/Dockerfile.template +1 -1
  54. package/src/ts/strands-agent/generator.js +14 -1
  55. package/src/ts/strands-agent/generator.js.map +1 -1
  56. package/src/ts/strands-agent/schema.d.ts +1 -1
  57. package/src/ts/strands-agent/schema.json +2 -2
  58. package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +24 -0
  59. package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +3 -0
  60. package/src/utils/agent-core-constructs/agent-core-constructs.js +2 -0
  61. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  62. package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +26 -11
  63. package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +13 -1
  64. package/src/utils/files/common/constructs/src/core/index.ts.template +2 -1
  65. package/src/utils/files/common/constructs/src/core/workspace.ts.template +19 -0
  66. package/src/utils/versions.d.ts +18 -1
  67. package/src/utils/versions.js +17 -0
  68. package/src/utils/versions.js.map +1 -1
  69. package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/Dockerfile.template +0 -1
@@ -3325,12 +3325,12 @@ SOFTWARE.
3325
3325
 
3326
3326
  ---
3327
3327
 
3328
- The following software may be included in this product: @esbuild/darwin-arm64 (0.27.4)
3328
+ The following software may be included in this product: @esbuild/linux-x64 (0.27.4)
3329
3329
  This software contains the following license and notice below:
3330
3330
 
3331
3331
  MIT License
3332
3332
 
3333
- Copyright (c) The maintainers of @esbuild/darwin-arm64 <https://github.com/evanw/esbuild#readme>
3333
+ Copyright (c) The maintainers of @esbuild/linux-x64 <https://github.com/evanw/esbuild#readme>
3334
3334
 
3335
3335
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
3336
3336
  associated documentation files (the "Software"), to deal in the Software without restriction, including
@@ -3349,12 +3349,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
3349
3349
 
3350
3350
  ---
3351
3351
 
3352
- The following software may be included in this product: @esbuild/darwin-arm64 (0.28.0)
3352
+ The following software may be included in this product: @esbuild/linux-x64 (0.28.0)
3353
3353
  This software contains the following license and notice below:
3354
3354
 
3355
3355
  MIT License
3356
3356
 
3357
- Copyright (c) The maintainers of @esbuild/darwin-arm64 <https://github.com/evanw/esbuild#readme>
3357
+ Copyright (c) The maintainers of @esbuild/linux-x64 <https://github.com/evanw/esbuild#readme>
3358
3358
 
3359
3359
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
3360
3360
  associated documentation files (the "Software"), to deal in the Software without restriction, including
@@ -3528,36 +3528,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
3528
3528
 
3529
3529
  ---
3530
3530
 
3531
- The following software may be included in this product: @getgrit/gritql-darwin-arm64 (0.0.3)
3531
+ The following software may be included in this product: @getgrit/gritql-linux-x64-gnu (0.0.3)
3532
3532
  This software contains the following license and notice below:
3533
3533
 
3534
3534
  MIT License
3535
3535
 
3536
- Copyright (c) The maintainers of @getgrit/gritql-darwin-arm64 <https://github.com/biomejs/gritql#readme>
3537
-
3538
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
3539
- associated documentation files (the "Software"), to deal in the Software without restriction, including
3540
- without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3541
- copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
3542
- following conditions:
3543
-
3544
- The above copyright notice and this permission notice shall be included in all copies or substantial
3545
- portions of the Software.
3546
-
3547
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
3548
- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
3549
- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
3550
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
3551
- USE OR OTHER DEALINGS IN THE SOFTWARE.
3552
-
3553
- ---
3554
-
3555
- The following software may be included in this product: @getgrit/gritql-darwin-universal (0.0.3)
3556
- This software contains the following license and notice below:
3557
-
3558
- MIT License
3559
-
3560
- Copyright (c) The maintainers of @getgrit/gritql-darwin-universal <https://github.com/biomejs/gritql#readme>
3536
+ Copyright (c) The maintainers of @getgrit/gritql-linux-x64-gnu <https://github.com/biomejs/gritql#readme>
3561
3537
 
3562
3538
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
3563
3539
  associated documentation files (the "Software"), to deal in the Software without restriction, including
@@ -5077,7 +5053,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5077
5053
 
5078
5054
  ---
5079
5055
 
5080
- The following software may be included in this product: @nx/nx-darwin-arm64 (22.6.5)
5056
+ The following software may be included in this product: @nx/nx-linux-x64-gnu (22.6.5)
5081
5057
  This software contains the following license and notice below:
5082
5058
 
5083
5059
  (The MIT License)
@@ -5328,12 +5304,12 @@ SOFTWARE.
5328
5304
 
5329
5305
  ---
5330
5306
 
5331
- The following software may be included in this product: @oxc-resolver/binding-darwin-arm64 (11.19.1)
5307
+ The following software may be included in this product: @oxc-resolver/binding-linux-x64-gnu (11.19.1)
5332
5308
  This software contains the following license and notice below:
5333
5309
 
5334
5310
  MIT License
5335
5311
 
5336
- Copyright (c) The maintainers of @oxc-resolver/binding-darwin-arm64 <https://oxc.rs>
5312
+ Copyright (c) The maintainers of @oxc-resolver/binding-linux-x64-gnu <https://oxc.rs>
5337
5313
 
5338
5314
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5339
5315
  associated documentation files (the "Software"), to deal in the Software without restriction, including
@@ -5664,12 +5640,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
5664
5640
 
5665
5641
  ---
5666
5642
 
5667
- The following software may be included in this product: @rolldown/binding-darwin-arm64 (1.0.0-rc.15)
5643
+ The following software may be included in this product: @rolldown/binding-linux-x64-gnu (1.0.0-rc.15)
5668
5644
  This software contains the following license and notice below:
5669
5645
 
5670
5646
  MIT License
5671
5647
 
5672
- Copyright (c) The maintainers of @rolldown/binding-darwin-arm64 <https://rolldown.rs/>
5648
+ Copyright (c) The maintainers of @rolldown/binding-linux-x64-gnu <https://rolldown.rs/>
5673
5649
 
5674
5650
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5675
5651
  associated documentation files (the "Software"), to deal in the Software without restriction, including
@@ -5929,7 +5905,7 @@ THE SOFTWARE.
5929
5905
 
5930
5906
  ---
5931
5907
 
5932
- The following software may be included in this product: @rollup/rollup-darwin-arm64 (4.50.1)
5908
+ The following software may be included in this product: @rollup/rollup-linux-x64-gnu (4.50.1)
5933
5909
  This software contains the following license and notice below:
5934
5910
 
5935
5911
  MIT License
@@ -5981,7 +5957,7 @@ SOFTWARE.
5981
5957
 
5982
5958
  ---
5983
5959
 
5984
- The following software may be included in this product: @rspack/binding-darwin-arm64 (1.6.8)
5960
+ The following software may be included in this product: @rspack/binding-linux-x64-gnu (1.6.8)
5985
5961
  This software contains the following license and notice below:
5986
5962
 
5987
5963
  MIT License
@@ -11257,34 +11233,6 @@ OTHER DEALINGS IN THE SOFTWARE.
11257
11233
 
11258
11234
  ---
11259
11235
 
11260
- The following software may be included in this product: create-nx-workspace (22.6.5)
11261
- This software contains the following license and notice below:
11262
-
11263
- (The MIT License)
11264
-
11265
- Copyright (c) 2017-2026 Narwhal Technologies Inc.
11266
-
11267
- Permission is hereby granted, free of charge, to any person obtaining
11268
- a copy of this software and associated documentation files (the
11269
- 'Software'), to deal in the Software without restriction, including
11270
- without limitation the rights to use, copy, modify, merge, publish,
11271
- distribute, sublicense, and/or sell copies of the Software, and to
11272
- permit persons to whom the Software is furnished to do so, subject to
11273
- the following conditions:
11274
-
11275
- The above copyright notice and this permission notice shall be
11276
- included in all copies or substantial portions of the Software.
11277
-
11278
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
11279
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11280
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11281
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
11282
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
11283
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
11284
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11285
-
11286
- ---
11287
-
11288
11236
  The following software may be included in this product: cron-parser (4.9.0)
11289
11237
  This software contains the following license and notice below:
11290
11238
 
@@ -14057,34 +14005,6 @@ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE
14057
14005
 
14058
14006
  ---
14059
14007
 
14060
- The following software may be included in this product: fsevents (2.3.3)
14061
- This software contains the following license and notice below:
14062
-
14063
- MIT License
14064
- -----------
14065
-
14066
- Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
14067
-
14068
- Permission is hereby granted, free of charge, to any person obtaining a copy
14069
- of this software and associated documentation files (the "Software"), to deal
14070
- in the Software without restriction, including without limitation the rights
14071
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14072
- copies of the Software, and to permit persons to whom the Software is
14073
- furnished to do so, subject to the following conditions:
14074
-
14075
- The above copyright notice and this permission notice shall be included in
14076
- all copies or substantial portions of the Software.
14077
-
14078
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14079
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14080
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14081
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14082
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14083
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14084
- THE SOFTWARE.
14085
-
14086
- ---
14087
-
14088
14008
  The following software may be included in this product: function-bind (1.1.2)
14089
14009
  This software contains the following license and notice below:
14090
14010
 
@@ -41475,7 +41395,7 @@ defined by the Mozilla Public License, v. 2.0.
41475
41395
 
41476
41396
  ---
41477
41397
 
41478
- The following software may be included in this product: lightningcss-darwin-arm64 (1.32.0)
41398
+ The following software may be included in this product: lightningcss-linux-x64-gnu (1.32.0)
41479
41399
  This software contains the following license and notice below:
41480
41400
 
41481
41401
  Mozilla Public License Version 2.0
package/generators.json CHANGED
@@ -15,6 +15,7 @@
15
15
  "connection/react-smithy",
16
16
  "connection/react-ts-strands-agent",
17
17
  "connection/react-py-strands-agent",
18
+ "connection/react-agui",
18
19
  "connection/py-strands-agent-mcp",
19
20
  "connection/ts-strands-agent-mcp",
20
21
  "connection/py-strands-agent-a2a",
@@ -102,6 +103,20 @@
102
103
  "description": "Add a Strands Agent to a Python project",
103
104
  "metric": "g25"
104
105
  },
106
+ "py#strands-agent#mcp-connection": {
107
+ "factory": "./src/py/strands-agent/mcp-connection/generator",
108
+ "schema": "./src/py/strands-agent/mcp-connection/schema.json",
109
+ "description": "Connect a Python Strands Agent to an MCP server",
110
+ "metric": "g32",
111
+ "hidden": true
112
+ },
113
+ "py#strands-agent#react-connection": {
114
+ "factory": "./src/py/strands-agent/react-connection/generator",
115
+ "schema": "./src/py/strands-agent/react-connection/schema.json",
116
+ "description": "Connect a React website to a Python Strands Agent",
117
+ "metric": "g34",
118
+ "hidden": true
119
+ },
105
120
  "smithy#project": {
106
121
  "factory": "./src/smithy/project/generator",
107
122
  "schema": "./src/smithy/project/schema.json",
@@ -123,6 +138,13 @@
123
138
  "metric": "g23",
124
139
  "guidePages": ["terraform-project"]
125
140
  },
141
+ "ts#astro-docs": {
142
+ "factory": "./src/ts/astro-docs/generator",
143
+ "schema": "./src/ts/astro-docs/schema.json",
144
+ "description": "Generates an Astro + Starlight documentation site with localisation, snippets, blog, and optional automated documentation translation",
145
+ "metric": "g37",
146
+ "guidePages": ["astro-docs"]
147
+ },
126
148
  "ts#infra": {
127
149
  "factory": "./src/infra/app/generator",
128
150
  "schema": "./src/infra/app/schema.json",
@@ -195,13 +217,6 @@
195
217
  "description": "Add a Strands Agent to a TypeScript project",
196
218
  "metric": "g30"
197
219
  },
198
- "ts#strands-agent#react-connection": {
199
- "factory": "./src/ts/strands-agent/react-connection/generator",
200
- "schema": "./src/ts/strands-agent/react-connection/schema.json",
201
- "description": "Connect a React website to a TypeScript Strands Agent",
202
- "metric": "g33",
203
- "hidden": true
204
- },
205
220
  "ts#strands-agent#mcp-connection": {
206
221
  "factory": "./src/ts/strands-agent/mcp-connection/generator",
207
222
  "schema": "./src/ts/strands-agent/mcp-connection/schema.json",
@@ -209,11 +224,11 @@
209
224
  "metric": "g31",
210
225
  "hidden": true
211
226
  },
212
- "py#strands-agent#mcp-connection": {
213
- "factory": "./src/py/strands-agent/mcp-connection/generator",
214
- "schema": "./src/py/strands-agent/mcp-connection/schema.json",
215
- "description": "Connect a Python Strands Agent to an MCP server",
216
- "metric": "g32",
227
+ "ts#strands-agent#react-connection": {
228
+ "factory": "./src/ts/strands-agent/react-connection/generator",
229
+ "schema": "./src/ts/strands-agent/react-connection/schema.json",
230
+ "description": "Connect a React website to a TypeScript Strands Agent",
231
+ "metric": "g33",
217
232
  "hidden": true
218
233
  },
219
234
  "ts#strands-agent#a2a-connection": {
@@ -230,13 +245,6 @@
230
245
  "metric": "g36",
231
246
  "hidden": true
232
247
  },
233
- "py#strands-agent#react-connection": {
234
- "factory": "./src/py/strands-agent/react-connection/generator",
235
- "schema": "./src/py/strands-agent/react-connection/schema.json",
236
- "description": "Connect a React website to a Python Strands Agent",
237
- "metric": "g34",
238
- "hidden": true
239
- },
240
248
  "ts#sync": {
241
249
  "factory": "./src/ts/sync/generator",
242
250
  "schema": "./src/ts/sync/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "0.99.1",
3
+ "version": "0.101.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -46,6 +46,8 @@ The following list of generators are what is currently available in the \`@aws/n
46
46
 
47
47
  - **terraform#project**: Generates a Terraform project
48
48
 
49
+ - **ts#astro-docs**: Generates an Astro + Starlight documentation site with localisation, snippets, blog, and optional automated documentation translation
50
+
49
51
  - **ts#infra**: Generates a cdk application
50
52
 
51
53
  - **ts#lambda-function**: Generate a TypeScript lambda function
@@ -9,6 +9,7 @@ exports[`py#mcp-server generator > should match snapshot for BedrockAgentCoreRun
9
9
  "export * from './app.js';
10
10
  export * from './checkov.js';
11
11
  export * from './runtime-config.js';
12
+ export * from './workspace.js';
12
13
  "
13
14
  `;
14
15
 
@@ -16,7 +17,6 @@ exports[`py#mcp-server generator > should match snapshot for BedrockAgentCoreRun
16
17
  "import { Lazy, Names } from 'aws-cdk-lib';
17
18
  import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
18
19
  import { Construct } from 'constructs';
19
- import { execSync } from 'child_process';
20
20
  import * as path from 'path';
21
21
  import * as url from 'url';
22
22
  import {
@@ -27,6 +27,7 @@ import {
27
27
  } from '@aws-cdk/aws-bedrock-agentcore-alpha';
28
28
  import { IGrantable, IPrincipal, Grant } from 'aws-cdk-lib/aws-iam';
29
29
  import { RuntimeConfig } from '../../../core/runtime-config.js';
30
+ import { findWorkspaceRoot } from '../../../core/workspace.js';
30
31
 
31
32
  export type SnapshotBedrockServerProps = Omit<
32
33
  RuntimeProps,
@@ -49,17 +50,16 @@ export class SnapshotBedrockServer extends Construct implements IGrantable {
49
50
 
50
51
  const rc = RuntimeConfig.ensure(this);
51
52
 
52
- this.dockerImage = AgentRuntimeArtifact.fromAsset(
53
- path.dirname(url.fileURLToPath(new URL(import.meta.url))),
54
- {
55
- platform: Platform.LINUX_ARM64,
56
- extraHash: execSync(
57
- \`docker inspect proj-snapshot-bedrock-server:latest --format '{{.Id}}'\`,
58
- { encoding: 'utf-8' },
59
- ).trim(),
60
- },
53
+ // Resolve the bundle output directory containing the Dockerfile and built artifacts
54
+ const bundleDir = path.join(
55
+ findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
56
+ 'dist/apps/test-project/docker/snapshot-bedrock-server',
61
57
  );
62
58
 
59
+ this.dockerImage = AgentRuntimeArtifact.fromAsset(bundleDir, {
60
+ platform: Platform.LINUX_ARM64,
61
+ });
62
+
63
63
  this.agentCoreRuntime = new Runtime(this, 'SnapshotBedrockServer', {
64
64
  runtimeName: Lazy.string({
65
65
  produce: () =>
@@ -3,7 +3,7 @@ FROM public.ecr.aws/docker/library/python:3.12-slim
3
3
  WORKDIR /app
4
4
 
5
5
  # Copy bundled package
6
- COPY --from=workspace <%- bundleOutputDir %> /app
6
+ COPY . /app
7
7
 
8
8
  EXPOSE 8000
9
9
 
@@ -15,6 +15,7 @@ const npm_scope_1 = require("../../utils/npm-scope");
15
15
  const agent_core_constructs_1 = require("../../utils/agent-core-constructs/agent-core-constructs");
16
16
  const shared_constructs_1 = require("../../utils/shared-constructs");
17
17
  const bundle_1 = require("../../utils/bundle/bundle");
18
+ const fs_1 = require("../../utils/fs");
18
19
  const versions_1 = require("../../utils/versions");
19
20
  const nxlv_python_1 = require("../../utils/nxlv-python");
20
21
  const iac_1 = require("../../utils/iac");
@@ -66,14 +67,20 @@ const pyMcpServerGenerator = async (tree, options) => {
66
67
  moduleName,
67
68
  bundleOutputDir,
68
69
  }, { overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting });
70
+ const dockerOutputDir = (0, devkit_1.joinPathFragments)('dist', project.root, 'docker', name);
69
71
  const dockerTargetName = `${mcpTargetPrefix}-docker`;
70
- // Add a docker target specific to this MCP server
72
+ // Add a docker target that prepares the docker context and builds the image
73
+ const fs = new fs_1.FsCommands(tree);
71
74
  project.targets[dockerTargetName] = {
72
75
  cache: true,
73
76
  executor: 'nx:run-commands',
74
77
  options: {
75
78
  commands: [
76
- `docker build --platform linux/arm64 -t ${dockerImageTag} ${targetSourceDir} --build-context workspace=.`,
79
+ fs.rm(dockerOutputDir),
80
+ fs.mkdir(dockerOutputDir),
81
+ fs.cp(bundleOutputDir, dockerOutputDir),
82
+ fs.cp(`${targetSourceDir}/Dockerfile`, `${dockerOutputDir}/Dockerfile`),
83
+ `docker build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,
77
84
  ],
78
85
  parallel: false,
79
86
  },
@@ -102,6 +109,7 @@ const pyMcpServerGenerator = async (tree, options) => {
102
109
  mcpServerNameClassName,
103
110
  projectName: project.name,
104
111
  dockerImageTag,
112
+ dockerOutputDir,
105
113
  iacProvider,
106
114
  auth,
107
115
  });
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/py/mcp-server/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AAEpB,uCAKwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,6CAAwE;AACxE,uCAAgE;AAChE,qDAAoD;AACpD,mGAA4F;AAE5F,qEAA0E;AAC1E,sDAAkE;AAClE,mDAAoD;AACpD,yDAA6D;AAC7D,yCAAqD;AACrD,2CAA8C;AAC9C,6CAA0D;AAE7C,QAAA,4BAA4B,GACvC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,oBAAoB,GAAG,KAAK,EACvC,IAAU,EACV,OAAmC,EACP,EAAE;IAC9B,MAAM,OAAO,GAAG,IAAA,wCAAmC,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3E,MAAM,aAAa,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAExE,iDAAiD;IACjD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,OAAO,qDAAqD,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,CAA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U,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,oBAAM,EAAE,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC,CAAC;AAzNW,QAAA,oBAAoB,wBAyN/B;AAEF,kBAAe,4BAAoB,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/py/mcp-server/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AAEpB,uCAKwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,6CAAwE;AACxE,uCAAgE;AAChE,qDAAoD;AACpD,mGAA4F;AAE5F,qEAA0E;AAC1E,sDAAkE;AAClE,uCAA4C;AAC5C,mDAAoD;AACpD,yDAA6D;AAC7D,yCAAqD;AACrD,2CAA8C;AAC9C,6CAA0D;AAE7C,QAAA,4BAA4B,GACvC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,oBAAoB,GAAG,KAAK,EACvC,IAAU,EACV,OAAmC,EACP,EAAE;IAC9B,MAAM,OAAO,GAAG,IAAA,wCAAmC,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3E,MAAM,aAAa,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAExE,iDAAiD;IACjD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,OAAO,qDAAqD,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,gIAAgI,CACjI,CAAC;IACJ,CAAC;IAED,mDAAmD;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CA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C,oCAA4B,CAAC,CAAC,CAAC;IAE5E,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,IAAI,EAAE;QAChB,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,IAAI,wBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,oBAAM,EAAE,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC,CAAC;AAxOW,QAAA,oBAAoB,wBAwO/B;AAEF,kBAAe,4BAAoB,CAAC"}
@@ -6,7 +6,7 @@ exports[`py#strands-agent generator > should match snapshot for BedrockAgentCore
6
6
  WORKDIR /app
7
7
 
8
8
  # Copy bundled package
9
- COPY --from=workspace dist/apps/test-project/bundle-arm /app
9
+ COPY . /app
10
10
 
11
11
  EXPOSE 8080
12
12
 
@@ -23,7 +23,6 @@ exports[`py#strands-agent generator > should match snapshot for BedrockAgentCore
23
23
  "import { Lazy, Names } from 'aws-cdk-lib';
24
24
  import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
25
25
  import { Construct } from 'constructs';
26
- import { execSync } from 'child_process';
27
26
  import * as path from 'path';
28
27
  import * as url from 'url';
29
28
  import {
@@ -32,8 +31,14 @@ import {
32
31
  Runtime,
33
32
  RuntimeProps,
34
33
  } from '@aws-cdk/aws-bedrock-agentcore-alpha';
35
- import { IGrantable, IPrincipal, Grant } from 'aws-cdk-lib/aws-iam';
34
+ import {
35
+ PolicyStatement,
36
+ IGrantable,
37
+ IPrincipal,
38
+ Grant,
39
+ } from 'aws-cdk-lib/aws-iam';
36
40
  import { RuntimeConfig } from '../../../core/runtime-config.js';
41
+ import { findWorkspaceRoot } from '../../../core/workspace.js';
37
42
 
38
43
  export type SnapshotBedrockAgentProps = Omit<
39
44
  RuntimeProps,
@@ -52,17 +57,16 @@ export class SnapshotBedrockAgent extends Construct implements IGrantable {
52
57
 
53
58
  const rc = RuntimeConfig.ensure(this);
54
59
 
55
- this.dockerImage = AgentRuntimeArtifact.fromAsset(
56
- path.dirname(url.fileURLToPath(new URL(import.meta.url))),
57
- {
58
- platform: Platform.LINUX_ARM64,
59
- extraHash: execSync(
60
- \`docker inspect proj-snapshot-bedrock-agent:latest --format '{{.Id}}'\`,
61
- { encoding: 'utf-8' },
62
- ).trim(),
63
- },
60
+ // Resolve the bundle output directory containing the Dockerfile and built artifacts
61
+ const bundleDir = path.join(
62
+ findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
63
+ 'dist/apps/test-project/docker/snapshot-bedrock-agent',
64
64
  );
65
65
 
66
+ this.dockerImage = AgentRuntimeArtifact.fromAsset(bundleDir, {
67
+ platform: Platform.LINUX_ARM64,
68
+ });
69
+
66
70
  this.agentCoreRuntime = new Runtime(this, 'SnapshotBedrockAgent', {
67
71
  runtimeName: Lazy.string({
68
72
  produce: () =>
@@ -77,6 +81,20 @@ export class SnapshotBedrockAgent extends Construct implements IGrantable {
77
81
  },
78
82
  });
79
83
 
84
+ // Grant access for the agent to invoke bedrock models
85
+ this.agentCoreRuntime.addToRolePolicy(
86
+ new PolicyStatement({
87
+ actions: [
88
+ 'bedrock:InvokeModel',
89
+ 'bedrock:InvokeModelWithResponseStream',
90
+ ],
91
+ resources: [
92
+ 'arn:aws:bedrock:*:*:foundation-model/*',
93
+ 'arn:aws:bedrock:*:*:inference-profile/*',
94
+ ],
95
+ }),
96
+ );
97
+
80
98
  rc.grantReadAppConfig(this.agentCoreRuntime);
81
99
 
82
100
  rc.set('agentcore', 'agentRuntimes', {
@@ -127,6 +145,7 @@ exports[`py#strands-agent generator > should match snapshot for BedrockAgentCore
127
145
  "export * from './app.js';
128
146
  export * from './checkov.js';
129
147
  export * from './runtime-config.js';
148
+ export * from './workspace.js';
130
149
  "
131
150
  `;
132
151
 
@@ -176,6 +195,18 @@ module "agent_core_runtime" {
176
195
  "appconfig:GetLatestConfiguration"
177
196
  ]
178
197
  Resource = ["\${module.appconfig.application_arn}/*"]
198
+ },
199
+ # Grant access for the agent to invoke bedrock models
200
+ {
201
+ Effect = "Allow"
202
+ Action = [
203
+ "bedrock:InvokeModel",
204
+ "bedrock:InvokeModelWithResponseStream"
205
+ ]
206
+ Resource = [
207
+ "arn:aws:bedrock:*:*:foundation-model/*",
208
+ "arn:aws:bedrock:*:*:inference-profile/*"
209
+ ]
179
210
  }
180
211
  ], var.additional_iam_policy_statements)
181
212
  tags = var.tags
@@ -0,0 +1,19 @@
1
+ import logging
2
+
3
+ from .agent import get_agent
4
+ from ag_ui_strands import StrandsAgent, create_strands_app
5
+
6
+ logging.basicConfig(level=logging.INFO)
7
+
8
+ # Create AG-UI agent wrapper
9
+ _agent_ctx = get_agent(session_id="default")
10
+ _agent = _agent_ctx.__enter__()
11
+
12
+ agui_agent = StrandsAgent(
13
+ agent=_agent,
14
+ name="<%= agentNameClassName %>",
15
+ description="A Strands Agent exposed via the AG-UI protocol.",
16
+ )
17
+
18
+ # Create FastAPI app with AG-UI endpoint and health check
19
+ app = create_strands_app(agui_agent, path="/invocations")
@@ -3,7 +3,7 @@ FROM public.ecr.aws/docker/library/python:3.12-slim
3
3
  WORKDIR /app
4
4
 
5
5
  # Copy bundled package
6
- COPY --from=workspace <%- bundleOutputDir %> /app
6
+ COPY . /app
7
7
 
8
8
  <%_ if (protocol === 'A2A') { _%>
9
9
  EXPOSE 9000
@@ -18,6 +18,8 @@ ENV PATH="/app/bin:${PATH}"
18
18
  # https://aws-otel.github.io/docs/getting-started/python-sdk/auto-instr
19
19
  <%_ if (protocol === 'A2A') { _%>
20
20
  CMD ["python", "bin/opentelemetry-instrument", "python", "-m", "uvicorn", "<%- moduleName %>.<%- agentNameSnakeCase %>.main:app", "--host", "0.0.0.0", "--port", "9000"]
21
+ <%_ } else if (protocol === 'AG-UI') { _%>
22
+ CMD ["python", "bin/opentelemetry-instrument", "python", "-m", "uvicorn", "<%- moduleName %>.<%- agentNameSnakeCase %>.main:app", "--host", "0.0.0.0", "--port", "8080"]
21
23
  <%_ } else { _%>
22
24
  CMD ["python", "bin/opentelemetry-instrument", "python", "-m", "<%- moduleName %>.<%- agentNameSnakeCase %>.main"]
23
25
  <%_ } _%>
@@ -13,6 +13,7 @@ const names_1 = require("../../utils/names");
13
13
  const py_1 = require("../../utils/py");
14
14
  const agent_core_constructs_1 = require("../../utils/agent-core-constructs/agent-core-constructs");
15
15
  const bundle_1 = require("../../utils/bundle/bundle");
16
+ const fs_1 = require("../../utils/fs");
16
17
  const npm_scope_1 = require("../../utils/npm-scope");
17
18
  const shared_constructs_1 = require("../../utils/shared-constructs");
18
19
  const nxlv_python_1 = require("../../utils/nxlv-python");
@@ -60,7 +61,9 @@ const pyStrandsAgentGenerator = async (tree, options) => {
60
61
  'mcp',
61
62
  ...(protocol === 'A2A'
62
63
  ? ['strands-agents[a2a]']
63
- : ['strands-agents']),
64
+ : protocol === 'AG-UI'
65
+ ? ['strands-agents', 'ag-ui-protocol', 'ag-ui-strands']
66
+ : ['strands-agents']),
64
67
  'strands-agents-tools',
65
68
  'uvicorn',
66
69
  ]);
@@ -80,14 +83,20 @@ const pyStrandsAgentGenerator = async (tree, options) => {
80
83
  bundleOutputDir,
81
84
  protocol,
82
85
  }, { overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting });
86
+ const dockerOutputDir = (0, devkit_1.joinPathFragments)('dist', project.root, 'docker', name);
83
87
  const dockerTargetName = `${agentTargetPrefix}-docker`;
84
- // Add a docker target specific to this agent
88
+ // Add a docker target that prepares the docker context and builds the image
89
+ const fs = new fs_1.FsCommands(tree);
85
90
  project.targets[dockerTargetName] = {
86
91
  cache: true,
87
92
  executor: 'nx:run-commands',
88
93
  options: {
89
94
  commands: [
90
- `docker build --platform linux/arm64 -t ${dockerImageTag} ${targetSourceDir} --build-context workspace=.`,
95
+ fs.rm(dockerOutputDir),
96
+ fs.mkdir(dockerOutputDir),
97
+ fs.cp(bundleOutputDir, dockerOutputDir),
98
+ fs.cp(`${targetSourceDir}/Dockerfile`, `${dockerOutputDir}/Dockerfile`),
99
+ `docker build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,
91
100
  ],
92
101
  parallel: false,
93
102
  },
@@ -98,24 +107,28 @@ const pyStrandsAgentGenerator = async (tree, options) => {
98
107
  // Add shared constructs
99
108
  const iacProvider = await (0, iac_1.resolveIacProvider)(tree, options.iacProvider);
100
109
  await (0, shared_constructs_1.sharedConstructsGenerator)(tree, { iacProvider });
101
- // Add the construct to deploy the agent
110
+ // Add the construct to deploy the agent.
111
+ // AG-UI uses HTTP as the AgentCore protocol type (AG-UI is HTTP-based with SSE over POST).
112
+ const infraProtocol = protocol === 'AG-UI' ? 'HTTP' : protocol;
102
113
  await (0, agent_core_constructs_1.addAgentInfra)(tree, {
103
114
  agentNameKebabCase: name,
104
115
  agentNameClassName,
105
116
  dockerImageTag,
117
+ dockerOutputDir,
106
118
  iacProvider,
107
119
  projectName: project.name,
108
120
  auth,
109
- serverProtocol: protocol,
121
+ serverProtocol: infraProtocol,
110
122
  });
111
123
  }
112
124
  // A2A servers use port 9000 as per the Strands A2A SDK default and AgentCore A2A contract.
113
- // HTTP agents use port 8081+ to avoid conflict with VS Code server on 8080.
125
+ // HTTP and AG-UI agents use port 8081+ to avoid conflict with VS Code server on 8080.
114
126
  const localDevPortStart = protocol === 'A2A' ? 9000 : 8081;
115
127
  const localDevPort = (0, port_1.assignPort)(tree, project, localDevPortStart);
116
- // Both protocols use fastapi dev for hot reload:
128
+ // All protocols use fastapi dev for hot reload:
117
129
  // - HTTP: FastAPI app directly defined in init.py
118
130
  // - A2A: A2AServer.to_fastapi_app() creates a FastAPI app in main.py
131
+ // - AG-UI: create_strands_app() creates a FastAPI app in main.py
119
132
  const serveCommand = `uv run fastapi dev ${moduleName}/${agentNameSnakeCase}/main.py --port ${localDevPort}`;
120
133
  (0, devkit_1.updateProjectConfiguration)(tree, project.name, {
121
134
  ...project,