@aws/nx-plugin 1.0.0-rc.22 → 1.0.0-rc.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-THIRD-PARTY +2088 -971
- package/package.json +25 -10
- package/src/agentcore-gateway/attach-upstream.d.ts +7 -7
- package/src/agentcore-gateway/attach-upstream.js +19 -22
- package/src/agentcore-gateway/attach-upstream.js.map +1 -1
- package/src/agentcore-gateway/gateway-connection/generator.d.ts +3 -3
- package/src/agentcore-gateway/gateway-connection/generator.js +42 -45
- package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -1
- package/src/agentcore-gateway/gateway-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/gateway-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/generator.js +89 -72
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-gateway/mcp-connection/generator.d.ts +2 -2
- package/src/agentcore-gateway/mcp-connection/generator.js +24 -30
- package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -1
- package/src/agentcore-gateway/mcp-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/mcp-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/schema.d.js +6 -0
- package/src/agentcore-gateway/schema.d.js.map +1 -0
- package/src/bin/aws-nx-mcp.js +14 -0
- package/src/bin/aws-nx-mcp.js.map +1 -0
- package/src/connection/{agent-serve-local.d.ts → agent-local-dev.d.ts} +5 -5
- package/src/connection/agent-local-dev.js +42 -0
- package/src/connection/agent-local-dev.js.map +1 -0
- package/src/connection/agent-runtime-config.js +9 -14
- package/src/connection/agent-runtime-config.js.map +1 -1
- package/src/connection/generator.js +262 -207
- package/src/connection/generator.js.map +1 -1
- package/src/connection/{serve-local.d.ts → local-dev.d.ts} +3 -3
- package/src/connection/local-dev.js +37 -0
- package/src/connection/local-dev.js.map +1 -0
- package/src/connection/schema.d.js +6 -0
- package/src/connection/schema.d.js.map +1 -0
- package/src/index.js +2 -5
- package/src/index.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +4 -26
- package/src/infra/app/generator.js +133 -123
- package/src/infra/app/generator.js.map +1 -1
- package/src/infra/app/schema.d.js +6 -0
- package/src/infra/app/schema.d.js.map +1 -0
- package/src/license/config-types.js +5 -3
- package/src/license/config-types.js.map +1 -1
- package/src/license/config.d.ts +1 -1
- package/src/license/config.js +267 -242
- package/src/license/config.js.map +1 -1
- package/src/license/dependency-check/check.js +51 -46
- package/src/license/dependency-check/check.js.map +1 -1
- package/src/license/dependency-check/collectors/collector.js +41 -71
- package/src/license/dependency-check/collectors/collector.js.map +1 -1
- package/src/license/dependency-check/collectors/npm-collector.js +34 -41
- package/src/license/dependency-check/collectors/npm-collector.js.map +1 -1
- package/src/license/dependency-check/collectors/python-collector.js +55 -62
- package/src/license/dependency-check/collectors/python-collector.js.map +1 -1
- package/src/license/dependency-check/evaluator.js +40 -68
- package/src/license/dependency-check/evaluator.js.map +1 -1
- package/src/license/dependency-check/executor.js +30 -22
- package/src/license/dependency-check/executor.js.map +1 -1
- package/src/license/dependency-check/pre-approved.js +949 -336
- package/src/license/dependency-check/pre-approved.js.map +1 -1
- package/src/license/dependency-check/types.js +2 -3
- package/src/license/dependency-check/types.js.map +1 -1
- package/src/license/generator.js +55 -60
- package/src/license/generator.js.map +1 -1
- package/src/license/index.js +3 -9
- package/src/license/index.js.map +1 -1
- package/src/license/known-exceptions.js +14 -13
- package/src/license/known-exceptions.js.map +1 -1
- package/src/license/schema.d.js +6 -0
- package/src/license/schema.d.js.map +1 -0
- package/src/license/sync/generator.js +94 -119
- package/src/license/sync/generator.js.map +1 -1
- package/src/license/sync/project-file-sync.js +28 -35
- package/src/license/sync/project-file-sync.js.map +1 -1
- package/src/mcp-server/generator-info.js +130 -160
- package/src/mcp-server/generator-info.js.map +1 -1
- package/src/mcp-server/guide-pipeline.js +184 -206
- package/src/mcp-server/guide-pipeline.js.map +1 -1
- package/src/mcp-server/guide-render.js +10 -25
- package/src/mcp-server/guide-render.js.map +1 -1
- package/src/mcp-server/index.js +6 -10
- package/src/mcp-server/index.js.map +1 -1
- package/src/mcp-server/mdx-ast.js +39 -57
- package/src/mcp-server/mdx-ast.js.map +1 -1
- package/src/mcp-server/option-filter.js +33 -47
- package/src/mcp-server/option-filter.js.map +1 -1
- package/src/mcp-server/schema-registry.js +27 -40
- package/src/mcp-server/schema-registry.js.map +1 -1
- package/src/mcp-server/schema.js +9 -7
- package/src/mcp-server/schema.js.map +1 -1
- package/src/mcp-server/server.js +20 -24
- package/src/mcp-server/server.js.map +1 -1
- package/src/mcp-server/tools/create-workspace-command.js +23 -24
- package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
- package/src/mcp-server/tools/general-guidance.js +28 -25
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/mcp-server/tools/generator-guide.js +29 -37
- package/src/mcp-server/tools/generator-guide.js.map +1 -1
- package/src/mcp-server/tools/list-generators.js +19 -25
- package/src/mcp-server/tools/list-generators.js.map +1 -1
- package/src/open-api/ts-client/generator.js +16 -26
- package/src/open-api/ts-client/generator.js.map +1 -1
- package/src/open-api/ts-client/schema.d.js +6 -0
- package/src/open-api/ts-client/schema.d.js.map +1 -0
- package/src/open-api/ts-hooks/generator.js +13 -21
- package/src/open-api/ts-hooks/generator.js.map +1 -1
- package/src/open-api/ts-hooks/schema.d.js +6 -0
- package/src/open-api/ts-hooks/schema.d.js.map +1 -0
- package/src/open-api/ts-metadata/generator.js +12 -20
- package/src/open-api/ts-metadata/generator.js.map +1 -1
- package/src/open-api/ts-metadata/schema.d.js +6 -0
- package/src/open-api/ts-metadata/schema.d.js.map +1 -0
- package/src/open-api/utils/codegen-data/languages.js +42 -60
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data/types.js +31 -30
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.js +253 -269
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +242 -241
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parse.js +8 -14
- package/src/open-api/utils/parse.js.map +1 -1
- package/src/open-api/utils/refs.js +12 -22
- package/src/open-api/utils/refs.js.map +1 -1
- package/src/open-api/utils/types.js +5 -2
- package/src/open-api/utils/types.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +31 -6
- package/src/preset/generator.d.ts +1 -1
- package/src/preset/generator.js +130 -112
- package/src/preset/generator.js.map +1 -1
- package/src/preset/schema.d.js +6 -0
- package/src/preset/schema.d.js.map +1 -0
- package/src/preset/schema.d.ts +0 -1
- package/src/preset/schema.json +0 -5
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +304 -0
- package/src/py/agent/__snapshots__/{generator.spec.ts.snap → generator.frameworks.spec.ts.snap} +18 -845
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +535 -0
- package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +1 -2
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +1 -1
- package/src/py/agent/a2a-connection/files/langchain/agent-connection/app/__targetAgentSnakeCase___client_langchain.py.template +1 -1
- package/src/py/agent/a2a-connection/generator.js +70 -75
- package/src/py/agent/a2a-connection/generator.js.map +1 -1
- package/src/py/agent/a2a-connection/schema.d.js +8 -0
- package/src/py/agent/a2a-connection/schema.d.js.map +1 -0
- package/src/py/agent/files/ag-ui-langchain/main.py.template +10 -0
- package/src/py/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +6 -8
- package/src/py/agent/gateway-connection/files/agent-connection/app/__gatewaySnakeCase___client_strands.py.template +3 -3
- package/src/py/agent/gateway-connection/files/langchain/agent-connection/app/__gatewaySnakeCase___client_langchain.py.template +3 -3
- package/src/py/agent/gateway-connection/generator.js +61 -58
- package/src/py/agent/gateway-connection/generator.js.map +1 -1
- package/src/py/agent/gateway-connection/schema.d.js +6 -0
- package/src/py/agent/gateway-connection/schema.d.js.map +1 -0
- package/src/py/agent/generator.js +227 -194
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +5 -12
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client_strands.py.template +1 -1
- package/src/py/agent/mcp-connection/files/langchain/agent-connection/app/__mcpServerSnakeCase___client_langchain.py.template +1 -1
- package/src/py/agent/mcp-connection/generator.js +53 -52
- package/src/py/agent/mcp-connection/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/schema.d.js +8 -0
- package/src/py/agent/mcp-connection/schema.d.js.map +1 -0
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +3 -2
- package/src/py/agent/react-connection/generator.js +51 -58
- package/src/py/agent/react-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/{serve-local.d.ts → local-dev.d.ts} +4 -4
- package/src/py/agent/react-connection/local-dev.js +36 -0
- package/src/py/agent/react-connection/local-dev.js.map +1 -0
- package/src/py/agent/react-connection/schema.d.js +8 -0
- package/src/py/agent/react-connection/schema.d.js.map +1 -0
- package/src/py/agent/schema.d.js +6 -0
- package/src/py/agent/schema.d.js.map +1 -0
- package/src/py/api/generator.js +12 -12
- package/src/py/api/generator.js.map +1 -1
- package/src/py/api/schema.d.js +6 -0
- package/src/py/api/schema.d.js.map +1 -0
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +68 -28
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/py/dynamodb/agent-connection/generator.js +27 -29
- package/src/py/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/py/dynamodb/agent-connection/schema.d.js +8 -0
- package/src/py/dynamodb/agent-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/dynamodb/fast-api-connection/generator.js +26 -28
- package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -1
- package/src/py/dynamodb/fast-api-connection/schema.d.js +8 -0
- package/src/py/dynamodb/fast-api-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/files/__name__/client.py.template +5 -5
- package/src/py/dynamodb/files/__name__/entities/base.py.template +2 -2
- package/src/py/dynamodb/files/config.json.template +1 -1
- package/src/py/dynamodb/generator.js +63 -62
- package/src/py/dynamodb/generator.js.map +1 -1
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/py/dynamodb/mcp-server-connection/generator.js +27 -29
- package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/py/dynamodb/mcp-server-connection/schema.d.js +8 -0
- package/src/py/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/schema.d.js +6 -0
- package/src/py/dynamodb/schema.d.js.map +1 -0
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +45 -4632
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +4833 -0
- package/src/py/fast-api/generator.js +79 -85
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/__snapshots__/generator.spec.ts.snap +3 -2
- package/src/py/fast-api/react/generator.js +22 -24
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/fast-api/react/open-api.js +28 -29
- package/src/py/fast-api/react/open-api.js.map +1 -1
- package/src/py/fast-api/react/schema.d.js +6 -0
- package/src/py/fast-api/react/schema.d.js.map +1 -0
- package/src/py/fast-api/schema.d.js +6 -0
- package/src/py/fast-api/schema.d.js.map +1 -0
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/lambda-function/generator.js +57 -58
- package/src/py/lambda-function/generator.js.map +1 -1
- package/src/py/lambda-function/schema.d.js +6 -0
- package/src/py/lambda-function/schema.d.js.map +1 -0
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/py/mcp-server/generator.js +149 -131
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/mcp-server/schema.d.js +6 -0
- package/src/py/mcp-server/schema.d.js.map +1 -0
- package/src/py/project/generator.d.ts +14 -1
- package/src/py/project/generator.js +137 -88
- package/src/py/project/generator.js.map +1 -1
- package/src/py/project/schema.d.js +6 -0
- package/src/py/project/schema.d.js.map +1 -0
- package/src/sdk/agentcore-gateway.d.ts +6 -0
- package/src/sdk/agentcore-gateway.js +7 -0
- package/src/sdk/agentcore-gateway.js.map +1 -0
- package/src/sdk/connection.d.ts +6 -0
- package/src/sdk/connection.js +6 -0
- package/src/sdk/connection.js.map +1 -0
- package/{sdk → src/sdk}/license.d.ts +4 -4
- package/src/sdk/license.js +7 -0
- package/src/sdk/license.js.map +1 -0
- package/src/sdk/open-api.d.ts +10 -0
- package/src/sdk/open-api.js +8 -0
- package/src/sdk/open-api.js.map +1 -0
- package/src/sdk/py.d.ts +14 -0
- package/src/sdk/py.js +10 -0
- package/src/sdk/py.js.map +1 -0
- package/src/sdk/terraform.d.ts +6 -0
- package/src/sdk/terraform.js +7 -0
- package/src/sdk/terraform.js.map +1 -0
- package/src/sdk/ts.d.ts +33 -0
- package/src/sdk/ts.js +35 -0
- package/src/sdk/ts.js.map +1 -0
- package/{sdk → src/sdk}/utils/ast.d.ts +2 -2
- package/src/sdk/utils/ast.js +7 -0
- package/src/sdk/utils/ast.js.map +1 -0
- package/{sdk → src/sdk}/utils/format.d.ts +1 -1
- package/src/sdk/utils/format.js +6 -0
- package/src/sdk/utils/format.js.map +1 -0
- package/{sdk → src/sdk}/utils/test.d.ts +1 -1
- package/src/sdk/utils/test.js +6 -0
- package/src/sdk/utils/test.js.map +1 -0
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +2 -8
- package/src/smithy/project/files/build.Dockerfile.template +1 -4
- package/src/smithy/project/generator.js +44 -42
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/project/schema.d.js +6 -0
- package/src/smithy/project/schema.d.js.map +1 -0
- package/src/smithy/react-connection/generator.js +35 -46
- package/src/smithy/react-connection/generator.js.map +1 -1
- package/src/smithy/react-connection/schema.d.js +6 -0
- package/src/smithy/react-connection/schema.d.js.map +1 -0
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +395 -72
- package/src/smithy/ts/api/generator.js +121 -111
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/smithy/ts/api/schema.d.js +6 -0
- package/src/smithy/ts/api/schema.d.js.map +1 -0
- package/src/terraform/project/files/application/src/providers.tf.template +1 -1
- package/src/terraform/project/generator.js +141 -103
- package/src/terraform/project/generator.js.map +1 -1
- package/src/terraform/project/schema.d.js +9 -0
- package/src/terraform/project/schema.d.js.map +1 -0
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +336 -92
- package/src/trpc/backend/generator.js +93 -86
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.d.js +6 -0
- package/src/trpc/backend/schema.d.js.map +1 -0
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/trpc/react/generator.js +59 -58
- package/src/trpc/react/generator.js.map +1 -1
- package/src/trpc/react/schema.d.js +6 -0
- package/src/trpc/react/schema.d.js.map +1 -0
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +11 -11
- package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client-strands.ts.template +1 -1
- package/src/ts/agent/a2a-connection/generator.js +58 -54
- package/src/ts/agent/a2a-connection/generator.js.map +1 -1
- package/src/ts/agent/a2a-connection/schema.d.js +8 -0
- package/src/ts/agent/a2a-connection/schema.d.js.map +1 -0
- package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/agent/gateway-connection/files/agent-connection/app/__gatewayKebabCase__-client-strands.ts.template +3 -3
- package/src/ts/agent/gateway-connection/generator.js +57 -52
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/gateway-connection/schema.d.js +6 -0
- package/src/ts/agent/gateway-connection/schema.d.js.map +1 -0
- package/src/ts/agent/generator.js +165 -136
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +1 -1
- package/src/ts/agent/mcp-connection/generator.js +48 -46
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/schema.d.js +8 -0
- package/src/ts/agent/mcp-connection/schema.d.js.map +1 -0
- package/src/ts/agent/react-connection/generator.js +79 -79
- package/src/ts/agent/react-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/{serve-local.d.ts → local-dev.d.ts} +2 -2
- package/src/ts/agent/react-connection/local-dev.js +17 -0
- package/src/ts/agent/react-connection/local-dev.js.map +1 -0
- package/src/ts/agent/react-connection/schema.d.js +8 -0
- package/src/ts/agent/react-connection/schema.d.js.map +1 -0
- package/src/ts/agent/schema.d.js +6 -0
- package/src/ts/agent/schema.d.js.map +1 -0
- package/src/ts/api/generator.js +16 -18
- package/src/ts/api/generator.js.map +1 -1
- package/src/ts/api/schema.d.js +6 -0
- package/src/ts/api/schema.d.js.map +1 -0
- package/src/ts/astro-docs/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/ts/astro-docs/generator.js +59 -48
- package/src/ts/astro-docs/generator.js.map +1 -1
- package/src/ts/astro-docs/schema.d.js +6 -0
- package/src/ts/astro-docs/schema.d.js.map +1 -0
- package/src/ts/docs/generator.js +10 -10
- package/src/ts/docs/generator.js.map +1 -1
- package/src/ts/docs/schema.d.js +6 -0
- package/src/ts/docs/schema.d.js.map +1 -0
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +68 -30
- package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/dynamodb/agent-connection/generator.js +21 -23
- package/src/ts/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/agent-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/agent-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/files/config.json.template +1 -1
- package/src/ts/dynamodb/files/src/client.ts.template +7 -7
- package/src/ts/dynamodb/generator.js +64 -63
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/dynamodb/mcp-server-connection/generator.js +21 -23
- package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/schema.d.js +6 -0
- package/src/ts/dynamodb/schema.d.js.map +1 -0
- package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/dynamodb/smithy-connection/generator.js +20 -22
- package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/smithy-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/smithy-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/trpc-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/dynamodb/trpc-connection/generator.js +20 -22
- package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/trpc-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/trpc-connection/schema.d.js.map +1 -0
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/lambda-function/generator.js +55 -55
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lambda-function/io.js +83 -52
- package/src/ts/lambda-function/io.js.map +1 -1
- package/src/ts/lambda-function/schema.d.js +6 -0
- package/src/ts/lambda-function/schema.d.js.map +1 -0
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +23 -36
- package/src/ts/lib/biome.js +37 -37
- package/src/ts/lib/biome.js.map +1 -1
- package/src/ts/lib/generator.js +75 -77
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/schema.d.js +6 -0
- package/src/ts/lib/schema.d.js.map +1 -0
- package/src/ts/lib/ts-project-utils.js +65 -70
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/types.js +5 -2
- package/src/ts/lib/types.js.map +1 -1
- package/src/ts/lib/vitest.js +29 -26
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/mcp-server/generator.js +157 -138
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/mcp-server/schema.d.js +6 -0
- package/src/ts/mcp-server/schema.d.js.map +1 -0
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +14 -9
- package/src/ts/nx-generator/files/local/generator.ts.template +3 -3
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.ts.template +4 -4
- package/src/ts/nx-generator/generator.js +84 -83
- package/src/ts/nx-generator/generator.js.map +1 -1
- package/src/ts/nx-generator/schema.d.js +6 -0
- package/src/ts/nx-generator/schema.d.js.map +1 -0
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +30 -18
- package/src/ts/nx-plugin/files/mcp-server/server.ts.template +5 -5
- package/src/ts/nx-plugin/files/mcp-server/tools/create-workspace-command.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/tools/general-guidance.ts.template +1 -1
- package/src/ts/nx-plugin/files/mcp-server/tools/generator-guide.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/tools/list-generators.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/utils.ts.template +3 -3
- package/src/ts/nx-plugin/generator.js +49 -48
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/nx-plugin/schema.d.js +9 -0
- package/src/ts/nx-plugin/schema.d.js.map +1 -0
- package/src/ts/nx-plugin/utils.js +32 -44
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +34 -30
- package/src/ts/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/rdb/agent-connection/generator.js +38 -39
- package/src/ts/rdb/agent-connection/generator.js.map +1 -1
- package/src/ts/rdb/agent-connection/schema.d.js +8 -0
- package/src/ts/rdb/agent-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/files/config.json.template +1 -1
- package/src/ts/rdb/files/prisma.config.ts.template +2 -2
- package/src/ts/rdb/files/src/prisma.ts.template +7 -7
- package/src/ts/rdb/files/src/utils.ts.template +3 -0
- package/src/ts/rdb/generator.js +130 -117
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/rdb/mcp-server-connection/generator.js +36 -37
- package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/schema.d.js +8 -0
- package/src/ts/rdb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/schema.d.js +6 -0
- package/src/ts/rdb/schema.d.js.map +1 -0
- package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/rdb/smithy-connection/generator.js +46 -43
- package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
- package/src/ts/rdb/smithy-connection/schema.d.js +8 -0
- package/src/ts/rdb/smithy-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/rdb/trpc-connection/generator.js +36 -31
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
- package/src/ts/rdb/trpc-connection/schema.d.js +8 -0
- package/src/ts/rdb/trpc-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/utils.js +9 -11
- package/src/ts/rdb/utils.js.map +1 -1
- package/src/ts/react-website/agui/generator.js +69 -61
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +179 -332
- package/src/ts/react-website/app/generator.js +197 -188
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/app/schema.d.js +6 -0
- package/src/ts/react-website/app/schema.d.js.map +1 -0
- package/src/ts/react-website/app/schema.json +6 -6
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +118 -4
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +27 -7
- package/src/ts/react-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +2 -2
- package/src/ts/react-website/cognito-auth/generator.js +60 -60
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/schema.d.js +6 -0
- package/src/ts/react-website/cognito-auth/schema.d.js.map +1 -0
- package/src/ts/react-website/cognito-auth/utils.js +34 -32
- package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
- package/src/ts/react-website/runtime-config/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/react-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +2 -2
- package/src/ts/react-website/runtime-config/generator.js +29 -31
- package/src/ts/react-website/runtime-config/generator.js.map +1 -1
- package/src/ts/react-website/runtime-config/schema.d.js +6 -0
- package/src/ts/react-website/runtime-config/schema.d.js.map +1 -0
- package/src/ts/sync/generator.js +60 -59
- package/src/ts/sync/generator.js.map +1 -1
- package/src/ts/website/app/generator.js +10 -10
- package/src/ts/website/app/generator.js.map +1 -1
- package/src/ts/website/app/schema.d.js +6 -0
- package/src/ts/website/app/schema.d.js.map +1 -0
- package/src/ts/website/app/schema.json +6 -6
- package/src/ts/website/auth/generator.js +11 -11
- package/src/ts/website/auth/generator.js.map +1 -1
- package/src/ts/website/auth/schema.d.js +6 -0
- package/src/ts/website/auth/schema.d.js.map +1 -0
- package/src/utils/agent-chat/agent-chat.d.ts +1 -1
- package/src/utils/agent-chat/agent-chat.js +11 -12
- package/src/utils/agent-chat/agent-chat.js.map +1 -1
- package/src/utils/agent-chat/files/a2a/chat.ts.template +1 -1
- package/src/utils/agent-chat/files/ag-ui/chat.ts.template +1 -1
- package/src/utils/agent-chat/files/http-py/chat.ts.template +1 -1
- package/src/utils/agent-chat/files/http-ts/chat.ts.template +1 -1
- package/src/utils/agent-connection/agent-connection.d.ts +9 -3
- package/src/utils/agent-connection/agent-connection.js +133 -147
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-connection/files/core-gateway/agentcore-gateway-mcp-transport.ts.template +1 -1
- package/src/utils/agent-connection/files/core-strands/gateway/agentcore-gateway-mcp-client-strands.ts.template +1 -1
- package/src/utils/agent-connection/files/py-core-gateway/agentcore_gateway_mcp_transport.py.template +1 -1
- package/src/utils/agent-connection/files/py-core-langchain/gateway/agentcore_gateway_mcp_client_langchain.py.template +1 -1
- package/src/utils/agent-connection/files/py-core-strands/gateway/agentcore_gateway_mcp_client_strands.py.template +1 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.js +53 -50
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +5 -5
- package/src/utils/agent-core-constructs/files/terraform/core/agentcore-gateway/gateway.tf.template +2 -2
- package/src/utils/api-constructs/api-constructs.js +30 -31
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +14 -6
- package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account/index.js.template +58 -0
- package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account.ts.template +82 -0
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +28 -14
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +1 -8
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +91 -4
- package/src/utils/api-constructs/files/terraform/core/api/http/http-api/http-api.tf.template +1 -1
- package/src/utils/api-constructs/files/terraform/core/api/rest/api-gateway-account/api-gateway-account.tf.template +83 -0
- package/src/utils/api-constructs/files/terraform/core/api/rest/rest-api/rest-api.tf.template +5 -11
- package/src/utils/api-constructs/open-api-metadata.js +22 -22
- package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
- package/src/utils/ast/website.js +17 -19
- package/src/utils/ast/website.js.map +1 -1
- package/src/utils/ast.js +72 -97
- package/src/utils/ast.js.map +1 -1
- package/src/utils/bundle/bundle.js +50 -47
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/commands.js +47 -26
- package/src/utils/commands.js.map +1 -1
- package/src/utils/config/index.d.ts +2 -2
- package/src/utils/config/index.js +5 -4
- package/src/utils/config/index.js.map +1 -1
- package/src/utils/config/utils.js +48 -58
- package/src/utils/config/utils.js.map +1 -1
- package/src/utils/connection/open-api/react.d.ts +5 -5
- package/src/utils/connection/open-api/react.js +81 -77
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/containers.js +22 -23
- package/src/utils/containers.js.map +1 -1
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js +32 -33
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -1
- package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +12 -2
- package/src/utils/dynamodb-constructs/files/terraform/core/dynamodb/dynamodb.tf.template +1 -1
- package/src/utils/files/common/scripts/src/dynamodb/create-local-table.ts.template +2 -2
- package/src/utils/files/common/scripts/src/dynamodb/pull-image.ts.template +1 -1
- package/src/utils/files/common/scripts/src/dynamodb/start-container.ts.template +17 -2
- package/src/utils/files/common/scripts/src/rdb/mysql/wait-for-mysql-db.ts.template +32 -0
- package/src/utils/files/common/scripts/src/rdb/postgres/wait-for-postgres-db.ts.template +32 -0
- package/src/utils/files/common/scripts/src/rdb/{pull-image.ts.template → shared/pull-image.ts.template} +1 -1
- package/src/utils/files/common/scripts/src/rdb/{start-container.ts.template → shared/start-container.ts.template} +16 -1
- package/src/utils/files/terraform/src/core/asset-bucket/asset-bucket.tf.template +2 -2
- package/src/utils/files/terraform/src/core/runtime-config/appconfig/appconfig.tf.template +1 -1
- package/src/utils/files/terraform/src/core/runtime-config/appconfig-deployment/appconfig-deployment.tf.template +3 -3
- package/src/utils/files/terraform/src/core/runtime-config/entry/entry.tf.template +1 -1
- package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +2 -2
- package/src/utils/files/website/hooks/sigv4/useSigV4.tsx.template +1 -1
- package/src/utils/format.js +153 -99
- package/src/utils/format.js.map +1 -1
- package/src/utils/fs.js +14 -13
- package/src/utils/fs.js.map +1 -1
- package/src/utils/function-constructs/files/terraform/app/lambda-functions/__nameKebabCase__/__nameKebabCase__.tf.template +2 -2
- package/src/utils/function-constructs/function-constructs.js +21 -26
- package/src/utils/function-constructs/function-constructs.js.map +1 -1
- package/src/utils/generators.js +18 -20
- package/src/utils/generators.js.map +1 -1
- package/src/utils/git.js +19 -34
- package/src/utils/git.js.map +1 -1
- package/src/utils/iac-providers.js +5 -5
- package/src/utils/iac-providers.js.map +1 -1
- package/src/utils/iac.js +12 -14
- package/src/utils/iac.js.map +1 -1
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +112 -2
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +19 -6
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +104 -2
- package/src/utils/identity-constructs/files/terraform/core/user-identity/main.tf.template +7 -0
- package/src/utils/identity-constructs/identity-constructs.js +24 -28
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/js.js +27 -20
- package/src/utils/js.js.map +1 -1
- package/src/utils/mcp.js +34 -41
- package/src/utils/mcp.js.map +1 -1
- package/src/utils/metrics.js +30 -45
- package/src/utils/metrics.js.map +1 -1
- package/src/utils/mock-project-graph.js +8 -12
- package/src/utils/mock-project-graph.js.map +1 -1
- package/src/utils/names.d.ts +16 -0
- package/src/utils/names.js +39 -48
- package/src/utils/names.js.map +1 -1
- package/src/utils/npm-scope.js +9 -17
- package/src/utils/npm-scope.js.map +1 -1
- package/src/utils/nx.d.ts +18 -2
- package/src/utils/nx.js +111 -74
- package/src/utils/nx.js.map +1 -1
- package/src/utils/nxlv-python.js +27 -15
- package/src/utils/nxlv-python.js.map +1 -1
- package/src/utils/object.js +5 -11
- package/src/utils/object.js.map +1 -1
- package/src/utils/paths.js +11 -15
- package/src/utils/paths.js.map +1 -1
- package/src/utils/pkg-manager.js +4 -9
- package/src/utils/pkg-manager.js.map +1 -1
- package/src/utils/pnpm-workspace.js +22 -22
- package/src/utils/pnpm-workspace.js.map +1 -1
- package/src/utils/port.js +26 -36
- package/src/utils/port.js.map +1 -1
- package/src/utils/py.d.ts +14 -1
- package/src/utils/py.js +63 -45
- package/src/utils/py.js.map +1 -1
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
- package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +3 -3
- package/src/utils/rdb-constructs/rdb-constructs.js +31 -33
- package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
- package/src/utils/shared-constructs-constants.js +16 -16
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.js +57 -54
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.js +16 -14
- package/src/utils/shared-dynamodb-scripts.js.map +1 -1
- package/src/utils/shared-infra-config.js +30 -31
- package/src/utils/shared-infra-config.js.map +1 -1
- package/src/utils/shared-infra-scripts.js +30 -25
- package/src/utils/shared-infra-scripts.js.map +1 -1
- package/src/utils/shared-rdb-scripts.d.ts +8 -3
- package/src/utils/shared-rdb-scripts.js +21 -13
- package/src/utils/shared-rdb-scripts.js.map +1 -1
- package/src/utils/shared-scripts.js +12 -17
- package/src/utils/shared-scripts.js.map +1 -1
- package/src/utils/shared-shadcn.js +64 -60
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/test.d.ts +8 -0
- package/src/utils/test.js +33 -25
- package/src/utils/test.js.map +1 -1
- package/src/utils/toml.js +7 -15
- package/src/utils/toml.js.map +1 -1
- package/src/utils/versions.d.ts +31 -4
- package/src/utils/versions.js +40 -23
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/terraform/app/static-websites/__websiteNameKebabCase__/__websiteNameKebabCase__.tf.template +1 -1
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +4 -4
- package/src/utils/website-constructs/website-constructs.js +31 -30
- package/src/utils/website-constructs/website-constructs.js.map +1 -1
- package/bin/aws-nx-mcp.js +0 -17
- package/bin/aws-nx-mcp.js.map +0 -1
- package/sdk/agentcore-gateway.d.ts +0 -6
- package/sdk/agentcore-gateway.js +0 -11
- package/sdk/agentcore-gateway.js.map +0 -1
- package/sdk/connection.d.ts +0 -6
- package/sdk/connection.js +0 -10
- package/sdk/connection.js.map +0 -1
- package/sdk/license.js +0 -14
- package/sdk/license.js.map +0 -1
- package/sdk/open-api.d.ts +0 -10
- package/sdk/open-api.js +0 -15
- package/sdk/open-api.js.map +0 -1
- package/sdk/py.d.ts +0 -14
- package/sdk/py.js +0 -18
- package/sdk/py.js.map +0 -1
- package/sdk/terraform.d.ts +0 -6
- package/sdk/terraform.js +0 -11
- package/sdk/terraform.js.map +0 -1
- package/sdk/ts.d.ts +0 -33
- package/sdk/ts.js +0 -53
- package/sdk/ts.js.map +0 -1
- package/sdk/utils/ast.js +0 -12
- package/sdk/utils/ast.js.map +0 -1
- package/sdk/utils/format.js +0 -10
- package/sdk/utils/format.js.map +0 -1
- package/sdk/utils/test.js +0 -10
- package/sdk/utils/test.js.map +0 -1
- package/src/connection/agent-serve-local.js +0 -48
- package/src/connection/agent-serve-local.js.map +0 -1
- package/src/connection/serve-local.js +0 -41
- package/src/connection/serve-local.js.map +0 -1
- package/src/py/agent/react-connection/serve-local.js +0 -38
- package/src/py/agent/react-connection/serve-local.js.map +0 -1
- package/src/ts/agent/react-connection/serve-local.js +0 -19
- package/src/ts/agent/react-connection/serve-local.js.map +0 -1
- package/src/utils/files/common/scripts/src/rdb/wait-for-db.ts.template +0 -59
- /package/src/agentcore-gateway/files/project/{serve-local.ts.template → local-dev.ts.template} +0 -0
- /package/{bin → src/bin}/aws-nx-mcp.d.ts +0 -0
package/src/py/agent/__snapshots__/{generator.spec.ts.snap → generator.frameworks.spec.ts.snap}
RENAMED
|
@@ -65,7 +65,7 @@ export const createAgentCoreFetch = (): typeof fetch => {
|
|
|
65
65
|
|
|
66
66
|
exports[`py#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with cognito auth > chat.ts (a2a, cognito) 1`] = `
|
|
67
67
|
"// Chat CLI for TestProjectAgent (A2A protocol). Connects to the local
|
|
68
|
-
// \`
|
|
68
|
+
// \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
69
69
|
import {
|
|
70
70
|
ClientFactory,
|
|
71
71
|
ClientFactoryOptions,
|
|
@@ -160,7 +160,7 @@ export const createAgentCoreFetch = (region: string): typeof fetch => {
|
|
|
160
160
|
|
|
161
161
|
exports[`py#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with iam auth > chat.ts (a2a, iam) 1`] = `
|
|
162
162
|
"// Chat CLI for TestProjectAgent (A2A protocol). Connects to the local
|
|
163
|
-
// \`
|
|
163
|
+
// \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
164
164
|
import {
|
|
165
165
|
ClientFactory,
|
|
166
166
|
ClientFactoryOptions,
|
|
@@ -260,7 +260,7 @@ export const createAgentCoreFetch = (): typeof fetch => {
|
|
|
260
260
|
|
|
261
261
|
exports[`py#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with cognito auth > chat.ts (ag-ui, cognito) 1`] = `
|
|
262
262
|
"// Chat CLI for TestProjectAgent (AG-UI protocol). Connects to the local
|
|
263
|
-
// \`
|
|
263
|
+
// \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
264
264
|
import { AGUIChatAdapter, chatLoop } from 'agent-chat-cli';
|
|
265
265
|
import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
|
|
266
266
|
|
|
@@ -337,7 +337,7 @@ export const createAgentCoreFetch = (region: string): typeof fetch => {
|
|
|
337
337
|
|
|
338
338
|
exports[`py#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with iam auth > chat.ts (ag-ui, iam) 1`] = `
|
|
339
339
|
"// Chat CLI for TestProjectAgent (AG-UI protocol). Connects to the local
|
|
340
|
-
// \`
|
|
340
|
+
// \`dev\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
341
341
|
import { AGUIChatAdapter, chatLoop } from 'agent-chat-cli';
|
|
342
342
|
import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
|
|
343
343
|
|
|
@@ -419,7 +419,7 @@ export const createAgentCoreFetch = (): typeof fetch => {
|
|
|
419
419
|
|
|
420
420
|
exports[`py#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with cognito auth > chat.ts (http, cognito) 1`] = `
|
|
421
421
|
"// Chat CLI for TestProjectAgent (Python FastAPI / JSONL streaming), using the
|
|
422
|
-
// generated client. Connects to the local \`
|
|
422
|
+
// generated client. Connects to the local \`dev\` server, or the deployed
|
|
423
423
|
// agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
424
424
|
import { chatLoop, type ChatAdapter } from 'agent-chat-cli';
|
|
425
425
|
import { TestProjectAgent } from './generated/client.gen.js';
|
|
@@ -524,7 +524,7 @@ export const createAgentCoreFetch = (region: string): typeof fetch => {
|
|
|
524
524
|
|
|
525
525
|
exports[`py#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with iam auth > chat.ts (http, iam) 1`] = `
|
|
526
526
|
"// Chat CLI for TestProjectAgent (Python FastAPI / JSONL streaming), using the
|
|
527
|
-
// generated client. Connects to the local \`
|
|
527
|
+
// generated client. Connects to the local \`dev\` server, or the deployed
|
|
528
528
|
// agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
529
529
|
import { chatLoop, type ChatAdapter } from 'agent-chat-cli';
|
|
530
530
|
import { TestProjectAgent } from './generated/client.gen.js';
|
|
@@ -614,6 +614,7 @@ from ag_ui.core import EventType, RunAgentInput, RunErrorEvent
|
|
|
614
614
|
from ag_ui.encoder import EventEncoder
|
|
615
615
|
from ag_ui_langgraph import LangGraphAgent
|
|
616
616
|
from fastapi import FastAPI, Request
|
|
617
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
617
618
|
from fastapi.responses import JSONResponse, StreamingResponse
|
|
618
619
|
from proj_agent_connection import get_current_session_id, session_id_context
|
|
619
620
|
from starlette.middleware.base import BaseHTTPMiddleware
|
|
@@ -643,6 +644,15 @@ class _SessionIdMiddleware(BaseHTTPMiddleware):
|
|
|
643
644
|
|
|
644
645
|
|
|
645
646
|
app = FastAPI(title="SnapshotAgent")
|
|
647
|
+
# Allow browser-based AG-UI clients (e.g. a connected React website) to call
|
|
648
|
+
# this agent cross-origin, including the CORS preflight.
|
|
649
|
+
app.add_middleware(
|
|
650
|
+
CORSMiddleware,
|
|
651
|
+
allow_origins=["*"],
|
|
652
|
+
allow_credentials=True,
|
|
653
|
+
allow_methods=["*"],
|
|
654
|
+
allow_headers=["*"],
|
|
655
|
+
)
|
|
646
656
|
app.add_middleware(_SessionIdMiddleware)
|
|
647
657
|
|
|
648
658
|
|
|
@@ -697,7 +707,7 @@ exports[`py#agent generator > langchain framework > should match snapshot for la
|
|
|
697
707
|
name = "proj.test_project"
|
|
698
708
|
version = "0.1.0"
|
|
699
709
|
dependencies = [
|
|
700
|
-
"proj
|
|
710
|
+
"proj-agent-connection",
|
|
701
711
|
"aws-lambda-powertools==3.29.0",
|
|
702
712
|
"aws-opentelemetry-distro==0.17.1",
|
|
703
713
|
"bedrock-agentcore==1.14.1",
|
|
@@ -718,844 +728,7 @@ dev = [ "fastapi[standard]==0.137.1" ]
|
|
|
718
728
|
[tool.uv]
|
|
719
729
|
dev-dependencies = [ ]
|
|
720
730
|
|
|
721
|
-
[tool.uv.sources.
|
|
722
|
-
workspace = true
|
|
723
|
-
"
|
|
724
|
-
`;
|
|
725
|
-
|
|
726
|
-
exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agent-Dockerfile 1`] = `
|
|
727
|
-
"FROM public.ecr.aws/docker/library/python:3.14-slim
|
|
728
|
-
|
|
729
|
-
WORKDIR /app
|
|
730
|
-
|
|
731
|
-
# Copy bundled package
|
|
732
|
-
COPY . /app
|
|
733
|
-
|
|
734
|
-
EXPOSE 8080
|
|
735
|
-
|
|
736
|
-
ENV PYTHONPATH=/app
|
|
737
|
-
ENV PATH="/app/bin:\${PATH}"
|
|
738
|
-
|
|
739
|
-
# Auto-instrument with AWS Distro for OpenTelemetry
|
|
740
|
-
# https://aws-otel.github.io/docs/getting-started/python-sdk/auto-instr
|
|
741
|
-
CMD ["python", "bin/opentelemetry-instrument", "python", "-m", "proj_test_project.snapshot_bedrock_agent.main"]
|
|
742
|
-
"
|
|
743
|
-
`;
|
|
744
|
-
|
|
745
|
-
exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agent-construct.ts 1`] = `
|
|
746
|
-
"import { Lazy, Names } from 'aws-cdk-lib';
|
|
747
|
-
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
|
|
748
|
-
import { Connections, IConnectable } from 'aws-cdk-lib/aws-ec2';
|
|
749
|
-
import { Construct } from 'constructs';
|
|
750
|
-
import * as path from 'path';
|
|
751
|
-
import * as url from 'url';
|
|
752
|
-
import {
|
|
753
|
-
AgentRuntimeArtifact,
|
|
754
|
-
ProtocolType,
|
|
755
|
-
Runtime,
|
|
756
|
-
RuntimeProps,
|
|
757
|
-
} from 'aws-cdk-lib/aws-bedrockagentcore';
|
|
758
|
-
import {
|
|
759
|
-
PolicyStatement,
|
|
760
|
-
IGrantable,
|
|
761
|
-
IPrincipal,
|
|
762
|
-
Grant,
|
|
763
|
-
} from 'aws-cdk-lib/aws-iam';
|
|
764
|
-
import { RuntimeConfig } from '../../../core/runtime-config.js';
|
|
765
|
-
import { findWorkspaceRoot } from '../../../core/workspace.js';
|
|
766
|
-
|
|
767
|
-
export type SnapshotBedrockAgentProps = Omit<
|
|
768
|
-
RuntimeProps,
|
|
769
|
-
| 'runtimeName'
|
|
770
|
-
| 'protocolConfiguration'
|
|
771
|
-
| 'agentRuntimeArtifact'
|
|
772
|
-
| 'authorizerConfiguration'
|
|
773
|
-
>;
|
|
774
|
-
|
|
775
|
-
export class SnapshotBedrockAgent
|
|
776
|
-
extends Construct
|
|
777
|
-
implements IGrantable, IConnectable
|
|
778
|
-
{
|
|
779
|
-
public readonly dockerImage: AgentRuntimeArtifact;
|
|
780
|
-
public readonly agentCoreRuntime: Runtime;
|
|
781
|
-
|
|
782
|
-
constructor(scope: Construct, id: string, props?: SnapshotBedrockAgentProps) {
|
|
783
|
-
super(scope, id);
|
|
784
|
-
|
|
785
|
-
const rc = RuntimeConfig.ensure(this);
|
|
786
|
-
|
|
787
|
-
// Resolve the bundle output directory containing the Dockerfile and built artifacts
|
|
788
|
-
const bundleDir = path.join(
|
|
789
|
-
findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
|
|
790
|
-
'dist/apps/test-project/docker/snapshot-bedrock-agent',
|
|
791
|
-
);
|
|
792
|
-
|
|
793
|
-
this.dockerImage = AgentRuntimeArtifact.fromAsset(bundleDir, {
|
|
794
|
-
platform: Platform.LINUX_ARM64,
|
|
795
|
-
});
|
|
796
|
-
|
|
797
|
-
this.agentCoreRuntime = new Runtime(this, 'SnapshotBedrockAgent', {
|
|
798
|
-
runtimeName: Lazy.string({
|
|
799
|
-
produce: () =>
|
|
800
|
-
Names.uniqueResourceName(this.agentCoreRuntime, { maxLength: 40 }),
|
|
801
|
-
}),
|
|
802
|
-
protocolConfiguration: ProtocolType.HTTP,
|
|
803
|
-
agentRuntimeArtifact: this.dockerImage,
|
|
804
|
-
...props,
|
|
805
|
-
environmentVariables: {
|
|
806
|
-
RUNTIME_CONFIG_APP_ID: rc.appConfigApplicationId,
|
|
807
|
-
...props?.environmentVariables,
|
|
808
|
-
},
|
|
809
|
-
});
|
|
810
|
-
|
|
811
|
-
// Grant access for the agent to invoke bedrock models
|
|
812
|
-
this.agentCoreRuntime.addToRolePolicy(
|
|
813
|
-
new PolicyStatement({
|
|
814
|
-
actions: [
|
|
815
|
-
'bedrock:InvokeModel',
|
|
816
|
-
'bedrock:InvokeModelWithResponseStream',
|
|
817
|
-
],
|
|
818
|
-
resources: [
|
|
819
|
-
'arn:aws:bedrock:*:*:foundation-model/*',
|
|
820
|
-
'arn:aws:bedrock:*:*:inference-profile/*',
|
|
821
|
-
],
|
|
822
|
-
}),
|
|
823
|
-
);
|
|
824
|
-
|
|
825
|
-
rc.grantReadAppConfig(this.agentCoreRuntime);
|
|
826
|
-
|
|
827
|
-
rc.set('agentcore', 'agentRuntimes', {
|
|
828
|
-
...rc.get('agentcore').agentRuntimes,
|
|
829
|
-
SnapshotBedrockAgent: this.agentCoreRuntime.agentRuntimeArn,
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* The principal to grant permissions to.
|
|
835
|
-
*/
|
|
836
|
-
public get grantPrincipal(): IPrincipal {
|
|
837
|
-
return this.agentCoreRuntime.grantPrincipal;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Network connections for this agent runtime.
|
|
842
|
-
*/
|
|
843
|
-
public get connections(): Connections {
|
|
844
|
-
return this.agentCoreRuntime.connections;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
/**
|
|
848
|
-
* Grants IAM permissions to invoke this agent runtime.
|
|
849
|
-
*
|
|
850
|
-
* @param grantee - The IAM principal to grant permissions to
|
|
851
|
-
*/
|
|
852
|
-
public grantInvokeAccess(grantee: IGrantable) {
|
|
853
|
-
this.agentCoreRuntime.grantInvoke(grantee);
|
|
854
|
-
|
|
855
|
-
Grant.addToPrincipal({
|
|
856
|
-
grantee,
|
|
857
|
-
actions: ['bedrock-agentcore:InvokeAgentRuntimeWithWebSocketStream'],
|
|
858
|
-
resourceArns: [
|
|
859
|
-
this.agentCoreRuntime.agentRuntimeArn,
|
|
860
|
-
\`\${this.agentCoreRuntime.agentRuntimeArn}/*\`,
|
|
861
|
-
],
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
"
|
|
866
|
-
`;
|
|
867
|
-
|
|
868
|
-
exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agents-index.ts 1`] = `
|
|
869
|
-
"export * from './snapshot-bedrock-agent/snapshot-bedrock-agent.js';
|
|
870
|
-
"
|
|
871
|
-
`;
|
|
872
|
-
|
|
873
|
-
exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > app-index.ts 1`] = `
|
|
874
|
-
"export * from './agents/index.js';
|
|
875
|
-
"
|
|
876
|
-
`;
|
|
877
|
-
|
|
878
|
-
exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > core-index.ts 1`] = `
|
|
879
|
-
"export * from './app.js';
|
|
880
|
-
export * from './checkov.js';
|
|
881
|
-
export * from './runtime-config.js';
|
|
882
|
-
export * from './workspace.js';
|
|
883
|
-
"
|
|
884
|
-
`;
|
|
885
|
-
|
|
886
|
-
exports[`py#agent generator > should match snapshot for Terraform generated files > terraform-agent.tf 1`] = `
|
|
887
|
-
"variable "env" {
|
|
888
|
-
description = "Environment variables to pass to the agent core runtime"
|
|
889
|
-
type = map(string)
|
|
890
|
-
default = {}
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
variable "additional_iam_policy_statements" {
|
|
894
|
-
description = "Additional IAM policy statements to attach to the agent core runtime role"
|
|
895
|
-
type = list(object({
|
|
896
|
-
Effect = string
|
|
897
|
-
Action = list(string)
|
|
898
|
-
Resource = list(string)
|
|
899
|
-
}))
|
|
900
|
-
default = []
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
variable "tags" {
|
|
904
|
-
description = "Tags to apply to resources"
|
|
905
|
-
type = map(string)
|
|
906
|
-
default = {}
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
variable "appconfig_application_id" {
|
|
910
|
-
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). The agent reads its runtime configuration from this application."
|
|
911
|
-
type = string
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
variable "appconfig_application_arn" {
|
|
915
|
-
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the agent runtime."
|
|
916
|
-
type = string
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
module "agent_core_runtime" {
|
|
920
|
-
source = "../../../core/agent-core"
|
|
921
|
-
agent_runtime_name = "TerraformSnapshotAgent"
|
|
922
|
-
docker_image_tag = "proj-terraform-snapshot-agent:latest"
|
|
923
|
-
server_protocol = "HTTP"
|
|
924
|
-
|
|
925
|
-
env = merge({
|
|
926
|
-
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
927
|
-
}, var.env)
|
|
928
|
-
additional_iam_policy_statements = concat([
|
|
929
|
-
{
|
|
930
|
-
Effect = "Allow"
|
|
931
|
-
Action = [
|
|
932
|
-
"appconfig:StartConfigurationSession",
|
|
933
|
-
"appconfig:GetLatestConfiguration"
|
|
934
|
-
]
|
|
935
|
-
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
936
|
-
},
|
|
937
|
-
# Grant access for the agent to invoke bedrock models
|
|
938
|
-
{
|
|
939
|
-
Effect = "Allow"
|
|
940
|
-
Action = [
|
|
941
|
-
"bedrock:InvokeModel",
|
|
942
|
-
"bedrock:InvokeModelWithResponseStream"
|
|
943
|
-
]
|
|
944
|
-
Resource = [
|
|
945
|
-
"arn:aws:bedrock:*:*:foundation-model/*",
|
|
946
|
-
"arn:aws:bedrock:*:*:inference-profile/*"
|
|
947
|
-
]
|
|
948
|
-
}
|
|
949
|
-
], var.additional_iam_policy_statements)
|
|
950
|
-
tags = var.tags
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
# Add agent runtime ARN to runtime config
|
|
954
|
-
module "add_agent_runtime_to_runtime_config" {
|
|
955
|
-
source = "../../../core/runtime-config/entry"
|
|
956
|
-
|
|
957
|
-
namespace = "agentcore"
|
|
958
|
-
key = "agentRuntimes"
|
|
959
|
-
value = { "TerraformSnapshotAgent" = module.agent_core_runtime.agent_core_runtime_arn }
|
|
960
|
-
|
|
961
|
-
depends_on = [module.agent_core_runtime]
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
output "agent_core_runtime_role_arn" {
|
|
965
|
-
description = "ARN of the agent core runtime role"
|
|
966
|
-
value = module.agent_core_runtime.agent_core_runtime_role_arn
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
output "agent_core_runtime_arn" {
|
|
970
|
-
description = "ARN of the Bedrock Agent Core runtime"
|
|
971
|
-
value = module.agent_core_runtime.agent_core_runtime_arn
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
output "appconfig_application_id" {
|
|
975
|
-
description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
|
|
976
|
-
value = var.appconfig_application_id
|
|
977
|
-
}
|
|
978
|
-
"
|
|
979
|
-
`;
|
|
980
|
-
|
|
981
|
-
exports[`py#agent generator > should match snapshot for Terraform generated files > terraform-agent-core-runtime.tf 1`] = `
|
|
982
|
-
"terraform {
|
|
983
|
-
required_version = ">= 1.0"
|
|
984
|
-
|
|
985
|
-
required_providers {
|
|
986
|
-
aws = {
|
|
987
|
-
source = "hashicorp/aws"
|
|
988
|
-
version = ">= 6.23"
|
|
989
|
-
}
|
|
990
|
-
null = {
|
|
991
|
-
source = "hashicorp/null"
|
|
992
|
-
version = ">= 3.0"
|
|
993
|
-
}
|
|
994
|
-
random = {
|
|
995
|
-
source = "hashicorp/random"
|
|
996
|
-
version = ">= 3.0"
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
# Variables
|
|
1002
|
-
variable "agent_runtime_name" {
|
|
1003
|
-
description = "Name of the agent runtime"
|
|
1004
|
-
type = string
|
|
1005
|
-
validation {
|
|
1006
|
-
condition = can(regex("^[a-zA-Z][a-zA-Z0-9_]{0,42}$", var.agent_runtime_name))
|
|
1007
|
-
error_message = "Value must start with a letter and contain only letters, numbers, and underscores (1-43 characters)."
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
variable "server_protocol" {
|
|
1012
|
-
description = "Server protocol for the agent runtime (HTTP, MCP, or A2A)"
|
|
1013
|
-
type = string
|
|
1014
|
-
default = "HTTP"
|
|
1015
|
-
validation {
|
|
1016
|
-
condition = contains(["MCP", "HTTP", "A2A"], var.server_protocol)
|
|
1017
|
-
error_message = "Protocol type must be either 'mcp', 'http', or 'a2a'."
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
variable "authorizer_configuration" {
|
|
1022
|
-
description = "Authorization configuration for authenticating incoming requests"
|
|
1023
|
-
type = object({
|
|
1024
|
-
custom_jwt_authorizer = optional(object({
|
|
1025
|
-
discovery_url = string
|
|
1026
|
-
allowed_audience = optional(list(string))
|
|
1027
|
-
allowed_clients = optional(list(string))
|
|
1028
|
-
}))
|
|
1029
|
-
})
|
|
1030
|
-
default = null
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
variable "docker_image_tag" {
|
|
1034
|
-
description = "Name of the docker image tag to use as the agent core runtime"
|
|
1035
|
-
type = string
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
variable "env" {
|
|
1039
|
-
description = "Environment variables to pass to the agent core runtime"
|
|
1040
|
-
type = map(string)
|
|
1041
|
-
default = {}
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
variable "additional_iam_policy_statements" {
|
|
1045
|
-
description = "Additional IAM policy statements to attach to the agent core runtime role"
|
|
1046
|
-
type = list(object({
|
|
1047
|
-
Effect = string
|
|
1048
|
-
Action = list(string)
|
|
1049
|
-
Resource = list(string)
|
|
1050
|
-
}))
|
|
1051
|
-
default = []
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
variable "tags" {
|
|
1055
|
-
description = "Tags to apply to resources"
|
|
1056
|
-
type = map(string)
|
|
1057
|
-
default = {}
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
# Data sources
|
|
1061
|
-
data "aws_caller_identity" "current" {}
|
|
1062
|
-
data "aws_region" "current" {}
|
|
1063
|
-
|
|
1064
|
-
locals {
|
|
1065
|
-
aws_account_id = data.aws_caller_identity.current.account_id
|
|
1066
|
-
aws_region = data.aws_region.current.id
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
# Random ID for bucket suffix to ensure uniqueness
|
|
1070
|
-
resource "random_id" "unique_suffix" {
|
|
1071
|
-
byte_length = 4
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
# ECR Repository
|
|
1075
|
-
resource "aws_ecr_repository" "agent_core_repository" {
|
|
1076
|
-
#checkov:skip=CKV_AWS_136:AES256 encryption is sufficient for ECR repositories
|
|
1077
|
-
name = "\${lower(var.agent_runtime_name)}_repository_\${random_id.unique_suffix.hex}"
|
|
1078
|
-
|
|
1079
|
-
image_tag_mutability = "IMMUTABLE"
|
|
1080
|
-
force_delete = true
|
|
1081
|
-
|
|
1082
|
-
image_scanning_configuration {
|
|
1083
|
-
scan_on_push = true
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
tags = var.tags
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
# ECR Repository Policy
|
|
1090
|
-
resource "aws_ecr_repository_policy" "agent_core_ecr_policy" {
|
|
1091
|
-
repository = aws_ecr_repository.agent_core_repository.name
|
|
1092
|
-
|
|
1093
|
-
policy = jsonencode({
|
|
1094
|
-
Version = "2012-10-17"
|
|
1095
|
-
Statement = [
|
|
1096
|
-
{
|
|
1097
|
-
Sid = "AllowPushPull"
|
|
1098
|
-
Effect = "Allow"
|
|
1099
|
-
Principal = {
|
|
1100
|
-
AWS = "arn:aws:iam::\${local.aws_account_id}:root"
|
|
1101
|
-
}
|
|
1102
|
-
Action = [
|
|
1103
|
-
"ecr:GetDownloadUrlForLayer",
|
|
1104
|
-
"ecr:BatchGetImage",
|
|
1105
|
-
"ecr:BatchCheckLayerAvailability",
|
|
1106
|
-
"ecr:PutImage",
|
|
1107
|
-
"ecr:InitiateLayerUpload",
|
|
1108
|
-
"ecr:UploadLayerPart",
|
|
1109
|
-
"ecr:CompleteLayerUpload"
|
|
1110
|
-
]
|
|
1111
|
-
}
|
|
1112
|
-
]
|
|
1113
|
-
})
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
# IAM Role for Agent Core Runtime
|
|
1117
|
-
resource "aws_iam_role" "agent_core_runtime_role" {
|
|
1118
|
-
name = "\${var.agent_runtime_name}-AgentCoreRuntimeRole-\${random_id.unique_suffix.hex}"
|
|
1119
|
-
|
|
1120
|
-
assume_role_policy = jsonencode({
|
|
1121
|
-
Version = "2012-10-17"
|
|
1122
|
-
Statement = [
|
|
1123
|
-
{
|
|
1124
|
-
Sid = "AgentCoreAssumeRolePolicy"
|
|
1125
|
-
Effect = "Allow"
|
|
1126
|
-
Principal = {
|
|
1127
|
-
Service = "bedrock-agentcore.amazonaws.com"
|
|
1128
|
-
}
|
|
1129
|
-
Action = "sts:AssumeRole"
|
|
1130
|
-
Condition = {
|
|
1131
|
-
StringEquals = {
|
|
1132
|
-
"aws:SourceAccount" = local.aws_account_id
|
|
1133
|
-
}
|
|
1134
|
-
ArnLike = {
|
|
1135
|
-
"aws:SourceArn" = "arn:aws:bedrock-agentcore:\${local.aws_region}:\${local.aws_account_id}:*"
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
]
|
|
1140
|
-
})
|
|
1141
|
-
|
|
1142
|
-
tags = var.tags
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
# IAM Policy for Agent Core Runtime
|
|
1146
|
-
resource "aws_iam_policy" "agent_core_runtime_policy" {
|
|
1147
|
-
name = "\${var.agent_runtime_name}-QueryAgentPolicy-\${random_id.unique_suffix.hex}"
|
|
1148
|
-
description = "Restricted policy for Agent"
|
|
1149
|
-
|
|
1150
|
-
policy = jsonencode({
|
|
1151
|
-
Version = "2012-10-17"
|
|
1152
|
-
Statement = concat([
|
|
1153
|
-
{
|
|
1154
|
-
Sid = "ECRImageAccess"
|
|
1155
|
-
Effect = "Allow"
|
|
1156
|
-
Action = [
|
|
1157
|
-
"ecr:BatchGetImage",
|
|
1158
|
-
"ecr:GetDownloadUrlForLayer"
|
|
1159
|
-
]
|
|
1160
|
-
Resource = [
|
|
1161
|
-
aws_ecr_repository.agent_core_repository.arn
|
|
1162
|
-
]
|
|
1163
|
-
},
|
|
1164
|
-
{
|
|
1165
|
-
Sid = "ECRTokenAccess"
|
|
1166
|
-
Effect = "Allow"
|
|
1167
|
-
Action = [
|
|
1168
|
-
"ecr:GetAuthorizationToken"
|
|
1169
|
-
]
|
|
1170
|
-
Resource = [
|
|
1171
|
-
"*"
|
|
1172
|
-
]
|
|
1173
|
-
},
|
|
1174
|
-
{
|
|
1175
|
-
"Effect" : "Allow",
|
|
1176
|
-
"Action" : [
|
|
1177
|
-
"logs:DescribeLogStreams",
|
|
1178
|
-
"logs:CreateLogGroup"
|
|
1179
|
-
],
|
|
1180
|
-
"Resource" : [
|
|
1181
|
-
"arn:aws:logs:\${local.aws_region}:\${local.aws_account_id}:log-group:/aws/bedrock-agentcore/runtimes/*"
|
|
1182
|
-
]
|
|
1183
|
-
},
|
|
1184
|
-
{
|
|
1185
|
-
"Effect" : "Allow",
|
|
1186
|
-
"Action" : [
|
|
1187
|
-
"logs:DescribeLogGroups"
|
|
1188
|
-
],
|
|
1189
|
-
"Resource" : [
|
|
1190
|
-
"arn:aws:logs:\${local.aws_region}:\${local.aws_account_id}:log-group:*"
|
|
1191
|
-
]
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
"Effect" : "Allow",
|
|
1195
|
-
"Action" : [
|
|
1196
|
-
"logs:CreateLogStream",
|
|
1197
|
-
"logs:PutLogEvents"
|
|
1198
|
-
],
|
|
1199
|
-
"Resource" : [
|
|
1200
|
-
"arn:aws:logs:\${local.aws_region}:\${local.aws_account_id}:log-group:/aws/bedrock-agentcore/runtimes/*:log-stream:*"
|
|
1201
|
-
]
|
|
1202
|
-
},
|
|
1203
|
-
{
|
|
1204
|
-
"Effect" : "Allow",
|
|
1205
|
-
"Action" : [
|
|
1206
|
-
"xray:PutTraceSegments",
|
|
1207
|
-
"xray:PutTelemetryRecords",
|
|
1208
|
-
"xray:GetSamplingRules",
|
|
1209
|
-
"xray:GetSamplingTargets"
|
|
1210
|
-
],
|
|
1211
|
-
"Resource" : ["*"]
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
"Effect" : "Allow",
|
|
1215
|
-
"Resource" : "*",
|
|
1216
|
-
"Action" : "cloudwatch:PutMetricData",
|
|
1217
|
-
"Condition" : {
|
|
1218
|
-
"StringEquals" : {
|
|
1219
|
-
"cloudwatch:namespace" : "bedrock-agentcore"
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
"Sid" : "GetAgentAccessToken",
|
|
1225
|
-
"Effect" : "Allow",
|
|
1226
|
-
"Action" : [
|
|
1227
|
-
"bedrock-agentcore:GetWorkloadAccessToken",
|
|
1228
|
-
"bedrock-agentcore:GetWorkloadAccessTokenForJWT",
|
|
1229
|
-
"bedrock-agentcore:GetWorkloadAccessTokenForUserId"
|
|
1230
|
-
],
|
|
1231
|
-
"Resource" : [
|
|
1232
|
-
"arn:aws:bedrock-agentcore:\${local.aws_region}:\${local.aws_account_id}:workload-identity-directory/default",
|
|
1233
|
-
"arn:aws:bedrock-agentcore:\${local.aws_region}:\${local.aws_account_id}:workload-identity-directory/default/workload-identity/*"
|
|
1234
|
-
]
|
|
1235
|
-
}
|
|
1236
|
-
], var.additional_iam_policy_statements)
|
|
1237
|
-
})
|
|
1238
|
-
|
|
1239
|
-
tags = var.tags
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
# Attach the restricted policy to the role
|
|
1243
|
-
resource "aws_iam_role_policy_attachment" "agent_core_policy" {
|
|
1244
|
-
role = aws_iam_role.agent_core_runtime_role.name
|
|
1245
|
-
policy_arn = aws_iam_policy.agent_core_runtime_policy.arn
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
# Data source to get container image digest
|
|
1249
|
-
data "external" "docker_digest" {
|
|
1250
|
-
program = ["sh", "-c", "echo '{\\"digest\\":\\"'$(docker inspect \${var.docker_image_tag} --format '{{.Id}}')'\\"}' "]
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
locals {
|
|
1254
|
-
# Content-based, immutable image tag derived from the local image digest
|
|
1255
|
-
image_tag = replace(data.external.docker_digest.result.digest, "sha256:", "")
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
# Null resource for container image publish
|
|
1259
|
-
resource "null_resource" "docker_publish" {
|
|
1260
|
-
triggers = {
|
|
1261
|
-
docker_digest = data.external.docker_digest.result.digest
|
|
1262
|
-
repository_url = aws_ecr_repository.agent_core_repository.repository_url
|
|
1263
|
-
docker_image_tag = var.docker_image_tag
|
|
1264
|
-
image_tag = local.image_tag
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
provisioner "local-exec" {
|
|
1268
|
-
command = <<-EOT
|
|
1269
|
-
# Get ECR login token
|
|
1270
|
-
aws ecr get-login-password --region "$AWS_REGION" | docker login --username AWS --password-stdin "$REPOSITORY_URL"
|
|
1271
|
-
|
|
1272
|
-
# Tag the image with the immutable content-based tag
|
|
1273
|
-
docker tag "$DOCKER_IMAGE_TAG" "$REPOSITORY_URL:$IMAGE_TAG"
|
|
1274
|
-
|
|
1275
|
-
# Push the image
|
|
1276
|
-
docker push "$REPOSITORY_URL:$IMAGE_TAG"
|
|
1277
|
-
EOT
|
|
1278
|
-
environment = {
|
|
1279
|
-
AWS_REGION = local.aws_region
|
|
1280
|
-
REPOSITORY_URL = self.triggers.repository_url
|
|
1281
|
-
DOCKER_IMAGE_TAG = self.triggers.docker_image_tag
|
|
1282
|
-
IMAGE_TAG = self.triggers.image_tag
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
depends_on = [aws_ecr_repository_policy.agent_core_ecr_policy]
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
# Bedrock AgentCore Agent Runtime
|
|
1290
|
-
resource "aws_bedrockagentcore_agent_runtime" "agent_runtime" {
|
|
1291
|
-
agent_runtime_name = "\${var.agent_runtime_name}_\${random_id.unique_suffix.hex}"
|
|
1292
|
-
description = "Agent Runtime for \${var.agent_runtime_name}"
|
|
1293
|
-
role_arn = aws_iam_role.agent_core_runtime_role.arn
|
|
1294
|
-
|
|
1295
|
-
agent_runtime_artifact {
|
|
1296
|
-
container_configuration {
|
|
1297
|
-
container_uri = "\${aws_ecr_repository.agent_core_repository.repository_url}:\${local.image_tag}"
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
environment_variables = length(var.env) > 0 ? var.env : null
|
|
1302
|
-
|
|
1303
|
-
dynamic "authorizer_configuration" {
|
|
1304
|
-
for_each = var.authorizer_configuration != null && try(var.authorizer_configuration.custom_jwt_authorizer, null) != null ? [var.authorizer_configuration.custom_jwt_authorizer] : []
|
|
1305
|
-
content {
|
|
1306
|
-
custom_jwt_authorizer {
|
|
1307
|
-
discovery_url = authorizer_configuration.value.discovery_url
|
|
1308
|
-
allowed_audience = authorizer_configuration.value.allowed_audience
|
|
1309
|
-
allowed_clients = authorizer_configuration.value.allowed_clients
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
network_configuration {
|
|
1315
|
-
network_mode = "PUBLIC"
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
protocol_configuration {
|
|
1319
|
-
server_protocol = var.server_protocol
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
tags = var.tags
|
|
1323
|
-
|
|
1324
|
-
depends_on = [
|
|
1325
|
-
null_resource.docker_publish,
|
|
1326
|
-
aws_iam_role_policy_attachment.agent_core_policy
|
|
1327
|
-
]
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
# MCP consumers (e.g. gateway targets, which fetch tools at creation) can race
|
|
1331
|
-
# the runtime's first cold start, so probe it until it serves MCP. The ARN
|
|
1332
|
-
# output is routed through this resource so consumers wait for readiness.
|
|
1333
|
-
resource "null_resource" "runtime_ready" {
|
|
1334
|
-
count = var.server_protocol == "MCP" ? 1 : 0
|
|
1335
|
-
|
|
1336
|
-
triggers = {
|
|
1337
|
-
runtime_arn = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
provisioner "local-exec" {
|
|
1341
|
-
command = <<-EOT
|
|
1342
|
-
uv run --with boto3 python -c "
|
|
1343
|
-
import boto3
|
|
1344
|
-
import json
|
|
1345
|
-
import os
|
|
1346
|
-
import time
|
|
1347
|
-
import uuid
|
|
1348
|
-
|
|
1349
|
-
runtime_arn = os.environ['RUNTIME_ARN']
|
|
1350
|
-
client = boto3.client('bedrock-agentcore')
|
|
1351
|
-
initialize_request = json.dumps({
|
|
1352
|
-
'jsonrpc': '2.0',
|
|
1353
|
-
'id': 1,
|
|
1354
|
-
'method': 'initialize',
|
|
1355
|
-
'params': {
|
|
1356
|
-
'protocolVersion': '2025-03-26',
|
|
1357
|
-
'capabilities': {},
|
|
1358
|
-
'clientInfo': {'name': 'readiness-probe', 'version': '1.0'},
|
|
1359
|
-
},
|
|
1360
|
-
})
|
|
1361
|
-
|
|
1362
|
-
deadline = time.time() + 3 * 60
|
|
1363
|
-
while True:
|
|
1364
|
-
try:
|
|
1365
|
-
client.invoke_agent_runtime(
|
|
1366
|
-
agentRuntimeArn=runtime_arn,
|
|
1367
|
-
runtimeSessionId=f'readiness-probe-{uuid.uuid4()}',
|
|
1368
|
-
contentType='application/json',
|
|
1369
|
-
accept='application/json, text/event-stream',
|
|
1370
|
-
payload=initialize_request,
|
|
1371
|
-
)
|
|
1372
|
-
break
|
|
1373
|
-
except Exception:
|
|
1374
|
-
if time.time() >= deadline:
|
|
1375
|
-
raise
|
|
1376
|
-
time.sleep(5)
|
|
1377
|
-
|
|
1378
|
-
print(f'Runtime {runtime_arn} is serving MCP')
|
|
1379
|
-
"
|
|
1380
|
-
EOT
|
|
1381
|
-
environment = {
|
|
1382
|
-
RUNTIME_ARN = self.triggers.runtime_arn
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
# Outputs
|
|
1388
|
-
output "agent_core_runtime_role_arn" {
|
|
1389
|
-
description = "ARN of the Agent Core Runtime IAM role"
|
|
1390
|
-
value = aws_iam_role.agent_core_runtime_role.arn
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
output "agent_core_runtime_role_name" {
|
|
1394
|
-
description = "Name of the Agent Core Runtime IAM role"
|
|
1395
|
-
value = aws_iam_role.agent_core_runtime_role.name
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
output "agent_runtime_name" {
|
|
1399
|
-
description = "Name of the deployed agent runtime"
|
|
1400
|
-
value = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_name
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
output "agent_core_runtime_arn" {
|
|
1404
|
-
description = "ARN of the Bedrock Agent Core runtime. For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
|
|
1405
|
-
value = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
output "agent_runtime_id" {
|
|
1409
|
-
description = "ID of the Bedrock Agent Core runtime"
|
|
1410
|
-
value = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_id
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
output "agent_runtime_version" {
|
|
1414
|
-
description = "Version of the Bedrock Agent Core runtime"
|
|
1415
|
-
value = aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_version
|
|
1416
|
-
}
|
|
1417
|
-
"
|
|
1418
|
-
`;
|
|
1419
|
-
|
|
1420
|
-
exports[`py#agent generator > should match snapshot for generated files > agent-__init__.py 1`] = `""`;
|
|
1421
|
-
|
|
1422
|
-
exports[`py#agent generator > should match snapshot for generated files > agent-agent.py 1`] = `
|
|
1423
|
-
"from contextlib import contextmanager
|
|
1424
|
-
|
|
1425
|
-
from strands import Agent, tool
|
|
1426
|
-
from strands_tools import current_time
|
|
1427
|
-
from proj_agent_connection import log_model_errors
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
@tool
|
|
1431
|
-
def subtract(a: int, b: int) -> int:
|
|
1432
|
-
return a - b
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
@contextmanager
|
|
1436
|
-
def get_agent():
|
|
1437
|
-
yield Agent(
|
|
1438
|
-
name="SnapshotAgent",
|
|
1439
|
-
description="SnapshotAgent Strands Agent",
|
|
1440
|
-
system_prompt="""
|
|
1441
|
-
You are a mathematical wizard.
|
|
1442
|
-
Use your tools for mathematical tasks.
|
|
1443
|
-
Refer to tools as your 'spellbook'.
|
|
1444
|
-
""",
|
|
1445
|
-
tools=[subtract, current_time],
|
|
1446
|
-
hooks=[log_model_errors],
|
|
1447
|
-
)
|
|
1448
|
-
"
|
|
1449
|
-
`;
|
|
1450
|
-
|
|
1451
|
-
exports[`py#agent generator > should match snapshot for generated files > agent-main.py 1`] = `
|
|
1452
|
-
"import uuid
|
|
1453
|
-
|
|
1454
|
-
import uvicorn
|
|
1455
|
-
from bedrock_agentcore.runtime.models import PingStatus
|
|
1456
|
-
from fastapi import Request
|
|
1457
|
-
from pydantic import BaseModel, Field
|
|
1458
|
-
from starlette.middleware.base import BaseHTTPMiddleware
|
|
1459
|
-
from proj_agent_connection import session_id_context, with_session_id
|
|
1460
|
-
|
|
1461
|
-
from .agent import get_agent
|
|
1462
|
-
from .init import JsonStreamingResponse, app
|
|
1463
|
-
|
|
1464
|
-
SESSION_ID_HEADER = "x-amzn-bedrock-agentcore-runtime-session-id"
|
|
1465
|
-
|
|
1466
|
-
_agent_ctx = with_session_id(
|
|
1467
|
-
get_agent,
|
|
1468
|
-
name="SnapshotAgent",
|
|
1469
|
-
description="A Strands Agent exposed via HTTP streaming.",
|
|
1470
|
-
)
|
|
1471
|
-
_agent = _agent_ctx.__enter__()
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
class InvokeInput(BaseModel):
|
|
1475
|
-
message: str = Field(max_length=100000)
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
class StreamChunk(BaseModel):
|
|
1479
|
-
content: str
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
async def handle_invoke(input: InvokeInput):
|
|
1483
|
-
"""Streaming handler for agent invocation"""
|
|
1484
|
-
stream = _agent.stream_async(input.message)
|
|
1485
|
-
async for event in stream:
|
|
1486
|
-
text = (
|
|
1487
|
-
event.get("event", {})
|
|
1488
|
-
.get("contentBlockDelta", {})
|
|
1489
|
-
.get("delta", {})
|
|
1490
|
-
.get("text")
|
|
1491
|
-
)
|
|
1492
|
-
if text is not None:
|
|
1493
|
-
yield StreamChunk(content=text)
|
|
1494
|
-
elif event.get("event", {}).get("messageStop") is not None:
|
|
1495
|
-
yield StreamChunk(content="\\n")
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
@app.post(
|
|
1499
|
-
"/invocations",
|
|
1500
|
-
response_class=JsonStreamingResponse,
|
|
1501
|
-
responses={
|
|
1502
|
-
200: JsonStreamingResponse.openapi_response(
|
|
1503
|
-
StreamChunk, "Stream of agent response chunks"
|
|
1504
|
-
)
|
|
1505
|
-
},
|
|
1506
|
-
)
|
|
1507
|
-
async def invoke(input: InvokeInput) -> JsonStreamingResponse:
|
|
1508
|
-
"""Entry point for agent invocation"""
|
|
1509
|
-
return JsonStreamingResponse(handle_invoke(input))
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
class _SessionIdMiddleware(BaseHTTPMiddleware):
|
|
1513
|
-
"""Bind the inbound session (or a fresh UUID) to async context."""
|
|
1514
|
-
|
|
1515
|
-
async def dispatch(self, request: Request, call_next):
|
|
1516
|
-
session_id = request.headers.get(SESSION_ID_HEADER) or str(uuid.uuid4())
|
|
1517
|
-
with session_id_context(session_id):
|
|
1518
|
-
return await call_next(request)
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
app.add_middleware(_SessionIdMiddleware)
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
@app.get("/ping")
|
|
1525
|
-
def ping() -> str:
|
|
1526
|
-
# TODO: if running an async task, return PingStatus.HEALTHY_BUSY
|
|
1527
|
-
return PingStatus.HEALTHY
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
if __name__ == "__main__":
|
|
1531
|
-
uvicorn.run("proj_test_project.snapshot_agent.main:app", port=8080)
|
|
1532
|
-
"
|
|
1533
|
-
`;
|
|
1534
|
-
|
|
1535
|
-
exports[`py#agent generator > should match snapshot for generated files > updated-pyproject.toml 1`] = `
|
|
1536
|
-
"[project]
|
|
1537
|
-
name = "proj.test_project"
|
|
1538
|
-
version = "0.1.0"
|
|
1539
|
-
dependencies = [
|
|
1540
|
-
"proj.agent_connection",
|
|
1541
|
-
"aws-lambda-powertools==3.29.0",
|
|
1542
|
-
"aws-opentelemetry-distro==0.17.1",
|
|
1543
|
-
"bedrock-agentcore==1.14.1",
|
|
1544
|
-
"boto3==1.43.29",
|
|
1545
|
-
"fastapi==0.137.1",
|
|
1546
|
-
"mcp==1.27.2",
|
|
1547
|
-
"strands-agents==1.43.0",
|
|
1548
|
-
"strands-agents-tools==0.8.0",
|
|
1549
|
-
"uvicorn==0.49.0"
|
|
1550
|
-
]
|
|
1551
|
-
|
|
1552
|
-
[dependency-groups]
|
|
1553
|
-
dev = [ "fastapi[standard]==0.137.1" ]
|
|
1554
|
-
|
|
1555
|
-
[tool.uv]
|
|
1556
|
-
dev-dependencies = [ ]
|
|
1557
|
-
|
|
1558
|
-
[tool.uv.sources."proj.agent_connection"]
|
|
731
|
+
[tool.uv.sources.proj-agent-connection]
|
|
1559
732
|
workspace = true
|
|
1560
733
|
"
|
|
1561
734
|
`;
|