@kitsy/cnos 1.9.2 → 1.11.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 (61) hide show
  1. package/dist/build/index.cjs +523 -80
  2. package/dist/build/index.d.cts +1 -1
  3. package/dist/build/index.d.ts +1 -1
  4. package/dist/build/index.js +13 -15
  5. package/dist/{chunk-6QQPHDUI.js → chunk-2DMCB3PK.js} +1 -1
  6. package/dist/{chunk-LURQ4LAK.js → chunk-5JGNRADB.js} +1 -1
  7. package/dist/{chunk-2JBA2LXU.js → chunk-DPC2BV3S.js} +35 -6
  8. package/dist/{chunk-7JZO6XN3.js → chunk-KJ57PF47.js} +1 -1
  9. package/dist/{chunk-CPGRRZLP.js → chunk-NFGPS7VJ.js} +8 -8
  10. package/dist/{chunk-A2WG3ZKW.js → chunk-NU25VFA2.js} +1 -1
  11. package/dist/{chunk-L7JVECPE.js → chunk-RNTTPI5S.js} +1 -1
  12. package/dist/{chunk-NVFACB64.js → chunk-T3E57MSQ.js} +1 -1
  13. package/dist/{chunk-7KVM5PUW.js → chunk-WPB4HB2K.js} +478 -61
  14. package/dist/{chunk-QK7BMU47.js → chunk-XGK6DXQL.js} +157 -37
  15. package/dist/configure/index.cjs +521 -76
  16. package/dist/configure/index.d.cts +3 -3
  17. package/dist/configure/index.d.ts +3 -3
  18. package/dist/configure/index.js +8 -8
  19. package/dist/{core-zDTUSVx9.d.cts → core-BW8SLnRx.d.cts} +46 -7
  20. package/dist/{core-zDTUSVx9.d.ts → core-BW8SLnRx.d.ts} +46 -7
  21. package/dist/{envNaming-EFzezmB3.d.cts → envNaming-1rk7BR0e.d.cts} +1 -1
  22. package/dist/{envNaming-BkorOKW_.d.ts → envNaming-CjL28IeH.d.ts} +1 -1
  23. package/dist/index.cjs +672 -108
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +10 -10
  27. package/dist/internal.cjs +378 -54
  28. package/dist/internal.d.cts +32 -4
  29. package/dist/internal.d.ts +32 -4
  30. package/dist/internal.js +141 -23
  31. package/dist/plugin/basic-schema.cjs +13 -3
  32. package/dist/plugin/basic-schema.d.cts +1 -1
  33. package/dist/plugin/basic-schema.d.ts +1 -1
  34. package/dist/plugin/basic-schema.js +2 -2
  35. package/dist/plugin/cli-args.cjs +4 -1
  36. package/dist/plugin/cli-args.d.cts +1 -1
  37. package/dist/plugin/cli-args.d.ts +1 -1
  38. package/dist/plugin/cli-args.js +2 -2
  39. package/dist/plugin/dotenv.cjs +40 -8
  40. package/dist/plugin/dotenv.d.cts +2 -2
  41. package/dist/plugin/dotenv.d.ts +2 -2
  42. package/dist/plugin/dotenv.js +2 -2
  43. package/dist/plugin/env-export.cjs +5 -2
  44. package/dist/plugin/env-export.d.cts +2 -2
  45. package/dist/plugin/env-export.d.ts +2 -2
  46. package/dist/plugin/env-export.js +2 -2
  47. package/dist/plugin/filesystem.cjs +13 -10
  48. package/dist/plugin/filesystem.d.cts +1 -1
  49. package/dist/plugin/filesystem.d.ts +1 -1
  50. package/dist/plugin/filesystem.js +2 -2
  51. package/dist/plugin/process-env.cjs +4 -1
  52. package/dist/plugin/process-env.d.cts +2 -2
  53. package/dist/plugin/process-env.d.ts +2 -2
  54. package/dist/plugin/process-env.js +2 -2
  55. package/dist/runtime/index.cjs +672 -108
  56. package/dist/runtime/index.d.cts +13 -6
  57. package/dist/runtime/index.d.ts +13 -6
  58. package/dist/runtime/index.js +10 -10
  59. package/dist/{toPublicEnv-Ds1DRwCX.d.cts → toPublicEnv-CZzpvhGg.d.cts} +1 -1
  60. package/dist/{toPublicEnv-CT265rzS.d.ts → toPublicEnv-CmydGcxg.d.ts} +1 -1
  61. package/package.json +1 -1
@@ -1342,6 +1342,134 @@ function stripNamespace(key) {
1342
1342
  return key.split(".").slice(1).join(".");
1343
1343
  }
1344
1344
 
