@go-to-k/cdkd 0.260.13 → 0.261.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/dist/cli.js CHANGED
@@ -1901,7 +1901,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1901
1901
  const FLUSH_EVENT_THRESHOLD = 50;
1902
1902
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1903
1903
  function getCdkdVersion() {
1904
- return "0.260.13";
1904
+ return "0.261.0";
1905
1905
  }
1906
1906
  /**
1907
1907
  * Generate a time-sortable unique run id, e.g.
@@ -20896,11 +20896,7 @@ var AgentCoreRuntimeProvider = class {
20896
20896
  this.logger.debug(`Created BedrockAgentCore Runtime: ${agentRuntimeId} (${agentRuntimeArn})`);
20897
20897
  return {
20898
20898
  physicalId: agentRuntimeId,
20899
- attributes: {
20900
- Arn: agentRuntimeArn,
20901
- AgentRuntimeId: agentRuntimeId,
20902
- AgentRuntimeName: agentRuntimeName
20903
- }
20899
+ attributes: this.buildAttributes(response, agentRuntimeName)
20904
20900
  };
20905
20901
  } catch (error) {
20906
20902
  const cause = error instanceof Error ? error : void 0;
@@ -20932,17 +20928,12 @@ var AgentCoreRuntimeProvider = class {
20932
20928
  if (properties["EnvironmentVariables"] !== void 0) input["environmentVariables"] = properties["EnvironmentVariables"];
20933
20929
  if (properties["ClientToken"] !== void 0) input["clientToken"] = properties["ClientToken"];
20934
20930
  const response = await this.client.send(new UpdateAgentRuntimeCommand(input));
20935
- const agentRuntimeArn = response.agentRuntimeArn;
20936
20931
  const agentRuntimeId = response.agentRuntimeId;
20937
20932
  this.logger.debug(`Successfully updated BedrockAgentCore Runtime ${logicalId}`);
20938
20933
  return {
20939
20934
  physicalId: agentRuntimeId,
20940
20935
  wasReplaced: false,
20941
- attributes: {
20942
- Arn: agentRuntimeArn,
20943
- AgentRuntimeId: agentRuntimeId,
20944
- AgentRuntimeName: properties["AgentRuntimeName"]
20945
- }
20936
+ attributes: this.buildAttributes(response, properties["AgentRuntimeName"])
20946
20937
  };
20947
20938
  } catch (error) {
20948
20939
  const cause = error instanceof Error ? error : void 0;
@@ -20968,13 +20959,58 @@ var AgentCoreRuntimeProvider = class {
20968
20959
  }
20969
20960
  }
20970
20961
  /**
20971
- * Get resource attribute (for Fn::GetAtt resolution)
20962
+ * Build the CFn read-only attribute map recorded in cdkd state for
20963
+ * `Fn::GetAtt` resolution.
20964
+ *
20965
+ * CloudFormation exposes `AWS::BedrockAgentCore::Runtime`'s read-only
20966
+ * attributes under the names `AgentRuntimeArn` / `AgentRuntimeId` /
20967
+ * `AgentRuntimeVersion` / `Status` / `CreatedAt` /
20968
+ * `WorkloadIdentityDetails` (the type's registry-schema
20969
+ * `readOnlyProperties`). The stored `attributes` map is looked up BY CFn
20970
+ * attribute name during output / cross-resource `Fn::GetAtt` resolution
20971
+ * (`IntrinsicFunctionResolver.constructAttribute` never calls
20972
+ * `getAttribute`), so the keys MUST match those CFn names. The previous
20973
+ * `Arn` key meant `Fn::GetAtt [Runtime, AgentRuntimeArn]` missed the
20974
+ * cached attribute, fell through to the unknown-attribute guard, and hard
20975
+ * -failed because the physical id (the runtime name) is not ARN-shaped
20976
+ * (issue #1179).
20977
+ */
20978
+ buildAttributes(response, agentRuntimeName) {
20979
+ const attributes = {
20980
+ AgentRuntimeArn: response.agentRuntimeArn,
20981
+ AgentRuntimeId: response.agentRuntimeId,
20982
+ AgentRuntimeName: agentRuntimeName
20983
+ };
20984
+ if (response.agentRuntimeVersion !== void 0) attributes["AgentRuntimeVersion"] = response.agentRuntimeVersion;
20985
+ if (response.status !== void 0) attributes["Status"] = response.status;
20986
+ if (response.createdAt !== void 0) attributes["CreatedAt"] = response.createdAt.toISOString();
20987
+ if (response.workloadIdentityDetails !== void 0) attributes["WorkloadIdentityDetails"] = camelToPascalCaseKeys(response.workloadIdentityDetails);
20988
+ return attributes;
20989
+ }
20990
+ /**
20991
+ * Get resource attribute (for a live `Fn::GetAtt` fetch, e.g. `cdkd
20992
+ * orphan`). Output / cross-resource resolution reads the cached
20993
+ * `attributes` map written by {@link buildAttributes}; this live path
20994
+ * covers callers that bypass that cache.
20995
+ *
20996
+ * `WorkloadIdentityDetails` is NOT resolvable here because
20997
+ * `GetAgentRuntime` does not return it (it is a create/update-time
20998
+ * response field only); it stays available via the cached attributes.
20972
20999
  */
