@aws/nx-plugin 1.0.0-rc.12 → 1.0.0-rc.13
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/LICENSE-THIRD-PARTY +81 -3
- package/package.json +2 -2
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +9 -9
- package/src/preset/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/py/agent/__snapshots__/generator.spec.ts.snap +574 -5
- package/src/py/agent/files/http/init.py.template +5 -23
- package/src/py/agent/generator.js +27 -22
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +5 -22
- package/src/py/fast-api/files/app/__name__/init.py.template +5 -22
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +564 -0
- package/src/ts/agent/generator.js +23 -19
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +86 -39
- package/src/utils/agent-chat/agent-chat.d.ts +31 -0
- package/src/utils/agent-chat/agent-chat.js +30 -0
- package/src/utils/agent-chat/agent-chat.js.map +1 -0
- package/src/utils/agent-chat/files/a2a/chat.ts.template +33 -0
- package/src/utils/agent-chat/files/ag-ui/chat.ts.template +17 -0
- package/src/utils/agent-chat/files/common/agentcore.ts.template +81 -0
- package/src/utils/agent-chat/files/http-py/chat.ts.template +43 -0
- package/src/utils/agent-chat/files/http-ts/chat.ts.template +54 -0
- package/src/utils/versions.d.ts +44 -44
- package/src/utils/versions.js +43 -43
- package/src/utils/versions.js.map +1 -1
- package/src/py/agent/scripts/http/chat.ts.template +0 -38
- package/src/ts/agent/scripts/http/chat.ts.template +0 -35
|
@@ -1,5 +1,569 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
+
exports[`ts#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with cognito auth > agentcore.ts (a2a, cognito) 1`] = `
|
|
4
|
+
"// Resolves the deployed TestProjectAgent agent from runtime config and authenticates requests to it.
|
|
5
|
+
import { randomUUID } from 'node:crypto';
|
|
6
|
+
import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
|
|
7
|
+
|
|
8
|
+
const SESSION_HEADER = 'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id';
|
|
9
|
+
|
|
10
|
+
// AgentCore session ids must be at least 33 characters.
|
|
11
|
+
export const SESSION_ID = randomUUID().replaceAll('-', '').padEnd(33, '0');
|
|
12
|
+
|
|
13
|
+
export interface RemoteAgent {
|
|
14
|
+
/** ARN of the deployed Bedrock AgentCore runtime. */
|
|
15
|
+
arn: string;
|
|
16
|
+
/** AWS region parsed from the runtime ARN. */
|
|
17
|
+
region: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Returns the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set, otherwise \`undefined\` to chat locally.
|
|
21
|
+
export const resolveRemoteAgent = async (): Promise<
|
|
22
|
+
RemoteAgent | undefined
|
|
23
|
+
> => {
|
|
24
|
+
const application = process.env.RUNTIME_CONFIG_APP_ID;
|
|
25
|
+
if (!application) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const config = (await getAppConfig('agentcore', {
|
|
29
|
+
application,
|
|
30
|
+
environment: 'default',
|
|
31
|
+
transform: 'json',
|
|
32
|
+
})) as { agentRuntimes?: Record<string, string> };
|
|
33
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
34
|
+
if (!arn) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return { arn, region: arn.split(':')[3] };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** The Cognito access token used to authenticate with the deployed agent. */
|
|
43
|
+
export const getAccessToken = (): string => {
|
|
44
|
+
const accessToken = process.env.AGENT_ACCESS_TOKEN;
|
|
45
|
+
if (!accessToken) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
'AGENT_ACCESS_TOKEN is not set. Provide a Cognito access token to chat with the deployed agent.',
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return accessToken;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// A \`fetch\` that authenticates requests to the deployed agent and forwards the session id.
|
|
54
|
+
export const createAgentCoreFetch = (): typeof fetch => {
|
|
55
|
+
const accessToken = getAccessToken();
|
|
56
|
+
return (input, init) => {
|
|
57
|
+
const headers = new Headers(init?.headers);
|
|
58
|
+
headers.set(SESSION_HEADER, SESSION_ID);
|
|
59
|
+
headers.set('Authorization', \`Bearer \${accessToken}\`);
|
|
60
|
+
return fetch(input, { ...init, headers });
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
"
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
exports[`ts#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with cognito auth > chat.ts (a2a, cognito) 1`] = `
|
|
67
|
+
"// Chat CLI for TestProjectAgent (A2A protocol). Connects to the local
|
|
68
|
+
// \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
69
|
+
import {
|
|
70
|
+
ClientFactory,
|
|
71
|
+
ClientFactoryOptions,
|
|
72
|
+
DefaultAgentCardResolver,
|
|
73
|
+
JsonRpcTransportFactory,
|
|
74
|
+
} from '@a2a-js/sdk/client';
|
|
75
|
+
import { A2AChatAdapter, chatLoop } from 'agent-chat-cli';
|
|
76
|
+
import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
|
|
77
|
+
|
|
78
|
+
const remote = await resolveRemoteAgent();
|
|
79
|
+
|
|
80
|
+
const url = remote
|
|
81
|
+
? \`https://bedrock-agentcore.\${remote.region}.amazonaws.com/runtimes/\${encodeURIComponent(remote.arn)}/invocations/\`
|
|
82
|
+
: process.env.URL!;
|
|
83
|
+
|
|
84
|
+
// Remote requests are authenticated via a custom fetch; locally the default client talks plain HTTP.
|
|
85
|
+
const clientFactory = remote
|
|
86
|
+
? new ClientFactory({
|
|
87
|
+
...ClientFactoryOptions.default,
|
|
88
|
+
transports: [
|
|
89
|
+
new JsonRpcTransportFactory({
|
|
90
|
+
fetchImpl: createAgentCoreFetch(),
|
|
91
|
+
}),
|
|
92
|
+
],
|
|
93
|
+
cardResolver: new DefaultAgentCardResolver({
|
|
94
|
+
fetchImpl: createAgentCoreFetch(),
|
|
95
|
+
}),
|
|
96
|
+
})
|
|
97
|
+
: undefined;
|
|
98
|
+
|
|
99
|
+
await chatLoop(new A2AChatAdapter({ clientFactory }), url);
|
|
100
|
+
"
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`ts#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with iam auth > agentcore.ts (a2a, iam) 1`] = `
|
|
104
|
+
"// Resolves the deployed TestProjectAgent agent from runtime config and authenticates requests to it.
|
|
105
|
+
import { randomUUID } from 'node:crypto';
|
|
106
|
+
import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
|
|
107
|
+
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
108
|
+
import { AwsClient } from 'aws4fetch';
|
|
109
|
+
|
|
110
|
+
const SESSION_HEADER = 'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id';
|
|
111
|
+
|
|
112
|
+
// AgentCore session ids must be at least 33 characters.
|
|
113
|
+
export const SESSION_ID = randomUUID().replaceAll('-', '').padEnd(33, '0');
|
|
114
|
+
|
|
115
|
+
export interface RemoteAgent {
|
|
116
|
+
/** ARN of the deployed Bedrock AgentCore runtime. */
|
|
117
|
+
arn: string;
|
|
118
|
+
/** AWS region parsed from the runtime ARN. */
|
|
119
|
+
region: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Returns the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set, otherwise \`undefined\` to chat locally.
|
|
123
|
+
export const resolveRemoteAgent = async (): Promise<
|
|
124
|
+
RemoteAgent | undefined
|
|
125
|
+
> => {
|
|
126
|
+
const application = process.env.RUNTIME_CONFIG_APP_ID;
|
|
127
|
+
if (!application) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const config = (await getAppConfig('agentcore', {
|
|
131
|
+
application,
|
|
132
|
+
environment: 'default',
|
|
133
|
+
transform: 'json',
|
|
134
|
+
})) as { agentRuntimes?: Record<string, string> };
|
|
135
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
136
|
+
if (!arn) {
|
|
137
|
+
throw new Error(
|
|
138
|
+
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
return { arn, region: arn.split(':')[3] };
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// A \`fetch\` that authenticates requests to the deployed agent and forwards the session id.
|
|
145
|
+
export const createAgentCoreFetch = (region: string): typeof fetch => {
|
|
146
|
+
const credentialProvider = fromNodeProviderChain();
|
|
147
|
+
return async (input, init) => {
|
|
148
|
+
const headers = new Headers(init?.headers);
|
|
149
|
+
headers.set(SESSION_HEADER, SESSION_ID);
|
|
150
|
+
const client = new AwsClient({
|
|
151
|
+
...(await credentialProvider()),
|
|
152
|
+
service: 'bedrock-agentcore',
|
|
153
|
+
region,
|
|
154
|
+
});
|
|
155
|
+
return client.fetch(input, { ...init, headers });
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
"
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
exports[`ts#agent generator > chat scripts for a2a protocol > should match snapshot for chat scripts with iam auth > chat.ts (a2a, iam) 1`] = `
|
|
162
|
+
"// Chat CLI for TestProjectAgent (A2A protocol). Connects to the local
|
|
163
|
+
// \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
164
|
+
import {
|
|
165
|
+
ClientFactory,
|
|
166
|
+
ClientFactoryOptions,
|
|
167
|
+
DefaultAgentCardResolver,
|
|
168
|
+
JsonRpcTransportFactory,
|
|
169
|
+
} from '@a2a-js/sdk/client';
|
|
170
|
+
import { A2AChatAdapter, chatLoop } from 'agent-chat-cli';
|
|
171
|
+
import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
|
|
172
|
+
|
|
173
|
+
const remote = await resolveRemoteAgent();
|
|
174
|
+
|
|
175
|
+
const url = remote
|
|
176
|
+
? \`https://bedrock-agentcore.\${remote.region}.amazonaws.com/runtimes/\${encodeURIComponent(remote.arn)}/invocations/\`
|
|
177
|
+
: process.env.URL!;
|
|
178
|
+
|
|
179
|
+
// Remote requests are authenticated via a custom fetch; locally the default client talks plain HTTP.
|
|
180
|
+
const clientFactory = remote
|
|
181
|
+
? new ClientFactory({
|
|
182
|
+
...ClientFactoryOptions.default,
|
|
183
|
+
transports: [
|
|
184
|
+
new JsonRpcTransportFactory({
|
|
185
|
+
fetchImpl: createAgentCoreFetch(remote.region),
|
|
186
|
+
}),
|
|
187
|
+
],
|
|
188
|
+
cardResolver: new DefaultAgentCardResolver({
|
|
189
|
+
fetchImpl: createAgentCoreFetch(remote.region),
|
|
190
|
+
}),
|
|
191
|
+
})
|
|
192
|
+
: undefined;
|
|
193
|
+
|
|
194
|
+
await chatLoop(new A2AChatAdapter({ clientFactory }), url);
|
|
195
|
+
"
|
|
196
|
+
`;
|
|
197
|
+
|
|
198
|
+
exports[`ts#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with cognito auth > agentcore.ts (ag-ui, cognito) 1`] = `
|
|
199
|
+
"// Resolves the deployed TestProjectAgent agent from runtime config and authenticates requests to it.
|
|
200
|
+
import { randomUUID } from 'node:crypto';
|
|
201
|
+
import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
|
|
202
|
+
|
|
203
|
+
const SESSION_HEADER = 'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id';
|
|
204
|
+
|
|
205
|
+
// AgentCore session ids must be at least 33 characters.
|
|
206
|
+
export const SESSION_ID = randomUUID().replaceAll('-', '').padEnd(33, '0');
|
|
207
|
+
|
|
208
|
+
export interface RemoteAgent {
|
|
209
|
+
/** ARN of the deployed Bedrock AgentCore runtime. */
|
|
210
|
+
arn: string;
|
|
211
|
+
/** AWS region parsed from the runtime ARN. */
|
|
212
|
+
region: string;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Returns the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set, otherwise \`undefined\` to chat locally.
|
|
216
|
+
export const resolveRemoteAgent = async (): Promise<
|
|
217
|
+
RemoteAgent | undefined
|
|
218
|
+
> => {
|
|
219
|
+
const application = process.env.RUNTIME_CONFIG_APP_ID;
|
|
220
|
+
if (!application) {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
const config = (await getAppConfig('agentcore', {
|
|
224
|
+
application,
|
|
225
|
+
environment: 'default',
|
|
226
|
+
transform: 'json',
|
|
227
|
+
})) as { agentRuntimes?: Record<string, string> };
|
|
228
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
229
|
+
if (!arn) {
|
|
230
|
+
throw new Error(
|
|
231
|
+
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
return { arn, region: arn.split(':')[3] };
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/** The Cognito access token used to authenticate with the deployed agent. */
|
|
238
|
+
export const getAccessToken = (): string => {
|
|
239
|
+
const accessToken = process.env.AGENT_ACCESS_TOKEN;
|
|
240
|
+
if (!accessToken) {
|
|
241
|
+
throw new Error(
|
|
242
|
+
'AGENT_ACCESS_TOKEN is not set. Provide a Cognito access token to chat with the deployed agent.',
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
return accessToken;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// A \`fetch\` that authenticates requests to the deployed agent and forwards the session id.
|
|
249
|
+
export const createAgentCoreFetch = (): typeof fetch => {
|
|
250
|
+
const accessToken = getAccessToken();
|
|
251
|
+
return (input, init) => {
|
|
252
|
+
const headers = new Headers(init?.headers);
|
|
253
|
+
headers.set(SESSION_HEADER, SESSION_ID);
|
|
254
|
+
headers.set('Authorization', \`Bearer \${accessToken}\`);
|
|
255
|
+
return fetch(input, { ...init, headers });
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
"
|
|
259
|
+
`;
|
|
260
|
+
|
|
261
|
+
exports[`ts#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with cognito auth > chat.ts (ag-ui, cognito) 1`] = `
|
|
262
|
+
"// Chat CLI for TestProjectAgent (AG-UI protocol). Connects to the local
|
|
263
|
+
// \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
264
|
+
import { AGUIChatAdapter, chatLoop } from 'agent-chat-cli';
|
|
265
|
+
import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
|
|
266
|
+
|
|
267
|
+
const remote = await resolveRemoteAgent();
|
|
268
|
+
|
|
269
|
+
const url = remote
|
|
270
|
+
? \`https://bedrock-agentcore.\${remote.region}.amazonaws.com/runtimes/\${encodeURIComponent(remote.arn)}/invocations?qualifier=DEFAULT\`
|
|
271
|
+
: process.env.URL!;
|
|
272
|
+
|
|
273
|
+
// Remote requests are authenticated via a custom fetch; locally the default agent talks plain HTTP.
|
|
274
|
+
const fetchImpl = remote ? createAgentCoreFetch() : undefined;
|
|
275
|
+
|
|
276
|
+
await chatLoop(new AGUIChatAdapter({ fetch: fetchImpl }), url);
|
|
277
|
+
"
|
|
278
|
+
`;
|
|
279
|
+
|
|
280
|
+
exports[`ts#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with iam auth > agentcore.ts (ag-ui, iam) 1`] = `
|
|
281
|
+
"// Resolves the deployed TestProjectAgent agent from runtime config and authenticates requests to it.
|
|
282
|
+
import { randomUUID } from 'node:crypto';
|
|
283
|
+
import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
|
|
284
|
+
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
285
|
+
import { AwsClient } from 'aws4fetch';
|
|
286
|
+
|
|
287
|
+
const SESSION_HEADER = 'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id';
|
|
288
|
+
|
|
289
|
+
// AgentCore session ids must be at least 33 characters.
|
|
290
|
+
export const SESSION_ID = randomUUID().replaceAll('-', '').padEnd(33, '0');
|
|
291
|
+
|
|
292
|
+
export interface RemoteAgent {
|
|
293
|
+
/** ARN of the deployed Bedrock AgentCore runtime. */
|
|
294
|
+
arn: string;
|
|
295
|
+
/** AWS region parsed from the runtime ARN. */
|
|
296
|
+
region: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Returns the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set, otherwise \`undefined\` to chat locally.
|
|
300
|
+
export const resolveRemoteAgent = async (): Promise<
|
|
301
|
+
RemoteAgent | undefined
|
|
302
|
+
> => {
|
|
303
|
+
const application = process.env.RUNTIME_CONFIG_APP_ID;
|
|
304
|
+
if (!application) {
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
const config = (await getAppConfig('agentcore', {
|
|
308
|
+
application,
|
|
309
|
+
environment: 'default',
|
|
310
|
+
transform: 'json',
|
|
311
|
+
})) as { agentRuntimes?: Record<string, string> };
|
|
312
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
313
|
+
if (!arn) {
|
|
314
|
+
throw new Error(
|
|
315
|
+
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
return { arn, region: arn.split(':')[3] };
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// A \`fetch\` that authenticates requests to the deployed agent and forwards the session id.
|
|
322
|
+
export const createAgentCoreFetch = (region: string): typeof fetch => {
|
|
323
|
+
const credentialProvider = fromNodeProviderChain();
|
|
324
|
+
return async (input, init) => {
|
|
325
|
+
const headers = new Headers(init?.headers);
|
|
326
|
+
headers.set(SESSION_HEADER, SESSION_ID);
|
|
327
|
+
const client = new AwsClient({
|
|
328
|
+
...(await credentialProvider()),
|
|
329
|
+
service: 'bedrock-agentcore',
|
|
330
|
+
region,
|
|
331
|
+
});
|
|
332
|
+
return client.fetch(input, { ...init, headers });
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
"
|
|
336
|
+
`;
|
|
337
|
+
|
|
338
|
+
exports[`ts#agent generator > chat scripts for ag-ui protocol > should match snapshot for chat scripts with iam auth > chat.ts (ag-ui, iam) 1`] = `
|
|
339
|
+
"// Chat CLI for TestProjectAgent (AG-UI protocol). Connects to the local
|
|
340
|
+
// \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
341
|
+
import { AGUIChatAdapter, chatLoop } from 'agent-chat-cli';
|
|
342
|
+
import { createAgentCoreFetch, resolveRemoteAgent } from './agentcore.js';
|
|
343
|
+
|
|
344
|
+
const remote = await resolveRemoteAgent();
|
|
345
|
+
|
|
346
|
+
const url = remote
|
|
347
|
+
? \`https://bedrock-agentcore.\${remote.region}.amazonaws.com/runtimes/\${encodeURIComponent(remote.arn)}/invocations?qualifier=DEFAULT\`
|
|
348
|
+
: process.env.URL!;
|
|
349
|
+
|
|
350
|
+
// Remote requests are authenticated via a custom fetch; locally the default agent talks plain HTTP.
|
|
351
|
+
const fetchImpl = remote ? createAgentCoreFetch(remote.region) : undefined;
|
|
352
|
+
|
|
353
|
+
await chatLoop(new AGUIChatAdapter({ fetch: fetchImpl }), url);
|
|
354
|
+
"
|
|
355
|
+
`;
|
|
356
|
+
|
|
357
|
+
exports[`ts#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with cognito auth > agentcore.ts (http, cognito) 1`] = `
|
|
358
|
+
"// Resolves the deployed TestProjectAgent agent from runtime config and authenticates requests to it.
|
|
359
|
+
import { randomUUID } from 'node:crypto';
|
|
360
|
+
import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
|
|
361
|
+
|
|
362
|
+
const SESSION_HEADER = 'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id';
|
|
363
|
+
|
|
364
|
+
// AgentCore session ids must be at least 33 characters.
|
|
365
|
+
export const SESSION_ID = randomUUID().replaceAll('-', '').padEnd(33, '0');
|
|
366
|
+
|
|
367
|
+
export interface RemoteAgent {
|
|
368
|
+
/** ARN of the deployed Bedrock AgentCore runtime. */
|
|
369
|
+
arn: string;
|
|
370
|
+
/** AWS region parsed from the runtime ARN. */
|
|
371
|
+
region: string;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Returns the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set, otherwise \`undefined\` to chat locally.
|
|
375
|
+
export const resolveRemoteAgent = async (): Promise<
|
|
376
|
+
RemoteAgent | undefined
|
|
377
|
+
> => {
|
|
378
|
+
const application = process.env.RUNTIME_CONFIG_APP_ID;
|
|
379
|
+
if (!application) {
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
const config = (await getAppConfig('agentcore', {
|
|
383
|
+
application,
|
|
384
|
+
environment: 'default',
|
|
385
|
+
transform: 'json',
|
|
386
|
+
})) as { agentRuntimes?: Record<string, string> };
|
|
387
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
388
|
+
if (!arn) {
|
|
389
|
+
throw new Error(
|
|
390
|
+
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
return { arn, region: arn.split(':')[3] };
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/** The Cognito access token used to authenticate with the deployed agent. */
|
|
397
|
+
export const getAccessToken = (): string => {
|
|
398
|
+
const accessToken = process.env.AGENT_ACCESS_TOKEN;
|
|
399
|
+
if (!accessToken) {
|
|
400
|
+
throw new Error(
|
|
401
|
+
'AGENT_ACCESS_TOKEN is not set. Provide a Cognito access token to chat with the deployed agent.',
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
return accessToken;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// A \`fetch\` that authenticates requests to the deployed agent and forwards the session id.
|
|
408
|
+
export const createAgentCoreFetch = (): typeof fetch => {
|
|
409
|
+
const accessToken = getAccessToken();
|
|
410
|
+
return (input, init) => {
|
|
411
|
+
const headers = new Headers(init?.headers);
|
|
412
|
+
headers.set(SESSION_HEADER, SESSION_ID);
|
|
413
|
+
headers.set('Authorization', \`Bearer \${accessToken}\`);
|
|
414
|
+
return fetch(input, { ...init, headers });
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
"
|
|
418
|
+
`;
|
|
419
|
+
|
|
420
|
+
exports[`ts#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with cognito auth > chat.ts (http, cognito) 1`] = `
|
|
421
|
+
"// Chat CLI for TestProjectAgent (HTTP / tRPC WebSocket). Connects to the local
|
|
422
|
+
// \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
423
|
+
import { chatLoop, type ChatAdapter } from 'agent-chat-cli';
|
|
424
|
+
import { TestProjectAgentClient } from '../../src/agent/client.js';
|
|
425
|
+
import { resolveRemoteAgent, SESSION_ID, getAccessToken } from './agentcore.js';
|
|
426
|
+
|
|
427
|
+
const remote = await resolveRemoteAgent();
|
|
428
|
+
|
|
429
|
+
class TrpcWebSocketAdapter implements ChatAdapter {
|
|
430
|
+
private client!: ReturnType<typeof TestProjectAgentClient.local>;
|
|
431
|
+
|
|
432
|
+
async connect(url: string) {
|
|
433
|
+
this.client = remote
|
|
434
|
+
? TestProjectAgentClient.withJwtAuth({
|
|
435
|
+
agentRuntimeArn: remote.arn,
|
|
436
|
+
sessionId: SESSION_ID,
|
|
437
|
+
accessTokenProvider: async () => getAccessToken(),
|
|
438
|
+
})
|
|
439
|
+
: TestProjectAgentClient.local({ url, sessionId: SESSION_ID });
|
|
440
|
+
return { agentName: 'TestProjectAgent' };
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
async *sendMessage(text: string): AsyncIterable<string> {
|
|
444
|
+
const stream = new ReadableStream<string>({
|
|
445
|
+
start: (controller) => {
|
|
446
|
+
this.client.invoke.subscribe(
|
|
447
|
+
{ message: text },
|
|
448
|
+
{
|
|
449
|
+
onData: (chunk: string) => controller.enqueue(chunk),
|
|
450
|
+
onComplete: () => controller.close(),
|
|
451
|
+
onError: (err: unknown) => controller.error(err),
|
|
452
|
+
},
|
|
453
|
+
);
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
yield* stream as unknown as AsyncIterable<string>;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
await chatLoop(new TrpcWebSocketAdapter(), process.env.URL ?? '');
|
|
462
|
+
"
|
|
463
|
+
`;
|
|
464
|
+
|
|
465
|
+
exports[`ts#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with iam auth > agentcore.ts (http, iam) 1`] = `
|
|
466
|
+
"// Resolves the deployed TestProjectAgent agent from runtime config and authenticates requests to it.
|
|
467
|
+
import { randomUUID } from 'node:crypto';
|
|
468
|
+
import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
|
|
469
|
+
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
470
|
+
import { AwsClient } from 'aws4fetch';
|
|
471
|
+
|
|
472
|
+
const SESSION_HEADER = 'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id';
|
|
473
|
+
|
|
474
|
+
// AgentCore session ids must be at least 33 characters.
|
|
475
|
+
export const SESSION_ID = randomUUID().replaceAll('-', '').padEnd(33, '0');
|
|
476
|
+
|
|
477
|
+
export interface RemoteAgent {
|
|
478
|
+
/** ARN of the deployed Bedrock AgentCore runtime. */
|
|
479
|
+
arn: string;
|
|
480
|
+
/** AWS region parsed from the runtime ARN. */
|
|
481
|
+
region: string;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// Returns the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set, otherwise \`undefined\` to chat locally.
|
|
485
|
+
export const resolveRemoteAgent = async (): Promise<
|
|
486
|
+
RemoteAgent | undefined
|
|
487
|
+
> => {
|
|
488
|
+
const application = process.env.RUNTIME_CONFIG_APP_ID;
|
|
489
|
+
if (!application) {
|
|
490
|
+
return undefined;
|
|
491
|
+
}
|
|
492
|
+
const config = (await getAppConfig('agentcore', {
|
|
493
|
+
application,
|
|
494
|
+
environment: 'default',
|
|
495
|
+
transform: 'json',
|
|
496
|
+
})) as { agentRuntimes?: Record<string, string> };
|
|
497
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
498
|
+
if (!arn) {
|
|
499
|
+
throw new Error(
|
|
500
|
+
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
return { arn, region: arn.split(':')[3] };
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
// A \`fetch\` that authenticates requests to the deployed agent and forwards the session id.
|
|
507
|
+
export const createAgentCoreFetch = (region: string): typeof fetch => {
|
|
508
|
+
const credentialProvider = fromNodeProviderChain();
|
|
509
|
+
return async (input, init) => {
|
|
510
|
+
const headers = new Headers(init?.headers);
|
|
511
|
+
headers.set(SESSION_HEADER, SESSION_ID);
|
|
512
|
+
const client = new AwsClient({
|
|
513
|
+
...(await credentialProvider()),
|
|
514
|
+
service: 'bedrock-agentcore',
|
|
515
|
+
region,
|
|
516
|
+
});
|
|
517
|
+
return client.fetch(input, { ...init, headers });
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
"
|
|
521
|
+
`;
|
|
522
|
+
|
|
523
|
+
exports[`ts#agent generator > chat scripts for http protocol > should match snapshot for chat scripts with iam auth > chat.ts (http, iam) 1`] = `
|
|
524
|
+
"// Chat CLI for TestProjectAgent (HTTP / tRPC WebSocket). Connects to the local
|
|
525
|
+
// \`serve-local\` server, or the deployed agent when \`RUNTIME_CONFIG_APP_ID\` is set.
|
|
526
|
+
import { chatLoop, type ChatAdapter } from 'agent-chat-cli';
|
|
527
|
+
import { TestProjectAgentClient } from '../../src/agent/client.js';
|
|
528
|
+
import { resolveRemoteAgent, SESSION_ID } from './agentcore.js';
|
|
529
|
+
|
|
530
|
+
const remote = await resolveRemoteAgent();
|
|
531
|
+
|
|
532
|
+
class TrpcWebSocketAdapter implements ChatAdapter {
|
|
533
|
+
private client!: ReturnType<typeof TestProjectAgentClient.local>;
|
|
534
|
+
|
|
535
|
+
async connect(url: string) {
|
|
536
|
+
this.client = remote
|
|
537
|
+
? TestProjectAgentClient.withIamAuth({
|
|
538
|
+
agentRuntimeArn: remote.arn,
|
|
539
|
+
sessionId: SESSION_ID,
|
|
540
|
+
})
|
|
541
|
+
: TestProjectAgentClient.local({ url, sessionId: SESSION_ID });
|
|
542
|
+
return { agentName: 'TestProjectAgent' };
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
async *sendMessage(text: string): AsyncIterable<string> {
|
|
546
|
+
const stream = new ReadableStream<string>({
|
|
547
|
+
start: (controller) => {
|
|
548
|
+
this.client.invoke.subscribe(
|
|
549
|
+
{ message: text },
|
|
550
|
+
{
|
|
551
|
+
onData: (chunk: string) => controller.enqueue(chunk),
|
|
552
|
+
onComplete: () => controller.close(),
|
|
553
|
+
onError: (err: unknown) => controller.error(err),
|
|
554
|
+
},
|
|
555
|
+
);
|
|
556
|
+
},
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
yield* stream as unknown as AsyncIterable<string>;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
await chatLoop(new TrpcWebSocketAdapter(), process.env.URL ?? '');
|
|
564
|
+
"
|
|
565
|
+
`;
|
|
566
|
+
|
|
3
567
|
exports[`ts#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agent-Dockerfile 1`] = `
|
|
4
568
|
"FROM public.ecr.aws/docker/library/node:lts-jod
|
|
5
569
|
|
|
@@ -6,6 +6,7 @@ exports.tsAgentGenerator = exports.TS_AGENT_GENERATOR_INFO = void 0;
|
|
|
6
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
7
|
*/
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
+
const agent_chat_1 = require("../../utils/agent-chat/agent-chat");
|
|
9
10
|
const agent_connection_1 = require("../../utils/agent-connection/agent-connection");
|
|
10
11
|
const agent_core_constructs_1 = require("../../utils/agent-core-constructs/agent-core-constructs");
|
|
11
12
|
const bundle_1 = require("../../utils/bundle/bundle");
|
|
@@ -132,9 +133,18 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
132
133
|
'aws4fetch',
|
|
133
134
|
]),
|
|
134
135
|
]), (0, versions_1.withVersions)([
|
|
136
|
+
// The chat CLI runs standalone via tsx for every protocol, and resolves
|
|
137
|
+
// the deployed agent from AppConfig when `RUNTIME_CONFIG_APP_ID` is set.
|
|
135
138
|
'tsx',
|
|
136
139
|
'@types/node',
|
|
137
140
|
'agent-chat-cli',
|
|
141
|
+
'@aws-lambda-powertools/parameters',
|
|
142
|
+
'@aws-sdk/client-appconfigdata',
|
|
143
|
+
...(auth === 'iam'
|
|
144
|
+
? ['aws4fetch', '@aws-sdk/credential-providers']
|
|
145
|
+
: []),
|
|
146
|
+
// A2A chat builds a signed @a2a-js client factory for the deployed agent.
|
|
147
|
+
...(protocol === 'a2a' ? ['@a2a-js/sdk'] : []),
|
|
138
148
|
...(protocol === 'a2a' || protocol === 'ag-ui'
|
|
139
149
|
? ['@types/express', '@types/cors']
|
|
140
150
|
: ['@types/ws', '@types/cors']),
|
|
@@ -145,29 +155,24 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
145
155
|
const localDevPort = (0, port_1.assignPort)(tree, project, localDevPortStart, {
|
|
146
156
|
component: { info: exports.TS_AGENT_GENERATOR_INFO, name: agentTargetPrefix },
|
|
147
157
|
});
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
158
|
+
// Every protocol gets a standalone `chat.ts`. It connects to the local
|
|
159
|
+
// `serve-local` server by default, or to the deployed agent (with the
|
|
160
|
+
// appropriate auth) when `RUNTIME_CONFIG_APP_ID` is set.
|
|
161
|
+
const scriptsDir = (0, devkit_1.joinPathFragments)(project.root, 'scripts', agentTargetPrefix);
|
|
162
|
+
(0, agent_chat_1.addAgentChatScripts)(tree, {
|
|
163
|
+
scriptsDir,
|
|
164
|
+
protocol,
|
|
165
|
+
language: 'ts',
|
|
166
|
+
agentNameClassName,
|
|
167
|
+
auth,
|
|
168
|
+
relativeAgentImport: `../../${targetSourceDirRelativeToProjectRoot}`,
|
|
169
|
+
});
|
|
161
170
|
const chatUrl = protocol === 'http'
|
|
162
171
|
? `ws://localhost:${localDevPort}/ws`
|
|
163
172
|
: protocol === 'ag-ui'
|
|
164
173
|
? `http://localhost:${localDevPort}/invocations`
|
|
165
174
|
: `http://localhost:${localDevPort}`;
|
|
166
|
-
const chatCommand =
|
|
167
|
-
? `tsx ./scripts/${agentTargetPrefix}/chat.ts`
|
|
168
|
-
: protocol === 'ag-ui'
|
|
169
|
-
? `agent-chat-cli agui ${chatUrl}`
|
|
170
|
-
: `agent-chat-cli a2a ${chatUrl}`;
|
|
175
|
+
const chatCommand = `tsx ./scripts/${agentTargetPrefix}/chat.ts`;
|
|
171
176
|
(0, devkit_1.updateProjectConfiguration)(tree, project.name, {
|
|
172
177
|
...project,
|
|
173
178
|
// Sort targets so their order is stable regardless of insertion order on
|
|
@@ -206,7 +211,6 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
206
211
|
URL: chatUrl,
|
|
207
212
|
},
|
|
208
213
|
},
|
|
209
|
-
dependsOn: [`${agentTargetPrefix}-serve-local`],
|
|
210
214
|
},
|
|
211
215
|
}),
|
|
212
216
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/agent/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AACpB,oFAAuG;AACvG,mGAAwF;AACxF,sDAAsE;AACtE,uDAA2D;AAC3D,+CAA0D;AAC1D,uCAA4C;AAC5C,yCAA6C;AAC7C,iDAAsE;AACtE,6CAA2D;AAC3D,qDAAoD;AACpD,uCAMwB;AACxB,+CAAoD;AACpD,2CAA8C;AAC9C,qEAA0E;AAC1E,mDAAiE;AAGpD,QAAA,uBAAuB,GAClC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,gBAAgB,GAAG,KAAK,EACnC,IAAU,EACV,OAA+B,EACH,EAAE;IAC9B,MAAM,OAAO,GAAG,IAAA,wCAAmC,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,OAAO,wDAAwD,CAC/F,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,GAAG,IAAA,iBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC;IACxE,MAAM,IAAI,GAAG,IAAA,iBAAS,EAAC,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC,CAAC;IACpD,MAAM,kBAAkB,GAAG,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC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AW;YACvC,CAAC,CAAC,QAAQ,KAAK,OAAO;gBACpB,CAAC,CAAE;oBACC,oBAAoB;oBACpB,aAAa;oBACb,gBAAgB;oBAChB,SAAS;oBACT,MAAM;iBACG;gBACb,CAAC,CAAE;oBACC,cAAc;oBACd,cAAc;oBACd,IAAI;oBACJ,MAAM;oBACN,WAAW;iBACF,CAAC;KACnB,CAAC,EACF,IAAA,uBAAY,EAAC;QACX,KAAK;QACL,aAAa;QACb,gBAAgB;QAChB,GAAG,CAAC,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,OAAO;YAC5C,CAAC,CAAE,CAAC,gBAAgB,EAAE,aAAa,CAAW;YAC9C,CAAC,CAAE,CAAC,WAAW,EAAE,aAAa,CAAW,CAAC;KAC7C,CAAC,CACH,CAAC;IAEF,2FAA2F;IAC3F,sFAAsF;IACtF,MAAM,iBAAiB,GAAG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,MAAM,YAAY,GAAG,IAAA,iBAAU,EAAC,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE;QAChE,SAAS,EAAE,EAAE,IAAI,EAAE,+BAAuB,EAAE,IAAI,EAAE,iBAAiB,EAAE;KACtE,CAAC,CAAC;IAEH,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/agent/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AACpB,kEAAwE;AACxE,oFAAuG;AACvG,mGAAwF;AACxF,sDAAsE;AACtE,uDAA2D;AAC3D,+CAA0D;AAC1D,uCAA4C;AAC5C,yCAA6C;AAC7C,iDAAsE;AACtE,6CAA2D;AAC3D,qDAAoD;AACpD,uCAMwB;AACxB,+CAAoD;AACpD,2CAA8C;AAC9C,qEAA0E;AAC1E,mDAAiE;AAGpD,QAAA,uBAAuB,GAClC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CA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