@aws/nx-plugin 1.0.0-rc.70 → 1.0.0-rc.72
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/migrations.json +11 -1
- package/package.json +1 -1
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/agentcore-harness/generator.d.ts +1 -1
- package/src/infra/app/generator.d.ts +1 -1
- package/src/init/generator.d.ts +1 -1
- package/src/license/dependency-check/evaluator.js +55 -10
- package/src/license/dependency-check/evaluator.js.map +1 -1
- package/src/migrations/latest/py-agent-a2a-httpx-client-per-call/metadata.json +3 -0
- package/src/migrations/latest/py-agent-a2a-httpx-client-per-call/migration.d.ts +6 -0
- package/src/migrations/latest/py-agent-a2a-httpx-client-per-call/migration.js +329 -0
- package/src/migrations/latest/py-agent-a2a-httpx-client-per-call/migration.js.map +1 -0
- package/src/migrations/latest/py-agent-session-management-support/metadata.json +3 -0
- package/src/migrations/latest/py-agent-session-management-support/migration.d.ts +2 -0
- package/src/migrations/latest/py-agent-session-management-support/migration.js +308 -0
- package/src/migrations/latest/py-agent-session-management-support/migration.js.map +1 -0
- package/src/preset/generator.d.ts +1 -1
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +615 -6
- package/src/py/agent/__snapshots__/generator.core.spec.ts.snap +186 -0
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +47 -3
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +668 -3
- package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +55 -14
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +1 -3
- package/src/py/agent/files/langchain/common/__init__.py.template +0 -0
- package/src/py/agent/files/langchain/common/agent.py.template +3 -3
- package/src/py/agent/files/langchain/common/session.py.template +61 -0
- package/src/py/agent/files/strands/ag-ui/main.py.template +5 -1
- package/src/py/agent/files/strands/common/agent.py.template +9 -2
- package/src/py/agent/files/strands/common/session.py.template +36 -0
- package/src/py/agent/generator.d.ts +11 -1
- package/src/py/agent/generator.js +78 -28
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +2 -0
- package/src/py/agent/react-connection/generator.d.ts +1 -1
- package/src/py/agent/schema.d.js.map +1 -1
- package/src/py/agent/schema.d.ts +1 -1
- package/src/py/agent/schema.json +3 -3
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
- package/src/py/fast-api/react/generator.d.ts +1 -1
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/smithy/project/generator.d.ts +1 -1
- package/src/smithy/react-connection/generator.d.ts +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
- package/src/terraform/project/generator.d.ts +1 -1
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/trpc/react/generator.d.ts +1 -1
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +28 -7
- package/src/ts/agent/a2a-connection/generator.d.ts +1 -1
- package/src/ts/agent/gateway-connection/generator.d.ts +1 -1
- package/src/ts/agent/mcp-connection/generator.d.ts +1 -1
- package/src/ts/agent/react-connection/generator.d.ts +1 -1
- package/src/ts/astro-docs/generator.d.ts +1 -1
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/dcr-proxy/generator.d.ts +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/dynamodb/generator.d.ts +1 -1
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/lambda-function/generator.d.ts +1 -1
- package/src/ts/lib/generator.d.ts +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/nx-generator/generator.d.ts +1 -1
- package/src/ts/nx-migration/generator.d.ts +1 -1
- package/src/ts/nx-plugin/generator.d.ts +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/rdb/generator.d.ts +1 -1
- package/src/ts/react-website/agui/generator.d.ts +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +1 -1
- package/src/utils/agent-connection/agent-connection.d.ts +10 -0
- package/src/utils/agent-connection/agent-connection.js +15 -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 +5 -3
- package/src/utils/agent-connection/files/py-core-langchain/a2a/agentcore_a2a_client_langchain.py.template +26 -20
- package/src/utils/agent-connection/files/py-core-langchain/s3/s3_checkpoint_saver_langchain.py.template +360 -0
- package/src/utils/agent-connection/files/py-core-runtime-config/runtime_config.py.template +2 -4
- package/src/utils/agent-connection/files/py-core-strands/a2a/agentcore_a2a_client_strands.py.template +55 -10
- package/src/utils/agent-connection/files/py-core-strands/base/tool_errors_strands.py.template +24 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +1 -1
- 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 +113 -13
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +76 -7
- package/src/utils/versions.d.ts +5 -2
- package/src/utils/versions.js +4 -1
- package/src/utils/versions.js.map +1 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`py#agent generator > should generate session.py returning InMemorySaver for the langchain framework > session.py (in-memory) 1`] = `
|
|
4
|
+
"import os
|
|
5
|
+
|
|
6
|
+
import aiosqlite
|
|
7
|
+
from langgraph.checkpoint.base import BaseCheckpointSaver
|
|
8
|
+
from langgraph.checkpoint.memory import InMemorySaver
|
|
9
|
+
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_checkpointer() -> BaseCheckpointSaver:
|
|
13
|
+
"""Returns a LangGraph checkpointer for persisting conversation state across
|
|
14
|
+
invocations. Local development always uses a local SQLite database for
|
|
15
|
+
convenience, regardless of the configured session option.
|
|
16
|
+
"""
|
|
17
|
+
if os.environ.get("LOCAL_DEV") == "true":
|
|
18
|
+
os.makedirs("../../tmp/agents/langchain/test-project-agent", exist_ok=True)
|
|
19
|
+
conn = aiosqlite.connect(
|
|
20
|
+
os.path.join(
|
|
21
|
+
"../../tmp/agents/langchain/test-project-agent", "checkpoints.sqlite"
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
return AsyncSqliteSaver(conn)
|
|
25
|
+
|
|
26
|
+
return InMemorySaver()
|
|
27
|
+
"
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
exports[`py#agent generator > should generate session.py returning None when session is in-memory > session.py (in-memory) 1`] = `
|
|
31
|
+
"import os
|
|
32
|
+
|
|
33
|
+
from proj_agent_connection import get_current_session_id
|
|
34
|
+
from strands.session import FileSessionManager, SessionManager
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_session_manager() -> SessionManager | None:
|
|
38
|
+
"""Returns a SessionManager for persisting conversation state across
|
|
39
|
+
invocations. Local development always uses local file storage for
|
|
40
|
+
convenience, regardless of the configured session option. Without a
|
|
41
|
+
configured session option, conversation state is kept in memory only and
|
|
42
|
+
does not survive process restarts.
|
|
43
|
+
"""
|
|
44
|
+
session_id = get_current_session_id()
|
|
45
|
+
if not session_id:
|
|
46
|
+
raise RuntimeError(
|
|
47
|
+
"No current session id — cannot resolve a SessionManager outside of a request scope."
|
|
48
|
+
)
|
|
49
|
+
if os.environ.get("LOCAL_DEV") == "true":
|
|
50
|
+
return FileSessionManager(
|
|
51
|
+
session_id=session_id,
|
|
52
|
+
storage_dir="../../tmp/agents/strands/test-project-agent",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
return None
|
|
56
|
+
"
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`py#agent generator > should generate session.py using DynamoDBSaver when session is dynamodb-s3 > session.py (dynamodb-s3) 1`] = `
|
|
60
|
+
"import os
|
|
61
|
+
|
|
62
|
+
import aiosqlite
|
|
63
|
+
from langgraph.checkpoint.base import BaseCheckpointSaver
|
|
64
|
+
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
|
|
65
|
+
from langgraph_checkpoint_aws import DynamoDBSaver
|
|
66
|
+
from proj_agent_connection.core.runtime_config import get_agentcore_runtime_config
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_checkpointer() -> BaseCheckpointSaver:
|
|
70
|
+
"""Returns a LangGraph checkpointer for persisting conversation state across
|
|
71
|
+
invocations. Local development always uses a local SQLite database for
|
|
72
|
+
convenience, regardless of the configured session option.
|
|
73
|
+
"""
|
|
74
|
+
if os.environ.get("LOCAL_DEV") == "true":
|
|
75
|
+
os.makedirs("../../tmp/agents/langchain/test-project-agent", exist_ok=True)
|
|
76
|
+
conn = aiosqlite.connect(
|
|
77
|
+
os.path.join(
|
|
78
|
+
"../../tmp/agents/langchain/test-project-agent", "checkpoints.sqlite"
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
return AsyncSqliteSaver(conn)
|
|
82
|
+
|
|
83
|
+
config = get_agentcore_runtime_config()
|
|
84
|
+
session_config = (
|
|
85
|
+
(config.get("agentRuntimes") or {})
|
|
86
|
+
.get("TestProjectAgent", {})
|
|
87
|
+
.get("session", {})
|
|
88
|
+
)
|
|
89
|
+
table_name = session_config.get("tableName")
|
|
90
|
+
bucket_name = session_config.get("bucketName")
|
|
91
|
+
if not table_name or not bucket_name:
|
|
92
|
+
raise RuntimeError(
|
|
93
|
+
"No DynamoDB checkpoint table or S3 offload bucket configured for this agent in runtime configuration."
|
|
94
|
+
)
|
|
95
|
+
return DynamoDBSaver(
|
|
96
|
+
table_name=table_name,
|
|
97
|
+
region_name=os.environ.get("AWS_REGION"),
|
|
98
|
+
s3_offload_config={"bucket_name": bucket_name},
|
|
99
|
+
)
|
|
100
|
+
"
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`py#agent generator > should generate session.py using S3 storage by default for the strands framework > session.py (s3) 1`] = `
|
|
104
|
+
"import os
|
|
105
|
+
|
|
106
|
+
from proj_agent_connection import get_current_session_id
|
|
107
|
+
from proj_agent_connection.core.runtime_config import get_agentcore_runtime_config
|
|
108
|
+
from strands.session import FileSessionManager, S3SessionManager, SessionManager
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def get_session_manager() -> SessionManager | None:
|
|
112
|
+
"""Returns a SessionManager for persisting conversation state across
|
|
113
|
+
invocations. Local development always uses local file storage for
|
|
114
|
+
convenience, regardless of the configured session option. Without a
|
|
115
|
+
configured session option, conversation state is kept in memory only and
|
|
116
|
+
does not survive process restarts.
|
|
117
|
+
"""
|
|
118
|
+
session_id = get_current_session_id()
|
|
119
|
+
if not session_id:
|
|
120
|
+
raise RuntimeError(
|
|
121
|
+
"No current session id — cannot resolve a SessionManager outside of a request scope."
|
|
122
|
+
)
|
|
123
|
+
if os.environ.get("LOCAL_DEV") == "true":
|
|
124
|
+
return FileSessionManager(
|
|
125
|
+
session_id=session_id,
|
|
126
|
+
storage_dir="../../tmp/agents/strands/test-project-agent",
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
config = get_agentcore_runtime_config()
|
|
130
|
+
bucket_name = (
|
|
131
|
+
(config.get("agentRuntimes") or {})
|
|
132
|
+
.get("TestProjectAgent", {})
|
|
133
|
+
.get("session", {})
|
|
134
|
+
.get("bucketName")
|
|
135
|
+
)
|
|
136
|
+
if not bucket_name:
|
|
137
|
+
raise RuntimeError(
|
|
138
|
+
"No S3 bucket configured for this agent's session in runtime configuration."
|
|
139
|
+
)
|
|
140
|
+
return S3SessionManager(session_id=session_id, bucket=bucket_name)
|
|
141
|
+
"
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
exports[`py#agent generator > should generate session.py using S3CheckpointSaver when session is s3 > session.py (s3) 1`] = `
|
|
145
|
+
"import os
|
|
146
|
+
|
|
147
|
+
import aiosqlite
|
|
148
|
+
import boto3
|
|
149
|
+
from langgraph.checkpoint.base import BaseCheckpointSaver
|
|
150
|
+
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
|
|
151
|
+
from proj_agent_connection.core.runtime_config import get_agentcore_runtime_config
|
|
152
|
+
from proj_agent_connection.core.s3_checkpoint_saver_langchain import S3CheckpointSaver
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def get_checkpointer() -> BaseCheckpointSaver:
|
|
156
|
+
"""Returns a LangGraph checkpointer for persisting conversation state across
|
|
157
|
+
invocations. Local development always uses a local SQLite database for
|
|
158
|
+
convenience, regardless of the configured session option.
|
|
159
|
+
"""
|
|
160
|
+
if os.environ.get("LOCAL_DEV") == "true":
|
|
161
|
+
os.makedirs("../../tmp/agents/langchain/test-project-agent", exist_ok=True)
|
|
162
|
+
conn = aiosqlite.connect(
|
|
163
|
+
os.path.join(
|
|
164
|
+
"../../tmp/agents/langchain/test-project-agent", "checkpoints.sqlite"
|
|
165
|
+
)
|
|
166
|
+
)
|
|
167
|
+
return AsyncSqliteSaver(conn)
|
|
168
|
+
|
|
169
|
+
config = get_agentcore_runtime_config()
|
|
170
|
+
session_config = (
|
|
171
|
+
(config.get("agentRuntimes") or {})
|
|
172
|
+
.get("TestProjectAgent", {})
|
|
173
|
+
.get("session", {})
|
|
174
|
+
)
|
|
175
|
+
bucket_name = session_config.get("bucketName")
|
|
176
|
+
if not bucket_name:
|
|
177
|
+
raise RuntimeError(
|
|
178
|
+
"No S3 checkpoint bucket configured for this agent in runtime configuration."
|
|
179
|
+
)
|
|
180
|
+
return S3CheckpointSaver(
|
|
181
|
+
bucket_name=bucket_name,
|
|
182
|
+
prefix="checkpoints/",
|
|
183
|
+
s3_client=boto3.client("s3"),
|
|
184
|
+
)
|
|
185
|
+
"
|
|
186
|
+
`;
|
|
@@ -577,7 +577,8 @@ exports[`py#agent generator > langchain framework > should match snapshot for la
|
|
|
577
577
|
from langchain.agents import create_agent
|
|
578
578
|
from langchain_aws import ChatBedrockConverse
|
|
579
579
|
from langchain_core.tools import tool
|
|
580
|
-
|
|
580
|
+
|
|
581
|
+
from .session import get_checkpointer
|
|
581
582
|
|
|
582
583
|
REGION = os.environ.get("AWS_REGION", "us-east-1")
|
|
583
584
|
MODEL_ID = os.environ.get("MODEL_ID", "global.anthropic.claude-haiku-4-5-20251001-v1:0")
|
|
@@ -591,7 +592,6 @@ def subtract(a: int, b: int) -> int:
|
|
|
591
592
|
|
|
592
593
|
def get_agent():
|
|
593
594
|
model = ChatBedrockConverse(model=MODEL_ID, region_name=REGION)
|
|
594
|
-
# Swap InMemorySaver for a durable checkpointer in a multi-replica deployment.
|
|
595
595
|
return create_agent(
|
|
596
596
|
model=model,
|
|
597
597
|
tools=[subtract],
|
|
@@ -600,7 +600,7 @@ You are a mathematical wizard.
|
|
|
600
600
|
Use your tools for mathematical tasks.
|
|
601
601
|
Refer to tools as your 'spellbook'.
|
|
602
602
|
""",
|
|
603
|
-
checkpointer=
|
|
603
|
+
checkpointer=get_checkpointer(),
|
|
604
604
|
)
|
|
605
605
|
"
|
|
606
606
|
`;
|
|
@@ -721,6 +721,8 @@ dependencies = [
|
|
|
721
721
|
"langchain==1.3.14",
|
|
722
722
|
"langchain-aws==1.7.0",
|
|
723
723
|
"langgraph==1.2.10",
|
|
724
|
+
"langgraph-checkpoint-sqlite==3.1.1",
|
|
725
|
+
"aiosqlite==0.22.1",
|
|
724
726
|
"ag-ui-protocol==0.1.19",
|
|
725
727
|
"ag-ui-langgraph==0.0.42",
|
|
726
728
|
"uvicorn==0.52.1"
|
|
@@ -736,3 +738,45 @@ dev-dependencies = [ ]
|
|
|
736
738
|
workspace = true
|
|
737
739
|
"
|
|
738
740
|
`;
|
|
741
|
+
|
|
742
|
+
exports[`py#agent generator > langchain framework > should match snapshot for langchain generated files > langchain-session.py 1`] = `
|
|
743
|
+
"import os
|
|
744
|
+
|
|
745
|
+
import aiosqlite
|
|
746
|
+
import boto3
|
|
747
|
+
from langgraph.checkpoint.base import BaseCheckpointSaver
|
|
748
|
+
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
|
|
749
|
+
from proj_agent_connection.core.runtime_config import get_agentcore_runtime_config
|
|
750
|
+
from proj_agent_connection.core.s3_checkpoint_saver_langchain import S3CheckpointSaver
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
def get_checkpointer() -> BaseCheckpointSaver:
|
|
754
|
+
"""Returns a LangGraph checkpointer for persisting conversation state across
|
|
755
|
+
invocations. Local development always uses a local SQLite database for
|
|
756
|
+
convenience, regardless of the configured session option.
|
|
757
|
+
"""
|
|
758
|
+
if os.environ.get("LOCAL_DEV") == "true":
|
|
759
|
+
os.makedirs("../../tmp/agents/langchain/snapshot-agent", exist_ok=True)
|
|
760
|
+
conn = aiosqlite.connect(
|
|
761
|
+
os.path.join(
|
|
762
|
+
"../../tmp/agents/langchain/snapshot-agent", "checkpoints.sqlite"
|
|
763
|
+
)
|
|
764
|
+
)
|
|
765
|
+
return AsyncSqliteSaver(conn)
|
|
766
|
+
|
|
767
|
+
config = get_agentcore_runtime_config()
|
|
768
|
+
session_config = (
|
|
769
|
+
(config.get("agentRuntimes") or {}).get("SnapshotAgent", {}).get("session", {})
|
|
770
|
+
)
|
|
771
|
+
bucket_name = session_config.get("bucketName")
|
|
772
|
+
if not bucket_name:
|
|
773
|
+
raise RuntimeError(
|
|
774
|
+
"No S3 checkpoint bucket configured for this agent in runtime configuration."
|
|
775
|
+
)
|
|
776
|
+
return S3CheckpointSaver(
|
|
777
|
+
bucket_name=bucket_name,
|
|
778
|
+
prefix="checkpoints/",
|
|
779
|
+
s3_client=boto3.client("s3"),
|
|
780
|
+
)
|
|
781
|
+
"
|
|
782
|
+
`;
|