@aws/nx-plugin 1.0.0-rc.56 → 1.0.0-rc.58
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 +2917 -1295
- package/migrations.json +34 -24
- package/package.json +13 -13
- package/src/agentcore-gateway/generator.d.ts +16 -1
- package/src/agentcore-gateway/generator.js +3 -2
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-gateway/schema.json +1 -0
- package/src/connection/scaffold-catalog.d.ts +160 -0
- package/src/connection/scaffold-catalog.js +207 -0
- package/src/connection/scaffold-catalog.js.map +1 -0
- package/src/connection/schema-resolver.d.ts +5 -0
- package/src/connection/schema-resolver.js +27 -0
- package/src/connection/schema-resolver.js.map +1 -0
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +7 -7
- package/src/migrations/latest/smithy-ssdk-bundle-pins/migration.js +78 -0
- package/src/migrations/latest/smithy-ssdk-bundle-pins/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.50/modernize-function-props-cast/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.50/restrict-cors-to-custom-domains/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.50/terraform-bootstrap-adopt-existing-bucket/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.52/user-identity-waf-allow-localhost-callback/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.54/order-access-log-delivery-after-bucket-policy/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.55/backfill-generator-metadata/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.56/dynamodb-local-remove-optimize-flag/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.js +449 -0
- package/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.js.map +1 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +11 -9
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +20 -20
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +3 -3
- package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +2 -1
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +2 -1
- package/src/py/agent/a2a-connection/files/langchain/agent-connection/app/__targetAgentSnakeCase___client_langchain.py.template +2 -1
- package/src/py/agent/a2a-connection/generator.d.ts +1 -1
- package/src/py/agent/gateway-connection/generator.d.ts +1 -1
- package/src/py/agent/generator.js +4 -0
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +2 -1
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client_strands.py.template +2 -1
- package/src/py/agent/mcp-connection/files/langchain/agent-connection/app/__mcpServerSnakeCase___client_langchain.py.template +2 -1
- package/src/py/agent/mcp-connection/generator.d.ts +1 -1
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +6 -0
- package/src/py/agent/schema.d.js.map +1 -1
- package/src/py/agent/schema.d.ts +3 -0
- package/src/py/agent/schema.json +9 -0
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/dynamodb/schema.json +1 -0
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
- package/src/py/fast-api/generator.d.ts +5 -0
- package/src/py/fast-api/generator.js +3 -2
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/schema.json +1 -0
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +9 -7
- package/src/py/mcp-server/schema.json +1 -0
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/rdb/schema.json +1 -0
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/smithy/project/files/service/build.Dockerfile.template +2 -2
- package/src/smithy/project/generator.d.ts +25 -0
- package/src/smithy/project/generator.js +24 -3
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
- package/src/smithy/ts/api/generator.d.ts +6 -1
- package/src/smithy/ts/api/generator.js +3 -2
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/smithy/ts/api/schema.json +1 -0
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/trpc/backend/generator.d.ts +6 -1
- package/src/trpc/backend/generator.js +3 -2
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.json +1 -0
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +668 -24
- package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +2 -1
- package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client-strands.ts.template +1 -1
- package/src/ts/agent/files/ag-ui/index.ts.template +10 -1
- package/src/ts/agent/files/common/agent.ts.template +11 -3
- package/src/ts/agent/files/common/session.ts.template +43 -0
- package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +1 -0
- package/src/ts/agent/generator.d.ts +36 -1
- package/src/ts/agent/generator.js +28 -4
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +2 -1
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +2 -1
- package/src/ts/agent/react-connection/__snapshots__/generator.spec.ts.snap +8 -4
- package/src/ts/agent/react-connection/files/src/components/__agentNameClassName__AgentClientProvider.tsx.template +2 -1
- package/src/ts/agent/schema.d.js.map +1 -1
- package/src/ts/agent/schema.d.ts +3 -0
- package/src/ts/agent/schema.json +9 -0
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/dynamodb/schema.json +1 -0
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +6 -4
- package/src/ts/mcp-server/generator.d.ts +32 -1
- package/src/ts/mcp-server/generator.js +7 -4
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/mcp-server/schema.json +1 -0
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/rdb/generator.d.ts +8 -0
- package/src/ts/rdb/generator.js +3 -2
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/schema.json +1 -0
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +61 -45
- package/src/ts/react-website/app/generator.d.ts +6 -1
- package/src/ts/react-website/app/generator.js +3 -2
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/app/schema.json +1 -0
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/ts/react-website/cognito-auth/generator.d.ts +6 -1
- package/src/ts/react-website/cognito-auth/generator.js +3 -2
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/utils/agent-chat/files/common/agentcore.ts.template +2 -2
- package/src/utils/agent-connection/agent-connection.js +4 -0
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-connection/files/core-runtime-config/runtime-config.ts.template +11 -1
- package/src/utils/agent-connection/files/core-strands/base/model-errors-strands.ts.template +26 -15
- package/src/utils/agent-connection/files/core-strands/base/tool-errors-strands.ts.template +23 -16
- package/src/utils/agent-connection/files/py-core-runtime-config/runtime_config.py.template +4 -3
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +22 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js +29 -2
- 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 +131 -3
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +180 -1
- package/src/utils/api-constructs/api-constructs.d.ts +9 -0
- package/src/utils/api-constructs/api-constructs.js +11 -1
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/ast.d.ts +5 -0
- package/src/utils/ast.js +25 -0
- package/src/utils/ast.js.map +1 -1
- package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +2 -0
- package/src/utils/docker.d.ts +27 -2
- package/src/utils/docker.js +31 -2
- package/src/utils/docker.js.map +1 -1
- package/src/utils/identity-constructs/identity-constructs.d.ts +10 -0
- package/src/utils/identity-constructs/identity-constructs.js +11 -1
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/shared-constructs-constants.d.ts +6 -0
- package/src/utils/shared-constructs-constants.js +5 -0
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/version-upgrade-migration/owned-dependencies.d.ts +26 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.js +52 -4
- package/src/utils/version-upgrade-migration/owned-dependencies.js.map +1 -1
- package/src/utils/version-upgrade-migration/register.d.ts +5 -1
- package/src/utils/version-upgrade-migration/register.js +6 -2
- package/src/utils/version-upgrade-migration/register.js.map +1 -1
- package/src/utils/version-upgrade-migration/sync-embedded-versions.d.ts +26 -0
- package/src/utils/version-upgrade-migration/sync-embedded-versions.js +304 -0
- package/src/utils/version-upgrade-migration/sync-embedded-versions.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js +14 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
- package/src/utils/versions.d.ts +90 -77
- package/src/utils/versions.js +86 -75
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/website-constructs.d.ts +11 -0
- package/src/utils/website-constructs/website-constructs.js +12 -1
- package/src/utils/website-constructs/website-constructs.js.map +1 -1
- package/src/migrations/latest/backfill-generator-metadata/migration.js.map +0 -1
- package/src/migrations/latest/dynamodb-local-remove-optimize-flag/migration.js.map +0 -1
- package/src/migrations/latest/modernize-function-props-cast/migration.js.map +0 -1
- package/src/migrations/latest/order-access-log-delivery-after-bucket-policy/migration.js.map +0 -1
- package/src/migrations/latest/restrict-cors-to-custom-domains/migration.js.map +0 -1
- package/src/migrations/latest/terraform-bootstrap-adopt-existing-bucket/migration.js.map +0 -1
- package/src/migrations/latest/user-identity-waf-allow-localhost-callback/migration.js.map +0 -1
- /package/src/migrations/latest/{modernize-function-props-cast → smithy-ssdk-bundle-pins}/migration.d.ts +0 -0
- /package/src/migrations/{latest/restrict-cors-to-custom-domains → v1.0.0-rc.50/modernize-function-props-cast}/migration.d.ts +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.50}/modernize-function-props-cast/migration.js +0 -0
- /package/src/migrations/{latest/terraform-bootstrap-adopt-existing-bucket → v1.0.0-rc.50/restrict-cors-to-custom-domains}/migration.d.ts +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.50}/restrict-cors-to-custom-domains/migration.js +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.50}/terraform-bootstrap-adopt-existing-bucket/migration.js +0 -0
- /package/src/migrations/{latest/dynamodb-local-remove-optimize-flag → v1.0.0-rc.52/user-identity-waf-allow-localhost-callback}/migration.d.ts +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.52}/user-identity-waf-allow-localhost-callback/migration.js +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.54}/order-access-log-delivery-after-bucket-policy/migration.d.ts +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.54}/order-access-log-delivery-after-bucket-policy/migration.js +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.55}/backfill-generator-metadata/migration.d.ts +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.55}/backfill-generator-metadata/migration.js +0 -0
- /package/src/migrations/{latest/user-identity-waf-allow-localhost-callback → v1.0.0-rc.56/dynamodb-local-remove-optimize-flag}/migration.d.ts +0 -0
- /package/src/migrations/{latest → v1.0.0-rc.56}/dynamodb-local-remove-optimize-flag/migration.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.57/ts-agent-session-management-support/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type ProjectConfiguration,\n type Tree,\n visitNotIgnoredFiles,\n} from '@nx/devkit';\nimport { TS_AGENT_GENERATOR_INFO } from '../../../ts/agent/generator';\nimport { AGENT_CONNECTION_PROJECT_DIR } from '../../../utils/agent-connection/agent-connection';\nimport {\n applyGritQL,\n captureGritQLVariable,\n matchGritQL,\n} from '../../../utils/ast';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { isEsmWorkspace } from '../../../utils/module-format';\nimport { kebabCase } from '../../../utils/names';\nimport type { ComponentMetadata } from '../../../utils/nx';\nimport {\n getRelativePathToRootByDirectory,\n toProjectRelativePath,\n} from '../../../utils/paths';\n\n/**\n * Add session management support to ts#agent.\n *\n * How to write a migration:\n * - https://nx.dev/docs/kb/migration-generators\n * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject\n *\n * Guardrails:\n * - Pattern-match before writing: skip files that have diverged from the shape\n * your generators produce and report them via `nextSteps`, or consider a\n * hybrid migration, rather than clobbering the user's changes.\n * - Idempotent: re-running must be a no-op.\n * - Format what you write: finish with `formatFilesInSubtree` so the files your\n * migration wrote are formatted correctly.\n */\n\n// Reshapes an `agentRuntimes` rc.set entry from a bare ARN to `{ arn }`. Only\n// the 'agentcore' namespace — 'connection' (client-facing) stays a string,\n// since it shouldn't carry the session bucket name to the browser. No\n// `session` field added here; a fresh session.ts (created below) defaults to\n// in-memory. Idempotent: only matches the pre-migration shape.\nconst CDK_RC_SET_PATTERN = `\\`rc.set('agentcore', 'agentRuntimes', { ...rc.get('agentcore').agentRuntimes, $name: this.agentCoreRuntime.agentRuntimeArn });\\` => raw\\`rc.set('agentcore', 'agentRuntimes', {\n ...rc.get('agentcore').agentRuntimes,\n $name: {\n arn: this.agentCoreRuntime.agentRuntimeArn,\n },\n});\\``;\n\n// Terraform equivalent, anchored on the module's fixed name/shape so it\n// doesn't also match the 'connection' module's identical-looking `value` line.\nconst TF_VALUE_PATTERN = `language hcl\\n\\`module \"add_agent_runtime_to_runtime_config\" {\n source = \"../../../core/runtime-config/entry\"\n\n namespace = \"agentcore\"\n key = \"agentRuntimes\"\n value = { \"$name\" = module.agent_core_runtime.agent_core_runtime_arn }\n\n depends_on = [module.agent_core_runtime]\n}\\` => \\`module \"add_agent_runtime_to_runtime_config\" {\n source = \"../../../core/runtime-config/entry\"\n\n namespace = \"agentcore\"\n key = \"agentRuntimes\"\n value = { \"$name\" = { arn = module.agent_core_runtime.agent_core_runtime_arn } }\n\n depends_on = [module.agent_core_runtime]\n}\\``;\n\n// Shared `AgentCoreRuntimeConfig` interface, vended into\n// `packages/common/agent-connection/src/core/runtime-config.ts`.\nconst TS_RUNTIME_CONFIG_INTERFACE_PATTERN = `\\`export interface AgentCoreRuntimeConfig {\n agentRuntimes?: Record<string, string>;\n gateways?: Record<string, string>;\n}\\` => raw\\`export interface AgentRuntimeEntry {\n arn: string;\n /** Session storage details. Only set when the agent has S3 session storage configured. */\n session?: {\n /** Name of the S3 bucket storing session data. */\n bucketName: string;\n };\n}\n\nexport interface AgentCoreRuntimeConfig {\n agentRuntimes?: Record<string, AgentRuntimeEntry>;\n gateways?: Record<string, string>;\n}\\``;\n\n// `config.agentRuntimes?.['Name']` as read by generated TS a2a/mcp clients and\n// the agent-chat CLI. Idempotent via the `not contains ?.arn` guard.\nconst TS_CLIENT_ARN_PATTERNS = [\n '`config.agentRuntimes?.[$name]` => `config.agentRuntimes?.[$name]?.arn` where { $program <: not contains `config.agentRuntimes?.[$name]?.arn` }',\n '`config?.agentRuntimes?.[$name]` => `config?.agentRuntimes?.[$name]?.arn` where { $program <: not contains `config?.agentRuntimes?.[$name]?.arn` }',\n];\n\n// The agent-chat CLI's agentcore.ts calls `getAppConfig` directly rather than\n// the shared `AgentCoreRuntimeConfig` type, so its own inline cast needs the\n// same { arn } reshape TS_RUNTIME_CONFIG_INTERFACE_PATTERN gives the shared\n// interface.\nconst AGENTCORE_CHAT_SCRIPT_TYPE_PATTERN =\n '`{ agentRuntimes?: Record<string, string> }` => `{ agentRuntimes?: Record<string, { arn: string }> }`';\n\n// Python equivalent (Strands + LangChain client templates).\nconst PY_CLIENT_ARN_PATTERN =\n 'language python\\n`agent_runtime_arn = config.get(\"agentRuntimes\", {}).get($name)` => `agent_runtime = config.get(\"agentRuntimes\", {}).get($name)\\nagent_runtime_arn = agent_runtime.get(\"arn\") if agent_runtime else None`';\n\n// Removes the imperative logModelErrors(agent)/logToolErrors(agent) calls.\n// Required for AG-UI (its adapter clones the template agent per-thread, and\n// hooks added directly to the template don't carry over — the equivalent\n// behaviour is restored via the AGUI_INDEX_* plugins below). For HTTP/A2A\n// it's a style unification, since the imperative form already worked there.\nconst AGENT_TS_LOG_MODEL_CALL_PATTERN = '`logModelErrors(agent);` => .';\nconst AGENT_TS_LOG_TOOL_CALL_PATTERN = '`logToolErrors(agent);` => .';\n\n// HTTP/A2A agents build one Agent per session, so wiring `sessionManager`\n// directly into the constructor is safe. Generic over `$props` so this works\n// regardless of customised systemPrompt/tools, as long as it's an inline\n// object literal. Prepended (not appended) to sidestep a trailing-comma\n// double-comma when `$props` is captured as raw source text.\nconst AGENT_TS_SESSION_MANAGER_CONSTRUCTOR_PATTERN =\n '`new Agent({ $props })` => `new Agent({ sessionManager: await getSessionManager(), $props })` where { $props <: not contains `sessionManager` }';\n\n// Match-only gate for the rewrites above/below: only applies when the Agent\n// is an inline object literal, not e.g. a variable.\nconst AGENT_TS_CONSTRUCTOR_MATCH_PATTERN = '`new Agent({ $props })`';\n\n// Moves the model/tool error hooks to Agent constructor plugins, mirroring\n// the AG-UI rewrite for consistency (HTTP/A2A already worked with the\n// imperative form).\nconst AGENT_TS_PLUGINS_CONSTRUCTOR_PATTERN =\n '`new Agent({ $props })` => `new Agent({ plugins: [new ModelErrorLoggingPlugin(), new ToolErrorLoggingPlugin()], $props })` where { $props <: not contains `plugins` }';\n\n// Captures the agent-connection package specifier so the new imports (and the\n// session.ts this migration creates) target the same module. Generic over\n// `$names` since a connection generator may have merged its own import here.\nconst AGENT_TS_LOG_IMPORT_CAPTURE_PATTERN =\n \"`import { $names } from '$mod';` where { $names <: contains `logModelErrors`, $names <: contains `logToolErrors` }\";\n\n// Removes `logModelErrors`/`logToolErrors` from the import, preserving any\n// other merged specifiers (or the whole statement if none remain). Decomposed\n// via `import_clause(name=named_imports($imports))` since a naive\n// `$rest`-based rewrite silently fails once 2+ other specifiers are merged in.\nconst AGENT_TS_REMOVE_LOG_ERRORS_IMPORT_PATTERN =\n \"`import $clause from '$mod';` as $import where { $clause <: import_clause(name=named_imports($imports)), $imports <: contains `logModelErrors`, $imports <: contains `logToolErrors`, if ($imports <: [`logModelErrors`, `logToolErrors`]) { $import => . } else { $imports <: some import_specifier(name=or { `logModelErrors`, `logToolErrors` }) => . } }\";\n\n// Existing agents predate session.ts, so there's no prior storage to\n// preserve — default to in-memory.\nconst legacySessionManagerContent = (\n agentConnectionModule: string,\n localSessionsDir: string,\n): string => `import { SessionManager } from '@strands-agents/sdk';\nimport { InMemoryStorage, LocalFileStorage } from '@strands-agents/sdk/storage';\nimport { getCurrentSessionId } from '${agentConnectionModule}';\n\n/**\n * Returns a SessionManager for persisting conversation state across\n * invocations. Local development always uses local file storage for\n * convenience, regardless of the configured session option. Without a\n * configured session option, conversation state is kept in memory only and\n * does not survive process restarts.\n */\nexport const getSessionManager = async (): Promise<SessionManager> => {\n const sessionId = getCurrentSessionId();\n if (!sessionId) {\n throw new Error(\n 'No current session id — cannot resolve a SessionManager outside of a request scope.',\n );\n }\n if (process.env.LOCAL_DEV === 'true') {\n return new SessionManager({\n sessionId,\n storage: new LocalFileStorage('${localSessionsDir}'),\n });\n }\n return new SessionManager({ sessionId, storage: new InMemoryStorage() });\n};\n`;\n\n/** The Nx project owning `dirPath`, if any (the longest-matching project.root). */\nconst findOwningProject = (\n tree: Tree,\n dirPath: string,\n): ProjectConfiguration | undefined => {\n let best: ProjectConfiguration | undefined;\n for (const project of getProjects(tree).values()) {\n if (\n (dirPath === project.root || dirPath.startsWith(`${project.root}/`)) &&\n (!best || project.root.length > best.root.length)\n ) {\n best = project;\n }\n }\n return best;\n};\n\n/** This agent's own ComponentMetadata entry, as written by the ts#agent generator. */\nconst findAgentComponentMetadata = (\n project: ProjectConfiguration,\n dirRelativeToProjectRoot: string,\n): ComponentMetadata | undefined =>\n (project.metadata as { components?: ComponentMetadata[] })?.components?.find(\n (component) =>\n component.generator === TS_AGENT_GENERATOR_INFO.id &&\n component.path === dirRelativeToProjectRoot,\n );\n\n/** This agent's real kebab-case name, from ComponentMetadata's `rc` (class-name) field. */\nconst agentTmpNameFor = (\n project: ProjectConfiguration,\n dir: string,\n): string | undefined => {\n const dirRelativeToProjectRoot = toProjectRelativePath(project, dir);\n const rc = findAgentComponentMetadata(project, dirRelativeToProjectRoot)?.rc;\n return rc ? kebabCase(rc) : undefined;\n};\n\n/** This agent's protocol, from ComponentMetadata's `protocol` field. */\nconst agentProtocolFor = (\n project: ProjectConfiguration,\n dir: string,\n): string | undefined => {\n const dirRelativeToProjectRoot = toProjectRelativePath(project, dir);\n return findAgentComponentMetadata(project, dirRelativeToProjectRoot)\n ?.protocol;\n};\n\n/** The relative path from `projectRoot` up to this agent's workspace-root-level local session storage. */\nconst localSessionsDirFor = (\n projectRoot: string,\n agentTmpName: string,\n): string =>\n joinPathFragments(\n getRelativePathToRootByDirectory(projectRoot),\n `tmp/agents/strands/${agentTmpName}`,\n );\n\n// Wires ModelErrorLoggingPlugin/ToolErrorLoggingPlugin into the StrandsAgent\n// constructor, restoring the error-logging behaviour removed from agent.ts.\nconst AGUI_INDEX_IMPORT_PATTERN =\n \"`import { $names } from '$mod'` => `import { ModelErrorLoggingPlugin, ToolErrorLoggingPlugin, $names } from '$mod'` where { $names <: contains `runWithSessionId`, $names <: not contains `ModelErrorLoggingPlugin` }\";\n// Match-only form of the target shape, used to gate before touching the\n// sibling agent.ts, and before committing to the rewrite here.\nconst AGUI_INDEX_CONSTRUCTOR_MATCH_PATTERN =\n '`new StrandsAgent({ agent, name: $name, description: $desc })`';\nconst AGUI_INDEX_CONSTRUCTOR_PATTERN = `${AGUI_INDEX_CONSTRUCTOR_MATCH_PATTERN} => \\`new StrandsAgent({ agent, name: $name, description: $desc, plugins: [new ModelErrorLoggingPlugin(), new ToolErrorLoggingPlugin()] })\\``;\n\nconst AGUI_INDEX_IMPORT_CAPTURE_PATTERN =\n \"`import { $names } from '$mod';` where { $names <: contains `runWithSessionId` }\";\n\n// AG-UI's StrandsAgent adapter needs a sessionManagerProvider (called once\n// per threadId), mirroring AGENT_TS_SESSION_MANAGER_CONSTRUCTOR_PATTERN.\nconst aguiIndexSessionManagerImportPattern = (esm: boolean) =>\n `\\`import { getAgent } from '$mod';\\` => raw\\`import { getAgent } from '$mod';\nimport { getSessionManager } from './session${esm ? '.js' : ''}';\\` where { $program <: not contains \\`getSessionManager\\` }`;\n// Anchored on the exact 4-property shape produced above, so this only fires\n// once plugins are wired in. Used both to gate and to rewrite.\nconst AGUI_INDEX_SESSION_MANAGER_MATCH_PATTERN =\n '`new StrandsAgent({ agent, name: $name, description: $desc, plugins: $plugins })`';\nconst AGUI_INDEX_SESSION_MANAGER_CONSTRUCTOR_PATTERN = `${AGUI_INDEX_SESSION_MANAGER_MATCH_PATTERN} => \\`new StrandsAgent({ agent, name: $name, description: $desc, plugins: $plugins, config: { sessionManagerProvider: getSessionManager } })\\``;\n\n// The plugin classes referenced above only exist once model-errors-strands.ts\n// / tool-errors-strands.ts are converted from their plain logXErrors function\n// form (see checkPluginClass/applyPluginClass below). Anchored on the\n// `agent.addHook(...)` call so this doesn't re-match its own output.\nconst MODEL_ERRORS_IMPORT_PATTERN =\n \"`import { AfterModelCallEvent, type LocalAgent } from '@strands-agents/sdk';` => `import { AfterModelCallEvent, type LocalAgent, type Plugin } from '@strands-agents/sdk';`\";\n// Match-only form of the target shape, checked before committing to either\n// this or the sibling tool-errors conversion — see checkPluginClass.\nconst MODEL_ERRORS_CLASS_MATCH_PATTERN =\n '`export const logModelErrors = (agent: LocalAgent): void => { agent.addHook(AfterModelCallEvent, $callback); };`';\nconst MODEL_ERRORS_CLASS_PATTERN = `${MODEL_ERRORS_CLASS_MATCH_PATTERN} => raw\\`export class ModelErrorLoggingPlugin implements Plugin {\\n readonly name = 'model-error-logging';\\n\\n initAgent(agent: LocalAgent): void {\\n agent.addHook(AfterModelCallEvent, $callback);\\n }\\n}\\``;\n\nconst TOOL_ERRORS_IMPORT_PATTERN =\n \"`import { AfterToolCallEvent, type LocalAgent, TextBlock } from '@strands-agents/sdk';` => `import { AfterToolCallEvent, type LocalAgent, type Plugin, TextBlock } from '@strands-agents/sdk';`\";\nconst TOOL_ERRORS_CLASS_MATCH_PATTERN =\n '`export const logToolErrors = (agent: LocalAgent): void => { agent.addHook(AfterToolCallEvent, $callback); };`';\nconst TOOL_ERRORS_CLASS_PATTERN = `${TOOL_ERRORS_CLASS_MATCH_PATTERN} => raw\\`export class ToolErrorLoggingPlugin implements Plugin {\\n readonly name = 'tool-error-logging';\\n\\n initAgent(agent: LocalAgent): void {\\n agent.addHook(AfterToolCallEvent, $callback);\\n }\\n}\\``;\n\ntype PluginClassStatus = 'ready' | 'done' | 'diverged';\n\n/**\n * Checks (without writing) whether `filePath` still needs converting from its\n * plain `logXErrors` function to `className`, and whether the conversion\n * pattern would actually apply. `'done'` covers both \"already converted\" and\n * \"file doesn't exist\" — either way there's nothing to do and nothing\n * blocking the sibling conversion.\n */\nasync function checkPluginClass(\n tree: Tree,\n filePath: string,\n className: string,\n classMatchPattern: string,\n): Promise<PluginClassStatus> {\n if (!tree.exists(filePath)) {\n return 'done';\n }\n if ((tree.read(filePath, 'utf-8') ?? '').includes(`class ${className}`)) {\n return 'done';\n }\n return (await matchGritQL(tree, filePath, classMatchPattern))\n ? 'ready'\n : 'diverged';\n}\n\n/** Applies the class + import rewrite for a file already confirmed `'ready'`. */\nasync function applyPluginClass(\n tree: Tree,\n filePath: string,\n importPattern: string,\n classPattern: string,\n): Promise<void> {\n // The class rewrite is applied first, and the import only added once it's\n // confirmed to have actually happened here — not because either could fail\n // at this point (checkPluginClass already confirmed the pattern matches),\n // but to keep this file's own edit order self-evidently safe to read.\n await applyGritQL(tree, filePath, classPattern);\n await applyGritQL(tree, filePath, importPattern);\n}\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n let anyChanges = false;\n\n // Both classes live in one shared agent-connection package, so their\n // readiness is resolved once up front rather than per agent.\n const modelErrorsPath = joinPathFragments(\n AGENT_CONNECTION_PROJECT_DIR,\n 'src',\n 'core',\n 'model-errors-strands.ts',\n );\n const toolErrorsPath = joinPathFragments(\n AGENT_CONNECTION_PROJECT_DIR,\n 'src',\n 'core',\n 'tool-errors-strands.ts',\n );\n // Checked together, before writing either: all-or-nothing, so a run either\n // converts both or leaves both untouched — never just one.\n const modelPluginStatus = await checkPluginClass(\n tree,\n modelErrorsPath,\n 'ModelErrorLoggingPlugin',\n MODEL_ERRORS_CLASS_MATCH_PATTERN,\n );\n const toolPluginStatus = await checkPluginClass(\n tree,\n toolErrorsPath,\n 'ToolErrorLoggingPlugin',\n TOOL_ERRORS_CLASS_MATCH_PATTERN,\n );\n const pluginsReady =\n modelPluginStatus !== 'diverged' && toolPluginStatus !== 'diverged';\n\n if (pluginsReady) {\n if (modelPluginStatus === 'ready') {\n await applyPluginClass(\n tree,\n modelErrorsPath,\n MODEL_ERRORS_IMPORT_PATTERN,\n MODEL_ERRORS_CLASS_PATTERN,\n );\n }\n if (toolPluginStatus === 'ready') {\n await applyPluginClass(\n tree,\n toolErrorsPath,\n TOOL_ERRORS_IMPORT_PATTERN,\n TOOL_ERRORS_CLASS_PATTERN,\n );\n }\n } else {\n if (modelPluginStatus === 'diverged') {\n nextSteps.push(\n `${modelErrorsPath}: diverged from the generated shape - left as-is. Manually convert it to a \\`ModelErrorLoggingPlugin\\` class implementing \\`Plugin\\` (see the ts#agent generator's template); agent.ts/index.ts files that reference it are left unmigrated until both this and ${toolErrorsPath} are converted.`,\n );\n }\n if (toolPluginStatus === 'diverged') {\n nextSteps.push(\n `${toolErrorsPath}: diverged from the generated shape - left as-is. Manually convert it to a \\`ToolErrorLoggingPlugin\\` class implementing \\`Plugin\\` (see the ts#agent generator's template); agent.ts/index.ts files that reference it are left unmigrated until both this and ${modelErrorsPath} are converted.`,\n );\n }\n }\n\n const filePaths: string[] = [];\n visitNotIgnoredFiles(tree, '', (filePath) => filePaths.push(filePath));\n\n for (const filePath of filePaths) {\n if (filePath === modelErrorsPath || filePath === toolErrorsPath) {\n continue;\n }\n if (filePath.endsWith('.d.ts')) {\n continue;\n }\n\n // session.ts already targets the new { arn, session } shape via\n // `config.agentRuntimes?.[$name]?.session?.bucketName` — the generic\n // reshape branch below would otherwise corrupt that into `?.arn?.session?.bucketName`.\n if (filePath.endsWith('/session.ts')) {\n continue;\n }\n\n if (filePath.endsWith('/agent.ts')) {\n const dir = filePath.split('/').slice(0, -1).join('/');\n const project = findOwningProject(tree, dir);\n\n // Without a registered project there's no ComponentMetadata, so this\n // agent's protocol/name/agent-connection module can't be resolved — and\n // a pre-migration AG-UI agent.ts is textually identical to an\n // HTTP/A2A one, so there's nothing left to safely guess from.\n if (!project) {\n if (\n await matchGritQL(tree, filePath, AGENT_TS_LOG_IMPORT_CAPTURE_PATTERN)\n ) {\n nextSteps.push(\n `${filePath}: could not determine the project root — manually verify whether this is an AG-UI or HTTP/A2A agent and complete its session-manager/error-logging-plugin migration accordingly (see the ts#agent generator's template).`,\n );\n }\n continue;\n }\n\n const protocol = agentProtocolFor(project, dir);\n\n if (protocol === 'ag-ui') {\n const hasLogCalls =\n (await matchGritQL(\n tree,\n filePath,\n AGENT_TS_LOG_MODEL_CALL_PATTERN,\n )) ||\n (await matchGritQL(tree, filePath, AGENT_TS_LOG_TOOL_CALL_PATTERN));\n if (!hasLogCalls) {\n continue;\n }\n\n // The sibling index.ts restores error-logging via StrandsAgent\n // plugins — removing the calls here without that succeeding would\n // drop error logging rather than move it.\n const indexPath = `${dir}/index.ts`;\n const indexReady =\n pluginsReady &&\n (await matchGritQL(\n tree,\n indexPath,\n AGUI_INDEX_CONSTRUCTOR_MATCH_PATTERN,\n ));\n\n if (!indexReady) {\n nextSteps.push(\n `${filePath}: left the logModelErrors/logToolErrors calls in place — ${indexPath} could not be automatically wired with the equivalent StrandsAgent plugins. Move error logging to plugins there manually (see the ts#agent generator's template), then remove these calls.`,\n );\n continue;\n }\n\n const rewroteImport = await applyGritQL(\n tree,\n filePath,\n AGENT_TS_REMOVE_LOG_ERRORS_IMPORT_PATTERN,\n );\n const rewroteModelCall = await applyGritQL(\n tree,\n filePath,\n AGENT_TS_LOG_MODEL_CALL_PATTERN,\n );\n const rewroteToolCall = await applyGritQL(\n tree,\n filePath,\n AGENT_TS_LOG_TOOL_CALL_PATTERN,\n );\n if (rewroteImport || rewroteModelCall || rewroteToolCall) {\n anyChanges = true;\n }\n continue;\n }\n\n if (!protocol) {\n if (\n await matchGritQL(tree, filePath, AGENT_TS_LOG_IMPORT_CAPTURE_PATTERN)\n ) {\n nextSteps.push(\n `${filePath}: could not determine this agent's protocol from its ComponentMetadata — manually verify whether it's AG-UI or HTTP/A2A and wire sessionManager/the error-logging plugins in accordingly (see the ts#agent generator's template).`,\n );\n }\n continue;\n }\n\n // HTTP/A2A: wire sessionManager into the Agent constructor and create\n // the sibling session.ts if it doesn't exist yet.\n if (\n !(await matchGritQL(\n tree,\n filePath,\n AGENT_TS_LOG_IMPORT_CAPTURE_PATTERN,\n ))\n ) {\n continue;\n }\n\n const sessionPath = `${dir}/session.ts`;\n\n // Checked before any writes: if the plugin classes aren't available, or\n // the Agent isn't an inline object literal, leave the file untouched\n // entirely rather than ending up half-migrated.\n if (!pluginsReady) {\n nextSteps.push(\n `${filePath}: left as-is — ModelErrorLoggingPlugin/ToolErrorLoggingPlugin are not available yet (see the model-errors-strands.ts/tool-errors-strands.ts next step above). Wire sessionManager and the plugins in manually once those classes exist.`,\n );\n continue;\n }\n if (\n !(await matchGritQL(tree, filePath, AGENT_TS_CONSTRUCTOR_MATCH_PATTERN))\n ) {\n nextSteps.push(\n `${filePath}: the Agent is not constructed with an inline object literal (\\`new Agent({ ... })\\`), so sessionManager and the error-logging plugins could not be wired in automatically. Manually add \\`sessionManager: await getSessionManager()\\` and \\`plugins: [new ModelErrorLoggingPlugin(), new ToolErrorLoggingPlugin()]\\` to its constructor (see the ts#agent generator's template), creating ${sessionPath} first if it doesn't already exist.`,\n );\n continue;\n }\n\n if (!tree.exists(sessionPath)) {\n const mod = await captureGritQLVariable(\n tree,\n filePath,\n AGENT_TS_LOG_IMPORT_CAPTURE_PATTERN,\n 'mod',\n );\n const agentName = agentTmpNameFor(project, dir);\n\n if (mod && agentName) {\n tree.write(\n sessionPath,\n legacySessionManagerContent(\n mod,\n localSessionsDirFor(project.root, agentName),\n ),\n );\n } else {\n nextSteps.push(\n `${filePath}: could not determine the agent-connection module or this agent's name from its ComponentMetadata — manually create a session.ts (see the ts#agent generator's template) and wire \\`sessionManager: await getSessionManager()\\` into the Agent constructor.`,\n );\n continue;\n }\n }\n\n // Merges the plugin imports into the existing logModelErrors/\n // logToolErrors import clause (rather than a redundant second import),\n // and adds getSessionManager as its own line. The old specifiers are\n // stripped separately below, after this rewrite anchors on them.\n const esm = isEsmWorkspace(tree);\n await applyGritQL(\n tree,\n filePath,\n `\\`import { $names } from '$mod';\\` => raw\\`import { ModelErrorLoggingPlugin, ToolErrorLoggingPlugin, $names } from '$mod';\nimport { getSessionManager } from './session${esm ? '.js' : ''}';\\` where { $names <: contains \\`logModelErrors\\`, $names <: contains \\`logToolErrors\\`, $program <: not contains \\`getSessionManager\\` }`,\n );\n\n // Only rewrite the constructor once the import is confirmed present.\n if (!(tree.read(filePath, 'utf-8') ?? '').includes('getSessionManager')) {\n nextSteps.push(\n `${filePath}: found ${sessionPath} but couldn't confirm the getSessionManager import — wire \\`sessionManager: await getSessionManager()\\` into the Agent constructor manually.`,\n );\n continue;\n }\n\n await applyGritQL(tree, filePath, AGENT_TS_LOG_MODEL_CALL_PATTERN);\n await applyGritQL(tree, filePath, AGENT_TS_LOG_TOOL_CALL_PATTERN);\n await applyGritQL(\n tree,\n filePath,\n AGENT_TS_REMOVE_LOG_ERRORS_IMPORT_PATTERN,\n );\n\n const rewrotePlugins = await applyGritQL(\n tree,\n filePath,\n AGENT_TS_PLUGINS_CONSTRUCTOR_PATTERN,\n );\n const rewroteConstructor = await applyGritQL(\n tree,\n filePath,\n AGENT_TS_SESSION_MANAGER_CONSTRUCTOR_PATTERN,\n );\n if (rewrotePlugins || rewroteConstructor) {\n anyChanges = true;\n }\n continue;\n }\n\n if (\n filePath.endsWith('/index.ts') &&\n (tree.read(filePath, 'utf-8') ?? '').includes('@ag-ui/aws-strands')\n ) {\n const alreadyWired = (tree.read(filePath, 'utf-8') ?? '').includes(\n 'ModelErrorLoggingPlugin',\n );\n\n if (!alreadyWired) {\n // Import and constructor only apply cleanly together — adding the\n // import while the constructor can't be rewritten would leave an\n // unused import and no plugins wired in.\n const needsPluginWiring = await matchGritQL(\n tree,\n filePath,\n AGUI_INDEX_CONSTRUCTOR_MATCH_PATTERN,\n );\n if (!pluginsReady) {\n if (needsPluginWiring) {\n nextSteps.push(\n `${filePath}: left the StrandsAgent constructor as-is — ModelErrorLoggingPlugin/ToolErrorLoggingPlugin are not available yet (see the model-errors-strands.ts/tool-errors-strands.ts next step above). Wire them in manually once those classes exist.`,\n );\n }\n continue;\n }\n if (!needsPluginWiring) {\n nextSteps.push(\n `${filePath}: the StrandsAgent constructor has diverged from the generated shape - left as-is. Manually add \\`plugins: [new ModelErrorLoggingPlugin(), new ToolErrorLoggingPlugin()]\\` to it (see the ts#agent generator's template).`,\n );\n continue;\n }\n\n const rewroteImport = await applyGritQL(\n tree,\n filePath,\n AGUI_INDEX_IMPORT_PATTERN,\n );\n const rewroteConstructor = await applyGritQL(\n tree,\n filePath,\n AGUI_INDEX_CONSTRUCTOR_PATTERN,\n );\n if (rewroteImport || rewroteConstructor) {\n anyChanges = true;\n }\n }\n\n // Create the sibling session.ts (once plugins are present) and wire in\n // sessionManagerProvider. Gated on the exact post-plugins shape, so a\n // customised constructor is left alone rather than creating an unused\n // session.ts.\n if (\n !(await matchGritQL(\n tree,\n filePath,\n AGUI_INDEX_SESSION_MANAGER_MATCH_PATTERN,\n ))\n ) {\n continue;\n }\n\n const dir = filePath.split('/').slice(0, -1).join('/');\n const sessionPath = `${dir}/session.ts`;\n\n if (!tree.exists(sessionPath)) {\n const project = findOwningProject(tree, dir);\n const mod = await captureGritQLVariable(\n tree,\n filePath,\n AGUI_INDEX_IMPORT_CAPTURE_PATTERN,\n 'mod',\n );\n const agentName = project && agentTmpNameFor(project, dir);\n\n if (project && mod && agentName) {\n tree.write(\n sessionPath,\n legacySessionManagerContent(\n mod,\n localSessionsDirFor(project.root, agentName),\n ),\n );\n } else {\n nextSteps.push(\n `${filePath}: could not determine the project root, agent-connection module, or this agent's name from its ComponentMetadata — manually create a session.ts (see the ts#agent generator's template) and wire \\`config: { sessionManagerProvider: getSessionManager }\\` into the StrandsAgent constructor.`,\n );\n continue;\n }\n }\n\n const esm = isEsmWorkspace(tree);\n await applyGritQL(\n tree,\n filePath,\n aguiIndexSessionManagerImportPattern(esm),\n );\n\n if (!(tree.read(filePath, 'utf-8') ?? '').includes('getSessionManager')) {\n nextSteps.push(\n `${filePath}: found ${sessionPath} but couldn't confirm the getSessionManager import — wire \\`config: { sessionManagerProvider: getSessionManager }\\` into the StrandsAgent constructor manually.`,\n );\n continue;\n }\n\n const rewroteSessionManagerConstructor = await applyGritQL(\n tree,\n filePath,\n AGUI_INDEX_SESSION_MANAGER_CONSTRUCTOR_PATTERN,\n );\n if (rewroteSessionManagerConstructor) {\n anyChanges = true;\n }\n continue;\n }\n\n if (filePath.endsWith('.ts') || filePath.endsWith('.tsx')) {\n const contents = tree.read(filePath, 'utf-8') ?? '';\n if (!contents.includes('agentRuntimes')) {\n continue;\n }\n // Only the 'agentcore' namespace is reshaped — see CDK_RC_SET_PATTERN.\n const rewroteAgentcoreRcSet = await applyGritQL(\n tree,\n filePath,\n CDK_RC_SET_PATTERN,\n );\n const rewroteInterface = await applyGritQL(\n tree,\n filePath,\n TS_RUNTIME_CONFIG_INTERFACE_PATTERN,\n );\n let rewroteClientArn = false;\n for (const pattern of TS_CLIENT_ARN_PATTERNS) {\n rewroteClientArn = (await applyGritQL(tree, filePath, pattern))\n ? true\n : rewroteClientArn;\n }\n const rewroteChatScriptType = await applyGritQL(\n tree,\n filePath,\n AGENTCORE_CHAT_SCRIPT_TYPE_PATTERN,\n );\n\n if (\n rewroteAgentcoreRcSet ||\n rewroteInterface ||\n rewroteClientArn ||\n rewroteChatScriptType\n ) {\n anyChanges = true;\n }\n } else if (filePath.endsWith('.tf')) {\n const contents = tree.read(filePath, 'utf-8') ?? '';\n if (!contents.includes('\"agentRuntimes\"')) {\n continue;\n }\n const rewrote = await applyGritQL(tree, filePath, TF_VALUE_PATTERN);\n if (rewrote) {\n anyChanges = true;\n }\n } else if (filePath.endsWith('.py')) {\n const contents = tree.read(filePath, 'utf-8') ?? '';\n if (!contents.includes('agentRuntimes')) {\n continue;\n }\n const rewrote = await applyGritQL(tree, filePath, PY_CLIENT_ARN_PATTERN);\n if (rewrote) {\n anyChanges = true;\n }\n }\n }\n\n if (anyChanges) {\n nextSteps.push(\n 'If you have custom code reading the runtime config `agentcore.agentRuntimes` entries ' +\n 'as plain ARN strings (e.g. custom Lambda handlers or agent code), update it to read ' +\n 'the ARN from `.arn` on the new `{ arn }` shape.',\n );\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","visitNotIgnoredFiles","TS_AGENT_GENERATOR_INFO","AGENT_CONNECTION_PROJECT_DIR","applyGritQL","captureGritQLVariable","matchGritQL","formatFilesInSubtree","isEsmWorkspace","kebabCase","getRelativePathToRootByDirectory","toProjectRelativePath","CDK_RC_SET_PATTERN","TF_VALUE_PATTERN","TS_RUNTIME_CONFIG_INTERFACE_PATTERN","TS_CLIENT_ARN_PATTERNS","AGENTCORE_CHAT_SCRIPT_TYPE_PATTERN","PY_CLIENT_ARN_PATTERN","AGENT_TS_LOG_MODEL_CALL_PATTERN","AGENT_TS_LOG_TOOL_CALL_PATTERN","AGENT_TS_SESSION_MANAGER_CONSTRUCTOR_PATTERN","AGENT_TS_CONSTRUCTOR_MATCH_PATTERN","AGENT_TS_PLUGINS_CONSTRUCTOR_PATTERN","AGENT_TS_LOG_IMPORT_CAPTURE_PATTERN","AGENT_TS_REMOVE_LOG_ERRORS_IMPORT_PATTERN","legacySessionManagerContent","agentConnectionModule","localSessionsDir","findOwningProject","tree","dirPath","best","project","values","root","startsWith","length","findAgentComponentMetadata","dirRelativeToProjectRoot","metadata","components","find","component","generator","id","path","agentTmpNameFor","dir","rc","undefined","agentProtocolFor","protocol","localSessionsDirFor","projectRoot","agentTmpName","AGUI_INDEX_IMPORT_PATTERN","AGUI_INDEX_CONSTRUCTOR_MATCH_PATTERN","AGUI_INDEX_CONSTRUCTOR_PATTERN","AGUI_INDEX_IMPORT_CAPTURE_PATTERN","aguiIndexSessionManagerImportPattern","esm","AGUI_INDEX_SESSION_MANAGER_MATCH_PATTERN","AGUI_INDEX_SESSION_MANAGER_CONSTRUCTOR_PATTERN","MODEL_ERRORS_IMPORT_PATTERN","MODEL_ERRORS_CLASS_MATCH_PATTERN","MODEL_ERRORS_CLASS_PATTERN","TOOL_ERRORS_IMPORT_PATTERN","TOOL_ERRORS_CLASS_MATCH_PATTERN","TOOL_ERRORS_CLASS_PATTERN","checkPluginClass","filePath","className","classMatchPattern","exists","read","includes","applyPluginClass","importPattern","classPattern","migration","nextSteps","anyChanges","modelErrorsPath","toolErrorsPath","modelPluginStatus","toolPluginStatus","pluginsReady","push","filePaths","endsWith","split","slice","join","hasLogCalls","indexPath","indexReady","rewroteImport","rewroteModelCall","rewroteToolCall","sessionPath","mod","agentName","write","rewrotePlugins","rewroteConstructor","alreadyWired","needsPluginWiring","rewroteSessionManagerConstructor","contents","rewroteAgentcoreRcSet","rewroteInterface","rewroteClientArn","pattern","rewroteChatScriptType","rewrote"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,EAIjBC,oBAAoB,QACf,aAAa;AACpB,SAASC,uBAAuB,QAAQ,iCAA8B;AACtE,SAASC,4BAA4B,QAAQ,sDAAmD;AAChG,SACEC,WAAW,EACXC,qBAAqB,EACrBC,WAAW,QACN,wBAAqB;AAC5B,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,cAAc,QAAQ,kCAA+B;AAC9D,SAASC,SAAS,QAAQ,0BAAuB;AAEjD,SACEC,gCAAgC,EAChCC,qBAAqB,QAChB,0BAAuB;AAE9B;;;;;;;;;;;;;;CAcC,GAED,8EAA8E;AAC9E,2EAA2E;AAC3E,sEAAsE;AACtE,6EAA6E;AAC7E,+DAA+D;AAC/D,MAAMC,qBAAqB,CAAC;;;;;KAKvB,CAAC;AAEN,wEAAwE;AACxE,+EAA+E;AAC/E,MAAMC,mBAAmB,CAAC;;;;;;;;;;;;;;;;GAgBvB,CAAC;AAEJ,yDAAyD;AACzD,iEAAiE;AACjE,MAAMC,sCAAsC,CAAC;;;;;;;;;;;;;;;GAe1C,CAAC;AAEJ,+EAA+E;AAC/E,qEAAqE;AACrE,MAAMC,yBAAyB;IAC7B;IACA;CACD;AAED,8EAA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@ -250,7 +250,7 @@ export default {
|
|
|
250
250
|
|
|
251
251
|
exports[`preset generator > should run successfully > biome.json 1`] = `
|
|
252
252
|
"{
|
|
253
|
-
"$schema": "https://biomejs.dev/schemas/2.5.
|
|
253
|
+
"$schema": "https://biomejs.dev/schemas/2.5.6/schema.json",
|
|
254
254
|
"root": true,
|
|
255
255
|
"formatter": {
|
|
256
256
|
"enabled": true,
|
|
@@ -412,11 +412,11 @@ onlyBuiltDependencies:
|
|
|
412
412
|
- sharp
|
|
413
413
|
catalogMode: strict
|
|
414
414
|
catalog:
|
|
415
|
-
nx: 23.1.
|
|
416
|
-
'@nx/js': 23.1.
|
|
417
|
-
'@nx/workspace': 23.1.
|
|
415
|
+
nx: 23.1.1
|
|
416
|
+
'@nx/js': 23.1.1
|
|
417
|
+
'@nx/workspace': 23.1.1
|
|
418
418
|
typescript: ~6.0.3
|
|
419
|
-
'@biomejs/biome': 2.5.
|
|
419
|
+
'@biomejs/biome': 2.5.6
|
|
420
420
|
'@aws/nx-plugin': ^0.0.0
|
|
421
421
|
'@aws/nx-plugin-mcp': ^0.0.0
|
|
422
422
|
"
|
|
@@ -103,7 +103,9 @@ export class SnapshotBedrockAgent
|
|
|
103
103
|
|
|
104
104
|
rc.set('agentcore', 'agentRuntimes', {
|
|
105
105
|
...rc.get('agentcore').agentRuntimes,
|
|
106
|
-
SnapshotBedrockAgent:
|
|
106
|
+
SnapshotBedrockAgent: {
|
|
107
|
+
arn: this.agentCoreRuntime.agentRuntimeArn,
|
|
108
|
+
},
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
111
|
|
|
@@ -299,18 +301,18 @@ version = "0.1.0"
|
|
|
299
301
|
dependencies = [
|
|
300
302
|
"proj-agent-connection",
|
|
301
303
|
"aws-lambda-powertools==3.31.1",
|
|
302
|
-
"aws-opentelemetry-distro==0.
|
|
303
|
-
"bedrock-agentcore==1.
|
|
304
|
-
"boto3==1.43.
|
|
305
|
-
"fastapi==0.
|
|
304
|
+
"aws-opentelemetry-distro==0.19.0",
|
|
305
|
+
"bedrock-agentcore==1.19.0",
|
|
306
|
+
"boto3==1.43.63",
|
|
307
|
+
"fastapi==0.141.1",
|
|
306
308
|
"mcp==1.28.1",
|
|
307
|
-
"strands-agents==1.
|
|
308
|
-
"strands-agents-tools==0.8.
|
|
309
|
-
"uvicorn==0.
|
|
309
|
+
"strands-agents==1.50.2",
|
|
310
|
+
"strands-agents-tools==0.8.5",
|
|
311
|
+
"uvicorn==0.52.1"
|
|
310
312
|
]
|
|
311
313
|
|
|
312
314
|
[dependency-groups]
|
|
313
|
-
dev = [ "fastapi[standard]==0.
|
|
315
|
+
dev = [ "fastapi[standard]==0.141.1" ]
|
|
314
316
|
|
|
315
317
|
[tool.uv]
|
|
316
318
|
dev-dependencies = [ ]
|
|
@@ -29,8 +29,8 @@ export const resolveRemoteAgent = async (): Promise<
|
|
|
29
29
|
application,
|
|
30
30
|
environment: 'default',
|
|
31
31
|
transform: 'json',
|
|
32
|
-
})) as { agentRuntimes?: Record<string, string> };
|
|
33
|
-
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
32
|
+
})) as { agentRuntimes?: Record<string, { arn: string }> };
|
|
33
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent']?.arn;
|
|
34
34
|
if (!arn) {
|
|
35
35
|
throw new Error(
|
|
36
36
|
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
@@ -131,8 +131,8 @@ export const resolveRemoteAgent = async (): Promise<
|
|
|
131
131
|
application,
|
|
132
132
|
environment: 'default',
|
|
133
133
|
transform: 'json',
|
|
134
|
-
})) as { agentRuntimes?: Record<string, string> };
|
|
135
|
-
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
134
|
+
})) as { agentRuntimes?: Record<string, { arn: string }> };
|
|
135
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent']?.arn;
|
|
136
136
|
if (!arn) {
|
|
137
137
|
throw new Error(
|
|
138
138
|
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
@@ -224,8 +224,8 @@ export const resolveRemoteAgent = async (): Promise<
|
|
|
224
224
|
application,
|
|
225
225
|
environment: 'default',
|
|
226
226
|
transform: 'json',
|
|
227
|
-
})) as { agentRuntimes?: Record<string, string> };
|
|
228
|
-
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
227
|
+
})) as { agentRuntimes?: Record<string, { arn: string }> };
|
|
228
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent']?.arn;
|
|
229
229
|
if (!arn) {
|
|
230
230
|
throw new Error(
|
|
231
231
|
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
@@ -308,8 +308,8 @@ export const resolveRemoteAgent = async (): Promise<
|
|
|
308
308
|
application,
|
|
309
309
|
environment: 'default',
|
|
310
310
|
transform: 'json',
|
|
311
|
-
})) as { agentRuntimes?: Record<string, string> };
|
|
312
|
-
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
311
|
+
})) as { agentRuntimes?: Record<string, { arn: string }> };
|
|
312
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent']?.arn;
|
|
313
313
|
if (!arn) {
|
|
314
314
|
throw new Error(
|
|
315
315
|
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
@@ -383,8 +383,8 @@ export const resolveRemoteAgent = async (): Promise<
|
|
|
383
383
|
application,
|
|
384
384
|
environment: 'default',
|
|
385
385
|
transform: 'json',
|
|
386
|
-
})) as { agentRuntimes?: Record<string, string> };
|
|
387
|
-
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
386
|
+
})) as { agentRuntimes?: Record<string, { arn: string }> };
|
|
387
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent']?.arn;
|
|
388
388
|
if (!arn) {
|
|
389
389
|
throw new Error(
|
|
390
390
|
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
@@ -495,8 +495,8 @@ export const resolveRemoteAgent = async (): Promise<
|
|
|
495
495
|
application,
|
|
496
496
|
environment: 'default',
|
|
497
497
|
transform: 'json',
|
|
498
|
-
})) as { agentRuntimes?: Record<string, string> };
|
|
499
|
-
const arn = config?.agentRuntimes?.['TestProjectAgent'];
|
|
498
|
+
})) as { agentRuntimes?: Record<string, { arn: string }> };
|
|
499
|
+
const arn = config?.agentRuntimes?.['TestProjectAgent']?.arn;
|
|
500
500
|
if (!arn) {
|
|
501
501
|
throw new Error(
|
|
502
502
|
\`No deployed agent named 'TestProjectAgent' found in runtime configuration (application \${application}).\`,
|
|
@@ -709,21 +709,21 @@ version = "0.1.0"
|
|
|
709
709
|
dependencies = [
|
|
710
710
|
"proj-agent-connection",
|
|
711
711
|
"aws-lambda-powertools==3.31.1",
|
|
712
|
-
"aws-opentelemetry-distro==0.
|
|
713
|
-
"bedrock-agentcore==1.
|
|
714
|
-
"boto3==1.43.
|
|
715
|
-
"fastapi==0.
|
|
712
|
+
"aws-opentelemetry-distro==0.19.0",
|
|
713
|
+
"bedrock-agentcore==1.19.0",
|
|
714
|
+
"boto3==1.43.63",
|
|
715
|
+
"fastapi==0.141.1",
|
|
716
716
|
"mcp==1.28.1",
|
|
717
717
|
"langchain==1.3.14",
|
|
718
|
-
"langchain-aws==1.6.
|
|
719
|
-
"langgraph==1.2.
|
|
718
|
+
"langchain-aws==1.6.4",
|
|
719
|
+
"langgraph==1.2.10",
|
|
720
720
|
"ag-ui-protocol==0.1.19",
|
|
721
721
|
"ag-ui-langgraph==0.0.42",
|
|
722
|
-
"uvicorn==0.
|
|
722
|
+
"uvicorn==0.52.1"
|
|
723
723
|
]
|
|
724
724
|
|
|
725
725
|
[dependency-groups]
|
|
726
|
-
dev = [ "fastapi[standard]==0.
|
|
726
|
+
dev = [ "fastapi[standard]==0.141.1" ]
|
|
727
727
|
|
|
728
728
|
[tool.uv]
|
|
729
729
|
dev-dependencies = [ ]
|
|
@@ -95,7 +95,7 @@ module "add_agent_runtime_to_runtime_config" {
|
|
|
95
95
|
|
|
96
96
|
namespace = "agentcore"
|
|
97
97
|
key = "agentRuntimes"
|
|
98
|
-
value = { "TerraformSnapshotAgent" = module.agent_core_runtime.agent_core_runtime_arn }
|
|
98
|
+
value = { "TerraformSnapshotAgent" = { arn = module.agent_core_runtime.agent_core_runtime_arn } }
|
|
99
99
|
|
|
100
100
|
depends_on = [module.agent_core_runtime]
|
|
101
101
|
}
|
|
@@ -134,7 +134,7 @@ exports[`py#agent generator > should match snapshot for Terraform generated file
|
|
|
134
134
|
required_providers {
|
|
135
135
|
aws = {
|
|
136
136
|
source = "hashicorp/aws"
|
|
137
|
-
version = "6.
|
|
137
|
+
version = "6.57.1"
|
|
138
138
|
}
|
|
139
139
|
null = {
|
|
140
140
|
source = "hashicorp/null"
|
|
@@ -542,7 +542,7 @@ resource "null_resource" "runtime_ready" {
|
|
|
542
542
|
|
|
543
543
|
provisioner "local-exec" {
|
|
544
544
|
command = <<-EOT
|
|
545
|
-
uv run --with boto3==1.43.
|
|
545
|
+
uv run --with boto3==1.43.63 python -c "
|
|
546
546
|
import boto3
|
|
547
547
|
import json
|
|
548
548
|
import os
|
|
@@ -128,7 +128,8 @@ class RemoteClientStrands:
|
|
|
128
128
|
if os.environ.get("LOCAL_DEV") == "true":
|
|
129
129
|
return AgentCoreA2aClientStrands.without_auth("http://localhost:9001/")
|
|
130
130
|
config = get_agentcore_runtime_config()
|
|
131
|
-
|
|
131
|
+
agent_runtime = config.get("agentRuntimes", {}).get("Remote")
|
|
132
|
+
agent_runtime_arn = agent_runtime.get("arn") if agent_runtime else None
|
|
132
133
|
if not agent_runtime_arn:
|
|
133
134
|
raise RuntimeError("No connected agent runtime named 'Remote' found in runtime configuration.")
|
|
134
135
|
return AgentCoreA2aClientStrands.with_iam_auth(agent_runtime_arn)
|
|
@@ -20,9 +20,10 @@ class <%- targetAgentClassName %>ClientStrands:
|
|
|
20
20
|
"http://localhost:<%- targetAgentPort %>/"
|
|
21
21
|
)
|
|
22
22
|
config = get_agentcore_runtime_config()
|
|
23
|
-
|
|
23
|
+
agent_runtime = config.get("agentRuntimes", {}).get(
|
|
24
24
|
"<%- targetAgentClassName %>"
|
|
25
25
|
)
|
|
26
|
+
agent_runtime_arn = agent_runtime.get("arn") if agent_runtime else None
|
|
26
27
|
if not agent_runtime_arn:
|
|
27
28
|
raise RuntimeError(
|
|
28
29
|
"No connected agent runtime named '<%- targetAgentClassName %>' found in runtime configuration."
|
|
@@ -18,9 +18,10 @@ class <%- targetAgentClassName %>ClientLangChain:
|
|
|
18
18
|
"http://localhost:<%- targetAgentPort %>/"
|
|
19
19
|
)
|
|
20
20
|
config = get_agentcore_runtime_config()
|
|
21
|
-
|
|
21
|
+
agent_runtime = config.get("agentRuntimes", {}).get(
|
|
22
22
|
"<%- targetAgentClassName %>"
|
|
23
23
|
)
|
|
24
|
+
agent_runtime_arn = agent_runtime.get("arn") if agent_runtime else None
|
|
24
25
|
if not agent_runtime_arn:
|
|
25
26
|
raise RuntimeError(
|
|
26
27
|
"No connected agent runtime named '<%- targetAgentClassName %>' found in runtime configuration."
|
|
@@ -10,7 +10,7 @@ import type { PyAgentA2aConnectionGeneratorSchema } from './schema';
|
|
|
10
10
|
export interface PyAgentA2aConnectionMetadata {
|
|
11
11
|
readonly framework: AgentFramework;
|
|
12
12
|
}
|
|
13
|
-
export declare const DEPENDENCIES: import("../../../utils/declared-dependencies").DependencyDeclaration<readonly import("../../../utils/declared-dependencies").DeclaredTsDependency<"@a2a-js/sdk" | "@aws/aws-distro-opentelemetry-node-autoinstrumentation" | "@opentelemetry/propagator-jaeger" | "minimatch" | "@aws-sdk/client-dynamodb" | "@aws-sdk/client-api-gateway" | "@aws-sdk/client-iam" | "@aws-sdk/client-bedrock-agentcore" | "@aws-sdk/client-bedrock-runtime" | "@aws-sdk/client-s3" | "@aws-sdk/client-sts" | "@aws-sdk/credential-providers" | "@aws-sdk/credential-provider-cognito-identity" | "@aws-sdk/client-secrets-manager" | "@aws-sdk/rds-signer" | "@aws-smithy/server-apigateway" | "@aws-smithy/server-node" | "@aws-lambda-powertools/logger" | "@aws-lambda-powertools/metrics" | "@aws-lambda-powertools/parameters" | "@aws-lambda-powertools/tracer" | "@aws-lambda-powertools/parser" | "@aws-sdk/client-appconfigdata" | "@middy/core" | "@nxlv/python" | "@nx-extend/terraform" | "nx" | "@nx/devkit" | "@nx/js" | "@nx/react" | "@nx/vite" | "@nx/vitest" | "@nx/workspace" | "create-nx-workspace" | "@swc-node/register" | "@swc/core" | "@modelcontextprotocol/sdk" | "@modelcontextprotocol/inspector" | "@ag-ui/a2ui-toolkit" | "@ag-ui/aws-strands" | "@ag-ui/client" | "@ag-ui/core" | "@ag-ui/encoder" | "agent-chat-cli" | "@copilotkit/react-core" | "rxjs" | "@strands-agents/sdk" | "@tanstack/react-router" | "@tanstack/router-plugin" | "@tanstack/router-generator" | "@tanstack/virtual-file-routes" | "@tanstack/router-utils" | "@cloudscape-design/board-components" | "@cloudscape-design/chat-components" | "@cloudscape-design/components" | "@cloudscape-design/global-styles" | "@tanstack/react-query" | "@tanstack/react-query-devtools" | "@trpc/tanstack-react-query" | "@trpc/client" | "@trpc/server" | "@types/node" | "@types/aws-lambda" | "@types/cors" | "@types/pg" | "@types/ws" | "@types/express" | "@smithy/config-resolver" | "@smithy/node-config-provider" | "@smithy/node-http-handler" | "@smithy/types" | "@vitest/coverage-v8" | "@vitest/ui" | "@astrojs/react" | "@astrojs/starlight" | "astro" | "aws4fetch" | "aws-cdk" | "aws-cdk-lib" | "aws-xray-sdk-core" | "constructs" | "cors" | "chalk" | "class-variance-authority" | "clsx" | "commander" | "electrodb" | "esbuild" | "event-source-polyfill" | "@types/event-source-polyfill" | "@biomejs/biome" | "@prisma/adapter-mariadb" | "@prisma/adapter-pg" | "@prisma/client" | "ejs" | "@types/ejs" | "express" | "fast-glob" | "husky" | "fs-extra" | "@types/fs-extra" | "make-dir-cli" | "mariadb" | "ncp" | "npm" | "npm-check-updates" | "oidc-client-ts" | "pg" | "prisma" | "react-oidc-context" | "react" | "react-dom" | "rimraf" | "rolldown" | "simple-git" | "source-map-support" | "starlight-blog" | "tailwindcss" | "@tailwindcss/vite" | "tsx" | "lucide-react" | "radix-ui" | "shadcn" | "tw-animate-css" | "tailwind-merge" | "vite" | "typescript" | "vitest" | "zod" | "ws", PyAgentA2aConnectionMetadata>[], readonly [{
|
|
13
|
+
export declare const DEPENDENCIES: import("../../../utils/declared-dependencies").DependencyDeclaration<readonly import("../../../utils/declared-dependencies").DeclaredTsDependency<"@a2a-js/sdk" | "@aws/aws-distro-opentelemetry-node-autoinstrumentation" | "@opentelemetry/propagator-jaeger" | "minimatch" | "@aws-sdk/client-dynamodb" | "@aws-sdk/client-api-gateway" | "@aws-sdk/client-iam" | "@aws-sdk/client-bedrock-agentcore" | "@aws-sdk/client-bedrock-runtime" | "@aws-sdk/client-s3" | "@aws-sdk/client-sts" | "@aws-sdk/credential-providers" | "@aws-sdk/credential-provider-cognito-identity" | "@aws-sdk/client-secrets-manager" | "@aws-sdk/rds-signer" | "@aws-smithy/server-apigateway" | "@aws-smithy/server-node" | "@aws-lambda-powertools/logger" | "@aws-lambda-powertools/metrics" | "@aws-lambda-powertools/parameters" | "@aws-lambda-powertools/tracer" | "@aws-lambda-powertools/parser" | "@aws-sdk/client-appconfigdata" | "@middy/core" | "@nxlv/python" | "@nx-extend/terraform" | "nx" | "@nx/devkit" | "@nx/js" | "@nx/react" | "@nx/vite" | "@nx/vitest" | "@nx/workspace" | "create-nx-workspace" | "@swc-node/register" | "@swc/core" | "@modelcontextprotocol/sdk" | "@modelcontextprotocol/inspector" | "@ag-ui/a2ui-toolkit" | "@ag-ui/aws-strands" | "@ag-ui/client" | "@ag-ui/core" | "@ag-ui/encoder" | "agent-chat-cli" | "@copilotkit/react-core" | "rxjs" | "@strands-agents/sdk" | "@tanstack/react-router" | "@tanstack/router-plugin" | "@tanstack/router-generator" | "@tanstack/virtual-file-routes" | "@tanstack/router-utils" | "@cloudscape-design/board-components" | "@cloudscape-design/chat-components" | "@cloudscape-design/components" | "@cloudscape-design/global-styles" | "@tanstack/react-query" | "@tanstack/react-query-devtools" | "@trpc/tanstack-react-query" | "@trpc/client" | "@trpc/server" | "@types/node" | "@types/aws-lambda" | "@types/cors" | "@types/pg" | "@types/ws" | "@types/express" | "@smithy/config-resolver" | "@smithy/node-config-provider" | "@smithy/node-http-handler" | "@smithy/types" | "@vitest/coverage-v8" | "@vitest/ui" | "@astrojs/react" | "@astrojs/starlight" | "astro" | "aws4fetch" | "aws-cdk" | "aws-cdk-lib" | "aws-xray-sdk-core" | "constructs" | "cors" | "chalk" | "class-variance-authority" | "clsx" | "commander" | "electrodb" | "esbuild" | "event-source-polyfill" | "@types/event-source-polyfill" | "@biomejs/biome" | "@prisma/adapter-mariadb" | "@prisma/adapter-pg" | "@prisma/client" | "ejs" | "@types/ejs" | "express" | "fast-glob" | "husky" | "fs-extra" | "@types/fs-extra" | "make-dir-cli" | "mariadb" | "ncp" | "npm" | "npm-check-updates" | "oidc-client-ts" | "pg" | "prisma" | "react-oidc-context" | "react" | "react-dom" | "rimraf" | "rolldown" | "rolldown-plugin-dts" | "@rollup/plugin-esm-shim" | "simple-git" | "source-map-support" | "starlight-blog" | "tailwindcss" | "@tailwindcss/vite" | "tsx" | "lucide-react" | "radix-ui" | "shadcn" | "tw-animate-css" | "tailwind-merge" | "vite" | "typescript" | "vitest" | "zod" | "ws", PyAgentA2aConnectionMetadata>[], readonly [{
|
|
14
14
|
readonly name: "boto3";
|
|
15
15
|
}, {
|
|
16
16
|
readonly name: "httpx";
|
|
@@ -10,7 +10,7 @@ import type { PyAgentGatewayConnectionGeneratorSchema } from './schema';
|
|
|
10
10
|
export interface PyAgentGatewayConnectionMetadata {
|
|
11
11
|
readonly framework: AgentFramework;
|
|
12
12
|
}
|
|
13
|
-
export declare const DEPENDENCIES: import("../../../utils/declared-dependencies").DependencyDeclaration<readonly import("../../../utils/declared-dependencies").DeclaredTsDependency<"@a2a-js/sdk" | "@aws/aws-distro-opentelemetry-node-autoinstrumentation" | "@opentelemetry/propagator-jaeger" | "minimatch" | "@aws-sdk/client-dynamodb" | "@aws-sdk/client-api-gateway" | "@aws-sdk/client-iam" | "@aws-sdk/client-bedrock-agentcore" | "@aws-sdk/client-bedrock-runtime" | "@aws-sdk/client-s3" | "@aws-sdk/client-sts" | "@aws-sdk/credential-providers" | "@aws-sdk/credential-provider-cognito-identity" | "@aws-sdk/client-secrets-manager" | "@aws-sdk/rds-signer" | "@aws-smithy/server-apigateway" | "@aws-smithy/server-node" | "@aws-lambda-powertools/logger" | "@aws-lambda-powertools/metrics" | "@aws-lambda-powertools/parameters" | "@aws-lambda-powertools/tracer" | "@aws-lambda-powertools/parser" | "@aws-sdk/client-appconfigdata" | "@middy/core" | "@nxlv/python" | "@nx-extend/terraform" | "nx" | "@nx/devkit" | "@nx/js" | "@nx/react" | "@nx/vite" | "@nx/vitest" | "@nx/workspace" | "create-nx-workspace" | "@swc-node/register" | "@swc/core" | "@modelcontextprotocol/sdk" | "@modelcontextprotocol/inspector" | "@ag-ui/a2ui-toolkit" | "@ag-ui/aws-strands" | "@ag-ui/client" | "@ag-ui/core" | "@ag-ui/encoder" | "agent-chat-cli" | "@copilotkit/react-core" | "rxjs" | "@strands-agents/sdk" | "@tanstack/react-router" | "@tanstack/router-plugin" | "@tanstack/router-generator" | "@tanstack/virtual-file-routes" | "@tanstack/router-utils" | "@cloudscape-design/board-components" | "@cloudscape-design/chat-components" | "@cloudscape-design/components" | "@cloudscape-design/global-styles" | "@tanstack/react-query" | "@tanstack/react-query-devtools" | "@trpc/tanstack-react-query" | "@trpc/client" | "@trpc/server" | "@types/node" | "@types/aws-lambda" | "@types/cors" | "@types/pg" | "@types/ws" | "@types/express" | "@smithy/config-resolver" | "@smithy/node-config-provider" | "@smithy/node-http-handler" | "@smithy/types" | "@vitest/coverage-v8" | "@vitest/ui" | "@astrojs/react" | "@astrojs/starlight" | "astro" | "aws4fetch" | "aws-cdk" | "aws-cdk-lib" | "aws-xray-sdk-core" | "constructs" | "cors" | "chalk" | "class-variance-authority" | "clsx" | "commander" | "electrodb" | "esbuild" | "event-source-polyfill" | "@types/event-source-polyfill" | "@biomejs/biome" | "@prisma/adapter-mariadb" | "@prisma/adapter-pg" | "@prisma/client" | "ejs" | "@types/ejs" | "express" | "fast-glob" | "husky" | "fs-extra" | "@types/fs-extra" | "make-dir-cli" | "mariadb" | "ncp" | "npm" | "npm-check-updates" | "oidc-client-ts" | "pg" | "prisma" | "react-oidc-context" | "react" | "react-dom" | "rimraf" | "rolldown" | "simple-git" | "source-map-support" | "starlight-blog" | "tailwindcss" | "@tailwindcss/vite" | "tsx" | "lucide-react" | "radix-ui" | "shadcn" | "tw-animate-css" | "tailwind-merge" | "vite" | "typescript" | "vitest" | "zod" | "ws", PyAgentGatewayConnectionMetadata>[], readonly [{
|
|
13
|
+
export declare const DEPENDENCIES: import("../../../utils/declared-dependencies").DependencyDeclaration<readonly import("../../../utils/declared-dependencies").DeclaredTsDependency<"@a2a-js/sdk" | "@aws/aws-distro-opentelemetry-node-autoinstrumentation" | "@opentelemetry/propagator-jaeger" | "minimatch" | "@aws-sdk/client-dynamodb" | "@aws-sdk/client-api-gateway" | "@aws-sdk/client-iam" | "@aws-sdk/client-bedrock-agentcore" | "@aws-sdk/client-bedrock-runtime" | "@aws-sdk/client-s3" | "@aws-sdk/client-sts" | "@aws-sdk/credential-providers" | "@aws-sdk/credential-provider-cognito-identity" | "@aws-sdk/client-secrets-manager" | "@aws-sdk/rds-signer" | "@aws-smithy/server-apigateway" | "@aws-smithy/server-node" | "@aws-lambda-powertools/logger" | "@aws-lambda-powertools/metrics" | "@aws-lambda-powertools/parameters" | "@aws-lambda-powertools/tracer" | "@aws-lambda-powertools/parser" | "@aws-sdk/client-appconfigdata" | "@middy/core" | "@nxlv/python" | "@nx-extend/terraform" | "nx" | "@nx/devkit" | "@nx/js" | "@nx/react" | "@nx/vite" | "@nx/vitest" | "@nx/workspace" | "create-nx-workspace" | "@swc-node/register" | "@swc/core" | "@modelcontextprotocol/sdk" | "@modelcontextprotocol/inspector" | "@ag-ui/a2ui-toolkit" | "@ag-ui/aws-strands" | "@ag-ui/client" | "@ag-ui/core" | "@ag-ui/encoder" | "agent-chat-cli" | "@copilotkit/react-core" | "rxjs" | "@strands-agents/sdk" | "@tanstack/react-router" | "@tanstack/router-plugin" | "@tanstack/router-generator" | "@tanstack/virtual-file-routes" | "@tanstack/router-utils" | "@cloudscape-design/board-components" | "@cloudscape-design/chat-components" | "@cloudscape-design/components" | "@cloudscape-design/global-styles" | "@tanstack/react-query" | "@tanstack/react-query-devtools" | "@trpc/tanstack-react-query" | "@trpc/client" | "@trpc/server" | "@types/node" | "@types/aws-lambda" | "@types/cors" | "@types/pg" | "@types/ws" | "@types/express" | "@smithy/config-resolver" | "@smithy/node-config-provider" | "@smithy/node-http-handler" | "@smithy/types" | "@vitest/coverage-v8" | "@vitest/ui" | "@astrojs/react" | "@astrojs/starlight" | "astro" | "aws4fetch" | "aws-cdk" | "aws-cdk-lib" | "aws-xray-sdk-core" | "constructs" | "cors" | "chalk" | "class-variance-authority" | "clsx" | "commander" | "electrodb" | "esbuild" | "event-source-polyfill" | "@types/event-source-polyfill" | "@biomejs/biome" | "@prisma/adapter-mariadb" | "@prisma/adapter-pg" | "@prisma/client" | "ejs" | "@types/ejs" | "express" | "fast-glob" | "husky" | "fs-extra" | "@types/fs-extra" | "make-dir-cli" | "mariadb" | "ncp" | "npm" | "npm-check-updates" | "oidc-client-ts" | "pg" | "prisma" | "react-oidc-context" | "react" | "react-dom" | "rimraf" | "rolldown" | "rolldown-plugin-dts" | "@rollup/plugin-esm-shim" | "simple-git" | "source-map-support" | "starlight-blog" | "tailwindcss" | "@tailwindcss/vite" | "tsx" | "lucide-react" | "radix-ui" | "shadcn" | "tw-animate-css" | "tailwind-merge" | "vite" | "typescript" | "vitest" | "zod" | "ws", PyAgentGatewayConnectionMetadata>[], readonly [{
|
|
14
14
|
readonly name: "boto3";
|
|
15
15
|
}, {
|
|
16
16
|
readonly name: "httpx";
|
|
@@ -193,6 +193,9 @@ export const pyAgentGenerator = async (tree, options)=>{
|
|
|
193
193
|
console.warn('Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)');
|
|
194
194
|
}
|
|
195
195
|
const auth = options.auth ?? 'iam';
|
|
196
|
+
// Only 'in-memory' is currently supported for Python agents (session manager
|
|
197
|
+
// support for Python is not yet implemented).
|
|
198
|
+
const session = options.session ?? 'in-memory';
|
|
196
199
|
// Ensure the shared agent-connection project exists so the server entry
|
|
197
200
|
// point can import `session_id_context` and propagate the AgentCore
|
|
198
201
|
// session ID to any downstream MCP / A2A clients a later connection
|
|
@@ -310,6 +313,7 @@ export const pyAgentGenerator = async (tree, options)=>{
|
|
|
310
313
|
iac,
|
|
311
314
|
projectName: project.name,
|
|
312
315
|
auth,
|
|
316
|
+
session,
|
|
313
317
|
serverProtocol: infraProtocol,
|
|
314
318
|
containers
|
|
315
319
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/agent/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { AG_UI_LANGGRAPH_EXCEPTIONS } from '../../license/known-exceptions';\nimport {\n addPyDependencies,\n addTsDependencies,\n} from '../../utils/add-dependencies';\nimport { addAgentChatScripts } from '../../utils/agent-chat/agent-chat';\nimport {\n AGENT_CONNECTION_PY_DEPENDENCIES,\n addPythonFrameworkBase,\n ensurePythonAgentConnectionProject,\n getPythonAgentConnectionModuleName,\n getPythonAgentConnectionProject,\n} from '../../utils/agent-connection/agent-connection';\nimport { addAgentInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies';\nimport { addDockerScanTarget, DOCKER_DEPENDENCIES } from '../../utils/docker';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FS_DEPENDENCIES, FsCommands } from '../../utils/fs';\nimport { updateGitIgnore } from '../../utils/git';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName, toSnakeCase } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n normalizeTargetKeyOrder,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { toProjectRelativePath } from '../../utils/paths';\nimport { assignPort } from '../../utils/port';\nimport { addWorkspaceDependencyToPyProject } from '../../utils/py';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs';\nimport type { IacMetadata } from '../../utils/shared-constructs-constants';\nimport { BASE_IMAGES } from '../../utils/versions';\nimport type {\n AgentProtocol,\n PyAgentFramework,\n PyAgentGeneratorSchema,\n} from './schema';\n\n/** The metadata this generator records, which its predicates read. */\nexport interface PyAgentMetadata extends IacMetadata {\n readonly port: number;\n readonly rc: string;\n readonly auth: string;\n readonly protocol: AgentProtocol;\n /**\n * The mcp / gateway connection generators dispatch on this field to pick the\n * Strands vs LangChain Layer-2 client + agent.py transform.\n */\n readonly framework: PyAgentFramework;\n}\n\n/** Whether the chat CLI signs its requests, which only IAM auth needs. */\nconst isIam = (m: PyAgentMetadata) => m.auth === 'iam';\n\n// Each entry names the framework and protocol branch it belongs to, so the same\n// declaration drives both adding and the version sync.\nexport const DEPENDENCIES = declareDependencies<PyAgentMetadata>()({\n ts: [\n // The chat CLI, which runs standalone via tsx for every protocol and\n // resolves the deployed agent from AppConfig. `agent-chat-cli` transitively\n // bundles the protocol clients (@a2a-js/sdk, @ag-ui/client).\n { name: 'agent-chat-cli', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n { name: '@types/node', dev: true, root: true },\n { name: '@aws-lambda-powertools/parameters', dev: true, root: true },\n { name: '@aws-sdk/client-appconfigdata', dev: true, root: true },\n { name: 'aws4fetch', when: isIam, dev: true, root: true },\n {\n name: '@aws-sdk/credential-providers',\n when: isIam,\n dev: true,\n root: true,\n },\n {\n name: '@a2a-js/sdk',\n when: (m) => m.protocol === 'a2a',\n dev: true,\n root: true,\n },\n // Added by the helpers that own the projects they belong to.\n ...ownedElsewhere(FS_DEPENDENCIES),\n ...ownedElsewhere(DOCKER_DEPENDENCIES),\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n py: [\n { name: 'aws-lambda-powertools' },\n { name: 'aws-opentelemetry-distro' },\n { name: 'bedrock-agentcore' },\n { name: 'boto3' },\n { name: 'fastapi' },\n { name: 'mcp' },\n // langchain pulls no Strands dependencies — the langchain model binding\n // plus the per-protocol server adapter: ag-ui-langgraph for AG-UI, a2a-sdk\n // for A2A, nothing extra for HTTP (FastAPI is added for every agent).\n { name: 'langchain', when: (m) => m.framework === 'langchain' },\n { name: 'langchain-aws', when: (m) => m.framework === 'langchain' },\n { name: 'langgraph', when: (m) => m.framework === 'langchain' },\n {\n name: 'ag-ui-protocol',\n when: (m) => m.framework === 'langchain' && m.protocol === 'ag-ui',\n },\n {\n name: 'ag-ui-langgraph',\n when: (m) => m.framework === 'langchain' && m.protocol === 'ag-ui',\n },\n {\n name: 'a2a-sdk',\n when: (m) => m.framework === 'langchain' && m.protocol === 'a2a',\n },\n {\n name: 'strands-agents[a2a]',\n when: (m) => m.framework !== 'langchain' && m.protocol === 'a2a',\n },\n {\n name: 'strands-agents',\n when: (m) => m.framework !== 'langchain' && m.protocol !== 'a2a',\n },\n {\n name: 'strands-agents-tools',\n when: (m) => m.framework !== 'langchain',\n },\n // Declared again here so a Strands AG-UI agent lists it in the same order\n // the generated pyproject.toml had before.\n {\n name: 'ag-ui-protocol',\n when: (m) => m.framework !== 'langchain' && m.protocol === 'ag-ui',\n },\n {\n name: 'ag-ui-strands',\n when: (m) => m.framework !== 'langchain' && m.protocol === 'ag-ui',\n },\n { name: 'uvicorn' },\n // `fastapi dev` runs the local server for every protocol.\n { name: 'fastapi[standard]', group: 'dev' },\n // The agent-connection helper adds these to its own project.\n ...ownedElsewhere(AGENT_CONNECTION_PY_DEPENDENCIES),\n ],\n});\n\nexport const PY_AGENT_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const pyAgentGenerator = async (\n tree: Tree,\n options: PyAgentGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n const pyProjectPath = joinPathFragments(project.root, 'pyproject.toml');\n\n // Check if the project has a pyproject.toml file\n if (!pyProjectPath) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a Python project (with a pyproject.toml)`,\n );\n }\n\n if (!project.sourceRoot) {\n throw new Error(\n `This project does not have a source root. Please add a source root to the project configuration before running this generator.`,\n );\n }\n\n // Module name is the last part of the source root,\n const sourceParts = project.sourceRoot.split('/');\n const moduleName = sourceParts[sourceParts.length - 1];\n\n const name = kebabCase(\n options.name || `${kebabCase(project.name.split('.').pop())}-agent`,\n );\n const agentTargetPrefix = options.name ? name : 'agent';\n\n const agentNameSnakeCase = toSnakeCase(options.name || 'agent');\n const agentNameClassName = toClassName(name);\n\n const targetSourceDir = joinPathFragments(\n project.sourceRoot,\n agentNameSnakeCase,\n );\n\n const infra = options.infra ?? 'agentcore';\n const protocol = options.protocol ?? 'http';\n const framework = options.framework ?? 'strands';\n\n // Recorded in the metadata below so the version sync can tell a CDK\n // project from a Terraform one; undefined when no infrastructure was\n // generated, in which case neither provider's packages were added.\n const iac =\n infra !== 'none' ? await resolveIac(tree, options.iac) : undefined;\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n // Ensure the shared agent-connection project exists so the server entry\n // point can import `session_id_context` and propagate the AgentCore\n // session ID to any downstream MCP / A2A clients a later connection\n // generator wires into this agent.\n await ensurePythonAgentConnectionProject(tree, DEPENDENCIES);\n // The agent server imports the framework base helpers (session cache + model\n // error logging) regardless of whether a connection client is wired in. The\n // langchain framework has no base layer (its AG-UI foundation reuses only the\n // framework-agnostic session context), so this is a no-op for langchain.\n await addPythonFrameworkBase(tree, DEPENDENCIES, framework);\n const agentConnectionModuleName = getPythonAgentConnectionModuleName(tree);\n addWorkspaceDependencyToPyProject(\n tree,\n project,\n getPythonAgentConnectionProject(tree),\n );\n\n const templateContext = {\n name,\n agentNameSnakeCase,\n agentNameClassName,\n moduleName,\n agentConnectionModuleName,\n framework,\n };\n\n // Generate common files shared by both protocols. The agent module (agent.py)\n // is framework-specific (Strands yields a contextmanaged Agent; LangChain\n // returns a compiled create_agent graph), so it comes from a per-framework\n // dir. The package __init__.py is framework-agnostic (it stays in `common`).\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n framework === 'langchain' ? 'common-langchain' : 'common',\n ),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n if (framework === 'langchain') {\n // common-langchain only carries agent.py; the empty package __init__.py is\n // framework-agnostic, so emit it from the shared `common` dir.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n // Generate protocol-specific files. Each protocol's server entry point is\n // framework-specific (Strands yields a contextmanaged Agent; LangChain drives\n // a compiled create_agent graph), so it comes from a per-framework dir\n // `<protocol>-langchain` for LangChain, or `<protocol>` for Strands.\n const protocolLower = protocol.toLowerCase();\n const protocolTemplateDir =\n framework === 'langchain' ? `${protocolLower}-langchain` : protocolLower;\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', protocolTemplateDir),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n // The HTTP server's init.py (the FastAPI app + JsonStreamingResponse) is\n // framework-agnostic and the LangChain http main.py reuses it, so emit it\n // from the shared `http` dir. Emitted after the langchain main.py above so\n // KeepExisting preserves that main.py and only adds init.py (the shared dir's\n // own Strands main.py is skipped).\n if (protocolLower === 'http' && framework === 'langchain') {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'http'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n const { bundleTargetName, bundleOutputDir } = addPythonBundleTarget(\n project,\n {\n pythonPlatform: 'aarch64-manylinux_2_28',\n },\n );\n\n // Add the Dockerfile\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'deploy'),\n targetSourceDir,\n {\n agentNameSnakeCase,\n moduleName,\n bundleOutputDir,\n protocol,\n pythonBaseImage: BASE_IMAGES.python,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'docker',\n name,\n );\n const dockerTargetName = `${agentTargetPrefix}-docker`;\n\n // Add a docker target that prepares the docker context and builds the image\n const fs = new FsCommands(tree, DEPENDENCIES);\n project.targets[dockerTargetName] = {\n cache: true,\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(dockerOutputDir),\n fs.mkdir(dockerOutputDir),\n fs.cp(bundleOutputDir, dockerOutputDir),\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n addDockerScanTarget(\n tree,\n {\n project,\n containerEngine: containers,\n trivyTargetName: `${agentTargetPrefix}-trivy`,\n dockerTargetName,\n imageTags: [dockerImageTag],\n },\n DEPENDENCIES,\n );\n\n // Add shared constructs\n await sharedConstructsGenerator(tree, { iac }, DEPENDENCIES);\n\n // Add the construct to deploy the agent.\n // AG-UI uses HTTP as the AgentCore protocol type (AG-UI is HTTP-based with SSE over POST).\n const infraProtocol =\n protocol === 'ag-ui' ? ('http' as const) : (protocol as 'http' | 'a2a');\n await addAgentInfra(tree, {\n agentNameKebabCase: name,\n agentNameClassName,\n dockerImageTag,\n dockerOutputDir,\n iac,\n projectName: project.name,\n auth,\n serverProtocol: infraProtocol,\n containers,\n });\n }\n\n // A2A servers use port 9000 as per the Strands A2A SDK default and AgentCore A2A contract.\n // HTTP and AG-UI agents use port 8081+ to avoid conflict with VS Code server on 8080.\n const localDevPortStart = protocol === 'a2a' ? 9000 : 8081;\n const localDevPort = assignPort(tree, project, localDevPortStart, {\n component: { info: PY_AGENT_GENERATOR_INFO, name: agentTargetPrefix },\n });\n\n // Recorded below and read by the declaration's predicates, so the packages\n // added here are exactly the ones the version sync will own.\n const metadata: PyAgentMetadata = {\n port: localDevPort,\n rc: agentNameClassName,\n auth,\n protocol,\n framework,\n ...(iac ? { iac } : {}),\n };\n\n addPyDependencies(tree, DEPENDENCIES, {\n metadata,\n projectRoot: project.root,\n });\n addTsDependencies(tree, DEPENDENCIES, { metadata });\n\n // All protocols use fastapi dev for hot reload:\n // - HTTP: FastAPI app directly defined in init.py\n // - A2A: A2AServer.to_fastapi_app() creates a FastAPI app in main.py\n // - AG-UI: create_strands_app() creates a FastAPI app in main.py\n const serveCommand = `uv run fastapi dev ${moduleName}/${agentNameSnakeCase}/main.py --port ${localDevPort}`;\n\n // HTTP chat uses the type-safe TypeScript client generated from the\n // agent's OpenAPI spec (same generated client the react-connection\n // generator produces). A2A and AG-UI speak standard protocols, so\n // we can run `agent-chat-cli` directly as a binary.\n const openApiTargetName = `${agentTargetPrefix}-openapi`;\n const clientGenTargetName = `${agentTargetPrefix}-generate-client`;\n\n const scriptsDir = joinPathFragments(\n project.root,\n 'scripts',\n agentTargetPrefix,\n );\n\n if (protocol === 'http') {\n // Emit the OpenAPI spec generator script (shared with react-connection)\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'react-connection',\n 'files',\n 'agent',\n ),\n project.root,\n {\n moduleName,\n agentNameSnakeCase,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Ignore the generated client directory\n updateGitIgnore(tree, project.root, (patterns) => [\n ...patterns,\n `scripts/${agentTargetPrefix}/generated/`,\n ]);\n }\n\n // Every protocol gets a standalone `chat.ts`. It connects to the local\n // `dev` server by default, or to the deployed agent (with the\n // appropriate auth) when `RUNTIME_CONFIG_APP_ID` is set.\n addAgentChatScripts(tree, {\n scriptsDir,\n protocol,\n language: 'py',\n agentNameClassName,\n auth,\n });\n\n const chatUrl =\n protocol === 'ag-ui'\n ? `http://localhost:${localDevPort}/invocations`\n : `http://localhost:${localDevPort}`;\n const chatCommand = `tsx ./scripts/${agentTargetPrefix}/chat.ts`;\n\n const httpOnlyTargets =\n protocol === 'http'\n ? {\n [openApiTargetName]: {\n cache: true,\n executor: 'nx:run-commands',\n outputs: [\n `{workspaceRoot}/dist/{projectRoot}/openapi/${agentNameSnakeCase}`,\n ],\n options: {\n commands: [\n `uv run python {projectRoot}/scripts/${agentNameSnakeCase}_openapi.py \"dist/{projectRoot}/openapi/${agentNameSnakeCase}/openapi.json\"`,\n ],\n },\n },\n [clientGenTargetName]: {\n cache: true,\n executor: 'nx:run-commands',\n dependsOn: [openApiTargetName],\n inputs: [\n {\n dependentTasksOutputFiles: '**/*.json',\n },\n ],\n outputs: [`{projectRoot}/scripts/${agentTargetPrefix}/generated`],\n options: {\n commands: [\n `nx g @aws/nx-plugin:open-api#ts-client --openApiSpecPath=\"dist/${project.root}/openapi/${agentNameSnakeCase}/openapi.json\" --outputPath=\"${project.root}/scripts/${agentTargetPrefix}/generated\" --no-interactive`,\n ],\n },\n },\n }\n : {};\n\n const agentTargets = {\n ...project.targets,\n ...httpOnlyTargets,\n [`${agentTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [serveCommand],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${agentTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [serveCommand],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n // HTTP chat imports the generated client, so ensure it's built first.\n // No dev dependency — chat runs standalone against a local or\n // deployed agent. normalizeTargetKeyOrder keeps the conditional dependsOn\n // in Nx 23's serialization order so re-runs stay byte-identical.\n [`${agentTargetPrefix}-chat`]: normalizeTargetKeyOrder({\n executor: 'nx:run-commands',\n options: {\n commands: [chatCommand],\n cwd: '{projectRoot}',\n env: {\n URL: chatUrl,\n },\n },\n ...(protocol === 'http' ? { dependsOn: [clientGenTargetName] } : {}),\n }),\n };\n\n // Aggregate `<agent>-dev` under the project-level `dev` target.\n addComponentDevTarget(agentTargets, `${agentTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n targets: sortObjectKeys(agentTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n PY_AGENT_GENERATOR_INFO,\n toProjectRelativePath(project, targetSourceDir),\n agentTargetPrefix,\n metadata,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [PY_AGENT_GENERATOR_INFO]);\n\n // langchain-core (pulled by every langchain agent regardless of protocol)\n // brings jsonpatch/jsonpointer, whose wheels ship without resolvable SPDX\n // license metadata, so register those exceptions so the workspace license\n // check still passes.\n if (framework === 'langchain') {\n await ensureLicenseExceptions(tree, AG_UI_LANGGRAPH_EXCEPTIONS);\n }\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\n\nexport default pyAgentGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","ensureLicenseExceptions","AG_UI_LANGGRAPH_EXCEPTIONS","addPyDependencies","addTsDependencies","addAgentChatScripts","AGENT_CONNECTION_PY_DEPENDENCIES","addPythonFrameworkBase","ensurePythonAgentConnectionProject","getPythonAgentConnectionModuleName","getPythonAgentConnectionProject","addAgentInfra","addPythonBundleTarget","resolveContainers","declareDependencies","ownedElsewhere","addDockerScanTarget","DOCKER_DEPENDENCIES","formatFilesInSubtree","FS_DEPENDENCIES","FsCommands","updateGitIgnore","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","toSnakeCase","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","normalizeTargetKeyOrder","readProjectConfigurationUnqualified","sortObjectKeys","toProjectRelativePath","assignPort","addWorkspaceDependencyToPyProject","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","BASE_IMAGES","isIam","m","auth","DEPENDENCIES","ts","name","dev","root","when","protocol","py","framework","group","PY_AGENT_GENERATOR_INFO","filename","pyAgentGenerator","tree","options","project","pyProjectPath","Error","sourceRoot","sourceParts","split","moduleName","length","pop","agentTargetPrefix","agentNameSnakeCase","agentNameClassName","targetSourceDir","infra","iac","undefined","console","warn","agentConnectionModuleName","templateContext","dirname","overwriteStrategy","KeepExisting","protocolLower","toLowerCase","protocolTemplateDir","containers","dockerImageTag","bundleTargetName","bundleOutputDir","pythonPlatform","pythonBaseImage","python","dockerOutputDir","dockerTargetName","fs","targets","cache","executor","commands","rm","mkdir","cp","parallel","dependsOn","containerEngine","trivyTargetName","imageTags","infraProtocol","agentNameKebabCase","projectName","serverProtocol","localDevPortStart","localDevPort","component","info","metadata","port","rc","projectRoot","serveCommand","openApiTargetName","clientGenTargetName","scriptsDir","patterns","language","chatUrl","chatCommand","httpOnlyTargets","outputs","inputs","dependentTasksOutputFiles","agentTargets","continuous","cwd","env","PORT","LOCAL_DEV","URL","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,uBAAuB,QAAQ,0BAAuB;AAC/D,SAASC,0BAA0B,QAAQ,oCAAiC;AAC5E,SACEC,iBAAiB,EACjBC,iBAAiB,QACZ,kCAA+B;AACtC,SAASC,mBAAmB,QAAQ,uCAAoC;AACxE,SACEC,gCAAgC,EAChCC,sBAAsB,EACtBC,kCAAkC,EAClCC,kCAAkC,EAClCC,+BAA+B,QAC1B,mDAAgD;AACvD,SAASC,aAAa,QAAQ,6DAA0D;AACxF,SAASC,qBAAqB,QAAQ,+BAA4B;AAClE,SAASC,iBAAiB,QAAQ,4BAAyB;AAC3D,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAoC;AAC3C,SAASC,mBAAmB,EAAEC,mBAAmB,QAAQ,wBAAqB;AAC9E,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,eAAe,EAAEC,UAAU,QAAQ,oBAAiB;AAC7D,SAASC,eAAe,QAAQ,qBAAkB;AAClD,SAASC,UAAU,QAAQ,qBAAkB;AAC7C,SAASC,mBAAmB,QAAQ,yBAAsB;AAC1D,SAASC,+BAA+B,QAAQ,yBAAsB;AACtE,SAASC,SAAS,EAAEC,WAAW,EAAEC,WAAW,QAAQ,uBAAoB;AACxE,SAASC,WAAW,QAAQ,2BAA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AAwByD,MAAMxD;IACtC;IAEA,MAAMgB,qBAAqBwC;IAC3B,OAAO,IACLnC,oBAAoBmC,MAAMC,QAAQgF,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AAEF,eAAenF,iBAAiB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/agent/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { AG_UI_LANGGRAPH_EXCEPTIONS } from '../../license/known-exceptions';\nimport {\n addPyDependencies,\n addTsDependencies,\n} from '../../utils/add-dependencies';\nimport { addAgentChatScripts } from '../../utils/agent-chat/agent-chat';\nimport {\n AGENT_CONNECTION_PY_DEPENDENCIES,\n addPythonFrameworkBase,\n ensurePythonAgentConnectionProject,\n getPythonAgentConnectionModuleName,\n getPythonAgentConnectionProject,\n} from '../../utils/agent-connection/agent-connection';\nimport { addAgentInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies';\nimport { addDockerScanTarget, DOCKER_DEPENDENCIES } from '../../utils/docker';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FS_DEPENDENCIES, FsCommands } from '../../utils/fs';\nimport { updateGitIgnore } from '../../utils/git';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName, toSnakeCase } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n normalizeTargetKeyOrder,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { toProjectRelativePath } from '../../utils/paths';\nimport { assignPort } from '../../utils/port';\nimport { addWorkspaceDependencyToPyProject } from '../../utils/py';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs';\nimport type { IacMetadata } from '../../utils/shared-constructs-constants';\nimport { BASE_IMAGES } from '../../utils/versions';\nimport type {\n AgentProtocol,\n PyAgentFramework,\n PyAgentGeneratorSchema,\n} from './schema';\n\n/** The metadata this generator records, which its predicates read. */\nexport interface PyAgentMetadata extends IacMetadata {\n readonly port: number;\n readonly rc: string;\n readonly auth: string;\n readonly protocol: AgentProtocol;\n /**\n * The mcp / gateway connection generators dispatch on this field to pick the\n * Strands vs LangChain Layer-2 client + agent.py transform.\n */\n readonly framework: PyAgentFramework;\n}\n\n/** Whether the chat CLI signs its requests, which only IAM auth needs. */\nconst isIam = (m: PyAgentMetadata) => m.auth === 'iam';\n\n// Each entry names the framework and protocol branch it belongs to, so the same\n// declaration drives both adding and the version sync.\nexport const DEPENDENCIES = declareDependencies<PyAgentMetadata>()({\n ts: [\n // The chat CLI, which runs standalone via tsx for every protocol and\n // resolves the deployed agent from AppConfig. `agent-chat-cli` transitively\n // bundles the protocol clients (@a2a-js/sdk, @ag-ui/client).\n { name: 'agent-chat-cli', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n { name: '@types/node', dev: true, root: true },\n { name: '@aws-lambda-powertools/parameters', dev: true, root: true },\n { name: '@aws-sdk/client-appconfigdata', dev: true, root: true },\n { name: 'aws4fetch', when: isIam, dev: true, root: true },\n {\n name: '@aws-sdk/credential-providers',\n when: isIam,\n dev: true,\n root: true,\n },\n {\n name: '@a2a-js/sdk',\n when: (m) => m.protocol === 'a2a',\n dev: true,\n root: true,\n },\n // Added by the helpers that own the projects they belong to.\n ...ownedElsewhere(FS_DEPENDENCIES),\n ...ownedElsewhere(DOCKER_DEPENDENCIES),\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n py: [\n { name: 'aws-lambda-powertools' },\n { name: 'aws-opentelemetry-distro' },\n { name: 'bedrock-agentcore' },\n { name: 'boto3' },\n { name: 'fastapi' },\n { name: 'mcp' },\n // langchain pulls no Strands dependencies — the langchain model binding\n // plus the per-protocol server adapter: ag-ui-langgraph for AG-UI, a2a-sdk\n // for A2A, nothing extra for HTTP (FastAPI is added for every agent).\n { name: 'langchain', when: (m) => m.framework === 'langchain' },\n { name: 'langchain-aws', when: (m) => m.framework === 'langchain' },\n { name: 'langgraph', when: (m) => m.framework === 'langchain' },\n {\n name: 'ag-ui-protocol',\n when: (m) => m.framework === 'langchain' && m.protocol === 'ag-ui',\n },\n {\n name: 'ag-ui-langgraph',\n when: (m) => m.framework === 'langchain' && m.protocol === 'ag-ui',\n },\n {\n name: 'a2a-sdk',\n when: (m) => m.framework === 'langchain' && m.protocol === 'a2a',\n },\n {\n name: 'strands-agents[a2a]',\n when: (m) => m.framework !== 'langchain' && m.protocol === 'a2a',\n },\n {\n name: 'strands-agents',\n when: (m) => m.framework !== 'langchain' && m.protocol !== 'a2a',\n },\n {\n name: 'strands-agents-tools',\n when: (m) => m.framework !== 'langchain',\n },\n // Declared again here so a Strands AG-UI agent lists it in the same order\n // the generated pyproject.toml had before.\n {\n name: 'ag-ui-protocol',\n when: (m) => m.framework !== 'langchain' && m.protocol === 'ag-ui',\n },\n {\n name: 'ag-ui-strands',\n when: (m) => m.framework !== 'langchain' && m.protocol === 'ag-ui',\n },\n { name: 'uvicorn' },\n // `fastapi dev` runs the local server for every protocol.\n { name: 'fastapi[standard]', group: 'dev' },\n // The agent-connection helper adds these to its own project.\n ...ownedElsewhere(AGENT_CONNECTION_PY_DEPENDENCIES),\n ],\n});\n\nexport const PY_AGENT_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const pyAgentGenerator = async (\n tree: Tree,\n options: PyAgentGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n const pyProjectPath = joinPathFragments(project.root, 'pyproject.toml');\n\n // Check if the project has a pyproject.toml file\n if (!pyProjectPath) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a Python project (with a pyproject.toml)`,\n );\n }\n\n if (!project.sourceRoot) {\n throw new Error(\n `This project does not have a source root. Please add a source root to the project configuration before running this generator.`,\n );\n }\n\n // Module name is the last part of the source root,\n const sourceParts = project.sourceRoot.split('/');\n const moduleName = sourceParts[sourceParts.length - 1];\n\n const name = kebabCase(\n options.name || `${kebabCase(project.name.split('.').pop())}-agent`,\n );\n const agentTargetPrefix = options.name ? name : 'agent';\n\n const agentNameSnakeCase = toSnakeCase(options.name || 'agent');\n const agentNameClassName = toClassName(name);\n\n const targetSourceDir = joinPathFragments(\n project.sourceRoot,\n agentNameSnakeCase,\n );\n\n const infra = options.infra ?? 'agentcore';\n const protocol = options.protocol ?? 'http';\n const framework = options.framework ?? 'strands';\n\n // Recorded in the metadata below so the version sync can tell a CDK\n // project from a Terraform one; undefined when no infrastructure was\n // generated, in which case neither provider's packages were added.\n const iac =\n infra !== 'none' ? await resolveIac(tree, options.iac) : undefined;\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n // Only 'in-memory' is currently supported for Python agents (session manager\n // support for Python is not yet implemented).\n const session = options.session ?? 'in-memory';\n\n // Ensure the shared agent-connection project exists so the server entry\n // point can import `session_id_context` and propagate the AgentCore\n // session ID to any downstream MCP / A2A clients a later connection\n // generator wires into this agent.\n await ensurePythonAgentConnectionProject(tree, DEPENDENCIES);\n // The agent server imports the framework base helpers (session cache + model\n // error logging) regardless of whether a connection client is wired in. The\n // langchain framework has no base layer (its AG-UI foundation reuses only the\n // framework-agnostic session context), so this is a no-op for langchain.\n await addPythonFrameworkBase(tree, DEPENDENCIES, framework);\n const agentConnectionModuleName = getPythonAgentConnectionModuleName(tree);\n addWorkspaceDependencyToPyProject(\n tree,\n project,\n getPythonAgentConnectionProject(tree),\n );\n\n const templateContext = {\n name,\n agentNameSnakeCase,\n agentNameClassName,\n moduleName,\n agentConnectionModuleName,\n framework,\n };\n\n // Generate common files shared by both protocols. The agent module (agent.py)\n // is framework-specific (Strands yields a contextmanaged Agent; LangChain\n // returns a compiled create_agent graph), so it comes from a per-framework\n // dir. The package __init__.py is framework-agnostic (it stays in `common`).\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'files',\n framework === 'langchain' ? 'common-langchain' : 'common',\n ),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n if (framework === 'langchain') {\n // common-langchain only carries agent.py; the empty package __init__.py is\n // framework-agnostic, so emit it from the shared `common` dir.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n // Generate protocol-specific files. Each protocol's server entry point is\n // framework-specific (Strands yields a contextmanaged Agent; LangChain drives\n // a compiled create_agent graph), so it comes from a per-framework dir\n // `<protocol>-langchain` for LangChain, or `<protocol>` for Strands.\n const protocolLower = protocol.toLowerCase();\n const protocolTemplateDir =\n framework === 'langchain' ? `${protocolLower}-langchain` : protocolLower;\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', protocolTemplateDir),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n // The HTTP server's init.py (the FastAPI app + JsonStreamingResponse) is\n // framework-agnostic and the LangChain http main.py reuses it, so emit it\n // from the shared `http` dir. Emitted after the langchain main.py above so\n // KeepExisting preserves that main.py and only adds init.py (the shared dir's\n // own Strands main.py is skipped).\n if (protocolLower === 'http' && framework === 'langchain') {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'http'),\n targetSourceDir,\n templateContext,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n const { bundleTargetName, bundleOutputDir } = addPythonBundleTarget(\n project,\n {\n pythonPlatform: 'aarch64-manylinux_2_28',\n },\n );\n\n // Add the Dockerfile\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'deploy'),\n targetSourceDir,\n {\n agentNameSnakeCase,\n moduleName,\n bundleOutputDir,\n protocol,\n pythonBaseImage: BASE_IMAGES.python,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'docker',\n name,\n );\n const dockerTargetName = `${agentTargetPrefix}-docker`;\n\n // Add a docker target that prepares the docker context and builds the image\n const fs = new FsCommands(tree, DEPENDENCIES);\n project.targets[dockerTargetName] = {\n cache: true,\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(dockerOutputDir),\n fs.mkdir(dockerOutputDir),\n fs.cp(bundleOutputDir, dockerOutputDir),\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n addDockerScanTarget(\n tree,\n {\n project,\n containerEngine: containers,\n trivyTargetName: `${agentTargetPrefix}-trivy`,\n dockerTargetName,\n imageTags: [dockerImageTag],\n },\n DEPENDENCIES,\n );\n\n // Add shared constructs\n await sharedConstructsGenerator(tree, { iac }, DEPENDENCIES);\n\n // Add the construct to deploy the agent.\n // AG-UI uses HTTP as the AgentCore protocol type (AG-UI is HTTP-based with SSE over POST).\n const infraProtocol =\n protocol === 'ag-ui' ? ('http' as const) : (protocol as 'http' | 'a2a');\n await addAgentInfra(tree, {\n agentNameKebabCase: name,\n agentNameClassName,\n dockerImageTag,\n dockerOutputDir,\n iac,\n projectName: project.name,\n auth,\n session,\n serverProtocol: infraProtocol,\n containers,\n });\n }\n\n // A2A servers use port 9000 as per the Strands A2A SDK default and AgentCore A2A contract.\n // HTTP and AG-UI agents use port 8081+ to avoid conflict with VS Code server on 8080.\n const localDevPortStart = protocol === 'a2a' ? 9000 : 8081;\n const localDevPort = assignPort(tree, project, localDevPortStart, {\n component: { info: PY_AGENT_GENERATOR_INFO, name: agentTargetPrefix },\n });\n\n // Recorded below and read by the declaration's predicates, so the packages\n // added here are exactly the ones the version sync will own.\n const metadata: PyAgentMetadata = {\n port: localDevPort,\n rc: agentNameClassName,\n auth,\n protocol,\n framework,\n ...(iac ? { iac } : {}),\n };\n\n addPyDependencies(tree, DEPENDENCIES, {\n metadata,\n projectRoot: project.root,\n });\n addTsDependencies(tree, DEPENDENCIES, { metadata });\n\n // All protocols use fastapi dev for hot reload:\n // - HTTP: FastAPI app directly defined in init.py\n // - A2A: A2AServer.to_fastapi_app() creates a FastAPI app in main.py\n // - AG-UI: create_strands_app() creates a FastAPI app in main.py\n const serveCommand = `uv run fastapi dev ${moduleName}/${agentNameSnakeCase}/main.py --port ${localDevPort}`;\n\n // HTTP chat uses the type-safe TypeScript client generated from the\n // agent's OpenAPI spec (same generated client the react-connection\n // generator produces). A2A and AG-UI speak standard protocols, so\n // we can run `agent-chat-cli` directly as a binary.\n const openApiTargetName = `${agentTargetPrefix}-openapi`;\n const clientGenTargetName = `${agentTargetPrefix}-generate-client`;\n\n const scriptsDir = joinPathFragments(\n project.root,\n 'scripts',\n agentTargetPrefix,\n );\n\n if (protocol === 'http') {\n // Emit the OpenAPI spec generator script (shared with react-connection)\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n 'react-connection',\n 'files',\n 'agent',\n ),\n project.root,\n {\n moduleName,\n agentNameSnakeCase,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Ignore the generated client directory\n updateGitIgnore(tree, project.root, (patterns) => [\n ...patterns,\n `scripts/${agentTargetPrefix}/generated/`,\n ]);\n }\n\n // Every protocol gets a standalone `chat.ts`. It connects to the local\n // `dev` server by default, or to the deployed agent (with the\n // appropriate auth) when `RUNTIME_CONFIG_APP_ID` is set.\n addAgentChatScripts(tree, {\n scriptsDir,\n protocol,\n language: 'py',\n agentNameClassName,\n auth,\n });\n\n const chatUrl =\n protocol === 'ag-ui'\n ? `http://localhost:${localDevPort}/invocations`\n : `http://localhost:${localDevPort}`;\n const chatCommand = `tsx ./scripts/${agentTargetPrefix}/chat.ts`;\n\n const httpOnlyTargets =\n protocol === 'http'\n ? {\n [openApiTargetName]: {\n cache: true,\n executor: 'nx:run-commands',\n outputs: [\n `{workspaceRoot}/dist/{projectRoot}/openapi/${agentNameSnakeCase}`,\n ],\n options: {\n commands: [\n `uv run python {projectRoot}/scripts/${agentNameSnakeCase}_openapi.py \"dist/{projectRoot}/openapi/${agentNameSnakeCase}/openapi.json\"`,\n ],\n },\n },\n [clientGenTargetName]: {\n cache: true,\n executor: 'nx:run-commands',\n dependsOn: [openApiTargetName],\n inputs: [\n {\n dependentTasksOutputFiles: '**/*.json',\n },\n ],\n outputs: [`{projectRoot}/scripts/${agentTargetPrefix}/generated`],\n options: {\n commands: [\n `nx g @aws/nx-plugin:open-api#ts-client --openApiSpecPath=\"dist/${project.root}/openapi/${agentNameSnakeCase}/openapi.json\" --outputPath=\"${project.root}/scripts/${agentTargetPrefix}/generated\" --no-interactive`,\n ],\n },\n },\n }\n : {};\n\n const agentTargets = {\n ...project.targets,\n ...httpOnlyTargets,\n [`${agentTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [serveCommand],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${agentTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [serveCommand],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n // HTTP chat imports the generated client, so ensure it's built first.\n // No dev dependency — chat runs standalone against a local or\n // deployed agent. normalizeTargetKeyOrder keeps the conditional dependsOn\n // in Nx 23's serialization order so re-runs stay byte-identical.\n [`${agentTargetPrefix}-chat`]: normalizeTargetKeyOrder({\n executor: 'nx:run-commands',\n options: {\n commands: [chatCommand],\n cwd: '{projectRoot}',\n env: {\n URL: chatUrl,\n },\n },\n ...(protocol === 'http' ? { dependsOn: [clientGenTargetName] } : {}),\n }),\n };\n\n // Aggregate `<agent>-dev` under the project-level `dev` target.\n addComponentDevTarget(agentTargets, `${agentTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n targets: sortObjectKeys(agentTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n PY_AGENT_GENERATOR_INFO,\n toProjectRelativePath(project, targetSourceDir),\n agentTargetPrefix,\n metadata,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [PY_AGENT_GENERATOR_INFO]);\n\n // langchain-core (pulled by every langchain agent regardless of protocol)\n // brings jsonpatch/jsonpointer, whose wheels ship without resolvable SPDX\n // license metadata, so register those exceptions so the workspace license\n // check still passes.\n if (framework === 'langchain') {\n await ensureLicenseExceptions(tree, AG_UI_LANGGRAPH_EXCEPTIONS);\n }\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\n\nexport default pyAgentGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","ensureLicenseExceptions","AG_UI_LANGGRAPH_EXCEPTIONS","addPyDependencies","addTsDependencies","addAgentChatScripts","AGENT_CONNECTION_PY_DEPENDENCIES","addPythonFrameworkBase","ensurePythonAgentConnectionProject","getPythonAgentConnectionModuleName","getPythonAgentConnectionProject","addAgentInfra","addPythonBundleTarget","resolveContainers","declareDependencies","ownedElsewhere","addDockerScanTarget","DOCKER_DEPENDENCIES","formatFilesInSubtree","FS_DEPENDENCIES","FsCommands","updateGitIgnore","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","toSnakeCase","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","normalizeTargetKeyOrder","readProjectConfigurationUnqualified","sortObjectKeys","toProjectRelativePath","assignPort","addWorkspaceDependencyToPyProject","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","BASE_IMAGES","isIam","m","auth","DEPENDENCIES","ts","name","dev","root","when","protocol","py","framework","group","PY_AGENT_GENERATOR_INFO","filename","pyAgentGenerator","tree","options","project","pyProjectPath","Error","sourceRoot","sourceParts","split","moduleName","length","pop","agentTargetPrefix","agentNameSnakeCase","agentNameClassName","targetSourceDir","infra","iac","undefined","console","warn","session","agentConnectionModuleName","templateContext","dirname","overwriteStrategy","KeepExisting","protocolLower","toLowerCase","protocolTemplateDir","containers","dockerImageTag","bundleTargetName","bundleOutputDir","pythonPlatform","pythonBaseImage","python","dockerOutputDir","dockerTargetName","fs","targets","cache","executor","commands","rm","mkdir","cp","parallel","dependsOn","containerEngine","trivyTargetName","imageTags","infraProtocol","agentNameKebabCase","projectName","serverProtocol","localDevPortStart","localDevPort","component","info","metadata","port","rc","projectRoot","serveCommand","openApiTargetName","clientGenTargetName","scriptsDir","patterns","language","chatUrl","chatCommand","httpOnlyTargets","outputs","inputs","dependentTasksOutputFiles","agentTargets","continuous","cwd","env","PORT","LOCAL_DEV","URL","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,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entCoreMCPClientStrands.without_auth("http://localhost:8082/mcp")
|
|
142
142
|
config = get_agentcore_runtime_config()
|
|
143
|
-
|
|
143
|
+
agent_runtime = config.get("agentRuntimes", {}).get("InventoryMcp")
|
|
144
|
+
agent_runtime_arn = agent_runtime.get("arn") if agent_runtime else None
|
|
144
145
|
if not agent_runtime_arn:
|
|
145
146
|
raise RuntimeError("No connected MCP server runtime named 'InventoryMcp' found in runtime configuration.")
|
|
146
147
|
return AgentCoreMCPClientStrands.with_iam_auth(agent_runtime_arn)
|