@aws/agentcore 1.0.0-preview.1 → 1.0.0-preview.11

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 (191) hide show
  1. package/README.md +56 -23
  2. package/dist/agent-inspector/index.css +1 -1
  3. package/dist/agent-inspector/index.js +87 -83
  4. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +809 -53
  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/cdk/bin/cdk.ts +6 -4
  8. package/dist/assets/cdk/cdk.json +1 -1
  9. package/dist/assets/cdk/lib/cdk-stack.ts +20 -14
  10. package/dist/assets/cdk/test/cdk.test.ts +1 -0
  11. package/dist/assets/container/python/Dockerfile +3 -1
  12. package/dist/assets/container/typescript/Dockerfile +25 -0
  13. package/dist/assets/container/typescript/dockerignore.template +24 -0
  14. package/dist/assets/datasets/predefined-v1.jsonl +3 -0
  15. package/dist/assets/datasets/simulated-v1.jsonl +3 -0
  16. package/dist/assets/evaluators/python-lambda/execution-role-policy.json +1 -1
  17. package/dist/assets/python/a2a/googleadk/base/pyproject.toml +3 -3
  18. package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +2 -1
  19. package/dist/assets/python/a2a/strands/base/pyproject.toml +2 -2
  20. package/dist/assets/python/a2a/strands/capabilities/memory/session.py +7 -2
  21. package/dist/assets/python/agui/googleadk/base/pyproject.toml +2 -2
  22. package/dist/assets/python/agui/langchain_langgraph/base/pyproject.toml +1 -0
  23. package/dist/assets/python/agui/strands/base/pyproject.toml +1 -1
  24. package/dist/assets/python/agui/strands/capabilities/memory/session.py +7 -2
  25. package/dist/assets/python/http/googleadk/base/pyproject.toml +2 -1
  26. package/dist/assets/python/http/langchain_langgraph/base/main.py +52 -8
  27. package/dist/assets/python/http/langchain_langgraph/base/pyproject.toml +1 -0
  28. package/dist/assets/python/http/strands/base/main.py +71 -8
  29. package/dist/assets/python/http/strands/base/pyproject.toml +1 -1
  30. package/dist/assets/python/http/strands/capabilities/memory/session.py +7 -2
  31. package/dist/assets/typescript/http/strands/base/README.md +37 -0
  32. package/dist/assets/typescript/http/strands/base/gitignore.template +22 -0
  33. package/dist/assets/typescript/http/strands/base/main.ts +66 -0
  34. package/dist/assets/typescript/http/strands/base/mcp_client/client.ts +11 -0
  35. package/dist/assets/typescript/http/strands/base/model/load.ts +102 -0
  36. package/dist/assets/typescript/http/strands/base/package.json +37 -0
  37. package/dist/assets/typescript/http/strands/base/tsconfig.json +19 -0
  38. package/dist/assets/typescript/http/vercelai/base/README.md +37 -0
  39. package/dist/assets/typescript/http/vercelai/base/gitignore.template +22 -0
  40. package/dist/assets/typescript/http/vercelai/base/main.ts +24 -0
  41. package/dist/assets/typescript/http/vercelai/base/model/load.ts +121 -0
  42. package/dist/assets/typescript/http/vercelai/base/package.json +35 -0
  43. package/dist/assets/typescript/http/vercelai/base/tsconfig.json +19 -0
  44. package/dist/cli/index.mjs +1311 -726
  45. package/dist/lib/errors/index.d.ts +1 -1
  46. package/dist/lib/errors/index.d.ts.map +1 -1
  47. package/dist/lib/errors/index.js +1 -1
  48. package/dist/lib/errors/index.js.map +1 -1
  49. package/dist/lib/errors/types.d.ts +189 -0
  50. package/dist/lib/errors/types.d.ts.map +1 -0
  51. package/dist/lib/errors/types.js +293 -0
  52. package/dist/lib/errors/types.js.map +1 -0
  53. package/dist/lib/errors/zod.d.ts +8 -0
  54. package/dist/lib/errors/zod.d.ts.map +1 -0
  55. package/dist/lib/errors/{config.js → zod.js} +7 -80
  56. package/dist/lib/errors/zod.js.map +1 -0
  57. package/dist/lib/index.d.ts +3 -0
  58. package/dist/lib/index.d.ts.map +1 -1
  59. package/dist/lib/index.js +4 -1
  60. package/dist/lib/index.js.map +1 -1
  61. package/dist/lib/packaging/build-args.js +2 -2
  62. package/dist/lib/packaging/build-args.js.map +1 -1
  63. package/dist/lib/packaging/container.js +5 -5
  64. package/dist/lib/packaging/container.js.map +1 -1
  65. package/dist/lib/packaging/helpers.d.ts +16 -0
  66. package/dist/lib/packaging/helpers.d.ts.map +1 -1
  67. package/dist/lib/packaging/helpers.js +77 -19
  68. package/dist/lib/packaging/helpers.js.map +1 -1
  69. package/dist/lib/packaging/index.d.ts +0 -1
  70. package/dist/lib/packaging/index.d.ts.map +1 -1
  71. package/dist/lib/packaging/index.js +4 -19
  72. package/dist/lib/packaging/index.js.map +1 -1
  73. package/dist/lib/packaging/node.d.ts +2 -2
  74. package/dist/lib/packaging/node.d.ts.map +1 -1
  75. package/dist/lib/packaging/node.js +83 -38
  76. package/dist/lib/packaging/node.js.map +1 -1
  77. package/dist/lib/packaging/python.js +12 -12
  78. package/dist/lib/packaging/python.js.map +1 -1
  79. package/dist/lib/result.d.ts +44 -0
  80. package/dist/lib/result.d.ts.map +1 -0
  81. package/dist/lib/result.js +28 -0
  82. package/dist/lib/result.js.map +1 -0
  83. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  84. package/dist/lib/schemas/io/config-io.js +11 -3
  85. package/dist/lib/schemas/io/config-io.js.map +1 -1
  86. package/dist/lib/schemas/io/global-config.d.ts +40 -0
  87. package/dist/lib/schemas/io/global-config.d.ts.map +1 -0
  88. package/dist/lib/schemas/io/global-config.js +118 -0
  89. package/dist/lib/schemas/io/global-config.js.map +1 -0
  90. package/dist/lib/schemas/io/index.d.ts +1 -2
  91. package/dist/lib/schemas/io/index.d.ts.map +1 -1
  92. package/dist/lib/schemas/io/index.js +1 -4
  93. package/dist/lib/schemas/io/index.js.map +1 -1
  94. package/dist/lib/schemas/io/path-resolver.d.ts +0 -6
  95. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -1
  96. package/dist/lib/schemas/io/path-resolver.js +3 -13
  97. package/dist/lib/schemas/io/path-resolver.js.map +1 -1
  98. package/dist/lib/time-constants.d.ts +5 -0
  99. package/dist/lib/time-constants.d.ts.map +1 -0
  100. package/dist/lib/time-constants.js +8 -0
  101. package/dist/lib/time-constants.js.map +1 -0
  102. package/dist/lib/utils/index.d.ts +2 -1
  103. package/dist/lib/utils/index.d.ts.map +1 -1
  104. package/dist/lib/utils/index.js +5 -1
  105. package/dist/lib/utils/index.js.map +1 -1
  106. package/dist/lib/utils/polling.d.ts +31 -0
  107. package/dist/lib/utils/polling.d.ts.map +1 -0
  108. package/dist/lib/utils/polling.js +61 -0
  109. package/dist/lib/utils/polling.js.map +1 -0
  110. package/dist/lib/utils/zod.d.ts +16 -0
  111. package/dist/lib/utils/zod.d.ts.map +1 -1
  112. package/dist/lib/utils/zod.js +45 -0
  113. package/dist/lib/utils/zod.js.map +1 -1
  114. package/dist/schema/constants.d.ts +7 -0
  115. package/dist/schema/constants.d.ts.map +1 -1
  116. package/dist/schema/constants.js +18 -3
  117. package/dist/schema/constants.js.map +1 -1
  118. package/dist/schema/schemas/agent-env.d.ts +25 -1
  119. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  120. package/dist/schema/schemas/agent-env.js +51 -5
  121. package/dist/schema/schemas/agent-env.js.map +1 -1
  122. package/dist/schema/schemas/agentcore-project.d.ts +161 -5
  123. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  124. package/dist/schema/schemas/agentcore-project.js +159 -13
  125. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  126. package/dist/schema/schemas/aws-targets.d.ts +3 -0
  127. package/dist/schema/schemas/aws-targets.d.ts.map +1 -1
  128. package/dist/schema/schemas/aws-targets.js +1 -0
  129. package/dist/schema/schemas/aws-targets.js.map +1 -1
  130. package/dist/schema/schemas/deployed-state.d.ts +165 -0
  131. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  132. package/dist/schema/schemas/deployed-state.js +59 -1
  133. package/dist/schema/schemas/deployed-state.js.map +1 -1
  134. package/dist/schema/schemas/mcp.d.ts +2 -0
  135. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  136. package/dist/schema/schemas/mcp.js +10 -2
  137. package/dist/schema/schemas/mcp.js.map +1 -1
  138. package/dist/schema/schemas/primitives/ab-test.d.ts +141 -0
  139. package/dist/schema/schemas/primitives/ab-test.d.ts.map +1 -0
  140. package/dist/schema/schemas/primitives/ab-test.js +97 -0
  141. package/dist/schema/schemas/primitives/ab-test.js.map +1 -0
  142. package/dist/schema/schemas/primitives/config-bundle.d.ts +31 -0
  143. package/dist/schema/schemas/primitives/config-bundle.d.ts.map +1 -0
  144. package/dist/schema/schemas/primitives/config-bundle.js +38 -0
  145. package/dist/schema/schemas/primitives/config-bundle.js.map +1 -0
  146. package/dist/schema/schemas/primitives/dataset.d.ts +48 -0
  147. package/dist/schema/schemas/primitives/dataset.d.ts.map +1 -0
  148. package/dist/schema/schemas/primitives/dataset.js +58 -0
  149. package/dist/schema/schemas/primitives/dataset.js.map +1 -0
  150. package/dist/schema/schemas/primitives/evaluator.d.ts +8 -0
  151. package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -1
  152. package/dist/schema/schemas/primitives/evaluator.js +17 -1
  153. package/dist/schema/schemas/primitives/evaluator.js.map +1 -1
  154. package/dist/schema/schemas/primitives/harness.d.ts +84 -8
  155. package/dist/schema/schemas/primitives/harness.d.ts.map +1 -1
  156. package/dist/schema/schemas/primitives/harness.js +29 -5
  157. package/dist/schema/schemas/primitives/harness.js.map +1 -1
  158. package/dist/schema/schemas/primitives/http-gateway.d.ts +21 -0
  159. package/dist/schema/schemas/primitives/http-gateway.d.ts.map +1 -0
  160. package/dist/schema/schemas/primitives/http-gateway.js +34 -0
  161. package/dist/schema/schemas/primitives/http-gateway.js.map +1 -0
  162. package/dist/schema/schemas/primitives/index.d.ts +9 -3
  163. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  164. package/dist/schema/schemas/primitives/index.js +24 -1
  165. package/dist/schema/schemas/primitives/index.js.map +1 -1
  166. package/dist/schema/schemas/primitives/memory.d.ts +22 -4
  167. package/dist/schema/schemas/primitives/memory.d.ts.map +1 -1
  168. package/dist/schema/schemas/primitives/memory.js +57 -16
  169. package/dist/schema/schemas/primitives/memory.js.map +1 -1
  170. package/dist/schema/schemas/primitives/online-eval-config.d.ts +1 -0
  171. package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
  172. package/dist/schema/schemas/primitives/online-eval-config.js +2 -0
  173. package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
  174. package/npm-shrinkwrap.json +16604 -0
  175. package/package.json +27 -15
  176. package/scripts/bump-version.ts +4 -4
  177. package/scripts/bundle.mjs +92 -66
  178. package/scripts/run-e2e-dev.sh +56 -0
  179. package/scripts/run-e2e-local.sh +112 -0
  180. package/dist/agent-inspector/index.js.map +0 -1
  181. package/dist/lib/errors/config.d.ts +0 -49
  182. package/dist/lib/errors/config.d.ts.map +0 -1
  183. package/dist/lib/errors/config.js.map +0 -1
  184. package/dist/lib/packaging/errors.d.ts +0 -16
  185. package/dist/lib/packaging/errors.d.ts.map +0 -1
  186. package/dist/lib/packaging/errors.js +0 -36
  187. package/dist/lib/packaging/errors.js.map +0 -1
  188. package/dist/lib/schemas/io/cli-config.d.ts +0 -12
  189. package/dist/lib/schemas/io/cli-config.d.ts.map +0 -1
  190. package/dist/lib/schemas/io/cli-config.js +0 -35
  191. 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.1",