1345
+ // ../core/src/spec/normalizeSpecRule.ts
1346
+ var ALLOWED_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "object", "array"]);
1347
+ var SECRET_FORBIDDEN_FIELDS = ["default", "examples", "enum"];
1348
+ function hasOwn(target, key) {
1349
+ return Object.prototype.hasOwnProperty.call(target, key);
1350
+ }
1351
+ function normalizeOptionalString(value, fieldName, logicalKey) {
1352
+ if (value === void 0) {
1353
+ return void 0;
1354
+ }
1355
+ if (typeof value !== "string") {
1356
+ throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "${fieldName}" must be a string.`);
1357
+ }
1358
+ const nextValue = value.trim();
1359
+ return nextValue.length > 0 ? nextValue : void 0;
1360
+ }
1361
+ function normalizeStringArray(value, fieldName, logicalKey) {
1362
+ if (value === void 0) {
1363
+ return void 0;
1364
+ }
1365
+ if (!Array.isArray(value)) {
1366
+ throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "${fieldName}" must be an array.`);
1367
+ }
1368
+ const nextValue = value.map((entry) => {
1369
+ if (typeof entry !== "string") {
1370
+ throw new CnosManifestError(
1371
+ `Invalid schema rule for ${logicalKey}: "${fieldName}" entries must be strings.`
1372
+ );
1373
+ }
1374
+ return entry.trim();
1375
+ }).filter(Boolean);
1376
+ return nextValue.length > 0 ? nextValue : void 0;
1377
+ }
1378
+ function normalizeUnknownArray(value, fieldName, logicalKey) {
1379
+ if (value === void 0) {
1380
+ return void 0;
1381
+ }
1382
+ if (!Array.isArray(value)) {
1383
+ throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "${fieldName}" must be an array.`);
1384
+ }
1385
+ return value.length > 0 ? value : void 0;
1386
+ }
1387
+ function assertValidPatternRegex(pattern, logicalKey) {
1388
+ try {
1389
+ void new RegExp(pattern);
1390
+ } catch (error) {
1391
+ const reason = error instanceof Error ? error.message : String(error);
1392
+ throw new CnosManifestError(
1393
+ `Invalid schema rule for ${logicalKey}: "pattern" must be a valid regex (${reason}).`
1394
+ );
1395
+ }
1396
+ }
1397
+ function assertSecretRuleSafety(logicalKey, rule) {
1398
+ if (!logicalKey.startsWith("secret.")) {
1399
+ return;
1400
+ }
1401
+ const offendingFields = SECRET_FORBIDDEN_FIELDS.filter((field) => hasOwn(rule, field));
1402
+ if (offendingFields.length === 0) {
1403
+ return;
1404
+ }
1405
+ throw new CnosManifestError(
1406
+ `Invalid schema rule for ${logicalKey}: secret specs cannot include ${offendingFields.join(", ")}. Store secret values in the vault, not schema metadata. Remove ${offendingFields.map((field) => `schema.${logicalKey}.${field}`).join(", ")} to continue.`
1407
+ );
1408
+ }
1409
+ function normalizeSpecRule(logicalKey, rule) {
1410
+ if (!rule || typeof rule !== "object" || Array.isArray(rule)) {
1411
+ throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: expected an object.`);
1412
+ }
1413
+ const candidate = rule;
1414
+ assertSecretRuleSafety(logicalKey, candidate);
1415
+ const normalized = {};
1416
+ if (candidate.type !== void 0) {
1417
+ if (typeof candidate.type !== "string" || !ALLOWED_TYPES.has(candidate.type)) {
1418
+ throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: unsupported type "${String(candidate.type)}".`);
1419
+ }
1420
+ normalized.type = candidate.type;
1421
+ }
1422
+ if (candidate.required !== void 0) {
1423
+ if (typeof candidate.required !== "boolean") {
1424
+ throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "required" must be a boolean.`);
1425
+ }
1426
+ normalized.required = candidate.required;
1427
+ }
1428
+ if (hasOwn(candidate, "default")) {
1429
+ normalized.default = candidate.default;
1430
+ }
1431
+ const normalizedEnum = normalizeUnknownArray(candidate.enum, "enum", logicalKey);
1432
+ if (normalizedEnum !== void 0) {
1433
+ normalized.enum = normalizedEnum;
1434
+ }
1435
+ const normalizedPattern = normalizeOptionalString(candidate.pattern, "pattern", logicalKey);
1436
+ if (normalizedPattern !== void 0) {
1437
+ assertValidPatternRegex(normalizedPattern, logicalKey);
1438
+ normalized.pattern = normalizedPattern;
1439
+ }
1440
+ const normalizedSummary = normalizeOptionalString(candidate.summary, "summary", logicalKey);
1441
+ if (normalizedSummary !== void 0) {
1442
+ normalized.summary = normalizedSummary;
1443
+ }
1444
+ const normalizedDescription = normalizeOptionalString(candidate.description, "description", logicalKey);
1445
+ if (normalizedDescription !== void 0) {
1446
+ normalized.description = normalizedDescription;
1447
+ }
1448
+ const normalizedExamples = normalizeUnknownArray(candidate.examples, "examples", logicalKey);
1449
+ if (normalizedExamples !== void 0) {
1450
+ normalized.examples = normalizedExamples;
1451
+ }
1452
+ const normalizedUsedBy = normalizeStringArray(candidate.usedBy, "usedBy", logicalKey);
1453
+ if (normalizedUsedBy !== void 0) {
1454
+ normalized.usedBy = normalizedUsedBy;
1455
+ }
1456
+ if (candidate.deprecated !== void 0) {
1457
+ if (typeof candidate.deprecated !== "boolean") {
1458
+ throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "deprecated" must be a boolean.`);
1459
+ }
1460
+ normalized.deprecated = candidate.deprecated;
1461
+ }
1462
+ const normalizedDeprecationMessage = normalizeOptionalString(
1463
+ candidate.deprecationMessage,
1464
+ "deprecationMessage",
1465
+ logicalKey
1466
+ );
1467
+ if (normalizedDeprecationMessage !== void 0) {
1468
+ normalized.deprecationMessage = normalizedDeprecationMessage;
1469
+ }
1470
+ return normalized;
1471
+ }
1472
+
1345
1473
  // ../core/src/manifest/normalizeManifest.ts
1346
1474
  var DEFAULT_RESOLVE_FROM = ["cli.profile", "env.CNOS_PROFILE", "default"];
1347
1475
  var DEFAULT_LOADERS = [
@@ -1475,11 +1603,19 @@ function normalizeVaults(vaults) {
1475
1603
  throw new CnosManifestError(`Vault "${name}" requires a provider`);
1476
1604
  }
1477
1605
  const normalizedAuth = normalizeVaultAuth(name, provider, definition.auth);
1478
- const normalizedMapping = Object.fromEntries(
1479
- Object.entries(definition.mapping ?? {}).filter(
1480
- (entry) => typeof entry[0] === "string" && typeof entry[1] === "string"
1481
- ).map(([envVar, logicalRef]) => [envVar.trim(), logicalRef.trim()]).filter(([envVar, logicalRef]) => envVar.length > 0 && logicalRef.length > 0)
1482
- );
1606
+ const normalizedMapping = normalizeVaultMapping(definition.mapping);
1607
+ const fallback = (definition.fallback ?? []).map((entry, index) => {
1608
+ const fallbackProvider = entry.provider?.trim();
1609
+ if (!fallbackProvider) {
1610
+ throw new CnosManifestError(`Vault "${name}" fallback ${index + 1} requires a provider`);
1611
+ }
1612
+ const fallbackMapping = normalizeVaultMapping(entry.mapping);
1613
+ return {
1614
+ provider: fallbackProvider,
1615
+ auth: normalizeVaultAuth(name, fallbackProvider, entry.auth),
1616
+ ...Object.keys(fallbackMapping).length > 0 ? { mapping: fallbackMapping } : {}
1617
+ };
1618
+ });
1483
1619
  return [
1484
1620
  name,
1485
1621
  {
@@ -1487,12 +1623,20 @@ function normalizeVaults(vaults) {
1487
1623
  auth: normalizedAuth,
1488
1624
  ...Object.keys(normalizedMapping).length > 0 ? {
1489
1625
  mapping: normalizedMapping
1490
- } : {}
1626
+ } : {},
1627
+ ...fallback.length > 0 ? { fallback } : {}
1491
1628
  }
1492
1629
  ];
1493
1630
  })
1494
1631
  );
1495
1632
  }
1633
+ function normalizeVaultMapping(mapping) {
1634
+ return Object.fromEntries(
1635
+ Object.entries(mapping ?? {}).filter(
1636
+ (entry) => typeof entry[0] === "string" && typeof entry[1] === "string"
1637
+ ).map(([envVar, logicalRef]) => [envVar.trim(), logicalRef.trim()]).filter(([envVar, logicalRef]) => envVar.length > 0 && logicalRef.length > 0)
1638
+ );
1639
+ }
1496
1640
  function normalizeAuthSources(value) {
1497
1641
  if (!value || typeof value !== "object" || Array.isArray(value)) {
1498
1642
  return void 0;
@@ -1540,6 +1684,14 @@ function normalizeVaultAuth(vaultName, provider, auth) {
1540
1684
  ...auth?.config ? { config: auth.config } : {}
1541
1685
  };
1542
1686
  }
1687
+ function normalizeSchema(schema) {
1688
+ return Object.fromEntries(
1689
+ Object.entries(schema ?? {}).map(([logicalKey, rule]) => [
1690
+ logicalKey,
1691
+ normalizeSpecRule(logicalKey, rule)
1692
+ ])
1693
+ );
1694
+ }
1543
1695
  function normalizeManifest(manifest) {
1544
1696
  const version = manifest.version ?? 1;
1545
1697
  if (version !== 1) {
@@ -1637,7 +1789,7 @@ function normalizeManifest(manifest) {
1637
1789
  }
1638
1790
  }
1639
1791
  },
1640
- schema: manifest.schema ?? {}
1792
+ schema: normalizeSchema(manifest.schema)
1641
1793
  };
1642
1794
  }
1643
1795
 
@@ -2271,6 +2423,13 @@ function enumMatches(value, allowed) {
2271
2423
  const serialized = JSON.stringify(value);
2272
2424
  return allowed.some((candidate) => JSON.stringify(candidate) === serialized);
2273
2425
  }
2426
+ function testPattern(pattern, value) {
2427
+ try {
2428
+ return new RegExp(pattern).test(value);
2429
+ } catch {
2430
+ return false;
2431
+ }
2432
+ }
2274
2433
  function applySchemaRules(graph, schema) {
2275
2434
  const nextEntries = new Map(graph.entries);
2276
2435
  const issues = [];
@@ -2337,11 +2496,11 @@ function applySchemaRules(graph, schema) {
2337
2496
  key,
2338
2497
  message: `Config key ${key} must be a string to match pattern ${rule.pattern}`
2339
2498
  });
2340
- } else if (!new RegExp(rule.pattern).test(coercedValue)) {
2499
+ } else if (!testPattern(rule.pattern, coercedValue)) {
2341
2500
  issues.push({
2342
2501
  code: "schema.pattern",
2343
2502
  key,
2344
- message: `Config key ${key} does not match pattern ${rule.pattern}`
2503
+ message: `Config key ${key} does not match pattern ${rule.pattern} (or the pattern is invalid).`
2345
2504
  });
2346
2505
  }
2347
2506
  }
@@ -2425,7 +2584,7 @@ function isObject(value) {
2425
2584
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
2426
2585
  }
2427
2586
  function isSecretReference(value) {
2428
- return isObject(value) && typeof value.provider === "string" && value.provider.trim().length > 0 && typeof value.ref === "string" && value.ref.trim().length > 0 && (value.vault === void 0 && true || typeof value.vault === "string" && value.vault.trim().length > 0) && Object.keys(value).every((key) => ["provider", "ref", "vault"].includes(key));
2587
+ return isObject(value) && (value.provider === void 0 || typeof value.provider === "string" && value.provider.trim().length > 0) && typeof value.ref === "string" && value.ref.trim().length > 0 && (value.vault === void 0 && true || typeof value.vault === "string" && value.vault.trim().length > 0) && Object.keys(value).every((key) => ["provider", "ref", "vault"].includes(key));
2429
2588
  }
2430
2589
  function resolveSecretStoreRoot(processEnv = process.env) {
2431
2590
  return import_node_path11.default.resolve(expandHomePath(processEnv.CNOS_SECRET_HOME ?? "~/.cnos/secrets"));
@@ -2741,16 +2900,19 @@ function resolveVaultDefinition(vaults, vault = "default") {
2741
2900
  // ../core/src/secrets/auditLog.ts
2742
2901
  async function appendAuditEvent(event, processEnv = process.env) {
2743
2902
  const auditFile = processEnv.CNOS_AUDIT_FILE ?? import_node_path12.default.join(resolveSecretStoreRoot(processEnv), "audit", "access.log");
2744
- await (0, import_promises11.mkdir)(import_node_path12.default.dirname(auditFile), { recursive: true });
2745
- await (0, import_promises11.appendFile)(
2746
- auditFile,
2747
- `${JSON.stringify({
2748
- ts: (/* @__PURE__ */ new Date()).toISOString(),
2749
- ...event
2750
- })}
2903
+ try {
2904
+ await (0, import_promises11.mkdir)(import_node_path12.default.dirname(auditFile), { recursive: true });
2905
+ await (0, import_promises11.appendFile)(
2906
+ auditFile,
2907
+ `${JSON.stringify({
2908
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
2909
+ ...event
2910
+ })}
2751
2911
  `,
2752
- "utf8"
2753
- );
2912
+ "utf8"
2913
+ );
2914
+ } catch {
2915
+ }
2754
2916
  }
