@aws/agentcore 1.0.0-preview.3 → 1.0.0-preview.30

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.
Files changed (330) hide show
  1. package/README.md +193 -33
  2. package/dist/agent-inspector/index.css +1 -1
  3. package/dist/agent-inspector/index.js +99 -84
  4. package/dist/assets/README.md +6 -2
  5. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +3344 -366
  6. package/dist/assets/__tests__/__snapshots__/dockerfile-render.test.ts.snap +6 -2
  7. package/dist/assets/__tests__/assets.snapshot.test.ts +10 -24
  8. package/dist/assets/__tests__/googleadk-observability.test.ts +23 -0
  9. package/dist/assets/__tests__/googleadk-session-eviction.test.ts +87 -0
  10. package/dist/assets/__tests__/input-validation.test.ts +44 -0
  11. package/dist/assets/__tests__/summarization-namespace.test.ts +43 -0
  12. package/dist/assets/agents/AGENTS.md +91 -14
  13. package/dist/assets/cdk/bin/cdk.ts +109 -24
  14. package/dist/assets/cdk/lib/cdk-stack.ts +227 -19
  15. package/dist/assets/cdk/package.json +9 -9
  16. package/dist/assets/cdk/test/cdk.test.ts +4 -0
  17. package/dist/assets/container/python/Dockerfile +7 -1
  18. package/dist/assets/container/typescript/Dockerfile +25 -0
  19. package/dist/assets/container/typescript/dockerignore.template +24 -0
  20. package/dist/assets/datasets/predefined-v1.jsonl +3 -0
  21. package/dist/assets/datasets/simulated-v1.jsonl +3 -0
  22. package/dist/assets/evaluators/autoevals-lambda/execution-role-policy.json +15 -0
  23. package/dist/assets/evaluators/autoevals-lambda/lambda_function.py +37 -0
  24. package/dist/assets/evaluators/autoevals-lambda/pyproject.toml +22 -0
  25. package/dist/assets/evaluators/deepeval-lambda/execution-role-policy.json +15 -0
  26. package/dist/assets/evaluators/deepeval-lambda/lambda_function.py +29 -0
  27. package/dist/assets/evaluators/deepeval-lambda/pyproject.toml +19 -0
  28. package/dist/assets/mcp/python/pyproject.toml +1 -1
  29. package/dist/assets/python/a2a/googleadk/base/main.py +32 -18
  30. package/dist/assets/python/a2a/googleadk/base/pyproject.toml +6 -4
  31. package/dist/assets/python/a2a/langchain_langgraph/base/main.py +35 -21
  32. package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +4 -3
  33. package/dist/assets/python/a2a/strands/base/main.py +23 -17
  34. package/dist/assets/python/a2a/strands/base/pyproject.toml +3 -3
  35. package/dist/assets/python/a2a/strands/capabilities/memory/session.py +4 -1
  36. package/dist/assets/python/agui/googleadk/base/main.py +62 -2
  37. package/dist/assets/python/agui/googleadk/base/pyproject.toml +6 -5
  38. package/dist/assets/python/agui/langchain_langgraph/base/main.py +56 -0
  39. package/dist/assets/python/agui/langchain_langgraph/base/pyproject.toml +3 -2
  40. package/dist/assets/python/agui/strands/base/main.py +63 -1
  41. package/dist/assets/python/agui/strands/base/pyproject.toml +2 -2
  42. package/dist/assets/python/agui/strands/capabilities/memory/session.py +4 -1
  43. package/dist/assets/python/http/autogen/base/README.md +7 -1
  44. package/dist/assets/python/http/autogen/base/main.py +62 -29
  45. package/dist/assets/python/http/autogen/base/pyproject.toml +1 -1
  46. package/dist/assets/python/http/googleadk/base/README.md +7 -1
  47. package/dist/assets/python/http/googleadk/base/main.py +71 -24
  48. package/dist/assets/python/http/googleadk/base/mcp_client/client.py +7 -7
  49. package/dist/assets/python/http/googleadk/base/pyproject.toml +5 -3
  50. package/dist/assets/python/http/langchain_langgraph/base/README.md +7 -1
  51. package/dist/assets/python/http/langchain_langgraph/base/main.py +119 -24
  52. package/dist/assets/python/http/langchain_langgraph/base/mcp_client/client.py +10 -8
  53. package/dist/assets/python/http/langchain_langgraph/base/pyproject.toml +5 -4
  54. package/dist/assets/python/http/openaiagents/base/README.md +7 -1
  55. package/dist/assets/python/http/openaiagents/base/main.py +63 -32
  56. package/dist/assets/python/http/openaiagents/base/mcp_client/client.py +4 -4
  57. package/dist/assets/python/http/openaiagents/base/pyproject.toml +3 -3
  58. package/dist/assets/python/http/strands/base/README.md +8 -1
  59. package/dist/assets/python/http/strands/base/main.py +607 -47
  60. package/dist/assets/python/http/strands/base/mcp_client/client.py +49 -6
  61. package/dist/assets/python/http/strands/base/model/load.py +119 -3
  62. package/dist/assets/python/http/strands/base/model/mantle_compat.py +21 -0
  63. package/dist/assets/python/http/strands/base/pyproject.toml +11 -5
  64. package/dist/assets/python/http/strands/base/skills/fetcher.py +279 -0
  65. package/dist/assets/python/http/strands/capabilities/execution-limits/hooks/execution_limits.py +54 -0
  66. package/dist/assets/python/http/strands/capabilities/memory/session.py +4 -1
  67. package/dist/assets/python/http/strands/capabilities/payments/__init__.py +4 -0
  68. package/dist/assets/python/http/strands/capabilities/payments/payments.py +142 -0
  69. package/dist/assets/python/mcp/standalone/base/main.py +58 -0
  70. package/dist/assets/python/mcp/standalone/base/pyproject.toml +1 -1
  71. package/dist/assets/typescript/http/strands/base/README.md +42 -0
  72. package/dist/assets/typescript/http/strands/base/gitignore.template +22 -0
  73. package/dist/assets/typescript/http/strands/base/main.ts +149 -0
  74. package/dist/assets/typescript/http/strands/base/mcp_client/client.ts +11 -0
  75. package/dist/assets/typescript/http/strands/base/model/load.ts +102 -0
  76. package/dist/assets/typescript/http/strands/base/package.json +38 -0
  77. package/dist/assets/typescript/http/strands/base/tsconfig.json +19 -0
  78. package/dist/assets/typescript/http/strands/capabilities/memory/memory.ts +52 -0
  79. package/dist/assets/typescript/http/vercelai/base/README.md +42 -0
  80. package/dist/assets/typescript/http/vercelai/base/gitignore.template +22 -0
  81. package/dist/assets/typescript/http/vercelai/base/main.ts +70 -0
  82. package/dist/assets/typescript/http/vercelai/base/model/load.ts +121 -0
  83. package/dist/assets/typescript/http/vercelai/base/package.json +35 -0
  84. package/dist/assets/typescript/http/vercelai/base/tsconfig.json +19 -0
  85. package/dist/cli/index.mjs +1743 -627
  86. package/dist/lib/constants.d.ts +8 -4
  87. package/dist/lib/constants.d.ts.map +1 -1
  88. package/dist/lib/constants.js +13 -7
  89. package/dist/lib/constants.js.map +1 -1
  90. package/dist/lib/dependency-management/index.d.ts +5 -0
  91. package/dist/lib/dependency-management/index.d.ts.map +1 -0
  92. package/dist/lib/dependency-management/index.js +8 -0
  93. package/dist/lib/dependency-management/index.js.map +1 -0
  94. package/dist/lib/dependency-management/messages.d.ts +30 -0
  95. package/dist/lib/dependency-management/messages.d.ts.map +1 -0
  96. package/dist/lib/dependency-management/messages.js +86 -0
  97. package/dist/lib/dependency-management/messages.js.map +1 -0
  98. package/dist/lib/dependency-management/plan.d.ts +25 -0
  99. package/dist/lib/dependency-management/plan.d.ts.map +1 -0
  100. package/dist/lib/dependency-management/plan.js +67 -0
  101. package/dist/lib/dependency-management/plan.js.map +1 -0
  102. package/dist/lib/dependency-management/semver.d.ts +21 -0
  103. package/dist/lib/dependency-management/semver.d.ts.map +1 -0
  104. package/dist/lib/dependency-management/semver.js +51 -0
  105. package/dist/lib/dependency-management/semver.js.map +1 -0
  106. package/dist/lib/dependency-management/sync.d.ts +26 -0
  107. package/dist/lib/dependency-management/sync.d.ts.map +1 -0
  108. package/dist/lib/dependency-management/sync.js +141 -0
  109. package/dist/lib/dependency-management/sync.js.map +1 -0
  110. package/dist/lib/dependency-management/types.d.ts +85 -0
  111. package/dist/lib/dependency-management/types.d.ts.map +1 -0
  112. package/dist/lib/dependency-management/types.js +3 -0
  113. package/dist/lib/dependency-management/types.js.map +1 -0
  114. package/dist/lib/errors/index.d.ts +1 -1
  115. package/dist/lib/errors/index.d.ts.map +1 -1
  116. package/dist/lib/errors/index.js +1 -1
  117. package/dist/lib/errors/index.js.map +1 -1
  118. package/dist/lib/errors/types.d.ts +274 -0
  119. package/dist/lib/errors/types.d.ts.map +1 -0
  120. package/dist/lib/errors/types.js +423 -0
  121. package/dist/lib/errors/types.js.map +1 -0
  122. package/dist/lib/errors/zod.d.ts +8 -0
  123. package/dist/lib/errors/zod.d.ts.map +1 -0
  124. package/dist/lib/errors/{config.js → zod.js} +8 -81
  125. package/dist/lib/errors/zod.js.map +1 -0
  126. package/dist/lib/index.d.ts +3 -0
  127. package/dist/lib/index.d.ts.map +1 -1
  128. package/dist/lib/index.js +4 -1
  129. package/dist/lib/index.js.map +1 -1
  130. package/dist/lib/packaging/build-args.d.ts +6 -0
  131. package/dist/lib/packaging/build-args.d.ts.map +1 -1
  132. package/dist/lib/packaging/build-args.js +11 -2
  133. package/dist/lib/packaging/build-args.js.map +1 -1
  134. package/dist/lib/packaging/build-context-dockerignore.d.ts +23 -0
  135. package/dist/lib/packaging/build-context-dockerignore.d.ts.map +1 -0
  136. package/dist/lib/packaging/build-context-dockerignore.js +63 -0
  137. package/dist/lib/packaging/build-context-dockerignore.js.map +1 -0
  138. package/dist/lib/packaging/build-context.d.ts +21 -0
  139. package/dist/lib/packaging/build-context.d.ts.map +1 -0
  140. package/dist/lib/packaging/build-context.js +21 -0
  141. package/dist/lib/packaging/build-context.js.map +1 -0
  142. package/dist/lib/packaging/container.d.ts.map +1 -1
  143. package/dist/lib/packaging/container.js +20 -9
  144. package/dist/lib/packaging/container.js.map +1 -1
  145. package/dist/lib/packaging/helpers.d.ts +16 -0
  146. package/dist/lib/packaging/helpers.d.ts.map +1 -1
  147. package/dist/lib/packaging/helpers.js +127 -29
  148. package/dist/lib/packaging/helpers.js.map +1 -1
  149. package/dist/lib/packaging/index.d.ts +2 -1
  150. package/dist/lib/packaging/index.d.ts.map +1 -1
  151. package/dist/lib/packaging/index.js +9 -20
  152. package/dist/lib/packaging/index.js.map +1 -1
  153. package/dist/lib/packaging/node.d.ts +2 -2
  154. package/dist/lib/packaging/node.d.ts.map +1 -1
  155. package/dist/lib/packaging/node.js +83 -38
  156. package/dist/lib/packaging/node.js.map +1 -1
  157. package/dist/lib/packaging/python.js +12 -12
  158. package/dist/lib/packaging/python.js.map +1 -1
  159. package/dist/lib/result.d.ts +57 -0
  160. package/dist/lib/result.d.ts.map +1 -0
  161. package/dist/lib/result.js +62 -0
  162. package/dist/lib/result.js.map +1 -0
  163. package/dist/lib/schemas/io/config-io.d.ts +14 -0
  164. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  165. package/dist/lib/schemas/io/config-io.js +89 -5
  166. package/dist/lib/schemas/io/config-io.js.map +1 -1
  167. package/dist/lib/schemas/io/global-config.d.ts +41 -0
  168. package/dist/lib/schemas/io/global-config.d.ts.map +1 -0
  169. package/dist/lib/schemas/io/global-config.js +119 -0
  170. package/dist/lib/schemas/io/global-config.js.map +1 -0
  171. package/dist/lib/schemas/io/index.d.ts +1 -2
  172. package/dist/lib/schemas/io/index.d.ts.map +1 -1
  173. package/dist/lib/schemas/io/index.js +1 -4
  174. package/dist/lib/schemas/io/index.js.map +1 -1
  175. package/dist/lib/schemas/io/path-resolver.d.ts +0 -6
  176. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -1
  177. package/dist/lib/schemas/io/path-resolver.js +3 -13
  178. package/dist/lib/schemas/io/path-resolver.js.map +1 -1
  179. package/dist/lib/secrets/cipher.d.ts +12 -0
  180. package/dist/lib/secrets/cipher.d.ts.map +1 -0
  181. package/dist/lib/secrets/cipher.js +54 -0
  182. package/dist/lib/secrets/cipher.js.map +1 -0
  183. package/dist/lib/secrets/index.d.ts +4 -0
  184. package/dist/lib/secrets/index.d.ts.map +1 -0
  185. package/dist/lib/secrets/index.js +15 -0
  186. package/dist/lib/secrets/index.js.map +1 -0
  187. package/dist/lib/secrets/key-provider.d.ts +16 -0
  188. package/dist/lib/secrets/key-provider.d.ts.map +1 -0
  189. package/dist/lib/secrets/key-provider.js +191 -0
  190. package/dist/lib/secrets/key-provider.js.map +1 -0
  191. package/dist/lib/secrets/sensitive-keys.d.ts +21 -0
  192. package/dist/lib/secrets/sensitive-keys.d.ts.map +1 -0
  193. package/dist/lib/secrets/sensitive-keys.js +67 -0
  194. package/dist/lib/secrets/sensitive-keys.js.map +1 -0
  195. package/dist/lib/time-constants.d.ts +5 -0
  196. package/dist/lib/time-constants.d.ts.map +1 -0
  197. package/dist/lib/time-constants.js +8 -0
  198. package/dist/lib/time-constants.js.map +1 -0
  199. package/dist/lib/utils/env.d.ts +8 -2
  200. package/dist/lib/utils/env.d.ts.map +1 -1
  201. package/dist/lib/utils/env.js +65 -17
  202. package/dist/lib/utils/env.js.map +1 -1
  203. package/dist/lib/utils/index.d.ts +3 -2
  204. package/dist/lib/utils/index.d.ts.map +1 -1
  205. package/dist/lib/utils/index.js +6 -1
  206. package/dist/lib/utils/index.js.map +1 -1
  207. package/dist/lib/utils/polling.d.ts +31 -0
  208. package/dist/lib/utils/polling.d.ts.map +1 -0
  209. package/dist/lib/utils/polling.js +61 -0
  210. package/dist/lib/utils/polling.js.map +1 -0
  211. package/dist/lib/utils/subprocess.d.ts +4 -1
  212. package/dist/lib/utils/subprocess.d.ts.map +1 -1
  213. package/dist/lib/utils/subprocess.js +11 -57
  214. package/dist/lib/utils/subprocess.js.map +1 -1
  215. package/dist/lib/utils/zod.d.ts +16 -0
  216. package/dist/lib/utils/zod.d.ts.map +1 -1
  217. package/dist/lib/utils/zod.js +45 -0
  218. package/dist/lib/utils/zod.js.map +1 -1
  219. package/dist/schema/constants.d.ts +56 -2
  220. package/dist/schema/constants.d.ts.map +1 -1
  221. package/dist/schema/constants.js +82 -7
  222. package/dist/schema/constants.js.map +1 -1
  223. package/dist/schema/schemas/agent-env.d.ts +187 -7
  224. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  225. package/dist/schema/schemas/agent-env.js +323 -27
  226. package/dist/schema/schemas/agent-env.js.map +1 -1
  227. package/dist/schema/schemas/agentcore-project.d.ts +519 -12
  228. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  229. package/dist/schema/schemas/agentcore-project.js +342 -13
  230. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  231. package/dist/schema/schemas/auth.d.ts +174 -0
  232. package/dist/schema/schemas/auth.d.ts.map +1 -1
  233. package/dist/schema/schemas/auth.js +127 -3
  234. package/dist/schema/schemas/auth.js.map +1 -1
  235. package/dist/schema/schemas/aws-targets.d.ts +18 -0
  236. package/dist/schema/schemas/aws-targets.d.ts.map +1 -1
  237. package/dist/schema/schemas/aws-targets.js +6 -0
  238. package/dist/schema/schemas/aws-targets.js.map +1 -1
  239. package/dist/schema/schemas/connections.d.ts +185 -0
  240. package/dist/schema/schemas/connections.d.ts.map +1 -0
  241. package/dist/schema/schemas/connections.js +176 -0
  242. package/dist/schema/schemas/connections.js.map +1 -0
  243. package/dist/schema/schemas/deployed-state.d.ts +392 -5
  244. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  245. package/dist/schema/schemas/deployed-state.js +112 -2
  246. package/dist/schema/schemas/deployed-state.js.map +1 -1
  247. package/dist/schema/schemas/index.d.ts +3 -0
  248. package/dist/schema/schemas/index.d.ts.map +1 -1
  249. package/dist/schema/schemas/index.js +5 -0
  250. package/dist/schema/schemas/index.js.map +1 -1
  251. package/dist/schema/schemas/mcp-defs.d.ts +2 -1
  252. package/dist/schema/schemas/mcp-defs.d.ts.map +1 -1
  253. package/dist/schema/schemas/mcp-defs.js +3 -2
  254. package/dist/schema/schemas/mcp-defs.js.map +1 -1
  255. package/dist/schema/schemas/mcp.d.ts +197 -0
  256. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  257. package/dist/schema/schemas/mcp.js +334 -5
  258. package/dist/schema/schemas/mcp.js.map +1 -1
  259. package/dist/schema/schemas/primitives/ab-test.d.ts +135 -0
  260. package/dist/schema/schemas/primitives/ab-test.d.ts.map +1 -0
  261. package/dist/schema/schemas/primitives/ab-test.js +95 -0
  262. package/dist/schema/schemas/primitives/ab-test.js.map +1 -0
  263. package/dist/schema/schemas/primitives/capacity-provider.d.ts +237 -0
  264. package/dist/schema/schemas/primitives/capacity-provider.d.ts.map +1 -0
  265. package/dist/schema/schemas/primitives/capacity-provider.js +220 -0
  266. package/dist/schema/schemas/primitives/capacity-provider.js.map +1 -0
  267. package/dist/schema/schemas/primitives/config-bundle.d.ts +32 -0
  268. package/dist/schema/schemas/primitives/config-bundle.d.ts.map +1 -0
  269. package/dist/schema/schemas/primitives/config-bundle.js +41 -0
  270. package/dist/schema/schemas/primitives/config-bundle.js.map +1 -0
  271. package/dist/schema/schemas/primitives/dataset.d.ts +48 -0
  272. package/dist/schema/schemas/primitives/dataset.d.ts.map +1 -0
  273. package/dist/schema/schemas/primitives/dataset.js +58 -0
  274. package/dist/schema/schemas/primitives/dataset.js.map +1 -0
  275. package/dist/schema/schemas/primitives/evaluator.d.ts +22 -0
  276. package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -1
  277. package/dist/schema/schemas/primitives/evaluator.js +28 -3
  278. package/dist/schema/schemas/primitives/evaluator.js.map +1 -1
  279. package/dist/schema/schemas/primitives/harness.d.ts +377 -19
  280. package/dist/schema/schemas/primitives/harness.d.ts.map +1 -1
  281. package/dist/schema/schemas/primitives/harness.js +379 -24
  282. package/dist/schema/schemas/primitives/harness.js.map +1 -1
  283. package/dist/schema/schemas/primitives/index.d.ts +17 -9
  284. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  285. package/dist/schema/schemas/primitives/index.js +62 -1
  286. package/dist/schema/schemas/primitives/index.js.map +1 -1
  287. package/dist/schema/schemas/primitives/knowledge-base.d.ts +104 -0
  288. package/dist/schema/schemas/primitives/knowledge-base.d.ts.map +1 -0
  289. package/dist/schema/schemas/primitives/knowledge-base.js +99 -0
  290. package/dist/schema/schemas/primitives/knowledge-base.js.map +1 -0
  291. package/dist/schema/schemas/primitives/memory.d.ts +22 -4
  292. package/dist/schema/schemas/primitives/memory.d.ts.map +1 -1
  293. package/dist/schema/schemas/primitives/memory.js +57 -16
  294. package/dist/schema/schemas/primitives/memory.js.map +1 -1
  295. package/dist/schema/schemas/primitives/online-eval-config.d.ts +21 -2
  296. package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
  297. package/dist/schema/schemas/primitives/online-eval-config.js +45 -5
  298. package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
  299. package/dist/schema/schemas/primitives/payment.d.ts +86 -0
  300. package/dist/schema/schemas/primitives/payment.d.ts.map +1 -0
  301. package/dist/schema/schemas/primitives/payment.js +88 -0
  302. package/dist/schema/schemas/primitives/payment.js.map +1 -0
  303. package/dist/schema/schemas/primitives/policy.d.ts +26 -0
  304. package/dist/schema/schemas/primitives/policy.d.ts.map +1 -1
  305. package/dist/schema/schemas/primitives/policy.js +5 -1
  306. package/dist/schema/schemas/primitives/policy.js.map +1 -1
  307. package/npm-shrinkwrap.json +16874 -0
  308. package/package.json +49 -21
  309. package/scripts/bump-version.ts +4 -4
  310. package/scripts/bundle.mjs +70 -41
  311. package/scripts/extract-cli-model.mjs +269 -0
  312. package/scripts/extract-cli-model.test.mjs +43 -0
  313. package/scripts/render_adoc.py +350 -0
  314. package/scripts/run-e2e-dev.sh +56 -0
  315. package/scripts/run-e2e-local.sh +145 -0
  316. package/scripts/safe-junit-reporter.ts +7 -0
  317. package/scripts/sanitize-test-artifacts.ts +65 -0
  318. package/scripts/sync-vended-cdk.ts +49 -0
  319. package/scripts/test_render_adoc.py +38 -0
  320. package/dist/lib/errors/config.d.ts +0 -49
  321. package/dist/lib/errors/config.d.ts.map +0 -1
  322. package/dist/lib/errors/config.js.map +0 -1
  323. package/dist/lib/packaging/errors.d.ts +0 -16
  324. package/dist/lib/packaging/errors.d.ts.map +0 -1
  325. package/dist/lib/packaging/errors.js +0 -36
  326. package/dist/lib/packaging/errors.js.map +0 -1
  327. package/dist/lib/schemas/io/cli-config.d.ts +0 -12
  328. package/dist/lib/schemas/io/cli-config.d.ts.map +0 -1
  329. package/dist/lib/schemas/io/cli-config.js +0 -35
  330. package/dist/lib/schemas/io/cli-config.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/agentcore",
