@aws/nx-plugin 0.99.1 → 0.100.0
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 +14 -94
- package/generators.json +1 -0
- package/package.json +1 -1
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +10 -10
- package/src/py/mcp-server/files/deploy/Dockerfile.template +1 -1
- package/src/py/mcp-server/generator.js +10 -2
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +43 -12
- package/src/py/strands-agent/files/ag-ui/main.py.template +19 -0
- package/src/py/strands-agent/files/deploy/Dockerfile.template +3 -1
- package/src/py/strands-agent/generator.js +20 -7
- package/src/py/strands-agent/generator.js.map +1 -1
- package/src/py/strands-agent/react-connection/__snapshots__/generator.spec.ts.snap +133 -0
- package/src/py/strands-agent/react-connection/generator.js +69 -56
- package/src/py/strands-agent/react-connection/generator.js.map +1 -1
- package/src/py/strands-agent/react-connection/serve-local.d.ts +6 -2
- package/src/py/strands-agent/react-connection/serve-local.js +11 -6
- package/src/py/strands-agent/react-connection/serve-local.js.map +1 -1
- package/src/py/strands-agent/schema.d.ts +1 -1
- package/src/py/strands-agent/schema.json +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +10 -10
- package/src/ts/mcp-server/files/Dockerfile.template +1 -1
- package/src/ts/mcp-server/generator.js +9 -1
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/react-website/agui/files/src/components/AguiProvider.tsx.template +19 -0
- package/src/ts/react-website/agui/files/src/hooks/useAgui__agentNameClassName__.tsx.template +142 -0
- package/src/ts/react-website/agui/generator.d.ts +26 -0
- package/src/ts/react-website/agui/generator.js +98 -0
- package/src/ts/react-website/agui/generator.js.map +1 -0
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +49 -0
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +2 -0
- package/src/ts/strands-agent/__snapshots__/generator.spec.ts.snap +43 -12
- package/src/ts/strands-agent/files/deploy/Dockerfile.template +1 -1
- package/src/ts/strands-agent/generator.js +14 -1
- package/src/ts/strands-agent/generator.js.map +1 -1
- package/src/ts/strands-agent/schema.d.ts +1 -1
- package/src/ts/strands-agent/schema.json +2 -2
- package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +24 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +3 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js +2 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +26 -11
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +13 -1
- package/src/utils/files/common/constructs/src/core/index.ts.template +2 -1
- package/src/utils/files/common/constructs/src/core/workspace.ts.template +19 -0
- package/src/utils/versions.d.ts +6 -1
- package/src/utils/versions.js +5 -0
- package/src/utils/versions.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/Dockerfile.template +0 -1
|
@@ -220,3 +220,136 @@ export function Main() {
|
|
|
220
220
|
}
|
|
221
221
|
"
|
|
222
222
|
`;
|
|
223
|
+
|
|
224
|
+
exports[`py strands agent react connection generator - AG-UI protocol > should generate a shared AguiProvider and a per-agent hook for AG-UI agents > AguiProvider.tsx 1`] = `
|
|
225
|
+
"import { useAguiTestAgent } from '../hooks/useAguiTestAgent';
|
|
226
|
+
import { CopilotKitProvider } from '@copilotkit/react-core/v2';
|
|
227
|
+
import '@copilotkit/react-core/v2/styles.css';
|
|
228
|
+
import { type FC, type PropsWithChildren, useMemo } from 'react';
|
|
229
|
+
import type { AbstractAgent } from '@ag-ui/client';
|
|
230
|
+
|
|
231
|
+
export const AguiProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
232
|
+
const testAgentAgents = useAguiTestAgent();
|
|
233
|
+
const selfManagedAgents = useMemo<Record<string, AbstractAgent>>(
|
|
234
|
+
() => ({ ...testAgentAgents }),
|
|
235
|
+
[testAgentAgents],
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<CopilotKitProvider selfManagedAgents={selfManagedAgents}>
|
|
240
|
+
{children}
|
|
241
|
+
</CopilotKitProvider>
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export default AguiProvider;
|
|
246
|
+
"
|
|
247
|
+
`;
|
|
248
|
+
|
|
249
|
+
exports[`py strands agent react connection generator - AG-UI protocol > should generate a shared AguiProvider and a per-agent hook for AG-UI agents > useAguiTestAgent.tsx 1`] = `
|
|
250
|
+
"import { HttpAgent } from '@ag-ui/client';
|
|
251
|
+
import type { AbstractAgent, RunAgentInput } from '@ag-ui/client';
|
|
252
|
+
import { Observable } from 'rxjs';
|
|
253
|
+
import { useMemo } from 'react';
|
|
254
|
+
import { useRuntimeConfig } from './useRuntimeConfig';
|
|
255
|
+
import { useSigV4, type SigV4Client } from './useSigV4';
|
|
256
|
+
|
|
257
|
+
function buildAgentCoreUrl(agentRuntimeArn: string): string {
|
|
258
|
+
const region = agentRuntimeArn.split(':')[3];
|
|
259
|
+
return \`https://bedrock-agentcore.\${region}.amazonaws.com/runtimes/\${encodeURIComponent(agentRuntimeArn)}/invocations?qualifier=DEFAULT\`;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// AgentCore session ids must be at least 33 characters.
|
|
263
|
+
function agentCoreSessionId(input: RunAgentInput): string {
|
|
264
|
+
return (input.threadId ?? '').padEnd(33, '0');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class SigV4HttpAgent extends HttpAgent {
|
|
268
|
+
sigV4Client: SigV4Client;
|
|
269
|
+
|
|
270
|
+
constructor(
|
|
271
|
+
config: ConstructorParameters<typeof HttpAgent>[0],
|
|
272
|
+
sigV4Client: SigV4Client,
|
|
273
|
+
) {
|
|
274
|
+
super(config);
|
|
275
|
+
this.sigV4Client = sigV4Client;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
protected override requestInit(input: RunAgentInput): RequestInit {
|
|
279
|
+
const init = super.requestInit(input);
|
|
280
|
+
init.headers = {
|
|
281
|
+
...(init.headers as Record<string, string>),
|
|
282
|
+
'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id': agentCoreSessionId(input),
|
|
283
|
+
};
|
|
284
|
+
return init;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Remove this override once https://github.com/ag-ui-protocol/ag-ui/issues/1316 is fixed.
|
|
288
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
289
|
+
override run(input: RunAgentInput): any {
|
|
290
|
+
const sigV4Fetch = this.sigV4Client.fetch as typeof window.fetch;
|
|
291
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
292
|
+
return new Observable<any>((subscriber) => {
|
|
293
|
+
const originalFetch = window.fetch;
|
|
294
|
+
window.fetch = sigV4Fetch;
|
|
295
|
+
const sub = super.run(input).subscribe(subscriber);
|
|
296
|
+
window.fetch = originalFetch;
|
|
297
|
+
return () => sub.unsubscribe();
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
override clone(): SigV4HttpAgent {
|
|
302
|
+
const cloned = super.clone() as SigV4HttpAgent;
|
|
303
|
+
cloned.sigV4Client = this.sigV4Client;
|
|
304
|
+
return cloned;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export const useAguiTestAgent = (): Record<string, AbstractAgent> => {
|
|
309
|
+
const runtimeConfig = useRuntimeConfig();
|
|
310
|
+
const agentRuntimeValue = runtimeConfig.agentRuntimes.TestAgent;
|
|
311
|
+
const sigv4 = useSigV4();
|
|
312
|
+
|
|
313
|
+
const url = useMemo(
|
|
314
|
+
() =>
|
|
315
|
+
agentRuntimeValue.startsWith('arn:')
|
|
316
|
+
? buildAgentCoreUrl(agentRuntimeValue)
|
|
317
|
+
: agentRuntimeValue,
|
|
318
|
+
[agentRuntimeValue],
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
return useMemo((): Record<string, AbstractAgent> => {
|
|
322
|
+
const agent = new SigV4HttpAgent({ url }, sigv4);
|
|
323
|
+
|
|
324
|
+
return { agent: agent };
|
|
325
|
+
}, [url, sigv4]);
|
|
326
|
+
};
|
|
327
|
+
"
|
|
328
|
+
`;
|
|
329
|
+
|
|
330
|
+
exports[`py strands agent react connection generator - AG-UI protocol > should register multiple AG-UI agents in the shared AguiProvider > AguiProvider-multi-agent.tsx 1`] = `
|
|
331
|
+
"import { useAguiResearchAgent } from '../hooks/useAguiResearchAgent';
|
|
332
|
+
import { useAguiTestAgent } from '../hooks/useAguiTestAgent';
|
|
333
|
+
import { CopilotKitProvider } from '@copilotkit/react-core/v2';
|
|
334
|
+
import '@copilotkit/react-core/v2/styles.css';
|
|
335
|
+
import { type FC, type PropsWithChildren, useMemo } from 'react';
|
|
336
|
+
import type { AbstractAgent } from '@ag-ui/client';
|
|
337
|
+
|
|
338
|
+
export const AguiProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
339
|
+
const testAgentAgents = useAguiTestAgent();
|
|
340
|
+
const researchAgentAgents = useAguiResearchAgent();
|
|
341
|
+
const selfManagedAgents = useMemo<Record<string, AbstractAgent>>(
|
|
342
|
+
() => ({ ...testAgentAgents, ...researchAgentAgents }),
|
|
343
|
+
[testAgentAgents, researchAgentAgents],
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<CopilotKitProvider selfManagedAgents={selfManagedAgents}>
|
|
348
|
+
{children}
|
|
349
|
+
</CopilotKitProvider>
|
|
350
|
+
);
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
export default AguiProvider;
|
|
354
|
+
"
|
|
355
|
+
`;
|
|
@@ -14,6 +14,7 @@ const agent_runtime_config_1 = require("../../../connection/agent-runtime-config
|
|
|
14
14
|
const names_1 = require("../../../utils/names");
|
|
15
15
|
const object_1 = require("../../../utils/object");
|
|
16
16
|
const serve_local_1 = require("./serve-local");
|
|
17
|
+
const generator_1 = require("../../../ts/react-website/agui/generator");
|
|
17
18
|
exports.PY_STRANDS_AGENT_REACT_CONNECTION_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
18
19
|
const pyStrandsAgentReactConnectionGenerator = async (tree, options) => {
|
|
19
20
|
const frontendProjectConfig = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.sourceProject);
|
|
@@ -25,71 +26,83 @@ const pyStrandsAgentReactConnectionGenerator = async (tree, options) => {
|
|
|
25
26
|
const agentNameClassName = targetComponent?.rc ?? (0, names_1.toClassName)(agentName);
|
|
26
27
|
const agentPort = targetComponent?.port ?? metadata?.ports?.[0] ?? 8081;
|
|
27
28
|
const auth = targetComponent?.auth ?? metadata?.auth ?? 'IAM';
|
|
28
|
-
|
|
29
|
+
const protocol = targetComponent?.protocol ?? 'HTTP';
|
|
30
|
+
if (protocol === 'A2A') {
|
|
29
31
|
throw new Error(`Cannot connect a React website to an A2A agent. ` +
|
|
30
|
-
`Consider generating an agent with the HTTP protocol instead.`);
|
|
32
|
+
`Consider generating an agent with the HTTP or AG-UI protocol instead.`);
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
let additionalServeLocalDeps = [];
|
|
35
|
+
if (protocol === 'AG-UI') {
|
|
36
|
+
await (0, generator_1.addAgUiReactConnection)(tree, {
|
|
37
|
+
frontendProjectConfig,
|
|
38
|
+
agentName,
|
|
39
|
+
agentNameClassName,
|
|
40
|
+
auth: auth,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const moduleName = getModuleName(agentProjectConfig);
|
|
45
|
+
const agentNameSnakeCase = (0, names_1.toSnakeCase)(agentName);
|
|
46
|
+
const agentTargetPrefix = targetComponent?.name ? agentName : 'agent';
|
|
47
|
+
// Add OpenAPI spec generation script scoped to this agent
|
|
48
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/agent'), agentProjectConfig.root, {
|
|
49
|
+
moduleName,
|
|
50
|
+
agentNameSnakeCase,
|
|
51
|
+
}, {
|
|
52
|
+
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
53
|
+
});
|
|
54
|
+
// Instrument the OpenAPI spec generation as a target on the agent project
|
|
55
|
+
const openApiTargetName = `${agentTargetPrefix}-openapi`;
|
|
56
|
+
const openApiDist = (0, devkit_1.joinPathFragments)('dist', agentProjectConfig.root, 'openapi', agentNameSnakeCase);
|
|
57
|
+
const specPath = (0, devkit_1.joinPathFragments)(openApiDist, 'openapi.json');
|
|
58
|
+
(0, devkit_1.updateProjectConfiguration)(tree, agentProjectConfig.name, {
|
|
59
|
+
...agentProjectConfig,
|
|
60
|
+
targets: (0, object_1.sortObjectKeys)({
|
|
61
|
+
...agentProjectConfig.targets,
|
|
62
|
+
[openApiTargetName]: {
|
|
63
|
+
cache: true,
|
|
64
|
+
executor: 'nx:run-commands',
|
|
65
|
+
outputs: [
|
|
66
|
+
`{workspaceRoot}/dist/{projectRoot}/openapi/${agentNameSnakeCase}`,
|
|
60
67
|
],
|
|
68
|
+
options: {
|
|
69
|
+
commands: [
|
|
70
|
+
`uv run python {projectRoot}/scripts/${agentNameSnakeCase}_openapi.py "dist/{projectRoot}/openapi/${agentNameSnakeCase}/openapi.json"`,
|
|
71
|
+
],
|
|
72
|
+
},
|
|
61
73
|
},
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
76
|
+
// Use the shared OpenAPI react client utility for hooks, providers, and build targets.
|
|
77
|
+
// Serve-local is handled separately below using the agent-specific serve-local target.
|
|
78
|
+
await (0, react_1.addOpenApiReactClient)(tree, {
|
|
79
|
+
apiName: agentNameClassName,
|
|
80
|
+
frontendProjectConfig,
|
|
81
|
+
backendProjectConfig: agentProjectConfig,
|
|
82
|
+
specBuildProject: agentProjectConfig,
|
|
83
|
+
specPath,
|
|
84
|
+
specBuildTargetName: `${agentProjectConfig.name}:${openApiTargetName}`,
|
|
85
|
+
auth,
|
|
86
|
+
port: agentPort,
|
|
87
|
+
isAgentRuntime: true,
|
|
88
|
+
skipServeLocal: true,
|
|
89
|
+
});
|
|
90
|
+
additionalServeLocalDeps = (0, serve_local_1.openApiClientServeLocalDeps)(agentNameClassName);
|
|
91
|
+
// HTTP only — the AG-UI branch handles this inside addAgUiReactConnection.
|
|
92
|
+
// Agent constructs publish their runtime ARN to the 'agentcore' namespace
|
|
93
|
+
// by default, which isn't exposed to the website; patch them to also
|
|
94
|
+
// publish under 'connection' so the browser can read it.
|
|
95
|
+
await (0, agent_runtime_config_1.addAgentRuntimeToConnectionNamespace)(tree, {
|
|
96
|
+
agentNameKebabCase: (0, names_1.kebabCase)(agentNameClassName),
|
|
97
|
+
agentNameClassName,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
81
100
|
await (0, serve_local_1.addPyStrandsAgentTargetToServeLocal)(tree, frontendProjectConfig.name, agentProjectConfig.name, {
|
|
82
101
|
agentName,
|
|
83
102
|
agentNameClassName,
|
|
84
103
|
port: agentPort,
|
|
85
104
|
targetComponent,
|
|
86
|
-
|
|
87
|
-
// Expose the agent's runtime ARN to the frontend via the 'connection'
|
|
88
|
-
// namespace (which is published to runtime-config.json). The agent construct
|
|
89
|
-
// itself only registers to the 'agentcore' namespace by default.
|
|
90
|
-
await (0, agent_runtime_config_1.addAgentRuntimeToConnectionNamespace)(tree, {
|
|
91
|
-
agentNameKebabCase: (0, names_1.kebabCase)(agentNameClassName),
|
|
92
|
-
agentNameClassName,
|
|
105
|
+
additionalDependencyTargets: additionalServeLocalDeps,
|
|
93
106
|
});
|
|
94
107
|
await (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [
|
|
95
108
|
exports.PY_STRANDS_AGENT_REACT_CONNECTION_GENERATOR_INFO,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/py/strands-agent/react-connection/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAOoB;AACpB,kDAA6D;AAC7D,0CAK2B;AAC3B,oDAAyE;AACzE,oEAAiF;AAEjF,mFAAgG;AAChG,gDAA2E;AAC3E,kDAAuD;AACvD,+
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/py/strands-agent/react-connection/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAOoB;AACpB,kDAA6D;AAC7D,0CAK2B;AAC3B,oDAAyE;AACzE,oEAAiF;AAEjF,mFAAgG;AAChG,gDAA2E;AAC3E,kDAAuD;AACvD,+CAGuB;AACvB,wEAGkD;AAErC,QAAA,gDAAgD,GAC3D,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,sCAAsC,GAAG,KAAK,EACzD,IAAU,EACV,OAAkC,EAClC,EAAE;IACF,MAAM,qBAAqB,GAAG,IAAA,wCAAmC,EAC/D,IAAI,EACJ,OA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|
targetComponent?: ComponentMetadata;
|
|
12
|
+
additionalDependencyTargets?: string[];
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Adds the given py strands agent target project to the source project's serve-local target.
|
|
15
16
|
* Updates the runtime config provider (if it exists) to point to the local HTTP URL.
|
|
16
|
-
* Also adds dependencies on the OpenAPI client generation targets so that local
|
|
17
|
-
* API changes are reflected in the generated client.
|
|
18
17
|
*/
|
|
19
18
|
export declare const addPyStrandsAgentTargetToServeLocal: (tree: Tree, sourceProjectName: string, targetProjectName: string, options: PyStrandsAgentServeLocalOptions) => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Build the OpenAPI client generation target names for an HTTP agent so
|
|
21
|
+
* that local API changes regenerate the client.
|
|
22
|
+
*/
|
|
23
|
+
export declare const openApiClientServeLocalDeps: (agentNameClassName: string) => string[];
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addPyStrandsAgentTargetToServeLocal = void 0;
|
|
3
|
+
exports.openApiClientServeLocalDeps = exports.addPyStrandsAgentTargetToServeLocal = void 0;
|
|
4
4
|
const agent_serve_local_1 = require("../../../connection/agent-serve-local");
|
|
5
5
|
const names_1 = require("../../../utils/names");
|
|
6
6
|
/**
|
|
7
7
|
* Adds the given py strands agent target project to the source project's serve-local target.
|
|
8
8
|
* Updates the runtime config provider (if it exists) to point to the local HTTP URL.
|
|
9
|
-
* Also adds dependencies on the OpenAPI client generation targets so that local
|
|
10
|
-
* API changes are reflected in the generated client.
|
|
11
9
|
*/
|
|
12
10
|
const addPyStrandsAgentTargetToServeLocal = async (tree, sourceProjectName, targetProjectName, options) => {
|
|
13
|
-
const clientGenTarget = `generate:${(0, names_1.kebabCase)(options.agentNameClassName)}-client`;
|
|
14
|
-
const clientGenWatchTarget = `watch-${clientGenTarget}`;
|
|
15
11
|
await (0, agent_serve_local_1.addAgentTargetToServeLocal)(tree, sourceProjectName, targetProjectName, {
|
|
16
12
|
agentNameClassName: options.agentNameClassName,
|
|
17
13
|
port: options.port,
|
|
18
14
|
targetComponent: options.targetComponent,
|
|
19
15
|
runtimeConfigNamespace: 'agentRuntimes',
|
|
20
16
|
localUrl: `http://localhost:${options.port}/`,
|
|
21
|
-
additionalDependencyTargets:
|
|
17
|
+
additionalDependencyTargets: options.additionalDependencyTargets,
|
|
22
18
|
});
|
|
23
19
|
};
|
|
24
20
|
exports.addPyStrandsAgentTargetToServeLocal = addPyStrandsAgentTargetToServeLocal;
|
|
21
|
+
/**
|
|
22
|
+
* Build the OpenAPI client generation target names for an HTTP agent so
|
|
23
|
+
* that local API changes regenerate the client.
|
|
24
|
+
*/
|
|
25
|
+
const openApiClientServeLocalDeps = (agentNameClassName) => {
|
|
26
|
+
const clientGenTarget = `generate:${(0, names_1.kebabCase)(agentNameClassName)}-client`;
|
|
27
|
+
return [clientGenTarget, `watch-${clientGenTarget}`];
|
|
28
|
+
};
|
|
29
|
+
exports.openApiClientServeLocalDeps = openApiClientServeLocalDeps;
|
|
25
30
|
//# sourceMappingURL=serve-local.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve-local.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/py/strands-agent/react-connection/serve-local.ts"],"names":[],"mappings":";;;AAKA,6EAAmF;AAEnF,gDAAiD;
|
|
1
|
+
{"version":3,"file":"serve-local.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/py/strands-agent/react-connection/serve-local.ts"],"names":[],"mappings":";;;AAKA,6EAAmF;AAEnF,gDAAiD;AAUjD;;;GAGG;AACI,MAAM,mCAAmC,GAAG,KAAK,EACtD,IAAU,EACV,iBAAyB,EACzB,iBAAyB,EACzB,OAAwC,EACxC,EAAE;IACF,MAAM,IAAA,8CAA0B,EAAC,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,EAAE;QAC3E,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,sBAAsB,EAAE,eAAe;QACvC,QAAQ,EAAE,oBAAoB,OAAO,CAAC,IAAI,GAAG;QAC7C,2BAA2B,EAAE,OAAO,CAAC,2BAA2B;KACjE,CAAC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,mCAAmC,uCAc9C;AAEF;;;GAGG;AACI,MAAM,2BAA2B,GAAG,CACzC,kBAA0B,EAChB,EAAE;IACZ,MAAM,eAAe,GAAG,YAAY,IAAA,iBAAS,EAAC,kBAAkB,CAAC,SAAS,CAAC;IAC3E,OAAO,CAAC,eAAe,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC;AALW,QAAA,2BAA2B,+BAKtC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { IacProviderOption } from '../../utils/iac';
|
|
7
7
|
|
|
8
8
|
export type PyStrandsAgentComputeType = 'BedrockAgentCoreRuntime' | 'None';
|
|
9
|
-
export type StrandsAgentProtocol = 'HTTP' | 'A2A';
|
|
9
|
+
export type StrandsAgentProtocol = 'HTTP' | 'A2A' | 'AG-UI';
|
|
10
10
|
|
|
11
11
|
export type PyStrandsAgentAuth = 'IAM' | 'Cognito';
|
|
12
12
|
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"protocol": {
|
|
40
40
|
"type": "string",
|
|
41
|
-
"description": "The server protocol for your Strands Agent. HTTP exposes a FastAPI HTTP server. A2A exposes an Agent-to-Agent protocol server.",
|
|
41
|
+
"description": "The server protocol for your Strands Agent. HTTP exposes a FastAPI HTTP server. A2A exposes an Agent-to-Agent protocol server. AG-UI exposes an Agent-User Interaction protocol server for direct frontend integration.",
|
|
42
42
|
"x-prompt": "Which protocol would you like to use for your Strands Agent?",
|
|
43
|
-
"enum": ["HTTP", "A2A"],
|
|
43
|
+
"enum": ["HTTP", "A2A", "AG-UI"],
|
|
44
44
|
"default": "HTTP",
|
|
45
45
|
"x-priority": "important"
|
|
46
46
|
},
|
|
@@ -9,6 +9,7 @@ exports[`ts#mcp-server generator > should match snapshot for BedrockAgentCoreRun
|
|
|
9
9
|
"export * from './app.js';
|
|
10
10
|
export * from './checkov.js';
|
|
11
11
|
export * from './runtime-config.js';
|
|
12
|
+
export * from './workspace.js';
|
|
12
13
|
"
|
|
13
14
|
`;
|
|
14
15
|
|
|
@@ -16,7 +17,6 @@ exports[`ts#mcp-server generator > should match snapshot for BedrockAgentCoreRun
|
|
|
16
17
|
"import { Lazy, Names } from 'aws-cdk-lib';
|
|
17
18
|
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
|
|
18
19
|
import { Construct } from 'constructs';
|
|
19
|
-
import { execSync } from 'child_process';
|
|
20
20
|
import * as path from 'path';
|
|
21
21
|
import * as url from 'url';
|
|
22
22
|
import {
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from '@aws-cdk/aws-bedrock-agentcore-alpha';
|
|
28
28
|
import { IGrantable, IPrincipal, Grant } from 'aws-cdk-lib/aws-iam';
|
|
29
29
|
import { RuntimeConfig } from '../../../core/runtime-config.js';
|
|
30
|
+
import { findWorkspaceRoot } from '../../../core/workspace.js';
|
|
30
31
|
|
|
31
32
|
export type SnapshotBedrockServerProps = Omit<
|
|
32
33
|
RuntimeProps,
|
|
@@ -49,17 +50,16 @@ export class SnapshotBedrockServer extends Construct implements IGrantable {
|
|
|
49
50
|
|
|
50
51
|
const rc = RuntimeConfig.ensure(this);
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
extraHash: execSync(
|
|
57
|
-
\`docker inspect proj-snapshot-bedrock-server:latest --format '{{.Id}}'\`,
|
|
58
|
-
{ encoding: 'utf-8' },
|
|
59
|
-
).trim(),
|
|
60
|
-
},
|
|
53
|
+
// Resolve the bundle output directory containing the Dockerfile and built artifacts
|
|
54
|
+
const bundleDir = path.join(
|
|
55
|
+
findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
|
|
56
|
+
'dist/apps/test-project/bundle/mcp/snapshot-bedrock-server',
|
|
61
57
|
);
|
|
62
58
|
|
|
59
|
+
this.dockerImage = AgentRuntimeArtifact.fromAsset(bundleDir, {
|
|
60
|
+
platform: Platform.LINUX_ARM64,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
63
|
this.agentCoreRuntime = new Runtime(this, 'SnapshotBedrockServer', {
|
|
64
64
|
runtimeName: Lazy.string({
|
|
65
65
|
produce: () =>
|
|
@@ -7,7 +7,7 @@ WORKDIR /app
|
|
|
7
7
|
RUN npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation@<%- adotVersion %>
|
|
8
8
|
|
|
9
9
|
# Copy bundled streamable http server
|
|
10
|
-
COPY
|
|
10
|
+
COPY index.js /app
|
|
11
11
|
|
|
12
12
|
EXPOSE 8000
|
|
13
13
|
|
|
@@ -17,6 +17,7 @@ const npm_scope_1 = require("../../utils/npm-scope");
|
|
|
17
17
|
const iac_1 = require("../../utils/iac");
|
|
18
18
|
const bundle_1 = require("../../utils/bundle/bundle");
|
|
19
19
|
const port_1 = require("../../utils/port");
|
|
20
|
+
const fs_1 = require("../../utils/fs");
|
|
20
21
|
exports.TS_MCP_SERVER_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
21
22
|
const tsMcpServerGenerator = async (tree, options) => {
|
|
22
23
|
const project = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.project);
|
|
@@ -82,12 +83,18 @@ const tsMcpServerGenerator = async (tree, options) => {
|
|
|
82
83
|
targetFilePath: `${targetSourceDirRelativeToProjectRoot}/http.ts`,
|
|
83
84
|
bundleOutputDir: (0, devkit_1.joinPathFragments)('mcp', name),
|
|
84
85
|
});
|
|
86
|
+
const dockerOutputDir = (0, devkit_1.joinPathFragments)('dist', project.root, 'bundle', 'mcp', name);
|
|
85
87
|
const dockerTargetName = `${mcpTargetPrefix}-docker`;
|
|
88
|
+
const fs = new fs_1.FsCommands(tree);
|
|
86
89
|
project.targets[dockerTargetName] = {
|
|
87
90
|
cache: true,
|
|
88
91
|
executor: 'nx:run-commands',
|
|
89
92
|
options: {
|
|
90
|
-
|
|
93
|
+
commands: [
|
|
94
|
+
fs.cp(`${targetSourceDir}/Dockerfile`, `${dockerOutputDir}/Dockerfile`),
|
|
95
|
+
`docker build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,
|
|
96
|
+
],
|
|
97
|
+
parallel: false,
|
|
91
98
|
},
|
|
92
99
|
dependsOn: ['bundle'],
|
|
93
100
|
};
|
|
@@ -102,6 +109,7 @@ const tsMcpServerGenerator = async (tree, options) => {
|
|
|
102
109
|
mcpServerNameClassName,
|
|
103
110
|
projectName: project.name,
|
|
104
111
|
dockerImageTag,
|
|
112
|
+
dockerOutputDir,
|
|
105
113
|
iacProvider,
|
|
106
114
|
auth,
|
|
107
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAYoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,mDAAiE;AACjE,6CAA2D;AAC3D,qEAA0E;AAC1E,mGAA4F;AAE5F,qDAAoD;AACpD,yCAAqD;AACrD,sDAAsE;AACtE,2CAA8C;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAYoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,mDAAiE;AACjE,6CAA2D;AAC3D,qEAA0E;AAC1E,mGAA4F;AAE5F,qDAAoD;AACpD,yCAAqD;AACrD,sDAAsE;AACtE,2CAA8C;AAC9C,uCAA4C;AAE/B,QAA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xB;iBACF;gBACD,UAAU,EAAE,IAAI;aACjB;YACD,CAAC,GAAG,eAAe,cAAc,CAAC,EAAE;gBAClC,QAAQ,EAAE,iBAAiB;gBAC3B,OAAO,EAAE;oBACP,QAAQ,EAAE,CAAC,eAAe,iBAAiB,UAAU,CAAC;oBACtD,GAAG,EAAE,eAAe;oBACpB,GAAG,EAAE;wBACH,IAAI,EAAE,GAAG,YAAY,EAAE;wBACvB,WAAW,EAAE,MAAM;qBACpB;iBACF;gBACD,UAAU,EAAE,IAAI;aACjB;YACD,CAAC,GAAG,eAAe,UAAU,CAAC,EAAE;gBAC9B,QAAQ,EAAE,iBAAiB;gBAC3B,OAAO,EAAE;oBACP,QAAQ,EAAE;wBACR,gCAAgC,iBAAiB,WAAW;qBAC7D;oBACD,GAAG,EAAE,eAAe;iBACrB;gBACD,UAAU,EAAE,IAAI;aACjB;SACF;KACF,CAAC,CAAC;IAEH,IAAA,kCAA6B,EAC3B,IAAI,EACJ,OAAO,CAAC,IAAI,EACZ,oCAA4B,EAC5B,oCAAoC,EACpC,eAAe,EACf;QACE,IAAI,EAAE,YAAY;QAClB,EAAE,EAAE,sBAAsB;QAC1B,IAAI;KACL,CACF,CAAC;IAEF,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE,CAAC,oCAA4B,CAAC,CAAC,CAAC;IAE5E,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE;QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAzNW,QAAA,oBAAoB,wBAyN/B;AAEF,kBAAe,4BAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CopilotKitProvider } from '@copilotkit/react-core/v2';
|
|
2
|
+
import '@copilotkit/react-core/v2/styles.css';
|
|
3
|
+
import { type FC, type PropsWithChildren, useMemo } from 'react';
|
|
4
|
+
import type { AbstractAgent } from '@ag-ui/client';
|
|
5
|
+
|
|
6
|
+
export const AguiProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
7
|
+
const selfManagedAgents = useMemo<Record<string, AbstractAgent>>(
|
|
8
|
+
() => ({}),
|
|
9
|
+
[],
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<CopilotKitProvider selfManagedAgents={selfManagedAgents}>
|
|
14
|
+
{children}
|
|
15
|
+
</CopilotKitProvider>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default AguiProvider;
|