@cdkd/cli 0.345.0 → 0.347.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 (39) hide show
  1. package/dist/{ambient-client-defaults-w6GrD1cQ.js → ambient-client-defaults-BV_xDm4m.js} +11 -4
  2. package/dist/ambient-client-defaults-BV_xDm4m.js.map +1 -0
  3. package/dist/{asg-provider-CwaTAotW.js → asg-provider-fpr4ZEfp.js} +5 -5
  4. package/dist/{asg-provider-CwaTAotW.js.map → asg-provider-fpr4ZEfp.js.map} +1 -1
  5. package/dist/{aws-client-defaults-DP5k4Mfi.js → aws-client-defaults-DAebi99J.js} +13 -5
  6. package/dist/{aws-client-defaults-DP5k4Mfi.js.map → aws-client-defaults-DAebi99J.js.map} +1 -1
  7. package/dist/{aws-clients-CUCH-WCd.js → aws-clients-DOkPjjAW.js} +2 -2
  8. package/dist/{aws-clients-CUCH-WCd.js.map → aws-clients-DOkPjjAW.js.map} +1 -1
  9. package/dist/cli.js +2 -2
  10. package/dist/{db-instance-modify-retry-B8xFklWu.js → db-instance-modify-retry-BbBT68Qa.js} +3 -3
  11. package/dist/{db-instance-modify-retry-B8xFklWu.js.map → db-instance-modify-retry-BbBT68Qa.js.map} +1 -1
  12. package/dist/{deploy-engine-DtUOqlzH.js → deploy-engine-DMWjQ_C2.js} +316 -63
  13. package/dist/deploy-engine-DMWjQ_C2.js.map +1 -0
  14. package/dist/{ecr-uri-J5nIkfit.js → ecr-uri-C2FWGsrX.js} +3 -3
  15. package/dist/{ecr-uri-J5nIkfit.js.map → ecr-uri-C2FWGsrX.js.map} +1 -1
  16. package/dist/{iam-role-provider-B0hZvgwj.js → iam-role-provider-70-NzlFV.js} +5 -5
  17. package/dist/{iam-role-provider-B0hZvgwj.js.map → iam-role-provider-70-NzlFV.js.map} +1 -1
  18. package/dist/index.d.ts +8 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +4 -4
  21. package/dist/{neptune-provider-CyePVMKo.js → neptune-provider-CX4BHKjZ.js} +6 -6
  22. package/dist/{neptune-provider-CyePVMKo.js.map → neptune-provider-CX4BHKjZ.js.map} +1 -1
  23. package/dist/{program-CZXbWLai.js → program-BU5T28eB.js} +782 -399
  24. package/dist/program-BU5T28eB.js.map +1 -0
  25. package/dist/{provider-classes-BBiXFmPi.js → provider-classes-cw32hLq9.js} +101 -33
  26. package/dist/{provider-classes-BBiXFmPi.js.map → provider-classes-cw32hLq9.js.map} +1 -1
  27. package/dist/{rds-provider-DpJ8f3oK.js → rds-provider-CxSVX1d7.js} +485 -51
  28. package/dist/rds-provider-CxSVX1d7.js.map +1 -0
  29. package/dist/{read-replica-BxCCOKlu.js → read-replica-DtD9IDko.js} +5 -5
  30. package/dist/{read-replica-BxCCOKlu.js.map → read-replica-DtD9IDko.js.map} +1 -1
  31. package/dist/{update-removal-BjJh8h9m.js → update-removal-CpGaCv-d.js} +3 -3
  32. package/dist/{update-removal-BjJh8h9m.js.map → update-removal-CpGaCv-d.js.map} +1 -1
  33. package/dist/{version-BLMZsdJP.js → version-Bx-Ox9xU.js} +2 -2
  34. package/dist/{version-BLMZsdJP.js.map → version-Bx-Ox9xU.js.map} +1 -1
  35. package/package.json +3 -3
  36. package/dist/ambient-client-defaults-w6GrD1cQ.js.map +0 -1
  37. package/dist/deploy-engine-DtUOqlzH.js.map +0 -1
  38. package/dist/program-CZXbWLai.js.map +0 -1
  39. package/dist/rds-provider-DpJ8f3oK.js.map +0 -1
@@ -1,11 +1,11 @@
1
- import { t as getCdkdVersion } from "./version-BLMZsdJP.js";
1
+ import { t as getCdkdVersion } from "./version-Bx-Ox9xU.js";
2
2
  import { $ as STACK_REF_MAX_CODE_POINTS, F as derivesPatternBName, I as generateResourceName, J as withSkipPrefix, K as isNameGeneration, M as PATTERN_B_NAME_OPTIONS, N as PATTERN_B_NAME_PROPERTIES, P as PATTERN_B_RESOURCE_TYPES, Q as SECRET_REF_MAX_CODE_POINTS, S as coerceCfnBoolean, Y as withStackScope, Z as SAFE_MSG_ALTERED_CHAR, a as safeStringify, at as displaySafe, c as isStdoutReservedForPayload, dt as stringifyJsonPayload, et as UNRENDERABLE, f as runStackBuffered, ft as terminalSafe, h as getLiveRenderer, it as displayIdent, l as releaseStdoutForPayload, lt as plainIdentOr, n as describeAwsFailure, nt as cutMarker, ot as displayStackName, pt as truncateCodePoints, rt as displayAwsMessage, s as getLogger, st as isPasteableIdent, tt as asIsMessage, u as reserveStdoutForPayload, ut as safeMsg, v as explicitNamePropertyFor } from "./aws-failure-text-jomzO3aT.js";
