@aws/nx-plugin 1.0.0-rc.58 → 1.0.0-rc.59

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 (96) hide show
  1. package/generators.json +17 -1
  2. package/migrations.json +12 -7
  3. package/package.json +1 -1
  4. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +273 -0
  5. package/src/agentcore-gateway/agent-connection/generator.d.ts +19 -0
  6. package/src/agentcore-gateway/agent-connection/generator.js +90 -0
  7. package/src/agentcore-gateway/agent-connection/generator.js.map +1 -0
  8. package/src/agentcore-gateway/agent-connection/schema.d.js +6 -0
  9. package/src/agentcore-gateway/agent-connection/schema.d.js.map +1 -0
  10. package/src/agentcore-gateway/agent-connection/schema.d.ts +13 -0
  11. package/src/agentcore-gateway/agent-connection/schema.json +31 -0
  12. package/src/agentcore-gateway/attach-upstream.d.ts +16 -0
  13. package/src/agentcore-gateway/attach-upstream.js +32 -11
  14. package/src/agentcore-gateway/attach-upstream.js.map +1 -1
  15. package/src/agentcore-gateway/files/project/http/local-dev.ts.template +77 -0
  16. package/src/agentcore-gateway/generator.d.ts +1 -0
  17. package/src/agentcore-gateway/generator.js +22 -10
  18. package/src/agentcore-gateway/generator.js.map +1 -1
  19. package/src/agentcore-gateway/react-connection/__snapshots__/generator.spec.ts.snap +68 -0
  20. package/src/agentcore-gateway/react-connection/generator.d.ts +19 -0
  21. package/src/agentcore-gateway/react-connection/generator.js +119 -0
  22. package/src/agentcore-gateway/react-connection/generator.js.map +1 -0
  23. package/src/agentcore-gateway/react-connection/schema.d.js +6 -0
  24. package/src/agentcore-gateway/react-connection/schema.d.js.map +1 -0
  25. package/src/agentcore-gateway/react-connection/schema.d.ts +13 -0
  26. package/src/agentcore-gateway/react-connection/schema.json +31 -0
  27. package/src/agentcore-gateway/schema.d.js.map +1 -1
  28. package/src/agentcore-gateway/schema.d.ts +1 -1
  29. package/src/agentcore-gateway/schema.json +2 -2
  30. package/src/connection/agent-local-dev.d.ts +16 -0
  31. package/src/connection/agent-local-dev.js +44 -2
  32. package/src/connection/agent-local-dev.js.map +1 -1
  33. package/src/connection/gateway-runtime-config.d.ts +19 -0
  34. package/src/connection/gateway-runtime-config.js +47 -0
  35. package/src/connection/gateway-runtime-config.js.map +1 -0
  36. package/src/connection/generator.js +5 -0
  37. package/src/connection/generator.js.map +1 -1
  38. package/src/connection/scaffold-catalog.d.ts +107 -0
  39. package/src/connection/scaffold-catalog.js +140 -0
  40. package/src/connection/scaffold-catalog.js.map +1 -1
  41. package/src/connection/supported-connections.d.ts +9 -0
  42. package/src/connection/supported-connections.js +12 -0
  43. package/src/connection/supported-connections.js.map +1 -1
  44. package/src/internal/test-matrix/generator.js +39 -1
  45. package/src/internal/test-matrix/generator.js.map +1 -1
  46. package/src/migrations/latest/gateway-agent-targets/__snapshots__/migration.spec.ts.snap +223 -0
  47. package/src/migrations/latest/gateway-agent-targets/metadata.json +3 -0
  48. package/src/migrations/latest/gateway-agent-targets/migration.d.ts +6 -0
  49. package/src/migrations/latest/gateway-agent-targets/migration.js +217 -0
  50. package/src/migrations/latest/gateway-agent-targets/migration.js.map +1 -0
  51. package/src/migrations/latest/smithy-ssdk-bundle-pins/metadata.json +3 -0
  52. package/src/migrations/v1.0.0-rc.50/modernize-function-props-cast/metadata.json +3 -0
  53. package/src/migrations/v1.0.0-rc.50/restrict-cors-to-custom-domains/metadata.json +3 -0
  54. package/src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/metadata.json +3 -0
  55. package/src/migrations/v1.0.0-rc.52/user-identity-waf-allow-localhost-callback/metadata.json +3 -0
  56. package/src/migrations/v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy/metadata.json +3 -0
  57. package/src/migrations/v1.0.0-rc.55/backfill-generator-metadata/metadata.json +3 -0
  58. package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/metadata.json +3 -0
  59. package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/metadata.json +3 -0
  60. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -0
  61. package/src/py/agent/react-connection/generator.d.ts +4 -1
  62. package/src/py/agent/react-connection/generator.js +35 -14
  63. package/src/py/agent/react-connection/generator.js.map +1 -1
  64. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +4 -0
  65. package/src/ts/agent/react-connection/generator.d.ts +16 -1
  66. package/src/ts/agent/react-connection/generator.js +21 -8
  67. package/src/ts/agent/react-connection/generator.js.map +1 -1
  68. package/src/ts/nx-migration/generator.js +40 -27
  69. package/src/ts/nx-migration/generator.js.map +1 -1
  70. package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +16 -0
  71. package/src/ts/react-website/agui/generator.d.ts +11 -0
  72. package/src/ts/react-website/agui/generator.js +11 -7
  73. package/src/ts/react-website/agui/generator.js.map +1 -1
  74. package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +5 -0
  75. package/src/utils/agent-core-constructs/agent-core-constructs.js +2 -0
  76. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  77. package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +3 -0
  78. package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +6 -4
  79. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +119 -3
  80. package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +17 -0
  81. package/src/utils/config/utils.d.ts +5 -0
  82. package/src/utils/config/utils.js +7 -1
  83. package/src/utils/config/utils.js.map +1 -1
  84. package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +13 -2
  85. package/src/utils/connection/open-api/react.d.ts +10 -1
  86. package/src/utils/connection/open-api/react.js +3 -2
  87. package/src/utils/connection/open-api/react.js.map +1 -1
  88. package/src/utils/migration-manifest.d.ts +58 -0
  89. package/src/utils/migration-manifest.js +76 -0
  90. package/src/utils/migration-manifest.js.map +1 -0
  91. package/src/utils/migration-versions.d.ts +2 -0
  92. package/src/utils/migration-versions.js.map +1 -1
  93. package/src/utils/version-upgrade-migration/register.d.ts +4 -2
  94. package/src/utils/version-upgrade-migration/register.js +13 -13
  95. package/src/utils/version-upgrade-migration/register.js.map +1 -1
  96. /package/src/agentcore-gateway/files/project/{local-dev.ts.template → mcp/local-dev.ts.template} +0 -0