2755
2917
 
2756
2918
  // ../core/src/secrets/secretCache.ts
@@ -2769,6 +2931,23 @@ var SecretCache = class {
2769
2931
  get(vaultId, ref) {
2770
2932
  return this.cache.get(`${vaultId}:${ref}`);
2771
2933
  }
2934
+ delete(vaultId, ref) {
2935
+ this.cache.delete(`${vaultId}:${ref}`);
2936
+ }
2937
+ replace(vaultId, secrets) {
2938
+ this.clear(vaultId);
2939
+ this.load(vaultId, secrets);
2940
+ }
2941
+ entriesForVault(vaultId) {
2942
+ const entries = /* @__PURE__ */ new Map();
2943
+ for (const [key, value] of this.cache) {
2944
+ const prefix = `${vaultId}:`;
2945
+ if (key.startsWith(prefix)) {
2946
+ entries.set(key.slice(prefix.length), value);
2947
+ }
2948
+ }
2949
+ return entries;
2950
+ }
2772
2951
  clear(vaultId) {
2773
2952
  if (!vaultId) {
2774
2953
  this.cache.clear();
@@ -2934,7 +3113,7 @@ var LocalSecretVaultProvider = class _LocalSecretVaultProvider {
2934
3113
  };
2935
3114
 
2936
3115
  // ../core/src/secrets/providers/registry.ts
2937
- function createSecretVaultProvider(vaultId, definition, processEnv) {
3116
+ function createSecretVaultProvider(vaultId, definition, processEnv, factories = []) {
2938
3117
  if (definition.provider === "local") {
2939
3118
  return new LocalSecretVaultProvider(vaultId, definition, processEnv);
2940
3119
  }
@@ -2944,9 +3123,30 @@ function createSecretVaultProvider(vaultId, definition, processEnv) {
2944
3123
  if (definition.provider === "github-secrets") {
2945
3124
  return new GithubSecretsVaultProvider(vaultId, definition, processEnv);
2946
3125
  }
3126
+ const factory = factories.find((candidate) => candidate.provider === definition.provider);
3127
+ if (factory) {
3128
+ return factory.create(vaultId, definition, processEnv);
3129
+ }
2947
3130
  throw new CnosManifestError(`Unsupported vault provider: ${definition.provider}`);
2948
3131
  }
2949
3132
 
3133
+ // ../core/src/secrets/providerCompatibility.ts
3134
+ function assertSecretRefVaultProviderCompatible(manifest, ref, logicalKey = "secret ref") {
3135
+ if (!ref.vault || !ref.provider) {
3136
+ return;
3137
+ }
3138
+ const definition = manifest.vaults[ref.vault];
3139
+ if (!definition || definition.provider === ref.provider) {
3140
+ return;
3141
+ }
3142
+ throw new CnosManifestError(
3143
+ `Secret ref "${logicalKey}" declares provider "${ref.provider}" but vault "${ref.vault}" uses provider "${definition.provider}". Remove the ref provider or use a matching vault.`
3144
+ );
3145
+ }
3146
+
3147
+ // ../core/src/secrets/resolveAuth.ts
3148
+ var import_promises12 = require("fs/promises");
3149
+
2950
3150
  // ../core/src/secrets/prompt.ts
2951
3151
  var import_node_readline = __toESM(require("readline"), 1);
2952
3152
  var import_node_stream = require("stream");
@@ -2987,6 +3187,23 @@ function toAuthError(vaultId, sources) {
2987
3187
  `Cannot authenticate to vault "${vaultId}". Tried: ${sources.join(", ")}. Set ${getVaultPassphraseEnvVar(vaultId)} or run cnos vault auth ${vaultId}.`
2988
3188
  );
2989
3189
  }
3190
+ async function resolveTokenFromSource(source, processEnv) {
3191
+ if (source.startsWith("env:")) {
3192
+ return processEnv[source.slice(4)] || void 0;
3193
+ }
3194
+ if (source.startsWith("file:")) {
3195
+ try {
3196
+ const value = await (0, import_promises12.readFile)(expandHomePath(source.slice("file:".length)), "utf8");
3197
+ return value.trim() || void 0;
3198
+ } catch {
3199
+ return void 0;
3200
+ }
3201
+ }
3202
+ if (source.startsWith("keychain:")) {
3203
+ return readKeychain(source.slice("keychain:".length));
3204
+ }
3205
+ return void 0;
3206
+ }
2990
3207
  async function resolveVaultAuth(vaultId, definition, processEnv = process.env) {
2991
3208
  const sessionKey = await resolveVaultSessionKey(vaultId, processEnv);
2992
3209
  if (sessionKey) {
@@ -3002,6 +3219,32 @@ async function resolveVaultAuth(vaultId, definition, processEnv = process.env) {
3002
3219
  ...definition.auth?.config ? { config: definition.auth.config } : {}
3003
3220
  };
3004
3221
  }
3222
+ if (definition.auth?.method === "iam") {
3223
+ return {
3224
+ method: "iam",
3225
+ ...definition.auth?.config ? { config: definition.auth.config } : {}
3226
+ };
3227
+ }
3228
+ if (definition.auth?.method === "environment") {
3229
+ return {
3230
+ method: "environment",
3231
+ ...definition.auth?.config ? { config: definition.auth.config } : {}
3232
+ };
3233
+ }
3234
+ const tokenSources = definition.auth?.token?.from ?? [];
3235
+ for (const source of tokenSources) {
3236
+ const token = await resolveTokenFromSource(source, processEnv);
3237
+ if (token) {
3238
+ return {
3239
+ token,
3240
+ method: "token",
3241
+ ...definition.auth?.config ? { config: definition.auth.config } : {}
3242
+ };
3243
+ }
3244
+ }
3245
+ if (definition.auth?.method === "token") {
3246
+ throw toAuthError(vaultId, [getVaultSessionKeyEnvVar(vaultId), ...tokenSources]);
3247
+ }
3005
3248
  const sources = definition.auth?.passphrase?.from ?? [getVaultPassphraseEnvVar(vaultId)];
3006
3249
  for (const source of sources) {
3007
3250
  if (source.startsWith("env:")) {
@@ -3053,22 +3296,76 @@ function collectSecretDescriptors(graph) {
3053
3296
  ref: entry.value
3054
3297
  }));
3055
3298
  }
3056
- async function batchResolveSecrets(graph, manifest, processEnv = process.env) {
3299
+ function secretGroupKey(manifest, descriptor) {
3300
+ assertSecretRefVaultProviderCompatible(manifest, descriptor.ref, descriptor.logicalKey);
3301
+ const vaultId = descriptor.ref.vault ?? "default";
3302
+ const provider = descriptor.ref.provider ?? manifest.vaults[vaultId]?.provider ?? "local";
3303
+ return `${vaultId}\0${provider}`;
3304
+ }
3305
+ function vaultDefinitionForRef(manifest, ref) {
3306
+ assertSecretRefVaultProviderCompatible(manifest, ref);
3307
+ const vaultId = ref.vault ?? "default";
3308
+ const base = manifest.vaults[vaultId] ?? { provider: "local", auth: { passphrase: { from: [] } } };
3309
+ if (!ref.provider || ref.provider === base.provider) {
3310
+ return base;
3311
+ }
3312
+ return {
3313
+ ...base,
3314
+ provider: ref.provider
3315
+ };
3316
+ }
3317
+ async function resolveFromDefinition(vaultId, definition, refs, processEnv, factories) {
3318
+ const runtimeDefinition = {
3319
+ provider: definition.provider,
3320
+ ...definition.auth ? { auth: definition.auth } : {},
3321
+ ...definition.mapping ? { mapping: definition.mapping } : {}
3322
+ };
3323
+ const provider = createSecretVaultProvider(vaultId, runtimeDefinition, processEnv, factories);
3324
+ const auth = await resolveVaultAuth(vaultId, runtimeDefinition, processEnv);
3325
+ await provider.authenticate(auth);
3326
+ return provider.batchGet(refs.map((entry) => entry.ref.ref));
3327
+ }
3328
+ async function batchResolveSecrets(graph, manifest, processEnv = process.env, factories = []) {
3057
3329
  const cache = new SecretCache();
3058
3330
  const descriptors = collectSecretDescriptors(graph);
3059
3331
  const grouped = descriptors.reduce((accumulator, descriptor) => {
3060
- const vaultId = descriptor.ref.vault ?? "default";
3061
- const bucket = accumulator.get(vaultId) ?? [];
3332
+ const key = secretGroupKey(manifest, descriptor);
3333
+ const bucket = accumulator.get(key) ?? [];
3062
3334
  bucket.push(descriptor);
3063
- accumulator.set(vaultId, bucket);
3335
+ accumulator.set(key, bucket);
3064
3336
  return accumulator;
3065
3337
  }, /* @__PURE__ */ new Map());
3066
- for (const [vaultId, refs] of grouped) {
3067
- const definition = manifest.vaults[vaultId] ?? { provider: "local", auth: { passphrase: { from: [] } } };
3068
- const provider = createSecretVaultProvider(vaultId, definition, processEnv);
3069
- const auth = await resolveVaultAuth(vaultId, definition, processEnv);
3070
- await provider.authenticate(auth);
3071
- const resolved = await provider.batchGet(refs.map((entry) => entry.ref.ref));
3338
+ for (const refs of grouped.values()) {
3339
+ const first = refs[0];
3340
+ if (!first) {
3341
+ continue;
3342
+ }
3343
+ const vaultId = first.ref.vault ?? "default";
3344
+ const definition = vaultDefinitionForRef(manifest, first.ref);
3345
+ const definitions = [definition, ...definition.fallback ?? []];
3346
+ const resolved = /* @__PURE__ */ new Map();
3347
+ let remaining = refs;
3348
+ let lastError;
3349
+ for (const candidate of definitions) {
3350
+ try {
3351
+ const candidateValues = await resolveFromDefinition(vaultId, candidate, remaining, processEnv, factories);
3352
+ for (const descriptor of remaining) {
3353
+ const value = candidateValues.get(descriptor.ref.ref);
3354
+ if (value !== void 0) {
3355
+ resolved.set(descriptor.ref.ref, value);
3356
+ }
3357
+ }
3358
+ remaining = remaining.filter((descriptor) => !resolved.has(descriptor.ref.ref));
3359
+ if (remaining.length === 0) {
3360
+ break;
3361
+ }
3362
+ } catch (error) {
3363
+ lastError = error;
3364
+ }
3365
+ }
3366
+ if (resolved.size === 0 && lastError) {
3367
+ throw lastError;
3368
+ }
3072
3369
  cache.load(vaultId, resolved);
3073
3370
  await appendAuditEvent(
3074
3371
  {
@@ -3089,7 +3386,11 @@ function resolveSecretEntryValue(key, value, cache) {
3089
3386
  return value;
3090
3387
  }
3091
3388
  const vaultId = value.vault ?? "default";
3092
- return cache.get(vaultId, value.ref) ?? value;
3389
+ const resolved = cache.get(vaultId, value.ref);
3390
+ if (resolved !== void 0 || cache.isVaultAuthenticated(vaultId)) {
3391
+ return resolved;
3392
+ }
3393
+ return value;
3093
3394
  }
3094
3395
 
3095
3396
  // ../core/src/runtime/projection.ts
@@ -3192,19 +3493,117 @@ function configHash(values) {
3192
3493
  function shouldProjectResolvedValue(sourceId) {
3193
3494
  return sourceId !== "process-env";
3194
3495
  }
3496
+ var SAFE_PROJECTED_CONFIG_KEYS = /* @__PURE__ */ new Set([
3497
+ "address",
3498
+ "audience",
3499
+ "clientid",
3500
+ "endpoint",
3501
+ "mount",
3502
+ "namespace",
3503
+ "path",
3504
+ "projectid",
3505
+ "region",
3506
+ "scope",
3507
+ "scopes",
3508
+ "serviceaccountemail",
3509
+ "tenant",
3510
+ "tenantid",
3511
+ "url",
3512
+ "version",
3513
+ "vaulturl"
3514
+ ]);
3515
+ function isSafeProjectedConfigKey(key) {
3516
+ return SAFE_PROJECTED_CONFIG_KEYS.has(key.replace(/[^A-Za-z0-9]/g, "").toLowerCase());
3517
+ }
3518
+ function sanitizeProjectedConfigValue(value) {
3519
+ if (Array.isArray(value)) {
3520
+ return value.map((item) => sanitizeProjectedConfigValue(item));
3521
+ }
3522
+ if (!value || typeof value !== "object") {
3523
+ return value;
3524
+ }
3525
+ return stableSortObject(
3526
+ Object.fromEntries(
3527
+ Object.entries(value).map(([key, item]) => [key, sanitizeProjectedConfigValue(item)]).filter(([key, item]) => {
3528
+ if (item && typeof item === "object" && !Array.isArray(item)) {
3529
+ return Object.keys(item).length > 0;
3530
+ }
3531
+ return isSafeProjectedConfigKey(key);
3532
+ })
3533
+ )
3534
+ );
3535
+ }
3536
+ function sanitizeProjectedConfig(config) {
3537
+ const sanitized = sanitizeProjectedConfigValue(config);
3538
+ if (!sanitized || typeof sanitized !== "object" || Array.isArray(sanitized)) {
3539
+ return void 0;
3540
+ }
3541
+ return Object.keys(sanitized).length > 0 ? sanitized : void 0;
3542
+ }
3543
+ function projectVaultAuth(definition) {
3544
+ const auth = definition.auth;
3545
+ if (!auth) {
3546
+ return void 0;
3547
+ }
3548
+ const config = auth.config ? sanitizeProjectedConfig(auth.config) : void 0;
3549
+ const projected = {
3550
+ ...auth.method ? { method: auth.method } : {},
3551
+ ...auth.passphrase?.from ? {
3552
+ passphrase: {
3553
+ from: [...auth.passphrase.from]
3554
+ }
3555
+ } : {},
3556
+ ...auth.token?.from ? {
3557
+ token: {
3558
+ from: [...auth.token.from]
3559
+ }
3560
+ } : {},
3561
+ ...config ? { config } : {}
3562
+ };
3563
+ return Object.keys(projected).length > 0 ? projected : void 0;
3564
+ }
3565
+ function projectVaultDefinition(definition) {
3566
+ const auth = projectVaultAuth(definition);
3567
+ const mapping = definition.mapping ? stableSortObject(definition.mapping) : void 0;
3568
+ const fallback = definition.fallback?.map((entry) => projectVaultDefinition({
3569
+ provider: entry.provider,
3570
+ ...entry.auth ? { auth: entry.auth } : {},
3571
+ ...entry.mapping ? { mapping: entry.mapping } : {}
3572
+ }));
3573
+ return {
3574
+ provider: definition.provider,
3575
+ ...auth ? { auth } : {},
3576
+ ...mapping && Object.keys(mapping).length > 0 ? { mapping } : {},
3577
+ ...fallback && fallback.length > 0 ? { fallback } : {}
3578
+ };
3579
+ }
3580
+ function projectReferencedVaults(manifest, vaultIds) {
3581
+ const projected = {};
3582
+ for (const vaultId of Array.from(vaultIds).sort((left, right) => left.localeCompare(right))) {
3583
+ const definition = manifest.vaults[vaultId];
3584
+ if (definition) {
3585
+ projected[vaultId] = projectVaultDefinition(definition);
3586
+ }
3587
+ }
3588
+ return Object.keys(projected).length > 0 ? projected : void 0;
3589
+ }
3195
3590
  function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers = {}) {
3196
3591
  const values = {};
3197
3592
  const derived = {};
3198
3593
  const secretRefs = {};
3594
+ const referencedVaultIds = /* @__PURE__ */ new Set();
3199
3595
  const namespaces = /* @__PURE__ */ new Set();
3200
3596
  const runtimeNamespaces = /* @__PURE__ */ new Set();
3201
3597
  const publicKeys = Array.from(graph.entries.values()).filter((entry) => entry.namespace === "public").map((entry) => entry.key.slice("public.".length)).sort((left, right) => left.localeCompare(right));
3202
3598
  for (const [key, entry] of graph.entries) {
3203
3599
  if (entry.namespace === "secret" && isSecretReference(entry.value)) {
3600
+ assertSecretRefVaultProviderCompatible(manifest, entry.value, key);
3204
3601
  const vaultId = entry.value.vault ?? "default";
3602
+ const provider = entry.value.provider ?? manifest.vaults[vaultId]?.provider ?? "local";
3205
3603
  const envVar = resolveProjectedEnvVar(manifest, vaultId, entry.value.ref);
3604
+ referencedVaultIds.add(vaultId);
3206
3605
  secretRefs[key.slice("secret.".length)] = {
3207
- provider: entry.value.provider,
3606
+ provider,
3208
3607
  vault: vaultId,
3209
3608
  ref: entry.value.ref,
3210
3609
  ...envVar ? {
@@ -3250,6 +3649,7 @@ function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers
3250
3649
  namespaces.add(entry.namespace);
3251
3650
  }
3252
3651
  }
3652
+ const vaults = projectReferencedVaults(manifest, referencedVaultIds);
3253
3653
  return {
3254
3654
  version: 1,
3255
3655
  workspace: graph.workspace.workspaceId,
@@ -3259,6 +3659,7 @@ function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers
3259
3659
  values: stableSortObject(values),
3260
3660
  derived: stableSortObject(derived),
3261
3661
  secretRefs: stableSortObject(secretRefs),
3662
+ ...vaults ? { vaults } : {},
3262
3663
  publicKeys,
3263
3664
  runtimeNamespaces: Array.from(runtimeNamespaces).sort((left, right) => left.localeCompare(right)),
3264
3665
  meta: {
@@ -3373,9 +3774,10 @@ function toPublicEnv(graph, manifest, options = {}, helpers = {}) {
3373
3774
  }
3374
3775
 
3375
3776
  // ../core/src/orchestrator/runtime.ts
3376
- function createRuntime(manifest, graph, plugins = [], secretCache, processEnv = process.env, cnosVersion = "0.0.0-dev") {
3777
+ function createRuntime(manifest, graph, plugins = [], secretCache, processEnv = process.env, cnosVersion = "0.0.0-dev", secretVaultProviders = []) {
3377
3778
  const runtimeProviders = createDefaultRuntimeProviders(manifest, processEnv);
3378
3779
  const derivedSupport = createDerivedRuntimeSupport(graph, manifest, runtimeProviders);
3780
+ let activeSecretCache = secretCache;
3379
3781
  function resolveProjectedSourceKey(key) {
3380
3782
  if (!key.startsWith("public.")) {
3381
3783
  return key;
@@ -3392,30 +3794,38 @@ function createRuntime(manifest, graph, plugins = [], secretCache, processEnv =
3392
3794
  if (!entry || entry.namespace !== "secret" || !isSecretReference(entry.value)) {
3393
3795
  return;
3394
3796
  }
3395
- if (!secretCache) {
3797
+ if (!activeSecretCache) {
3396
3798
  return;
3397
3799
  }
3398
3800
  const vaultId = entry.value.vault ?? "default";
3399
- const definition = manifest.vaults[vaultId] ?? {
3400
- provider: entry.value.provider,
3401
- auth: { passphrase: { from: [] } }
3402
- };
3403
- const provider = createSecretVaultProvider(vaultId, definition, processEnv);
3404
- const auth = await resolveVaultAuth(vaultId, definition, processEnv);
3405
- await provider.authenticate(auth);
3406
- const value = await provider.get(entry.value.ref);
3407
- if (value !== void 0) {
3408
- secretCache.load(vaultId, /* @__PURE__ */ new Map([[entry.value.ref, value]]));
3801
+ const refreshed = await batchResolveSecrets(
3802
+ {
3803
+ ...graph,
3804
+ entries: /* @__PURE__ */ new Map([[key, entry]])
3805
+ },
3806
+ manifest,
3807
+ processEnv,
3808
+ secretVaultProviders
3809
+ );
3810
+ const resolved = refreshed.get(vaultId, entry.value.ref);
3811
+ const existing = activeSecretCache.entriesForVault(vaultId);
3812
+ existing.delete(entry.value.ref);
3813
+ if (resolved !== void 0) {
3814
+ existing.set(entry.value.ref, resolved);
3409
3815
  }
3816
+ activeSecretCache.replace(vaultId, existing);
3410
3817
  }
3411
3818
  async function refreshAllSecrets() {
3412
- if (!secretCache) {
3819
+ if (!activeSecretCache) {
3413
3820
  return;
3414
3821
  }
3415
- const secretKeys = Array.from(graph.entries.values()).filter((entry) => entry.namespace === "secret" && isSecretReference(entry.value)).map((entry) => entry.key);
3416
- for (const key of secretKeys) {
3417
- await refreshSecretEntry(key);
3418
- }
3822
+ const refreshed = await batchResolveSecrets(
3823
+ graph,
3824
+ manifest,
3825
+ processEnv,
3826
+ secretVaultProviders
3827
+ );
3828
+ activeSecretCache = refreshed;
3419
3829
  }
3420
3830
  function readLogicalKey(key) {
3421
3831
  const resolved = derivedSupport.read(key, (ref) => {
@@ -3423,10 +3833,10 @@ function createRuntime(manifest, graph, plugins = [], secretCache, processEnv =
3423
3833
  if (!entry2) {
3424
3834
  return void 0;
3425
3835
  }
3426
- if (!secretCache) {
3836
+ if (!activeSecretCache) {
3427
3837
  return entry2.value;
3428
3838
  }
3429
- return resolveSecretEntryValue(ref, entry2.value, secretCache);
3839
+ return resolveSecretEntryValue(ref, entry2.value, activeSecretCache);
3430
3840
  });
3431
3841
  if (resolved !== void 0 || graph.entries.has(key) || manifest.runtimeNamespaces[key.split(".")[0] ?? ""]) {
3432
3842
  return resolved;
@@ -3435,10 +3845,10 @@ function createRuntime(manifest, graph, plugins = [], secretCache, processEnv =
3435
3845
  if (!entry) {
3436
3846
  return void 0;
3437
3847
  }
3438
- if (!secretCache) {
3848
+ if (!activeSecretCache) {
3439
3849
  return entry.value;
3440
3850
  }
3441
- return resolveSecretEntryValue(key, entry.value, secretCache);
3851
+ return resolveSecretEntryValue(key, entry.value, activeSecretCache);
3442
3852
  }
3443
3853
  return {
3444
3854
  manifest,
@@ -3475,10 +3885,10 @@ function createRuntime(manifest, graph, plugins = [], secretCache, processEnv =
3475
3885
  if (!entry) {
3476
3886
  return void 0;
3477
3887
  }
3478
- if (!secretCache) {
3888
+ if (!activeSecretCache) {
3479
3889
  return entry.value;
3480
3890
  }
3481
- return resolveSecretEntryValue(candidate, entry.value, secretCache);
3891
+ return resolveSecretEntryValue(candidate, entry.value, activeSecretCache);
3482
3892
  })
3483
3893
  });
3484
3894
  },
@@ -3669,7 +4079,12 @@ async function createCnos(options = {}) {
3669
4079
  });
3670
4080
  const schemaApplied = applySchemaRules(graph, loadedManifest.manifest.schema);
3671
4081
  const promotedGraph = promoteToPublic(schemaApplied.graph, loadedManifest.manifest);
3672
- const secretCache = options.secretResolution === "lazy" ? new SecretCache() : await batchResolveSecrets(promotedGraph, loadedManifest.manifest, options.processEnv);
4082
+ const secretCache = options.secretResolution === "lazy" ? new SecretCache() : await batchResolveSecrets(
4083
+ promotedGraph,
4084
+ loadedManifest.manifest,
4085
+ options.processEnv,
4086
+ options.secretVaultProviders
4087
+ );
3673
4088
  return createRuntime(
3674
4089
  loadedManifest.manifest,
3675
4090
  appendMetaEntries({
@@ -3679,12 +4094,13 @@ async function createCnos(options = {}) {
3679
4094
  plugins,
3680
4095
  secretCache,
3681
4096
  options.processEnv,
3682
- options.cnosVersion
4097
+ options.cnosVersion,
4098
+ options.secretVaultProviders
3683
4099
  );
3684
4100
  }
3685
4101
 
3686
4102
  // ../core/src/runtime/dump.ts
3687
- var import_promises12 = require("fs/promises");
4103
+ var import_promises13 = require("fs/promises");
3688
4104
  var import_node_path13 = __toESM(require("path"), 1);
3689
4105
  function buildDumpFiles(graph, options = {}) {
3690
4106
  const basePath = options.flatten ? "" : import_node_path13.default.posix.join("workspaces", graph.workspace.workspaceId);
@@ -3720,8 +4136,8 @@ async function writeDump(graph, options) {
3720
4136
  const plan = planDump(graph, options);
3721
4137
  for (const file of plan.files) {
3722
4138
  const destination = import_node_path13.default.join(root, file.path);
3723
- await (0, import_promises12.mkdir)(import_node_path13.default.dirname(destination), { recursive: true });
3724
- await (0, import_promises12.writeFile)(destination, file.content, "utf8");
4139
+ await (0, import_promises13.mkdir)(import_node_path13.default.dirname(destination), { recursive: true });
4140
+ await (0, import_promises13.writeFile)(destination, file.content, "utf8");
3725
4141
  }
3726
4142
  return {
3727
4143
  ...plan,
@@ -3764,7 +4180,7 @@ function envVarToLogicalKey(envVar, config = {}) {
3764
4180
  // package.json
3765
4181
  var package_default = {
3766
4182
  name: "@kitsy/cnos",
3767
- version: "1.9.2",
4183
+ version: "1.11.0",
3768
4184
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
3769
4185
  type: "module",
3770
4186
  main: "./dist/index.cjs",
@@ -3963,15 +4379,36 @@ function createCliArgsPlugin() {
3963
4379
  }
3964
4380
 
3965
4381
  // ../../plugins/dotenv/src/index.ts
3966
- var import_promises13 = require("fs/promises");
4382
+ var import_promises14 = require("fs/promises");
3967
4383
  var import_node_path14 = __toESM(require("path"), 1);
3968
4384
  var DOTENV_PLUGIN_ID = "@kitsy/cnos/plugins/dotenv";
3969
4385
  function parseDoubleQuoted(value) {
3970
4386
  return value.replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
3971
4387
  }
4388
+ function isEscapedCharacter(value, index) {
4389
+ let slashCount = 0;
4390
+ for (let cursor = index - 1; cursor >= 0 && value[cursor] === "\\"; cursor -= 1) {
4391
+ slashCount += 1;
4392
+ }
4393
+ return slashCount % 2 === 1;
4394
+ }
4395
+ function findClosingQuote(value, quote) {
4396
+ for (let index = 0; index < value.length; index += 1) {
4397
+ if (value[index] !== quote) {
4398
+ continue;
4399
+ }
4400
+ if (quote === '"' && isEscapedCharacter(value, index)) {
4401
+ continue;
4402
+ }
4403
+ return index;
4404
+ }
4405
+ return -1;
4406
+ }
3972
4407
  function parseDotenv(document) {
3973
4408
  const parsed = {};
3974
- for (const rawLine of document.split(/\r?\n/)) {
4409
+ const lines = document.split(/\r?\n/);
4410
+ for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
4411
+ const rawLine = lines[lineIndex] ?? "";
3975
4412
  const line = rawLine.trim();
3976
4413
  if (!line || line.startsWith("#")) {
3977
4414
  continue;
@@ -3986,10 +4423,18 @@ function parseDotenv(document) {
3986
4423
  if (!envVar) {
3987
4424
  continue;
3988
4425
  }
3989
- if (value.startsWith('"') && value.endsWith('"')) {
3990
- value = parseDoubleQuoted(value.slice(1, -1));
3991
- } else if (value.startsWith("'") && value.endsWith("'")) {
3992
- value = value.slice(1, -1);
4426
+ if (value.startsWith('"') || value.startsWith("'")) {
4427
+ const quote = value.startsWith('"') ? '"' : "'";
4428
+ let quotedContent = value.slice(1);
4429
+ let closingIndex = findClosingQuote(quotedContent, quote);
4430
+ while (closingIndex === -1 && lineIndex < lines.length - 1) {
4431
+ lineIndex += 1;
4432
+ quotedContent = `${quotedContent}
4433
+ ${lines[lineIndex] ?? ""}`;
4434
+ closingIndex = findClosingQuote(quotedContent, quote);
4435
+ }
4436
+ const rawQuotedValue = closingIndex === -1 ? quotedContent : quotedContent.slice(0, closingIndex);
4437
+ value = quote === '"' ? parseDoubleQuoted(rawQuotedValue) : rawQuotedValue;
3993
4438
  } else {
3994
4439
  value = value.replace(/\s+#.*$/, "").trim();
3995
4440
  }
@@ -4021,7 +4466,7 @@ function dotenvEntriesFromObject(values, mapping = {}, originFile, workspaceId =
4021
4466
  }
4022
4467
  async function readIfPresent(filePath) {
4023
4468
  try {
4024
- return await (0, import_promises13.readFile)(filePath, "utf8");
4469
+ return await (0, import_promises14.readFile)(filePath, "utf8");
4025
4470
  } catch {
4026
4471
  return void 0;
4027
4472
  }
@@ -4087,16 +4532,16 @@ function createPublicEnvExportPlugin() {
4087
4532
  }
4088
4533
 
4089
4534
  // ../../plugins/filesystem/src/filesystemSecretsReader.ts
4090
- var import_promises15 = require("fs/promises");
4535
+ var import_promises16 = require("fs/promises");
4091
4536
 
4092
4537
  // ../../plugins/filesystem/src/helpers.ts
4093
- var import_promises14 = require("fs/promises");
4538
+ var import_promises15 = require("fs/promises");
4094
4539
  var import_node_path15 = __toESM(require("path"), 1);
4095
4540
  var YAML_EXTENSIONS = /* @__PURE__ */ new Set([".yml", ".yaml"]);
4096
4541
  var FILESYSTEM_PLUGIN_ID = "@kitsy/cnos/plugins/filesystem";
4097
4542
  async function existsDirectory(targetPath) {
4098
4543
  try {
4099
- const stat2 = await (0, import_promises14.readdir)(targetPath);
4544
+ const stat2 = await (0, import_promises15.readdir)(targetPath);
4100
4545
  void stat2;
4101
4546
  return true;
4102
4547
  } catch {
@@ -4104,7 +4549,7 @@ async function existsDirectory(targetPath) {
4104
4549
  }
4105
4550
  }
4106
4551
  async function collectYamlFiles(root) {
4107
- const entries = await (0, import_promises14.readdir)(root, { withFileTypes: true });
4552
+ const entries = await (0, import_promises15.readdir)(root, { withFileTypes: true });
4108
4553
  const results = [];
4109
4554
  for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
4110
4555
  const absolutePath = import_node_path15.default.join(root, entry.name);
@@ -4206,7 +4651,7 @@ function createFilesystemSecretsPlugin() {
4206
4651
  );
4207
4652
  const entries = [];
4208
4653
  for (const file of files) {
4209
- const document = await (0, import_promises15.readFile)(file.absolutePath, "utf8");
4654
+ const document = await (0, import_promises16.readFile)(file.absolutePath, "utf8");
4210
4655
  const fileEntries = filesystemSecretsReader(file.relativePath, document, file.workspaceId);
4211
4656
  for (const entry of fileEntries) {
4212
4657
  const metadata = toSecretReferenceMetadata(entry.value);
@@ -4222,7 +4667,7 @@ function createFilesystemSecretsPlugin() {
4222
4667
  }
4223
4668
 
4224
4669
  // ../../plugins/filesystem/src/filesystemValuesReader.ts
4225
- var import_promises16 = require("fs/promises");
4670
+ var import_promises17 = require("fs/promises");
4226
4671
  function filesystemValuesReader(filePath, document, workspaceId = "default") {
4227
4672
  return yamlObjectToEntries(document, filePath, "value", "filesystem-values", workspaceId);
4228
4673
  }
@@ -4243,7 +4688,7 @@ function createFilesystemValuesPlugin() {
4243
4688
  ).map(([namespace]) => namespace);
4244
4689
  const entries = [];
4245
4690
  for (const file of files) {
4246
- const document = await (0, import_promises16.readFile)(file.absolutePath, "utf8");
4691
+ const document = await (0, import_promises17.readFile)(file.absolutePath, "utf8");
4247
4692
  entries.push(...filesystemValuesReader(file.relativePath, document, file.workspaceId));
4248
4693
  }
4249
4694
  for (const namespace of customNamespaces) {
@@ -4258,7 +4703,7 @@ function createFilesystemValuesPlugin() {
4258
4703
  layers
4259
4704
  );
4260
4705
  for (const file of namespaceFiles) {
4261
- const document = await (0, import_promises16.readFile)(file.absolutePath, "utf8");
4706
+ const document = await (0, import_promises17.readFile)(file.absolutePath, "utf8");
4262
4707
  entries.push(...yamlObjectToEntries(document, file.relativePath, namespace, "filesystem-values", file.workspaceId));
4263
4708
  }
4264
4709
  }