@aws/nx-plugin 1.0.0-rc.43 → 1.0.0-rc.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE-THIRD-PARTY +121 -154
  2. package/generators.json +6 -0
  3. package/package.json +4 -4
  4. package/src/agentcore-gateway/files/cedar/policies/README.md +9 -0
  5. package/src/agentcore-gateway/files/cedar/policies/permit-all.cedar +15 -0
  6. package/src/agentcore-gateway/generator.js +12 -5
  7. package/src/agentcore-gateway/generator.js.map +1 -1
  8. package/src/agentcore-gateway/schema.d.js.map +1 -1
  9. package/src/agentcore-gateway/schema.d.ts +1 -1
  10. package/src/agentcore-gateway/schema.json +3 -2
  11. package/src/connection/generator.js +1 -1
  12. package/src/connection/generator.js.map +1 -1
  13. package/src/infra/app/__snapshots__/generator.spec.ts.snap +8 -8
  14. package/src/mcp-server/tools/general-guidance.js +1 -1
  15. package/src/mcp-server/tools/general-guidance.js.map +1 -1
  16. package/src/preset/__snapshots__/generator.spec.ts.snap +6 -3
  17. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
  18. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +6 -6
  19. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +2 -2
  20. package/src/py/agent/gateway-connection/generator.js +1 -1
  21. package/src/py/agent/gateway-connection/generator.js.map +1 -1
  22. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +4 -8
  23. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  24. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  25. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
  26. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +21 -5
  27. package/src/py/rdb/files/Dockerfile.create-db-user.template +4 -0
  28. package/src/py/rdb/files/Dockerfile.migration.template +4 -0
  29. package/src/sdk/ts.d.ts +2 -0
  30. package/src/sdk/ts.js +2 -0
  31. package/src/sdk/ts.js.map +1 -1
  32. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
  33. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  34. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +7 -3
  35. package/src/ts/agent/files/deploy/Dockerfile.template +5 -1
  36. package/src/ts/agent/gateway-connection/generator.js +1 -1
  37. package/src/ts/agent/gateway-connection/generator.js.map +1 -1
  38. package/src/ts/agent/generator.js +6 -0
  39. package/src/ts/agent/generator.js.map +1 -1
  40. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +982 -0
  41. package/src/ts/dcr-proxy/generator.d.ts +10 -0
  42. package/src/ts/dcr-proxy/generator.js +98 -0
  43. package/src/ts/dcr-proxy/generator.js.map +1 -0
  44. package/src/ts/dcr-proxy/schema.d.js +6 -0
  45. package/src/ts/dcr-proxy/schema.d.js.map +1 -0
  46. package/src/ts/dcr-proxy/schema.d.ts +13 -0
  47. package/src/ts/dcr-proxy/schema.json +44 -0
  48. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +4 -8
  49. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  50. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
  51. package/src/ts/mcp-server/files/Dockerfile.template +5 -1
  52. package/src/ts/mcp-server/generator.js +1 -0
  53. package/src/ts/mcp-server/generator.js.map +1 -1
  54. package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +2 -2
  55. package/src/ts/nx-plugin/files/mcp-server/resources/GENERAL_GUIDANCE.md.template +1 -1
  56. package/src/ts/nx-plugin/files/mcp-server/utils.ts.template +1 -1
  57. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +11 -4
  58. package/src/ts/rdb/files/Dockerfile.template +7 -0
  59. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +28 -28
  60. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  61. package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +1 -0
  62. package/src/utils/agent-core-constructs/agent-core-constructs.js +2 -0
  63. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  64. package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +38 -3
  65. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +13 -3
  66. package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +22 -1
  67. package/src/utils/commands.js +1 -1
  68. package/src/utils/commands.js.map +1 -1
  69. package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.d.ts +38 -0
  70. package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js +93 -0
  71. package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js.map +1 -0
  72. package/src/utils/dcr-proxy-constructs/files/cdk/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.ts.template +227 -0
  73. package/src/utils/dcr-proxy-constructs/files/project/src/handlers/authorization-server-metadata.ts.template +39 -0
  74. package/src/utils/dcr-proxy-constructs/files/project/src/handlers/authorize.ts.template +26 -0
  75. package/src/utils/dcr-proxy-constructs/files/project/src/handlers/mcp-proxy.ts.template +89 -0
  76. package/src/utils/dcr-proxy-constructs/files/project/src/handlers/protected-resource-metadata.ts.template +13 -0
  77. package/src/utils/dcr-proxy-constructs/files/project/src/handlers/register.ts.template +70 -0
  78. package/src/utils/dcr-proxy-constructs/files/project/src/handlers/token.ts.template +75 -0
  79. package/src/utils/dcr-proxy-constructs/files/terraform/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.tf.template +410 -0
  80. package/src/utils/docker.d.ts +4 -3
  81. package/src/utils/docker.js +11 -7
  82. package/src/utils/docker.js.map +1 -1
  83. package/src/utils/files/common/scripts/src/dynamodb/start-container.ts.template +1 -3
  84. package/src/utils/files/common/scripts/src/rdb/shared/start-container.ts.template +1 -3
  85. package/src/utils/format.d.ts +1 -1
  86. package/src/utils/format.js +3 -2
  87. package/src/utils/format.js.map +1 -1
  88. package/src/utils/init.js +4 -0
  89. package/src/utils/init.js.map +1 -1
  90. package/src/utils/versions.d.ts +53 -51
  91. package/src/utils/versions.js +53 -49
  92. package/src/utils/versions.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport agentcoreGatewayGatewayConnectionGenerator from '../agentcore-gateway/gateway-connection/generator';\nimport { AGENTCORE_GATEWAY_GENERATOR_INFO } from '../agentcore-gateway/generator';\nimport agentcoreGatewayMcpConnectionGenerator from '../agentcore-gateway/mcp-connection/generator';\nimport pyAgentA2aConnectionGenerator from '../py/agent/a2a-connection/generator';\nimport pyAgentGatewayConnectionGenerator from '../py/agent/gateway-connection/generator';\nimport pyAgentMcpConnectionGenerator from '../py/agent/mcp-connection/generator';\nimport pyAgentReactConnectionGenerator from '../py/agent/react-connection/generator';\nimport pyDynamoDBAgentConnectionGenerator from '../py/dynamodb/agent-connection/generator';\nimport pyDynamoDBFastApiConnectionGenerator from '../py/dynamodb/fast-api-connection/generator';\nimport { PY_DYNAMODB_GENERATOR_INFO } from '../py/dynamodb/generator';\nimport pyDynamoDBMcpServerConnectionGenerator from '../py/dynamodb/mcp-server-connection/generator';\nimport pyRdbAgentConnectionGenerator from '../py/rdb/agent-connection/generator';\nimport pyRdbFastApiConnectionGenerator from '../py/rdb/fast-api-connection/generator';\nimport { PY_RDB_GENERATOR_INFO } from '../py/rdb/generator';\nimport pyRdbMcpServerConnectionGenerator from '../py/rdb/mcp-server-connection/generator';\nimport fastApiReactGenerator from '../py/fast-api/react/generator';\nimport { SMITHY_PROJECT_GENERATOR_INFO } from '../smithy/project/generator';\nimport smithyReactConnectionGenerator from '../smithy/react-connection/generator';\nimport { TS_SMITHY_API_GENERATOR_INFO } from '../smithy/ts/api/generator';\nimport trpcReactGenerator from '../trpc/react/generator';\nimport tsAgentA2aConnectionGenerator from '../ts/agent/a2a-connection/generator';\nimport tsAgentGatewayConnectionGenerator from '../ts/agent/gateway-connection/generator';\nimport tsAgentMcpConnectionGenerator from '../ts/agent/mcp-connection/generator';\nimport tsAgentReactConnectionGenerator from '../ts/agent/react-connection/generator';\nimport tsDynamoDBAgentConnectionGenerator from '../ts/dynamodb/agent-connection/generator';\nimport { TS_DYNAMODB_GENERATOR_INFO } from '../ts/dynamodb/generator';\nimport tsDynamoDBMcpServerConnectionGenerator from '../ts/dynamodb/mcp-server-connection/generator';\nimport tsDynamoDBSmithyConnectionGenerator from '../ts/dynamodb/smithy-connection/generator';\nimport tsDynamoDBTrpcConnectionGenerator from '../ts/dynamodb/trpc-connection/generator';\nimport tsRdbAgentConnectionGenerator from '../ts/rdb/agent-connection/generator';\nimport { TS_RDB_GENERATOR_INFO } from '../ts/rdb/generator';\nimport tsRdbMcpServerConnectionGenerator from '../ts/rdb/mcp-server-connection/generator';\nimport tsRdbSmithyConnectionGenerator from '../ts/rdb/smithy-connection/generator';\nimport tsRdbTrpcConnectionGenerator from '../ts/rdb/trpc-connection/generator';\nimport { hasExportDeclaration } from '../utils/ast';\nimport {\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\nimport { readToml } from '../utils/toml';\nimport type { ConnectionGeneratorSchema } from './schema';\nimport {\n type Connection,\n type ConnectionKey,\n SUPPORTED_CONNECTIONS,\n type SUPPORTED_PROJECT_TYPES,\n} from './supported-connections';\n\nexport type { Connection };\n\ntype ProjectType = (typeof SUPPORTED_PROJECT_TYPES)[number];\n\n/**\n * Sentinel value for sourceComponent/targetComponent that means\n * \"use the project-level connection, not a component\".\n */\nexport const PROJECT_COMPONENT_SENTINEL = '.';\n\n/**\n * The result of resolving a connection, including the matched connection\n * and any resolved source/target component metadata.\n */\nexport interface ResolvedConnection {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Generators for each connection type\n */\n/**\n * Options passed to connection generators, including resolved component metadata.\n */\nexport interface ResolvedConnectionOptions {\n sourceProject: string;\n targetProject: string;\n sourceComponent?: ComponentMetadata;\n targetComponent?: ComponentMetadata;\n preferInstallDependencies?: boolean;\n}\n\nconst CONNECTION_GENERATORS = {\n 'ts#trpc-api -> ts#rdb': (tree, options) =>\n tsRdbTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#rdb': (tree, options) =>\n tsRdbAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#rdb': (tree, options) =>\n tsRdbSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#rdb': (tree, options) =>\n tsRdbMcpServerConnectionGenerator(tree, options),\n 'ts#trpc-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#dynamodb': (tree, options) =>\n tsDynamoDBAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#dynamodb': (tree, options) =>\n tsDynamoDBMcpServerConnectionGenerator(tree, options),\n 'ts#react-website -> ts#trpc-api': (tree, options) =>\n trpcReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n backendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> py#fast-api': (tree, options) =>\n fastApiReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n fastApiProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#smithy-api': (tree, options) =>\n smithyReactConnectionGenerator(tree, {\n frontendProjectName: options.sourceProject,\n smithyModelOrBackendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#agent': (tree, options) =>\n tsAgentReactConnectionGenerator(tree, options),\n 'ts#react-website -> py#agent': (tree, options) =>\n pyAgentReactConnectionGenerator(tree, options),\n 'ts#agent -> ts#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> py#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> ts#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> py#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> ts#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> py#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> ts#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> py#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> agentcore-gateway': (tree, options) =>\n tsAgentGatewayConnectionGenerator(tree, options),\n 'py#agent -> agentcore-gateway': (tree, options) =>\n pyAgentGatewayConnectionGenerator(tree, options),\n 'agentcore-gateway -> ts#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> py#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> agentcore-gateway': (tree, options) =>\n agentcoreGatewayGatewayConnectionGenerator(tree, options),\n 'py#fast-api -> py#dynamodb': (tree, options) =>\n pyDynamoDBFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#dynamodb': (tree, options) =>\n pyDynamoDBAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#dynamodb': (tree, options) =>\n pyDynamoDBMcpServerConnectionGenerator(tree, options),\n 'py#fast-api -> py#rdb': (tree, options) =>\n pyRdbFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#rdb': (tree, options) =>\n pyRdbAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#rdb': (tree, options) =>\n pyRdbMcpServerConnectionGenerator(tree, options),\n} satisfies Record<\n ConnectionKey,\n (tree: Tree, options: ResolvedConnectionOptions) => Promise<any>\n>;\n\n/**\n * Generator for a connection between two projects\n */\nexport const connectionGenerator = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n) => {\n const resolved = await resolveConnection(tree, options);\n\n const connectionKey =\n `${resolved.connection.source} -> ${resolved.connection.target}` as ConnectionKey;\n\n return await CONNECTION_GENERATORS[connectionKey](tree, {\n sourceProject: options.sourceProject,\n targetProject: options.targetProject,\n sourceComponent: resolved.sourceComponent,\n targetComponent: resolved.targetComponent,\n preferInstallDependencies: options.preferInstallDependencies,\n });\n};\n\n/**\n * Find a component in project metadata matching the given reference.\n * Checks by name first, then by path, then by generator.\n */\nexport const findComponentInMetadata = (\n projectConfiguration: ProjectConfiguration,\n componentRef: string,\n): ComponentMetadata | undefined => {\n const components: ComponentMetadata[] =\n (projectConfiguration.metadata as any)?.components ?? [];\n\n return (\n components.find((c) => c.name === componentRef) ??\n components.find((c) => c.path === componentRef) ??\n components.find((c) => c.generator === componentRef)\n );\n};\n\n/**\n * Represents a candidate source or target for a connection, which may be\n * the project itself or a specific component within the project.\n */\ninterface ConnectionCandidate {\n readonly type: string;\n readonly component?: ComponentMetadata;\n}\n\n/**\n * A matched connection between source and target candidates.\n */\ninterface ConnectionMatch {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Gather all connection candidates for a project configuration. This includes:\n * - The project-level type (if it's a supported type)\n * - Each component's generator id as a candidate type\n */\nconst gatherCandidates = async (\n tree: Tree,\n projectConfig: ProjectConfiguration,\n): Promise<ConnectionCandidate[]> => {\n const type = await determineProjectTypeFromConfig(tree, projectConfig);\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n\n return [\n ...(type ? [{ type: type }] : []),\n ...components.map((component) => ({\n type: component.generator,\n component,\n })),\n ];\n};\n\n/**\n * Validate that a specified component exists in the project metadata.\n * Skips validation for undefined refs and the project sentinel '.'.\n */\nconst validateComponent = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n side: 'source' | 'target',\n) => {\n if (!componentRef || componentRef === PROJECT_COMPONENT_SENTINEL) return;\n const found = findComponentInMetadata(projectConfig, componentRef);\n if (!found) {\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n throw new Error(\n `Component '${componentRef}' not found in ${side} project ${projectConfig.name}. ` +\n `Available components: ${components.length > 0 ? components.map((c) => c.name ?? c.generator).join(', ') : 'none'}`,\n );\n }\n};\n\n/**\n * Narrow candidates based on the user's specified component reference.\n */\nconst filterConnectionCandidatesForComponentReference = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n candidates: ConnectionCandidate[],\n supportedConnections: readonly Connection[],\n side: 'source' | 'target',\n): ConnectionCandidate[] => {\n if (!componentRef) return candidates;\n if (componentRef === PROJECT_COMPONENT_SENTINEL) {\n return candidates.filter((c) => !c.component);\n }\n const component = findComponentInMetadata(projectConfig, componentRef);\n if (!component) return candidates;\n const isConnectionParticipant = supportedConnections.some(\n (c) => c[side] === component.generator,\n );\n if (!isConnectionParticipant) return candidates;\n // Filter to the specific matched component, not all components with the same generator\n return candidates.filter((c) => c.component === component);\n};\n\n/**\n * Resolve the connection to use, considering source/target projects and components.\n */\nexport const resolveConnection = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n supportedConnections: readonly Connection[] = SUPPORTED_CONNECTIONS,\n): Promise<ResolvedConnection> => {\n const sourceConfig = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetConfig = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n // Validate explicitly specified components exist\n validateComponent(options.sourceComponent, sourceConfig, 'source');\n validateComponent(options.targetComponent, targetConfig, 'target');\n\n // Gather and narrow candidates\n const sourceCandidates = filterConnectionCandidatesForComponentReference(\n options.sourceComponent,\n sourceConfig,\n await gatherCandidates(tree, sourceConfig),\n supportedConnections,\n 'source',\n );\n const targetCandidates = filterConnectionCandidatesForComponentReference(\n options.targetComponent,\n targetConfig,\n await gatherCandidates(tree, targetConfig),\n supportedConnections,\n 'target',\n );\n\n // Cross-product candidates and find supported connections\n const matches: ConnectionMatch[] = [];\n for (const source of sourceCandidates) {\n for (const target of targetCandidates) {\n const match = supportedConnections.find(\n (c) => c.source === source.type && c.target === target.type,\n );\n if (match) {\n matches.push({\n connection: match,\n sourceComponent: source.component,\n targetComponent: target.component,\n });\n }\n }\n }\n\n if (matches.length === 0) {\n const sourceTypes = [...new Set(sourceCandidates.map((c) => c.type))];\n const targetTypes = [...new Set(targetCandidates.map((c) => c.type))];\n throw new Error(\n `This generator does not support a connection from ${options.sourceProject}${sourceTypes.length > 0 ? ` (${sourceTypes.join(', ')})` : ''} to ${options.targetProject}${targetTypes.length > 0 ? ` (${targetTypes.join(', ')})` : ''}`,\n );\n }\n\n if (matches.length > 1) {\n const connectionDescriptions = matches\n .map((m) => {\n const sourceName = m.sourceComponent?.name;\n const targetName = m.targetComponent?.name;\n const sourceLabel = sourceName\n ? `${sourceName} (${m.connection.source})`\n : m.connection.source;\n const targetLabel = targetName\n ? `${targetName} (${m.connection.target})`\n : m.connection.target;\n return `${sourceLabel} -> ${targetLabel}`;\n })\n .join(', ');\n throw new Error(\n `Ambiguous connection from ${options.sourceProject} to ${options.targetProject}. ` +\n `Multiple supported connections found: ${connectionDescriptions}. ` +\n `Please specify sourceComponent and/or targetComponent to disambiguate.`,\n );\n }\n\n return {\n connection: matches[0].connection,\n sourceComponent: matches[0].sourceComponent,\n targetComponent: matches[0].targetComponent,\n };\n};\n\n/**\n * Determine whether the given project is of a known project type\n */\nexport const determineProjectType = async (\n tree: Tree,\n projectName: string,\n): Promise<ProjectType | undefined> => {\n const projectConfiguration = readProjectConfigurationUnqualified(\n tree,\n projectName,\n );\n return await determineProjectTypeFromConfig(tree, projectConfiguration);\n};\n\n/**\n * Determine whether the given project configuration is of a known project type\n */\nconst determineProjectTypeFromConfig = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<ProjectType | undefined> => {\n // NB: if adding new checks, ensure these go from most to least specific\n // eg. react website is more specific than typescript project\n\n if (await isTrpcApi(tree, projectConfiguration)) {\n return 'ts#trpc-api';\n }\n\n if (isFastApi(tree, projectConfiguration)) {\n return 'py#fast-api';\n }\n\n if (isSmithyApi(tree, projectConfiguration)) {\n return 'ts#smithy-api';\n }\n\n if (isReact(tree, projectConfiguration)) {\n return 'ts#react-website';\n }\n\n if (isRdb(projectConfiguration)) {\n return 'ts#rdb';\n }\n\n if (isTsDynamoDB(projectConfiguration)) {\n return 'ts#dynamodb';\n }\n\n if (isPyDynamoDB(projectConfiguration)) {\n return 'py#dynamodb';\n }\n\n if (isPyRdb(projectConfiguration)) {\n return 'py#rdb';\n }\n\n if (isAgentCoreGateway(projectConfiguration)) {\n return 'agentcore-gateway';\n }\n\n return undefined;\n};\n\nconst sourceRoot = (projectConfiguration: ProjectConfiguration) =>\n projectConfiguration.sourceRoot ??\n joinPathFragments(projectConfiguration.root, 'src');\n\nconst isTrpcApi = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<boolean> => {\n // If the project.json says it's a trpc api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'trpc') {\n return true;\n }\n\n // Find the src/index.ts\n const indexTs = tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'index.ts'),\n 'utf-8',\n );\n if (indexTs === null) {\n return false;\n }\n\n // If the index file exports an AppRouter, it's a trpc api\n if (await hasExportDeclaration(tree, indexTs, 'AppRouter')) {\n return true;\n }\n\n // If there's a src/router.ts or src/lambdas/router.ts which exports an AppRouter, it's a trpc api\n const trpcRouter =\n tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'router.ts'),\n 'utf-8',\n ) ??\n tree.read(\n joinPathFragments(\n sourceRoot(projectConfiguration),\n 'lambdas',\n 'router.ts',\n ),\n 'utf-8',\n );\n\n if (trpcRouter === null) {\n return false;\n }\n\n if (await hasExportDeclaration(tree, trpcRouter, 'AppRouter')) {\n return true;\n }\n\n return false;\n};\n\nconst isReact = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // if there's a main.tsx, it's a react app\n return tree.exists(\n joinPathFragments(sourceRoot(projectConfiguration), 'main.tsx'),\n );\n};\n\nconst isFastApi = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // If the project.json says it's a fast api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'fast-api') {\n return true;\n }\n\n const pyProjectPath = joinPathFragments(\n projectConfiguration.root,\n 'pyproject.toml',\n );\n if (tree.exists(pyProjectPath)) {\n const pyProject = readToml(tree, pyProjectPath);\n if (((pyProject as any)?.project?.dependencies ?? []).includes('fastapi')) {\n return true;\n }\n }\n\n return false;\n};\n\nconst isSmithyApi = (\n _tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // Support selecting either the smithy model or backend project\n return [\n SMITHY_PROJECT_GENERATOR_INFO.id,\n TS_SMITHY_API_GENERATOR_INFO.id,\n ].includes(((projectConfiguration.metadata as any) ?? {}).generator);\n};\n\nconst isRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_RDB_GENERATOR_INFO.id;\n\nconst isTsDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_RDB_GENERATOR_INFO.id;\n\nconst isAgentCoreGateway = (\n projectConfiguration: ProjectConfiguration,\n): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n AGENTCORE_GATEWAY_GENERATOR_INFO.id;\n\nexport default connectionGenerator;\n"],"names":["joinPathFragments","agentcoreGatewayGatewayConnectionGenerator","AGENTCORE_GATEWAY_GENERATOR_INFO","agentcoreGatewayMcpConnectionGenerator","pyAgentA2aConnectionGenerator","pyAgentGatewayConnectionGenerator","pyAgentMcpConnectionGenerator","pyAgentReactConnectionGenerator","pyDynamoDBAgentConnectionGenerator","pyDynamoDBFastApiConnectionGenerator","PY_DYNAMODB_GENERATOR_INFO","pyDynamoDBMcpServerConnectionGenerator","pyRdbAgentConnectionGenerator","pyRdbFastApiConnectionGenerator","PY_RDB_GENERATOR_INFO","pyRdbMcpServerConnectionGenerator","fastApiReactGenerator","SMITHY_PROJECT_GENERATOR_INFO","smithyReactConnectionGenerator","TS_SMITHY_API_GENERATOR_INFO","trpcReactGenerator","tsAgentA2aConnectionGenerator","tsAgentGatewayConnectionGenerator","tsAgentMcpConnectionGenerator","tsAgentReactConnectionGenerator","tsDynamoDBAgentConnectionGenerator","TS_DYNAMODB_GENERATOR_INFO","tsDynamoDBMcpServerConnectionGenerator","tsDynamoDBSmithyConnectionGenerator","tsDynamoDBTrpcConnectionGenerator","tsRdbAgentConnectionGenerator","TS_RDB_GENERATOR_INFO","tsRdbMcpServerConnectionGenerator","tsRdbSmithyConnectionGenerator","tsRdbTrpcConnectionGenerator","hasExportDeclaration","readProjectConfigurationUnqualified","readToml","SUPPORTED_CONNECTIONS","PROJECT_COMPONENT_SENTINEL","CONNECTION_GENERATORS","tree","options","frontendProjectName","sourceProject","backendProjectName","targetProject","preferInstallDependencies","fastApiProjectName","smithyModelOrBackendProjectName","connectionGenerator","resolved","resolveConnection","connectionKey","connection","source","target","sourceComponent","targetComponent","findComponentInMetadata","projectConfiguration","componentRef","components","metadata","find","c","name","path","generator","gatherCandidates","projectConfig","type","determineProjectTypeFromConfig","map","component","validateComponent","side","found","Error","length","join","filterConnectionCandidatesForComponentReference","candidates","supportedConnections","filter","isConnectionParticipant","some","sourceConfig","targetConfig","sourceCandidates","targetCandidates","matches","match","push","sourceTypes","Set","targetTypes","connectionDescriptions","m","sourceName","targetName","sourceLabel","targetLabel","determineProjectType","projectName","isTrpcApi","isFastApi","isSmithyApi","isReact","isRdb","isTsDynamoDB","isPyDynamoDB","isPyRdb","isAgentCoreGateway","undefined","sourceRoot","root","apiType","indexTs","read","trpcRouter","exists","pyProjectPath","pyProject","project","dependencies","includes","_tree","id"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,QAGZ,aAAa;AACpB,OAAOC,gDAAgD,uDAAoD;AAC3G,SAASC,gCAAgC,QAAQ,oCAAiC;AAClF,OAAOC,4CAA4C,mDAAgD;AACnG,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,uCAAuC,8CAA2C;AACzF,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,4CAAyC;AACrF,OAAOC,wCAAwC,+CAA4C;AAC3F,OAAOC,0CAA0C,kDAA+C;AAChG,SAASC,0BAA0B,QAAQ,8BAA2B;AACtE,OAAOC,4CAA4C,oDAAiD;AACpG,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,6CAA0C;AACtF,SAASC,qBAAqB,QAAQ,yBAAsB;AAC5D,OAAOC,uCAAuC,+CAA4C;AAC1F,OAAOC,2BAA2B,oCAAiC;AACnE,SAASC,6BAA6B,QAAQ,iCAA8B;AAC5E,OAAOC,oCAAoC,0CAAuC;AAClF,SAASC,4BAA4B,QAAQ,gCAA6B;AAC1E,OAAOC,wBAAwB,6BAA0B;AACzD,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,uCAAuC,8CAA2C;AACzF,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,q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"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport agentcoreGatewayGatewayConnectionGenerator from '../agentcore-gateway/gateway-connection/generator';\nimport { AGENTCORE_GATEWAY_GENERATOR_INFO } from '../agentcore-gateway/generator';\nimport agentcoreGatewayMcpConnectionGenerator from '../agentcore-gateway/mcp-connection/generator';\nimport pyAgentA2aConnectionGenerator from '../py/agent/a2a-connection/generator';\nimport pyAgentGatewayConnectionGenerator from '../py/agent/gateway-connection/generator';\nimport pyAgentMcpConnectionGenerator from '../py/agent/mcp-connection/generator';\nimport pyAgentReactConnectionGenerator from '../py/agent/react-connection/generator';\nimport pyDynamoDBAgentConnectionGenerator from '../py/dynamodb/agent-connection/generator';\nimport pyDynamoDBFastApiConnectionGenerator from '../py/dynamodb/fast-api-connection/generator';\nimport { PY_DYNAMODB_GENERATOR_INFO } from '../py/dynamodb/generator';\nimport pyDynamoDBMcpServerConnectionGenerator from '../py/dynamodb/mcp-server-connection/generator';\nimport fastApiReactGenerator from '../py/fast-api/react/generator';\nimport pyRdbAgentConnectionGenerator from '../py/rdb/agent-connection/generator';\nimport pyRdbFastApiConnectionGenerator from '../py/rdb/fast-api-connection/generator';\nimport { PY_RDB_GENERATOR_INFO } from '../py/rdb/generator';\nimport pyRdbMcpServerConnectionGenerator from '../py/rdb/mcp-server-connection/generator';\nimport { SMITHY_PROJECT_GENERATOR_INFO } from '../smithy/project/generator';\nimport smithyReactConnectionGenerator from '../smithy/react-connection/generator';\nimport { TS_SMITHY_API_GENERATOR_INFO } from '../smithy/ts/api/generator';\nimport trpcReactGenerator from '../trpc/react/generator';\nimport tsAgentA2aConnectionGenerator from '../ts/agent/a2a-connection/generator';\nimport tsAgentGatewayConnectionGenerator from '../ts/agent/gateway-connection/generator';\nimport tsAgentMcpConnectionGenerator from '../ts/agent/mcp-connection/generator';\nimport tsAgentReactConnectionGenerator from '../ts/agent/react-connection/generator';\nimport tsDynamoDBAgentConnectionGenerator from '../ts/dynamodb/agent-connection/generator';\nimport { TS_DYNAMODB_GENERATOR_INFO } from '../ts/dynamodb/generator';\nimport tsDynamoDBMcpServerConnectionGenerator from '../ts/dynamodb/mcp-server-connection/generator';\nimport tsDynamoDBSmithyConnectionGenerator from '../ts/dynamodb/smithy-connection/generator';\nimport tsDynamoDBTrpcConnectionGenerator from '../ts/dynamodb/trpc-connection/generator';\nimport tsRdbAgentConnectionGenerator from '../ts/rdb/agent-connection/generator';\nimport { TS_RDB_GENERATOR_INFO } from '../ts/rdb/generator';\nimport tsRdbMcpServerConnectionGenerator from '../ts/rdb/mcp-server-connection/generator';\nimport tsRdbSmithyConnectionGenerator from '../ts/rdb/smithy-connection/generator';\nimport tsRdbTrpcConnectionGenerator from '../ts/rdb/trpc-connection/generator';\nimport { hasExportDeclaration } from '../utils/ast';\nimport {\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\nimport { readToml } from '../utils/toml';\nimport type { ConnectionGeneratorSchema } from './schema';\nimport {\n type Connection,\n type ConnectionKey,\n SUPPORTED_CONNECTIONS,\n type SUPPORTED_PROJECT_TYPES,\n} from './supported-connections';\n\nexport type { Connection };\n\ntype ProjectType = (typeof SUPPORTED_PROJECT_TYPES)[number];\n\n/**\n * Sentinel value for sourceComponent/targetComponent that means\n * \"use the project-level connection, not a component\".\n */\nexport const PROJECT_COMPONENT_SENTINEL = '.';\n\n/**\n * The result of resolving a connection, including the matched connection\n * and any resolved source/target component metadata.\n */\nexport interface ResolvedConnection {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Generators for each connection type\n */\n/**\n * Options passed to connection generators, including resolved component metadata.\n */\nexport interface ResolvedConnectionOptions {\n sourceProject: string;\n targetProject: string;\n sourceComponent?: ComponentMetadata;\n targetComponent?: ComponentMetadata;\n preferInstallDependencies?: boolean;\n}\n\nconst CONNECTION_GENERATORS = {\n 'ts#trpc-api -> ts#rdb': (tree, options) =>\n tsRdbTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#rdb': (tree, options) =>\n tsRdbAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#rdb': (tree, options) =>\n tsRdbSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#rdb': (tree, options) =>\n tsRdbMcpServerConnectionGenerator(tree, options),\n 'ts#trpc-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#dynamodb': (tree, options) =>\n tsDynamoDBAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#dynamodb': (tree, options) =>\n tsDynamoDBMcpServerConnectionGenerator(tree, options),\n 'ts#react-website -> ts#trpc-api': (tree, options) =>\n trpcReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n backendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> py#fast-api': (tree, options) =>\n fastApiReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n fastApiProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#smithy-api': (tree, options) =>\n smithyReactConnectionGenerator(tree, {\n frontendProjectName: options.sourceProject,\n smithyModelOrBackendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#agent': (tree, options) =>\n tsAgentReactConnectionGenerator(tree, options),\n 'ts#react-website -> py#agent': (tree, options) =>\n pyAgentReactConnectionGenerator(tree, options),\n 'ts#agent -> ts#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> py#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> ts#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> py#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> ts#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> py#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> ts#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> py#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> agentcore-gateway': (tree, options) =>\n tsAgentGatewayConnectionGenerator(tree, options),\n 'py#agent -> agentcore-gateway': (tree, options) =>\n pyAgentGatewayConnectionGenerator(tree, options),\n 'agentcore-gateway -> ts#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> py#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> agentcore-gateway': (tree, options) =>\n agentcoreGatewayGatewayConnectionGenerator(tree, options),\n 'py#fast-api -> py#dynamodb': (tree, options) =>\n pyDynamoDBFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#dynamodb': (tree, options) =>\n pyDynamoDBAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#dynamodb': (tree, options) =>\n pyDynamoDBMcpServerConnectionGenerator(tree, options),\n 'py#fast-api -> py#rdb': (tree, options) =>\n pyRdbFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#rdb': (tree, options) =>\n pyRdbAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#rdb': (tree, options) =>\n pyRdbMcpServerConnectionGenerator(tree, options),\n} satisfies Record<\n ConnectionKey,\n (tree: Tree, options: ResolvedConnectionOptions) => Promise<any>\n>;\n\n/**\n * Generator for a connection between two projects\n */\nexport const connectionGenerator = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n) => {\n const resolved = await resolveConnection(tree, options);\n\n const connectionKey =\n `${resolved.connection.source} -> ${resolved.connection.target}` as ConnectionKey;\n\n return await CONNECTION_GENERATORS[connectionKey](tree, {\n sourceProject: options.sourceProject,\n targetProject: options.targetProject,\n sourceComponent: resolved.sourceComponent,\n targetComponent: resolved.targetComponent,\n preferInstallDependencies: options.preferInstallDependencies,\n });\n};\n\n/**\n * Find a component in project metadata matching the given reference.\n * Checks by name first, then by path, then by generator.\n */\nexport const findComponentInMetadata = (\n projectConfiguration: ProjectConfiguration,\n componentRef: string,\n): ComponentMetadata | undefined => {\n const components: ComponentMetadata[] =\n (projectConfiguration.metadata as any)?.components ?? [];\n\n return (\n components.find((c) => c.name === componentRef) ??\n components.find((c) => c.path === componentRef) ??\n components.find((c) => c.generator === componentRef)\n );\n};\n\n/**\n * Represents a candidate source or target for a connection, which may be\n * the project itself or a specific component within the project.\n */\ninterface ConnectionCandidate {\n readonly type: string;\n readonly component?: ComponentMetadata;\n}\n\n/**\n * A matched connection between source and target candidates.\n */\ninterface ConnectionMatch {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Gather all connection candidates for a project configuration. This includes:\n * - The project-level type (if it's a supported type)\n * - Each component's generator id as a candidate type\n */\nconst gatherCandidates = async (\n tree: Tree,\n projectConfig: ProjectConfiguration,\n): Promise<ConnectionCandidate[]> => {\n const type = await determineProjectTypeFromConfig(tree, projectConfig);\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n\n return [\n ...(type ? [{ type: type }] : []),\n ...components.map((component) => ({\n type: component.generator,\n component,\n })),\n ];\n};\n\n/**\n * Validate that a specified component exists in the project metadata.\n * Skips validation for undefined refs and the project sentinel '.'.\n */\nconst validateComponent = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n side: 'source' | 'target',\n) => {\n if (!componentRef || componentRef === PROJECT_COMPONENT_SENTINEL) return;\n const found = findComponentInMetadata(projectConfig, componentRef);\n if (!found) {\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n throw new Error(\n `Component '${componentRef}' not found in ${side} project ${projectConfig.name}. ` +\n `Available components: ${components.length > 0 ? components.map((c) => c.name ?? c.generator).join(', ') : 'none'}`,\n );\n }\n};\n\n/**\n * Narrow candidates based on the user's specified component reference.\n */\nconst filterConnectionCandidatesForComponentReference = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n candidates: ConnectionCandidate[],\n supportedConnections: readonly Connection[],\n side: 'source' | 'target',\n): ConnectionCandidate[] => {\n if (!componentRef) return candidates;\n if (componentRef === PROJECT_COMPONENT_SENTINEL) {\n return candidates.filter((c) => !c.component);\n }\n const component = findComponentInMetadata(projectConfig, componentRef);\n if (!component) return candidates;\n const isConnectionParticipant = supportedConnections.some(\n (c) => c[side] === component.generator,\n );\n if (!isConnectionParticipant) return candidates;\n // Filter to the specific matched component, not all components with the same generator\n return candidates.filter((c) => c.component === component);\n};\n\n/**\n * Resolve the connection to use, considering source/target projects and components.\n */\nexport const resolveConnection = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n supportedConnections: readonly Connection[] = SUPPORTED_CONNECTIONS,\n): Promise<ResolvedConnection> => {\n const sourceConfig = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetConfig = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n // Validate explicitly specified components exist\n validateComponent(options.sourceComponent, sourceConfig, 'source');\n validateComponent(options.targetComponent, targetConfig, 'target');\n\n // Gather and narrow candidates\n const sourceCandidates = filterConnectionCandidatesForComponentReference(\n options.sourceComponent,\n sourceConfig,\n await gatherCandidates(tree, sourceConfig),\n supportedConnections,\n 'source',\n );\n const targetCandidates = filterConnectionCandidatesForComponentReference(\n options.targetComponent,\n targetConfig,\n await gatherCandidates(tree, targetConfig),\n supportedConnections,\n 'target',\n );\n\n // Cross-product candidates and find supported connections\n const matches: ConnectionMatch[] = [];\n for (const source of sourceCandidates) {\n for (const target of targetCandidates) {\n const match = supportedConnections.find(\n (c) => c.source === source.type && c.target === target.type,\n );\n if (match) {\n matches.push({\n connection: match,\n sourceComponent: source.component,\n targetComponent: target.component,\n });\n }\n }\n }\n\n if (matches.length === 0) {\n const sourceTypes = [...new Set(sourceCandidates.map((c) => c.type))];\n const targetTypes = [...new Set(targetCandidates.map((c) => c.type))];\n throw new Error(\n `This generator does not support a connection from ${options.sourceProject}${sourceTypes.length > 0 ? ` (${sourceTypes.join(', ')})` : ''} to ${options.targetProject}${targetTypes.length > 0 ? ` (${targetTypes.join(', ')})` : ''}`,\n );\n }\n\n if (matches.length > 1) {\n const connectionDescriptions = matches\n .map((m) => {\n const sourceName = m.sourceComponent?.name;\n const targetName = m.targetComponent?.name;\n const sourceLabel = sourceName\n ? `${sourceName} (${m.connection.source})`\n : m.connection.source;\n const targetLabel = targetName\n ? `${targetName} (${m.connection.target})`\n : m.connection.target;\n return `${sourceLabel} -> ${targetLabel}`;\n })\n .join(', ');\n throw new Error(\n `Ambiguous connection from ${options.sourceProject} to ${options.targetProject}. ` +\n `Multiple supported connections found: ${connectionDescriptions}. ` +\n `Please specify sourceComponent and/or targetComponent to disambiguate.`,\n );\n }\n\n return {\n connection: matches[0].connection,\n sourceComponent: matches[0].sourceComponent,\n targetComponent: matches[0].targetComponent,\n };\n};\n\n/**\n * Determine whether the given project is of a known project type\n */\nexport const determineProjectType = async (\n tree: Tree,\n projectName: string,\n): Promise<ProjectType | undefined> => {\n const projectConfiguration = readProjectConfigurationUnqualified(\n tree,\n projectName,\n );\n return await determineProjectTypeFromConfig(tree, projectConfiguration);\n};\n\n/**\n * Determine whether the given project configuration is of a known project type\n */\nconst determineProjectTypeFromConfig = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<ProjectType | undefined> => {\n // NB: if adding new checks, ensure these go from most to least specific\n // eg. react website is more specific than typescript project\n\n if (await isTrpcApi(tree, projectConfiguration)) {\n return 'ts#trpc-api';\n }\n\n if (isFastApi(tree, projectConfiguration)) {\n return 'py#fast-api';\n }\n\n if (isSmithyApi(tree, projectConfiguration)) {\n return 'ts#smithy-api';\n }\n\n if (isReact(tree, projectConfiguration)) {\n return 'ts#react-website';\n }\n\n if (isRdb(projectConfiguration)) {\n return 'ts#rdb';\n }\n\n if (isTsDynamoDB(projectConfiguration)) {\n return 'ts#dynamodb';\n }\n\n if (isPyDynamoDB(projectConfiguration)) {\n return 'py#dynamodb';\n }\n\n if (isPyRdb(projectConfiguration)) {\n return 'py#rdb';\n }\n\n if (isAgentCoreGateway(projectConfiguration)) {\n return 'agentcore-gateway';\n }\n\n return undefined;\n};\n\nconst sourceRoot = (projectConfiguration: ProjectConfiguration) =>\n projectConfiguration.sourceRoot ??\n joinPathFragments(projectConfiguration.root, 'src');\n\nconst isTrpcApi = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<boolean> => {\n // If the project.json says it's a trpc api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'trpc') {\n return true;\n }\n\n // Find the src/index.ts\n const indexTs = tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'index.ts'),\n 'utf-8',\n );\n if (indexTs === null) {\n return false;\n }\n\n // If the index file exports an AppRouter, it's a trpc api\n if (await hasExportDeclaration(tree, indexTs, 'AppRouter')) {\n return true;\n }\n\n // If there's a src/router.ts or src/lambdas/router.ts which exports an AppRouter, it's a trpc api\n const trpcRouter =\n tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'router.ts'),\n 'utf-8',\n ) ??\n tree.read(\n joinPathFragments(\n sourceRoot(projectConfiguration),\n 'lambdas',\n 'router.ts',\n ),\n 'utf-8',\n );\n\n if (trpcRouter === null) {\n return false;\n }\n\n if (await hasExportDeclaration(tree, trpcRouter, 'AppRouter')) {\n return true;\n }\n\n return false;\n};\n\nconst isReact = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // if there's a main.tsx, it's a react app\n return tree.exists(\n joinPathFragments(sourceRoot(projectConfiguration), 'main.tsx'),\n );\n};\n\nconst isFastApi = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // If the project.json says it's a fast api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'fast-api') {\n return true;\n }\n\n const pyProjectPath = joinPathFragments(\n projectConfiguration.root,\n 'pyproject.toml',\n );\n if (tree.exists(pyProjectPath)) {\n const pyProject = readToml(tree, pyProjectPath);\n if (((pyProject as any)?.project?.dependencies ?? []).includes('fastapi')) {\n return true;\n }\n }\n\n return false;\n};\n\nconst isSmithyApi = (\n _tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // Support selecting either the smithy model or backend project\n return [\n SMITHY_PROJECT_GENERATOR_INFO.id,\n TS_SMITHY_API_GENERATOR_INFO.id,\n ].includes(((projectConfiguration.metadata as any) ?? {}).generator);\n};\n\nconst isRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_RDB_GENERATOR_INFO.id;\n\nconst isTsDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_RDB_GENERATOR_INFO.id;\n\nconst isAgentCoreGateway = (\n projectConfiguration: ProjectConfiguration,\n): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n AGENTCORE_GATEWAY_GENERATOR_INFO.id;\n\nexport default connectionGenerator;\n"],"names":["joinPathFragments","agentcoreGatewayGatewayConnectionGenerator","AGENTCORE_GATEWAY_GENERATOR_INFO","agentcoreGatewayMcpConnectionGenerator","pyAgentA2aConnectionGenerator","pyAgentGatewayConnectionGenerator","pyAgentMcpConnectionGenerator","pyAgentReactConnectionGenerator","pyDynamoDBAgentConnectionGenerator","pyDynamoDBFastApiConnectionGenerator","PY_DYNAMODB_GENERATOR_INFO","pyDynamoDBMcpServerConnectionGenerator","fastApiReactGenerator","pyRdbAgentConnectionGenerator","pyRdbFastApiConnectionGenerator","PY_RDB_GENERATOR_INFO","pyRdbMcpServerConnectionGenerator","SMITHY_PROJECT_GENERATOR_INFO","smithyReactConnectionGenerator","TS_SMITHY_API_GENERATOR_INFO","trpcReactGenerator","tsAgentA2aConnectionGenerator","tsAgentGatewayConnectionGenerator","tsAgentMcpConnectionGenerator","tsAgentReactConnectionGenerator","tsDynamoDBAgentConnectionGenerator","TS_DYNAMODB_GENERATOR_INFO","tsDynamoDBMcpServerConnectionGenerator","tsDynamoDBSmithyConnectionGenerator","tsDynamoDBTrpcConnectionGenerator","tsRdbAgentConnectionGenerator","TS_RDB_GENERATOR_INFO","tsRdbMcpServerConnectionGenerator","tsRdbSmithyConnectionGenerator","tsRdbTrpcConnectionGenerator","hasExportDeclaration","readProjectConfigurationUnqualified","readToml","SUPPORTED_CONNECTIONS","PROJECT_COMPONENT_SENTINEL","CONNECTION_GENERATORS","tree","options","frontendProjectName","sourceProject","backendProjectName","targetProject","preferInstallDependencies","fastApiProjectName","smithyModelOrBackendProjectName","connectionGenerator","resolved","resolveConnection","connectionKey","connection","source","target","sourceComponent","targetComponent","findComponentInMetadata","projectConfiguration","componentRef","components","metadata","find","c","name","path","generator","gatherCandidates","projectConfig","type","determineProjectTypeFromConfig","map","component","validateComponent","side","found","Error","length","join","filterConnectionCandidatesForComponentReference","candidates","supportedConnections","filter","isConnectionParticipant","some","sourceConfig","targetConfig","sourceCandidates","targetCandidates","matches","match","push","sourceTypes","Set","targetTypes","connectionDescriptions","m","sourceName","targetName","sourceLabel","targetLabel","determineProjectType","projectName","isTrpcApi","isFastApi","isSmithyApi","isReact","isRdb","isTsDynamoDB","isPyDynamoDB","isPyRdb","isAgentCoreGateway","undefined","sourceRoot","root","apiType","indexTs","read","trpcRouter","exists","pyProjectPath","pyProject","project","dependencies","includes","_tree","id"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,QAGZ,aAAa;AACpB,OAAOC,gDAAgD,uDAAoD;AAC3G,SAASC,gCAAgC,QAAQ,oCAAiC;AAClF,OAAOC,4CAA4C,mDAAgD;AACnG,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,uCAAuC,8CAA2C;AACzF,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,4CAAyC;AACrF,OAAOC,wCAAwC,+CAA4C;AAC3F,OAAOC,0CAA0C,kDAA+C;AAChG,SAASC,0BAA0B,QAAQ,8BAA2B;AACtE,OAAOC,4CAA4C,oDAAiD;AACpG,OAAOC,2BAA2B,oCAAiC;AACnE,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,6CAA0C;AACtF,SAASC,qBAAqB,QAAQ,yBAAsB;AAC5D,OAAOC,uCAAuC,+CAA4C;AAC1F,SAASC,6BAA6B,QAAQ,iCAA8B;AAC5E,OAAOC,oCAAoC,0CAAuC;AAClF,SAASC,4BAA4B,QAAQ,gCAA6B;AAC1E,OAAOC,wBAAwB,6BAA0B;AACzD,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,uCAAuC,8CAA2C;AACzF,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,4CAAyC;AACrF,OAAOC,wCAAwC,+CAA4C;AAC3F,SAASC,0BAA0B,QAAQ,8BAA2B;AACtE,OAAOC,4CAA4C,oDAAiD;AACpG,OAAOC,yCAAyC,gDAA6C;AAC7F,OAAOC,uCAAuC,8CAA2C;AACzF,OAAOC,mCAAmC,0CAAuC;AACjF,SAASC,qBAAqB,QAAQ,yBAAsB;AAC5D,OAAOC,uCAAu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SAASC,gBAAgB,EAAE,AAAD,EAAGC,QAAQ,CAAC,YAAY;YACzE,OAAO;QACT;IACF;IAEA,OAAO;AACT;AAEA,MAAMnB,cAAc,CAClBoB,OACAnE;IAEA,+DAA+D;IAC/D,OAAO;QACL3C,8BAA8B+G,EAAE;QAChC7G,6BAA6B6G,EAAE;KAChC,CAACF,QAAQ,CAAC,AAAC,CAAA,AAAClE,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS;AACrE;AAEA,MAAMyC,QAAQ,CAACjD,uBACb,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxDrC,sBAAsBiG,EAAE;AAE1B,MAAMlB,eAAe,CAAClD,uBACpB,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxD1C,2BAA2BsG,EAAE;AAE/B,MAAMjB,eAAe,CAACnD,uBACpB,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxD1D,2BAA2BsH,EAAE;AAE/B,MAAMhB,UAAU,CAACpD,uBACf,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxDrD,sBAAsBiH,EAAE;AAE1B,MAAMf,qBAAqB,CACzBrD,uBAEA,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxDlE,iCAAiC8H,EAAE;AAErC,eAAe9E,oBAAoB"}
@@ -2,9 +2,9 @@
2
2
 
3
3
  exports[`infra generator > should add required dependencies to package.json > dependencies 1`] = `
4
4
  {
5
- "aws-cdk": "2.1130.0",
5
+ "aws-cdk": "2.1132.0",
6
6
  "aws-cdk-lib": "2.261.0",
7
- "constructs": "10.6.0",
7
+ "constructs": "10.7.0",
8
8
  "esbuild": "0.28.1",
9
9
  "source-map-support": "0.5.21",
10
10
  }
@@ -18,9 +18,9 @@ exports[`infra generator > should add required dependencies to package.json > de
18
18
  "@types/node": "26.1.1",
19
19
  "@vitest/coverage-v8": "4.1.10",
20
20
  "jsdom": "^27.1.0",
21
- "tsx": "4.23.0",
21
+ "tsx": "4.23.1",
22
22
  "typescript": "~6.0.3",
23
- "vite": "8.1.4",
23
+ "vite": "8.1.5",
24
24
  "vitest": "4.1.10",
25
25
  }
26
26
  `;
@@ -28,9 +28,9 @@ exports[`infra generator > should add required dependencies to package.json > de
28
28
  exports[`infra generator > should add required dependencies to package.json > package-json 1`] = `
29
29
  {
30
30
  "dependencies": {
31
- "aws-cdk": "2.1130.0",
31
+ "aws-cdk": "2.1132.0",
32
32
  "aws-cdk-lib": "2.261.0",
33
- "constructs": "10.6.0",
33
+ "constructs": "10.7.0",
34
34
  "esbuild": "0.28.1",
35
35
  "source-map-support": "0.5.21",
36
36
  },
@@ -41,9 +41,9 @@ exports[`infra generator > should add required dependencies to package.json > pa
41
41
  "@types/node": "26.1.1",
42
42
  "@vitest/coverage-v8": "4.1.10",
43
43
  "jsdom": "^27.1.0",
44
- "tsx": "4.23.0",
44
+ "tsx": "4.23.1",
45
45
  "typescript": "~6.0.3",
46
- "vite": "8.1.4",
46
+ "vite": "8.1.5",
47
47
  "vitest": "4.1.10",
48
48
  },
49
49
  "name": "@proj/source",
@@ -46,7 +46,7 @@ ${PACKAGE_MANAGERS.map((pm)=>buildNxCommand('<options>', pm)).join(' - \n')}
46
46
  - pnpm add -w -D <package>
47
47
  - yarn add -D <package>
48
48
  - npm install --legacy-peer-deps -D <package>
49
- - bun install -D <package>
49
+ - bun add -D <package>
50
50
  - (Omit -D for production dependencies)
51
51
  - When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example \`@workspace-name/project-name\`. Check the \`project.json\` file for the specific package to find its fully qualified name
52
52
  - When no generator exists for a specific framework required, use the base \`ts#project\` and \`py#project\` generators and build on top.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/general-guidance.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { NxGeneratorInfo } from '../../utils/generators';\nimport { IAC_PROVIDERS } from '../../utils/iac-providers';\nimport { buildNxCommand, fetchGuidePages } from '../generator-info';\nimport { PACKAGE_MANAGERS } from '../schema';\n\nexport const TOOL_SELECTION_GUIDE = `## Tool Selection Guide\n\n- Use the \\`general-guidance\\` tool for guidance and best practices for working with Nx and the Nx Plugin for AWS.\n- Use the \\`create-workspace-command\\` tool to discover how to create a workspace to start a new project.\n- Use the \\`add-to-existing-project\\` tool when adding the plugin to an existing Nx workspace or non-Nx monorepo, or when troubleshooting configuration errors in such a workspace.\n- Use the \\`list-generators\\` tool to discover the available generators and how to run them.\n- Use the \\`generator-guide\\` tool to retrieve detailed information about a specific generator.`;\n\n/**\n * Add a tool which provides general guidance for using Nx and the Nx Plugin for AWS\n */\nexport const addGeneralGuidanceTool = (\n server: McpServer,\n generators: NxGeneratorInfo[],\n) => {\n server.registerTool(\n 'general-guidance',\n {\n title: 'General Guidance',\n description:\n 'Tool for guidance and best practices for working with Nx and the Nx Plugin for AWS',\n },\n async () => ({\n content: [\n {\n type: 'text' as const,\n text: `# Nx Plugin for AWS Guidance\n\n${TOOL_SELECTION_GUIDE}\n\n## Getting Started\n\n- Choose a package manager first. You can choose between ${PACKAGE_MANAGERS.join(', ')}. It's recommended to use \"pnpm\" if the user has no preference\n- Choose an infrastructure as code (IaC) provider next. You can choose between ${IAC_PROVIDERS.join(', ')}. It's recommended to use CDK if the user has no preference\n- Next, you must create an Nx workspace. Use the \\`create-workspace-command\\` tool for more details, and provide it with your chosen package manager\n- After this, you can start scaffolding the main components of your application using generators. Use the \\`list-generators\\` tool to discover available generators, and the \\`generator-guide\\` tool for more detailed information about a specific generator\n\n## Nx Primer\n\n- Prefix nx commands with the appropriate prefix for your package manager, for example:\n${PACKAGE_MANAGERS.map((pm) => buildNxCommand('<options>', pm)).join(' - \\n')}\n- Each project in your workspace has a file named \\`project.json\\` which contains important project information such as its name, and defines the \"targets\" which can be run for that project, for example building or testing the project\n- Use the command \\`nx reset\\` to reset the Nx daemon when unexpected issues arise\n- After adding dependencies between TypeScript projects, use \\`nx sync\\` to ensure project references are set up correctly\n\n## General Instructions\n\n- Workspaces contain a single \\`package.json\\` file at the root which defines the dependencies for all projects. Therefore when installing dependencies, you must add these to the root workspace using the appropriate command for your package manager:\n - pnpm add -w -D <package>\n - yarn add -D <package>\n - npm install --legacy-peer-deps -D <package>\n - bun install -D <package>\n - (Omit -D for production dependencies)\n- When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example \\`@workspace-name/project-name\\`. Check the \\`project.json\\` file for the specific package to find its fully qualified name\n- When no generator exists for a specific framework required, use the base \\`ts#project\\` and \\`py#project\\` generators and build on top.\n- Leave the \\`--infra\\` option at its default value unless the user has explicitly instructed otherwise. Generators choose a sensible default type of infrastructure to deploy the project with, so only override \\`--infra\\` when the user has specified a particular requirement.\n\n## Useful Commands\n\n- Fix lint issues with \\`nx run-many --target lint --configuration=fix --all --output-style=stream\\`\n- Build all projects with \\`nx run-many --target build --all --output-style=stream\\`\n- Prefer importing the CDK constructs vended by generators in \\`packages/common/constructs\\` over writing your own\n\n## Best Practices\n\n- After running a generator, use the \\`nx show projects\\` command to check which projects have been added (if any)\n- Carefully examine the files that have been generated and always refer back to the generator guide when working in a generated project\n- Generate all projects into the \\`packages/\\` directory\n- After making changes to your projects, fix linting issues, then run a full build\n- When it's time to start testing a project, suggest to the user that infrastructure is deployed to AWS. For websites, if a runtime-config.json is needed, use the load:runtime-config target after a deployment to point a local website at a sandbox stack.\n\n## Batching Generators\n\nWhen scaffolding several projects in one go, chain generators to avoid a slow dependency install after every generator:\n\n- **Chain generators** with \\`&&\\` in a single command. Pass \\`--prefer-install-dependencies=false\\` on each generator except the last so dependencies install once at the end, for example:\n\n${PACKAGE_MANAGERS.map(\n (pm) => ` \\`\\`\\`bash\n ${buildNxCommand('g @aws/nx-plugin:ts#trpc-api --no-interactive --name=my-app-api --auth=IAM --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#react-website --no-interactive --name=my-app-website --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:connection --no-interactive --sourceProject=@my-app/my-app-website --targetProject=@my-app/my-app-api --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#infra --no-interactive --name=infra', pm)} && \\\\\n ${buildNxCommand('sync', pm)}\n \\`\\`\\``,\n).join('\\n')}\n\n- **\\`--prefer-install-dependencies=false\\`** asks a generator to defer its dependency install so the batch installs once at the end (the final generator above omits the flag and installs everything).\n- **\\`nx sync\\`** is required before building — generators modify TypeScript project references.\n\n## Detailed Guides\n\nPlease refer to the below documentation for important details regarding workspaces and working with TypeScript or Python projects.\n\n${await fetchGuidePages(['workspace', 'typescript-project', 'python-project'], generators)}\n\n `,\n },\n ],\n }),\n );\n};\n"],"names":["IAC_PROVIDERS","buildNxCommand","fetchGuidePages","PACKAGE_MANAGERS","TOOL_SELECTION_GUIDE","addGeneralGuidanceTool","server","generators","registerTool","title","description","content","type","text","join","map","pm"],"mappings":"AAAA;;;CAGC,GAGD,SAASA,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,cAAc,EAAEC,eAAe,QAAQ,uBAAoB;AACpE,SAASC,gBAAgB,QAAQ,eAAY;AAE7C,OAAO,MAAMC,uBAAuB,CAAC;;;;;;+FAM0D,CAAC,CAAC;AAEjG;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CACpCC,QACAC;IAEAD,OAAOE,YAAY,CACjB,oBACA;QACEC,OAAO;QACPC,aACE;IACJ,GACA,UAAa,CAAA;YACXC,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC;;AAEjB,EAAET,qBAAqB;;;;yDAIkC,EAAED,iBAAiBW,IAAI,CAAC,MAAM;+EACR,EAAEd,cAAcc,IAAI,CAAC,MAAM;;;;;;;AAO1G,EAAEX,iBAAiBY,GAAG,CAAC,CAACC,KAAOf,eAAe,aAAae,KAAKF,IAAI,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqC9E,EAAEX,iBAAiBY,GAAG,CACpB,CAACC,KAAO,CAAC;EACT,EAAEf,eAAe,kHAAkHe,IAAI;IACrI,EAAEf,eAAe,gHAAgHe,IAAI;IACrI,EAAEf,eAAe,8JAA8Je,IAAI;IACnL,EAAEf,eAAe,2DAA2De,IAAI;IAChF,EAAEf,eAAe,QAAQe,IAAI;QACzB,CAAC,EACPF,IAAI,CAAC,MAAM;;;;;;;;;AASb,EAAE,MAAMZ,gBAAgB;wBAAC;wBAAa;wBAAsB;qBAAiB,EAAEK,YAAY;;IAEvF,CAAC;gBACG;aACD;QACH,CAAA;AAEJ,EAAE"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/general-guidance.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { NxGeneratorInfo } from '../../utils/generators';\nimport { IAC_PROVIDERS } from '../../utils/iac-providers';\nimport { buildNxCommand, fetchGuidePages } from '../generator-info';\nimport { PACKAGE_MANAGERS } from '../schema';\n\nexport const TOOL_SELECTION_GUIDE = `## Tool Selection Guide\n\n- Use the \\`general-guidance\\` tool for guidance and best practices for working with Nx and the Nx Plugin for AWS.\n- Use the \\`create-workspace-command\\` tool to discover how to create a workspace to start a new project.\n- Use the \\`add-to-existing-project\\` tool when adding the plugin to an existing Nx workspace or non-Nx monorepo, or when troubleshooting configuration errors in such a workspace.\n- Use the \\`list-generators\\` tool to discover the available generators and how to run them.\n- Use the \\`generator-guide\\` tool to retrieve detailed information about a specific generator.`;\n\n/**\n * Add a tool which provides general guidance for using Nx and the Nx Plugin for AWS\n */\nexport const addGeneralGuidanceTool = (\n server: McpServer,\n generators: NxGeneratorInfo[],\n) => {\n server.registerTool(\n 'general-guidance',\n {\n title: 'General Guidance',\n description:\n 'Tool for guidance and best practices for working with Nx and the Nx Plugin for AWS',\n },\n async () => ({\n content: [\n {\n type: 'text' as const,\n text: `# Nx Plugin for AWS Guidance\n\n${TOOL_SELECTION_GUIDE}\n\n## Getting Started\n\n- Choose a package manager first. You can choose between ${PACKAGE_MANAGERS.join(', ')}. It's recommended to use \"pnpm\" if the user has no preference\n- Choose an infrastructure as code (IaC) provider next. You can choose between ${IAC_PROVIDERS.join(', ')}. It's recommended to use CDK if the user has no preference\n- Next, you must create an Nx workspace. Use the \\`create-workspace-command\\` tool for more details, and provide it with your chosen package manager\n- After this, you can start scaffolding the main components of your application using generators. Use the \\`list-generators\\` tool to discover available generators, and the \\`generator-guide\\` tool for more detailed information about a specific generator\n\n## Nx Primer\n\n- Prefix nx commands with the appropriate prefix for your package manager, for example:\n${PACKAGE_MANAGERS.map((pm) => buildNxCommand('<options>', pm)).join(' - \\n')}\n- Each project in your workspace has a file named \\`project.json\\` which contains important project information such as its name, and defines the \"targets\" which can be run for that project, for example building or testing the project\n- Use the command \\`nx reset\\` to reset the Nx daemon when unexpected issues arise\n- After adding dependencies between TypeScript projects, use \\`nx sync\\` to ensure project references are set up correctly\n\n## General Instructions\n\n- Workspaces contain a single \\`package.json\\` file at the root which defines the dependencies for all projects. Therefore when installing dependencies, you must add these to the root workspace using the appropriate command for your package manager:\n - pnpm add -w -D <package>\n - yarn add -D <package>\n - npm install --legacy-peer-deps -D <package>\n - bun add -D <package>\n - (Omit -D for production dependencies)\n- When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example \\`@workspace-name/project-name\\`. Check the \\`project.json\\` file for the specific package to find its fully qualified name\n- When no generator exists for a specific framework required, use the base \\`ts#project\\` and \\`py#project\\` generators and build on top.\n- Leave the \\`--infra\\` option at its default value unless the user has explicitly instructed otherwise. Generators choose a sensible default type of infrastructure to deploy the project with, so only override \\`--infra\\` when the user has specified a particular requirement.\n\n## Useful Commands\n\n- Fix lint issues with \\`nx run-many --target lint --configuration=fix --all --output-style=stream\\`\n- Build all projects with \\`nx run-many --target build --all --output-style=stream\\`\n- Prefer importing the CDK constructs vended by generators in \\`packages/common/constructs\\` over writing your own\n\n## Best Practices\n\n- After running a generator, use the \\`nx show projects\\` command to check which projects have been added (if any)\n- Carefully examine the files that have been generated and always refer back to the generator guide when working in a generated project\n- Generate all projects into the \\`packages/\\` directory\n- After making changes to your projects, fix linting issues, then run a full build\n- When it's time to start testing a project, suggest to the user that infrastructure is deployed to AWS. For websites, if a runtime-config.json is needed, use the load:runtime-config target after a deployment to point a local website at a sandbox stack.\n\n## Batching Generators\n\nWhen scaffolding several projects in one go, chain generators to avoid a slow dependency install after every generator:\n\n- **Chain generators** with \\`&&\\` in a single command. Pass \\`--prefer-install-dependencies=false\\` on each generator except the last so dependencies install once at the end, for example:\n\n${PACKAGE_MANAGERS.map(\n (pm) => ` \\`\\`\\`bash\n ${buildNxCommand('g @aws/nx-plugin:ts#trpc-api --no-interactive --name=my-app-api --auth=IAM --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#react-website --no-interactive --name=my-app-website --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:connection --no-interactive --sourceProject=@my-app/my-app-website --targetProject=@my-app/my-app-api --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#infra --no-interactive --name=infra', pm)} && \\\\\n ${buildNxCommand('sync', pm)}\n \\`\\`\\``,\n).join('\\n')}\n\n- **\\`--prefer-install-dependencies=false\\`** asks a generator to defer its dependency install so the batch installs once at the end (the final generator above omits the flag and installs everything).\n- **\\`nx sync\\`** is required before building — generators modify TypeScript project references.\n\n## Detailed Guides\n\nPlease refer to the below documentation for important details regarding workspaces and working with TypeScript or Python projects.\n\n${await fetchGuidePages(['workspace', 'typescript-project', 'python-project'], generators)}\n\n `,\n },\n ],\n }),\n );\n};\n"],"names":["IAC_PROVIDERS","buildNxCommand","fetchGuidePages","PACKAGE_MANAGERS","TOOL_SELECTION_GUIDE","addGeneralGuidanceTool","server","generators","registerTool","title","description","content","type","text","join","map","pm"],"mappings":"AAAA;;;CAGC,GAGD,SAASA,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,cAAc,EAAEC,eAAe,QAAQ,uBAAoB;AACpE,SAASC,gBAAgB,QAAQ,eAAY;AAE7C,OAAO,MAAMC,uBAAuB,CAAC;;;;;;+FAM0D,CAAC,CAAC;AAEjG;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CACpCC,QACAC;IAEAD,OAAOE,YAAY,CACjB,oBACA;QACEC,OAAO;QACPC,aACE;IACJ,GACA,UAAa,CAAA;YACXC,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC;;AAEjB,EAAET,qBAAqB;;;;yDAIkC,EAAED,iBAAiBW,IAAI,CAAC,MAAM;+EACR,EAAEd,cAAcc,IAAI,CAAC,MAAM;;;;;;;AAO1G,EAAEX,iBAAiBY,GAAG,CAAC,CAACC,KAAOf,eAAe,aAAae,KAAKF,IAAI,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqC9E,EAAEX,iBAAiBY,GAAG,CACpB,CAACC,KAAO,CAAC;EACT,EAAEf,eAAe,kHAAkHe,IAAI;IACrI,EAAEf,eAAe,gHAAgHe,IAAI;IACrI,EAAEf,eAAe,8JAA8Je,IAAI;IACnL,EAAEf,eAAe,2DAA2De,IAAI;IAChF,EAAEf,eAAe,QAAQe,IAAI;QACzB,CAAC,EACPF,IAAI,CAAC,MAAM;;;;;;;;;AASb,EAAE,MAAMZ,gBAAgB;wBAAC;wBAAa;wBAAsB;qBAAiB,EAAEK,YAAY;;IAEvF,CAAC;gBACG;aACD;QACH,CAAA;AAEJ,EAAE"}
@@ -116,6 +116,8 @@ The following list of generators are what is currently available in the \`@aws/n
116
116
 
117
117
  - **ts#lambda-function**: Generate a TypeScript lambda function
118
118
 
119
+ - **ts#dcr-proxy**: Generate an OAuth Dynamic Client Registration (DCR) proxy construct for Cognito-authenticated MCP servers
120
+
119
121
  - **ts#mcp-server**: Generate a TypeScript Model Context Protocol (MCP) server for providing context to Large Language Models
120
122
 
121
123
  - **ts#nx-generator**: Generator for adding an Nx Generator to an existing TypeScript project
@@ -243,7 +245,7 @@ export default {
243
245
 
244
246
  exports[`preset generator > should run successfully > biome.json 1`] = `
245
247
  "{
246
- "$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
248
+ "$schema": "https://biomejs.dev/schemas/2.5.4/schema.json",
247
249
  "root": true,
248
250
  "formatter": {
249
251
  "enabled": true,
@@ -268,7 +270,7 @@ exports[`preset generator > should run successfully > biome.json 1`] = `
268
270
  "linter": {
269
271
  "enabled": true,
270
272
  "rules": {
271
- "recommended": false,
273
+ "preset": "none",
272
274
  "correctness": {
273
275
  "noUndeclaredDependencies": "warn"
274
276
  }
@@ -341,7 +343,7 @@ exports[`preset generator > should run successfully > package.json 1`] = `
341
343
  "name": "@proj/source",
342
344
  "dependencies": {},
343
345
  "devDependencies": {
344
- "@biomejs/biome": "2.5.3",
346
+ "@biomejs/biome": "2.5.4",
345
347
  "@nx/js": "23.1.0",
346
348
  "@nx/workspace": "23.1.0",
347
349
  "@swc/helpers": "~0.5.18",
@@ -354,6 +356,7 @@ exports[`preset generator > should run successfully > package.json 1`] = `
354
356
  "build": "nx run-many --target build",
355
357
  "lint": "nx run-many --target lint --configuration=fix",
356
358
  "test": "nx run-many --target test --all",
359
+ "trivy": "nx run-many --target trivy --all",
357
360
  "build:skip-lint": "nx run-many --target build --configuration=skip-lint",
358
361
  "build:all": "nx run-many --target build --all",
359
362
  "affected:all": "nx affected --target build"
@@ -297,19 +297,19 @@ name = "proj.test_project"
297
297
  version = "0.1.0"
298
298
  dependencies = [
299
299
  "proj-agent-connection",
300
- "aws-lambda-powertools==3.31.0",
300
+ "aws-lambda-powertools==3.31.1",
301
301
  "aws-opentelemetry-distro==0.18.0",
302
- "bedrock-agentcore==1.18.0",
303
- "boto3==1.43.46",
304
- "fastapi==0.139.0",
302
+ "bedrock-agentcore==1.18.1",
303
+ "boto3==1.43.51",
304
+ "fastapi==0.139.2",
305
305
  "mcp==1.28.1",
306
- "strands-agents==1.47.0",
307
- "strands-agents-tools==0.8.3",
306
+ "strands-agents==1.48.0",
307
+ "strands-agents-tools==0.8.4",
308
308
  "uvicorn==0.51.0"
309
309
  ]
310
310
 
311
311
  [dependency-groups]
312
- dev = [ "fastapi[standard]==0.139.0" ]
312
+ dev = [ "fastapi[standard]==0.139.2" ]
313
313
 
314
314
  [tool.uv]
315
315
  dev-dependencies = [ ]
@@ -708,13 +708,13 @@ name = "proj.test_project"
708
708
  version = "0.1.0"
709
709
  dependencies = [
710
710
  "proj-agent-connection",
711
- "aws-lambda-powertools==3.31.0",
711
+ "aws-lambda-powertools==3.31.1",
712
712
  "aws-opentelemetry-distro==0.18.0",
713
- "bedrock-agentcore==1.18.0",
714
- "boto3==1.43.46",
715
- "fastapi==0.139.0",
713
+ "bedrock-agentcore==1.18.1",
714
+ "boto3==1.43.51",
715
+ "fastapi==0.139.2",
716
716
  "mcp==1.28.1",
717
- "langchain==1.3.13",
717
+ "langchain==1.3.14",
718
718
  "langchain-aws==1.6.2",
719
719
  "langgraph==1.2.9",
720
720
  "ag-ui-protocol==0.1.19",
@@ -723,7 +723,7 @@ dependencies = [
723
723
  ]
724
724
 
725
725
  [dependency-groups]
726
- dev = [ "fastapi[standard]==0.139.0" ]
726
+ dev = [ "fastapi[standard]==0.139.2" ]
727
727
 
728
728
  [tool.uv]
729
729
  dev-dependencies = [ ]
@@ -134,7 +134,7 @@ exports[`py#agent generator > should match snapshot for Terraform generated file
134
134
  required_providers {
135
135
  aws = {
136
136
  source = "hashicorp/aws"
137
- version = "6.54.0"
137
+ version = "6.55.0"
138
138
  }
139
139
  null = {
140
140
  source = "hashicorp/null"
@@ -542,7 +542,7 @@ resource "null_resource" "runtime_ready" {
542
542
 
543
543
  provisioner "local-exec" {
544
544
  command = <<-EOT
545
- uv run --with boto3==1.43.46 python -c "
545
+ uv run --with boto3==1.43.51 python -c "
546
546
  import boto3
547
547
  import json
548
548
  import os
@@ -24,7 +24,7 @@ export const pyAgentGatewayConnectionGenerator = async (tree, options)=>{
24
24
  throw new Error(`Gateway '${gateway.name}' has protocol='${gateway.protocol}'. Only MCP-protocol gateways are supported.`);
25
25
  }
26
26
  if (gateway.auth !== 'iam') {
27
- throw new Error(`Gateway '${gateway.name}' uses auth='${gateway.auth}'. Only IAM-authenticated gateways are supported in v1.`);
27
+ throw new Error(`Gateway '${gateway.name}' uses auth='${gateway.auth}'. Agent connections currently require the gateway to use IAM authentication.`);
28
28
  }
29
29
  if (agentComponent.auth && agentComponent.auth !== 'iam') {
30
30
  throw new Error(`Agent '${agentComponent.name}' uses auth='${agentComponent.auth}'. Only IAM-authenticated agents can connect to IAM gateways.`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/agent/gateway-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { readAgentCoreGatewayMetadata } from '../../../agentcore-gateway/generator';\nimport {\n addPythonCoreClient,\n addPythonReExport,\n ensurePythonAgentConnectionProject,\n getPythonAgentConnectionModuleName,\n getPythonAgentConnectionProject,\n getPythonAgentConnectionProjectDir,\n PY_MCP_FAMILY_CONNECTIONS,\n resolveAgentFramework,\n} from '../../../utils/agent-connection/agent-connection';\nimport { addPythonDestructuredImport } from '../../../utils/ast';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { installDependencies } from '../../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport { snakeCase } from '../../../utils/names';\nimport {\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport {\n addDependenciesToPyProjectToml,\n addWorkspaceDependencyToPyProject,\n} from '../../../utils/py';\nimport type { PyAgentGatewayConnectionGeneratorSchema } from './schema';\n\nexport const PY_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const pyAgentGatewayConnectionGenerator = async (\n tree: Tree,\n options: PyAgentGatewayConnectionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentComponent = options.sourceComponent;\n if (!agentComponent) {\n throw new Error(\n 'sourceComponent must be provided for py#agent -> agentcore-gateway connections',\n );\n }\n const gateway = readAgentCoreGatewayMetadata(targetProject);\n\n if (gateway.protocol !== 'mcp') {\n throw new Error(\n `Gateway '${gateway.name}' has protocol='${gateway.protocol}'. Only MCP-protocol gateways are supported.`,\n );\n }\n if (gateway.auth !== 'iam') {\n throw new Error(\n `Gateway '${gateway.name}' uses auth='${gateway.auth}'. Only IAM-authenticated gateways are supported in v1.`,\n );\n }\n if (agentComponent.auth && agentComponent.auth !== 'iam') {\n throw new Error(\n `Agent '${agentComponent.name}' uses auth='${agentComponent.auth}'. Only IAM-authenticated agents can connect to IAM gateways.`,\n );\n }\n\n const gatewayClassName = gateway.rc;\n const gatewaySnakeCase = snakeCase(gatewayClassName);\n // A gateway is its own standalone project, so it exposes plain serve / dev.\n const gatewayServeTargetName = 'serve';\n const gatewayDevTargetName = 'dev';\n\n // The source agent's framework selects the client shape, dependencies and the\n // agent.py transform — see PY_MCP_FAMILY_CONNECTIONS (keyed by framework, not a\n // boolean, so a third framework is an additive entry there). A Gateway exposes\n // its tools over MCP, so it reuses the same wiring as an MCP server connection.\n const framework = resolveAgentFramework(agentComponent.framework);\n const connection = PY_MCP_FAMILY_CONNECTIONS[framework];\n\n await ensurePythonAgentConnectionProject(tree);\n await addPythonCoreClient(tree, 'gateway', framework);\n\n const agentConnectionProjectDir = getPythonAgentConnectionProjectDir(tree);\n const agentConnectionModuleName = getPythonAgentConnectionModuleName(tree);\n\n // Shared MCP transport + signed httpx auth deps, plus whatever extra deps the\n // framework's MCP client needs (e.g. langchain-mcp-adapters for LangChain).\n addDependenciesToPyProjectToml(tree, agentConnectionProjectDir, [\n 'boto3',\n 'httpx',\n 'mcp',\n ...connection.deps,\n ]);\n\n const appDir = joinPathFragments(\n agentConnectionProjectDir,\n agentConnectionModuleName,\n 'app',\n );\n // Local mode points at the gateway project's local gateway port.\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n connection.appTemplateSubdir,\n ),\n appDir,\n {\n gatewaySnakeCase,\n gatewayClassName,\n agentConnectionModuleName,\n gatewayPort: gateway.port,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const appInitPath = joinPathFragments(appDir, '__init__.py');\n if (!tree.exists(appInitPath)) {\n tree.write(appInitPath, '');\n }\n\n const moduleInitPath = joinPathFragments(\n agentConnectionProjectDir,\n agentConnectionModuleName,\n '__init__.py',\n );\n await addPythonReExport(\n tree,\n moduleInitPath,\n `.app.${gatewaySnakeCase}_client_${connection.clientModuleSuffix}`,\n `${gatewayClassName}Client${connection.clientClassSuffix}`,\n );\n\n const agentSourceDir = joinPathFragments(\n sourceProject.root,\n agentComponent.path ?? 'src',\n );\n const agentFilePath = joinPathFragments(agentSourceDir, 'agent.py');\n\n if (tree.exists(agentFilePath)) {\n const clientClassName = `${gatewayClassName}Client${connection.clientClassSuffix}`;\n const clientVarName = gatewaySnakeCase;\n\n await addPythonDestructuredImport(\n tree,\n agentFilePath,\n [clientClassName],\n agentConnectionModuleName,\n );\n await connection.wireClientIntoAgent(\n tree,\n agentFilePath,\n clientClassName,\n clientVarName,\n );\n }\n\n addWorkspaceDependencyToPyProject(\n tree,\n sourceProject,\n getPythonAgentConnectionProject(tree),\n );\n\n const agentName = agentComponent.name ?? 'agent';\n const serveTargetName = `${agentName}-serve`;\n const devTargetName = `${agentName}-dev`;\n let projectConfigChanged = false;\n if (sourceProject.targets?.[serveTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, serveTargetName, {\n projects: [targetProject.name],\n target: gatewayServeTargetName,\n });\n projectConfigChanged = true;\n }\n if (sourceProject.targets?.[devTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTargetName, {\n projects: [targetProject.name],\n target: gatewayDevTargetName,\n });\n projectConfigChanged = true;\n }\n if (projectConfigChanged) {\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [\n PY_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default pyAgentGatewayConnectionGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","readAgentCoreGatewayMetadata","addPythonCoreClient","addPythonReExport","ensurePythonAgentConnectionProject","getPythonAgentConnectionModuleName","getPythonAgentConnectionProject","getPythonAgentConnectionProjectDir","PY_MCP_FAMILY_CONNECTIONS","resolveAgentFramework","addPythonDestructuredImport","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","snakeCase","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","addDependenciesToPyProjectToml","addWorkspaceDependencyToPyProject","PY_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO","filename","pyAgentGatewayConnectionGenerator","tree","options","sourceProject","targetProject","agentComponent","sourceComponent","Error","gateway","protocol","name","auth","gatewayClassName","rc","gatewaySnakeCase","gatewayServeTargetName","gatewayDevTargetName","framework","connection","agentConnectionProjectDir","agentConnectionModuleName","deps","appDir","dirname","appTemplateSubdir","gatewayPort","port","overwriteStrategy","KeepExisting","appInitPath","exists","write","moduleInitPath","clientModuleSuffix","clientClassSuffix","agentSourceDir","root","path","agentFilePath","clientClassName","clientVarName","wireClientIntoAgent","agentName","serveTargetName","devTargetName","projectConfigChanged","targets","projects","target","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,4BAA4B,QAAQ,0CAAuC;AACpF,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,kCAAkC,EAClCC,kCAAkC,EAClCC,+BAA+B,EAC/BC,kCAAkC,EAClCC,yBAAyB,EACzBC,qBAAqB,QAChB,sDAAmD;AAC1D,SAASC,2BAA2B,QAAQ,wBAAqB;AACjE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,mBAAmB,QAAQ,4BAAyB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SAASC,SAAS,QAAQ,0BAAuB;AACjD,SACEC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAC3B,SACEC,8BAA8B,EAC9BC,iCAAiC,QAC5B,uBAAoB;AAG3B,OAAO,MAAMC,6CACXJ,iBAAiB,YAAYK,QAAQ,EAAE;AAEzC,OAAO,MAAMC,oCAAoC,OAC/CC,MACAC;IAEA,MAAMC,gBAAgBR,oCACpBM,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBT,oCACpBM,MACAC,QAAQE,aAAa;IAGvB,MAAMC,iBAAiBH,QAAQI,eAAe;IAC9C,IAAI,CAACD,gBAAgB;QACnB,MAAM,IAAIE,MACR;IAEJ;IACA,MAAMC,UAAU7B,6BAA6By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AC3C,cAAcM,IAAI;aAAC;YAC9BsC,QAAQhC;QACV;QACA6B,uBAAuB;IACzB;IACA,IAAIA,sBAAsB;QACxBnE,2BAA2BuB,MAAME,cAAcO,IAAI,EAAEP;IACvD;IAEA,MAAMZ,gCAAgCU,MAAM;QAC1CH;KACD;IAED,MAAMT,qBAAqBY;IAC3B,OAAO,IACLX,oBAAoBW,MAAMC,QAAQ+C,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAelD,kCAAkC"}
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/agent/gateway-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { readAgentCoreGatewayMetadata } from '../../../agentcore-gateway/generator';\nimport {\n addPythonCoreClient,\n addPythonReExport,\n ensurePythonAgentConnectionProject,\n getPythonAgentConnectionModuleName,\n getPythonAgentConnectionProject,\n getPythonAgentConnectionProjectDir,\n PY_MCP_FAMILY_CONNECTIONS,\n resolveAgentFramework,\n} from '../../../utils/agent-connection/agent-connection';\nimport { addPythonDestructuredImport } from '../../../utils/ast';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { installDependencies } from '../../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport { snakeCase } from '../../../utils/names';\nimport {\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport {\n addDependenciesToPyProjectToml,\n addWorkspaceDependencyToPyProject,\n} from '../../../utils/py';\nimport type { PyAgentGatewayConnectionGeneratorSchema } from './schema';\n\nexport const PY_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const pyAgentGatewayConnectionGenerator = async (\n tree: Tree,\n options: PyAgentGatewayConnectionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentComponent = options.sourceComponent;\n if (!agentComponent) {\n throw new Error(\n 'sourceComponent must be provided for py#agent -> agentcore-gateway connections',\n );\n }\n const gateway = readAgentCoreGatewayMetadata(targetProject);\n\n if (gateway.protocol !== 'mcp') {\n throw new Error(\n `Gateway '${gateway.name}' has protocol='${gateway.protocol}'. Only MCP-protocol gateways are supported.`,\n );\n }\n if (gateway.auth !== 'iam') {\n throw new Error(\n `Gateway '${gateway.name}' uses auth='${gateway.auth}'. Agent connections currently require the gateway to use IAM authentication.`,\n );\n }\n if (agentComponent.auth && agentComponent.auth !== 'iam') {\n throw new Error(\n `Agent '${agentComponent.name}' uses auth='${agentComponent.auth}'. Only IAM-authenticated agents can connect to IAM gateways.`,\n );\n }\n\n const gatewayClassName = gateway.rc;\n const gatewaySnakeCase = snakeCase(gatewayClassName);\n // A gateway is its own standalone project, so it exposes plain serve / dev.\n const gatewayServeTargetName = 'serve';\n const gatewayDevTargetName = 'dev';\n\n // The source agent's framework selects the client shape, dependencies and the\n // agent.py transform — see PY_MCP_FAMILY_CONNECTIONS (keyed by framework, not a\n // boolean, so a third framework is an additive entry there). A Gateway exposes\n // its tools over MCP, so it reuses the same wiring as an MCP server connection.\n const framework = resolveAgentFramework(agentComponent.framework);\n const connection = PY_MCP_FAMILY_CONNECTIONS[framework];\n\n await ensurePythonAgentConnectionProject(tree);\n await addPythonCoreClient(tree, 'gateway', framework);\n\n const agentConnectionProjectDir = getPythonAgentConnectionProjectDir(tree);\n const agentConnectionModuleName = getPythonAgentConnectionModuleName(tree);\n\n // Shared MCP transport + signed httpx auth deps, plus whatever extra deps the\n // framework's MCP client needs (e.g. langchain-mcp-adapters for LangChain).\n addDependenciesToPyProjectToml(tree, agentConnectionProjectDir, [\n 'boto3',\n 'httpx',\n 'mcp',\n ...connection.deps,\n ]);\n\n const appDir = joinPathFragments(\n agentConnectionProjectDir,\n agentConnectionModuleName,\n 'app',\n );\n // Local mode points at the gateway project's local gateway port.\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n connection.appTemplateSubdir,\n ),\n appDir,\n {\n gatewaySnakeCase,\n gatewayClassName,\n agentConnectionModuleName,\n gatewayPort: gateway.port,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const appInitPath = joinPathFragments(appDir, '__init__.py');\n if (!tree.exists(appInitPath)) {\n tree.write(appInitPath, '');\n }\n\n const moduleInitPath = joinPathFragments(\n agentConnectionProjectDir,\n agentConnectionModuleName,\n '__init__.py',\n );\n await addPythonReExport(\n tree,\n moduleInitPath,\n `.app.${gatewaySnakeCase}_client_${connection.clientModuleSuffix}`,\n `${gatewayClassName}Client${connection.clientClassSuffix}`,\n );\n\n const agentSourceDir = joinPathFragments(\n sourceProject.root,\n agentComponent.path ?? 'src',\n );\n const agentFilePath = joinPathFragments(agentSourceDir, 'agent.py');\n\n if (tree.exists(agentFilePath)) {\n const clientClassName = `${gatewayClassName}Client${connection.clientClassSuffix}`;\n const clientVarName = gatewaySnakeCase;\n\n await addPythonDestructuredImport(\n tree,\n agentFilePath,\n [clientClassName],\n agentConnectionModuleName,\n );\n await connection.wireClientIntoAgent(\n tree,\n agentFilePath,\n clientClassName,\n clientVarName,\n );\n }\n\n addWorkspaceDependencyToPyProject(\n tree,\n sourceProject,\n getPythonAgentConnectionProject(tree),\n );\n\n const agentName = agentComponent.name ?? 'agent';\n const serveTargetName = `${agentName}-serve`;\n const devTargetName = `${agentName}-dev`;\n let projectConfigChanged = false;\n if (sourceProject.targets?.[serveTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, serveTargetName, {\n projects: [targetProject.name],\n target: gatewayServeTargetName,\n });\n projectConfigChanged = true;\n }\n if (sourceProject.targets?.[devTargetName]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTargetName, {\n projects: [targetProject.name],\n target: gatewayDevTargetName,\n });\n projectConfigChanged = true;\n }\n if (projectConfigChanged) {\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [\n PY_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default pyAgentGatewayConnectionGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","readAgentCoreGatewayMetadata","addPythonCoreClient","addPythonReExport","ensurePythonAgentConnectionProject","getPythonAgentConnectionModuleName","getPythonAgentConnectionProject","getPythonAgentConnectionProjectDir","PY_MCP_FAMILY_CONNECTIONS","resolveAgentFramework","addPythonDestructuredImport","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","snakeCase","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","addDependenciesToPyProjectToml","addWorkspaceDependencyToPyProject","PY_AGENT_GATEWAY_CONNECTION_GENERATOR_INFO","filename","pyAgentGatewayConnectionGenerator","tree","options","sourceProject","targetProject","agentComponent","sourceComponent","Error","gateway","protocol","name","auth","gatewayClassName","rc","gatewaySnakeCase","gatewayServeTargetName","gatewayDevTargetName","framework","connection","agentConnectionProjectDir","agentConnectionModuleName","deps","appDir","dirname","appTemplateSubdir","gatewayPort","port","overwriteStrategy","KeepExisting","appInitPath","exists","write","moduleInitPath","clientModuleSuffix","clientClassSuffix","agentSourceDir","root","path","agentFilePath","clientClassName","clientVarName","wireClientIntoAgent","agentName","serveTargetName","devTargetName","projectConfigChanged","targets","projects","target","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAi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generator > should generate terraform modules when iac is t
35
35
  required_providers {
36
36
  aws = {
37
37
  source = "hashicorp/aws"
38
- version = "6.54.0"
38
+ version = "6.55.0"
39
39
  }
40
40
  }
41
41
  }
@@ -192,7 +192,7 @@ exports[`py#dynamodb generator > should generate terraform modules when iac is t
192
192
  required_providers {
193
193
  aws = {
194
194
  source = "hashicorp/aws"
195
- version = "6.54.0"
195
+ version = "6.55.0"
196
196
  }
197
197
  random = {
198
198
  source = "hashicorp/random"
@@ -604,9 +604,7 @@ process.on('SIGTERM', cleanup);
604
604
  process.on('SIGINT', cleanup);
605
605
  process.on('SIGHUP', cleanup);
606
606
 
607
- logs.on('exit', (code) => {
608
- if (!exiting) process.exit(code ?? 0);
609
- });
607
+ logs.on('exit', cleanup);
610
608
  "
611
609
  `;
612
610
 
@@ -1322,9 +1320,7 @@ process.on('SIGTERM', cleanup);
1322
1320
  process.on('SIGINT', cleanup);
1323
1321
  process.on('SIGHUP', cleanup);
1324
1322
 
1325
- logs.on('exit', (code) => {
1326
- if (!exiting) process.exit(code ?? 0);
1327
- });
1323
+ logs.on('exit', cleanup);
1328
1324
  "
1329
1325
  `;
1330
1326
 
@@ -11,7 +11,7 @@ terraform {
11
11
  required_providers {
12
12
  aws = {
13
13
  source = "hashicorp/aws"
14
- version = "6.54.0"
14
+ version = "6.55.0"
15
15
  }
16
16
  }
17
17
  }
@@ -258,7 +258,7 @@ output "api_log_group_arn" {
258
258
  required_providers {
259
259
  aws = {
260
260
  source = "hashicorp/aws"
261
- version = "6.54.0"
261
+ version = "6.55.0"
262
262
  }
263
263
  }
264
264
  }
@@ -771,7 +771,7 @@ terraform {
771
771
  required_providers {
772
772
  aws = {
773
773
  source = "hashicorp/aws"
774
- version = "6.54.0"
774
+ version = "6.55.0"
775
775
  }
776
776
  }
777
777
  }
@@ -1018,7 +1018,7 @@ output "api_log_group_arn" {
1018
1018
  required_providers {
1019
1019
  aws = {
1020
1020
  source = "hashicorp/aws"
1021
- version = "6.54.0"
1021
+ version = "6.55.0"
1022
1022
  }
1023
1023
  }
1024
1024
  }
@@ -1603,7 +1603,7 @@ terraform {
1603
1603
  required_providers {
1604
1604
  aws = {
1605
1605
  source = "hashicorp/aws"
1606
- version = "6.54.0"
1606
+ version = "6.55.0"
1607
1607
  }
1608
1608
  }
1609
1609
  }
@@ -1850,7 +1850,7 @@ output "api_log_group_arn" {
1850
1850
  required_providers {
1851
1851
  aws = {
1852
1852
  source = "hashicorp/aws"
1853
- version = "6.54.0"
1853
+ version = "6.55.0"
1854
1854
  }
1855
1855
  }
1856
1856
  }
@@ -2340,7 +2340,7 @@ terraform {
2340
2340
  required_providers {
2341
2341
  aws = {
2342
2342
  source = "hashicorp/aws"
2343
- version = "6.54.0"
2343
+ version = "6.55.0"
2344
2344
  }
2345
2345
  random = {
2346
2346
  source = "hashicorp/random"
@@ -2596,7 +2596,7 @@ output "waf_web_acl_arn" {
2596
2596
  required_providers {
2597
2597
  aws = {
2598
2598
  source = "hashicorp/aws"
2599
- version = "6.54.0"
2599
+ version = "6.55.0"
2600
2600
  }
2601
2601
  }
2602
2602
  }
@@ -3346,7 +3346,7 @@ terraform {
3346
3346
  required_providers {
3347
3347
  aws = {
3348
3348
  source = "hashicorp/aws"
3349
- version = "6.54.0"
3349
+ version = "6.55.0"
3350
3350
  }
3351
3351
  random = {
3352
3352
  source = "hashicorp/random"
@@ -3602,7 +3602,7 @@ output "waf_web_acl_arn" {
3602
3602
  required_providers {
3603
3603
  aws = {
3604
3604
  source = "hashicorp/aws"
3605
- version = "6.54.0"
3605
+ version = "6.55.0"
3606
3606
  }
3607
3607
  }
3608
3608
  }
@@ -4341,7 +4341,7 @@ terraform {
4341
4341
  required_providers {
4342
4342
  aws = {
4343
4343
  source = "hashicorp/aws"
4344
- version = "6.54.0"
4344
+ version = "6.55.0"
4345
4345
  }
4346
4346
  random = {
4347
4347
  source = "hashicorp/random"
@@ -4597,7 +4597,7 @@ output "waf_web_acl_arn" {
4597
4597
  required_providers {
4598
4598
  aws = {
4599
4599
  source = "hashicorp/aws"
4600
- version = "6.54.0"
4600
+ version = "6.55.0"
4601
4601
  }
4602
4602
  }
4603
4603
  }
@@ -70,7 +70,7 @@ exports[`lambda-handler project generator > terraform iac > should generate terr
70
70
  required_providers {
71
71
  aws = {
72
72
  source = "hashicorp/aws"
73
- version = "6.54.0"
73
+ version = "6.55.0"
74
74
  }
75
75
  archive = {
76
76
  source = "hashicorp/archive"
@@ -251,7 +251,7 @@ exports[`lambda-handler project generator > terraform iac > should match snapsho
251
251
  required_providers {
252
252
  aws = {
253
253
  source = "hashicorp/aws"
254
- version = "6.54.0"
254
+ version = "6.55.0"
255
255
  }
256
256
  archive = {
257
257
  source = "hashicorp/archive"