@@ -32,10 +32,52 @@ import { addDependencyToTargetIfNotPresent, readProjectConfigurationUnqualified
32
32
  addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);
33
33
  }
34
34
  updateProjectConfiguration(tree, sourceProject.name, sourceProject);
35
- // Add an override to runtime-config for the dev target to use the local url
35
+ await addLocalDevRuntimeConfigOverride(tree, sourceProject, {
36
+ statement: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName} = '${options.localUrl}';`,
37
+ marker: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName}`
38
+ });
39
+ };
40
+ /**
41
+ * Adds an AgentCore Gateway project's dev target as a dependency of the
42
+ * source project's dev target (transitively starting the gateway's attached
43
+ * agents), and updates the RuntimeConfig provider to point the gateway's
44
+ * runtime config entry at the local gateway.
45
+ */ export const addGatewayTargetToLocalDev = async (tree, sourceProjectName, gatewayProjectName, options)=>{
46
+ const sourceProject = readProjectConfigurationUnqualified(tree, sourceProjectName);
47
+ const gatewayProject = readProjectConfigurationUnqualified(tree, gatewayProjectName);
48
+ // A gateway is its own standalone project, so it exposes plain dev
49
+ if (!(gatewayProject.targets?.['dev']?.continuous && sourceProject.targets?.['dev'])) {
50
+ return;
51
+ }
52
+ addDependencyToTargetIfNotPresent(sourceProject, 'dev', {
53
+ projects: [
54
+ gatewayProject.name
55
+ ],
56
+ target: 'dev'
57
+ });
58
+ for (const additional of options.additionalDependencyTargets ?? []){
59
+ addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);
60
+ }
61
+ updateProjectConfiguration(tree, sourceProject.name, sourceProject);
62
+ // Spread rather than member assignment: the provider's fetch-failure
63
+ // fallback config carries no `gateways` key, so assigning into it would
64
+ // throw and leave the site stuck on the loading spinner. The marker is
65
+ // this gateway's own local URL (its port is unique per gateway and stable
66
+ // across re-runs), not the shared `gateways` key, so a website connected to
67
+ // several gateways gets one override statement per gateway.
68
+ await addLocalDevRuntimeConfigOverride(tree, sourceProject, {
69
+ statement: `runtimeConfig.gateways = { ...runtimeConfig.gateways, ${options.gatewayClassName}: 'http://localhost:${options.port}' };`,
70
+ marker: `'http://localhost:${options.port}'`
71
+ });
72
+ };
73
+ /**
74
+ * Add an override statement to the source project's RuntimeConfig provider so
75
+ * the dev target uses local urls. `marker` guards idempotency: the statement
76
+ * is only inserted when the overrides don't already contain it. Idempotent.
77
+ */ const addLocalDevRuntimeConfigOverride = async (tree, sourceProject, options)=>{
36
78
  const runtimeConfigProvider = joinPathFragments(sourceProject.root, 'src', 'components', 'RuntimeConfig', 'index.tsx');
37
79
  if (tree.exists(runtimeConfigProvider)) {
38
- await applyGritQL(tree, runtimeConfigProvider, `\`if ($cond) { $stmts }\` => raw\`if ($cond) {\n $stmts\n runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName} = '${options.localUrl}';\n }\` where { $cond <: contains \`'local-dev'\`, $stmts <: within \`const applyOverrides = $_\`, $stmts <: not contains \`runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName}\` }`);
80
+ await applyGritQL(tree, runtimeConfigProvider, `\`if ($cond) { $stmts }\` => raw\`if ($cond) {\n $stmts\n ${options.statement}\n }\` where { $cond <: contains \`'local-dev'\`, $stmts <: within \`const applyOverrides = $_\`, $stmts <: not contains \`${options.marker}\` }`);
39
81
  }
40
82
  };