3
+ "version": "1.0.0-preview.11",
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": {
@@ -50,13 +51,14 @@
50
51
  "build:lib": "tsc -p tsconfig.build.json",
51
52
  "build:cli": "node esbuild.config.mjs",
52
53
  "build:assets": "node scripts/copy-assets.mjs",
54
+ "build:preview": "BUILD_PREVIEW=1 node esbuild.config.mjs",
53
55
  "build:harness": "BUILD_HARNESS=1 node esbuild.config.mjs",
54
56
  "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 .",
57
+ "typecheck": "tsc --noEmit --incremental",
58
+ "lint": "eslint --cache src/",
59
+ "lint:fix": "eslint --cache src/ --fix",
60
+ "format": "prettier --cache --write .",
61
+ "format:check": "prettier --cache --check .",
60
62
  "secrets:check": "secretlint '**/*'",
61
63
  "security:audit": "npm audit --audit-level=high --omit=dev",
62
64
  "clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
@@ -64,11 +66,12 @@
64
66
  "test": "vitest run --project unit",
65
67
  "test:all": "vitest run",
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",
70
72
  "test:update-snapshots": "vitest run --project unit --update",
71
73
  "test:tui": "npm run build:harness && vitest run --project tui",
74
+ "test:browser": "npx playwright test --config browser-tests/playwright.config.ts",
72
75
  "bundle": "node scripts/bundle.mjs"
