Skip to content

Commit 0274932

Browse files
chore: sync main with public/main
2 parents 6675ef0 + 12275c3 commit 0274932

10 files changed

Lines changed: 269 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.10.0] - 2026-04-23
6+
7+
### Added
8+
- feat: upgrade agent inspector to 0.2.1 (#937) (b49a06f)
9+
- feat: remove deployed/local from status legend (#936) (c0d5b7b)
10+
- feat: add GovCloud multi-partition support (#908) (098b104)
11+
- feat: support preview releases from feature branches (#905) (1a93f92)
12+
- feat: add AG-UI (AGUI) as fourth first-class protocol mode (#858) (52144dc)
13+
- feat: add session filesystem storage support (#893) (b97e337)
14+
15+
### Fixed
16+
- fix: agentcore add component opens component wizard directly (#896) (74a35cb)
17+
- fix: propagate sessionId as A2A contextId in Inspector proxy (#892) (08d452e)
18+
19+
### Documentation
20+
- docs: update vended AGENTS.md, README.md, and llm-context references (#898) (84a6dde)
21+
22+
### Other Changes
23+
- fix(deploy): honor aws-targets.json region for all SDK and CDK calls (#925) (1903f7d)
24+
- fix(invoke): show full session ID and print resume command on exit (#904) (ce683c0)
25+
- chore: remove preview bump type from release workflow (#847) (13f16d3)
26+
- chore: remove single-commit-must-match-PR-title validation (#897) (4d7da2f)
27+
- fix(invoke): pass session ID to local invoke log files (#894) (e966cb6)
28+
529
## [0.9.1] - 2026-04-17
630

731
## [0.9.0] - 2026-04-17

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aws/agentcore",
3-
"version": "0.9.1",
3+
"version": "0.10.0",
44
"description": "CLI for Amazon Bedrock AgentCore",
55
"license": "Apache-2.0",
66
"repository": {
@@ -86,7 +86,7 @@
8686
"@aws-sdk/client-sts": "^3.893.0",
8787
"@aws-sdk/client-xray": "^3.1003.0",
8888
"@aws-sdk/credential-providers": "^3.893.0",
89-
"@aws/agent-inspector": "0.1.0",
89+
"@aws/agent-inspector": "0.2.1",
9090
"@commander-js/extra-typings": "^14.0.0",
9191
"@opentelemetry/api": "^1.9.0",
9292
"@opentelemetry/otlp-transformer": "^0.213.0",

schemas/agentcore.schema.v1.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
},
143143
"protocol": {
144144
"type": "string",
145-
"enum": ["HTTP", "MCP", "A2A"]
145+
"enum": ["HTTP", "MCP", "A2A", "AGUI"]
146146
},
147147
"requestHeaderAllowlist": {
148148
"maxItems": 20,
@@ -280,6 +280,27 @@
280280
}
281281
},
282282
"additionalProperties": false
283+
},
284+
"filesystemConfigurations": {
285+
"type": "array",
286+
"items": {
287+
"type": "object",
288+
"properties": {
289+
"sessionStorage": {
290+
"type": "object",
291+
"properties": {
292+
"mountPath": {
293+
"type": "string",
294+
"pattern": "^\\/mnt\\/[^/]+$"
295+
}
296+
},
297+
"required": ["mountPath"],
298+
"additionalProperties": false
299+
}
300+
},
301+
"required": ["sessionStorage"],
302+
"additionalProperties": false
303+
}
283304
}
284305
},
285306
"required": ["name", "build", "entrypoint", "codeLocation"],
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import { applyTargetRegionToEnv, withTargetRegion } from '../target-region.js';
2+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
3+
4+
describe('target-region', () => {
5+
let savedRegion: string | undefined;
6+
let savedDefaultRegion: string | undefined;
7+
8+
beforeEach(() => {
9+
savedRegion = process.env.AWS_REGION;
10+
savedDefaultRegion = process.env.AWS_DEFAULT_REGION;
11+
delete process.env.AWS_REGION;
12+
delete process.env.AWS_DEFAULT_REGION;
13+
});
14+
15+
afterEach(() => {
16+
if (savedRegion !== undefined) process.env.AWS_REGION = savedRegion;
17+
else delete process.env.AWS_REGION;
18+
if (savedDefaultRegion !== undefined) process.env.AWS_DEFAULT_REGION = savedDefaultRegion;
19+
else delete process.env.AWS_DEFAULT_REGION;
20+
});
21+
22+
describe('applyTargetRegionToEnv', () => {
23+
it('sets AWS_REGION and AWS_DEFAULT_REGION to the provided region', () => {
24+
applyTargetRegionToEnv('ap-southeast-2');
25+
expect(process.env.AWS_REGION).toBe('ap-southeast-2');
26+
expect(process.env.AWS_DEFAULT_REGION).toBe('ap-southeast-2');
27+
});
28+
29+
it('returns a restore function that clears env vars when they were previously unset', () => {
30+
const restore = applyTargetRegionToEnv('eu-west-1');
31+
restore();
32+
expect(process.env.AWS_REGION).toBeUndefined();
33+
expect(process.env.AWS_DEFAULT_REGION).toBeUndefined();
34+
});
35+
36+
it('returns a restore function that restores previous env var values', () => {
37+
process.env.AWS_REGION = 'us-east-1';
38+
process.env.AWS_DEFAULT_REGION = 'us-east-1';
39+
40+
const restore = applyTargetRegionToEnv('ap-south-1');
41+
expect(process.env.AWS_REGION).toBe('ap-south-1');
42+
expect(process.env.AWS_DEFAULT_REGION).toBe('ap-south-1');
43+
44+
restore();
45+
expect(process.env.AWS_REGION).toBe('us-east-1');
46+
expect(process.env.AWS_DEFAULT_REGION).toBe('us-east-1');
47+
});
48+
49+
it('restores each env var independently (only one was previously set)', () => {
50+
process.env.AWS_REGION = 'us-west-2';
51+
// AWS_DEFAULT_REGION intentionally left unset
52+
53+
const restore = applyTargetRegionToEnv('eu-central-1');
54+
expect(process.env.AWS_REGION).toBe('eu-central-1');
55+
expect(process.env.AWS_DEFAULT_REGION).toBe('eu-central-1');
56+
57+
restore();
58+
expect(process.env.AWS_REGION).toBe('us-west-2');
59+
expect(process.env.AWS_DEFAULT_REGION).toBeUndefined();
60+
});
61+
});
62+
63+
describe('withTargetRegion', () => {
64+
it('applies region inside the callback and restores afterwards', async () => {
65+
let seenRegion: string | undefined;
66+
let seenDefaultRegion: string | undefined;
67+
68+
await withTargetRegion('ap-northeast-1', () => {
69+
seenRegion = process.env.AWS_REGION;
70+
seenDefaultRegion = process.env.AWS_DEFAULT_REGION;
71+
return Promise.resolve();
72+
});
73+
74+
expect(seenRegion).toBe('ap-northeast-1');
75+
expect(seenDefaultRegion).toBe('ap-northeast-1');
76+
expect(process.env.AWS_REGION).toBeUndefined();
77+
expect(process.env.AWS_DEFAULT_REGION).toBeUndefined();
78+
});
79+
80+
it('restores env vars even when the callback throws', async () => {
81+
process.env.AWS_REGION = 'us-east-1';
82+
83+
await expect(
84+
withTargetRegion('sa-east-1', () => {
85+
expect(process.env.AWS_REGION).toBe('sa-east-1');
86+
return Promise.reject(new Error('boom'));
87+
})
88+
).rejects.toThrow('boom');
89+
90+
expect(process.env.AWS_REGION).toBe('us-east-1');
91+
expect(process.env.AWS_DEFAULT_REGION).toBeUndefined();
92+
});
93+
94+
it('returns the callback result', async () => {
95+
const result = await withTargetRegion('eu-west-2', () => Promise.resolve(42));
96+
expect(result).toBe(42);
97+
});
98+
});
99+
});

src/cli/aws/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export { detectAwsContext, type AwsContext } from './aws-context';
22
export { detectAccount, getCredentialProvider } from './account';
33
export { getPartition, arnPrefix, dnsSuffix, serviceEndpoint, consoleDomain } from './partition';
44
export { detectRegion, type RegionDetectionResult } from './region';
5+
export { applyTargetRegionToEnv, withTargetRegion } from './target-region';
56
export {
67
invokeBedrockSync,
78
invokeClaude,

src/cli/aws/target-region.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Make a deployment target's region authoritative for downstream AWS SDK calls.
3+
*
4+
* The AWS SDK (and CDK toolkit-lib's internal clients) resolve region from
5+
* AWS_REGION / AWS_DEFAULT_REGION when constructed without an explicit `region`
6+
* option. aws-targets.json is the user's source of truth for where resources
7+
* should be created, so we promote the target's region onto the environment for
8+
* the operation and restore any prior values afterwards.
9+
*
10+
* Without this override, a user with a non-default region in aws-targets.json
11+
* but no AWS_DEFAULT_REGION set would see resources created in the SDK's default
12+
* region — see https://github.com/aws/agentcore-cli/issues/924.
13+
*/
14+
15+
type RestoreEnv = () => void;
16+
17+
/**
18+
* Set AWS_REGION / AWS_DEFAULT_REGION to `region` and return a restore function.
19+
* Callers that cannot wrap their work in a callback (e.g. CLI entrypoints that
20+
* span many helpers) should use this, and invoke the returned function in a
21+
* `finally` block.
22+
*/
23+
export function applyTargetRegionToEnv(region: string): RestoreEnv {
24+
const prevRegion = process.env.AWS_REGION;
25+
const prevDefaultRegion = process.env.AWS_DEFAULT_REGION;
26+
27+
process.env.AWS_REGION = region;
28+
process.env.AWS_DEFAULT_REGION = region;
29+
30+
return () => {
31+
if (prevRegion === undefined) {
32+
delete process.env.AWS_REGION;
33+
} else {
34+
process.env.AWS_REGION = prevRegion;
35+
}
36+
if (prevDefaultRegion === undefined) {
37+
delete process.env.AWS_DEFAULT_REGION;
38+
} else {
39+
process.env.AWS_DEFAULT_REGION = prevDefaultRegion;
40+
}
41+
};
42+
}
43+
44+
/**
45+
* Run `fn` with `region` applied to AWS_REGION / AWS_DEFAULT_REGION, restoring
46+
* the prior values on return (including when `fn` throws).
47+
*/
48+
export async function withTargetRegion<T>(region: string, fn: () => Promise<T>): Promise<T> {
49+
const restore = applyTargetRegionToEnv(region);
50+
try {
51+
return await fn();
52+
} finally {
53+
restore();
54+
}
55+
}

src/cli/commands/deploy/actions.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ConfigIO, SecureCredentials } from '../../../lib';
22
import type { AgentCoreMcpSpec, DeployedState } from '../../../schema';
3+
import { applyTargetRegionToEnv } from '../../aws';
34
import { validateAwsCredentials } from '../../aws/account';
45
import { createSwitchableIoHost } from '../../cdk/toolkit-lib';
56
import {
@@ -48,6 +49,7 @@ const MEMORY_ONLY_NEXT_STEPS = ['agentcore add agent', 'agentcore status'];
4849

4950
export async function handleDeploy(options: ValidatedDeployOptions): Promise<DeployResult> {
5051
let toolkitWrapper = null;
52+
let restoreEnv: (() => void) | null = null;
5153
const logger = new ExecLogger({ command: 'deploy' });
5254
const { onProgress } = options;
5355
let currentStepName = '';
@@ -79,6 +81,10 @@ export async function handleDeploy(options: ValidatedDeployOptions): Promise<Dep
7981
logPath: logger.getRelativeLogPath(),
8082
};
8183
}
84+
// Make the resolved target region authoritative for downstream SDK / CDK
85+
// calls that don't receive an explicit region option.
86+
// See https://github.com/aws/agentcore-cli/issues/924.
87+
restoreEnv = applyTargetRegionToEnv(target.region);
8288
endStep('success');
8389

8490
// Read project spec for gateway information (used later for deploy step name and outputs)
@@ -485,5 +491,6 @@ export async function handleDeploy(options: ValidatedDeployOptions): Promise<Dep
485491
if (toolkitWrapper) {
486492
await toolkitWrapper.dispose();
487493
}
494+
restoreEnv?.();
488495
}
489496
}

src/cli/operations/deploy/teardown.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CONFIG_DIR, ConfigIO } from '../../../lib';
22
import type { AwsDeploymentTarget } from '../../../schema';
3+
import { withTargetRegion } from '../../aws';
34
import { CdkToolkitWrapper, silentIoHost } from '../../cdk/toolkit-lib';
45
import { type DiscoveredStack, findStack } from '../../cloudformation/stack-discovery';
56
import { StackSelectionStrategy } from '@aws-cdk/toolkit-lib';
@@ -60,12 +61,18 @@ export async function destroyTarget(options: DestroyTargetOptions): Promise<void
6061
ioHost: silentIoHost,
6162
});
6263

63-
await toolkit.initialize();
64-
await toolkit.destroy({
65-
stacks: {
66-
strategy: StackSelectionStrategy.PATTERN_MUST_MATCH,
67-
patterns: [target.stack.stackName],
68-
},
64+
// aws-targets.json is authoritative for the destroy region; promote it onto
65+
// the env so CDK toolkit-lib's internal SDK clients hit the right region even
66+
// when AWS_REGION / AWS_DEFAULT_REGION are unset.
67+
// See https://github.com/aws/agentcore-cli/issues/924.
68+
await withTargetRegion(target.target.region, async () => {
69+
await toolkit.initialize();
70+
await toolkit.destroy({
71+
stacks: {
72+
strategy: StackSelectionStrategy.PATTERN_MUST_MATCH,
73+
patterns: [target.stack.stackName],
74+
},
75+
});
6976
});
7077

7178
// Clean up deployed-state.json after successful destroy

0 commit comments

Comments
 (0)