@aws/agentcore 1.0.0-preview.2 → 1.0.0-preview.21

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 (277) 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/__tests__/__snapshots__/assets.snapshot.test.ts.snap +3132 -366
  5. package/dist/assets/__tests__/__snapshots__/dockerfile-render.test.ts.snap +6 -2
  6. package/dist/assets/__tests__/assets.snapshot.test.ts +10 -24
  7. package/dist/assets/__tests__/googleadk-session-eviction.test.ts +87 -0
  8. package/dist/assets/__tests__/summarization-namespace.test.ts +43 -0
  9. package/dist/assets/agents/AGENTS.md +87 -11
  10. package/dist/assets/cdk/bin/cdk.ts +87 -26
  11. package/dist/assets/cdk/lib/cdk-stack.ts +185 -55
  12. package/dist/assets/cdk/package.json +1 -1
  13. package/dist/assets/cdk/test/cdk.test.ts +4 -0
  14. package/dist/assets/container/python/Dockerfile +7 -1
  15. package/dist/assets/container/typescript/Dockerfile +25 -0
  16. package/dist/assets/container/typescript/dockerignore.template +24 -0
  17. package/dist/assets/datasets/predefined-v1.jsonl +3 -0
  18. package/dist/assets/datasets/simulated-v1.jsonl +3 -0
  19. package/dist/assets/python/a2a/googleadk/base/main.py +24 -16
  20. package/dist/assets/python/a2a/googleadk/base/pyproject.toml +3 -3
  21. package/dist/assets/python/a2a/langchain_langgraph/base/main.py +24 -16
  22. package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +3 -2
  23. package/dist/assets/python/a2a/strands/base/main.py +23 -17
  24. package/dist/assets/python/a2a/strands/base/pyproject.toml +2 -2
  25. package/dist/assets/python/a2a/strands/capabilities/memory/session.py +10 -2
  26. package/dist/assets/python/agui/googleadk/base/main.py +62 -2
  27. package/dist/assets/python/agui/googleadk/base/pyproject.toml +3 -3
  28. package/dist/assets/python/agui/langchain_langgraph/base/main.py +56 -0
  29. package/dist/assets/python/agui/langchain_langgraph/base/pyproject.toml +2 -1
  30. package/dist/assets/python/agui/strands/base/main.py +63 -1
  31. package/dist/assets/python/agui/strands/base/pyproject.toml +1 -1
  32. package/dist/assets/python/agui/strands/capabilities/memory/session.py +10 -2
  33. package/dist/assets/python/http/autogen/base/main.py +60 -29
  34. package/dist/assets/python/http/autogen/base/pyproject.toml +1 -1
  35. package/dist/assets/python/http/googleadk/base/main.py +69 -24
  36. package/dist/assets/python/http/googleadk/base/mcp_client/client.py +7 -7
  37. package/dist/assets/python/http/googleadk/base/pyproject.toml +2 -1
  38. package/dist/assets/python/http/langchain_langgraph/base/main.py +115 -24
  39. package/dist/assets/python/http/langchain_langgraph/base/mcp_client/client.py +10 -8
  40. package/dist/assets/python/http/langchain_langgraph/base/pyproject.toml +3 -2
  41. package/dist/assets/python/http/openaiagents/base/main.py +61 -32
  42. package/dist/assets/python/http/openaiagents/base/mcp_client/client.py +4 -4
  43. package/dist/assets/python/http/openaiagents/base/pyproject.toml +2 -2
  44. package/dist/assets/python/http/strands/base/main.py +571 -47
  45. package/dist/assets/python/http/strands/base/mcp_client/client.py +49 -6
  46. package/dist/assets/python/http/strands/base/model/load.py +119 -3
  47. package/dist/assets/python/http/strands/base/model/mantle_compat.py +21 -0
  48. package/dist/assets/python/http/strands/base/pyproject.toml +9 -3
  49. package/dist/assets/python/http/strands/base/skills/fetcher.py +279 -0
  50. package/dist/assets/python/http/strands/capabilities/execution-limits/hooks/execution_limits.py +54 -0
  51. package/dist/assets/python/http/strands/capabilities/memory/session.py +10 -2
  52. package/dist/assets/python/http/strands/capabilities/payments/__init__.py +4 -0
  53. package/dist/assets/python/http/strands/capabilities/payments/payments.py +142 -0
  54. package/dist/assets/python/mcp/standalone/base/main.py +58 -0
  55. package/dist/assets/typescript/http/strands/base/README.md +37 -0
  56. package/dist/assets/typescript/http/strands/base/gitignore.template +22 -0
  57. package/dist/assets/typescript/http/strands/base/main.ts +144 -0
  58. package/dist/assets/typescript/http/strands/base/mcp_client/client.ts +11 -0
  59. package/dist/assets/typescript/http/strands/base/model/load.ts +102 -0
  60. package/dist/assets/typescript/http/strands/base/package.json +38 -0
  61. package/dist/assets/typescript/http/strands/base/tsconfig.json +19 -0
  62. package/dist/assets/typescript/http/strands/capabilities/memory/memory.ts +52 -0
  63. package/dist/assets/typescript/http/vercelai/base/README.md +37 -0
  64. package/dist/assets/typescript/http/vercelai/base/gitignore.template +22 -0
  65. package/dist/assets/typescript/http/vercelai/base/main.ts +64 -0
  66. package/dist/assets/typescript/http/vercelai/base/model/load.ts +121 -0
  67. package/dist/assets/typescript/http/vercelai/base/package.json +35 -0
  68. package/dist/assets/typescript/http/vercelai/base/tsconfig.json +19 -0
  69. package/dist/cli/index.mjs +1443 -569
  70. package/dist/lib/constants.d.ts +8 -4
  71. package/dist/lib/constants.d.ts.map +1 -1
  72. package/dist/lib/constants.js +13 -7
  73. package/dist/lib/constants.js.map +1 -1
  74. package/dist/lib/errors/index.d.ts +1 -1
  75. package/dist/lib/errors/index.d.ts.map +1 -1
  76. package/dist/lib/errors/index.js +1 -1
  77. package/dist/lib/errors/index.js.map +1 -1
  78. package/dist/lib/errors/types.d.ts +259 -0
  79. package/dist/lib/errors/types.d.ts.map +1 -0
  80. package/dist/lib/errors/types.js +402 -0
  81. package/dist/lib/errors/types.js.map +1 -0
  82. package/dist/lib/errors/zod.d.ts +8 -0
  83. package/dist/lib/errors/zod.d.ts.map +1 -0
  84. package/dist/lib/errors/{config.js → zod.js} +8 -81
  85. package/dist/lib/errors/zod.js.map +1 -0
  86. package/dist/lib/index.d.ts +3 -0
  87. package/dist/lib/index.d.ts.map +1 -1
  88. package/dist/lib/index.js +4 -1
  89. package/dist/lib/index.js.map +1 -1
  90. package/dist/lib/packaging/build-args.d.ts +6 -0
  91. package/dist/lib/packaging/build-args.d.ts.map +1 -1
  92. package/dist/lib/packaging/build-args.js +11 -2
  93. package/dist/lib/packaging/build-args.js.map +1 -1
  94. package/dist/lib/packaging/build-context-dockerignore.d.ts +23 -0
  95. package/dist/lib/packaging/build-context-dockerignore.d.ts.map +1 -0
  96. package/dist/lib/packaging/build-context-dockerignore.js +63 -0
  97. package/dist/lib/packaging/build-context-dockerignore.js.map +1 -0
  98. package/dist/lib/packaging/build-context.d.ts +21 -0
  99. package/dist/lib/packaging/build-context.d.ts.map +1 -0
  100. package/dist/lib/packaging/build-context.js +21 -0
  101. package/dist/lib/packaging/build-context.js.map +1 -0
  102. package/dist/lib/packaging/container.d.ts.map +1 -1
  103. package/dist/lib/packaging/container.js +20 -9
  104. package/dist/lib/packaging/container.js.map +1 -1
  105. package/dist/lib/packaging/helpers.d.ts +16 -0
  106. package/dist/lib/packaging/helpers.d.ts.map +1 -1
  107. package/dist/lib/packaging/helpers.js +127 -29
  108. package/dist/lib/packaging/helpers.js.map +1 -1
  109. package/dist/lib/packaging/index.d.ts +2 -1
  110. package/dist/lib/packaging/index.d.ts.map +1 -1
  111. package/dist/lib/packaging/index.js +9 -20
  112. package/dist/lib/packaging/index.js.map +1 -1
  113. package/dist/lib/packaging/node.d.ts +2 -2
  114. package/dist/lib/packaging/node.d.ts.map +1 -1
  115. package/dist/lib/packaging/node.js +83 -38
  116. package/dist/lib/packaging/node.js.map +1 -1
  117. package/dist/lib/packaging/python.js +12 -12
  118. package/dist/lib/packaging/python.js.map +1 -1
  119. package/dist/lib/result.d.ts +50 -0
  120. package/dist/lib/result.d.ts.map +1 -0
  121. package/dist/lib/result.js +49 -0
  122. package/dist/lib/result.js.map +1 -0
  123. package/dist/lib/schemas/io/config-io.d.ts +8 -0
  124. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  125. package/dist/lib/schemas/io/config-io.js +21 -3
  126. package/dist/lib/schemas/io/config-io.js.map +1 -1
  127. package/dist/lib/schemas/io/global-config.d.ts +40 -0
  128. package/dist/lib/schemas/io/global-config.d.ts.map +1 -0
  129. package/dist/lib/schemas/io/global-config.js +118 -0
  130. package/dist/lib/schemas/io/global-config.js.map +1 -0
  131. package/dist/lib/schemas/io/index.d.ts +1 -2
  132. package/dist/lib/schemas/io/index.d.ts.map +1 -1
  133. package/dist/lib/schemas/io/index.js +1 -4
  134. package/dist/lib/schemas/io/index.js.map +1 -1
  135. package/dist/lib/schemas/io/path-resolver.d.ts +0 -6
  136. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -1
  137. package/dist/lib/schemas/io/path-resolver.js +3 -13
  138. package/dist/lib/schemas/io/path-resolver.js.map +1 -1
  139. package/dist/lib/secrets/cipher.d.ts +12 -0
  140. package/dist/lib/secrets/cipher.d.ts.map +1 -0
  141. package/dist/lib/secrets/cipher.js +54 -0
  142. package/dist/lib/secrets/cipher.js.map +1 -0
  143. package/dist/lib/secrets/index.d.ts +4 -0
  144. package/dist/lib/secrets/index.d.ts.map +1 -0
  145. package/dist/lib/secrets/index.js +15 -0
  146. package/dist/lib/secrets/index.js.map +1 -0
  147. package/dist/lib/secrets/key-provider.d.ts +16 -0
  148. package/dist/lib/secrets/key-provider.d.ts.map +1 -0
  149. package/dist/lib/secrets/key-provider.js +191 -0
  150. package/dist/lib/secrets/key-provider.js.map +1 -0
  151. package/dist/lib/secrets/sensitive-keys.d.ts +21 -0
  152. package/dist/lib/secrets/sensitive-keys.d.ts.map +1 -0
  153. package/dist/lib/secrets/sensitive-keys.js +67 -0
  154. package/dist/lib/secrets/sensitive-keys.js.map +1 -0
  155. package/dist/lib/time-constants.d.ts +5 -0
  156. package/dist/lib/time-constants.d.ts.map +1 -0
  157. package/dist/lib/time-constants.js +8 -0
  158. package/dist/lib/time-constants.js.map +1 -0
  159. package/dist/lib/utils/env.d.ts +8 -2
  160. package/dist/lib/utils/env.d.ts.map +1 -1
  161. package/dist/lib/utils/env.js +65 -17
  162. package/dist/lib/utils/env.js.map +1 -1
  163. package/dist/lib/utils/index.d.ts +3 -2
  164. package/dist/lib/utils/index.d.ts.map +1 -1
  165. package/dist/lib/utils/index.js +6 -1
  166. package/dist/lib/utils/index.js.map +1 -1
  167. package/dist/lib/utils/polling.d.ts +31 -0
  168. package/dist/lib/utils/polling.d.ts.map +1 -0
  169. package/dist/lib/utils/polling.js +61 -0
  170. package/dist/lib/utils/polling.js.map +1 -0
  171. package/dist/lib/utils/zod.d.ts +16 -0
  172. package/dist/lib/utils/zod.d.ts.map +1 -1
  173. package/dist/lib/utils/zod.js +45 -0
  174. package/dist/lib/utils/zod.js.map +1 -1
  175. package/dist/schema/constants.d.ts +56 -2
  176. package/dist/schema/constants.d.ts.map +1 -1
  177. package/dist/schema/constants.js +82 -7
  178. package/dist/schema/constants.js.map +1 -1
  179. package/dist/schema/schemas/agent-env.d.ts +178 -6
  180. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  181. package/dist/schema/schemas/agent-env.js +302 -27
  182. package/dist/schema/schemas/agent-env.js.map +1 -1
  183. package/dist/schema/schemas/agentcore-project.d.ts +450 -11
  184. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  185. package/dist/schema/schemas/agentcore-project.js +283 -18
  186. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  187. package/dist/schema/schemas/auth.d.ts +174 -0
  188. package/dist/schema/schemas/auth.d.ts.map +1 -1
  189. package/dist/schema/schemas/auth.js +127 -3
  190. package/dist/schema/schemas/auth.js.map +1 -1
  191. package/dist/schema/schemas/aws-targets.d.ts +12 -0
  192. package/dist/schema/schemas/aws-targets.d.ts.map +1 -1
  193. package/dist/schema/schemas/aws-targets.js +4 -0
  194. package/dist/schema/schemas/aws-targets.js.map +1 -1
  195. package/dist/schema/schemas/connections.d.ts +185 -0
  196. package/dist/schema/schemas/connections.d.ts.map +1 -0
  197. package/dist/schema/schemas/connections.js +176 -0
  198. package/dist/schema/schemas/connections.js.map +1 -0
  199. package/dist/schema/schemas/deployed-state.d.ts +361 -5
  200. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  201. package/dist/schema/schemas/deployed-state.js +105 -2
  202. package/dist/schema/schemas/deployed-state.js.map +1 -1
  203. package/dist/schema/schemas/index.d.ts +1 -0
  204. package/dist/schema/schemas/index.d.ts.map +1 -1
  205. package/dist/schema/schemas/index.js +1 -0
  206. package/dist/schema/schemas/index.js.map +1 -1
  207. package/dist/schema/schemas/mcp-defs.d.ts +2 -1
  208. package/dist/schema/schemas/mcp-defs.d.ts.map +1 -1
  209. package/dist/schema/schemas/mcp-defs.js +3 -2
  210. package/dist/schema/schemas/mcp-defs.js.map +1 -1
  211. package/dist/schema/schemas/mcp.d.ts +199 -0
  212. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  213. package/dist/schema/schemas/mcp.js +343 -6
  214. package/dist/schema/schemas/mcp.js.map +1 -1
  215. package/dist/schema/schemas/primitives/ab-test.d.ts +135 -0
  216. package/dist/schema/schemas/primitives/ab-test.d.ts.map +1 -0
  217. package/dist/schema/schemas/primitives/ab-test.js +95 -0
  218. package/dist/schema/schemas/primitives/ab-test.js.map +1 -0
  219. package/dist/schema/schemas/primitives/config-bundle.d.ts +32 -0
  220. package/dist/schema/schemas/primitives/config-bundle.d.ts.map +1 -0
  221. package/dist/schema/schemas/primitives/config-bundle.js +41 -0
  222. package/dist/schema/schemas/primitives/config-bundle.js.map +1 -0
  223. package/dist/schema/schemas/primitives/dataset.d.ts +48 -0
  224. package/dist/schema/schemas/primitives/dataset.d.ts.map +1 -0
  225. package/dist/schema/schemas/primitives/dataset.js +58 -0
  226. package/dist/schema/schemas/primitives/dataset.js.map +1 -0
  227. package/dist/schema/schemas/primitives/evaluator.d.ts +8 -0
  228. package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -1
  229. package/dist/schema/schemas/primitives/evaluator.js +17 -1
  230. package/dist/schema/schemas/primitives/evaluator.js.map +1 -1
  231. package/dist/schema/schemas/primitives/harness.d.ts +377 -19
  232. package/dist/schema/schemas/primitives/harness.d.ts.map +1 -1
  233. package/dist/schema/schemas/primitives/harness.js +379 -24
  234. package/dist/schema/schemas/primitives/harness.js.map +1 -1
  235. package/dist/schema/schemas/primitives/index.d.ts +13 -7
  236. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  237. package/dist/schema/schemas/primitives/index.js +37 -1
  238. package/dist/schema/schemas/primitives/index.js.map +1 -1
  239. package/dist/schema/schemas/primitives/knowledge-base.d.ts +104 -0
  240. package/dist/schema/schemas/primitives/knowledge-base.d.ts.map +1 -0
  241. package/dist/schema/schemas/primitives/knowledge-base.js +99 -0
  242. package/dist/schema/schemas/primitives/knowledge-base.js.map +1 -0
  243. package/dist/schema/schemas/primitives/memory.d.ts +22 -4
  244. package/dist/schema/schemas/primitives/memory.d.ts.map +1 -1
  245. package/dist/schema/schemas/primitives/memory.js +57 -16
  246. package/dist/schema/schemas/primitives/memory.js.map +1 -1
  247. package/dist/schema/schemas/primitives/online-eval-config.d.ts +21 -2
  248. package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
  249. package/dist/schema/schemas/primitives/online-eval-config.js +45 -5
  250. package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
  251. package/dist/schema/schemas/primitives/payment.d.ts +54 -0
  252. package/dist/schema/schemas/primitives/payment.d.ts.map +1 -0
  253. package/dist/schema/schemas/primitives/payment.js +79 -0
  254. package/dist/schema/schemas/primitives/payment.js.map +1 -0
  255. package/dist/schema/schemas/primitives/policy.d.ts +26 -0
  256. package/dist/schema/schemas/primitives/policy.d.ts.map +1 -1
  257. package/dist/schema/schemas/primitives/policy.js +5 -1
  258. package/dist/schema/schemas/primitives/policy.js.map +1 -1
  259. package/npm-shrinkwrap.json +17013 -0
  260. package/package.json +43 -21
  261. package/scripts/bump-version.ts +4 -4
  262. package/scripts/bundle.mjs +70 -41
  263. package/scripts/extract-cli-model.mjs +228 -0
  264. package/scripts/render_adoc.py +274 -0
  265. package/scripts/run-e2e-dev.sh +56 -0
  266. package/scripts/run-e2e-local.sh +145 -0
  267. package/dist/lib/errors/config.d.ts +0 -49
  268. package/dist/lib/errors/config.d.ts.map +0 -1
  269. package/dist/lib/errors/config.js.map +0 -1
  270. package/dist/lib/packaging/errors.d.ts +0 -16
  271. package/dist/lib/packaging/errors.d.ts.map +0 -1
  272. package/dist/lib/packaging/errors.js +0 -36
  273. package/dist/lib/packaging/errors.js.map +0 -1
  274. package/dist/lib/schemas/io/cli-config.d.ts +0 -12
  275. package/dist/lib/schemas/io/cli-config.d.ts.map +0 -1
  276. package/dist/lib/schemas/io/cli-config.js +0 -35
  277. 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.2",
