@aws/agentcore-cdk 0.1.0-alpha.5 → 0.1.0-alpha.7
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/dist/cdk/constructs/components/mcp/{McpGateway.d.ts → Gateway.d.ts} +10 -4
- package/dist/cdk/constructs/components/mcp/Gateway.d.ts.map +1 -0
- package/dist/cdk/constructs/components/mcp/{McpGateway.js → Gateway.js} +178 -13
- package/dist/cdk/constructs/components/mcp/Gateway.js.map +1 -0
- package/dist/cdk/constructs/components/mcp/index.d.ts +1 -1
- package/dist/cdk/constructs/components/mcp/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/mcp/index.js +3 -3
- package/dist/cdk/constructs/components/mcp/index.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.d.ts +46 -0
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.js +49 -0
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/index.d.ts +1 -0
- package/dist/cdk/constructs/components/primitives/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/index.js +3 -1
- package/dist/cdk/constructs/components/primitives/index.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.d.ts +10 -2
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.js +24 -28
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.js +3 -12
- package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.js.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreApplication.d.ts +2 -1
- package/dist/cdk/constructs/l3/AgentCoreApplication.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreApplication.js +17 -3
- package/dist/cdk/constructs/l3/AgentCoreApplication.js.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.d.ts +1 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.js +3 -3
- package/dist/cdk/constructs/l3/AgentCoreMcp.js.map +1 -1
- package/dist/schema/constants.d.ts +1 -1
- package/dist/schema/constants.d.ts.map +1 -1
- package/dist/schema/constants.js +1 -1
- package/dist/schema/constants.js.map +1 -1
- package/dist/schema/schemas/agent-env.d.ts +1 -14
- package/dist/schema/schemas/agent-env.d.ts.map +1 -1
- package/dist/schema/schemas/agent-env.js +3 -32
- package/dist/schema/schemas/agent-env.js.map +1 -1
- package/dist/schema/schemas/agentcore-project.d.ts +1 -5
- package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
- package/dist/schema/schemas/deployed-state.d.ts +21 -0
- package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
- package/dist/schema/schemas/deployed-state.js +9 -1
- package/dist/schema/schemas/deployed-state.js.map +1 -1
- package/dist/schema/schemas/mcp.d.ts +283 -9
- package/dist/schema/schemas/mcp.d.ts.map +1 -1
- package/dist/schema/schemas/mcp.js +256 -7
- package/dist/schema/schemas/mcp.js.map +1 -1
- package/package.json +11 -3
- package/dist/cdk/constructs/components/mcp/McpGateway.d.ts.map +0 -1
- package/dist/cdk/constructs/components/mcp/McpGateway.js.map +0 -1
|
@@ -8,7 +8,7 @@ export type CredentialDeployedState = Record<string, {
|
|
|
8
8
|
credentialProviderArn: string;
|
|
9
9
|
clientSecretArn?: string;
|
|
10
10
|
}>;
|
|
11
|
-
export interface
|
|
11
|
+
export interface GatewayProps extends AgentCoreComponentProps {
|
|
12
12
|
/** Gateway configuration from schema */
|
|
13
13
|
readonly gateway: AgentCoreGateway;
|
|
14
14
|
/** Config root directory for resolving paths */
|
|
@@ -25,18 +25,24 @@ export interface McpGatewayProps extends AgentCoreComponentProps {
|
|
|
25
25
|
* - Gateway targets (Lambda or AgentCoreRuntime backed)
|
|
26
26
|
* - Proper IAM grants between gateway and compute
|
|
27
27
|
*/
|
|
28
|
-
export declare class
|
|
28
|
+
export declare class Gateway extends Construct {
|
|
29
29
|
readonly cfnGateway: bedrockagentcore.CfnGateway;
|
|
30
30
|
readonly role: iam.Role;
|
|
31
31
|
readonly runtimes: Map<string, AgentCoreRuntime>;
|
|
32
32
|
readonly lambdaFunctions: Map<string, cdk.aws_lambda.Function>;
|
|
33
33
|
private readonly credentials?;
|
|
34
|
-
constructor(scope: Construct, id: string, props:
|
|
34
|
+
constructor(scope: Construct, id: string, props: GatewayProps);
|
|
35
35
|
/**
|
|
36
36
|
* Builds the authorizer configuration for a gateway.
|
|
37
37
|
* URL format is validated at schema level via OidcDiscoveryUrlSchema.
|
|
38
38
|
*/
|
|
39
39
|
private buildAuthorizerConfiguration;
|
|
40
|
+
/**
|
|
41
|
+
* Builds the protocol configuration for a gateway.
|
|
42
|
+
* When semantic search is disabled, no protocol configuration is set.
|
|
43
|
+
* Otherwise, configures MCP with SEMANTIC search type.
|
|
44
|
+
*/
|
|
45
|
+
private buildProtocolConfiguration;
|
|
40
46
|
/**
|
|
41
47
|
* Builds credential provider configuration for a gateway target based on outbound auth.
|
|
42
48
|
*/
|
|
@@ -46,4 +52,4 @@ export declare class McpGateway extends Construct {
|
|
|
46
52
|
*/
|
|
47
53
|
private createGatewayTarget;
|
|
48
54
|
}
|
|
49
|
-
//# sourceMappingURL=
|
|
55
|
+
//# sourceMappingURL=Gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Gateway.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/mcp/Gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,oBAAoB,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) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.Gateway = void 0;
|
|
37
|
+
const lib_1 = require("../../../../lib");
|
|
38
|
+
const schema_1 = require("../../../../schema");
|
|
37
39
|
const constants_1 = require("../../../constants");
|
|
38
40
|
const logical_ids_1 = require("../../../logical-ids");
|
|
39
41
|
const McpLambdaCompute_1 = require("./McpLambdaCompute");
|
|
40
42
|
const McpRuntimeCompute_1 = require("./McpRuntimeCompute");
|
|
41
43
|
const cdk = __importStar(require("aws-cdk-lib"));
|
|
42
44
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
45
|
+
const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets");
|
|
43
46
|
const constructs_1 = require("constructs");
|
|
47
|
+
const path_1 = require("path");
|
|
44
48
|
/**
|
|
45
49
|
* Creates an MCP Gateway with its associated targets and compute.
|
|
46
50
|
*
|
|
@@ -50,7 +54,7 @@ const constructs_1 = require("constructs");
|
|
|
50
54
|
* - Gateway targets (Lambda or AgentCoreRuntime backed)
|
|
51
55
|
* - Proper IAM grants between gateway and compute
|
|
52
56
|
*/
|
|
53
|
-
class
|
|
57
|
+
class Gateway extends constructs_1.Construct {
|
|
54
58
|
cfnGateway;
|
|
55
59
|
role;
|
|
56
60
|
runtimes = new Map();
|
|
@@ -77,6 +81,7 @@ class McpGateway extends constructs_1.Construct {
|
|
|
77
81
|
roleArn: this.role.roleArn,
|
|
78
82
|
description: gateway.description ?? `MCP Gateway for ${gatewayResourceName}`,
|
|
79
83
|
authorizerConfiguration,
|
|
84
|
+
protocolConfiguration: this.buildProtocolConfiguration(gateway),
|
|
80
85
|
});
|
|
81
86
|
// Process gateway targets
|
|
82
87
|
for (const target of gateway.targets) {
|
|
@@ -112,15 +117,25 @@ class McpGateway extends constructs_1.Construct {
|
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
if (apiKeyTargets.length > 0) {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
const stack = cdk.Stack.of(this);
|
|
121
|
+
// Grant permissions to retrieve API key credentials from AgentCore Identity
|
|
122
|
+
this.role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
123
|
+
actions: [
|
|
124
|
+
'bedrock-agentcore:GetApiKeyCredential',
|
|
125
|
+
'bedrock-agentcore:GetResourceApiKey',
|
|
126
|
+
'bedrock-agentcore:GetWorkloadAccessToken',
|
|
127
|
+
],
|
|
128
|
+
resources: [
|
|
129
|
+
`arn:aws:bedrock-agentcore:${stack.region}:${stack.account}:workload-identity-directory/*`,
|
|
130
|
+
`arn:aws:bedrock-agentcore:${stack.region}:${stack.account}:token-vault/*`,
|
|
131
|
+
`arn:aws:bedrock-agentcore:${stack.region}:${stack.account}:apikeycredentialprovider/*`,
|
|
132
|
+
],
|
|
133
|
+
}));
|
|
134
|
+
// Grant Secrets Manager access for the underlying API key secrets
|
|
135
|
+
this.role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
136
|
+
actions: ['secretsmanager:GetSecretValue'],
|
|
137
|
+
resources: [`arn:aws:secretsmanager:${stack.region}:${stack.account}:secret:bedrock-agentcore-identity!*`],
|
|
138
|
+
}));
|
|
124
139
|
}
|
|
125
140
|
}
|
|
126
141
|
/**
|
|
@@ -141,6 +156,19 @@ class McpGateway extends constructs_1.Construct {
|
|
|
141
156
|
},
|
|
142
157
|
};
|
|
143
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Builds the protocol configuration for a gateway.
|
|
161
|
+
* When semantic search is disabled, no protocol configuration is set.
|
|
162
|
+
* Otherwise, configures MCP with SEMANTIC search type.
|
|
163
|
+
*/
|
|
164
|
+
buildProtocolConfiguration(gateway) {
|
|
165
|
+
if (gateway.enableSemanticSearch === false) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
mcp: { searchType: 'SEMANTIC' },
|
|
170
|
+
};
|
|
171
|
+
}
|
|
144
172
|
/**
|
|
145
173
|
* Builds credential provider configuration for a gateway target based on outbound auth.
|
|
146
174
|
*/
|
|
@@ -175,6 +203,7 @@ class McpGateway extends constructs_1.Construct {
|
|
|
175
203
|
apiKeyCredentialProvider: {
|
|
176
204
|
providerArn: credential.credentialProviderArn,
|
|
177
205
|
credentialLocation: 'HEADER',
|
|
206
|
+
credentialParameterName: 'x-api-key',
|
|
178
207
|
},
|
|
179
208
|
},
|
|
180
209
|
},
|
|
@@ -187,6 +216,88 @@ class McpGateway extends constructs_1.Construct {
|
|
|
187
216
|
*/
|
|
188
217
|
createGatewayTarget(target, projectName, configRoot) {
|
|
189
218
|
const targetName = target.name;
|
|
219
|
+
// Handle API Gateway targets (no compute required)
|
|
220
|
+
if (target.targetType === 'apiGateway' && target.apiGateway) {
|
|
221
|
+
const { restApiId, stage, apiGatewayToolConfiguration } = target.apiGateway;
|
|
222
|
+
const credentialProviderConfigurations = this.buildCredentialConfig(target);
|
|
223
|
+
// Grant execute-api:Invoke only when the gateway uses SigV4 (IAM/NONE auth).
|
|
224
|
+
// API_KEY auth sends the key in a header and doesn't need IAM-level invoke permission.
|
|
225
|
+
// When adding new auth types, consider whether the gateway SigV4-signs the request —
|
|
226
|
+
// if it does, execute-api:Invoke is required; if it uses a different auth mechanism, it's not.
|
|
227
|
+
if (!credentialProviderConfigurations) {
|
|
228
|
+
const apiGatewayArn = `arn:aws:execute-api:${cdk.Stack.of(this).region}:${cdk.Stack.of(this).account}:${restApiId}/${stage}/*`;
|
|
229
|
+
this.role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
230
|
+
actions: ['execute-api:Invoke'],
|
|
231
|
+
resources: [apiGatewayArn],
|
|
232
|
+
}));
|
|
233
|
+
}
|
|
234
|
+
new aws_cdk_lib_1.aws_bedrockagentcore.CfnGatewayTarget(this, (0, logical_ids_1.toPascalId)('Target', targetName), {
|
|
235
|
+
gatewayIdentifier: this.cfnGateway.attrGatewayIdentifier,
|
|
236
|
+
name: targetName,
|
|
237
|
+
description: `API Gateway target: ${targetName}`,
|
|
238
|
+
targetConfiguration: {
|
|
239
|
+
mcp: {
|
|
240
|
+
apiGateway: {
|
|
241
|
+
restApiId,
|
|
242
|
+
stage,
|
|
243
|
+
apiGatewayToolConfiguration: {
|
|
244
|
+
toolFilters: apiGatewayToolConfiguration.toolFilters.map(f => ({
|
|
245
|
+
filterPath: f.filterPath,
|
|
246
|
+
methods: f.methods,
|
|
247
|
+
})),
|
|
248
|
+
...(apiGatewayToolConfiguration.toolOverrides && {
|
|
249
|
+
toolOverrides: apiGatewayToolConfiguration.toolOverrides.map(o => ({
|
|
250
|
+
name: o.name,
|
|
251
|
+
path: o.path,
|
|
252
|
+
method: o.method,
|
|
253
|
+
...(o.description && { description: o.description }),
|
|
254
|
+
})),
|
|
255
|
+
}),
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
credentialProviderConfigurations: credentialProviderConfigurations ??
|
|
261
|
+
(schema_1.TARGET_TYPE_AUTH_CONFIG.apiGateway.iamRoleFallback
|
|
262
|
+
? [{ credentialProviderType: 'GATEWAY_IAM_ROLE' }]
|
|
263
|
+
: undefined),
|
|
264
|
+
});
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
// Handle Lambda Function ARN targets (no compute required)
|
|
268
|
+
if (target.targetType === 'lambdaFunctionArn' && target.lambdaFunctionArn) {
|
|
269
|
+
const { lambdaArn, toolSchemaFile } = target.lambdaFunctionArn;
|
|
270
|
+
// Grant the gateway role permission to invoke the Lambda function
|
|
271
|
+
this.role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
272
|
+
actions: ['lambda:InvokeFunction'],
|
|
273
|
+
resources: [lambdaArn, `${lambdaArn}:*`],
|
|
274
|
+
}));
|
|
275
|
+
// Upload tool schema file to S3 via CDK Assets
|
|
276
|
+
const resolvedSchemaPath = (0, lib_1.resolveCodeLocation)(toolSchemaFile, configRoot);
|
|
277
|
+
const schemaAsset = new aws_s3_assets_1.Asset(this, (0, logical_ids_1.toPascalId)('Schema', targetName), {
|
|
278
|
+
path: resolvedSchemaPath,
|
|
279
|
+
});
|
|
280
|
+
schemaAsset.grantRead(this.role);
|
|
281
|
+
new aws_cdk_lib_1.aws_bedrockagentcore.CfnGatewayTarget(this, (0, logical_ids_1.toPascalId)('Target', targetName), {
|
|
282
|
+
gatewayIdentifier: this.cfnGateway.attrGatewayIdentifier,
|
|
283
|
+
name: targetName,
|
|
284
|
+
description: `Lambda function target: ${targetName}`,
|
|
285
|
+
targetConfiguration: {
|
|
286
|
+
mcp: {
|
|
287
|
+
lambda: {
|
|
288
|
+
lambdaArn,
|
|
289
|
+
toolSchema: {
|
|
290
|
+
s3: {
|
|
291
|
+
uri: `s3://${schemaAsset.s3BucketName}/${schemaAsset.s3ObjectKey}`,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
credentialProviderConfigurations: [{ credentialProviderType: 'GATEWAY_IAM_ROLE' }],
|
|
298
|
+
});
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
190
301
|
// Handle external MCP server endpoints (no compute required)
|
|
191
302
|
if (target.targetType === 'mcpServer' && target.endpoint && !target.compute) {
|
|
192
303
|
const credentialProviderConfigurations = this.buildCredentialConfig(target);
|
|
@@ -203,6 +314,60 @@ class McpGateway extends constructs_1.Construct {
|
|
|
203
314
|
});
|
|
204
315
|
return;
|
|
205
316
|
}
|
|
317
|
+
// Handle OpenAPI / Smithy schema-based targets
|
|
318
|
+
if (target.targetType === 'openApiSchema' || target.targetType === 'smithyModel') {
|
|
319
|
+
if (!target.schemaSource) {
|
|
320
|
+
throw new Error(`Gateway target "${targetName}" of type ${target.targetType} requires a schemaSource.`);
|
|
321
|
+
}
|
|
322
|
+
let schemaConfig;
|
|
323
|
+
if ('s3' in target.schemaSource && target.schemaSource.s3) {
|
|
324
|
+
// User-provided S3 URI — pass directly to CFN
|
|
325
|
+
schemaConfig = {
|
|
326
|
+
s3: {
|
|
327
|
+
uri: target.schemaSource.s3.uri,
|
|
328
|
+
bucketOwnerAccountId: target.schemaSource.s3.bucketOwnerAccountId,
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
else if ('inline' in target.schemaSource && target.schemaSource.inline) {
|
|
333
|
+
// Local file — upload via CDK Asset, reference as S3 URI
|
|
334
|
+
// Resolve relative to project root (parent of agentcore/)
|
|
335
|
+
const projectRoot = (0, path_1.dirname)(configRoot);
|
|
336
|
+
const schemaPath = (0, path_1.isAbsolute)(target.schemaSource.inline.path)
|
|
337
|
+
? target.schemaSource.inline.path
|
|
338
|
+
: (0, path_1.join)(projectRoot, target.schemaSource.inline.path);
|
|
339
|
+
const schemaAsset = new aws_s3_assets_1.Asset(this, (0, logical_ids_1.toPascalId)('SchemaAsset', targetName), {
|
|
340
|
+
path: schemaPath,
|
|
341
|
+
});
|
|
342
|
+
schemaAsset.grantRead(this.role);
|
|
343
|
+
schemaConfig = {
|
|
344
|
+
s3: { uri: `s3://${schemaAsset.s3BucketName}/${schemaAsset.s3ObjectKey}` },
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
throw new Error(`Invalid schemaSource for target "${targetName}".`);
|
|
349
|
+
}
|
|
350
|
+
const credentialProviderConfigurations = this.buildCredentialConfig(target);
|
|
351
|
+
const targetConfiguration = {
|
|
352
|
+
mcp: target.targetType === 'openApiSchema' ? { openApiSchema: schemaConfig } : { smithyModel: schemaConfig },
|
|
353
|
+
};
|
|
354
|
+
const authConfig = schema_1.TARGET_TYPE_AUTH_CONFIG[target.targetType];
|
|
355
|
+
if (authConfig.authRequired && !credentialProviderConfigurations) {
|
|
356
|
+
throw new Error(`Target "${targetName}" of type ${target.targetType} requires outbound auth ` +
|
|
357
|
+
`(${authConfig.validAuthTypes.join(' or ')}). ` +
|
|
358
|
+
`Register a credential with 'agentcore add identity' and reference it via outboundAuth.`);
|
|
359
|
+
}
|
|
360
|
+
const gatewayTarget = new aws_cdk_lib_1.aws_bedrockagentcore.CfnGatewayTarget(this, (0, logical_ids_1.toPascalId)('Target', targetName), {
|
|
361
|
+
gatewayIdentifier: this.cfnGateway.attrGatewayIdentifier,
|
|
362
|
+
name: targetName,
|
|
363
|
+
description: `${target.targetType} target: ${targetName}`,
|
|
364
|
+
targetConfiguration,
|
|
365
|
+
credentialProviderConfigurations: credentialProviderConfigurations ??
|
|
366
|
+
(authConfig.iamRoleFallback ? [{ credentialProviderType: 'GATEWAY_IAM_ROLE' }] : undefined),
|
|
367
|
+
});
|
|
368
|
+
gatewayTarget.node.addDependency(this.role);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
206
371
|
if (!target.compute) {
|
|
207
372
|
throw new Error(`Gateway target "${targetName}" must specify compute configuration. ` +
|
|
208
373
|
`Supported compute hosts: Lambda, AgentCoreRuntime`);
|
|
@@ -284,5 +449,5 @@ class McpGateway extends constructs_1.Construct {
|
|
|
284
449
|
gatewayTarget.node.addDependency(this.role);
|
|
285
450
|
}
|
|
286
451
|
}
|
|
287
|
-
exports.
|
|
288
|
-
//# sourceMappingURL=
|
|
452
|
+
exports.Gateway = Gateway;
|
|
453
|
+
//# sourceMappingURL=Gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Gateway.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/mcp/Gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAsD;AAEtD,+CAA6D;AAC7D,kDAAiE;AACjE,sDAAkD;AAGlD,yDAAsD;AACtD,2DAAwD;AACxD,iDAAmC;AACnC,6CAA6G;AAC7G,6DAAkD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,IAAI,EAAE,UAAU;YAChB,mBAAmB;YACnB,WAAW,EAAE,iBAAiB;YAC9B,iBAAiB,EAAE,IAAI,CAAC,UAAU,CAAC,qBAAqB;SACzD,CAAC,CAAC;QAEH,0EAA0E;QAC1E,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF;AA9dD,0BA8dC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Gateway, type GatewayProps, type CredentialDeployedState } from './Gateway';
|
|
2
2
|
export { McpLambdaCompute, type McpLambdaComputeProps } from './McpLambdaCompute';
|
|
3
3
|
export { McpRuntimeCompute, type McpRuntimeComputeProps } from './McpRuntimeCompute';
|
|
4
4
|
export { DEFAULT_MCP_PYTHON_VERSION, RUNTIME_ENDPOINT_URL_TEMPLATE, getRuntimeEndpointUrl, mapNodeRuntime, mapPythonRuntime, urlEncodeArn, } from './mcp-utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,YAAY,GACb,MAAM,aAAa,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.urlEncodeArn = exports.mapPythonRuntime = exports.mapNodeRuntime = exports.getRuntimeEndpointUrl = exports.RUNTIME_ENDPOINT_URL_TEMPLATE = exports.DEFAULT_MCP_PYTHON_VERSION = exports.McpRuntimeCompute = exports.McpLambdaCompute = exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.urlEncodeArn = exports.mapPythonRuntime = exports.mapNodeRuntime = exports.getRuntimeEndpointUrl = exports.RUNTIME_ENDPOINT_URL_TEMPLATE = exports.DEFAULT_MCP_PYTHON_VERSION = exports.McpRuntimeCompute = exports.McpLambdaCompute = exports.Gateway = void 0;
|
|
4
|
+
var Gateway_1 = require("./Gateway");
|
|
5
|
+
Object.defineProperty(exports, "Gateway", { enumerable: true, get: function () { return Gateway_1.Gateway; } });
|
|
6
6
|
var McpLambdaCompute_1 = require("./McpLambdaCompute");
|
|
7
7
|
Object.defineProperty(exports, "McpLambdaCompute", { enumerable: true, get: function () { return McpLambdaCompute_1.McpLambdaCompute; } });
|
|
8
8
|
var McpRuntimeCompute_1 = require("./McpRuntimeCompute");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/mcp/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/mcp/index.ts"],"names":[],"mappings":";;;AAAA,qCAAqF;AAA5E,kGAAA,OAAO,OAAA;AAChB,uDAAkF;AAAzE,oHAAA,gBAAgB,OAAA;AACzB,yDAAqF;AAA5E,sHAAA,iBAAiB,OAAA;AAC1B,yCAOqB;AANnB,uHAAA,0BAA0B,OAAA;AAC1B,0HAAA,6BAA6B,OAAA;AAC7B,kHAAA,qBAAqB,OAAA;AACrB,2GAAA,cAAc,OAAA;AACd,6GAAA,gBAAgB,OAAA;AAChB,yGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AgentCoreComponentProps } from '../base-props';
|
|
2
|
+
import type { AgentCoreRuntime } from './runtime/AgentCoreRuntime';
|
|
3
|
+
import { aws_iam as iam } from 'aws-cdk-lib';
|
|
4
|
+
import { Construct } from 'constructs';
|
|
5
|
+
export interface BasePrimitiveConstructProps extends AgentCoreComponentProps {
|
|
6
|
+
/**
|
|
7
|
+
* The name of this primitive resource.
|
|
8
|
+
*/
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Optional description for the IAM execution role.
|
|
12
|
+
*/
|
|
13
|
+
readonly roleDescription?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Abstract base class for AgentCore primitive CDK constructs.
|
|
17
|
+
* Provides shared IAM role creation and grant helpers.
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class BasePrimitiveConstruct extends Construct {
|
|
20
|
+
/** The IAM execution role for this primitive */
|
|
21
|
+
protected readonly role: iam.Role;
|
|
22
|
+
/** The physical name: ${projectName}_${name} */
|
|
23
|
+
protected readonly physicalName: string;
|
|
24
|
+
constructor(scope: Construct, id: string, props: BasePrimitiveConstructProps);
|
|
25
|
+
/**
|
|
26
|
+
* Grant permissions to a runtime. Each primitive defines its own grant logic.
|
|
27
|
+
*/
|
|
28
|
+
abstract grant(runtime: AgentCoreRuntime): void;
|
|
29
|
+
/**
|
|
30
|
+
* Get the environment variable name for this primitive.
|
|
31
|
+
*/
|
|
32
|
+
abstract getEnvVarName(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Get the environment variable value for this primitive.
|
|
35
|
+
*/
|
|
36
|
+
abstract getEnvVarValue(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Grant specific actions on an ARN to a runtime.
|
|
39
|
+
*/
|
|
40
|
+
protected grantActions(runtime: AgentCoreRuntime, actions: string[], arn: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Grant specific actions with a condition key to a runtime.
|
|
43
|
+
*/
|
|
44
|
+
protected grantActionsWithCondition(runtime: AgentCoreRuntime, actions: string[], arn: string, conditionKey: string, values: string[]): void;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=BasePrimitiveConstruct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePrimitiveConstruct.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/primitives/BasePrimitiveConstruct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,2BAA4B,SAAQ,uBAAuB;IAC1E;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;GAGG;AACH,8BAAsB,sBAAuB,SAAQ,SAAS;IAC5D,gDAAgD;IAChD,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IAElC,gDAAgD;IAChD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAE5B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,2BAA2B;IAW5E;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAE/C;;OAEG;IACH,QAAQ,CAAC,aAAa,IAAI,MAAM;IAEhC;;OAEG;IACH,QAAQ,CAAC,cAAc,IAAI,MAAM;IAEjC;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IASvF;;OAEG;IACH,SAAS,CAAC,yBAAyB,CACjC,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EAAE,GACf,IAAI;CAaR"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasePrimitiveConstruct = void 0;
|
|
4
|
+
const constants_1 = require("../../../constants");
|
|
5
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
6
|
+
const constructs_1 = require("constructs");
|
|
7
|
+
/**
|
|
8
|
+
* Abstract base class for AgentCore primitive CDK constructs.
|
|
9
|
+
* Provides shared IAM role creation and grant helpers.
|
|
10
|
+
*/
|
|
11
|
+
class BasePrimitiveConstruct extends constructs_1.Construct {
|
|
12
|
+
/** The IAM execution role for this primitive */
|
|
13
|
+
role;
|
|
14
|
+
/** The physical name: ${projectName}_${name} */
|
|
15
|
+
physicalName;
|
|
16
|
+
constructor(scope, id, props) {
|
|
17
|
+
super(scope, id);
|
|
18
|
+
this.physicalName = `${props.projectName}_${props.name}`;
|
|
19
|
+
this.role = new aws_cdk_lib_1.aws_iam.Role(this, 'ExecutionRole', {
|
|
20
|
+
assumedBy: new aws_cdk_lib_1.aws_iam.ServicePrincipal(constants_1.AGENTCORE_SERVICE_PRINCIPAL),
|
|
21
|
+
description: props.roleDescription ?? `AgentCore ${props.name} execution role`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Grant specific actions on an ARN to a runtime.
|
|
26
|
+
*/
|
|
27
|
+
grantActions(runtime, actions, arn) {
|
|
28
|
+
runtime.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
29
|
+
actions,
|
|
30
|
+
resources: [arn],
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Grant specific actions with a condition key to a runtime.
|
|
35
|
+
*/
|
|
36
|
+
grantActionsWithCondition(runtime, actions, arn, conditionKey, values) {
|
|
37
|
+
runtime.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
38
|
+
actions,
|
|
39
|
+
resources: [arn],
|
|
40
|
+
conditions: {
|
|
41
|
+
StringLike: {
|
|
42
|
+
[conditionKey]: values,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.BasePrimitiveConstruct = BasePrimitiveConstruct;
|
|
49
|
+
//# sourceMappingURL=BasePrimitiveConstruct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePrimitiveConstruct.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/primitives/BasePrimitiveConstruct.ts"],"names":[],"mappings":";;;AAAA,kDAAiE;AAGjE,6CAA6C;AAC7C,2CAAuC;AAcvC;;;GAGG;AACH,MAAsB,sBAAuB,SAAQ,sBAAS;IAC5D,gDAAgD;IAC7B,IAAI,CAAW;IAElC,gDAAgD;IAC7B,YAAY,CAAS;IAExC,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAkC;QAC1E,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,GAAG,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAEzD,IAAI,CAAC,IAAI,GAAG,IAAI,qBAAG,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE;YAC9C,SAAS,EAAE,IAAI,qBAAG,CAAC,gBAAgB,CAAC,uCAA2B,CAAC;YAChE,WAAW,EAAE,KAAK,CAAC,eAAe,IAAI,aAAa,KAAK,CAAC,IAAI,iBAAiB;SAC/E,CAAC,CAAC;IACL,CAAC;IAiBD;;OAEG;IACO,YAAY,CAAC,OAAyB,EAAE,OAAiB,EAAE,GAAW;QAC9E,OAAO,CAAC,WAAW,CACjB,IAAI,qBAAG,CAAC,eAAe,CAAC;YACtB,OAAO;YACP,SAAS,EAAE,CAAC,GAAG,CAAC;SACjB,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;OAEG;IACO,yBAAyB,CACjC,OAAyB,EACzB,OAAiB,EACjB,GAAW,EACX,YAAoB,EACpB,MAAgB;QAEhB,OAAO,CAAC,WAAW,CACjB,IAAI,qBAAG,CAAC,eAAe,CAAC;YACtB,OAAO;YACP,SAAS,EAAE,CAAC,GAAG,CAAC;YAChB,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,CAAC,YAAY,CAAC,EAAE,MAAM;iBACvB;aACF;SACF,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AAnED,wDAmEC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { BasePrimitiveConstruct, type BasePrimitiveConstructProps } from './BasePrimitiveConstruct';
|
|
1
2
|
export { AgentCoreMemory, type AgentCoreMemoryProps } from './memory';
|
|
2
3
|
export { AgentCoreRuntime, type AgentCoreRuntimeProps } from './runtime';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,KAAK,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgentCoreRuntime = exports.AgentCoreMemory = void 0;
|
|
3
|
+
exports.AgentCoreRuntime = exports.AgentCoreMemory = exports.BasePrimitiveConstruct = void 0;
|
|
4
|
+
var BasePrimitiveConstruct_1 = require("./BasePrimitiveConstruct");
|
|
5
|
+
Object.defineProperty(exports, "BasePrimitiveConstruct", { enumerable: true, get: function () { return BasePrimitiveConstruct_1.BasePrimitiveConstruct; } });
|
|
4
6
|
var memory_1 = require("./memory");
|
|
5
7
|
Object.defineProperty(exports, "AgentCoreMemory", { enumerable: true, get: function () { return memory_1.AgentCoreMemory; } });
|
|
6
8
|
var runtime_1 = require("./runtime");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/primitives/index.ts"],"names":[],"mappings":";;;AAAA,mCAAsE;AAA7D,yGAAA,eAAe,OAAA;AACxB,qCAAyE;AAAhE,2GAAA,gBAAgB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/primitives/index.ts"],"names":[],"mappings":";;;AAAA,mEAAoG;AAA3F,gIAAA,sBAAsB,OAAA;AAC/B,mCAAsE;AAA7D,yGAAA,eAAe,OAAA;AACxB,qCAAyE;AAAhE,2GAAA,gBAAgB,OAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Access, Memory } from '../../../../../schema';
|
|
2
2
|
import type { AgentCoreComponentProps } from '../../base-props';
|
|
3
|
+
import { BasePrimitiveConstruct } from '../BasePrimitiveConstruct';
|
|
3
4
|
import type { AgentCoreRuntime } from '../runtime/AgentCoreRuntime';
|
|
4
5
|
import { Construct } from 'constructs';
|
|
5
6
|
export interface AgentCoreMemoryProps extends AgentCoreComponentProps {
|
|
@@ -24,12 +25,11 @@ export interface AgentCoreMemoryProps extends AgentCoreComponentProps {
|
|
|
24
25
|
* - USER_PREFERENCE -> userPreferenceMemoryStrategy
|
|
25
26
|
* - CUSTOM -> customMemoryStrategy
|
|
26
27
|
*/
|
|
27
|
-
export declare class AgentCoreMemory extends
|
|
28
|
+
export declare class AgentCoreMemory extends BasePrimitiveConstruct {
|
|
28
29
|
readonly memoryId: string;
|
|
29
30
|
readonly memoryArn: string;
|
|
30
31
|
readonly memoryName: string;
|
|
31
32
|
private readonly cfnMemory;
|
|
32
|
-
private readonly role;
|
|
33
33
|
private readonly memoryConfig;
|
|
34
34
|
constructor(scope: Construct, id: string, props: AgentCoreMemoryProps);
|
|
35
35
|
/**
|
|
@@ -50,6 +50,14 @@ export declare class AgentCoreMemory extends Construct {
|
|
|
50
50
|
* @param namespaces - Specific namespaces to scope access to (optional)
|
|
51
51
|
*/
|
|
52
52
|
grantWithAccess(runtime: AgentCoreRuntime, access?: Access, namespaces?: string[]): void;
|
|
53
|
+
/**
|
|
54
|
+
* Get the environment variable name for this primitive.
|
|
55
|
+
*/
|
|
56
|
+
getEnvVarName(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Get the environment variable value for this primitive.
|
|
59
|
+
*/
|
|
60
|
+
getEnvVarValue(): string;
|
|
53
61
|
/**
|
|
54
62
|
* Internal method to grant permissions with specified access and optional namespace scoping.
|
|
55
63
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentCoreMemory.d.ts","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/memory/AgentCoreMemory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentCoreM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object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AgentCoreMemory = void 0;
|
|
4
|
-
const
|
|
4
|
+
const BasePrimitiveConstruct_1 = require("../BasePrimitiveConstruct");
|
|
5
5
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
6
|
-
const constructs_1 = require("constructs");
|
|
7
6
|
/**
|
|
8
7
|
* Memory IAM actions that support the bedrock-agentcore:namespace condition key.
|
|
9
8
|
* These actions can be scoped to specific namespaces for fine-grained access control.
|
|
@@ -47,22 +46,21 @@ const WRITE_ACTIONS = [
|
|
|
47
46
|
* - USER_PREFERENCE -> userPreferenceMemoryStrategy
|
|
48
47
|
* - CUSTOM -> customMemoryStrategy
|
|
49
48
|
*/
|
|
50
|
-
class AgentCoreMemory extends
|
|
49
|
+
class AgentCoreMemory extends BasePrimitiveConstruct_1.BasePrimitiveConstruct {
|
|
51
50
|
memoryId;
|
|
52
51
|
memoryArn;
|
|
53
52
|
memoryName;
|
|
54
53
|
cfnMemory;
|
|
55
|
-
role;
|
|
56
54
|
memoryConfig;
|
|
57
55
|
constructor(scope, id, props) {
|
|
58
|
-
super(scope, id
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
this.role = new aws_cdk_lib_1.aws_iam.Role(this, 'ExecutionRole', {
|
|
63
|
-
assumedBy: new aws_cdk_lib_1.aws_iam.ServicePrincipal(constants_1.AGENTCORE_SERVICE_PRINCIPAL),
|
|
64
|
-
description: 'AgentCore Memory execution role',
|
|
56
|
+
super(scope, id, {
|
|
57
|
+
projectName: props.projectName,
|
|
58
|
+
name: props.memory.name,
|
|
59
|
+
roleDescription: 'AgentCore Memory execution role',
|
|
65
60
|
});
|
|
61
|
+
const { memory } = props;
|
|
62
|
+
this.memoryConfig = memory;
|
|
63
|
+
this.memoryName = this.physicalName;
|
|
66
64
|
// Map memory strategies to CloudFormation format
|
|
67
65
|
// CloudFormation MemoryStrategyProperty has optional properties for each strategy type
|
|
68
66
|
// Each strategy in the array should be a single object with one property set
|
|
@@ -147,6 +145,18 @@ class AgentCoreMemory extends constructs_1.Construct {
|
|
|
147
145
|
grantWithAccess(runtime, access = 'readwrite', namespaces) {
|
|
148
146
|
this.grantAccess(runtime, access, namespaces);
|
|
149
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Get the environment variable name for this primitive.
|
|
150
|
+
*/
|
|
151
|
+
getEnvVarName() {
|
|
152
|
+
return `MEMORY_${this.memoryConfig.name.toUpperCase()}_ID`;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get the environment variable value for this primitive.
|
|
156
|
+
*/
|
|
157
|
+
getEnvVarValue() {
|
|
158
|
+
return this.memoryId;
|
|
159
|
+
}
|
|
150
160
|
/**
|
|
151
161
|
* Internal method to grant permissions with specified access and optional namespace scoping.
|
|
152
162
|
*
|
|
@@ -163,28 +173,14 @@ class AgentCoreMemory extends constructs_1.Construct {
|
|
|
163
173
|
// These are read actions, so always included regardless of access level
|
|
164
174
|
if (namespaces && namespaces.length > 0) {
|
|
165
175
|
// Scope to specific namespaces
|
|
166
|
-
|
|
167
|
-
actions: NAMESPACE_SCOPED_ACTIONS,
|
|
168
|
-
resources: [this.memoryArn],
|
|
169
|
-
conditions: {
|
|
170
|
-
StringLike: {
|
|
171
|
-
'bedrock-agentcore:namespace': namespaces,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
}));
|
|
176
|
+
this.grantActionsWithCondition(runtime, NAMESPACE_SCOPED_ACTIONS, this.memoryArn, 'bedrock-agentcore:namespace', namespaces);
|
|
175
177
|
}
|
|
176
178
|
else {
|
|
177
179
|
// No namespace restriction
|
|
178
|
-
|
|
179
|
-
actions: NAMESPACE_SCOPED_ACTIONS,
|
|
180
|
-
resources: [this.memoryArn],
|
|
181
|
-
}));
|
|
180
|
+
this.grantActions(runtime, NAMESPACE_SCOPED_ACTIONS, this.memoryArn);
|
|
182
181
|
}
|
|
183
182
|
// Grant non-namespace actions (no condition support)
|
|
184
|
-
|
|
185
|
-
actions: nonNamespaceActions,
|
|
186
|
-
resources: [this.memoryArn],
|
|
187
|
-
}));
|
|
183
|
+
this.grantActions(runtime, nonNamespaceActions, this.memoryArn);
|
|
188
184
|
}
|
|
189
185
|
}
|
|
190
186
|
exports.AgentCoreMemory = AgentCoreMemory;
|