3
- "version": "1.0.0-preview.3",
3
+ "version": "1.0.0-preview.30",
4
4
  "description": "CLI for Amazon Bedrock AgentCore",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -41,6 +41,7 @@
41
41
  "files": [
42
42
  "dist",
43
43
  "scripts",
44
+ "npm-shrinkwrap.json",
44
45
  "!dist/mcp-harness"
45
46
  ],
46
47
  "scripts": {
@@ -52,51 +53,60 @@
52
53
  "build:assets": "node scripts/copy-assets.mjs",
53
54
  "build:harness": "BUILD_HARNESS=1 node esbuild.config.mjs",
54
55
  "cli": "npx tsx src/cli/index.ts",
55
- "typecheck": "tsc --noEmit",
56
- "lint": "eslint src/",
57
- "lint:fix": "eslint src/ --fix",
58
- "format": "prettier --write .",
59
- "format:check": "prettier --check .",
56
+ "typecheck": "tsc --noEmit --incremental",
57
+ "lint": "eslint --cache src/",
58
+ "lint:fix": "eslint --cache src/ --fix",
59
+ "format": "prettier --cache --write .",
60
+ "format:check": "prettier --cache --check .",
60
61
  "secrets:check": "secretlint '**/*'",
61
62
  "security:audit": "npm audit --audit-level=high --omit=dev",
62
63
  "clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
63
64
  "prepare": "husky",
64
65
  "test": "vitest run --project unit",
65
66
  "test:all": "vitest run",
67
+ "test:docs": "node --test scripts/*.test.mjs && python3 -m unittest scripts/test_render_adoc.py",
66
68
  "test:watch": "vitest --project unit",
67
- "test:integ": "vitest run --project integ",
69
+ "test:integ": "npm run build && vitest run --project integ",
68
70
  "test:unit": "vitest run --project unit --coverage",
69
71
  "test:e2e": "vitest run --project e2e",
72
+ "test-artifacts:sanitize": "tsx scripts/sanitize-test-artifacts.ts --redact",
73
+ "test-artifacts:check": "tsx scripts/sanitize-test-artifacts.ts --check",
70
74
  "test:update-snapshots": "vitest run --project unit --update",
71
75
  "test:tui": "npm run build:harness && vitest run --project tui",
72
76
  "test:browser": "npx playwright test --config browser-tests/playwright.config.ts",
73
77
  "bundle": "node scripts/bundle.mjs"
74
78
  },
75
79
  "dependencies": {
76
- "@aws-cdk/toolkit-lib": "^1.16.0",
80
+ "@aws-cdk/cdk-assets-lib": "^1.4.10",
81
+ "@aws-cdk/toolkit-lib": "^1.28.0",
77
82
  "@aws-sdk/client-application-signals": "^3.1003.0",
78
83
  "@aws-sdk/client-bedrock": "^3.1012.0",
79
84
  "@aws-sdk/client-bedrock-agent": "^3.1012.0",
80
- "@aws-sdk/client-bedrock-agentcore": "^3.1020.0",
81
- "@aws-sdk/client-bedrock-agentcore-control": "^3.1020.0",
85
+ "@aws-sdk/client-bedrock-agentcore": "^3.1114.0",
86
+ "@aws-sdk/client-bedrock-agentcore-control": "^3.1099.0",
82
87
  "@aws-sdk/client-bedrock-runtime": "^3.893.0",
83
88
  "@aws-sdk/client-cloudformation": "^3.893.0",
84
89
  "@aws-sdk/client-cloudwatch-logs": "^3.893.0",
90
+ "@aws-sdk/client-efs": "^3.1067.0",
85
91
  "@aws-sdk/client-resource-groups-tagging-api": "^3.893.0",
86
92
  "@aws-sdk/client-s3": "^3.1012.0",
93
+ "@aws-sdk/client-s3files": "^3.1067.0",
87
94
  "@aws-sdk/client-sts": "^3.893.0",
88
95
  "@aws-sdk/client-xray": "^3.1003.0",
89
96
  "@aws-sdk/credential-providers": "^3.893.0",
90
- "@aws/agent-inspector": "0.2.1",
97
+ "@aws-sdk/region-config-resolver": "^3.972.13",
98
+ "@aws/agent-inspector": "0.6.1",
91
99
  "@commander-js/extra-typings": "^14.0.0",
92
100
  "@opentelemetry/api": "^1.9.1",
93
- "@opentelemetry/exporter-metrics-otlp-http": "^0.214.0",
94
- "@opentelemetry/otlp-transformer": "^0.213.0",
101
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.215.0",
102
+ "@opentelemetry/otlp-transformer": "0.213.0",
95
103
  "@opentelemetry/resources": "^2.6.1",
96
104
  "@opentelemetry/sdk-metrics": "^2.6.1",
97
105
  "@smithy/shared-ini-file-loader": "^4.4.2",
98
106
  "commander": "^14.0.2",
107
+ "cross-spawn": "^7.0.6",
99
108
  "dotenv": "^17.2.3",
109
+ "fast-json-stable-stringify": "^2.1.0",
100
110
  "fflate": "^0.8.2",
101
111
  "handlebars": "^4.7.8",
102
112
  "ink": "^6.6.0",
@@ -104,11 +114,16 @@
104
114
  "ink-spinner": "^5.0.0",
105
115
  "js-yaml": "^4.1.1",
106
116
  "react": "^19.2.3",
117
+ "semver": "^7.8.5",
118
+ "ws": "^8.21.0",
107
119
  "yaml": "^2.8.3",
108
120
  "zod": "^4.3.5"
109
121
  },
122
+ "optionalDependencies": {
123
+ "@napi-rs/keyring": "^1.3.0"
124
+ },
110
125
  "peerDependencies": {
111
- "aws-cdk-lib": "^2.248.0",
126
+ "aws-cdk-lib": "^2.258.0",
112
127
  "constructs": "^10.0.0"
113
128
  },
114
129
  "devDependencies": {
@@ -118,14 +133,17 @@
118
133
  "@playwright/test": "^1.59.1",
119
134
  "@secretlint/secretlint-rule-preset-recommend": "^12.2.0",
120
135
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
136
+ "@types/cross-spawn": "^6.0.6",
121
137
  "@types/js-yaml": "^4.0.9",
122
138
  "@types/node": "^25.0.3",
123
139
  "@types/react": "^19.2.7",
140
+ "@types/semver": "^7.7.1",
141
+ "@types/ws": "^8.18.1",
124
142
  "@typescript-eslint/eslint-plugin": "^8.50.0",
125
143
  "@typescript-eslint/parser": "^8.50.0",
126
144
  "@vitest/coverage-v8": "^4.0.18",
127
145
  "@xterm/headless": "^6.0.0",
128
- "aws-cdk-lib": "^2.248.0",
146
+ "aws-cdk-lib": "^2.258.0",
129
147
  "constructs": "^10.4.4",
130
148
  "esbuild": "^0.28.0",
131
149
  "eslint": "^9.39.4",
@@ -138,10 +156,12 @@
138
156
  "eslint-plugin-security": "^4.0.0",
139
157
  "husky": "^9.1.7",
140
158
  "ink-testing-library": "^4.0.0",
159
+ "jose": "^6.2.3",
141
160
  "lint-staged": "^16.2.7",
142
161
  "node-pty": "^1.1.0",
143
162
  "prettier": "^3.7.4",
144
163
  "secretlint": "^12.2.0",
164
+ "strip-ansi": "^7.2.0",
145
165
  "tsx": "^4.21.0",
146
166
  "typescript": "^5",
147
167
  "typescript-eslint": "^8.50.1",
@@ -149,23 +169,31 @@
149
169
  },