3
+ "version": "1.0.0-preview.21",
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,11 +53,11 @@
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})\"",
@@ -64,35 +65,44 @@
64
65
  "test": "vitest run --project unit",
65
66
  "test:all": "vitest run",
66
67
  "test:watch": "vitest --project unit",
67
- "test:integ": "vitest run --project integ",
68
+ "test:integ": "npm run build && vitest run --project integ",
68
69
  "test:unit": "vitest run --project unit --coverage",
69
70
  "test:e2e": "vitest run --project e2e",
70
71
  "test:update-snapshots": "vitest run --project unit --update",
71
72
  "test:tui": "npm run build:harness && vitest run --project tui",
73
+ "test:browser": "npx playwright test --config browser-tests/playwright.config.ts",
72
74
  "bundle": "node scripts/bundle.mjs"
73
75
  },
74
76
  "dependencies": {
75
- "@aws-cdk/toolkit-lib": "^1.16.0",
77
+ "@aws-cdk/cdk-assets-lib": "^1.4.10",
78
+ "@aws-cdk/toolkit-lib": "^1.28.0",
76
79
  "@aws-sdk/client-application-signals": "^3.1003.0",
77
80
  "@aws-sdk/client-bedrock": "^3.1012.0",
78
81
  "@aws-sdk/client-bedrock-agent": "^3.1012.0",
79
- "@aws-sdk/client-bedrock-agentcore": "^3.1020.0",
80
- "@aws-sdk/client-bedrock-agentcore-control": "^3.1020.0",
82
+ "@aws-sdk/client-bedrock-agentcore": "^3.1061.0",
83
+ "@aws-sdk/client-bedrock-agentcore-control": "^3.1061.0",
81
84
  "@aws-sdk/client-bedrock-runtime": "^3.893.0",
82
85
  "@aws-sdk/client-cloudformation": "^3.893.0",
83
86
  "@aws-sdk/client-cloudwatch-logs": "^3.893.0",
87
+ "@aws-sdk/client-efs": "^3.1067.0",
84
88
  "@aws-sdk/client-resource-groups-tagging-api": "^3.893.0",
85
89
  "@aws-sdk/client-s3": "^3.1012.0",
90
+ "@aws-sdk/client-s3files": "^3.1067.0",
86
91
  "@aws-sdk/client-sts": "^3.893.0",
87
92
  "@aws-sdk/client-xray": "^3.1003.0",
88
93
  "@aws-sdk/credential-providers": "^3.893.0",
89
- "@aws/agent-inspector": "0.2.1",
94
+ "@aws-sdk/region-config-resolver": "^3.972.13",
95
+ "@aws/agent-inspector": "0.6.1",
90
96
  "@commander-js/extra-typings": "^14.0.0",
91
- "@opentelemetry/api": "^1.9.0",
97
+ "@opentelemetry/api": "^1.9.1",
98
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.215.0",
92
99
  "@opentelemetry/otlp-transformer": "^0.213.0",
100
+ "@opentelemetry/resources": "^2.6.1",
101
+ "@opentelemetry/sdk-metrics": "^2.6.1",
93
102
  "@smithy/shared-ini-file-loader": "^4.4.2",
94
103
  "commander": "^14.0.2",
95
104
  "dotenv": "^17.2.3",
105
+ "fast-json-stable-stringify": "^2.1.0",
96
106
  "fflate": "^0.8.2",
97
107
  "handlebars": "^4.7.8",
98
108
  "ink": "^6.6.0",
@@ -100,29 +110,35 @@
100
110
  "ink-spinner": "^5.0.0",
101
111
  "js-yaml": "^4.1.1",
102
112
  "react": "^19.2.3",
113
+ "ws": "^8.21.0",
103
114
  "yaml": "^2.8.3",
104
115
  "zod": "^4.3.5"
105
116
  },
