@clef-sh/core 0.1.11-beta.68 → 0.1.11-beta.74

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/index.js CHANGED
@@ -608,7 +608,7 @@ var require_age_encryption = __commonJS({
608
608
  };
609
609
  }
610
610
  // @__NO_SIDE_EFFECTS__
611
- function join18(separator = "") {
611
+ function join21(separator = "") {
612
612
  astr("join", separator);
613
613
  return {
614
614
  encode: (from) => {
@@ -738,9 +738,9 @@ var require_age_encryption = __commonJS({
738
738
  decode(s) {
739
739
  return decodeBase64Builtin(s, false);
740
740
  }
741
- } : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join18(""));
742
- var base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ join18(""));
743
- var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ join18(""));
741
+ } : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join21(""));
742
+ var base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ join21(""));
743
+ var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ join21(""));
744
744
  var POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059];
745
745
  function bech32Polymod(pre) {
746
746
  const b = pre >> 25;
@@ -6921,7 +6921,9 @@ __export(index_exports, {
6921
6921
  CLEF_SUPPORTED_EXTENSIONS: () => CLEF_SUPPORTED_EXTENSIONS,
6922
6922
  ClefError: () => ClefError,
6923
6923
  CloudApiError: () => CloudApiError,
6924
+ CloudArtifactClient: () => CloudArtifactClient,
6924
6925
  CloudClient: () => CloudClient,
6926
+ CloudPackClient: () => CloudPackClient,
6925
6927
  ConsumptionClient: () => ConsumptionClient,
6926
6928
  DiffEngine: () => DiffEngine,
6927
6929
  DriftDetector: () => DriftDetector,
@@ -6965,6 +6967,7 @@ __export(index_exports, {
6965
6967
  generateRandomValue: () => generateRandomValue,
6966
6968
  generateSigningKeyPair: () => generateSigningKeyPair,
6967
6969
  getPendingKeys: () => getPendingKeys,
6970
+ initiateDeviceFlow: () => initiateDeviceFlow,
6968
6971
  isHighEntropy: () => isHighEntropy,
6969
6972
  isKmsEnvelope: () => isKmsEnvelope,
6970
6973
  isPending: () => isPending,
@@ -6982,13 +6985,17 @@ __export(index_exports, {
6982
6985
  parseIgnoreContent: () => parseIgnoreContent,
6983
6986
  parseJson: () => parseJson,
6984
6987
  parseYaml: () => parseYaml,
6988
+ pollDeviceFlow: () => pollDeviceFlow,
6989
+ readCloudCredentials: () => readCloudCredentials,
6985
6990
  readManifestYaml: () => readManifestYaml,
6986
6991
  redactValue: () => redactValue,
6987
6992
  removeAccessRequest: () => removeRequest,
6988
6993
  requestsFilePath: () => requestsFilePath,
6994
+ resetKeyserviceResolution: () => resetKeyserviceResolution,
6989
6995
  resetSopsResolution: () => resetSopsResolution,
6990
6996
  resolveBackendConfig: () => resolveBackendConfig,
6991
6997
  resolveIdentitySecrets: () => resolveIdentitySecrets,
6998
+ resolveKeyservicePath: () => resolveKeyservicePath,
6992
6999
  resolveRecipientsForEnvironment: () => resolveRecipientsForEnvironment,
6993
7000
  resolveSopsPath: () => resolveSopsPath,
6994
7001
  saveMetadata: () => saveMetadata,
@@ -6998,9 +7005,11 @@ __export(index_exports, {
6998
7005
  shouldIgnoreMatch: () => shouldIgnoreMatch,
6999
7006
  signEd25519: () => signEd25519,
7000
7007
  signKms: () => signKms,
7008
+ spawnKeyservice: () => spawnKeyservice,
7001
7009
  upsertRequest: () => upsertRequest,
7002
7010
  validateAgePublicKey: () => validateAgePublicKey,
7003
7011
  verifySignature: () => verifySignature,
7012
+ writeCloudCredentials: () => writeCloudCredentials,
7004
7013
  writeManifestYaml: () => writeManifestYaml
7005
7014
  });
7006
7015
  module.exports = __toCommonJS(index_exports);
@@ -7155,7 +7164,7 @@ function keyPreview(key) {
7155
7164
 
7156
7165
  // src/manifest/parser.ts
7157
7166
  var CLEF_MANIFEST_FILENAME = "clef.yaml";
7158
- var VALID_BACKENDS = ["age", "awskms", "gcpkms", "azurekv", "pgp"];
7167
+ var VALID_BACKENDS = ["age", "awskms", "gcpkms", "azurekv", "pgp", "cloud"];
7159
7168
  var VALID_TOP_LEVEL_KEYS = [
7160
7169
  "version",
7161
7170
  "environments",
@@ -7680,7 +7689,26 @@ var ManifestParser = class {
7680
7689
  "cloud"
7681
7690
  );
7682
7691
  }
7683
- cloud = { integrationId: cloudObj.integrationId };
7692
+ if (typeof cloudObj.keyId !== "string" || cloudObj.keyId.length === 0) {
7693
+ throw new ManifestValidationError(
7694
+ "Field 'cloud.keyId' is required and must be a non-empty string.",
7695
+ "cloud"
7696
+ );
7697
+ }
7698
+ if (!/^clef:[a-z0-9_]+\/[a-z0-9_-]+$/.test(cloudObj.keyId)) {
7699
+ throw new ManifestValidationError(
7700
+ `Field 'cloud.keyId' has invalid format '${cloudObj.keyId}'. Must match: clef:<integrationId>/<keyAlias>`,
7701
+ "cloud"
7702
+ );
7703
+ }
7704
+ cloud = { integrationId: cloudObj.integrationId, keyId: cloudObj.keyId };
7705
+ }
7706
+ const usesCloudBackend = sopsConfig.default_backend === "cloud" || environments.some((e) => e.sops?.backend === "cloud");
7707
+ if (usesCloudBackend && !cloud) {
7708
+ throw new ManifestValidationError(
7709
+ "One or more environments use the 'cloud' backend but the manifest is missing the top-level 'cloud' block with 'integrationId' and 'keyId'.",
7710
+ "cloud"
7711
+ );
7684
7712
  }
7685
7713
  return {
7686
7714
  version: 1,
@@ -9088,14 +9116,18 @@ var SopsClient = class {
9088
9116
  * to the subprocess environment.
9089
9117
  * @param sopsPath - Optional explicit path to the sops binary. When omitted,
9090
9118
  * resolved automatically via {@link resolveSopsPath}.
9119
+ * @param keyserviceAddr - Optional keyservice address (e.g. `tcp://127.0.0.1:12345`).
9120
+ * When set, all SOPS invocations include `--enable-local-keyservice=false --keyservice <addr>`.
9091
9121
  */
9092
- constructor(runner, ageKeyFile, ageKey, sopsPath) {
9122
+ constructor(runner, ageKeyFile, ageKey, sopsPath, keyserviceAddr) {
9093
9123
  this.runner = runner;
9094
9124
  this.ageKeyFile = ageKeyFile;
9095
9125
  this.ageKey = ageKey;
9096
9126
  this.sopsCommand = sopsPath ?? resolveSopsPath().path;
9127
+ this.keyserviceArgs = keyserviceAddr ? ["--enable-local-keyservice=false", "--keyservice", keyserviceAddr] : [];
9097
9128
  }
9098
9129
  sopsCommand;
9130
+ keyserviceArgs;
9099
9131
  buildSopsEnv() {
9100
9132
  const env = {};
9101
9133
  if (this.ageKey) {
@@ -9120,7 +9152,7 @@ var SopsClient = class {
9120
9152
  const env = this.buildSopsEnv();
9121
9153
  const result = await this.runner.run(
9122
9154
  this.sopsCommand,
9123
- ["decrypt", "--output-type", fmt, filePath],
9155
+ [...this.keyserviceArgs, "decrypt", "--output-type", fmt, filePath],
9124
9156
  {
9125
9157
  ...env ? { env } : {}
9126
9158
  }
@@ -9186,6 +9218,7 @@ var SopsClient = class {
9186
9218
  [
9187
9219
  "--config",
9188
9220
  configPath,
9221
+ ...this.keyserviceArgs,
9189
9222
  "encrypt",
9190
9223
  ...args,
9191
9224
  "--input-type",
@@ -9240,7 +9273,7 @@ var SopsClient = class {
9240
9273
  const env = this.buildSopsEnv();
9241
9274
  const result = await this.runner.run(
9242
9275
  this.sopsCommand,
9243
- ["rotate", "-i", "--add-age", key, filePath],
9276
+ [...this.keyserviceArgs, "rotate", "-i", "--add-age", key, filePath],
9244
9277
  {
9245
9278
  ...env ? { env } : {}
9246
9279
  }
@@ -9264,7 +9297,7 @@ var SopsClient = class {
9264
9297
  const env = this.buildSopsEnv();
9265
9298
  const result = await this.runner.run(
9266
9299
  this.sopsCommand,
9267
- ["rotate", "-i", "--rm-age", key, filePath],
9300
+ [...this.keyserviceArgs, "rotate", "-i", "--rm-age", key, filePath],
9268
9301
  {
9269
9302
  ...env ? { env } : {}
9270
9303
  }
@@ -9376,7 +9409,13 @@ var SopsClient = class {
9376
9409
  }
9377
9410
  detectBackend(sops) {
9378
9411
  if (sops.age && Array.isArray(sops.age) && sops.age.length > 0) return "age";
9379
- if (sops.kms && Array.isArray(sops.kms) && sops.kms.length > 0) return "awskms";
9412
+ if (sops.kms && Array.isArray(sops.kms) && sops.kms.length > 0) {
9413
+ const firstArn = sops.kms[0]?.arn;
9414
+ if (typeof firstArn === "string" && firstArn.startsWith("clef:")) {
9415
+ return "cloud";
9416
+ }
9417
+ return "awskms";
9418
+ }
9380
9419
  if (sops.gcp_kms && Array.isArray(sops.gcp_kms) && sops.gcp_kms.length > 0)
9381
9420
  return "gcpkms";
9382
9421
  if (sops.azure_kv && Array.isArray(sops.azure_kv) && sops.azure_kv.length > 0)
@@ -9390,6 +9429,7 @@ var SopsClient = class {
9390
9429
  const entries = sops.age;
9391
9430
  return entries?.map((e) => String(e.recipient ?? "")) ?? [];
9392
9431
  }
9432
+ case "cloud":
9393
9433
  case "awskms": {
9394
9434
  const entries = sops.kms;
9395
9435
  return entries?.map((e) => String(e.arn ?? "")) ?? [];
@@ -9451,6 +9491,13 @@ var SopsClient = class {
9451
9491
  args.push("--pgp", config.pgp_fingerprint);
9452
9492
  }
9453
9493
  break;
9494
+ case "cloud": {
9495
+ const cloudKeyId = manifest.cloud?.keyId;
9496
+ if (cloudKeyId) {
9497
+ args.push("--kms", cloudKeyId);
9498
+ }
9499
+ break;
9500
+ }
9454
9501
  }
9455
9502
  return args;
9456
9503
  }
@@ -11675,7 +11722,8 @@ var BACKEND_KEY_FIELDS = {
11675
11722
  awskms: "aws_kms_arn",
11676
11723
  gcpkms: "gcp_kms_resource_id",
11677
11724
  azurekv: "azure_kv_url",
11678
- pgp: "pgp_fingerprint"
11725
+ pgp: "pgp_fingerprint",
11726
+ cloud: void 0
11679
11727
  };
11680
11728
  var ALL_KEY_FIELDS = Object.values(BACKEND_KEY_FIELDS).filter(
11681
11729
  (v) => v !== void 0
@@ -11863,6 +11911,276 @@ var BackendMigrator = class {
11863
11911
  }
11864
11912
  }
11865
11913
  };
11914
+
11915
+ // src/cloud/keyservice.ts
11916
+ var import_child_process = require("child_process");
11917
+ var readline = __toESM(require("readline"));
11918
+ var PORT_REGEX = /^PORT=(\d+)$/;
11919
+ var STARTUP_TIMEOUT_MS = 5e3;
11920
+ var SHUTDOWN_TIMEOUT_MS = 3e3;
11921
+ async function spawnKeyservice(options) {
11922
+ const args = ["--addr", "127.0.0.1:0"];
11923
+ if (options.endpoint) {
11924
+ args.push("--endpoint", options.endpoint);
11925
+ }
11926
+ const child = (0, import_child_process.spawn)(options.binaryPath, args, {
11927
+ stdio: ["ignore", "pipe", "pipe"],
11928
+ env: { ...process.env, CLEF_CLOUD_TOKEN: options.token }
11929
+ });
11930
+ const port = await readPort(child);
11931
+ const addr = `tcp://127.0.0.1:${port}`;
11932
+ return {
11933
+ addr,
11934
+ kill: () => killGracefully(child)
11935
+ };
11936
+ }
11937
+ function readPort(child) {
11938
+ return new Promise((resolve, reject) => {
11939
+ let settled = false;
11940
+ const rl = readline.createInterface({ input: child.stdout });
11941
+ function settle() {
11942
+ clearTimeout(timer);
11943
+ rl.close();
11944
+ }
11945
+ const timer = setTimeout(() => {
11946
+ if (!settled) {
11947
+ settled = true;
11948
+ settle();
11949
+ child.kill("SIGKILL");
11950
+ reject(new Error("Keyservice did not start within 5 seconds."));
11951
+ }
11952
+ }, STARTUP_TIMEOUT_MS);
11953
+ rl.on("line", (line) => {
11954
+ const match = PORT_REGEX.exec(line);
11955
+ if (match && !settled) {
11956
+ settled = true;
11957
+ settle();
11958
+ resolve(parseInt(match[1], 10));
11959
+ }
11960
+ });
11961
+ child.on("error", (err) => {
11962
+ if (!settled) {
11963
+ settled = true;
11964
+ settle();
11965
+ reject(new Error(`Failed to start keyservice: ${err.message}`));
11966
+ }
11967
+ });
11968
+ child.on("exit", (code) => {
11969
+ if (!settled) {
11970
+ settled = true;
11971
+ settle();
11972
+ reject(new Error(`Keyservice exited unexpectedly with code ${code}.`));
11973
+ }
11974
+ });
11975
+ });
11976
+ }
11977
+ function killGracefully(child) {
11978
+ return new Promise((resolve) => {
11979
+ if (child.exitCode !== null) {
11980
+ resolve();
11981
+ return;
11982
+ }
11983
+ const timer = setTimeout(() => {
11984
+ child.kill("SIGKILL");
11985
+ }, SHUTDOWN_TIMEOUT_MS);
11986
+ child.on("exit", () => {
11987
+ clearTimeout(timer);
11988
+ resolve();
11989
+ });
11990
+ child.kill("SIGTERM");
11991
+ });
11992
+ }
11993
+
11994
+ // src/cloud/resolver.ts
11995
+ var fs19 = __toESM(require("fs"));
11996
+ var path22 = __toESM(require("path"));
11997
+
11998
+ // src/cloud/bundled.ts
11999
+ var fs18 = __toESM(require("fs"));
12000
+ var path21 = __toESM(require("path"));
12001
+ function tryBundledKeyservice() {
12002
+ const platform = process.platform;
12003
+ const arch = process.arch;
12004
+ const archName = arch === "x64" ? "x64" : arch === "arm64" ? "arm64" : null;
12005
+ if (!archName) return null;
12006
+ const platformName = platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : platform === "win32" ? "win32" : null;
12007
+ if (!platformName) return null;
12008
+ const packageName = `@clef-sh/keyservice-${platformName}-${archName}`;
12009
+ const binName = platform === "win32" ? "clef-keyservice.exe" : "clef-keyservice";
12010
+ try {
12011
+ const packageMain = require.resolve(`${packageName}/package.json`);
12012
+ const packageDir = path21.dirname(packageMain);
12013
+ const binPath = path21.join(packageDir, "bin", binName);
12014
+ return fs18.existsSync(binPath) ? binPath : null;
12015
+ } catch {
12016
+ return null;
12017
+ }
12018
+ }
12019
+
12020
+ // src/cloud/resolver.ts
12021
+ function validateKeyservicePath(candidate) {
12022
+ if (!path22.isAbsolute(candidate)) {
12023
+ throw new Error(`CLEF_KEYSERVICE_PATH must be an absolute path, got '${candidate}'.`);
12024
+ }
12025
+ const segments = candidate.split(/[/\\]/);
12026
+ if (segments.includes("..")) {
12027
+ throw new Error(
12028
+ `CLEF_KEYSERVICE_PATH contains '..' path segments ('${candidate}'). Use an absolute path without directory traversal.`
12029
+ );
12030
+ }
12031
+ }
12032
+ var cached2;
12033
+ function resolveKeyservicePath() {
12034
+ if (cached2) return cached2;
12035
+ const envPath = process.env.CLEF_KEYSERVICE_PATH?.trim();
12036
+ if (envPath) {
12037
+ validateKeyservicePath(envPath);
12038
+ if (!fs19.existsSync(envPath)) {
12039
+ throw new Error(`CLEF_KEYSERVICE_PATH points to '${envPath}' but the file does not exist.`);
12040
+ }
12041
+ cached2 = { path: envPath, source: "env" };
12042
+ return cached2;
12043
+ }
12044
+ const bundledPath = tryBundledKeyservice();
12045
+ if (bundledPath) {
12046
+ cached2 = { path: bundledPath, source: "bundled" };
12047
+ return cached2;
12048
+ }
12049
+ cached2 = { path: "clef-keyservice", source: "system" };
12050
+ return cached2;
12051
+ }
12052
+ function resetKeyserviceResolution() {
12053
+ cached2 = void 0;
12054
+ }
12055
+
12056
+ // src/cloud/credentials.ts
12057
+ var fs20 = __toESM(require("fs"));
12058
+ var path23 = __toESM(require("path"));
12059
+ var os2 = __toESM(require("os"));
12060
+ var YAML12 = __toESM(require("yaml"));
12061
+
12062
+ // src/cloud/constants.ts
12063
+ var CLOUD_DEFAULT_ENDPOINT = "https://api.clef.sh";
12064
+
12065
+ // src/cloud/credentials.ts
12066
+ var CREDENTIALS_FILENAME = "credentials.yaml";
12067
+ function readCloudCredentials() {
12068
+ const credPath = path23.join(os2.homedir(), ".clef", CREDENTIALS_FILENAME);
12069
+ let raw;
12070
+ try {
12071
+ raw = YAML12.parse(fs20.readFileSync(credPath, "utf-8"));
12072
+ } catch {
12073
+ return null;
12074
+ }
12075
+ if (!raw || typeof raw !== "object") return null;
12076
+ const obj = raw;
12077
+ if (typeof obj.token !== "string" || obj.token.length === 0) return null;
12078
+ return {
12079
+ token: obj.token,
12080
+ endpoint: typeof obj.endpoint === "string" ? obj.endpoint : CLOUD_DEFAULT_ENDPOINT
12081
+ };
12082
+ }
12083
+ function writeCloudCredentials(credentials) {
12084
+ const clefDir = path23.join(os2.homedir(), ".clef");
12085
+ fs20.mkdirSync(clefDir, { recursive: true, mode: 448 });
12086
+ const credPath = path23.join(clefDir, CREDENTIALS_FILENAME);
12087
+ const content = { token: credentials.token };
12088
+ if (credentials.endpoint) {
12089
+ content.endpoint = credentials.endpoint;
12090
+ }
12091
+ fs20.writeFileSync(credPath, YAML12.stringify(content), { mode: 384 });
12092
+ }
12093
+
12094
+ // src/cloud/device-flow.ts
12095
+ async function initiateDeviceFlow(endpoint, options) {
12096
+ const base = endpoint ?? CLOUD_DEFAULT_ENDPOINT;
12097
+ const res = await fetch(`${base}/api/v1/device/init`, {
12098
+ method: "POST",
12099
+ headers: { "Content-Type": "application/json" },
12100
+ body: JSON.stringify({
12101
+ clientType: "cli",
12102
+ clientVersion: options.clientVersion,
12103
+ repoName: options.repoName,
12104
+ environment: options.environment
12105
+ })
12106
+ });
12107
+ if (!res.ok) {
12108
+ const body = await res.text().catch(() => "");
12109
+ throw new Error(`Device flow init failed (${res.status}): ${body}`);
12110
+ }
12111
+ return await res.json();
12112
+ }
12113
+ async function pollDeviceFlow(pollUrl) {
12114
+ const res = await fetch(pollUrl);
12115
+ if (!res.ok) {
12116
+ const body = await res.text().catch(() => "");
12117
+ throw new Error(`Device flow poll failed (${res.status}): ${body}`);
12118
+ }
12119
+ return await res.json();
12120
+ }
12121
+
12122
+ // src/cloud/pack-client.ts
12123
+ var fs21 = __toESM(require("fs"));
12124
+ var path24 = __toESM(require("path"));
12125
+ var CloudPackClient = class {
12126
+ endpoint;
12127
+ constructor(endpoint) {
12128
+ this.endpoint = endpoint ?? CLOUD_DEFAULT_ENDPOINT;
12129
+ }
12130
+ async pack(token, config) {
12131
+ const matrixManager = new MatrixManager();
12132
+ const cells = matrixManager.resolveMatrix(config.manifest, config.repoRoot).filter((c) => c.environment === config.environment && c.exists);
12133
+ const formData = new FormData();
12134
+ const configJson = JSON.stringify({
12135
+ identity: config.identity,
12136
+ environment: config.environment,
12137
+ ...config.ttl ? { ttl: config.ttl } : {}
12138
+ });
12139
+ formData.append("config", new Blob([configJson], { type: "application/json" }));
12140
+ const manifestPath = path24.join(config.repoRoot, "clef.yaml");
12141
+ const manifestContent = fs21.readFileSync(manifestPath, "utf-8");
12142
+ formData.append("manifest", new Blob([manifestContent], { type: "text/yaml" }));
12143
+ for (const cell of cells) {
12144
+ const relPath = path24.relative(config.repoRoot, cell.filePath);
12145
+ const content = fs21.readFileSync(cell.filePath, "utf-8");
12146
+ formData.append(`files`, new Blob([content], { type: "text/yaml" }), relPath);
12147
+ }
12148
+ const res = await fetch(`${this.endpoint}/api/v1/cloud/pack`, {
12149
+ method: "POST",
12150
+ headers: { Authorization: `Bearer ${token}` },
12151
+ body: formData
12152
+ });
12153
+ if (!res.ok) {
12154
+ const body = await res.text().catch(() => "");
12155
+ throw new Error(`Cloud pack failed (${res.status}): ${body}`);
12156
+ }
12157
+ return await res.json();
12158
+ }
12159
+ };
12160
+ var CloudArtifactClient = class {
12161
+ endpoint;
12162
+ constructor(endpoint) {
12163
+ this.endpoint = endpoint ?? CLOUD_DEFAULT_ENDPOINT;
12164
+ }
12165
+ async upload(token, config) {
12166
+ const content = fs21.readFileSync(config.artifactPath, "utf-8");
12167
+ const res = await fetch(
12168
+ `${this.endpoint}/api/v1/cloud/artifacts/${config.identity}/${config.environment}`,
12169
+ {
12170
+ method: "PUT",
12171
+ headers: {
12172
+ Authorization: `Bearer ${token}`,
12173
+ "Content-Type": "application/json"
12174
+ },
12175
+ body: content
12176
+ }
12177
+ );
12178
+ if (!res.ok) {
12179
+ const body = await res.text().catch(() => "");
12180
+ throw new Error(`Artifact upload failed (${res.status}): ${body}`);
12181
+ }
12182
+ }
12183
+ };
11866
12184
  // Annotate the CommonJS export names for ESM import in node:
11867
12185
  0 && (module.exports = {
11868
12186
  ArtifactPacker,
@@ -11873,7 +12191,9 @@ var BackendMigrator = class {
11873
12191
  CLEF_SUPPORTED_EXTENSIONS,
11874
12192
  ClefError,
11875
12193
  CloudApiError,
12194
+ CloudArtifactClient,
11876
12195
  CloudClient,
12196
+ CloudPackClient,
11877
12197
  ConsumptionClient,
11878
12198
  DiffEngine,
11879
12199
  DriftDetector,
@@ -11917,6 +12237,7 @@ var BackendMigrator = class {
11917
12237
  generateRandomValue,
11918
12238
  generateSigningKeyPair,
11919
12239
  getPendingKeys,
12240
+ initiateDeviceFlow,
11920
12241
  isHighEntropy,
11921
12242
  isKmsEnvelope,
11922
12243
  isPending,
@@ -11934,13 +12255,17 @@ var BackendMigrator = class {
11934
12255
  parseIgnoreContent,
11935
12256
  parseJson,
11936
12257
  parseYaml,
12258
+ pollDeviceFlow,
12259
+ readCloudCredentials,
11937
12260
  readManifestYaml,
11938
12261
  redactValue,
11939
12262
  removeAccessRequest,
11940
12263
  requestsFilePath,
12264
+ resetKeyserviceResolution,
11941
12265
  resetSopsResolution,
11942
12266
  resolveBackendConfig,
11943
12267
  resolveIdentitySecrets,
12268
+ resolveKeyservicePath,
11944
12269
  resolveRecipientsForEnvironment,
11945
12270
  resolveSopsPath,
11946
12271
  saveMetadata,
@@ -11950,9 +12275,11 @@ var BackendMigrator = class {
11950
12275
  shouldIgnoreMatch,
11951
12276
  signEd25519,
11952
12277
  signKms,
12278
+ spawnKeyservice,
11953
12279
  upsertRequest,
11954
12280
  validateAgePublicKey,
11955
12281
  verifySignature,
12282
+ writeCloudCredentials,
11956
12283
  writeManifestYaml
11957
12284
  });
11958
12285
  /*! Bundled license information: