@aws/nx-plugin 1.2.0 → 1.3.1
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 +107 -259
- package/README.md +1 -0
- package/generators.json +8 -0
- package/migrations.json +53 -10
- package/package.json +14 -14
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/greengrass/component/python/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/internal/test-matrix/generator.js +6 -1
- package/src/internal/test-matrix/generator.js.map +1 -1
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/metadata.json +3 -0
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/migration.d.ts +6 -0
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/migration.js +113 -0
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/migration.js.map +1 -0
- package/src/migrations/v1.0.15/0001-py-agent-pillow-override/migration.js.map +1 -0
- package/src/migrations/v1.1.1/0001-ts-agent-guardrails-synth-input/migration.js.map +1 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/metadata.json +3 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/migration.d.ts +6 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/migration.js +118 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/migration.js.map +1 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +17 -5
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +7 -7
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
- package/src/py/agent/guardrails/__snapshots__/generator.spec.ts.snap +3813 -0
- package/src/py/agent/guardrails/files/langchain/guardrail.py.template +135 -0
- package/src/py/agent/guardrails/files/strands/guardrail.py.template +93 -0
- package/src/py/agent/guardrails/generator.d.ts +10 -0
- package/src/py/agent/guardrails/generator.js +175 -0
- package/src/py/agent/guardrails/generator.js.map +1 -0
- package/src/py/agent/guardrails/runtime-check/run_checks.py +250 -0
- package/src/py/agent/guardrails/schema.d.js +6 -0
- package/src/py/agent/guardrails/schema.d.js.map +1 -0
- package/src/py/agent/guardrails/schema.d.ts +9 -0
- package/src/py/agent/guardrails/schema.json +25 -0
- 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/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/sdk/py.d.ts +2 -0
- package/src/sdk/py.js +1 -0
- package/src/sdk/py.js.map +1 -1
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/agent/guardrails/__snapshots__/generator.spec.ts.snap +57 -6
- package/src/ts/agent/guardrails/generator.js +2 -1
- package/src/ts/agent/guardrails/generator.js.map +1 -1
- 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/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +53 -33
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/utils/format.d.ts +10 -0
- package/src/utils/format.js +11 -0
- package/src/utils/format.js.map +1 -1
- package/src/utils/guardrail-constructs/files/terraform/app/guardrails/__nameKebabCase__/__nameKebabCase__-guardrail.tf.template +18 -1
- package/src/utils/guardrail-constructs/guardrail-constructs.d.ts +5 -0
- package/src/utils/guardrail-constructs/guardrail-constructs.js +8 -0
- package/src/utils/guardrail-constructs/guardrail-constructs.js.map +1 -1
- package/src/utils/guardrail-constructs/guardrail-wiring.d.ts +7 -0
- package/src/utils/guardrail-constructs/guardrail-wiring.js +6 -5
- package/src/utils/guardrail-constructs/guardrail-wiring.js.map +1 -1
- package/src/utils/test/fake-aws/fake_aws.py +205 -0
- package/src/utils/test/python-dependencies.d.ts +6 -0
- package/src/utils/test/python-dependencies.js +19 -0
- package/src/utils/test/python-dependencies.js.map +1 -1
- package/src/utils/test/warm-python-cache.js +5 -1
- package/src/utils/test/warm-python-cache.js.map +1 -1
- package/src/utils/version-upgrade-migration/sync-vended-versions.d.ts +8 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js +11 -2
- package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
- package/src/utils/versions.d.ts +71 -71
- package/src/utils/versions.js +68 -68
- package/src/utils/versions.js.map +1 -1
- package/src/migrations/latest/py-agent-pillow-override/migration.js.map +0 -1
- package/src/migrations/latest/ts-agent-guardrails-synth-input/migration.js.map +0 -1
- /package/src/migrations/{latest/py-agent-pillow-override → v1.0.15/0001-py-agent-pillow-override}/metadata.json +0 -0
- /package/src/migrations/{latest/py-agent-pillow-override → v1.0.15/0001-py-agent-pillow-override}/migration.d.ts +0 -0
- /package/src/migrations/{latest/py-agent-pillow-override → v1.0.15/0001-py-agent-pillow-override}/migration.js +0 -0
- /package/src/migrations/{latest/ts-agent-guardrails-synth-input → v1.1.1/0001-ts-agent-guardrails-synth-input}/metadata.json +0 -0
- /package/src/migrations/{latest/ts-agent-guardrails-synth-input → v1.1.1/0001-ts-agent-guardrails-synth-input}/migration.d.ts +0 -0
- /package/src/migrations/{latest/ts-agent-guardrails-synth-input → v1.1.1/0001-ts-agent-guardrails-synth-input}/migration.js +0 -0
- /package/src/{ts/agent/guardrails/files/agent → utils/guardrail-constructs/files/policy}/guardrail.json.template +0 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
"""Run a generated, guarded Python agent against fake_aws.py and report what
|
|
6
|
+
the real SDK sent. Used by guardrail-runtime.spec.ts.
|
|
7
|
+
|
|
8
|
+
Usage: python run_checks.py <project root> <connection root> <fake_aws.py> <framework>
|
|
9
|
+
<agent package> <agent-connection module> [<scenario>]
|
|
10
|
+
|
|
11
|
+
<project root> holds the agent project's module and pyproject.toml, and
|
|
12
|
+
<connection root> the agent-connection module, as in a workspace.
|
|
13
|
+
Without a scenario, every scenario runs in a fresh interpreter (so the
|
|
14
|
+
guardrail cache and warn-once state start clean), then the static checks, and
|
|
15
|
+
one line "RESULTS <json>" maps each name to its result.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import asyncio
|
|
19
|
+
import importlib
|
|
20
|
+
import importlib.util
|
|
21
|
+
import json
|
|
22
|
+
import logging
|
|
23
|
+
import os
|
|
24
|
+
import shutil
|
|
25
|
+
import subprocess
|
|
26
|
+
import sys
|
|
27
|
+
import tempfile
|
|
28
|
+
import time
|
|
29
|
+
from contextlib import contextmanager
|
|
30
|
+
from typing import Any
|
|
31
|
+
|
|
32
|
+
ROOT, CONNECTION_ROOT, FAKE_AWS, FRAMEWORK, AGENT_PACKAGE, CONNECTION_MODULE = sys.argv[1:7]
|
|
33
|
+
|
|
34
|
+
ENTRY = {"guardrailId": "grtest", "guardrailVersion": "1"}
|
|
35
|
+
# fake_aws.py blocks a guarded request whose checked text contains "stocks".
|
|
36
|
+
BLOCKED_PROMPT = "Which stocks should I buy this year?"
|
|
37
|
+
|
|
38
|
+
# scenario: (LOCAL_DEV, RUNTIME_CONFIG_APP_ID, guardrail entry or None, number of calls)
|
|
39
|
+
SCENARIOS: dict[str, tuple[bool, str | None, dict[str, str] | None, int]] = {
|
|
40
|
+
"guarded": (False, "fake-app", ENTRY, 1),
|
|
41
|
+
"missing": (False, "fake-app", None, 1),
|
|
42
|
+
"no-app-id": (False, None, ENTRY, 1),
|
|
43
|
+
"local-dev": (True, None, ENTRY, 2),
|
|
44
|
+
"local-dev-broken": (True, "broken", ENTRY, 2),
|
|
45
|
+
"local-dev-guarded": (True, "fake-app", ENTRY, 1),
|
|
46
|
+
"draft": (False, "fake-app", {**ENTRY, "guardrailVersion": "DRAFT"}, 1),
|
|
47
|
+
"draft-local": (True, "fake-app", {**ENTRY, "guardrailVersion": "DRAFT"}, 1),
|
|
48
|
+
"zero": (False, "fake-app", {**ENTRY, "guardrailVersion": "0"}, 1),
|
|
49
|
+
"zero-local": (True, "fake-app", {**ENTRY, "guardrailVersion": "0"}, 1),
|
|
50
|
+
"reread": (False, "fake-app", ENTRY, 0),
|
|
51
|
+
"concurrent": (False, "fake-app", ENTRY, 0),
|
|
52
|
+
"blocked-session": (False, "fake-app", ENTRY, 0),
|
|
53
|
+
"blocked-session-stream": (False, "fake-app", ENTRY, 0),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def write_config(path: str, entry: dict[str, str] | None, class_name: str) -> None:
|
|
58
|
+
data: dict[str, Any] = {"agentRuntimes": {}}
|
|
59
|
+
if entry is not None:
|
|
60
|
+
data["guardrails"] = {class_name: entry}
|
|
61
|
+
with open(path, "w") as f:
|
|
62
|
+
json.dump(data, f)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def read_log(path: str) -> list[dict[str, Any]]:
|
|
66
|
+
if not os.path.exists(path):
|
|
67
|
+
return []
|
|
68
|
+
with open(path) as f:
|
|
69
|
+
return [json.loads(line) for line in f if line.strip()]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class WarningRecorder(logging.Handler):
|
|
73
|
+
def __init__(self) -> None:
|
|
74
|
+
super().__init__(logging.WARNING)
|
|
75
|
+
self.messages: list[str] = []
|
|
76
|
+
|
|
77
|
+
def emit(self, record: logging.LogRecord) -> None:
|
|
78
|
+
if record.name.endswith(".guardrail"):
|
|
79
|
+
self.messages.append(record.getMessage())
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def run_scenario(name: str) -> dict[str, Any]:
|
|
83
|
+
local_dev, app_id, entry, calls = SCENARIOS[name]
|
|
84
|
+
work = tempfile.mkdtemp(prefix=f"{name}-")
|
|
85
|
+
config_file, log_file = os.path.join(work, "config.json"), os.path.join(work, "requests.log")
|
|
86
|
+
# The vended local session storage is relative to the project root, two levels down.
|
|
87
|
+
cwd = os.path.join(work, "packages", "project")
|
|
88
|
+
os.makedirs(cwd)
|
|
89
|
+
os.chdir(cwd)
|
|
90
|
+
|
|
91
|
+
spec = importlib.util.spec_from_file_location("fake_aws", FAKE_AWS)
|
|
92
|
+
assert spec and spec.loader
|
|
93
|
+
fake_aws = importlib.util.module_from_spec(spec)
|
|
94
|
+
spec.loader.exec_module(fake_aws)
|
|
95
|
+
_server, port = fake_aws.start_server(config_file, log_file)
|
|
96
|
+
os.environ["AWS_ENDPOINT_URL_APPCONFIGDATA"] = f"http://127.0.0.1:{port}"
|
|
97
|
+
os.environ["AWS_ENDPOINT_URL_BEDROCK_RUNTIME"] = f"http://127.0.0.1:{port}"
|
|
98
|
+
os.environ.pop("LOCAL_DEV", None)
|
|
99
|
+
os.environ.pop("RUNTIME_CONFIG_APP_ID", None)
|
|
100
|
+
if local_dev:
|
|
101
|
+
os.environ["LOCAL_DEV"] = "true"
|
|
102
|
+
if app_id:
|
|
103
|
+
os.environ["RUNTIME_CONFIG_APP_ID"] = app_id
|
|
104
|
+
|
|
105
|
+
recorder = WarningRecorder()
|
|
106
|
+
logging.getLogger().addHandler(recorder)
|
|
107
|
+
|
|
108
|
+
sys.path[:0] = [ROOT, CONNECTION_ROOT]
|
|
109
|
+
agent_module = importlib.import_module(f"{AGENT_PACKAGE}.agent")
|
|
110
|
+
guardrail_module = importlib.import_module(f"{AGENT_PACKAGE}.guardrail")
|
|
111
|
+
class_name = guardrail_module.RUNTIME_CONFIG_KEY.split(".")[-1]
|
|
112
|
+
write_config(config_file, entry, class_name)
|
|
113
|
+
|
|
114
|
+
result: dict[str, Any] = {"calls": []}
|
|
115
|
+
|
|
116
|
+
def snapshot() -> dict[str, Any]:
|
|
117
|
+
log = read_log(log_file)
|
|
118
|
+
return {
|
|
119
|
+
"models": [r for r in log if "modelId" in r],
|
|
120
|
+
"appConfigCalls": len([r for r in log if "modelId" not in r]),
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async def scenario() -> None:
|
|
124
|
+
if FRAMEWORK == "strands":
|
|
125
|
+
connection = importlib.import_module(CONNECTION_MODULE)
|
|
126
|
+
|
|
127
|
+
@contextmanager
|
|
128
|
+
def agent_scope():
|
|
129
|
+
with connection.session_id_context("s1"), agent_module.get_agent() as agent:
|
|
130
|
+
yield agent
|
|
131
|
+
|
|
132
|
+
async def call(agent: Any, prompt: str = "2+2?") -> None:
|
|
133
|
+
await agent.invoke_async(prompt)
|
|
134
|
+
|
|
135
|
+
if name == "concurrent":
|
|
136
|
+
from strands import Agent
|
|
137
|
+
|
|
138
|
+
shared = guardrail_module.get_guardrailed_model()
|
|
139
|
+
agents = [Agent(model=shared, callback_handler=None) for _ in range(10)]
|
|
140
|
+
await asyncio.gather(*[a.invoke_async("2+2?") for a in agents])
|
|
141
|
+
return
|
|
142
|
+
with agent_scope() as agent:
|
|
143
|
+
await run_calls(agent, call)
|
|
144
|
+
else:
|
|
145
|
+
graph = agent_module.get_agent()
|
|
146
|
+
counter = iter(range(1000))
|
|
147
|
+
|
|
148
|
+
async def call(agent: Any, prompt: str | None = None) -> None:
|
|
149
|
+
# A call with a prompt continues one session; without, each call is a new session.
|
|
150
|
+
if name == "blocked-session-stream":
|
|
151
|
+
await stream(agent, prompt)
|
|
152
|
+
return
|
|
153
|
+
thread = {"configurable": {"thread_id": "session" if prompt else f"t{next(counter)}"}}
|
|
154
|
+
await agent.ainvoke({"messages": [{"role": "user", "content": prompt or "2+2?"}]}, thread)
|
|
155
|
+
|
|
156
|
+
async def stream(agent: Any, prompt: str | None = None) -> None:
|
|
157
|
+
thread = {"configurable": {"thread_id": "session" if prompt else f"t{next(counter)}"}}
|
|
158
|
+
async for _ in agent.astream(
|
|
159
|
+
{"messages": [{"role": "user", "content": prompt or "2+2?"}]}, thread, stream_mode="messages"
|
|
160
|
+
):
|
|
161
|
+
pass
|
|
162
|
+
|
|
163
|
+
if name == "concurrent":
|
|
164
|
+
await asyncio.gather(*[call(graph) for _ in range(10)])
|
|
165
|
+
return
|
|
166
|
+
await run_calls(graph, call)
|
|
167
|
+
if name == "guarded":
|
|
168
|
+
await stream(graph)
|
|
169
|
+
result["streamed"] = snapshot()["models"][-1:]
|
|
170
|
+
|
|
171
|
+
async def run_calls(agent: Any, call: Any) -> None:
|
|
172
|
+
if name.startswith("blocked-session"):
|
|
173
|
+
# A blocked message, then a normal one, in the same session.
|
|
174
|
+
for prompt in (BLOCKED_PROMPT, "2+2?"):
|
|
175
|
+
await call(agent, prompt)
|
|
176
|
+
result["calls"].append(snapshot())
|
|
177
|
+
return
|
|
178
|
+
if name == "reread":
|
|
179
|
+
await call(agent)
|
|
180
|
+
result["calls"].append(snapshot())
|
|
181
|
+
write_config(config_file, {**ENTRY, "guardrailVersion": "2"}, class_name)
|
|
182
|
+
await call(agent)
|
|
183
|
+
result["calls"].append(snapshot())
|
|
184
|
+
time.sleep(5.5)
|
|
185
|
+
await call(agent)
|
|
186
|
+
result["calls"].append(snapshot())
|
|
187
|
+
return
|
|
188
|
+
for _ in range(calls):
|
|
189
|
+
await call(agent)
|
|
190
|
+
result["calls"].append(snapshot())
|
|
191
|
+
|
|
192
|
+
try:
|
|
193
|
+
asyncio.run(scenario())
|
|
194
|
+
except Exception as e: # noqa: BLE001 - reported to the spec
|
|
195
|
+
result["error"] = {"type": type(e).__name__, "message": str(e)}
|
|
196
|
+
result.update(snapshot())
|
|
197
|
+
result["warnings"] = recorder.messages
|
|
198
|
+
shutil.rmtree(work, ignore_errors=True)
|
|
199
|
+
return result
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def run_static() -> dict[str, Any]:
|
|
203
|
+
package_dir = os.path.join(ROOT, *AGENT_PACKAGE.split("."))
|
|
204
|
+
files = [os.path.join(package_dir, f) for f in ("guardrail.py", "agent.py")]
|
|
205
|
+
# uv's --with environment layers several site-packages directories, which
|
|
206
|
+
# ty does not discover from the interpreter alone.
|
|
207
|
+
search_paths = [CONNECTION_ROOT, *(p for p in sys.path if p.endswith("site-packages"))]
|
|
208
|
+
commands = {
|
|
209
|
+
"ty": [
|
|
210
|
+
"ty",
|
|
211
|
+
"check",
|
|
212
|
+
"--python",
|
|
213
|
+
sys.executable,
|
|
214
|
+
*(arg for path in search_paths for arg in ("--extra-search-path", path)),
|
|
215
|
+
"--no-progress",
|
|
216
|
+
*files,
|
|
217
|
+
],
|
|
218
|
+
"ruffFormat": ["ruff", "format", "--check", *files],
|
|
219
|
+
"ruffCheck": ["ruff", "check", "--select", "E,F,UP,B,SIM,I", *files],
|
|
220
|
+
}
|
|
221
|
+
results = {}
|
|
222
|
+
for key, command in commands.items():
|
|
223
|
+
done = subprocess.run(command, cwd=ROOT, capture_output=True, text=True)
|
|
224
|
+
results[key] = {"code": done.returncode, "output": done.stdout + done.stderr}
|
|
225
|
+
return results
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
if __name__ == "__main__":
|
|
229
|
+
if len(sys.argv) > 7:
|
|
230
|
+
print("\nRESULT " + json.dumps(run_scenario(sys.argv[7])), flush=True)
|
|
231
|
+
# A failed LangChain call in local dev leaves the SQLite checkpointer's
|
|
232
|
+
# non-daemon thread running, which would keep the interpreter alive.
|
|
233
|
+
os._exit(0)
|
|
234
|
+
else:
|
|
235
|
+
results: dict[str, Any] = {}
|
|
236
|
+
for scenario_name in SCENARIOS:
|
|
237
|
+
done = subprocess.run(
|
|
238
|
+
[sys.executable, __file__, *sys.argv[1:7], scenario_name],
|
|
239
|
+
capture_output=True,
|
|
240
|
+
text=True,
|
|
241
|
+
timeout=180,
|
|
242
|
+
)
|
|
243
|
+
lines = [line for line in done.stdout.splitlines() if line.startswith("RESULT ")]
|
|
244
|
+
results[scenario_name] = (
|
|
245
|
+
json.loads(lines[-1][len("RESULT ") :])
|
|
246
|
+
if lines
|
|
247
|
+
else {"crashed": done.returncode, "stdout": done.stdout[-4000:], "stderr": done.stderr[-4000:]}
|
|
248
|
+
)
|
|
249
|
+
results["static"] = run_static()
|
|
250
|
+
print("RESULTS " + json.dumps(results), flush=True)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/agent/guardrails/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface PyAgentGuardrailsGeneratorSchema {\n project: string;\n agent?: string;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAED,WAGC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "py#agent#guardrails",
|
|
4
|
+
"title": "py#agent#guardrails",
|
|
5
|
+
"x-label": "Agent Guardrails",
|
|
6
|
+
"description": "Add an Amazon Bedrock Guardrail to a Python Agent",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"project": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "The project containing the Python Agent",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-prompt": "Select the project containing the Python Agent to guard",
|
|
17
|
+
"x-dropdown": "projects"
|
|
18
|
+
},
|
|
19
|
+
"agent": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "The name of the Agent component to guard. Required when the project contains more than one Python Agent."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["project"]
|
|
25
|
+
}
|
|
@@ -35,7 +35,7 @@ exports[`py#dynamodb generator > should generate terraform modules when iac is t
|
|
|
35
35
|
required_providers {
|
|
36
36
|
aws = {
|
|
37
37
|
source = "hashicorp/aws"
|
|
38
|
-
version = "6.
|
|
38
|
+
version = "6.70.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -232,7 +232,7 @@ exports[`py#dynamodb generator > should generate terraform modules when iac is t
|
|
|
232
232
|
required_providers {
|
|
233
233
|
aws = {
|
|
234
234
|
source = "hashicorp/aws"
|
|
235
|
-
version = "6.
|
|
235
|
+
version = "6.70.0"
|
|
236
236
|
}
|
|
237
237
|
random = {
|
|
238
238
|
source = "hashicorp/random"
|
|
@@ -11,7 +11,7 @@ terraform {
|
|
|
11
11
|
required_providers {
|
|
12
12
|
aws = {
|
|
13
13
|
source = "hashicorp/aws"
|
|
14
|
-
version = "6.
|
|
14
|
+
version = "6.70.0"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -262,7 +262,7 @@ output "api_log_group_arn" {
|
|
|
262
262
|
}
|
|
263
263
|
aws = {
|
|
264
264
|
source = "hashicorp/aws"
|
|
265
|
-
version = "6.
|
|
265
|
+
version = "6.70.0"
|
|
266
266
|
}
|
|
267
267
|
random = {
|
|
268
268
|
source = "hashicorp/random"
|
|
@@ -908,7 +908,7 @@ terraform {
|
|
|
908
908
|
required_providers {
|
|
909
909
|
aws = {
|
|
910
910
|
source = "hashicorp/aws"
|
|
911
|
-
version = "6.
|
|
911
|
+
version = "6.70.0"
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
914
|
}
|
|
@@ -1159,7 +1159,7 @@ output "api_log_group_arn" {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
aws = {
|
|
1161
1161
|
source = "hashicorp/aws"
|
|
1162
|
-
version = "6.
|
|
1162
|
+
version = "6.70.0"
|
|
1163
1163
|
}
|
|
1164
1164
|
random = {
|
|
1165
1165
|
source = "hashicorp/random"
|
|
@@ -1878,7 +1878,7 @@ terraform {
|
|
|
1878
1878
|
required_providers {
|
|
1879
1879
|
aws = {
|
|
1880
1880
|
source = "hashicorp/aws"
|
|
1881
|
-
version = "6.
|
|
1881
|
+
version = "6.70.0"
|
|
1882
1882
|
}
|
|
1883
1883
|
}
|
|
1884
1884
|
}
|
|
@@ -2129,7 +2129,7 @@ output "api_log_group_arn" {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
aws = {
|
|
2131
2131
|
source = "hashicorp/aws"
|
|
2132
|
-
version = "6.
|
|
2132
|
+
version = "6.70.0"
|
|
2133
2133
|
}
|
|
2134
2134
|
random = {
|
|
2135
2135
|
source = "hashicorp/random"
|
|
@@ -2752,7 +2752,7 @@ terraform {
|
|
|
2752
2752
|
required_providers {
|
|
2753
2753
|
aws = {
|
|
2754
2754
|
source = "hashicorp/aws"
|
|
2755
|
-
version = "6.
|
|
2755
|
+
version = "6.70.0"
|
|
2756
2756
|
}
|
|
2757
2757
|
random = {
|
|
2758
2758
|
source = "hashicorp/random"
|
|
@@ -3065,7 +3065,7 @@ output "waf_web_acl_arn" {
|
|
|
3065
3065
|
}
|
|
3066
3066
|
aws = {
|
|
3067
3067
|
source = "hashicorp/aws"
|
|
3068
|
-
version = "6.
|
|
3068
|
+
version = "6.70.0"
|
|
3069
3069
|
}
|
|
3070
3070
|
random = {
|
|
3071
3071
|
source = "hashicorp/random"
|
|
@@ -4162,7 +4162,7 @@ terraform {
|
|
|
4162
4162
|
required_providers {
|
|
4163
4163
|
aws = {
|
|
4164
4164
|
source = "hashicorp/aws"
|
|
4165
|
-
version = "6.
|
|
4165
|
+
version = "6.70.0"
|
|
4166
4166
|
}
|
|
4167
4167
|
random = {
|
|
4168
4168
|
source = "hashicorp/random"
|
|
@@ -4475,7 +4475,7 @@ output "waf_web_acl_arn" {
|
|
|
4475
4475
|
}
|
|
4476
4476
|
aws = {
|
|
4477
4477
|
source = "hashicorp/aws"
|
|
4478
|
-
version = "6.
|
|
4478
|
+
version = "6.70.0"
|
|
4479
4479
|
}
|
|
4480
4480
|
random = {
|
|
4481
4481
|
source = "hashicorp/random"
|
|
@@ -5561,7 +5561,7 @@ terraform {
|
|
|
5561
5561
|
required_providers {
|
|
5562
5562
|
aws = {
|
|
5563
5563
|
source = "hashicorp/aws"
|
|
5564
|
-
version = "6.
|
|
5564
|
+
version = "6.70.0"
|
|
5565
5565
|
}
|
|
5566
5566
|
random = {
|
|
5567
5567
|
source = "hashicorp/random"
|
|
@@ -5874,7 +5874,7 @@ output "waf_web_acl_arn" {
|
|
|
5874
5874
|
}
|
|
5875
5875
|
aws = {
|
|
5876
5876
|
source = "hashicorp/aws"
|
|
5877
|
-
version = "6.
|
|
5877
|
+
version = "6.70.0"
|
|
5878
5878
|
}
|
|
5879
5879
|
random = {
|
|
5880
5880
|
source = "hashicorp/random"
|
|
@@ -71,7 +71,7 @@ exports[`lambda-handler project generator > terraform iac > should generate terr
|
|
|
71
71
|
required_providers {
|
|
72
72
|
aws = {
|
|
73
73
|
source = "hashicorp/aws"
|
|
74
|
-
version = "6.
|
|
74
|
+
version = "6.70.0"
|
|
75
75
|
}
|
|
76
76
|
archive = {
|
|
77
77
|
source = "hashicorp/archive"
|
|
@@ -256,7 +256,7 @@ exports[`lambda-handler project generator > terraform iac > should match snapsho
|
|
|
256
256
|
required_providers {
|
|
257
257
|
aws = {
|
|
258
258
|
source = "hashicorp/aws"
|
|
259
|
-
version = "6.
|
|
259
|
+
version = "6.70.0"
|
|
260
260
|
}
|
|
261
261
|
archive = {
|
|
262
262
|
source = "hashicorp/archive"
|
|
@@ -155,7 +155,7 @@ exports[`py#mcp-server generator > should match snapshot for Terraform generated
|
|
|
155
155
|
required_providers {
|
|
156
156
|
aws = {
|
|
157
157
|
source = "hashicorp/aws"
|
|
158
|
-
version = "6.
|
|
158
|
+
version = "6.70.0"
|
|
159
159
|
}
|
|
160
160
|
null = {
|
|
161
161
|
source = "hashicorp/null"
|
|
@@ -514,7 +514,7 @@ resource "null_resource" "runtime_ready" {
|
|
|
514
514
|
|
|
515
515
|
provisioner "local-exec" {
|
|
516
516
|
command = <<-EOT
|
|
517
|
-
uv run --with boto3==1.43.
|
|
517
|
+
uv run --with boto3==1.43.118 python -c "
|
|
518
518
|
import boto3
|
|
519
519
|
import json
|
|
520
520
|
import os
|
|
@@ -801,10 +801,10 @@ exports[`py#mcp-server generator > should match snapshot for generated files > u
|
|
|
801
801
|
name = "proj.test_project"
|
|
802
802
|
version = "0.1.0"
|
|
803
803
|
dependencies = [
|
|
804
|
-
"aws-lambda-powertools==3.
|
|
804
|
+
"aws-lambda-powertools==3.37.0",
|
|
805
805
|
"mcp==1.28.1",
|
|
806
806
|
"uvicorn==0.54.0",
|
|
807
|
-
"boto3==1.43.
|
|
807
|
+
"boto3==1.43.118",
|
|
808
808
|
"aws-opentelemetry-distro==0.21.0"
|
|
809
809
|
]
|
|
810
810
|
|
|
@@ -228,7 +228,7 @@ exports[`py#rdb generator > should generate Terraform modules 1`] = `
|
|
|
228
228
|
}
|
|
229
229
|
aws = {
|
|
230
230
|
source = "hashicorp/aws"
|
|
231
|
-
version = "6.
|
|
231
|
+
version = "6.70.0"
|
|
232
232
|
}
|
|
233
233
|
external = {
|
|
234
234
|
source = "hashicorp/external"
|
|
@@ -1504,11 +1504,11 @@ requires-python = ">=3.14"
|
|
|
1504
1504
|
readme = "README.md"
|
|
1505
1505
|
dependencies = [
|
|
1506
1506
|
"sqlmodel==0.0.48",
|
|
1507
|
-
"alembic==1.20.
|
|
1507
|
+
"alembic==1.20.1",
|
|
1508
1508
|
"greenlet==3.5.6",
|
|
1509
1509
|
"asyncpg==0.32.0",
|
|
1510
|
-
"boto3==1.43.
|
|
1511
|
-
"aws-lambda-powertools==3.
|
|
1510
|
+
"boto3==1.43.118",
|
|
1511
|
+
"aws-lambda-powertools==3.37.0"
|
|
1512
1512
|
]
|
|
1513
1513
|
|
|
1514
1514
|
[build-system]
|
package/src/sdk/py.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
export { pyAgentGenerator } from '../py/agent/generator.js';
|
|
6
|
+
export { pyAgentGuardrailsGenerator } from '../py/agent/guardrails/generator.js';
|
|
7
|
+
export type { PyAgentGuardrailsGeneratorSchema } from '../py/agent/guardrails/schema';
|
|
6
8
|
export type { PyAgentGeneratorSchema } from '../py/agent/schema';
|
|
7
9
|
export { pyApiGenerator } from '../py/api/generator.js';
|
|
8
10
|
export type { PyApiGeneratorSchema } from '../py/api/schema';
|
package/src/sdk/py.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/ export { pyAgentGenerator } from "../py/agent/generator.js";
|
|
5
|
+
export { pyAgentGuardrailsGenerator } from "../py/agent/guardrails/generator.js";
|
|
5
6
|
export { pyApiGenerator } from "../py/api/generator.js";
|
|
6
7
|
export { pyDynamoDBGenerator } from "../py/dynamodb/generator.js";
|
|
7
8
|
export { pyLambdaFunctionGenerator } from "../py/lambda-function/generator.js";
|
package/src/sdk/py.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/sdk/py.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { pyAgentGenerator } from '../py/agent/generator.js';\nexport type { PyAgentGeneratorSchema } from '../py/agent/schema';\n\nexport { pyApiGenerator } from '../py/api/generator.js';\nexport type { PyApiGeneratorSchema } from '../py/api/schema';\n\nexport { pyDynamoDBGenerator } from '../py/dynamodb/generator.js';\nexport type { PyDynamoDBGeneratorSchema } from '../py/dynamodb/schema';\n\nexport { pyLambdaFunctionGenerator } from '../py/lambda-function/generator.js';\nexport type { PyLambdaFunctionGeneratorSchema } from '../py/lambda-function/schema';\n\nexport { pyMcpServerGenerator } from '../py/mcp-server/generator.js';\nexport type { PyMcpServerGeneratorSchema } from '../py/mcp-server/schema';\nexport { pyProjectGenerator } from '../py/project/generator.js';\nexport type { PyProjectGeneratorSchema } from '../py/project/schema';\n\nexport { pyRdbGenerator } from '../py/rdb/generator.js';\nexport type { PyRdbGeneratorSchema } from '../py/rdb/schema';\n"],"names":["pyAgentGenerator","pyApiGenerator","pyDynamoDBGenerator","pyLambdaFunctionGenerator","pyMcpServerGenerator","pyProjectGenerator","pyRdbGenerator"],"mappings":"AAAA;;;CAGC,GAED,SAASA,gBAAgB,QAAQ,2BAA2B;
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/sdk/py.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { pyAgentGenerator } from '../py/agent/generator.js';\nexport { pyAgentGuardrailsGenerator } from '../py/agent/guardrails/generator.js';\nexport type { PyAgentGuardrailsGeneratorSchema } from '../py/agent/guardrails/schema';\nexport type { PyAgentGeneratorSchema } from '../py/agent/schema';\n\nexport { pyApiGenerator } from '../py/api/generator.js';\nexport type { PyApiGeneratorSchema } from '../py/api/schema';\n\nexport { pyDynamoDBGenerator } from '../py/dynamodb/generator.js';\nexport type { PyDynamoDBGeneratorSchema } from '../py/dynamodb/schema';\n\nexport { pyLambdaFunctionGenerator } from '../py/lambda-function/generator.js';\nexport type { PyLambdaFunctionGeneratorSchema } from '../py/lambda-function/schema';\n\nexport { pyMcpServerGenerator } from '../py/mcp-server/generator.js';\nexport type { PyMcpServerGeneratorSchema } from '../py/mcp-server/schema';\nexport { pyProjectGenerator } from '../py/project/generator.js';\nexport type { PyProjectGeneratorSchema } from '../py/project/schema';\n\nexport { pyRdbGenerator } from '../py/rdb/generator.js';\nexport type { PyRdbGeneratorSchema } from '../py/rdb/schema';\n"],"names":["pyAgentGenerator","pyAgentGuardrailsGenerator","pyApiGenerator","pyDynamoDBGenerator","pyLambdaFunctionGenerator","pyMcpServerGenerator","pyProjectGenerator","pyRdbGenerator"],"mappings":"AAAA;;;CAGC,GAED,SAASA,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,0BAA0B,QAAQ,sCAAsC;AAIjF,SAASC,cAAc,QAAQ,yBAAyB;AAGxD,SAASC,mBAAmB,QAAQ,8BAA8B;AAGlE,SAASC,yBAAyB,QAAQ,qCAAqC;AAG/E,SAASC,oBAAoB,QAAQ,gCAAgC;AAErE,SAASC,kBAAkB,QAAQ,6BAA6B;AAGhE,SAASC,cAAc,QAAQ,yBAAyB"}
|
|
@@ -46,7 +46,7 @@ exports[`smithyProjectGenerator > shape libraries > should generate a shape libr
|
|
|
46
46
|
"shx rm -rf dist/{projectRoot}/build",
|
|
47
47
|
"shx rm -rf dist/{projectRoot}/smithy",
|
|
48
48
|
"shx mkdir -p dist/{projectRoot}/build",
|
|
49
|
-
"npx -y mise@2026.10.
|
|
49
|
+
"npx -y mise@2026.10.19 exec smithy@1.74.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
|
|
50
50
|
"shx cp dist/{projectRoot}/smithy/source/model/model.json dist/{projectRoot}/build/model.json"
|
|
51
51
|
],
|
|
52
52
|
"parallel": false,
|
|
@@ -124,7 +124,7 @@ exports[`smithyProjectGenerator > should generate smithy project with all custom
|
|
|
124
124
|
"shx rm -rf dist/{projectRoot}/build",
|
|
125
125
|
"shx rm -rf dist/{projectRoot}/smithy",
|
|
126
126
|
"shx mkdir -p dist/{projectRoot}/build",
|
|
127
|
-
"npx -y mise@2026.10.
|
|
127
|
+
"npx -y mise@2026.10.19 exec smithy@1.74.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
|
|
128
128
|
"shx mkdir -p dist/{projectRoot}/build/openapi",
|
|
129
129
|
"shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
|
|
130
130
|
],
|
|
@@ -184,7 +184,7 @@ exports[`smithyProjectGenerator > should generate smithy project with custom dir
|
|
|
184
184
|
"shx rm -rf dist/{projectRoot}/build",
|
|
185
185
|
"shx rm -rf dist/{projectRoot}/smithy",
|
|
186
186
|
"shx mkdir -p dist/{projectRoot}/build",
|
|
187
|
-
"npx -y mise@2026.10.
|
|
187
|
+
"npx -y mise@2026.10.19 exec smithy@1.74.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
|
|
188
188
|
"shx mkdir -p dist/{projectRoot}/build/openapi",
|
|
189
189
|
"shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
|
|
190
190
|
],
|
|
@@ -336,7 +336,7 @@ exports[`smithyProjectGenerator > should generate smithy project with default op
|
|
|
336
336
|
"shx rm -rf dist/{projectRoot}/build",
|
|
337
337
|
"shx rm -rf dist/{projectRoot}/smithy",
|
|
338
338
|
"shx mkdir -p dist/{projectRoot}/build",
|
|
339
|
-
"npx -y mise@2026.10.
|
|
339
|
+
"npx -y mise@2026.10.19 exec smithy@1.74.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
|
|
340
340
|
"shx mkdir -p dist/{projectRoot}/build/openapi",
|
|
341
341
|
"shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
|
|
342
342
|
],
|
|
@@ -482,7 +482,7 @@ exports[`smithyProjectGenerator > should generate smithy project with subdirecto
|
|
|
482
482
|
"shx rm -rf dist/{projectRoot}/build",
|
|
483
483
|
"shx rm -rf dist/{projectRoot}/smithy",
|
|
484
484
|
"shx mkdir -p dist/{projectRoot}/build",
|
|
485
|
-
"npx -y mise@2026.10.
|
|
485
|
+
"npx -y mise@2026.10.19 exec smithy@1.74.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
|
|
486
486
|
"shx mkdir -p dist/{projectRoot}/build/openapi",
|
|
487
487
|
"shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
|
|
488
488
|
],
|
|
@@ -416,7 +416,7 @@ terraform {
|
|
|
416
416
|
required_providers {
|
|
417
417
|
aws = {
|
|
418
418
|
source = "hashicorp/aws"
|
|
419
|
-
version = "6.
|
|
419
|
+
version = "6.70.0"
|
|
420
420
|
}
|
|
421
421
|
random = {
|
|
422
422
|
source = "hashicorp/random"
|
|
@@ -732,7 +732,7 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with Terraform pro
|
|
|
732
732
|
}
|
|
733
733
|
aws = {
|
|
734
734
|
source = "hashicorp/aws"
|
|
735
|
-
version = "6.
|
|
735
|
+
version = "6.70.0"
|
|
736
736
|
}
|
|
737
737
|
random = {
|
|
738
738
|
source = "hashicorp/random"
|
|
@@ -2176,7 +2176,7 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with default optio
|
|
|
2176
2176
|
"shx rm -rf dist/{projectRoot}/build",
|
|
2177
2177
|
"shx rm -rf dist/{projectRoot}/smithy",
|
|
2178
2178
|
"shx mkdir -p dist/{projectRoot}/build",
|
|
2179
|
-
"npx -y mise@2026.10.
|
|
2179
|
+
"npx -y mise@2026.10.19 exec smithy@1.74.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
|
|
2180
2180
|
"shx mkdir -p dist/{projectRoot}/build/openapi",
|
|
2181
2181
|
"shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
|
|
2182
2182
|
],
|
|
@@ -2317,7 +2317,7 @@ terraform {
|
|
|
2317
2317
|
required_providers {
|
|
2318
2318
|
aws = {
|
|
2319
2319
|
source = "hashicorp/aws"
|
|
2320
|
-
version = "6.
|
|
2320
|
+
version = "6.70.0"
|
|
2321
2321
|
}
|
|
2322
2322
|
random = {
|
|
2323
2323
|
source = "hashicorp/random"
|
|
@@ -2630,7 +2630,7 @@ output "waf_web_acl_arn" {
|
|
|
2630
2630
|
}
|
|
2631
2631
|
aws = {
|
|
2632
2632
|
source = "hashicorp/aws"
|
|
2633
|
-
version = "6.
|
|
2633
|
+
version = "6.70.0"
|
|
2634
2634
|
}
|
|
2635
2635
|
random = {
|
|
2636
2636
|
source = "hashicorp/random"
|
|
@@ -3692,7 +3692,7 @@ terraform {
|
|
|
3692
3692
|
required_providers {
|
|
3693
3693
|
aws = {
|
|
3694
3694
|
source = "hashicorp/aws"
|
|
3695
|
-
version = "6.
|
|
3695
|
+
version = "6.70.0"
|
|
3696
3696
|
}
|
|
3697
3697
|
random = {
|
|
3698
3698
|
source = "hashicorp/random"
|
|
@@ -4005,7 +4005,7 @@ output "waf_web_acl_arn" {
|
|
|
4005
4005
|
}
|
|
4006
4006
|
aws = {
|
|
4007
4007
|
source = "hashicorp/aws"
|
|
4008
|
-
version = "6.
|
|
4008
|
+
version = "6.70.0"
|
|
4009
4009
|
}
|
|
4010
4010
|
random = {
|
|
4011
4011
|
source = "hashicorp/random"
|
|
@@ -5056,7 +5056,7 @@ exports[`tsSmithyApiGenerator > terraform iac > should generate terraform with c
|
|
|
5056
5056
|
}
|
|
5057
5057
|
aws = {
|
|
5058
5058
|
source = "hashicorp/aws"
|
|
5059
|
-
version = "6.
|
|
5059
|
+
version = "6.70.0"
|
|
5060
5060
|
}
|
|
5061
5061
|
random = {
|
|
5062
5062
|
source = "hashicorp/random"
|