117
+ "optionalDependencies": {
118
+ "@napi-rs/keyring": "^1.3.0"
119
+ },
106
120
  "peerDependencies": {
107
- "aws-cdk-lib": "^2.248.0",
121
+ "aws-cdk-lib": "^2.258.0",
108
122
  "constructs": "^10.0.0"
109
123
  },
110
124
  "devDependencies": {
111
125
  "@aws-sdk/client-cognito-identity-provider": "^3.1018.0",
112
126
  "@eslint/js": "^9.39.2",
113
127
  "@modelcontextprotocol/sdk": "^1.0.0",
114
- "@secretlint/secretlint-rule-preset-recommend": "^11.3.0",
128
+ "@playwright/test": "^1.59.1",
129
+ "@secretlint/secretlint-rule-preset-recommend": "^12.2.0",
115
130
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
116
131
  "@types/js-yaml": "^4.0.9",
117
132
  "@types/node": "^25.0.3",
118
133
  "@types/react": "^19.2.7",
134
+ "@types/ws": "^8.18.1",
119
135
  "@typescript-eslint/eslint-plugin": "^8.50.0",
120
136
  "@typescript-eslint/parser": "^8.50.0",
121
137
  "@vitest/coverage-v8": "^4.0.18",
122
138
  "@xterm/headless": "^6.0.0",
123
- "aws-cdk-lib": "^2.248.0",
139
+ "aws-cdk-lib": "^2.258.0",
124
140
  "constructs": "^10.4.4",
125
- "esbuild": "^0.27.2",
141
+ "esbuild": "^0.28.0",
126
142
  "eslint": "^9.39.4",
127
143
  "eslint-config-prettier": "^10.1.8",
128
144
  "eslint-import-resolver-typescript": "^4.4.4",
@@ -133,10 +149,12 @@
133
149
  "eslint-plugin-security": "^4.0.0",
134
150
  "husky": "^9.1.7",
135
151
  "ink-testing-library": "^4.0.0",
152
+ "jose": "^6.2.3",
136
153
  "lint-staged": "^16.2.7",
137
154
  "node-pty": "^1.1.0",
138
155
  "prettier": "^3.7.4",
139
- "secretlint": "^11.3.0",
156
+ "secretlint": "^12.2.0",
157
+ "strip-ansi": "^7.2.0",
140
158
  "tsx": "^4.21.0",
141
159
  "typescript": "^5",
142
160
  "typescript-eslint": "^8.50.1",
@@ -144,23 +162,27 @@
144
162
  },