73
76
  },
74
77
  "dependencies": {
@@ -77,22 +80,27 @@
77
80
  "@aws-sdk/client-bedrock": "^3.1012.0",
78
81
  "@aws-sdk/client-bedrock-agent": "^3.1012.0",
79
82
  "@aws-sdk/client-bedrock-agentcore": "^3.1020.0",
80
- "@aws-sdk/client-bedrock-agentcore-control": "^3.1020.0",
83
+ "@aws-sdk/client-bedrock-agentcore-control": "^3.1048.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",
84
87
  "@aws-sdk/client-resource-groups-tagging-api": "^3.893.0",
85
88
  "@aws-sdk/client-s3": "^3.1012.0",
86
89
  "@aws-sdk/client-sts": "^3.893.0",
90
+ "@aws-sdk/region-config-resolver": "^3.972.13",
87
91
  "@aws-sdk/client-xray": "^3.1003.0",
88
92
  "@aws-sdk/credential-providers": "^3.893.0",
89
- "@aws/agent-inspector": "0.2.0",
93
+ "@aws/agent-inspector": "0.4.2",
90
94
  "@commander-js/extra-typings": "^14.0.0",
91
- "@opentelemetry/api": "^1.9.0",
95
+ "@opentelemetry/api": "^1.9.1",
96
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.215.0",
92
97
  "@opentelemetry/otlp-transformer": "^0.213.0",
98
+ "@opentelemetry/resources": "^2.6.1",
99
+ "@opentelemetry/sdk-metrics": "^2.6.1",
93
100
  "@smithy/shared-ini-file-loader": "^4.4.2",
94
101
  "commander": "^14.0.2",
95
102
  "dotenv": "^17.2.3",
103
+ "fast-json-stable-stringify": "^2.1.0",
96
104
  "fflate": "^0.8.2",
97
105
  "handlebars": "^4.7.8",
98
106
  "ink": "^6.6.0",
@@ -111,7 +119,8 @@
111
119
  "@aws-sdk/client-cognito-identity-provider": "^3.1018.0",
112
120
  "@eslint/js": "^9.39.2",
113
121
  "@modelcontextprotocol/sdk": "^1.0.0",
114
- "@secretlint/secretlint-rule-preset-recommend": "^11.3.0",
122
+ "@playwright/test": "^1.59.1",
123
+ "@secretlint/secretlint-rule-preset-recommend": "^12.2.0",
115
124
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
116
125
  "@types/js-yaml": "^4.0.9",
117
126
  "@types/node": "^25.0.3",
@@ -122,7 +131,7 @@
122
131
  "@xterm/headless": "^6.0.0",
123
132
  "aws-cdk-lib": "^2.248.0",
124
133
  "constructs": "^10.4.4",
125
- "esbuild": "^0.27.2",
134
+ "esbuild": "^0.28.0",
126
135
  "eslint": "^9.39.4",
127
136
  "eslint-config-prettier": "^10.1.8",
128
137
  "eslint-import-resolver-typescript": "^4.4.4",
@@ -136,7 +145,8 @@
136
145
  "lint-staged": "^16.2.7",
137
146
  "node-pty": "^1.1.0",
138
147
  "prettier": "^3.7.4",
139
- "secretlint": "^11.3.0",
148
+ "secretlint": "^12.2.0",
149
+ "strip-ansi": "^7.2.0",
140
150
  "tsx": "^4.21.0",
141
151
  "typescript": "^5",
142
152
  "typescript-eslint": "^8.50.1",
@@ -144,11 +154,13 @@
144
154
  },