3
- import { $a as applyRoleArnIfSet, $i as buildFinalSnapshotIdentifier, $l as isReadableBag, $n as updatePartialMessage, $r as DEFAULT_RESOURCE_TIMEOUT_MS, $s as malformedOutputsWarning, $t as NESTED_PENDING_PARENT_REASON, $u as runDockerForeground, A as PROTECTION_PROPERTY_BY_TYPE, Aa as RollbackInlinePolicyWriters, Ad as AssemblyReader, Ai as maskEventTextWithBoundBags, Al as recordPhysicalNameCopy, An as rollbackOrphanIds, Ao as recordedReferenceRegions, Ar as retiredNameGenerationsLeaving, As as refuseMalformedResourceEntriesForImport, Au as isCrossRegionRedirect, Bc as maskAtCoordinates, Bd as ownValue, Bl as wholeStringLeavesOf, Bn as propertiesChangedReason, Bo as unsettledItemsField, Br as exportAliasCollisionScrubWarning, Bs as refuseMalformedResourcePropertiesForOrphan, Bt as refactorMarkerRefusalMessage, Bu as describeDockerExecFailure, C as refusePendingMovesOut, Ca as withPrintingSecrets, Cc as findHandledUnwrittenCreateOnly, Cd as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, Ci as noEchoComparisonForTemplate, Cl as spelledKeysOf, Cn as DeploymentEventsStore, Co as isStalePlaceholderArnAttribute, Cr as removeProtectionTypeList, Cs as malformedLocalResourcesWarning, Cu as createAssetRedirectResolver, D as diffSecurity, Dc as NO_CC_HANDLERS_REASON, Dd as canonicalizeRegion, Di as createReadOnlyAttributeHealerFactory, Dn as findRefactorHints, Do as keepHeldTokenProvenance, Dr as nameScopeOf, Ds as refuseMalformedResourceEntries, Du as ensureAssetStorage, E as serviceTokenBlockingReason, Ed as PARTITION_TABLE, Ei as withAttemptedItemsMasked, El as inheritNestedStackParameterAssociations, En as formatDestructiveChange, Er as nameGenerationHighWaterOf, Es as refuseMalformedResourceAttributesForOrphan, Eu as AssetModeResolver, Fd as utf8ByteLength, Fl as recordMaskOnlyValue, Fn as differingRemedy, Fo as carriesDynamicReference, Fr as namesAnyDeclaredParameter, Fs as malformedDriftResourcePropertiesWarning, Ft as keptForRetainedRecord, Fu as validateContainerRepoName, Ga as DiffCalculator, Gc as noEchoLeavesOf, Gd as resolveAssemblyPath, Gi as PRE_DELETE_SNAPSHOT_TYPES, Gl as S3StateBackend, Gn as DELETED_RESOURCE_REMEDY, Go as findReplacedReadersOfRecreateTargets, Gr as exportNameNoEchoParameters, Gs as malformedOrphansWarning, Gu as dockerSpawnEnvWithSensitive, Hc as maskWholeValue, Hd as describeFileReadFailure, Hi as secretSegmentsOfState, Hl as isSingleDynamicReferenceToken, Hn as referencedLogicalIds, Ho as unsettledPropertiesOf, Hr as secretBearingStateKeyWarning, Hs as UNREADABLE_ORPHANS_CONTAINER_ROW, Ht as sameMove, Hu as redactedCause, Ic as DagBuilder, Id as defineOwnKey, Ii as secretNamedRecordNeedles, Il as recordMaskOnlyValuesIn, In as isPairableType, Io as keepsSecretReferenceToken, Ir as reachableDivergentParameters, Is as malformedResourcePropertiesWarning, It as recordRetainedForReadoption, Iu as BOOTSTRAP_MARKER_PREFIX, Ja as poisonRenderedSpellingsCollidingIn, Jc as readbackPathFor, Ji as effectiveDeletionPolicy, Jl as describeRegionValueKind, Jn as withUnprovenUnsettled, Jo as isStatefulRecreateTargetForReplace, Jr as noEchoParameterValueSeed, Js as repairMalformedOrphansForReadOnly, Ju as warnFinchArgvExposure, Ka as IntrinsicFunctionResolver, Kc as noEchoOutputsComparison, Kd as injectAwsRegion, Ki as ccRoutedFinalSnapshotError, Kl as splitImportedOps, Kn as recordAfterRollbackUpdate, Ko as shownType, Kr as exportNameSecretExposure, Ks as refuseMalformedOrphans, Kt as formatResourceLine, Ku as finchSecretArgvRefusal, Lc as TemplateParser, Ld as hasOwnKey, Li as stateSecretNameNeedles, Ll as recordNoEchoAttributeValues, Ln as looselyEqual, Lo as withSharedDrainBudget, Lr as resourcesNamingDeclaredParameter, Ls as refuseMalformedResourcePropertiesForDestroy, Lt as readRefactorMarker, Lu as buildDockerImage, M as perType, Ma as deleteIndeterminateGuards, Md as processStackMessages, Mi as orphanRecordsPrintingBag, Ml as splitGetAttStringForm, Mn as changedReferenceInDiff, Mo as isImpossibleEmptyStoredAttribute, Ms as refuseMalformedResourceEntriesForOrphan, Mt as withResourceDeadline, Mu as parseBootstrapMarker, N as readProtection, Na as deleteLeftInPlace, Nd as describeJsonParseFailure, Ni as secretNamePrintingBag, Nl as carriesSecretMask, Nn as changedReferencePath, No as carriesFetchableDynamicReference, Nr as inheritProducerRegions, Ns as repairMalformedResourceEntriesForReadOnly, Nt as IMPLICIT_DELETE_DEPENDENCIES, Nu as readBootstrapMarkerBody, O as recordedProtectionEvidence, Oa as setResolvedResourceTimeouts, Oc as hasNoCloudControlHandlers, Od as derivePartitionAndUrlSuffix, Oi as completedReplayEntries, Ol as physicalNameCopiesOf, On as hintSidesOf, Or as retiredAfterRollback, Os as refuseMalformedResourceEntriesForDeploy, Ou as buildDenyExternalAccessPolicy, Pa as deleteSkipReason, Pd as parseFailureDebugDetail, Pi as secretNamePrintingBags, Pl as provenPublicValue, Pn as changedReferenceReason, Po as isNamelessDynamicReferenceError, Pr as computeParameterTaint, Ps as unreadableResourceEntries, Pt as computeImplicitDeleteEdges, Pu as validateAssetBucketName, Qa as refuseUnreadableCdkCrossAccountRefs, Qc as liveMatchesUnresolvedTokenFrame, Qi as createPreDeleteFinalSnapshot, Ql as importableOutputs, Qn as undeclaredEmptyObservedKeys, Qr as bindingSkippedOutputs, Qs as malformedOutputsRefusalMessage, Qt as resolvePendingCloudControlRequests, Qu as getDockerCmd, Rc as canonicalCoordinates, Rd as hasPlainPrototype, Ri as storedSecretNameNeedles, Rl as recordNoEchoParameterFreshValue, Rn as mappingPairs, Ro as INTRINSIC_KEYS, Rr as WITHHELD_NAME_DISPLAY, Rs as refuseMalformedResourcePropertiesForDrift, Rt as readRefactorMarkerOnce, Ru as resolveDockerContextDirectory, S as pendingMovesRefusalMessage, Sc as findActionableSdkUnwired, Sd as uploadCfnTemplate, Si as noEchoAttributeNamesOf, Sl as isUncertifiedBaselineMaskPosition, Sn as DeploymentEventsReader, So as cfnRefValueFromPhysicalId, Sr as segmentCleanupOptions, Ss as malformedLocalResourceEntriesWarning, Su as buildAssetRedirectMap, T as findServiceTokenRefusals, Ta as CloudControlProvider, Tc as unwrittenCreateOnlyReplacement, Td as expectedOwnerParam, Ti as noEchoParameterNamesOf, Tl as identityKeyFor, Tn as findDestructiveChanges, To as refStateLookupFromResource, Tr as nameGenerationCarriedFrom, Ts as malformedScrubResourceEntriesRefusalMessage, Tu as rewriteTemplateAssetReferences, Uc as maskedLeafCoordinatesOf, Ud as displayAssemblyPath, Ui as withSecretPhysicalIdsMaskedInState, Ul as LockManager, Un as replayFailedOperations, Uo as withUnsettledProperties, Ur as secretSafeKeyDisplay, Us as hasReadableOrphans, Ut as updateRefactorMarker, Uu as redactedDockerCause, Vc as maskReadbackAtCoordinates, Vd as absoluteAssemblyPathEscape, Vl as WHOLE_DYNAMIC_REFERENCE_PATTERN, Vn as proposeRenames, Vo as unsettledItemsOf, Vr as secretBearing, Vs as repairMalformedResourcePropertiesForReadOnly, Vt as refuseRefactorMarker, Vu as describeDockerFailure, Wa as isWaitAbandonedError, Wc as noEchoCoordinatesOf, Wd as renderAssemblyPathEscape, Wi as ATOMIC_FINAL_SNAPSHOT_TYPES, Wl as isLockInfoExpired, Wn as replayRollback, Wo as withoutUnsettledProperties, Wr as carriedExportAliasExposure, Ws as malformedOrphansRefusalMessage, Wu as redactDockerArgvValues, Xa as resolveDynamicReferences, Xc as recordedNoEchoValuesOf, Xi as refusesFinalSnapshot, Xl as hasReadableExportSet, Xn as equalModuloMarkedMask, Xo as renderStatefulReason, Xr as collectPublishedOutputNames, Xs as malformedExportSourceWarning, Xu as isMalformedEnvKey, Yc as readsNoEchoSource, Yd as resolveBucketRegion, Yi as isFinalSnapshotError, Yl as exportNamesCarriedFrom, Yn as calculateResourceDrift, Yo as isStatefulRecreateTargetSync, Yr as collectDeclaredOutputNames, Ys as malformedExportNamesWarning, Yu as isDockerClientEnvKey, Za as producerLookupOver, Zc as valueAtCoordinate, Zi as unsupportedFinalSnapshotError, Zl as importableOutputKeys, Zn as equalModuloMask, Zr as isExportAliasCollision, Zs as malformedLocalOutputsWarning, Zt as pendingRequestCount, Zu as formatDockerLoginError, _ as listNestedTemplateRows, _a as applyCustomResourceResponseExpiration, _c as STATE_RESOURCES_MALFORMED, _d as ssmResolvedValueType, _i as cyan, _l as scrubResourceRecord, _n as loadJournaledOrphans, _r as findNestedStackTypeChanges, _s as refuseMalformedOrphansForOrphan, _u as withStackInstanceIdWithheld, a as scanActiveConsumers, ac as refuseDivergentRecordRegionForDestroy, ad as getDefaultStateBucketName, ai as withStackRecords, al as hasMaskableValues, an as recordDisplacedSkips, ao as AWS_CREDENTIAL_ENV_KEYS, as as withRetry, au as hasUnverifiableParameterRefusal, b as hasPendingMovesOut, ba as readsNoEchoDeleteValues, bc as hasReadableOutputs, bd as MIGRATE_TMP_PREFIX, bi as red, bl as DYNAMIC_REFERENCE_TOKEN_SCAN, bn as makeSiblingClaimReader, bo as parameterTypeMayLoseSecretIdentity, bs as unreadableOrphanRecords, bu as stringifyValue, c as inheritedProvenanceForChildDiff, cc as malformedStateRefusalMessage, cd as resolveApp, ci as holdsSupersededResources, cl as printingCorpusOf, cn as withNestedRevertRun, co as envCredentialsAreAssumedRole, cr as demoteSupersededOrphans, cs as declaresNoEcho, cu as timePhase, d as conditionInputsFrom, da as CC_BROKEN_REASON, dc as refuseMalformedResourcesForExport, dd as resolveSkipPrefix, di as supersededHeldByOtherTypeWarning, dl as shareLogOnlyValues, dn as withNestedStackContext, do as producerRegionsFromState, dr as planFailedOps, ds as malformedOrphanRecordsRefusalMessage, du as CrossPrefixScanCache, ed as runDockerStreaming, ei as DEFAULT_RESOURCE_WARN_AFTER_MS, el as redactForState, en as displacedOpClause, eo as assertFlagRoleArn, er as updatePartialReason, eu as orphansAfterRollback, f as parentSuppliedValues, fa as ProviderRegistry, fc as refuseMalformedState, fd as resolveStateBucketWithDefault, fi as supersededHolderOf, fl as unionOfSecretBags, fn as deleteJournaledOrphans, fo as regionLessSecretName, fr as recheckFailedPlan, fs as malformedOrphanRecordsWarning, fu as applyCrossPrefixScan, g as isAbsoluteAssetPath, ga as CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID, gc as withheldAccountClause, gd as warnDeprecatedNoPrefixCliFlag, gi as bold, gl as maskSecretsInText, gn as journaledOrphanLines, gr as withPreviousPolicies, gs as refuseMalformedOrphanRecordsForDestroy, gu as stackInstanceIdOf, h as findNestedTemplateTreeDefect, ha as wouldReturnToSdkProvider, hc as accountArgs, hd as stateBucketExistenceConfirmed, hl as maskSecretsInError, hn as isHandledOrphan, hr as resolveReplacementOldType, hs as refuseMalformedOrphanRecords, hu as isNotImplemented, i as mergeNoChangeOutputs, ic as STATE_REGION_DIVERGED, id as synthesisStatusMessage, il as createUnionSecretMasker, in as nestedChildStackName$1, io as sendableAssumeRoleCommand, ir as withCreateTokenLedger, is as describeTypeWithThrottleRetry, iu as hasReasonlessBaselineRefusal, j as isProtectionValueActive, ja as UNSPECIFIED_SKIP_REASON, jd as StageLoadError, ji as namingSecretsWithRecordedNoEcho, jl as recordNestedStackParameterExpressions, jn as withMovedTo, jo as getAccountInfo, jr as withNameGenerationReached, js as refuseMalformedResourceEntriesForImportSave, ju as getBootstrapMarkerKey, k as recordedProtectionNote, ka as slowCcOperationTimeoutMs, kd as refuseFailedLookups, ki as journaledOrphanPrintingBag, kn as movedToHint, ko as recordedOutputReferenceRegions, kr as retiredNameGenerationsAfter, ks as refuseMalformedResourceEntriesForDestroy, ku as assertAssetBucketRegion, l as makeCanonicalizePropertiesFn, lc as refuseMalformedResourcesForDeploy, ld as resolveAutoAssetStorage, li as isSupersededResourceRecord, ll as recordLogOnlyParameterValue, ln as collectNestedChildUnaddressed, lo as classifyRecordedSecretRegion, lr as isJournaledOrphan, ls as deployRefusesOrphanRowsReason, lu as rebuildClientForBucketRegion, m as childTemplateLoader, ma as isCustomResource, mc as JSON_LISTING_HOLE_VALUE, md as resolveUseCdkBootstrapAssets, mi as withoutSuperseded, ml as errorCauseChain, mn as dropFailedHint, mr as replacementNeverSwapped, ms as previewableOrphanRecords, mu as isAccessDenied, n as isSecretBearingReferenceString, nc as refuseMalformedOutputsForDestroy, nd as getDockerImageBySourceHash, nn as dropSettledNestedJournals, no as explicitRoleArnOrThrow, nr as ledgerForStack, ns as prefetchCreateOnlyPropertyPaths, nu as shouldRetainResource, o as inRunStackKey, oc as malformedRenderedContainersWarning, od as getLegacyStateBucketName, ol as literalSplitDelimitersOf, oo as applyCallerIdentityCredentials, or as planRollback, os as parameterInputsFor, ou as PhaseClock, p as readRecordedConditionVerdicts, pa as ccBrokenReason, pc as repairMalformedResourcesForReadOnly, pd as resolveStateBucketWithDefaultAndSource, pi as supersededResourcesOf, pl as createSecretMasker, pn as dropFailedCommands, pr as recordUnderIdIsNotOwn, ps as malformedOrphanRowsKeptWarning, pu as crossPrefixDeniedWarning, qa as isAlwaysLiveAttribute, qd as injectedAwsRegionValue, qi as ccRoutedInstanceTakesNoSnapshot, ql as acceptedCreateOnlyDropsOf, qn as settleUnsettledPrevious, qo as MULTI_REGION_RECREATE_BLOCKED_TYPES, qr as isWholeDynamicReferenceValue, qs as refuseMalformedOrphansForDestroy, qu as partitionSensitiveEnv, r as keptWholeReasonText, rc as repairMalformedOutputsForReadOnly, rd as Synthesizer, ri as destroyStackRecordsView, rl as carryLogOnlyValues, ro as isIamRoleArn, rs as templateResourceTypes, ru as stackInstanceIdCarriedFrom, s as crossStackOutputProvenanceSource, sc as malformedResourcesWarning, sd as loadCdkJson, si as deleteSupersededEntry, sl as logOnlyValueCount, sn as revertedNestedRowIds, so as callerEnvCredentials, sr as seedsDeleteFirstGuard, su as renderPhaseTimings, t as DeployEngine, tc as refuseMalformedOutputs, td as AssetManifestLoader, ti as maskingRetryLogger, tn as displacedPhysicalIdShown, to as assertSendableRoleArn, tu as orphansCarriedFrom, u as conditionFingerprint, uc as refuseMalformedResourcesForDestroy, ud as resolveCaptureObservedState, ui as supersededAfterRollback, ul as recordLogOnlyValue, un as getCurrentNestedStackContext, uo as classifyReplaySecretRegion, ur as isReplacementOrphan, us as isReadableOrphanRecord, uu as CrossPrefixReadError, v as renderNestedTemplateTreeDefect, va as customResourceResponseExpirationWarning, vc as UNREADABLE_RESOURCES_MAP_ROW, vd as CFN_TEMPLATE_BODY_LIMIT, vi as gray, vl as withPhysicalNameCopies, vn as sameJournaledOrphans, vo as coerceParameterTypedValue, vs as repairMalformedOrphanRecordsForReadOnly, vu as AssetPublisher, w as deferredServiceTokenWarning, wd as decodeListingKey, wi as noEchoExactEchoLeavesOf, wl as pathCrossesDottedKey, wn as constructPathOf$1, wo as lacksRecordedTableArn, wr as orphanNeedsIdentity, ws as malformedResourceEntriesWarning, wu as loadPublishableAssetManifest, x as pendingMovesOutOf, xa as isCustomResourceType$1, xc as hasReadableResources, xd as findLargeInlineResources, xi as yellow, xl as dynamicReferenceTokens, xn as planOrphanAdoption, xo as AWS_NO_VALUE, xs as isReadableResourceEntry, xu as WorkGraph, y as templateIdentity, ya as TemplateNoEchoReresolver, yc as displayLogicalId, yd as CFN_TEMPLATE_URL_LIMIT, yi as green, yn as makeForeignHolderScan, yo as isUnboundTemplateParameter, ys as unpreviewableOrphanRecords, yu as isSensitiveAttributeName, zc as isMarkedCoordinate, zd as nullPrototypeRecord, zi as extractDeploymentEventError, zl as recordProvenPublicExpression, zn as parseMappingFile, zr as displayTextOrWithheld, zs as refuseMalformedResourcePropertiesForExport, zt as refactorMarkerMovesOf, zu as describeDockerCapturedOutput } from "./deploy-engine-DtUOqlzH.js";
4
- import { $ as CdkdError, A as stripControlChars, B as retryClassificationText, Ct as setPasteableRunFlags, F as isAmbiguousOutcomeError, H as isMarkedNonRetryable, J as DynamicReferenceRegionAmbiguousError, R as isRetryableTransientError, St as withheldTargetClause, U as isThrottlingError, W as markNonRetryable, X as MalformedProducerRecordRefusalError, Y as IntrinsicResolutionRefusalError, Z as AccountIdUnavailableError, _ as ResourceUpdateNotSupportedError, a as normalizeAwsError, at as ResourceTimeoutError, bt as shellBoundedDisplay, dt as SHELL_ACTIVE_WHY, et as DeployCancelledError, g as PartialFailureError, gt as pasteableCommand, h as NestedStackChildDirectDestroyError, ht as isInertUnquoted, i as credentialFingerprint, it as ProvisioningError, j as stripForDisplay, k as escapeRegExp, l as withErrorHandling, lt as TIMEOUT_FLAG_RESOURCE_TYPE, n as ambientCredentialConfig, nt as LocalInvokeBuildError$1, o as formatError, ot as StateError, pt as commandHole, q as CrossAccountSecretRefusalError, r as clientDefaultsFor, s as handleError, st as SynthesisError, t as ambientClientDefaults, u as LocalStartServiceError, v as StackHasActiveImportsError, vt as plainOrDescribed, wt as setPasteableVerbFlags, xt as shellQuote, y as StackTerminationProtectionError, yt as quotedOrDescribed, z as isTransientServerError } from "./ambient-client-defaults-w6GrD1cQ.js";
5
- import { $t as forceQuitRecoveryClause, Dt as logicalIdShown, H as assertRegionMatch, M as VALUE_NOT_SHOWN, Qt as buildLockContentionMessage, U as isMarkedNotGone, V as RESOURCE_NOT_FOUND, Xt as UNREPRODUCIBLE_LOCK_CLAUSE, Zt as buildForceUnlockCommand, an as CUSTOM_RESOURCE_RESPONSE_PREFIX, bt as interruptWatchListenerCount, dn as setPasteableAwsCaBundle, en as formatLockExpiry, fn as setPasteableAwsProfile, kt as resourceTypeShown, ln as producerCoordinateKey, m as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, mt as isAwsCliLiteral, nn as formatLockOwner, on as DEFAULT_STATE_PREFIX, p as IAM_PRINCIPAL_NAME, pn as withPasteableAwsProfile, sn as injectiveKey, st as runDeleteAttempt, tn as formatLockOperation, un as producerRecordKey, vt as beginCommandInterruptScope, xt as isInterruptedWaitError, y as readRecordedPrincipals, yt as endCommandInterruptScope, z as remedyLogicalId } from "./update-removal-BjJh8h9m.js";
6
- import { a as runWithStackAwsClients, i as resetAwsClients, l as s3ClientDefaults, o as setAwsClients, s as resolveS3ClientDefaults, t as AwsClients, u as setS3ClientDefaultsDebugLog } from "./aws-clients-CUCH-WCd.js";
7
- import { a as getAssumedRoleCredentials, c as setAwsEndpointOverrideSource, m as formatAuthority, n as awsClientDefaults, o as getPreAssumeEnvCredentials, p as runInStackAwsScope, s as setAssumedRoleCredentials } from "./aws-client-defaults-DP5k4Mfi.js";
8
- import { a as parseEcrRegistryHost, i as looksLikeEcrHostWithForeignSuffix, n as hasEcrRegistryHostLabels, t as ecrRegistryHostPattern } from "./ecr-uri-J5nIkfit.js";
3
+ import { $a as poisonRenderedSpellingsCollidingIn, $d as injectedAwsRegionValue, $i as isFinalSnapshotError, $l as describeRegionValueKind, $n as updatePartialMessage, $o as MULTI_REGION_RECREATE_BLOCKED_TYPES, $r as DEFAULT_RESOURCE_TIMEOUT_MS, $s as refuseMalformedOrphansForDestroy, $t as NESTED_PENDING_PARENT_REASON, $u as warnFinchArgvExposure, A as PROTECTION_PROPERTY_BY_TYPE, Ad as expectedOwnerParam, Ai as withAttemptedItemsMasked, Al as identityKeyFor, An as rollbackOrphanIds, Ao as lacksRecordedTableArn, Ar as retiredNameGenerationsLeaving, As as malformedResourceEntriesWarning, Au as rewriteTemplateAssetReferences, Bd as utf8ByteLength, Bi as secretNamedRecordNeedles, Bl as recordMaskOnlyValue, Bn as propertiesChangedReason, Bo as isNamelessDynamicReferenceError, Br as exportAliasCollisionScrubWarning, Bs as unreadableResourceEntries, Bt as refactorMarkerRefusalMessage, Bu as validateContainerRepoName, C as refusePendingMovesOut, Ca as TemplateNoEchoReresolver, Cc as STATE_RESOURCES_MALFORMED, Cd as CFN_TEMPLATE_BODY_LIMIT, Ci as green, Cl as withPhysicalNameCopies, Cn as DeploymentEventsStore, Cr as removeProtectionTypeList, Cs as refuseMalformedOrphansForOrphan, Cu as AssetPublisher, D as diffSecurity, Da as withPrintingSecrets, Dc as hasReadableResources, Dd as uploadCfnTemplate, Di as noEchoComparisonForTemplate, Dl as isUncertifiedBaselineMaskPosition, Dn as findRefactorHints, Do as AWS_NO_VALUE, Dr as nameScopeOf, Ds as isReadableResourceEntry, Du as buildAssetRedirectMap, E as serviceTokenBlockingReason, Ec as hasReadableOutputs, Ed as findLargeInlineResources, Ei as noEchoAttributeNamesOf, El as dynamicReferenceTokens, En as formatDestructiveChange, Eo as parameterTypeMayLoseSecretIdentity, Er as nameGenerationHighWaterOf, Es as unreadableOrphanRecords, Eu as WorkGraph, Fa as UNSPECIFIED_SKIP_REASON, Fd as AssemblyReader, Fi as namingSecretsWithRecordedNoEcho, Fl as recordPhysicalNameCopy, Fn as differingRemedy, Fo as recordedOutputReferenceRegions, Fr as namesAnyDeclaredParameter, Fs as refuseMalformedResourceEntriesForDestroy, Ft as keptForRetainedRecord, Fu as isCrossRegionRedirect, Gc as isMarkedCoordinate, Gd as ownValue, Gl as wholeStringLeavesOf, Gn as DELETED_RESOURCE_REMEDY, Gr as exportNameNoEchoParameters, Gs as refuseMalformedResourcePropertiesForExport, Gu as describeDockerExecFailure, Hc as DagBuilder, Hd as hasOwnKey, Hi as storedSecretNameNeedles, Hl as recordNoEchoAttributeValues, Hn as referencedLogicalIds, Ho as keepsSecretReferenceToken, Hr as secretBearingStateKeyWarning, Hs as malformedResourcePropertiesWarning, Ht as sameMove, Hu as buildDockerImage, Ia as deleteIndeterminateGuards, Id as StageLoadError, Ii as orphanRecordsPrintingBag, Il as recordNestedStackParameterExpressions, In as isPairableType, Io as recordedReferenceRegions, Ir as reachableDivergentParameters, Is as refuseMalformedResourceEntriesForImport, It as recordRetainedForReadoption, Iu as getBootstrapMarkerKey, Ja as isWaitAbandonedError, Jc as maskWholeValue, Jd as displayAssemblyPath, Ji as ATOMIC_FINAL_SNAPSHOT_TYPES, Jl as LockManager, Jn as withUnprovenUnsettled, Jo as unsettledPropertiesOf, Jr as noEchoParameterValueSeed, Js as UNREADABLE_ORPHANS_CONTAINER_ROW, Ju as redactedDockerCause, Kc as maskAtCoordinates, Kd as absoluteAssemblyPathEscape, Ki as secretSegmentsOfState, Kl as WHOLE_DYNAMIC_REFERENCE_PATTERN, Kn as recordAfterRollbackUpdate, Ko as unsettledItemsField, Kr as exportNameSecretExposure, Ks as refuseMalformedResourcePropertiesForOrphan, Kt as formatResourceLine, Ku as describeDockerFailure, La as deleteLeftInPlace, Ld as processStackMessages, Li as secretNamePrintingBag, Ll as splitGetAttStringForm, Ln as looselyEqual, Lo as getAccountInfo, Lr as resourcesNamingDeclaredParameter, Ls as refuseMalformedResourceEntriesForImportSave, Lt as readRefactorMarker, Lu as parseBootstrapMarker, M as perType, Ma as setResolvedResourceTimeouts, Md as canonicalizeRegion, Mi as completedReplayEntries, Mn as changedReferenceInDiff, Ms as refuseMalformedResourceAttributesForOrphan, Mt as withResourceDeadline, Mu as ensureAssetStorage, N as readProtection, Na as slowCcOperationTimeoutMs, Nc as NO_CC_HANDLERS_REASON, Nd as derivePartitionAndUrlSuffix, Ni as journaledOrphanPrintingBag, Nl as physicalNameCopiesOf, Nn as changedReferencePath, No as keepHeldTokenProvenance, Nr as inheritProducerRegions, Ns as refuseMalformedResourceEntries, Nt as IMPLICIT_DELETE_DEPENDENCIES, Nu as buildDenyExternalAccessPolicy, O as recordedProtectionEvidence, Oc as findActionableSdkUnwired, Od as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, Oi as noEchoExactEchoLeavesOf, Ol as spelledKeysOf, On as hintSidesOf, Oo as cfnRefValueFromPhysicalId, Or as retiredAfterRollback, Os as malformedLocalResourceEntriesWarning, Ou as createAssetRedirectResolver, Pa as RollbackInlinePolicyWriters, Pc as hasNoCloudControlHandlers, Pd as refuseFailedLookups, Pi as maskEventTextWithBoundBags, Pn as changedReferenceReason, Pr as computeParameterTaint, Ps as refuseMalformedResourceEntriesForDeploy, Pt as computeImplicitDeleteEdges, Pu as assertAssetBucketRegion, Qa as isAlwaysLiveAttribute, Qc as noEchoOutputsComparison, Qd as injectAwsRegion, Qi as effectiveDeletionPolicy, Ql as acceptedCreateOnlyDropsOf, Qn as undeclaredEmptyObservedKeys, Qo as shownType, Qr as bindingSkippedOutputs, Qs as refuseMalformedOrphans, Qt as resolvePendingCloudControlRequests, Qu as partitionSensitiveEnv, Ra as deleteSkipReason, Rd as describeJsonParseFailure, Ri as secretNamePrintingBags, Rl as carriesSecretMask, Rn as mappingPairs, Ro as isImpossibleEmptyStoredAttribute, Rr as WITHHELD_NAME_DISPLAY, Rs as refuseMalformedResourceEntriesForOrphan, Rt as readRefactorMarkerOnce, Ru as readBootstrapMarkerBody, S as pendingMovesRefusalMessage, Sa as customResourceResponseExpirationWarning, Sc as withheldAccountClause, Sd as ssmResolvedValueType, Si as gray, Sl as scrubResourceRecord, Sn as DeploymentEventsReader, Sr as segmentCleanupOptions, Ss as refuseMalformedOrphanRecordsForDestroy, Su as withStackInstanceIdWithheld, T as findServiceTokenRefusals, Ta as isCustomResourceType$1, Tc as displayLogicalId, Td as MIGRATE_TMP_PREFIX, Ti as yellow, Tl as DYNAMIC_REFERENCE_TOKEN_SCAN, Tn as findDestructiveChanges, To as isUnboundTemplateParameter, Tr as nameGenerationCarriedFrom, Ts as unpreviewableOrphanRecords, Tu as stringifyValue, Uc as TemplateParser, Ud as hasPlainPrototype, Ui as extractDeploymentEventError, Ul as recordNoEchoParameterFreshValue, Un as replayFailedOperations, Uo as withSharedDrainBudget, Ur as secretSafeKeyDisplay, Us as refuseMalformedResourcePropertiesForDestroy, Ut as updateRefactorMarker, Uu as resolveDockerContextDirectory, Vd as defineOwnKey, Vi as stateSecretNameNeedles, Vl as recordMaskOnlyValuesIn, Vn as proposeRenames, Vo as carriesDynamicReference, Vr as secretBearing, Vs as malformedDriftResourcePropertiesWarning, Vt as refuseRefactorMarker, Vu as BOOTSTRAP_MARKER_PREFIX, Wc as canonicalCoordinates, Wd as nullPrototypeRecord, Wl as recordProvenPublicExpression, Wn as replayRollback, Wo as INTRINSIC_KEYS, Wr as carriedExportAliasExposure, Ws as refuseMalformedResourcePropertiesForDrift, Wu as describeDockerCapturedOutput, Xa as IntrinsicFunctionResolver, Xc as noEchoCoordinatesOf, Xd as resolveAssemblyPath, Xi as ccRoutedFinalSnapshotError, Xl as S3StateBackend, Xn as equalModuloMarkedMask, Xo as withoutUnsettledProperties, Xr as collectPublishedOutputNames, Xs as malformedOrphansRefusalMessage, Xu as dockerSpawnEnvWithSensitive, Ya as DiffCalculator, Yc as maskedLeafCoordinatesOf, Yd as renderAssemblyPathEscape, Yi as PRE_DELETE_SNAPSHOT_TYPES, Yl as isLockInfoExpired, Yn as calculateResourceDrift, Yo as withUnsettledProperties, Yr as collectDeclaredOutputNames, Ys as hasReadableOrphans, Yu as redactDockerArgvValues, Za as isSelectOutOfBounds, Zc as noEchoLeavesOf, Zd as setChildProcessAwsEnv, Zi as ccRoutedInstanceTakesNoSnapshot, Zl as splitImportedOps, Zn as equalModuloMask, Zo as findReplacedReadersOfRecreateTargets, Zr as isExportAliasCollision, Zs as malformedOrphansWarning, Zt as pendingRequestCount, Zu as finchSecretArgvRefusal, _ as listNestedTemplateRows, _a as ccBrokenReason, _c as refuseMalformedResourcesForExport, _d as resolveStateBucketWithDefault, _l as unionOfSecretBags, _n as loadJournaledOrphans, _o as producerRegionsFromState, _r as findNestedStackTypeChanges, _s as malformedOrphanRecordsRefusalMessage, _u as applyCrossPrefixScan, a as scanActiveConsumers, ac as malformedOutputsWarning, ad as runDockerStreaming, ai as withStackRecords, al as redactForState, an as recordDisplacedSkips, ao as applyRoleArnIfSet, au as orphansAfterRollback, b as hasPendingMovesOut, ba as CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID, bc as JSON_LISTING_HOLE_VALUE, bd as stateBucketExistenceConfirmed, bi as bold, bl as maskSecretsInError, bn as makeSiblingClaimReader, bs as previewableOrphanRecords, bu as isNotImplemented, c as inheritedProvenanceForChildDiff, cc as refuseMalformedOutputsForDestroy, cd as Synthesizer, ci as holdsSupersededResources, cl as carryLogOnlyValues, cn as withNestedRevertRun, co as explicitRoleArnOrThrow, cr as demoteSupersededOrphans, cs as prefetchCreateOnlyPropertyPaths, cu as stackInstanceIdCarriedFrom, d as conditionInputsFrom, dc as refuseDivergentRecordRegionForDestroy, dd as getLegacyStateBucketName, di as supersededHeldByOtherTypeWarning, dl as literalSplitDelimitersOf, dn as withNestedStackContext, do as AWS_CREDENTIAL_ENV_KEYS, dr as planFailedOps, ds as withRetry, du as PhaseClock, ea as refusesFinalSnapshot, ec as repairMalformedOrphansForReadOnly, ed as isDockerClientEnvKey, ei as DEFAULT_RESOURCE_WARN_AFTER_MS, el as readsNoEchoSource, en as displacedOpClause, eo as stackIdTailOf, er as updatePartialReason, es as isStatefulRecreateTargetForReplace, eu as exportNamesCarriedFrom, f as parentSuppliedValues, fc as malformedRenderedContainersWarning, fd as loadCdkJson, fi as supersededHolderOf, fl as logOnlyValueCount, fn as deleteJournaledOrphans, fo as applyCallerIdentityCredentials, fr as recheckFailedPlan, fs as parameterInputsFor, fu as renderPhaseTimings, g as isAbsoluteAssetPath, ga as ProviderRegistry, gc as refuseMalformedResourcesForDestroy, gd as resolveSkipPrefix, gl as shareLogOnlyValues, gn as journaledOrphanLines, go as classifyReplaySecretRegion, gr as withPreviousPolicies, gs as isReadableOrphanRecord, gu as CrossPrefixScanCache, h as findNestedTemplateTreeDefect, ha as CC_BROKEN_REASON, hc as refuseMalformedResourcesForDeploy, hd as resolveCaptureObservedState, hl as recordLogOnlyValue, hn as isHandledOrphan, ho as classifyRecordedSecretRegion, hr as resolveReplacementOldType, hs as deployRefusesOrphanRowsReason, hu as CrossPrefixReadError, i as mergeNoChangeOutputs, ic as malformedOutputsRefusalMessage, id as runDockerForeground, in as nestedChildStackName$1, io as refuseUnreadableCdkCrossAccountRefs, ir as withCreateTokenLedger, iu as isReadableBag, j as isProtectionValueActive, jc as unwrittenCreateOnlyReplacement, jd as PARTITION_TABLE, ji as createReadOnlyAttributeHealerFactory, jl as inheritNestedStackParameterAssociations, jn as withMovedTo, jo as refStateLookupFromResource, jr as withNameGenerationReached, js as malformedScrubResourceEntriesRefusalMessage, ju as AssetModeResolver, k as recordedProtectionNote, ka as CloudControlProvider, kc as findHandledUnwrittenCreateOnly, kd as decodeListingKey, ki as noEchoParameterNamesOf, kl as pathCrossesDottedKey, kn as movedToHint, ko as isStalePlaceholderArnAttribute, kr as retiredNameGenerationsAfter, ks as malformedLocalResourcesWarning, ku as loadPublishableAssetManifest, l as makeCanonicalizePropertiesFn, lc as repairMalformedOutputsForReadOnly, ld as synthesisStatusMessage, li as isSupersededResourceRecord, ll as createUnionSecretMasker, ln as collectNestedChildUnaddressed, lo as isIamRoleArn, lr as isJournaledOrphan, ls as templateResourceTypes, lu as hasReasonlessBaselineRefusal, m as childTemplateLoader, mc as malformedStateRefusalMessage, md as resolveAutoAssetStorage, mi as withoutSuperseded, ml as recordLogOnlyParameterValue, mn as dropFailedHint, mo as envCredentialsAreAssumedRole, mr as replacementNeverSwapped, ms as declaresNoEcho, mu as rebuildClientForBucketRegion, n as isSecretBearingReferenceString, na as createPreDeleteFinalSnapshot, nc as malformedExportSourceWarning, nd as formatDockerLoginError, nl as valueAtCoordinate, nn as dropSettledNestedJournals, no as resolveDynamicReferences, nr as ledgerForStack, ns as renderStatefulReason, nu as importableOutputKeys, o as inRunStackKey, od as AssetManifestLoader, oo as assertFlagRoleArn, or as planRollback, ou as orphansCarriedFrom, p as readRecordedConditionVerdicts, pc as malformedResourcesWarning, pd as resolveApp, pi as supersededResourcesOf, pl as printingCorpusOf, pn as dropFailedCommands, po as callerEnvCredentials, pr as recordUnderIdIsNotOwn, pu as timePhase, qc as maskReadbackAtCoordinates, qd as describeFileReadFailure, qi as withSecretPhysicalIdsMaskedInState, ql as isSingleDynamicReferenceToken, qn as settleUnsettledPrevious, qo as unsettledItemsOf, qr as isWholeDynamicReferenceValue, qs as repairMalformedResourcePropertiesForReadOnly, qu as redactedCause, r as keptWholeReasonText, ra as buildFinalSnapshotIdentifier, rc as malformedLocalOutputsWarning, rd as getDockerCmd, ri as destroyStackRecordsView, rl as liveMatchesUnresolvedTokenFrame, ro as producerLookupOver, ru as importableOutputs, s as crossStackOutputProvenanceSource, sc as refuseMalformedOutputs, sd as getDockerImageBySourceHash, si as deleteSupersededEntry, sn as revertedNestedRowIds, so as assertSendableRoleArn, sr as seedsDeleteFirstGuard, su as shouldRetainResource, t as DeployEngine, ta as unsupportedFinalSnapshotError, tc as malformedExportNamesWarning, td as isMalformedEnvKey, tf as resolveBucketRegion, ti as maskingRetryLogger, tl as recordedNoEchoValuesOf, tn as displacedPhysicalIdShown, ts as isStatefulRecreateTargetSync, tu as hasReadableExportSet, u as conditionFingerprint, uc as STATE_REGION_DIVERGED, ud as getDefaultStateBucketName, ui as supersededAfterRollback, ul as hasMaskableValues, un as getCurrentNestedStackContext, uo as sendableAssumeRoleCommand, ur as isReplacementOrphan, us as describeTypeWithThrottleRetry, uu as hasUnverifiableParameterRefusal, v as renderNestedTemplateTreeDefect, va as isCustomResource, vc as refuseMalformedState, vd as resolveStateBucketWithDefaultAndSource, vl as createSecretMasker, vn as sameJournaledOrphans, vo as regionLessSecretName, vs as malformedOrphanRecordsWarning, vu as crossPrefixDeniedWarning, w as deferredServiceTokenWarning, wa as readsNoEchoDeleteValues, wc as UNREADABLE_RESOURCES_MAP_ROW, wd as CFN_TEMPLATE_URL_LIMIT, wi as red, wn as constructPathOf$1, wo as coerceParameterTypedValue, wr as orphanNeedsIdentity, ws as repairMalformedOrphanRecordsForReadOnly, wu as isSensitiveAttributeName, x as pendingMovesOutOf, xa as applyCustomResourceResponseExpiration, xc as accountArgs, xd as warnDeprecatedNoPrefixCliFlag, xi as cyan, xl as maskSecretsInText, xn as planOrphanAdoption, xs as refuseMalformedOrphanRecords, xu as stackInstanceIdOf, y as templateIdentity, ya as wouldReturnToSdkProvider, yc as repairMalformedResourcesForReadOnly, yd as resolveUseCdkBootstrapAssets, yl as errorCauseChain, yn as makeForeignHolderScan, ys as malformedOrphanRowsKeptWarning, yu as isAccessDenied, zd as parseFailureDebugDetail, zl as provenPublicValue, zn as parseMappingFile, zo as carriesFetchableDynamicReference, zr as displayTextOrWithheld, zs as repairMalformedResourceEntriesForReadOnly, zt as refactorMarkerMovesOf, zu as validateAssetBucketName } from "./deploy-engine-DMWjQ_C2.js";
4
+ import { A as stripControlChars, B as retryClassificationText, Ct as withheldTargetClause, F as isAmbiguousOutcomeError, H as isMarkedNonRetryable, J as DynamicReferenceRegionAmbiguousError, Q as AccountIdUnavailableError, R as isRetryableTransientError, St as shellQuote, Tt as setPasteableVerbFlags, U as isThrottlingError, W as markNonRetryable, X as MalformedProducerRecordRefusalError, Y as IntrinsicResolutionRefusalError, _ as ResourceUpdateNotSupportedError, _t as pasteableCommand, a as normalizeAwsError, at as ProvisioningError, bt as quotedOrDescribed, ct as SynthesisError, et as CdkdError, ft as SHELL_ACTIVE_WHY, g as PartialFailureError, gt as isInertUnquoted, h as NestedStackChildDirectDestroyError, i as credentialFingerprint, j as stripForDisplay, k as escapeRegExp, l as withErrorHandling, mt as commandHole, n as ambientCredentialConfig, o as formatError, ot as ResourceTimeoutError, q as CrossAccountSecretRefusalError, r as clientDefaultsFor, rt as LocalInvokeBuildError$1, s as handleError, st as StateError, t as ambientClientDefaults, tt as DeployCancelledError, u as LocalStartServiceError, ut as TIMEOUT_FLAG_RESOURCE_TYPE, v as StackHasActiveImportsError, wt as setPasteableRunFlags, xt as shellBoundedDisplay, y as StackTerminationProtectionError, yt as plainOrDescribed, z as isTransientServerError } from "./ambient-client-defaults-BV_xDm4m.js";
5
+ import { $t as forceQuitRecoveryClause, Dt as logicalIdShown, H as assertRegionMatch, M as VALUE_NOT_SHOWN, Qt as buildLockContentionMessage, U as isMarkedNotGone, V as RESOURCE_NOT_FOUND, Xt as UNREPRODUCIBLE_LOCK_CLAUSE, Zt as buildForceUnlockCommand, an as CUSTOM_RESOURCE_RESPONSE_PREFIX, bt as interruptWatchListenerCount, dn as setPasteableAwsCaBundle, en as formatLockExpiry, fn as setPasteableAwsProfile, kt as resourceTypeShown, ln as producerCoordinateKey, m as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, mt as isAwsCliLiteral, nn as formatLockOwner, on as DEFAULT_STATE_PREFIX, p as IAM_PRINCIPAL_NAME, pn as withPasteableAwsProfile, sn as injectiveKey, st as runDeleteAttempt, tn as formatLockOperation, un as producerRecordKey, vt as beginCommandInterruptScope, xt as isInterruptedWaitError, y as readRecordedPrincipals, yt as endCommandInterruptScope, z as remedyLogicalId } from "./update-removal-CpGaCv-d.js";
6
+ import { a as runWithStackAwsClients, i as resetAwsClients, l as s3ClientDefaults, o as setAwsClients, s as resolveS3ClientDefaults, t as AwsClients, u as setS3ClientDefaultsDebugLog } from "./aws-clients-DOkPjjAW.js";
7
+ import { a as getAssumedRoleCredentials, c as setAssumedRoleCredentials, h as formatAuthority, l as setAwsEndpointOverrideSource, m as runInStackAwsScope, n as awsClientDefaults, o as getPreAssumeEnvCredentials, s as runWithRealAws } from "./aws-client-defaults-DAebi99J.js";
8
+ import { a as parseEcrRegistryHost, i as looksLikeEcrHostWithForeignSuffix, n as hasEcrRegistryHostLabels, t as ecrRegistryHostPattern } from "./ecr-uri-C2FWGsrX.js";
9
9
  import { t as cdkdCacheHome } from "./cli.js";
