@aws/agentcore 0.3.0-preview.6.1 → 0.3.0-preview.8.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 (54) hide show
  1. package/README.md +11 -9
  2. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +19 -8
  3. package/dist/assets/agents/AGENTS.md +1 -1
  4. package/dist/assets/cdk/bin/cdk.ts +13 -7
  5. package/dist/assets/cdk/lib/cdk-stack.ts +1 -0
  6. package/dist/assets/cdk/test/cdk.test.ts +4 -0
  7. package/dist/cli/index.mjs +679 -346
  8. package/dist/lib/constants.d.ts +0 -1
  9. package/dist/lib/constants.d.ts.map +1 -1
  10. package/dist/lib/constants.js +0 -1
  11. package/dist/lib/constants.js.map +1 -1
  12. package/dist/lib/schemas/io/config-io.d.ts +2 -10
  13. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  14. package/dist/lib/schemas/io/config-io.js +0 -15
  15. package/dist/lib/schemas/io/config-io.js.map +1 -1
  16. package/dist/lib/schemas/io/path-resolver.d.ts +0 -5
  17. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -1
  18. package/dist/lib/schemas/io/path-resolver.js +0 -6
  19. package/dist/lib/schemas/io/path-resolver.js.map +1 -1
  20. package/dist/schema/schemas/agent-env.d.ts +10 -0
  21. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  22. package/dist/schema/schemas/agent-env.js +17 -1
  23. package/dist/schema/schemas/agent-env.js.map +1 -1
  24. package/dist/schema/schemas/agentcore-project.d.ts +400 -1
  25. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  26. package/dist/schema/schemas/agentcore-project.js +44 -1
  27. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  28. package/dist/schema/schemas/deployed-state.d.ts +173 -12
  29. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  30. package/dist/schema/schemas/deployed-state.js +23 -3
  31. package/dist/schema/schemas/deployed-state.js.map +1 -1
  32. package/dist/schema/schemas/mcp.d.ts +129 -353
  33. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  34. package/dist/schema/schemas/mcp.js +88 -18
  35. package/dist/schema/schemas/mcp.js.map +1 -1
  36. package/dist/schema/schemas/primitives/index.d.ts +2 -0
  37. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  38. package/dist/schema/schemas/primitives/index.js +7 -1
  39. package/dist/schema/schemas/primitives/index.js.map +1 -1
  40. package/dist/schema/schemas/primitives/online-eval-config.d.ts +1 -0
  41. package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
  42. package/dist/schema/schemas/primitives/online-eval-config.js +2 -0
  43. package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
  44. package/dist/schema/schemas/primitives/policy.d.ts +49 -0
  45. package/dist/schema/schemas/primitives/policy.d.ts.map +1 -0
  46. package/dist/schema/schemas/primitives/policy.js +62 -0
  47. package/dist/schema/schemas/primitives/policy.js.map +1 -0
  48. package/dist/schema/schemas/primitives/tags.d.ts +6 -0
  49. package/dist/schema/schemas/primitives/tags.d.ts.map +1 -0
  50. package/dist/schema/schemas/primitives/tags.js +27 -0
  51. package/dist/schema/schemas/primitives/tags.js.map +1 -0
  52. package/package.json +11 -4
  53. package/scripts/check-old-cli.lib.mjs +102 -0
  54. package/scripts/check-old-cli.mjs +6 -22
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Testable detection logic for the old Bedrock AgentCore Starter Toolkit.
3
+ *
4
+ * Each function accepts an `execSyncFn` so callers can inject a mock.
5
+ */
6
+
7
+ const INSTALLERS = [
8
+ { cmd: 'pip list', label: 'pip', uninstallCmd: 'pip uninstall bedrock-agentcore-starter-toolkit' },
9
+ { cmd: 'pipx list', label: 'pipx', uninstallCmd: 'pipx uninstall bedrock-agentcore-starter-toolkit' },
10
+ { cmd: 'uv tool list', label: 'uv', uninstallCmd: 'uv tool uninstall bedrock-agentcore-starter-toolkit' },
11
+ ];
12
+
13
+ /**
14
+ * Run a package-manager list command and check whether the old toolkit appears.
15
+ * Returns `{ installer, uninstallCmd }` when found, or `null`.
16
+ */
17
+ export function probeInstaller(cmd, label, uninstallCmd, execSyncFn) {
18
+ try {
19
+ const output = execSyncFn(cmd);
20
+ if (/^bedrock-agentcore-starter-toolkit\s/m.test(output)) {
21
+ return { installer: label, uninstallCmd };
22
+ }
23
+ } catch {
24
+ // Command not found or non-zero exit — ignore.
25
+ }
26
+ return null;
27
+ }
28
+
29
+ /**
30
+ * PATH-based fallback: locate an `agentcore` binary and check whether it's
31
+ * the old Python CLI (which doesn't support --version).
32
+ * Returns `{ installer, uninstallCmd }` when the old CLI is found, or `null`.
33
+ */
34
+ export function probePath(execSyncFn, platform = process.platform) {
35
+ const whichCmd = platform === 'win32' ? 'where agentcore' : 'command -v agentcore';
36
+ let binaryPath;
37
+ try {
38
+ binaryPath = execSyncFn(whichCmd).trim();
39
+ } catch {
40
+ return null; // no agentcore binary on PATH
41
+ }
42
+ // Skip binaries installed via npm/node — a broken new CLI install would also
43
+ // fail --version, and we don't want to block reinstallation.
44
+ if (/node_modules|[/\\]\.?(?:npm|nvm|fnm)[/\\]/.test(binaryPath)) {
45
+ return null;
46
+ }
47
+ try {
48
+ execSyncFn('agentcore --version');
49
+ return null; // --version succeeded — this is the new CLI
50
+ } catch {
51
+ // --version failed — likely the old Python CLI
52
+ return {
53
+ installer: 'PATH',
54
+ uninstallCmd: 'pip uninstall bedrock-agentcore-starter-toolkit',
55
+ };
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Probe pip, pipx, and uv for the old toolkit, then fall back to PATH-based
61
+ * detection. Returns an array of matches.
62
+ */
63
+ export function detectOldToolkit(execSyncFn) {
64
+ const results = [];
65
+ for (const { cmd, label, uninstallCmd } of INSTALLERS) {
66
+ const match = probeInstaller(cmd, label, uninstallCmd, execSyncFn);
67
+ if (match) results.push(match);
68
+ }
69
+ // If package-manager queries found nothing, fall back to PATH-based check
70
+ if (results.length === 0) {
71
+ const pathMatch = probePath(execSyncFn);
72
+ if (pathMatch) results.push(pathMatch);
73
+ }
74
+ return results;
75
+ }
76
+
77
+ /**
78
+ * Format a user-facing warning message listing per-installer uninstall commands.
79
+ */
80
+ export function formatWarningMessage(detected) {
81
+ const yellow = '\x1b[33m';
82
+ const bold = '\x1b[1m';
83
+ const reset = '\x1b[0m';
84
+ const lines = [
85
+ '',
86
+ `${bold}${yellow}╔══════════════════════════════════════════════════════════════════╗${reset}`,
87
+ `${bold}${yellow}║ WARNING: Old Bedrock AgentCore Starter Toolkit detected ║${reset}`,
88
+ `${bold}${yellow}╚══════════════════════════════════════════════════════════════════╝${reset}`,
89
+ '',
90
+ `${yellow}The old Starter Toolkit CLI uses the same "agentcore" command name.${reset}`,
91
+ `${yellow}To avoid confusion, please uninstall it:${reset}`,
92
+ '',
93
+ ];
94
+
95
+ for (const { installer, uninstallCmd } of detected) {
96
+ lines.push(`${yellow} ${uninstallCmd} # installed via ${installer}${reset}`);
97
+ }
98
+
99
+ lines.push('');
100
+
101
+ return lines.join('\n');
102
+ }
@@ -1,26 +1,10 @@
1
+ import { detectOldToolkit, formatWarningMessage } from './check-old-cli.lib.mjs';
1
2
  import { execSync } from 'node:child_process';
2
- import { platform } from 'node:os';
3
3
 
4
- try {
5
- // Check if an `agentcore` binary exists on PATH
6
- const whichCmd = platform() === 'win32' ? 'where agentcore' : 'command -v agentcore';
7
- execSync(whichCmd, { stdio: 'ignore' });
4
+ if (process.env.AGENTCORE_SKIP_CONFLICT_CHECK === '1') process.exit(0);
8
5
 
9
- // Binary exists check if it supports --version (the new CLI does, the old Python one does not)
10
- try {
11
- execSync('agentcore --version', { stdio: 'ignore' });
12
- } catch {
13
- // --version failed → likely the old Python CLI
14
- console.warn(
15
- [
16
- '',
17
- '\x1b[33m⚠ WARNING: We detected an older version of the AgentCore CLI.\x1b[0m',
18
- '\x1b[33mFor the best experience, we recommend uninstalling it using:\x1b[0m',
19
- '\x1b[33m pip uninstall bedrock-agentcore-starter-toolkit\x1b[0m',
20
- '',
21
- ].join('\n')
22
- );
23
- }
24
- } catch {
25
- // No agentcore binary found or unexpected error — nothing to do
6
+ const detected = detectOldToolkit(cmd => execSync(cmd, { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }));
7
+
8
+ if (detected.length > 0) {
9
+ console.warn(formatWarningMessage(detected));
26
10
  }