150
170
  "overridesComments": {
151
171
  "minimatch": "GHSA-7r86-cg39-jmmj, GHSA-23c5-xmqv-rm74: minimatch 10.0.0-10.2.2 has ReDoS vulnerabilities. Multiple transitive deps (eslint, typescript-eslint, eslint-plugin-import, eslint-plugin-react, prettier-plugin-sort-imports, aws-cdk-lib) pin older versions. Remove this override once upstream packages update their minimatch dependency to >=10.2.3.",
152
- "fast-xml-parser": "GHSA-8gc5-j5rx-235r, GHSA-jp2q-39xq-3w4g: fast-xml-parser <=5.5.6 has entity expansion bypass (CVE-2026-33036, CVE-2026-33349). Transitive via @aws-sdk/xml-builder. Remove once @aws-sdk updates to fast-xml-parser >=5.5.7.",
153
- "@aws-sdk/xml-builder": "aws/aws-sdk-js-v3#7867: @aws-sdk/xml-builder <3.972.14 does not configure maxTotalExpansions on fast-xml-parser, causing 'Entity expansion limit exceeded' on large CloudFormation responses. Remove once @aws-sdk/client-* deps are bumped past 3.972.14."
172
+ "glob": "glob <12 is deprecated and emits npm install warnings (https://github.com/isaacs/node-glob). Pulled in transitively via archiver-utils@5.0.2 (latest), which still pins glob@^10.0.0. archiver-utils only uses glob.sync(pattern, options), which remains compatible in glob@13. Remove this override once archiver-utils updates its glob dependency.",
173
+ "fast-xml-parser": "GHSA-8gc5-j5rx-235r, GHSA-jp2q-39xq-3w4g, GHSA-gh4j-gqv2-49f6: fast-xml-parser <=5.6.x has entity expansion bypass and XML injection vulnerabilities. Transitive via @aws-sdk/xml-builder. Remove once @aws-sdk updates to fast-xml-parser >=5.7.0.",
174
+ "@aws-sdk/xml-builder": "aws/aws-sdk-js-v3#7867: @aws-sdk/xml-builder <3.972.14 does not configure maxTotalExpansions on fast-xml-parser, causing 'Entity expansion limit exceeded' on large CloudFormation responses. Remove once @aws-sdk/client-* deps are bumped past 3.972.14.",
175
+ "@opentelemetry/core": "GHSA-8988-4f7v-96qf: @opentelemetry/core <2.8.0 has unbounded memory allocation in W3C Baggage propagation. Transitive via @opentelemetry/otlp-transformer. Remove once @opentelemetry/otlp-transformer is upgraded past 0.219.0.",
176
+ "@opentelemetry/otlp-transformer": "Pinned to 0.213.0 — the last version that ships generated protobuf types for trace, logs, and metrics (used by the dev-mode OTLP collector). Versions 0.214–0.217 drop logs/trace protos; 0.218+ removes the generated root entirely. Remove this pin once the collector is refactored to not depend on the internal generated/root path.",
177
+ "protobufjs": "Multiple high-severity CVEs in protobufjs <8.7.0 (code injection, DoS, prototype pollution). Transitive via @opentelemetry/otlp-transformer@0.213.0. Remove once @opentelemetry/otlp-transformer is upgraded past 0.217.0."
154
178
  },
155
179
  "overrides": {
156
180
  "minimatch": "10.2.4",
157
- "fast-xml-parser": "5.5.7",
158
- "@aws-sdk/xml-builder": "3.972.15"
181
+ "glob": "^13.0.0",
182
+ "fast-xml-parser": "5.10.1",
183
+ "@aws-sdk/xml-builder": "3.972.15",
184
+ "@opentelemetry/core": ">=2.8.0",
185
+ "protobufjs": ">=8.7.0",
186
+ "fast-uri": "^3.1.5"
159
187
  },
160
188
  "engines": {
161
189
  "node": ">=20"
162
190
  },