10
10
  import { randomBytes, randomUUID } from "node:crypto";
11
11
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketCommand, DeleteObjectsCommand, GetBucketLocationCommand, GetObjectCommand, HeadBucketCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, NotFound, PutBucketEncryptionCommand, PutBucketPolicyCommand, PutBucketVersioningCommand, PutObjectCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -26,7 +26,7 @@ import { BatchDeleteImageCommand, DeleteRepositoryCommand, DescribeImagesCommand
26
26
  import { isDeepStrictEqual, promisify } from "node:util";
27
27
  import graphlib from "graphlib";
28
28
  import { Command, InvalidArgumentError, Option } from "commander";
29
- import { A2A_CONTAINER_PORT, A2A_PATH, AGENTCORE_A2A_PROTOCOL, AGENTCORE_AGUI_PROTOCOL, AGENTCORE_MCP_PROTOCOL, ConnectionRegistry, DEFAULT_AWS_EMULATOR_URL, DynamicReferenceResolver, EMULATOR_SCRUBBED_ENV_KEYS, EcsTaskResolutionError, HOST_GATEWAY_MIN_VERSION, LocalInvokeBuildError, MCP_CONTAINER_PORT, MCP_PATH, a2aInvokeOnce, activateWorkloadAwsWiring, addAlbSpecificOptions, addAwsEndpointOptions, addCommonEcsServiceOptions, addImageOverrideOptions, addStartServiceSpecificOptions, albStrategy, applyWorkloadAwsWiringToEnv, architectureToPlatform, attachAuthorizers, attachLoopbackForwarder, attachStageContext, availableApiIdentifiers, awaitLoopbackForwarderStatus, awsEmulatorEnvName, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildNamespaceOwnerForwarderDockerArgs, buildStageMap, canonicalizeImageOverrideKeys, classifySourceChange, containsDynamicReference, createAuthorizerCache, createFileWatcher, createFileWatcher as createFileWatcher$1, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, describeAwsFailureForWarn, describeForwarderFailure, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, effectiveLoopbackPorts, enforceImageOverrideOrphans, ensureForwarderImage, filterRoutesByApiIdentifier, firstUsableRegion, getActiveWorkloadAwsWiring, getActiveWorkloadAwsWiring as getActiveWorkloadAwsWiring$1, getAwsEndpointOverride, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, keysNotFromTemplate, keysOverriddenBy, materializeLayerFromArn, mcpInvokeOnce, parseAwsEndpoint, parseConnectionsPath, parseImageOverrideFlags, parseSelectionExpressionPath, pickAgentCoreCandidateStack, pickAgentCoreCandidateStack as pickAgentCoreCandidateStack$1, probeHostGatewaySupport, readEmulatorRunFiles, readMtlsMaterialsFromDisk, recordAssumedRole, resolveAgentCoreTarget, resolveAwsEmulatorOption, resolveDynamicReferencesInEnv, resolveEnvVars, resolveHostDefaultCredentials, resolveHostGatewayExtraHosts, resolveImageOverrides, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSingleTarget, resolveWatchConfig, resolveWorkloadAwsWiring, runEcsServiceEmulator, runImageOverrideBuilds, setActiveWorkloadAwsWiring, setAwsEndpointOverride, signAgentCoreInvocation, startApiServer, substituteImagePlaceholders, tryResolveImageFnJoin, verifyJwtViaDiscovery, waitForAgentCorePing, withoutKeys } from "cdk-local/internal";
29
+ import { A2A_CONTAINER_PORT, A2A_PATH, AGENTCORE_A2A_PROTOCOL, AGENTCORE_AGUI_PROTOCOL, AGENTCORE_MCP_PROTOCOL, ConnectionRegistry, DEFAULT_AWS_EMULATOR_URL, DynamicReferenceResolver, EMULATOR_SCRUBBED_ENV_KEYS, EcsTaskResolutionError, HOST_GATEWAY_MIN_VERSION, LocalInvokeBuildError, MCP_CONTAINER_PORT, MCP_PATH, UNNAMED_WORKLOAD, a2aInvokeOnce, activateWorkloadAwsWiring, addAlbSpecificOptions, addAwsEndpointOptions, addCommonEcsServiceOptions, addImageOverrideOptions, addStartServiceSpecificOptions, albStrategy, applyWorkloadAwsWiringToEnv, architectureToPlatform, attachAuthorizers, attachLoopbackForwarder, attachStageContext, availableApiIdentifiers, awaitLoopbackForwarderStatus, awsEmulatorEnvName, awsEmulatorRealServices, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildNamespaceOwnerForwarderDockerArgs, buildStageMap, canonicalizeImageOverrideKeys, classifySourceChange, containsDynamicReference, createAuthorizerCache, createFileWatcher, createFileWatcher as createFileWatcher$1, createJwksCache, createMixedModeStateProvider, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, describeAwsFailureForWarn, describeForwarderFailure, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, effectiveLoopbackPorts, enforceImageOverrideOrphans, ensureForwarderImage, filterRoutesByApiIdentifier, firstUsableRegion, getActiveWorkloadAwsWiring, getActiveWorkloadAwsWiring as getActiveWorkloadAwsWiring$1, getAwsEndpointOverride, groupRoutesByServer, groupWorkloadsRoutedApart, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, isAwsServiceRoutedToEmulator, isRealAwsSentinel, keysNotFromTemplate, keysOverriddenBy, loopbackForwarderPlan, materializeLayerFromArn, mcpInvokeOnce, parseAwsEndpoint, parseConnectionsPath, parseImageOverrideFlags, parseSelectionExpressionPath, pickAgentCoreCandidateStack, pickAgentCoreCandidateStack as pickAgentCoreCandidateStack$1, probeHostGatewaySupport, readAwsEmulatorEnvVarsFile, readEmulatorRunFiles, readEnvVarsFileText, readMtlsMaterialsFromDisk, realAwsServicesOf, recordAssumedRole, resolveAgentCoreTarget, resolveAwsEmulatorOption, resolveDynamicReferencesInEnv, resolveEnvVars, resolveHostDefaultCredentials, resolveHostGatewayExtraHosts, resolveImageOverrides, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSingleTarget, resolveWatchConfig, resolveWorkloadAwsWiring, runEcsServiceEmulator, runImageOverrideBuilds, setActiveWorkloadAwsWiring, setAwsEndpointOverride, signAgentCoreInvocation, startApiServer, substituteImagePlaceholders, takeAwsEmulatorStateSourceHint, tryResolveImageFnJoin, verifyJwtViaDiscovery, waitForAgentCorePing, withoutKeys } from "cdk-local/internal";
30
30
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
31
31
  import * as readline$1 from "node:readline/promises";
32
32
  import readline from "node:readline/promises";
@@ -335,7 +335,8 @@ const skipFinalSnapshotOption = new Option("--skip-final-snapshot", "Delete reso
335
335
 
336
336
  // src/local/local-role-arn.ts
337
337
  async function applyRoleArnForLocal(opts) {
338
- await applyRoleArnIfSet(opts);
338
+ if (getActiveWorkloadAwsWiring()?.mixed) await runWithRealAws(() => applyRoleArnIfSet(opts));
339
+ else await applyRoleArnIfSet(opts);
339
340
  const role = getAssumedRoleCredentials();
340
341
  if (role === void 0) return;
341
342
  recordAssumedRole(getPreAssumeEnvCredentials(), {
@@ -399,10 +400,12 @@ async function activateLocalAwsWiring(options) {
399
400
  awsEmulator: options.awsEmulator,
400
401
  caBundle: options.caBundle,
401
402
  profile: options.profile,
402
- pull: options.pull
403
+ pull: options.pull,
404
+ envVars: options.envVars
403
405
  });
404
406
  } catch (err) {
405
- throw new CdkdError(err instanceof Error ? err.message : String(err), "LOCAL_AWS_WIRING_FAILED", err instanceof Error ? err : void 0);
407
+ const cause = err instanceof Error && err.cause instanceof Error ? err.cause : void 0;
408
+ throw new CdkdError(err instanceof Error ? err.message : String(err), "LOCAL_AWS_WIRING_FAILED", cause);
406
409
  }
407
410
  }
408
411
  async function activateLocalAwsAndRoleArn(options) {
@@ -428,7 +431,8 @@ function assertAwsEmulatorValue(flag) {
428
431
  async function applyLocalAwsWiring(wiring, env, extraMounts, takenContainerPaths) {
429
432
  const defaults = wiring.mode === "forward" && !env["AWS_ACCESS_KEY_ID"] ? await resolveHostDefaultCredentials() : void 0;
430
433
  const wiredEnv = applyWorkloadAwsWiringToEnv(env, wiring, defaults);
431
- const mounts = extraMounts.filter((m) => wiring.mode !== "emulator" || m.containerPath !== "/cdkd-aws/credentials");
434
+ const emulatorOnly = workloadGetsEmulatorKeysOnly(env, wiring);
435
+ const mounts = extraMounts.filter((m) => !emulatorOnly || m.containerPath !== "/cdkd-aws/credentials");
432
436
  const taken = /* @__PURE__ */ new Set([...takenContainerPaths, ...mounts.map((m) => m.containerPath)]);
433
437
  for (const m of wiring.mounts) if (!taken.has(m.containerPath)) mounts.push({
434
438
  ...m,
@@ -440,13 +444,16 @@ async function applyLocalAwsWiring(wiring, env, extraMounts, takenContainerPaths
440
444
  };
441
445
  }
442
446
  function loopbackPortsFor(wiring, env, network) {
443
- return network === "host" ? [] : effectiveLoopbackPorts(env, wiring);
447
+ if (network !== "host") return effectiveLoopbackPorts(env, wiring);
448
+ const mixed = wiring.mixed;
449
+ if (mixed && effectiveLoopbackPorts(env, wiring).includes(mixed.resignPort)) throw new CdkdError("A run with \"real-aws\" exceptions (AWS Emulator mixed mode) cannot use the host network: its re-signing sidecar listens on the workload's own loopback. Drop the \"real-aws\" exceptions or the host network.", "LOCAL_AWS_EMULATOR_FORWARDER_FAILED");
450
+ return [];
444
451
  }
445
452
  async function prepareLocalLoopbackForwarder(wiring) {
446
453
  try {
447
454
  await ensureForwarderImage(wiring.skipPull === true);
448
455
  } catch (err) {
449
- if (wiring.mode === "emulator") throw new CdkdError(`--aws-emulator: the loopback forwarder image could not be pulled: ${err.message}`, "LOCAL_AWS_EMULATOR_FORWARDER_PULL_FAILED");
456
+ if (wiring.mode === "emulator" || wiring.mixed) throw new CdkdError(`--aws-emulator: the loopback forwarder image could not be pulled: ${err.message}`, "LOCAL_AWS_EMULATOR_FORWARDER_PULL_FAILED");
450
457
  }
451
458
  }
452
459
  async function attachLocalLoopbackForwarder(containerId, ports) {
@@ -475,6 +482,26 @@ function localAwsEmulatorCredentials() {
475
482
  const wiring = getActiveWorkloadAwsWiring$1();
476
483
  return wiring?.mode === "emulator" ? wiring.emulatorCredentials : void 0;
477
484
  }
485
+ function workloadGetsEmulatorKeysOnly(env, wiring) {
486
+ if (!wiring) return false;
487
+ if (wiring.mode === "emulator") return true;
488
+ if (!wiring.mixed) return false;
489
+ return !Object.entries(env).some(([k, v]) => k !== "AWS_ENDPOINT_URL" && isRealAwsSentinel(k, v));
490
+ }
491
+ function mixedModeActive() {
492
+ return getActiveWorkloadAwsWiring$1()?.mixed !== void 0;
493
+ }
494
+ function realAwsException(service, workload) {
495
+ return mixedModeActive() && !isAwsServiceRoutedToEmulator(service, workload);
496
+ }
497
+ function mixedModeEmulatorOverride() {
498
+ return getAwsEndpointOverride() ?? getActiveWorkloadAwsWiring$1()?.mixed?.emulatorClientOverride;
499
+ }
500
+ function warnAwsEmulatorStateSourceHint(dropped, stateSourceGiven) {
501
+ if (dropped === 0 || stateSourceGiven) return;
502
+ const hint = takeAwsEmulatorStateSourceHint();
503
+ if (hint !== void 0) getLogger().warn(hint);
504
+ }
478
505
 
479
506
  // src/cli/aws-emulator-activation.ts
480
507
  async function activateAwsEmulatorForCommand(flag) {
@@ -542,6 +569,13 @@ function prepareAwsEmulatorForCommand(actionCommand) {
542
569
  const value = resolveAwsEmulatorOption(flag);
543
570
  if (value === void 0) return void 0;
544
571
  const local = underLocalCommand(actionCommand);
572
+ const endpoint = parseAwsEndpoint(value === true ? DEFAULT_AWS_EMULATOR_URL : value, "--aws-emulator");
573
+ const url = endpoint.hostname === "localhost" ? endpoint.url.replace("//localhost", "//127.0.0.1") : endpoint.url;
574
+ if (local && localCommandIsMixedMode(actionCommand)) {
575
+ keepHostClientsOnRealAws();
576
+ pointChildProcessesAtEmulator(url, endpoint.port);
577
+ return;
578
+ }
545
579
  const ignored = [];
546
580
  if (clearOption(actionCommand, "profile")) ignored.push("--profile");
547
581
  if (!local && clearOption(actionCommand, "roleArn")) ignored.push("--role-arn");
@@ -562,14 +596,29 @@ function prepareAwsEmulatorForCommand(actionCommand) {
562
596
  const names = ignored.join(", ");
563
597
  onStderr(() => getLogger().info(safeMsg`--aws-emulator: ignoring ${names}; every AWS call uses the emulator's keys.`));
564
598
  }
565
- const endpoint = parseAwsEndpoint(value === true ? DEFAULT_AWS_EMULATOR_URL : value, "--aws-emulator");
566
- const url = endpoint.hostname === "localhost" ? endpoint.url.replace("//localhost", "//127.0.0.1") : endpoint.url;
567
599
  const caBundle = actionCommand.optsWithGlobals().caBundle;
568
600
  pointEnvironmentAtEmulator(url, endpoint.port, caBundle);
569
601
  if (local) return void 0;
570
602
  setAwsEndpointOverrideSource(getAwsEndpointOverride);
571
603
  return () => onStderr(() => activateAwsEmulatorForCommand(flag));
572
604
  }
605
+ function keepHostClientsOnRealAws() {
606
+ const ignored = [];
607
+ for (const key of Object.keys(process.env)) if (key.startsWith("AWS_ENDPOINT_URL")) {
608
+ if (process.env[key] !== "") ignored.push(key);
609
+ delete process.env[key];
610
+ }
611
+ process.env["AWS_IGNORE_CONFIGURED_ENDPOINT_URLS"] = "true";
612
+ if (ignored.length > 0) {
613
+ const names = ignored.join(", ");
614
+ onStderr(() => getLogger().info(safeMsg`--aws-emulator (mixed mode): ignoring ${names}; the "real-aws" exceptions go to real AWS.`));
615
+ }
616
+ }
617
+ function localCommandIsMixedMode(actionCommand) {
618
+ const envVars = actionCommand.optsWithGlobals().envVars;
619
+ if (typeof envVars !== "string" || envVars === "") return false;
620
+ return realAwsServicesOf(readAwsEmulatorEnvVarsFile(envVars).exceptions).length > 0;
621
+ }
573
622
  function onStderr(fn) {
574
623
  if (isStdoutReservedForPayload()) return fn();
575
624
  reserveStdoutForPayload();
@@ -585,22 +634,42 @@ function onStderr(fn) {
585
634
  return result;
586
635
  }
587
636
  function pointEnvironmentAtEmulator(url, port, caBundle) {
637
+ Object.assign(process.env, emulatorEnvironment(url, port, process.env));
638
+ const run = readEmulatorRunFiles(port);
639
+ const caPath = join(run.dir, "ca.pem");
640
+ const runCa = run.present && existsSync(caPath) ? caPath : devNull;
641
+ const ca = caBundle !== void 0 && caBundle !== "" ? caBundle : runCa;
642
+ setPasteableAwsCaBundle(url.startsWith("https:") && ca !== devNull ? ca : void 0);
643
+ }
644
+ function emulatorEnvironment(url, port, env) {
588
645
  const run = readEmulatorRunFiles(port);
589
646
  const runFile = (name) => {
590
647
  const p = join(run.dir, name);
591
648
  return run.present && existsSync(p) ? p : devNull;
592
649
  };
593
- process.env["AWS_ENDPOINT_URL"] = url;
594
650
  const config = runFile("config");
595
- process.env["AWS_CONFIG_FILE"] = config;
596
- if (!process.env["AWS_REGION"] && !process.env["AWS_DEFAULT_REGION"] && config !== devNull) {
651
+ const out = {
652
+ AWS_ENDPOINT_URL: url,
653
+ AWS_CONFIG_FILE: config,
654
+ AWS_SHARED_CREDENTIALS_FILE: runFile("emulator_credentials"),
655
+ AWS_EC2_METADATA_DISABLED: "true"
656
+ };
657
+ if (!env["AWS_REGION"] && !env["AWS_DEFAULT_REGION"] && config !== devNull) {
597
658
  const region = defaultProfileRegion(readFileSync(config, "utf8"));
598
- if (region !== void 0) process.env["AWS_REGION"] = region;
659
+ if (region !== void 0) out["AWS_REGION"] = region;
599
660
  }
600
- process.env["AWS_SHARED_CREDENTIALS_FILE"] = runFile("emulator_credentials");
601
- process.env["AWS_EC2_METADATA_DISABLED"] = "true";
602
- const ca = caBundle !== void 0 && caBundle !== "" ? caBundle : runFile("ca.pem");
603
- setPasteableAwsCaBundle(url.startsWith("https:") && ca !== devNull ? ca : void 0);
661
+ return out;
662
+ }
663
+ function pointChildProcessesAtEmulator(url, port) {
664
+ setChildProcessAwsEnv((env) => {
665
+ for (const key of [
666
+ "CDKD_ROLE_ARN",
667
+ ...EMULATOR_SCRUBBED_ENV_KEYS,
668
+ ...CREDENTIAL_ENV_KEYS
669
+ ]) delete env[key];
670
+ for (const key of Object.keys(env)) if (key.startsWith("AWS_ENDPOINT_URL") || key === "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS") delete env[key];
671
+ return Object.assign(env, emulatorEnvironment(url, port, env));
672
+ });
604
673
  }
605
674
  function defaultProfileRegion(ini) {
606
675
  let inDefault = false;
@@ -2140,7 +2209,7 @@ function collectCrossStackRefs(node, onRef, unconditional) {
2140
2209
  // src/provisioning/register-providers.ts
2141
2210
  let providerClasses;
2142
2211
  function loadProviderClasses() {
2143
- providerClasses ??= import("./provider-classes-BBiXFmPi.js");
2212
+ providerClasses ??= import("./provider-classes-cw32hLq9.js");
2144
2213
  return providerClasses;
2145
2214
  }
2146
2215
  function registerAllProviders(registry, classes) {
@@ -3645,7 +3714,7 @@ async function deployStackInScope(ctx, stackInfo, stackRegion, stackAwsClients)
3645
3714
  const syncValidation = validateRecreateTargets({
3646
3715
  template: stackInfo.template,
3647
3716
  state: stateForRecreateCheck?.state ?? {
3648
- version: 15,
3717
+ version: 16,
3649
3718
  stackName: stackInfo.stackName,
3650
3719
  region: stackRegion,
3651
3720
  resources: {},
@@ -3680,7 +3749,7 @@ async function deployStackInScope(ctx, stackInfo, stackRegion, stackAwsClients)
3680
3749
  const replacedReaders = await findReplacedReadersOfRecreateTargets({
3681
3750
  template: stackInfo.template,
3682
3751
  state: stateForRecreateCheck?.state ?? {
3683
- version: 15,
3752
+ version: 16,
3684
3753
  stackName: stackInfo.stackName,
3685
3754
  region: stackRegion,
3686
3755
  resources: {},
@@ -5718,6 +5787,7 @@ async function bindParametersAndConditions({ template, parameters, stackName, st
5718
5787
  resources: currentState.resources,
5719
5788
  stateBackend,
5720
5789
  stackName,
5790
+ stackIdTail: () => stackIdTailOf(currentState, stackName),
5721
5791
  bestEffort: true,
5722
5792
  ...mergedParameters && { parameters: mergedParameters },
5723
5793
  ...inheritedForResolver && { inheritedSecrets: inheritedForResolver },
@@ -5729,7 +5799,9 @@ async function bindParametersAndConditions({ template, parameters, stackName, st
5729
5799
  effectiveTemplate = new TemplateParser().filterResourcesByCondition(template, conditions);
5730
5800
  everyConditionKnown = unboundParameterNames.size === 0 && unknownConditions.size === 0;
5731
5801
  } catch (error) {
5732
- logger.debug(`Diff condition evaluation for stack ${displayStackName(stackName)} skipped: ${describeAwsFailure(error).detail}`);
5802
+ const message = `Diff condition evaluation for stack ${displayStackName(stackName)} skipped: ${describeAwsFailure(error).detail}`;
5803
+ if (isSelectOutOfBounds(error)) logger.warn(`${message}. \`cdkd deploy\` refuses this template.`);
5804
+ else logger.debug(message);
5733
5805
  }
5734
5806
  if (mismatchedRecords.length > 0) logger.warn(safeMsg`Stack ${displayStackName(stackName)}: condition(s) ${mismatchedRecords.map((name) => displayIdent(name)).join(", ")} read a secret-fed parameter and changed since the last deploy, or one of their inputs did. This diff cannot tell which branch the next deploy takes, and shows each Fn::If on them as its FALSE branch.`);
5735
5807
  const stillUnknown = [...unknownConditions].filter((name) => !Object.hasOwn(recordedVerdicts, name));
@@ -5903,6 +5975,7 @@ async function resolveChildStackParameters(parentStackRow, parentTemplate, paren
5903
5975
  secretNameSink: derivedNameSink ?? /* @__PURE__ */ new Map(),
5904
5976
  stateBackend,
5905
5977
  stackName: parentStackName,
5978
+ stackIdTail: () => stackIdTailOf(parentState, parentStackName),
5906
5979
  bestEffort: true,
5907
5980
  ...parentParameters && { parameters: parentParameters },
5908
5981
  ...parentConditions && { conditions: parentConditions },
@@ -6048,6 +6121,7 @@ async function computeStackDiff(currentState, template, region, stackName, state
6048
6121
  resources: currentState.resources,
6049
6122
  stateBackend,
6050
6123
  stackName,
6124
+ stackIdTail: () => stackIdTailOf(currentState, stackName),
6051
6125
  bestEffort: true,
6052
6126
  ...mergedParameters && { parameters: mergedParameters },
6053
6127
  ...conditions && { conditions },
@@ -6094,6 +6168,7 @@ async function computeStackDiff(currentState, template, region, stackName, state
6094
6168
  resources: resourcesForInputs,
6095
6169
  stateBackend,
6096
6170
  stackName,
6171
+ stackIdTail: () => stackIdTailOf(currentState, stackName),
6097
6172
  bestEffort: true,
6098
6173
  ...Object.keys(classified.bound).length > 0 && { parameters: classified.bound },
6099
6174
  ...conditions && Object.keys(conditions).length > 0 && { conditions },
@@ -6281,7 +6356,7 @@ async function loadStateOrEmpty(stackName, region, stateBackend, refusalRecovery
6281
6356
  region,
6282
6357
  resources: {},
6283
6358
  outputs: {},
6284
- version: 15,
6359
+ version: 16,
6285
6360
  lastModified: Date.now()
6286
6361
  },
6287
6362
  unreadable: [],
@@ -9294,6 +9369,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
9294
9369
  ...Object.keys(parameters).length > 0 && { parameters },
9295
9370
  ...Object.keys(conditions).length > 0 && { conditions },
9296
9371
  stackName: stack.stackName,
9372
+ stackIdTail: () => stackIdTailOf(state, stack.stackName),
9297
9373
  stateBackend: resolverStateBackend,
9298
9374
  ...recordedSecretValues && { recordedSecretValues },
9299
9375
  producerRegions,
@@ -10355,15 +10431,12 @@ function redactDriftChanges(changes, secrets, secretPaths, maskPaths) {
10355
10431
  };
10356
10432
  }
10357
10433
  function maskMarkedNoEchoBaseline(baseline, record, observed) {
10358
- return maskMarkedNoEchoBaselineWithLeaves(baseline, record, observed).baseline;
10359
- }
10360
- function maskMarkedNoEchoBaselineWithLeaves(baseline, record, observed) {
10361
10434
  const marked = noEchoLeavesOf(record) ?? [];
10362
10435
  if (observed) {
10363
10436
  const coordinates = [...marked, ...maskedLeafCoordinatesOf(record.properties ?? {})];
10364
- return { baseline: coordinates.length === 0 ? baseline : maskReadbackAtCoordinates(baseline, record.properties ?? {}, coordinates) };
10437
+ return coordinates.length === 0 ? baseline : maskReadbackAtCoordinates(baseline, record.properties ?? {}, coordinates);
10365
10438
  }
10366
- if (marked.length === 0) return { baseline };
10439
+ if (marked.length === 0) return baseline;
10367
10440
  const recorded = record.properties ?? {};
10368
10441
  const listPathOf = (coordinate) => {
10369
10442
  const list = coordinate.findIndex((segment) => typeof segment === "number");
@@ -10376,12 +10449,8 @@ function maskMarkedNoEchoBaselineWithLeaves(baseline, record, observed) {
10376
10449
  return JSON.stringify(valueAtCoordinate(maskAtCoordinates(baseline, underList), path)) !== JSON.stringify(valueAtCoordinate(maskAtCoordinates(recorded, underList), path));
10377
10450
  });
10378
10451
  const byIndex = maskAtCoordinates(baseline, marked.filter((coordinate) => !replaced.includes(coordinate)));
10379
- if (replaced.length === 0) return { baseline: byIndex };
10380
- const widened = replaced.map((coordinate) => readbackPathFor(byIndex, recorded, coordinate)).filter((path, i) => path !== void 0 && path.length < replaced[i].length);
10381
- return {
10382
- baseline: maskReadbackAtCoordinates(byIndex, recorded, replaced),
10383
- ...widened.length > 0 && { noEchoLeaves: canonicalCoordinates([...marked, ...widened]) }
10384
- };
10452
+ if (replaced.length === 0) return byIndex;
10453
+ return maskReadbackAtCoordinates(byIndex, recorded, replaced);
10385
10454
  }
10386
10455
 
10387
10456
  // src/cli/commands/drift/read-failure.ts
@@ -10839,7 +10908,7 @@ function printAcceptPlan(reports, out) {
10839
10908
  let plannedWrites = 0;
10840
10909
  for (const o of drifted) {
10841
10910
  if (report.state.resources[o.logicalId]?.observedBaselineRefused === true) {
10842
- lines.push(` ~ ${reportResource(o)}\n SKIPPED — a 'cdkd import' run refused this resource's observed-properties baseline; accepting would write the AWS readback into properties it already found untrustworthy. ` + (refusedBaselineRemedy(report.state.resources[o.logicalId]) ?? `Deploy a change to this resource first.`) + `\n`);
10911
+ lines.push(` ~ ${reportResource(o)}\n SKIPPED — a 'cdkd import' run refused this resource's observed-properties baseline; accepting would write a baseline positioned against properties it already found untrustworthy. ` + (refusedBaselineRemedy(report.state.resources[o.logicalId]) ?? `Deploy a change to this resource first.`) + `\n`);
10843
10912
  continue;
10844
10913
  }
10845
10914
  lines.push(` ~ ${reportResource(o)}\n`);
@@ -11019,12 +11088,10 @@ async function runAccept(reports, regionScope, stateBackend, stateConfig, awsCli
11019
11088
  const existing = resources[outcome.logicalId];
11020
11089
  if (!existing) continue;
11021
11090
  if (existing.observedBaselineRefused === true) {
11022
- logger.warn(` ! ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): NOT accepted — a 'cdkd import' run refused to capture this resource's observed-properties baseline, because its recorded properties can no longer position the secret redaction. Accepting would write the AWS readback into those properties, which can persist a resolved secret into state.json in plaintext. ` + safeMsg`${refusedBaselineRemedy(existing) ?? "Deploy a change to this resource to restore a baseline first."}`);
11091
+ logger.warn(` ! ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): NOT accepted — a 'cdkd import' run refused to capture this resource's observed-properties baseline, because its recorded properties can no longer position the secret redaction. Accepting would write a baseline positioned against those properties, which can persist a resolved secret into state.json in plaintext. ` + safeMsg`${refusedBaselineRemedy(existing) ?? "Deploy a change to this resource to restore a baseline first."}`);
11023
11092
  continue;
11024
11093
  }
11025
- const hasObserved = existing.observedProperties !== void 0;
11026
- const baselineSource = hasObserved ? existing.observedProperties : existing.properties ?? {};
11027
- const newBaseline = JSON.parse(JSON.stringify(baselineSource));
11094
+ const newBaseline = existing.observedProperties === void 0 ? structuredClone(outcome.awsProperties) : JSON.parse(JSON.stringify(existing.observedProperties));
11028
11095
  const accepted = [];
11029
11096
  for (const change of outcome.changes) {
11030
11097
  const refusal = acceptRefusalReason(change, outcome.maskedPaths);
@@ -11037,7 +11104,7 @@ async function runAccept(reports, regionScope, stateBackend, stateConfig, awsCli
11037
11104
  accepted.push(change);
11038
11105
  }
11039
11106
  const redactedBaseline = withPhysicalNameCopies(outcome.secrets, otherPhysicalIds(report.state.resources, outcome.logicalId), () => redactForState(newBaseline, {
11040
- provenance: hasObserved ? "state-baseline" : "state-readback",
11107
+ provenance: "state-baseline",
11041
11108
  secrets: outcome.secrets,
11042
11109
  source: existing.properties ?? {}
11043
11110
  }));
@@ -11050,18 +11117,14 @@ async function runAccept(reports, regionScope, stateBackend, stateConfig, awsCli
11050
11117
  logger.warn(` ! ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): '${displayDriftPath(outcome, change.path)}' was NOT recorded — after redaction cdkd state holds a different value at that property. Usually an unresolved '{{resolve:...}}' reference sits there and wins over an accepted value (change the template if that reference is wrong); a readback value cdkd cannot compare is never called recorded.`);
11051
11118
  }
11052
11119
  if (recordedChanges > 0) acceptedResourceCount++;
11053
- const written = maskMarkedNoEchoBaselineWithLeaves(redactedBaseline, existing, hasObserved);
11120
+ const written = maskMarkedNoEchoBaseline(redactedBaseline, existing, true);
11054
11121
  const settled = await settleUnsettled(existing, outcome.logicalId, () => regionScope(report.region).registry.getProviderFor({
11055
11122
  resourceType: outcome.resourceType,
11056
11123
  provisionedBy: existing.provisionedBy
11057
11124
  }).provider);
11058
- resources[outcome.logicalId] = hasObserved ? {
11059
- ...settled,
11060
- observedProperties: written.baseline
11061
- } : {
11125
+ resources[outcome.logicalId] = {
11062
11126
  ...settled,
11063
- properties: written.baseline,
11064
- ...written.noEchoLeaves !== void 0 && { noEchoLeaves: written.noEchoLeaves }
11127
+ observedProperties: written
11065
11128
  };
11066
11129
  }
11067
11130
  const { skippedOutputs: _droppedByAccept, ...carriedState } = report.state;
@@ -16675,6 +16738,7 @@ async function buildResolvedParametersPerStack(args) {
16675
16738
  secretNameSink: /* @__PURE__ */ new Map(),
16676
16739
  parameters: parentParamValues,
16677
16740
  stackName: parentNode.cdkdName,
16741
+ stackIdTail: () => stackIdTailOf(parentNode.state, parentNode.cdkdName),
16678
16742
  ...args.stateBackend && { stateBackend: args.stateBackend }
16679
16743
  };
16680
16744
  const { params, intrinsicSkipped } = await resolveChildImportParameters(parentNode.template, parentResolverContext, parentLogicalId, args.resolver);
@@ -21309,7 +21373,7 @@ async function runRollbackReplay(ctx) {
21309
21373
  ...carriedState,
21310
21374
  ...stackInstanceIdCarriedFrom(baseState),
21311
21375
  ...supersededAfterRollback(baseState, supersededHost),
21312
- version: 15,
21376
+ version: 16,
21313
21377
  region,
21314
21378
  resources: { ...stateResources },
21315
21379
  ...orphansAfterRollback(baseState, mintedOrphans),
@@ -24576,7 +24640,9 @@ async function resolveImportedProperties(stackState, template, region, stateBack
24576
24640
  parameters
24577
24641
  });
24578
24642
  } catch (err) {
24579
- logger.debug(`Template condition evaluation failed during import-time property resolution: ${describeAwsFailure(err).detail} — continuing without conditions.`);
24643
+ const message = `Template condition evaluation failed during import-time property resolution: ${describeAwsFailure(err).detail} — continuing without conditions.`;
24644
+ if (isSelectOutOfBounds(err)) logger.warn(message);
24645
+ else logger.debug(message);
24580
24646
  }
24581
24647
  const unboundParameterNames = Object.keys(template.Parameters ?? {}).filter((name) => isUnboundTemplateParameter(name, template, parameters));
24582
24648
  let divergentParameters;
@@ -24605,7 +24671,8 @@ async function resolveImportedProperties(stackState, template, region, stateBack
24605
24671
  ...Object.keys(parameters).length > 0 && { parameters },
24606
24672
  ...Object.keys(conditions).length > 0 && { conditions },
24607
24673
  stateBackend,
24608
- stackName: stackState.stackName
24674
+ stackName: stackState.stackName,
24675
+ stackIdTail: () => stackIdTailOf(stackState, stackState.stackName)
24609
24676
  };
24610
24677
  const noEchoInputs = /* @__PURE__ */ new Map();
24611
24678
  for (const [logicalId, resource] of entries) {
@@ -24824,7 +24891,7 @@ function buildStackState(stackName, region, rows, templateParser, template, exis
24824
24891
  }
24825
24892
  if (namesParameter?.failedClosed !== void 0) getLogger().debug(`The template's parameter dependence could not be judged (${namesParameter.failedClosed}): every prior observed-baseline refusal recorded without a reason is carried as an unverifiable-parameter refusal.`);
24826
24893
  return {
24827
- version: 15,
24894
+ version: 16,
24828
24895
  stackName,
24829
24896
  region,
24830
24897
  resources,
@@ -25110,6 +25177,14 @@ async function runLockedImport(ctx) {
25110
25177
  }
25111
25178
  }
25112
25179
  const deployedParameters = !namesAnyDeclaredParameter(stateTemplate) ? void 0 : migrationCfnStackName !== void 0 ? await readDeployedParameters(migrationCfnStackName, regionClients.cloudFormation, logger, displaySafe(migrationCfnStackName)) : await readDeployedParameters(stackInfo.stackName, regionClients.cloudFormation, logger, displaySafe(stackInfo.stackName), { absentStackIsNoSource: true });
25180
+ if (existingState === null && typeof stateBackend.peekStackInstanceSibling === "function") {
25181
+ const sibling = await stateBackend.peekStackInstanceSibling(stackInfo.stackName, targetRegion);
25182
+ if (sibling?.stackIdFromInstance === true) stackState = {
25183
+ ...stackState,
25184
+ stackInstanceId: sibling.stackInstanceId,
25185
+ stackIdFromInstance: true
25186
+ };
25187
+ }
25113
25188
  const unsafeObservedBaselineLogicalIds = await withSharedDrainBudget(() => resolveImportedProperties(stackState, stateTemplate, targetRegion, stateBackend, logger, deployedParameters));
25114
25189
  await captureObservedForImportedResources(stackState, providerRegistry, logger, unsafeObservedBaselineLogicalIds, rebuiltLogicalIdsFrom(rows, stateTemplate));
25115
25190
  const saveOptions = {};
@@ -25400,20 +25475,21 @@ function hasSdkMetadata(error) {
25400
25475
  async function loadStateForStack(stackName, synthRegion, opts) {
25401
25476
  const logger = getLogger();
25402
25477
  const prefix = opts.logPrefix ?? "--from-state";
25478
+ const warn = opts.warn ?? ((message) => logger.warn(message));
25403
25479
  const region = canonicalizeRegion(opts.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? synthRegion ?? "us-east-1");
25404
25480
  const clientRegion = canonicalizeRegion(opts.region) || void 0;
25405
25481
  let stateBucket;
25406
25482
  try {
25407
25483
  stateBucket = await resolveStateBucketWithDefault(opts.stateBucket, region);
25408
25484
  } catch (err) {
25409
- logger.warn(`${prefix}: could not resolve state bucket: ${describeLocalAwsFailureForWarn(err, "state bucket resolution")}. Falling back.`);
25485
+ warn(`${prefix}: could not resolve state bucket: ${describeLocalAwsFailureForWarn(err, "state bucket resolution")}. Falling back.`);
25410
25486
  return;
25411
25487
  }
25412
25488
  const awsClients = new AwsClients({
25413
25489
  ...clientRegion !== void 0 && { region: clientRegion },
25414
25490
  ...opts.profile !== void 0 && { profile: opts.profile }
25415
25491
  });
25416
- setAwsClients(awsClients);
25492
+ if (!opts.scopedClients) setAwsClients(awsClients);
25417
25493
  try {
25418
25494
  const stateConfig = {
25419
25495
  bucket: stateBucket,
@@ -25430,7 +25506,7 @@ async function loadStateForStack(stackName, synthRegion, opts) {
25430
25506
  }
25431
25507
  const refs = (await stateBackend.listStacks()).filter((r) => r.stackName === stackName);
25432
25508
  if (refs.length === 0) {
25433
- logger.warn(`${prefix}: no cdkd state found for stack '${stackName}' in bucket '${stateBucket}'. Was it deployed via 'cdkd deploy'? Falling back.`);
25509
+ warn(`${prefix}: no cdkd state found for stack '${stackName}' in bucket '${stateBucket}'. Was it deployed via 'cdkd deploy'? Falling back.`);
25434
25510
  return;
25435
25511
  }
25436
25512
  const findByRegion = (candidate, source) => {
@@ -25439,7 +25515,7 @@ async function loadStateForStack(stackName, synthRegion, opts) {
25439
25515
  const chosen = exact ?? folded[0];
25440
25516
  if (folded.length > 1 && chosen) {
25441
25517
  const how = exact ? `matches ${source} '${candidate}' exactly` : `no record spells ${source} '${candidate}' exactly, so this is a case-insensitive recovery`;
25442
- logger.warn(`${prefix}: stack '${stackName}' has state under ${folded.length} case-variant spellings of ${source} '${candidate}' (${folded.map((r) => r.region ?? "(legacy)").join(", ")}). Reading '${chosen.region ?? "(legacy)"}' — ${how}.`);
25518
+ warn(`${prefix}: stack '${stackName}' has state under ${folded.length} case-variant spellings of ${source} '${candidate}' (${folded.map((r) => r.region ?? "(legacy)").join(", ")}). Reading '${chosen.region ?? "(legacy)"}' — ${how}.`);
25443
25519
  }
25444
25520
  return chosen;
25445
25521
  };
@@ -25450,8 +25526,7 @@ async function loadStateForStack(stackName, synthRegion, opts) {
25450
25526
  const requestedRegion = opts.rawStackRegion ?? opts.stackRegion;
25451
25527
  const found = findByRegion(requestedRegion, "--stack-region");
25452
25528
  if (!found) {
25453
- const seen = refs.map((r) => r.region ?? "(legacy)").join(", ");
25454
- logger.warn(`${prefix}: stack '${stackName}' has no state in region '${requestedRegion}' (available: ${seen}). Falling back.`);
25529
+ warn(`${prefix}: stack '${stackName}' has no state in region '${requestedRegion}' (available: ${refs.map((r) => r.region ?? "(legacy)").join(", ")}). Falling back.`);
25455
25530
  return;
25456
25531
  }
25457
25532
  targetRegion = found.region ?? requestedRegion;
@@ -25459,12 +25534,12 @@ async function loadStateForStack(stackName, synthRegion, opts) {
25459
25534
  else if (refs.length === 1) targetRegion = refs[0].region ?? synthRegion ?? region;
25460
25535
  else {
25461
25536
  const seen = refs.map((r) => r.region === void 0 ? "(legacy)" : regionShown(r.region)).join(", ");
25462
- logger.warn(`${prefix}: stack ${quotedOrDescribed(stackName, "stack name")} has state in multiple regions (${seen}). Re-run with --stack-region '<region>'. Falling back.`);
25537
+ warn(`${prefix}: stack ${quotedOrDescribed(stackName, "stack name")} has state in multiple regions (${seen}). Re-run with --stack-region '<region>'. Falling back.`);
25463
25538
  return;
25464
25539
  }
25465
25540
  const stateData = await stateBackend.getState(stackName, targetRegion);
25466
25541
  if (!stateData) {
25467
- logger.warn(`${prefix}: state record for '${stackName}' (${targetRegion}) returned empty. Falling back.`);
25542
+ warn(`${prefix}: state record for '${stackName}' (${targetRegion}) returned empty. Falling back.`);
25468
25543
  return;
25469
25544
  }
25470
25545
  logger.debug(`${prefix}: loaded state for ${stackName} (${targetRegion})`);
@@ -25474,7 +25549,8 @@ async function loadStateForStack(stackName, synthRegion, opts) {
25474
25549
  stateBucket
25475
25550
  };
25476
25551
  } finally {
25477
- resetAwsClients();
25552
+ if (opts.scopedClients) awsClients.destroy();
25553
+ else resetAwsClients();
25478
25554
  }
25479
25555
  }
25480
25556
  async function loadBootstrapContainerRepo(synthRegion, opts) {
@@ -25658,12 +25734,13 @@ function describeStateBucketAccessFailure(err) {
25658
25734
 
25659
25735
  // src/local/s3-local-state-provider.ts
25660
25736
  var S3LocalStateProvider = class {
25661
- label = "--from-state";
25737
+ label;
25662
25738
  opts;
25663
25739
  disposers = [];
25664
25740
  warnedMalformedProducers = /* @__PURE__ */ new Set();
25665
25741
  constructor(opts) {
25666
25742
  this.opts = opts;
25743
+ this.label = opts.logPrefix ?? "--from-state";
25667
25744
  }
25668
25745
  async load(stackName, synthRegion) {
25669
25746
  const loadOpts = {
@@ -25672,7 +25749,10 @@ var S3LocalStateProvider = class {
25672
25749
  ...this.opts.rawStackRegion !== void 0 && { rawStackRegion: this.opts.rawStackRegion },
25673
25750
  ...this.opts.stateBucket !== void 0 && { stateBucket: this.opts.stateBucket },
25674
25751
  ...this.opts.region !== void 0 && { region: this.opts.region },
25675
- ...this.opts.profile !== void 0 && { profile: this.opts.profile }
25752
+ ...this.opts.profile !== void 0 && { profile: this.opts.profile },
25753
+ ...this.opts.logPrefix !== void 0 && { logPrefix: this.opts.logPrefix },
25754
+ ...this.opts.warn !== void 0 && { warn: this.opts.warn },
25755
+ ...this.opts.scopedClients === true && { scopedClients: true }
25676
25756
  };
25677
25757
  const loaded = await loadStateForStack(stackName, synthRegion, loadOpts);
25678
25758
  if (!loaded) return void 0;
@@ -25718,24 +25798,92 @@ var S3LocalStateProvider = class {
25718
25798
  }
25719
25799
  };
25720
25800
 
25801
+ // src/local/mixed-mode-state.ts
25802
+ const REAL_FROM_STATE_LABEL = "--from-state (real AWS)";
25803
+ function realMissReason(message) {
25804
+ return (message.startsWith(`${"--from-state (real AWS)"}: `) ? message.slice(25) : message).replace(/\s*Was it deployed via 'cdkd deploy'\?/, "").replace(/\s*Falling back\.\s*$/, "").replace(/\.\s*$/, "");
25805
+ }
25806
+ function serialQueue() {
25807
+ let tail = Promise.resolve();
25808
+ return (job) => {
25809
+ const run = tail.then(job, job);
25810
+ tail = run.catch(() => void 0);
25811
+ return run;
25812
+ };
25813
+ }
25814
+ function createMixedModeFromStateProvider(opts, realServices) {
25815
+ if (realServices.length === 0) return new S3LocalStateProvider(opts);
25816
+ const serial = serialQueue();
25817
+ const emulatorInner = new S3LocalStateProvider(opts);
25818
+ const emulator = {
25819
+ label: emulatorInner.label,
25820
+ load: (stackName, synthRegion) => serial(() => emulatorInner.load(stackName, synthRegion)),
25821
+ buildCrossStackResolver: (region) => serial(() => emulatorInner.buildCrossStackResolver(region)),
25822
+ dispose: () => emulatorInner.dispose()
25823
+ };
25824
+ let lastLoadError;
25825
+ const realInner = new S3LocalStateProvider({
25826
+ ...opts,
25827
+ logPrefix: REAL_FROM_STATE_LABEL,
25828
+ warn: (message) => {
25829
+ lastLoadError ??= realMissReason(message);
25830
+ getLogger().debug(message);
25831
+ },
25832
+ scopedClients: true
25833
+ });
25834
+ return createMixedModeStateProvider({
25835
+ emulator,
25836
+ real: {
25837
+ label: REAL_FROM_STATE_LABEL,
25838
+ load: (stackName, synthRegion) => serial(() => runWithRealAws(async () => {
25839
+ lastLoadError = void 0;
25840
+ const region = canonicalizeRegion(opts.stackRegion ?? opts.region ?? synthRegion ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"]) || "us-east-1";
25841
+ const clients = new AwsClients({
25842
+ region,
25843
+ ...opts.profile && { profile: opts.profile }
25844
+ });
25845
+ try {
25846
+ return await runWithStackAwsClients(clients, () => realInner.load(stackName, synthRegion));
25847
+ } catch (err) {
25848
+ lastLoadError = realMissReason(err instanceof Error ? err.message : String(err));
25849
+ return;
25850
+ } finally {
25851
+ clients.destroy();
25852
+ }
25853
+ })),
25854
+ buildCrossStackResolver: () => Promise.resolve(void 0),
25855
+ getLastLoadError: () => lastLoadError,
25856
+ dispose: () => realInner.dispose()
25857
+ },
25858
+ realServices
25859
+ });
25860
+ }
25861
+
25721
25862
  // src/cli/commands/local-state-source.ts
25722
- const fromStateFactory = (options) => {
25863
+ const fromStateFactory = (options, behavior) => {
25864
+ const providerOpts = s3ProviderOptions(options);
25865
+ const mixed = getActiveWorkloadAwsWiring()?.mixed;
25866
+ if (!mixed) return new S3LocalStateProvider(providerOpts);
25867
+ const realServices = awsEmulatorRealServices(behavior.workload) ?? mixed.realServices;
25868
+ return createMixedModeFromStateProvider(providerOpts, realServices);
25869
+ };
25870
+ function s3ProviderOptions(options) {
25723
25871
  const opts = options;
25724
25872
  const clientRegion = canonicalizeRegion(opts.region) || void 0;
25725
25873
  const stackRegion = canonicalizeRegion(opts.stackRegion) || void 0;
25726
25874
  const rawStackRegion = opts.rawStackRegion || opts.stackRegion || void 0;
25727
- return new S3LocalStateProvider({
25875
+ return {
25728
25876
  statePrefix: opts.statePrefix,
25729
25877
  ...opts.stateBucket !== void 0 && { stateBucket: opts.stateBucket },
25730
25878
  ...clientRegion !== void 0 && { region: clientRegion },
25731
25879
  ...opts.profile !== void 0 && { profile: opts.profile },
25732
25880
  ...stackRegion !== void 0 && { stackRegion },
25733
25881
  ...rawStackRegion !== void 0 && { rawStackRegion }
25734
- });
25735
- };
25882
+ };
25883
+ }
25736
25884
  const cdkdExtraStateProviders = { fromState: fromStateFactory };
25737
- function createLocalStateProvider$1(options, cdkdStackName, synthRegion) {
25738
- return createLocalStateProvider(options, cdkdStackName, synthRegion, cdkdExtraStateProviders);
25885
+ function createLocalStateProvider$1(options, cdkdStackName, synthRegion, behavior = {}) {
25886
+ return createLocalStateProvider(options, cdkdStackName, synthRegion, cdkdExtraStateProviders, behavior);
25739
25887
  }
25740
25888
 
25741
25889
  // src/local/docker-runner.ts
@@ -25776,6 +25924,7 @@ async function runDetached(opts) {
25776
25924
  const wiring = getActiveWorkloadAwsWiring$1();
25777
25925
  if (!wiring) return runDetachedContainer(opts);
25778
25926
  const wired = await applyLocalAwsWiring(wiring, opts.env, opts.extraMounts ?? [], opts.mounts.map((m) => m.containerPath));
25927
+ if (opts.network === "host" && wiring.sidecar?.passthrough && wired.env["AWS_ENDPOINT_URL_SQS"] === wiring.sidecar.endpoint) delete wired.env["AWS_ENDPOINT_URL_SQS"];
25779
25928
  const wiredOpts = {
25780
25929
  ...opts,
25781
25930
  env: wired.env,
@@ -27284,22 +27433,30 @@ function dynamicReferenceSpecOptions(options) {
27284
27433
  // src/local/dynamic-reference.ts
27285
27434
  function createCallerDynamicReferenceResolver(profile) {
27286
27435
  return new DynamicReferenceResolver({
27287
- secretsManagerClientFactory: (region) => new SecretsManagerClient({
27288
- ...awsClientDefaults({
27289
- profile,
27290
- ignoreAssumedRole: true
27291
- }),
27292
- ...region && { region: canonicalizeRegion(region) },
27293
- ...profile && { profile }
27294
- }),
27295
- ssmClientFactory: (region) => new SSMClient({
27296
- ...awsClientDefaults({
27297
- profile,
27298
- ignoreAssumedRole: true
27299
- }),
27300
- ...region && { region: canonicalizeRegion(region) },
27301
- ...profile && { profile }
27302
- })
27436
+ secretsManagerClientFactory: (region, route) => {
27437
+ const realAws = realAwsException("SECRETS_MANAGER", route.workload);
27438
+ return new SecretsManagerClient({
27439
+ ...awsClientDefaults({
27440
+ profile,
27441
+ ignoreAssumedRole: true,
27442
+ realAws
27443
+ }),
27444
+ ...region && { region: canonicalizeRegion(region) },
27445
+ ...profile && { profile }
27446
+ });
27447
+ },
27448
+ ssmClientFactory: (region, route) => {
27449
+ const realAws = realAwsException("SSM", route.workload);
27450
+ return new SSMClient({
27451
+ ...awsClientDefaults({
27452
+ profile,
27453
+ ignoreAssumedRole: true,
27454
+ realAws
27455
+ }),
27456
+ ...region && { region: canonicalizeRegion(region) },
27457
+ ...profile && { profile }
27458
+ });
27459
+ }
27303
27460
  });
27304
27461
  }
27305
27462
 
@@ -27386,6 +27543,10 @@ function isCredentialFresh(creds) {
27386
27543
  return creds.expiration.getTime() - Date.now() > STS_CREDENTIAL_SAFETY_MARGIN_MS;
27387
27544
  }
27388
27545
  async function pullEcrImage(imageUri, options) {
27546
+ if (realAwsException("ECR", options.workload)) return runWithRealAws(() => pullEcrImageOnSide(imageUri, options, "real"));
27547
+ return pullEcrImageOnSide(imageUri, options, "default");
27548
+ }
27549
+ async function pullEcrImageOnSide(imageUri, options, side) {
27389
27550
  const logger = getLogger().child("ecr-puller");
27390
27551
  const parsed = parseEcrUri(imageUri);
27391
27552
  if (!parsed) throw new LocalInvokeBuildError$1(`Image URI '${imageUri}' is not an ECR URI. cdkd local invoke v1 only authenticates against ECR for the deployed-image fallback path.`);
@@ -27397,7 +27558,7 @@ async function pullEcrImage(imageUri, options) {
27397
27558
  return canonicalUri;
27398
27559
  }
27399
27560
  const credentialConfig = ambientCredentialConfig();
27400
- const identityFingerprint = credentialFingerprint(credentialConfig);
27561
+ const identityFingerprint = injectiveKey(side, credentialFingerprint(credentialConfig));
27401
27562
  const callerIdentityKey = injectiveKey(identityFingerprint, callerRegion ?? "_unset");
27402
27563
  let callerAccount = CALLER_IDENTITY_CACHE.get(callerIdentityKey);
27403
27564
  if (callerAccount === void 0) {
@@ -28181,7 +28342,7 @@ function readEnvOverridesFile$3(filePath) {
28181
28342
  if (!filePath) return void 0;
28182
28343
  let raw;
28183
28344
  try {
28184
- raw = readFileSync(filePath, "utf-8");
28345
+ raw = readEnvVarsFileText(filePath);
28185
28346
  } catch (err) {
28186
28347
  throw new Error(`Failed to read --env-vars file '${filePath}': ${describeAwsFailure(err).detail}`);
28187
28348
  }
@@ -28216,7 +28377,8 @@ async function resolveProfileCredentials(profile) {
28216
28377
  const sts = new STSClient({
28217
28378
  ...awsClientDefaults({
28218
28379
  profile,
28219
- ignoreAssumedRole: true
28380
+ ignoreAssumedRole: true,
28381
+ realAws: mixedModeActive()
28220
28382
  }),
28221
28383
  profile
28222
28384
  });
@@ -28247,7 +28409,10 @@ async function assumeLambdaExecutionRole$1(roleArn, region) {
28247
28409
  assertSendableRoleArn(roleArn);
28248
28410
  const { STSClient } = await import("@aws-sdk/client-sts");
28249
28411
  const sts = new STSClient({
28250
- ...awsClientDefaults({ ignoreAssumedRole: true }),
28412
+ ...awsClientDefaults({
28413
+ ignoreAssumedRole: true,
28414
+ realAws: mixedModeActive()
28415
+ }),
28251
28416
  ...region && { region }
28252
28417
  });
28253
28418
  try {
@@ -28271,243 +28436,6 @@ async function assumeLambdaExecutionRole$1(roleArn, region) {
28271
28436
  }
28272
28437
  }
28273
28438
 
28274
- // src/cli/commands/local-start-api/container-spec.ts
28275
- async function buildContainerSpec(args) {
28276
- const { logicalId, stacks, overrides, assumeRole, containerHost, debugPort, stsRegion, inlineTmpDirs, layerTmpDirs, stateByStack, skipPull, layerRoleArn, profileCredentials, profileCredsFile, profile, stackRegionOverride } = args;
28277
- const lambda = resolveLambdaByLogicalId(logicalId, stacks);
28278
- let codeDir;
28279
- let optDir;
28280
- let imageRef;
28281
- let platform;
28282
- if (lambda.kind === "zip") {
28283
- codeDir = lambda.codePath ?? materializeInlineCode$1(lambda.handler, lambda.inlineCode ?? "", resolveRuntimeFileExtension(lambda.runtime), inlineTmpDirs);
28284
- optDir = await materializeLambdaLayers$1(lambda.layers, layerTmpDirs, layerRoleArn);
28285
- platform = architectureToPlatform(lambda.architecture);
28286
- } else {
28287
- imageRef = (await resolveContainerImageForStartApi(lambda, skipPull)).imageRef;
28288
- platform = architectureToPlatform(lambda.architecture);
28289
- }
28290
- let templateEnv = getTemplateEnv$1(lambda.resource);
28291
- const stateBundle = stateByStack.get(lambda.stack.stackName);
28292
- let stateAudit;
28293
- if (stateBundle) {
28294
- const context = { resources: stateBundle.state.resources };
28295
- if (stateBundle.pseudoParameters) context.pseudoParameters = stateBundle.pseudoParameters;
28296
- const { env, audit } = substituteEnvVarsFromState(templateEnv, context);
28297
- templateEnv = env;
28298
- stateAudit = audit;
28299
- for (const key of audit.resolvedKeys) getLogger().debug(`Lambda ${logicalId}: --from-state substituted env var ${key}`);
28300
- for (const { key, reason } of audit.unresolved) getLogger().warn(`Lambda ${logicalId}: --from-state could not substitute env var ${key} (${reason}). Override it via --env-vars or it will be dropped.`);
28301
- }
28302
- const lambdaCdkPath = readCdkPathOrUndefined(lambda.resource);
28303
- const envResult = resolveEnvVars(logicalId, lambdaCdkPath, templateEnv, overrides);
28304
- for (const key of envResult.unresolved) {
28305
- if (stateAudit && stateAudit.unresolved.some((u) => u.key === key)) continue;
28306
- const overrideKeyExample = lambdaCdkPath?.replace(/\/Resource$/, "") ?? logicalId;
28307
- getLogger().warn(`Lambda ${logicalId}: env var ${key} contains a CloudFormation intrinsic and was dropped. Override it with --env-vars (e.g. {"${overrideKeyExample}":{"${key}":"<literal>"}}) or pass --from-state to recover deployed values.`);
28308
- }
28309
- const plaintextKeys = new Set(stateAudit?.sensitiveKeys ?? []);
28310
- for (const key of keysNotFromTemplate(templateEnv, envResult.resolved)) plaintextKeys.add(key);
28311
- const dynamicRefs = createCallerDynamicReferenceResolver(profile);
28312
- let dynamic;
28313
- try {
28314
- dynamic = await resolveDynamicReferencesInEnv(envResult.resolved, {
28315
- region: firstUsableRegion(stateBundle?.region, stackRegionOverride, lambda.stack.region, stsRegion),
28316
- label: `Lambda ${logicalId}`,
28317
- skipKeys: plaintextKeys,
28318
- resolver: dynamicRefs
28319
- });
28320
- } finally {
28321
- dynamicRefs.dispose();
28322
- }
28323
- const sensitiveKeyList = [...stateAudit?.sensitiveKeys ?? [], ...dynamic.resolvedKeys];
28324
- const sensitiveEnvKeys = sensitiveKeyList.length > 0 ? new Set(sensitiveKeyList) : void 0;
28325
- const dockerEnv = {
28326
- AWS_LAMBDA_FUNCTION_NAME: logicalId,
28327
- AWS_LAMBDA_FUNCTION_MEMORY_SIZE: String(lambda.memoryMb),
28328
- AWS_LAMBDA_FUNCTION_TIMEOUT: String(lambda.timeoutSec),
28329
- AWS_LAMBDA_FUNCTION_VERSION: "$LATEST",
28330
- AWS_LAMBDA_LOG_GROUP_NAME: `/aws/lambda/${logicalId}`,
28331
- AWS_LAMBDA_LOG_STREAM_NAME: "local",
28332
- ...dynamic.env
28333
- };
28334
- const roleArn = resolveStartApiAssumeRoleArn({
28335
- logicalId,
28336
- assumeRole,
28337
- lambdaResource: lambda.resource,
28338
- stateBundle
28339
- });
28340
- if (roleArn) {
28341
- const creds = await assumeLambdaExecutionRole$1(roleArn, stsRegion);
28342
- dockerEnv["AWS_ACCESS_KEY_ID"] = creds.accessKeyId;
28343
- dockerEnv["AWS_SECRET_ACCESS_KEY"] = creds.secretAccessKey;
28344
- dockerEnv["AWS_SESSION_TOKEN"] = creds.sessionToken;
28345
- setContainerRegion(dockerEnv, stsRegion);
28346
- } else {
28347
- forwardAwsEnv$2(dockerEnv);
28348
- const containerRegion = firstUsableRegion(stsRegion, lambda.stack.region);
28349
- setContainerRegion(dockerEnv, containerRegion);
28350
- if (profileCredentials) {
28351
- dockerEnv["AWS_ACCESS_KEY_ID"] = profileCredentials.accessKeyId;
28352
- dockerEnv["AWS_SECRET_ACCESS_KEY"] = profileCredentials.secretAccessKey;
28353
- if (profileCredentials.sessionToken) dockerEnv["AWS_SESSION_TOKEN"] = profileCredentials.sessionToken;
28354
- else delete dockerEnv["AWS_SESSION_TOKEN"];
28355
- }
28356
- if (profileCredsFile) {
28357
- dockerEnv["AWS_SHARED_CREDENTIALS_FILE"] = profileCredsFile.containerPath;
28358
- dockerEnv["AWS_PROFILE"] = profileCredsFile.profileName;
28359
- }
28360
- }
28361
- if (debugPort !== void 0) dockerEnv["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${debugPort}`;
28362
- const tmpfs = lambda.ephemeralStorageMb !== void 0 ? {
28363
- target: "/tmp",
28364
- sizeMb: lambda.ephemeralStorageMb
28365
- } : void 0;
28366
- if (lambda.kind === "zip") return {
28367
- kind: "zip",
28368
- lambda,
28369
- codeDir,
28370
- platform,
28371
- env: dockerEnv,
28372
- ...sensitiveEnvKeys !== void 0 && { sensitiveEnvKeys },
28373
- containerHost,
28374
- ...optDir !== void 0 && { optDir },
28375
- ...debugPort !== void 0 && { debugPort },
28376
- ...tmpfs !== void 0 && { tmpfs },
28377
- ...profileCredsFile && { profileCredentialsFile: {
28378
- hostPath: profileCredsFile.hostPath,
28379
- containerPath: profileCredsFile.containerPath
28380
- } }
28381
- };
28382
- const rie = await resolveRieWrap({
28383
- image: imageRef,
28384
- platform,
28385
- entryPoint: lambda.imageConfig.entryPoint,
28386
- command: lambda.imageConfig.command,
28387
- skipPull
28388
- });
28389
- return {
28390
- kind: "image",
28391
- lambda,
28392
- image: imageRef,
28393
- platform,
28394
- command: rie ? rie.cmd : lambda.imageConfig.command ?? [],
28395
- ...rie && {
28396
- entryPoint: rie.entryPoint,
28397
- rieMount: rie.mount
28398
- },
28399
- ...!rie && lambda.imageConfig.entryPoint !== void 0 && lambda.imageConfig.entryPoint.length > 0 && { entryPoint: lambda.imageConfig.entryPoint },
28400
- ...lambda.imageConfig.workingDirectory !== void 0 && { workingDir: lambda.imageConfig.workingDirectory },
28401
- env: dockerEnv,
28402
- ...sensitiveEnvKeys !== void 0 && { sensitiveEnvKeys },
28403
- containerHost,
28404
- ...debugPort !== void 0 && { debugPort },
28405
- ...tmpfs !== void 0 && { tmpfs },
28406
- ...profileCredsFile && { profileCredentialsFile: {
28407
- hostPath: profileCredsFile.hostPath,
28408
- containerPath: profileCredsFile.containerPath
28409
- } }
28410
- };
28411
- }
28412
- async function resolveContainerImageForStartApi(lambda, skipPull) {
28413
- const logger = getLogger();
28414
- const localBuild = await resolveLocalBuildPlan$1(lambda);
28415
- if (localBuild) return { imageRef: await buildContainerImage$1(localBuild.asset, localBuild.cdkOutDir, {
28416
- assetOutdir: localBuild.assetOutdir,
28417
- architecture: lambda.architecture
28418
- }) };
28419
- if (!parseEcrUri(lambda.imageUri)) throw new Error(`Container Lambda '${lambda.logicalId}' has no matching asset in cdk.out, and Code.ImageUri '${lambda.imageUri}' is not an ECR URI cdkd can authenticate against. Re-synthesize the CDK app (so cdk.out includes the build context) or deploy the image to ECR first.`);
28420
- logger.info(`No matching cdk.out asset for ${lambda.imageUri}; falling back to ECR pull (uses your own credentials — this command has no --ecr-role-arn, so a cross-account image needs cross-account ECR permissions)...`);
28421
- return { imageRef: await pullEcrImage(lambda.imageUri, { skipPull }) };
28422
- }
28423
- async function resolveLocalBuildPlan$1(lambda) {
28424
- if (!lambda.stack.assetManifestPath) return void 0;
28425
- const { manifestDir: cdkOutDir, assetOutdir } = assetPathDirs(lambda.stack);
28426
- const manifest = await new AssetManifestLoader().loadStackManifest(lambda.stack, cdkOutDir);
28427
- if (!manifest) return void 0;
28428
- const entry = getDockerImageBySourceHash(manifest, lambda.imageUri);
28429
- if (!entry) return void 0;
28430
- return {
28431
- asset: entry.asset,
28432
- cdkOutDir,
28433
- assetOutdir
28434
- };
28435
- }
28436
- async function materializeLambdaLayers$1(layers, layerTmpDirs, layerRoleArn) {
28437
- if (layers.length === 0) return void 0;
28438
- const flat = [];
28439
- for (const layer of layers) {
28440
- if (layer.kind === "asset") {
28441
- flat.push({
28442
- logicalId: layer.logicalId,
28443
- assetPath: layer.assetPath
28444
- });
28445
- continue;
28446
- }
28447
- const dir = await materializeLayerFromArn(layer, { ...layerRoleArn !== void 0 && { roleArn: explicitRoleArnOrThrow("--layer-role-arn", layerRoleArn) } });
28448
- layerTmpDirs.add(dir);
28449
- flat.push({
28450
- logicalId: layer.arn,
28451
- assetPath: dir
28452
- });
28453
- }
28454
- if (flat.length === 1) return flat[0].assetPath;
28455
- const dir = mkdtempSync(path.join(tmpdir(), "cdkd-local-start-api-layers-"));
28456
- try {
28457
- for (const layer of flat) copyLayerTreeLastWins(layer.assetPath, dir);
28458
- } catch (error) {
28459
- rmSync(dir, {
28460
- recursive: true,
28461
- force: true
28462
- });
28463
- throw error;
28464
- }
28465
- layerTmpDirs.add(dir);
28466
- return dir;
28467
- }
28468
-
28469
- // src/cli/commands/local-start-api/reload.ts
28470
- async function reloadAllServers(args) {
28471
- const { synthesizeAndBuild, servers, buildPool, logger, isClosing, retiredPoolDisposals } = args;
28472
- let material;
28473
- try {
28474
- material = await synthesizeAndBuild();
28475
- } catch (err) {
28476
- logger.warn(`cdk synth failed during reload; keeping previous version. (${describeAwsFailure(err).detail})`);
28477
- return;
28478
- }
28479
- if (isClosing?.()) return;
28480
- const newGroups = groupRoutesByServer(material.routes);
28481
- const newByKey = new Map(newGroups.map((g) => [g.serverKey, g]));
28482
- const oldKeys = new Set(servers.map((s) => s.group.serverKey));
28483
- const newKeys = new Set(newByKey.keys());
28484
- const added = [...newKeys].filter((k) => !oldKeys.has(k));
28485
- const removed = [...oldKeys].filter((k) => !newKeys.has(k));
28486
- if (added.length > 0) logger.warn(`Reload detected new API surface(s): ${added.join(", ")}. Restart 'cdkd local start-api' to serve them.`);
28487
- if (removed.length > 0) logger.warn(`Reload detected removed API surface(s): ${removed.join(", ")}. Their servers will keep serving stale routes until restart.`);
28488
- for (const booted of servers) {
28489
- const group = newByKey.get(booted.group.serverKey);
28490
- if (!group) continue;
28491
- const newPool = buildPool(filterSpecsForGroup(group, material));
28492
- const newState = {
28493
- routes: group.routes,
28494
- pool: newPool,
28495
- corsConfigByApiId: corsConfigForGroup(group, material)
28496
- };
28497
- const previousState = booted.server.setServerState(newState);
28498
- booted.group = group;
28499
- const disposal = previousState.pool.dispose().catch((err) => {
28500
- logger.debug(`Previous pool dispose() failed for ${group.displayName}: ${describeAwsFailure(err).detail}`);
28501
- });
28502
- retiredPoolDisposals?.add(disposal);
28503
- disposal.then(() => retiredPoolDisposals?.delete(disposal));
28504
- }
28505
- printPerServerRouteTables(servers);
28506
- const allRoutes = servers.flatMap((s) => s.group.routes.map((r) => r.route));
28507
- warnUnsupportedRoutes(allRoutes, logger);
28508
- warnSsrfRiskyIntegrations(allRoutes, logger);
28509
- }
28510
-
28511
28439
  // src/local/ecs-task-resolver/image.ts
28512
28440
  const CDK_ASSET_IMAGE_REPO_RE = /(?:cdk-[a-z0-9]+|cdkd)-container-assets-/;
28513
28441
  function extractEcrRepoComponent(uri) {
@@ -29308,6 +29236,10 @@ async function applyCrossStackResolverToTask(task, context) {
29308
29236
  }
29309
29237
 
29310
29238
  // src/cli/commands/local-start-api/state.ts
29239
+ function stateBundleKey(stackName, workload) {
29240
+ const real = awsEmulatorRealServices(workload);
29241
+ return real === void 0 ? stackName : JSON.stringify([stackName, real]);
29242
+ }
29311
29243
  function envHasIntrinsicValue$1(templateEnv) {
29312
29244
  if (!templateEnv) return false;
29313
29245
  for (const v of Object.values(templateEnv)) {
@@ -29329,10 +29261,36 @@ async function loadStateForRoutedStacks(stacks, routes, routesWithAuth, options)
29329
29261
  }
29330
29262
  const stackHasIntrinsicEnv = (stackName) => intrinsicEnvStacks.has(stackName);
29331
29263
  rejectExplicitCfnStackWithMultipleStacks(options, reachableStackNames.size);
29332
- for (const stackName of reachableStackNames) {
29264
+ const loads = /* @__PURE__ */ new Map();
29265
+ const lambdas = [];
29266
+ for (const ref of reachedLambdas(routes, routesWithAuth)) for (const owner of lambdaOwners(ref, stacks)) {
29267
+ const resource = owner.template.Resources?.[ref.logicalId];
29268
+ lambdas.push({
29269
+ stackName: owner.stackName,
29270
+ workload: {
29271
+ logicalId: ref.logicalId,
29272
+ cdkPath: resource ? readCdkPathOrUndefined(resource) : void 0
29273
+ }
29274
+ });
29275
+ }
29276
+ for (const { stackName } of lambdas) {
29277
+ const key = stateBundleKey(stackName, UNNAMED_WORKLOAD);
29278
+ if (!loads.has(key)) loads.set(key, {
29279
+ stackName,
29280
+ workload: UNNAMED_WORKLOAD
29281
+ });
29282
+ }
29283
+ for (const group of groupWorkloadsRoutedApart(lambdas, (l) => l.workload)) for (const { stackName } of group.items) {
29284
+ const key = stateBundleKey(stackName, group.workload);
29285
+ if (!loads.has(key)) loads.set(key, {
29286
+ stackName,
29287
+ workload: group.workload
29288
+ });
29289
+ }
29290
+ for (const [key, { stackName, workload }] of loads) {
29333
29291
  const stack = stacks.find((s) => s.stackName === stackName);
29334
29292
  if (!stack) continue;
29335
- const provider = createLocalStateProvider$1(options, stack.stackName, stack.region);
29293
+ const provider = createLocalStateProvider$1(options, stack.stackName, stack.region, { workload });
29336
29294
  if (!provider) continue;
29337
29295
  try {
29338
29296
  const loaded = await provider.load(stack.stackName, stack.region);
@@ -29351,7 +29309,7 @@ async function loadStateForRoutedStacks(stacks, routes, routesWithAuth, options)
29351
29309
  const pseudo = await resolvePseudoParametersForStartApi(loaded.region, options);
29352
29310
  if (pseudo) bundle.pseudoParameters = pseudo;
29353
29311
  }
29354
- out.set(stackName, bundle);
29312
+ out.set(key, bundle);
29355
29313
  logger.debug(`${provider.label}: loaded state for ${stackName} (${loaded.region})`);
29356
29314
  } finally {
29357
29315
  provider.dispose();
@@ -29367,19 +29325,25 @@ async function resolvePseudoParametersForStartApi(stateRegion, options) {
29367
29325
  try {
29368
29326
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
29369
29327
  let sts;
29370
- if (!options.fromState) sts = new STSClient({
29328
+ if (!options.fromState) {
29329
+ const realAws = realAwsException("STS");
29330
+ sts = new STSClient({
29331
+ ...awsClientDefaults({
29332
+ profile: options.profile,
29333
+ ignoreAssumedRole: true,
29334
+ realAws
29335
+ }),
29336
+ ...region && { region },
29337
+ ...options.profile && { profile: options.profile }
29338
+ });
29339
+ } else sts = new STSClient({
29371
29340
  ...awsClientDefaults({
29372
29341
  profile: options.profile,
29373
- ignoreAssumedRole: true
29342
+ realAws: realAwsException("STS")
29374
29343
  }),
29375
29344
  ...region && { region },
29376
29345
  ...options.profile && { profile: options.profile }
29377
29346
  });
29378
- else sts = new STSClient({
29379
- ...awsClientDefaults({ profile: options.profile }),
29380
- ...region && { region },
29381
- ...options.profile && { profile: options.profile }
29382
- });
29383
29347
  try {
29384
29348
  accountId = (await sts.send(new GetCallerIdentityCommand({}))).Account;
29385
29349
  } finally {
@@ -29400,6 +29364,263 @@ async function resolvePseudoParametersForStartApi(stateRegion, options) {
29400
29364
  return Object.keys(bag).length === 0 ? void 0 : bag;
29401
29365
  }
29402
29366
 
29367
+ // src/cli/commands/local-start-api/container-spec.ts
29368
+ async function buildContainerSpec(args) {
29369
+ const { logicalId, stacks, overrides, assumeRole, containerHost, debugPort, stsRegion, inlineTmpDirs, layerTmpDirs, stateByStack, stateSourceActive, skipPull, layerRoleArn, profileCredentials, profileCredsFile, profile, stackRegionOverride } = args;
29370
+ const lambda = resolveLambdaByLogicalId(logicalId, stacks);
29371
+ let codeDir;
29372
+ let optDir;
29373
+ let imageRef;
29374
+ let platform;
29375
+ if (lambda.kind === "zip") {
29376
+ codeDir = lambda.codePath ?? materializeInlineCode$1(lambda.handler, lambda.inlineCode ?? "", resolveRuntimeFileExtension(lambda.runtime), inlineTmpDirs);
29377
+ optDir = await materializeLambdaLayers$1(lambda.layers, layerTmpDirs, layerRoleArn, {
29378
+ logicalId,
29379
+ cdkPath: readCdkPathOrUndefined(lambda.resource)
29380
+ });
29381
+ platform = architectureToPlatform(lambda.architecture);
29382
+ } else {
29383
+ imageRef = (await resolveContainerImageForStartApi(lambda, skipPull)).imageRef;
29384
+ platform = architectureToPlatform(lambda.architecture);
29385
+ }
29386
+ let templateEnv = getTemplateEnv$1(lambda.resource);
29387
+ const stateBundle = stateByStack.get(stateBundleKey(lambda.stack.stackName, {
29388
+ logicalId,
29389
+ cdkPath: readCdkPathOrUndefined(lambda.resource)
29390
+ }));
29391
+ let stateAudit;
29392
+ if (stateBundle) {
29393
+ const context = { resources: stateBundle.state.resources };
29394
+ if (stateBundle.pseudoParameters) context.pseudoParameters = stateBundle.pseudoParameters;
29395
+ const { env, audit } = substituteEnvVarsFromState(templateEnv, context);
29396
+ templateEnv = env;
29397
+ stateAudit = audit;
29398
+ for (const key of audit.resolvedKeys) getLogger().debug(`Lambda ${logicalId}: --from-state substituted env var ${key}`);
29399
+ for (const { key, reason } of audit.unresolved) getLogger().warn(`Lambda ${logicalId}: --from-state could not substitute env var ${key} (${reason}). Override it via --env-vars or it will be dropped.`);
29400
+ }
29401
+ const lambdaCdkPath = readCdkPathOrUndefined(lambda.resource);
29402
+ const envResult = resolveEnvVars(logicalId, lambdaCdkPath, templateEnv, overrides);
29403
+ for (const key of envResult.unresolved) {
29404
+ if (stateAudit && stateAudit.unresolved.some((u) => u.key === key)) continue;
29405
+ const overrideKeyExample = lambdaCdkPath?.replace(/\/Resource$/, "") ?? logicalId;
29406
+ getLogger().warn(`Lambda ${logicalId}: env var ${key} contains a CloudFormation intrinsic and was dropped. Override it with --env-vars (e.g. {"${overrideKeyExample}":{"${key}":"<literal>"}}) or pass --from-state to recover deployed values.`);
29407
+ }
29408
+ warnAwsEmulatorStateSourceHint(envResult.unresolved.length, stateSourceActive === true);
29409
+ const plaintextKeys = new Set(stateAudit?.sensitiveKeys ?? []);
29410
+ for (const key of keysNotFromTemplate(templateEnv, envResult.resolved)) plaintextKeys.add(key);
29411
+ const dynamicRefs = createCallerDynamicReferenceResolver(profile);
29412
+ let dynamic;
29413
+ try {
29414
+ dynamic = await resolveDynamicReferencesInEnv(envResult.resolved, {
29415
+ workload: {
29416
+ logicalId,
29417
+ cdkPath: lambdaCdkPath
29418
+ },
29419
+ region: firstUsableRegion(stateBundle?.region, stackRegionOverride, lambda.stack.region, stsRegion),
29420
+ label: `Lambda ${logicalId}`,
29421
+ skipKeys: plaintextKeys,
29422
+ resolver: dynamicRefs
29423
+ });
29424
+ } finally {
29425
+ dynamicRefs.dispose();
29426
+ }
29427
+ const sensitiveKeyList = [...stateAudit?.sensitiveKeys ?? [], ...dynamic.resolvedKeys];
29428
+ const sensitiveEnvKeys = sensitiveKeyList.length > 0 ? new Set(sensitiveKeyList) : void 0;
29429
+ const dockerEnv = {
29430
+ AWS_LAMBDA_FUNCTION_NAME: logicalId,
29431
+ AWS_LAMBDA_FUNCTION_MEMORY_SIZE: String(lambda.memoryMb),
29432
+ AWS_LAMBDA_FUNCTION_TIMEOUT: String(lambda.timeoutSec),
29433
+ AWS_LAMBDA_FUNCTION_VERSION: "$LATEST",
29434
+ AWS_LAMBDA_LOG_GROUP_NAME: `/aws/lambda/${logicalId}`,
29435
+ AWS_LAMBDA_LOG_STREAM_NAME: "local",
29436
+ ...dynamic.env
29437
+ };
29438
+ const roleArn = resolveStartApiAssumeRoleArn({
29439
+ logicalId,
29440
+ assumeRole,
29441
+ lambdaResource: lambda.resource,
29442
+ stateBundle
29443
+ });
29444
+ if (roleArn) {
29445
+ const creds = await assumeLambdaExecutionRole$1(roleArn, stsRegion);
29446
+ dockerEnv["AWS_ACCESS_KEY_ID"] = creds.accessKeyId;
29447
+ dockerEnv["AWS_SECRET_ACCESS_KEY"] = creds.secretAccessKey;
29448
+ dockerEnv["AWS_SESSION_TOKEN"] = creds.sessionToken;
29449
+ setContainerRegion(dockerEnv, stsRegion);
29450
+ } else {
29451
+ forwardAwsEnv$2(dockerEnv);
29452
+ const containerRegion = firstUsableRegion(stsRegion, lambda.stack.region);
29453
+ setContainerRegion(dockerEnv, containerRegion);
29454
+ if (profileCredentials) {
29455
+ dockerEnv["AWS_ACCESS_KEY_ID"] = profileCredentials.accessKeyId;
29456
+ dockerEnv["AWS_SECRET_ACCESS_KEY"] = profileCredentials.secretAccessKey;
29457
+ if (profileCredentials.sessionToken) dockerEnv["AWS_SESSION_TOKEN"] = profileCredentials.sessionToken;
29458
+ else delete dockerEnv["AWS_SESSION_TOKEN"];
29459
+ }
29460
+ if (profileCredsFile) {
29461
+ dockerEnv["AWS_SHARED_CREDENTIALS_FILE"] = profileCredsFile.containerPath;
29462
+ dockerEnv["AWS_PROFILE"] = profileCredsFile.profileName;
29463
+ }
29464
+ }
29465
+ if (debugPort !== void 0) dockerEnv["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${debugPort}`;
29466
+ const tmpfs = lambda.ephemeralStorageMb !== void 0 ? {
29467
+ target: "/tmp",
29468
+ sizeMb: lambda.ephemeralStorageMb
29469
+ } : void 0;
29470
+ if (lambda.kind === "zip") return {
29471
+ kind: "zip",
29472
+ lambda,
29473
+ codeDir,
29474
+ platform,
29475
+ env: dockerEnv,
29476
+ ...sensitiveEnvKeys !== void 0 && { sensitiveEnvKeys },
29477
+ containerHost,
29478
+ ...optDir !== void 0 && { optDir },
29479
+ ...debugPort !== void 0 && { debugPort },
29480
+ ...tmpfs !== void 0 && { tmpfs },
29481
+ ...profileCredsFile && { profileCredentialsFile: {
29482
+ hostPath: profileCredsFile.hostPath,
29483
+ containerPath: profileCredsFile.containerPath
29484
+ } }
29485
+ };
29486
+ const rie = await resolveRieWrap({
29487
+ image: imageRef,
29488
+ platform,
29489
+ entryPoint: lambda.imageConfig.entryPoint,
29490
+ command: lambda.imageConfig.command,
29491
+ skipPull
29492
+ });
29493
+ return {
29494
+ kind: "image",
29495
+ lambda,
29496
+ image: imageRef,
29497
+ platform,
29498
+ command: rie ? rie.cmd : lambda.imageConfig.command ?? [],
29499
+ ...rie && {
29500
+ entryPoint: rie.entryPoint,
29501
+ rieMount: rie.mount
29502
+ },
29503
+ ...!rie && lambda.imageConfig.entryPoint !== void 0 && lambda.imageConfig.entryPoint.length > 0 && { entryPoint: lambda.imageConfig.entryPoint },
29504
+ ...lambda.imageConfig.workingDirectory !== void 0 && { workingDir: lambda.imageConfig.workingDirectory },
29505
+ env: dockerEnv,
29506
+ ...sensitiveEnvKeys !== void 0 && { sensitiveEnvKeys },
29507
+ containerHost,
29508
+ ...debugPort !== void 0 && { debugPort },
29509
+ ...tmpfs !== void 0 && { tmpfs },
29510
+ ...profileCredsFile && { profileCredentialsFile: {
29511
+ hostPath: profileCredsFile.hostPath,
29512
+ containerPath: profileCredsFile.containerPath
29513
+ } }
29514
+ };
29515
+ }
29516
+ async function resolveContainerImageForStartApi(lambda, skipPull) {
29517
+ const logger = getLogger();
29518
+ const localBuild = await resolveLocalBuildPlan$1(lambda);
29519
+ if (localBuild) return { imageRef: await buildContainerImage$1(localBuild.asset, localBuild.cdkOutDir, {
29520
+ assetOutdir: localBuild.assetOutdir,
29521
+ architecture: lambda.architecture
29522
+ }) };
29523
+ if (!parseEcrUri(lambda.imageUri)) throw new Error(`Container Lambda '${lambda.logicalId}' has no matching asset in cdk.out, and Code.ImageUri '${lambda.imageUri}' is not an ECR URI cdkd can authenticate against. Re-synthesize the CDK app (so cdk.out includes the build context) or deploy the image to ECR first.`);
29524
+ logger.info(`No matching cdk.out asset for ${lambda.imageUri}; falling back to ECR pull (uses your own credentials — this command has no --ecr-role-arn, so a cross-account image needs cross-account ECR permissions)...`);
29525
+ return { imageRef: await pullEcrImage(lambda.imageUri, {
29526
+ skipPull,
29527
+ workload: {
29528
+ logicalId: lambda.logicalId,
29529
+ cdkPath: readCdkPathOrUndefined(lambda.resource)
29530
+ }
29531
+ }) };
29532
+ }
29533
+ async function resolveLocalBuildPlan$1(lambda) {
29534
+ if (!lambda.stack.assetManifestPath) return void 0;
29535
+ const { manifestDir: cdkOutDir, assetOutdir } = assetPathDirs(lambda.stack);
29536
+ const manifest = await new AssetManifestLoader().loadStackManifest(lambda.stack, cdkOutDir);
29537
+ if (!manifest) return void 0;
29538
+ const entry = getDockerImageBySourceHash(manifest, lambda.imageUri);
29539
+ if (!entry) return void 0;
29540
+ return {
29541
+ asset: entry.asset,
29542
+ cdkOutDir,
29543
+ assetOutdir
29544
+ };
29545
+ }
29546
+ async function materializeLambdaLayers$1(layers, layerTmpDirs, layerRoleArn, workload) {
29547
+ if (layers.length === 0) return void 0;
29548
+ const flat = [];
29549
+ for (const layer of layers) {
29550
+ if (layer.kind === "asset") {
29551
+ flat.push({
29552
+ logicalId: layer.logicalId,
29553
+ assetPath: layer.assetPath
29554
+ });
29555
+ continue;
29556
+ }
29557
+ const dir = await materializeLayerFromArn(layer, {
29558
+ ...workload && { workload },
29559
+ ...layerRoleArn !== void 0 && { roleArn: explicitRoleArnOrThrow("--layer-role-arn", layerRoleArn) }
29560
+ });
29561
+ layerTmpDirs.add(dir);
29562
+ flat.push({
29563
+ logicalId: layer.arn,
29564
+ assetPath: dir
29565
+ });
29566
+ }
29567
+ if (flat.length === 1) return flat[0].assetPath;
29568
+ const dir = mkdtempSync(path.join(tmpdir(), "cdkd-local-start-api-layers-"));
29569
+ try {
29570
+ for (const layer of flat) copyLayerTreeLastWins(layer.assetPath, dir);
29571
+ } catch (error) {
29572
+ rmSync(dir, {
29573
+ recursive: true,
29574
+ force: true
29575
+ });
29576
+ throw error;
29577
+ }
29578
+ layerTmpDirs.add(dir);
29579
+ return dir;
29580
+ }
29581
+
29582
+ // src/cli/commands/local-start-api/reload.ts
29583
+ async function reloadAllServers(args) {
29584
+ const { synthesizeAndBuild, servers, buildPool, logger, isClosing, retiredPoolDisposals } = args;
29585
+ let material;
29586
+ try {
29587
+ material = await synthesizeAndBuild();
29588
+ } catch (err) {
29589
+ logger.warn(`cdk synth failed during reload; keeping previous version. (${describeAwsFailure(err).detail})`);
29590
+ return;
29591
+ }
29592
+ if (isClosing?.()) return;
29593
+ const newGroups = groupRoutesByServer(material.routes);
29594
+ const newByKey = new Map(newGroups.map((g) => [g.serverKey, g]));
29595
+ const oldKeys = new Set(servers.map((s) => s.group.serverKey));
29596
+ const newKeys = new Set(newByKey.keys());
29597
+ const added = [...newKeys].filter((k) => !oldKeys.has(k));
29598
+ const removed = [...oldKeys].filter((k) => !newKeys.has(k));
29599
+ if (added.length > 0) logger.warn(`Reload detected new API surface(s): ${added.join(", ")}. Restart 'cdkd local start-api' to serve them.`);
29600
+ if (removed.length > 0) logger.warn(`Reload detected removed API surface(s): ${removed.join(", ")}. Their servers will keep serving stale routes until restart.`);
29601
+ for (const booted of servers) {
29602
+ const group = newByKey.get(booted.group.serverKey);
29603
+ if (!group) continue;
29604
+ const newPool = buildPool(filterSpecsForGroup(group, material));
29605
+ const newState = {
29606
+ routes: group.routes,
29607
+ pool: newPool,
29608
+ corsConfigByApiId: corsConfigForGroup(group, material)
29609
+ };
29610
+ const previousState = booted.server.setServerState(newState);
29611
+ booted.group = group;
29612
+ const disposal = previousState.pool.dispose().catch((err) => {
29613
+ logger.debug(`Previous pool dispose() failed for ${group.displayName}: ${describeAwsFailure(err).detail}`);
29614
+ });
29615
+ retiredPoolDisposals?.add(disposal);
29616
+ disposal.then(() => retiredPoolDisposals?.delete(disposal));
29617
+ }
29618
+ printPerServerRouteTables(servers);
29619
+ const allRoutes = servers.flatMap((s) => s.group.routes.map((r) => r.route));
29620
+ warnUnsupportedRoutes(allRoutes, logger);
29621
+ warnSsrfRiskyIntegrations(allRoutes, logger);
29622
+ }
29623
+
29403
29624
  // src/cli/commands/local-start-api/command.ts
29404
29625
  function formatServerListeningBanner(scheme, host, port, pathSuffix, label) {
29405
29626
  return `Server listening on ${scheme}://${formatAuthority(host, port)}${pathSuffix} (${label})\n`;
@@ -29486,7 +29707,8 @@ async function localStartApiCommand(target, options) {
29486
29707
  ...overrides !== void 0 && { overrides }
29487
29708
  });
29488
29709
  const corsConfigByStack = buildCorsConfigByStack(targetStacks);
29489
- const stateByStack = options.fromState || isCfnFlagPresent(options) ? await loadStateForRoutedStacks(targetStacks, routes, routesWithAuth, options) : /* @__PURE__ */ new Map();
29710
+ const stateSourceActive = options.fromState || isCfnFlagPresent(options);
29711
+ const stateByStack = stateSourceActive ? await loadStateForRoutedStacks(targetStacks, routes, routesWithAuth, options) : /* @__PURE__ */ new Map();
29490
29712
  const profileCredentials = await profileCredentialsForWorkload(options.profile, resolveProfileCredentials);
29491
29713
  if (options.profile && profileCredentials && !profileCredsFile) profileCredsFile = await writeProfileCredentialsFile(options.profile, profileCredentials, {
29492
29714
  onDirCreated: (hostPath) => {
@@ -29507,6 +29729,7 @@ async function localStartApiCommand(target, options) {
29507
29729
  inlineTmpDirs,
29508
29730
  layerTmpDirs,
29509
29731
  stateByStack,
29732
+ stateSourceActive,
29510
29733
  skipPull: options.pull === false,
29511
29734
  ...options.layerRoleArn !== void 0 && { layerRoleArn: options.layerRoleArn },
29512
29735
  ...profileCredentials && { profileCredentials },
@@ -29841,19 +30064,46 @@ var EcsSecretsResolutionError = class EcsSecretsResolutionError extends Error {
29841
30064
  async function resolveEcsSecrets(entries, options = {}) {
29842
30065
  if (entries.length === 0) return [];
29843
30066
  const logger = getLogger().child("ecs-secrets");
29844
- const secretsClient = options.secretsManagerClient ?? new SecretsManagerClient({
29845
- ...awsClientDefaults({ ignoreAssumedRole: true }),
29846
- ...options.region && { region: options.region }
29847
- });
29848
- const ssmClient = options.ssmClient ?? new SSMClient({
29849
- ...awsClientDefaults({ ignoreAssumedRole: true }),
29850
- ...options.region && { region: options.region }
29851
- });
29852
- const ownsSecretsClient = options.secretsManagerClient === void 0;
29853
- const ownsSsmClient = options.ssmClient === void 0;
30067
+ const owned = [];
30068
+ const secretsClients = /* @__PURE__ */ new Map();
30069
+ const ssmClients = /* @__PURE__ */ new Map();
30070
+ const secretsFor = (containerName) => {
30071
+ if (options.secretsManagerClient) return options.secretsManagerClient;
30072
+ const realAws = realAwsException("SECRETS_MANAGER", { containerName });
30073
+ let client = secretsClients.get(realAws);
30074
+ if (!client) {
30075
+ client = new SecretsManagerClient({
30076
+ ...awsClientDefaults({
30077
+ ignoreAssumedRole: true,
30078
+ realAws
30079
+ }),
30080
+ ...options.region && { region: options.region }
30081
+ });
30082
+ secretsClients.set(realAws, client);
30083
+ owned.push(client);
30084
+ }
30085
+ return client;
30086
+ };
30087
+ const ssmFor = (containerName) => {
30088
+ if (options.ssmClient) return options.ssmClient;
30089
+ const realAws = realAwsException("SSM", { containerName });
30090
+ let client = ssmClients.get(realAws);
30091
+ if (!client) {
30092
+ client = new SSMClient({
30093
+ ...awsClientDefaults({
30094
+ ignoreAssumedRole: true,
30095
+ realAws
30096
+ }),
30097
+ ...options.region && { region: options.region }
30098
+ });
30099
+ ssmClients.set(realAws, client);
30100
+ owned.push(client);
30101
+ }
30102
+ return client;
30103
+ };
29854
30104
  try {
29855
30105
  return await Promise.all(entries.map(async (entry) => {
29856
- const value = await resolveOne(entry, secretsClient, ssmClient);
30106
+ const value = await resolveOne(entry, () => secretsFor(entry.containerName), () => ssmFor(entry.containerName));
29857
30107
  logger.debug(`Resolved secret ${displayIdent(entry.containerName)}.${displayIdent(entry.name)} (${displayIdent(entry.valueFrom, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS })})`);
29858
30108
  return {
29859
30109
  ...entry,
@@ -29861,16 +30111,15 @@ async function resolveEcsSecrets(entries, options = {}) {
29861
30111
  };
29862
30112
  }));
29863
30113
  } finally {
29864
- if (ownsSecretsClient) secretsClient.destroy();
29865
- if (ownsSsmClient) ssmClient.destroy();
30114
+ for (const c of owned) c.destroy();
29866
30115
  }
29867
30116
  }
29868
30117
  async function resolveOne(entry, secretsClient, ssmClient) {
29869
30118
  const arn = entry.valueFrom;
29870
30119
  const shape = classifySecretArn(arn);
29871
30120
  switch (shape.kind) {
29872
- case "secrets-manager": return resolveSecretsManager(entry, shape, secretsClient);
29873
- case "ssm": return resolveSsm(entry, shape, ssmClient);
30121
+ case "secrets-manager": return resolveSecretsManager(entry, shape, secretsClient());
30122
+ case "ssm": return resolveSsm(entry, shape, ssmClient());
29874
30123
  case "unknown": throw new EcsSecretsResolutionError(`Container ${displayIdent(entry.containerName)} secret ${displayIdent(entry.name)} references an unsupported ValueFrom shape ${displayIdent(arn, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS })}. Expected Secrets Manager ARN (optionally with :<json-key>::) or SSM Parameter ARN.`);
29875
30124
  }
29876
30125
  }
@@ -30302,7 +30551,14 @@ function buildDockerRunArgs(opts) {
30302
30551
  ownerPublish.push(publish);
30303
30552
  }
30304
30553
  const wiring = getActiveWorkloadAwsWiring();
30305
- const profileCredentialsFile = wiring?.mode === "emulator" ? void 0 : opts.profileCredentialsFile;
30554
+ const previewEnv = {};
30555
+ for (const [k, v] of Object.entries(container.environment)) defineOwnKey(previewEnv, k, v);
30556
+ if (opts.envOverrides) {
30557
+ applyOverrideMap(previewEnv, opts.envOverrides["Parameters"]);
30558
+ applyOverrideMap(previewEnv, opts.envOverrides[container.name]);
30559
+ }
30560
+ const emulatorKeysOnly = workloadGetsEmulatorKeysOnly(previewEnv, wiring);
30561
+ const profileCredentialsFile = emulatorKeysOnly ? void 0 : opts.profileCredentialsFile;
30306
30562
  if (profileCredentialsFile) both("-v", `${profileCredentialsFile.hostPath}:${profileCredentialsFile.containerPath}:ro`);
30307
30563
  for (const m of wiring?.mounts ?? []) if (!container.mountPoints.some((mp) => mp.containerPath === m.containerPath)) both("-v", `${m.hostPath}:${m.containerPath}:ro`);
30308
30564
  for (const mp of container.mountPoints) {
@@ -30327,6 +30583,12 @@ function buildDockerRunArgs(opts) {
30327
30583
  ...opts.sidecarIp !== void 0 && { sidecarIp: opts.sidecarIp }
30328
30584
  });
30329
30585
  Object.assign(finalEnv, metaEnv);
30586
+ if (opts.mixedModeRealCredentials && wiring?.mixed && !emulatorKeysOnly) {
30587
+ delete finalEnv["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"];
30588
+ finalEnv["AWS_ACCESS_KEY_ID"] = opts.mixedModeRealCredentials.accessKeyId;
30589
+ finalEnv["AWS_SECRET_ACCESS_KEY"] = opts.mixedModeRealCredentials.secretAccessKey;
30590
+ if (opts.mixedModeRealCredentials.sessionToken) finalEnv["AWS_SESSION_TOKEN"] = opts.mixedModeRealCredentials.sessionToken;
30591
+ }
30330
30592
  if (profileCredentialsFile) {
30331
30593
  finalEnv["AWS_SHARED_CREDENTIALS_FILE"] = profileCredentialsFile.containerPath;
30332
30594
  finalEnv["AWS_PROFILE"] = profileCredentialsFile.profileName;
@@ -30431,6 +30693,7 @@ async function prepareOneImage(task, container, options) {
30431
30693
  await pullImage(image.uri, options.skipPull);
30432
30694
  return image.uri;
30433
30695
  case "ecr": return pullEcrImage(image.uri, {
30696
+ workload: { containerName: container.name },
30434
30697
  skipPull: options.skipPull,
30435
30698
  ...options.region !== void 0 && { region: options.region },
30436
30699
  ...options.ecrRoleArn !== void 0 && { ecrRoleArn: options.ecrRoleArn }
@@ -30518,16 +30781,19 @@ async function realizeDockerVolumes(volumes, state) {
30518
30781
  // src/local/ecs-task-runner/loopback-forwarder.ts
30519
30782
  const execFileAsync$2 = promisify(execFile);
30520
30783
  async function startNamespaceForwarder(state, forwarder, containerName, ports, wiring) {
30521
- const label = wiring.mode === "emulator" ? `--aws-emulator ${wiring.emulatorEndpoint?.url ?? ""}` : "The AWS endpoint override (AWS_ENDPOINT_URL*)";
30784
+ const label = wiring.mode === "emulator" ? `--aws-emulator ${wiring.emulatorEndpoint?.url ?? ""}` : wiring.mixed ? `--aws-emulator ${wiring.mixed.emulatorEndpoint.url} (mixed mode)` : "The AWS endpoint override (AWS_ENDPOINT_URL*)";
30785
+ const plan = loopbackForwarderPlan(wiring, ports);
30786
+ const fatal = wiring.mode === "emulator" || plan.resignConfigHostPath !== void 0;
30522
30787
  await prepareLocalLoopbackForwarder(wiring);
30523
30788
  const { name } = forwarder;
30524
30789
  const args = buildNamespaceOwnerForwarderDockerArgs({
30525
30790
  name,
30526
30791
  namespace: forwarder.namespace,
30527
- ports,
30792
+ ports: plan.ports,
30528
30793
  probe: wiring.probeHealth ? "health" : "tcp",
30529
30794
  ...wiring.caHostPath ? { caHostPath: wiring.caHostPath } : {},
30530
- ...wiring.skipPull ? { skipPull: true } : {}
30795
+ ...wiring.skipPull ? { skipPull: true } : {},
30796
+ ...plan.resignConfigHostPath ? { resignConfigHostPath: plan.resignConfigHostPath } : {}
30531
30797
  });
30532
30798
  getLogger().child("ecs-runner").debug(`Starting loopback forwarder ${name} for ports ${ports.join(",")}`);
30533
30799
  try {
@@ -30547,8 +30813,8 @@ async function startNamespaceForwarder(state, forwarder, containerName, ports, w
30547
30813
  } catch (err) {
30548
30814
  if (state.closing) throw interruptedError();
30549
30815
  await removeNamespaceForwarder(state, name);
30550
- if (wiring.mode === "emulator") throw err;
30551
- return failed(state, wiring, `start:${containerName}`, `${label}: ${err.message}`);
30816
+ if (fatal) throw err;
30817
+ return failed(state, fatal, `start:${containerName}`, `${label}: ${err.message}`);
30552
30818
  }
30553
30819
  let result;
30554
30820
  try {
@@ -30556,12 +30822,12 @@ async function startNamespaceForwarder(state, forwarder, containerName, ports, w
30556
30822
  } catch (err) {
30557
30823
  if (state.closing) throw interruptedError();
30558
30824
  await removeNamespaceForwarder(state, name);
30559
- return failed(state, wiring, `start:${containerName}`, `${label}: ${err.message}`);
30825
+ return failed(state, fatal, `start:${containerName}`, `${label}: ${err.message}`);
30560
30826
  }
30561
30827
  if (state.closing) throw interruptedError();
30562
30828
  if (result.ok) return true;
30563
30829
  await removeNamespaceForwarder(state, name);
30564
- return failed(state, wiring, String(result.failedPort ?? 0), describeForwarderFailure(result, label));
30830
+ return failed(state, fatal, String(result.failedPort ?? 0), describeForwarderFailure(result, label));
30565
30831
  }
30566
30832
  async function runForwarderContainer(args, containerName) {
30567
30833
  try {
@@ -30574,8 +30840,8 @@ async function removeNamespaceForwarder(state, name) {
30574
30840
  await removeContainer(name);
30575
30841
  state.forwarders = state.forwarders.filter((f) => f.name !== name);
30576
30842
  }
30577
- function failed(state, wiring, key, message) {
30578
- if (wiring.mode === "emulator") throw new CdkdError(message, "LOCAL_AWS_EMULATOR_FORWARDER_FAILED");
30843
+ function failed(state, fatal, key, message) {
30844
+ if (fatal) throw new CdkdError(message, "LOCAL_AWS_EMULATOR_FORWARDER_FAILED");
30579
30845
  state.forwarderWarnings ??= /* @__PURE__ */ new Set();
30580
30846
  if (!state.forwarderWarnings.has(key)) {
30581
30847
  state.forwarderWarnings.add(key);
@@ -30600,10 +30866,12 @@ function describeDetachedForwarders(state) {
30600
30866
  const forwarders = joined.map((f) => f.name).join(", ");
30601
30867
  return safeMsg`Under the loopback AWS endpoint, these task containers share the network of a forwarder container, so that filter does not list them: ${containers}. Remove them before their forwarders: ${forwarders}.`;
30602
30868
  }
30869
+ const DROPPED_ENTRY = /(?:^|: )(?:Environment|Secret) '.*' dropped:/;
30603
30870
  async function runEcsTask(task, options, state) {
30604
30871
  const logger = getLogger();
30605
30872
  if (task.containers.length === 0) throw new EcsTaskRunnerError(`Task '${task.taskDefinitionLogicalId}' has no containers — nothing to run.`);
30606
30873
  for (const w of task.warnings) logger.warn(w);
30874
+ warnAwsEmulatorStateSourceHint(task.warnings.filter((w) => DROPPED_ENTRY.test(w)).length, options.stateSourceGiven === true);
30607
30875
  const dag = buildDependencyGraph(task.containers);
30608
30876
  const startOrder = topoSort(dag, task.containers);
30609
30877
  const finchRefusals = [];
@@ -30653,6 +30921,7 @@ async function runEcsTask(task, options, state) {
30653
30921
  const tokenKeys = new Set(dynamicReferenceEnvKeys(c, options.envOverrides));
30654
30922
  if (tokenKeys.size === 0) continue;
30655
30923
  dynamicEnvByContainer.set(c.name, await resolveDynamicReferencesInEnv(c.environment, {
30924
+ workload: { containerName: c.name },
30656
30925
  region: firstUsableRegion(options.stateRecordRegion, options.stackRegion, task.stack.region, options.region),
30657
30926
  label: `Container ${c.name}`,
30658
30927
  skipKeys: new Set(Object.keys(c.environment).filter((k) => !tokenKeys.has(k))),
@@ -30728,7 +30997,8 @@ async function runEcsTask(task, options, state) {
30728
30997
  ...options.skipHostPortPublish ? { skipHostPortPublish: true } : {},
30729
30998
  ...mergedAddHostFlags.length > 0 ? { addHostFlags: mergedAddHostFlags } : {},
30730
30999
  ...(options.networkAliasesByContainer?.get(container.name)?.length ?? 0) > 0 ? { networkAliases: options.networkAliasesByContainer.get(container.name) } : {},
30731
- ...options.profileCredentialsFile && { profileCredentialsFile: options.profileCredentialsFile }
31000
+ ...options.profileCredentialsFile && { profileCredentialsFile: options.profileCredentialsFile },
31001
+ ...options.mixedModeRealCredentials && { mixedModeRealCredentials: options.mixedModeRealCredentials }
30732
31002
  });
30733
31003
  dockerCmds.set(container.name, built.args);
30734
31004
  dockerLoopbackPorts.set(container.name, built.loopbackPorts);
@@ -30826,13 +31096,17 @@ async function resolvePlaceholderAccount(arn, source) {
30826
31096
  if (readFromCfnStack(source)) sts = new STSClient({
30827
31097
  ...awsClientDefaults({
30828
31098
  profile,
30829
- ignoreAssumedRole: true
31099
+ ignoreAssumedRole: true,
31100
+ realAws: realAwsException("STS")
30830
31101
  }),
30831
31102
  ...region && { region },
30832
31103
  ...profile && { profile }
30833
31104
  });
30834
31105
  else sts = new STSClient({
30835
- ...awsClientDefaults({ profile }),
31106
+ ...awsClientDefaults({
31107
+ profile,
31108
+ realAws: realAwsException("STS")
31109
+ }),
30836
31110
  ...region && { region },
30837
31111
  ...profile && { profile }
30838
31112
  });
@@ -30852,7 +31126,10 @@ async function assumeTaskRole(roleArn, region) {
30852
31126
  assertSendableRoleArn(roleArn);
30853
31127
  const { STSClient } = await import("@aws-sdk/client-sts");
30854
31128
  const sts = new STSClient({
30855
- ...awsClientDefaults({ ignoreAssumedRole: true }),
31129
+ ...awsClientDefaults({
31130
+ ignoreAssumedRole: true,
31131
+ realAws: mixedModeActive()
31132
+ }),
30856
31133
  ...region && { region }
30857
31134
  });
30858
31135
  try {
@@ -30882,13 +31159,17 @@ async function resolveStackAccountId$1(source) {
30882
31159
  if (readFromCfnStack(source)) sts = new STSClient({
30883
31160
  ...awsClientDefaults({
30884
31161
  profile,
30885
- ignoreAssumedRole: true
31162
+ ignoreAssumedRole: true,
31163
+ realAws: realAwsException("STS")
30886
31164
  }),
30887
31165
  ...region && { region },
30888
31166
  ...profile && { profile }
30889
31167
  });
30890
31168
  else sts = new STSClient({
30891
- ...awsClientDefaults({ profile }),
31169
+ ...awsClientDefaults({
31170
+ profile,
31171
+ realAws: realAwsException("STS")
31172
+ }),
30892
31173
  ...region && { region },
30893
31174
  ...profile && { profile }
30894
31175
  });
@@ -30981,7 +31262,7 @@ function readEnvOverridesFile$2(filePath) {
30981
31262
  if (!filePath) return void 0;
30982
31263
  let raw;
30983
31264
  try {
30984
- raw = readFileSync(filePath, "utf-8");
31265
+ raw = readEnvVarsFileText(filePath);
30985
31266
  } catch (err) {
30986
31267
  throw new Error(`Failed to read --env-vars file '${filePath}': ${describeAwsFailure(err).detail}`);
30987
31268
  }
@@ -31000,12 +31281,21 @@ function readEnvOverridesFile$2(filePath) {
31000
31281
  async function resolveSidecarCredentials(options, assumedCredentials) {
31001
31282
  const wiring = getActiveWorkloadAwsWiring();
31002
31283
  if (wiring?.mode === "emulator") return wiring.emulatorCredentials;
31284
+ if (wiring?.mixed) return wiring.mixed.emulatorCredentials;
31003
31285
  if (assumedCredentials) return assumedCredentials;
31004
31286
  if (options.profile) return resolveProfileCredentials(options.profile);
31005
31287
  return resolveHostDefaultCredentials();
31006
31288
  }
31007
31289
  async function resolveTaskCredentialChannels(options, assumedCredentials, opts) {
31008
31290
  const sidecarCredentials = await resolveSidecarCredentials(options, assumedCredentials);
31291
+ if (getActiveWorkloadAwsWiring()?.mixed) {
31292
+ const real = assumedCredentials ?? (options.profile ? await resolveProfileCredentials(options.profile) : await resolveHostDefaultCredentials());
31293
+ return {
31294
+ sidecarCredentials,
31295
+ profileCredsFile: void 0,
31296
+ ...real && { mixedModeRealCredentials: real }
31297
+ };
31298
+ }
31009
31299
  const emulator = getActiveWorkloadAwsWiring()?.mode === "emulator";
31010
31300
  if (options.profile && sidecarCredentials && !assumedCredentials && !emulator) return {
31011
31301
  sidecarCredentials,
@@ -31026,6 +31316,7 @@ function buildRunEcsTaskOptions(options, channels, extra = {}) {
31026
31316
  };
31027
31317
  if (extra.envOverrides) runOpts.envOverrides = extra.envOverrides;
31028
31318
  if (channels.sidecarCredentials) runOpts.taskCredentials = channels.sidecarCredentials;
31319
+ if (channels.mixedModeRealCredentials) runOpts.mixedModeRealCredentials = channels.mixedModeRealCredentials;
31029
31320
  if (extra.resolvedRoleArn) runOpts.taskRoleArn = extra.resolvedRoleArn;
31030
31321
  if (options.platform) runOpts.platformOverride = options.platform;
31031
31322
  if (options.region) runOpts.region = options.region;
@@ -31162,9 +31453,10 @@ async function localRunTaskCommand(target, options) {
31162
31453
  const parsed = parseEcsTarget(target);
31163
31454
  const candidate = pickCandidateStack(parsed, target, stacks);
31164
31455
  refuseFailedLookups(candidate ? [candidate] : [], stacks, failedLookups);
31165
- stateProvider = createLocalStateProvider$1(options, candidate?.stackName ?? "", candidate?.region);
31456
+ stateProvider = createLocalStateProvider$1(options, candidate?.stackName ?? "", candidate?.region, getActiveWorkloadAwsWiring$1()?.mixed ? { workload: UNNAMED_WORKLOAD } : {});
31166
31457
  const { context: imageContext, stateRecordRegion } = await buildEcsImageResolutionContext$1(candidate, stateProvider, options);
31167
31458
  const task = resolveEcsTaskTarget(target, stacks, imageContext);
31459
+ await applyPerContainerNames(task, target, stacks, candidate, options, imageContext);
31168
31460
  const canPrompt = options.interactiveOverrides !== false && Boolean(process.stdin.isTTY && process.stdout.isTTY);
31169
31461
  if (!options.imageOverride?.length && !canPrompt) assertEcsTaskImagesResolvable(task);
31170
31462
  logger.info(`Target: ${task.stack.stackName}/${task.taskDefinitionLogicalId} (family=${task.family}, containers=${task.containers.length})`);
@@ -31180,9 +31472,10 @@ async function localRunTaskCommand(target, options) {
31180
31472
  ...imageContext?.pseudoParameters && { pseudoParameters: imageContext.pseudoParameters },
31181
31473
  consumerRegion,
31182
31474
  crossStackResolver: resolver,
31183
- resolveDynamicReferences: (value, producerRegion) => dynamicRefs.resolveString(value, {
31475
+ resolveDynamicReferences: (value, producerRegion, workload) => dynamicRefs.resolveString(value, {
31184
31476
  region: producerRegion,
31185
31477
  consumer: `Task ${task.taskDefinitionLogicalId} cross-stack env value`,
31478
+ workload,
31186
31479
  overridable: false
31187
31480
  })
31188
31481
  };
@@ -31230,6 +31523,7 @@ async function localRunTaskCommand(target, options) {
31230
31523
  });
31231
31524
  const hostGatewayExtraHosts = await resolveHostGatewayExtraHosts();
31232
31525
  if (hostGatewayExtraHosts.length > 0) runOpts.hostGatewayExtraHosts = hostGatewayExtraHosts;
31526
+ if (stateProvider) runOpts.stateSourceGiven = true;
31233
31527
  const imageOverrideResult = await resolveRunTaskImageOverride({
31234
31528
  task,
31235
31529
  target,
@@ -31265,6 +31559,32 @@ async function localRunTaskCommand(target, options) {
31265
31559
  if (sigintHandler) process.off("SIGINT", sigintHandler);
31266
31560
  }
31267
31561
  }
31562
+ async function applyPerContainerNames(task, target, stacks, candidate, options, baseContext) {
31563
+ if (!getActiveWorkloadAwsWiring$1()?.mixed || !candidate || !baseContext) return;
31564
+ const groups = groupWorkloadsRoutedApart(task.containers, (c) => ({ containerName: c.name }));
31565
+ for (const group of groups) {
31566
+ const names = group.items.map((c) => c.name);
31567
+ const provider = createLocalStateProvider$1(options, candidate.stackName, candidate.region, { workload: group.workload });
31568
+ if (!provider) continue;
31569
+ try {
31570
+ const loaded = await provider.load(candidate.stackName, candidate.region);
31571
+ if (!loaded) continue;
31572
+ const own = resolveEcsTaskTarget(target, stacks, {
31573
+ ...baseContext,
31574
+ stateResources: loaded.resources
31575
+ });
31576
+ for (const name of names) {
31577
+ const mine = own.containers.find((c) => c.name === name);
31578
+ const into = task.containers.find((c) => c.name === name);
31579
+ if (!mine || !into) continue;
31580
+ into.environment = mine.environment;
31581
+ into.secrets = mine.secrets;
31582
+ }
31583
+ } finally {
31584
+ provider.dispose();
31585
+ }
31586
+ }
31587
+ }
31268
31588
 
31269
31589
  // src/cli/commands/local-run-task.ts
31270
31590
  function createLocalRunTaskCommand() {
@@ -31619,7 +31939,7 @@ function readEnvOverridesFile$1(filePath) {
31619
31939
  if (!filePath) return void 0;
31620
31940
  let raw;
31621
31941
  try {
31622
- raw = readFileSync(filePath, "utf-8");
31942
+ raw = readEnvVarsFileText(filePath);
31623
31943
  } catch (err) {
31624
31944
  throw new CdkdError(`Failed to read --env-vars file '${filePath}': ${describeAwsFailure(err).detail}`, "LOCAL_INVOKE_AGENTCORE_ENV_VARS_READ_FAILED");
31625
31945
  }
@@ -31647,6 +31967,10 @@ async function buildContainerEnvWith(resolved, options, profileCredentials, prof
31647
31967
  const logger = getLogger();
31648
31968
  const overrides = readEnvOverridesFile$1(options.envVars);
31649
31969
  const cdkPath = readCdkPathOrUndefined(resolved.resource);
31970
+ const workload = {
31971
+ logicalId: resolved.logicalId,
31972
+ cdkPath
31973
+ };
31650
31974
  const overriddenKeys = keysOverriddenBy(resolved.environmentVariables, (env) => resolveEnvVars(resolved.logicalId, cdkPath, env, overrides).resolved);
31651
31975
  let templateEnv = withoutKeys(resolved.environmentVariables, overriddenKeys);
31652
31976
  const sensitiveEnvKeys = /* @__PURE__ */ new Set();
@@ -31656,7 +31980,8 @@ async function buildContainerEnvWith(resolved, options, profileCredentials, prof
31656
31980
  consumerRegion: loaded.region,
31657
31981
  resolveDynamicReferences: (value, producerRegion) => dynamicRefs.resolveString(value, {
31658
31982
  region: producerRegion,
31659
- consumer: `AgentCore Runtime ${resolved.logicalId} cross-stack env value`
31983
+ consumer: `AgentCore Runtime ${resolved.logicalId} cross-stack env value`,
31984
+ workload
31660
31985
  })
31661
31986
  };
31662
31987
  const pseudo = imageContext?.pseudoParameters ?? derivePseudoParametersFromRegion$1(loaded.region);
@@ -31676,9 +32001,11 @@ async function buildContainerEnvWith(resolved, options, profileCredentials, prof
31676
32001
  const overrideKeyExample = cdkPath?.replace(/\/Resource$/, "") ?? resolved.logicalId;
31677
32002
  logger.warn(`Environment variable ${key} contains a CloudFormation intrinsic and was dropped. Override it with --env-vars (e.g. {"${overrideKeyExample}":{"${key}":"<literal>"}}), or pass a state-source flag (e.g. --from-cfn-stack) to recover deployed values.`);
31678
32003
  }
32004
+ warnAwsEmulatorStateSourceHint(envResult.unresolved.length, stateProvider !== void 0);
31679
32005
  const skipKeys = keysNotFromTemplate(templateEnv, envResult.resolved);
31680
32006
  for (const key of sensitiveEnvKeys) skipKeys.add(key);
31681
32007
  const dynamic = await resolveDynamicReferencesInEnv(envResult.resolved, {
32008
+ workload,
31682
32009
  region: firstUsableRegion(loaded?.region, options.stackRegion, resolved.stack.region, options.region),
31683
32010
  label: `AgentCore Runtime ${resolved.logicalId}`,
31684
32011
  skipKeys,
@@ -31707,13 +32034,17 @@ async function resolveStackAccountId(region, profile, fromState, fromCfnStack) {
31707
32034
  if (!fromState && fromCfnStack !== void 0 && fromCfnStack !== false) sts = new STSClient({
31708
32035
  ...awsClientDefaults({
31709
32036
  profile,
31710
- ignoreAssumedRole: true
32037
+ ignoreAssumedRole: true,
32038
+ realAws: realAwsException("STS")
31711
32039
  }),
31712
32040
  ...region && { region },
31713
32041
  ...profile && { profile }
31714
32042
  });
31715
32043
  else sts = new STSClient({
31716
- ...awsClientDefaults({ profile }),
32044
+ ...awsClientDefaults({
32045
+ profile,
32046
+ realAws: realAwsException("STS")
32047
+ }),
31717
32048
  ...region && { region },
31718
32049
  ...profile && { profile }
31719
32050
  });
@@ -31798,7 +32129,10 @@ async function assumeAgentCoreExecutionRole(roleArn, region) {
31798
32129
  assertSendableRoleArn(roleArn, (m) => new CdkdError(m, "LOCAL_INVOKE_AGENTCORE_ASSUME_ROLE_INVALID"));
31799
32130
  const { STSClient } = await import("@aws-sdk/client-sts");
31800
32131
  const sts = new STSClient({
31801
- ...awsClientDefaults({ ignoreAssumedRole: true }),
32132
+ ...awsClientDefaults({
32133
+ ignoreAssumedRole: true,
32134
+ realAws: mixedModeActive()
32135
+ }),
31802
32136
  ...region && { region }
31803
32137
  });
31804
32138
  try {
@@ -31910,6 +32244,10 @@ async function resolveAgentCoreImage(resolved, options, assemblyDir, loaded) {
31910
32244
  if (parseEcrUri(containerUri)) {
31911
32245
  logger.info(`Pulling agent image from ECR: ${containerUri}`);
31912
32246
  return pullEcrImage(containerUri, {
32247
+ workload: {
32248
+ logicalId: resolved.logicalId,
32249
+ cdkPath: readCdkPathOrUndefined(resolved.resource)
32250
+ },
31913
32251
  skipPull: options.pull === false,
31914
32252
  ...options.region !== void 0 && { region: options.region },
31915
32253
  ...options.ecrRoleArn !== void 0 && { ecrRoleArn: options.ecrRoleArn },
@@ -31965,6 +32303,10 @@ async function resolveAgentCoreCodeImageFromS3(resolved, code, s3Source, options
31965
32303
  }));
31966
32304
  }
31967
32305
  const bundle = await downloadAndExtractS3Bundle(location, {
32306
+ workload: {
32307
+ logicalId: resolved.logicalId,
32308
+ cdkPath: readCdkPathOrUndefined(resolved.resource)
32309
+ },
31968
32310
  ...region !== void 0 && { region },
31969
32311
  ...options.profile !== void 0 && { profile: options.profile },
31970
32312
  ...credentials !== void 0 && { credentials }
@@ -32338,7 +32680,7 @@ async function localInvokeAgentCoreCommand(target, options) {
32338
32680
  });
32339
32681
  const candidate = pickAgentCoreCandidateStack$1(resolvedTarget, stacks);
32340
32682
  refuseFailedLookups(candidate ? [candidate] : [], stacks, failedLookups);
32341
- stateProvider = createLocalStateProvider$1(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region));
32683
+ stateProvider = createLocalStateProvider$1(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), { workload: agentCoreTargetWorkload(resolvedTarget, stacks) });
32342
32684
  const { context: imageContext, loaded: loadedState } = stateProvider && candidate ? await buildAgentCoreImageContext(candidate, stateProvider, options) : {
32343
32685
  context: void 0,
32344
32686
  loaded: void 0
@@ -32535,6 +32877,16 @@ async function localInvokeAgentCoreCommand(target, options) {
32535
32877
  if (sigintHandler) process.off("SIGINT", sigintHandler);
32536
32878
  }
32537
32879
  }
32880
+ function agentCoreTargetWorkload(target, stacks) {
32881
+ const hits = listTargets([...stacks]).agentCoreRuntimes.filter((e) => e.qualifiedId === target || e.displayPath === target || e.logicalId === target);
32882
+ if (hits.length !== 1) return void 0;
32883
+ const hit = hits[0];
32884
+ const path = ((stacks.find((s) => s.stackName === hit.stackName)?.template.Resources?.[hit.logicalId])?.Metadata)?.["aws:cdk:path"];
32885
+ return {
32886
+ logicalId: hit.logicalId,
32887
+ cdkPath: typeof path === "string" ? path : void 0
32888
+ };
32889
+ }
32538
32890
 
32539
32891
  // src/cli/commands/local-invoke-agentcore.ts
32540
32892
  function parseTimeoutMs(raw) {
@@ -32653,7 +33005,10 @@ async function assumeLambdaExecutionRole(roleArn, region) {
32653
33005
  assertSendableRoleArn(roleArn, (m) => new CdkdError(m, "LOCAL_INVOKE_ASSUME_ROLE_INVALID"));
32654
33006
  const { STSClient } = await import("@aws-sdk/client-sts");
32655
33007
  const sts = new STSClient({
32656
- ...awsClientDefaults({ ignoreAssumedRole: true }),
33008
+ ...awsClientDefaults({
33009
+ ignoreAssumedRole: true,
33010
+ realAws: mixedModeActive()
33011
+ }),
32657
33012
  ...region && { region }
32658
33013
  });
32659
33014
  try {
@@ -32819,7 +33174,10 @@ async function resolveZipImagePlan(lambda, options) {
32819
33174
  }
32820
33175
  const image = resolveRuntimeImage(lambda.runtime);
32821
33176
  await pullImage(image, options.pull === false);
32822
- const layerPlan = await materializeLambdaLayersIncludingArns(lambda.layers, options);
33177
+ const layerPlan = await materializeLambdaLayersIncludingArns(lambda.layers, options, {
33178
+ logicalId: lambda.logicalId,
33179
+ cdkPath: readCdkPathOrUndefined(lambda.resource)
33180
+ });
32823
33181
  const containerCodePath = resolveRuntimeCodeMountPath(lambda.runtime);
32824
33182
  const tmpfs = resolveTmpfsForLambda(lambda);
32825
33183
  return {
@@ -32838,7 +33196,7 @@ async function resolveZipImagePlan(lambda, options) {
32838
33196
  ...tmpfs !== void 0 && { tmpfs }
32839
33197
  };
32840
33198
  }
32841
- async function materializeLambdaLayersIncludingArns(layers, options) {
33199
+ async function materializeLambdaLayersIncludingArns(layers, options, workload) {
32842
33200
  const extraTmpDirs = [];
32843
33201
  const flat = [];
32844
33202
  for (const layer of layers) {
@@ -32849,7 +33207,10 @@ async function materializeLambdaLayersIncludingArns(layers, options) {
32849
33207
  });
32850
33208
  continue;
32851
33209
  }
32852
- const dir = await materializeLayerFromArn(layer, { ...options.layerRoleArn !== void 0 && { roleArn: explicitRoleArnOrThrow("--layer-role-arn", options.layerRoleArn) } });
33210
+ const dir = await materializeLayerFromArn(layer, {
33211
+ ...workload && { workload },
33212
+ ...options.layerRoleArn !== void 0 && { roleArn: explicitRoleArnOrThrow("--layer-role-arn", options.layerRoleArn) }
33213
+ });
32853
33214
  extraTmpDirs.push(dir);
32854
33215
  flat.push({
32855
33216
  logicalId: layer.arn,
@@ -32939,19 +33300,25 @@ async function resolvePseudoParametersForInvoke(stackRegion, options) {
32939
33300
  try {
32940
33301
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
32941
33302
  let sts;
32942
- if (!options.fromState) sts = new STSClient({
33303
+ if (!options.fromState) {
33304
+ const realAws = realAwsException("STS");
33305
+ sts = new STSClient({
33306
+ ...awsClientDefaults({
33307
+ profile: options.profile,
33308
+ ignoreAssumedRole: true,
33309
+ realAws
33310
+ }),
33311
+ ...region && { region },
33312
+ ...options.profile && { profile: options.profile }
33313
+ });
33314
+ } else sts = new STSClient({
32943
33315
  ...awsClientDefaults({
32944
33316
  profile: options.profile,
32945
- ignoreAssumedRole: true
33317
+ realAws: realAwsException("STS")
32946
33318
  }),
32947
33319
  ...region && { region },
32948
33320
  ...options.profile && { profile: options.profile }
32949
33321
  });
32950
- else sts = new STSClient({
32951
- ...awsClientDefaults({ profile: options.profile }),
32952
- ...region && { region },
32953
- ...options.profile && { profile: options.profile }
32954
- });
32955
33322
  try {
32956
33323
  accountId = (await sts.send(new GetCallerIdentityCommand({}))).Account;
32957
33324
  } finally {
@@ -32982,7 +33349,7 @@ function readEnvOverridesFile(filePath) {
32982
33349
  if (!filePath) return void 0;
32983
33350
  let raw;
32984
33351
  try {
32985
- raw = readFileSync(filePath, "utf-8");
33352
+ raw = readEnvVarsFileText(filePath);
32986
33353
  } catch (err) {
32987
33354
  throw new Error(`Failed to read --env-vars file '${filePath}': ${describeAwsFailure(err).detail}`);
32988
33355
  }
@@ -33179,7 +33546,11 @@ async function resolveInvokeTemplateEnvWith(lambda, options, dynamicRefs) {
33179
33546
  const lambdaCdkPath = readCdkPathOrUndefined(lambda.resource);
33180
33547
  const overriddenKeys = keysOverriddenBy(declaredEnv, (env) => resolveEnvVars(lambda.logicalId, lambdaCdkPath, env, overrides).resolved);
33181
33548
  let templateEnv = declaredEnv && withoutKeys(declaredEnv, overriddenKeys);
33182
- const stateProvider = createLocalStateProvider$1(options, lambda.stack.stackName, lambda.stack.region);
33549
+ const workload = {
33550
+ logicalId: lambda.logicalId,
33551
+ cdkPath: lambdaCdkPath
33552
+ };
33553
+ const stateProvider = createLocalStateProvider$1(options, lambda.stack.stackName, lambda.stack.region, { workload });
33183
33554
  if (stateProvider) try {
33184
33555
  const loaded = await stateProvider.load(lambda.stack.stackName, lambda.stack.region);
33185
33556
  if (loaded) {
@@ -33196,7 +33567,8 @@ async function resolveInvokeTemplateEnvWith(lambda, options, dynamicRefs) {
33196
33567
  consumerRegion: loaded.region,
33197
33568
  resolveDynamicReferences: (value, producerRegion) => dynamicRefs.resolveString(value, {
33198
33569
  region: producerRegion,
33199
- consumer: `Lambda ${lambda.logicalId} cross-stack env value`
33570
+ consumer: `Lambda ${lambda.logicalId} cross-stack env value`,
33571
+ workload
33200
33572
  })
33201
33573
  };
33202
33574
  if (envHasIntrinsicValue(templateEnv)) {
@@ -33223,9 +33595,14 @@ async function resolveInvokeTemplateEnvWith(lambda, options, dynamicRefs) {
33223
33595
  const overrideKeyExample = lambdaCdkPath?.replace(/\/Resource$/, "") ?? lambda.logicalId;
33224
33596
  logger.warn(`Environment variable ${key} contains a CloudFormation intrinsic and was dropped. Override it with --env-vars (e.g. {"${overrideKeyExample}":{"${key}":"<literal>"}}), or pass --from-state (cdkd-deployed) / --from-cfn-stack (cdk-deployed) to recover deployed values.`);
33225
33597
  }
33598
+ warnAwsEmulatorStateSourceHint(envResult.unresolved.length, stateProvider !== void 0);
33226
33599
  const plaintextKeys = new Set(stateAudit?.sensitiveKeys ?? []);
33227
33600
  for (const key of keysNotFromTemplate(templateEnv, envResult.resolved)) plaintextKeys.add(key);
33228
33601
  const dynamic = await resolveDynamicReferencesInEnv(envResult.resolved, {
33602
+ workload: {
33603
+ logicalId: lambda.logicalId,
33604
+ cdkPath: readCdkPathOrUndefined(lambda.resource)
33605
+ },
33229
33606
  region: firstUsableRegion(ownerRegion, options.stackRegion, lambda.stack.region, options.region),
33230
33607
  label: `Lambda ${lambda.logicalId}`,
33231
33608
  skipKeys: plaintextKeys,
@@ -33255,6 +33632,10 @@ async function resolveContainerImagePlan(lambda, options) {
33255
33632
  if (!parseEcrUri(lambda.imageUri)) throw new Error(`Container Lambda '${lambda.logicalId}' has no matching asset in cdk.out, and Code.ImageUri '${lambda.imageUri}' is not an ECR URI cdkd can authenticate against. Re-synthesize the CDK app (so cdk.out includes the build context) or deploy the image to ECR first.`);
33256
33633
  logger.info(`No matching cdk.out asset for ${lambda.imageUri}; falling back to ECR pull (cross-region is supported — the ECR client is built for the image URI's region; pass --ecr-role-arn for a cross-account image)...`);
33257
33634
  imageRef = await pullEcrImage(lambda.imageUri, {
33635
+ workload: {
33636
+ logicalId: lambda.logicalId,
33637
+ cdkPath: readCdkPathOrUndefined(lambda.resource)
33638
+ },
33258
33639
  skipPull: options.pull === false,
33259
33640
  ...options.region !== void 0 && { region: options.region },
33260
33641
  ...options.ecrRoleArn !== void 0 && { ecrRoleArn: options.ecrRoleArn }
@@ -33313,11 +33694,13 @@ const CDKD_EMBED_CONFIG = {
33313
33694
  setLevel: (level) => getLogger().setLevel(level),
33314
33695
  getLevel: () => getLogger().getLevel()
33315
33696
  },
33316
- workloadIdentity: "caller"
33697
+ workloadIdentity: "caller",
33698
+ awsEmulatorSqsSidecar: true,
33699
+ deployCommand: "cdkd deploy"
33317
33700
  };
33318
33701
  function createLocalCommand() {
33319
33702
  setEmbedConfig(CDKD_EMBED_CONFIG);
33320
- setAwsEndpointOverrideSource(getAwsEndpointOverride);
33703
+ setAwsEndpointOverrideSource(mixedModeEmulatorOverride);
33321
33704
  const local = new Command("local").description("Local execution of Lambda functions (RIE) and ECS task definitions (Docker required)");
33322
33705
  const invoke = new Command("invoke").description("Run a Lambda function locally in a Docker container (RIE-backed). Target accepts a CDK display path (MyStack/MyApi/Handler) or stack-qualified logical ID (MyStack:MyApiHandler1234ABCD). Single-stack apps may omit the stack prefix.").argument("<target>", "CDK display path or stack-qualified logical ID of the Lambda to invoke").addOption(new Option("-e, --event <file>", "JSON event payload file (default: {})")).addOption(new Option("--event-stdin", "Read event JSON from stdin").default(false)).addOption(new Option("--env-vars <file>", "JSON env-var overrides (SAM-compatible: {\"LogicalId\":{\"KEY\":\"VALUE\"}})")).addOption(new Option("--no-pull", "Skip docker pull (use cached image) — no-op for IMAGE local-build path; `docker build` does not pull base layers by default")).addOption(new Option("--no-build", "Skip docker build on the IMAGE local-build path (use the previously-built tag). Requires the deterministic tag to already be in the local registry; errors with an actionable message when missing. No-op for ZIP Lambdas and the IMAGE ECR-pull path. Compatible with --no-pull.")).addOption(new Option("--debug-port <port>", "Node --inspect-brk port (default: off)")).addOption(new Option("--container-host <host>", "Host to bind the RIE port to").default("127.0.0.1")).addOption(new Option("--assume-role [arn]", "Assume the Lambda's deployed execution role and forward STS-issued temp credentials to the container so the handler runs with the deployed function's narrow permissions (closes the \"developer admin / function narrow\" skew). Three forms: (1) `--assume-role <arn>` assumes the explicit ARN; (2) `--assume-role` (bare) auto-resolves the function's execution role ARN from cdkd state (requires --from-state); (3) `--no-assume-role` explicitly opts out (forces dev creds even with --from-state). Off by default — when omitted, the developer's shell credentials are forwarded unchanged (SAM-compatible default). STS failures degrade to a warn + dev-creds fallback.")).addOption(new Option("--no-assume-role", "Explicitly opt out of assuming the deployed execution role: forward your ambient AWS credentials (or the --profile overlay) even when --from-state is set, and suppress the \"run with --assume-role\" hint. Distinct from omitting the flag, which still prints that hint.")).addOption(new Option("--layer-role-arn <arn>", "Role to sts:AssumeRole before calling lambda:GetLayerVersion on every literal-ARN entry in Properties.Layers. Use only when the dev credentials cannot read the layer — typically cross-account layers. AWS-published public layers (e.g. Lambda Powertools) are readable from every account and need no role.")).addOption(new Option("--ecr-role-arn <arn>", "Role ARN to assume before authenticating against ECR for cross-account / centralized registries. Issues sts:AssumeRole via the default credential chain and uses the temporary credentials for ecr:GetAuthorizationToken + docker pull. Required when the caller does not have direct cross-account access to the target repository. A same-account pull in ANY region does not need this flag: the ECR client is built for the image URI's own region, so crossing a region costs nothing extra.")).addOption(new Option("--from-state", "Read cdkd S3 state for the target stack and substitute Ref / Fn::GetAtt / Fn::Sub in env vars with the deployed physical IDs / attributes. Off by default — keep PR 1 warn-and-drop semantics; turn on for stacks already deployed via cdkd deploy.").default(false)).addOption(new Option("--from-cfn-stack [cfn-stack-name]", "Read a deployed CloudFormation stack via ListStackResources and substitute Ref / Fn::ImportValue in env vars with the deployed physical IDs / exports. Use for CDK apps deployed via the upstream CDK CLI (`cdk deploy`). Bare form uses the cdkd stack name; pass an explicit value when CFn stack name differs. Mutually exclusive with --from-state. Fn::GetAtt is warn-and-dropped in v1 (CFn ListStackResources does not return per-attribute values).")).addOption(new Option("--stack-region <region>", "Region of the state record to read. Used with --from-state when the same stack name has state in multiple regions, and with --from-cfn-stack as the CFn client region (cdkd does not have a separate --cfn-stack-region flag).").argParser(parseStackRegion)).action(withErrorHandling(localInvokeCommand));
33323
33706
  [
@@ -33410,4 +33793,4 @@ function collectVerbFlags(program) {
33410
33793
  }
33411
33794
 
33412
33795
  export { resolveSecretDerivedPrincipals as a, buildProgram, isResolvableSecretPrincipalList as i, runDestroyForStack as n, canonicalizeIpProtocolValue as o, holdsUnprovenSecretPrincipalToken as r, canonicalizeIpv4Cidr as t };
33413
- //# sourceMappingURL=program-CZXbWLai.js.map
33796
+ //# sourceMappingURL=program-BU5T28eB.js.map