@aws/nx-plugin 1.0.8 → 1.0.10
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.
- package/LICENSE-THIRD-PARTY +100 -562
- package/migrations.json +67 -24
- package/package.json +10 -10
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/migrations/latest/pin-strands-mcp-client-peer/metadata.json +3 -0
- package/src/migrations/latest/pin-strands-mcp-client-peer/migration.d.ts +20 -0
- package/src/migrations/latest/pin-strands-mcp-client-peer/migration.js +51 -0
- package/src/migrations/latest/pin-strands-mcp-client-peer/migration.js.map +1 -0
- package/src/migrations/latest/py-dynamodb-bind-base-model-meta/metadata.json +3 -0
- package/src/migrations/latest/{rdb-drop-lambda-rie → py-dynamodb-bind-base-model-meta}/migration.d.ts +1 -1
- package/src/migrations/latest/py-dynamodb-bind-base-model-meta/migration.js +56 -0
- package/src/migrations/latest/py-dynamodb-bind-base-model-meta/migration.js.map +1 -0
- package/src/migrations/v1.0.7/0001-pin-strands-express-peer/migration.js.map +1 -0
- package/src/migrations/v1.0.7/0002-rdb-drop-lambda-rie/migration.js.map +1 -0
- package/src/migrations/v1.0.8/0001-infra-test-loop/migration.js.map +1 -0
- package/src/migrations/v1.0.8/0002-py-dynamodb-type-base-model-meta/metadata.json +3 -0
- package/src/migrations/v1.0.8/0002-py-dynamodb-type-base-model-meta/migration.d.ts +6 -0
- package/src/migrations/v1.0.8/0002-py-dynamodb-type-base-model-meta/migration.js +54 -0
- package/src/migrations/v1.0.8/0002-py-dynamodb-type-base-model-meta/migration.js.map +1 -0
- package/src/migrations/v1.0.8/0003-cache-inputs-outputs/migration.js.map +1 -0
- package/src/open-api/py-client/files/shared/errors.py.template +3 -5
- package/src/open-api/py-client/generator.d.ts +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +5 -5
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +9 -9
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
- package/src/py/agent/a2a-connection/generator.d.ts +1 -1
- package/src/py/agent/gateway-connection/generator.d.ts +1 -1
- package/src/py/agent/mcp-connection/generator.d.ts +1 -1
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +8 -4
- package/src/py/dynamodb/base-model-meta.d.ts +39 -0
- package/src/py/dynamodb/base-model-meta.js +54 -0
- package/src/py/dynamodb/base-model-meta.js.map +1 -0
- package/src/py/dynamodb/files/__name__/entities/base.py.template +3 -1
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/agent/a2a-connection/generator.d.ts +2 -2
- package/src/ts/agent/gateway-connection/generator.d.ts +3 -1
- package/src/ts/agent/gateway-connection/generator.js +4 -0
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/generator.d.ts +3 -1
- package/src/ts/agent/generator.js +5 -0
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/generator.d.ts +3 -1
- package/src/ts/agent/mcp-connection/generator.js +4 -0
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/astro-docs/generator.d.ts +1 -1
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +41 -39
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/utils/agent-connection/agent-connection.d.ts +9 -3
- package/src/utils/agent-connection/agent-connection.js +9 -2
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/git.d.ts +5 -0
- package/src/utils/git.js +29 -4
- package/src/utils/git.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +5 -0
- package/src/utils/shared-constructs.js +10 -9
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/version-lockstep/hold.d.ts +29 -0
- package/src/utils/version-lockstep/hold.js +40 -0
- package/src/utils/version-lockstep/hold.js.map +1 -0
- package/src/utils/version-lockstep/lockstep.d.ts +2 -2
- package/src/utils/version-lockstep/lockstep.js.map +1 -1
- package/src/utils/versions.d.ts +81 -80
- package/src/utils/versions.js +79 -78
- package/src/utils/versions.js.map +1 -1
- package/src/migrations/latest/cache-inputs-outputs/migration.js.map +0 -1
- package/src/migrations/latest/infra-test-loop/migration.js.map +0 -1
- package/src/migrations/latest/pin-strands-express-peer/migration.js.map +0 -1
- package/src/migrations/latest/py-dynamodb-type-base-model-meta/metadata.json +0 -3
- package/src/migrations/latest/py-dynamodb-type-base-model-meta/migration.js +0 -87
- package/src/migrations/latest/py-dynamodb-type-base-model-meta/migration.js.map +0 -1
- package/src/migrations/latest/rdb-drop-lambda-rie/migration.js.map +0 -1
- /package/src/migrations/{latest/pin-strands-express-peer → v1.0.7/0001-pin-strands-express-peer}/metadata.json +0 -0
- /package/src/migrations/{latest/pin-strands-express-peer → v1.0.7/0001-pin-strands-express-peer}/migration.d.ts +0 -0
- /package/src/migrations/{latest/pin-strands-express-peer → v1.0.7/0001-pin-strands-express-peer}/migration.js +0 -0
- /package/src/migrations/{latest/rdb-drop-lambda-rie → v1.0.7/0002-rdb-drop-lambda-rie}/metadata.json +0 -0
- /package/src/migrations/{latest/cache-inputs-outputs → v1.0.7/0002-rdb-drop-lambda-rie}/migration.d.ts +0 -0
- /package/src/migrations/{latest/rdb-drop-lambda-rie → v1.0.7/0002-rdb-drop-lambda-rie}/migration.js +0 -0
- /package/src/migrations/{latest/infra-test-loop → v1.0.8/0001-infra-test-loop}/metadata.json +0 -0
- /package/src/migrations/{latest/infra-test-loop → v1.0.8/0001-infra-test-loop}/migration.d.ts +0 -0
- /package/src/migrations/{latest/infra-test-loop → v1.0.8/0001-infra-test-loop}/migration.js +0 -0
- /package/src/migrations/{latest/cache-inputs-outputs → v1.0.8/0003-cache-inputs-outputs}/metadata.json +0 -0
- /package/src/migrations/{latest/py-dynamodb-type-base-model-meta → v1.0.8/0003-cache-inputs-outputs}/migration.d.ts +0 -0
- /package/src/migrations/{latest/cache-inputs-outputs → v1.0.8/0003-cache-inputs-outputs}/migration.js +0 -0
|
@@ -416,7 +416,7 @@ terraform {
|
|
|
416
416
|
required_providers {
|
|
417
417
|
aws = {
|
|
418
418
|
source = "hashicorp/aws"
|
|
419
|
-
version = "6.
|
|
419
|
+
version = "6.68.0"
|
|
420
420
|
}
|
|
421
421
|
random = {
|
|
422
422
|
source = "hashicorp/random"
|
|
@@ -732,7 +732,7 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with Terraform pro
|
|
|
732
732
|
}
|
|
733
733
|
aws = {
|
|
734
734
|
source = "hashicorp/aws"
|
|
735
|
-
version = "6.
|
|
735
|
+
version = "6.68.0"
|
|
736
736
|
}
|
|
737
737
|
random = {
|
|
738
738
|
source = "hashicorp/random"
|
|
@@ -2176,7 +2176,7 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with default optio
|
|
|
2176
2176
|
"shx rm -rf dist/{projectRoot}/build",
|
|
2177
2177
|
"shx rm -rf dist/{projectRoot}/smithy",
|
|
2178
2178
|
"shx mkdir -p dist/{projectRoot}/build",
|
|
2179
|
-
"npx -y mise@2026.10.
|
|
2179
|
+
"npx -y mise@2026.10.9 exec smithy@1.74.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
|
|
2180
2180
|
"shx mkdir -p dist/{projectRoot}/build/openapi",
|
|
2181
2181
|
"shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
|
|
2182
2182
|
],
|
|
@@ -2317,7 +2317,7 @@ terraform {
|
|
|
2317
2317
|
required_providers {
|
|
2318
2318
|
aws = {
|
|
2319
2319
|
source = "hashicorp/aws"
|
|
2320
|
-
version = "6.
|
|
2320
|
+
version = "6.68.0"
|
|
2321
2321
|
}
|
|
2322
2322
|
random = {
|
|
2323
2323
|
source = "hashicorp/random"
|
|
@@ -2630,7 +2630,7 @@ output "waf_web_acl_arn" {
|
|
|
2630
2630
|
}
|
|
2631
2631
|
aws = {
|
|
2632
2632
|
source = "hashicorp/aws"
|
|
2633
|
-
version = "6.
|
|
2633
|
+
version = "6.68.0"
|
|
2634
2634
|
}
|
|
2635
2635
|
random = {
|
|
2636
2636
|
source = "hashicorp/random"
|
|
@@ -3692,7 +3692,7 @@ terraform {
|
|
|
3692
3692
|
required_providers {
|
|
3693
3693
|
aws = {
|
|
3694
3694
|
source = "hashicorp/aws"
|
|
3695
|
-
version = "6.
|
|
3695
|
+
version = "6.68.0"
|
|
3696
3696
|
}
|
|
3697
3697
|
random = {
|
|
3698
3698
|
source = "hashicorp/random"
|
|
@@ -4005,7 +4005,7 @@ output "waf_web_acl_arn" {
|
|
|
4005
4005
|
}
|
|
4006
4006
|
aws = {
|
|
4007
4007
|
source = "hashicorp/aws"
|
|
4008
|
-
version = "6.
|
|
4008
|
+
version = "6.68.0"
|
|
4009
4009
|
}
|
|
4010
4010
|
random = {
|
|
4011
4011
|
source = "hashicorp/random"
|
|
@@ -5056,7 +5056,7 @@ exports[`tsSmithyApiGenerator > terraform iac > should generate terraform with c
|
|
|
5056
5056
|
}
|
|
5057
5057
|
aws = {
|
|
5058
5058
|
source = "hashicorp/aws"
|
|
5059
|
-
version = "6.
|
|
5059
|
+
version = "6.68.0"
|
|
5060
5060
|
}
|
|
5061
5061
|
random = {
|
|
5062
5062
|
source = "hashicorp/random"
|
|
@@ -3223,7 +3223,7 @@ terraform {
|
|
|
3223
3223
|
required_providers {
|
|
3224
3224
|
aws = {
|
|
3225
3225
|
source = "hashicorp/aws"
|
|
3226
|
-
version = "6.
|
|
3226
|
+
version = "6.68.0"
|
|
3227
3227
|
}
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
@@ -3474,7 +3474,7 @@ output "api_log_group_arn" {
|
|
|
3474
3474
|
}
|
|
3475
3475
|
aws = {
|
|
3476
3476
|
source = "hashicorp/aws"
|
|
3477
|
-
version = "6.
|
|
3477
|
+
version = "6.68.0"
|
|
3478
3478
|
}
|
|
3479
3479
|
random = {
|
|
3480
3480
|
source = "hashicorp/random"
|
|
@@ -4100,7 +4100,7 @@ terraform {
|
|
|
4100
4100
|
required_providers {
|
|
4101
4101
|
aws = {
|
|
4102
4102
|
source = "hashicorp/aws"
|
|
4103
|
-
version = "6.
|
|
4103
|
+
version = "6.68.0"
|
|
4104
4104
|
}
|
|
4105
4105
|
}
|
|
4106
4106
|
}
|
|
@@ -4351,7 +4351,7 @@ output "api_log_group_arn" {
|
|
|
4351
4351
|
}
|
|
4352
4352
|
aws = {
|
|
4353
4353
|
source = "hashicorp/aws"
|
|
4354
|
-
version = "6.
|
|
4354
|
+
version = "6.68.0"
|
|
4355
4355
|
}
|
|
4356
4356
|
random = {
|
|
4357
4357
|
source = "hashicorp/random"
|
|
@@ -5050,7 +5050,7 @@ terraform {
|
|
|
5050
5050
|
required_providers {
|
|
5051
5051
|
aws = {
|
|
5052
5052
|
source = "hashicorp/aws"
|
|
5053
|
-
version = "6.
|
|
5053
|
+
version = "6.68.0"
|
|
5054
5054
|
}
|
|
5055
5055
|
}
|
|
5056
5056
|
}
|
|
@@ -5301,7 +5301,7 @@ output "api_log_group_arn" {
|
|
|
5301
5301
|
}
|
|
5302
5302
|
aws = {
|
|
5303
5303
|
source = "hashicorp/aws"
|
|
5304
|
-
version = "6.
|
|
5304
|
+
version = "6.68.0"
|
|
5305
5305
|
}
|
|
5306
5306
|
random = {
|
|
5307
5307
|
source = "hashicorp/random"
|
|
@@ -5904,7 +5904,7 @@ terraform {
|
|
|
5904
5904
|
required_providers {
|
|
5905
5905
|
aws = {
|
|
5906
5906
|
source = "hashicorp/aws"
|
|
5907
|
-
version = "6.
|
|
5907
|
+
version = "6.68.0"
|
|
5908
5908
|
}
|
|
5909
5909
|
random = {
|
|
5910
5910
|
source = "hashicorp/random"
|
|
@@ -6217,7 +6217,7 @@ output "waf_web_acl_arn" {
|
|
|
6217
6217
|
}
|
|
6218
6218
|
aws = {
|
|
6219
6219
|
source = "hashicorp/aws"
|
|
6220
|
-
version = "6.
|
|
6220
|
+
version = "6.68.0"
|
|
6221
6221
|
}
|
|
6222
6222
|
random = {
|
|
6223
6223
|
source = "hashicorp/random"
|
|
@@ -7280,7 +7280,7 @@ terraform {
|
|
|
7280
7280
|
required_providers {
|
|
7281
7281
|
aws = {
|
|
7282
7282
|
source = "hashicorp/aws"
|
|
7283
|
-
version = "6.
|
|
7283
|
+
version = "6.68.0"
|
|
7284
7284
|
}
|
|
7285
7285
|
random = {
|
|
7286
7286
|
source = "hashicorp/random"
|
|
@@ -7593,7 +7593,7 @@ output "waf_web_acl_arn" {
|
|
|
7593
7593
|
}
|
|
7594
7594
|
aws = {
|
|
7595
7595
|
source = "hashicorp/aws"
|
|
7596
|
-
version = "6.
|
|
7596
|
+
version = "6.68.0"
|
|
7597
7597
|
}
|
|
7598
7598
|
random = {
|
|
7599
7599
|
source = "hashicorp/random"
|
|
@@ -8645,7 +8645,7 @@ terraform {
|
|
|
8645
8645
|
required_providers {
|
|
8646
8646
|
aws = {
|
|
8647
8647
|
source = "hashicorp/aws"
|
|
8648
|
-
version = "6.
|
|
8648
|
+
version = "6.68.0"
|
|
8649
8649
|
}
|
|
8650
8650
|
random = {
|
|
8651
8651
|
source = "hashicorp/random"
|
|
@@ -8958,7 +8958,7 @@ output "waf_web_acl_arn" {
|
|
|
8958
8958
|
}
|
|
8959
8959
|
aws = {
|
|
8960
8960
|
source = "hashicorp/aws"
|
|
8961
|
-
version = "6.
|
|
8961
|
+
version = "6.68.0"
|
|
8962
8962
|
}
|
|
8963
8963
|
random = {
|
|
8964
8964
|
source = "hashicorp/random"
|
|
@@ -661,7 +661,7 @@ WORKDIR /app
|
|
|
661
661
|
# the runtime only needs node, and npm's own bundled dependencies would
|
|
662
662
|
# otherwise carry vulnerabilities into the image.
|
|
663
663
|
RUN npm init -y \\
|
|
664
|
-
&& npm pkg set "overrides.@opentelemetry/propagator-jaeger=2.
|
|
664
|
+
&& npm pkg set "overrides.@opentelemetry/propagator-jaeger=2.12.0" \\
|
|
665
665
|
&& npm pkg set "overrides.minimatch=10.2.6" \\
|
|
666
666
|
&& npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation@0.13.0 \\
|
|
667
667
|
&& npm uninstall -g npm
|
|
@@ -984,7 +984,7 @@ exports[`ts#agent generator > should match snapshot for Terraform generated file
|
|
|
984
984
|
required_providers {
|
|
985
985
|
aws = {
|
|
986
986
|
source = "hashicorp/aws"
|
|
987
|
-
version = "6.
|
|
987
|
+
version = "6.68.0"
|
|
988
988
|
}
|
|
989
989
|
random = {
|
|
990
990
|
source = "hashicorp/random"
|
|
@@ -1307,7 +1307,7 @@ exports[`ts#agent generator > should match snapshot for Terraform generated file
|
|
|
1307
1307
|
required_providers {
|
|
1308
1308
|
aws = {
|
|
1309
1309
|
source = "hashicorp/aws"
|
|
1310
|
-
version = "6.
|
|
1310
|
+
version = "6.68.0"
|
|
1311
1311
|
}
|
|
1312
1312
|
null = {
|
|
1313
1313
|
source = "hashicorp/null"
|
|
@@ -1666,7 +1666,7 @@ resource "null_resource" "runtime_ready" {
|
|
|
1666
1666
|
|
|
1667
1667
|
provisioner "local-exec" {
|
|
1668
1668
|
command = <<-EOT
|
|
1669
|
-
uv run --with boto3==1.43.
|
|
1669
|
+
uv run --with boto3==1.43.113 python -c "
|
|
1670
1670
|
import boto3
|
|
1671
1671
|
import json
|
|
1672
1672
|
import os
|
|
@@ -9,7 +9,7 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
9
9
|
readonly name: "@a2a-js/sdk";
|
|
10
10
|
readonly root: true;
|
|
11
11
|
}, ...({
|
|
12
|
-
name: "@aws-sdk/client-s3" | "@strands-agents/sdk" | "express";
|
|
12
|
+
name: "@aws-sdk/client-s3" | "@modelcontextprotocol/client" | "@strands-agents/sdk" | "express";
|
|
13
13
|
root: boolean;
|
|
14
14
|
} | ({
|
|
15
15
|
readonly name: "@aws-lambda-powertools/parameters";
|
|
@@ -32,7 +32,7 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
32
32
|
} & {
|
|
33
33
|
versionOnly: true;
|
|
34
34
|
}) | ({
|
|
35
|
-
name: "@aws-sdk/client-s3" | "@strands-agents/sdk" | "express";
|
|
35
|
+
name: "@aws-sdk/client-s3" | "@modelcontextprotocol/client" | "@strands-agents/sdk" | "express";
|
|
36
36
|
} & {
|
|
37
37
|
versionOnly: true;
|
|
38
38
|
}) | {
|
|
@@ -11,6 +11,8 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
11
11
|
readonly name: "@strands-agents/sdk";
|
|
12
12
|
}, {
|
|
13
13
|
readonly name: "express";
|
|
14
|
+
}, {
|
|
15
|
+
readonly name: "@modelcontextprotocol/client";
|
|
14
16
|
}, {
|
|
15
17
|
readonly name: "@aws-lambda-powertools/parameters";
|
|
16
18
|
}, {
|
|
@@ -40,7 +42,7 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
40
42
|
} & {
|
|
41
43
|
versionOnly: true;
|
|
42
44
|
}, ...({
|
|
43
|
-
name: "@aws-sdk/client-s3" | "@strands-agents/sdk" | "express";
|
|
45
|
+
name: "@aws-sdk/client-s3" | "@modelcontextprotocol/client" | "@strands-agents/sdk" | "express";
|
|
44
46
|
} & {
|
|
45
47
|
versionOnly: true;
|
|
46
48
|
})[]], readonly import("../../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "pydantic" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", Record<string, never>>[]>;
|
|
@@ -37,6 +37,10 @@ export const DEPENDENCIES = declareDependencies()({
|
|
|
37
37
|
{
|
|
38
38
|
name: 'express'
|
|
39
39
|
},
|
|
40
|
+
// strands' required peer, pinned for the same self-sufficiency.
|
|
41
|
+
{
|
|
42
|
+
name: '@modelcontextprotocol/client'
|
|
43
|
+
},
|
|
40
44
|
{
|
|
41
45
|
name: '@aws-lambda-powertools/parameters'
|
|
42
46
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/agent/gateway-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { readAgentCoreGatewayMetadata } from '../../../agentcore-gateway/generator.js';\nimport { addTsDependencies } from '../../../utils/add-dependencies.js';\nimport {\n AGENT_CONNECTION_DEPENDENCIES,\n AGENT_CONNECTION_PROJECT_DIR,\n addTypeScriptClientToAgent,\n addTypeScriptCoreClient,\n ensureTypeScriptAgentConnectionProject,\n} from '../../../utils/agent-connection/agent-connection.js';\nimport { addDestructuredImport, addStarExport } from '../../../utils/ast.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { installDependencies } from '../../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics.js';\nimport { esmVars } from '../../../utils/module-format.js';\nimport { kebabCase } from '../../../utils/names.js';\nimport { getNpmScope } from '../../../utils/npm-scope.js';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx.js';\nimport { toProjectRelativePath } from '../../../utils/paths.js';\nimport type { TsAgentGatewayConnectionGeneratorSchema } from './schema';\n\n// The gateway core client + vended client need these whatever the connection's\n// options, so no entry is conditional.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@modelcontextprotocol/sdk' },\n { name: '@strands-agents/sdk' },\n // express is strands' optional peer (see STRANDS_PEER_DEPENDENCY_NAMES in\n // agent-connection.ts). Declared here too, even though it is redundant\n // with ts#agent's own unconditional declaration on the same project, so\n // this generator is self-sufficient. @aws-sdk/client-s3, strands' other\n // required peer, is deliberately NOT added here: ts#agent only declares\n // it when session: 's3' (see generator.ts), and adding it unconditionally\n // from this connection would install an unused S3 client into an\n // in-memory-session agent — a user-visible change outside this fix's\n // scope.\n { name: 'express' },\n { name: '@aws-lambda-powertools/parameters' },\n { name: '@aws-sdk/client-appconfigdata' },\n { name: 'aws4fetch' },\n { name: '@aws-sdk/credential-providers' },\n ...ownedElsewhere(AGENT_CONNECTION_DEPENDENCIES),\n ],\n});\n\nexport const TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsAgentGatewayConnectionGenerator = async (\n tree: Tree,\n options: TsAgentGatewayConnectionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentComponent = options.sourceComponent;\n if (!agentComponent) {\n throw new Error(\n 'sourceComponent must be provided for ts#agent -> agentcore-gateway connections',\n );\n }\n const gateway = readAgentCoreGatewayMetadata(targetProject);\n\n if (gateway.protocol !== 'mcp') {\n throw new Error(\n `Gateway '${gateway.name}' has protocol='${gateway.protocol}'. Only MCP-protocol gateways are supported.`,\n );\n }\n if (gateway.auth !== 'iam') {\n throw new Error(\n `Gateway '${gateway.name}' uses auth='${gateway.auth}'. Agent connections currently require the gateway to use IAM authentication.`,\n );\n }\n\n const gatewayClassName = gateway.rc;\n const gatewayKebabCase = kebabCase(gatewayClassName);\n // A gateway is its own standalone project, so it exposes plain serve / dev.\n const gatewayServeTargetName = 'serve';\n const gatewayDevTargetName = 'dev';\n\n const npmScope = getNpmScope(tree);\n\n // 1. Ensure the shared agent-connection project exists + has the gateway\n // core client template.\n await ensureTypeScriptAgentConnectionProject(tree, DEPENDENCIES);\n await addTypeScriptCoreClient(tree, 'gateway', DEPENDENCIES);\n\n // 2. Generate the per-connection <Gateway>Client into app/. Local mode\n // points at the gateway project's local gateway port.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'agent-connection', 'app'),\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'app'),\n {\n gatewayKebabCase,\n gatewayClassName,\n gatewayPort: gateway.port,\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Re-export from the agent-connection index\n await addStarExport(\n tree,\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'index.ts'),\n `./app/${gatewayKebabCase}-client-strands.js`,\n );\n\n // 3. AST-transform agent.ts to add the gateway client (an McpClient in\n // both deployed and local modes) to the agent's tools.\n const agentSourceDir = joinPathFragments(\n sourceProject.root,\n agentComponent.path ?? 'src',\n );\n const agentFilePath = joinPathFragments(agentSourceDir, 'agent.ts');\n\n if (tree.exists(agentFilePath)) {\n const clientClassName = `${gatewayClassName}ClientStrands`;\n const clientVarName =\n gatewayClassName.charAt(0).toLowerCase() + gatewayClassName.slice(1);\n\n await addDestructuredImport(\n tree,\n agentFilePath,\n [clientClassName],\n `@${npmScope}/agent-connection`,\n );\n await addTypeScriptClientToAgent(\n tree,\n agentFilePath,\n clientClassName,\n clientVarName,\n );\n }\n\n // 4. Wire dev chain — agent's dev depends on gateway's\n // aggregator target, which transitively starts each attached MCP server.\n const agentName = agentComponent.name ?? 'agent';\n const serveTargetName = `${agentName}-serve`;\n const devTargetName = `${agentName}-dev`;\n let projectConfigChanged = false;\n if (sourceProject.targets?.[serveTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, serveTargetName, {\n projects: [targetProject.name],\n target: gatewayServeTargetName,\n });\n projectConfigChanged = true;\n }\n if (sourceProject.targets?.[devTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTargetName, {\n projects: [targetProject.name],\n target: gatewayDevTargetName,\n });\n projectConfigChanged = true;\n }\n if (projectConfigChanged) {\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // 5. Dependencies\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: sourceProject.root });\n\n // Recorded so the version sync knows this connection's dependencies are ours.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO,\n toProjectRelativePath(sourceProject, agentFilePath),\n gatewayClassName,\n // The source component this connection is made from, so the pair is\n // identifiable rather than just the two projects.\n { sourcePath: options.sourceComponent?.path },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsAgentGatewayConnectionGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","readAgentCoreGatewayMetadata","addTsDependencies","AGENT_CONNECTION_DEPENDENCIES","AGENT_CONNECTION_PROJECT_DIR","addTypeScriptClientToAgent","addTypeScriptCoreClient","ensureTypeScriptAgentConnectionProject","addDestructuredImport","addStarExport","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScope","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","toProjectRelativePath","DEPENDENCIES","ts","name","TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO","filename","tsAgentGatewayConnectionGenerator","tree","options","sourceProject","targetProject","agentComponent","sourceComponent","Error","gateway","protocol","auth","gatewayClassName","rc","gatewayKebabCase","gatewayServeTargetName","gatewayDevTargetName","npmScope","dirname","gatewayPort","port","overwriteStrategy","KeepExisting","agentSourceDir","root","path","agentFilePath","exists","clientClassName","clientVarName","charAt","toLowerCase","slice","agentName","serveTargetName","devTargetName","projectConfigChanged","targets","projects","target","projectRoot","sourcePath","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,4BAA4B,QAAQ,0CAA0C;AACvF,SAASC,iBAAiB,QAAQ,qCAAqC;AACvE,SACEC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,uBAAuB,EACvBC,sCAAsC,QACjC,sDAAsD;AAC7D,SAASC,qBA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../../../../../../packages/nx-plugin/src/ts/agent/gateway-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { readAgentCoreGatewayMetadata } from '../../../agentcore-gateway/generator.js';\nimport { addTsDependencies } from '../../../utils/add-dependencies.js';\nimport {\n AGENT_CONNECTION_DEPENDENCIES,\n AGENT_CONNECTION_PROJECT_DIR,\n addTypeScriptClientToAgent,\n addTypeScriptCoreClient,\n ensureTypeScriptAgentConnectionProject,\n} from '../../../utils/agent-connection/agent-connection.js';\nimport { addDestructuredImport, addStarExport } from '../../../utils/ast.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { installDependencies } from '../../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics.js';\nimport { esmVars } from '../../../utils/module-format.js';\nimport { kebabCase } from '../../../utils/names.js';\nimport { getNpmScope } from '../../../utils/npm-scope.js';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx.js';\nimport { toProjectRelativePath } from '../../../utils/paths.js';\nimport type { TsAgentGatewayConnectionGeneratorSchema } from './schema';\n\n// The gateway core client + vended client need these whatever the connection's\n// options, so no entry is conditional.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@modelcontextprotocol/sdk' },\n { name: '@strands-agents/sdk' },\n // express is strands' optional peer (see STRANDS_PEER_DEPENDENCY_NAMES in\n // agent-connection.ts). Declared here too, even though it is redundant\n // with ts#agent's own unconditional declaration on the same project, so\n // this generator is self-sufficient. @aws-sdk/client-s3, strands' other\n // required peer, is deliberately NOT added here: ts#agent only declares\n // it when session: 's3' (see generator.ts), and adding it unconditionally\n // from this connection would install an unused S3 client into an\n // in-memory-session agent — a user-visible change outside this fix's\n // scope.\n { name: 'express' },\n // strands' required peer, pinned for the same self-sufficiency.\n { name: '@modelcontextprotocol/client' },\n { name: '@aws-lambda-powertools/parameters' },\n { name: '@aws-sdk/client-appconfigdata' },\n { name: 'aws4fetch' },\n { name: '@aws-sdk/credential-providers' },\n ...ownedElsewhere(AGENT_CONNECTION_DEPENDENCIES),\n ],\n});\n\nexport const TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsAgentGatewayConnectionGenerator = async (\n tree: Tree,\n options: TsAgentGatewayConnectionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentComponent = options.sourceComponent;\n if (!agentComponent) {\n throw new Error(\n 'sourceComponent must be provided for ts#agent -> agentcore-gateway connections',\n );\n }\n const gateway = readAgentCoreGatewayMetadata(targetProject);\n\n if (gateway.protocol !== 'mcp') {\n throw new Error(\n `Gateway '${gateway.name}' has protocol='${gateway.protocol}'. Only MCP-protocol gateways are supported.`,\n );\n }\n if (gateway.auth !== 'iam') {\n throw new Error(\n `Gateway '${gateway.name}' uses auth='${gateway.auth}'. Agent connections currently require the gateway to use IAM authentication.`,\n );\n }\n\n const gatewayClassName = gateway.rc;\n const gatewayKebabCase = kebabCase(gatewayClassName);\n // A gateway is its own standalone project, so it exposes plain serve / dev.\n const gatewayServeTargetName = 'serve';\n const gatewayDevTargetName = 'dev';\n\n const npmScope = getNpmScope(tree);\n\n // 1. Ensure the shared agent-connection project exists + has the gateway\n // core client template.\n await ensureTypeScriptAgentConnectionProject(tree, DEPENDENCIES);\n await addTypeScriptCoreClient(tree, 'gateway', DEPENDENCIES);\n\n // 2. Generate the per-connection <Gateway>Client into app/. Local mode\n // points at the gateway project's local gateway port.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'agent-connection', 'app'),\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'app'),\n {\n gatewayKebabCase,\n gatewayClassName,\n gatewayPort: gateway.port,\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Re-export from the agent-connection index\n await addStarExport(\n tree,\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'index.ts'),\n `./app/${gatewayKebabCase}-client-strands.js`,\n );\n\n // 3. AST-transform agent.ts to add the gateway client (an McpClient in\n // both deployed and local modes) to the agent's tools.\n const agentSourceDir = joinPathFragments(\n sourceProject.root,\n agentComponent.path ?? 'src',\n );\n const agentFilePath = joinPathFragments(agentSourceDir, 'agent.ts');\n\n if (tree.exists(agentFilePath)) {\n const clientClassName = `${gatewayClassName}ClientStrands`;\n const clientVarName =\n gatewayClassName.charAt(0).toLowerCase() + gatewayClassName.slice(1);\n\n await addDestructuredImport(\n tree,\n agentFilePath,\n [clientClassName],\n `@${npmScope}/agent-connection`,\n );\n await addTypeScriptClientToAgent(\n tree,\n agentFilePath,\n clientClassName,\n clientVarName,\n );\n }\n\n // 4. Wire dev chain — agent's dev depends on gateway's\n // aggregator target, which transitively starts each attached MCP server.\n const agentName = agentComponent.name ?? 'agent';\n const serveTargetName = `${agentName}-serve`;\n const devTargetName = `${agentName}-dev`;\n let projectConfigChanged = false;\n if (sourceProject.targets?.[serveTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, serveTargetName, {\n projects: [targetProject.name],\n target: gatewayServeTargetName,\n });\n projectConfigChanged = true;\n }\n if (sourceProject.targets?.[devTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTargetName, {\n projects: [targetProject.name],\n target: gatewayDevTargetName,\n });\n projectConfigChanged = true;\n }\n if (projectConfigChanged) {\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // 5. Dependencies\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: sourceProject.root });\n\n // Recorded so the version sync knows this connection's dependencies are ours.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO,\n toProjectRelativePath(sourceProject, agentFilePath),\n gatewayClassName,\n // The source component this connection is made from, so the pair is\n // identifiable rather than just the two projects.\n { sourcePath: options.sourceComponent?.path },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsAgentGatewayConnectionGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","readAgentCoreGatewayMetadata","addTsDependencies","AGENT_CONNECTION_DEPENDENCIES","AGENT_CONNECTION_PROJECT_DIR","addTypeScriptClientToAgent","addTypeScriptCoreClient","ensureTypeScriptAgentConnectionProject","addDestructuredImport","addStarExport","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScope","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","toProjectRelativePath","DEPENDENCIES","ts","name","TS_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO","filename","tsAgentGatewayConnectionGenerator","tree","options","sourceProject","targetProject","agentComponent","sourceComponent","Error","gateway","protocol","auth","gatewayClassName","rc","gatewayKebabCase","gatewayServeTargetName","gatewayDevTargetName","npmScope","dirname","gatewayPort","port","overwriteStrategy","KeepExisting","agentSourceDir","root","path","agentFilePath","exists","clientClassName","clientVarName","charAt","toLowerCase","slice","agentName","serveTargetName","devTargetName","projectConfigChanged","targets","projects","target","projectRoot","sourcePath","preferInstallDependencies","languages"],"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AsBS,eAAesB,gBACrCd,kBACA,oEAAoE;IACpE,kDAAkD;IAClD;QAAE6B,YAAYtC,QAAQI,eAAe,EAAEkB;IAAK;IAG9C,MAAMtC,gCAAgCe,MAAM;QAC1CH;KACD;IAED,MAAMd,qBAAqBiB;IAC3B,OAAO,IACLhB,oBAAoBgB,MAAMC,QAAQuC,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAe1C,kCAAkC"}
|
|
@@ -36,6 +36,8 @@ export declare const DEPENDENCIES: import("../../utils/declared-dependencies.js"
|
|
|
36
36
|
readonly when: (m: TsAgentMetadata) => boolean;
|
|
37
37
|
}, {
|
|
38
38
|
readonly name: "express";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "@modelcontextprotocol/client";
|
|
39
41
|
}, {
|
|
40
42
|
readonly name: "@a2a-js/sdk";
|
|
41
43
|
readonly when: (m: TsAgentMetadata) => boolean;
|
|
@@ -129,7 +131,7 @@ export declare const DEPENDENCIES: import("../../utils/declared-dependencies.js"
|
|
|
129
131
|
} & {
|
|
130
132
|
versionOnly: true;
|
|
131
133
|
}, ...({
|
|
132
|
-
name: "@aws-sdk/client-s3" | "@strands-agents/sdk" | "express";
|
|
134
|
+
name: "@aws-sdk/client-s3" | "@modelcontextprotocol/client" | "@strands-agents/sdk" | "express";
|
|
133
135
|
} & {
|
|
134
136
|
versionOnly: true;
|
|
135
137
|
})[], {
|
|
@@ -69,6 +69,11 @@ export const DEPENDENCIES = declareDependencies()({
|
|
|
69
69
|
{
|
|
70
70
|
name: 'express'
|
|
71
71
|
},
|
|
72
|
+
// strands' required peer (see STRANDS_PEER_DEPENDENCY_NAMES), pinned so
|
|
73
|
+
// it doesn't float to its latest.
|
|
74
|
+
{
|
|
75
|
+
name: '@modelcontextprotocol/client'
|
|
76
|
+
},
|
|
72
77
|
{
|
|
73
78
|
name: '@a2a-js/sdk',
|
|
74
79
|
when: (m)=>m.protocol === 'a2a'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/agent/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { addAgentChatScripts } from '../../utils/agent-chat/agent-chat.js';\nimport {\n AGENT_CONNECTION_DEPENDENCIES,\n addTypeScriptFrameworkBase,\n ensureTypeScriptAgentConnectionProject,\n} from '../../utils/agent-connection/agent-connection.js';\nimport {\n AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES,\n type AgentCoreArtifact,\n addAgentInfra,\n} from '../../utils/agent-core-constructs/agent-core-constructs.js';\nimport {\n addTypeScriptCodePackageTarget,\n agentCoreNodeRuntime,\n CODE_PACKAGE_DEPENDENCIES,\n isAgentCoreHosted,\n isContainerHosted,\n} from '../../utils/agent-core-packaging.js';\nimport {\n addTypeScriptBundleTarget,\n BUNDLE_DEPENDENCIES,\n} from '../../utils/bundle/bundle.js';\nimport { resolveContainers } from '../../utils/containers.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport {\n ADOT_IMAGE_DEPENDENCIES,\n addDockerScanTarget,\n DOCKER_DEPENDENCIES,\n IMAGE_BUILD_CACHE,\n NODE_IMAGE_DEPENDENCIES,\n nodeImageVersions,\n} from '../../utils/docker.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { FS_DEPENDENCIES, FsCommands } from '../../utils/fs.js';\nimport { resolveIac } from '../../utils/iac.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { esmVars } from '../../utils/module-format.js';\nimport { kebabCase, toClassName } from '../../utils/names.js';\nimport { getNpmScope } from '../../utils/npm-scope.js';\nimport {\n addArtifactDependencyToTargets,\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n normalizeTargetKeyOrder,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getRelativePathToRootByDirectory } from '../../utils/paths.js';\nimport { assignPort } from '../../utils/port.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs.js';\nimport type { IacMetadata } from '../../utils/shared-constructs-constants.js';\nimport { BASE_IMAGES, TS_VERSIONS } from '../../utils/versions.js';\nimport type { TsAgentGeneratorSchema, TsAgentInfra } from './schema';\n\n/** The metadata this generator records, which its predicates read. */\nexport interface TsAgentMetadata extends IacMetadata {\n readonly port: number;\n readonly rc: string;\n readonly auth: string;\n readonly protocol: string;\n readonly session: string;\n /**\n * How this component is packaged and hosted, so a consumer can tell a\n * code-packaged runtime from a container-packaged one without re-deriving it.\n */\n readonly infra: TsAgentInfra;\n}\n\n// Each entry names the branch it belongs to, so the same declaration drives both\n// adding and the version sync.\nexport const DEPENDENCIES = declareDependencies<TsAgentMetadata>()({\n ts: [\n { name: 'zod' },\n { name: '@strands-agents/sdk' },\n { name: '@aws-sdk/credential-providers' },\n { name: '@aws-sdk/client-appconfigdata' },\n { name: '@aws-lambda-powertools/parameters' },\n { name: '@modelcontextprotocol/sdk' },\n // @aws-sdk/client-s3 is one of @strands-agents/sdk's peers in\n // STRANDS_PEER_DEPENDENCY_NAMES, but this project only actually uses S3\n // when session storage is backed by it — an in-memory session installs\n // no S3 client at all (see generator.spec.ts's \"should not add the\n // @aws-sdk/client-s3 dependency when session is in-memory\"). That is a\n // deliberate, tested exception to the peer rule for this one site; the\n // in-memory branch does not reach pnpm's peer-suffixing bug because no\n // other project in a workspace with only in-memory agents declares\n // client-s3 at a floating version either.\n { name: '@aws-sdk/client-s3', when: (m) => m.session === 's3' },\n // express is strands' optional peer (see STRANDS_PEER_DEPENDENCY_NAMES);\n // pnpm suffixes a package by its resolved peer versions, so leaving it\n // undeclared on a protocol that doesn't use express can resolve a\n // different express than every other importer and split\n // @strands-agents/sdk into two instances. Declared unconditionally,\n // matching @strands-agents/sdk itself.\n { name: 'express' },\n { name: '@a2a-js/sdk', when: (m) => m.protocol === 'a2a' },\n { name: '@ag-ui/aws-strands', when: (m) => m.protocol === 'ag-ui' },\n // @ag-ui/aws-strands declares these as peer dependencies but statically\n // imports them, so they must be installed for the bundler to inline them.\n { name: '@ag-ui/a2ui-toolkit', when: (m) => m.protocol === 'ag-ui' },\n { name: '@ag-ui/client', when: (m) => m.protocol === 'ag-ui' },\n { name: '@ag-ui/core', when: (m) => m.protocol === 'ag-ui' },\n { name: '@ag-ui/encoder', when: (m) => m.protocol === 'ag-ui' },\n { name: '@trpc/server', when: (m) => m.protocol === 'http' },\n { name: '@trpc/client', when: (m) => m.protocol === 'http' },\n { name: 'ws', when: (m) => m.protocol === 'http' },\n { name: 'cors', when: (m) => m.protocol !== 'a2a' },\n { name: 'aws4fetch', when: (m) => m.protocol === 'http' },\n { name: 'aws4fetch', when: (m) => m.auth === 'iam', dev: true },\n {\n name: '@aws-sdk/credential-providers',\n when: (m) => m.auth === 'iam',\n dev: true,\n },\n { name: '@types/node', dev: true },\n // The chat CLI runs standalone via tsx and resolves the deployed agent from\n // AppConfig when `RUNTIME_CONFIG_APP_ID` is set.\n { name: 'agent-chat-cli', dev: true },\n { name: '@aws-lambda-powertools/parameters', dev: true },\n { name: '@aws-sdk/client-appconfigdata', dev: true },\n // A2A chat builds a signed @a2a-js client factory for the deployed agent.\n { name: '@a2a-js/sdk', when: (m) => m.protocol === 'a2a', dev: true },\n { name: '@types/express', when: (m) => m.protocol !== 'http', dev: true },\n { name: '@types/ws', when: (m) => m.protocol === 'http', dev: true },\n { name: '@types/cors', dev: true },\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(AGENT_CONNECTION_DEPENDENCIES),\n ...ownedElsewhere(BUNDLE_DEPENDENCIES),\n ...ownedElsewhere(FS_DEPENDENCIES),\n ...ownedElsewhere(DOCKER_DEPENDENCIES),\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ...ownedElsewhere(NODE_IMAGE_DEPENDENCIES),\n ...ownedElsewhere(ADOT_IMAGE_DEPENDENCIES),\n ...ownedElsewhere(CODE_PACKAGE_DEPENDENCIES),\n ],\n py: ownedElsewhere(AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES),\n});\n\nexport const TS_AGENT_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsAgentGenerator = async (\n tree: Tree,\n options: TsAgentGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n if (!tree.exists(joinPathFragments(project.root, 'tsconfig.json'))) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a TypeScript project (with a tsconfig.json)`,\n );\n }\n\n const defaultName = `${kebabCase(project.name.split('/').pop())}-agent`;\n const name = kebabCase(options.name || defaultName);\n const agentNameClassName = toClassName(name);\n const agentTargetPrefix = options.name ? name : 'agent';\n const targetSourceDirRelativeToProjectRoot = joinPathFragments(\n 'src',\n agentTargetPrefix,\n );\n const targetSourceDir = joinPathFragments(\n project.root,\n targetSourceDirRelativeToProjectRoot,\n );\n const relativeSourceDir = targetSourceDir.replace(project.root + '/', './');\n const distDir = joinPathFragments('dist', project.root);\n\n const infra = options.infra ?? 'agentcore';\n const protocol = options.protocol ?? 'http';\n\n // Recorded in the metadata below so the version sync can tell a CDK\n // project from a Terraform one; undefined when no infrastructure was\n // generated, in which case neither provider's packages were added.\n const iac =\n infra !== 'none' ? await resolveIac(tree, options.iac) : undefined;\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n const session = options.session ?? 's3';\n\n if (infra === 'none' && session !== 'in-memory') {\n console.warn(\n 'Warning: session is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n // Local-dev session storage lives at the workspace root\n // (`tmp/agents/strands/<agent-name>`), not inside the project, so each agent\n // gets its own storage directory. The `-dev`/`-serve` targets run with\n // cwd={projectRoot}, so compute that directory relative to the project root\n // here rather than resolving it at runtime (e.g. via import.meta.url),\n // which would need an extra runtime helper.\n const localSessionsDir = joinPathFragments(\n getRelativePathToRootByDirectory(project.root),\n `tmp/agents/strands/${name}`,\n );\n\n // Ensure the shared agent-connection project exists so the server entry\n // point can import `runWithSessionId` and propagate the AgentCore session\n // ID to any downstream MCP / A2A clients a later connection generator\n // wires into this agent.\n await ensureTypeScriptAgentConnectionProject(tree, DEPENDENCIES);\n // The agent server imports the framework base helpers (session cache + model\n // error logging) regardless of whether a connection client is wired in.\n await addTypeScriptFrameworkBase(tree, DEPENDENCIES);\n\n const templateContext = {\n name,\n agentNameClassName,\n distDir,\n protocol,\n session,\n localSessionsDir,\n agentConnectionImport: `@${getNpmScope(tree)}/agent-connection`,\n ...esmVars(tree),\n };\n\n // Generate common files shared by both protocols\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Generate protocol-specific files\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', protocol.toLowerCase()),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // AG-UI and A2A both mount an Express app and share the same session-id\n // middleware; HTTP relies on tRPC's createContext instead and has no\n // Express dependency to support it.\n if (protocol === 'ag-ui' || protocol === 'a2a') {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common-express'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n if (isAgentCoreHosted(infra)) {\n const container = isContainerHosted(infra);\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n await addTypeScriptBundleTarget(\n tree,\n project,\n {\n targetFilePath: `${targetSourceDirRelativeToProjectRoot}/index.ts`,\n bundleOutputDir: joinPathFragments('agent', name),\n },\n DEPENDENCIES,\n );\n\n const bundleOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'bundle',\n 'agent',\n name,\n );\n\n let artifact: AgentCoreArtifact;\n\n if (container) {\n // Add the Dockerfile\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'deploy'),\n targetSourceDir,\n {\n distDir,\n name,\n protocol,\n adotVersion:\n TS_VERSIONS[\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation'\n ],\n jaegerVersion: TS_VERSIONS['@opentelemetry/propagator-jaeger'],\n nodeBaseImage: BASE_IMAGES.node,\n ...nodeImageVersions(),\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const dockerTargetName = `${agentTargetPrefix}-docker`;\n\n const fs = new FsCommands(tree, DEPENDENCIES);\n project.targets[dockerTargetName] = normalizeTargetKeyOrder({\n cache: IMAGE_BUILD_CACHE,\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.cpFile(\n `${targetSourceDir}/Dockerfile`,\n `${bundleOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${bundleOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle'],\n });\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addArtifactDependencyToTargets(project, 'docker');\n\n addDockerScanTarget(\n tree,\n {\n project,\n containerEngine: containers,\n trivyTargetName: `${agentTargetPrefix}-trivy`,\n dockerTargetName,\n imageTags: [dockerImageTag],\n },\n DEPENDENCIES,\n );\n\n artifact = {\n type: 'container',\n dockerImageTag,\n outputDir: bundleOutputDir,\n };\n } else {\n const packageOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'package',\n 'agent',\n name,\n );\n addTypeScriptCodePackageTarget(\n tree,\n {\n project,\n targetName: `${agentTargetPrefix}-package`,\n bundleTargetName: 'bundle',\n bundleOutputDir,\n packageOutputDir,\n },\n DEPENDENCIES,\n );\n\n artifact = {\n type: 'code',\n outputDir: packageOutputDir,\n runtime: agentCoreNodeRuntime(),\n entryPoint: 'index.js',\n };\n }\n\n // Add shared constructs\n await sharedConstructsGenerator(tree, { iac }, DEPENDENCIES);\n\n // AG-UI uses HTTP as the AgentCore protocol type (AG-UI is HTTP-based with SSE over POST).\n const infraProtocol: 'http' | 'a2a' =\n protocol === 'ag-ui' ? 'http' : (protocol as 'http' | 'a2a');\n\n await addAgentInfra(tree, {\n agentNameKebabCase: name,\n agentNameClassName,\n projectName: project.name,\n artifact,\n iac,\n auth,\n session,\n serverProtocol: infraProtocol,\n containers,\n });\n }\n\n // A2A servers use port 9000 as per the Strands A2A SDK default and AgentCore A2A contract.\n // HTTP and AG-UI agents use port 8081+ to avoid conflict with VS Code server on 8080.\n const localDevPortStart = protocol === 'a2a' ? 9000 : 8081;\n const localDevPort = assignPort(tree, project, localDevPortStart, {\n component: { info: TS_AGENT_GENERATOR_INFO, name: agentTargetPrefix },\n });\n\n // Recorded below and read by the declaration's predicates, so the packages\n // added here are exactly the ones the version sync will own.\n const metadata: TsAgentMetadata = {\n infra,\n port: localDevPort,\n rc: agentNameClassName,\n auth,\n protocol,\n session,\n ...(iac ? { iac } : {}),\n };\n\n addTsDependencies(tree, DEPENDENCIES, {\n metadata,\n projectRoot: project.root,\n });\n\n // Every protocol gets a standalone `chat.ts`. It connects to the local\n // `dev` server by default, or to the deployed agent (with the\n // appropriate auth) when `RUNTIME_CONFIG_APP_ID` is set.\n const scriptsDir = joinPathFragments(\n project.root,\n 'scripts',\n agentTargetPrefix,\n );\n addAgentChatScripts(tree, {\n scriptsDir,\n protocol,\n language: 'ts',\n agentNameClassName,\n auth,\n relativeAgentImport: `../../${targetSourceDirRelativeToProjectRoot}`,\n });\n\n const chatUrl =\n protocol === 'http'\n ? `ws://localhost:${localDevPort}/ws`\n : protocol === 'ag-ui'\n ? `http://localhost:${localDevPort}/invocations`\n : `http://localhost:${localDevPort}`;\n const chatCommand = `tsx ./scripts/${agentTargetPrefix}/chat.ts`;\n\n const agentTargets = {\n ...project.targets,\n [`${agentTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/index.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${agentTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/index.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${agentTargetPrefix}-chat`]: {\n executor: 'nx:run-commands',\n options: {\n commands: [chatCommand],\n cwd: '{projectRoot}',\n env: {\n URL: chatUrl,\n },\n },\n },\n };\n\n // Aggregate `<agent>-dev` under the project-level `dev` target.\n addComponentDevTarget(agentTargets, `${agentTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n // Sort targets so their order is stable regardless of insertion order on\n // first run vs re-run.\n targets: sortObjectKeys(agentTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_AGENT_GENERATOR_INFO,\n targetSourceDirRelativeToProjectRoot,\n agentTargetPrefix,\n metadata,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [TS_AGENT_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsAgentGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","addTsDependencies","addAgentChatScripts","AGENT_CONNECTION_DEPENDENCIES","addTypeScriptFrameworkBase","ensureTypeScriptAgentConnectionProject","AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES","addAgentInfra","addTypeScriptCodePackageTarget","agentCoreNodeRuntime","CODE_PACKAGE_DEPENDENCIES","isAgentCoreHosted","isContainerHosted","addTypeScriptBundleTarget","BUNDLE_DEPENDENCIES","resolveContainers","declareDependencies","ownedElsewhere","ADOT_IMAGE_DEPENDENCIES","addDockerScanTarget","DOCKER_DEPENDENCIES","IMAGE_BUILD_CACHE","NODE_IMAGE_DEPENDENCIES","nodeImageVersions","formatFilesInSubtree","FS_DEPENDENCIES","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","toClassName","getNpmScope","addArtifactDependencyToTargets","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","normalizeTargetKeyOrder","readProjectConfigurationUnqualified","sortObjectKeys","getRelativePathToRootByDirectory","assignPort","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","BASE_IMAGES","TS_VERSIONS","DEPENDENCIES","ts","name","when","m","session","protocol","auth","dev","root","py","TS_AGENT_GENERATOR_INFO","filename","tsAgentGenerator","tree","options","project","exists","Error","defaultName","split","pop","agentNameClassName","agentTargetPrefix","targetSourceDirRelativeToProjectRoot","targetSourceDir","relativeSourceDir","replace","distDir","infra","iac","undefined","console","warn","localSessionsDir","templateContext","agentConnectionImport","dirname","overwriteStrategy","KeepExisting","toLowerCase","container","containers","dockerImageTag","targetFilePath","bundleOutputDir","artifact","adotVersion","jaegerVersion","nodeBaseImage","node","dockerTargetName","fs","targets","cache","executor","commands","cpFile","parallel","dependsOn","containerEngine","trivyTargetName","imageTags","type","outputDir","packageOutputDir","targetName","bundleTargetName","runtime","entryPoint","infraProtocol","agentNameKebabCase","projectName","serverProtocol","localDevPortStart","localDevPort","component","info","metadata","port","rc","projectRoot","scriptsDir","language","relativeAgentImport","chatUrl","chatCommand","agentTargets","continuous","cwd","env","PORT","LOCAL_DEV","URL","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SACEC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,sCAAsC,QACjC,mDAAmD;AAC1D,SACEC,qCAAqC,EAErCC,aAAa,QACR,6DAA6D;AACpE,SACEC,8BAA8B,EAC9BC,oBAAoB,EACpBC,yBAAyB,EACzBC,iBAAiB,EACjBC,iBAAiB,QACZ,sCAAsC;AAC7C,SACEC,yBAAyB,EACzBC,mBAAmB,QACd,+BAA+B;AACtC,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAuC;AAC9C,SACEC,uBAAuB,EACvBC,mBAAmB,EACnBC,mBAAmB,EACnBC,iBAAiB,EACjBC,uBAAuB,EACvBC,iBAAiB,QACZ,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,eAAe,EAAEC,UAAU,QAAQ,oBAAoB;AAChE,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAuB;AAC9D,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,EAEhBC,uBAAuB,EACvBC,mCAAmC,QAC9B,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,gCAAgC,QAAQ,uBAAuB;AACxE,SAAS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Q+E,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAelF,iBAAiB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/agent/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { addAgentChatScripts } from '../../utils/agent-chat/agent-chat.js';\nimport {\n AGENT_CONNECTION_DEPENDENCIES,\n addTypeScriptFrameworkBase,\n ensureTypeScriptAgentConnectionProject,\n} from '../../utils/agent-connection/agent-connection.js';\nimport {\n AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES,\n type AgentCoreArtifact,\n addAgentInfra,\n} from '../../utils/agent-core-constructs/agent-core-constructs.js';\nimport {\n addTypeScriptCodePackageTarget,\n agentCoreNodeRuntime,\n CODE_PACKAGE_DEPENDENCIES,\n isAgentCoreHosted,\n isContainerHosted,\n} from '../../utils/agent-core-packaging.js';\nimport {\n addTypeScriptBundleTarget,\n BUNDLE_DEPENDENCIES,\n} from '../../utils/bundle/bundle.js';\nimport { resolveContainers } from '../../utils/containers.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport {\n ADOT_IMAGE_DEPENDENCIES,\n addDockerScanTarget,\n DOCKER_DEPENDENCIES,\n IMAGE_BUILD_CACHE,\n NODE_IMAGE_DEPENDENCIES,\n nodeImageVersions,\n} from '../../utils/docker.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { FS_DEPENDENCIES, FsCommands } from '../../utils/fs.js';\nimport { resolveIac } from '../../utils/iac.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { esmVars } from '../../utils/module-format.js';\nimport { kebabCase, toClassName } from '../../utils/names.js';\nimport { getNpmScope } from '../../utils/npm-scope.js';\nimport {\n addArtifactDependencyToTargets,\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n normalizeTargetKeyOrder,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getRelativePathToRootByDirectory } from '../../utils/paths.js';\nimport { assignPort } from '../../utils/port.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs.js';\nimport type { IacMetadata } from '../../utils/shared-constructs-constants.js';\nimport { BASE_IMAGES, TS_VERSIONS } from '../../utils/versions.js';\nimport type { TsAgentGeneratorSchema, TsAgentInfra } from './schema';\n\n/** The metadata this generator records, which its predicates read. */\nexport interface TsAgentMetadata extends IacMetadata {\n readonly port: number;\n readonly rc: string;\n readonly auth: string;\n readonly protocol: string;\n readonly session: string;\n /**\n * How this component is packaged and hosted, so a consumer can tell a\n * code-packaged runtime from a container-packaged one without re-deriving it.\n */\n readonly infra: TsAgentInfra;\n}\n\n// Each entry names the branch it belongs to, so the same declaration drives both\n// adding and the version sync.\nexport const DEPENDENCIES = declareDependencies<TsAgentMetadata>()({\n ts: [\n { name: 'zod' },\n { name: '@strands-agents/sdk' },\n { name: '@aws-sdk/credential-providers' },\n { name: '@aws-sdk/client-appconfigdata' },\n { name: '@aws-lambda-powertools/parameters' },\n { name: '@modelcontextprotocol/sdk' },\n // @aws-sdk/client-s3 is one of @strands-agents/sdk's peers in\n // STRANDS_PEER_DEPENDENCY_NAMES, but this project only actually uses S3\n // when session storage is backed by it — an in-memory session installs\n // no S3 client at all (see generator.spec.ts's \"should not add the\n // @aws-sdk/client-s3 dependency when session is in-memory\"). That is a\n // deliberate, tested exception to the peer rule for this one site; the\n // in-memory branch does not reach pnpm's peer-suffixing bug because no\n // other project in a workspace with only in-memory agents declares\n // client-s3 at a floating version either.\n { name: '@aws-sdk/client-s3', when: (m) => m.session === 's3' },\n // express is strands' optional peer (see STRANDS_PEER_DEPENDENCY_NAMES);\n // pnpm suffixes a package by its resolved peer versions, so leaving it\n // undeclared on a protocol that doesn't use express can resolve a\n // different express than every other importer and split\n // @strands-agents/sdk into two instances. Declared unconditionally,\n // matching @strands-agents/sdk itself.\n { name: 'express' },\n // strands' required peer (see STRANDS_PEER_DEPENDENCY_NAMES), pinned so\n // it doesn't float to its latest.\n { name: '@modelcontextprotocol/client' },\n { name: '@a2a-js/sdk', when: (m) => m.protocol === 'a2a' },\n { name: '@ag-ui/aws-strands', when: (m) => m.protocol === 'ag-ui' },\n // @ag-ui/aws-strands declares these as peer dependencies but statically\n // imports them, so they must be installed for the bundler to inline them.\n { name: '@ag-ui/a2ui-toolkit', when: (m) => m.protocol === 'ag-ui' },\n { name: '@ag-ui/client', when: (m) => m.protocol === 'ag-ui' },\n { name: '@ag-ui/core', when: (m) => m.protocol === 'ag-ui' },\n { name: '@ag-ui/encoder', when: (m) => m.protocol === 'ag-ui' },\n { name: '@trpc/server', when: (m) => m.protocol === 'http' },\n { name: '@trpc/client', when: (m) => m.protocol === 'http' },\n { name: 'ws', when: (m) => m.protocol === 'http' },\n { name: 'cors', when: (m) => m.protocol !== 'a2a' },\n { name: 'aws4fetch', when: (m) => m.protocol === 'http' },\n { name: 'aws4fetch', when: (m) => m.auth === 'iam', dev: true },\n {\n name: '@aws-sdk/credential-providers',\n when: (m) => m.auth === 'iam',\n dev: true,\n },\n { name: '@types/node', dev: true },\n // The chat CLI runs standalone via tsx and resolves the deployed agent from\n // AppConfig when `RUNTIME_CONFIG_APP_ID` is set.\n { name: 'agent-chat-cli', dev: true },\n { name: '@aws-lambda-powertools/parameters', dev: true },\n { name: '@aws-sdk/client-appconfigdata', dev: true },\n // A2A chat builds a signed @a2a-js client factory for the deployed agent.\n { name: '@a2a-js/sdk', when: (m) => m.protocol === 'a2a', dev: true },\n { name: '@types/express', when: (m) => m.protocol !== 'http', dev: true },\n { name: '@types/ws', when: (m) => m.protocol === 'http', dev: true },\n { name: '@types/cors', dev: true },\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(AGENT_CONNECTION_DEPENDENCIES),\n ...ownedElsewhere(BUNDLE_DEPENDENCIES),\n ...ownedElsewhere(FS_DEPENDENCIES),\n ...ownedElsewhere(DOCKER_DEPENDENCIES),\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ...ownedElsewhere(NODE_IMAGE_DEPENDENCIES),\n ...ownedElsewhere(ADOT_IMAGE_DEPENDENCIES),\n ...ownedElsewhere(CODE_PACKAGE_DEPENDENCIES),\n ],\n py: ownedElsewhere(AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES),\n});\n\nexport const TS_AGENT_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsAgentGenerator = async (\n tree: Tree,\n options: TsAgentGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n if (!tree.exists(joinPathFragments(project.root, 'tsconfig.json'))) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a TypeScript project (with a tsconfig.json)`,\n );\n }\n\n const defaultName = `${kebabCase(project.name.split('/').pop())}-agent`;\n const name = kebabCase(options.name || defaultName);\n const agentNameClassName = toClassName(name);\n const agentTargetPrefix = options.name ? name : 'agent';\n const targetSourceDirRelativeToProjectRoot = joinPathFragments(\n 'src',\n agentTargetPrefix,\n );\n const targetSourceDir = joinPathFragments(\n project.root,\n targetSourceDirRelativeToProjectRoot,\n );\n const relativeSourceDir = targetSourceDir.replace(project.root + '/', './');\n const distDir = joinPathFragments('dist', project.root);\n\n const infra = options.infra ?? 'agentcore';\n const protocol = options.protocol ?? 'http';\n\n // Recorded in the metadata below so the version sync can tell a CDK\n // project from a Terraform one; undefined when no infrastructure was\n // generated, in which case neither provider's packages were added.\n const iac =\n infra !== 'none' ? await resolveIac(tree, options.iac) : undefined;\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n const session = options.session ?? 's3';\n\n if (infra === 'none' && session !== 'in-memory') {\n console.warn(\n 'Warning: session is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n // Local-dev session storage lives at the workspace root\n // (`tmp/agents/strands/<agent-name>`), not inside the project, so each agent\n // gets its own storage directory. The `-dev`/`-serve` targets run with\n // cwd={projectRoot}, so compute that directory relative to the project root\n // here rather than resolving it at runtime (e.g. via import.meta.url),\n // which would need an extra runtime helper.\n const localSessionsDir = joinPathFragments(\n getRelativePathToRootByDirectory(project.root),\n `tmp/agents/strands/${name}`,\n );\n\n // Ensure the shared agent-connection project exists so the server entry\n // point can import `runWithSessionId` and propagate the AgentCore session\n // ID to any downstream MCP / A2A clients a later connection generator\n // wires into this agent.\n await ensureTypeScriptAgentConnectionProject(tree, DEPENDENCIES);\n // The agent server imports the framework base helpers (session cache + model\n // error logging) regardless of whether a connection client is wired in.\n await addTypeScriptFrameworkBase(tree, DEPENDENCIES);\n\n const templateContext = {\n name,\n agentNameClassName,\n distDir,\n protocol,\n session,\n localSessionsDir,\n agentConnectionImport: `@${getNpmScope(tree)}/agent-connection`,\n ...esmVars(tree),\n };\n\n // Generate common files shared by both protocols\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Generate protocol-specific files\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', protocol.toLowerCase()),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // AG-UI and A2A both mount an Express app and share the same session-id\n // middleware; HTTP relies on tRPC's createContext instead and has no\n // Express dependency to support it.\n if (protocol === 'ag-ui' || protocol === 'a2a') {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common-express'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n if (isAgentCoreHosted(infra)) {\n const container = isContainerHosted(infra);\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n await addTypeScriptBundleTarget(\n tree,\n project,\n {\n targetFilePath: `${targetSourceDirRelativeToProjectRoot}/index.ts`,\n bundleOutputDir: joinPathFragments('agent', name),\n },\n DEPENDENCIES,\n );\n\n const bundleOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'bundle',\n 'agent',\n name,\n );\n\n let artifact: AgentCoreArtifact;\n\n if (container) {\n // Add the Dockerfile\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'deploy'),\n targetSourceDir,\n {\n distDir,\n name,\n protocol,\n adotVersion:\n TS_VERSIONS[\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation'\n ],\n jaegerVersion: TS_VERSIONS['@opentelemetry/propagator-jaeger'],\n nodeBaseImage: BASE_IMAGES.node,\n ...nodeImageVersions(),\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const dockerTargetName = `${agentTargetPrefix}-docker`;\n\n const fs = new FsCommands(tree, DEPENDENCIES);\n project.targets[dockerTargetName] = normalizeTargetKeyOrder({\n cache: IMAGE_BUILD_CACHE,\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.cpFile(\n `${targetSourceDir}/Dockerfile`,\n `${bundleOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${bundleOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle'],\n });\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addArtifactDependencyToTargets(project, 'docker');\n\n addDockerScanTarget(\n tree,\n {\n project,\n containerEngine: containers,\n trivyTargetName: `${agentTargetPrefix}-trivy`,\n dockerTargetName,\n imageTags: [dockerImageTag],\n },\n DEPENDENCIES,\n );\n\n artifact = {\n type: 'container',\n dockerImageTag,\n outputDir: bundleOutputDir,\n };\n } else {\n const packageOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'package',\n 'agent',\n name,\n );\n addTypeScriptCodePackageTarget(\n tree,\n {\n project,\n targetName: `${agentTargetPrefix}-package`,\n bundleTargetName: 'bundle',\n bundleOutputDir,\n packageOutputDir,\n },\n DEPENDENCIES,\n );\n\n artifact = {\n type: 'code',\n outputDir: packageOutputDir,\n runtime: agentCoreNodeRuntime(),\n entryPoint: 'index.js',\n };\n }\n\n // Add shared constructs\n await sharedConstructsGenerator(tree, { iac }, DEPENDENCIES);\n\n // AG-UI uses HTTP as the AgentCore protocol type (AG-UI is HTTP-based with SSE over POST).\n const infraProtocol: 'http' | 'a2a' =\n protocol === 'ag-ui' ? 'http' : (protocol as 'http' | 'a2a');\n\n await addAgentInfra(tree, {\n agentNameKebabCase: name,\n agentNameClassName,\n projectName: project.name,\n artifact,\n iac,\n auth,\n session,\n serverProtocol: infraProtocol,\n containers,\n });\n }\n\n // A2A servers use port 9000 as per the Strands A2A SDK default and AgentCore A2A contract.\n // HTTP and AG-UI agents use port 8081+ to avoid conflict with VS Code server on 8080.\n const localDevPortStart = protocol === 'a2a' ? 9000 : 8081;\n const localDevPort = assignPort(tree, project, localDevPortStart, {\n component: { info: TS_AGENT_GENERATOR_INFO, name: agentTargetPrefix },\n });\n\n // Recorded below and read by the declaration's predicates, so the packages\n // added here are exactly the ones the version sync will own.\n const metadata: TsAgentMetadata = {\n infra,\n port: localDevPort,\n rc: agentNameClassName,\n auth,\n protocol,\n session,\n ...(iac ? { iac } : {}),\n };\n\n addTsDependencies(tree, DEPENDENCIES, {\n metadata,\n projectRoot: project.root,\n });\n\n // Every protocol gets a standalone `chat.ts`. It connects to the local\n // `dev` server by default, or to the deployed agent (with the\n // appropriate auth) when `RUNTIME_CONFIG_APP_ID` is set.\n const scriptsDir = joinPathFragments(\n project.root,\n 'scripts',\n agentTargetPrefix,\n );\n addAgentChatScripts(tree, {\n scriptsDir,\n protocol,\n language: 'ts',\n agentNameClassName,\n auth,\n relativeAgentImport: `../../${targetSourceDirRelativeToProjectRoot}`,\n });\n\n const chatUrl =\n protocol === 'http'\n ? `ws://localhost:${localDevPort}/ws`\n : protocol === 'ag-ui'\n ? `http://localhost:${localDevPort}/invocations`\n : `http://localhost:${localDevPort}`;\n const chatCommand = `tsx ./scripts/${agentTargetPrefix}/chat.ts`;\n\n const agentTargets = {\n ...project.targets,\n [`${agentTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/index.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${agentTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/index.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${agentTargetPrefix}-chat`]: {\n executor: 'nx:run-commands',\n options: {\n commands: [chatCommand],\n cwd: '{projectRoot}',\n env: {\n URL: chatUrl,\n },\n },\n },\n };\n\n // Aggregate `<agent>-dev` under the project-level `dev` target.\n addComponentDevTarget(agentTargets, `${agentTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n // Sort targets so their order is stable regardless of insertion order on\n // first run vs re-run.\n targets: sortObjectKeys(agentTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_AGENT_GENERATOR_INFO,\n targetSourceDirRelativeToProjectRoot,\n agentTargetPrefix,\n metadata,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [TS_AGENT_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsAgentGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","addTsDependencies","addAgentChatScripts","AGENT_CONNECTION_DEPENDENCIES","addTypeScriptFrameworkBase","ensureTypeScriptAgentConnectionProject","AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES","addAgentInfra","addTypeScriptCodePackageTarget","agentCoreNodeRuntime","CODE_PACKAGE_DEPENDENCIES","isAgentCoreHosted","isContainerHosted","addTypeScriptBundleTarget","BUNDLE_DEPENDENCIES","resolveContainers","declareDependencies","ownedElsewhere","ADOT_IMAGE_DEPENDENCIES","addDockerScanTarget","DOCKER_DEPENDENCIES","IMAGE_BUILD_CACHE","NODE_IMAGE_DEPENDENCIES","nodeImageVersions","formatFilesInSubtree","FS_DEPENDENCIES","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","toClassName","getNpmScope","addArtifactDependencyToTargets","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","normalizeTargetKeyOrder","readProjectConfigurationUnqualified","sortObjectKeys","getRelativePathToRootByDirectory","assignPort","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","BASE_IMAGES","TS_VERSIONS","DEPENDENCIES","ts","name","when","m","session","protocol","auth","dev","root","py","TS_AGENT_GENERATOR_INFO","filename","tsAgentGenerator","tree","options","project","exists","Error","defaultName","split","pop","agentNameClassName","agentTargetPrefix","targetSourceDirRelativeToProjectRoot","targetSourceDir","relativeSourceDir","replace","distDir","infra","iac","undefined","console","warn","localSessionsDir","templateContext","agentConnectionImport","dirname","overwriteStrategy","KeepExisting","toLowerCase","container","containers","dockerImageTag","targetFilePath","bundleOutputDir","artifact","adotVersion","jaegerVersion","nodeBaseImage","node","dockerTargetName","fs","targets","cache","executor","commands","cpFile","parallel","dependsOn","containerEngine","trivyTargetName","imageTags","type","outputDir","packageOutputDir","targetName","bundleTargetName","runtime","entryPoint","infraProtocol","agentNameKebabCase","projectName","serverProtocol","localDevPortStart","localDevPort","component","info","metadata","port","rc","projectRoot","scriptsDir","language","relativeAgentImport","chatUrl","chatCommand","agentTargets","continuous","cwd","env","PORT","LOCAL_DEV","URL","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SACEC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,sCAAsC,QACjC,mDAAmD;AAC1D,SACEC,qCAAqC,EAErCC,aAAa,QACR,6DAA6D;AACpE,SACEC,8BAA8B,EAC9BC,oBAAoB,EACpBC,yBAAyB,EACzBC,iBAAiB,EACjBC,iBAAiB,QACZ,sCAAsC;AAC7C,SACEC,yBAAyB,EACzBC,mBAAmB,QACd,+BAA+B;AACtC,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAuC;AAC9C,SACEC,uBAAuB,EACvBC,mBAAmB,EACnBC,mBAAmB,EACnBC,iBAAiB,EACjBC,uBAAuB,EACvBC,iBAAiB,QACZ,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,eAAe,EAAEC,UAAU,QAAQ,oBAAoB;AAChE,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAuB;AAC9D,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,6BAA6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,uBAAuB;QACvBqC,SAAS5D,eAAe8F;IAC1B;IAEAnG,8BACE0B,MACAE,QAAQd,IAAI,EACZS,yBACAa,sCACAD,mBACAuD;IAGF,MAAMjG,gCAAgCiC,MAAM;QAACH;KAAwB;IAErE,MAAMnC,qBAAqBsC;IAC3B,OAAO,IACLlC,oBAAoBkC,MAAMC,QAAQ+E,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAelF,iBAAiB"}
|
|
@@ -11,6 +11,8 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
11
11
|
readonly name: "@strands-agents/sdk";
|
|
12
12
|
}, {
|
|
13
13
|
readonly name: "express";
|
|
14
|
+
}, {
|
|
15
|
+
readonly name: "@modelcontextprotocol/client";
|
|
14
16
|
}, {
|
|
15
17
|
readonly name: "@aws-lambda-powertools/parameters";
|
|
16
18
|
}, {
|
|
@@ -40,7 +42,7 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
40
42
|
} & {
|
|
41
43
|
versionOnly: true;
|
|
42
44
|
}, ...({
|
|
43
|
-
name: "@aws-sdk/client-s3" | "@strands-agents/sdk" | "express";
|
|
45
|
+
name: "@aws-sdk/client-s3" | "@modelcontextprotocol/client" | "@strands-agents/sdk" | "express";
|
|
44
46
|
} & {
|
|
45
47
|
versionOnly: true;
|
|
46
48
|
})[]], readonly import("../../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "pydantic" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", Record<string, never>>[]>;
|
|
@@ -36,6 +36,10 @@ export const DEPENDENCIES = declareDependencies()({
|
|
|
36
36
|
{
|
|
37
37
|
name: 'express'
|
|
38
38
|
},
|
|
39
|
+
// strands' required peer, pinned for the same self-sufficiency.
|
|
40
|
+
{
|
|
41
|
+
name: '@modelcontextprotocol/client'
|
|
42
|
+
},
|
|
39
43
|
{
|
|
40
44
|
name: '@aws-lambda-powertools/parameters'
|
|
41
45
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/agent/mcp-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addTsDependencies } from '../../../utils/add-dependencies.js';\nimport {\n AGENT_CONNECTION_DEPENDENCIES,\n AGENT_CONNECTION_PROJECT_DIR,\n addTypeScriptClientToAgent,\n addTypeScriptCoreClient,\n ensureTypeScriptAgentConnectionProject,\n} from '../../../utils/agent-connection/agent-connection.js';\nimport { addDestructuredImport, addStarExport } from '../../../utils/ast.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { installDependencies } from '../../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics.js';\nimport { esmVars } from '../../../utils/module-format.js';\nimport { kebabCase } from '../../../utils/names.js';\nimport { getNpmScope } from '../../../utils/npm-scope.js';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx.js';\nimport { toProjectRelativePath } from '../../../utils/paths.js';\nimport type { TsAgentMcpConnectionGeneratorSchema } from './schema';\n\n// The MCP core client + vended client need these whatever the connection's\n// options, so no entry is conditional.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@modelcontextprotocol/sdk' },\n { name: '@strands-agents/sdk' },\n // express is strands' optional peer (see STRANDS_PEER_DEPENDENCY_NAMES in\n // agent-connection.ts). Declared here too, even though it is redundant\n // with ts#agent's own unconditional declaration on the same project, so\n // this generator is self-sufficient. @aws-sdk/client-s3, strands' other\n // required peer, is deliberately NOT added here: ts#agent only declares\n // it when session: 's3' (see generator.ts), and adding it unconditionally\n // from this connection would install an unused S3 client into an\n // in-memory-session agent — a user-visible change outside this fix's\n // scope.\n { name: 'express' },\n { name: '@aws-lambda-powertools/parameters' },\n { name: '@aws-sdk/client-appconfigdata' },\n { name: 'aws4fetch' },\n { name: '@aws-sdk/credential-providers' },\n ...ownedElsewhere(AGENT_CONNECTION_DEPENDENCIES),\n ],\n});\n\nexport const TS_AGENT_MCP_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsAgentMcpConnectionGenerator = async (\n tree: Tree,\n options: TsAgentMcpConnectionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentComponent = options.sourceComponent;\n const mcpComponent = options.targetComponent;\n\n if (!agentComponent || !mcpComponent) {\n throw new Error(\n 'Both sourceComponent and targetComponent must be provided for ts#agent -> mcp connections',\n );\n }\n\n if (mcpComponent.auth && mcpComponent.auth.toLowerCase() !== 'iam') {\n throw new Error(\n `MCP server connection currently only supports IAM authentication, but '${mcpComponent.name}' uses '${mcpComponent.auth}' authentication.`,\n );\n }\n\n const mcpComponentName = mcpComponent.name ?? 'mcp-server';\n const mcpServerClassName = mcpComponent.rc as string;\n const mcpServerKebabCase = kebabCase(mcpServerClassName);\n const mcpServerPort = mcpComponent.port ?? 8000;\n\n const npmScope = getNpmScope(tree);\n\n // 1. Ensure the shared agent-connection project exists + has the MCP core client\n await ensureTypeScriptAgentConnectionProject(tree, DEPENDENCIES);\n await addTypeScriptCoreClient(tree, 'mcp', DEPENDENCIES);\n\n // 2. Generate the per-connection <Name>Client into app/\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'agent-connection', 'app'),\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'app'),\n {\n mcpServerKebabCase,\n mcpServerClassName,\n mcpServerPort,\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Add re-export to index.ts\n await addStarExport(\n tree,\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'index.ts'),\n `./app/${mcpServerKebabCase}-client-strands.js`,\n );\n\n // 3. AST transform agent.ts to add MCP tools\n const agentSourceDir = joinPathFragments(\n sourceProject.root,\n agentComponent.path ?? 'src',\n );\n const agentFilePath = joinPathFragments(agentSourceDir, 'agent.ts');\n\n if (tree.exists(agentFilePath)) {\n const clientClassName = `${mcpServerClassName}ClientStrands`;\n const clientVarName =\n mcpServerClassName.charAt(0).toLowerCase() + mcpServerClassName.slice(1);\n\n // Add import for the client\n await addDestructuredImport(\n tree,\n agentFilePath,\n [clientClassName],\n `@${npmScope}/agent-connection`,\n );\n\n await addTypeScriptClientToAgent(\n tree,\n agentFilePath,\n clientClassName,\n clientVarName,\n );\n }\n\n // 4. Set up dev target\n const agentName = agentComponent.name ?? 'agent';\n const devTargetName = `${agentName}-dev`;\n const mcpDevTargetName = `${mcpComponentName}-dev`;\n\n if (sourceProject.targets?.[devTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTargetName, {\n projects: [targetProject.name],\n target: mcpDevTargetName,\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // 5. Add dependencies required by the MCP core client + vended client\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: sourceProject.root });\n\n // Recorded so the version sync knows this connection's dependencies are ours.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_AGENT_MCP_CONNECTION_GENERATOR_INFO,\n toProjectRelativePath(sourceProject, agentFilePath),\n mcpServerClassName,\n // The source component this connection is made from, so the pair is\n // identifiable rather than just the two projects.\n { sourcePath: options.sourceComponent?.path },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_AGENT_MCP_CONNECTION_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsAgentMcpConnectionGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","addTsDependencies","AGENT_CONNECTION_DEPENDENCIES","AGENT_CONNECTION_PROJECT_DIR","addTypeScriptClientToAgent","addTypeScriptCoreClient","ensureTypeScriptAgentConnectionProject","addDestructuredImport","addStarExport","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScope","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","toProjectRelativePath","DEPENDENCIES","ts","name","TS_AGENT_MCP_CONNECTION_GENERATOR_INFO","filename","tsAgentMcpConnectionGenerator","tree","options","sourceProject","targetProject","agentComponent","sourceComponent","mcpComponent","targetComponent","Error","auth","toLowerCase","mcpComponentName","mcpServerClassName","rc","mcpServerKebabCase","mcpServerPort","port","npmScope","dirname","overwriteStrategy","KeepExisting","agentSourceDir","root","path","agentFilePath","exists","clientClassName","clientVarName","charAt","slice","agentName","devTargetName","mcpDevTargetName","targets","projects","target","projectRoot","sourcePath","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAE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BAAmBgB,MAAM,CAAC,GAAGlB,WAAW,KAAKE,mBAAmBiB,KAAK,CAAC;QAExE,4BAA4B;QAC5B,MAAMlD,sBACJqB,MACAwB,eACA;YAACE;SAAgB,EACjB,CAAC,CAAC,EAAET,SAAS,iBAAiB,CAAC;QAGjC,MAAMzC,2BACJwB,MACAwB,eACAE,iBACAC;IAEJ;IAEA,uBAAuB;IACvB,MAAMG,YAAY1B,eAAeR,IAAI,IAAI;IACzC,MAAMmC,gBAAgB,GAAGD,UAAU,IAAI,CAAC;IACxC,MAAME,mBAAmB,GAAGrB,iBAAiB,IAAI,CAAC;IAElD,IAAIT,cAAc+B,OAAO,EAAE,CAACF,cAAc,EAAE;QAC1CzC,kCAAkCY,eAAe6B,eAAe;YAC9DG,UAAU;gBAAC/B,cAAcP,IAAI;aAAC;YAC9BuC,QAAQH;QACV;QACA5D,2BAA2B4B,MAAME,cAAcN,IAAI,EAAEM;IACvD;IAEA,sEAAsE;IACtE7B,kBAAkB2B,MAAMN,cAAc;QAAE0C,aAAalC,cAAcoB,IAAI;IAAC;IAExE,8EAA8E;IAC9EjC,8BACEW,MACAE,cAAcN,IAAI,EAClBC,wCACAJ,sBAAsBS,eAAesB,gBACrCZ,oBACA,oEAAoE;IACpE,kDAAkD;IAClD;QAAEyB,YAAYpC,QAAQI,eAAe,EAAEkB;IAAK;IAG9C,MAAMtC,gCAAgCe,MAAM;QAC1CH;KACD;IAED,MAAMd,qBAAqBiB;IAC3B,OAAO,IACLhB,oBAAoBgB,MAAMC,QAAQqC,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAexC,8BAA8B"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/agent/mcp-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addTsDependencies } from '../../../utils/add-dependencies.js';\nimport {\n AGENT_CONNECTION_DEPENDENCIES,\n AGENT_CONNECTION_PROJECT_DIR,\n addTypeScriptClientToAgent,\n addTypeScriptCoreClient,\n ensureTypeScriptAgentConnectionProject,\n} from '../../../utils/agent-connection/agent-connection.js';\nimport { addDestructuredImport, addStarExport } from '../../../utils/ast.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { installDependencies } from '../../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics.js';\nimport { esmVars } from '../../../utils/module-format.js';\nimport { kebabCase } from '../../../utils/names.js';\nimport { getNpmScope } from '../../../utils/npm-scope.js';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx.js';\nimport { toProjectRelativePath } from '../../../utils/paths.js';\nimport type { TsAgentMcpConnectionGeneratorSchema } from './schema';\n\n// The MCP core client + vended client need these whatever the connection's\n// options, so no entry is conditional.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@modelcontextprotocol/sdk' },\n { name: '@strands-agents/sdk' },\n // express is strands' optional peer (see STRANDS_PEER_DEPENDENCY_NAMES in\n // agent-connection.ts). Declared here too, even though it is redundant\n // with ts#agent's own unconditional declaration on the same project, so\n // this generator is self-sufficient. @aws-sdk/client-s3, strands' other\n // required peer, is deliberately NOT added here: ts#agent only declares\n // it when session: 's3' (see generator.ts), and adding it unconditionally\n // from this connection would install an unused S3 client into an\n // in-memory-session agent — a user-visible change outside this fix's\n // scope.\n { name: 'express' },\n // strands' required peer, pinned for the same self-sufficiency.\n { name: '@modelcontextprotocol/client' },\n { name: '@aws-lambda-powertools/parameters' },\n { name: '@aws-sdk/client-appconfigdata' },\n { name: 'aws4fetch' },\n { name: '@aws-sdk/credential-providers' },\n ...ownedElsewhere(AGENT_CONNECTION_DEPENDENCIES),\n ],\n});\n\nexport const TS_AGENT_MCP_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsAgentMcpConnectionGenerator = async (\n tree: Tree,\n options: TsAgentMcpConnectionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentComponent = options.sourceComponent;\n const mcpComponent = options.targetComponent;\n\n if (!agentComponent || !mcpComponent) {\n throw new Error(\n 'Both sourceComponent and targetComponent must be provided for ts#agent -> mcp connections',\n );\n }\n\n if (mcpComponent.auth && mcpComponent.auth.toLowerCase() !== 'iam') {\n throw new Error(\n `MCP server connection currently only supports IAM authentication, but '${mcpComponent.name}' uses '${mcpComponent.auth}' authentication.`,\n );\n }\n\n const mcpComponentName = mcpComponent.name ?? 'mcp-server';\n const mcpServerClassName = mcpComponent.rc as string;\n const mcpServerKebabCase = kebabCase(mcpServerClassName);\n const mcpServerPort = mcpComponent.port ?? 8000;\n\n const npmScope = getNpmScope(tree);\n\n // 1. Ensure the shared agent-connection project exists + has the MCP core client\n await ensureTypeScriptAgentConnectionProject(tree, DEPENDENCIES);\n await addTypeScriptCoreClient(tree, 'mcp', DEPENDENCIES);\n\n // 2. Generate the per-connection <Name>Client into app/\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'agent-connection', 'app'),\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'app'),\n {\n mcpServerKebabCase,\n mcpServerClassName,\n mcpServerPort,\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Add re-export to index.ts\n await addStarExport(\n tree,\n joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'src', 'index.ts'),\n `./app/${mcpServerKebabCase}-client-strands.js`,\n );\n\n // 3. AST transform agent.ts to add MCP tools\n const agentSourceDir = joinPathFragments(\n sourceProject.root,\n agentComponent.path ?? 'src',\n );\n const agentFilePath = joinPathFragments(agentSourceDir, 'agent.ts');\n\n if (tree.exists(agentFilePath)) {\n const clientClassName = `${mcpServerClassName}ClientStrands`;\n const clientVarName =\n mcpServerClassName.charAt(0).toLowerCase() + mcpServerClassName.slice(1);\n\n // Add import for the client\n await addDestructuredImport(\n tree,\n agentFilePath,\n [clientClassName],\n `@${npmScope}/agent-connection`,\n );\n\n await addTypeScriptClientToAgent(\n tree,\n agentFilePath,\n clientClassName,\n clientVarName,\n );\n }\n\n // 4. Set up dev target\n const agentName = agentComponent.name ?? 'agent';\n const devTargetName = `${agentName}-dev`;\n const mcpDevTargetName = `${mcpComponentName}-dev`;\n\n if (sourceProject.targets?.[devTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTargetName, {\n projects: [targetProject.name],\n target: mcpDevTargetName,\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // 5. Add dependencies required by the MCP core client + vended client\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: sourceProject.root });\n\n // Recorded so the version sync knows this connection's dependencies are ours.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_AGENT_MCP_CONNECTION_GENERATOR_INFO,\n toProjectRelativePath(sourceProject, agentFilePath),\n mcpServerClassName,\n // The source component this connection is made from, so the pair is\n // identifiable rather than just the two projects.\n { sourcePath: options.sourceComponent?.path },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_AGENT_MCP_CONNECTION_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsAgentMcpConnectionGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","addTsDependencies","AGENT_CONNECTION_DEPENDENCIES","AGENT_CONNECTION_PROJECT_DIR","addTypeScriptClientToAgent","addTypeScriptCoreClient","ensureTypeScriptAgentConnectionProject","addDestructuredImport","addStarExport","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScope","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","toProjectRelativePath","DEPENDENCIES","ts","name","TS_AGENT_MCP_CONNECTION_GENERATOR_INFO","filename","tsAgentMcpConnectionGenerator","tree","options","sourceProject","targetProject","agentComponent","sourceComponent","mcpComponent","targetComponent","Error","auth","toLowerCase","mcpComponentName","mcpServerClassName","rc","mcpServerKebabCase","mcpServerPort","port","npmScope","dirname","overwriteStrategy","KeepExisting","agentSourceDir","root","path","agentFilePath","exists","clientClassName","clientVarName","charAt","slice","agentName","devTargetName","mcpDevTargetName","targets","projects","target","projectRoot","sourcePath","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,iBAAiB,QAAQ,qCAAqC;AACvE,SACEC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,uBAAuB,EACvBC,sCAAsC,QACjC,sDAAsD;AAC7D,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,wBAAwB;AAC7E,SACEC,mBAAmB,EACnBC,cAAc,QACT,0CAA0C;AACjD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,+BAA+B,QAAQ,4BAA4B;AAC5E,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,SAAS,QAAQ,0BAA0B;AACpD,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SACEC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,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