163
191
  "lint-staged": {
164
192
  "*.{ts,tsx}": [
165
- "eslint --max-warnings=10"
193
+ "eslint --cache --max-warnings=10"
166
194
  ],
167
195
  "*.{ts,tsx,js,jsx,json,md,css,html,yml,yaml}": [
168
- "prettier --check"
196
+ "prettier --cache --check"
169
197
  ],
170
198
  "*": [
171
199
  "secretlint"
@@ -183,7 +183,7 @@ function getGitLog(sinceTag?: string): string {
183
183
  } else {
184
184
  // Try to get the last tag
185
185
  try {
186
- const lastTag = execSync('git describe --tags --abbrev=0', { encoding: 'utf-8' }).trim();
186
+ const lastTag = execSync("git describe --tags --abbrev=0 --match 'v*'", { encoding: 'utf-8' }).trim();
187
187
  cmd += ` ${lastTag}..HEAD`;
188
188
  } catch {
189
189
  // No tags exist, get last 20 commits
@@ -218,11 +218,11 @@ function categorizeCommits(gitLog: string): CategorizedChanges {
218
218
 
219
219
  const msg = trimmed.slice(2).trim();
220
220
 
221
- if (msg.startsWith('feat:') || msg.startsWith('feature:')) {
221
+ if (/^(feat|feature)(\(.*?\))?:/.test(msg)) {
222
222
  result.features.push(msg);
223
- } else if (msg.startsWith('fix:') || msg.startsWith('bugfix:')) {
223
+ } else if (/^(fix|bugfix)(\(.*?\))?:/.test(msg)) {
224
224
  result.fixes.push(msg);
225
- } else if (msg.startsWith('docs:') || msg.startsWith('doc:')) {
225
+ } else if (/^docs?(\(.*?\))?:/.test(msg)) {
226
226
  result.docs.push(msg);
227
227
  } else {
228
228
  result.other.push(msg);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * bundle.mjs — Single command to build CLI + CDK constructs + frontend into one tarball.
2
+ * bundle.mjs — Single command to build CLI + CDK constructs into one tarball.
3
3
  *
4
4
  * This is a testing-only workflow. It does NOT modify the default build or
5
5
  * deployment flow. The normal `npm run build` + `npm pack` pipeline is unchanged.
@@ -9,16 +9,19 @@
9
9
  * At `agentcore create` time, CDKRenderer detects this tarball and installs it
10
10
  * after the normal `npm install`, overriding the registry version.
11
11
  *
12
- * It also builds the @aws/agent-inspector frontend and copies its dist-assets
13
- * into the CLI's dist/agent-inspector/ directory, overriding the npm registry version.
14
- *
15
12
  * Usage:
16
13
  * node scripts/bundle.mjs
17
14
  * npm run bundle
18
15
  *
19
16
  * Environment variables:
20
- * AGENTCORE_CDK_PATH — absolute path to the agentcore-l3-cdk-constructs repo
21
- * AGENT_INSPECTOR_PATH — absolute path to the agent-inspector repo
17
+ * AGENTCORE_CDK_PATH — path to the agentcore-l3-cdk-constructs repo.
18
+ * Falls back to ../agentcore-l3-cdk-constructs, then clones from GitHub.
19
+ * AGENTCORE_INSPECTOR_PATH — path to the agent-inspector repo.
20
+ * Falls back to ../agent-inspector. If found, builds and bundles
21
+ * the local version instead of the npm-installed one.
22
+ * AGENTCORE_TARBALL_OUTPUT — output path (without .tgz) for the tarball. Relative to cwd.
23
+ * AGENTCORE_TARBALL_VERSION_SUFFIX — version prerelease suffix (e.g. "abc12-def34").
24
+ * Defaults to a timestamp if not set.
22
25
  */
23
26
  import { execFileSync } from 'node:child_process';
24
27
  import * as fs from 'node:fs';
@@ -80,18 +83,19 @@ function resolveCdkPath() {
80
83
  }
81
84
 
82
85
  /**
83
- * Resolve the agent-inspector repo path. Priority:
84
- * 1. AGENT_INSPECTOR_PATH env var
86
+ * Resolve a local agent-inspector repo path. Priority:
87
+ * 1. AGENTCORE_INSPECTOR_PATH env var
85
88
  * 2. Sibling directory ../agent-inspector
89
+ * 3. null (use npm-installed version)
86
90
  */
87
91
  function resolveInspectorPath() {
88
- if (process.env.AGENT_INSPECTOR_PATH) {
89
- const p = path.resolve(process.env.AGENT_INSPECTOR_PATH);
92
+ if (process.env.AGENTCORE_INSPECTOR_PATH) {
93
+ const p = path.resolve(process.env.AGENTCORE_INSPECTOR_PATH);
90
94
  if (fs.existsSync(path.join(p, 'package.json'))) {
91
- log(`Using agent-inspector from AGENT_INSPECTOR_PATH: ${p}`);
95
+ log(`Using agent-inspector from AGENTCORE_INSPECTOR_PATH: ${p}`);
92
96
  return p;
93
97
  }
94
- console.warn(` WARNING: AGENT_INSPECTOR_PATH=${p} does not contain package.json, ignoring.`);
98
+ console.warn(` WARNING: AGENTCORE_INSPECTOR_PATH=${p} does not contain package.json, ignoring.`);
95
99
  }
96
100
 
97
101
  const sibling = path.resolve(cliRoot, '..', 'agent-inspector');
@@ -109,8 +113,14 @@ function resolveInspectorPath() {
109
113
 
110
114
  log('Starting bundle process...');
111
115
 
112
- const timestamp = Math.floor(Date.now() / 1000);
113
- log(`Bundle timestamp: ${timestamp}`);
116
+ const now = new Date();
117
+ const timestamp = now.toISOString().replace(/[-:T]/g, '').slice(0, 14);
118
+ const versionSuffix = process.env.AGENTCORE_TARBALL_VERSION_SUFFIX || timestamp;
119
+ if (!/^[\w.-]+$/.test(versionSuffix)) {
120
+ console.error(`ERROR: Invalid version suffix: ${versionSuffix}`);
121
+ process.exit(1);
122
+ }
123
+ log(`Bundle version suffix: ${versionSuffix}`);
114
124
 
115
125
  // Helper to bump a package version with a unique e2e timestamp tag.
116
126
  // Saves the original version so it can be restored after packing.
@@ -119,7 +129,9 @@ function bumpVersion(pkgDir) {
119
129
  const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
120
130
  const originalVersion = pkg.version;
121
131
  const baseVersion = originalVersion.split('-')[0];
122
- pkg.version = `${baseVersion}-${timestamp}`;
132
+ const prerelease = originalVersion.includes('-') ? originalVersion.split('-').slice(1).join('-') : '';
133
+ const tag = prerelease ? `${prerelease}-${versionSuffix}` : versionSuffix;
134
+ pkg.version = `${baseVersion}-${tag}`;
123
135
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + '\n');
124
136
  log(`Bumped ${pkg.name} version: ${originalVersion} -> ${pkg.version}`);
125
137
  return { pkgJsonPath, originalVersion, bumpedVersion: pkg.version };
@@ -131,6 +143,17 @@ function restoreVersion({ pkgJsonPath, originalVersion }) {
131
143
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + '\n');
132
144
  }
133
145
 
146
+ /**
147
+ * If AGENTCORE_TARBALL_OUTPUT is set, return a resolved path using it as base.
148
+ * Always appends .tgz.
149
+ */
150
+ function resolveTarballPath(tarballPath) {
151
+ const envPath = process.env.AGENTCORE_TARBALL_OUTPUT;
152
+ if (!envPath) return tarballPath;
153
+ const base = envPath.replace(/\.tgz$/, '');
154
+ return path.resolve(`${base}.tgz`);
155
+ }
156
+
134
157
  // Step 1: Resolve and build CDK constructs
135
158
  const cdkPath = resolveCdkPath();
136
159
 
@@ -164,12 +187,7 @@ run('npm', ['install'], { cwd: cliRoot });
164
187
  log('Building CLI...');
165
188
  run('npm', ['run', 'build'], { cwd: cliRoot });
166
189
 
167
- // Step 4: Copy CDK tarball into dist/assets/ so CDKRenderer can detect it
168
- const bundledTarballDest = path.join(cliRoot, 'dist', 'assets', 'bundled-agentcore-cdk.tgz');
169
- fs.copyFileSync(cdkTarballSrc, bundledTarballDest);
170
- log(`Placed CDK tarball at ${bundledTarballDest}`);
171
-
172
- // Step 5: Build and bundle agent-inspector frontend (overrides the npm version)
190
+ // Step 3.5: If local agent-inspector is available, build and overwrite dist/agent-inspector/
173
191
  const inspectorPath = resolveInspectorPath();
174
192
  if (inspectorPath) {
175
193
  log('Installing agent-inspector dependencies...');
@@ -178,24 +196,26 @@ if (inspectorPath) {
178
196
  log('Building agent-inspector...');
179
197
  run('npm', ['run', 'build'], { cwd: inspectorPath });
180
198
 
181
- const inspectorDistSrc = path.join(inspectorPath, 'dist-assets');
182
- const inspectorDistDest = path.join(cliRoot, 'dist', 'agent-inspector');
183
-
184
- if (fs.existsSync(inspectorDistSrc)) {
185
- if (fs.existsSync(inspectorDistDest)) {
186
- fs.rmSync(inspectorDistDest, { recursive: true });
187
- }
188
- fs.cpSync(inspectorDistSrc, inspectorDistDest, { recursive: true });
189
- log(`Copied agent-inspector frontend to ${inspectorDistDest}`);
190
- } else {
191
- console.error(`ERROR: agent-inspector build did not produce dist-assets/ at ${inspectorDistSrc}`);
199
+ const inspectorDistAssets = path.join(inspectorPath, 'dist-assets');
200
+ if (!fs.existsSync(inspectorDistAssets)) {
201
+ console.error(`ERROR: agent-inspector build did not produce dist-assets/ at ${inspectorDistAssets}`);
192
202
  process.exit(1);
193
203
  }
194
- } else {
195
- log('No local agent-inspector found — using npm registry version.');
204
+
205
+ const inspectorDest = path.join(cliRoot, 'dist', 'agent-inspector');
206
+ if (fs.existsSync(inspectorDest)) {
207
+ fs.rmSync(inspectorDest, { recursive: true });
208
+ }
209
+ fs.cpSync(inspectorDistAssets, inspectorDest, { recursive: true });
210
+ log(`Replaced dist/agent-inspector/ with local build from ${inspectorPath}`);
196
211
  }
197
212
 
198
- // Step 6: Bump CLI version and pack into final tarball (includes the bundled CDK tarball + frontend)
213
+ // Step 4: Copy CDK tarball into dist/assets/ so CDKRenderer can detect it
214
+ const bundledTarballDest = path.join(cliRoot, 'dist', 'assets', 'bundled-agentcore-cdk.tgz');
215
+ fs.copyFileSync(cdkTarballSrc, bundledTarballDest);
216
+ log(`Placed CDK tarball at ${bundledTarballDest}`);
217
+
218
+ // Step 5: Bump CLI version and pack into final tarball (includes the bundled CDK tarball)
199
219
  const cliVersionInfo = bumpVersion(cliRoot);
200
220
  try {
201
221
  log('Packing CLI tarball...');
@@ -207,10 +227,19 @@ try {
207
227
  const cliTarballName = `aws-agentcore-${cliVersionInfo.bumpedVersion}.tgz`;
208
228
  const cliTarballPath = path.join(cliRoot, cliTarballName);
209
229
 
210
- if (fs.existsSync(cliTarballPath)) {
211
- log(`Done! Tarball: ${cliTarballPath}`);
212
- log(`Install with: npm install ${cliTarballPath}`);
213
- log('When you run agentcore create, the bundled CDK constructs will be installed automatically.');
214
- } else {
215
- log(`Done! Check ${cliRoot} for the .tgz file.`);
230
+ if (!fs.existsSync(cliTarballPath)) {
231
+ console.error(`ERROR: Expected tarball at ${cliTarballPath} but not found.`);
232
+ process.exit(1);
233
+ }
234
+
235
+ const finalTarballPath = resolveTarballPath(cliTarballPath);
236
+ if (finalTarballPath !== cliTarballPath) {
237
+ fs.mkdirSync(path.dirname(finalTarballPath), { recursive: true });
238
+ fs.renameSync(cliTarballPath, finalTarballPath);
239
+ log(`Renamed tarball to: ${finalTarballPath}`);
216
240
  }
241
+
242
+ // Final output
243
+ log(`Done! Tarball: ${finalTarballPath}`);
244
+ log(`Install with: npm install -g ${finalTarballPath}`);
245
+ log('When you run agentcore create, the bundled CDK constructs will be installed automatically.');
@@ -0,0 +1,269 @@
1
+ #!/usr/bin/env node
2
+ // =============================================================================
3
+ // extract-cli-model.mjs — agentcore CLI -> doc-model JSON
4
+ // =============================================================================
5
+ // Runs `agentcore <cmd> --help` for every command, parses the Commander.js help
6
+ // output, and emits the SAME shared doc-model schema (v1) as the SDK extractors
7
+ // so the one shared renderer (_shared/render_adoc.py) produces consistent .adoc.
8
+ //
9
+ // Why --help scraping (not AST): it is 1:1 with what users actually see, and it
10
+ // survives refactors of the command source. Commander.js help is
11
+ // stable and easy to parse (Usage / Arguments / Options blocks).
12
+ //
13
+ // Decision: ALL ~30 commands, arranged into groups (one group == one .adoc).
14
+ //
15
+ // NOTE: if these workflows are later consolidated into a single shared reusable
16
+ // workflow, this script is vendored there and selected via `language: cli`.
17
+ // Standalone here for the draft.
18
+ // =============================================================================
19
+ import { execFileSync } from 'node:child_process';
20
+ import { writeFileSync } from 'node:fs';
21
+ import { argv } from 'node:process';
22
+ import { pathToFileURL } from 'node:url';
23
+
24
+ // Command grouping (arranged properly, per the request). Mirrors the sections
25
+ // in agentcore-cli/docs/commands.md. Any command discovered from the binary but
26
+ // not listed here lands in the "Other" group so nothing is silently dropped.
27
+ const GROUPS = [
28
+ {
29
+ id: 'project-lifecycle',
30
+ title: 'Project Lifecycle',
31
+ commands: ['create', 'deploy', 'dev', 'package', 'export', 'update', 'validate'],
32
+ },
33
+ {
34
+ id: 'invocation',
35
+ title: 'Invocation & Runtime',
36
+ commands: ['invoke', 'exec', 'run', 'logs', 'traces', 'status', 'fetch', 'view'],
37
+ },
38
+ {
39
+ id: 'resources',
40
+ title: 'Resource Management',
41
+ commands: ['add', 'remove', 'import'],
42
+ },
43
+ {
44
+ id: 'evaluation',
45
+ title: 'Evaluation & Datasets',
46
+ commands: ['evals', 'batch-evaluations', 'dataset'],
47
+ },
48
+ {
49
+ id: 'optimization',
50
+ title: 'Optimization & Config Bundles',
51
+ commands: ['config-bundle', 'promote', 'archive'],
52
+ },
53
+ {
54
+ id: 'operations',
55
+ title: 'Operations & Settings',
56
+ commands: ['pause', 'resume', 'stop', 'config', 'telemetry', 'feedback'],
57
+ },
58
+ ];
59
+
60
+ // AGENTCORE_BIN may be a single command ("agentcore") OR a multi-token
61
+ // invocation ("node /path/to/index.mjs"). Split into [executable, ...prefixArgs]
62
+ // so execFileSync gets a real executable and forwards the rest as args —
63
+ // passing the whole string as argv[0] would make execFileSync look for an
64
+ // executable literally named "node /path/...", which fails silently to empty.
65
+ const BIN_TOKENS = (process.env.AGENTCORE_BIN || 'agentcore').split(/\s+/);
66
+ const BIN = BIN_TOKENS[0];
67
+ const BIN_PREFIX_ARGS = BIN_TOKENS.slice(1);
68
+
69
+ function getArg(flag) {
70
+ const i = argv.indexOf(flag);
71
+ return i >= 0 ? argv[i + 1] : undefined;
72
+ }
73
+
74
+ function help(args) {
75
+ try {
76
+ return execFileSync(BIN, [...BIN_PREFIX_ARGS, ...args, '--help'], {
77
+ encoding: 'utf8',
78
+ // CLI launches a TUI without args; --help forces non-interactive text.
79
+ env: { ...process.env, NO_COLOR: '1', CI: '1' },
80
+ stdio: ['ignore', 'pipe', 'pipe'],
81
+ });
82
+ } catch (e) {
83
+ // Commander exits non-zero for some help paths; stdout still holds text.
84
+ return (e.stdout && e.stdout.toString()) || '';
85
+ }
86
+ }
87
+
88
+ const PARAMETER_DESCRIPTION_OVERRIDES = new Map([
89
+ ['bedrock, open_ai, or gemini', 'The model provider. Valid values: `bedrock`, `open_ai`, or `gemini`.'],
90
+ [
91
+ 'Override LiteLLM API base URL (harness only, lite_llm) [non-interactive]',
92
+ 'The LiteLLM API base URL override for harness invocations. ' +
93
+ 'Available only with `lite_llm` in non-interactive mode.',
94
+ ],
95
+ [
96
+ 'Override LiteLLM additional params as a JSON object (harness only, lite_llm) [non-interactive]',
97
+ 'The additional LiteLLM parameters, as a JSON object, for harness invocations. ' +
98
+ 'Available only with `lite_llm` in non-interactive mode.',
99
+ ],
100
+ ]);
101
+
102
+ export function normalizeParameterDescription(description) {
103
+ return PARAMETER_DESCRIPTION_OVERRIDES.get(description) || description;
104
+ }
105
+
106
+ // Parse a Commander.js help blob into { summary, signature, params, options }.
107
+ export function parseHelp(text) {
108
+ const lines = text.split('\n');
109
+ const out = { summary: '', signature: '', args: [], options: [] };
110
+ let section = 'head';
111
+ let currentItem = null;
112
+ const descLines = [];
113
+
114
+ for (const raw of lines) {
115
+ const line = raw.replace(/\s+$/, '');
116
+ if (/^Usage:/.test(line)) {
117
+ out.signature = line.replace(/^Usage:\s*/, '').trim();
118
+ section = 'desc';
119
+ currentItem = null;
120
+ continue;
121
+ }
122
+ if (/^Arguments:/.test(line)) {
123
+ section = 'args';
124
+ currentItem = null;
125
+ continue;
126
+ }
127
+ if (/^Options:/.test(line)) {
128
+ section = 'options';
129
+ currentItem = null;
130
+ continue;
131
+ }
132
+ if (/^Commands:/.test(line)) {
133
+ section = 'commands';
134
+ currentItem = null;
135
+ continue;
136
+ }
137
+
138
+ if (section === 'desc') {
139
+ if (line.trim()) descLines.push(line.trim());
140
+ } else if (section === 'args') {
141
+ const m = line.match(/^\s+(\S+)\s{2,}(.*)$/);
142
+ if (m) {
143
+ currentItem = { name: m[1], type: null, required: true, description: m[2].trim() };
144
+ out.args.push(currentItem);
145
+ } else if (currentItem && /^\s+\S/.test(line)) {
146
+ currentItem.description += ` ${line.trim()}`;
147
+ }
148
+ } else if (section === 'options') {
149
+ const m = line.match(/^\s+(-[^\s].*?)\s{2,}(.*)$/);
150
+ if (m) {
151
+ currentItem = { name: m[1].trim(), type: null, required: false, description: m[2].trim() };
152
+ out.options.push(currentItem);
153
+ } else if (currentItem && /^\s+\S/.test(line)) {
154
+ currentItem.description += ` ${line.trim()}`;
155
+ } else if (line.trim()) {
156
+ currentItem = null;
157
+ }
158
+ }
159
+ }
160
+ out.summary = descLines.join(' ');
161
+ return out;
162
+ }
163
+
164
+ function entryForCommand(name) {
165
+ const raw = help([name]);
166
+ // Fail loudly on phantom commands / drift. A real command's help names itself
167
+ // in the usage line (`Usage: agentcore <name> ...`); an unknown command falls
168
+ // back to the root usage (`Usage: agentcore [options] [command]`), which does
169
+ // NOT contain the name. Without this guard such commands would silently render
170
+ // as empty stubs (synthesized signature, no description/params).
171
+ if (!new RegExp(`^Usage:\\s+agentcore\\s+${name}\\b`, 'm').test(raw)) {
172
+ throw new Error(
173
+ `Command "${name}" produced no self-describing help output — it is likely ` +
174
+ `not a real CLI command (phantom/renamed). Remove it from GROUPS or fix the name.`
175
+ );
176
+ }
177
+ const parsed = parseHelp(raw);
178
+ // subcommands (e.g. `add agent`, `remove tool`) show under "Commands:"—
179
+ // we surface the top-level command; nested ones can be expanded later.
180
+ return {
181
+ kind: 'command',
182
+ name: `agentcore ${name}`,
183
+ signature: parsed.signature || `agentcore ${name} [options]`,
184
+ summary: parsed.summary,
185
+ description: '',
186
+ // reuse params for both positional args and flags, flagged by required.
187
+ // The renderer already wraps param names in backticks, so don't add our
188
+ // own (that produced double-backticks). Drop the ubiquitous help flag.
189
+ params: [...parsed.args, ...parsed.options.filter(o => !/^-h,?\s|--help\b/.test(o.name))].map(param => ({
190
+ ...param,
191
+ description: normalizeParameterDescription(param.description),
192
+ })),
193
+ returns: null,
194
+ raises: [],
195
+ examples: [],
196
+ members: [],
197
+ };
198
+ }
199
+
200
+ function discoverCommands() {
201
+ // Parse the root help "Commands:" block so we don't miss anything new.
202
+ // In Commander output, a command entry starts at EXACTLY 2 spaces of indent
203
+ // (e.g. " deploy|dp [options] ...") while wrapped description lines are
204
+ // indented much deeper (~36 spaces). Matching only the 2-space indent avoids
205
+ // scraping the first word of a wrapped description ("locally", "past", ...).
206
+ // We also strip the "|alias" and trailing "[options]"/"<arg>" tokens.
207
+ const text = help([]);
208
+ const found = [];
209
+ let inCmds = false;
210
+ for (const line of text.split('\n')) {
211
+ if (/^Commands:/.test(line)) {
212
+ inCmds = true;
213
+ continue;
214
+ }
215
+ if (!inCmds) continue;
216
+ // stop if we hit a new top-level section (e.g. a footer) — non-indented text
217
+ if (line.trim() && !/^ {2}\S/.test(line) && !/^ {3,}/.test(line)) break;
218
+ const m = line.match(/^ {2}([a-z][a-z0-9-]*)(?:\|[a-z0-9-]+)?\b/);
219
+ if (m) found.push(m[1]);
220
+ }
221
+ return found;
222
+ }
223
+
224
+ function main() {
225
+ const outPath = getArg('--out');
226
+ const version = getArg('--version') || 'unknown';
227
+
228
+ const discovered = new Set(discoverCommands());
229
+ const placed = new Set();
230
+ const groups = [];
231
+
232
+ for (const g of GROUPS) {
233
+ const entries = [];
234
+ for (const cmd of g.commands) {
235
+ entries.push(entryForCommand(cmd));
236
+ placed.add(cmd);
237
+ }
238
+ groups.push({ id: g.id, title: g.title, summary: '', entries });
239
+ }
240
+
241
+ // Built-in meta-commands we intentionally don't document as API surface.
242
+ const IGNORED = new Set(['help']);
243
+
244
+ // Catch anything the binary exposes that we didn't group — no silent drops.
245
+ const leftovers = [...discovered].filter(c => !placed.has(c) && !IGNORED.has(c));
246
+ if (leftovers.length) {
247
+ process.stderr.write(`WARNING: ungrouped commands -> "Other": ${leftovers.join(', ')}\n`);
248
+ groups.push({
249
+ id: 'other',
250
+ title: 'Other Commands',
251
+ summary: '',
252
+ entries: leftovers.map(entryForCommand),
253
+ });
254
+ }
255
+
256
+ const model = {
257
+ source: 'cli',
258
+ package: '@aws/agentcore',
259
+ version,
260
+ language: 'cli',
261
+ groups,
262
+ };
263
+ writeFileSync(outPath, JSON.stringify(model, null, 2));
264
+ process.stderr.write(`Wrote doc-model: ${groups.length} groups, version ${version}\n`);
265
+ }
266
+
267
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
268
+ main();
269
+ }