@go-to-k/cdkd 0.283.2 → 0.283.4

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.
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as configStringRefusal, $t as resolveStateBucketWithDefaultAndSource, A as green, An as NestedStackChildDirectDestroyError, At as BOOTSTRAP_MARKER_PREFIX, B as slowCcOperationTimeoutMs, Bt as runDockerForeground, C as MULTI_REGION_RECREATE_BLOCKED_TYPES, Ct as stringifyValue, D as bold, Dn as LocalStartServiceError, Dt as loadPublishableAssetManifest, E as formatResourceLine, En as LocalMigrateError, Et as createAssetRedirectResolver, F as clearOnUpdateRemoval, Fn as StackHasActiveImportsError, Ft as validateContainerRepoName, G as getAccountInfo, Gt as synthesisStatusMessage, H as isTerminationProtectionPropagationError, Hn as withErrorHandling, Ht as AssetManifestLoader, I as ProviderRegistry, In as StackTerminationProtectionError, It as buildDenyExternalAccessPolicy, J as normalizeAwsTagsToCfn, Jt as resolveApp, K as refStateLookupFromResource, Kt as getDefaultStateBucketName, L as findActionableSilentDrops, Lt as buildDockerImage, M as yellow, Mn as ProvisioningError, Mt as getBootstrapMarkerKey, N as IAMRoleProvider, Nn as ResourceTimeoutError, Nt as parseBootstrapMarker, O as cyan, Ot as rewriteTemplateAssetReferences, P as collectInlinePolicyNamesManagedBySiblings, Pn as ResourceUpdateNotSupportedError, Pt as validateAssetBucketName, Q as configBooleanRefusal, Qt as resolveStateBucketWithDefault, R as findSilentDropProperties, Rt as formatDockerLoginError, S as extractDeploymentEventError, St as AssetPublisher, T as renderStatefulReason, Tn as LocalInvokeBuildError$1, Tt as buildAssetRedirectMap, U as IntrinsicFunctionResolver, Ut as getDockerImageBySourceHash, V as disableInstanceApiTermination, Vn as normalizeAwsError, Vt as runDockerStreaming, W as cfnRefValueFromPhysicalId, Wt as Synthesizer, X as assertRegionMatch, Xt as resolveCaptureObservedState, Y as resolveExplicitPhysicalId, Yt as resolveAutoAssetStorage, Z as coerceCfnBoolean, Zt as resolveSkipPrefix, _ as createPreDeleteFinalSnapshot, _n as getAwsClients, _t as TemplateParser, a as DeploymentEventsStore, an as MIGRATE_TMP_PREFIX, at as s3BucketArn, b as unsupportedFinalSnapshotError, bt as rebuildClientForBucketRegion, c as replayFailedOperations, cn as expectedOwnerParam, ct as s3BucketRegionalDomainName, d as IMPLICIT_DELETE_DEPENDENCIES, dn as derivePartitionAndUrlSuffix, dt as DiffCalculator, en as resolveUseCdkBootstrapAssets, et as readConfigString, f as computeImplicitDeleteEdges, fn as AssemblyReader, ft as describeTypeWithThrottleRetry, g as ccRoutedFinalSnapshotError, gn as AwsClients, gt as DagBuilder, h as buildFinalSnapshotIdentifier, hn as resolveBucketRegion, ht as isThrottlingError, i as DeploymentEventsReader, in as CFN_TEMPLATE_URL_LIMIT, it as requireConfigString, j as red, jn as PartialFailureError, jt as ensureAssetStorage, k as gray, kn as MissingCdkCliError, kt as AssetModeResolver, l as replayRollback, ln as PARTITION_TABLE, lt as s3BucketWebsiteUrl, m as PRE_DELETE_SNAPSHOT_TYPES, mt as isRetryableTransientError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as warnDeprecatedNoPrefixCliFlag, nt as requireConfigArray, o as planFailedOps, on as findLargeInlineResources, ot as s3BucketDomainName, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as processStackMessages, pt as withRetry, q as WAFv2WebACLProvider, qt as getLegacyStateBucketName, r as DeployEngine, rn as CFN_TEMPLATE_BODY_LIMIT, rt as requireConfigObject, s as planRollback, sn as uploadCfnTemplate, st as s3BucketDualStackDomainName, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as stateBucketExistenceConfirmed, tt as replayWarn, u as withResourceDeadline, un as canonicalizeRegion, ut as applyRoleArnIfSet, v as isFinalSnapshotError, vn as resetAwsClients, vt as LockManager, w as isStatefulRecreateTargetSync, wn as DeployCancelledError, wt as WorkGraph, x as makeCanonicalizePropertiesFn, xn as CdkdError, xt as shouldRetainResource, y as refusesFinalSnapshot, yn as setAwsClients, yt as S3StateBackend, z as CloudControlProvider, zt as getDockerCmd } from "./deploy-engine-DuYBir2W.js";
2
+ import { $ as configStringRefusal, $t as resolveSkipPrefix, A as green, At as rewriteTemplateAssetReferences, B as slowCcOperationTimeoutMs, Bt as formatDockerLoginError, C as MULTI_REGION_RECREATE_BLOCKED_TYPES, Cn as CdkdError, Ct as shouldRetainResource, D as bold, Dn as LocalInvokeBuildError$1, Dt as buildAssetRedirectMap, E as formatResourceLine, En as DeployCancelledError, Et as WorkGraph, F as clearOnUpdateRemoval, Fn as ResourceTimeoutError, Ft as parseBootstrapMarker, G as getAccountInfo, Gt as getDockerImageBySourceHash, H as isTerminationProtectionPropagationError, Ht as runDockerForeground, I as ProviderRegistry, In as ResourceUpdateNotSupportedError, It as validateAssetBucketName, J as normalizeAwsTagsToCfn, Jt as getDefaultStateBucketName, K as refStateLookupFromResource, Kt as Synthesizer, L as findActionableSilentDrops, Ln as StackHasActiveImportsError, Lt as validateContainerRepoName, M as yellow, Mn as NestedStackChildDirectDestroyError, Mt as BOOTSTRAP_MARKER_PREFIX, N as IAMRoleProvider, Nn as PartialFailureError, Nt as ensureAssetStorage, O as cyan, On as LocalMigrateError, Ot as createAssetRedirectResolver, P as collectInlinePolicyNamesManagedBySiblings, Pn as ProvisioningError, Pt as getBootstrapMarkerKey, Q as configBooleanRefusal, Qt as resolveCaptureObservedState, R as findSilentDropProperties, Rn as StackTerminationProtectionError, Rt as buildDenyExternalAccessPolicy, S as extractDeploymentEventError, St as rebuildClientForBucketRegion, T as renderStatefulReason, Tt as stringifyValue, U as IntrinsicFunctionResolver, Un as normalizeAwsError, Ut as runDockerStreaming, V as disableInstanceApiTermination, Vt as getDockerCmd, W as cfnRefValueFromPhysicalId, Wn as withErrorHandling, Wt as AssetManifestLoader, X as assertRegionMatch, Xt as resolveApp, Y as resolveExplicitPhysicalId, Yt as getLegacyStateBucketName, Z as coerceCfnBoolean, Zt as resolveAutoAssetStorage, _ as createPreDeleteFinalSnapshot, _n as resolveBucketRegion, _t as markNonRetryable, a as DeploymentEventsStore, an as CFN_TEMPLATE_BODY_LIMIT, at as s3BucketArn, b as unsupportedFinalSnapshotError, bn as resetAwsClients, bt as LockManager, c as replayFailedOperations, cn as findLargeInlineResources, ct as s3BucketRegionalDomainName, d as IMPLICIT_DELETE_DEPENDENCIES, dn as PARTITION_TABLE, dt as DiffCalculator, en as resolveStateBucketWithDefault, et as readConfigString, f as computeImplicitDeleteEdges, fn as canonicalizeRegion, ft as describeTypeWithThrottleRetry, g as ccRoutedFinalSnapshotError, gt as isThrottlingError, h as buildFinalSnapshotIdentifier, hn as processStackMessages, ht as isRetryableTransientError, i as DeploymentEventsReader, in as warnDeprecatedNoPrefixCliFlag, it as requireConfigString, j as red, jn as MissingCdkCliError, jt as AssetModeResolver, k as gray, kn as LocalStartServiceError, kt as loadPublishableAssetManifest, l as replayRollback, ln as uploadCfnTemplate, lt as s3BucketWebsiteUrl, m as PRE_DELETE_SNAPSHOT_TYPES, mn as AssemblyReader, mt as isMarkedNonRetryable, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as resolveUseCdkBootstrapAssets, nt as requireConfigArray, o as planFailedOps, on as CFN_TEMPLATE_URL_LIMIT, ot as s3BucketDomainName, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as derivePartitionAndUrlSuffix, pt as withRetry, q as WAFv2WebACLProvider, qt as synthesisStatusMessage, r as DeployEngine, rn as stateBucketExistenceConfirmed, rt as requireConfigObject, s as planRollback, sn as MIGRATE_TMP_PREFIX, st as s3BucketDualStackDomainName, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as resolveStateBucketWithDefaultAndSource, tt as replayWarn, u as withResourceDeadline, un as expectedOwnerParam, ut as applyRoleArnIfSet, v as isFinalSnapshotError, vn as AwsClients, vt as DagBuilder, w as isStatefulRecreateTargetSync, wt as AssetPublisher, x as makeCanonicalizePropertiesFn, xn as setAwsClients, xt as S3StateBackend, y as refusesFinalSnapshot, yn as getAwsClients, yt as TemplateParser, z as CloudControlProvider, zt as buildDockerImage } from "./deploy-engine-C605sBVJ.js";
3
3
  import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, h as withStackName, i as runStackBuffered, m as withSkipPrefix, n as getLogger, o as PATTERN_B_NAME_OPTIONS, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-zRrlbaQt.js";
