@aws/agentcore 0.15.0 → 0.16.0

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 (37) hide show
  1. package/README.md +5 -0
  2. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +62 -5
  3. package/dist/assets/cdk/bin/cdk.ts +37 -0
  4. package/dist/assets/cdk/lib/cdk-stack.ts +24 -5
  5. package/dist/assets/harness/invoke.py.template +74 -0
  6. package/dist/cli/index.mjs +486 -461
  7. package/dist/lib/constants.d.ts +1 -0
  8. package/dist/lib/constants.d.ts.map +1 -1
  9. package/dist/lib/constants.js +3 -1
  10. package/dist/lib/constants.js.map +1 -1
  11. package/dist/lib/schemas/io/config-io.d.ts +9 -1
  12. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  13. package/dist/lib/schemas/io/config-io.js +14 -0
  14. package/dist/lib/schemas/io/config-io.js.map +1 -1
  15. package/dist/lib/schemas/io/path-resolver.d.ts +12 -0
  16. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -1
  17. package/dist/lib/schemas/io/path-resolver.js +18 -0
  18. package/dist/lib/schemas/io/path-resolver.js.map +1 -1
  19. package/dist/schema/schemas/agentcore-project.d.ts +11 -0
  20. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  21. package/dist/schema/schemas/agentcore-project.js +21 -2
  22. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  23. package/dist/schema/schemas/deployed-state.d.ts +50 -0
  24. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  25. package/dist/schema/schemas/deployed-state.js +15 -1
  26. package/dist/schema/schemas/deployed-state.js.map +1 -1
  27. package/dist/schema/schemas/primitives/harness.d.ts +363 -0
  28. package/dist/schema/schemas/primitives/harness.d.ts.map +1 -0
  29. package/dist/schema/schemas/primitives/harness.js +261 -0
  30. package/dist/schema/schemas/primitives/harness.js.map +1 -0
  31. package/dist/schema/schemas/primitives/index.d.ts +2 -0
  32. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  33. package/dist/schema/schemas/primitives/index.js +17 -1
  34. package/dist/schema/schemas/primitives/index.js.map +1 -1
  35. package/npm-shrinkwrap.json +2 -2
  36. package/package.json +9 -8
  37. package/scripts/bundle.mjs +86 -9
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpGatewaySchema = exports.HttpGatewayNameSchema = exports.ValidationModeSchema = exports.PolicySchema = exports.PolicyNameSchema = exports.PolicyEngineSchema = exports.PolicyEngineNameSchema = exports.OnlineEvalConfigNameSchema = exports.OnlineEvalConfigSchema = exports.RatingScaleSchema = exports.NumericalRatingSchema = exports.ManagedCodeBasedConfigSchema = exports.LlmAsAJudgeConfigSchema = exports.isValidBedrockModelId = exports.ExternalCodeBasedConfigSchema = exports.EvaluatorNameSchema = exports.EvaluatorConfigSchema = exports.EvaluationLevelSchema = exports.CodeBasedConfigSchema = exports.CategoricalRatingSchema = exports.BedrockModelIdSchema = exports.MemoryStrategyTypeSchema = exports.MemoryStrategySchema = exports.MemoryStrategyNameSchema = exports.DEFAULT_STRATEGY_NAMESPACES = exports.DEFAULT_STRATEGY_NAMESPACE_TEMPLATES = exports.DEFAULT_EPISODIC_REFLECTION_NAMESPACES = exports.DEFAULT_EPISODIC_REFLECTION_NAMESPACE_TEMPLATES = exports.VariantWeightSchema = exports.VariantNameSchema = exports.VariantConfigurationSchema = exports.TrafficAllocationConfigSchema = exports.ConfigurationBundleRefSchema = exports.ABTestEvaluationConfigSchema = exports.ABTestVariantSchema = exports.ABTestSchema = exports.ABTestDescriptionSchema = exports.ABTestNameSchema = exports.DatasetSchemaTypeSchema = exports.DatasetSchema = exports.DatasetNameSchema = void 0;
3
+ exports.HarnessToolSchema = exports.HarnessToolNameSchema = exports.HarnessToolConfigSchema = exports.HarnessSpecSchema = exports.HarnessNameSchema = exports.HarnessModelSchema = exports.HarnessModelProviderSchema = exports.HarnessMemoryRefSchema = exports.HarnessGatewayOutboundAuthSchema = exports.GatewayOAuthGrantTypeSchema = exports.AllowedToolSchema = exports.ValidationModeSchema = exports.PolicySchema = exports.PolicyNameSchema = exports.PolicyEngineSchema = exports.PolicyEngineNameSchema = exports.OnlineEvalConfigNameSchema = exports.OnlineEvalConfigSchema = exports.RatingScaleSchema = exports.NumericalRatingSchema = exports.ManagedCodeBasedConfigSchema = exports.LlmAsAJudgeConfigSchema = exports.isValidBedrockModelId = exports.ExternalCodeBasedConfigSchema = exports.EvaluatorNameSchema = exports.EvaluatorConfigSchema = exports.EvaluationLevelSchema = exports.CodeBasedConfigSchema = exports.CategoricalRatingSchema = exports.BedrockModelIdSchema = exports.MemoryStrategyTypeSchema = exports.MemoryStrategySchema = exports.MemoryStrategyNameSchema = exports.DEFAULT_STRATEGY_NAMESPACES = exports.DEFAULT_STRATEGY_NAMESPACE_TEMPLATES = exports.DEFAULT_EPISODIC_REFLECTION_NAMESPACES = exports.DEFAULT_EPISODIC_REFLECTION_NAMESPACE_TEMPLATES = exports.VariantWeightSchema = exports.VariantNameSchema = exports.VariantConfigurationSchema = exports.TrafficAllocationConfigSchema = exports.ConfigurationBundleRefSchema = exports.ABTestEvaluationConfigSchema = exports.ABTestVariantSchema = exports.ABTestSchema = exports.ABTestDescriptionSchema = exports.ABTestNameSchema = exports.DatasetSchemaTypeSchema = exports.DatasetSchema = exports.DatasetNameSchema = void 0;
4
+ exports.HttpGatewaySchema = exports.HttpGatewayNameSchema = exports.HarnessTruncationStrategySchema = exports.HarnessTruncationConfigSchema = exports.HarnessToolTypeSchema = void 0;
4
5
  var dataset_1 = require("./dataset");