145
155
  "overridesComments": {
146
156
  "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.",
157
+ "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
158
  "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
159
  "@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."
149
160
  },
150
161
  "overrides": {
151
162
  "minimatch": "10.2.4",
163
+ "glob": "^13.0.0",
152
164
  "fast-xml-parser": "5.5.7",
153
165
  "@aws-sdk/xml-builder": "3.972.15"
154
166
  },
@@ -157,10 +169,10 @@
157
169
  },
158
170
  "lint-staged": {
159
171
  "*.{ts,tsx}": [
160
- "eslint --max-warnings=10"
172
+ "eslint --cache --max-warnings=10"
161
173
  ],
162
174
  "*.{ts,tsx,js,jsx,json,md,css,html,yml,yaml}": [
163
- "prettier --check"
175
+ "prettier --cache --check"
164
176
  ],
165
177
  "*": [
166
178
  "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,17 @@
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_TARBALL_OUTPUT — output path (without .tgz) for the GA tarball.
20
+ * Preview tarball gets '-preview' appended. Relative to cwd.
21
+ * AGENTCORE_TARBALL_VERSION_SUFFIX — version prerelease suffix (e.g. "abc12-def34").
22
+ * Defaults to a timestamp if not set.
22
23
  */
23
24
  import { execFileSync } from 'node:child_process';
24
25
  import * as fs from 'node:fs';
@@ -79,38 +80,20 @@ function resolveCdkPath() {
79
80
  return cloneDir;
80
81
  }
81
82
 
82
- /**
83
- * Resolve the agent-inspector repo path. Priority:
84
- * 1. AGENT_INSPECTOR_PATH env var
85
- * 2. Sibling directory ../agent-inspector
86
- */
87
- function resolveInspectorPath() {
88
- if (process.env.AGENT_INSPECTOR_PATH) {
89
- const p = path.resolve(process.env.AGENT_INSPECTOR_PATH);
90
- if (fs.existsSync(path.join(p, 'package.json'))) {
91
- log(`Using agent-inspector from AGENT_INSPECTOR_PATH: ${p}`);
92
- return p;
93
- }
94
- console.warn(` WARNING: AGENT_INSPECTOR_PATH=${p} does not contain package.json, ignoring.`);
95
- }
96
-
97
- const sibling = path.resolve(cliRoot, '..', 'agent-inspector');
98
- if (fs.existsSync(path.join(sibling, 'package.json'))) {
99
- log(`Using agent-inspector from sibling directory: ${sibling}`);
100
- return sibling;
101
- }
102
-
103
- return null;
104
- }
105
-
106
83
  // ---------------------------------------------------------------------------
107
84
  // Main
108
85
  // ---------------------------------------------------------------------------
109
86
 
110
87
  log('Starting bundle process...');
111
88
 
112
- const timestamp = Math.floor(Date.now() / 1000);
113
- log(`Bundle timestamp: ${timestamp}`);
89
+ const now = new Date();
90
+ const timestamp = now.toISOString().replace(/[-:T]/g, '').slice(0, 14);
91
+ const versionSuffix = process.env.AGENTCORE_TARBALL_VERSION_SUFFIX || timestamp;
92
+ if (!/^[\w.-]+$/.test(versionSuffix)) {
93
+ console.error(`ERROR: Invalid version suffix: ${versionSuffix}`);
94
+ process.exit(1);
95
+ }
96
+ log(`Bundle version suffix: ${versionSuffix}`);
114
97
 
115
98
  // Helper to bump a package version with a unique e2e timestamp tag.
116
99
  // Saves the original version so it can be restored after packing.
@@ -119,7 +102,9 @@ function bumpVersion(pkgDir) {
119
102
  const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
120
103
  const originalVersion = pkg.version;
121
104
  const baseVersion = originalVersion.split('-')[0];
122
- pkg.version = `${baseVersion}-${timestamp}`;
105
+ const prerelease = originalVersion.includes('-') ? originalVersion.split('-').slice(1).join('-') : '';
106
+ const tag = prerelease ? `${prerelease}-${versionSuffix}` : versionSuffix;
107
+ pkg.version = `${baseVersion}-${tag}`;
123
108
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + '\n');
124
109
  log(`Bumped ${pkg.name} version: ${originalVersion} -> ${pkg.version}`);
125
110
  return { pkgJsonPath, originalVersion, bumpedVersion: pkg.version };
@@ -131,6 +116,18 @@ function restoreVersion({ pkgJsonPath, originalVersion }) {
131
116
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + '\n');
132
117
  }
133
118
 
119
+ /**
120
+ * If AGENTCORE_TARBALL_OUTPUT is set, return a resolved path using it as base.
121
+ * Appends '-preview' suffix for preview builds. Always appends .tgz.
122
+ */
123
+ function resolveTarballPath(tarballPath, { preview = false } = {}) {
124
+ const envPath = process.env.AGENTCORE_TARBALL_OUTPUT;
125
+ if (!envPath) return tarballPath;
126
+ const suffix = preview ? '-preview' : '';
127
+ const base = envPath.replace(/\.tgz$/, '');
128
+ return path.resolve(`${base}${suffix}.tgz`);
129
+ }
130
+
134
131
  // Step 1: Resolve and build CDK constructs
135
132
  const cdkPath = resolveCdkPath();
136
133
 
@@ -169,33 +166,7 @@ const bundledTarballDest = path.join(cliRoot, 'dist', 'assets', 'bundled-agentco
169
166
  fs.copyFileSync(cdkTarballSrc, bundledTarballDest);
170
167
  log(`Placed CDK tarball at ${bundledTarballDest}`);
171
168
 
172
- // Step 5: Build and bundle agent-inspector frontend (overrides the npm version)
173
- const inspectorPath = resolveInspectorPath();
174
- if (inspectorPath) {
175
- log('Installing agent-inspector dependencies...');
176
- run('npm', ['install'], { cwd: inspectorPath });
177
-
178
- log('Building agent-inspector...');
179
- run('npm', ['run', 'build'], { cwd: inspectorPath });
180
-
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}`);
192
- process.exit(1);
193
- }
194
- } else {
195
- log('No local agent-inspector found — using npm registry version.');
196
- }
197
-
198
- // Step 6: Bump CLI version and pack into final tarball (includes the bundled CDK tarball + frontend)
169
+ // Step 5: Bump CLI version and pack into final tarball (includes the bundled CDK tarball)
199
170
  const cliVersionInfo = bumpVersion(cliRoot);
200
171
  try {
201
172
  log('Packing CLI tarball...');
@@ -207,10 +178,65 @@ try {
207
178
  const cliTarballName = `aws-agentcore-${cliVersionInfo.bumpedVersion}.tgz`;
208
179
  const cliTarballPath = path.join(cliRoot, cliTarballName);
209
180
 
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.`);
181
+ if (!fs.existsSync(cliTarballPath)) {
182
+ console.error(`ERROR: Expected GA tarball at ${cliTarballPath} but not found.`);
183
+ process.exit(1);
184
+ }
185
+
186
+ const gaTarballPath = resolveTarballPath(cliTarballPath);
187
+ if (gaTarballPath !== cliTarballPath) {
188
+ fs.mkdirSync(path.dirname(gaTarballPath), { recursive: true });
189
+ fs.renameSync(cliTarballPath, gaTarballPath);
190
+ log(`Renamed tarball to: ${gaTarballPath}`);
191
+ }
192
+ log(`Done! GA Tarball: ${gaTarballPath}`);
193
+ log(`Install with: npm install -g ${gaTarballPath}`);
194
+ log('When you run agentcore create, the bundled CDK constructs will be installed automatically.');
195
+
196
+ // Step 6: Rebuild CLI with BUILD_PREVIEW=1
197
+ log('Rebuilding CLI with BUILD_PREVIEW=1 for preview tarball...');
198
+ run('npm', ['run', 'build:cli'], { cwd: cliRoot, env: { ...process.env, BUILD_PREVIEW: '1' } });
199
+
200
+ // Step 7: Bump version to preview variant
201
+ function bumpPreviewVersion(pkgDir) {
202
+ const pkgJsonPath = path.join(pkgDir, 'package.json');
203
+ const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
204
+ const originalVersion = pkg.version;
205
+ const baseVersion = originalVersion.split('-')[0];
206
+ pkg.version = `${baseVersion}-preview-${versionSuffix}`;
207
+ fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + '\n');
208
+ log(`Bumped ${pkg.name} version: ${originalVersion} -> ${pkg.version}`);
209
+ return { pkgJsonPath, originalVersion, bumpedVersion: pkg.version };
216
210
  }
