@aws/nx-plugin 1.0.0-rc.57 → 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 (223) hide show
  1. package/LICENSE-THIRD-PARTY +2917 -1295
  2. package/generators.json +17 -1
  3. package/migrations.json +36 -26
  4. package/package.json +13 -13
  5. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +273 -0
  6. package/src/agentcore-gateway/agent-connection/generator.d.ts +19 -0
  7. package/src/agentcore-gateway/agent-connection/generator.js +90 -0
  8. package/src/agentcore-gateway/agent-connection/generator.js.map +1 -0
  9. package/src/agentcore-gateway/agent-connection/schema.d.js +6 -0
  10. package/src/agentcore-gateway/agent-connection/schema.d.js.map +1 -0
  11. package/src/agentcore-gateway/agent-connection/schema.d.ts +13 -0
  12. package/src/agentcore-gateway/agent-connection/schema.json +31 -0
  13. package/src/agentcore-gateway/attach-upstream.d.ts +16 -0
  14. package/src/agentcore-gateway/attach-upstream.js +32 -11
  15. package/src/agentcore-gateway/attach-upstream.js.map +1 -1
  16. package/src/agentcore-gateway/files/project/http/local-dev.ts.template +77 -0
  17. package/src/agentcore-gateway/generator.d.ts +17 -1
  18. package/src/agentcore-gateway/generator.js +25 -12
  19. package/src/agentcore-gateway/generator.js.map +1 -1
  20. package/src/agentcore-gateway/react-connection/__snapshots__/generator.spec.ts.snap +68 -0
  21. package/src/agentcore-gateway/react-connection/generator.d.ts +19 -0
  22. package/src/agentcore-gateway/react-connection/generator.js +119 -0
  23. package/src/agentcore-gateway/react-connection/generator.js.map +1 -0
  24. package/src/agentcore-gateway/react-connection/schema.d.js +6 -0
  25. package/src/agentcore-gateway/react-connection/schema.d.js.map +1 -0
  26. package/src/agentcore-gateway/react-connection/schema.d.ts +13 -0
  27. package/src/agentcore-gateway/react-connection/schema.json +31 -0
  28. package/src/agentcore-gateway/schema.d.js.map +1 -1
  29. package/src/agentcore-gateway/schema.d.ts +1 -1
  30. package/src/agentcore-gateway/schema.json +3 -2
  31. package/src/connection/agent-local-dev.d.ts +16 -0
  32. package/src/connection/agent-local-dev.js +44 -2
  33. package/src/connection/agent-local-dev.js.map +1 -1
  34. package/src/connection/gateway-runtime-config.d.ts +19 -0
  35. package/src/connection/gateway-runtime-config.js +47 -0
  36. package/src/connection/gateway-runtime-config.js.map +1 -0
  37. package/src/connection/generator.js +5 -0
  38. package/src/connection/generator.js.map +1 -1
  39. package/src/connection/scaffold-catalog.d.ts +267 -0
  40. package/src/connection/scaffold-catalog.js +347 -0
  41. package/src/connection/scaffold-catalog.js.map +1 -0
  42. package/src/connection/schema-resolver.d.ts +5 -0
  43. package/src/connection/schema-resolver.js +27 -0
  44. package/src/connection/schema-resolver.js.map +1 -0
  45. package/src/connection/supported-connections.d.ts +9 -0
  46. package/src/connection/supported-connections.js +12 -0
  47. package/src/connection/supported-connections.js.map +1 -1
  48. package/src/infra/app/__snapshots__/generator.spec.ts.snap +7 -7
  49. package/src/internal/test-matrix/generator.js +39 -1
  50. package/src/internal/test-matrix/generator.js.map +1 -1
  51. package/src/migrations/latest/gateway-agent-targets/__snapshots__/migration.spec.ts.snap +223 -0
  52. package/src/migrations/latest/gateway-agent-targets/metadata.json +3 -0
  53. package/src/migrations/latest/gateway-agent-targets/migration.js +217 -0
  54. package/src/migrations/latest/gateway-agent-targets/migration.js.map +1 -0
  55. package/src/migrations/latest/smithy-ssdk-bundle-pins/metadata.json +3 -0
  56. package/src/migrations/latest/smithy-ssdk-bundle-pins/migration.js +78 -0
  57. package/src/migrations/latest/smithy-ssdk-bundle-pins/migration.js.map +1 -0
  58. package/src/migrations/v1.0.0-rc.50/modernize-function-props-cast/metadata.json +3 -0
  59. package/src/migrations/v1.0.0-rc.50/modernize-function-props-cast/migration.js.map +1 -0
  60. package/src/migrations/v1.0.0-rc.50/restrict-cors-to-custom-domains/metadata.json +3 -0
  61. package/src/migrations/v1.0.0-rc.50/restrict-cors-to-custom-domains/migration.js.map +1 -0
  62. package/src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/metadata.json +3 -0
  63. package/src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/migration.js.map +1 -0
  64. package/src/migrations/v1.0.0-rc.52/user-identity-waf-allow-localhost-callback/metadata.json +3 -0
  65. package/src/migrations/v1.0.0-rc.52/user-identity-waf-allow-localhost-callback/migration.js.map +1 -0
  66. package/src/migrations/v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy/metadata.json +3 -0
  67. package/src/migrations/v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy/migration.js.map +1 -0
  68. package/src/migrations/v1.0.0-rc.55/backfill-generator-metadata/metadata.json +3 -0
  69. package/src/migrations/v1.0.0-rc.55/backfill-generator-metadata/migration.js.map +1 -0
  70. package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/metadata.json +3 -0
  71. package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/migration.d.ts +6 -0
  72. package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/migration.js.map +1 -0
  73. package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/metadata.json +3 -0
  74. package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.d.ts +6 -0
  75. package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.js.map +1 -0
  76. package/src/preset/__snapshots__/generator.spec.ts.snap +5 -5
  77. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +10 -8
  78. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +8 -8
  79. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +2 -2
  80. package/src/py/agent/a2a-connection/generator.d.ts +1 -1
  81. package/src/py/agent/gateway-connection/generator.d.ts +1 -1
  82. package/src/py/agent/mcp-connection/generator.d.ts +1 -1
  83. package/src/py/agent/react-connection/generator.d.ts +4 -1
  84. package/src/py/agent/react-connection/generator.js +35 -14
  85. package/src/py/agent/react-connection/generator.js.map +1 -1
  86. package/src/py/agent/schema.json +1 -0
  87. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  88. package/src/py/dynamodb/schema.json +1 -0
  89. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  90. package/src/py/fast-api/generator.d.ts +5 -0
  91. package/src/py/fast-api/generator.js +3 -2
  92. package/src/py/fast-api/generator.js.map +1 -1
  93. package/src/py/fast-api/schema.json +1 -0
  94. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  95. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +5 -5
  96. package/src/py/mcp-server/schema.json +1 -0
  97. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2 -2
  98. package/src/py/rdb/schema.json +1 -0
  99. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +4 -4
  100. package/src/smithy/project/files/service/build.Dockerfile.template +2 -2
  101. package/src/smithy/project/generator.d.ts +25 -0
  102. package/src/smithy/project/generator.js +24 -3
  103. package/src/smithy/project/generator.js.map +1 -1
  104. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
  105. package/src/smithy/ts/api/generator.d.ts +6 -1
  106. package/src/smithy/ts/api/generator.js +3 -2
  107. package/src/smithy/ts/api/generator.js.map +1 -1
  108. package/src/smithy/ts/api/schema.json +1 -0
  109. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  110. package/src/trpc/backend/generator.d.ts +6 -1
  111. package/src/trpc/backend/generator.js +3 -2
  112. package/src/trpc/backend/generator.js.map +1 -1
  113. package/src/trpc/backend/schema.json +1 -0
  114. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +9 -5
  115. package/src/ts/agent/generator.d.ts +32 -1
  116. package/src/ts/agent/generator.js +7 -4
  117. package/src/ts/agent/generator.js.map +1 -1
  118. package/src/ts/agent/react-connection/generator.d.ts +16 -1
  119. package/src/ts/agent/react-connection/generator.js +21 -8
  120. package/src/ts/agent/react-connection/generator.js.map +1 -1
  121. package/src/ts/agent/schema.json +1 -0
  122. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
  123. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  124. package/src/ts/dynamodb/schema.json +1 -0
  125. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  126. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
  127. package/src/ts/mcp-server/generator.d.ts +32 -1
  128. package/src/ts/mcp-server/generator.js +7 -4
  129. package/src/ts/mcp-server/generator.js.map +1 -1
  130. package/src/ts/mcp-server/schema.json +1 -0
  131. package/src/ts/nx-migration/generator.js +40 -27
  132. package/src/ts/nx-migration/generator.js.map +1 -1
  133. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +6 -6
  134. package/src/ts/rdb/generator.d.ts +8 -0
  135. package/src/ts/rdb/generator.js +3 -2
  136. package/src/ts/rdb/generator.js.map +1 -1
  137. package/src/ts/rdb/schema.json +1 -0
  138. package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +16 -0
  139. package/src/ts/react-website/agui/generator.d.ts +11 -0
  140. package/src/ts/react-website/agui/generator.js +11 -7
  141. package/src/ts/react-website/agui/generator.js.map +1 -1
  142. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +61 -45
  143. package/src/ts/react-website/app/generator.d.ts +6 -1
  144. package/src/ts/react-website/app/generator.js +3 -2
  145. package/src/ts/react-website/app/generator.js.map +1 -1
  146. package/src/ts/react-website/app/schema.json +1 -0
  147. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  148. package/src/ts/react-website/cognito-auth/generator.d.ts +6 -1
  149. package/src/ts/react-website/cognito-auth/generator.js +3 -2
  150. package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
  151. package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +23 -0
  152. package/src/utils/agent-core-constructs/agent-core-constructs.js +24 -1
  153. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  154. package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +3 -0
  155. package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +6 -4
  156. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +119 -3
  157. package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +17 -0
  158. package/src/utils/api-constructs/api-constructs.d.ts +9 -0
  159. package/src/utils/api-constructs/api-constructs.js +11 -1
  160. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  161. package/src/utils/config/utils.d.ts +5 -0
  162. package/src/utils/config/utils.js +7 -1
  163. package/src/utils/config/utils.js.map +1 -1
  164. package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +13 -2
  165. package/src/utils/connection/open-api/react.d.ts +10 -1
  166. package/src/utils/connection/open-api/react.js +3 -2
  167. package/src/utils/connection/open-api/react.js.map +1 -1
  168. package/src/utils/docker.d.ts +27 -2
  169. package/src/utils/docker.js +31 -2
  170. package/src/utils/docker.js.map +1 -1
  171. package/src/utils/identity-constructs/identity-constructs.d.ts +10 -0
  172. package/src/utils/identity-constructs/identity-constructs.js +11 -1
  173. package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
  174. package/src/utils/migration-manifest.d.ts +58 -0
  175. package/src/utils/migration-manifest.js +76 -0
  176. package/src/utils/migration-manifest.js.map +1 -0
  177. package/src/utils/migration-versions.d.ts +2 -0
  178. package/src/utils/migration-versions.js.map +1 -1
  179. package/src/utils/shared-constructs-constants.d.ts +6 -0
  180. package/src/utils/shared-constructs-constants.js +5 -0
  181. package/src/utils/shared-constructs-constants.js.map +1 -1
  182. package/src/utils/version-upgrade-migration/owned-dependencies.d.ts +26 -0
  183. package/src/utils/version-upgrade-migration/owned-dependencies.js +52 -4
  184. package/src/utils/version-upgrade-migration/owned-dependencies.js.map +1 -1
  185. package/src/utils/version-upgrade-migration/register.d.ts +9 -3
  186. package/src/utils/version-upgrade-migration/register.js +18 -14
  187. package/src/utils/version-upgrade-migration/register.js.map +1 -1
  188. package/src/utils/version-upgrade-migration/sync-embedded-versions.d.ts +26 -0
  189. package/src/utils/version-upgrade-migration/sync-embedded-versions.js +304 -0
  190. package/src/utils/version-upgrade-migration/sync-embedded-versions.js.map +1 -0
  191. package/src/utils/version-upgrade-migration/sync-vended-versions.js +14 -0
  192. package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
  193. package/src/utils/versions.d.ts +90 -77
  194. package/src/utils/versions.js +86 -75
  195. package/src/utils/versions.js.map +1 -1
  196. package/src/utils/website-constructs/website-constructs.d.ts +11 -0
  197. package/src/utils/website-constructs/website-constructs.js +12 -1
  198. package/src/utils/website-constructs/website-constructs.js.map +1 -1
  199. package/src/migrations/latest/backfill-generator-metadata/migration.js.map +0 -1
  200. package/src/migrations/latest/dynamodb-local-remove-optimize-flag/migration.js.map +0 -1
  201. package/src/migrations/latest/modernize-function-props-cast/migration.js.map +0 -1
  202. package/src/migrations/latest/order-access-log-delivery-after-bucket-policy/migration.js.map +0 -1
  203. package/src/migrations/latest/restrict-cors-to-custom-domains/migration.js.map +0 -1
  204. package/src/migrations/latest/terraform-bootstrap-adopt-existing-bucket/migration.js.map +0 -1
  205. package/src/migrations/latest/ts-agent-session-management-support/migration.js.map +0 -1
  206. package/src/migrations/latest/user-identity-waf-allow-localhost-callback/migration.js.map +0 -1
  207. /package/src/agentcore-gateway/files/project/{local-dev.ts.template → mcp/local-dev.ts.template} +0 -0
  208. /package/src/migrations/latest/{dynamodb-local-remove-optimize-flag → gateway-agent-targets}/migration.d.ts +0 -0
  209. /package/src/migrations/latest/{modernize-function-props-cast → smithy-ssdk-bundle-pins}/migration.d.ts +0 -0
  210. /package/src/migrations/{latest/restrict-cors-to-custom-domains → v1.0.0-rc.50/modernize-function-props-cast}/migration.d.ts +0 -0
  211. /package/src/migrations/{latest → v1.0.0-rc.50}/modernize-function-props-cast/migration.js +0 -0
  212. /package/src/migrations/{latest/terraform-bootstrap-adopt-existing-bucket → v1.0.0-rc.50/restrict-cors-to-custom-domains}/migration.d.ts +0 -0
  213. /package/src/migrations/{latest → v1.0.0-rc.50}/restrict-cors-to-custom-domains/migration.js +0 -0
  214. /package/src/migrations/{latest/ts-agent-session-management-support → v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket}/migration.d.ts +0 -0
  215. /package/src/migrations/{latest → v1.0.0-rc.50}/terraform-bootstrap-adopt-existing-bucket/migration.js +0 -0
  216. /package/src/migrations/{latest/order-access-log-delivery-after-bucket-policy → v1.0.0-rc.52/user-identity-waf-allow-localhost-callback}/migration.d.ts +0 -0
  217. /package/src/migrations/{latest → v1.0.0-rc.52}/user-identity-waf-allow-localhost-callback/migration.js +0 -0
  218. /package/src/migrations/{latest/user-identity-waf-allow-localhost-callback → v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy}/migration.d.ts +0 -0
  219. /package/src/migrations/{latest → v1.0.0-rc.54}/order-access-log-delivery-after-bucket-policy/migration.js +0 -0
  220. /package/src/migrations/{latest → v1.0.0-rc.55}/backfill-generator-metadata/migration.d.ts +0 -0
  221. /package/src/migrations/{latest → v1.0.0-rc.55}/backfill-generator-metadata/migration.js +0 -0
  222. /package/src/migrations/{latest → v1.0.0-rc.56}/dynamodb-local-remove-optimize-flag/migration.js +0 -0
  223. /package/src/migrations/{latest → v1.0.0-rc.57}/ts-agent-session-management-support/migration.js +0 -0
