@aws/nx-plugin 0.99.1 → 0.101.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 +27 -19
- package/package.json +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +2 -0
- 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/astro-docs/__snapshots__/generator.spec.ts.snap +223 -0
- package/src/ts/astro-docs/files/base/README.md.template +63 -0
- package/src/ts/astro-docs/files/base/astro.config.mjs.template +47 -0
- package/src/ts/astro-docs/files/base/src/components/link.astro.template +25 -0
- package/src/ts/astro-docs/files/base/src/components/snippet.astro.template +20 -0
- package/src/ts/astro-docs/files/base/src/content/docs/en/blog/welcome.mdx.template +13 -0
- package/src/ts/astro-docs/files/base/src/content/docs/en/guides/getting-started.mdx.template +64 -0
- package/src/ts/astro-docs/files/base/src/content/docs/en/index.mdx.template +29 -0
- package/src/ts/astro-docs/files/base/src/content/docs/en/snippets/example.mdx.template +7 -0
- package/src/ts/astro-docs/files/base/src/content.config.ts.template +13 -0
- package/src/ts/astro-docs/files/base/src/styles/custom.css.template +1 -0
- package/src/ts/astro-docs/files/base/tsconfig.json.template +12 -0
- package/src/ts/astro-docs/files/translation/scripts/translate.config.json.template +10 -0
- package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +430 -0
- package/src/ts/astro-docs/generator.d.ts +10 -0
- package/src/ts/astro-docs/generator.js +113 -0
- package/src/ts/astro-docs/generator.js.map +1 -0
- package/src/ts/astro-docs/schema.d.ts +30 -0
- package/src/ts/astro-docs/schema.json +62 -0
- 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 +18 -1
- package/src/utils/versions.js +17 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/py/strands-agent/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAQoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,6CAAwE;AACxE,uCAGwB;AACxB,mGAAwF;AAExF,sDAAkE;AAClE,qDAAoD;AACpD,qEAA0E;AAC1E,yDAA6D;AAC7D,yCAAqD;AACrD,2CAA8C;AAC9C,6CAA0D;AAE7C,QAAA,+BAA+B,GAC1C,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,uBAAuB,GAAG,KAAK,EAC1C,IAAU,EACV,OAAsC,EACV,EAAE;IAC9B,MAAM,OAAO,GAAG,IAAA,wCAAmC,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3E,MAAM,aAAa,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAExE,iDAAiD;IACjD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,OAAO,qDAAqD,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,gIAAgI,CACjI,CAAC;IACJ,CAAC;IAED,mDA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,EAAE,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,EAC7D,eAAe,EACf,eAAe,EACf,EAAE,iBAAiB,EAAE,0BAAiB,CAAC,YAAY,EAAE,CACtD,CAAC;IAEF,IAAA,mCAA8B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;QACjD,uBAAuB;QACvB,0BAA0B;QAC1B,mBAAmB;QACnB,OAAO;QACP,SAAS;QACT,KAAK;QACL,GAAG,CAAC,QAAQ,KAAK,KAAK;YACpB,CAAC,CAAE,CAAC,qBAAqB,CAAW;YACpC,CAAC,CAAE,CAAC,gBAAgB,CAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/py/strands-agent/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAQoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,6CAAwE;AACxE,uCAGwB;AACxB,mGAAwF;AAExF,sDAAkE;AAClE,uCAA4C;AAC5C,qDAAoD;AACpD,qEAA0E;AAC1E,yDAA6D;AAC7D,yCAAqD;AACrD,2CAA8C;AAC9C,6CAA0D;AAE7C,QAAA,+BAA+B,GAC1C,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,uBAAuB,GAAG,KAAK,EAC1C,IAAU,EACV,OAAsC,EACV,EAAE;IAC9B,MAAM,OAAO,GAAG,IAAA,wCAAmC,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3E,MAAM,aAAa,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAExE,iDAAiD;IACjD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,OAAO,qDAAqD,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,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,kCAA6B,EAC3B,IAAI,EACJ,OAAO,CAAC,IAAI,EACZ,uCAA+B,EAC/B,IAAA,6BAAqB,EAAC,OAAO,EAAE,eAAe,CAAC,EAC/C,iBAAiB,EACjB;QACE,IAAI,EAAE,YAAY;QAClB,EAAE,EAAE,kBAAkB;QACtB,IAAI;QACJ,QAAQ;KACT,CACF,CAAC;IAEF,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE;QAC1C,uCAA+B;KAChC,CAAC,CAAC;IAEH,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,IAAI,EAAE;QAChB,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,IAAI,wBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,oBAAM,EAAE,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC,CAAC;AAnOW,QAAA,uBAAuB,2BAmOlC;AAEF,kBAAe,+BAAuB,CAAC"}
|
|
@@ -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,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,wCAAmC,EAC5D,IAAI,EACJ,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E;QAC3E,0EAA0E;QAC1E,qEAAqE;QACrE,yDAAyD;QACzD,MAAM,IAAA,2DAAoC,EAAC,IAAI,EAAE;YAC/C,kBAAkB,EAAE,IAAA,iBAAS,EAAC,kBAAkB,CAAC;YACjD,kBAAkB;SACnB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAA,iDAAmC,EACvC,IAAI,EACJ,qBAAqB,CAAC,IAAI,EAC1B,kBAAkB,CAAC,IAAI,EACvB;QACE,SAAS;QACT,kBAAkB;QAClB,IAAI,EAAE,SAAS;QACf,eAAe;QACf,2BAA2B,EAAE,wBAAwB;KACtD,CACF,CAAC;IAEF,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE;QAC1C,wDAAgD;KACjD,CAAC,CAAC;IAEH,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE;QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAxIW,QAAA,sCAAsC,0CAwIjD;AAEF;;GAEG;AACH,MAAM,aAAa,GAAG,CACpB,aAAqE,EAC7D,EAAE;IACV,IAAI,aAAa,CAAC,UAAU,EAAE,CAAC;QAC7B,MAAM,eAAe,GAAG,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5D,OAAO,eAAe,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,IAAI,KAAK,CACb,8CAA8C,aAAa,CAAC,IAAI,EAAE,CACnE,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,8CAAsC,CAAC"}
|
|
@@ -9,11 +9,15 @@ export interface PyStrandsAgentServeLocalOptions {
|
|
|
9
9
|
agentNameClassName: string;
|
|
10
10
|
port: number;
|
|
11
11
|
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
|
},
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`ts#astro-docs generator > should generate a docs site with default options (translation + blog enabled) > astro.config.mjs 1`] = `
|
|
4
|
+
"// @ts-check
|
|
5
|
+
import { defineConfig } from 'astro/config';
|
|
6
|
+
|
|
7
|
+
import starlight from '@astrojs/starlight';
|
|
8
|
+
import starlightBlog from 'starlight-blog';
|
|
9
|
+
|
|
10
|
+
// https://astro.build/config
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
outDir: './dist',
|
|
13
|
+
// Redirect the root URL to the default locale so visitors land on localised content.
|
|
14
|
+
redirects: {
|
|
15
|
+
'/': '/en',
|
|
16
|
+
},
|
|
17
|
+
integrations: [
|
|
18
|
+
starlight({
|
|
19
|
+
title: 'docs',
|
|
20
|
+
social: [],
|
|
21
|
+
tableOfContents: {
|
|
22
|
+
minHeadingLevel: 2,
|
|
23
|
+
maxHeadingLevel: 4,
|
|
24
|
+
},
|
|
25
|
+
defaultLocale: 'en',
|
|
26
|
+
locales: {
|
|
27
|
+
en: {
|
|
28
|
+
label: 'English',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
sidebar: [
|
|
32
|
+
{
|
|
33
|
+
label: 'Getting started',
|
|
34
|
+
items: [{ slug: 'guides/getting-started' }],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
customCss: ['./src/styles/custom.css'],
|
|
38
|
+
plugins: [
|
|
39
|
+
starlightBlog({
|
|
40
|
+
authors: {
|
|
41
|
+
default: {
|
|
42
|
+
name: 'Docs Author',
|
|
43
|
+
title: 'Maintainer',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
}),
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
"
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
exports[`ts#astro-docs generator > should generate a docs site with default options (translation + blog enabled) > index.mdx 1`] = `
|
|
55
|
+
"---
|
|
56
|
+
title: docs
|
|
57
|
+
description: Documentation for docs.
|
|
58
|
+
template: splash
|
|
59
|
+
hero:
|
|
60
|
+
title: docs
|
|
61
|
+
tagline: Project documentation built with Astro and Starlight.
|
|
62
|
+
actions:
|
|
63
|
+
- text: Get started
|
|
64
|
+
link: /en/guides/getting-started
|
|
65
|
+
icon: right-arrow
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
import { CardGrid, Card } from '@astrojs/starlight/components';
|
|
69
|
+
|
|
70
|
+
<CardGrid>
|
|
71
|
+
<Card title="Guides" icon="open-book">
|
|
72
|
+
Reference documentation for docs.
|
|
73
|
+
</Card>
|
|
74
|
+
<Card title="Blog" icon="pencil">
|
|
75
|
+
News and updates from the team.
|
|
76
|
+
</Card>
|
|
77
|
+
<Card title="Snippets" icon="seti:config">
|
|
78
|
+
Reusable content fragments used across the docs.
|
|
79
|
+
</Card>
|
|
80
|
+
<Card title="Localised" icon="translate">
|
|
81
|
+
Localisation is configured out of the box — add target locales in
|
|
82
|
+
\`astro.config.mjs\`.
|
|
83
|
+
</Card>
|
|
84
|
+
</CardGrid>
|
|
85
|
+
"
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
exports[`ts#astro-docs generator > should generate a docs site with default options (translation + blog enabled) > link.astro 1`] = `
|
|
89
|
+
"---
|
|
90
|
+
import { getRelativeLocaleUrl } from 'astro:i18n';
|
|
91
|
+
import { LinkButton } from '@astrojs/starlight/components';
|
|
92
|
+
|
|
93
|
+
// Resolve an internal docs path against the current locale so a single source of
|
|
94
|
+
// truth (the \`path\` prop) produces a correct URL in every language. Callers pass
|
|
95
|
+
// a locale-agnostic path like \`guides/getting-started\`.
|
|
96
|
+
const { path, type } = Astro.props;
|
|
97
|
+
let resolvedPath = getRelativeLocaleUrl(Astro.currentLocale || 'en', path);
|
|
98
|
+
if (resolvedPath.endsWith('/')) {
|
|
99
|
+
resolvedPath = resolvedPath.slice(0, -1);
|
|
100
|
+
}
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
{
|
|
104
|
+
type === 'button' ? (
|
|
105
|
+
<LinkButton href={resolvedPath}>
|
|
106
|
+
<slot />
|
|
107
|
+
</LinkButton>
|
|
108
|
+
) : (
|
|
109
|
+
<a href={resolvedPath}>
|
|
110
|
+
<slot />
|
|
111
|
+
</a>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
"
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
exports[`ts#astro-docs generator > should generate a docs site with default options (translation + blog enabled) > project.json 1`] = `
|
|
118
|
+
"{
|
|
119
|
+
"name": "@proj/docs",
|
|
120
|
+
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
|
121
|
+
"sourceRoot": "docs/src",
|
|
122
|
+
"projectType": "application",
|
|
123
|
+
"targets": {
|
|
124
|
+
"build": {
|
|
125
|
+
"executor": "nx:run-commands",
|
|
126
|
+
"options": {
|
|
127
|
+
"command": "astro build",
|
|
128
|
+
"cwd": "docs"
|
|
129
|
+
},
|
|
130
|
+
"outputs": ["{workspaceRoot}/docs/dist"],
|
|
131
|
+
"cache": true
|
|
132
|
+
},
|
|
133
|
+
"start": {
|
|
134
|
+
"executor": "nx:run-commands",
|
|
135
|
+
"options": {
|
|
136
|
+
"command": "astro dev",
|
|
137
|
+
"cwd": "docs"
|
|
138
|
+
},
|
|
139
|
+
"continuous": true
|
|
140
|
+
},
|
|
141
|
+
"serve": {
|
|
142
|
+
"dependsOn": ["start"]
|
|
143
|
+
},
|
|
144
|
+
"preview": {
|
|
145
|
+
"executor": "nx:run-commands",
|
|
146
|
+
"options": {
|
|
147
|
+
"command": "astro preview",
|
|
148
|
+
"cwd": "docs"
|
|
149
|
+
},
|
|
150
|
+
"dependsOn": ["build"],
|
|
151
|
+
"continuous": true
|
|
152
|
+
},
|
|
153
|
+
"translate": {
|
|
154
|
+
"executor": "nx:run-commands",
|
|
155
|
+
"options": {
|
|
156
|
+
"command": "tsx ./scripts/translate.ts",
|
|
157
|
+
"cwd": "docs",
|
|
158
|
+
"forwardAllArgs": true
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"metadata": {
|
|
163
|
+
"generator": "ts#astro-docs",
|
|
164
|
+
"includeTranslation": true,
|
|
165
|
+
"includeBlog": true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
"
|
|
169
|
+
`;
|
|
170
|
+
|
|
171
|
+
exports[`ts#astro-docs generator > should generate a docs site with default options (translation + blog enabled) > snippet.astro 1`] = `
|
|
172
|
+
"---
|
|
173
|
+
import { Aside } from '@astrojs/starlight/components';
|
|
174
|
+
|
|
175
|
+
const locale = Astro.currentLocale || 'en';
|
|
176
|
+
const snippets = Object.values(
|
|
177
|
+
import.meta.glob('../content/docs/*/snippets/**/*.mdx', { eager: true })
|
|
178
|
+
);
|
|
179
|
+
const { name } = Astro.props;
|
|
180
|
+
const snippet = snippets.find((s) =>
|
|
181
|
+
s.file.endsWith(\`content/docs/\${locale}/snippets/\${name}.mdx\`)
|
|
182
|
+
);
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
{
|
|
186
|
+
snippet ? (
|
|
187
|
+
<snippet.Content />
|
|
188
|
+
) : (
|
|
189
|
+
<Aside type="danger">Unable to load snippet {name} for locale {locale}</Aside>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
"
|
|
193
|
+
`;
|
|
194
|
+
|
|
195
|
+
exports[`ts#astro-docs generator > should generate a docs site with default options (translation + blog enabled) > translate.config.json 1`] = `
|
|
196
|
+
"{
|
|
197
|
+
"sourceLanguage": "en",
|
|
198
|
+
"targetLanguages": [],
|
|
199
|
+
"docsDir": "src/content/docs",
|
|
200
|
+
"include": ["**/*.md", "**/*.mdx"],
|
|
201
|
+
"exclude": [],
|
|
202
|
+
"modelId": "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
203
|
+
"awsRegion": "us-west-2",
|
|
204
|
+
"concurrency": 5
|
|
205
|
+
}
|
|
206
|
+
"
|
|
207
|
+
`;
|
|
208
|
+
|
|
209
|
+
exports[`ts#astro-docs generator > should generate a docs site with default options (translation + blog enabled) > tsconfig.json 1`] = `
|
|
210
|
+
"{
|
|
211
|
+
"extends": "astro/tsconfigs/strict",
|
|
212
|
+
"include": [".astro/types.d.ts", "**/*"],
|
|
213
|
+
"exclude": ["dist"],
|
|
214
|
+
"compilerOptions": {
|
|
215
|
+
"baseUrl": ".",
|
|
216
|
+
"paths": {
|
|
217
|
+
"@components/*": ["src/components/*"],
|
|
218
|
+
"@assets/*": ["src/content/docs/assets/*"]
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
"
|
|
223
|
+
`;
|