@aws/nx-plugin 1.0.0-rc.2 → 1.0.0-rc.21
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 +3552 -4179
- package/README.md +8 -8
- package/executors.json +9 -0
- package/generators.json +100 -1
- package/package.json +16 -12
- package/sdk/agentcore-gateway.d.ts +6 -0
- package/sdk/agentcore-gateway.js +11 -0
- package/sdk/agentcore-gateway.js.map +1 -0
- package/sdk/license.d.ts +8 -0
- package/sdk/license.js +14 -0
- package/sdk/license.js.map +1 -0
- package/sdk/py.d.ts +6 -6
- package/sdk/py.js +7 -7
- package/sdk/py.js.map +1 -1
- package/sdk/ts.d.ts +18 -14
- package/sdk/ts.js +38 -32
- package/sdk/ts.js.map +1 -1
- package/src/agentcore-gateway/attach-upstream.d.ts +33 -0
- package/src/agentcore-gateway/attach-upstream.js +41 -0
- package/src/agentcore-gateway/attach-upstream.js.map +1 -0
- package/src/agentcore-gateway/files/cedar/policies/README.md +52 -0
- package/src/agentcore-gateway/files/cedar/policies/permit-all.cedar +11 -0
- package/src/agentcore-gateway/files/project/serve-local.ts.template +134 -0
- package/src/agentcore-gateway/gateway-connection/generator.d.ts +21 -0
- package/src/agentcore-gateway/gateway-connection/generator.js +102 -0
- package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -0
- package/src/agentcore-gateway/gateway-connection/schema.d.ts +12 -0
- package/src/agentcore-gateway/gateway-connection/schema.json +26 -0
- package/src/agentcore-gateway/generator.d.ts +25 -0
- package/src/agentcore-gateway/generator.js +129 -0
- package/src/agentcore-gateway/generator.js.map +1 -0
- package/src/agentcore-gateway/mcp-connection/generator.d.ts +19 -0
- package/src/agentcore-gateway/mcp-connection/generator.js +63 -0
- package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -0
- package/src/agentcore-gateway/mcp-connection/schema.d.ts +12 -0
- package/src/agentcore-gateway/mcp-connection/schema.json +26 -0
- package/src/agentcore-gateway/schema.d.ts +16 -0
- package/src/agentcore-gateway/schema.json +65 -0
- package/src/connection/agent-runtime-config.d.ts +1 -1
- package/src/connection/agent-runtime-config.js.map +1 -1
- package/src/connection/agent-serve-local.d.ts +2 -2
- package/src/connection/agent-serve-local.js +1 -1
- package/src/connection/agent-serve-local.js.map +1 -1
- package/src/connection/generator.d.ts +5 -5
- package/src/connection/generator.js +93 -37
- package/src/connection/generator.js.map +1 -1
- package/src/connection/serve-local.d.ts +1 -1
- package/src/connection/serve-local.js +1 -1
- package/src/connection/serve-local.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +47 -58
- package/src/infra/app/generator.d.ts +3 -3
- package/src/infra/app/generator.js +19 -17
- package/src/infra/app/generator.js.map +1 -1
- package/src/license/__snapshots__/config.spec.ts.snap +23 -0
- package/src/license/config-types.d.ts +18 -1
- package/src/license/config-types.js +4 -0
- package/src/license/config-types.js.map +1 -1
- package/src/license/config.d.ts +65 -7
- package/src/license/config.js +315 -7
- package/src/license/config.js.map +1 -1
- package/src/license/dependency-check/check.d.ts +16 -0
- package/src/license/dependency-check/check.js +111 -0
- package/src/license/dependency-check/check.js.map +1 -0
- package/src/license/dependency-check/collectors/collector.d.ts +21 -0
- package/src/license/dependency-check/collectors/collector.js +76 -0
- package/src/license/dependency-check/collectors/collector.js.map +1 -0
- package/src/license/dependency-check/collectors/npm-collector.d.ts +10 -0
- package/src/license/dependency-check/collectors/npm-collector.js +75 -0
- package/src/license/dependency-check/collectors/npm-collector.js.map +1 -0
- package/src/license/dependency-check/collectors/python-collector.d.ts +23 -0
- package/src/license/dependency-check/collectors/python-collector.js +121 -0
- package/src/license/dependency-check/collectors/python-collector.js.map +1 -0
- package/src/license/dependency-check/evaluator.d.ts +9 -0
- package/src/license/dependency-check/evaluator.js +122 -0
- package/src/license/dependency-check/evaluator.js.map +1 -0
- package/src/license/dependency-check/executor-schema.json +6 -0
- package/src/license/dependency-check/executor.d.ts +9 -0
- package/src/license/dependency-check/executor.js +43 -0
- package/src/license/dependency-check/executor.js.map +1 -0
- package/src/license/dependency-check/pre-approved.d.ts +6 -0
- package/src/license/dependency-check/pre-approved.js +1280 -0
- package/src/license/dependency-check/pre-approved.js.map +1 -0
- package/src/license/dependency-check/types.d.ts +45 -0
- package/src/license/dependency-check/types.js +7 -0
- package/src/license/dependency-check/types.js.map +1 -0
- package/src/license/generator.d.ts +3 -3
- package/src/license/generator.js +102 -14
- package/src/license/generator.js.map +1 -1
- package/src/license/index.d.ts +8 -0
- package/src/license/index.js +13 -0
- package/src/license/index.js.map +1 -0
- package/src/license/known-exceptions.d.ts +6 -0
- package/src/license/known-exceptions.js +26 -0
- package/src/license/known-exceptions.js.map +1 -0
- package/src/license/schema.d.ts +5 -0
- package/src/license/schema.json +6 -0
- package/src/license/sync/generator.d.ts +2 -2
- package/src/license/sync/generator.js +15 -15
- package/src/license/sync/generator.js.map +1 -1
- package/src/license/sync/project-file-sync.d.ts +3 -3
- package/src/license/sync/project-file-sync.js.map +1 -1
- package/src/mcp-server/generator-info.d.ts +5 -1
- package/src/mcp-server/generator-info.js +7 -7
- package/src/mcp-server/generator-info.js.map +1 -1
- package/src/mcp-server/guide-pipeline.d.ts +1 -1
- package/src/mcp-server/guide-pipeline.js +2 -2
- package/src/mcp-server/guide-pipeline.js.map +1 -1
- package/src/mcp-server/mdx-ast.js +4 -0
- package/src/mcp-server/mdx-ast.js.map +1 -1
- package/src/mcp-server/schema-registry.d.ts +9 -3
- package/src/mcp-server/schema-registry.js +22 -6
- package/src/mcp-server/schema-registry.js.map +1 -1
- package/src/mcp-server/server.js +3 -3
- package/src/mcp-server/server.js.map +1 -1
- package/src/mcp-server/tools/create-workspace-command.d.ts +1 -1
- package/src/mcp-server/tools/create-workspace-command.js +4 -4
- package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
- package/src/mcp-server/tools/general-guidance.d.ts +2 -2
- package/src/mcp-server/tools/general-guidance.js +2 -2
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/mcp-server/tools/generator-guide.d.ts +2 -2
- package/src/mcp-server/tools/generator-guide.js.map +1 -1
- package/src/mcp-server/tools/list-generators.d.ts +2 -2
- package/src/mcp-server/tools/list-generators.js +1 -1
- package/src/mcp-server/tools/list-generators.js.map +1 -1
- package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +1 -1
- package/src/open-api/ts-client/generator.d.ts +3 -3
- package/src/open-api/ts-client/generator.js +2 -2
- package/src/open-api/ts-client/generator.js.map +1 -1
- package/src/open-api/ts-hooks/generator.d.ts +3 -3
- package/src/open-api/ts-hooks/generator.js +2 -2
- package/src/open-api/ts-hooks/generator.js.map +1 -1
- package/src/open-api/ts-hooks/generator.spec.tsx +14 -14
- package/src/open-api/ts-metadata/generator.d.ts +3 -3
- package/src/open-api/ts-metadata/generator.js +1 -1
- package/src/open-api/ts-metadata/generator.js.map +1 -1
- package/src/open-api/utils/codegen-data/languages.d.ts +5 -1
- package/src/open-api/utils/codegen-data/languages.js +4 -4
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data.d.ts +6 -2
- package/src/open-api/utils/codegen-data.js +6 -6
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.d.ts +5 -1
- package/src/open-api/utils/normalise.js +5 -5
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parse.d.ts +2 -2
- package/src/open-api/utils/parse.js +4 -0
- package/src/open-api/utils/parse.js.map +1 -1
- package/src/open-api/utils/refs.d.ts +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +131 -13
- package/src/preset/generator.d.ts +4 -4
- package/src/preset/generator.js +21 -14
- package/src/preset/generator.js.map +1 -1
- package/src/preset/schema.d.ts +3 -1
- package/src/preset/schema.json +5 -0
- package/src/py/agent/__snapshots__/generator.spec.ts.snap +659 -21
- package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +201 -0
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +30 -0
- package/src/py/agent/a2a-connection/generator.d.ts +3 -3
- package/src/py/agent/a2a-connection/generator.js +11 -10
- package/src/py/agent/a2a-connection/generator.js.map +1 -1
- package/src/py/agent/files/common/agent.py.template +2 -0
- package/src/py/agent/files/http/init.py.template +7 -25
- package/src/py/agent/files/http/main.py.template +2 -3
- package/src/py/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +197 -0
- package/src/py/agent/gateway-connection/files/agent-connection/app/__gatewaySnakeCase___client_strands.py.template +35 -0
- package/src/py/agent/gateway-connection/generator.d.ts +10 -0
- package/src/py/agent/gateway-connection/generator.js +106 -0
- package/src/py/agent/gateway-connection/generator.js.map +1 -0
- package/src/py/agent/gateway-connection/schema.d.ts +12 -0
- package/src/py/agent/gateway-connection/schema.json +26 -0
- package/src/py/agent/generator.d.ts +3 -3
- package/src/py/agent/generator.js +47 -38
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +167 -81
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client_strands.py.template +30 -0
- package/src/py/agent/mcp-connection/generator.d.ts +3 -3
- package/src/py/agent/mcp-connection/generator.js +11 -81
- package/src/py/agent/mcp-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +8 -17
- package/src/py/agent/react-connection/generator.d.ts +3 -3
- package/src/py/agent/react-connection/generator.js +4 -4
- package/src/py/agent/react-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/serve-local.d.ts +2 -2
- package/src/py/agent/react-connection/serve-local.js.map +1 -1
- package/src/py/api/generator.d.ts +3 -3
- package/src/py/api/generator.js.map +1 -1
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +1486 -0
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/py/dynamodb/agent-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/agent-connection/generator.js +39 -0
- package/src/py/dynamodb/agent-connection/generator.js.map +1 -0
- package/src/py/dynamodb/agent-connection/schema.d.ts +14 -0
- package/src/py/dynamodb/agent-connection/schema.json +22 -0
- package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +23 -0
- package/src/py/dynamodb/fast-api-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/fast-api-connection/generator.js +37 -0
- package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -0
- package/src/py/dynamodb/fast-api-connection/schema.d.ts +12 -0
- package/src/py/dynamodb/fast-api-connection/schema.json +18 -0
- package/src/py/dynamodb/files/__name__/__init__.py.template +6 -0
- package/src/py/dynamodb/files/__name__/client.py.template +39 -0
- package/src/py/dynamodb/files/__name__/entities/__init__.py.template +4 -0
- package/src/py/dynamodb/files/__name__/entities/base.py.template +63 -0
- package/src/py/dynamodb/files/__name__/entities/example.py.template +64 -0
- package/src/py/dynamodb/files/config.json.template +24 -0
- package/src/py/dynamodb/generator.d.ts +10 -0
- package/src/py/dynamodb/generator.js +106 -0
- package/src/py/dynamodb/generator.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/py/dynamodb/mcp-server-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js +39 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/schema.d.ts +14 -0
- package/src/py/dynamodb/mcp-server-connection/schema.json +22 -0
- package/src/py/dynamodb/schema.d.ts +15 -0
- package/src/py/dynamodb/schema.json +70 -0
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +167 -39
- package/src/py/fast-api/files/app/__name__/init.py.template +5 -22
- package/src/py/fast-api/files/app/__name__/main.py.template +4 -1
- package/src/py/fast-api/generator.d.ts +3 -3
- package/src/py/fast-api/generator.js +23 -17
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/py/fast-api/react/generator.d.ts +3 -3
- package/src/py/fast-api/react/generator.js +2 -2
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/fast-api/react/open-api.d.ts +1 -1
- package/src/py/fast-api/react/open-api.js +5 -2
- package/src/py/fast-api/react/open-api.js.map +1 -1
- package/src/py/lambda-function/generator.d.ts +3 -3
- package/src/py/lambda-function/generator.js +11 -11
- package/src/py/lambda-function/generator.js.map +1 -1
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +83 -13
- package/src/py/mcp-server/generator.d.ts +3 -3
- package/src/py/mcp-server/generator.js +33 -26
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/project/generator.d.ts +3 -3
- package/src/py/project/generator.js +96 -70
- package/src/py/project/generator.js.map +1 -1
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +19 -16
- package/src/smithy/project/files/build.Dockerfile.template +1 -0
- package/src/smithy/project/files/src/operations/echo.smithy.template +1 -0
- package/src/smithy/project/generator.d.ts +3 -3
- package/src/smithy/project/generator.js +30 -28
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/react-connection/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/smithy/react-connection/generator.d.ts +3 -3
- package/src/smithy/react-connection/generator.js +3 -3
- package/src/smithy/react-connection/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +14 -34
- package/src/smithy/ts/api/generator.d.ts +3 -3
- package/src/smithy/ts/api/generator.js +18 -12
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/terraform/project/files/application/src/main.tf.template +6 -1
- package/src/terraform/project/generator.d.ts +3 -3
- package/src/terraform/project/generator.js +13 -8
- package/src/terraform/project/generator.js.map +1 -1
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +163 -18
- package/src/trpc/backend/files/src/procedures/echo.ts.template +1 -1
- package/src/trpc/backend/files/src/schema/echo.ts.template +2 -2
- package/src/trpc/backend/generator.d.ts +3 -3
- package/src/trpc/backend/generator.js +11 -10
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.d.ts +2 -2
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/trpc/react/files/src/components/__apiNameClassName__ClientProvider.tsx.template +3 -3
- package/src/trpc/react/generator.d.ts +3 -3
- package/src/trpc/react/generator.js +5 -5
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +652 -14
- package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +256 -0
- package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client-strands.ts.template +23 -0
- package/src/ts/agent/a2a-connection/generator.d.ts +3 -3
- package/src/ts/agent/a2a-connection/generator.js +8 -8
- package/src/ts/agent/a2a-connection/generator.js.map +1 -1
- package/src/ts/agent/files/common/agent.ts.template +6 -2
- package/src/ts/agent/files/http/router.ts.template +1 -1
- package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +220 -0
- package/src/ts/agent/gateway-connection/files/agent-connection/app/__gatewayKebabCase__-client-strands.ts.template +30 -0
- package/src/ts/agent/gateway-connection/generator.d.ts +10 -0
- package/src/ts/agent/gateway-connection/generator.js +106 -0
- package/src/ts/agent/gateway-connection/generator.js.map +1 -0
- package/src/ts/agent/gateway-connection/schema.d.ts +12 -0
- package/src/ts/agent/gateway-connection/schema.json +26 -0
- package/src/ts/agent/generator.d.ts +3 -3
- package/src/ts/agent/generator.js +44 -32
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +191 -110
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +22 -0
- package/src/ts/agent/mcp-connection/generator.d.ts +3 -3
- package/src/ts/agent/mcp-connection/generator.js +9 -21
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/generator.d.ts +3 -3
- package/src/ts/agent/react-connection/generator.js +9 -9
- package/src/ts/agent/react-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/serve-local.d.ts +2 -2
- package/src/ts/api/generator.d.ts +3 -3
- package/src/ts/api/generator.js +4 -4
- package/src/ts/api/generator.js.map +1 -1
- package/src/ts/api/schema.d.ts +2 -1
- package/src/ts/astro-docs/__snapshots__/generator.spec.ts.snap +7 -8
- package/src/ts/astro-docs/generator.d.ts +3 -3
- package/src/ts/astro-docs/generator.js +14 -11
- package/src/ts/astro-docs/generator.js.map +1 -1
- package/src/ts/docs/generator.d.ts +3 -3
- package/src/ts/docs/generator.js.map +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +1352 -0
- package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/ts/dynamodb/agent-connection/generator.d.ts +10 -0
- package/src/ts/dynamodb/agent-connection/generator.js +32 -0
- package/src/ts/dynamodb/agent-connection/generator.js.map +1 -0
- package/src/ts/dynamodb/agent-connection/schema.d.ts +14 -0
- package/src/ts/dynamodb/agent-connection/schema.json +22 -0
- package/src/ts/dynamodb/files/config.json.template +24 -0
- package/src/ts/dynamodb/files/src/client.ts.template +61 -0
- package/src/ts/dynamodb/files/src/entities/example.ts.template +47 -0
- package/src/ts/dynamodb/files/src/entities/index.ts.template +1 -0
- package/src/ts/dynamodb/files/src/index.ts.template +2 -0
- package/src/ts/dynamodb/generator.d.ts +10 -0
- package/src/ts/dynamodb/generator.js +111 -0
- package/src/ts/dynamodb/generator.js.map +1 -0
- package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/ts/dynamodb/mcp-server-connection/generator.d.ts +10 -0
- package/src/ts/dynamodb/mcp-server-connection/generator.js +32 -0
- package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.d.ts +14 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.json +22 -0
- package/src/ts/dynamodb/schema.d.ts +15 -0
- package/src/ts/dynamodb/schema.json +70 -0
- package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +23 -0
- package/src/ts/dynamodb/smithy-connection/generator.d.ts +10 -0
- package/src/ts/dynamodb/smithy-connection/generator.js +30 -0
- package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -0
- package/src/ts/dynamodb/smithy-connection/schema.d.ts +12 -0
- package/src/ts/dynamodb/smithy-connection/schema.json +18 -0
- package/src/ts/dynamodb/trpc-connection/__snapshots__/generator.spec.ts.snap +23 -0
- package/src/ts/dynamodb/trpc-connection/generator.d.ts +10 -0
- package/src/ts/dynamodb/trpc-connection/generator.js +30 -0
- package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -0
- package/src/ts/dynamodb/trpc-connection/schema.d.ts +12 -0
- package/src/ts/dynamodb/trpc-connection/schema.json +18 -0
- package/src/ts/lambda-function/generator.d.ts +3 -3
- package/src/ts/lambda-function/generator.js +8 -8
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +32 -65
- package/src/ts/lib/__snapshots__/vitest.spec.ts.snap +24 -0
- package/src/ts/lib/biome.d.ts +7 -0
- package/src/ts/lib/biome.js +58 -0
- package/src/ts/lib/biome.js.map +1 -0
- package/src/ts/lib/generator.d.ts +3 -3
- package/src/ts/lib/generator.js +27 -29
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/grit/vitest-pass-with-no-tests.grit +1 -4
- package/src/ts/lib/ts-project-utils.d.ts +12 -2
- package/src/ts/lib/ts-project-utils.js +30 -10
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/vitest.d.ts +2 -2
- package/src/ts/lib/vitest.js +1 -1
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +82 -12
- package/src/ts/mcp-server/generator.d.ts +3 -3
- package/src/ts/mcp-server/generator.js +34 -12
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +19 -14
- package/src/ts/nx-generator/generator.d.ts +2 -2
- package/src/ts/nx-generator/generator.js +52 -19
- package/src/ts/nx-generator/generator.js.map +1 -1
- package/src/ts/nx-plugin/generator.d.ts +3 -3
- package/src/ts/nx-plugin/generator.js +10 -9
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/nx-plugin/utils.d.ts +1 -1
- package/src/ts/nx-plugin/utils.js +10 -4
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +252 -388
- package/src/ts/rdb/agent-connection/generator.d.ts +3 -3
- package/src/ts/rdb/agent-connection/generator.js +4 -4
- package/src/ts/rdb/agent-connection/generator.js.map +1 -1
- package/src/ts/rdb/files/config.json.template +14 -0
- package/src/ts/rdb/files/prisma.config.ts.template +5 -4
- package/src/ts/rdb/files/src/index.ts.template +0 -1
- package/src/ts/rdb/files/src/prisma.ts.template +26 -21
- package/src/ts/rdb/generator.d.ts +3 -7
- package/src/ts/rdb/generator.js +52 -41
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/generator.d.ts +3 -3
- package/src/ts/rdb/mcp-server-connection/generator.js +4 -4
- package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/rdb/smithy-connection/generator.d.ts +3 -3
- package/src/ts/rdb/smithy-connection/generator.js +4 -4
- package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
- package/src/ts/rdb/trpc-connection/generator.d.ts +3 -3
- package/src/ts/rdb/trpc-connection/generator.js +3 -3
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
- package/src/ts/rdb/utils.d.ts +1 -1
- package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +1 -16
- package/src/ts/react-website/agui/generator.d.ts +1 -1
- package/src/ts/react-website/agui/generator.js +4 -5
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +530 -367
- package/src/ts/react-website/app/generator.d.ts +3 -3
- package/src/ts/react-website/app/generator.js +21 -17
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +1 -7
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +9 -3
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.ux-provider.spec.ts.snap +0 -20
- package/src/ts/react-website/cognito-auth/generator.d.ts +3 -3
- package/src/ts/react-website/cognito-auth/generator.js +10 -13
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/grit/cloudscape-auth-menu.grit +8 -6
- package/src/ts/react-website/cognito-auth/grit/cognito-auth-wrapper.grit +1 -1
- package/src/ts/react-website/cognito-auth/grit/none-auth-menu.grit +1 -0
- package/src/ts/react-website/cognito-auth/grit/shadcn-auth-menu.grit +3 -1
- package/src/ts/react-website/cognito-auth/grit/shadcn-state-declarations.grit +3 -1
- package/src/ts/react-website/cognito-auth/utils.d.ts +1 -1
- package/src/ts/react-website/cognito-auth/utils.js +1 -1
- package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
- package/src/ts/react-website/runtime-config/generator.d.ts +3 -3
- package/src/ts/react-website/runtime-config/generator.js +4 -4
- package/src/ts/react-website/runtime-config/generator.js.map +1 -1
- package/src/ts/sync/generator.d.ts +3 -3
- package/src/ts/sync/generator.js +2 -2
- package/src/ts/sync/generator.js.map +1 -1
- package/src/ts/website/app/generator.d.ts +3 -3
- package/src/ts/website/app/generator.js +1 -1
- package/src/ts/website/app/generator.js.map +1 -1
- package/src/ts/website/auth/generator.d.ts +3 -3
- package/src/ts/website/auth/generator.js +1 -1
- package/src/ts/website/auth/generator.js.map +1 -1
- package/src/utils/agent-chat/agent-chat.d.ts +31 -0
- package/src/utils/agent-chat/agent-chat.js +30 -0
- package/src/utils/agent-chat/agent-chat.js.map +1 -0
- package/src/utils/agent-chat/files/a2a/chat.ts.template +33 -0
- package/src/utils/agent-chat/files/ag-ui/chat.ts.template +17 -0
- package/src/utils/agent-chat/files/common/agentcore.ts.template +81 -0
- package/src/utils/agent-chat/files/http-py/chat.ts.template +43 -0
- package/src/utils/agent-chat/files/http-ts/chat.ts.template +54 -0
- package/src/utils/agent-connection/agent-connection.d.ts +67 -24
- package/src/utils/agent-connection/agent-connection.js +236 -44
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-connection/files/core-a2a/agentcore-a2a-client-config.ts.template +93 -0
- package/src/utils/agent-connection/files/core-auth/agentcore-endpoints.ts.template +37 -0
- package/src/utils/agent-connection/files/core-auth/agentcore-fetch.ts.template +54 -0
- package/src/utils/agent-connection/files/core-gateway/agentcore-gateway-mcp-transport.ts.template +41 -0
- package/src/utils/agent-connection/files/core-mcp/agentcore-mcp-transport.ts.template +70 -0
- package/src/utils/agent-connection/files/core-runtime-config/runtime-config.ts.template +22 -32
- package/src/utils/agent-connection/files/core-shared/agentcore-transport.ts.template +39 -0
- package/src/utils/agent-connection/files/core-strands/a2a/agentcore-a2a-client-strands.ts.template +61 -0
- package/src/utils/agent-connection/files/core-strands/base/model-errors-strands.ts.template +36 -0
- package/src/utils/agent-connection/files/core-strands/gateway/agentcore-gateway-mcp-client-strands.ts.template +26 -0
- package/src/utils/agent-connection/files/core-strands/mcp/agentcore-mcp-client-strands.ts.template +27 -0
- package/src/utils/agent-connection/files/py-core-a2a/agentcore_a2a_client_config.py.template +43 -0
- package/src/utils/agent-connection/files/py-core-auth/agentcore_endpoints.py.template +47 -0
- package/src/utils/agent-connection/files/py-core-auth/auth/session.py.template +51 -0
- package/src/utils/agent-connection/files/py-core-gateway/agentcore_gateway_mcp_transport.py.template +28 -0
- package/src/utils/agent-connection/files/py-core-mcp/agentcore_mcp_transport.py.template +34 -0
- package/src/utils/agent-connection/files/py-core-runtime-config/runtime_config.py.template +5 -18
- package/src/utils/agent-connection/files/py-core-shared/agentcore_transport.py.template +40 -0
- package/src/utils/agent-connection/files/py-core-strands/a2a/agentcore_a2a_client_strands.py.template +66 -0
- package/src/utils/agent-connection/files/py-core-strands/base/model_errors_strands.py.template +40 -0
- package/src/utils/agent-connection/files/py-core-strands/gateway/agentcore_gateway_mcp_client_strands.py.template +22 -0
- package/src/utils/agent-connection/files/py-core-strands/mcp/agentcore_mcp_client_strands.py.template +30 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +11 -3
- package/src/utils/agent-core-constructs/agent-core-constructs.js +57 -12
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +4 -0
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +40 -0
- package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +375 -0
- package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/readiness-probe/index.js.template +55 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +335 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/render-cedar.cjs.template +13 -0
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +77 -9
- package/src/utils/agent-core-constructs/files/terraform/core/agentcore-gateway/gateway.tf.template +14 -0
- package/src/utils/api-constructs/api-constructs.d.ts +2 -2
- package/src/utils/api-constructs/api-constructs.js +1 -1
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +3 -0
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +9 -0
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +23 -1
- package/src/utils/api-constructs/files/cdk/core/api/utils/utils.ts.template +61 -7
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +3 -0
- package/src/utils/api-constructs/open-api-metadata.d.ts +2 -2
- package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
- package/src/utils/ast/website.d.ts +5 -1
- package/src/utils/ast/website.js +3 -3
- package/src/utils/ast/website.js.map +1 -1
- package/src/utils/ast.d.ts +33 -1
- package/src/utils/ast.js +89 -4
- package/src/utils/ast.js.map +1 -1
- package/src/utils/bundle/bundle.d.ts +1 -1
- package/src/utils/bundle/bundle.js +2 -2
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/config/index.d.ts +5 -5
- package/src/utils/config/utils.d.ts +13 -3
- package/src/utils/config/utils.js +37 -5
- package/src/utils/config/utils.js.map +1 -1
- package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +1 -1
- package/src/utils/connection/open-api/react.d.ts +1 -1
- package/src/utils/connection/open-api/react.js +4 -4
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/containers.d.ts +1 -1
- package/src/utils/dynamodb-constructs/dynamodb-constructs.d.ts +18 -0
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js +49 -0
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -0
- package/src/utils/dynamodb-constructs/files/cdk/app/dynamodb/__nameKebabCase__.ts.template +43 -0
- package/src/utils/dynamodb-constructs/files/cdk/core/dynamodb.ts.template +105 -0
- package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +62 -0
- package/src/utils/dynamodb-constructs/files/terraform/core/dynamodb/dynamodb.tf.template +155 -0
- package/src/utils/files/common/scripts/src/dynamodb/create-local-table.ts.template +195 -0
- package/src/utils/files/common/scripts/src/dynamodb/pull-image.ts.template +13 -0
- package/src/utils/files/common/scripts/src/dynamodb/start-container.ts.template +91 -0
- package/src/utils/files/common/scripts/src/rdb/pull-image.ts.template +16 -0
- package/src/utils/files/common/scripts/src/rdb/start-container.ts.template +102 -0
- package/src/utils/files/common/scripts/src/rdb/wait-for-db.ts.template +59 -0
- package/src/utils/files/terraform/src/core/runtime-config/appconfig-deployment/appconfig-deployment.tf.template +9 -3
- package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +7 -2
- package/src/utils/format.d.ts +45 -2
- package/src/utils/format.js +167 -46
- package/src/utils/format.js.map +1 -1
- package/src/utils/fs.d.ts +1 -1
- package/src/utils/fs.js.map +1 -1
- package/src/utils/function-constructs/function-constructs.d.ts +2 -2
- package/src/utils/function-constructs/function-constructs.js +1 -1
- package/src/utils/function-constructs/function-constructs.js.map +1 -1
- package/src/utils/generators.d.ts +4 -0
- package/src/utils/generators.js +4 -4
- package/src/utils/generators.js.map +1 -1
- package/src/utils/git.d.ts +1 -1
- package/src/utils/git.js.map +1 -1
- package/src/utils/iac.d.ts +1 -1
- package/src/utils/iac.js.map +1 -1
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +1 -5
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +9 -3
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +2 -4
- package/src/utils/identity-constructs/identity-constructs.d.ts +2 -2
- package/src/utils/identity-constructs/identity-constructs.js +1 -1
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/js.d.ts +4 -0
- package/src/utils/js.js +4 -4
- package/src/utils/js.js.map +1 -1
- package/src/utils/mcp.d.ts +25 -0
- package/src/utils/mcp.js +81 -0
- package/src/utils/mcp.js.map +1 -0
- package/src/utils/metrics.d.ts +9 -3
- package/src/utils/metrics.js +58 -28
- package/src/utils/metrics.js.map +1 -1
- package/src/utils/npm-scope.d.ts +1 -1
- package/src/utils/npm-scope.js.map +1 -1
- package/src/utils/nx.d.ts +7 -2
- package/src/utils/nx.js +46 -14
- package/src/utils/nx.js.map +1 -1
- package/src/utils/nxlv-python.d.ts +1 -1
- package/src/utils/paths.d.ts +1 -1
- package/src/utils/pnpm-workspace.d.ts +1 -1
- package/src/utils/pnpm-workspace.js.map +1 -1
- package/src/utils/port.d.ts +31 -3
- package/src/utils/port.js +74 -4
- package/src/utils/port.js.map +1 -1
- package/src/utils/py.d.ts +2 -2
- package/src/utils/py.js +13 -6
- package/src/utils/py.js.map +1 -1
- package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +12 -2
- package/src/utils/rdb-constructs/files/cdk/core/rdb/aurora.ts.template +30 -1
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +38 -16
- package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +28 -13
- package/src/utils/rdb-constructs/rdb-constructs.d.ts +5 -4
- package/src/utils/rdb-constructs/rdb-constructs.js +3 -11
- package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
- package/src/utils/shared-constructs-constants.d.ts +1 -0
- package/src/utils/shared-constructs-constants.js +2 -1
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +2 -2
- package/src/utils/shared-constructs.js +7 -7
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.d.ts +11 -0
- package/src/utils/shared-dynamodb-scripts.js +23 -0
- package/src/utils/shared-dynamodb-scripts.js.map +1 -0
- package/src/utils/shared-infra-config.d.ts +1 -1
- package/src/utils/shared-infra-config.js +1 -1
- package/src/utils/shared-infra-config.js.map +1 -1
- package/src/utils/shared-infra-scripts.d.ts +11 -0
- package/src/utils/shared-infra-scripts.js +35 -0
- package/src/utils/shared-infra-scripts.js.map +1 -0
- package/src/utils/shared-rdb-scripts.d.ts +11 -0
- package/src/utils/shared-rdb-scripts.js +20 -0
- package/src/utils/shared-rdb-scripts.js.map +1 -0
- package/src/utils/shared-scripts.d.ts +2 -5
- package/src/utils/shared-scripts.js +2 -23
- package/src/utils/shared-scripts.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +1 -1
- package/src/utils/shared-shadcn.js +1 -13
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/test.d.ts +5 -1
- package/src/utils/test.js +9 -5
- package/src/utils/test.js.map +1 -1
- package/src/utils/toml.d.ts +1 -1
- package/src/utils/toml.js +4 -0
- package/src/utils/toml.js.map +1 -1
- package/src/utils/versions.d.ts +82 -83
- package/src/utils/versions.js +81 -82
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +72 -5
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +63 -15
- package/src/utils/website-constructs/website-constructs.d.ts +2 -2
- package/src/utils/website-constructs/website-constructs.js +1 -1
- package/src/utils/website-constructs/website-constructs.js.map +1 -1
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client.py.template +0 -22
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client.py.template +0 -22
- package/src/py/agent/scripts/http/chat.ts.template +0 -38
- package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client.ts.template +0 -19
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client.ts.template +0 -19
- package/src/ts/agent/scripts/http/chat.ts.template +0 -35
- package/src/ts/lib/eslint.d.ts +0 -14
- package/src/ts/lib/eslint.js +0 -90
- package/src/ts/lib/eslint.js.map +0 -1
- package/src/ts/lib/grit/eslint-dependency-checks-warn.grit +0 -1
- package/src/ts/rdb/files/scripts/docker-pull.ts.template +0 -15
- package/src/ts/rdb/files/scripts/docker-start.ts.template +0 -84
- package/src/ts/rdb/files/scripts/wait-for-db.ts.template +0 -55
- package/src/ts/rdb/files/src/constants.ts.template +0 -8
- package/src/utils/agent-connection/files/core-a2a/agentcore-a2a-client.ts.template +0 -123
- package/src/utils/agent-connection/files/core-mcp/agentcore-mcp-client.ts.template +0 -128
- package/src/utils/agent-connection/files/py-core-a2a/agentcore_a2a_client.py.template +0 -120
- package/src/utils/agent-connection/files/py-core-mcp/agentcore_mcp_client.py.template +0 -89
- /package/src/utils/agent-connection/files/{core-runtime-config/with-session-id.ts.template → core-strands/base/with-session-id-strands.ts.template} +0 -0
- /package/src/utils/agent-connection/files/{py-core-runtime-config/with_session_id.py.template → py-core-strands/base/with_session_id_strands.py.template} +0 -0
- /package/src/utils/files/common/scripts/src/{index.ts.template → infra/index.ts.template} +0 -0
- /package/src/utils/files/common/scripts/src/{infra-deploy.ts.template → infra/infra-deploy.ts.template} +0 -0
- /package/src/utils/files/common/scripts/src/{infra-destroy.ts.template → infra/infra-destroy.ts.template} +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/cdk-command.ts.template +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/credentials.ts.template +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/run.ts.template +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/stage-parser.ts.template +0 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
import * as agentcore from 'aws-cdk-lib/aws-bedrockagentcore';
|
|
3
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
4
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
5
|
+
import * as triggers from 'aws-cdk-lib/triggers';
|
|
6
|
+
import { Construct } from 'constructs';
|
|
7
|
+
import ejs from 'ejs';
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
import * as url from 'node:url';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props for the AgentCoreGateway construct.
|
|
14
|
+
*/
|
|
15
|
+
export interface AgentCoreGatewayProps {
|
|
16
|
+
/**
|
|
17
|
+
* Directory of Cedar policy files (`.cedar`, nested folders supported).
|
|
18
|
+
* When set, a `PolicyEngine` running in `ENFORCE` mode is attached to the
|
|
19
|
+
* gateway, with one `Policy` per file. Files are EJS templates rendered at
|
|
20
|
+
* synth time with `gatewayArn` and `accountId` in scope.
|
|
21
|
+
*/
|
|
22
|
+
readonly cedarPolicyPath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Additional variables available to the Cedar policy EJS templates.
|
|
25
|
+
*/
|
|
26
|
+
readonly cedarPolicyVariables?: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* AgentCore Gateway wired for MCP protocol with IAM inbound auth, exposing
|
|
31
|
+
* attached MCP servers' tools under `<targetName>___<toolName>` names.
|
|
32
|
+
*/
|
|
33
|
+
export class AgentCoreGateway extends Construct implements iam.IGrantable {
|
|
34
|
+
public readonly gateway: agentcore.Gateway;
|
|
35
|
+
public readonly policyEngine?: agentcore.CfnPolicyEngine;
|
|
36
|
+
private readonly policies: agentcore.CfnPolicy[] = [];
|
|
37
|
+
private targetReadinessProbe?: triggers.TriggerFunction;
|
|
38
|
+
private readonly targetRuntimeArns: string[] = [];
|
|
39
|
+
|
|
40
|
+
constructor(scope: Construct, id: string, props?: AgentCoreGatewayProps) {
|
|
41
|
+
super(scope, id);
|
|
42
|
+
|
|
43
|
+
this.gateway = new agentcore.Gateway(this, 'Gateway', {
|
|
44
|
+
protocolConfiguration: new agentcore.McpProtocolConfiguration({
|
|
45
|
+
searchType: agentcore.McpGatewaySearchType.SEMANTIC,
|
|
46
|
+
supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],
|
|
47
|
+
}),
|
|
48
|
+
authorizerConfiguration: agentcore.GatewayAuthorizer.usingAwsIam(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (props?.cedarPolicyPath) {
|
|
52
|
+
this.policyEngine = new agentcore.CfnPolicyEngine(this, 'PolicyEngine', {
|
|
53
|
+
name: cdk.Names.uniqueResourceName(this, { maxLength: 48 }),
|
|
54
|
+
description: `Cedar policy engine for ${id}`,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// The stable Gateway L2 does not yet expose policy engine
|
|
58
|
+
// configuration, so attach it via the underlying CloudFormation
|
|
59
|
+
// resource.
|
|
60
|
+
const cfnGateway = this.gateway.node.defaultChild as agentcore.CfnGateway;
|
|
61
|
+
cfnGateway.policyEngineConfiguration = {
|
|
62
|
+
arn: this.policyEngine.attrPolicyEngineArn,
|
|
63
|
+
mode: 'ENFORCE',
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Permissions the gateway role needs to evaluate policies, including
|
|
67
|
+
// CheckAuthorizePermissions, which the CloudFormation handler's
|
|
68
|
+
// readiness probe requires during gateway creation. Authorization
|
|
69
|
+
// actions are evaluated against both the policy engine ARN and the
|
|
70
|
+
// gateway's own ARN (which cannot be referenced here without a circular
|
|
71
|
+
// dependency, so it is scoped to this account and region's gateways).
|
|
72
|
+
// The gateway must depend on the policy update — access is validated at
|
|
73
|
+
// creation.
|
|
74
|
+
const policyGrant = this.gateway.role.addToPrincipalPolicy(
|
|
75
|
+
new iam.PolicyStatement({
|
|
76
|
+
actions: [
|
|
77
|
+
'bedrock-agentcore:GetPolicyEngine',
|
|
78
|
+
'bedrock-agentcore:AuthorizeAction',
|
|
79
|
+
'bedrock-agentcore:PartiallyAuthorizeActions',
|
|
80
|
+
'bedrock-agentcore:CheckAuthorizePermissions',
|
|
81
|
+
],
|
|
82
|
+
resources: [
|
|
83
|
+
this.policyEngine.attrPolicyEngineArn,
|
|
84
|
+
cdk.Stack.of(this).formatArn({
|
|
85
|
+
service: 'bedrock-agentcore',
|
|
86
|
+
resource: 'gateway',
|
|
87
|
+
resourceName: '*',
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
if (policyGrant.policyDependable) {
|
|
93
|
+
cfnGateway.node.addDependency(policyGrant.policyDependable);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const policiesDir = props.cedarPolicyPath;
|
|
97
|
+
if (fs.existsSync(policiesDir)) {
|
|
98
|
+
for (const file of fs
|
|
99
|
+
.readdirSync(policiesDir, { recursive: true, encoding: 'utf-8' })
|
|
100
|
+
.filter((f) => f.endsWith('.cedar'))) {
|
|
101
|
+
const raw = fs.readFileSync(path.join(policiesDir, file), 'utf-8');
|
|
102
|
+
const statement = cdk.Lazy.string({
|
|
103
|
+
produce: () =>
|
|
104
|
+
ejs.render(raw, {
|
|
105
|
+
gatewayArn: cdk.Token.asString(this.gateway.gatewayArn),
|
|
106
|
+
accountId: cdk.Token.asString(cdk.Stack.of(this).account),
|
|
107
|
+
...props.cedarPolicyVariables,
|
|
108
|
+
}),
|
|
109
|
+
});
|
|
110
|
+
const policyId = `Policy-${file.replace(/\.cedar$/, '').replace(/[\\/]/g, '-')}`;
|
|
111
|
+
const policy = new agentcore.CfnPolicy(this, policyId, {
|
|
112
|
+
name: policyId,
|
|
113
|
+
policyEngineId: this.policyEngine.attrPolicyEngineId,
|
|
114
|
+
definition: { cedar: { statement } },
|
|
115
|
+
description: `Policy loaded from ${file}`,
|
|
116
|
+
// The Cedar analyzer rejects legitimate policies as findings
|
|
117
|
+
// (e.g. a forbid disabling one tool for every caller is "Overly
|
|
118
|
+
// Restrictive"), so deploy regardless and rely on the engine's
|
|
119
|
+
// ENFORCE mode.
|
|
120
|
+
validationMode: 'IGNORE_ALL_FINDINGS',
|
|
121
|
+
});
|
|
122
|
+
// Policy names are unique account-wide, so derive the name from
|
|
123
|
+
// the construct path to avoid collisions with other gateways.
|
|
124
|
+
policy.name = cdk.Names.uniqueResourceName(policy, {
|
|
125
|
+
maxLength: 48,
|
|
126
|
+
});
|
|
127
|
+
this.policies.push(policy);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The principal to grant permissions to.
|
|
135
|
+
*/
|
|
136
|
+
public get grantPrincipal(): iam.IPrincipal {
|
|
137
|
+
return this.gateway.role.grantPrincipal;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Grants an IAM principal permission to invoke this gateway.
|
|
142
|
+
*/
|
|
143
|
+
public grantInvokeAccess(grantee: iam.IGrantable) {
|
|
144
|
+
this.gateway.grantInvoke(grantee);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Add an MCP server construct as a target of this Gateway.
|
|
149
|
+
*
|
|
150
|
+
* The target name defaults to the MCP server construct's `mcpServerName`
|
|
151
|
+
* (its project's class name in kebab-case, e.g. `TsMcp` -> `ts-mcp`),
|
|
152
|
+
* which is stable across stacks and unique across projects in the
|
|
153
|
+
* workspace. It prefixes Cedar action names
|
|
154
|
+
* (`AgentCore::Action::"<targetName>___<toolName>"`) and the gateway's
|
|
155
|
+
* tool names (`<targetName>___<toolName>`), so renaming it later is a
|
|
156
|
+
* breaking change for consumers.
|
|
157
|
+
*/
|
|
158
|
+
public addMcpServer(
|
|
159
|
+
server: Construct & {
|
|
160
|
+
readonly agentCoreRuntime: agentcore.Runtime;
|
|
161
|
+
readonly mcpServerName: string;
|
|
162
|
+
},
|
|
163
|
+
props?: {
|
|
164
|
+
gatewayTargetName?: string;
|
|
165
|
+
},
|
|
166
|
+
): agentcore.CfnGatewayTarget {
|
|
167
|
+
return this.addMcpServerTarget({
|
|
168
|
+
gatewayTargetName: props?.gatewayTargetName ?? server.mcpServerName,
|
|
169
|
+
mcpServerRuntimeArn: server.agentCoreRuntime.agentRuntimeArn,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Register an MCP server runtime ARN as a Gateway target. Prefer
|
|
175
|
+
* {@link addMcpServer} when the construct is in scope.
|
|
176
|
+
*/
|
|
177
|
+
public addMcpServerTarget(props: {
|
|
178
|
+
gatewayTargetName: string;
|
|
179
|
+
mcpServerRuntimeArn: string;
|
|
180
|
+
}): agentcore.CfnGatewayTarget {
|
|
181
|
+
const region = cdk.Stack.of(this).region;
|
|
182
|
+
// The endpoint must URL-encode the runtime ARN (':' -> '%3A', '/' -> '%2F').
|
|
183
|
+
// The ARN is a CDK token, so encode at deploy time via Fn.join/Fn.split.
|
|
184
|
+
const arn = props.mcpServerRuntimeArn;
|
|
185
|
+
const encodedArn = cdk.Fn.join(
|
|
186
|
+
'%2F',
|
|
187
|
+
cdk.Fn.split('/', cdk.Fn.join('%3A', cdk.Fn.split(':', arn))),
|
|
188
|
+
);
|
|
189
|
+
const endpoint = `https://bedrock-agentcore.${region}.amazonaws.com/runtimes/${encodedArn}/invocations?qualifier=DEFAULT`;
|
|
190
|
+
const target = this.addTarget(props.gatewayTargetName, endpoint);
|
|
191
|
+
|
|
192
|
+
// Grant the gateway role invoke access to the target runtime before the
|
|
193
|
+
// target is created — AgentCore probes the target during creation, which
|
|
194
|
+
// stalls if the permission is not yet in place.
|
|
195
|
+
const grant = this.gateway.role.addToPrincipalPolicy(
|
|
196
|
+
new iam.PolicyStatement({
|
|
197
|
+
actions: [
|
|
198
|
+
'bedrock-agentcore:InvokeAgentRuntime',
|
|
199
|
+
'bedrock-agentcore:InvokeAgentRuntimeWithWebSocketStream',
|
|
200
|
+
],
|
|
201
|
+
resources: [
|
|
202
|
+
props.mcpServerRuntimeArn,
|
|
203
|
+
`${props.mcpServerRuntimeArn}/*`,
|
|
204
|
+
],
|
|
205
|
+
}),
|
|
206
|
+
);
|
|
207
|
+
if (grant.policyDependable) {
|
|
208
|
+
target.node.addDependency(grant.policyDependable);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Create the target only after the readiness probe has confirmed the
|
|
212
|
+
// runtime serves MCP.
|
|
213
|
+
this.targetRuntimeArns.push(props.mcpServerRuntimeArn);
|
|
214
|
+
const probe = this.getOrCreateTargetReadinessProbe();
|
|
215
|
+
const probeGrant = probe.grantPrincipal.addToPrincipalPolicy(
|
|
216
|
+
new iam.PolicyStatement({
|
|
217
|
+
actions: ['bedrock-agentcore:InvokeAgentRuntime'],
|
|
218
|
+
resources: [
|
|
219
|
+
props.mcpServerRuntimeArn,
|
|
220
|
+
`${props.mcpServerRuntimeArn}/*`,
|
|
221
|
+
],
|
|
222
|
+
}),
|
|
223
|
+
);
|
|
224
|
+
if (probeGrant.policyDependable) {
|
|
225
|
+
probe.trigger.node.addDependency(probeGrant.policyDependable);
|
|
226
|
+
}
|
|
227
|
+
target.node.addDependency(probe.trigger);
|
|
228
|
+
|
|
229
|
+
return target;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Add another Gateway as a target of this Gateway, exposing its tools
|
|
234
|
+
* under `<targetName>___<innerTargetName>___<toolName>` names.
|
|
235
|
+
*
|
|
236
|
+
* The target name defaults to the gateway construct's `gatewayName`
|
|
237
|
+
* (its project's class name in kebab-case, e.g. `MyGateway` ->
|
|
238
|
+
* `my-gateway`). It prefixes Cedar action names and the gateway's tool
|
|
239
|
+
* names, so renaming it later is a breaking change for consumers.
|
|
240
|
+
*
|
|
241
|
+
* Both gateways evaluate their own Cedar policies: this gateway
|
|
242
|
+
* authorizes the prefixed action, then the target gateway authorizes the
|
|
243
|
+
* inner action for this gateway's role.
|
|
244
|
+
*/
|
|
245
|
+
public addGateway(
|
|
246
|
+
gateway: Construct & {
|
|
247
|
+
readonly gateway: agentcore.Gateway;
|
|
248
|
+
readonly gatewayName: string;
|
|
249
|
+
},
|
|
250
|
+
props?: {
|
|
251
|
+
gatewayTargetName?: string;
|
|
252
|
+
},
|
|
253
|
+
): agentcore.CfnGatewayTarget {
|
|
254
|
+
const target = this.addGatewayTarget({
|
|
255
|
+
gatewayTargetName: props?.gatewayTargetName ?? gateway.gatewayName,
|
|
256
|
+
// The Gateway L2 only populates gatewayUrl when created from its own
|
|
257
|
+
// props; fall back to the CloudFormation attribute otherwise.
|
|
258
|
+
gatewayUrl:
|
|
259
|
+
gateway.gateway.gatewayUrl ??
|
|
260
|
+
(gateway.gateway.node.defaultChild as agentcore.CfnGateway)
|
|
261
|
+
.attrGatewayUrl,
|
|
262
|
+
gatewayArn: gateway.gateway.gatewayArn,
|
|
263
|
+
});
|
|
264
|
+
// AgentCore fetches the target gateway's tools during target creation,
|
|
265
|
+
// so the target gateway and all of its own targets must exist first.
|
|
266
|
+
// Construct dependencies resolve at synth time, covering targets added
|
|
267
|
+
// to the target gateway after this call.
|
|
268
|
+
target.node.addDependency(gateway);
|
|
269
|
+
return target;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Register another Gateway's MCP endpoint as a target of this Gateway.
|
|
274
|
+
* Prefer {@link addGateway} when the construct is in scope — it also
|
|
275
|
+
* orders this gateway's target after the target gateway's own targets,
|
|
276
|
+
* so its tools are registered before they are fetched.
|
|
277
|
+
*/
|
|
278
|
+
public addGatewayTarget(props: {
|
|
279
|
+
gatewayTargetName: string;
|
|
280
|
+
gatewayUrl: string;
|
|
281
|
+
gatewayArn: string;
|
|
282
|
+
}): agentcore.CfnGatewayTarget {
|
|
283
|
+
const target = this.addTarget(props.gatewayTargetName, props.gatewayUrl);
|
|
284
|
+
|
|
285
|
+
// Grant the gateway role invoke access to the target gateway before the
|
|
286
|
+
// target is created — AgentCore fetches the target's tools during
|
|
287
|
+
// creation, which fails if the permission is not yet in place.
|
|
288
|
+
const grant = this.gateway.role.addToPrincipalPolicy(
|
|
289
|
+
new iam.PolicyStatement({
|
|
290
|
+
actions: ['bedrock-agentcore:InvokeGateway'],
|
|
291
|
+
resources: [props.gatewayArn],
|
|
292
|
+
}),
|
|
293
|
+
);
|
|
294
|
+
if (grant.policyDependable) {
|
|
295
|
+
target.node.addDependency(grant.policyDependable);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return target;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Create a Gateway target for an MCP endpoint, with outbound calls signed
|
|
303
|
+
* using this gateway's own execution role.
|
|
304
|
+
*/
|
|
305
|
+
private addTarget(
|
|
306
|
+
gatewayTargetName: string,
|
|
307
|
+
endpoint: string,
|
|
308
|
+
): agentcore.CfnGatewayTarget {
|
|
309
|
+
// The construct id is derived from the target name so the two change
|
|
310
|
+
// together — target names are unique per gateway, and replacing a target
|
|
311
|
+
// under an unchanged name fails with AlreadyExists.
|
|
312
|
+
const target = new agentcore.CfnGatewayTarget(
|
|
313
|
+
this,
|
|
314
|
+
`Target-${gatewayTargetName}`,
|
|
315
|
+
{
|
|
316
|
+
gatewayIdentifier: this.gateway.gatewayId,
|
|
317
|
+
name: gatewayTargetName,
|
|
318
|
+
targetConfiguration: {
|
|
319
|
+
mcp: {
|
|
320
|
+
mcpServer: {
|
|
321
|
+
endpoint,
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
credentialProviderConfigurations: [
|
|
326
|
+
{
|
|
327
|
+
credentialProviderType: 'GATEWAY_IAM_ROLE',
|
|
328
|
+
credentialProvider: {
|
|
329
|
+
iamCredentialProvider: {
|
|
330
|
+
service: 'bedrock-agentcore',
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
],
|
|
335
|
+
},
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
// Policies referencing this target's actions (e.g.
|
|
339
|
+
// AgentCore::Action::"<targetName>___<tool>") only validate once the
|
|
340
|
+
// target has registered them, so create policies after targets.
|
|
341
|
+
for (const policy of this.policies) {
|
|
342
|
+
policy.node.addDependency(target);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return target;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* AgentCore fetches each target's tools during target creation, which can
|
|
350
|
+
* race the MCP runtime's first cold start on a fresh deploy and fail the
|
|
351
|
+
* target. This trigger probes each runtime until it serves MCP, and targets
|
|
352
|
+
* are created after it succeeds.
|
|
353
|
+
*/
|
|
354
|
+
private getOrCreateTargetReadinessProbe(): triggers.TriggerFunction {
|
|
355
|
+
this.targetReadinessProbe ??= new triggers.TriggerFunction(
|
|
356
|
+
this,
|
|
357
|
+
'TargetReadinessProbe',
|
|
358
|
+
{
|
|
359
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
360
|
+
handler: 'index.handler',
|
|
361
|
+
timeout: cdk.Duration.seconds(210),
|
|
362
|
+
code: lambda.Code.fromAsset(
|
|
363
|
+
url.fileURLToPath(new URL('./readiness-probe', import.meta.url)),
|
|
364
|
+
),
|
|
365
|
+
environment: {
|
|
366
|
+
RUNTIME_ARNS: cdk.Lazy.string({
|
|
367
|
+
produce: () => this.targetRuntimeArns.join(','),
|
|
368
|
+
}),
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
);
|
|
372
|
+
return this.targetReadinessProbe;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Readiness probe for AgentCore Gateway MCP targets.
|
|
3
|
+
*
|
|
4
|
+
* AgentCore fetches each target's tools during target creation, which can
|
|
5
|
+
* race the MCP runtime's first cold start on a fresh deploy. This handler
|
|
6
|
+
* invokes each runtime with an MCP initialize request — the invocation
|
|
7
|
+
* blocks through the cold start — retrying for up to 3 minutes.
|
|
8
|
+
*/
|
|
9
|
+
const {
|
|
10
|
+
BedrockAgentCoreClient,
|
|
11
|
+
InvokeAgentRuntimeCommand,
|
|
12
|
+
} = require('@aws-sdk/client-bedrock-agentcore');
|
|
13
|
+
|
|
14
|
+
const client = new BedrockAgentCoreClient();
|
|
15
|
+
|
|
16
|
+
const DEADLINE_MS = 3 * 60 * 1000;
|
|
17
|
+
const RETRY_INTERVAL_MS = 5 * 1000;
|
|
18
|
+
|
|
19
|
+
const INITIALIZE_REQUEST = JSON.stringify({
|
|
20
|
+
jsonrpc: '2.0',
|
|
21
|
+
id: 1,
|
|
22
|
+
method: 'initialize',
|
|
23
|
+
params: {
|
|
24
|
+
protocolVersion: '2025-03-26',
|
|
25
|
+
capabilities: {},
|
|
26
|
+
clientInfo: { name: 'readiness-probe', version: '1.0' },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const probe = async (agentRuntimeArn) => {
|
|
31
|
+
const deadline = Date.now() + DEADLINE_MS;
|
|
32
|
+
for (;;) {
|
|
33
|
+
try {
|
|
34
|
+
return await client.send(
|
|
35
|
+
new InvokeAgentRuntimeCommand({
|
|
36
|
+
agentRuntimeArn,
|
|
37
|
+
runtimeSessionId: 'readiness-probe-' + crypto.randomUUID(),
|
|
38
|
+
contentType: 'application/json',
|
|
39
|
+
accept: 'application/json, text/event-stream',
|
|
40
|
+
payload: Buffer.from(INITIALIZE_REQUEST),
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
if (Date.now() >= deadline) {
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
await new Promise((resolve) => setTimeout(resolve, RETRY_INTERVAL_MS));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.handler = async () => {
|
|
53
|
+
const arns = (process.env.RUNTIME_ARNS ?? '').split(',').filter(Boolean);
|
|
54
|
+
await Promise.all(arns.map(probe));
|
|
55
|
+
};
|