@@ -0,0 +1,267 @@
1
+ import { SUPPORTED_CONNECTIONS, type SUPPORTED_PROJECT_TYPES } from './supported-connections';
2
+ /**
3
+ * How to scaffold each end of a connection, derived from the plugin's own
4
+ * metadata rather than hand-listed.
5
+ *
6
+ * Every connection endpoint type is also a generator id, which is what makes the
7
+ * derivation possible:
8
+ *
9
+ * - **kind** — a generator whose schema `required`s a `project` adds a component
10
+ * to an existing project; anything else creates a project of its own.
11
+ * - **host** — a component lands in a project made by its language's base
12
+ * generator (`ts#project` / `py#project`).
13
+ * - **generator + options** — a type whose own generator is `hidden` is reached
14
+ * through the public wrapper that selects it, found by matching the wrapper's
15
+ * enum values against the type's name (`ts#trpc-api` ← `ts#api
16
+ * --framework=trpc`). A visible generator is run directly.
17
+ *
18
+ * - **label** — the generator schema's own `x-label`.
19
+ *
20
+ * The result is that adding a generator and a connection for it needs no edit
21
+ * here at all. The one thing still declared below is the option constraints,
22
+ * which live as imperative guards inside each connection generator and so cannot
23
+ * be read from metadata.
24
+ */
25
+ /**
26
+ * Every type that can sit at either end of a connection: the project-level
27
+ * types resolved by introspection, plus the component generator ids recorded in
28
+ * component metadata.
29
+ */
30
+ export type ConnectionEndpointType = (typeof SUPPORTED_PROJECT_TYPES)[number] | (typeof SUPPORTED_CONNECTIONS)[number]['source'] | (typeof SUPPORTED_CONNECTIONS)[number]['target'];
31
+ /**
32
+ * Whether scaffolding an endpoint creates a project of its own, or adds a
33
+ * component to a project that must already exist.
34
+ */
35
+ export type ScaffoldKind = 'project' | 'component';
36
+ /** How to scaffold one end of a connection from the CLI. */
37
+ export interface ScaffoldRecipe {
38
+ /** Human-readable name for this endpoint type. */
39
+ readonly label: string;
40
+ /** The generator id in `generators.json` that produces this endpoint. */
41
+ readonly generator: string;
42
+ /**
43
+ * Options that select this endpoint type from its generator, for generators
44
+ * producing more than one type (e.g. `framework`).
45
+ */
46
+ readonly options?: Readonly<Record<string, string>>;
47
+ /** Whether the generator creates a project or adds a component to one. */
48
+ readonly kind: ScaffoldKind;
49
+ /**
50
+ * The generator producing a project able to host this component, for
51
+ * `component` recipes. Components are added to an existing project, so one
52
+ * must be scaffolded first.
53
+ */
54
+ readonly host?: {
55
+ readonly generator: string;
56
+ readonly options?: Readonly<Record<string, string>>;
57
+ /**
58
+ * Whether the host project's name is referenced in snake_case. Python
59
+ * project names are snake_cased when qualified, TypeScript ones are not.
60
+ */
61
+ readonly snakeCaseName?: boolean;
62
+ };
63
+ }
64
+ /** The subset of JSON Schema the catalogue and the docs builder read. */
65
+ export type GeneratorSchema = {
66
+ /**
67
+ * Short display name for the thing this generator produces, used by the docs
68
+ * graph builder's palette. Set it on any generator that can take part in a
69
+ * connection.
70
+ */
71
+ 'x-label'?: string;
72
+ properties?: Record<string, {
73
+ type?: string;
74
+ description?: string;
75
+ enum?: string[];
76
+ default?: unknown;
77
+ 'x-priority'?: string;
78
+ }>;
79
+ required?: string[];
80
+ };
81
+ type Schema = GeneratorSchema;
82
+ /**
83
+ * Resolves a generator's JSON schema by generator id.
84
+ *
85
+ * Injected rather than fixed because the two callers load files differently: the
86
+ * plugin reads from disk (see `./schema-resolver`), while the docs site bundles
87
+ * the schemas for the browser, where `node:fs` does not exist. Keeping this
88
+ * module free of `node:fs` is what lets the browser import it at all.
89
+ */
90
+ export type SchemaResolver = (generatorId: string) => Schema;
91
+ /** The path `generators.json` records for a generator, relative to the plugin root. */
92
+ export declare const schemaPathOf: (generatorId: string) => string;
93
+ /**
94
+ * Derive the recipe for one endpoint type. Exported so a test can assert the
95
+ * derivation against every type the plugin supports.
96
+ */
97
+ export declare const deriveScaffoldRecipe: (endpointType: string, schemaOf: SchemaResolver) => ScaffoldRecipe;
98
+ /** Every endpoint type appearing at either end of a supported connection. */
99
+ export declare const CONNECTION_ENDPOINT_TYPES: readonly string[];
100
+ /**
101
+ * How to scaffold each connection endpoint type, derived from the generator
102
+ * metadata. A connection added to `SUPPORTED_CONNECTIONS` appears here with no
103
+ * edit to this file.
104
+ */
105
+ export declare const buildScaffoldRecipes: (schemaOf: SchemaResolver) => Readonly<Record<string, ScaffoldRecipe>>;
106
+ /**
107
+ * A requirement one end of a connection places on the other's options, mirroring
108
+ * the guard the corresponding connection generator enforces.
109
+ *
110
+ * Declared rather than derived: each guard is an imperative `throw` inside its
111
+ * connection generator, reachable only by running it. Recording them here lets a
112
+ * caller choosing options up front check them first, and the paired test asserts
113
+ * every entry names a real option with a value its enum allows.
114
+ */
115
+ export interface ConnectionConstraint {
116
+ /** Which end of the connection the constrained option belongs to. */
117
+ readonly side: 'source' | 'target';
118
+ /** The generator option carrying the constrained value. */
119
+ readonly option: string;
120
+ /** The only value accepted, if the option is pinned to one. */
121
+ readonly equals?: string;
122
+ /** A value rejected, for options accepting all but one. */
123
+ readonly notEquals?: string;
124
+ /** Why the constraint exists, phrased for the user choosing the option. */
125
+ readonly reason: string;
126
+ }
127
+ /**
128
+ * The option-level requirements each connection places on its endpoints.
129
+ *
130
+ * Only connections carrying a requirement appear. Keyed by `ConnectionKey`, so a
131
+ * key that no longer names a supported connection is a compile error.
132
+ */
133
+ export declare const CONNECTION_CONSTRAINTS: {
134
+ readonly 'ts#react-website -> ts#agent': readonly ConnectionConstraint[];
135
+ readonly 'ts#react-website -> py#agent': readonly ConnectionConstraint[];
136
+ readonly 'ts#agent -> ts#agent': readonly ConnectionConstraint[];
137
+ readonly 'ts#agent -> py#agent': readonly ConnectionConstraint[];
138
+ readonly 'py#agent -> ts#agent': readonly ConnectionConstraint[];
139
+ readonly 'py#agent -> py#agent': readonly ConnectionConstraint[];
140
+ readonly 'ts#agent -> ts#mcp-server': readonly ConnectionConstraint[];
141
+ readonly 'ts#agent -> py#mcp-server': readonly ConnectionConstraint[];
142
+ readonly 'py#agent -> ts#mcp-server': readonly ConnectionConstraint[];
143
+ readonly 'py#agent -> py#mcp-server': readonly ConnectionConstraint[];
144
+ readonly 'ts#agent -> agentcore-gateway': readonly ConnectionConstraint[];
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[];
159
+ readonly 'agentcore-gateway -> ts#mcp-server': readonly ConnectionConstraint[];
160
+ readonly 'agentcore-gateway -> py#mcp-server': readonly ConnectionConstraint[];
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
+ }, {
172
+ readonly side: "target";
173
+ readonly option: "auth";
174
+ readonly equals: "iam";
175
+ readonly reason: "The source gateway signs its request with IAM, so the target gateway must accept IAM.";
176
+ }];
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
+ };
262
+ /**
263
+ * Connections whose source and target must be distinct projects, because the
264
+ * connection generator refuses to wire a project to itself.
265
+ */
266
+ export declare const SELF_CONNECTION_DISALLOWED: readonly ["agentcore-gateway -> agentcore-gateway"];
267
+ export {};
@@ -0,0 +1,347 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import GeneratorsJson from "../../generators.json" with {
5
+ type: 'json'
6
+ };
7
+ import { SUPPORTED_CONNECTIONS } from "./supported-connections.js";
8
+ const GENERATORS = GeneratorsJson.generators;
9
+ /** The path `generators.json` records for a generator, relative to the plugin root. */ export const schemaPathOf = (generatorId)=>{
10
+ const entry = GENERATORS[generatorId];
11
+ if (!entry) {
12
+ throw new Error(`Scaffold catalog: '${generatorId}' is not in generators.json`);
13
+ }
14
+ return entry.schema;
15
+ };
16
+ /** The language prefix of a generator id: `ts` for `ts#agent`, `` for `license`. */ const languageOf = (id)=>id.includes('#') ? id.slice(0, id.indexOf('#')) : '';
17
+ /** Compare ids ignoring the separators that differ between wrapper and variant. */ const alike = (a, b)=>a.replace(/[^a-z0-9]/gi, '').toLowerCase() === b.replace(/[^a-z0-9]/gi, '').toLowerCase();
18
+ /**
19
+ * The public generator and option value that select a hidden endpoint type.
20
+ *
21
+ * A wrapper like `ts#api` produces several endpoint types, choosing between them
22
+ * with an enum option: `--framework=trpc` yields `ts#trpc-api`. The pairing is
23
+ * found by looking for a same-language public generator with an enum value that
24
+ * reconstructs the endpoint's own name.
25
+ */ const findWrapper = (endpointType, schemaOf)=>{
26
+ const language = languageOf(endpointType);
27
+ const name = endpointType.slice(endpointType.indexOf('#') + 1);
28
+ for (const [generatorId, entry] of Object.entries(GENERATORS)){
29
+ if (entry.hidden) continue;
30
+ if (languageOf(generatorId) !== language) continue;
31
+ const wrapperName = generatorId.slice(generatorId.indexOf('#') + 1);
32
+ for (const [option, property] of Object.entries(schemaOf(generatorId).properties ?? {})){
33
+ for (const value of property.enum ?? []){
34
+ // Either the value names the variant outright (`react` for
35
+ // `react-website`), or it qualifies the wrapper's own name
36
+ // (`trpc` + `api` for `trpc-api`).
37
+ if (alike(value, name) || alike(`${value}${wrapperName}`, name)) {
38
+ return {
39
+ generator: generatorId,
40
+ options: {
41
+ [option]: value
42
+ }
43
+ };
44
+ }
45
+ }
46
+ }
47
+ }
48
+ return undefined;
49
+ };
50
+ /**
51
+ * Derive the recipe for one endpoint type. Exported so a test can assert the
52
+ * derivation against every type the plugin supports.
53
+ */ export const deriveScaffoldRecipe = (endpointType, schemaOf)=>{
54
+ const own = GENERATORS[endpointType];
55
+ if (!own) {
56
+ throw new Error(`Scaffold catalog: connection endpoint '${endpointType}' is not a generator id`);
57
+ }
58
+ // A hidden generator is an implementation detail reached through its public
59
+ // wrapper, which is what a user would actually run.
60
+ const wrapper = own.hidden ? findWrapper(endpointType, schemaOf) : undefined;
61
+ if (own.hidden && !wrapper) {
62
+ throw new Error(`Scaffold catalog: '${endpointType}' is hidden and no public generator selects it`);
63
+ }
64
+ // A generator requiring a `project` adds a component to one; anything else
65
+ // creates its own project.
66
+ const kind = (schemaOf(endpointType).required ?? []).includes('project') ? 'component' : 'project';
67
+ const language = languageOf(endpointType);
68
+ const hostGenerator = `${language}#project`;
69
+ if (kind === 'component' && !GENERATORS[hostGenerator]) {
70
+ throw new Error(`Scaffold catalog: '${endpointType}' is a component but '${hostGenerator}' does not exist to host it`);
71
+ }
72
+ return {
73
+ // `x-label` is the short noun a palette entry needs; `title` and
74
+ // `description` are prose aimed at CLI prompts ("Create a relational database
75
+ // project"). A generator without one falls back to its id, so a new endpoint
76
+ // type still appears rather than being dropped.
77
+ label: schemaOf(endpointType)['x-label'] ?? endpointType,
78
+ generator: wrapper?.generator ?? endpointType,
79
+ ...wrapper ? {
80
+ options: wrapper.options
81
+ } : {},
82
+ kind,
83
+ ...kind === 'component' ? {
84
+ host: {
85
+ generator: hostGenerator,
86
+ // Only options the host's schema actually requires, so a base
87
+ // project generator gaining a required option is handled here.
88
+ options: Object.fromEntries((schemaOf(hostGenerator).required ?? []).filter((option)=>option !== 'name').map((option)=>{
89
+ const property = schemaOf(hostGenerator).properties?.[option];
90
+ const value = property?.default ?? property?.enum?.[0];
91
+ if (value === undefined) {
92
+ throw new Error(`Scaffold catalog: '${hostGenerator}' requires '${option}' but its schema offers no value to use`);
93
+ }
94
+ return [
95
+ option,
96
+ String(value)
97
+ ];
98
+ })),
99
+ // Python project names are snake_cased when Nx qualifies them.
100
+ snakeCaseName: language === 'py'
101
+ }
102
+ } : {}
103
+ };
104
+ };
105
+ /** Every endpoint type appearing at either end of a supported connection. */ export const CONNECTION_ENDPOINT_TYPES = [
106
+ ...new Set(SUPPORTED_CONNECTIONS.flatMap(({ source, target })=>[
107
+ source,
108
+ target
109
+ ]))
110
+ ].sort();
111
+ /**
112
+ * How to scaffold each connection endpoint type, derived from the generator
113
+ * metadata. A connection added to `SUPPORTED_CONNECTIONS` appears here with no
114
+ * edit to this file.
115
+ */ export const buildScaffoldRecipes = (schemaOf)=>Object.fromEntries(CONNECTION_ENDPOINT_TYPES.map((type)=>[
116
+ type,
117
+ deriveScaffoldRecipe(type, schemaOf)
118
+ ]));
119
+ /** Reusable constraint shapes, so the map below states each rule once. */ const AGENT_TO_AGENT = [
120
+ {
121
+ side: 'target',
122
+ option: 'protocol',
123
+ equals: 'a2a',
124
+ reason: 'Only an A2A agent can be connected to another agent as a tool.'
125
+ },
126
+ {
127
+ side: 'target',
128
+ option: 'auth',
129
+ equals: 'iam',
130
+ reason: 'A2A agent connections authenticate with IAM.'
131
+ }
132
+ ];
133
+ const WEBSITE_TO_AGENT = [
134
+ {
135
+ side: 'target',
136
+ option: 'protocol',
137
+ notEquals: 'a2a',
138
+ reason: 'A2A agents are reached by other agents, not by a website. Use the http or ag-ui protocol.'
139
+ }
140
+ ];
141
+ const AGENT_TO_MCP = [
142
+ {
143
+ side: 'target',
144
+ option: 'auth',
145
+ equals: 'iam',
146
+ reason: 'An agent reaches an MCP server with IAM authentication.'
147
+ }
148
+ ];
149
+ const AGENT_TO_GATEWAY = [
150
+ {
151
+ side: 'source',
152
+ option: 'auth',
153
+ equals: 'iam',
154
+ reason: 'Only an IAM-authenticated agent can reach an IAM gateway.'
155
+ },
156
+ {
157
+ side: 'target',
158
+ option: 'auth',
159
+ equals: 'iam',
160
+ reason: 'Agent connections require the gateway to authenticate with IAM.'
161
+ }
162
+ ];
163
+ const GATEWAY_TO_MCP = [
164
+ {
165
+ side: 'source',
166
+ option: 'protocol',
167
+ equals: 'mcp',
168
+ reason: 'MCP server targets can only be attached to an mcp-protocol gateway.'
169
+ },
170
+ {
171
+ side: 'target',
172
+ option: 'auth',
173
+ equals: 'iam',
174
+ reason: 'A gateway reaches an MCP server target with IAM authentication.'
175
+ }
176
+ ];
177
+ const GATEWAY_TO_AGENT = [
178
+ {
179
+ side: 'source',
180
+ option: 'protocol',
181
+ equals: 'http',
182
+ reason: 'Agent runtime targets can only be attached to an http-protocol gateway.'
183
+ },
184
+ {
185
+ side: 'target',
186
+ option: 'auth',
187
+ equals: 'iam',
188
+ reason: 'The gateway signs requests to its agent targets with IAM.'
189
+ }
190
+ ];
191
+ /**
192
+ * The option-level requirements each connection places on its endpoints.
193
+ *
194
+ * Only connections carrying a requirement appear. Keyed by `ConnectionKey`, so a
195
+ * key that no longer names a supported connection is a compile error.
196
+ */ export const CONNECTION_CONSTRAINTS = {
197
+ 'ts#react-website -> ts#agent': WEBSITE_TO_AGENT,
198
+ 'ts#react-website -> py#agent': WEBSITE_TO_AGENT,
199
+ 'ts#agent -> ts#agent': AGENT_TO_AGENT,
200
+ 'ts#agent -> py#agent': AGENT_TO_AGENT,
201
+ 'py#agent -> ts#agent': AGENT_TO_AGENT,
202
+ 'py#agent -> py#agent': AGENT_TO_AGENT,
203
+ 'ts#agent -> ts#mcp-server': AGENT_TO_MCP,
204
+ 'ts#agent -> py#mcp-server': AGENT_TO_MCP,
205
+ 'py#agent -> ts#mcp-server': AGENT_TO_MCP,
206
+ 'py#agent -> py#mcp-server': AGENT_TO_MCP,
207
+ 'ts#agent -> agentcore-gateway': AGENT_TO_GATEWAY,
208
+ 'py#agent -> agentcore-gateway': AGENT_TO_GATEWAY,
209
+ 'ts#react-website -> agentcore-gateway': [
210
+ {
211
+ side: 'target',
212
+ option: 'protocol',
213
+ equals: 'http',
214
+ reason: 'A website connects to an http-protocol gateway, which proxies requests to its agent targets.'
215
+ }
216
+ ],
217
+ 'agentcore-gateway -> ts#agent': [
218
+ ...GATEWAY_TO_AGENT,
219
+ {
220
+ side: 'target',
221
+ option: 'protocol',
222
+ notEquals: 'http',
223
+ reason: 'A TypeScript http agent serves tRPC over WebSocket, which AgentCore Gateway does not support. Use the ag-ui or a2a protocol.'
224
+ }
225
+ ],
226
+ 'agentcore-gateway -> py#agent': GATEWAY_TO_AGENT,
227
+ 'agentcore-gateway -> ts#mcp-server': GATEWAY_TO_MCP,
228
+ 'agentcore-gateway -> py#mcp-server': GATEWAY_TO_MCP,
229
+ 'agentcore-gateway -> agentcore-gateway': [
230
+ {
231
+ side: 'source',
232
+ option: 'protocol',
233
+ equals: 'mcp',
234
+ reason: 'A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.'
235
+ },
236
+ {
237
+ side: 'target',
238
+ option: 'protocol',
239
+ equals: 'mcp',
240
+ reason: 'A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.'
241
+ },
242
+ {
243
+ side: 'target',
244
+ option: 'auth',
245
+ equals: 'iam',
246
+ reason: 'The source gateway signs its request with IAM, so the target gateway must accept IAM.'
247
+ }
248
+ ]
249
+ };
250
+ /**
251
+ * Generators run automatically after an endpoint type is scaffolded, keyed by
252
+ * endpoint type.
253
+ */ export const ENDPOINT_FOLLOW_UPS = {
254
+ 'ts#react-website': [
255
+ {
256
+ generator: 'ts#website#auth',
257
+ // `cognitoDomain` is derived from the npm scope and project name when
258
+ // omitted, so the command stays short.
259
+ adds: 'Cognito authentication'
260
+ }
261
+ ]
262
+ };
263
+ /** An agent target only attaches to an http gateway, an MCP server only to an mcp one. */ const GATEWAY_PREFERS_HTTP = {
264
+ side: 'source',
265
+ option: 'protocol',
266
+ value: 'http',
267
+ reason: 'Agent runtime targets are proxied by an http gateway, so attaching an agent selects that protocol.'
268
+ };
269
+ const GATEWAY_PREFERS_MCP = {
270
+ side: 'source',
271
+ option: 'protocol',
272
+ value: 'mcp',
273
+ reason: 'MCP server targets are aggregated by an mcp gateway, so attaching an MCP server selects that protocol.'
274
+ };
275
+ /**
276
+ * Preferred option values per connection. Keyed by `ConnectionKey`, so a key that
277
+ * no longer names a supported connection is a compile error.
278
+ */ export const CONNECTION_PREFERENCES = {
279
+ 'ts#react-website -> ts#agent': [
280
+ {
281
+ side: 'target',
282
+ option: 'protocol',
283
+ value: 'ag-ui',
284
+ reason: 'AG-UI is the protocol built for driving a frontend, so a website connection selects it.'
285
+ }
286
+ ],
287
+ 'ts#react-website -> py#agent': [
288
+ {
289
+ side: 'target',
290
+ option: 'protocol',
291
+ value: 'ag-ui',
292
+ reason: 'AG-UI is the protocol built for driving a frontend, so a website connection selects it.'
293
+ }
294
+ ],
295
+ // A gateway's protocol is decided by what it fronts, and the two are mutually
296
+ // exclusive: agent runtime targets need an http gateway, MCP server targets an
297
+ // mcp one. The gateway schema defaults to mcp, so only the agent side needs a
298
+ // preference — but both are stated, so whichever target the user attaches
299
+ // first settles the protocol.
300
+ 'agentcore-gateway -> ts#agent': [
301
+ GATEWAY_PREFERS_HTTP
302
+ ],
303
+ 'agentcore-gateway -> py#agent': [
304
+ GATEWAY_PREFERS_HTTP
305
+ ],
306
+ 'agentcore-gateway -> ts#mcp-server': [
307
+ GATEWAY_PREFERS_MCP
308
+ ],
309
+ 'agentcore-gateway -> py#mcp-server': [
310
+ GATEWAY_PREFERS_MCP
311
+ ],
312
+ 'ts#react-website -> agentcore-gateway': [
313
+ {
314
+ side: 'target',
315
+ option: 'protocol',
316
+ value: 'http',
317
+ reason: 'A website reaches a gateway’s agent targets over path-based http routing, so the gateway serves the http protocol.'
318
+ }
319
+ ]
320
+ };
321
+ /**
322
+ * Connections that must be generated after another, because the generator reads
323
+ * state the earlier one records.
324
+ *
325
+ * The website→gateway generator publishes a route per agent already attached to
326
+ * the gateway, reading them from the gateway project's connection metadata. Run
327
+ * before the gateway→agent connections, it finds none and wires up nothing.
328
+ *
329
+ * Keyed by `ConnectionKey`, so a key that no longer names a supported connection
330
+ * is a compile error.
331
+ */ export const CONNECTION_ORDERING = {
332
+ 'ts#react-website -> agentcore-gateway': {
333
+ after: [
334
+ 'agentcore-gateway -> ts#agent',
335
+ 'agentcore-gateway -> py#agent'
336
+ ],
337
+ reason: 'The website connection publishes a route per agent attached to the gateway, so the gateway’s agents must be attached first.'
338
+ }
339
+ };
340
+ /**
341
+ * Connections whose source and target must be distinct projects, because the
342
+ * connection generator refuses to wire a project to itself.
343
+ */ export const SELF_CONNECTION_DISALLOWED = [
344
+ 'agentcore-gateway -> agentcore-gateway'
345
+ ];
346
+
347
+ //# sourceMappingURL=scaffold-catalog.js.map