41
83
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/agent-local-dev.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 Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { applyGritQL } from '../utils/ast';\nimport {\n addDependencyToTargetIfNotPresent,\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\n\nexport interface AgentLocalDevOptions {\n agentNameClassName: string;\n port: number;\n targetComponent?: ComponentMetadata;\n /**\n * The runtime config namespace to set the local URL on.\n * E.g. 'apis' results in `runtimeConfig.apis.X = url`\n */\n runtimeConfigNamespace: string;\n /**\n * The local URL to set in the runtime config override.\n */\n localUrl: string;\n /**\n * Additional targets to add as dev dependencies.\n */\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds a Strands Agent's component dev target as a dependency of the\n * source project's dev target, and updates the RuntimeConfig provider\n * to point to the agent's local URL.\n *\n * This is the shared implementation used by both Python and TypeScript Strands\n * Agent react-connection generators.\n */\nexport const addAgentTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n targetProjectName: string,\n options: AgentLocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n targetProjectName,\n );\n\n // Determine the dev target name for the agent component\n const agentDevTargetName = options.targetComponent?.name\n ? `${options.targetComponent.name}-dev`\n : 'agent-dev';\n\n // Target project must have the agent dev target which is continuous\n if (\n !(\n targetProject.targets?.[agentDevTargetName]?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n // Add a dependency on the agent dev target (so that the agent's\n // own dev dependencies, such as MCP servers, are also started)\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: agentDevTargetName,\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n // Add an override to runtime-config for the dev target to use the local url\n const runtimeConfigProvider = joinPathFragments(\n sourceProject.root,\n 'src',\n 'components',\n 'RuntimeConfig',\n 'index.tsx',\n );\n if (tree.exists(runtimeConfigProvider)) {\n await applyGritQL(\n tree,\n runtimeConfigProvider,\n `\\`if ($cond) { $stmts }\\` => raw\\`if ($cond) {\\n $stmts\\n runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName} = '${options.localUrl}';\\n }\\` where { $cond <: contains \\`'local-dev'\\`, $stmts <: within \\`const applyOverrides = $_\\`, $stmts <: not contains \\`runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName}\\` }`,\n );\n }\n};\n"],"names":["joinPathFragments","updateProjectConfiguration","applyGritQL","addDependencyToTargetIfNotPresent","readProjectConfigurationUnqualified","addAgentTargetToLocalDev","tree","sourceProjectName","targetProjectName","options","sourceProject","targetProject","agentDevTargetName","targetComponent","name","targets","continuous","projects","target","additional","additionalDependencyTargets","runtimeConfigProvider","root","exists","runtimeConfigNamespace","agentNameClassName","localUrl"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SACEC,iCAAiC,EAEjCC,mCAAmC,QAC9B,iBAAc;AAqBrB;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B,OACtCC,MACAC,mBACAC,mBACAC;IAEA,MAAMC,gBAAgBN,oCACpBE,MACAC;IAEF,MAAMI,gBAAgBP,oCACpBE,MACAE;IAGF,wDAAwD;IACxD,MAAMI,qBAAqBH,QAAQI,eAAe,EAAEC,OAChD,GAAGL,QAAQI,eAAe,CAACC,IAAI,CAAC,IAAI,CAAC,GACrC;IAEJ,oEAAoE;IACpE,IACE,CACEH,CAAAA,cAAcI,OAAO,EAAE,CAACH,mBAAmB,EAAEI,cAC7CN,cAAcK,OAAO,EAAE,CAAC,MAAM,AAAD,GAE/B;QACA;IACF;IAEA,gEAAgE;IAChE,+DAA+D;IAC/DZ,kCAAkCO,eAAe,OAAO;QACtDO,UAAU;YAACN,cAAcG,IAAI;SAAC;QAC9BI,QAAQN;IACV;IACA,KAAK,MAAMO,cAAcV,QAAQW,2BAA2B,IAAI,EAAE,CAAE;QAClEjB,kCAAkCO,eAAe,OAAOS;IAC1D;IACAlB,2BAA2BK,MAAMI,cAAcI,IAAI,EAAEJ;IAErD,4EAA4E;IAC5E,MAAMW,wBAAwBrB,kBAC5BU,cAAcY,IAAI,EAClB,OACA,cACA,iBACA;IAEF,IAAIhB,KAAKiB,MAAM,CAACF,wBAAwB;QACtC,MAAMnB,YACJI,MACAe,uBACA,CAAC,8EAA8E,EAAEZ,QAAQe,sBAAsB,CAAC,CAAC,EAAEf,QAAQgB,kBAAkB,CAAC,IAAI,EAAEhB,QAAQiB,QAAQ,CAAC,4IAA4I,EAAEjB,QAAQe,sBAAsB,CAAC,CAAC,EAAEf,QAAQgB,kBAAkB,CAAC,IAAI,CAAC;IAEzX;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/agent-local-dev.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 Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { applyGritQL } from '../utils/ast';\nimport {\n addDependencyToTargetIfNotPresent,\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\n\nexport interface AgentLocalDevOptions {\n agentNameClassName: string;\n port: number;\n targetComponent?: ComponentMetadata;\n /**\n * The runtime config namespace to set the local URL on.\n * E.g. 'apis' results in `runtimeConfig.apis.X = url`\n */\n runtimeConfigNamespace: string;\n /**\n * The local URL to set in the runtime config override.\n */\n localUrl: string;\n /**\n * Additional targets to add as dev dependencies.\n */\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds a Strands Agent's component dev target as a dependency of the\n * source project's dev target, and updates the RuntimeConfig provider\n * to point to the agent's local URL.\n *\n * This is the shared implementation used by both Python and TypeScript Strands\n * Agent react-connection generators.\n */\nexport const addAgentTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n targetProjectName: string,\n options: AgentLocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n targetProjectName,\n );\n\n // Determine the dev target name for the agent component\n const agentDevTargetName = options.targetComponent?.name\n ? `${options.targetComponent.name}-dev`\n : 'agent-dev';\n\n // Target project must have the agent dev target which is continuous\n if (\n !(\n targetProject.targets?.[agentDevTargetName]?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n // Add a dependency on the agent dev target (so that the agent's\n // own dev dependencies, such as MCP servers, are also started)\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: agentDevTargetName,\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n await addLocalDevRuntimeConfigOverride(tree, sourceProject, {\n statement: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName} = '${options.localUrl}';`,\n marker: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName}`,\n });\n};\n\nexport interface GatewayLocalDevOptions {\n gatewayClassName: string;\n /** Local port the gateway project's dev target listens on. */\n port: number;\n /**\n * Additional targets to add as dev dependencies.\n */\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds an AgentCore Gateway project's dev target as a dependency of the\n * source project's dev target (transitively starting the gateway's attached\n * agents), and updates the RuntimeConfig provider to point the gateway's\n * runtime config entry at the local gateway.\n */\nexport const addGatewayTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n gatewayProjectName: string,\n options: GatewayLocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const gatewayProject = readProjectConfigurationUnqualified(\n tree,\n gatewayProjectName,\n );\n\n // A gateway is its own standalone project, so it exposes plain dev\n if (\n !(\n gatewayProject.targets?.['dev']?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [gatewayProject.name],\n target: 'dev',\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n // Spread rather than member assignment: the provider's fetch-failure\n // fallback config carries no `gateways` key, so assigning into it would\n // throw and leave the site stuck on the loading spinner. The marker is\n // this gateway's own local URL (its port is unique per gateway and stable\n // across re-runs), not the shared `gateways` key, so a website connected to\n // several gateways gets one override statement per gateway.\n await addLocalDevRuntimeConfigOverride(tree, sourceProject, {\n statement: `runtimeConfig.gateways = { ...runtimeConfig.gateways, ${options.gatewayClassName}: 'http://localhost:${options.port}' };`,\n marker: `'http://localhost:${options.port}'`,\n });\n};\n\n/**\n * Add an override statement to the source project's RuntimeConfig provider so\n * the dev target uses local urls. `marker` guards idempotency: the statement\n * is only inserted when the overrides don't already contain it. Idempotent.\n */\nconst addLocalDevRuntimeConfigOverride = async (\n tree: Tree,\n sourceProject: { root: string },\n options: { statement: string; marker: string },\n) => {\n const runtimeConfigProvider = joinPathFragments(\n sourceProject.root,\n 'src',\n 'components',\n 'RuntimeConfig',\n 'index.tsx',\n );\n if (tree.exists(runtimeConfigProvider)) {\n await applyGritQL(\n tree,\n runtimeConfigProvider,\n `\\`if ($cond) { $stmts }\\` => raw\\`if ($cond) {\\n $stmts\\n ${options.statement}\\n }\\` where { $cond <: contains \\`'local-dev'\\`, $stmts <: within \\`const applyOverrides = $_\\`, $stmts <: not contains \\`${options.marker}\\` }`,\n );\n }\n};\n"],"names":["joinPathFragments","updateProjectConfiguration","applyGritQL","addDependencyToTargetIfNotPresent","readProjectConfigurationUnqualified","addAgentTargetToLocalDev","tree","sourceProjectName","targetProjectName","options","sourceProject","targetProject","agentDevTargetName","targetComponent","name","targets","continuous","projects","target","additional","additionalDependencyTargets","addLocalDevRuntimeConfigOverride","statement","runtimeConfigNamespace","agentNameClassName","localUrl","marker","addGatewayTargetToLocalDev","gatewayProjectName","gatewayProject","gatewayClassName","port","runtimeConfigProvider","root","exists"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SACEC,iCAAiC,EAEjCC,mCAAmC,QAC9B,iBAAc;AAqBrB;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B,OACtCC,MACAC,mBACAC,mBACAC;IAEA,MAAMC,gBAAgBN,oCACpBE,MACAC;IAEF,MAAMI,gBAAgBP,oCACpBE,MACAE;IAGF,wDAAwD;IACxD,MAAMI,qBAAqBH,QAAQI,eAAe,EAAEC,OAChD,GAAGL,QAAQI,eAAe,CAACC,IAAI,CAAC,IAAI,CAAC,GACrC;IAEJ,oEAAoE;IACpE,IACE,CACEH,CAAAA,cAAcI,OAAO,EAAE,CAACH,mBAAmB,EAAEI,cAC7CN,cAAcK,OAAO,EAAE,CAAC,MAAM,AAAD,GAE/B;QACA;IACF;IAEA,gEAAgE;IAChE,+DAA+D;IAC/DZ,kCAAkCO,eAAe,OAAO;QACtDO,UAAU;YAACN,cAAcG,IAAI;SAAC;QAC9BI,QAAQN;IACV;IACA,KAAK,MAAMO,cAAcV,QAAQW,2BAA2B,IAAI,EAAE,CAAE;QAClEjB,kCAAkCO,eAAe,OAAOS;IAC1D;IACAlB,2BAA2BK,MAAMI,cAAcI,IAAI,EAAEJ;IAErD,MAAMW,iCAAiCf,MAAMI,eAAe;QAC1DY,WAAW,CAAC,cAAc,EAAEb,QAAQc,sBAAsB,CAAC,CAAC,EAAEd,QAAQe,kBAAkB,CAAC,IAAI,EAAEf,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AA4H,EAAEb,QAAQiB,MAAM,CAAC,IAAI,CAAC;IAE3O;AACF"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type Tree } from '@nx/devkit';
6
+ /**
7
+ * Register the gateway's URL in the 'connection' namespace so it is published
8
+ * to the website's runtime-config.json. Patches the generated CDK and
9
+ * Terraform constructs in-place; idempotent.
10
+ *
11
+ * Note: the 'connection' namespace is stage-scoped — every StaticWebsite in
12
+ * the stage will see this URL, not just the one the user connected.
13
+ */
14
+ export declare const addGatewayUrlToConnectionNamespace: (tree: Tree, options: {
15
+ /** The kebab-case directory name that holds the construct, e.g. 'my-gateway'. */
16
+ gatewayNameKebabCase: string;
17
+ /** The class name of the gateway, e.g. 'MyGateway'. */
18
+ gatewayNameClassName: string;
19
+ }) => Promise<void>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { joinPathFragments } from "@nx/devkit";
5
+ import { applyGritQL, matchGritQL } from "../utils/ast.js";
6
+ import { PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, SHARED_TERRAFORM_DIR } from "../utils/shared-constructs-constants.js";
7
+ const CONNECTION_TF_MODULE_NAME = 'add_gateway_url_to_connection_runtime_config';
8
+ /**
9
+ * Register the gateway's URL in the 'connection' namespace so it is published
10
+ * to the website's runtime-config.json. Patches the generated CDK and
11
+ * Terraform constructs in-place; idempotent.
12
+ *
13
+ * Note: the 'connection' namespace is stage-scoped — every StaticWebsite in
14
+ * the stage will see this URL, not just the one the user connected.
15
+ */ export const addGatewayUrlToConnectionNamespace = async (tree, options)=>{
16
+ const cdkConstructPath = joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'app', 'gateways', options.gatewayNameKebabCase, `${options.gatewayNameKebabCase}.ts`);
17
+ if (tree.exists(cdkConstructPath)) {
18
+ await applyGritQL(tree, cdkConstructPath, `\`rc.set('agentcore', 'gateways', $args);\` => raw\`rc.set('agentcore', 'gateways', $args);
19
+
20
+ rc.set('connection', 'gateways', {
21
+ ...rc.get('connection').gateways,
22
+ ${options.gatewayNameClassName}: this.gateway.gatewayUrl,
23
+ });\` where { $program <: not contains \`rc.set('connection', 'gateways', $_)\` }`);
24
+ }
25
+ const terraformConstructPath = joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'app', 'gateways', options.gatewayNameKebabCase, `${options.gatewayNameKebabCase}.tf`);
26
+ if (tree.exists(terraformConstructPath)) {
27
+ const alreadyPatched = await matchGritQL(tree, terraformConstructPath, `language hcl\n\`module "${CONNECTION_TF_MODULE_NAME}" { $_ }\``);
28
+ if (!alreadyPatched) {
29
+ const source = tree.read(terraformConstructPath, 'utf-8');
30
+ tree.write(terraformConstructPath, `${source.trimEnd()}
31
+
32
+ # Also expose the gateway URL to the frontend via the 'connection' namespace
33
+ module "${CONNECTION_TF_MODULE_NAME}" {
34
+ source = "../../../core/runtime-config/entry"
35
+
36
+ namespace = "connection"
37
+ key = "gateways"
38
+ value = { "${options.gatewayNameClassName}" = aws_bedrockagentcore_gateway.this.gateway_url }
39
+
40
+ depends_on = [aws_bedrockagentcore_gateway.this]
41
+ }
42
+ `);
43
+ }
44
+ }
45
+ };
46
+
47
+ //# sourceMappingURL=gateway-runtime-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/gateway-runtime-config.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, type Tree } from '@nx/devkit';\nimport { applyGritQL, matchGritQL } from '../utils/ast';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../utils/shared-constructs-constants';\n\nconst CONNECTION_TF_MODULE_NAME =\n 'add_gateway_url_to_connection_runtime_config';\n\n/**\n * Register the gateway's URL in the 'connection' namespace so it is published\n * to the website's runtime-config.json. Patches the generated CDK and\n * Terraform constructs in-place; idempotent.\n *\n * Note: the 'connection' namespace is stage-scoped — every StaticWebsite in\n * the stage will see this URL, not just the one the user connected.\n */\nexport const addGatewayUrlToConnectionNamespace = async (\n tree: Tree,\n options: {\n /** The kebab-case directory name that holds the construct, e.g. 'my-gateway'. */\n gatewayNameKebabCase: string;\n /** The class name of the gateway, e.g. 'MyGateway'. */\n gatewayNameClassName: string;\n },\n) => {\n const cdkConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n `${options.gatewayNameKebabCase}.ts`,\n );\n if (tree.exists(cdkConstructPath)) {\n await applyGritQL(\n tree,\n cdkConstructPath,\n `\\`rc.set('agentcore', 'gateways', $args);\\` => raw\\`rc.set('agentcore', 'gateways', $args);\n\n rc.set('connection', 'gateways', {\n ...rc.get('connection').gateways,\n ${options.gatewayNameClassName}: this.gateway.gatewayUrl,\n });\\` where { $program <: not contains \\`rc.set('connection', 'gateways', $_)\\` }`,\n );\n }\n\n const terraformConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n `${options.gatewayNameKebabCase}.tf`,\n );\n if (tree.exists(terraformConstructPath)) {\n const alreadyPatched = await matchGritQL(\n tree,\n terraformConstructPath,\n `language hcl\\n\\`module \"${CONNECTION_TF_MODULE_NAME}\" { $_ }\\``,\n );\n if (!alreadyPatched) {\n const source = tree.read(terraformConstructPath, 'utf-8')!;\n tree.write(\n terraformConstructPath,\n `${source.trimEnd()}\n\n# Also expose the gateway URL to the frontend via the 'connection' namespace\nmodule \"${CONNECTION_TF_MODULE_NAME}\" {\n source = \"../../../core/runtime-config/entry\"\n\n namespace = \"connection\"\n key = \"gateways\"\n value = { \"${options.gatewayNameClassName}\" = aws_bedrockagentcore_gateway.this.gateway_url }\n\n depends_on = [aws_bedrockagentcore_gateway.this]\n}\n`,\n );\n }\n }\n};\n"],"names":["joinPathFragments","applyGritQL","matchGritQL","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","CONNECTION_TF_MODULE_NAME","addGatewayUrlToConnectionNamespace","tree","options","cdkConstructPath","gatewayNameKebabCase","exists","gatewayNameClassName","terraformConstructPath","alreadyPatched","source","read","write","trimEnd"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,QAAmB,aAAa;AAC1D,SAASC,WAAW,EAAEC,WAAW,QAAQ,kBAAe;AACxD,SACEC,YAAY,EACZC,qBAAqB,EACrBC,oBAAoB,QACf,0CAAuC;AAE9C,MAAMC,4BACJ;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMC,qCAAqC,OAChDC,MACAC;IAOA,MAAMC,mBAAmBV,kBACvBG,cACAC,uBACA,OACA,OACA,YACAK,QAAQE,oBAAoB,EAC5B,GAAGF,QAAQE,oBAAoB,CAAC,GAAG,CAAC;IAEtC,IAAIH,KAAKI,MAAM,CAACF,mBAAmB;QACjC,MAAMT,YACJO,MACAE,kBACA,CAAC;;;;MAID,EAAED,QAAQI,oBAAoB,CAAC;qFACgD,CAAC;IAEpF;IAEA,MAAMC,yBAAyBd,kBAC7BG,cACAE,sBACA,OACA,OACA,YACAI,QAAQE,oBAAoB,EAC5B,GAAGF,QAAQE,oBAAoB,CAAC,GAAG,CAAC;IAEtC,IAAIH,KAAKI,MAAM,CAACE,yBAAyB;QACvC,MAAMC,iBAAiB,MAAMb,YAC3BM,MACAM,wBACA,CAAC,wBAAwB,EAAER,0BAA0B,UAAU,CAAC;QAElE,IAAI,CAACS,gBAAgB;YACnB,MAAMC,SAASR,KAAKS,IAAI,CAACH,wBAAwB;YACjDN,KAAKU,KAAK,CACRJ,wBACA,GAAGE,OAAOG,OAAO,GAAG;;;QAGpB,EAAEb,0BAA0B;;;;;iBAKnB,EAAEG,QAAQI,oBAAoB,CAAC;;;;AAIhD,CAAC;QAEG;IACF;AACF,EAAE"}
@@ -2,9 +2,11 @@
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */ import { joinPathFragments } from "@nx/devkit";
5
+ import agentcoreGatewayAgentConnectionGenerator from "../agentcore-gateway/agent-connection/generator.js";
5
6
  import agentcoreGatewayGatewayConnectionGenerator from "../agentcore-gateway/gateway-connection/generator.js";
