@aws/nx-plugin 1.0.0-rc.68 → 1.0.0-rc.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/generators.json +7 -0
- package/migrations.json +1 -1
- package/package.json +1 -1
- package/src/agentcore-harness/__snapshots__/generator.spec.ts.snap +238 -0
- package/src/agentcore-harness/files/project/README.md.template +83 -0
- package/src/agentcore-harness/files/project/scripts/chat.ts.template +99 -0
- package/src/agentcore-harness/files/project/src/PROMPT.md.template +16 -0
- package/src/agentcore-harness/generator.d.ts +62 -0
- package/src/agentcore-harness/generator.js +158 -0
- package/src/agentcore-harness/generator.js.map +1 -0
- package/src/agentcore-harness/schema.d.js +8 -0
- package/src/agentcore-harness/schema.d.js.map +1 -0
- package/src/agentcore-harness/schema.d.ts +17 -0
- package/src/agentcore-harness/schema.json +53 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +2 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +25 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js +59 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-harness/__nameKebabCase__/__nameKebabCase__.ts.template +366 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-harness/__nameKebabCase__/__nameKebabCase__.tf.template +282 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { addProjectConfiguration, generateFiles, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
|
|
5
|
+
import { addTsDependencies } from "../utils/add-dependencies.js";
|
|
6
|
+
import { addAgentCoreHarnessInfra } from "../utils/agent-core-constructs/agent-core-constructs.js";
|
|
7
|
+
import { declareDependencies, ownedElsewhere } from "../utils/declared-dependencies.js";
|
|
8
|
+
import { formatFilesInSubtree } from "../utils/format.js";
|
|
9
|
+
import { resolveIac } from "../utils/iac.js";
|
|
10
|
+
import { installDependencies } from "../utils/install.js";
|
|
11
|
+
import { addGeneratorMetricsIfApplicable } from "../utils/metrics.js";
|
|
12
|
+
import { kebabCase, toClassName } from "../utils/names.js";
|
|
13
|
+
import { getNpmScopePrefix } from "../utils/npm-scope.js";
|
|
14
|
+
import { addGeneratorMetadata, getGeneratorInfo, projectExists, readProjectConfigurationUnqualified } from "../utils/nx.js";
|
|
15
|
+
import { SHARED_CONSTRUCTS_DEPENDENCIES, sharedConstructsGenerator } from "../utils/shared-constructs.js";
|
|
16
|
+
// scripts/chat.ts needs all of these whatever the infrastructure choice, so no
|
|
17
|
+
// entry is conditional. The harness project holds no manifest of its own, so
|
|
18
|
+
// every entry is declared against the workspace root.
|
|
19
|
+
export const DEPENDENCIES = declareDependencies()({
|
|
20
|
+
ts: [
|
|
21
|
+
{
|
|
22
|
+
name: '@aws-sdk/client-bedrock-agentcore',
|
|
23
|
+
root: true
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: '@aws-sdk/client-appconfigdata',
|
|
27
|
+
root: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: '@aws-lambda-powertools/parameters',
|
|
31
|
+
root: true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'agent-chat-cli',
|
|
35
|
+
root: true
|
|
36
|
+
},
|
|
37
|
+
// tsx runs the chat script via the `chat` target; both are shared tooling.
|
|
38
|
+
{
|
|
39
|
+
name: '@types/node',
|
|
40
|
+
dev: true,
|
|
41
|
+
root: true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'tsx',
|
|
45
|
+
dev: true,
|
|
46
|
+
root: true
|
|
47
|
+
},
|
|
48
|
+
...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES)
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
export const AGENTCORE_HARNESS_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
52
|
+
export const agentcoreHarnessGenerator = async (tree, options)=>{
|
|
53
|
+
const nameKebabCase = kebabCase(options.name);
|
|
54
|
+
const nameClassName = toClassName(nameKebabCase);
|
|
55
|
+
const parentDir = options.directory ?? 'packages';
|
|
56
|
+
const subDir = options.subDirectory ?? nameKebabCase;
|
|
57
|
+
const projectRoot = joinPathFragments(parentDir, subDir);
|
|
58
|
+
const fullyQualifiedProjectName = `${getNpmScopePrefix(tree)}${nameKebabCase}`;
|
|
59
|
+
const infra = options.infra ?? 'agentcore';
|
|
60
|
+
// AgentCore harness names must start with an ASCII letter and stay within 40
|
|
61
|
+
// characters once the "_<8 hex>" suffix is appended, so cap the prefix at 31.
|
|
62
|
+
// toClassName prefixes `_` (not a letter) for digit-leading names.
|
|
63
|
+
const harnessNamePrefix = (/^[A-Za-z]/.test(nameClassName) ? nameClassName : `H${nameClassName}`).slice(0, 31);
|
|
64
|
+
// Reuse an existing project configuration; create it otherwise.
|
|
65
|
+
let project;
|
|
66
|
+
if (projectExists(tree, fullyQualifiedProjectName)) {
|
|
67
|
+
project = readProjectConfigurationUnqualified(tree, fullyQualifiedProjectName);
|
|
68
|
+
} else {
|
|
69
|
+
addProjectConfiguration(tree, fullyQualifiedProjectName, {
|
|
70
|
+
name: fullyQualifiedProjectName,
|
|
71
|
+
root: projectRoot,
|
|
72
|
+
projectType: 'application',
|
|
73
|
+
sourceRoot: projectRoot,
|
|
74
|
+
tags: [],
|
|
75
|
+
targets: {},
|
|
76
|
+
metadata: {
|
|
77
|
+
generator: AGENTCORE_HARNESS_GENERATOR_INFO.id
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
project = readProjectConfigurationUnqualified(tree, fullyQualifiedProjectName);
|
|
81
|
+
}
|
|
82
|
+
// `chat` runs the vended chat script against the deployed Harness. Re-run:
|
|
83
|
+
// keep an existing target so user edits survive.
|
|
84
|
+
project.targets ??= {};
|
|
85
|
+
project.targets['chat'] ??= {
|
|
86
|
+
executor: 'nx:run-commands',
|
|
87
|
+
options: {
|
|
88
|
+
commands: [
|
|
89
|
+
'tsx ./scripts/chat.ts'
|
|
90
|
+
],
|
|
91
|
+
cwd: '{projectRoot}'
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
updateProjectConfiguration(tree, project.name, project);
|
|
95
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'project'), projectRoot, {
|
|
96
|
+
nameClassName,
|
|
97
|
+
nameKebabCase,
|
|
98
|
+
fullyQualifiedName: fullyQualifiedProjectName
|
|
99
|
+
}, {
|
|
100
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
101
|
+
});
|
|
102
|
+
// Resolved before the metadata write because the recorded value is what the
|
|
103
|
+
// declaration's predicates read; undefined when no infrastructure is written,
|
|
104
|
+
// in which case neither provider's packages were added.
|
|
105
|
+
const iac = infra === 'agentcore' ? await resolveIac(tree, options.iac) : undefined;
|
|
106
|
+
// Record only what cannot drift once the user owns the generated
|
|
107
|
+
// infrastructure: the project identity, its runtime config key, its auth mode
|
|
108
|
+
// and which provider's infrastructure was written.
|
|
109
|
+
const metadata = {
|
|
110
|
+
name: nameKebabCase,
|
|
111
|
+
rc: nameClassName,
|
|
112
|
+
auth: 'iam',
|
|
113
|
+
...iac ? {
|
|
114
|
+
iac
|
|
115
|
+
} : {}
|
|
116
|
+
};
|
|
117
|
+
addGeneratorMetadata(tree, fullyQualifiedProjectName, AGENTCORE_HARNESS_GENERATOR_INFO, metadata);
|
|
118
|
+
// scripts/chat.ts dependencies; tsx runs it via the `chat` target.
|
|
119
|
+
addTsDependencies(tree, DEPENDENCIES, {
|
|
120
|
+
metadata
|
|
121
|
+
});
|
|
122
|
+
// Harness infrastructure is written only for `infra: agentcore`. A later
|
|
123
|
+
// `infra: agentcore` rerun adds it without replacing project files.
|
|
124
|
+
if (iac) {
|
|
125
|
+
await sharedConstructsGenerator(tree, {
|
|
126
|
+
iac
|
|
127
|
+
}, DEPENDENCIES);
|
|
128
|
+
await addAgentCoreHarnessInfra(tree, {
|
|
129
|
+
harnessNameClassName: nameClassName,
|
|
130
|
+
harnessNameKebabCase: nameKebabCase,
|
|
131
|
+
projectRoot,
|
|
132
|
+
harnessNamePrefix,
|
|
133
|
+
iac
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
await addGeneratorMetricsIfApplicable(tree, [
|
|
137
|
+
AGENTCORE_HARNESS_GENERATOR_INFO
|
|
138
|
+
]);
|
|
139
|
+
await formatFilesInSubtree(tree);
|
|
140
|
+
return ()=>installDependencies(tree, options.preferInstallDependencies, {
|
|
141
|
+
languages: [
|
|
142
|
+
'typescript'
|
|
143
|
+
]
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Read a Harness Project's metadata, validating it was generated by the
|
|
148
|
+
* agentcore-harness generator before returning typed data.
|
|
149
|
+
*/ export const readAgentCoreHarnessMetadata = (project)=>{
|
|
150
|
+
const metadata = project.metadata;
|
|
151
|
+
if (metadata?.generator !== AGENTCORE_HARNESS_GENERATOR_INFO.id) {
|
|
152
|
+
throw new Error(`Project '${project.name}' was not generated by the '${AGENTCORE_HARNESS_GENERATOR_INFO.id}' generator.`);
|
|
153
|
+
}
|
|
154
|
+
return metadata;
|
|
155
|
+
};
|
|
156
|
+
export default agentcoreHarnessGenerator;
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/agentcore-harness/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addProjectConfiguration,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addTsDependencies } from '../utils/add-dependencies';\nimport { addAgentCoreHarnessInfra } from '../utils/agent-core-constructs/agent-core-constructs';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../utils/declared-dependencies';\nimport { formatFilesInSubtree } from '../utils/format';\nimport { resolveIac } from '../utils/iac';\nimport { installDependencies } from '../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../utils/metrics';\nimport { kebabCase, toClassName } from '../utils/names';\nimport { getNpmScopePrefix } from '../utils/npm-scope';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../utils/shared-constructs';\nimport type { IacMetadata } from '../utils/shared-constructs-constants';\nimport type { AgentcoreHarnessGeneratorSchema } from './schema';\n\n// scripts/chat.ts needs all of these whatever the infrastructure choice, so no\n// entry is conditional. The harness project holds no manifest of its own, so\n// every entry is declared against the workspace root.\nexport const DEPENDENCIES = declareDependencies<AgentCoreHarnessMetadata>()({\n ts: [\n { name: '@aws-sdk/client-bedrock-agentcore', root: true },\n { name: '@aws-sdk/client-appconfigdata', root: true },\n { name: '@aws-lambda-powertools/parameters', root: true },\n { name: 'agent-chat-cli', root: true },\n // tsx runs the chat script via the `chat` target; both are shared tooling.\n { name: '@types/node', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n});\n\nexport const AGENTCORE_HARNESS_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const agentcoreHarnessGenerator = async (\n tree: Tree,\n options: AgentcoreHarnessGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const nameKebabCase = kebabCase(options.name);\n const nameClassName = toClassName(nameKebabCase);\n const parentDir = options.directory ?? 'packages';\n const subDir = options.subDirectory ?? nameKebabCase;\n const projectRoot = joinPathFragments(parentDir, subDir);\n const fullyQualifiedProjectName = `${getNpmScopePrefix(tree)}${nameKebabCase}`;\n const infra = options.infra ?? 'agentcore';\n\n // AgentCore harness names must start with an ASCII letter and stay within 40\n // characters once the \"_<8 hex>\" suffix is appended, so cap the prefix at 31.\n // toClassName prefixes `_` (not a letter) for digit-leading names.\n const harnessNamePrefix = (\n /^[A-Za-z]/.test(nameClassName) ? nameClassName : `H${nameClassName}`\n ).slice(0, 31);\n\n // Reuse an existing project configuration; create it otherwise.\n let project: ProjectConfiguration;\n if (projectExists(tree, fullyQualifiedProjectName)) {\n project = readProjectConfigurationUnqualified(\n tree,\n fullyQualifiedProjectName,\n );\n } else {\n addProjectConfiguration(tree, fullyQualifiedProjectName, {\n name: fullyQualifiedProjectName,\n root: projectRoot,\n projectType: 'application',\n sourceRoot: projectRoot,\n tags: [],\n targets: {},\n metadata: {\n generator: AGENTCORE_HARNESS_GENERATOR_INFO.id,\n } as any,\n });\n project = readProjectConfigurationUnqualified(\n tree,\n fullyQualifiedProjectName,\n );\n }\n\n // `chat` runs the vended chat script against the deployed Harness. Re-run:\n // keep an existing target so user edits survive.\n project.targets ??= {};\n project.targets['chat'] ??= {\n executor: 'nx:run-commands',\n options: {\n commands: ['tsx ./scripts/chat.ts'],\n cwd: '{projectRoot}',\n },\n };\n updateProjectConfiguration(tree, project.name, project);\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'project'),\n projectRoot,\n {\n nameClassName,\n nameKebabCase,\n fullyQualifiedName: fullyQualifiedProjectName,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Resolved before the metadata write because the recorded value is what the\n // declaration's predicates read; undefined when no infrastructure is written,\n // in which case neither provider's packages were added.\n const iac =\n infra === 'agentcore' ? await resolveIac(tree, options.iac) : undefined;\n\n // Record only what cannot drift once the user owns the generated\n // infrastructure: the project identity, its runtime config key, its auth mode\n // and which provider's infrastructure was written.\n const metadata: Omit<AgentCoreHarnessMetadata, 'generator'> = {\n name: nameKebabCase,\n rc: nameClassName,\n auth: 'iam',\n ...(iac ? { iac } : {}),\n };\n\n addGeneratorMetadata(\n tree,\n fullyQualifiedProjectName,\n AGENTCORE_HARNESS_GENERATOR_INFO,\n metadata,\n );\n\n // scripts/chat.ts dependencies; tsx runs it via the `chat` target.\n addTsDependencies(tree, DEPENDENCIES, { metadata });\n\n // Harness infrastructure is written only for `infra: agentcore`. A later\n // `infra: agentcore` rerun adds it without replacing project files.\n if (iac) {\n await sharedConstructsGenerator(tree, { iac }, DEPENDENCIES);\n await addAgentCoreHarnessInfra(tree, {\n harnessNameClassName: nameClassName,\n harnessNameKebabCase: nameKebabCase,\n projectRoot,\n harnessNamePrefix,\n iac,\n });\n }\n\n await addGeneratorMetricsIfApplicable(tree, [\n AGENTCORE_HARNESS_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\n/**\n * Harness details stored in the Harness Project's metadata. `iac` records which\n * provider's infrastructure was written, so the version sync can tell which\n * shared constructs packages this project owns.\n */\nexport interface AgentCoreHarnessMetadata extends IacMetadata {\n generator: string;\n name: string;\n rc: string;\n auth: 'iam';\n}\n\n/**\n * Read a Harness Project's metadata, validating it was generated by the\n * agentcore-harness generator before returning typed data.\n */\nexport const readAgentCoreHarnessMetadata = (\n project: ProjectConfiguration,\n): AgentCoreHarnessMetadata => {\n const metadata = project.metadata as any;\n if (metadata?.generator !== AGENTCORE_HARNESS_GENERATOR_INFO.id) {\n throw new Error(\n `Project '${project.name}' was not generated by the '${AGENTCORE_HARNESS_GENERATOR_INFO.id}' generator.`,\n );\n }\n return metadata as AgentCoreHarnessMetadata;\n};\n\nexport default agentcoreHarnessGenerator;\n"],"names":["addProjectConfiguration","generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","addTsDependencies","addAgentCoreHarnessInfra","declareDependencies","ownedElsewhere","formatFilesInSubtree","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","projectExists","readProjectConfigurationUnqualified","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","DEPENDENCIES","ts","name","root","dev","AGENTCORE_HARNESS_GENERATOR_INFO","filename","agentcoreHarnessGenerator","tree","options","nameKebabCase","nameClassName","parentDir","directory","subDir","subDirectory","projectRoot","fullyQualifiedProjectName","infra","harnessNamePrefix","test","slice","project","projectType","sourceRoot","tags","targets","metadata","generator","id","executor","commands","cwd","dirname","fullyQualifiedName","overwriteStrategy","KeepExisting","iac","undefined","rc","auth","harnessNameClassName","harnessNameKebabCase","preferInstallDependencies","languages","readAgentCoreHarnessMetadata","Error"],"mappings":"AAAA;;;CAGC,GACD,SACEA,uBAAuB,EAEvBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAGjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,wBAAwB,QAAQ,0DAAuD;AAChG,SACEC,mBAAmB,EACnBC,cAAc,QACT,oCAAiC;AACxC,SAASC,oBAAoB,QAAQ,qBAAkB;AACvD,SAASC,UAAU,QAAQ,kBAAe;AAC1C,SAASC,mBAAmB,QAAQ,sBAAmB;AACvD,SAASC,+BAA+B,QAAQ,sBAAmB;AACnE,SAASC,SAAS,EAAEC,WAAW,QAAQ,oBAAiB;AACxD,SAASC,iBAAiB,QAAQ,wBAAqB;AACvD,SACEC,oBAAoB,EACpBC,gBAAgB,EAEhBC,aAAa,EACbC,mCAAmC,QAC9B,iBAAc;AACrB,SACEC,8BAA8B,EAC9BC,yBAAyB,QACpB,gCAA6B;AAIpC,+EAA+E;AAC/E,6EAA6E;AAC7E,sDAAsD;AACtD,OAAO,MAAMC,eAAef,sBAAgD;IAC1EgB,IAAI;QACF;YAAEC,MAAM;YAAqCC,MAAM;QAAK;QACxD;YAAED,MAAM;YAAiCC,MAA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QpB,IAAI,CAAC,4BAA4B,EAAEG,iCAAiCwB,EAAE,CAAC,YAAY,CAAC;IAE5G;IACA,OAAOF;AACT,EAAE;AAEF,eAAepB,0BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/agentcore-harness/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { IacOption } from '../utils/iac';\n\n/**\n * Options for the agentcore-harness generator, mirroring schema.json.\n */\nexport interface AgentcoreHarnessGeneratorSchema {\n name: string;\n directory?: string;\n subDirectory?: string;\n infra?: 'agentcore' | 'none';\n iac?: IacOption;\n preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAGD;;CAEC,GACD,WAOC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { IacOption } from '../utils/iac';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Options for the agentcore-harness generator, mirroring schema.json.
|
|
9
|
+
*/
|
|
10
|
+
export interface AgentcoreHarnessGeneratorSchema {
|
|
11
|
+
name: string;
|
|
12
|
+
directory?: string;
|
|
13
|
+
subDirectory?: string;
|
|
14
|
+
infra?: 'agentcore' | 'none';
|
|
15
|
+
iac?: IacOption;
|
|
16
|
+
preferInstallDependencies?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "agentcore-harness",
|
|
4
|
+
"title": "agentcore-harness",
|
|
5
|
+
"description": "Generate an Amazon Bedrock AgentCore Harness project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of your AgentCore Harness project. Must contain at least one non-whitespace character which can be normalized into a kebab-case project name (eg. my-harness).",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
},
|
|
15
|
+
"x-prompt": "What would you like to call your AgentCore Harness?",
|
|
16
|
+
"x-priority": "important",
|
|
17
|
+
"pattern": "\\S"
|
|
18
|
+
},
|
|
19
|
+
"directory": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Parent directory where the harness project is placed. Defaults to packages. Must be a relative path which does not contain parent directory (..) segments.",
|
|
22
|
+
"x-priority": "important",
|
|
23
|
+
"pattern": "^(?![A-Za-z]:)(?![\\\\/])(?!.*(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$))(?=.*\\S).+$"
|
|
24
|
+
},
|
|
25
|
+
"subDirectory": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "The sub directory the project is placed in. Defaults to the kebab-case harness name. Must be a relative path which does not contain parent directory (..) segments.",
|
|
28
|
+
"x-priority": "important",
|
|
29
|
+
"pattern": "^(?![A-Za-z]:)(?![\\\\/])(?!.*(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$))(?=.*\\S).+$"
|
|
30
|
+
},
|
|
31
|
+
"infra": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The type of infrastructure to generate for hosting your harness. Defaults to agentcore. Select none for no hosting.",
|
|
34
|
+
"x-prompt": "How would you like to host your harness?",
|
|
35
|
+
"x-priority": "important",
|
|
36
|
+
"enum": ["agentcore", "none"],
|
|
37
|
+
"default": "agentcore"
|
|
38
|
+
},
|
|
39
|
+
"iac": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "The preferred IaC provider for generated harness infrastructure. Defaults to inherit, which uses the provider configured for your workspace.",
|
|
42
|
+
"x-prompt": "Which provider would you like to manage your infrastructure? (default: inherit)",
|
|
43
|
+
"x-priority": "important",
|
|
44
|
+
"enum": ["inherit", "cdk", "terraform"],
|
|
45
|
+
"default": "inherit"
|
|
46
|
+
},
|
|
47
|
+
"preferInstallDependencies": {
|
|
48
|
+
"type": "boolean",
|
|
49
|
+
"description": "Whether to prefer installing dependencies after the generator runs. Defaults to true. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end."
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": ["name"]
|
|
53
|
+
}
|
|
@@ -94,6 +94,8 @@ The following list of generators are what is currently available in the \`@aws/n
|
|
|
94
94
|
|
|
95
95
|
- **agentcore-gateway**: Generate an AgentCore Gateway project
|
|
96
96
|
|
|
97
|
+
- **agentcore-harness**: Generate an AgentCore Harness project
|
|
98
|
+
|
|
97
99
|
- **connection**: Integrates a source project with a target project
|
|
98
100
|
|
|
99
101
|
- **license**: Add LICENSE files and configure source code licence headers
|
|
@@ -101,4 +101,29 @@ export interface AddAgentCoreGatewayInfraProps {
|
|
|
101
101
|
protocol: 'mcp' | 'http';
|
|
102
102
|
}
|
|
103
103
|
export declare const addAgentCoreGatewayInfra: <const D extends DependencyDeclaration>(tree: Tree, options: AddAgentCoreGatewayInfraProps & IACProvider, declaration: D & MustDeclare<typeof AGENT_CORE_CONSTRUCTS_DEPENDENCIES, D>) => Promise<void>;
|
|
104
|
+
export interface AddAgentCoreHarnessInfraProps {
|
|
105
|
+
harnessNameClassName: string;
|
|
106
|
+
harnessNameKebabCase: string;
|
|
107
|
+
/**
|
|
108
|
+
* Workspace-root-relative harness project root, eg `packages/my-harness`.
|
|
109
|
+
* The `src/PROMPT.md` path both templates read is derived from it.
|
|
110
|
+
*/
|
|
111
|
+
projectRoot: string;
|
|
112
|
+
/** Leading-letter-guaranteed, 31-char-truncated resource name prefix. */
|
|
113
|
+
harnessNamePrefix: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Add AgentCore Harness infrastructure for the selected IaC provider.
|
|
117
|
+
*
|
|
118
|
+
* Renders the provider-specific Harness infrastructure (a CDK construct or
|
|
119
|
+
* a Terraform module) into the Shared Infrastructure Project with
|
|
120
|
+
* `KeepExisting`, so existing files become user-owned and are never
|
|
121
|
+
* rewritten by reruns.
|
|
122
|
+
*
|
|
123
|
+
* Unlike agents, MCP servers and gateways, no build dependency is added
|
|
124
|
+
* from the shared infrastructure project to the Harness Project: generated
|
|
125
|
+
* Harness infrastructure does not import Harness Project source, so a
|
|
126
|
+
* dependency would only create false rebuild coupling.
|
|
127
|
+
*/
|
|
128
|
+
export declare const addAgentCoreHarnessInfra: (tree: Tree, options: AddAgentCoreHarnessInfraProps & IACProvider) => Promise<void>;
|
|
104
129
|
export {};
|
|
@@ -201,5 +201,64 @@ const addAgentCoreGatewayTerraformInfra = (tree, options)=>{
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
+
/**
|
|
205
|
+
* Add AgentCore Harness infrastructure for the selected IaC provider.
|
|
206
|
+
*
|
|
207
|
+
* Renders the provider-specific Harness infrastructure (a CDK construct or
|
|
208
|
+
* a Terraform module) into the Shared Infrastructure Project with
|
|
209
|
+
* `KeepExisting`, so existing files become user-owned and are never
|
|
210
|
+
* rewritten by reruns.
|
|
211
|
+
*
|
|
212
|
+
* Unlike agents, MCP servers and gateways, no build dependency is added
|
|
213
|
+
* from the shared infrastructure project to the Harness Project: generated
|
|
214
|
+
* Harness infrastructure does not import Harness Project source, so a
|
|
215
|
+
* dependency would only create false rebuild coupling.
|
|
216
|
+
*/ export const addAgentCoreHarnessInfra = async (tree, options)=>{
|
|
217
|
+
// One resolved template context, built once and passed to both provider
|
|
218
|
+
// branches. The prompt path is derived from the same projectRoot the
|
|
219
|
+
// Harness Project is written to, so explicit placement needs no extra logic.
|
|
220
|
+
const promptPath = joinPathFragments(options.projectRoot, 'src', 'PROMPT.md');
|
|
221
|
+
const templateContext = {
|
|
222
|
+
nameClassName: options.harnessNameClassName,
|
|
223
|
+
nameKebabCase: options.harnessNameKebabCase,
|
|
224
|
+
harnessNamePrefix: options.harnessNamePrefix,
|
|
225
|
+
promptPathFromCdk: promptPath,
|
|
226
|
+
promptPathFromTerraform: promptPath
|
|
227
|
+
};
|
|
228
|
+
switch(options.iac){
|
|
229
|
+
case 'cdk':
|
|
230
|
+
await addAgentCoreHarnessCDKInfra(tree, templateContext);
|
|
231
|
+
break;
|
|
232
|
+
case 'terraform':
|
|
233
|
+
addAgentCoreHarnessTerraformInfra(tree, templateContext);
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
const addAgentCoreHarnessCDKInfra = async (tree, templateContext)=>{
|
|
238
|
+
// Generate the app specific CDK construct under
|
|
239
|
+
// src/app/harnesses/<kebab-case-name>/
|
|
240
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'cdk', 'app', 'agentcore-harness'), joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'app', 'harnesses'), {
|
|
241
|
+
...templateContext,
|
|
242
|
+
...esmVars(tree)
|
|
243
|
+
}, {
|
|
244
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
245
|
+
});
|
|
246
|
+
// Export the construct through the harnesses app index and the shared
|
|
247
|
+
// app index. addStarExport creates a missing index file and semantically
|
|
248
|
+
// deduplicates equivalent exports on reruns.
|
|
249
|
+
await addStarExport(tree, joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'app', 'harnesses', 'index.ts'), `./${templateContext.nameKebabCase}/${templateContext.nameKebabCase}.js`);
|
|
250
|
+
await addStarExport(tree, joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'app', 'index.ts'), './harnesses/index.js');
|
|
251
|
+
};
|
|
252
|
+
const addAgentCoreHarnessTerraformInfra = (tree, templateContext)=>{
|
|
253
|
+
// Generate the app specific Terraform module under
|
|
254
|
+
// src/app/harnesses/<kebab-case-name>/. No CDK files or exports are
|
|
255
|
+
// created on this path.
|
|
256
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'terraform', 'app', 'agentcore-harness'), joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'app', 'harnesses'), {
|
|
257
|
+
...templateContext,
|
|
258
|
+
...terraformProviderVersions()
|
|
259
|
+
}, {
|
|
260
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
261
|
+
});
|
|
262
|
+
};
|
|
204
263
|
|
|
205
264
|
//# sourceMappingURL=agent-core-constructs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/agent-core-constructs/agent-core-constructs.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport { addStarExport } from '../ast';\nimport type { Containers } from '../containers';\nimport {\n type DeclaredPyDependency,\n type DeclaredTsDependency,\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../declared-dependencies';\nimport { addDependenciesToPackageJson } from '../dependencies';\nimport type { Iac } from '../iac';\nimport { esmVars } from '../module-format';\nimport { addDependencyToTargetIfNotPresent } from '../nx';\nimport {\n generatedInfrastructure,\n generatedTerraform,\n type IacMetadata,\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../shared-constructs-constants';\nimport {\n type IPyDepVersion,\n type ITsDepVersion,\n PY_VERSIONS,\n terraformProviderVersions,\n withVersions,\n} from '../versions';\n\ntype IACProvider = { iac: Iac };\n\n/**\n * Dependencies a caller must declare to add an AgentCore Gateway construct.\n *\n * Gated on infrastructure having been generated, since the construct helpers only\n * run on that branch.\n */\nexport const AGENT_CORE_CONSTRUCTS_DEPENDENCIES = [\n { name: 'ejs', when: generatedInfrastructure },\n { name: '@aws-sdk/client-bedrock-agentcore', when: generatedInfrastructure },\n { name: '@types/ejs', when: generatedInfrastructure },\n] as const satisfies readonly DeclaredTsDependency<\n ITsDepVersion,\n IacMetadata\n>[];\n\n/**\n * Python versions the generated Terraform pins in an inline `uv run --with`\n * script, rather than in any `pyproject.toml`.\n *\n * Spread through `ownedElsewhere` because nothing installs them into the\n * workspace — the pin is owned so the version sync keeps it current, and gated on\n * Terraform since the CDK branch writes no such script.\n */\nexport const AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES = [\n { name: 'boto3', when: generatedTerraform },\n { name: 'httpx', when: generatedTerraform },\n { name: 'mcp', when: generatedTerraform },\n] as const satisfies readonly DeclaredPyDependency<\n IPyDepVersion,\n IacMetadata\n>[];\n\nexport type AgentCoreAuth = 'iam' | 'cognito';\n\nexport type AgentCoreSession = 's3' | 'in-memory';\n\nexport interface AddAgentCoreInfraProps {\n nameClassName: string;\n nameKebabCase: string;\n projectName: string;\n dockerImageTag: string;\n dockerOutputDir: string;\n appDirectory: string;\n serverProtocol: 'mcp' | 'http' | 'a2a';\n auth: AgentCoreAuth;\n /** How this runtime's session should be persisted. MCP servers have no session, so pass 'in-memory'. */\n session: AgentCoreSession;\n containers: Containers;\n}\n\nconst addAgentCoreInfra = async (\n tree: Tree,\n options: AddAgentCoreInfraProps & { iac: Iac },\n) => {\n switch (options.iac) {\n case 'cdk':\n await addAgentCoreCDKInfra(tree, options);\n break;\n case 'terraform':\n addAgentCoreTerraformInfra(tree, options);\n break;\n }\n\n // Update shared constructs/terraform project configuration to depend on this project\n updateJson(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n options.iac === 'cdk' ? SHARED_CONSTRUCTS_DIR : SHARED_TERRAFORM_DIR,\n 'project.json',\n ),\n (config: ProjectConfiguration) => {\n addDependencyToTargetIfNotPresent(\n config,\n 'build',\n `${options.projectName}:build`,\n );\n return config;\n },\n );\n};\n\nconst addAgentCoreCDKInfra = async (\n tree: Tree,\n options: AddAgentCoreInfraProps,\n) => {\n // Generate app specific CDK construct\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'app', 'agent-core'),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n options.appDirectory,\n ),\n { ...options, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Export app specific CDK construct\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n options.appDirectory,\n 'index.ts',\n ),\n `./${options.nameKebabCase}/${options.nameKebabCase}.js`,\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'index.ts',\n ),\n `./${options.appDirectory}/index.js`,\n );\n};\n\nconst addAgentCoreTerraformInfra = (\n tree: Tree,\n options: AddAgentCoreInfraProps,\n) => {\n // Add the AgentCore shared module\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'core',\n 'agent-core',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'core',\n 'agent-core',\n ),\n {\n containers: options.containers,\n boto3Version: PY_VERSIONS.boto3,\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Generate app specific agent core configuration\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'app',\n 'agent-core',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n options.appDirectory,\n ),\n { ...options, ...terraformProviderVersions() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n};\n\nexport interface AddMcpServerInfraProps {\n mcpServerNameClassName: string;\n mcpServerNameKebabCase: string;\n projectName: string;\n dockerImageTag: string;\n dockerOutputDir: string;\n auth: AgentCoreAuth;\n containers: Containers;\n}\n\n/**\n * Add an MCP server CDK construct\n */\nexport const addMcpServerInfra = async (\n tree: Tree,\n options: AddMcpServerInfraProps & IACProvider,\n) => {\n await addAgentCoreInfra(tree, {\n nameClassName: options.mcpServerNameClassName,\n nameKebabCase: options.mcpServerNameKebabCase,\n dockerImageTag: options.dockerImageTag,\n dockerOutputDir: options.dockerOutputDir,\n projectName: options.projectName,\n appDirectory: 'mcp-servers',\n serverProtocol: 'mcp',\n iac: options.iac,\n auth: options.auth,\n // MCP servers are stateless (no conversation session to persist).\n session: 'in-memory',\n containers: options.containers,\n });\n};\n\nexport interface AddAgentInfraProps {\n agentNameClassName: string;\n agentNameKebabCase: string;\n projectName: string;\n dockerImageTag: string;\n dockerOutputDir: string;\n auth: AgentCoreAuth;\n session: AgentCoreSession;\n serverProtocol?: 'http' | 'a2a';\n containers: Containers;\n}\n\n/**\n * Add an agent CDK construct\n */\nexport const addAgentInfra = async (\n tree: Tree,\n options: AddAgentInfraProps & IACProvider,\n) => {\n await addAgentCoreInfra(tree, {\n nameClassName: options.agentNameClassName,\n nameKebabCase: options.agentNameKebabCase,\n projectName: options.projectName,\n dockerImageTag: options.dockerImageTag,\n dockerOutputDir: options.dockerOutputDir,\n appDirectory: 'agents',\n session: options.session,\n serverProtocol: options.serverProtocol ?? 'http',\n iac: options.iac,\n auth: options.auth,\n containers: options.containers,\n });\n};\n\nexport interface AddAgentCoreGatewayInfraProps {\n gatewayNameClassName: string;\n gatewayNameKebabCase: string;\n projectName: string;\n projectDirectory: string;\n cedarPolicy: boolean;\n auth: AgentCoreAuth;\n /**\n * The gateway's protocol: mcp aggregates MCP server targets, http proxies\n * agent runtime targets via path-based routing.\n */\n protocol: 'mcp' | 'http';\n}\n\nexport const addAgentCoreGatewayInfra = async <\n const D extends DependencyDeclaration,\n>(\n tree: Tree,\n options: AddAgentCoreGatewayInfraProps & IACProvider,\n declaration: D & MustDeclare<typeof AGENT_CORE_CONSTRUCTS_DEPENDENCIES, D>,\n) => {\n switch (options.iac) {\n case 'cdk':\n await addAgentCoreGatewayCDKInfra(tree, options, declaration);\n break;\n case 'terraform':\n addAgentCoreGatewayTerraformInfra(tree, options);\n break;\n }\n\n updateJson(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n options.iac === 'cdk' ? SHARED_CONSTRUCTS_DIR : SHARED_TERRAFORM_DIR,\n 'project.json',\n ),\n (config: ProjectConfiguration) => {\n addDependencyToTargetIfNotPresent(\n config,\n 'build',\n `${options.projectName}:build`,\n );\n return config;\n },\n );\n};\n\nconst addAgentCoreGatewayCDKInfra = async (\n tree: Tree,\n options: AddAgentCoreGatewayInfraProps,\n declaration: DependencyDeclaration,\n) => {\n // Generic gateway construct (readiness probe, policy engine, Cedar policy\n // loading) shared by all gateways\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'cdk',\n 'core',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'agentcore-gateway',\n ),\n { ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'cdk',\n 'app',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'gateways',\n ),\n {\n nameClassName: options.gatewayNameClassName,\n nameKebabCase: options.gatewayNameKebabCase,\n projectDirectory: options.projectDirectory,\n cedarPolicy: options.cedarPolicy,\n auth: options.auth,\n protocol: options.protocol,\n ...esmVars(tree),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'index.ts',\n ),\n './agentcore-gateway/agentcore-gateway.js',\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'gateways',\n 'index.ts',\n ),\n `./${options.gatewayNameKebabCase}/${options.gatewayNameKebabCase}.js`,\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'index.ts',\n ),\n './gateways/index.js',\n );\n\n // The gateway construct renders Cedar policies with ejs and its readiness\n // probe uses the AgentCore SDK client; declare both so the lint passes.\n addDependenciesToPackageJson(\n tree,\n withVersions(\n forDependencies<typeof AGENT_CORE_CONSTRUCTS_DEPENDENCIES>(declaration),\n ['ejs', '@aws-sdk/client-bedrock-agentcore'],\n ),\n withVersions(\n forDependencies<typeof AGENT_CORE_CONSTRUCTS_DEPENDENCIES>(declaration),\n ['@types/ejs'],\n ),\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'package.json'),\n );\n};\n\nconst addAgentCoreGatewayTerraformInfra = (\n tree: Tree,\n options: AddAgentCoreGatewayInfraProps,\n) => {\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'core',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'core',\n 'agentcore-gateway',\n ),\n { ...terraformProviderVersions() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'app',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'gateways',\n ),\n {\n nameClassName: options.gatewayNameClassName,\n nameKebabCase: options.gatewayNameKebabCase,\n projectDirectory: options.projectDirectory,\n cedarPolicy: options.cedarPolicy,\n auth: options.auth,\n protocol: options.protocol,\n boto3Version: PY_VERSIONS.boto3,\n httpxVersion: PY_VERSIONS.httpx,\n mcpVersion: PY_VERSIONS.mcp,\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // The Cedar render script is only needed when policies are enabled\n if (!options.cedarPolicy) {\n const renderScript = joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n 'render-cedar.cjs',\n );\n if (tree.exists(renderScript)) {\n tree.delete(renderScript);\n }\n }\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateJson","addStarExport","forDependencies","addDependenciesToPackageJson","esmVars","addDependencyToTargetIfNotPresent","generatedInfrastructure","generatedTerraform","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","PY_VERSIONS","terraformProviderVersions","withVersions","AGENT_CORE_CONSTRUCTS_DEPENDENCIES","name","when","AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES","addAgentCoreInfra","tree","options","iac","addAgentCoreCDKInfra","addAgentCoreTerraformInfra","config","projectName","dirname","appDirectory","overwriteStrategy","KeepExisting","nameKebabCase","containers","boto3Version","boto3","addMcpServerInfra","nameClassName","mcpServerNameClassName","mcpServerNameKebabCase","dockerImageTag","dockerOutputDir","serverProtocol","auth","session","addAgentInfra","agentNameClassName","agentNameKebabCase","addAgentCoreGatewayInfra","declaration","addAgentCoreGatewayCDKInfra","addAgentCoreGatewayTerraformInfra","gatewayNameClassName","gatewayNameKebabCase","projectDirectory","cedarPolicy","protocol","httpxVersion","httpx","mcpVersion","mcp","renderScript","exists","delete"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAGjBC,UAAU,QACL,aAAa;AACpB,SAASC,aAAa,QAAQ,YAAS;AAEvC,SAIEC,eAAe,QAEV,8BAA2B;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B,cAAcrB,YAAYsB,KAAK;QAC/BsB,cAAc5C,YAAY6C,KAAK;QAC/BC,YAAY9C,YAAY+C,GAAG;QAC3B,GAAG9C,2BAA2B;IAChC,GACA;QACEgB,mBAAmB7B,kBAAkB8B,YAAY;IACnD;IAGF,mEAAmE;IACnE,IAAI,CAACT,QAAQiC,WAAW,EAAE;QACxB,MAAMM,eAAe7D,kBACnBU,cACAE,sBACA,OACA,OACA,YACAU,QAAQ+B,oBAAoB,EAC5B;QAEF,IAAIhC,KAAKyC,MAAM,CAACD,eAAe;YAC7BxC,KAAK0C,MAAM,CAACF;QACd;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/agent-core-constructs/agent-core-constructs.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport { addStarExport } from '../ast';\nimport type { Containers } from '../containers';\nimport {\n type DeclaredPyDependency,\n type DeclaredTsDependency,\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../declared-dependencies';\nimport { addDependenciesToPackageJson } from '../dependencies';\nimport type { Iac } from '../iac';\nimport { esmVars } from '../module-format';\nimport { addDependencyToTargetIfNotPresent } from '../nx';\nimport {\n generatedInfrastructure,\n generatedTerraform,\n type IacMetadata,\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../shared-constructs-constants';\nimport {\n type IPyDepVersion,\n type ITsDepVersion,\n PY_VERSIONS,\n terraformProviderVersions,\n withVersions,\n} from '../versions';\n\ntype IACProvider = { iac: Iac };\n\n/**\n * Dependencies a caller must declare to add an AgentCore Gateway construct.\n *\n * Gated on infrastructure having been generated, since the construct helpers only\n * run on that branch.\n */\nexport const AGENT_CORE_CONSTRUCTS_DEPENDENCIES = [\n { name: 'ejs', when: generatedInfrastructure },\n { name: '@aws-sdk/client-bedrock-agentcore', when: generatedInfrastructure },\n { name: '@types/ejs', when: generatedInfrastructure },\n] as const satisfies readonly DeclaredTsDependency<\n ITsDepVersion,\n IacMetadata\n>[];\n\n/**\n * Python versions the generated Terraform pins in an inline `uv run --with`\n * script, rather than in any `pyproject.toml`.\n *\n * Spread through `ownedElsewhere` because nothing installs them into the\n * workspace — the pin is owned so the version sync keeps it current, and gated on\n * Terraform since the CDK branch writes no such script.\n */\nexport const AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES = [\n { name: 'boto3', when: generatedTerraform },\n { name: 'httpx', when: generatedTerraform },\n { name: 'mcp', when: generatedTerraform },\n] as const satisfies readonly DeclaredPyDependency<\n IPyDepVersion,\n IacMetadata\n>[];\n\nexport type AgentCoreAuth = 'iam' | 'cognito';\n\nexport type AgentCoreSession = 's3' | 'in-memory';\n\nexport interface AddAgentCoreInfraProps {\n nameClassName: string;\n nameKebabCase: string;\n projectName: string;\n dockerImageTag: string;\n dockerOutputDir: string;\n appDirectory: string;\n serverProtocol: 'mcp' | 'http' | 'a2a';\n auth: AgentCoreAuth;\n /** How this runtime's session should be persisted. MCP servers have no session, so pass 'in-memory'. */\n session: AgentCoreSession;\n containers: Containers;\n}\n\nconst addAgentCoreInfra = async (\n tree: Tree,\n options: AddAgentCoreInfraProps & { iac: Iac },\n) => {\n switch (options.iac) {\n case 'cdk':\n await addAgentCoreCDKInfra(tree, options);\n break;\n case 'terraform':\n addAgentCoreTerraformInfra(tree, options);\n break;\n }\n\n // Update shared constructs/terraform project configuration to depend on this project\n updateJson(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n options.iac === 'cdk' ? SHARED_CONSTRUCTS_DIR : SHARED_TERRAFORM_DIR,\n 'project.json',\n ),\n (config: ProjectConfiguration) => {\n addDependencyToTargetIfNotPresent(\n config,\n 'build',\n `${options.projectName}:build`,\n );\n return config;\n },\n );\n};\n\nconst addAgentCoreCDKInfra = async (\n tree: Tree,\n options: AddAgentCoreInfraProps,\n) => {\n // Generate app specific CDK construct\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'app', 'agent-core'),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n options.appDirectory,\n ),\n { ...options, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Export app specific CDK construct\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n options.appDirectory,\n 'index.ts',\n ),\n `./${options.nameKebabCase}/${options.nameKebabCase}.js`,\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'index.ts',\n ),\n `./${options.appDirectory}/index.js`,\n );\n};\n\nconst addAgentCoreTerraformInfra = (\n tree: Tree,\n options: AddAgentCoreInfraProps,\n) => {\n // Add the AgentCore shared module\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'core',\n 'agent-core',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'core',\n 'agent-core',\n ),\n {\n containers: options.containers,\n boto3Version: PY_VERSIONS.boto3,\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Generate app specific agent core configuration\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'app',\n 'agent-core',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n options.appDirectory,\n ),\n { ...options, ...terraformProviderVersions() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n};\n\nexport interface AddMcpServerInfraProps {\n mcpServerNameClassName: string;\n mcpServerNameKebabCase: string;\n projectName: string;\n dockerImageTag: string;\n dockerOutputDir: string;\n auth: AgentCoreAuth;\n containers: Containers;\n}\n\n/**\n * Add an MCP server CDK construct\n */\nexport const addMcpServerInfra = async (\n tree: Tree,\n options: AddMcpServerInfraProps & IACProvider,\n) => {\n await addAgentCoreInfra(tree, {\n nameClassName: options.mcpServerNameClassName,\n nameKebabCase: options.mcpServerNameKebabCase,\n dockerImageTag: options.dockerImageTag,\n dockerOutputDir: options.dockerOutputDir,\n projectName: options.projectName,\n appDirectory: 'mcp-servers',\n serverProtocol: 'mcp',\n iac: options.iac,\n auth: options.auth,\n // MCP servers are stateless (no conversation session to persist).\n session: 'in-memory',\n containers: options.containers,\n });\n};\n\nexport interface AddAgentInfraProps {\n agentNameClassName: string;\n agentNameKebabCase: string;\n projectName: string;\n dockerImageTag: string;\n dockerOutputDir: string;\n auth: AgentCoreAuth;\n session: AgentCoreSession;\n serverProtocol?: 'http' | 'a2a';\n containers: Containers;\n}\n\n/**\n * Add an agent CDK construct\n */\nexport const addAgentInfra = async (\n tree: Tree,\n options: AddAgentInfraProps & IACProvider,\n) => {\n await addAgentCoreInfra(tree, {\n nameClassName: options.agentNameClassName,\n nameKebabCase: options.agentNameKebabCase,\n projectName: options.projectName,\n dockerImageTag: options.dockerImageTag,\n dockerOutputDir: options.dockerOutputDir,\n appDirectory: 'agents',\n session: options.session,\n serverProtocol: options.serverProtocol ?? 'http',\n iac: options.iac,\n auth: options.auth,\n containers: options.containers,\n });\n};\n\nexport interface AddAgentCoreGatewayInfraProps {\n gatewayNameClassName: string;\n gatewayNameKebabCase: string;\n projectName: string;\n projectDirectory: string;\n cedarPolicy: boolean;\n auth: AgentCoreAuth;\n /**\n * The gateway's protocol: mcp aggregates MCP server targets, http proxies\n * agent runtime targets via path-based routing.\n */\n protocol: 'mcp' | 'http';\n}\n\nexport const addAgentCoreGatewayInfra = async <\n const D extends DependencyDeclaration,\n>(\n tree: Tree,\n options: AddAgentCoreGatewayInfraProps & IACProvider,\n declaration: D & MustDeclare<typeof AGENT_CORE_CONSTRUCTS_DEPENDENCIES, D>,\n) => {\n switch (options.iac) {\n case 'cdk':\n await addAgentCoreGatewayCDKInfra(tree, options, declaration);\n break;\n case 'terraform':\n addAgentCoreGatewayTerraformInfra(tree, options);\n break;\n }\n\n updateJson(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n options.iac === 'cdk' ? SHARED_CONSTRUCTS_DIR : SHARED_TERRAFORM_DIR,\n 'project.json',\n ),\n (config: ProjectConfiguration) => {\n addDependencyToTargetIfNotPresent(\n config,\n 'build',\n `${options.projectName}:build`,\n );\n return config;\n },\n );\n};\n\nconst addAgentCoreGatewayCDKInfra = async (\n tree: Tree,\n options: AddAgentCoreGatewayInfraProps,\n declaration: DependencyDeclaration,\n) => {\n // Generic gateway construct (readiness probe, policy engine, Cedar policy\n // loading) shared by all gateways\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'cdk',\n 'core',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'agentcore-gateway',\n ),\n { ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'cdk',\n 'app',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'gateways',\n ),\n {\n nameClassName: options.gatewayNameClassName,\n nameKebabCase: options.gatewayNameKebabCase,\n projectDirectory: options.projectDirectory,\n cedarPolicy: options.cedarPolicy,\n auth: options.auth,\n protocol: options.protocol,\n ...esmVars(tree),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'index.ts',\n ),\n './agentcore-gateway/agentcore-gateway.js',\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'gateways',\n 'index.ts',\n ),\n `./${options.gatewayNameKebabCase}/${options.gatewayNameKebabCase}.js`,\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'index.ts',\n ),\n './gateways/index.js',\n );\n\n // The gateway construct renders Cedar policies with ejs and its readiness\n // probe uses the AgentCore SDK client; declare both so the lint passes.\n addDependenciesToPackageJson(\n tree,\n withVersions(\n forDependencies<typeof AGENT_CORE_CONSTRUCTS_DEPENDENCIES>(declaration),\n ['ejs', '@aws-sdk/client-bedrock-agentcore'],\n ),\n withVersions(\n forDependencies<typeof AGENT_CORE_CONSTRUCTS_DEPENDENCIES>(declaration),\n ['@types/ejs'],\n ),\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'package.json'),\n );\n};\n\nconst addAgentCoreGatewayTerraformInfra = (\n tree: Tree,\n options: AddAgentCoreGatewayInfraProps,\n) => {\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'core',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'core',\n 'agentcore-gateway',\n ),\n { ...terraformProviderVersions() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'app',\n 'agentcore-gateway',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'gateways',\n ),\n {\n nameClassName: options.gatewayNameClassName,\n nameKebabCase: options.gatewayNameKebabCase,\n projectDirectory: options.projectDirectory,\n cedarPolicy: options.cedarPolicy,\n auth: options.auth,\n protocol: options.protocol,\n boto3Version: PY_VERSIONS.boto3,\n httpxVersion: PY_VERSIONS.httpx,\n mcpVersion: PY_VERSIONS.mcp,\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // The Cedar render script is only needed when policies are enabled\n if (!options.cedarPolicy) {\n const renderScript = joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n 'render-cedar.cjs',\n );\n if (tree.exists(renderScript)) {\n tree.delete(renderScript);\n }\n }\n};\n\nexport interface AddAgentCoreHarnessInfraProps {\n harnessNameClassName: string;\n harnessNameKebabCase: string;\n /**\n * Workspace-root-relative harness project root, eg `packages/my-harness`.\n * The `src/PROMPT.md` path both templates read is derived from it.\n */\n projectRoot: string;\n /** Leading-letter-guaranteed, 31-char-truncated resource name prefix. */\n harnessNamePrefix: string;\n}\n\n/**\n * Template substitution context shared by the CDK and Terraform harness\n * branches. Both prompt path fields carry the same workspace-root-relative\n * path, named per provider so each template's usage reads on its own.\n */\ninterface HarnessTemplateContext {\n nameClassName: string;\n nameKebabCase: string;\n harnessNamePrefix: string;\n /** Joined onto `findWorkspaceRoot()` in the CDK construct. */\n promptPathFromCdk: string;\n /** Appended to the `path.module` walk to the workspace root in Terraform. */\n promptPathFromTerraform: string;\n}\n\n/**\n * Add AgentCore Harness infrastructure for the selected IaC provider.\n *\n * Renders the provider-specific Harness infrastructure (a CDK construct or\n * a Terraform module) into the Shared Infrastructure Project with\n * `KeepExisting`, so existing files become user-owned and are never\n * rewritten by reruns.\n *\n * Unlike agents, MCP servers and gateways, no build dependency is added\n * from the shared infrastructure project to the Harness Project: generated\n * Harness infrastructure does not import Harness Project source, so a\n * dependency would only create false rebuild coupling.\n */\nexport const addAgentCoreHarnessInfra = async (\n tree: Tree,\n options: AddAgentCoreHarnessInfraProps & IACProvider,\n): Promise<void> => {\n // One resolved template context, built once and passed to both provider\n // branches. The prompt path is derived from the same projectRoot the\n // Harness Project is written to, so explicit placement needs no extra logic.\n const promptPath = joinPathFragments(options.projectRoot, 'src', 'PROMPT.md');\n const templateContext: HarnessTemplateContext = {\n nameClassName: options.harnessNameClassName,\n nameKebabCase: options.harnessNameKebabCase,\n harnessNamePrefix: options.harnessNamePrefix,\n promptPathFromCdk: promptPath,\n promptPathFromTerraform: promptPath,\n };\n\n switch (options.iac) {\n case 'cdk':\n await addAgentCoreHarnessCDKInfra(tree, templateContext);\n break;\n case 'terraform':\n addAgentCoreHarnessTerraformInfra(tree, templateContext);\n break;\n }\n};\n\nconst addAgentCoreHarnessCDKInfra = async (\n tree: Tree,\n templateContext: HarnessTemplateContext,\n) => {\n // Generate the app specific CDK construct under\n // src/app/harnesses/<kebab-case-name>/\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'cdk',\n 'app',\n 'agentcore-harness',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'harnesses',\n ),\n { ...templateContext, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Export the construct through the harnesses app index and the shared\n // app index. addStarExport creates a missing index file and semantically\n // deduplicates equivalent exports on reruns.\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'harnesses',\n 'index.ts',\n ),\n `./${templateContext.nameKebabCase}/${templateContext.nameKebabCase}.js`,\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'index.ts',\n ),\n './harnesses/index.js',\n );\n};\n\nconst addAgentCoreHarnessTerraformInfra = (\n tree: Tree,\n templateContext: HarnessTemplateContext,\n) => {\n // Generate the app specific Terraform module under\n // src/app/harnesses/<kebab-case-name>/. No CDK files or exports are\n // created on this path.\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n 'terraform',\n 'app',\n 'agentcore-harness',\n ),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'harnesses',\n ),\n { ...templateContext, ...terraformProviderVersions() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateJson","addStarExport","forDependencies","addDependenciesToPackageJson","esmVars","addDependencyToTargetIfNotPresent","generatedInfrastructure","generatedTerraform","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","PY_VERSIONS","terraformProviderVersions","withVersions","AGENT_CORE_CONSTRUCTS_DEPENDENCIES","name","when","AGENT_CORE_CONSTRUCTS_PY_DEPENDENCIES","addAgentCoreInfra","tree","options","iac","addAgentCoreCDKInfra","addAgentCoreTerraformInfra","config","projectName","dirname","appDirectory","overwriteStrategy","KeepExisting","nameKebabCase","containers","boto3Version","boto3","addMcpServerInfra","nameClassName","mcpServerNameClassName","mcpServerNameKebabCase","dockerImageTag","dockerOutputDir","serverProtocol","auth","session","addAgentInfra","agentNameClassName","agentNameKebabCase","addAgentCoreGatewayInfra","declaration","addAgentCoreGatewayCDKInfra","addAgentCoreGatewayTerraformInfra","gatewayNameClassName","gatewayNameKebabCase","projectDirectory","cedarPolicy","protocol","httpxVersion","httpx","mcpVersion","mcp","renderScript","exists","delete","addAgentCoreHarnessInfra","promptPath","projectRoot","templateContext","harnessNameClassName","harnessNameKebabCase","harnessNamePrefix","promptPathFromCdk","promptPathFromTerraform","addAgentCoreHarnessCDKInfra","addAgentCoreHarnessTerraformInfra"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAGjBC,UAAU,QACL,aAAa;AACpB,SAASC,aAAa,QAAQ,YAAS;AAEvC,SAIEC,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