@go-to-k/cdkd 0.210.0 → 0.211.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.
package/README.md CHANGED
@@ -59,7 +59,7 @@ Reproduce the first two with `./tests/benchmark/run-benchmark.sh all`. See [test
59
59
  - **Rollback on failure**: When a deploy errors mid-stack, cdkd rolls back the resources it just created so the stack state stays consistent (CloudFormation parity — but cdkd does this without round-tripping through CFn). Pass `cdkd deploy --no-rollback` to skip rollback and keep the partial state for Terraform-style inspection / repair. See [Rollback behavior](#rollback-behavior).
60
60
  - **`--no-wait` for async resources**: Skip the multi-minute wait on CloudFront / RDS / ElastiCache / NAT Gateway and return as soon as the create call returns (CloudFormation always blocks)
61
61
  - **VPC route DependsOn relaxation (on by default)**: Drop CDK-injected defensive `DependsOn` edges from VPC Lambdas onto private-subnet routes so `CloudFront::Distribution` and `Lambda::Url` start their ~3-min propagation in parallel with NAT Gateway stabilization (~50% faster on VPC + Lambda + CloudFront stacks). Pass `--no-aggressive-vpc-parallel` to opt out.
62
- - **Local execution** (`cdkd local invoke` / `start-api` / `run-task` / `start-service` / `start-alb` / `start-cloudfront` / `invoke-agentcore` / `start-agentcore`): run Lambdas, API Gateway routes, ECS tasks, long-running ECS services, CloudFront distributions, and Bedrock AgentCore Runtimes from your CDK code. All AWS Lambda runtimes, container Lambdas, REST v1 / HTTP v2 / Function URL routes, Service Connect / Cloud Map, AgentCore HTTP / MCP / A2A / AGUI / WebSocket protocols (one-shot `invoke-agentcore` and long-running `/ws` serve via `start-agentcore`). The Docker-backed commands work for both `cdkd deploy`-managed (`--from-state`) AND `cdk deploy`-managed (`--from-cfn-stack`) stacks; `start-cloudfront` serves the viewer-request -> S3 / Lambda Function URL origin -> viewer-response pipeline (CloudFront-Functions + S3-only distributions run in-process with no Docker). See [Local execution](#local-execution).
62
+ - **Local execution** (`cdkd local invoke` / `start-api` / `run-task` / `start-service` / `start-alb` / `start-cloudfront` / `invoke-agentcore` / `start-agentcore`): run Lambdas, API Gateway routes, ECS tasks, long-running ECS services, CloudFront distributions, and Bedrock AgentCore Runtimes from your CDK code. All AWS Lambda runtimes, container Lambdas, REST v1 / HTTP v2 / Function URL routes, Service Connect / Cloud Map, AgentCore HTTP / MCP / A2A / AGUI / WebSocket protocols (one-shot `invoke-agentcore` and long-running warm serve via `start-agentcore`, which serves the native contract — `POST /invocations` + `GET /ping`, MCP `/mcp`, A2A `/` — plus the `/ws` bridge for HTTP / AGUI). The Docker-backed commands work for both `cdkd deploy`-managed (`--from-state`) AND `cdk deploy`-managed (`--from-cfn-stack`) stacks; `start-cloudfront` serves the viewer-request -> S3 / Lambda Function URL origin -> viewer-response pipeline (CloudFront-Functions + S3-only distributions run in-process with no Docker). See [Local execution](#local-execution).
63
63
  - **Bidirectional CloudFormation migration**: `cdkd import --migrate-from-cloudformation` adopts existing CFn stacks (including `cdk deploy`-managed) into cdkd state without re-creating resources; `cdkd export` hands a cdkd stack back to CloudFormation when production-ready. See [Importing](#importing-existing-resources) / [Exporting](#exporting-a-stack-back-to-cloudformation).
64
64
 
65
65
  > **Note**: Resource types not covered by either SDK Providers or Cloud Control API cannot be deployed with cdkd. Deployment fails with a clear error message naming the type + a 1-click issue link.
@@ -242,7 +242,7 @@ maintain, no `cdk synth | sam ...` round-trip.
242
242
  | `cdkd local run-task <target>` | ECS RunTask — every container in a task definition started on a per-task docker network |
243
243
  | `cdkd local start-service <target>` | Long-running ECS Service emulator — `DesiredCount` replicas with restart-on-exit (no local load balancer in v1) |
244
244
  | `cdkd local invoke-agentcore <target>` | One-shot Bedrock AgentCore Runtime invoke (HTTP `/invocations` / MCP `/mcp` / A2A `/a2a` / AGUI / WebSocket `--ws`) |
245
- | `cdkd local start-agentcore [target]` | Long-running serve of a Bedrock AgentCore Runtime's bidirectional `/ws` WebSocket (HTTP / AGUI), fronted by a host bridge that injects the session-id / Authorization a header-less browser client cannot set |
245
+ | `cdkd local start-agentcore [target]` | Long-running serve of a Bedrock AgentCore Runtime against a warm container (all four protocols): HTTP / AGUI serve `POST /invocations` + `GET /ping` plus the `/ws` bridge (injects the session-id / Authorization a header-less browser client cannot set); MCP serves `/mcp`, A2A serves `/`. `--sigv4` / `--watch` supported |
246
246
  | `cdkd local start-alb <targets...>` | Long-running local ALB front-door (HTTP + HTTPS listeners, path / host / header / weighted / redirect / fixed-response routing, authenticate-cognito / authenticate-oidc) for ECS / Lambda backing services |
247
247
  | `cdkd local start-cloudfront [target]` | Long-running local CloudFront distribution — viewer-request -> S3 / Lambda Function URL origin -> viewer-response pipeline, CloudFront Functions run in-process (Function URL origins use Docker/RIE) |
248
248
 
package/dist/cli.js CHANGED
@@ -43823,6 +43823,7 @@ function extractLambdaProperties(stack, logicalId, resource, resources) {
43823
43823
  handler,
43824
43824
  memoryMb,
43825
43825
  timeoutSec,
43826
+ architecture: extractArchitecture(props, logicalId),
43826
43827
  codePath,
43827
43828
  layers,
43828
43829
  ...ephemeralStorageMb !== void 0 && { ephemeralStorageMb },
@@ -43910,6 +43911,24 @@ function extractImageUri$1(value, logicalId, stackName, resources, region) {
43910
43911
  }
43911
43912
  }
43912
43913
  /**
43914
+ * Parse `Properties.Architectures` into the single arch cdkd threads to
43915
+ * `--platform`. CFn types it as an array, but CDK / Lambda allow exactly
43916
+ * one entry; default `x86_64` matches the AWS-side default when the
43917
+ * property is absent. Shared by BOTH the ZIP and IMAGE variants (issue
43918
+ * #768) so the ZIP container run pins `--platform` the same way the IMAGE
43919
+ * path always has.
43920
+ */
43921
+ function extractArchitecture(props, logicalId) {
43922
+ const arches = props["Architectures"];
43923
+ if (Array.isArray(arches) && arches.length > 0) {
43924
+ const first = arches[0];
43925
+ if (first === "arm64") return "arm64";
43926
+ if (first === "x86_64") return "x86_64";
43927
+ throw new LocalInvokeResolutionError(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local invoke supports x86_64 and arm64.`);
43928
+ }
43929
+ return "x86_64";
43930
+ }
43931
+ /**
43913
43932
  * Build the IMAGE-variant `ResolvedLambda` from a Lambda template entry
43914
43933
  * with `Code.ImageUri`. `ImageConfig` and `Architectures` are both
43915
43934
  * optional in CFn — the defaults match the AWS-side defaults.
@@ -43921,14 +43940,6 @@ function extractImageLambdaProperties(args) {
43921
43940
  if (Array.isArray(rawImageConfig["Command"])) imageConfig.command = rawImageConfig["Command"].filter((s) => typeof s === "string");
43922
43941
  if (Array.isArray(rawImageConfig["EntryPoint"])) imageConfig.entryPoint = rawImageConfig["EntryPoint"].filter((s) => typeof s === "string");
43923
43942
  if (typeof rawImageConfig["WorkingDirectory"] === "string") imageConfig.workingDirectory = rawImageConfig["WorkingDirectory"];
43924
- const arches = props["Architectures"];
43925
- let architecture = "x86_64";
43926
- if (Array.isArray(arches) && arches.length > 0) {
43927
- const first = arches[0];
43928
- if (first === "arm64") architecture = "arm64";
43929
- else if (first === "x86_64") architecture = "x86_64";
43930
- else throw new LocalInvokeResolutionError(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local invoke supports x86_64 and arm64.`);
43931
- }
43932
43943
  return {
43933
43944
  kind: "image",
43934
43945
  stack,
@@ -43938,7 +43949,7 @@ function extractImageLambdaProperties(args) {
43938
43949
  timeoutSec,
43939
43950
  imageUri,
43940
43951
  imageConfig,
43941
- architecture,
43952
+ architecture: extractArchitecture(props, logicalId),
43942
43953
  layers: [],
43943
43954
  ...ephemeralStorageMb !== void 0 && { ephemeralStorageMb }
43944
43955
  };
@@ -46532,6 +46543,7 @@ function createContainerPool(specs, options) {
46532
46543
  hostPort,
46533
46544
  host: spec.containerHost,
46534
46545
  name,
46546
+ platform: spec.platform,
46535
46547
  ...spec.debugPort !== void 0 && { debugPort: spec.debugPort },
46536
46548
  ...spec.tmpfs !== void 0 && { tmpfs: spec.tmpfs },
46537
46549
  ...spec.extraHosts !== void 0 && { extraHosts: spec.extraHosts }
@@ -47464,6 +47476,7 @@ async function buildContainerSpec(args) {
47464
47476
  if (lambda.kind === "zip") {
47465
47477
  codeDir = lambda.codePath ?? materializeInlineCode$1(lambda.handler, lambda.inlineCode ?? "", resolveRuntimeFileExtension(lambda.runtime), inlineTmpDirs);
47466
47478
  optDir = await materializeLambdaLayers$1(lambda.layers, layerTmpDirs, layerRoleArn);
47479
+ platform = architectureToPlatform(lambda.architecture);
47467
47480
  } else {
47468
47481
  imageRef = (await resolveContainerImageForStartApi(lambda, skipPull)).imageRef;
47469
47482
  platform = architectureToPlatform(lambda.architecture);
@@ -47530,6 +47543,7 @@ async function buildContainerSpec(args) {
47530
47543
  kind: "zip",
47531
47544
  lambda,
47532
47545
  codeDir,
47546
+ platform,
47533
47547
  env: dockerEnv,
47534
47548
  containerHost,
47535
47549
  ...optDir !== void 0 && { optDir },
@@ -47681,6 +47695,7 @@ function resolveLambdaByLogicalId(logicalId, stacks) {
47681
47695
  if (!inlineCode) codePath = resolveAssetCodePath(stack, logicalId, resource);
47682
47696
  const layers = resolveLambdaLayers(stack, logicalId, props);
47683
47697
  const ephemeralStorageMb = extractEphemeralStorageMb(props, logicalId);
47698
+ const architecture = extractStartApiArchitecture(props, logicalId);
47684
47699
  return {
47685
47700
  kind: "zip",
47686
47701
  stack,
@@ -47692,6 +47707,7 @@ function resolveLambdaByLogicalId(logicalId, stacks) {
47692
47707
  timeoutSec,
47693
47708
  codePath,
47694
47709
  layers,
47710
+ architecture,
47695
47711
  ...inlineCode !== void 0 && { inlineCode },
47696
47712
  ...ephemeralStorageMb !== void 0 && { ephemeralStorageMb }
47697
47713
  };
@@ -47741,6 +47757,23 @@ function extractImageUri(value, logicalId, stackName, resources, region) {
47741
47757
  }
47742
47758
  }
47743
47759
  /**
47760
+ * Parse `Properties.Architectures` into the single arch cdkd threads to
47761
+ * `--platform`. Defaults to `x86_64` (the AWS default) when absent; CDK
47762
+ * only ever sets one entry. Shared by BOTH the ZIP and IMAGE start-api
47763
+ * resolvers (issue #768) so the ZIP container run pins `--platform` the
47764
+ * same way the IMAGE path always has.
47765
+ */
47766
+ function extractStartApiArchitecture(props, logicalId) {
47767
+ const arches = props["Architectures"];
47768
+ if (Array.isArray(arches) && arches.length > 0) {
47769
+ const first = arches[0];
47770
+ if (first === "arm64") return "arm64";
47771
+ if (first === "x86_64") return "x86_64";
47772
+ throw new Error(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local start-api supports x86_64 and arm64.`);
47773
+ }
47774
+ return "x86_64";
47775
+ }
47776
+ /**
47744
47777
  * Build the IMAGE-variant `ResolvedStartApiLambda` from a Lambda
47745
47778
  * template entry with `Code.ImageUri`. Mirrors
47746
47779
  * `lambda-resolver.ts:extractImageLambdaProperties` but trimmed to the
@@ -47753,14 +47786,7 @@ function resolveImageLambda(args) {
47753
47786
  if (Array.isArray(rawImageConfig["Command"])) imageConfig.command = rawImageConfig["Command"].filter((s) => typeof s === "string");
47754
47787
  if (Array.isArray(rawImageConfig["EntryPoint"])) imageConfig.entryPoint = rawImageConfig["EntryPoint"].filter((s) => typeof s === "string");
47755
47788
  if (typeof rawImageConfig["WorkingDirectory"] === "string") imageConfig.workingDirectory = rawImageConfig["WorkingDirectory"];
47756
- const arches = props["Architectures"];
47757
- let architecture = "x86_64";
47758
- if (Array.isArray(arches) && arches.length > 0) {
47759
- const first = arches[0];
47760
- if (first === "arm64") architecture = "arm64";
47761
- else if (first === "x86_64") architecture = "x86_64";
47762
- else throw new Error(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local start-api supports x86_64 and arm64.`);
47763
- }
47789
+ const architecture = extractStartApiArchitecture(props, logicalId);
47764
47790
  const ephemeralStorageMb = extractEphemeralStorageMb(props, logicalId);
47765
47791
  return {
47766
47792
  kind: "image",
@@ -50791,23 +50817,36 @@ function createLocalInvokeAgentCoreCommand() {
50791
50817
  //#region src/cli/commands/local-start-agentcore.ts
50792
50818
  /**
50793
50819
  * `cdkd local start-agentcore <target>` — long-running serve for a Bedrock
50794
- * AgentCore Runtime's bidirectional `/ws` WebSocket endpoint. Boots the
50795
- * `AWS::BedrockAgentCore::Runtime` container (same image / env / credential
50796
- * resolution as `invoke-agentcore`) and fronts its `/ws` endpoint with a host
50797
- * WebSocket bridge that injects the AgentCore session-id (and `Authorization`
50798
- * under a `customJwtAuthorizer`) on the container upgrade, so a header-less
50799
- * client (e.g. a browser) can hold an interactive multi-frame session. HTTP /
50800
- * AGUI protocols only. The serve counterpart of the single-shot
50801
- * `cdkd local invoke-agentcore`. Inherited from cdk-local
50802
- * (go-to-k/cdk-local#420).
50820
+ * AgentCore Runtime against a WARM container. Boots the
50821
+ * `AWS::BedrockAgentCore::Runtime` container ONCE (same image / env / credential
50822
+ * resolution as `invoke-agentcore`) and keeps it warm, serving the runtime's
50823
+ * native protocol contract so a client can hit it repeatedly:
50824
+ *
50825
+ * - **HTTP / AGUI** runtimes serve `POST /invocations` + `GET /ping` proxied to
50826
+ * the warm container (session-id / boot-resolved `Authorization` injected,
50827
+ * request/response incl. SSE streamed) AND the bidirectional `/ws`
50828
+ * endpoint behind a host WebSocket bridge (injects the AgentCore session-id,
50829
+ * and `Authorization` under a `customJwtAuthorizer`, so a header-less client
50830
+ * such as a browser can hold an interactive multi-frame session), both on the
50831
+ * SAME host port.
50832
+ * - **MCP** runtimes serve `POST /mcp`; **A2A** runtimes serve `POST /` (no
50833
+ * `/ws` bridge).
50834
+ *
50835
+ * The serve counterpart of the single-shot `cdkd local invoke-agentcore`.
50836
+ * Inherited from cdk-local (go-to-k/cdk-local#420; warm HTTP serve + all four
50837
+ * protocols + per-request inbound JWT + `--sigv4` + `--watch` from #454 slices
50838
+ * 1/2/4a/4b, cdk-local#458/#459/#461/#462).
50803
50839
  *
50804
50840
  * Like `start-cloudfront`, this is a THIN pass-through to cdk-local's factory —
50805
50841
  * the serve behavior and the `start-agentcore`-only option block (`--port` /
50806
50842
  * `--host` / `--session-id` / `--bearer-token` / `--no-verify-auth` /
50807
- * `--env-vars` / `--platform` / `--no-pull` / `--no-build` / `--container-host`
50808
- * / `--timeout` / `--assume-role` / `--ecr-role-arn` / `--from-cfn-stack` /
50809
- * `--stack-region`) live in cdk-local's `addStartAgentCoreSpecificOptions` and
50810
- * are auto-inherited.
50843
+ * `--sigv4` / `--watch` / `--env-vars` / `--platform` / `--no-pull` /
50844
+ * `--no-build` / `--container-host` / `--timeout` / `--assume-role` /
50845
+ * `--ecr-role-arn` / `--from-cfn-stack` / `--stack-region`) live in cdk-local's
50846
+ * `addStartAgentCoreSpecificOptions` and are auto-inherited. Under a
50847
+ * `customJwtAuthorizer` the inbound JWT is now verified PER REQUEST on the warm
50848
+ * serve (401 missing / 403 invalid / forwarded on pass; `GET /ping` is
50849
+ * unauthenticated), with `--bearer-token` as the default-when-missing fallback.
50811
50850
  *
50812
50851
  * Like `start-cloudfront` / `start-alb` / `start-service`, this command binds
50813
50852
  * deployed state through cdk-local's `extraStateProviders` seam: the factory
@@ -51203,6 +51242,7 @@ async function resolveZipImagePlan(lambda, options) {
51203
51242
  }],
51204
51243
  extraMounts: layerPlan.mount ? [layerPlan.mount] : [],
51205
51244
  cmd: [lambda.handler],
51245
+ platform: architectureToPlatform(lambda.architecture),
51206
51246
  ...inlineTmpDir !== void 0 && { inlineTmpDir },
51207
51247
  ...layerPlan.tmpDir !== void 0 && { layersTmpDir: layerPlan.tmpDir },
51208
51248
  ...layerPlan.extraTmpDirs.length > 0 && { layerArnTmpDirs: layerPlan.extraTmpDirs },
@@ -52847,7 +52887,7 @@ function reorderArgs(argv) {
52847
52887
  async function main() {
52848
52888
  installPipeCloseHandler();
52849
52889
  const program = new Command();
52850
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.210.0");
52890
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.211.0");
52851
52891
  program.addCommand(createBootstrapCommand());
52852
52892
  program.addCommand(createSynthCommand());
52853
52893
  program.addCommand(createListCommand());