@aws/agentcore-cdk 0.1.0-alpha.36 → 0.1.0-alpha.38
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/Gateway.d.ts +11 -0
- package/dist/cdk/constructs/components/mcp/Gateway.d.ts.map +1 -1
- package/dist/cdk/constructs/components/mcp/Gateway.js +377 -4
- package/dist/cdk/constructs/components/mcp/Gateway.js.map +1 -1
- package/dist/cdk/constructs/components/mcp/connector-defaults.d.ts +20 -0
- package/dist/cdk/constructs/components/mcp/connector-defaults.d.ts.map +1 -0
- package/dist/cdk/constructs/components/mcp/connector-defaults.js +16 -0
- package/dist/cdk/constructs/components/mcp/connector-defaults.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.d.ts +36 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.js +65 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.d.ts +3 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.js +6 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreOnlineEvaluationConfig.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreOnlineEvaluationConfig.js +68 -22
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreOnlineEvaluationConfig.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.d.ts +64 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.js +91 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.d.ts +25 -8
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.js +120 -11
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.d.ts +47 -0
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.js +388 -0
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/index.d.ts +1 -0
- package/dist/cdk/constructs/components/primitives/harness/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/harness/index.js +3 -1
- package/dist/cdk/constructs/components/primitives/harness/index.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/index.d.ts +3 -1
- package/dist/cdk/constructs/components/primitives/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/index.js +6 -1
- package/dist/cdk/constructs/components/primitives/index.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.d.ts +69 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.js +292 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.d.ts +2 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.js +6 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.js +20 -5
- package/dist/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.js.map +1 -1
- package/dist/cdk/constructs/index.d.ts +2 -2
- package/dist/cdk/constructs/index.d.ts.map +1 -1
- package/dist/cdk/constructs/index.js +4 -1
- package/dist/cdk/constructs/index.js.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreApplication.d.ts +74 -4
- package/dist/cdk/constructs/l3/AgentCoreApplication.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreApplication.js +264 -2
- package/dist/cdk/constructs/l3/AgentCoreApplication.js.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.d.ts +24 -0
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.js +27 -3
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.js.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.js +25 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.js.map +1 -1
- package/dist/cdk/constructs/l3/index.d.ts +1 -1
- package/dist/cdk/constructs/l3/index.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/index.js.map +1 -1
- package/dist/cdk/feature-flags.d.ts +15 -0
- package/dist/cdk/feature-flags.d.ts.map +1 -0
- package/dist/cdk/feature-flags.js +19 -0
- package/dist/cdk/feature-flags.js.map +1 -0
- package/dist/cdk/index.d.ts +1 -1
- package/dist/cdk/index.d.ts.map +1 -1
- package/dist/cdk/index.js +4 -1
- package/dist/cdk/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/schema/schemas/agent-env.d.ts +35 -0
- package/dist/schema/schemas/agent-env.d.ts.map +1 -1
- package/dist/schema/schemas/agentcore-project.d.ts +175 -4
- package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
- package/dist/schema/schemas/agentcore-project.js +81 -4
- package/dist/schema/schemas/agentcore-project.js.map +1 -1
- package/dist/schema/schemas/auth.d.ts +171 -0
- package/dist/schema/schemas/auth.d.ts.map +1 -1
- package/dist/schema/schemas/auth.js +125 -3
- package/dist/schema/schemas/auth.js.map +1 -1
- package/dist/schema/schemas/mcp.d.ts +254 -0
- package/dist/schema/schemas/mcp.d.ts.map +1 -1
- package/dist/schema/schemas/mcp.js +452 -4
- package/dist/schema/schemas/mcp.js.map +1 -1
- package/dist/schema/schemas/primitives/harness.d.ts +353 -19
- package/dist/schema/schemas/primitives/harness.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/harness.js +385 -25
- package/dist/schema/schemas/primitives/harness.js.map +1 -1
- package/dist/schema/schemas/primitives/index.d.ts +5 -1
- package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/index.js +31 -1
- package/dist/schema/schemas/primitives/index.js.map +1 -1
- package/dist/schema/schemas/primitives/knowledge-base.d.ts +103 -0
- package/dist/schema/schemas/primitives/knowledge-base.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/knowledge-base.js +98 -0
- package/dist/schema/schemas/primitives/knowledge-base.js.map +1 -0
- package/dist/schema/schemas/primitives/memory.d.ts +2 -2
- package/dist/schema/schemas/primitives/online-evaluation-config.d.ts +19 -2
- package/dist/schema/schemas/primitives/online-evaluation-config.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/online-evaluation-config.js +39 -5
- package/dist/schema/schemas/primitives/online-evaluation-config.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentCoreKnowledgeBase = void 0;
|
|
4
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
|
+
const constructs_1 = require("constructs");
|
|
6
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
/**
|
|
8
|
+
* The embedding model used for FMKB MANAGED knowledge bases.
|
|
9
|
+
*
|
|
10
|
+
* Hardcoded to titan-embed-text-v2:0 to match the spec's
|
|
11
|
+
* "Parameter governance hidden — use service defaults, don't expose in CLI"
|
|
12
|
+
* decision (docs/cli-knowledge-bases-devex.md). Verification also showed
|
|
13
|
+
* EmbeddingModelArn is accepted on create but not echoed back by
|
|
14
|
+
* GetKnowledgeBase, so the user-facing impact of overriding it is unclear.
|
|
15
|
+
* If a customer use case emerges, plumb this as an optional field on
|
|
16
|
+
* `KnowledgeBaseSchema`.
|
|
17
|
+
*/
|
|
18
|
+
const EMBEDDING_MODEL_ID = 'amazon.titan-embed-text-v2:0';
|
|
19
|
+
/**
|
|
20
|
+
* AgentCore Knowledge Base component construct.
|
|
21
|
+
*
|
|
22
|
+
* Wave 1 scope: creates an FMKB-style Knowledge Base + S3 Data Source via the
|
|
23
|
+
* CfnResource escape hatch. Typed L1 (CfnKnowledgeBase / CfnDataSource) cannot
|
|
24
|
+
* be used because the MANAGED knowledge base type and the
|
|
25
|
+
* MANAGED_KNOWLEDGE_BASE_CONNECTOR data source type are both private-beta and
|
|
26
|
+
* not in the public CFN schema; typed L1 rejects them at synth time.
|
|
27
|
+
*
|
|
28
|
+
* The IAM service role trusts `bedrock.amazonaws.com`.
|
|
29
|
+
*
|
|
30
|
+
* Wave 1 does NOT create a connector gateway target. The `knowledgeBase.gateway`
|
|
31
|
+
* field is accepted but ignored. Wave 2 lights up gateway wiring.
|
|
32
|
+
*/
|
|
33
|
+
class AgentCoreKnowledgeBase extends constructs_1.Construct {
|
|
34
|
+
/** The KB physical name (`${projectName}_${kb.name}`). */
|
|
35
|
+
knowledgeBaseName;
|
|
36
|
+
/** The KB id (CfnResource Ref). */
|
|
37
|
+
knowledgeBaseId;
|
|
38
|
+
/** The KB ARN (CfnResource attribute). */
|
|
39
|
+
knowledgeBaseArn;
|
|
40
|
+
/** The KB service role. */
|
|
41
|
+
role;
|
|
42
|
+
/**
|
|
43
|
+
* Each created data source, in the order specified in the KB schema's
|
|
44
|
+
* `dataSources[]` array. Exposed so the L3 can emit per-DS CFN outputs
|
|
45
|
+
* (id + URI) without recomputing names or hashes — consumers (e.g. the CLI
|
|
46
|
+
* post-deploy hook) read these outputs to map URI → DS id deterministically
|
|
47
|
+
* instead of parsing physical names.
|
|
48
|
+
*/
|
|
49
|
+
dataSources = [];
|
|
50
|
+
cfnKnowledgeBase;
|
|
51
|
+
cfnDataSources = [];
|
|
52
|
+
constructor(scope, id, props) {
|
|
53
|
+
super(scope, id);
|
|
54
|
+
const { projectName, knowledgeBase } = props;
|
|
55
|
+
this.knowledgeBaseName = `${projectName}_${knowledgeBase.name}`;
|
|
56
|
+
const stack = aws_cdk_lib_1.Stack.of(this);
|
|
57
|
+
const region = stack.region;
|
|
58
|
+
const account = stack.account;
|
|
59
|
+
const partition = stack.partition;
|
|
60
|
+
const embeddingModelArn = `arn:${partition}:bedrock:${region}::foundation-model/${EMBEDDING_MODEL_ID}`;
|
|
61
|
+
// Confused-deputy guards (aws:SourceAccount + aws:SourceArn scoped to
|
|
62
|
+
// knowledge-base/*) — verified shape from kb-cdk-test/lib/kb-stack.ts.
|
|
63
|
+
this.role = new aws_cdk_lib_1.aws_iam.Role(this, 'ServiceRole', {
|
|
64
|
+
assumedBy: new aws_cdk_lib_1.aws_iam.ServicePrincipal('bedrock.amazonaws.com', {
|
|
65
|
+
conditions: {
|
|
66
|
+
StringEquals: { 'aws:SourceAccount': account },
|
|
67
|
+
ArnLike: {
|
|
68
|
+
'aws:SourceArn': `arn:${partition}:bedrock:${region}:${account}:knowledge-base/*`,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
description: `AgentCore Knowledge Base service role for ${this.knowledgeBaseName}`,
|
|
73
|
+
});
|
|
74
|
+
// Permission: KB needs to call bedrock:InvokeModel on the embedding model
|
|
75
|
+
// during create (verifies the model is reachable). Scoped to the specific
|
|
76
|
+
// model ARN we synthesize plus the inference-profile ARN that lets
|
|
77
|
+
// cross-region inference profiles work as embedding sources.
|
|
78
|
+
this.role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
79
|
+
actions: ['bedrock:InvokeModel'],
|
|
80
|
+
resources: [embeddingModelArn, `arn:${partition}:bedrock:${region}:${account}:inference-profile/*`],
|
|
81
|
+
}));
|
|
82
|
+
// Permission: KB role needs s3:GetObject + s3:ListBucket on each S3 source
|
|
83
|
+
// bucket. We collect unique buckets from the data sources to avoid
|
|
84
|
+
// redundant statements.
|
|
85
|
+
const buckets = new Set();
|
|
86
|
+
for (const ds of knowledgeBase.dataSources) {
|
|
87
|
+
if (ds.type === 'S3') {
|
|
88
|
+
buckets.add(this.parseS3Uri(ds.uri).bucket);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (buckets.size > 0) {
|
|
92
|
+
const bucketArns = [];
|
|
93
|
+
// Sort for deterministic synth output across runs (Set iteration is
|
|
94
|
+
// insertion order, which can vary if data sources are reordered).
|
|
95
|
+
for (const bucket of Array.from(buckets).sort()) {
|
|
96
|
+
bucketArns.push(`arn:${partition}:s3:::${bucket}`);
|
|
97
|
+
bucketArns.push(`arn:${partition}:s3:::${bucket}/*`);
|
|
98
|
+
}
|
|
99
|
+
this.role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
100
|
+
actions: ['s3:GetObject', 's3:ListBucket'],
|
|
101
|
+
resources: bucketArns,
|
|
102
|
+
// Confused-deputy guard: only allow this role to read S3 objects in
|
|
103
|
+
// the deploying account. Mirrors kb-cdk-test/lib/kb-stack.ts.
|
|
104
|
+
conditions: {
|
|
105
|
+
StringEquals: { 'aws:ResourceAccount': account },
|
|
106
|
+
},
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
// Knowledge Base resource (MANAGED / FMKB) via CfnResource escape hatch.
|
|
110
|
+
//
|
|
111
|
+
// Tags are intentionally NOT emitted on this resource. The
|
|
112
|
+
// AWS::Bedrock::KnowledgeBase CFN handler disagrees with itself across
|
|
113
|
+
// accounts on the wire shape: some handler builds want the standard CFN
|
|
114
|
+
// [{Key, Value}] array, others want a JSON-object {key: value} map, and
|
|
115
|
+
// the registered schema accepts the array form even where the handler
|
|
116
|
+
// rejects it. Rather than special-case the L3 against a moving service
|
|
117
|
+
// contract, we drop tag propagation for KBs entirely until the service
|
|
118
|
+
// team aligns on a single shape.
|
|
119
|
+
//
|
|
120
|
+
// Project-level tags continue to flow to all other primitives via the
|
|
121
|
+
// standard composeTags / recordToCfnTags path. This is a per-resource
|
|
122
|
+
// exception, not a project-wide drop.
|
|
123
|
+
this.cfnKnowledgeBase = new aws_cdk_lib_1.CfnResource(this, 'Resource', {
|
|
124
|
+
type: 'AWS::Bedrock::KnowledgeBase',
|
|
125
|
+
properties: {
|
|
126
|
+
Name: this.knowledgeBaseName,
|
|
127
|
+
...(knowledgeBase.description && { Description: knowledgeBase.description }),
|
|
128
|
+
RoleArn: this.role.roleArn,
|
|
129
|
+
KnowledgeBaseConfiguration: {
|
|
130
|
+
Type: 'MANAGED',
|
|
131
|
+
ManagedKnowledgeBaseConfiguration: {
|
|
132
|
+
EmbeddingModelArn: embeddingModelArn,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
// KB create calls bedrock:InvokeModel to verify the embedding model. CDK's
|
|
138
|
+
// addToPolicy emits a separate AWS::IAM::Policy that creates in parallel
|
|
139
|
+
// with the KB by default, which causes flaky AccessDenied at create time.
|
|
140
|
+
// Force the policy to attach before KB create.
|
|
141
|
+
const cfnRole = this.role.node.defaultChild;
|
|
142
|
+
if (cfnRole) {
|
|
143
|
+
this.cfnKnowledgeBase.node.addDependency(cfnRole);
|
|
144
|
+
}
|
|
145
|
+
const inlinePolicy = this.role.node.tryFindChild('DefaultPolicy');
|
|
146
|
+
if (inlinePolicy) {
|
|
147
|
+
this.cfnKnowledgeBase.node.addDependency(inlinePolicy);
|
|
148
|
+
}
|
|
149
|
+
this.knowledgeBaseId = this.cfnKnowledgeBase.ref;
|
|
150
|
+
this.knowledgeBaseArn = this.cfnKnowledgeBase.getAtt('KnowledgeBaseArn').toString();
|
|
151
|
+
// Data sources. Each data source becomes one MANAGED_KNOWLEDGE_BASE_CONNECTOR
|
|
152
|
+
// DataSource. Construct id and physical name are both derived from a hash
|
|
153
|
+
// of a stable per-DS key (S3 URI or connectorConfigFile path) so reordering
|
|
154
|
+
// `dataSources[]` in agentcore.json is a no-op at the CFN layer (no replace).
|
|
155
|
+
//
|
|
156
|
+
// For S3 we build ConnectorParameters inline. For non-S3 connectors the L3
|
|
157
|
+
// does not read files: the CLI reads each connector-config file and passes
|
|
158
|
+
// the parsed `connectorParameters` object in via `connectorParametersByFile`,
|
|
159
|
+
// which we emit verbatim. ConnectorParameters in both cases is the raw
|
|
160
|
+
// AWSPlatoDataConnectorConfigurationModel shape — camelCase, verbatim. Don't
|
|
161
|
+
// normalize keys. Verified working in kb-cdk-test/lib/ds-stack.ts.
|
|
162
|
+
const { connectorParametersByFile = {} } = props;
|
|
163
|
+
const secretArns = new Set();
|
|
164
|
+
for (const ds of knowledgeBase.dataSources) {
|
|
165
|
+
let connectorParameters;
|
|
166
|
+
let dsKey; // stable identity for hashing + output correlation
|
|
167
|
+
if (ds.type === 'S3') {
|
|
168
|
+
const { bucket, prefix } = this.parseS3Uri(ds.uri);
|
|
169
|
+
dsKey = ds.uri;
|
|
170
|
+
connectorParameters = {
|
|
171
|
+
type: 'S3',
|
|
172
|
+
// version is the STRING "1" — verified against the FMKB managed-
|
|
173
|
+
// connector backend by direct CreateDataSource API call. The
|
|
174
|
+
// service's connector-parameters parser rejects an integer 1 with
|
|
175
|
+
// `Invalid connector version '1.0'` (the CFN/JSON marshalling
|
|
176
|
+
// round-trips the integer to a float, which then fails the version
|
|
177
|
+
// check). The string form is what the production console module
|
|
178
|
+
// emits in batchConnectorUtils.ts and is the only form that works
|
|
179
|
+
// through every connector type.
|
|
180
|
+
version: '1',
|
|
181
|
+
connectionConfiguration: {
|
|
182
|
+
bucketArn: `arn:${partition}:s3:::${bucket}`,
|
|
183
|
+
bucketName: bucket,
|
|
184
|
+
bucketOwnerAccountId: account,
|
|
185
|
+
},
|
|
186
|
+
// When the user specified `s3://bucket/prefix/`, scope ingestion to
|
|
187
|
+
// that prefix instead of the whole bucket. Without this, customers
|
|
188
|
+
// see the entire bucket indexed even when they passed a
|
|
189
|
+
// path-prefixed URI.
|
|
190
|
+
...(prefix !== undefined && {
|
|
191
|
+
filterConfiguration: {
|
|
192
|
+
inclusionPrefixes: [prefix],
|
|
193
|
+
},
|
|
194
|
+
}),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
dsKey = ds.connectorConfigFile;
|
|
199
|
+
const params = connectorParametersByFile[ds.connectorConfigFile];
|
|
200
|
+
if (!params) {
|
|
201
|
+
throw new Error(`Missing parsed connectorParameters for data source '${ds.connectorConfigFile}'. ` +
|
|
202
|
+
`The CLI must read the connector-config file and pass it via connectorParametersByFile.`);
|
|
203
|
+
}
|
|
204
|
+
connectorParameters = params;
|
|
205
|
+
// Normalize `version` to the STRING form. The FMKB managed-connector
|
|
206
|
+
// backend's parser only accepts a string `"1"` (verified by direct
|
|
207
|
+
// API probe: the integer `1` round-trips through CFN's JSON
|
|
208
|
+
// marshalling as `1.0` and fails with `Invalid connector version
|
|
209
|
+
// '1.0'`). Templates and hand-written configs commonly use a JSON
|
|
210
|
+
// number, so we silently convert. Non-numeric or absent version is
|
|
211
|
+
// left as-is so a future connector that omits version still works.
|
|
212
|
+
if (typeof connectorParameters.version === 'number' && Number.isFinite(connectorParameters.version)) {
|
|
213
|
+
connectorParameters = { ...connectorParameters, version: String(connectorParameters.version) };
|
|
214
|
+
}
|
|
215
|
+
else if (typeof connectorParameters.version === 'string' &&
|
|
216
|
+
/^\d+(\.0+)?$/.test(connectorParameters.version)) {
|
|
217
|
+
// "1.0" → "1": match the bare-integer string the service expects.
|
|
218
|
+
connectorParameters = {
|
|
219
|
+
...connectorParameters,
|
|
220
|
+
version: String(parseInt(connectorParameters.version, 10)),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// Auth-bearing connectors (Confluence, SharePoint, etc.) reference a
|
|
224
|
+
// Secrets Manager secret via connectionConfiguration.secretArn. Collect
|
|
225
|
+
// those so the KB role can read them at ingestion time.
|
|
226
|
+
const cc = params.connectionConfiguration;
|
|
227
|
+
if (cc && typeof cc.secretArn === 'string' && cc.secretArn) {
|
|
228
|
+
secretArns.add(cc.secretArn);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const uriHash = (0, crypto_1.createHash)('sha256').update(dsKey).digest('hex').slice(0, 8);
|
|
232
|
+
const dsConstructId = `DataSource${uriHash}`;
|
|
233
|
+
const dsName = `${this.knowledgeBaseName}_ds_${uriHash}`;
|
|
234
|
+
// Bedrock CreateDataSource caps the name at 63 chars. The schema caps
|
|
235
|
+
// KB names at 48 and project names are bounded elsewhere, but the
|
|
236
|
+
// composed name `${projectName}_${kbName}_ds_${hash}` can still exceed
|
|
237
|
+
// 63 for long combinations. Surface this as a clear error at synth
|
|
238
|
+
// time instead of letting the CFN handler fail mid-deploy.
|
|
239
|
+
if (dsName.length > 63) {
|
|
240
|
+
throw new Error(`Synthesized DataSource name '${dsName}' exceeds Bedrock's 63-char limit ` +
|
|
241
|
+
`(${dsName.length} chars). Shorten the project name or the knowledge base name.`);
|
|
242
|
+
}
|
|
243
|
+
const cfnDs = new aws_cdk_lib_1.CfnResource(this, dsConstructId, {
|
|
244
|
+
type: 'AWS::Bedrock::DataSource',
|
|
245
|
+
properties: {
|
|
246
|
+
Name: dsName,
|
|
247
|
+
KnowledgeBaseId: this.knowledgeBaseId,
|
|
248
|
+
DataDeletionPolicy: 'RETAIN',
|
|
249
|
+
DataSourceConfiguration: {
|
|
250
|
+
Type: 'MANAGED_KNOWLEDGE_BASE_CONNECTOR',
|
|
251
|
+
ManagedKnowledgeBaseConnectorConfiguration: {
|
|
252
|
+
ConnectorParameters: connectorParameters,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
cfnDs.node.addDependency(this.cfnKnowledgeBase);
|
|
258
|
+
this.cfnDataSources.push(cfnDs);
|
|
259
|
+
// cfnDs.ref returns the composite primaryIdentifier "<kbId>|<dsId>" for
|
|
260
|
+
// AWS::Bedrock::DataSource; we need the bare DataSourceId (10-char) so
|
|
261
|
+
// StartIngestionJob accepts it. getAtt('DataSourceId') returns just the id.
|
|
262
|
+
this.dataSources.push({ uri: dsKey, id: cfnDs.getAtt('DataSourceId').toString() });
|
|
263
|
+
}
|
|
264
|
+
// Grant secret read for auth-bearing connectors.
|
|
265
|
+
if (secretArns.size > 0) {
|
|
266
|
+
this.role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
267
|
+
actions: ['secretsmanager:GetSecretValue'],
|
|
268
|
+
resources: Array.from(secretArns).sort(),
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Parse `s3://bucket[/prefix]` into its components. Bucket name follows
|
|
274
|
+
* the standard S3 naming rules; the regex in S3DataSourceSchema is the
|
|
275
|
+
* authority. Prefix (when present) is passed through to the DataSource's
|
|
276
|
+
* `inclusionPrefixes` so ingestion is scoped to the path the user named.
|
|
277
|
+
*
|
|
278
|
+
* `prefix` is `undefined` when the URI is `s3://bucket` or `s3://bucket/`.
|
|
279
|
+
* It is the substring after the first `/` otherwise (without a leading
|
|
280
|
+
* slash) so `s3://b/docs/eng/` yields `'docs/eng/'`.
|
|
281
|
+
*/
|
|
282
|
+
parseS3Uri(uri) {
|
|
283
|
+
const m = /^s3:\/\/([^/]+)(?:\/(.*))?$/.exec(uri);
|
|
284
|
+
if (!m?.[1]) {
|
|
285
|
+
throw new Error(`Invalid S3 URI: ${uri}`);
|
|
286
|
+
}
|
|
287
|
+
const prefix = m[2];
|
|
288
|
+
return prefix ? { bucket: m[1], prefix } : { bucket: m[1] };
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
exports.AgentCoreKnowledgeBase = AgentCoreKnowledgeBase;
|
|
292
|
+
//# sourceMappingURL=AgentCoreKnowledgeBase.js.map
|
package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentCoreKnowledgeBase.js","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.ts"],"names":[],"mappings":";;;AAEA,6CAAiE;AACjE,2CAAuC;AACvC,mCAAoC;AAmBpC;;;;;;;;;;GAUG;AACH,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,MAAa,sBAAuB,SAAQ,sBAAS;IACnD,0DAA0D;IAC1C,iBAAiB,CAAS;IAE1C,mCAAmC;IACnB,eAAe,CAAS;IAExC,0CAA0C;IAC1B,gBAAgB,CAAS;IAEzC,2BAA2B;IACX,IAAI,CAAW;IAE/B;;;;;;OAMG;IACa,WAAW,GAAkC,EAAE,CAAC;IAE/C,gBAAgB,CAAc;IAC9B,cAAc,GAAkB,EAAE,CAAC;IAEpD,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAkC;QAC1E,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,GAAG,WAAW,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC;QAEhE,MAAM,KAAK,GAAG,mBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAC7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AG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,CAAC;CACF;AA/RD,wDA+RC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/knowledge-base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,KAAK,2BAA2B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentCoreKnowledgeBase = void 0;
|
|
4
|
+
var AgentCoreKnowledgeBase_1 = require("./AgentCoreKnowledgeBase");
|
|
5
|
+
Object.defineProperty(exports, "AgentCoreKnowledgeBase", { enumerable: true, get: function () { return AgentCoreKnowledgeBase_1.AgentCoreKnowledgeBase; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/knowledge-base/index.ts"],"names":[],"mappings":";;;AAAA,mEAAoG;AAA3F,gIAAA,sBAAsB,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentCorePolicyEngine.d.ts","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,SAAgB,eAAe,EAAE,MAAM,CAAC;IACxC,SAAgB,QAAQ;kBAA+B,MAAM;mBAAa,MAAM;OAAM;gBAE1E,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B;
|
|
1
|
+
{"version":3,"file":"AgentCorePolicyEngine.d.ts","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,SAAgB,eAAe,EAAE,MAAM,CAAC;IACxC,SAAgB,QAAQ;kBAA+B,MAAM;mBAAa,MAAM;OAAM;gBAE1E,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B;CA0D5E"}
|
|
@@ -36,14 +36,29 @@ class AgentCorePolicyEngine extends constructs_1.Construct {
|
|
|
36
36
|
const cfnPolicy = new aws_cdk_lib_1.aws_bedrockagentcore.CfnPolicy(this, `Policy${policySpec.name}`, {
|
|
37
37
|
name: policySpec.name,
|
|
38
38
|
policyEngineId: this.policyEngineId,
|
|
39
|
-
definition
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
39
|
+
// `definition` is a required prop, but the generated PolicyDefinition
|
|
40
|
+
// validator/converter in aws-cdk-lib only understands the `Cedar` variant.
|
|
41
|
+
// Pass a syntactically-valid placeholder to satisfy the type; the raw CFN
|
|
42
|
+
// Definition is set via the escape hatch below.
|
|
43
|
+
definition: { cedar: { statement: '' } },
|
|
44
44
|
...(policySpec.description && { description: policySpec.description }),
|
|
45
45
|
...(policySpec.validationMode && { validationMode: policySpec.validationMode }),
|
|
46
46
|
});
|
|
47
|
+
// CloudFormation already accepts the `Policy` variant of PolicyDefinition, but
|
|
48
|
+
// aws-cdk-lib's generated converter only emits `Cedar` (and its validator
|
|
49
|
+
// rejects `policy`), which makes synth fail with
|
|
50
|
+
// "supplied properties not correct for PolicyDefinitionProperty". Set the raw
|
|
51
|
+
// CFN Definition.Policy directly and delete the `Cedar` placeholder emitted from
|
|
52
|
+
// the typed prop above — `Definition` is `oneOf(Cedar, Policy)`, so leaving the
|
|
53
|
+
// empty placeholder in would fail deploy. (addPropertyOverride deep-merges, so
|
|
54
|
+
// the placeholder must be deleted explicitly rather than overwritten.)
|
|
55
|
+
// TODO: revert to `definition: { policy: { statement } }` once aws-cdk-lib
|
|
56
|
+
// regenerates CfnPolicy with the `policy`/`Policy` variant from the updated
|
|
57
|
+
// CFN schema (cdklabs/awscdk-service-spec).
|
|
58
|
+
cfnPolicy.addPropertyOverride('Definition.Policy', {
|
|
59
|
+
Statement: policySpec.statement,
|
|
60
|
+
});
|
|
61
|
+
cfnPolicy.addPropertyDeletionOverride('Definition.Cedar');
|
|
47
62
|
// Ensure policies are created after the engine
|
|
48
63
|
cfnPolicy.addDependency(cfnPolicyEngine);
|
|
49
64
|
this.policies.set(policySpec.name, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentCorePolicyEngine.js","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/policy/AgentCoreP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,IAAI,EAAE,EAAE;gBACjF,IAAI,EAAE,UAAU,CAAC,IAAI;gBACrB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,UAAU,EAAE
|
|
1
|
+
{"version":3,"file":"AgentCorePolicyEngine.js","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.ts"],"names":[],"mappings":";;;AACA,iDAAsE;AAEtE,6CAAuE;AACvE,2CAAuC;AASvC;;;;;;;;GAQG;AACH,MAAa,qBAAsB,SAAQ,sBAAS;IAClC,cAAc,CAAS;IACvB,eAAe,CAAS;IACxB,QAAQ,GAAG,IAAI,GAAG,EAAmD,CAAC;IAEtF,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAiC;QACzE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;QAC5C,MAAM,YAAY,GAAG,GAAG,WAAW,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC;QAE3D,+BAA+B;QAC/B,MAAM,UAAU,GAAG,IAAA,sBAAe,EAAC,IAAA,kBAAW,EAAC,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAEtF,MAAM,eAAe,GAAG,IAAI,kCAAgB,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE;YAC7E,IAAI,EAAE,YAAY;YAClB,GAAG,CAAC,YAAY,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,YAAY,CAAC,WAAW,EAAE,CAAC;YAC1E,GAAG,CAAC,YAAY,CAAC,gBAAgB,IAAI,EAAE,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,EAAE,CAAC;YACzF,GAAG,CAAC,UAAU,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;SACxC,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC,kBAAkB,CAAC;QACzD,IAAI,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}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AgentCoreApplication, type AgentCoreApplicationProps, AgentEnvironment, type AgentEnvironmentProps, AgentCoreHarnessEnvironment, type AgentCoreHarnessEnvironmentProps, AgentCoreMcp, type AgentCoreMcpProps, } from './l3';
|
|
2
|
-
export { type AgentCoreComponentProps, AgentCoreDataset, type AgentCoreDatasetProps, AgentCoreHarnessRole, type AgentCoreHarnessRoleProps, type HarnessRoleConfig, AgentCoreMemory, type AgentCoreMemoryProps, AgentCorePolicyEngine, type AgentCorePolicyEngineProps, AgentCoreRuntime, type AgentCoreRuntimeProps, AgentCorePaymentManager, type AgentCorePaymentManagerProps, type CustomJWTAuthorizerConfig, AgentCorePaymentConnector, type AgentCorePaymentConnectorProps, } from './components';
|
|
1
|
+
export { AgentCoreApplication, type AgentCoreApplicationProps, type HarnessDeploymentConfig, AgentEnvironment, type AgentEnvironmentProps, AgentCoreHarnessEnvironment, type AgentCoreHarnessEnvironmentProps, AgentCoreMcp, type AgentCoreMcpProps, } from './l3';
|
|
2
|
+
export { type AgentCoreComponentProps, AgentCoreDataset, type AgentCoreDatasetProps, AgentCoreHarnessRole, type AgentCoreHarnessRoleProps, type HarnessRoleConfig, AgentCoreHarness, type AgentCoreHarnessProps, AgentCoreKnowledgeBase, type AgentCoreKnowledgeBaseProps, AgentCoreConfigBundle, type AgentCoreConfigBundleProps, AgentCoreMemory, type AgentCoreMemoryProps, AgentCorePolicyEngine, type AgentCorePolicyEngineProps, AgentCoreRuntime, type AgentCoreRuntimeProps, AgentCorePaymentManager, type AgentCorePaymentManagerProps, type CustomJWTAuthorizerConfig, AgentCorePaymentConnector, type AgentCorePaymentConnectorProps, } from './components';
|
|
3
3
|
export { BundledCodeZipAsset, type BundledCodeZipAssetProps, NodeBundledCodeZipAsset, PythonBundledCodeZipAsset, } from './bundling';
|
|
4
4
|
export { ContainerSourceAssetFromPath, type ContainerSourceAssetFromPathProps } from './bundling';
|
|
5
5
|
export { AgentEcrRepository, type AgentEcrRepositoryProps } from './components/container';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cdk/constructs/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,gCAAgC,EACrC,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,eAAe,EACf,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,uBAAuB,EACvB,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,yBAAyB,EACzB,KAAK,8BAA8B,GACpC,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,4BAA4B,EAAE,KAAK,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAGlG,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,KAAK,0BAA0B,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cdk/constructs/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,gCAAgC,EACrC,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,eAAe,EACf,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,uBAAuB,EACvB,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,yBAAyB,EACzB,KAAK,8BAA8B,GACpC,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,4BAA4B,EAAE,KAAK,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAGlG,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,KAAK,0BAA0B,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContainerImageBuilder = exports.ContainerBuildProject = exports.AgentEcrRepository = exports.ContainerSourceAssetFromPath = exports.PythonBundledCodeZipAsset = exports.NodeBundledCodeZipAsset = exports.BundledCodeZipAsset = exports.AgentCorePaymentConnector = exports.AgentCorePaymentManager = exports.AgentCoreRuntime = exports.AgentCorePolicyEngine = exports.AgentCoreMemory = exports.AgentCoreHarnessRole = exports.AgentCoreDataset = exports.AgentCoreMcp = exports.AgentCoreHarnessEnvironment = exports.AgentEnvironment = exports.AgentCoreApplication = void 0;
|
|
3
|
+
exports.ContainerImageBuilder = exports.ContainerBuildProject = exports.AgentEcrRepository = exports.ContainerSourceAssetFromPath = exports.PythonBundledCodeZipAsset = exports.NodeBundledCodeZipAsset = exports.BundledCodeZipAsset = exports.AgentCorePaymentConnector = exports.AgentCorePaymentManager = exports.AgentCoreRuntime = exports.AgentCorePolicyEngine = exports.AgentCoreMemory = exports.AgentCoreConfigBundle = exports.AgentCoreKnowledgeBase = exports.AgentCoreHarness = exports.AgentCoreHarnessRole = exports.AgentCoreDataset = exports.AgentCoreMcp = exports.AgentCoreHarnessEnvironment = exports.AgentEnvironment = exports.AgentCoreApplication = void 0;
|
|
4
4
|
// L3 Constructs
|
|
5
5
|
var l3_1 = require("./l3");
|
|
6
6
|
Object.defineProperty(exports, "AgentCoreApplication", { enumerable: true, get: function () { return l3_1.AgentCoreApplication; } });
|
|
@@ -11,6 +11,9 @@ Object.defineProperty(exports, "AgentCoreMcp", { enumerable: true, get: function
|
|
|
11
11
|
var components_1 = require("./components");
|
|
12
12
|
Object.defineProperty(exports, "AgentCoreDataset", { enumerable: true, get: function () { return components_1.AgentCoreDataset; } });
|
|
13
13
|
Object.defineProperty(exports, "AgentCoreHarnessRole", { enumerable: true, get: function () { return components_1.AgentCoreHarnessRole; } });
|
|
14
|
+
Object.defineProperty(exports, "AgentCoreHarness", { enumerable: true, get: function () { return components_1.AgentCoreHarness; } });
|
|
15
|
+
Object.defineProperty(exports, "AgentCoreKnowledgeBase", { enumerable: true, get: function () { return components_1.AgentCoreKnowledgeBase; } });
|
|
16
|
+
Object.defineProperty(exports, "AgentCoreConfigBundle", { enumerable: true, get: function () { return components_1.AgentCoreConfigBundle; } });
|
|
14
17
|
Object.defineProperty(exports, "AgentCoreMemory", { enumerable: true, get: function () { return components_1.AgentCoreMemory; } });
|
|
15
18
|
Object.defineProperty(exports, "AgentCorePolicyEngine", { enumerable: true, get: function () { return components_1.AgentCorePolicyEngine; } });
|
|
16
19
|
Object.defineProperty(exports, "AgentCoreRuntime", { enumerable: true, get: function () { return components_1.AgentCoreRuntime; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cdk/constructs/index.ts"],"names":[],"mappings":";;;AAAA,gBAAgB;AAChB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cdk/constructs/index.ts"],"names":[],"mappings":";;;AAAA,gBAAgB;AAChB,2BAUc;AATZ,0GAAA,oBAAoB,OAAA;AAGpB,sGAAA,gBAAgB,OAAA;AAEhB,iHAAA,2BAA2B,OAAA;AAE3B,kGAAA,YAAY,OAAA;AAId,uBAAuB;AACvB,2CAwBsB;AAtBpB,8GAAA,gBAAgB,OAAA;AAEhB,kHAAA,oBAAoB,OAAA;AAGpB,8GAAA,gBAAgB,OAAA;AAEhB,oHAAA,sBAAsB,OAAA;AAEtB,mHAAA,qBAAqB,OAAA;AAErB,6GAAA,eAAe,OAAA;AAEf,mHAAA,qBAAqB,OAAA;AAErB,8GAAA,gBAAgB,OAAA;AAEhB,qHAAA,uBAAuB,OAAA;AAGvB,uHAAA,yBAAyB,OAAA;AAI3B,sBAAsB;AACtB,uCAKoB;AAJlB,+GAAA,mBAAmB,OAAA;AAEnB,mHAAA,uBAAuB,OAAA;AACvB,qHAAA,yBAAyB,OAAA;AAE3B,uCAAkG;AAAzF,wHAAA,4BAA4B,OAAA;AAErC,uBAAuB;AACvB,oDAA0F;AAAjF,+GAAA,kBAAkB,OAAA;AAC3B,oDAA+D;AAAtD,kHAAA,qBAAqB,OAAA;AAC9B,oDAAgG;AAAvF,kHAAA,qBAAqB,OAAA"}
|
|
@@ -1,23 +1,51 @@
|
|
|
1
|
-
import type { AgentCoreProjectSpec } from '../../../schema';
|
|
1
|
+
import type { AgentCoreProjectSpec, HarnessSpec } from '../../../schema';
|
|
2
|
+
import { AgentCoreConfigBundle } from '../components/primitives/config-bundle/AgentCoreConfigBundle';
|
|
2
3
|
import { AgentCoreDataset } from '../components/primitives/dataset/AgentCoreDataset';
|
|
3
4
|
import { AgentCoreEvaluator } from '../components/primitives/evaluator/AgentCoreEvaluator';
|
|
4
5
|
import { AgentCoreOnlineEvaluationConfig } from '../components/primitives/evaluator/AgentCoreOnlineEvaluationConfig';
|
|
6
|
+
import type { AgentCoreHarness } from '../components/primitives/harness/AgentCoreHarness';
|
|
5
7
|
import type { AgentCoreHarnessRole } from '../components/primitives/harness/AgentCoreHarnessRole';
|
|
6
8
|
import type { HarnessRoleConfig } from '../components/primitives/harness/AgentCoreHarnessRole';
|
|
9
|
+
import { AgentCoreKnowledgeBase } from '../components/primitives/knowledge-base/AgentCoreKnowledgeBase';
|
|
7
10
|
import { AgentCoreMemory } from '../components/primitives/memory/AgentCoreMemory';
|
|
8
11
|
import { AgentCorePolicyEngine } from '../components/primitives/policy/AgentCorePolicyEngine';
|
|
9
12
|
import { AgentEnvironment } from './AgentEnvironment';
|
|
10
13
|
import { Construct } from 'constructs';
|
|
14
|
+
/**
|
|
15
|
+
* A harness deployment unit: the role-scoped config (for the IAM role + container build)
|
|
16
|
+
* plus, when deploying via CDK, the full validated spec and its config directory.
|
|
17
|
+
*/
|
|
18
|
+
export interface HarnessDeploymentConfig extends HarnessRoleConfig {
|
|
19
|
+
/** Full validated harness spec — when present, the harness is synthesized as a CFN resource. */
|
|
20
|
+
readonly spec?: HarnessSpec;
|
|
21
|
+
/** Directory containing this harness's harness.json (for resolving a system-prompt file path). */
|
|
22
|
+
readonly harnessDir?: string;
|
|
23
|
+
}
|
|
11
24
|
export interface AgentCoreApplicationProps {
|
|
12
25
|
/**
|
|
13
26
|
* The full project specification (v2 schema).
|
|
14
27
|
*/
|
|
15
28
|
spec: AgentCoreProjectSpec;
|
|
16
29
|
/**
|
|
17
|
-
* Optional harness
|
|
18
|
-
* Each entry creates (or imports) an IAM execution role for a harness
|
|
30
|
+
* Optional harness configurations.
|
|
31
|
+
* Each entry creates (or imports) an IAM execution role for a harness, and — when a full
|
|
32
|
+
* `spec` is provided — synthesizes the `AWS::BedrockAgentCore::Harness` CFN resource.
|
|
33
|
+
*/
|
|
34
|
+
harnesses?: HarnessDeploymentConfig[];
|
|
35
|
+
/**
|
|
36
|
+
* Parsed connectorParameters for non-S3 KB data sources, keyed by the data
|
|
37
|
+
* source's `connectorConfigFile` path. Supplied by the caller (which reads
|
|
38
|
+
* the JSON files); forwarded to each AgentCoreKnowledgeBase. Optional —
|
|
39
|
+
* required only when a KB has non-S3 data sources.
|
|
19
40
|
*/
|
|
20
|
-
|
|
41
|
+
connectorParametersByFile?: Record<string, Record<string, unknown>>;
|
|
42
|
+
/**
|
|
43
|
+
* Deployed credential state for resolving credential names to ARNs.
|
|
44
|
+
* Used by harness skill git auth to look up credential provider ARNs at synth time.
|
|
45
|
+
*/
|
|
46
|
+
credentials?: Record<string, {
|
|
47
|
+
credentialProviderArn: string;
|
|
48
|
+
}>;
|
|
21
49
|
}
|
|
22
50
|
/**
|
|
23
51
|
* AgentCore Application L3 Construct - v2 resource-centric model.
|
|
@@ -40,17 +68,42 @@ export declare class AgentCoreApplication extends Construct {
|
|
|
40
68
|
readonly environments: Map<string, AgentEnvironment>;
|
|
41
69
|
/** Memories keyed by memory name */
|
|
42
70
|
readonly memories: Map<string, AgentCoreMemory>;
|
|
71
|
+
/**
|
|
72
|
+
* Knowledge bases keyed by KB name.
|
|
73
|
+
*
|
|
74
|
+
* Public so Wave 2 can resolve `knowledgeBaseId` when wiring connector
|
|
75
|
+
* gateway targets — `app.knowledgeBases.get(kbName).knowledgeBaseId`.
|
|
76
|
+
* Do not narrow this back to private without updating Wave 2's lookup
|
|
77
|
+
* path; the contract is consumed cross-construct.
|
|
78
|
+
*/
|
|
79
|
+
readonly knowledgeBases: Map<string, AgentCoreKnowledgeBase>;
|
|
43
80
|
/** Evaluators keyed by evaluator name */
|
|
44
81
|
readonly evaluators: Map<string, AgentCoreEvaluator>;
|
|
45
82
|
/** Online evaluation configs keyed by config name */
|
|
46
83
|
readonly onlineEvalConfigs: Map<string, AgentCoreOnlineEvaluationConfig>;
|
|
47
84
|
/** Policy engines keyed by engine name */
|
|
48
85
|
readonly policyEngines: Map<string, AgentCorePolicyEngine>;
|
|
86
|
+
/** Config bundles keyed by bundle name */
|
|
87
|
+
readonly configBundles: Map<string, AgentCoreConfigBundle>;
|
|
49
88
|
/** Datasets keyed by dataset name */
|
|
50
89
|
readonly datasets: Map<string, AgentCoreDataset>;
|
|
51
90
|
/** Harness roles keyed by harness name */
|
|
52
91
|
readonly harnessRoles: Map<string, AgentCoreHarnessRole>;
|
|
92
|
+
/** Harness CFN resources keyed by harness name (only those deployed via CDK with a full spec) */
|
|
93
|
+
readonly harnesses: Map<string, AgentCoreHarness>;
|
|
53
94
|
constructor(scope: Construct, id: string, props: AgentCoreApplicationProps);
|
|
95
|
+
/**
|
|
96
|
+
* Resolve a harness's referenced memory into the in-stack ARN token + the
|
|
97
|
+
* retrievalConfig derived from that memory's strategy namespaces.
|
|
98
|
+
* Direct ARN (`memory.arn`) takes precedence over a by-name reference.
|
|
99
|
+
*/
|
|
100
|
+
private resolveHarnessMemory;
|
|
101
|
+
/**
|
|
102
|
+
* Creates CloudFormation outputs for harnesses deployed via CDK.
|
|
103
|
+
* Per-harness: HarnessId, HarnessArn, Status, Version, AgentRuntimeArn.
|
|
104
|
+
* (The execution-role ARN output is emitted separately by AgentCoreHarnessRole.)
|
|
105
|
+
*/
|
|
106
|
+
private createHarnessOutputs;
|
|
54
107
|
/**
|
|
55
108
|
* Wire all memories to all agents in the project.
|
|
56
109
|
* In the v2 schema, all resources within a project have implicit access.
|
|
@@ -85,10 +138,27 @@ export declare class AgentCoreApplication extends Construct {
|
|
|
85
138
|
* Produces per-dataset outputs (Id, Arn).
|
|
86
139
|
*/
|
|
87
140
|
private createDatasetOutputs;
|
|
141
|
+
/**
|
|
142
|
+
* Creates CloudFormation outputs for knowledge bases and their data sources.
|
|
143
|
+
*
|
|
144
|
+
* Per-KB outputs: Id, Arn.
|
|
145
|
+
* Per-DS outputs: DataSourceN.Id and DataSourceN.Uri, where N is the index
|
|
146
|
+
* into the local `dataSources[]` array. Consumers (e.g. the CLI post-deploy
|
|
147
|
+
* hook) read these to map local URI → deployed DS id deterministically
|
|
148
|
+
* instead of parsing physical names.
|
|
149
|
+
*/
|
|
150
|
+
private createKnowledgeBaseOutputs;
|
|
88
151
|
/**
|
|
89
152
|
* Creates CloudFormation outputs for policy engines and their policies.
|
|
90
153
|
* Produces per-engine outputs (Id, Arn) and per-policy outputs (Id, Arn).
|
|
91
154
|
*/
|
|
92
155
|
private createPolicyOutputs;
|
|
156
|
+
private createConfigBundleOutputs;
|
|
157
|
+
/**
|
|
158
|
+
* Resolve placeholder component keys (e.g., {{runtime:name}}, {{gateway:name}})
|
|
159
|
+
* to CDK token references from already-created constructs.
|
|
160
|
+
*/
|
|
161
|
+
private resolveConfigBundleComponents;
|
|
162
|
+
private resolveComponentKey;
|
|
93
163
|
}
|
|
94
164
|
//# sourceMappingURL=AgentCoreApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentCoreApplication.d.ts","sourceRoot":"","sources":["../../../../src/cdk/constructs/l3/AgentCoreApplication.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"AgentCoreApplication.d.ts","sourceRoot":"","sources":["../../../../src/cdk/constructs/l3/AgentCoreApplication.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAc,WAAW,EAAU,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F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