5
6
  Object.defineProperty(exports, "DatasetNameSchema", { enumerable: true, get: function () { return dataset_1.DatasetNameSchema; } });
6
7
  Object.defineProperty(exports, "DatasetSchema", { enumerable: true, get: function () { return dataset_1.DatasetSchema; } });
@@ -46,6 +47,21 @@ Object.defineProperty(exports, "PolicyEngineSchema", { enumerable: true, get: fu
46
47
  Object.defineProperty(exports, "PolicyNameSchema", { enumerable: true, get: function () { return policy_1.PolicyNameSchema; } });
47
48
  Object.defineProperty(exports, "PolicySchema", { enumerable: true, get: function () { return policy_1.PolicySchema; } });
48
49
  Object.defineProperty(exports, "ValidationModeSchema", { enumerable: true, get: function () { return policy_1.ValidationModeSchema; } });
50
+ var harness_1 = require("./harness");
51
+ Object.defineProperty(exports, "AllowedToolSchema", { enumerable: true, get: function () { return harness_1.AllowedToolSchema; } });
52
+ Object.defineProperty(exports, "GatewayOAuthGrantTypeSchema", { enumerable: true, get: function () { return harness_1.GatewayOAuthGrantTypeSchema; } });
53
+ Object.defineProperty(exports, "HarnessGatewayOutboundAuthSchema", { enumerable: true, get: function () { return harness_1.HarnessGatewayOutboundAuthSchema; } });
54
+ Object.defineProperty(exports, "HarnessMemoryRefSchema", { enumerable: true, get: function () { return harness_1.HarnessMemoryRefSchema; } });
55
+ Object.defineProperty(exports, "HarnessModelProviderSchema", { enumerable: true, get: function () { return harness_1.HarnessModelProviderSchema; } });
56
+ Object.defineProperty(exports, "HarnessModelSchema", { enumerable: true, get: function () { return harness_1.HarnessModelSchema; } });
57
+ Object.defineProperty(exports, "HarnessNameSchema", { enumerable: true, get: function () { return harness_1.HarnessNameSchema; } });
58
+ Object.defineProperty(exports, "HarnessSpecSchema", { enumerable: true, get: function () { return harness_1.HarnessSpecSchema; } });
59
+ Object.defineProperty(exports, "HarnessToolConfigSchema", { enumerable: true, get: function () { return harness_1.HarnessToolConfigSchema; } });
60
+ Object.defineProperty(exports, "HarnessToolNameSchema", { enumerable: true, get: function () { return harness_1.HarnessToolNameSchema; } });
61
+ Object.defineProperty(exports, "HarnessToolSchema", { enumerable: true, get: function () { return harness_1.HarnessToolSchema; } });
62
+ Object.defineProperty(exports, "HarnessToolTypeSchema", { enumerable: true, get: function () { return harness_1.HarnessToolTypeSchema; } });
63
+ Object.defineProperty(exports, "HarnessTruncationConfigSchema", { enumerable: true, get: function () { return harness_1.HarnessTruncationConfigSchema; } });
64
+ Object.defineProperty(exports, "HarnessTruncationStrategySchema", { enumerable: true, get: function () { return harness_1.HarnessTruncationStrategySchema; } });
49
65
  var http_gateway_1 = require("./http-gateway");
50
66
  Object.defineProperty(exports, "HttpGatewayNameSchema", { enumerable: true, get: function () { return http_gateway_1.HttpGatewayNameSchema; } });
51
67
  Object.defineProperty(exports, "HttpGatewaySchema", { enumerable: true, get: function () { return http_gateway_1.HttpGatewaySchema; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/schema/schemas/primitives/index.ts"],"names":[],"mappings":";;;AAUA,qCAAsF;AAA7E,4GAAA,iBAAiB,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AAClE,qCAWmB;AAVjB,2GAAA,gBAAgB,OAAA;AAChB,kHAAA,uBAAuB,OAAA;AACvB,uGAAA,YAAY,OAAA;AACZ,8GAAA,mBAAmB,OAAA;AACnB,uHAAA,4BAA4B,OAAA;AAC5B,uHAAA,4BAA4B,OAAA;AAC5B,wHAAA,6BAA6B,OAAA;AAC7B,qHAAA,0BAA0B,OAAA;AAC1B,4GAAA,iBAAiB,OAAA;AACjB,8GAAA,mBAAmB,OAAA;AAIrB,mCAQkB;AAPhB,yIAAA,+CAA+C,OAAA;AAC/C,gIAAA,sCAAsC,OAAA;AACtC,8HAAA,oCAAoC,OAAA;AACpC,qHAAA,2BAA2B,OAAA;AAC3B,kHAAA,wBAAwB,OAAA;AACxB,8GAAA,oBAAoB,OAAA;AACpB,kHAAA,wBAAwB,OAAA;AAc1B,yCAaqB;AAZnB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AACvB,kHAAA,qBAAqB,OAAA;AACrB,kHAAA,qBAAqB,OAAA;AACrB,kHAAA,qBAAqB,OAAA;AACrB,gHAAA,mBAAmB,OAAA;AACnB,0HAAA,6BAA6B,OAAA;AAC7B,kHAAA,qBAAqB,OAAA;AACrB,oHAAA,uBAAuB,OAAA;AACvB,yHAAA,4BAA4B,OAAA;AAC5B,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AAInB,2DAA0F;AAAjF,4HAAA,sBAAsB,OAAA;AAAE,gIAAA,0BAA0B,OAAA;AAG3D,mCAMkB;AALhB,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,sGAAA,YAAY,OAAA;AACZ,8GAAA,oBAAoB,OAAA;AAItB,+CAA0E;AAAjE,qHAAA,qBAAqB,OAAA;AAAE,iHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/schema/schemas/primitives/index.ts"],"names":[],"mappings":";;;;AAUA,qCAAsF;AAA7E,4GAAA,iBAAiB,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AAClE,qCAWmB;AAVjB,2GAAA,gBAAgB,OAAA;AAChB,kHAAA,uBAAuB,OAAA;AACvB,uGAAA,YAAY,OAAA;AACZ,8GAAA,mBAAmB,OAAA;AACnB,uHAAA,4BAA4B,OAAA;AAC5B,uHAAA,4BAA4B,OAAA;AAC5B,wHAAA,6BAA6B,OAAA;AAC7B,qHAAA,0BAA0B,OAAA;AAC1B,4GAAA,iBAAiB,OAAA;AACjB,8GAAA,mBAAmB,OAAA;AAIrB,mCAQkB;AAPhB,yIAAA,+CAA+C,OAAA;AAC/C,gIAAA,sCAAsC,OAAA;AACtC,8HAAA,oCAAoC,OAAA;AACpC,qHAAA,2BAA2B,OAAA;AAC3B,kHAAA,wBAAwB,OAAA;AACxB,8GAAA,oBAAoB,OAAA;AACpB,kHAAA,wBAAwB,OAAA;AAc1B,yCAaqB;AAZnB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AACvB,kHAAA,qBAAqB,OAAA;AACrB,kHAAA,qBAAqB,OAAA;AACrB,kHAAA,qBAAqB,OAAA;AACrB,gHAAA,mBAAmB,OAAA;AACnB,0HAAA,6BAA6B,OAAA;AAC7B,kHAAA,qBAAqB,OAAA;AACrB,oHAAA,uBAAuB,OAAA;AACvB,yHAAA,4BAA4B,OAAA;AAC5B,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AAInB,2DAA0F;AAAjF,4HAAA,sBAAsB,OAAA;AAAE,gIAAA,0BAA0B,OAAA;AAG3D,mCAMkB;AALhB,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,sGAAA,YAAY,OAAA;AACZ,8GAAA,oBAAoB,OAAA;AAatB,qCAemB;AAdjB,4GAAA,iBAAiB,OAAA;AACjB,sHAAA,2BAA2B,OAAA;AAC3B,2HAAA,gCAAgC,OAAA;AAChC,iHAAA,sBAAsB,OAAA;AACtB,qHAAA,0BAA0B,OAAA;AAC1B,6GAAA,kBAAkB,OAAA;AAClB,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,kHAAA,uBAAuB,OAAA;AACvB,gHAAA,qBAAqB,OAAA;AACrB,4GAAA,iBAAiB,OAAA;AACjB,gHAAA,qBAAqB,OAAA;AACrB,wHAAA,6BAA6B,OAAA;AAC7B,0HAAA,+BAA+B,OAAA;AAIjC,+CAA0E;AAAjE,qHAAA,qBAAqB,OAAA;AAAE,iHAAA,iBAAiB,OAAA"}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@aws/agentcore",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@aws/agentcore",
9
- "version": "0.14.1",
9
+ "version": "0.15.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "Apache-2.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/agentcore",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "CLI for Amazon Bedrock AgentCore",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -51,13 +51,14 @@
51
51
  "build:lib": "tsc -p tsconfig.build.json",
52
52
  "build:cli": "node esbuild.config.mjs",
53
53
  "build:assets": "node scripts/copy-assets.mjs",
54
+ "build:preview": "BUILD_PREVIEW=1 node esbuild.config.mjs",
54
55
  "build:harness": "BUILD_HARNESS=1 node esbuild.config.mjs",
55
56
  "cli": "npx tsx src/cli/index.ts",
56
- "typecheck": "tsc --noEmit",
57
- "lint": "eslint src/",
58
- "lint:fix": "eslint src/ --fix",
59
- "format": "prettier --write .",
60
- "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 .",
61
62
  "secrets:check": "secretlint '**/*'",
62
63
  "security:audit": "npm audit --audit-level=high --omit=dev",
63
64
  "clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
@@ -168,10 +169,10 @@
168
169
  },
169
170
  "lint-staged": {
170
171
  "*.{ts,tsx}": [
171
- "eslint --max-warnings=10"
172
+ "eslint --cache --max-warnings=10"
172
173
  ],
173
174
  "*.{ts,tsx,js,jsx,json,md,css,html,yml,yaml}": [
174
- "prettier --check"
175
+ "prettier --cache --check"
175
176
  ],
176
177
  "*": [
177
178
  "secretlint"
@@ -14,7 +14,12 @@
14
14
  * npm run bundle
15
15
  *
16
16
  * Environment variables:
17
- * AGENTCORE_CDK_PATH — absolute path to the agentcore-l3-cdk-constructs 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.
18
23
  */
19
24
  import { execFileSync } from 'node:child_process';
20
25
  import * as fs from 'node:fs';
@@ -83,7 +88,12 @@ log('Starting bundle process...');
83
88
 
84
89
  const now = new Date();
85
90
  const timestamp = now.toISOString().replace(/[-:T]/g, '').slice(0, 14);
86
- log(`Bundle timestamp: ${timestamp}`);
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}`);
87
97
 
88
98
  // Helper to bump a package version with a unique e2e timestamp tag.
89
99
  // Saves the original version so it can be restored after packing.
@@ -93,7 +103,7 @@ function bumpVersion(pkgDir) {
93
103
  const originalVersion = pkg.version;
94
104
  const baseVersion = originalVersion.split('-')[0];
95
105
  const prerelease = originalVersion.includes('-') ? originalVersion.split('-').slice(1).join('-') : '';
96
- const tag = prerelease ? `${prerelease}-${timestamp}` : timestamp;
106
+ const tag = prerelease ? `${prerelease}-${versionSuffix}` : versionSuffix;
97
107
  pkg.version = `${baseVersion}-${tag}`;
98
108
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + '\n');
99
109
  log(`Bumped ${pkg.name} version: ${originalVersion} -> ${pkg.version}`);
@@ -106,6 +116,18 @@ function restoreVersion({ pkgJsonPath, originalVersion }) {
106
116
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + '\n');
107
117
  }
108
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
+
109
131
  // Step 1: Resolve and build CDK constructs
110
132
  const cdkPath = resolveCdkPath();
111
133
 
@@ -156,10 +178,65 @@ try {
156
178
  const cliTarballName = `aws-agentcore-${cliVersionInfo.bumpedVersion}.tgz`;
157
179
  const cliTarballPath = path.join(cliRoot, cliTarballName);
158
180
 
159
- if (fs.existsSync(cliTarballPath)) {
160
- log(`Done! Tarball: ${cliTarballPath}`);
161
- log(`Install with: npm install -g ${cliTarballPath}`);
162
- log('When you run agentcore create, the bundled CDK constructs will be installed automatically.');
163
- } else {
164
- 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 };
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}`);
165
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.');