4
- import { t as ASGProvider } from "./asg-provider-Cl4ATw1l.js";
4
+ import { t as ASGProvider } from "./asg-provider-CZQewQcH.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
7
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -3032,7 +3032,8 @@ var IAMManagedPolicyProvider = class {
3032
3032
  this.logger.debug(`${reason} changed, replacing managed policy: ${physicalId} (${reason} mutation)`);
3033
3033
  const createResult = await this.create(logicalId, resourceType, properties);
3034
3034
  try {
3035
- await this.delete(logicalId, physicalId, resourceType, previousProperties);
3035
+ const deleteResult = await this.delete(logicalId, physicalId, resourceType, previousProperties);
3036
+ if (deleteResult?.outcome === "skipped") this.logger.warn(`Skipped deleting old managed policy ${physicalId} during replacement: ${deleteResult.reason}. The old policy may be orphaned and require manual cleanup.`);
3036
3037
  } catch (error) {
3037
3038
  this.logger.warn(`Failed to delete old managed policy ${physicalId} during replacement: ${String(error)}. The old policy may be orphaned and require manual cleanup.`);
3038
3039
  }
@@ -10399,11 +10400,16 @@ var SNSSubscriptionProvider = class {
10399
10400
  */
10400
10401
  async update(logicalId, physicalId, resourceType, properties, _previousProperties) {
10401
10402
  this.logger.debug(`Updating SNS subscription ${logicalId}: ${physicalId}`);
10403
+ let deleteResult = void 0;
10402
10404
  try {
10403
- await this.delete(logicalId, physicalId, resourceType);
10405
+ deleteResult = await this.delete(logicalId, physicalId, resourceType);
10404
10406
  } catch (error) {
10405
10407
  this.logger.warn(`Failed to delete old subscription ${physicalId} during update: ${String(error)}`);
10406
10408
  }
10409
+ if (deleteResult?.outcome === "skipped") {
10410
+ this.logger.warn(`Cannot replace SNS subscription ${logicalId}: the old subscription ${physicalId} was not deleted — ${deleteResult.reason}`);
10411
+ throw markNonRetryable(new ProvisioningError(`Cannot replace SNS subscription ${logicalId}: cdkd could not delete the old subscription, and creating the replacement would leave both subscribed to the topic and deliver every message twice. See the warning naming ${logicalId} for the recorded physical id and the cause. Repair the state record for ${logicalId}, or remove the old subscription in AWS if it is still live, then re-run.`, resourceType, logicalId, physicalId));
10412
+ }
10407
10413
  const createResult = await this.create(logicalId, resourceType, properties);
10408
10414
  return {
10409
10415
  physicalId: createResult.physicalId,
@@ -10439,6 +10445,27 @@ var SNSSubscriptionProvider = class {
10439
10445
  }
10440
10446
  /**
10441
10447
  * Log the CFn-parity skip for a pending-confirmation subscription delete.
10448
+ *
10449
+ * **Do NOT convert either caller into a `ResourceDeleteResult` skip** (the
10450
+ * issue [#1770](https://github.com/go-to-k/cdkd/issues/1770) sweep) — the
10451
+ * note lives here rather than only at `update()` because this is where a
10452
+ * future converter looks. Both arms mean the resource is GONE as far as the
10453
+ * stack is concerned: CloudFormation removes a pending-confirmation
10454
+ * subscription from the stack without unsubscribing, and the pending record
10455
+ * expires on its own, so `deleted` is the honest outcome and a skip would
10456
+ * preserve state and fail an otherwise-clean destroy for no reason.
10457
+ *
10458
+ * There is a second consequence, and it is why the warning is this loud:
10459
+ * `update()` ABORTS the DELETE-first replacement on a skip (issue
10460
+ * [#1778](https://github.com/go-to-k/cdkd/issues/1778)). Reporting a skip
10461
+ * here would therefore make every deploy of a subscription whose state
10462
+ * physicalId is the `PendingConfirmation` placeholder — reachable via
10463
+ * `cdkd import --resource <id>=PendingConfirmation` — throw permanently,
10464
+ * with no flag to force it, and `cdkd drift --revert` would fail the same
10465
+ * way. Exempting that placeholder from the abort was the alternative and
10466
+ * was rejected: it would duplicate this method's knowledge of the
10467
+ * placeholder inside `update()`, where a later change to the accepted set
10468
+ * would silently un-fence the abort.
10442
10469
  */
10443
10470
  logPendingConfirmationSkip(logicalId, physicalId) {
10444
10471
  this.logger.warn(`SNS subscription ${logicalId} (${physicalId}) is pending confirmation and cannot be unsubscribed; skipping deletion to match CloudFormation behavior (the pending record expires automatically within 3 days)`);
@@ -53511,7 +53538,7 @@ async function runDestroyForStack(stackName, state, ctx) {
53511
53538
  } catch (retryError) {
53512
53539
  lastDeleteError = retryError;
53513
53540
  const msg = retryError instanceof Error ? retryError.message : String(retryError);
53514
- if (!(isRetryableTransientError(retryError, msg) || msg.includes("Too Many Requests")) || attempt >= maxAttempts) break;
53541
+ if (!(!isMarkedNonRetryable(retryError) && (isRetryableTransientError(retryError, msg) || msg.includes("Too Many Requests"))) || attempt >= maxAttempts) break;
53515
53542
  const delay = 5e3 * Math.pow(2, attempt);
53516
53543
  logger.debug(` ⏳ Retrying delete ${logicalId} in ${delay / 1e3}s (attempt ${attempt + 1}/${maxAttempts})`);
53517
53544
  await new Promise((resolve) => setTimeout(resolve, delay));
@@ -54209,7 +54236,8 @@ var ACMCertificateProvider = class {
54209
54236
  this.logger.debug(`${changedImmutable} changed, replacing ACM certificate: ${physicalId}`);
54210
54237
  const createResult = await this.create(logicalId, resourceType, properties);
54211
54238
  try {
54212
- await this.delete(logicalId, physicalId, resourceType, previousProperties);
54239
+ const deleteResult = await this.delete(logicalId, physicalId, resourceType, previousProperties);
54240
+ if (deleteResult?.outcome === "skipped") this.logger.warn(`Skipped deleting old ACM certificate ${physicalId} during replacement: ${deleteResult.reason}. The old certificate may be orphaned and require manual cleanup.`);
54213
54241
  } catch (error) {
54214
54242
  this.logger.warn(`Failed to delete old ACM certificate ${physicalId} during replacement: ${String(error)}. The old certificate may be orphaned and require manual cleanup.`);
54215
54243
  }
@@ -67196,6 +67224,75 @@ function createLocalStateProvider$1(options, cdkdStackName, synthRegion) {
67196
67224
  return createLocalStateProvider(options, cdkdStackName, synthRegion, cdkdExtraStateProviders);
67197
67225
  }
67198
67226
 
67227
+ //#endregion
67228
+ //#region src/local/intrinsic-image.ts
67229
+ /**
67230
+ * Boundary shim over cdk-local's container-image intrinsic resolver for
67231
+ * `cdkd local invoke` / `start-api` / `run-task` — resolves the canonical
67232
+ * CDK 2.x `Fn::Join` shape for ECR image URIs (`lambda.DockerImageCode.fromEcr`
67233
+ * / ECS `ContainerImage.fromEcrRepository`) and the same-stack ECR `Fn::GetAtt`
67234
+ * Arn / RepositoryUri synthesis. The implementation lives in cdk-local and
67235
+ * cdkd consumes it instead of carrying a byte-identical copy.
67236
+ * `ImageResolutionContext` is re-exported as a type. See cdk-local's
67237
+ * `src/local/intrinsic-image.ts`.
67238
+ *
67239
+ * Two of the three symbols are bare re-exports. `derivePseudoParametersFromRegion`
67240
+ * is NOT: it is wrapped, for the reason below.
67241
+ */
67242
+ /**
67243
+ * Derive `${AWS::Region}` / `${AWS::AccountId}` / `${AWS::Partition}` /
67244
+ * `${AWS::URLSuffix}` for the `Fn::Join` `Code.ImageUri` path (issue #637),
67245
+ * with the region CANONICALIZED to its lower-case spelling first.
67246
+ *
67247
+ * ## Why this is a wrapper rather than a re-export
67248
+ *
67249
+ * Issue [#1795](https://github.com/go-to-k/cdkd/issues/1795) canonicalizes the
67250
+ * region inside `derivePartitionAndUrlSuffix` (`src/utils/aws-partition.ts`),
67251
+ * so every cdkd-OWNED region -> partition/suffix derivation inherits ONE
67252
+ * normalization point. This helper is a FOURTH derivation that the fix
67253
+ * structurally could not reach (issue
67254
+ * [#1814](https://github.com/go-to-k/cdkd/issues/1814)): the implementation is
67255
+ * cdk-local's, and it carries its own partition table whose prefix tests are
67256
+ * case-sensitive in the same direction. So an upper-cased `--region CN-NORTH-1`
67257
+ * still fell through to the commercial partition here and synthesized
67258
+ * `<acct>.dkr.ecr.CN-NORTH-1.amazonaws.com/...` — a `cn-` region carrying the
67259
+ * commercial suffix, a host that does not exist — at the five call sites, across
67260
+ * three files, that reach this symbol:
67261
+ *
67262
+ * - `src/cli/commands/local-start-api.ts` (the `Fn::Join` `Code.ImageUri` path)
67263
+ * - `src/cli/commands/local-invoke-agentcore.ts` (x3)
67264
+ * - `src/local/lambda-resolver.ts`
67265
+ *
67266
+ * The preferred fix is upstream — lower-casing the region inside cdk-local's
67267
+ * own implementation, which would keep exactly one normalization point. This
67268
+ * is the filed FALLBACK: a thin canonicalizing boundary over the re-export,
67269
+ * the same shape `docker-image-builder.ts` uses for its error-class boundary.
67270
+ * It stays correct if upstream later canonicalizes too, because
67271
+ * {@link canonicalizeRegion} is idempotent — double-folding is a no-op.
67272
+ *
67273
+ * Canonicalizing the INPUT (rather than post-processing the result) is what
67274
+ * makes this complete: the returned `region` is substituted as
67275
+ * `${AWS::Region}` into every ARN the resolver builds, so a raw upper-cased
67276
+ * value would misspell those too, not just the derived suffix.
67277
+ *
67278
+ * `undefined` passes through untouched — upstream answers `undefined` for a
67279
+ * missing region and that verdict is not this shim's to change.
67280
+ *
67281
+ * ## What this deliberately does NOT fix
67282
+ *
67283
+ * Case is only half the agreement between the two tables. cdk-local's table
67284
+ * predates the three rows cdkd's issue #1764 added, so `us-isof-` / `eu-isoe-` /
67285
+ * `eusc-` regions resolve COMMERCIAL here even when spelled canonically — a
67286
+ * table-COVERAGE divergence, orthogonal to case, filed as issue
67287
+ * [#1821](https://github.com/go-to-k/cdkd/issues/1821). Widening this wrapper
67288
+ * into a second partition authority would fix it, but that is a design call of
67289
+ * its own; the divergence is pinned by a unit case so it fails loudly rather
67290
+ * than staying latent.
67291
+ */
67292
+ function derivePseudoParametersFromRegion$1(region, accountId) {
67293
+ return derivePseudoParametersFromRegion(canonicalizeRegion(region), accountId);
67294
+ }
67295
+
67199
67296
  //#endregion
67200
67297
  //#region src/local/lambda-resolver.ts
67201
67298
  var LocalInvokeResolutionError = class LocalInvokeResolutionError extends Error {
@@ -67405,7 +67502,7 @@ function extractImageUri$1(value, logicalId, stackName, resources, region) {
67405
67502
  if (typeof sub === "string" && sub.length > 0) return sub;
67406
67503
  if (Array.isArray(sub) && typeof sub[0] === "string") return sub[0];
67407
67504
  if ("Fn::Join" in obj) {
67408
- const pseudoParameters = derivePseudoParametersFromRegion(region);
67505
+ const pseudoParameters = derivePseudoParametersFromRegion$1(region);
67409
67506
  const joinResolved = tryResolveImageFnJoin(value, resources, pseudoParameters ? { pseudoParameters } : void 0);
67410
67507
  if (joinResolved.kind === "resolved") return joinResolved.uri;
67411
67508
  if (joinResolved.kind === "needs-state") throw new LocalInvokeResolutionError(`Lambda '${logicalId}' in ${stackName} references same-stack ECR repository '${joinResolved.repoLogicalId}' via Fn::Join. cdkd local invoke cannot resolve the repository URI without state — deploy the stack first (so cdkd records the repository physical id), rebuild via lambda.DockerImageCode.fromImageAsset, or pin a public image.`);
@@ -71371,7 +71468,7 @@ function extractImageUri(value, logicalId, stackName, resources, region) {
71371
71468
  if (typeof sub === "string" && sub.length > 0) return sub;
71372
71469
  if (Array.isArray(sub) && typeof sub[0] === "string") return sub[0];
71373
71470
  if ("Fn::Join" in obj) {
71374
- const pseudoParameters = derivePseudoParametersFromRegion(region);
71471
+ const pseudoParameters = derivePseudoParametersFromRegion$1(region);
71375
71472
  const joinResolved = tryResolveImageFnJoin(value, resources, pseudoParameters ? { pseudoParameters } : void 0);
71376
71473
  if (joinResolved.kind === "resolved") return joinResolved.uri;
71377
71474
  if (joinResolved.kind === "needs-state") throw new Error(`Lambda '${logicalId}' in ${stackName} references same-stack ECR repository '${joinResolved.repoLogicalId}' via Fn::Join. cdkd local start-api cannot resolve the repository URI without state — deploy the stack first (so cdkd records the repository physical id), rebuild via lambda.DockerImageCode.fromImageAsset, or pin a public image.`);
@@ -73448,6 +73545,7 @@ async function localInvokeAgentCoreCommand(target, options) {
73448
73545
  const logger = getLogger();
73449
73546
  if (options.verbose) logger.setLevel("debug");
73450
73547
  warnIfDeprecatedRegion(options);
73548
+ if (options.region !== void 0) options.region = canonicalizeRegion(options.region);
73451
73549
  let containerId;
73452
73550
  let stopLogs;
73453
73551
  let sigintHandler;
@@ -73868,7 +73966,7 @@ async function buildSigV4HeadersIfRequested(options, resolved, loaded, host, por
73868
73966
  getLogger().warn(`Runtime '${resolved.logicalId}' declares a customJwtAuthorizer; --sigv4 ignored (JWT path takes precedence).`);
73869
73967
  return;
73870
73968
  }
73871
- const region = options.region ?? options.stackRegion ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? resolved.stack.region;
73969
+ const region = canonicalizeRegion(options.region ?? options.stackRegion ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? resolved.stack.region);
73872
73970
  if (!region) throw new CdkdError("--sigv4: no region resolved for the AgentCore signing scope. Pass --region <region>, set AWS_REGION, or use --from-cfn-stack with a region-bound stack.", "LOCAL_INVOKE_AGENTCORE_SIGV4_NO_REGION");
73873
73971
  const signed = await signAgentCoreInvocation({
73874
73972
  credentials: await resolveHostCredentialsForSigV4(options, resolved, loaded, region),
@@ -74014,7 +74112,7 @@ async function resolveAgentCoreCodeImageFromS3(resolved, code, s3Source, options
74014
74112
  key: s3Source.key,
74015
74113
  ...s3Source.versionId !== void 0 && { versionId: s3Source.versionId }
74016
74114
  };
74017
- const region = options.region ?? options.stackRegion ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? resolved.stack.region;
74115
+ const region = canonicalizeRegion(options.region ?? options.stackRegion ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? resolved.stack.region);
74018
74116
  const assumeRoleArn = resolveAssumeRoleArn(options, resolved, loaded);
74019
74117
  let credentials;
74020
74118
  if (assumeRoleArn) try {
@@ -74069,7 +74167,7 @@ async function buildContainerEnv(resolved, options, profileCredentials, profileC
74069
74167
  resources: imageContext?.stateResources ?? loaded.resources,
74070
74168
  consumerRegion: loaded.region
74071
74169
  };
74072
- const pseudo = imageContext?.pseudoParameters ?? derivePseudoParametersFromRegion(loaded.region);
74170
+ const pseudo = imageContext?.pseudoParameters ?? derivePseudoParametersFromRegion$1(loaded.region);
74073
74171
  if (pseudo) subContext.pseudoParameters = pseudo;
74074
74172
  if (imageContext?.stateParameters) subContext.parameters = imageContext.stateParameters;
74075
74173
  if (imageContext?.stateSensitiveParameters?.length) subContext.sensitiveParameters = new Set(imageContext.stateSensitiveParameters);
@@ -74125,7 +74223,7 @@ async function resolveFromS3BucketIntrinsic(resolved, stateProvider, loaded, ima
74125
74223
  resources: imageContext?.stateResources ?? loaded.resources,
74126
74224
  consumerRegion: loaded.region
74127
74225
  };
74128
- const pseudo = imageContext?.pseudoParameters ?? derivePseudoParametersFromRegion(loaded.region);
74226
+ const pseudo = imageContext?.pseudoParameters ?? derivePseudoParametersFromRegion$1(loaded.region);
74129
74227
  if (pseudo) subContext.pseudoParameters = pseudo;
74130
74228
  const crossStackResolver = await stateProvider.buildCrossStackResolver(loaded.region);
74131
74229
  if (crossStackResolver) subContext.crossStackResolver = crossStackResolver;
@@ -74153,7 +74251,7 @@ function describeIntrinsic(value) {
74153
74251
  */
74154
74252
  async function buildAgentCoreImageContext(candidate, stateProvider, options) {
74155
74253
  const logger = getLogger();
74156
- const region = options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? candidate.region;
74254
+ const region = canonicalizeRegion(options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? candidate.region);
74157
74255
  let accountId;
74158
74256
  try {
74159
74257
  accountId = await resolveCallerAccountId(region, options.profile);
@@ -74161,7 +74259,7 @@ async function buildAgentCoreImageContext(candidate, stateProvider, options) {
74161
74259
  logger.warn(`--from-cfn-stack: STS GetCallerIdentity failed: ${err instanceof Error ? err.message : String(err)}. A same-stack ECR image URI referencing \${AWS::AccountId} may not resolve.`);
74162
74260
  }
74163
74261
  const context = {};
74164
- const pseudo = derivePseudoParametersFromRegion(region, accountId);
74262
+ const pseudo = derivePseudoParametersFromRegion$1(region, accountId);
74165
74263
  if (pseudo) context.pseudoParameters = pseudo;
74166
74264
  const loaded = await stateProvider.load(candidate.stackName, candidate.region);
74167
74265
  if (loaded) {
@@ -74205,7 +74303,7 @@ async function applyAgentCoreCredentialEnv(dockerEnv, args) {
74205
74303
  const logger = getLogger();
74206
74304
  let assumeSucceeded = false;
74207
74305
  if (args.assumeRoleArn) {
74208
- const stsRegion = args.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"];
74306
+ const stsRegion = canonicalizeRegion(args.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"]);
74209
74307
  try {
74210
74308
  const creds = await assumeAgentCoreExecutionRole(args.assumeRoleArn, stsRegion);
74211
74309
  dockerEnv["AWS_ACCESS_KEY_ID"] = creds.accessKeyId;
@@ -76520,7 +76618,7 @@ function createMigrateCommand() {
76520
76618
  */
76521
76619
  function buildProgram() {
76522
76620
  const program = new Command();
76523
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.283.2");
76621
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.283.4");
76524
76622
  program.hook("preAction", (_thisCommand, actionCommand) => {
76525
76623
  const { profile } = actionCommand.optsWithGlobals();
76526
76624
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;