145
163
  "overridesComments": {
146
164
  "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.",
165
+ "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.",
147
166
  "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.",
148
- "@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."
167
+ "@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.",
168
+ "protobufjs": "GHSA-f38q-mgvj-vph7, GHSA-wcpc-wj8m-hjx6, GHSA-94rc-8x27-4472: protobufjs <=7.6.2 / 8.0.0-8.5.0 has property shadowing and DoS vulnerabilities. Transitive via @opentelemetry/otlp-transformer. Remove once @opentelemetry updates to protobufjs >=7.6.3 or >=8.5.1."
149
169
  },
150
170
  "overrides": {
151
171
  "minimatch": "10.2.4",
172
+ "glob": "^13.0.0",
152
173
  "fast-xml-parser": "5.5.7",
153
- "@aws-sdk/xml-builder": "3.972.15"
174
+ "@aws-sdk/xml-builder": "3.972.15",
175
+ "protobufjs": ">=7.6.3"
154
176
  },
155
177
  "engines": {
156
178
  "node": ">=20"
157
179
  },
158
180
  "lint-staged": {
159
181
  "*.{ts,tsx}": [
160
- "eslint --max-warnings=10"
182
+ "eslint --cache --max-warnings=10"
161
183
  ],
162
184
  "*.{ts,tsx,js,jsx,json,md,css,html,yml,yaml}": [
163
- "prettier --check"
185
+ "prettier --cache --check"
164
186
  ],
165
187
  "*": [
166
188
  "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,228 @@
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
+
23
+ // Command grouping (arranged properly, per the request). Mirrors the sections
24
+ // in agentcore-cli/docs/commands.md. Any command discovered from the binary but
25
+ // not listed here lands in the "Other" group so nothing is silently dropped.
26
+ const GROUPS = [
27
+ {
28
+ id: 'project-lifecycle',
29
+ title: 'Project Lifecycle',
30
+ commands: ['create', 'deploy', 'dev', 'package', 'export', 'update', 'validate'],
31
+ },
32
+ {
33
+ id: 'invocation',
34
+ title: 'Invocation & Runtime',
35
+ commands: ['invoke', 'exec', 'run', 'logs', 'traces', 'status', 'fetch', 'view'],
36
+ },
37
+ {
38
+ id: 'resources',
39
+ title: 'Resource Management',
40
+ commands: ['add', 'remove', 'import'],
41
+ },
42
+ {
43
+ id: 'evaluation',
44
+ title: 'Evaluation & Datasets',
45
+ commands: ['evals', 'batch-evaluations', 'dataset'],
46
+ },
47
+ {
48
+ id: 'optimization',
49
+ title: 'Optimization & Config Bundles',
50
+ commands: ['config-bundle', 'promote', 'archive'],
51
+ },
52
+ {
53
+ id: 'operations',
54
+ title: 'Operations & Settings',
55
+ commands: ['pause', 'resume', 'stop', 'config', 'telemetry', 'feedback'],
56
+ },
57
+ ];
58
+
59
+ // AGENTCORE_BIN may be a single command ("agentcore") OR a multi-token
60
+ // invocation ("node /path/to/index.mjs"). Split into [executable, ...prefixArgs]
61
+ // so execFileSync gets a real executable and forwards the rest as args —
62
+ // passing the whole string as argv[0] would make execFileSync look for an
63
+ // executable literally named "node /path/...", which fails silently to empty.
64
+ const BIN_TOKENS = (process.env.AGENTCORE_BIN || 'agentcore').split(/\s+/);
65
+ const BIN = BIN_TOKENS[0];
66
+ const BIN_PREFIX_ARGS = BIN_TOKENS.slice(1);
67
+
68
+ function getArg(flag) {
69
+ const i = argv.indexOf(flag);
70
+ return i >= 0 ? argv[i + 1] : undefined;
71
+ }
72
+
73
+ function help(args) {
74
+ try {
75
+ return execFileSync(BIN, [...BIN_PREFIX_ARGS, ...args, '--help'], {
76
+ encoding: 'utf8',
77
+ // CLI launches a TUI without args; --help forces non-interactive text.
78
+ env: { ...process.env, NO_COLOR: '1', CI: '1' },
79
+ stdio: ['ignore', 'pipe', 'pipe'],
80
+ });
81
+ } catch (e) {
82
+ // Commander exits non-zero for some help paths; stdout still holds text.
83
+ return (e.stdout && e.stdout.toString()) || '';
84
+ }
85
+ }
86
+
87
+ // Parse a Commander.js help blob into { summary, signature, params, options }.
88
+ function parseHelp(text, name) {
89
+ const lines = text.split('\n');
90
+ const out = { summary: '', signature: '', args: [], options: [] };
91
+ let section = 'head';
92
+ const descLines = [];
93
+
94
+ for (const raw of lines) {
95
+ const line = raw.replace(/\s+$/, '');
96
+ if (/^Usage:/.test(line)) {
97
+ out.signature = line.replace(/^Usage:\s*/, '').trim();
98
+ section = 'desc';
99
+ continue;
100
+ }
101
+ if (/^Arguments:/.test(line)) {
102
+ section = 'args';
103
+ continue;
104
+ }
105
+ if (/^Options:/.test(line)) {
106
+ section = 'options';
107
+ continue;
108
+ }
109
+ if (/^Commands:/.test(line)) {
110
+ section = 'commands';
111
+ continue;
112
+ }
113
+
114
+ if (section === 'desc') {
115
+ if (line.trim()) descLines.push(line.trim());
116
+ } else if (section === 'args') {
117
+ const m = line.match(/^\s+(\S+)\s{2,}(.*)$/);
118
+ if (m) out.args.push({ name: m[1], type: null, required: true, description: m[2].trim() });
119
+ } else if (section === 'options') {
120
+ const m = line.match(/^\s+(-[^\s].*?)\s{2,}(.*)$/);
121
+ if (m) out.options.push({ name: m[1].trim(), type: null, required: false, description: m[2].trim() });
122
+ }
123
+ }
124
+ out.summary = descLines.join(' ');
125
+ return out;
126
+ }
127
+
128
+ function entryForCommand(name) {
129
+ const raw = help([name]);
130
+ // Fail loudly on phantom commands / drift. A real command's help names itself
131
+ // in the usage line (`Usage: agentcore <name> ...`); an unknown command falls
132
+ // back to the root usage (`Usage: agentcore [options] [command]`), which does
133
+ // NOT contain the name. Without this guard such commands would silently render
134
+ // as empty stubs (synthesized signature, no description/params).
135
+ if (!new RegExp(`^Usage:\\s+agentcore\\s+${name}\\b`, 'm').test(raw)) {
136
+ throw new Error(
137
+ `Command "${name}" produced no self-describing help output — it is likely ` +
138
+ `not a real CLI command (phantom/renamed). Remove it from GROUPS or fix the name.`
139
+ );
140
+ }
141
+ const parsed = parseHelp(raw, name);
142
+ // subcommands (e.g. `add agent`, `remove tool`) show under "Commands:"—
143
+ // we surface the top-level command; nested ones can be expanded later.
144
+ return {
145
+ kind: 'command',
146
+ name: `agentcore ${name}`,
147
+ signature: parsed.signature || `agentcore ${name} [options]`,
148
+ summary: parsed.summary,
149
+ description: '',
150
+ // reuse params for both positional args and flags, flagged by required.
151
+ // The renderer already wraps param names in backticks, so don't add our
152
+ // own (that produced double-backticks). Drop the ubiquitous help flag.
153
+ params: [...parsed.args, ...parsed.options.filter(o => !/^-h,?\s|--help\b/.test(o.name))],
154
+ returns: null,
155
+ raises: [],
156
+ examples: [],
157
+ members: [],
158
+ };
159
+ }
160
+
161
+ function discoverCommands() {
162
+ // Parse the root help "Commands:" block so we don't miss anything new.
163
+ // In Commander output, a command entry starts at EXACTLY 2 spaces of indent
164
+ // (e.g. " deploy|dp [options] ...") while wrapped description lines are
165
+ // indented much deeper (~36 spaces). Matching only the 2-space indent avoids
166
+ // scraping the first word of a wrapped description ("locally", "past", ...).
167
+ // We also strip the "|alias" and trailing "[options]"/"<arg>" tokens.
168
+ const text = help([]);
169
+ const found = [];
170
+ let inCmds = false;
171
+ for (const line of text.split('\n')) {
172
+ if (/^Commands:/.test(line)) {
173
+ inCmds = true;
174
+ continue;
175
+ }
176
+ if (!inCmds) continue;
177
+ // stop if we hit a new top-level section (e.g. a footer) — non-indented text
178
+ if (line.trim() && !/^ {2}\S/.test(line) && !/^ {3,}/.test(line)) break;
179
+ const m = line.match(/^ {2}([a-z][a-z0-9-]*)(?:\|[a-z0-9-]+)?\b/);
180
+ if (m) found.push(m[1]);
181
+ }
182
+ return found;
183
+ }
184
+
185
+ function main() {
186
+ const outPath = getArg('--out');
187
+ const version = getArg('--version') || 'unknown';
188
+
189
+ const discovered = new Set(discoverCommands());
190
+ const placed = new Set();
191
+ const groups = [];
192
+
193
+ for (const g of GROUPS) {
194
+ const entries = [];
195
+ for (const cmd of g.commands) {
196
+ entries.push(entryForCommand(cmd));
197
+ placed.add(cmd);
198
+ }
199
+ groups.push({ id: g.id, title: g.title, summary: '', entries });
200
+ }
201
+
202
+ // Built-in meta-commands we intentionally don't document as API surface.
203
+ const IGNORED = new Set(['help']);
204
+
205
+ // Catch anything the binary exposes that we didn't group — no silent drops.
206
+ const leftovers = [...discovered].filter(c => !placed.has(c) && !IGNORED.has(c));
207
+ if (leftovers.length) {
208
+ process.stderr.write(`WARNING: ungrouped commands -> "Other": ${leftovers.join(', ')}\n`);
209
+ groups.push({
210
+ id: 'other',
211
+ title: 'Other Commands',
212
+ summary: '',
213
+ entries: leftovers.map(entryForCommand),
214
+ });
215
+ }
216
+
217
+ const model = {
218
+ source: 'cli',
219
+ package: '@aws/agentcore',
220
+ version,
221
+ language: 'cli',
222
+ groups,
223
+ };
224
+ writeFileSync(outPath, JSON.stringify(model, null, 2));
225
+ process.stderr.write(`Wrote doc-model: ${groups.length} groups, version ${version}\n`);
226
+ }
227
+
228
+ main();