211
+
212
+ const previewVersionInfo = bumpPreviewVersion(cliRoot);
213
+
214
+ // Step 8: Pack preview tarball
215
+ try {
216
+ log('Packing CLI preview tarball...');
217
+ run('npm', ['pack'], { cwd: cliRoot });
218
+ } finally {
219
+ restoreVersion(previewVersionInfo);
220
+ }
221
+
222
+ const previewTarballName = `aws-agentcore-${previewVersionInfo.bumpedVersion}.tgz`;
223
+ const previewTarballPath = path.join(cliRoot, previewTarballName);
224
+
225
+ if (!fs.existsSync(previewTarballPath)) {
226
+ console.error(`ERROR: Expected preview tarball at ${previewTarballPath} but not found.`);
227
+ process.exit(1);
228
+ }
229
+
230
+ const finalPreviewPath = resolveTarballPath(previewTarballPath, { preview: true });
231
+ if (finalPreviewPath !== previewTarballPath) {
232
+ fs.mkdirSync(path.dirname(finalPreviewPath), { recursive: true });
233
+ fs.renameSync(previewTarballPath, finalPreviewPath);
234
+ log(`Renamed tarball to: ${finalPreviewPath}`);
235
+ }
236
+
237
+ // Final output
238
+ log(`GA tarball: ${gaTarballPath}`);
239
+ log(`Preview tarball: ${finalPreviewPath}`);
240
+ log(`Install GA: npm install -g ${gaTarballPath}`);
241
+ log(`Install Preview: npm install -g ${finalPreviewPath}`);
242
+ log('When you run agentcore create, the bundled CDK constructs will be installed automatically.');
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env bash
2
+ # Run E2E tests against your dev account using local credentials.
3
+ #
4
+ # Usage:
5
+ # ./scripts/run-e2e-dev.sh # runs strands-bedrock.test.ts
6
+ # ./scripts/run-e2e-dev.sh --all # runs the full e2e suite
7
+ # ./scripts/run-e2e-dev.sh e2e-tests/foo.test.ts # runs a specific test file
8
+
9
+ set -euo pipefail
10
+
11
+ REGION="${AWS_REGION:-us-east-1}"
12
+
13
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14
+ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
15
+
16
+ # ── Parse arguments ────────────────────────────────────────────────────────────
17
+ RUN_ALL=false
18
+ TEST_FILES=()
19
+ for arg in "$@"; do
20
+ if [[ "$arg" == "--all" ]]; then
21
+ RUN_ALL=true
22
+ else
23
+ TEST_FILES+=("$arg")
24
+ fi
25
+ done
26
+
27
+ # ── Build & install CLI from source ────────────────────────────────────────────
28
+ cd "$REPO_ROOT"
29
+ npm run build
30
+ TARBALL=$(npm pack | tail -1)
31
+ npm install -g "$TARBALL"
32
+ echo "=== Installed: $(agentcore --version) ==="
33
+
34
+ # ── Set env vars for tests ─────────────────────────────────────────────────────
35
+ export AWS_REGION="$REGION"
36
+ export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
37
+
38
+ # ── Run tests ──────────────────────────────────────────────────────────────────
39
+ cd "$REPO_ROOT"
40
+
41
+ EXCLUDE_API_KEY_TESTS=(
42
+ --exclude 'e2e-tests/*-anthropic*'
43
+ --exclude 'e2e-tests/*-openai*'
44
+ --exclude 'e2e-tests/*-gemini*'
45
+ )
46
+
47
+ if [[ "$RUN_ALL" == "true" ]]; then
48
+ echo "=== Running full e2e suite ==="
49
+ npx vitest run --project e2e
50
+ elif [[ ${#TEST_FILES[@]} -gt 0 ]]; then
51
+ echo "=== Running: ${TEST_FILES[*]} ==="
52
+ npx vitest run --project e2e "${TEST_FILES[@]}"
53
+ else
54
+ echo "=== Running all Bedrock/IAM tests (excluding API-key-dependent tests) ==="
55
+ npx vitest run --project e2e "${EXCLUDE_API_KEY_TESTS[@]}"
56
+ fi
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env bash
2
+ # Run E2E tests locally in the CI account, replicating the GitHub Actions e2e-tests.yml workflow.
3
+ #
4
+ # Required env vars:
5
+ # E2E_ROLE_ARN — IAM role ARN to assume (grants access to the test account)
6
+ # E2E_SECRET_ARN — Secrets Manager ARN containing ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY
7
+ #
8
+ # Optional env vars:
9
+ # AWS_REGION — defaults to us-east-1
10
+ #
11
+ # Usage:
12
+ # export E2E_ROLE_ARN=arn:aws:iam::<account>:role/<role>
13
+ # export E2E_SECRET_ARN=arn:aws:secretsmanager:<region>:<account>:secret:<name>
14
+ # ./scripts/run-e2e-local.sh # runs strands-bedrock.test.ts (CI default)
15
+ # ./scripts/run-e2e-local.sh --all # runs the full e2e suite
16
+ # ./scripts/run-e2e-local.sh e2e-tests/foo.test.ts # runs a specific test file
17
+ #
18
+ # Prerequisites: aws CLI, node >=20.19, npm, git, uv, jq
19
+
20
+ set -euo pipefail
21
+
22
+ ROLE_ARN="${E2E_ROLE_ARN:-}"
23
+ SECRET_ARN="${E2E_SECRET_ARN:-}"
24
+ AWS_REGION="${AWS_REGION:-us-east-1}"
25
+
26
+ if [[ -z "$ROLE_ARN" ]]; then
27
+ echo "❌ E2E_ROLE_ARN is not set. Export it before running this script:"
28
+ echo " export E2E_ROLE_ARN=arn:aws:iam::<account>:role/<role-name>"
29
+ exit 1
30
+ fi
31
+
32
+ if [[ -z "$SECRET_ARN" ]]; then
33
+ echo "❌ E2E_SECRET_ARN is not set. Export it before running this script:"
34
+ echo " export E2E_SECRET_ARN=arn:aws:secretsmanager:<region>:<account>:secret:<name>"
35
+ exit 1
36
+ fi
37
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
38
+ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
39
+
40
+ # ── Parse arguments ────────────────────────────────────────────────────────────
41
+ RUN_ALL=false
42
+ TEST_FILES=()
43
+ for arg in "$@"; do
44
+ if [[ "$arg" == "--all" ]]; then
45
+ RUN_ALL=true
46
+ else
47
+ TEST_FILES+=("$arg")
48
+ fi
49
+ done
50
+
51
+ echo "=== Assuming IAM role ==="
52
+ CREDS=$(aws sts assume-role \
53
+ --role-arn "$ROLE_ARN" \
54
+ --role-session-name "local-e2e-$(date +%s)" \
55
+ --duration-seconds 3600 \
56
+ --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
57
+ --output text)
58
+
59
+ export AWS_ACCESS_KEY_ID=$(echo "$CREDS" | awk '{print $1}')
60
+ export AWS_SECRET_ACCESS_KEY=$(echo "$CREDS" | awk '{print $2}')
61
+ export AWS_SESSION_TOKEN=$(echo "$CREDS" | awk '{print $3}')
62
+ export AWS_REGION
63
+
64
+ echo "✅ Assumed role successfully"
65
+
66
+ echo "=== Fetching API keys from Secrets Manager ==="
67
+ SECRET_JSON=$(aws secretsmanager get-secret-value \
68
+ --secret-id "$SECRET_ARN" \
69
+ --region "$AWS_REGION" \
70
+ --query SecretString \
71
+ --output text)
72
+
73
+ # Mirror the GitHub workflow: parse-json-secrets maps keys to E2E_<KEY> then
74
+ # the workflow maps them to the bare names the tests expect.
75
+ export ANTHROPIC_API_KEY=$(echo "$SECRET_JSON" | jq -r '.ANTHROPIC_API_KEY // empty')
76
+ export OPENAI_API_KEY=$(echo "$SECRET_JSON" | jq -r '.OPENAI_API_KEY // empty')
77
+ export GEMINI_API_KEY=$(echo "$SECRET_JSON" | jq -r '.GEMINI_API_KEY // empty')
78
+
79
+ echo "✅ Secrets loaded (keys present: $(echo "$SECRET_JSON" | jq -r 'keys | join(", ")')"
80
+
81
+ echo "=== Setting AWS account env var ==="
82
+ export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
83
+ echo "✅ AWS_ACCOUNT_ID=$AWS_ACCOUNT_ID AWS_REGION=$AWS_REGION"
84
+
85
+ echo "=== Configuring git (required for agentcore create) ==="
86
+ git config --global user.email "ci@local" 2>/dev/null || true
87
+ git config --global user.name "Local E2E" 2>/dev/null || true
88
+
89
+ cd "$REPO_ROOT"
90
+
91
+ echo "=== Installing dependencies ==="
92
+ npm ci
93
+
94
+ echo "=== Building CLI ==="
95
+ npm run build
96
+
97
+ echo "=== Installing CLI globally ==="
98
+ TARBALL=$(npm pack | tail -1)
99
+ npm install -g "$TARBALL"
100
+ echo "✅ Installed: $(agentcore --version)"
101
+
102
+ echo "=== Running E2E tests ==="
103
+ if [[ "$RUN_ALL" == "true" ]]; then
104
+ echo "Running full e2e suite"
105
+ npx vitest run --project e2e
106
+ elif [[ ${#TEST_FILES[@]} -gt 0 ]]; then
107
+ echo "Running: ${TEST_FILES[*]}"
108
+ npx vitest run --project e2e "${TEST_FILES[@]}"
109
+ else
110
+ echo "Running default: e2e-tests/strands-bedrock.test.ts"
111
+ npx vitest run --project e2e e2e-tests/strands-bedrock.test.ts
112
+ fi