20973
21000
  async getAttribute(physicalId, _resourceType, attributeName) {
20974
- if (attributeName === "Arn" || attributeName === "AgentRuntimeArn") return (await this.client.send(new GetAgentRuntimeCommand({ agentRuntimeId: physicalId }))).agentRuntimeArn;
20975
21001
  if (attributeName === "AgentRuntimeId") return physicalId;
20976
- if (attributeName === "AgentRuntimeName") return (await this.client.send(new GetAgentRuntimeCommand({ agentRuntimeId: physicalId }))).agentRuntimeName;
20977
- throw new Error(`Unsupported attribute: ${attributeName} for AWS::BedrockAgentCore::Runtime`);
21002
+ const response = await this.client.send(new GetAgentRuntimeCommand({ agentRuntimeId: physicalId }));
21003
+ switch (attributeName) {
21004
+ case "Arn":
21005
+ case "AgentRuntimeArn": return response.agentRuntimeArn;
21006
+ case "AgentRuntimeName": return response.agentRuntimeName;
21007
+ case "AgentRuntimeVersion": return response.agentRuntimeVersion;
21008
+ case "Status": return response.status;
21009
+ case "CreatedAt": return response.createdAt?.toISOString();
21010
+ case "LastUpdatedAt": return response.lastUpdatedAt?.toISOString();
21011
+ case "FailureReason": return response.failureReason;
21012
+ default: throw new Error(`Unsupported attribute: ${attributeName} for AWS::BedrockAgentCore::Runtime`);
21013
+ }
20978
21014
  }
20979
21015
  /**
20980
21016
  * Read the AWS-current BedrockAgentCore Runtime configuration in
@@ -21038,13 +21074,35 @@ var AgentCoreRuntimeProvider = class {
21038
21074
  * adopting an existing runtime should pass
21039
21075
  * `--resource <logicalId>=<agentRuntimeId>` (e.g. `runtime-12345`,
21040
21076
  * matching the physical id format returned by `create()`).
21077
+ *
21078
+ * The imported record's `attributes` are enriched to the same CFn read-only
21079
+ * set `create()` / `update()` write (via {@link buildAttributes}) so an
21080
+ * imported runtime resolves `Fn::GetAtt [Runtime, AgentRuntimeArn]` (and the
21081
+ * other read-only attributes) from cached state, matching deploy-created
21082
+ * runtimes (issue #1188). The enrichment is best-effort: a single
21083
+ * `GetAgentRuntime` is issued, and any failure (throttle, transient error,
21084
+ * a `--resource` id that does not resolve) falls back to the minimal
21085
+ * `{ AgentRuntimeId }` record — the live `getAttribute()` path still resolves
21086
+ * the ARN, so import never fails on the enrichment. `WorkloadIdentityDetails`
21087
+ * is not populated here (`GetAgentRuntime` does not return it — it is a
21088
+ * create/update-response field only).
21041
21089
  */
21042
21090
  async import(input) {
21043
- if (input.knownPhysicalId) return {
21044
- physicalId: input.knownPhysicalId,
21045
- attributes: { AgentRuntimeId: input.knownPhysicalId }
21046
- };
21047
- return null;
21091
+ if (!input.knownPhysicalId) return null;
21092
+ const physicalId = input.knownPhysicalId;
21093
+ try {
21094
+ const resp = await this.client.send(new GetAgentRuntimeCommand({ agentRuntimeId: physicalId }));
21095
+ return {
21096
+ physicalId,
21097
+ attributes: this.buildAttributes(resp, resp.agentRuntimeName ?? "")
21098
+ };
21099
+ } catch (err) {
21100
+ this.logger.debug(`Could not enrich imported BedrockAgentCore Runtime ${physicalId} attributes (${err instanceof Error ? err.message : String(err)}); recording AgentRuntimeId only (Fn::GetAtt resolves live via getAttribute)`);
21101
+ return {
21102
+ physicalId,
21103
+ attributes: { AgentRuntimeId: physicalId }
21104
+ };
21105
+ }
21048
21106
  }
21049
21107
  };
21050
21108
 
@@ -62018,7 +62076,7 @@ function createMigrateCommand() {
62018
62076
  */
62019
62077
  function buildProgram() {
62020
62078
  const program = new Command();
62021
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.13");
62079
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.261.0");
62022
62080
  program.addCommand(createBootstrapCommand());
62023
62081
  program.addCommand(createSynthCommand());
62024
62082
  program.addCommand(createListCommand());