6
7
  import { AGENTCORE_GATEWAY_GENERATOR_INFO } from "../agentcore-gateway/generator.js";
7
8
  import agentcoreGatewayMcpConnectionGenerator from "../agentcore-gateway/mcp-connection/generator.js";
9
+ import agentcoreGatewayReactConnectionGenerator from "../agentcore-gateway/react-connection/generator.js";
8
10
  import pyAgentA2aConnectionGenerator from "../py/agent/a2a-connection/generator.js";
9
11
  import pyAgentGatewayConnectionGenerator from "../py/agent/gateway-connection/generator.js";
10
12
  import pyAgentMcpConnectionGenerator from "../py/agent/mcp-connection/generator.js";
@@ -80,6 +82,9 @@ const CONNECTION_GENERATORS = {
80
82
  'py#agent -> py#agent': (tree, options)=>pyAgentA2aConnectionGenerator(tree, options),
81
83
  'ts#agent -> agentcore-gateway': (tree, options)=>tsAgentGatewayConnectionGenerator(tree, options),
82
84
  'py#agent -> agentcore-gateway': (tree, options)=>pyAgentGatewayConnectionGenerator(tree, options),
85
+ 'ts#react-website -> agentcore-gateway': (tree, options)=>agentcoreGatewayReactConnectionGenerator(tree, options),
86
+ 'agentcore-gateway -> ts#agent': (tree, options)=>agentcoreGatewayAgentConnectionGenerator(tree, options),
87
+ 'agentcore-gateway -> py#agent': (tree, options)=>agentcoreGatewayAgentConnectionGenerator(tree, options),
83
88
  'agentcore-gateway -> ts#mcp-server': (tree, options)=>agentcoreGatewayMcpConnectionGenerator(tree, options),
84
89
  'agentcore-gateway -> py#mcp-server': (tree, options)=>agentcoreGatewayMcpConnectionGenerator(tree, options),
85
90
  'agentcore-gateway -> agentcore-gateway': (tree, options)=>agentcoreGatewayGatewayConnectionGenerator(tree, options),
@@ -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 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,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B1H,kBACpB4D,qBAAqBwD,IAAI,EACzB;IAEF,IAAI3E,KAAKgF,MAAM,CAACC,gBAAgB;QAC9B,MAAMC,YAAYtF,SAASI,MAAMiF;QACjC,IAAI,AAAC,CAAA,AAACC,WAAmBC,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"}
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 agentcoreGatewayAgentConnectionGenerator from '../agentcore-gateway/agent-connection/generator';\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 agentcoreGatewayReactConnectionGenerator from '../agentcore-gateway/react-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 'ts#react-website -> agentcore-gateway': (tree, options) =>\n agentcoreGatewayReactConnectionGenerator(tree, options),\n 'agentcore-gateway -> ts#agent': (tree, options) =>\n agentcoreGatewayAgentConnectionGenerator(tree, options),\n 'agentcore-gateway -> py#agent': (tree, options) =>\n agentcoreGatewayAgentConnectionGenerator(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","agentcoreGatewayAgentConnectionGenerator","agentcoreGatewayGatewayConnectionGenerator","AGENTCORE_GATEWAY_GENERATOR_INFO","agentcoreGatewayMcpConnectionGenerator","agentcoreGatewayReactConnectionGenerator","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,8CAA8C,qDAAkD;AACvG,OAAOC,gDAAgD,uDAAoD;AAC3G,SAASC,gCAAgC,QAAQ,oCAAiC;AAClF,OAAOC,4CAA4C,mDAAgD;AACnG,OAAOC,8CAA8C,qDAAkD;AACvG,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,8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AAY,CAAC,CAAA,EAAGK,SAAS,KACxDrD,sBAAsBiH,EAAE;AAE1B,MAAMf,qBAAqB,CACzBrD,uBAEA,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxDnE,iCAAiC+H,EAAE;AAErC,eAAe9E,oBAAoB"}
@@ -143,15 +143,122 @@ export declare const CONNECTION_CONSTRAINTS: {
143
143
  readonly 'py#agent -> py#mcp-server': readonly ConnectionConstraint[];
144
144
  readonly 'ts#agent -> agentcore-gateway': readonly ConnectionConstraint[];
145
145
  readonly 'py#agent -> agentcore-gateway': readonly ConnectionConstraint[];
146
+ readonly 'ts#react-website -> agentcore-gateway': readonly [{
147
+ readonly side: "target";
148
+ readonly option: "protocol";
149
+ readonly equals: "http";
150
+ readonly reason: "A website connects to an http-protocol gateway, which proxies requests to its agent targets.";
151
+ }];
152
+ readonly 'agentcore-gateway -> ts#agent': readonly [...ConnectionConstraint[], {
153
+ readonly side: "target";
154
+ readonly option: "protocol";
155
+ readonly notEquals: "http";
156
+ readonly reason: "A TypeScript http agent serves tRPC over WebSocket, which AgentCore Gateway does not support. Use the ag-ui or a2a protocol.";
157
+ }];
158
+ readonly 'agentcore-gateway -> py#agent': readonly ConnectionConstraint[];
146
159
  readonly 'agentcore-gateway -> ts#mcp-server': readonly ConnectionConstraint[];
147
160
  readonly 'agentcore-gateway -> py#mcp-server': readonly ConnectionConstraint[];
148
161
  readonly 'agentcore-gateway -> agentcore-gateway': readonly [{
162
+ readonly side: "source";
163
+ readonly option: "protocol";
164
+ readonly equals: "mcp";
165
+ readonly reason: "A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.";
166
+ }, {
167
+ readonly side: "target";
168
+ readonly option: "protocol";
169
+ readonly equals: "mcp";
170
+ readonly reason: "A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.";
171
+ }, {
149
172
  readonly side: "target";
150
173
  readonly option: "auth";
151
174
  readonly equals: "iam";
152
175
  readonly reason: "The source gateway signs its request with IAM, so the target gateway must accept IAM.";
153
176
  }];
154
177
  };
178
+ /**
179
+ * A generator run automatically after an endpoint is scaffolded, adding something
180
+ * that endpoint should always have.
181
+ *
182
+ * A website is only useful with authentication in front of it, and `ts#website`
183
+ * does not add it — `ts#website#auth` is a separate follow-up generator. Declared
184
+ * here so the docs graph builder emits it without hardcoding the pairing.
185
+ */
186
+ export interface FollowUpGenerator {
187
+ /** The generator id to run after the endpoint's own. */
188
+ readonly generator: string;
189
+ /** Options to pass, beyond the `--project` naming the endpoint. */
190
+ readonly options?: Readonly<Record<string, string>>;
191
+ /** What it adds, for the emitted command's comment. */
192
+ readonly adds: string;
193
+ }
194
+ /**
195
+ * Generators run automatically after an endpoint type is scaffolded, keyed by
196
+ * endpoint type.
197
+ */
198
+ export declare const ENDPOINT_FOLLOW_UPS: Readonly<Record<string, readonly FollowUpGenerator[]>>;
199
+ /**
200
+ * An option value a connection works best against, without requiring it.
201
+ *
202
+ * Distinct from `CONNECTION_CONSTRAINTS`: a constraint is a rule the connection
203
+ * generator enforces, whereas a preference is the setting most users want. A
204
+ * React website can call an `http` agent perfectly well, but AG-UI is the
205
+ * protocol built for driving a frontend, so that is what a new connection picks.
206
+ *
207
+ * A caller applies these only where the user has not chosen the option, so a
208
+ * preference never overrides a deliberate decision.
209
+ */
210
+ export interface ConnectionPreference {
211
+ readonly side: 'source' | 'target';
212
+ readonly option: string;
213
+ readonly value: string;
214
+ /** Why this is the better default, phrased for the user. */
215
+ readonly reason: string;
216
+ }
217
+ /**
218
+ * Preferred option values per connection. Keyed by `ConnectionKey`, so a key that
219
+ * no longer names a supported connection is a compile error.
220
+ */
221
+ export declare const CONNECTION_PREFERENCES: {
222
+ readonly 'ts#react-website -> ts#agent': readonly [{
223
+ readonly side: "target";
224
+ readonly option: "protocol";
225
+ readonly value: "ag-ui";
226
+ readonly reason: "AG-UI is the protocol built for driving a frontend, so a website connection selects it.";
227
+ }];
228
+ readonly 'ts#react-website -> py#agent': readonly [{
229
+ readonly side: "target";
230
+ readonly option: "protocol";
231
+ readonly value: "ag-ui";
232
+ readonly reason: "AG-UI is the protocol built for driving a frontend, so a website connection selects it.";
233
+ }];
234
+ readonly 'agentcore-gateway -> ts#agent': readonly [ConnectionPreference];
235
+ readonly 'agentcore-gateway -> py#agent': readonly [ConnectionPreference];
236
+ readonly 'agentcore-gateway -> ts#mcp-server': readonly [ConnectionPreference];
237
+ readonly 'agentcore-gateway -> py#mcp-server': readonly [ConnectionPreference];
238
+ readonly 'ts#react-website -> agentcore-gateway': readonly [{
239
+ readonly side: "target";
240
+ readonly option: "protocol";
241
+ readonly value: "http";
242
+ readonly reason: "A website reaches a gateway’s agent targets over path-based http routing, so the gateway serves the http protocol.";
243
+ }];
244
+ };
245
+ /**
246
+ * Connections that must be generated after another, because the generator reads
247
+ * state the earlier one records.
248
+ *
249
+ * The website→gateway generator publishes a route per agent already attached to
250
+ * the gateway, reading them from the gateway project's connection metadata. Run
251
+ * before the gateway→agent connections, it finds none and wires up nothing.
252
+ *
253
+ * Keyed by `ConnectionKey`, so a key that no longer names a supported connection
254
+ * is a compile error.
255
+ */
256
+ export declare const CONNECTION_ORDERING: {
257
+ readonly 'ts#react-website -> agentcore-gateway': {
258
+ readonly after: readonly ["agentcore-gateway -> ts#agent", "agentcore-gateway -> py#agent"];
259
+ readonly reason: "The website connection publishes a route per agent attached to the gateway, so the gateway’s agents must be attached first.";
260
+ };
261
+ };
155
262
  /**
156
263
  * Connections whose source and target must be distinct projects, because the
157
264
  * connection generator refuses to wire a project to itself.