codexuse-cli 6.3.0 → 6.4.1

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
@@ -1685,20 +1685,20 @@ var require_parse_async = __commonJS({
1685
1685
  const index2 = 0;
1686
1686
  const blocksize = opts.blocksize || 40960;
1687
1687
  const parser = new TOMLParser();
1688
- return new Promise((resolve2, reject) => {
1689
- setImmediate(parseAsyncNext, index2, blocksize, resolve2, reject);
1688
+ return new Promise((resolve3, reject) => {
1689
+ setImmediate(parseAsyncNext, index2, blocksize, resolve3, reject);
1690
1690
  });
1691
- function parseAsyncNext(index3, blocksize2, resolve2, reject) {
1691
+ function parseAsyncNext(index3, blocksize2, resolve3, reject) {
1692
1692
  if (index3 >= str.length) {
1693
1693
  try {
1694
- return resolve2(parser.finish());
1694
+ return resolve3(parser.finish());
1695
1695
  } catch (err) {
1696
1696
  return reject(prettyError(err, str));
1697
1697
  }
1698
1698
  }
1699
1699
  try {
1700
1700
  parser.parse(str.slice(index3, index3 + blocksize2));
1701
- setImmediate(parseAsyncNext, index3 + blocksize2, blocksize2, resolve2, reject);
1701
+ setImmediate(parseAsyncNext, index3 + blocksize2, blocksize2, resolve3, reject);
1702
1702
  } catch (err) {
1703
1703
  reject(prettyError(err, str));
1704
1704
  }
@@ -1724,7 +1724,7 @@ var require_parse_stream = __commonJS({
1724
1724
  function parseReadable(stm) {
1725
1725
  const parser = new TOMLParser();
1726
1726
  stm.setEncoding("utf8");
1727
- return new Promise((resolve2, reject) => {
1727
+ return new Promise((resolve3, reject) => {
1728
1728
  let readable;
1729
1729
  let ended = false;
1730
1730
  let errored = false;
@@ -1732,7 +1732,7 @@ var require_parse_stream = __commonJS({
1732
1732
  ended = true;
1733
1733
  if (readable) return;
1734
1734
  try {
1735
- resolve2(parser.finish());
1735
+ resolve3(parser.finish());
1736
1736
  } catch (err) {
1737
1737
  reject(err);
1738
1738
  }
@@ -2557,7 +2557,7 @@ function describeError(error) {
2557
2557
  return error instanceof Error ? error.message : String(error);
2558
2558
  }
2559
2559
  function sleep(ms) {
2560
- return new Promise((resolve2) => setTimeout(resolve2, ms));
2560
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
2561
2561
  }
2562
2562
  function matchesErrorChain(error, predicate) {
2563
2563
  if (!error || typeof error !== "object") {
@@ -2810,8 +2810,8 @@ function withStatement(db, sql, task) {
2810
2810
  async function withWriteQueue(dbPath, task) {
2811
2811
  const previous = writeQueueByDbPath.get(dbPath) ?? Promise.resolve();
2812
2812
  let release;
2813
- const current = new Promise((resolve2) => {
2814
- release = resolve2;
2813
+ const current = new Promise((resolve3) => {
2814
+ release = resolve3;
2815
2815
  });
2816
2816
  writeQueueByDbPath.set(dbPath, current);
2817
2817
  await previous;
@@ -3411,8 +3411,8 @@ async function withCloudSyncTransaction(userDataDir, mode, operation) {
3411
3411
  }
3412
3412
  const previous = operationTails.get(target) ?? Promise.resolve();
3413
3413
  let finish;
3414
- const turn = new Promise((resolve2) => {
3415
- finish = resolve2;
3414
+ const turn = new Promise((resolve3) => {
3415
+ finish = resolve3;
3416
3416
  });
3417
3417
  operationTails.set(target, turn);
3418
3418
  await previous;
@@ -5120,9 +5120,9 @@ async function ensureInitialized() {
5120
5120
  );
5121
5121
  attempt.catch(() => void 0);
5122
5122
  let deadlineTimer;
5123
- const deadline = new Promise((resolve2) => {
5123
+ const deadline = new Promise((resolve3) => {
5124
5124
  deadlineTimer = setTimeout(
5125
- () => resolve2(READ_TOO_SLOW),
5125
+ () => resolve3(READ_TOO_SLOW),
5126
5126
  PERSISTENCE_READ_DEADLINE_MS
5127
5127
  );
5128
5128
  });
@@ -5153,8 +5153,8 @@ async function withWriteLock(task) {
5153
5153
  }
5154
5154
  const previous = writeLock;
5155
5155
  let release;
5156
- writeLock = new Promise((resolve2) => {
5157
- release = resolve2;
5156
+ writeLock = new Promise((resolve3) => {
5157
+ release = resolve3;
5158
5158
  });
5159
5159
  await previous;
5160
5160
  try {
@@ -6666,7 +6666,7 @@ function shouldEnforceProfileLimit(status) {
6666
6666
 
6667
6667
  // ../../packages/runtime-profiles/src/profiles/profile-manager.ts
6668
6668
  var import_node_crypto15 = require("crypto");
6669
- var import_fs = require("fs");
6669
+ var import_fs3 = require("fs");
6670
6670
  var import_node_os8 = __toESM(require("os"), 1);
6671
6671
  var import_path = __toESM(require("path"), 1);
6672
6672
  var import_path2 = require("path");
@@ -6722,6 +6722,20 @@ function resolveProfileIdentityKeyFromProfile(profile) {
6722
6722
  return resolveProfileIdentityKey(profile) ?? `profile:${profile.name}`;
6723
6723
  }
6724
6724
 
6725
+ // ../../packages/shared/src/core/fs.ts
6726
+ var import_promises2 = __toESM(require("fs/promises"), 1);
6727
+ async function syncDirectory(directoryPath) {
6728
+ if (process.platform === "win32") {
6729
+ return;
6730
+ }
6731
+ const directory = await import_promises2.default.open(directoryPath, "r");
6732
+ try {
6733
+ await directory.sync();
6734
+ } finally {
6735
+ await directory.close();
6736
+ }
6737
+ }
6738
+
6725
6739
  // ../../packages/runtime-codex/src/codex/rpc.ts
6726
6740
  var import_node_child_process5 = require("child_process");
6727
6741
  var import_node_crypto11 = require("crypto");
@@ -6873,7 +6887,7 @@ function evaluateCodexCliStatus() {
6873
6887
  return evaluateExternalStatus();
6874
6888
  }
6875
6889
  function runVersionPreflight(cliPath) {
6876
- return new Promise((resolve2) => {
6890
+ return new Promise((resolve3) => {
6877
6891
  const useNode = /\.(?:c|m)?js$/i.test(cliPath);
6878
6892
  const child = (0, import_node_child_process2.spawn)(
6879
6893
  useNode ? process.execPath : cliPath,
@@ -6891,7 +6905,7 @@ function runVersionPreflight(cliPath) {
6891
6905
  }
6892
6906
  settled = true;
6893
6907
  clearTimeout(timeout2);
6894
- resolve2(version);
6908
+ resolve3(version);
6895
6909
  };
6896
6910
  const collect = (chunk) => {
6897
6911
  if (output.length < 1024) {
@@ -7016,7 +7030,7 @@ function buildCodexCommand(binaryPath, args2, env) {
7016
7030
  // ../../packages/runtime-codex/src/codex/home.ts
7017
7031
  var import_node_crypto9 = require("crypto");
7018
7032
  var import_node_fs6 = require("fs");
7019
- var import_promises2 = require("fs/promises");
7033
+ var import_promises3 = require("fs/promises");
7020
7034
  var import_node_os4 = __toESM(require("os"), 1);
7021
7035
  var import_node_path8 = __toESM(require("path"), 1);
7022
7036
  function resolveHomeDir() {
@@ -7078,11 +7092,11 @@ function resolveProfileCodexHomesRoot() {
7078
7092
  async function ensureProfileCodexHomesRoot() {
7079
7093
  const root = resolveProfileCodexHomesRoot();
7080
7094
  const parent = import_node_path8.default.dirname(root);
7081
- await (0, import_promises2.mkdir)(parent, { recursive: true, mode: 448 });
7082
- await (0, import_promises2.mkdir)(root, { recursive: true, mode: 448 });
7095
+ await (0, import_promises3.mkdir)(parent, { recursive: true, mode: 448 });
7096
+ await (0, import_promises3.mkdir)(root, { recursive: true, mode: 448 });
7083
7097
  if (process.platform !== "win32") {
7084
- await (0, import_promises2.chmod)(parent, 448);
7085
- await (0, import_promises2.chmod)(root, 448);
7098
+ await (0, import_promises3.chmod)(parent, 448);
7099
+ await (0, import_promises3.chmod)(root, 448);
7086
7100
  }
7087
7101
  return root;
7088
7102
  }
@@ -7102,7 +7116,7 @@ async function migrateProfileCodexHomeDir(profileHomeId) {
7102
7116
  }
7103
7117
  await ensureProfileCodexHomesRoot();
7104
7118
  try {
7105
- await (0, import_promises2.rename)(legacy, current);
7119
+ await (0, import_promises3.rename)(legacy, current);
7106
7120
  } catch (error) {
7107
7121
  if (error.code === "EXDEV") {
7108
7122
  throw Object.assign(new Error("profile-home-cross-volume-unsupported"), {
@@ -7169,7 +7183,7 @@ var import_toml = __toESM(require_toml(), 1);
7169
7183
 
7170
7184
  // ../../packages/runtime-codex/src/codex/config-metadata.ts
7171
7185
  var import_node_child_process4 = require("child_process");
7172
- var import_promises3 = require("fs/promises");
7186
+ var import_promises4 = require("fs/promises");
7173
7187
  var import_node_path9 = __toESM(require("path"), 1);
7174
7188
  var CONFIG_SCHEMA_URL = "https://raw.githubusercontent.com/openai/codex/main/codex-rs/core/config.schema.json";
7175
7189
  var METADATA_CACHE_TTL_MS = 6e4;
@@ -7279,7 +7293,7 @@ function uniqueSorted(values2) {
7279
7293
  return Array.from(new Set(values2)).sort((a, b) => a.localeCompare(b));
7280
7294
  }
7281
7295
  async function runCommand(command, args2, timeoutMs = 3e3) {
7282
- return new Promise((resolve2, reject) => {
7296
+ return new Promise((resolve3, reject) => {
7283
7297
  const child = (0, import_node_child_process4.spawn)(command, args2, {
7284
7298
  stdio: ["ignore", "pipe", "pipe"],
7285
7299
  env: buildCodexChildEnv()
@@ -7303,10 +7317,10 @@ async function runCommand(command, args2, timeoutMs = 3e3) {
7303
7317
  child.on("close", (code) => {
7304
7318
  clearTimeout(timeout2);
7305
7319
  if (code !== 0 && !stdout.trim() && stderr.trim()) {
7306
- resolve2({ stdout: stderr, exitCode: code });
7320
+ resolve3({ stdout: stderr, exitCode: code });
7307
7321
  return;
7308
7322
  }
7309
- resolve2({ stdout, exitCode: code });
7323
+ resolve3({ stdout, exitCode: code });
7310
7324
  });
7311
7325
  });
7312
7326
  }
@@ -7361,7 +7375,7 @@ async function readSchemaFromLocal() {
7361
7375
  ].filter((candidate) => Boolean(candidate));
7362
7376
  for (const candidate of candidates) {
7363
7377
  try {
7364
- return await (0, import_promises3.readFile)(candidate, "utf8");
7378
+ return await (0, import_promises4.readFile)(candidate, "utf8");
7365
7379
  } catch {
7366
7380
  }
7367
7381
  }
@@ -7462,7 +7476,7 @@ async function getCodexConfigMetadata(forceRefresh = false) {
7462
7476
 
7463
7477
  // ../../packages/runtime-codex/src/codex/config-io.ts
7464
7478
  var import_node_crypto10 = require("crypto");
7465
- var import_promises4 = require("fs/promises");
7479
+ var import_promises5 = require("fs/promises");
7466
7480
  var import_node_path10 = __toESM(require("path"), 1);
7467
7481
 
7468
7482
  // ../../packages/runtime-codex/src/codex/config-presets.ts
@@ -7510,20 +7524,20 @@ function getConfigPath(options) {
7510
7524
  }
7511
7525
  async function ensureConfigDirExists(filePath) {
7512
7526
  const dir = import_node_path10.default.dirname(filePath);
7513
- await (0, import_promises4.mkdir)(dir, { recursive: true });
7527
+ await (0, import_promises5.mkdir)(dir, { recursive: true });
7514
7528
  }
7515
7529
  async function resolveConfigWriteTarget(configPath) {
7516
7530
  try {
7517
- if (!(await (0, import_promises4.lstat)(configPath)).isSymbolicLink()) {
7531
+ if (!(await (0, import_promises5.lstat)(configPath)).isSymbolicLink()) {
7518
7532
  return configPath;
7519
7533
  }
7520
7534
  try {
7521
- return await (0, import_promises4.realpath)(configPath);
7535
+ return await (0, import_promises5.realpath)(configPath);
7522
7536
  } catch (error) {
7523
7537
  if (error.code !== "ENOENT") {
7524
7538
  throw error;
7525
7539
  }
7526
- return import_node_path10.default.resolve(import_node_path10.default.dirname(configPath), await (0, import_promises4.readlink)(configPath));
7540
+ return import_node_path10.default.resolve(import_node_path10.default.dirname(configPath), await (0, import_promises5.readlink)(configPath));
7527
7541
  }
7528
7542
  } catch (error) {
7529
7543
  if (error.code === "ENOENT") {
@@ -7535,19 +7549,19 @@ async function resolveConfigWriteTarget(configPath) {
7535
7549
  async function removeStaleConfigStagingFiles(targetPath) {
7536
7550
  const directory = import_node_path10.default.dirname(targetPath);
7537
7551
  const prefix = `${import_node_path10.default.basename(targetPath)}.tmp-`;
7538
- const entries3 = await (0, import_promises4.readdir)(directory).catch((error) => {
7552
+ const entries3 = await (0, import_promises5.readdir)(directory).catch((error) => {
7539
7553
  if (error.code === "ENOENT") {
7540
7554
  return [];
7541
7555
  }
7542
7556
  throw error;
7543
7557
  });
7544
7558
  await Promise.all(
7545
- entries3.filter((entry) => entry.startsWith(prefix)).map((entry) => (0, import_promises4.rm)(import_node_path10.default.join(directory, entry), { force: true }))
7559
+ entries3.filter((entry) => entry.startsWith(prefix)).map((entry) => (0, import_promises5.rm)(import_node_path10.default.join(directory, entry), { force: true }))
7546
7560
  );
7547
7561
  }
7548
7562
  async function resolveConfigWriteMode(targetPath) {
7549
7563
  try {
7550
- return (await (0, import_promises4.stat)(targetPath)).mode & 511;
7564
+ return (await (0, import_promises5.stat)(targetPath)).mode & 511;
7551
7565
  } catch (error) {
7552
7566
  if (error.code === "ENOENT") {
7553
7567
  return 384;
@@ -7566,7 +7580,7 @@ async function readConfigContent(options) {
7566
7580
  return withCloudSyncTransaction(getUserDataDir(), "read", async () => {
7567
7581
  const configPath = getConfigPath(options);
7568
7582
  try {
7569
- const content = await (0, import_promises4.readFile)(configPath, "utf8");
7583
+ const content = await (0, import_promises5.readFile)(configPath, "utf8");
7570
7584
  return {
7571
7585
  exists: true,
7572
7586
  content: normalizeLineEndings(content)
@@ -7593,25 +7607,20 @@ async function writeConfigContent(content, options) {
7593
7607
  const normalized = ensureTrailingNewline(normalizeLineEndings(content));
7594
7608
  const stagingPath = `${targetPath}.tmp-${process.pid}-${(0, import_node_crypto10.randomUUID)()}`;
7595
7609
  try {
7596
- const handle = await (0, import_promises4.open)(stagingPath, "wx", mode);
7610
+ const handle = await (0, import_promises5.open)(stagingPath, "wx", mode);
7597
7611
  try {
7598
7612
  await handle.writeFile(normalized, "utf8");
7599
7613
  await handle.sync();
7600
7614
  } finally {
7601
7615
  await handle.close();
7602
7616
  }
7603
- await (0, import_promises4.rename)(stagingPath, targetPath);
7617
+ await (0, import_promises5.rename)(stagingPath, targetPath);
7604
7618
  if (process.platform !== "win32") {
7605
- await (0, import_promises4.chmod)(targetPath, mode);
7606
- const directory = await (0, import_promises4.open)(import_node_path10.default.dirname(targetPath), "r");
7607
- try {
7608
- await directory.sync();
7609
- } finally {
7610
- await directory.close();
7611
- }
7619
+ await (0, import_promises5.chmod)(targetPath, mode);
7612
7620
  }
7621
+ await syncDirectory(import_node_path10.default.dirname(targetPath));
7613
7622
  } finally {
7614
- await (0, import_promises4.rm)(stagingPath, { force: true });
7623
+ await (0, import_promises5.rm)(stagingPath, { force: true });
7615
7624
  }
7616
7625
  });
7617
7626
  }
@@ -7619,19 +7628,14 @@ async function removeConfigContent(options) {
7619
7628
  await withCloudSyncTransaction(getUserDataDir(), "write", async () => {
7620
7629
  const configPath = getConfigPath(options);
7621
7630
  try {
7622
- await (0, import_promises4.unlink)(configPath);
7631
+ await (0, import_promises5.unlink)(configPath);
7623
7632
  } catch (error) {
7624
7633
  if (error.code === "ENOENT") {
7625
7634
  return;
7626
7635
  }
7627
7636
  throw error;
7628
7637
  }
7629
- const directory = await (0, import_promises4.open)(import_node_path10.default.dirname(configPath), "r");
7630
- try {
7631
- await directory.sync();
7632
- } finally {
7633
- await directory.close();
7634
- }
7638
+ await syncDirectory(import_node_path10.default.dirname(configPath));
7635
7639
  });
7636
7640
  }
7637
7641
  async function getUpdatedAt(configPath, exists) {
@@ -7639,7 +7643,7 @@ async function getUpdatedAt(configPath, exists) {
7639
7643
  return null;
7640
7644
  }
7641
7645
  try {
7642
- const stats = await (0, import_promises4.stat)(configPath);
7646
+ const stats = await (0, import_promises5.stat)(configPath);
7643
7647
  return stats.mtimeMs;
7644
7648
  } catch (error) {
7645
7649
  const nodeError = error;
@@ -7996,7 +8000,7 @@ function logInfo(...args2) {
7996
8000
  console.info(...args2);
7997
8001
  }
7998
8002
 
7999
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Pipeable.js
8003
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Pipeable.js
8000
8004
  var pipeArguments = (self, args2) => {
8001
8005
  switch (args2.length) {
8002
8006
  case 0:
@@ -8040,7 +8044,7 @@ var Class = /* @__PURE__ */ (function() {
8040
8044
  return PipeableBase;
8041
8045
  })();
8042
8046
 
8043
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Function.js
8047
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Function.js
8044
8048
  var dual = function(arity, body) {
8045
8049
  if (typeof arity === "function") {
8046
8050
  return function() {
@@ -8091,28 +8095,28 @@ function pipe(a, ...args2) {
8091
8095
  return pipeArguments(a, args2);
8092
8096
  }
8093
8097
  function memoize(f) {
8094
- const cache = /* @__PURE__ */ new WeakMap();
8098
+ const cache2 = /* @__PURE__ */ new WeakMap();
8095
8099
  return (a) => {
8096
- const cached2 = cache.get(a);
8100
+ const cached2 = cache2.get(a);
8097
8101
  if (cached2 !== void 0) return cached2;
8098
8102
  const result2 = f(a);
8099
- cache.set(a, result2);
8103
+ cache2.set(a, result2);
8100
8104
  return result2;
8101
8105
  };
8102
8106
  }
8103
8107
  function memoizeIdempotent(f) {
8104
- const cache = /* @__PURE__ */ new WeakMap();
8108
+ const cache2 = /* @__PURE__ */ new WeakMap();
8105
8109
  return (a) => {
8106
- const cached2 = cache.get(a);
8110
+ const cached2 = cache2.get(a);
8107
8111
  if (cached2 !== void 0) return cached2;
8108
8112
  const result2 = f(a);
8109
- cache.set(a, result2);
8110
- cache.set(result2, result2);
8113
+ cache2.set(a, result2);
8114
+ cache2.set(result2, result2);
8111
8115
  return result2;
8112
8116
  };
8113
8117
  }
8114
8118
 
8115
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/equal.js
8119
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/equal.js
8116
8120
  var getAllObjectKeys = (obj) => {
8117
8121
  const keys4 = new Set(Reflect.ownKeys(obj));
8118
8122
  if (obj.constructor === Object) return keys4;
@@ -8135,7 +8139,7 @@ var getAllObjectKeys = (obj) => {
8135
8139
  };
8136
8140
  var byReferenceInstances = /* @__PURE__ */ new WeakSet();
8137
8141
 
8138
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Predicate.js
8142
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Predicate.js
8139
8143
  function isString(input) {
8140
8144
  return typeof input === "string";
8141
8145
  }
@@ -8180,7 +8184,7 @@ function isError(input) {
8180
8184
  return input instanceof Error;
8181
8185
  }
8182
8186
 
8183
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Hash.js
8187
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Hash.js
8184
8188
  var symbol = "~effect/Hash";
8185
8189
  var hash = (self) => {
8186
8190
  switch (typeof self) {
@@ -8294,7 +8298,7 @@ function withVisitedTracking(obj, fn2) {
8294
8298
  return result2;
8295
8299
  }
8296
8300
 
8297
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Equal.js
8301
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Equal.js
8298
8302
  var symbol2 = "~effect/Equal";
8299
8303
  function equals() {
8300
8304
  if (arguments.length === 1) {
@@ -8486,7 +8490,7 @@ function makeCompareSet(equivalence) {
8486
8490
  var compareSets = /* @__PURE__ */ makeCompareSet(compareBoth);
8487
8491
  var isEqual = (u) => hasProperty(u, symbol2);
8488
8492
 
8489
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Reducer.js
8493
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Reducer.js
8490
8494
  function make(combine2, initialValue, combineAll) {
8491
8495
  return {
8492
8496
  combine: combine2,
@@ -8501,7 +8505,7 @@ function make(combine2, initialValue, combineAll) {
8501
8505
  };
8502
8506
  }
8503
8507
 
8504
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Equivalence.js
8508
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Equivalence.js
8505
8509
  var make2 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
8506
8510
  var isStrictEquivalent = (x, y) => x === y;
8507
8511
  var strictEqual = () => isStrictEquivalent;
@@ -8537,10 +8541,10 @@ function Struct(fields) {
8537
8541
  });
8538
8542
  }
8539
8543
 
8540
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/array.js
8544
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/array.js
8541
8545
  var isArrayNonEmpty = (self) => self.length > 0;
8542
8546
 
8543
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/record.js
8547
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/record.js
8544
8548
  function assignProperty(self, key, value3) {
8545
8549
  if (key === "__proto__") {
8546
8550
  Object.defineProperty(self, key, {
@@ -8562,14 +8566,14 @@ function assignProperties(self, source) {
8562
8566
  }
8563
8567
  }
8564
8568
 
8565
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Combiner.js
8569
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Combiner.js
8566
8570
  function make3(combine2) {
8567
8571
  return {
8568
8572
  combine: combine2
8569
8573
  };
8570
8574
  }
8571
8575
 
8572
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Redactable.js
8576
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Redactable.js
8573
8577
  var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Redactable");
8574
8578
  var isRedactable = (u) => hasProperty(u, symbolRedactable);
8575
8579
  function redact(u) {
@@ -8591,7 +8595,7 @@ var emptyContext = {
8591
8595
  }
8592
8596
  };
8593
8597
 
8594
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Formatter.js
8598
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Formatter.js
8595
8599
  function format(input, options) {
8596
8600
  const space = options?.space ?? 0;
8597
8601
  const ancestors = /* @__PURE__ */ new WeakSet();
@@ -8707,7 +8711,7 @@ function formatJson(input, options) {
8707
8711
  }, options?.space) ?? "null";
8708
8712
  }
8709
8713
 
8710
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Inspectable.js
8714
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Inspectable.js
8711
8715
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
8712
8716
  var toJson = (input) => {
8713
8717
  try {
@@ -8760,7 +8764,7 @@ var Class2 = class {
8760
8764
  }
8761
8765
  };
8762
8766
 
8763
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/stackTraceLimit.js
8767
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/stackTraceLimit.js
8764
8768
  var isStackTraceLimitWritable = () => {
8765
8769
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
8766
8770
  if (desc === void 0) {
@@ -8777,7 +8781,7 @@ var setStackTraceLimit = (value3) => {
8777
8781
  }
8778
8782
  };
8779
8783
 
8780
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Utils.js
8784
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Utils.js
8781
8785
  var SingleShotGen = class _SingleShotGen {
8782
8786
  called = false;
8783
8787
  self;
@@ -8837,7 +8841,7 @@ var pickInternalCall = () => {
8837
8841
  };
8838
8842
  var internalCall = /* @__PURE__ */ pickInternalCall();
8839
8843
 
8840
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/core.js
8844
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/core.js
8841
8845
  var EffectTypeId = `~effect/Effect`;
8842
8846
  var ExitTypeId = `~effect/Exit`;
8843
8847
  var effectVariance = {
@@ -9189,7 +9193,7 @@ var DoneVoid = {
9189
9193
  value: void 0
9190
9194
  };
9191
9195
 
9192
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/option.js
9196
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/option.js
9193
9197
  var TypeId = "~effect/Option";
9194
9198
  var CommonProto = {
9195
9199
  [TypeId]: {
@@ -9255,7 +9259,7 @@ var SomeImpl = function(value3) {
9255
9259
  SomeImpl.prototype = SomeProto;
9256
9260
  var some = (value3) => new SomeImpl(value3);
9257
9261
 
9258
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/result.js
9262
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/result.js
9259
9263
  var TypeId2 = "~effect/Result";
9260
9264
  var CommonProto2 = {
9261
9265
  [TypeId2]: {
@@ -9322,7 +9326,7 @@ var SuccessImpl = function(success) {
9322
9326
  SuccessImpl.prototype = SuccessProto;
9323
9327
  var succeed = (success) => new SuccessImpl(success);
9324
9328
 
9325
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Order.js
9329
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Order.js
9326
9330
  function make4(compare2) {
9327
9331
  return (self, that) => self === that ? 0 : compare2(self, that);
9328
9332
  }
@@ -9352,7 +9356,7 @@ var isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
9352
9356
  var isLessThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== 1);
9353
9357
  var isGreaterThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== -1);
9354
9358
 
9355
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Option.js
9359
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Option.js
9356
9360
  var none2 = () => none;
9357
9361
  var some2 = some;
9358
9362
  var isOption2 = isOption;
@@ -9360,8 +9364,8 @@ var isNone2 = isNone;
9360
9364
  var isSome2 = isSome;
9361
9365
  var match = /* @__PURE__ */ dual(2, (self, {
9362
9366
  onNone,
9363
- onSome: onSome2
9364
- }) => isNone2(self) ? onNone() : onSome2(self.value));
9367
+ onSome
9368
+ }) => isNone2(self) ? onNone() : onSome(self.value));
9365
9369
  var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
9366
9370
  var fromNullishOr = (a) => a == null ? none2() : some2(a);
9367
9371
  var fromUndefinedOr = (a) => a === void 0 ? none2() : some2(a);
@@ -9380,7 +9384,7 @@ var flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(s
9380
9384
  var flatten = /* @__PURE__ */ flatMap(identity);
9381
9385
  var filter = /* @__PURE__ */ dual(2, (self, predicate) => isNone2(self) ? none2() : predicate(self.value) ? some2(self.value) : none2());
9382
9386
 
9383
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Result.js
9387
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Result.js
9384
9388
  var succeed2 = succeed;
9385
9389
  var fail2 = fail;
9386
9390
  var isResult2 = isResult;
@@ -9402,10 +9406,10 @@ var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onFailure) => {
9402
9406
  var getOrThrow = /* @__PURE__ */ getOrThrowWith(identity);
9403
9407
  var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => isFailure2(self) ? fail2(self.failure) : f(self.success));
9404
9408
 
9405
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Tuple.js
9409
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Tuple.js
9406
9410
  var makeEquivalence = Tuple;
9407
9411
 
9408
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Iterable.js
9412
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Iterable.js
9409
9413
  var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
9410
9414
  let i = 0;
9411
9415
  for (const a of self) {
@@ -9424,7 +9428,7 @@ var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
9424
9428
  return none2();
9425
9429
  });
9426
9430
 
9427
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Record.js
9431
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Record.js
9428
9432
  var has = /* @__PURE__ */ dual(2, (self, key) => Object.hasOwn(self, key));
9429
9433
  var map3 = /* @__PURE__ */ dual(2, (self, f) => {
9430
9434
  const out = {
@@ -9449,7 +9453,7 @@ var makeEquivalence2 = (equivalence) => {
9449
9453
  return (self, that) => is3(self, that) && is3(that, self);
9450
9454
  };
9451
9455
 
9452
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Array.js
9456
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Array.js
9453
9457
  var Array2 = globalThis.Array;
9454
9458
  var fromIterable = (collection) => Array2.isArray(collection) ? collection : Array2.from(collection);
9455
9459
  var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
@@ -9494,7 +9498,7 @@ var dedupe = (self) => {
9494
9498
  return out;
9495
9499
  };
9496
9500
 
9497
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/BigDecimal.js
9501
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/BigDecimal.js
9498
9502
  var FINITE_INT_REGEXP = /^[+-]?\d+$/;
9499
9503
  var TypeId3 = "~effect/BigDecimal";
9500
9504
  var BigDecimalProto = {
@@ -9687,7 +9691,7 @@ var toExponential = (n) => {
9687
9691
  var isZero = (n) => n.value === bigint0;
9688
9692
  var isNegative = (n) => n.value < bigint0;
9689
9693
 
9690
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/BigInt.js
9694
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/BigInt.js
9691
9695
  var BigInt3 = globalThis.BigInt;
9692
9696
  var toNumber = (b) => {
9693
9697
  if (b > BigInt3(Number.MAX_SAFE_INTEGER) || b < BigInt3(Number.MIN_SAFE_INTEGER)) {
@@ -9696,13 +9700,13 @@ var toNumber = (b) => {
9696
9700
  return some2(Number(b));
9697
9701
  };
9698
9702
 
9699
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Effectable.js
9703
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Effectable.js
9700
9704
  var Prototype2 = (options) => makePrimitiveProto({
9701
9705
  op: options.label,
9702
9706
  [evaluate]: options.evaluate
9703
9707
  });
9704
9708
 
9705
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Context.js
9709
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Context.js
9706
9710
  var ServiceTypeId = "~effect/Context/Service";
9707
9711
  var Service = function() {
9708
9712
  function KeyClass() {
@@ -9879,7 +9883,7 @@ var serviceNotFoundError = (service2) => {
9879
9883
  };
9880
9884
  var Reference = Service;
9881
9885
 
9882
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Duration.js
9886
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Duration.js
9883
9887
  var TypeId5 = "~effect/Duration";
9884
9888
  var bigint02 = /* @__PURE__ */ BigInt(0);
9885
9889
  var bigint12 = /* @__PURE__ */ BigInt(1);
@@ -10144,7 +10148,7 @@ var Equivalence2 = (self, that) => matchPair(self, that, {
10144
10148
  });
10145
10149
  var equals3 = /* @__PURE__ */ dual(2, (self, that) => Equivalence2(self, that));
10146
10150
 
10147
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Scheduler.js
10151
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Scheduler.js
10148
10152
  var Scheduler = /* @__PURE__ */ Reference("effect/Scheduler", {
10149
10153
  fiberCached: true,
10150
10154
  defaultValue: () => new MixedScheduler()
@@ -10288,7 +10292,7 @@ var PreventSchedulerYield = /* @__PURE__ */ Reference("effect/Scheduler/PreventS
10288
10292
  defaultValue: () => false
10289
10293
  });
10290
10294
 
10291
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Data.js
10295
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Data.js
10292
10296
  var Class3 = class extends Class {
10293
10297
  constructor(props) {
10294
10298
  super();
@@ -10300,7 +10304,7 @@ var Class3 = class extends Class {
10300
10304
  var Error3 = Error2;
10301
10305
  var TaggedError2 = TaggedError;
10302
10306
 
10303
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Encoding.js
10307
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Encoding.js
10304
10308
  var EncodingErrorTypeId = "~effect/Encoding/EncodingError";
10305
10309
  var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")) {
10306
10310
  /**
@@ -10472,14 +10476,14 @@ var fromHexChar = (byte) => {
10472
10476
  throw new TypeError("Invalid input");
10473
10477
  };
10474
10478
 
10475
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Tracer.js
10479
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Tracer.js
10476
10480
  var ParentSpanKey = "effect/Tracer/ParentSpan";
10477
10481
  var TracerKey = "effect/Tracer";
10478
10482
 
10479
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/metric.js
10483
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/metric.js
10480
10484
  var FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics";
10481
10485
 
10482
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/references.js
10486
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/references.js
10483
10487
  var CurrentStackFrame = /* @__PURE__ */ Reference("effect/References/CurrentStackFrame", {
10484
10488
  fiberCached: true,
10485
10489
  defaultValue: constUndefined
@@ -10497,7 +10501,7 @@ var MinimumLogLevel = /* @__PURE__ */ Reference("effect/References/MinimumLogLev
10497
10501
  defaultValue: () => "Info"
10498
10502
  });
10499
10503
 
10500
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/effect.js
10504
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/effect.js
10501
10505
  var Interrupt = class extends ReasonBase {
10502
10506
  constructor(fiberId2, annotations = constEmptyAnnotations) {
10503
10507
  super("Interrupt", annotations, "Interrupted");
@@ -10848,13 +10852,13 @@ var FiberImpl = class {
10848
10852
  current = failCause(this._interruptedCause);
10849
10853
  }
10850
10854
  this.currentOpCount++;
10851
- const cache = this.cache;
10852
- if (!yielding && !cache.preventYield && cache.scheduler.shouldYield(this)) {
10855
+ const cache2 = this.cache;
10856
+ if (!yielding && !cache2.preventYield && cache2.scheduler.shouldYield(this)) {
10853
10857
  yielding = true;
10854
10858
  const prev = current;
10855
10859
  current = flatMap3(yieldNow, () => prev);
10856
10860
  }
10857
- current = cache.tracerContext ? cache.tracerContext(current, this) : current[evaluate](this);
10861
+ current = cache2.tracerContext ? cache2.tracerContext(current, this) : current[evaluate](this);
10858
10862
  if (current === Yield) {
10859
10863
  const yielded = this._yielded;
10860
10864
  if (ExitTypeId in yielded) {
@@ -10914,11 +10918,11 @@ var FiberImpl = class {
10914
10918
  this.context = context2;
10915
10919
  if (previous !== void 0 && hasSameCache(previous, context2)) return;
10916
10920
  const root = context2.cacheRoot;
10917
- const cache = root._fiberCache ??= makeFiberContextCache(context2);
10918
- if (this.cache !== void 0 && this.cache.scheduler !== cache.scheduler) {
10921
+ const cache2 = root._fiberCache ??= makeFiberContextCache(context2);
10922
+ if (this.cache !== void 0 && this.cache.scheduler !== cache2.scheduler) {
10919
10923
  this._dispatcher = void 0;
10920
10924
  }
10921
- this.cache = cache;
10925
+ this.cache = cache2;
10922
10926
  }
10923
10927
  get currentSpanLocal() {
10924
10928
  const span = this.cache.span;
@@ -11517,8 +11521,8 @@ var runPromiseExitWith = (context2) => {
11517
11521
  const runFork3 = runForkWith(context2);
11518
11522
  return (effect, options) => {
11519
11523
  const fiber2 = runFork3(effect, options);
11520
- return new Promise((resolve2) => {
11521
- fiber2.addObserver((exit3) => resolve2(exit3));
11524
+ return new Promise((resolve3) => {
11525
+ fiber2.addObserver((exit3) => resolve3(exit3));
11522
11526
  });
11523
11527
  };
11524
11528
  };
@@ -11617,11 +11621,12 @@ var logLevelColors = {
11617
11621
  Fatal: [colors.bgBrightRed, colors.black]
11618
11622
  };
11619
11623
 
11620
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Cause.js
11624
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Cause.js
11621
11625
  var isCause2 = isCause;
11622
11626
  var isReason = isCauseReason;
11623
11627
  var isFailReason2 = isFailReason;
11624
11628
  var fromReasons = causeFromReasons;
11629
+ var die2 = causeDie;
11625
11630
  var makeFailReason = (error) => new Fail(error);
11626
11631
  var makeDieReason = (defect) => new Die(defect);
11627
11632
  var makeInterruptReason2 = makeInterruptReason;
@@ -11629,7 +11634,7 @@ var map6 = causeMap;
11629
11634
  var pretty = causePretty;
11630
11635
  var IllegalArgumentError2 = IllegalArgumentError;
11631
11636
 
11632
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Exit.js
11637
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Exit.js
11633
11638
  var isExit2 = isExit;
11634
11639
  var succeed4 = exitSucceed;
11635
11640
  var failCause2 = exitFailCause;
@@ -11638,7 +11643,7 @@ var void_2 = exitVoid;
11638
11643
  var isSuccess3 = exitIsSuccess;
11639
11644
  var isFailure3 = exitIsFailure;
11640
11645
 
11641
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/dateTime.js
11646
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/dateTime.js
11642
11647
  var TypeId6 = "~effect/DateTime";
11643
11648
  var TimeZoneTypeId = "~effect/DateTime/TimeZone";
11644
11649
  var Proto2 = {
@@ -12025,7 +12030,7 @@ var formatIsoOffset = (self) => {
12025
12030
  };
12026
12031
  var formatIsoZoned = (self) => self.zone._tag === "Offset" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;
12027
12032
 
12028
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Number.js
12033
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Number.js
12029
12034
  var Number3 = globalThis.Number;
12030
12035
  var remainder = /* @__PURE__ */ dual(2, (self, divisor) => {
12031
12036
  const selfString = self.toString();
@@ -12064,18 +12069,18 @@ function toScientificInteger(n) {
12064
12069
  return [coefficient, globalThis.Number(scientific.slice(eIndex + 1)) - digits.length + 1];
12065
12070
  }
12066
12071
 
12067
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/String.js
12072
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/String.js
12068
12073
  var String2 = globalThis.String;
12069
12074
  var trim = (self) => self.trim();
12070
12075
 
12071
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Effect.js
12076
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Effect.js
12072
12077
  var tryPromise2 = tryPromise;
12073
12078
  var succeed5 = succeed3;
12074
12079
  var succeedNone2 = succeedNone;
12075
12080
  var void_3 = void_;
12076
12081
  var fail5 = fail3;
12077
12082
  var failCauseSync2 = failCauseSync;
12078
- var die2 = die;
12083
+ var die3 = die;
12079
12084
  var try_2 = try_;
12080
12085
  var fromResult2 = fromResult;
12081
12086
  var flatMap4 = flatMap3;
@@ -12093,7 +12098,7 @@ var flatMapEager2 = flatMapEager;
12093
12098
  var catchEager2 = catchEager;
12094
12099
  var fnUntracedEager2 = fnUntracedEager;
12095
12100
 
12096
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/annotations.js
12101
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/annotations.js
12097
12102
  function resolve(ast) {
12098
12103
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
12099
12104
  }
@@ -12116,7 +12121,7 @@ var getExpected = /* @__PURE__ */ memoize((ast) => {
12116
12121
  });
12117
12122
  var annotationExcludedKeys = /* @__PURE__ */ new Set([SENTINELS_ANNOTATION_KEY, STRUCTURAL_ANNOTATION_KEY, "representation", "arbitraryConstraint", "brands", "toJsonSchema", "toCode", "toEquivalence", "toFormatter", "toCodec", "toCodecJson", "toCodecStringTree", "toCodecIso", "toCodecArbitrary"]);
12118
12123
 
12119
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/parser.js
12124
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/parser.js
12120
12125
  var missing = /* @__PURE__ */ Symbol();
12121
12126
  var succeed6 = succeed4;
12122
12127
  var missingExit = /* @__PURE__ */ succeed6(missing);
@@ -12124,7 +12129,7 @@ var sameExit = /* @__PURE__ */ succeed6(missing);
12124
12129
  var toOption = (value3) => value3 === missing ? none2() : some2(value3);
12125
12130
  var fromOptionExit = (option2) => option2._tag === "None" ? missingExit : succeed6(option2.value);
12126
12131
 
12127
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaIssue.js
12132
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaIssue.js
12128
12133
  var TypeId7 = "~effect/SchemaIssue/Issue";
12129
12134
  function isIssue(u) {
12130
12135
  return hasProperty(u, TypeId7) && u[TypeId7] === TypeId7;
@@ -12467,7 +12472,7 @@ function findMessage(issue) {
12467
12472
  if (typeof message === "string") return message;
12468
12473
  }
12469
12474
 
12470
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/cause.js
12475
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/cause.js
12471
12476
  function getSchemaIssue(cause) {
12472
12477
  let issue;
12473
12478
  for (const reason of cause.reasons) {
@@ -12488,7 +12493,7 @@ function getSchemaIssueOrThrow(cause, message) {
12488
12493
  return issue;
12489
12494
  }
12490
12495
 
12491
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/DateTime.js
12496
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/DateTime.js
12492
12497
  var isDateTime2 = isDateTime;
12493
12498
  var isTimeZone2 = isTimeZone;
12494
12499
  var isTimeZoneOffset2 = isTimeZoneOffset;
@@ -12511,28 +12516,10 @@ var toEpochMillis2 = toEpochMillis;
12511
12516
  var formatIso2 = formatIso;
12512
12517
  var formatIsoZoned2 = formatIsoZoned;
12513
12518
 
12514
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaGetter.js
12515
- var Getter = class extends Class {
12516
- run;
12517
- constructor(run2) {
12518
- super();
12519
- this.run = run2;
12520
- }
12521
- map(f) {
12522
- return new Getter((oe, options) => this.run(oe, options).pipe(mapEager2(map(f))));
12523
- }
12524
- compose(other) {
12525
- if (isPassthrough(this)) {
12526
- return other;
12527
- }
12528
- if (isPassthrough(other)) {
12529
- return this;
12530
- }
12531
- return new Getter((oe, options) => this.run(oe, options).pipe(flatMapEager2((ot) => other.run(ot, options))));
12532
- }
12533
- };
12519
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaGetter.js
12520
+ var makeGetter = (fields) => Object.assign(Object.create(Prototype), fields);
12534
12521
  function fail6(f) {
12535
- return new Getter((oe, options) => fail5(f(oe, options)));
12522
+ return transformOptionalEffect((oe, options) => fail5(f(oe, options)));
12536
12523
  }
12537
12524
  function forbidden(message) {
12538
12525
  return fail6((oe, options) => {
@@ -12543,30 +12530,41 @@ function forbidden(message) {
12543
12530
  });
12544
12531
  }
12545
12532
  var forbiddenEncoding = /* @__PURE__ */ forbidden(() => "Encoding is not supported");
12546
- var passthrough_ = /* @__PURE__ */ new Getter(succeed5);
12547
- function isPassthrough(getter) {
12548
- return getter.run === passthrough_.run;
12549
- }
12533
+ var passthrough_ = /* @__PURE__ */ makeGetter({
12534
+ _tag: "Passthrough"
12535
+ });
12550
12536
  function passthrough() {
12551
12537
  return passthrough_;
12552
12538
  }
12553
- function onSome(f) {
12554
- return new Getter((oe, options) => isNone2(oe) ? succeedNone2 : f(oe.value, options));
12555
- }
12556
12539
  function transform(f) {
12557
- return transformOptional(map(f));
12540
+ return makeGetter({
12541
+ _tag: "Transform",
12542
+ transform: f
12543
+ });
12558
12544
  }
12559
12545
  function transformEffect(f) {
12560
- return onSome((e, options) => f(e, options).pipe(mapEager2(some2)));
12546
+ return makeGetter({
12547
+ _tag: "TransformEffect",
12548
+ transform: f
12549
+ });
12561
12550
  }
12562
12551
  function transformOptional(f) {
12563
- return new Getter((oe) => succeed5(f(oe)));
12552
+ return makeGetter({
12553
+ _tag: "TransformOptional",
12554
+ transform: f
12555
+ });
12556
+ }
12557
+ function transformOptionalEffect(f) {
12558
+ return makeGetter({
12559
+ _tag: "TransformOptionalEffect",
12560
+ transform: f
12561
+ });
12564
12562
  }
12565
12563
  function omit() {
12566
- return new Getter(() => succeedNone2);
12564
+ return transformOptional(() => none2());
12567
12565
  }
12568
12566
  function withDefault(defaultValue) {
12569
- return new Getter((o) => {
12567
+ return transformOptionalEffect((o) => {
12570
12568
  const filtered = filter(o, isNotUndefined);
12571
12569
  return isSome2(filtered) ? succeed5(filtered) : mapEager2(defaultValue, some2);
12572
12570
  });
@@ -12587,21 +12585,21 @@ function trim2() {
12587
12585
  return transform(trim);
12588
12586
  }
12589
12587
  function parseJson(options) {
12590
- return onSome((input, parseOptions) => try_2({
12591
- try: () => some2(JSON.parse(input, options?.reviver)),
12588
+ return transformEffect((input, parseOptions) => try_2({
12589
+ try: () => JSON.parse(input, options?.reviver),
12592
12590
  catch: () => new InvalidValue({
12593
12591
  expected: "a valid JSON string"
12594
12592
  }, input, parseOptions)
12595
12593
  }));
12596
12594
  }
12597
12595
  function stringifyJson(options) {
12598
- return onSome((input, parseOptions) => try_2({
12596
+ return transformEffect((input, parseOptions) => try_2({
12599
12597
  try: () => {
12600
12598
  const output = JSON.stringify(input, options?.replacer, options?.space);
12601
12599
  if (output === void 0) {
12602
12600
  throw new TypeError("Value cannot be represented as JSON");
12603
12601
  }
12604
- return some2(output);
12602
+ return output;
12605
12603
  },
12606
12604
  catch: () => new InvalidValue({
12607
12605
  expected: "a JSON-serializable value"
@@ -12791,7 +12789,7 @@ function collectBracketPathEntries(isLeaf) {
12791
12789
  };
12792
12790
  }
12793
12791
 
12794
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/ByteSize.js
12792
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/ByteSize.js
12795
12793
  var bigint03 = /* @__PURE__ */ BigInt(0);
12796
12794
  var bigint13 = /* @__PURE__ */ BigInt(1);
12797
12795
  var decimalBase = /* @__PURE__ */ BigInt(1e3);
@@ -12886,7 +12884,7 @@ var fromNumber = (input) => {
12886
12884
  }
12887
12885
  return make10(BigInt(input));
12888
12886
  };
12889
- var parse2 = (input) => {
12887
+ var fromStringUnsafe = (input) => {
12890
12888
  const match7 = /^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(input);
12891
12889
  if (match7 === null) return invalid2(`unsupported syntax ${JSON.stringify(input)}`);
12892
12890
  const unit = unitsByName.get(match7[3]);
@@ -12899,6 +12897,7 @@ var parse2 = (input) => {
12899
12897
  }
12900
12898
  return make10(numerator / scale);
12901
12899
  };
12900
+ var fromString2 = /* @__PURE__ */ liftThrowable(fromStringUnsafe);
12902
12901
  var fromInputUnsafe2 = (input) => {
12903
12902
  switch (typeof input) {
12904
12903
  case "bigint":
@@ -12907,7 +12906,7 @@ var fromInputUnsafe2 = (input) => {
12907
12906
  case "number":
12908
12907
  return fromNumber(input);
12909
12908
  case "string":
12910
- return parse2(input);
12909
+ return fromStringUnsafe(input);
12911
12910
  }
12912
12911
  return invalid2(`unsupported input ${input}`);
12913
12912
  };
@@ -12917,12 +12916,13 @@ var isByteSize = (input) => typeof input === "bigint" && input >= bigint03;
12917
12916
  var toBigInt = (self) => self;
12918
12917
  var toNumber2 = toNumber;
12919
12918
 
12920
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaTransformation.js
12921
- var Middleware = class {
12919
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaTransformation.js
12920
+ var Middleware = class extends Class {
12922
12921
  _tag = "Middleware";
12923
12922
  decode;
12924
12923
  encode;
12925
12924
  constructor(decode2, encode2) {
12925
+ super();
12926
12926
  this.decode = decode2;
12927
12927
  this.encode = encode2;
12928
12928
  }
@@ -12931,26 +12931,24 @@ var Middleware = class {
12931
12931
  }
12932
12932
  };
12933
12933
  var TypeId8 = "~effect/SchemaTransformation/Transformation";
12934
- var Transformation = class {
12934
+ var Transformation = class extends Class {
12935
12935
  [TypeId8] = TypeId8;
12936
12936
  _tag = "Transformation";
12937
12937
  decode;
12938
12938
  encode;
12939
12939
  constructor(decode2, encode2) {
12940
+ super();
12940
12941
  this.decode = decode2;
12941
12942
  this.encode = encode2;
12942
12943
  }
12943
12944
  flip() {
12944
12945
  return new Transformation(this.encode, this.decode);
12945
12946
  }
12946
- compose(other) {
12947
- return new Transformation(this.decode.compose(other.decode), other.encode.compose(this.encode));
12948
- }
12949
12947
  };
12950
12948
  function isTransformation(u) {
12951
12949
  return hasProperty(u, TypeId8) && u[TypeId8] === TypeId8;
12952
12950
  }
12953
- var make11 = (options) => {
12951
+ var makeTransformation = (options) => {
12954
12952
  if (isTransformation(options)) {
12955
12953
  return options;
12956
12954
  }
@@ -12977,7 +12975,7 @@ var bigintFromString = /* @__PURE__ */ new Transformation(/* @__PURE__ */ BigInt
12977
12975
  var dateFromString = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Date3(), /* @__PURE__ */ transform(formatDate));
12978
12976
  var dateFromMillis = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Date3(), /* @__PURE__ */ transform((date) => date.getTime()));
12979
12977
  var byteSizeFromString = /* @__PURE__ */ transformEffect2({
12980
- decode: (input, options) => match(fromInput2(input), {
12978
+ decode: (input, options) => match(fromString2(input), {
12981
12979
  onNone: () => fail5(new InvalidValue({
12982
12980
  expected: "a valid ByteSize string"
12983
12981
  }, input, options)),
@@ -13111,7 +13109,7 @@ function fromJsonString(options) {
13111
13109
  var fromFormData = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeFormData(), /* @__PURE__ */ encodeFormData());
13112
13110
  var fromURLSearchParams = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeURLSearchParams(), /* @__PURE__ */ encodeURLSearchParams());
13113
13111
 
13114
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaAST.js
13112
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaAST.js
13115
13113
  function makeGuard(tag2) {
13116
13114
  return (ast) => ast._tag === tag2;
13117
13115
  }
@@ -13397,9 +13395,9 @@ var TemplateLiteral = class extends ASTNodeImpl {
13397
13395
  this.suffixLengths = suffixLengths;
13398
13396
  }
13399
13397
  /** @internal */
13400
- getParser(compile) {
13398
+ getParser(compile2) {
13401
13399
  const tuple2 = new Arrays(false, this.parts.map(partFromString), []);
13402
- const parser = compile(decodeTo(string2, tuple2, templateLiteralTransformation(this)));
13400
+ const parser = compile2(decodeTo(string2, tuple2, templateLiteralTransformation(this)));
13403
13401
  return (input, options) => {
13404
13402
  if (input === missing) return missingExit;
13405
13403
  const result2 = parser(input, options);
@@ -13645,7 +13643,7 @@ var Arrays = class extends ASTNodeImpl {
13645
13643
  }
13646
13644
  }
13647
13645
  /** @internal */
13648
- getParser(compile, compileConstructorDefault2 = compile) {
13646
+ getParser(compile2, compileField2 = compile2) {
13649
13647
  const ast = this;
13650
13648
  let elements;
13651
13649
  let rest;
@@ -13669,11 +13667,11 @@ var Arrays = class extends ASTNodeImpl {
13669
13667
  if (!elements) {
13670
13668
  elements = ast.elements.map((ast2) => ({
13671
13669
  ast: ast2,
13672
- parser: compileConstructorDefault2(ast2)
13670
+ parser: compileField2(ast2)
13673
13671
  }));
13674
13672
  rest = ast.rest.map((ast2) => ({
13675
13673
  ast: ast2,
13676
- parser: compileConstructorDefault2(ast2)
13674
+ parser: compileField2(ast2)
13677
13675
  }));
13678
13676
  }
13679
13677
  const len = input.length;
@@ -13730,30 +13728,31 @@ var Arrays = class extends ASTNodeImpl {
13730
13728
  return "array";
13731
13729
  }
13732
13730
  };
13731
+ function stepArray(s, item, exit3, i) {
13732
+ if (exit3._tag === "Failure") {
13733
+ return wrapPropertyKeyIssue(s, s.ast, i, exit3);
13734
+ }
13735
+ const value3 = exit3 === sameExit ? item : exit3[args];
13736
+ if (value3 !== missing) {
13737
+ s.output[i] = value3;
13738
+ } else {
13739
+ const p = s.getParser(s.tailThreshold, i);
13740
+ if (isOptional(p.ast)) return;
13741
+ const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
13742
+ if (s.options.errors === "all") {
13743
+ if (s.issues) s.issues.push(issue);
13744
+ else s.issues = [issue];
13745
+ } else {
13746
+ return fail4(new Composite(s.ast, [issue], s.input, s.options));
13747
+ }
13748
+ }
13749
+ }
13733
13750
  var parseArrayOptions = {
13734
13751
  onItem(s, item, i) {
13735
13752
  const value3 = i < s.len ? item : missing;
13736
13753
  return s.getParser(s.tailThreshold, i).parser(value3, s.options);
13737
13754
  },
13738
- step(s, item, exit3, i) {
13739
- if (exit3._tag === "Failure") {
13740
- return wrapPropertyKeyIssue(s, s.ast, i, exit3);
13741
- }
13742
- const value3 = exit3 === sameExit ? item : exit3[args];
13743
- if (value3 !== missing) {
13744
- s.output[i] = value3;
13745
- } else {
13746
- const p = s.getParser(s.tailThreshold, i);
13747
- if (isOptional(p.ast)) return;
13748
- const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
13749
- if (s.options.errors === "all") {
13750
- if (s.issues) s.issues.push(issue);
13751
- else s.issues = [issue];
13752
- } else {
13753
- return fail4(new Composite(s.ast, [issue], s.input, s.options));
13754
- }
13755
- }
13756
- }
13755
+ step: stepArray
13757
13756
  };
13758
13757
  var parseArray = /* @__PURE__ */ iterateEager()(parseArrayOptions);
13759
13758
  var parseArrayConcurrent = /* @__PURE__ */ iterateConcurrent()(parseArrayOptions);
@@ -13871,7 +13870,7 @@ var Objects = class extends ASTNodeImpl {
13871
13870
  }
13872
13871
  }
13873
13872
  /** @internal */
13874
- getParser(compile, compileConstructorDefault2 = compile) {
13873
+ getParser(compile2, compileField2 = compile2) {
13875
13874
  const ast = this;
13876
13875
  const expectedKeys = [];
13877
13876
  for (const ps of ast.propertySignatures) {
@@ -13924,14 +13923,14 @@ var Objects = class extends ASTNodeImpl {
13924
13923
  const compileMembers = () => {
13925
13924
  if (!properties) {
13926
13925
  properties = ast.propertySignatures.map((ps) => ({
13927
- parser: compileConstructorDefault2(ps.type),
13926
+ parser: compileField2(ps.type),
13928
13927
  name: ps.name,
13929
13928
  type: ps.type
13930
13929
  }));
13931
13930
  indexes = indexCount ? ast.indexSignatures.map((is3) => ({
13932
13931
  is: is3,
13933
- parserKey: compile(parameterFromPropertyKey(is3.parameter)),
13934
- parserValue: compileConstructorDefault2(is3.type)
13932
+ parserKey: compile2(parameterFromPropertyKey(is3.parameter)),
13933
+ parserValue: compileField2(is3.type)
13935
13934
  })) : void 0;
13936
13935
  }
13937
13936
  return properties;
@@ -13993,10 +13992,10 @@ var Objects = class extends ASTNodeImpl {
13993
13992
  if (indexCount && concurrency === 1) {
13994
13993
  for (let i = 0; i < indexCount; i++) {
13995
13994
  const index2 = indexes[i];
13996
- const parse4 = index2.is.parameter === string2 ? parseStringIndex : parseIndex;
13995
+ const parse3 = index2.is.parameter === string2 ? parseStringIndex : parseIndex;
13997
13996
  const keys4 = indexKeys?.[i] ?? (index2.is.parameter === string2 ? Object.keys(record2) : getIndexSignatureKeys(record2, index2.is.parameter, options));
13998
13997
  for (let j = 0; j < keys4.length; j++) {
13999
- const eff = parse4(state, keys4[j], index2);
13998
+ const eff = parse3(state, keys4[j], index2);
14000
13999
  if (!effectIsExit(eff)) yield* eff;
14001
14000
  else if (eff._tag === "Failure") return yield* eff;
14002
14001
  }
@@ -14067,7 +14066,7 @@ var Objects = class extends ASTNodeImpl {
14067
14066
  if (terminal) return terminal;
14068
14067
  }
14069
14068
  } catch (error) {
14070
- return die2(error);
14069
+ return die3(error);
14071
14070
  }
14072
14071
  return succeed6(out);
14073
14072
  };
@@ -14422,24 +14421,24 @@ var Union = class extends ASTNodeImpl {
14422
14421
  this.encodingChecks = encodingChecks;
14423
14422
  }
14424
14423
  /** @internal */
14425
- getParser(compile, compileConstructorDefault2) {
14424
+ getParser(compile2, compileField2) {
14426
14425
  const ast = this;
14427
14426
  return (input, options) => {
14428
14427
  if (input === missing) {
14429
14428
  return missingExit;
14430
14429
  }
14431
- const candidates = getCandidates(input, ast.types, compileConstructorDefault2 !== void 0);
14430
+ const candidates = getCandidates(input, ast.types, compileField2 !== void 0);
14432
14431
  if (candidates.length === 0) {
14433
14432
  return fail5(new AnyOf(ast, [], input, options));
14434
14433
  }
14435
14434
  if (candidates.length === 1) {
14436
- const result2 = compile(candidates[0])(input, options);
14435
+ const result2 = compile2(candidates[0])(input, options);
14437
14436
  if (result2._tag === "Success") return result2;
14438
14437
  return effectIsExit(result2) ? failSingleUnionCandidate(ast, result2.cause, input, options) : catchCause2(result2, (cause) => failSingleUnionCandidate(ast, cause, input, options));
14439
14438
  }
14440
14439
  const state = {
14441
14440
  ast,
14442
- compile,
14441
+ compile: compile2,
14443
14442
  input,
14444
14443
  out: void 0,
14445
14444
  successes: ast.options?.mode === "oneOf" ? [] : void 0,
@@ -14557,9 +14556,9 @@ var Suspend = class extends ASTNodeImpl {
14557
14556
  this.thunk = () => ast ??= thunk();
14558
14557
  }
14559
14558
  /** @internal */
14560
- getParser(compile) {
14559
+ getParser(compile2) {
14561
14560
  let parser;
14562
- return (input, options) => (parser ??= compile(this.thunk()))(input, options);
14561
+ return (input, options) => (parser ??= compile2(this.thunk()))(input, options);
14563
14562
  }
14564
14563
  /** @internal */
14565
14564
  recur(recur2) {
@@ -14810,9 +14809,7 @@ var mutableKey = /* @__PURE__ */ memoizeIdempotent((ast) => {
14810
14809
  });
14811
14810
  var mutableKeyLastLink = /* @__PURE__ */ applyToLastLink(mutableKey);
14812
14811
  function withConstructorDefault(ast, defaultValue) {
14813
- const transformation = new Transformation(withDefault(defaultValue), passthrough());
14814
- const constructorDefault = new Link(unknown, transformation);
14815
- const context2 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) : new Context(false, false, constructorDefault);
14812
+ const context2 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, defaultValue, ast.context.annotations) : new Context(false, false, defaultValue);
14816
14813
  return replaceContext(ast, context2);
14817
14814
  }
14818
14815
  function decodeTo(from, to, transformation) {
@@ -15125,7 +15122,7 @@ function isStringTreeLeaf(u) {
15125
15122
  return u === void 0 || typeof u === "string";
15126
15123
  }
15127
15124
  function isTree(u, isLeaf) {
15128
- const cache = /* @__PURE__ */ new WeakMap();
15125
+ const cache2 = /* @__PURE__ */ new WeakMap();
15129
15126
  const stack = [];
15130
15127
  outer: while (true) {
15131
15128
  if (typeof u !== "object" || u === null) {
@@ -15134,7 +15131,7 @@ function isTree(u, isLeaf) {
15134
15131
  }
15135
15132
  } else {
15136
15133
  const value3 = u;
15137
- const cached2 = cache.get(value3);
15134
+ const cached2 = cache2.get(value3);
15138
15135
  if (cached2 === false) {
15139
15136
  return false;
15140
15137
  }
@@ -15146,7 +15143,7 @@ function isTree(u, isLeaf) {
15146
15143
  return false;
15147
15144
  }
15148
15145
  }
15149
- cache.set(value3, false);
15146
+ cache2.set(value3, false);
15150
15147
  stack.push({
15151
15148
  value: value3,
15152
15149
  keys: isArray2 ? value3.length : Object.keys(value3),
@@ -15166,7 +15163,7 @@ function isTree(u, isLeaf) {
15166
15163
  u = frame.value[keys4[frame.index++]];
15167
15164
  continue outer;
15168
15165
  }
15169
- cache.set(frame.value, true);
15166
+ cache2.set(frame.value, true);
15170
15167
  stack.pop();
15171
15168
  }
15172
15169
  return true;
@@ -15201,7 +15198,7 @@ var StringTree = /* @__PURE__ */ new Declaration([], () => (input, ast, options)
15201
15198
  });
15202
15199
  var unknownToStringTree = /* @__PURE__ */ new Link(StringTree, /* @__PURE__ */ passthrough2());
15203
15200
 
15204
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Chunk.js
15201
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Chunk.js
15205
15202
  var TypeId10 = "~effect/Chunk";
15206
15203
  function copy(src, srcPos, dest, destPos, len) {
15207
15204
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
@@ -15385,7 +15382,7 @@ var getUnsafe2 = /* @__PURE__ */ dual(2, (self, index2) => {
15385
15382
  });
15386
15383
  var size = (self) => self.length;
15387
15384
 
15388
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js
15385
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Schema.js
15389
15386
  var Schema_exports = {};
15390
15387
  __export(Schema_exports, {
15391
15388
  Any: () => Any2,
@@ -15445,20 +15442,36 @@ __export(Schema_exports, {
15445
15442
  IpAddressFromString: () => IpAddressFromString,
15446
15443
  IpInterface: () => IpInterface,
15447
15444
  IpInterfaceFromString: () => IpInterfaceFromString,
15445
+ IpLinkLocalAddress: () => IpLinkLocalAddress,
15446
+ IpLinkLocalAddressFromString: () => IpLinkLocalAddressFromString,
15447
+ IpLoopbackAddress: () => IpLoopbackAddress,
15448
+ IpLoopbackAddressFromString: () => IpLoopbackAddressFromString,
15449
+ IpMulticastAddress: () => IpMulticastAddress,
15450
+ IpMulticastAddressFromString: () => IpMulticastAddressFromString,
15448
15451
  IpNetwork: () => IpNetwork,
15449
15452
  IpNetworkFromString: () => IpNetworkFromString,
15453
+ IpUnicastAddress: () => IpUnicastAddress,
15454
+ IpUnicastAddressFromString: () => IpUnicastAddressFromString,
15455
+ IpUnspecifiedAddress: () => IpUnspecifiedAddress,
15456
+ IpUnspecifiedAddressFromString: () => IpUnspecifiedAddressFromString,
15450
15457
  Ipv4Address: () => Ipv4Address,
15451
15458
  Ipv4AddressFromString: () => Ipv4AddressFromString,
15459
+ Ipv4BroadcastAddress: () => Ipv4BroadcastAddress,
15460
+ Ipv4BroadcastAddressFromString: () => Ipv4BroadcastAddressFromString,
15452
15461
  Ipv4Interface: () => Ipv4Interface,
15453
15462
  Ipv4InterfaceFromString: () => Ipv4InterfaceFromString,
15454
15463
  Ipv4Network: () => Ipv4Network,
15455
15464
  Ipv4NetworkFromString: () => Ipv4NetworkFromString,
15465
+ Ipv4PrivateAddress: () => Ipv4PrivateAddress,
15466
+ Ipv4PrivateAddressFromString: () => Ipv4PrivateAddressFromString,
15456
15467
  Ipv6Address: () => Ipv6Address,
15457
15468
  Ipv6AddressFromString: () => Ipv6AddressFromString,
15458
15469
  Ipv6Interface: () => Ipv6Interface,
15459
15470
  Ipv6InterfaceFromString: () => Ipv6InterfaceFromString,
15460
15471
  Ipv6Network: () => Ipv6Network,
15461
15472
  Ipv6NetworkFromString: () => Ipv6NetworkFromString,
15473
+ Ipv6UniqueLocalAddress: () => Ipv6UniqueLocalAddress,
15474
+ Ipv6UniqueLocalAddressFromString: () => Ipv6UniqueLocalAddressFromString,
15462
15475
  Json: () => Json2,
15463
15476
  JsonFromUrlParamsField: () => JsonFromUrlParamsField,
15464
15477
  JsonObject: () => JsonObject,
@@ -15466,6 +15479,16 @@ __export(Schema_exports, {
15466
15479
  Literals: () => Literals,
15467
15480
  MacAddress: () => MacAddress,
15468
15481
  MacAddressFromString: () => MacAddressFromString,
15482
+ MacBroadcastAddress: () => MacBroadcastAddress,
15483
+ MacBroadcastAddressFromString: () => MacBroadcastAddressFromString,
15484
+ MacLocallyAdministeredAddress: () => MacLocallyAdministeredAddress,
15485
+ MacLocallyAdministeredAddressFromString: () => MacLocallyAdministeredAddressFromString,
15486
+ MacMulticastAddress: () => MacMulticastAddress,
15487
+ MacMulticastAddressFromString: () => MacMulticastAddressFromString,
15488
+ MacUnicastAddress: () => MacUnicastAddress,
15489
+ MacUnicastAddressFromString: () => MacUnicastAddressFromString,
15490
+ MacUniversallyAdministeredAddress: () => MacUniversallyAdministeredAddress,
15491
+ MacUniversallyAdministeredAddressFromString: () => MacUniversallyAdministeredAddressFromString,
15469
15492
  MutableJson: () => MutableJson2,
15470
15493
  Natural: () => Natural,
15471
15494
  Never: () => Never2,
@@ -15650,7 +15673,7 @@ __export(Schema_exports, {
15650
15673
  isUppercased: () => isUppercased,
15651
15674
  link: () => link,
15652
15675
  linkDecoding: () => linkDecoding,
15653
- make: () => make22,
15676
+ make: () => make21,
15654
15677
  makeFilter: () => makeFilter2,
15655
15678
  makeFilterGroup: () => makeFilterGroup,
15656
15679
  makeIsBetween: () => makeIsBetween,
@@ -15705,7 +15728,7 @@ __export(Schema_exports, {
15705
15728
  withDecodingDefaultTypeKey: () => withDecodingDefaultTypeKey
15706
15729
  });
15707
15730
 
15708
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/hashMap.js
15731
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/hashMap.js
15709
15732
  var HashMapTypeId = "~effect/HashMap";
15710
15733
  var SHIFT = 5;
15711
15734
  var BUCKET_SIZE = 1 << SHIFT;
@@ -16349,14 +16372,14 @@ var entries = (self) => {
16349
16372
  };
16350
16373
  var size2 = (self) => self.size;
16351
16374
 
16352
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/HashMap.js
16375
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/HashMap.js
16353
16376
  var isHashMap2 = isHashMap;
16354
16377
  var fromIterable4 = fromIterable3;
16355
16378
  var entries2 = entries;
16356
16379
  var toEntries = (self) => Array.from(entries2(self));
16357
16380
  var size3 = size2;
16358
16381
 
16359
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/hashSet.js
16382
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/hashSet.js
16360
16383
  var HashSetTypeId = "~effect/HashSet";
16361
16384
  var HashSetProto = {
16362
16385
  [symbol]() {
@@ -16410,12 +16433,12 @@ var every2 = (self, predicate) => {
16410
16433
  return true;
16411
16434
  };
16412
16435
 
16413
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/HashSet.js
16436
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/HashSet.js
16414
16437
  var fromIterable6 = fromIterable5;
16415
16438
  var isHashSet2 = isHashSet;
16416
16439
  var size5 = size4;
16417
16440
 
16418
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/graph.js
16441
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/graph.js
16419
16442
  var TypeId11 = "~effect/Graph";
16420
16443
  var isGraph = (u) => hasProperty(u, TypeId11);
16421
16444
  var toImpl = (graph) => graph;
@@ -16481,7 +16504,7 @@ var ProtoGraph = {
16481
16504
  return pipeArguments(this, arguments);
16482
16505
  }
16483
16506
  };
16484
- var make14 = (type, mutable3) => {
16507
+ var make13 = (type, mutable3) => {
16485
16508
  const graph = Object.create(ProtoGraph);
16486
16509
  graph.type = type;
16487
16510
  graph.mutable = mutable3;
@@ -16512,7 +16535,7 @@ var snapshot = (graph) => {
16512
16535
  };
16513
16536
  };
16514
16537
  var hydrate = (snapshot2) => {
16515
- const graph = make14(snapshot2.type, false);
16538
+ const graph = make13(snapshot2.type, false);
16516
16539
  for (const node of snapshot2.nodes) {
16517
16540
  graph.nodes.set(node.index, node.data);
16518
16541
  graph.adjacency.set(node.index, []);
@@ -16537,7 +16560,258 @@ var hydrate = (snapshot2) => {
16537
16560
  return graph;
16538
16561
  };
16539
16562
 
16540
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaParser.js
16563
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/interpreter.js
16564
+ var flatMapTransformation = (result2, current, f) => result2 === sameExit ? f(current) : flatMapEager2(result2, f);
16565
+ function compileTransformation(transformation) {
16566
+ if (transformation._tag === "Middleware") {
16567
+ return (result2, current, options) => {
16568
+ const transformed = result2 === sameExit ? transformation.decode(succeed6(toOption(current)), options) : transformation.decode(mapEager2(result2, toOption), options);
16569
+ return fromOptionalEffect(transformed);
16570
+ };
16571
+ }
16572
+ const getter = transformation.decode;
16573
+ switch (getter._tag) {
16574
+ case "Passthrough":
16575
+ return (result2, current) => result2 === sameExit ? succeed6(current) : result2;
16576
+ case "Transform": {
16577
+ const transform3 = (value3) => value3 === missing ? missingExit : succeed6(getter.transform(value3));
16578
+ return (result2, current) => flatMapTransformation(result2, current, transform3);
16579
+ }
16580
+ case "TransformOptional": {
16581
+ const transform3 = (value3) => fromOptionExit(getter.transform(toOption(value3)));
16582
+ return (result2, current) => flatMapTransformation(result2, current, transform3);
16583
+ }
16584
+ case "TransformEffect":
16585
+ return (result2, current, options) => flatMapTransformation(result2, current, (value3) => value3 === missing ? missingExit : getter.transform(value3, options));
16586
+ case "TransformOptionalEffect":
16587
+ return (result2, current, options) => flatMapTransformation(result2, current, (value3) => fromOptionalEffect(getter.transform(toOption(value3), options)));
16588
+ }
16589
+ }
16590
+ var fromOptionalEffect = (effect) => flatMapEager2(effect, fromOptionExit);
16591
+ var wrapEncoding = (ast, input, options, effect) => catchCause2(effect, (cause) => failCauseSync2(() => map6(cause, (issue) => new Encoding(ast, issue, input, options))));
16592
+ function makeConstructorParser(descriptor2, compile2) {
16593
+ const transform3 = compileTransformation(descriptor2.link.transformation);
16594
+ let sourceParser;
16595
+ return (input, options) => {
16596
+ if (input === missing) return missingExit;
16597
+ if (descriptor2.isConstructed(input)) return sameExit;
16598
+ const result2 = (sourceParser ??= compile2(descriptor2.link.to))(input, options);
16599
+ return transform3(result2, input, options);
16600
+ };
16601
+ }
16602
+ function withDefault2(ast, parser) {
16603
+ const defaultValue = ast.context.constructorDefault;
16604
+ return (input, options) => {
16605
+ if (input !== missing && input !== void 0) return parser(input, options);
16606
+ const result2 = defaultValue;
16607
+ if (effectIsExit(result2) && result2._tag === "Success") {
16608
+ const local = parser(result2[args], options);
16609
+ return local === sameExit ? result2 : local;
16610
+ }
16611
+ return flatMapEager2(wrapEncoding(ast, input, options, result2), (value3) => {
16612
+ const local = parser(value3, options);
16613
+ return local === sameExit ? succeed6(value3) : local;
16614
+ });
16615
+ };
16616
+ }
16617
+ function compileField(ast, compile2) {
16618
+ const parser = compile2(ast);
16619
+ return ast.context?.constructorDefault === void 0 ? parser : withDefault2(ast, parser);
16620
+ }
16621
+ function compile(ast, compile2, compileField2, base, specialize) {
16622
+ if (ast._tag === "Declaration") {
16623
+ for (const parameter of ast.typeParameters) compile2(parameter);
16624
+ }
16625
+ const descriptor2 = compileField2 ? getConstructorDescriptor(ast) : void 0;
16626
+ const parser = descriptor2 ? makeConstructorParser(descriptor2, compile2) : base ?? ast.getParser(compile2, compileField2);
16627
+ const checks = ast.checks;
16628
+ const links = ast.encoding;
16629
+ const transformations = links?.map((link3) => compileTransformation(link3.transformation));
16630
+ const encodingChecks = ast.encodingChecks;
16631
+ if (!links && !checks && !encodingChecks) {
16632
+ return parser;
16633
+ }
16634
+ let encodingParsers;
16635
+ const parseChecks = (input, options) => {
16636
+ let result2 = parser(input, options);
16637
+ if (encodingChecks && !options.disableChecks) {
16638
+ if (effectIsExit(result2)) {
16639
+ if (result2._tag === "Success") {
16640
+ const output = result2 === sameExit ? input : result2[args];
16641
+ if (input !== missing && output !== missing) {
16642
+ const issues = collectIssues(encodingChecks, input, void 0, ast, options);
16643
+ if (issues) {
16644
+ result2 = fail5(new Composite(ast, issues, input, options));
16645
+ }
16646
+ }
16647
+ }
16648
+ } else {
16649
+ result2 = flatMap4(result2, (value3) => {
16650
+ if (input !== missing && value3 !== missing) {
16651
+ const issues = collectIssues(encodingChecks, input, void 0, ast, options);
16652
+ if (issues) {
16653
+ return fail5(new Composite(ast, issues, input, options));
16654
+ }
16655
+ }
16656
+ return succeed5(value3);
16657
+ });
16658
+ }
16659
+ }
16660
+ if (checks && !options.disableChecks) {
16661
+ if (effectIsExit(result2)) {
16662
+ if (result2._tag === "Success") {
16663
+ const value3 = result2 === sameExit ? input : result2[args];
16664
+ if (value3 === missing) return result2;
16665
+ const issues = collectIssues(checks, value3, void 0, ast, options);
16666
+ if (issues) {
16667
+ result2 = fail5(new Composite(ast, issues, value3, options));
16668
+ }
16669
+ }
16670
+ } else {
16671
+ result2 = flatMap4(result2, (value3) => {
16672
+ if (value3 !== missing) {
16673
+ const issues = collectIssues(checks, value3, void 0, ast, options);
16674
+ if (issues) {
16675
+ return fail5(new Composite(ast, issues, value3, options));
16676
+ }
16677
+ }
16678
+ return succeed5(value3);
16679
+ });
16680
+ }
16681
+ }
16682
+ return result2;
16683
+ };
16684
+ const parseLocal = specialize === void 0 ? parseChecks : specialize(parseChecks);
16685
+ if (!links) {
16686
+ return parseLocal;
16687
+ }
16688
+ return (input, options) => {
16689
+ const parsers = encodingParsers ??= links.map((link3) => compile2(link3.to));
16690
+ let current = input;
16691
+ let result2 = parsers[parsers.length - 1](input, options);
16692
+ for (let i = links.length - 1; i >= 0; i--) {
16693
+ result2 = transformations[i](result2, current, options);
16694
+ if (i !== 0) {
16695
+ const next = parsers[i - 1];
16696
+ if (result2._tag === "Success") {
16697
+ current = result2[args];
16698
+ result2 = next(current, options);
16699
+ } else {
16700
+ result2 = flatMapEager2(result2, (value3) => {
16701
+ const nextResult = next(value3, options);
16702
+ return nextResult === sameExit ? succeed6(value3) : nextResult;
16703
+ });
16704
+ }
16705
+ }
16706
+ }
16707
+ if (result2._tag === "Success") {
16708
+ const value3 = result2[args];
16709
+ const local = parseLocal(value3, options);
16710
+ return local === sameExit ? result2 : local;
16711
+ }
16712
+ result2 = wrapEncoding(ast, input, options, result2);
16713
+ return flatMapEager2(result2, (value3) => {
16714
+ const local = parseLocal(value3, options);
16715
+ return local === sameExit ? succeed6(value3) : local;
16716
+ });
16717
+ };
16718
+ }
16719
+
16720
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/compilerRegistry.js
16721
+ var invalid3 = /* @__PURE__ */ Symbol();
16722
+ var cache = /* @__PURE__ */ new WeakMap();
16723
+ var compiler;
16724
+ var compilerAdaptersEnabled = false;
16725
+ var decodeChild = (ast) => compilerAdaptersEnabled ? lazyParser(resolve2, ast, "parser") : resolve2(ast).parser;
16726
+ var makeChild = (ast) => compilerAdaptersEnabled ? lazyParser(resolve2, ast, "makeEffect") : resolve2(ast).makeEffect;
16727
+ var makeField = (ast) => compileField(ast, makeChild);
16728
+ var InterpretedEntry = class {
16729
+ ast;
16730
+ constructor(ast) {
16731
+ this.ast = ast;
16732
+ }
16733
+ get decodeEffect() {
16734
+ return this.cachedDecodeEffect ??= compile(this.ast, decodeChild);
16735
+ }
16736
+ get parser() {
16737
+ return this.decodeEffect;
16738
+ }
16739
+ get makeEffect() {
16740
+ return this.cachedMakeEffect ??= compile(this.ast, makeChild, makeField);
16741
+ }
16742
+ };
16743
+ var CompilerEntry = class extends InterpretedEntry {
16744
+ compiled;
16745
+ resolve;
16746
+ constructor(ast, compiled, resolve3) {
16747
+ super(ast);
16748
+ this.compiled = compiled;
16749
+ this.resolve = resolve3;
16750
+ }
16751
+ save(key, value3) {
16752
+ Object.defineProperty(this, key, {
16753
+ value: value3
16754
+ });
16755
+ return value3;
16756
+ }
16757
+ operation(key) {
16758
+ const compiled = this.compiled;
16759
+ return typeof compiled === "function" ? compiled(this.ast, this.resolve, key) : compiled?.[key];
16760
+ }
16761
+ get is() {
16762
+ return this.save("is", this.operation("is"));
16763
+ }
16764
+ get decode() {
16765
+ return this.save("decode", this.operation("decode"));
16766
+ }
16767
+ get make() {
16768
+ return this.save("make", this.operation("make"));
16769
+ }
16770
+ get decodeEffect() {
16771
+ return this.save("decodeEffect", this.operation("decodeEffect") ?? compile(this.ast, (ast) => lazyParser(this.resolve, ast, "parser")));
16772
+ }
16773
+ get parser() {
16774
+ const decode2 = this.decode;
16775
+ return decode2 === void 0 ? this.decodeEffect : this.save("parser", withDecode(decode2, () => this.decodeEffect));
16776
+ }
16777
+ get makeEffect() {
16778
+ const makeEffect2 = this.operation("makeEffect");
16779
+ if (makeEffect2 !== void 0) return this.save("makeEffect", makeEffect2);
16780
+ const child = (ast) => lazyParser(this.resolve, ast, "makeEffect");
16781
+ return this.save("makeEffect", compile(this.ast, child, (ast) => compileField(ast, child)));
16782
+ }
16783
+ };
16784
+ function withDecode(fastDecode, decodeEffect3) {
16785
+ let detailed;
16786
+ return (input, options) => {
16787
+ if (input !== missing) {
16788
+ try {
16789
+ const value3 = fastDecode(input, options);
16790
+ if (value3 !== invalid3) return value3 === input ? sameExit : succeed6(value3);
16791
+ } catch (error) {
16792
+ return die3(error);
16793
+ }
16794
+ }
16795
+ return (detailed ??= decodeEffect3())(input, options);
16796
+ };
16797
+ }
16798
+ function lazyParser(resolve3, ast, operation) {
16799
+ const entry = resolve3(ast);
16800
+ if (entry.compiled === void 0 || Object.hasOwn(entry, operation)) {
16801
+ return entry[operation];
16802
+ }
16803
+ let parser;
16804
+ return (input, options) => (parser ??= entry[operation])(input, options);
16805
+ }
16806
+ function resolve2(ast) {
16807
+ const cached2 = cache.get(ast);
16808
+ if (cached2 !== void 0) return cached2;
16809
+ const entry = compiler === void 0 ? new InterpretedEntry(ast) : new CompilerEntry(ast, compiler(ast, resolve2), resolve2);
16810
+ cache.set(ast, entry);
16811
+ return entry;
16812
+ }
16813
+
16814
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaParser.js
16541
16815
  function makeEffect(schema) {
16542
16816
  const ast = schema.ast;
16543
16817
  let parser;
@@ -16561,33 +16835,52 @@ function makeOption(schema) {
16561
16835
  return none2();
16562
16836
  };
16563
16837
  }
16564
- function make15(schema) {
16565
- const parser = makeEffect(schema);
16566
- return (input, options) => {
16567
- const exit3 = runSyncExit2(parser(input, options));
16568
- if (isSuccess3(exit3)) {
16569
- return exit3.value;
16570
- }
16571
- const issue = getSchemaIssueOrThrow(exit3.cause, "Constructor adapter can only throw schema issues");
16572
- throw new Error("Schema validation failed", {
16573
- cause: issue
16574
- });
16575
- };
16838
+ function make14(schema) {
16839
+ return makeConstructorSync(toType(schema.ast));
16576
16840
  }
16577
16841
  function is(schema) {
16578
16842
  return _is(schema.ast);
16579
16843
  }
16580
- function _is(ast) {
16581
- const parser = asExit(run(toType(ast)));
16844
+ function makeIs(ast) {
16845
+ if (!compilerAdaptersEnabled) {
16846
+ const parser2 = asExit(run(ast));
16847
+ return (input) => {
16848
+ const exit3 = parser2(input, defaultParseOptions);
16849
+ if (isSuccess3(exit3)) return true;
16850
+ getSchemaIssueOrThrow(exit3.cause, "Type guard adapter can only return false for schema issues");
16851
+ return false;
16852
+ };
16853
+ }
16854
+ const entry = resolve2(ast);
16855
+ const guard = entry.is;
16856
+ if (guard !== void 0) {
16857
+ return (input) => {
16858
+ try {
16859
+ return guard(input, defaultParseOptions);
16860
+ } catch (error) {
16861
+ getSchemaIssueOrThrow(die2(error), "Type guard adapter can only return false for schema issues");
16862
+ return false;
16863
+ }
16864
+ };
16865
+ }
16866
+ const parser = entry.parser;
16582
16867
  return (input) => {
16583
- const exit3 = parser(input, defaultParseOptions);
16584
- if (isSuccess3(exit3)) {
16585
- return true;
16586
- }
16868
+ const exit3 = runSyncExit2(parserResult(parser(input, defaultParseOptions), input));
16869
+ if (isSuccess3(exit3)) return true;
16587
16870
  getSchemaIssueOrThrow(exit3.cause, "Type guard adapter can only return false for schema issues");
16588
16871
  return false;
16589
16872
  };
16590
16873
  }
16874
+ function _is(ast) {
16875
+ const typeAST = toType(ast);
16876
+ let guard = (input) => {
16877
+ guard = makeIs(typeAST);
16878
+ return guard(input);
16879
+ };
16880
+ return (input) => {
16881
+ return guard(input);
16882
+ };
16883
+ }
16591
16884
  function _issue(ast) {
16592
16885
  const parser = run(ast);
16593
16886
  return (input, options) => {
@@ -16624,7 +16917,7 @@ function decodeUnknownResult(schema, options) {
16624
16917
  return asResult(decodeUnknownEffect(schema, options));
16625
16918
  }
16626
16919
  function decodeUnknownSync(schema, options) {
16627
- return asSync(decodeUnknownEffect(schema, options));
16920
+ return compilerAdaptersEnabled ? makeSync(schema.ast, options) : asSync(decodeUnknownEffect(schema, options));
16628
16921
  }
16629
16922
  var decodeSync = decodeUnknownSync;
16630
16923
  function encodeUnknownEffect(schema, options) {
@@ -16643,7 +16936,7 @@ function encodeUnknownResult(schema, options) {
16643
16936
  return asResult(encodeUnknownEffect(schema, options));
16644
16937
  }
16645
16938
  function encodeUnknownSync(schema, options) {
16646
- return asSync(encodeUnknownEffect(schema, options));
16939
+ return compilerAdaptersEnabled ? makeSync(flip2(schema.ast), options) : asSync(encodeUnknownEffect(schema, options));
16647
16940
  }
16648
16941
  var encodeSync = encodeUnknownSync;
16649
16942
  var mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
@@ -16659,10 +16952,19 @@ var getValue = (value3) => {
16659
16952
  function run(ast) {
16660
16953
  return runWithCompiler(normalCompiler, ast);
16661
16954
  }
16662
- function runWithCompiler(compiler, ast) {
16955
+ function parserResult(result2, input) {
16956
+ if (result2 === sameExit) {
16957
+ return succeed5(input);
16958
+ }
16959
+ if (!effectIsExit(result2)) {
16960
+ return flatMapEager2(result2, getValue);
16961
+ }
16962
+ return result2[args] === missing ? getValue(missing) : result2;
16963
+ }
16964
+ function runWithCompiler(compiler2, ast) {
16663
16965
  let parser;
16664
16966
  return (input, options) => {
16665
- const result2 = (parser ??= compiler(ast))(input, options ?? defaultParseOptions);
16967
+ const result2 = (parser ??= compiler2(ast))(input, options ?? defaultParseOptions);
16666
16968
  if (result2 === sameExit) {
16667
16969
  return succeed5(input);
16668
16970
  }
@@ -16696,6 +16998,32 @@ function asResult(parser) {
16696
16998
  return fail2(getSchemaIssueOrThrow(exit3.cause, "Result adapter can only return schema issues"));
16697
16999
  };
16698
17000
  }
17001
+ function makeSync(ast, options) {
17002
+ let run2;
17003
+ return (input, overrideOptions) => (run2 ??= makeSyncEntry(resolve2(ast), options))(input, overrideOptions);
17004
+ }
17005
+ function makeSyncEntry(entry, options) {
17006
+ const decode2 = entry.decode;
17007
+ let detailed;
17008
+ const run2 = decode2 === void 0 ? (input, parseOptions = defaultParseOptions) => (detailed ??= makeDetailedSync(entry))(input, parseOptions) : (input, parseOptions = defaultParseOptions) => {
17009
+ if (input === missing) {
17010
+ return (detailed ??= makeDetailedSync(entry))(input, parseOptions);
17011
+ }
17012
+ let output;
17013
+ try {
17014
+ output = decode2(input, parseOptions);
17015
+ } catch (error) {
17016
+ getSchemaIssueOrThrow(die2(error), "Sync adapter can only throw schema issues");
17017
+ throw error;
17018
+ }
17019
+ if (output !== invalid3) return output;
17020
+ return (detailed ??= makeDetailedSync(entry))(input, parseOptions);
17021
+ };
17022
+ return options === void 0 ? run2 : (input, overrideOptions) => run2(input, mergeParseOptions(options, overrideOptions));
17023
+ }
17024
+ function makeDetailedSync(entry) {
17025
+ return asSync(runWithCompiler(() => entry.decodeEffect, entry.ast));
17026
+ }
16699
17027
  function asSync(parser) {
16700
17028
  const parserExit = asExit(parser);
16701
17029
  return (input, options) => {
@@ -16709,128 +17037,46 @@ function asSync(parser) {
16709
17037
  });
16710
17038
  };
16711
17039
  }
16712
- var normalCompiler = /* @__PURE__ */ memoize((ast) => makeParser(ast, normalCompiler));
16713
- var constructorCompiler = /* @__PURE__ */ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault));
16714
- var compileDefaulted = /* @__PURE__ */ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault));
16715
- function compileConstructorDefault(ast) {
16716
- return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast);
16717
- }
16718
- function applyTransformation(result2, current, transformation, options) {
16719
- let transformed;
16720
- if (effectIsExit(result2) && result2._tag === "Success") {
16721
- const optional3 = toOption(result2 === sameExit ? current : result2[args]);
16722
- transformed = transformation._tag === "Transformation" ? transformation.decode.run(optional3, options) : transformation.decode(succeed6(optional3), options);
16723
- } else if (transformation._tag === "Transformation") {
16724
- transformed = flatMapEager2(result2, (value3) => transformation.decode.run(toOption(value3), options));
16725
- } else {
16726
- transformed = transformation.decode(mapEager2(result2, toOption), options);
17040
+ function runSync2(effect, message) {
17041
+ const exit3 = runSyncExit2(effect);
17042
+ if (isSuccess3(exit3)) {
17043
+ return exit3.value;
16727
17044
  }
16728
- return effectIsExit(transformed) && transformed._tag === "Success" ? fromOptionExit(transformed[args]) : flatMapEager2(transformed, fromOptionExit);
16729
- }
16730
- function makeConstructorParser(descriptor2, compile) {
16731
- let sourceParser;
16732
- return (input, options) => {
16733
- if (input === missing) return missingExit;
16734
- if (descriptor2.isConstructed(input)) return sameExit;
16735
- const result2 = (sourceParser ??= compile(descriptor2.link.to))(input, options);
16736
- return applyTransformation(result2, input, descriptor2.link.transformation, options);
16737
- };
17045
+ const issue = getSchemaIssueOrThrow(exit3.cause, message);
17046
+ throw new Error("Schema validation failed", {
17047
+ cause: issue
17048
+ });
16738
17049
  }
16739
- function makeParser(ast, compile, compileConstructorDefault2, constructorDefault) {
16740
- const descriptor2 = compileConstructorDefault2 ? getConstructorDescriptor(ast) : void 0;
16741
- const parser = descriptor2 ? makeConstructorParser(descriptor2, compile) : ast.getParser(compile, compileConstructorDefault2);
16742
- const checks = ast.checks;
16743
- const links = constructorDefault ? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault] : ast.encoding;
16744
- const encodingChecks = ast.encodingChecks;
16745
- if (!links && !checks && !encodingChecks) {
16746
- return parser;
16747
- }
16748
- let encodingParsers;
16749
- const parseLocal = (input, options) => {
16750
- let result2 = parser(input, options);
16751
- if (encodingChecks && !options.disableChecks) {
16752
- if (effectIsExit(result2)) {
16753
- if (result2._tag === "Success") {
16754
- const output = result2 === sameExit ? input : result2[args];
16755
- if (input !== missing && output !== missing) {
16756
- const issues = collectIssues(encodingChecks, input, void 0, ast, options);
16757
- if (issues) {
16758
- result2 = fail5(new Composite(ast, issues, input, options));
16759
- }
16760
- }
16761
- }
16762
- } else {
16763
- result2 = flatMap4(result2, (value3) => {
16764
- if (input !== missing && value3 !== missing) {
16765
- const issues = collectIssues(encodingChecks, input, void 0, ast, options);
16766
- if (issues) {
16767
- return fail5(new Composite(ast, issues, input, options));
16768
- }
16769
- }
16770
- return succeed5(value3);
16771
- });
16772
- }
16773
- }
16774
- if (checks && !options.disableChecks) {
16775
- if (effectIsExit(result2)) {
16776
- if (result2._tag === "Success") {
16777
- const value3 = result2 === sameExit ? input : result2[args];
16778
- if (value3 === missing) return result2;
16779
- const issues = collectIssues(checks, value3, void 0, ast, options);
16780
- if (issues) {
16781
- result2 = fail5(new Composite(ast, issues, value3, options));
16782
- }
16783
- }
16784
- } else {
16785
- result2 = flatMap4(result2, (value3) => {
16786
- if (value3 !== missing) {
16787
- const issues = collectIssues(checks, value3, void 0, ast, options);
16788
- if (issues) {
16789
- return fail5(new Composite(ast, issues, value3, options));
16790
- }
16791
- }
16792
- return succeed5(value3);
16793
- });
16794
- }
16795
- }
16796
- return result2;
16797
- };
16798
- if (!links) {
16799
- return parseLocal;
16800
- }
17050
+ function makeConstructorSync(ast) {
17051
+ let entry;
17052
+ let parser;
16801
17053
  return (input, options) => {
16802
- const parsers = encodingParsers ??= links.map((link3) => compile(link3.to));
16803
- let current = input;
16804
- let result2 = parsers[parsers.length - 1](input, options);
16805
- for (let i = links.length - 1; i >= 0; i--) {
16806
- result2 = applyTransformation(result2, current, links[i].transformation, options);
16807
- if (i !== 0) {
16808
- const next = parsers[i - 1];
16809
- if (result2._tag === "Success") {
16810
- current = result2[args];
16811
- result2 = next(current, options);
16812
- } else {
16813
- result2 = flatMapEager2(result2, (value3) => {
16814
- const nextResult = next(value3, options);
16815
- return nextResult === sameExit ? succeed6(value3) : nextResult;
16816
- });
16817
- }
17054
+ entry ??= resolve2(ast);
17055
+ const parseOptions = options?.disableChecks ? options.parseOptions ? {
17056
+ ...options.parseOptions,
17057
+ disableChecks: true
17058
+ } : {
17059
+ disableChecks: true
17060
+ } : options?.parseOptions ?? defaultParseOptions;
17061
+ const make22 = entry.make;
17062
+ if (make22 !== void 0 && input !== missing) {
17063
+ let output;
17064
+ try {
17065
+ output = make22(input, parseOptions);
17066
+ } catch (error) {
17067
+ getSchemaIssueOrThrow(die2(error), "Constructor adapter can only throw schema issues");
17068
+ throw error;
16818
17069
  }
17070
+ if (output !== invalid3 && output !== missing) return output;
16819
17071
  }
16820
- if (result2._tag === "Success") {
16821
- const value3 = result2[args];
16822
- const local = parseLocal(value3, options);
16823
- return local === sameExit ? result2 : local;
16824
- }
16825
- result2 = catchCause2(result2, (cause) => failCauseSync2(() => map6(cause, (issue) => new Encoding(ast, issue, input, options))));
16826
- return flatMapEager2(result2, (value3) => {
16827
- const local = parseLocal(value3, options);
16828
- return local === sameExit ? succeed6(value3) : local;
16829
- });
17072
+ const result2 = (parser ??= entry.makeEffect)(input, parseOptions);
17073
+ return runSync2(parserResult(result2, input), "Constructor adapter can only throw schema issues");
16830
17074
  };
16831
17075
  }
17076
+ var normalCompiler = (ast) => resolve2(ast).parser;
17077
+ var constructorCompiler = (ast) => resolve2(ast).makeEffect;
16832
17078
 
16833
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/make.js
17079
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/make.js
16834
17080
  var TypeId12 = "~effect/Schema/Schema";
16835
17081
  var SchemaProto = {
16836
17082
  [TypeId12]: TypeId12,
@@ -16847,7 +17093,7 @@ var SchemaProto = {
16847
17093
  return this.rebuild(appendChecks(this.ast, checks));
16848
17094
  }
16849
17095
  };
16850
- function make16(ast, options) {
17096
+ function make15(ast, options) {
16851
17097
  function Schema() {
16852
17098
  }
16853
17099
  const self = Object.setPrototypeOf(Schema, SchemaProto);
@@ -16859,14 +17105,14 @@ function make16(ast, options) {
16859
17105
  Object.assign(self, options);
16860
17106
  }
16861
17107
  self.ast = ast;
16862
- self.rebuild = (ast2) => make16(ast2, options);
17108
+ self.rebuild = (ast2) => make15(ast2, options);
16863
17109
  self.makeEffect = makeEffect(self);
16864
- self.make = make15(self);
17110
+ self.make = make14(self);
16865
17111
  self.makeOption = makeOption(self);
16866
17112
  return self;
16867
17113
  }
16868
17114
 
16869
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/JsonPointer.js
17115
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/JsonPointer.js
16870
17116
  function escapeToken(token) {
16871
17117
  return token.replace(/~/g, "~0").replace(/\//g, "~1");
16872
17118
  }
@@ -16896,7 +17142,7 @@ function formatUriFragment(path23) {
16896
17142
  return path23.reduce((fragment, token) => `${fragment}/${formatUriFragmentToken(token)}`, "#");
16897
17143
  }
16898
17144
 
16899
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/JsonSchema.js
17145
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/JsonSchema.js
16900
17146
  var META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema#";
16901
17147
  var META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
16902
17148
  function isMetaSchemaUri(value3, uri) {
@@ -17256,9 +17502,9 @@ function convertLegacyId(source, out, targetKey, dialect) {
17256
17502
  }
17257
17503
  }
17258
17504
 
17259
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toCodec.js
17505
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toCodec.js
17260
17506
  function toCodecJson(schema) {
17261
- return make16(toCodecJsonAST(schema.ast), {
17507
+ return make15(toCodecJsonAST(schema.ast), {
17262
17508
  schema
17263
17509
  });
17264
17510
  }
@@ -17314,7 +17560,7 @@ function toCodecJsonASTStep(ast, recur2) {
17314
17560
  if (!isFunction(getLink)) {
17315
17561
  return replaceEncoding(ast, [unknownToJson]);
17316
17562
  }
17317
- const typeParameters = ast.typeParameters.map((tp) => make16(toEncoded(tp)));
17563
+ const typeParameters = ast.typeParameters.map((tp) => make15(toEncoded(tp)));
17318
17564
  const link3 = getLink(typeParameters);
17319
17565
  return link3 === void 0 ? ast : replaceEncoding(ast, [mapLink(link3, recur2)]);
17320
17566
  }
@@ -17349,7 +17595,7 @@ function toCodecJsonASTStep(ast, recur2) {
17349
17595
  return ast;
17350
17596
  }
17351
17597
  function toCodecIso(schema) {
17352
- return make16(toCodecIsoAST(toType(schema.ast)));
17598
+ return make15(toCodecIsoAST(toType(schema.ast)));
17353
17599
  }
17354
17600
  var toCodecIsoAST = /* @__PURE__ */ memoize((ast) => {
17355
17601
  const out = toCodecIsoASTStep(ast, toCodecIsoAST);
@@ -17360,7 +17606,7 @@ function toCodecIsoASTStep(ast, recur2) {
17360
17606
  case "Declaration": {
17361
17607
  const getLink = ast.annotations?.toCodecIso ?? ast.annotations?.toCodec;
17362
17608
  if (isFunction(getLink)) {
17363
- const link3 = getLink(ast.typeParameters.map((tp) => make16(tp)));
17609
+ const link3 = getLink(ast.typeParameters.map((tp) => make15(tp)));
17364
17610
  return replaceEncoding(ast, [mapLink(link3, recur2)]);
17365
17611
  }
17366
17612
  return ast;
@@ -17374,12 +17620,12 @@ function toCodecIsoASTStep(ast, recur2) {
17374
17620
  return ast;
17375
17621
  }
17376
17622
  function toCodecStringTree(schema) {
17377
- return make16(toCodecStringTreeAST(schema.ast), {
17623
+ return make15(toCodecStringTreeAST(schema.ast), {
17378
17624
  schema
17379
17625
  });
17380
17626
  }
17381
17627
  function toCodecArrayFromSingle(schema) {
17382
- return make16(toCodecArrayFromSingleAST(schema.ast));
17628
+ return make15(toCodecArrayFromSingleAST(schema.ast));
17383
17629
  }
17384
17630
  var toStringTreeReorder = /* @__PURE__ */ makeReorder((ast) => {
17385
17631
  switch (ast._tag) {
@@ -17397,7 +17643,7 @@ var toStringTreeReorder = /* @__PURE__ */ makeReorder((ast) => {
17397
17643
  function toCodecStringTreeASTStep(ast, recur2, onMissingAnnotation) {
17398
17644
  switch (ast._tag) {
17399
17645
  case "Declaration": {
17400
- const typeParameters = ast.typeParameters.map((tp) => make16(recur2(toEncoded(tp))));
17646
+ const typeParameters = ast.typeParameters.map((tp) => make15(recur2(toEncoded(tp))));
17401
17647
  const getStringTreeLink = ast.annotations?.toCodecStringTree;
17402
17648
  if (isFunction(getStringTreeLink)) {
17403
17649
  const link4 = getStringTreeLink(typeParameters);
@@ -17475,11 +17721,11 @@ function toCodecArrayFromSingleASTStep(ast) {
17475
17721
  return ast._tag === "Declaration" || ast._tag === "Arrays" || ast._tag === "Objects" || ast._tag === "Union" || ast._tag === "Suspend" ? ast.recur(toCodecArrayFromSingleAST) : ast;
17476
17722
  }
17477
17723
 
17478
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/RegExp.js
17724
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/RegExp.js
17479
17725
  var RegExp2 = globalThis.RegExp;
17480
17726
  var escape = (string3) => string3.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
17481
17727
 
17482
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/errors.js
17728
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/errors.js
17483
17729
  function errorWithPath(message, path23) {
17484
17730
  if (path23.length > 0) {
17485
17731
  message += `
@@ -17488,7 +17734,7 @@ function errorWithPath(message, path23) {
17488
17734
  return new Error(message);
17489
17735
  }
17490
17736
 
17491
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
17737
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
17492
17738
  function formatDefinitionReference(key) {
17493
17739
  return `#/$defs/${formatUriFragmentToken(key)}`;
17494
17740
  }
@@ -18073,7 +18319,7 @@ function toJsonSchemaDocument(document, options) {
18073
18319
  };
18074
18320
  }
18075
18321
 
18076
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toRepresentation.js
18322
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toRepresentation.js
18077
18323
  var defaultReferencePolicy = ({
18078
18324
  identifier: identifier2
18079
18325
  }) => identifier2;
@@ -18390,7 +18636,7 @@ function toRepresentations(asts, options) {
18390
18636
  }
18391
18637
  }
18392
18638
 
18393
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/standardSchema.js
18639
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/standardSchema.js
18394
18640
  function makeStandardResult(exit3) {
18395
18641
  return isSuccess3(exit3) ? exit3.value : {
18396
18642
  issues: [{
@@ -18420,9 +18666,9 @@ function toStandardSchemaV1(self, options) {
18420
18666
  if (exit3) {
18421
18667
  return makeStandardResult(exit3);
18422
18668
  }
18423
- return new Promise((resolve2) => {
18669
+ return new Promise((resolve3) => {
18424
18670
  fiber2.addObserver((exit4) => {
18425
- resolve2(makeStandardResult(exit4));
18671
+ resolve3(makeStandardResult(exit4));
18426
18672
  });
18427
18673
  });
18428
18674
  };
@@ -18490,7 +18736,7 @@ function toStandardJSONSchemaV1(self) {
18490
18736
  });
18491
18737
  }
18492
18738
 
18493
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/JsonPatch.js
18739
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/JsonPatch.js
18494
18740
  function get3(oldValue, newValue) {
18495
18741
  const patches = [];
18496
18742
  getLoop(oldValue, newValue, "", patches);
@@ -18671,7 +18917,7 @@ function rebuildFromStack(stack, newParent) {
18671
18917
  return acc;
18672
18918
  }
18673
18919
 
18674
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toDifferJsonPatch.js
18920
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toDifferJsonPatch.js
18675
18921
  function toDifferJsonPatch(schema) {
18676
18922
  const serializer = toCodecJson(schema);
18677
18923
  const get5 = encodeSync(serializer);
@@ -18688,7 +18934,7 @@ function toDifferJsonPatch(schema) {
18688
18934
  };
18689
18935
  }
18690
18936
 
18691
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toEncoderXml.js
18937
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toEncoderXml.js
18692
18938
  function toEncoderXml(codec, options) {
18693
18939
  const rootName = resolveIdentifier(codec.ast) ?? resolveTitle(codec.ast);
18694
18940
  const serialize = encodeEffect(toCodecStringTree(codec));
@@ -18787,7 +19033,7 @@ var xml = {
18787
19033
  }
18788
19034
  };
18789
19035
 
18790
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toEquivalence.js
19036
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toEquivalence.js
18791
19037
  var toEquivalence = /* @__PURE__ */ memoize((ast) => {
18792
19038
  return recur(ast, []);
18793
19039
  });
@@ -18970,7 +19216,7 @@ function causeEquivalence(error, defect) {
18970
19216
  return (a, b) => reasons(a.reasons, b.reasons);
18971
19217
  }
18972
19218
 
18973
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toFormatter.js
19219
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toFormatter.js
18974
19220
  function causeReasonToFormatter(error, defect) {
18975
19221
  return (reason) => {
18976
19222
  switch (reason._tag) {
@@ -19175,7 +19421,7 @@ function toFormatter(ast, options) {
19175
19421
  }
19176
19422
  }
19177
19423
 
19178
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Struct.js
19424
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Struct.js
19179
19425
  var Struct_exports = {};
19180
19426
  __export(Struct_exports, {
19181
19427
  Record: () => Record,
@@ -19281,12 +19527,12 @@ function Record(keys4, value3) {
19281
19527
  return out;
19282
19528
  }
19283
19529
 
19284
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Optic.js
19530
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Optic.js
19285
19531
  function makeIso(get5, set3) {
19286
- return make17(primitiveNode("Iso", get5, set3));
19532
+ return make16(primitiveNode("Iso", get5, set3));
19287
19533
  }
19288
19534
  function makeLens(get5, replace) {
19289
- return make17(primitiveNode("Lens", get5, replace));
19535
+ return make16(primitiveNode("Lens", get5, replace));
19290
19536
  }
19291
19537
  function primitiveNode(kind, get5, set3) {
19292
19538
  return [{
@@ -19341,7 +19587,7 @@ var CheckNode = class {
19341
19587
  this.get = (s) => runChecks(checks, s);
19342
19588
  }
19343
19589
  };
19344
- function compose(a, b) {
19590
+ function compose2(a, b) {
19345
19591
  if (a.length === 0) return b;
19346
19592
  if (b.length === 0) return a;
19347
19593
  const nodes = a.slice();
@@ -19359,7 +19605,7 @@ function compose(a, b) {
19359
19605
  return nodes;
19360
19606
  }
19361
19607
  function makeOptional(getResult, set3) {
19362
- return make17(primitiveNode("Optional", getResult, set3));
19608
+ return make16(primitiveNode("Optional", getResult, set3));
19363
19609
  }
19364
19610
  var OptionalImpl = class {
19365
19611
  /** @internal */
@@ -19378,13 +19624,13 @@ var OptionalImpl = class {
19378
19624
  return (s) => getOrElse2(flatMap2(this.getResult(s), (a) => this.replaceResult(f(a), s)), () => s);
19379
19625
  }
19380
19626
  compose(that) {
19381
- return make17(compose(this.node, that.node));
19627
+ return make16(compose2(this.node, that.node));
19382
19628
  }
19383
19629
  key(key) {
19384
- return make17(compose(this.node, [new PathNode([key])]));
19630
+ return make16(compose2(this.node, [new PathNode([key])]));
19385
19631
  }
19386
19632
  optionalKey(key) {
19387
- return make17(compose(this.node, primitiveNode("Lens", (s) => s[key], (a, s) => {
19633
+ return make16(compose2(this.node, primitiveNode("Lens", (s) => s[key], (a, s) => {
19388
19634
  const copy2 = cloneShallow(s);
19389
19635
  if (a === void 0) {
19390
19636
  if (Array.isArray(copy2) && (typeof key === "number" || typeof key === "string" && isCanonicalArrayIndex(key))) {
@@ -19399,20 +19645,20 @@ var OptionalImpl = class {
19399
19645
  })));
19400
19646
  }
19401
19647
  check(...checks) {
19402
- return make17(compose(this.node, [new CheckNode(checks)]));
19648
+ return make16(compose2(this.node, [new CheckNode(checks)]));
19403
19649
  }
19404
19650
  refine(refinement, annotations) {
19405
- return make17(compose(this.node, [new CheckNode([makeFilterByGuard(refinement, annotations)])]));
19651
+ return make16(compose2(this.node, [new CheckNode([makeFilterByGuard(refinement, annotations)])]));
19406
19652
  }
19407
19653
  tag(tag2) {
19408
19654
  const err = fail2(new InvalidValue({
19409
19655
  expected: `${JSON.stringify(tag2)} tag`
19410
19656
  }));
19411
- return make17(compose(this.node, primitiveNode("Prism", (s) => s._tag === tag2 ? succeed2(s) : err, identity)));
19657
+ return make16(compose2(this.node, primitiveNode("Prism", (s) => s._tag === tag2 ? succeed2(s) : err, identity)));
19412
19658
  }
19413
19659
  at(key, ..._rest) {
19414
19660
  const err = fail2(new Pointer([key], new MissingKey(void 0)));
19415
- return make17(compose(this.node, primitiveNode("Optional", (s) => Object.hasOwn(s, key) ? succeed2(s[key]) : err, (a, s) => {
19661
+ return make16(compose2(this.node, primitiveNode("Optional", (s) => Object.hasOwn(s, key) ? succeed2(s[key]) : err, (a, s) => {
19416
19662
  if (Object.hasOwn(s, key)) {
19417
19663
  const copy2 = cloneShallow(s);
19418
19664
  assignProperty(copy2, key, a);
@@ -19518,7 +19764,7 @@ var PrismImpl = class extends OptionalImpl {
19518
19764
  return (s) => getOrElse2(map2(this.getResult(s), (a) => this.set(f(a))), () => s);
19519
19765
  }
19520
19766
  };
19521
- function make17(node) {
19767
+ function make16(node) {
19522
19768
  let op = node[0] ?? identityOperation;
19523
19769
  if (node.length > 1) {
19524
19770
  const kind = node.reduce((kind2, step) => composeKind(kind2, step.kind), "Iso");
@@ -19622,12 +19868,12 @@ function composeKind(a, b) {
19622
19868
  if (b === "Iso" || a === b) return a;
19623
19869
  return "Optional";
19624
19870
  }
19625
- var identityIso = /* @__PURE__ */ make17([]);
19871
+ var identityIso = /* @__PURE__ */ make16([]);
19626
19872
  function id() {
19627
19873
  return identityIso;
19628
19874
  }
19629
19875
 
19630
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toIso.js
19876
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/toIso.js
19631
19877
  function toIso(schema) {
19632
19878
  const serializer = toCodecIso(schema);
19633
19879
  return makeIso(encodeSync(serializer), decodeSync(serializer));
@@ -19639,13 +19885,13 @@ function toIsoFocus(_) {
19639
19885
  return id();
19640
19886
  }
19641
19887
 
19642
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schemaError.js
19888
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schemaError.js
19643
19889
  var SchemaErrorTypeId = "~effect/Schema/SchemaError";
19644
19890
  function isSchemaError(u) {
19645
19891
  return hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;
19646
19892
  }
19647
19893
 
19648
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/redacted.js
19894
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/internal/redacted.js
19649
19895
  var redactedRegistry = /* @__PURE__ */ new WeakMap();
19650
19896
  var value = (self) => {
19651
19897
  if (redactedRegistry.has(self)) {
@@ -19655,10 +19901,10 @@ var value = (self) => {
19655
19901
  }
19656
19902
  };
19657
19903
 
19658
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Redacted.js
19904
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Redacted.js
19659
19905
  var TypeId13 = "~effect/Redacted";
19660
19906
  var isRedacted = (u) => hasProperty(u, TypeId13);
19661
- var make18 = (value3, options) => {
19907
+ var make17 = (value3, options) => {
19662
19908
  const self = Object.create(Proto3);
19663
19909
  if (options?.label) {
19664
19910
  self.label = options.label;
@@ -19688,7 +19934,7 @@ var Proto3 = {
19688
19934
  var value2 = value;
19689
19935
  var makeEquivalence6 = (isEquivalent) => make2((x, y) => isEquivalent(value2(x), value2(y)));
19690
19936
 
19691
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/Cookies.js
19937
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/http/Cookies.js
19692
19938
  var TypeId14 = "~effect/http/Cookies";
19693
19939
  var isCookies = (u) => hasProperty(u, TypeId14);
19694
19940
  var CookieTypeId = "~effect/http/Cookies/Cookie";
@@ -20009,7 +20255,7 @@ var tryDecodeURIComponent = (str) => {
20009
20255
  }
20010
20256
  };
20011
20257
 
20012
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/Headers.js
20258
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/http/Headers.js
20013
20259
  var TypeId15 = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
20014
20260
  var isHeaders = (u) => hasProperty(u, TypeId15);
20015
20261
  var Proto5 = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.create(null), {
@@ -20073,12 +20319,12 @@ var redact2 = /* @__PURE__ */ dual(2, (self, key) => {
20073
20319
  if (typeof key2 === "string") {
20074
20320
  const k = key2.toLowerCase();
20075
20321
  if (k in self) {
20076
- out[k] = make18(self[k]);
20322
+ out[k] = make17(self[k]);
20077
20323
  }
20078
20324
  } else {
20079
20325
  for (const name in self) {
20080
20326
  if (name.search(key2) !== -1) {
20081
- out[name] = make18(self[name]);
20327
+ out[name] = make17(self[name]);
20082
20328
  }
20083
20329
  }
20084
20330
  }
@@ -20096,7 +20342,7 @@ var CurrentRedactedNames = /* @__PURE__ */ Reference("effect/Headers/CurrentReda
20096
20342
  defaultValue: () => ["authorization", "cookie", "set-cookie", "x-api-key"]
20097
20343
  });
20098
20344
 
20099
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/UrlParams.js
20345
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/http/UrlParams.js
20100
20346
  var TypeId16 = "~effect/http/UrlParams";
20101
20347
  var isUrlParams = (u) => hasProperty(u, TypeId16);
20102
20348
  var Proto6 = {
@@ -20118,7 +20364,7 @@ var Proto6 = {
20118
20364
  return array(this.params.flat());
20119
20365
  }
20120
20366
  };
20121
- var make19 = (params) => {
20367
+ var make18 = (params) => {
20122
20368
  const self = Object.create(Proto6);
20123
20369
  self.params = params;
20124
20370
  return self;
@@ -20137,7 +20383,7 @@ var fromInput4 = (input) => {
20137
20383
  out.push(parsed[i]);
20138
20384
  }
20139
20385
  }
20140
- return make19(out);
20386
+ return make18(out);
20141
20387
  };
20142
20388
  var fromInputNested = (input) => {
20143
20389
  const entries3 = typeof input[Symbol.iterator] === "function" ? fromIterable(input) : Object.entries(input);
@@ -20181,7 +20427,7 @@ var toRecord2 = (self) => {
20181
20427
  };
20182
20428
  var toReadonlyRecord = toRecord2;
20183
20429
 
20184
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/net/NetAddress.js
20430
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/net/NetAddress.js
20185
20431
  var TypeId17 = "~effect/net/NetAddress";
20186
20432
  var getBytes = (self) => self.bytes;
20187
20433
  var NetAddressError = class extends (/* @__PURE__ */ TaggedError2("NetAddressError")) {
@@ -20353,9 +20599,9 @@ var parseIpv6Segments = (input) => {
20353
20599
  if (halves.length === 1 ? explicit !== 8 : explicit >= 8) {
20354
20600
  return addressError(input, halves.length === 1 ? "expected eight segments" : "compression must replace at least one segment");
20355
20601
  }
20356
- const parse4 = (part) => /^[0-9a-fA-F]{1,4}$/.test(part) ? Number.parseInt(part, 16) : void 0;
20357
- const parsedHead = head2.map(parse4);
20358
- const parsedTail = tail.map(parse4);
20602
+ const parse3 = (part) => /^[0-9a-fA-F]{1,4}$/.test(part) ? Number.parseInt(part, 16) : void 0;
20603
+ const parsedHead = head2.map(parse3);
20604
+ const parsedTail = tail.map(parse3);
20359
20605
  if (parsedHead.some((part) => part === void 0) || parsedTail.some((part) => part === void 0)) {
20360
20606
  return addressError(input, "segments must contain one through four hexadecimal digits");
20361
20607
  }
@@ -20382,6 +20628,11 @@ var ipv6ToSegments = (self) => {
20382
20628
  };
20383
20629
  var ipv6ToOctets = (self) => Array.from(getBytes(self));
20384
20630
  var formatMacAddress = (self) => Array.from(getBytes(self), (byte) => byte.toString(16).padStart(2, "0")).join(":");
20631
+ var isMacBroadcast = (self) => getBytes(self).every((byte) => byte === 255);
20632
+ var isMacMulticast = (self) => (getBytes(self)[0] & 1) !== 0;
20633
+ var isMacUnicast = (self) => (getBytes(self)[0] & 1) === 0;
20634
+ var isMacLocallyAdministered = (self) => (getBytes(self)[0] & 2) !== 0;
20635
+ var isMacUniversallyAdministered = (self) => (getBytes(self)[0] & 2) === 0;
20385
20636
  var formatIp = (self) => {
20386
20637
  if (isIpv4Address(self)) return ipv4ToOctets(self).join(".");
20387
20638
  const segments = ipv6ToSegments(self);
@@ -20407,6 +20658,38 @@ var formatIp = (self) => {
20407
20658
  const tail = segments.slice(bestStart + bestLength).map((segment) => segment.toString(16)).join(":");
20408
20659
  return `${head2}::${tail}`;
20409
20660
  };
20661
+ var isUnspecified = (self) => getBytes(self).every((byte) => byte === 0);
20662
+ var isLoopback = (self) => {
20663
+ if (isIpv4Address(self)) return getBytes(self)[0] === 127;
20664
+ const bytes2 = getBytes(self);
20665
+ for (let index2 = 0; index2 < 15; index2++) {
20666
+ if (bytes2[index2] !== 0) return false;
20667
+ }
20668
+ return bytes2[15] === 1;
20669
+ };
20670
+ var isMulticast = (self) => {
20671
+ if (isMacAddress(self)) return isMacMulticast(self);
20672
+ if (isIpv4Address(self)) return getBytes(self)[0] >> 4 === 14;
20673
+ return getBytes(self)[0] === 255;
20674
+ };
20675
+ var isBroadcast = (self) => isMacAddress(self) ? isMacBroadcast(self) : getBytes(self).every((byte) => byte === 255);
20676
+ var isUnicast = (self) => {
20677
+ if (isMacAddress(self)) return isMacUnicast(self);
20678
+ return !isMulticast(self) && !isUnspecified(self) && (!isIpv4Address(self) || !isBroadcast(self));
20679
+ };
20680
+ var isLinkLocal = (self) => {
20681
+ if (isIpv4Address(self)) {
20682
+ const bytes3 = getBytes(self);
20683
+ return bytes3[0] === 169 && bytes3[1] === 254;
20684
+ }
20685
+ const bytes2 = getBytes(self);
20686
+ return bytes2[0] === 254 && (bytes2[1] & 192) === 128;
20687
+ };
20688
+ var isPrivate = (self) => {
20689
+ const bytes2 = getBytes(self);
20690
+ return bytes2[0] === 10 || bytes2[0] === 172 && (bytes2[1] & 240) === 16 || bytes2[0] === 192 && bytes2[1] === 168;
20691
+ };
20692
+ var isUniqueLocal = (self) => (getBytes(self)[0] & 254) === 252;
20410
20693
  var isIpv4Mapped = (self) => {
20411
20694
  const bytes2 = getBytes(self);
20412
20695
  for (let index2 = 0; index2 < 10; index2++) {
@@ -20523,10 +20806,10 @@ var inetAddressFromString = (input) => {
20523
20806
  }) : inetAddressV4(address, Number(portText));
20524
20807
  });
20525
20808
  };
20809
+ var formatHost = (self) => formatIp(self.address) + (isInetAddressV6(self) && self.scopeId !== 0 ? `%${self.scopeId}` : "");
20526
20810
  var formatInet = (self) => {
20527
- if (self._tag === "InetAddressV4") return `${formatIp(self.address)}:${self.port}`;
20528
- const scope2 = self.scopeId === 0 ? "" : `%${self.scopeId}`;
20529
- return `[${formatIp(self.address)}${scope2}]:${self.port}`;
20811
+ const host = formatHost(self);
20812
+ return isInetAddressV4(self) ? `${host}:${self.port}` : `[${host}]:${self.port}`;
20530
20813
  };
20531
20814
  var UnixPathProto = {
20532
20815
  _tag: "UnixPathAddress",
@@ -20553,7 +20836,7 @@ var unixPathAddress = (path23) => {
20553
20836
  return Object.freeze(self);
20554
20837
  };
20555
20838
 
20556
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/net/IpInterface.js
20839
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/net/IpInterface.js
20557
20840
  var TypeId18 = "~effect/net/IpInterface";
20558
20841
  var isIpv4Interface = (u) => isIpInterface(u) && isIpv4Address(u.address);
20559
20842
  var isIpv6Interface = (u) => isIpInterface(u) && isIpv6Address(u.address);
@@ -20581,7 +20864,7 @@ var interfaceError = (input, message) => fail2(new NetAddressError({
20581
20864
  input,
20582
20865
  message
20583
20866
  }));
20584
- var make20 = (address, prefixLength) => {
20867
+ var make19 = (address, prefixLength) => {
20585
20868
  const max4 = width(address);
20586
20869
  if (!Number.isInteger(prefixLength) || prefixLength < 0 || prefixLength > max4) {
20587
20870
  return interfaceError(address, `prefix length must be an integer from 0 through ${max4}`);
@@ -20612,12 +20895,12 @@ var parseAddressWithPrefix = (input, options) => {
20612
20895
  prefixLength: Number(prefix)
20613
20896
  });
20614
20897
  };
20615
- var ipv4FromString2 = (input, options) => flatMap2(parseAddressWithPrefix(input, options), (parts) => flatMap2(ipv4FromString(parts.address), (address) => make20(address, parts.prefixLength ?? width(address))));
20616
- var ipv6FromString2 = (input, options) => flatMap2(parseAddressWithPrefix(input, options), (parts) => flatMap2(ipv6FromString(parts.address), (address) => make20(address, parts.prefixLength ?? width(address))));
20617
- var fromString2 = (input, options) => flatMap2(parseAddressWithPrefix(input, options), (parts) => flatMap2(ipFromString(parts.address), (address) => make20(address, parts.prefixLength ?? width(address))));
20898
+ var ipv4FromString2 = (input, options) => flatMap2(parseAddressWithPrefix(input, options), (parts) => flatMap2(ipv4FromString(parts.address), (address) => make19(address, parts.prefixLength ?? width(address))));
20899
+ var ipv6FromString2 = (input, options) => flatMap2(parseAddressWithPrefix(input, options), (parts) => flatMap2(ipv6FromString(parts.address), (address) => make19(address, parts.prefixLength ?? width(address))));
20900
+ var fromString3 = (input, options) => flatMap2(parseAddressWithPrefix(input, options), (parts) => flatMap2(ipFromString(parts.address), (address) => make19(address, parts.prefixLength ?? width(address))));
20618
20901
  var format4 = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
20619
20902
 
20620
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/net/IpNetwork.js
20903
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/net/IpNetwork.js
20621
20904
  var TypeId19 = "~effect/net/IpNetwork";
20622
20905
  var isIpv4Network = (u) => isIpNetwork(u) && isIpv4Address(u.address);
20623
20906
  var isIpv6Network = (u) => isIpNetwork(u) && isIpv6Address(u.address);
@@ -20658,8 +20941,8 @@ var maskBytes = (bytes2, prefixLength) => {
20658
20941
  return 0;
20659
20942
  });
20660
20943
  };
20661
- var make21 = (address, prefixLength) => {
20662
- return flatMap2(make20(address, prefixLength), (value3) => {
20944
+ var make20 = (address, prefixLength) => {
20945
+ return flatMap2(make19(address, prefixLength), (value3) => {
20663
20946
  const bytes2 = toBytes(address);
20664
20947
  const masked = maskBytes(bytes2, prefixLength);
20665
20948
  if (bytes2.some((byte, index2) => byte !== masked[index2])) {
@@ -20674,25 +20957,25 @@ var make21 = (address, prefixLength) => {
20674
20957
  var ipv4FromString3 = (input) => {
20675
20958
  return flatMap2(ipv4FromString2(input, {
20676
20959
  prefix: "required"
20677
- }), (value3) => make21(value3.address, value3.prefixLength));
20960
+ }), (value3) => make20(value3.address, value3.prefixLength));
20678
20961
  };
20679
20962
  var ipv6FromString3 = (input) => {
20680
20963
  return flatMap2(ipv6FromString2(input, {
20681
20964
  prefix: "required"
20682
- }), (value3) => make21(value3.address, value3.prefixLength));
20965
+ }), (value3) => make20(value3.address, value3.prefixLength));
20683
20966
  };
20684
- var fromString3 = (input) => {
20685
- return flatMap2(fromString2(input, {
20967
+ var fromString4 = (input) => {
20968
+ return flatMap2(fromString3(input, {
20686
20969
  prefix: "required"
20687
- }), (value3) => make21(value3.address, value3.prefixLength));
20970
+ }), (value3) => make20(value3.address, value3.prefixLength));
20688
20971
  };
20689
20972
  var format5 = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
20690
20973
 
20691
- // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js
20974
+ // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/Schema.js
20692
20975
  var TypeId20 = TypeId12;
20693
20976
  function declareConstructor() {
20694
20977
  return (typeParameters, run2, annotations) => {
20695
- return make22(new Declaration(typeParameters.map(getAST), (typeParameters2) => run2(typeParameters2.map((ast) => make22(ast))), annotations));
20978
+ return make21(new Declaration(typeParameters.map(getAST), (typeParameters2) => run2(typeParameters2.map((ast) => make21(ast))), annotations));
20696
20979
  };
20697
20980
  }
20698
20981
  function declare(is3, annotations) {
@@ -20861,29 +21144,29 @@ function encodeUnknownSync2(schema, options) {
20861
21144
  };
20862
21145
  }
20863
21146
  var encodeSync2 = encodeUnknownSync2;
20864
- var make22 = make16;
21147
+ var make21 = make15;
20865
21148
  function isSchema(u) {
20866
21149
  return hasProperty(u, TypeId20) && u[TypeId20] === TypeId20;
20867
21150
  }
20868
- var optionalKey2 = /* @__PURE__ */ lambda((schema) => make22(optionalKey(schema.ast), {
21151
+ var optionalKey2 = /* @__PURE__ */ lambda((schema) => make21(optionalKey(schema.ast), {
20869
21152
  schema
20870
21153
  }));
20871
21154
  var requiredKey = /* @__PURE__ */ lambda((self) => self.schema);
20872
21155
  var optional2 = /* @__PURE__ */ lambda((self) => {
20873
21156
  const schema = UndefinedOr(self);
20874
- return make22(optional(self.ast), {
21157
+ return make21(optional(self.ast), {
20875
21158
  schema
20876
21159
  });
20877
21160
  });
20878
21161
  var required = /* @__PURE__ */ lambda((self) => self.schema.members[0]);
20879
- var mutableKey2 = /* @__PURE__ */ lambda((schema) => make22(mutableKey(schema.ast), {
21162
+ var mutableKey2 = /* @__PURE__ */ lambda((schema) => make21(mutableKey(schema.ast), {
20880
21163
  schema
20881
21164
  }));
20882
21165
  var readonlyKey = /* @__PURE__ */ lambda((self) => self.schema);
20883
- var toType2 = /* @__PURE__ */ lambda((schema) => make22(toType(schema.ast), {
21166
+ var toType2 = /* @__PURE__ */ lambda((schema) => make21(toType(schema.ast), {
20884
21167
  schema
20885
21168
  }));
20886
- var toEncoded2 = /* @__PURE__ */ lambda((schema) => make22(toEncoded(schema.ast), {
21169
+ var toEncoded2 = /* @__PURE__ */ lambda((schema) => make21(toEncoded(schema.ast), {
20887
21170
  schema
20888
21171
  }));
20889
21172
  var FlipTypeId = "~effect/Schema/flip";
@@ -20894,13 +21177,13 @@ function flip3(schema) {
20894
21177
  if (isFlip$(schema)) {
20895
21178
  return schema.schema.rebuild(flip2(schema.ast));
20896
21179
  }
20897
- return make22(flip2(schema.ast), {
21180
+ return make21(flip2(schema.ast), {
20898
21181
  [FlipTypeId]: FlipTypeId,
20899
21182
  schema
20900
21183
  });
20901
21184
  }
20902
21185
  function Literal2(literal) {
20903
- const out = make22(new Literal(literal), {
21186
+ const out = make21(new Literal(literal), {
20904
21187
  literal,
20905
21188
  transform(to) {
20906
21189
  return out.pipe(decodeTo2(Literal2(to), {
@@ -20915,37 +21198,37 @@ function templateLiteralParts(parts) {
20915
21198
  return parts.map((part) => isSchema(part) ? part.ast : new Literal(part));
20916
21199
  }
20917
21200
  function TemplateLiteral2(parts) {
20918
- return make22(new TemplateLiteral(templateLiteralParts(parts)), {
21201
+ return make21(new TemplateLiteral(templateLiteralParts(parts)), {
20919
21202
  parts
20920
21203
  });
20921
21204
  }
20922
21205
  function TemplateLiteralParser(parts) {
20923
- return make22(templateLiteralParser(templateLiteralParts(parts)), {
21206
+ return make21(templateLiteralParser(templateLiteralParts(parts)), {
20924
21207
  parts
20925
21208
  });
20926
21209
  }
20927
21210
  function Enum2(enums) {
20928
- return make22(new Enum(Object.keys(enums).filter((key) => typeof enums[enums[key]] !== "number").map((key) => [key, enums[key]])), {
21211
+ return make21(new Enum(Object.keys(enums).filter((key) => typeof enums[enums[key]] !== "number").map((key) => [key, enums[key]])), {
20929
21212
  enums
20930
21213
  });
20931
21214
  }
20932
- var Never2 = /* @__PURE__ */ make22(never2);
20933
- var Any2 = /* @__PURE__ */ make22(any);
20934
- var Unknown2 = /* @__PURE__ */ make22(unknown);
20935
- var Null2 = /* @__PURE__ */ make22(null_);
20936
- var Undefined2 = /* @__PURE__ */ make22(undefined_2);
20937
- var String5 = /* @__PURE__ */ make22(string2);
20938
- var Number6 = /* @__PURE__ */ make22(number2);
20939
- var Boolean3 = /* @__PURE__ */ make22(boolean);
20940
- var Symbol3 = /* @__PURE__ */ make22(symbol3);
20941
- var BigInt6 = /* @__PURE__ */ make22(bigInt);
20942
- var Void2 = /* @__PURE__ */ make22(void_4);
20943
- var ObjectKeyword2 = /* @__PURE__ */ make22(objectKeyword);
21215
+ var Never2 = /* @__PURE__ */ make21(never2);
21216
+ var Any2 = /* @__PURE__ */ make21(any);
21217
+ var Unknown2 = /* @__PURE__ */ make21(unknown);
21218
+ var Null2 = /* @__PURE__ */ make21(null_);
21219
+ var Undefined2 = /* @__PURE__ */ make21(undefined_2);
21220
+ var String5 = /* @__PURE__ */ make21(string2);
21221
+ var Number6 = /* @__PURE__ */ make21(number2);
21222
+ var Boolean3 = /* @__PURE__ */ make21(boolean);
21223
+ var Symbol3 = /* @__PURE__ */ make21(symbol3);
21224
+ var BigInt6 = /* @__PURE__ */ make21(bigInt);
21225
+ var Void2 = /* @__PURE__ */ make21(void_4);
21226
+ var ObjectKeyword2 = /* @__PURE__ */ make21(objectKeyword);
20944
21227
  function UniqueSymbol2(symbol4) {
20945
- return make22(new UniqueSymbol(symbol4));
21228
+ return make21(new UniqueSymbol(symbol4));
20946
21229
  }
20947
21230
  function makeStruct(ast, fields) {
20948
- return make22(ast, {
21231
+ return make21(ast, {
20949
21232
  fields,
20950
21233
  mapFields(f, options) {
20951
21234
  const fields2 = f(this.fields);
@@ -21021,19 +21304,19 @@ function extendTo(fields, derive) {
21021
21304
  };
21022
21305
  }
21023
21306
  function Record2(key, value3) {
21024
- return make22(record(key.ast, value3.ast), {
21307
+ return make21(record(key.ast, value3.ast), {
21025
21308
  key,
21026
21309
  value: value3
21027
21310
  });
21028
21311
  }
21029
21312
  function StructWithRest(schema, records) {
21030
- return make22(structWithRest(schema.ast, records.map(getAST)), {
21313
+ return make21(structWithRest(schema.ast, records.map(getAST)), {
21031
21314
  schema,
21032
21315
  records
21033
21316
  });
21034
21317
  }
21035
21318
  function makeTuple(ast, elements) {
21036
- return make22(ast, {
21319
+ return make21(ast, {
21037
21320
  elements,
21038
21321
  mapElements(f, options) {
21039
21322
  const elements2 = f(this.elements);
@@ -21045,12 +21328,12 @@ function Tuple2(elements) {
21045
21328
  return makeTuple(tuple(elements), elements);
21046
21329
  }
21047
21330
  function TupleWithRest(schema, rest) {
21048
- return make22(tupleWithRest(schema.ast, rest.map(getAST)), {
21331
+ return make21(tupleWithRest(schema.ast, rest.map(getAST)), {
21049
21332
  schema,
21050
21333
  rest
21051
21334
  });
21052
21335
  }
21053
- var ArraySchema = /* @__PURE__ */ lambda((schema) => make22(new Arrays(false, [], [schema.ast]), {
21336
+ var ArraySchema = /* @__PURE__ */ lambda((schema) => make21(new Arrays(false, [], [schema.ast]), {
21054
21337
  value: schema
21055
21338
  }));
21056
21339
  function withArrayLengthConstraints(self, minimum, maximum) {
@@ -21061,7 +21344,7 @@ function withArrayLengthConstraints(self, minimum, maximum) {
21061
21344
  if (maximum !== void 0) return self.check(isMaxLength(maximum));
21062
21345
  return self;
21063
21346
  }
21064
- var NonEmptyArray = /* @__PURE__ */ lambda((schema) => make22(new Arrays(false, [schema.ast], [schema.ast]), {
21347
+ var NonEmptyArray = /* @__PURE__ */ lambda((schema) => make21(new Arrays(false, [schema.ast], [schema.ast]), {
21065
21348
  value: schema
21066
21349
  }));
21067
21350
  function ArrayEnsure(schema) {
@@ -21071,7 +21354,7 @@ function ArrayEnsure(schema) {
21071
21354
  decode: (value3) => [value3],
21072
21355
  encode: ([value3]) => value3
21073
21356
  }))(schema);
21074
- return make22(Union2([one, many]).pipe(decodeTo2(to)).ast, {
21357
+ return make21(Union2([one, many]).pipe(decodeTo2(to)).ast, {
21075
21358
  from: Union2([schema, many]),
21076
21359
  to
21077
21360
  });
@@ -21079,11 +21362,11 @@ function ArrayEnsure(schema) {
21079
21362
  function UniqueArray(item) {
21080
21363
  return ArraySchema(item).check(isUnique());
21081
21364
  }
21082
- var mutable2 = /* @__PURE__ */ lambda((schema) => make22(mutable(schema.ast), {
21365
+ var mutable2 = /* @__PURE__ */ lambda((schema) => make21(mutable(schema.ast), {
21083
21366
  schema
21084
21367
  }));
21085
21368
  function makeUnion(ast, members) {
21086
- return make22(ast, {
21369
+ return make21(ast, {
21087
21370
  members,
21088
21371
  mapMembers(f, options) {
21089
21372
  const members2 = f(this.members);
@@ -21096,7 +21379,7 @@ function Union2(members, options) {
21096
21379
  }
21097
21380
  function Literals(literals) {
21098
21381
  const members = literals.map(Literal2);
21099
- return make22(union(members, void 0, void 0), {
21382
+ return make21(union(members, void 0, void 0), {
21100
21383
  literals,
21101
21384
  members,
21102
21385
  mapMembers(f) {
@@ -21114,18 +21397,18 @@ var NullOr = /* @__PURE__ */ lambda((self) => Union2([self, Null2]));
21114
21397
  var UndefinedOr = /* @__PURE__ */ lambda((self) => Union2([self, Undefined2]));
21115
21398
  var NullishOr = /* @__PURE__ */ lambda((self) => Union2([self, Null2, Undefined2]));
21116
21399
  function suspend2(f) {
21117
- return make22(new Suspend(() => f().ast));
21400
+ return make21(new Suspend(() => f().ast));
21118
21401
  }
21119
21402
  function check(...checks) {
21120
21403
  return (self) => self.check(...checks);
21121
21404
  }
21122
21405
  function refine(refinement, annotations) {
21123
- return (schema) => make22(appendChecks(schema.ast, [makeFilterByGuard(refinement, annotations)]), {
21406
+ return (schema) => make21(appendChecks(schema.ast, [makeFilterByGuard(refinement, annotations)]), {
21124
21407
  schema
21125
21408
  });
21126
21409
  }
21127
21410
  function brand2(identifier2) {
21128
- return (schema) => make22(brand(schema.ast, identifier2), {
21411
+ return (schema) => make21(brand(schema.ast, identifier2), {
21129
21412
  schema,
21130
21413
  identifier: identifier2
21131
21414
  });
@@ -21136,12 +21419,12 @@ function fromBrand(identifier2, ctor) {
21136
21419
  };
21137
21420
  }
21138
21421
  function middlewareDecoding2(decode2) {
21139
- return (schema) => make22(middlewareDecoding(schema.ast, new Middleware(decode2, identity)), {
21422
+ return (schema) => make21(middlewareDecoding(schema.ast, new Middleware(decode2, identity)), {
21140
21423
  schema
21141
21424
  });
21142
21425
  }
21143
21426
  function middlewareEncoding2(encode2) {
21144
- return (schema) => make22(middlewareEncoding(schema.ast, new Middleware(identity, encode2)), {
21427
+ return (schema) => make21(middlewareEncoding(schema.ast, new Middleware(identity, encode2)), {
21145
21428
  schema
21146
21429
  });
21147
21430
  }
@@ -21159,7 +21442,7 @@ function catchEncodingWithContext(f) {
21159
21442
  }
21160
21443
  function decodeTo2(to, transformation) {
21161
21444
  return (from) => {
21162
- return make22(decodeTo(from.ast, to.ast, transformation ? make11(transformation) : passthrough2()), {
21445
+ return make21(decodeTo(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough2()), {
21163
21446
  from,
21164
21447
  to
21165
21448
  });
@@ -21193,7 +21476,7 @@ function encode(transformation) {
21193
21476
  };
21194
21477
  }
21195
21478
  function withConstructorDefault2(defaultValue) {
21196
- return (schema) => make22(withConstructorDefault(schema.ast, defaultValue), {
21479
+ return (schema) => make21(withConstructorDefault(schema.ast, defaultValue), {
21197
21480
  schema
21198
21481
  });
21199
21482
  }
@@ -21329,7 +21612,7 @@ function TaggedUnion(casesByTag) {
21329
21612
  match: match7,
21330
21613
  matchOrElse
21331
21614
  } = toTaggedUnion("_tag")(union5);
21332
- return make22(union5.ast, {
21615
+ return make21(union5.ast, {
21333
21616
  cases,
21334
21617
  isAnyOf,
21335
21618
  guards,
@@ -21345,7 +21628,7 @@ function instanceOf(constructor, annotations) {
21345
21628
  }
21346
21629
  function link() {
21347
21630
  return (encodeTo2, transformation) => {
21348
- return new Link(encodeTo2.ast, make11(transformation));
21631
+ return new Link(encodeTo2.ast, makeTransformation(transformation));
21349
21632
  };
21350
21633
  }
21351
21634
  var makeFilter2 = makeFilter;
@@ -21678,7 +21961,7 @@ function isUncapitalized(annotations) {
21678
21961
  ...annotations
21679
21962
  });
21680
21963
  }
21681
- var Finite = /* @__PURE__ */ make22(finite);
21964
+ var Finite = /* @__PURE__ */ make21(finite);
21682
21965
  var isFinite3 = isFinite2;
21683
21966
  function makeIsGreaterThan(options) {
21684
21967
  const gt = isGreaterThan(options.order);
@@ -22543,7 +22826,7 @@ function ReadonlyMap(key, value3) {
22543
22826
  encode: (map11) => [...map11.entries()]
22544
22827
  }))
22545
22828
  });
22546
- return make22(schema.ast, {
22829
+ return make21(schema.ast, {
22547
22830
  key,
22548
22831
  value: value3
22549
22832
  });
@@ -22577,7 +22860,7 @@ function ReadonlySet(value3) {
22577
22860
  encode: (set3) => [...set3.values()]
22578
22861
  }))
22579
22862
  });
22580
- return make22(schema.ast, {
22863
+ return make21(schema.ast, {
22581
22864
  value: value3
22582
22865
  });
22583
22866
  }
@@ -22762,7 +23045,7 @@ var NumberFromString = /* @__PURE__ */ String5.annotate({
22762
23045
  var FiniteFromString = /* @__PURE__ */ String5.annotate({
22763
23046
  expected: "a string that will be decoded as a finite number"
22764
23047
  }).pipe(/* @__PURE__ */ decodeTo2(Finite, numberFromString));
22765
- var BigIntFromString = /* @__PURE__ */ make22(bigIntString).pipe(/* @__PURE__ */ decodeTo2(BigInt6, bigintFromString));
23048
+ var BigIntFromString = /* @__PURE__ */ make21(bigIntString).pipe(/* @__PURE__ */ decodeTo2(BigInt6, bigintFromString));
22766
23049
  var Trimmed = /* @__PURE__ */ String5.check(/* @__PURE__ */ isTrimmed());
22767
23050
  var Trim = /* @__PURE__ */ String5.annotate({
22768
23051
  expected: "a string that will be decoded as a trimmed string"
@@ -22854,48 +23137,6 @@ var isBetweenBigDecimal = /* @__PURE__ */ makeIsBetween({
22854
23137
  var BigDecimalString = /* @__PURE__ */ String5.annotate({
22855
23138
  expected: "a string that will be decoded as a BigDecimal"
22856
23139
  });
22857
- var arbitraryBigDecimalMaxScale = 20;
22858
- function bigIntArbitrarySchema(minimum, maximum) {
22859
- if (minimum !== void 0 && maximum !== void 0) {
22860
- return BigInt6.check(isBetweenBigInt({
22861
- minimum,
22862
- maximum
22863
- }));
22864
- }
22865
- if (minimum !== void 0) return BigInt6.check(isGreaterThanOrEqualToBigInt(minimum));
22866
- if (maximum !== void 0) return BigInt6.check(isLessThanOrEqualToBigInt(maximum));
22867
- return BigInt6;
22868
- }
22869
- function bigDecimalValueAtScale(value3, scale) {
22870
- return value3.value * globalThis.BigInt(10) ** globalThis.BigInt(scale - value3.scale);
22871
- }
22872
- function bigDecimalArbitrarySchema(constraint) {
22873
- if (constraint?.minimum === void 0 && constraint?.maximum === void 0) {
22874
- return Struct3({
22875
- value: BigInt6,
22876
- scale: Int.check(isBetween2({
22877
- minimum: 0,
22878
- maximum: arbitraryBigDecimalMaxScale
22879
- }))
22880
- });
22881
- }
22882
- const scale = Math.max(arbitraryBigDecimalMaxScale, constraint.minimum?.scale ?? 0, constraint.maximum?.scale ?? 0, constraint.exclusiveMinimum === true && constraint.minimum !== void 0 ? constraint.minimum.scale + 1 : 0, constraint.exclusiveMaximum === true && constraint.maximum !== void 0 ? constraint.maximum.scale + 1 : 0);
22883
- const minimum = constraint.minimum === void 0 ? void 0 : bigDecimalValueAtScale(constraint.minimum, scale) + (constraint.exclusiveMinimum === true ? globalThis.BigInt(1) : globalThis.BigInt(0));
22884
- const maximum = constraint.maximum === void 0 ? void 0 : bigDecimalValueAtScale(constraint.maximum, scale) - (constraint.exclusiveMaximum === true ? globalThis.BigInt(1) : globalThis.BigInt(0));
22885
- if (minimum !== void 0 && maximum !== void 0 && minimum > maximum) {
22886
- return Struct3({
22887
- value: BigInt6,
22888
- scale: Int.check(isBetween2({
22889
- minimum: 0,
22890
- maximum: arbitraryBigDecimalMaxScale
22891
- }))
22892
- });
22893
- }
22894
- return Struct3({
22895
- value: bigIntArbitrarySchema(minimum, maximum),
22896
- scale: Literal2(scale)
22897
- });
22898
- }
22899
23140
  var BigDecimal = /* @__PURE__ */ declare(isBigDecimal, {
22900
23141
  representation: {
22901
23142
  id: "effect/schema/BigDecimal",
@@ -22907,12 +23148,6 @@ var BigDecimal = /* @__PURE__ */ declare(isBigDecimal, {
22907
23148
  importDeclarations: [`import * as BigDecimal from "effect/BigDecimal"`]
22908
23149
  }),
22909
23150
  expected: "BigDecimal",
22910
- toCodecArbitrary: ({
22911
- constraint
22912
- }) => linkDecoding()(bigDecimalArbitrarySchema(constraint), transform(({
22913
- scale,
22914
- value: value3
22915
- }) => make5(value3, scale))),
22916
23151
  toCodecJson: () => link()(BigDecimalString, bigDecimalFromString),
22917
23152
  toFormatter: () => (bd) => format2(bd)
22918
23153
  });
@@ -22992,10 +23227,28 @@ function CauseReason(error, defect) {
22992
23227
  return makeInterruptReason2(e.fiberId);
22993
23228
  }
22994
23229
  },
22995
- encode: identity
23230
+ encode: (reason) => {
23231
+ switch (reason._tag) {
23232
+ case "Fail":
23233
+ return {
23234
+ _tag: "Fail",
23235
+ error: reason.error
23236
+ };
23237
+ case "Die":
23238
+ return {
23239
+ _tag: "Die",
23240
+ defect: reason.defect
23241
+ };
23242
+ case "Interrupt":
23243
+ return {
23244
+ _tag: "Interrupt",
23245
+ fiberId: reason.fiberId
23246
+ };
23247
+ }
23248
+ }
22996
23249
  }))
22997
23250
  });
22998
- return make22(schema.ast, {
23251
+ return make21(schema.ast, {
22999
23252
  error,
23000
23253
  defect
23001
23254
  });
@@ -23032,7 +23285,7 @@ function Cause(error, defect) {
23032
23285
  }) => failures
23033
23286
  }))
23034
23287
  });
23035
- return make22(schema.ast, {
23288
+ return make21(schema.ast, {
23036
23289
  error,
23037
23290
  defect
23038
23291
  });
@@ -23074,7 +23327,7 @@ function Chunk(value3) {
23074
23327
  }) => chunkLink(withArrayLengthConstraints(ArraySchema(value4), constraint?.minLength, constraint?.maxLength)),
23075
23328
  toEquivalence: ([value4]) => makeEquivalence4(value4)
23076
23329
  });
23077
- return make22(schema.ast, {
23330
+ return make21(schema.ast, {
23078
23331
  value: value3
23079
23332
  });
23080
23333
  }
@@ -23273,9 +23526,9 @@ var DateTimeZoned = /* @__PURE__ */ declare((u) => isDateTime2(u) && isZoned2(u)
23273
23526
  toEquivalence: () => Equivalence4
23274
23527
  });
23275
23528
  var DateTimeZonedFromString = /* @__PURE__ */ DateTimeZonedString.pipe(/* @__PURE__ */ decodeTo2(DateTimeZoned, dateTimeZonedFromString));
23276
- var netAddressFromString = (declaration, parse4, encode2, identifier2) => String5.pipe(decodeTo2(declaration, transformEffect2({
23529
+ var netAddressFromString = (declaration, parse3, encode2, identifier2) => String5.pipe(decodeTo2(declaration, transformEffect2({
23277
23530
  decode: (input, options) => {
23278
- const result2 = parse4(input);
23531
+ const result2 = parse3(input);
23279
23532
  return isSuccess2(result2) ? succeed5(result2.success) : fail5(new InvalidValue({
23280
23533
  message: result2.failure.message
23281
23534
  }, input, options));
@@ -23300,6 +23553,37 @@ var IpAddress = /* @__PURE__ */ declare(isIpAddress, {
23300
23553
  identifier: "IpAddress"
23301
23554
  });
23302
23555
  var IpAddressFromString = /* @__PURE__ */ netAddressFromString(IpAddress, ipFromString, formatIp, "IpAddressFromString");
23556
+ var netAddressRefinement = (schema, guard, expected, identifier2) => refine(guard, {
23557
+ expected
23558
+ })(schema).annotate({
23559
+ identifier: identifier2
23560
+ });
23561
+ var IpMulticastAddress = /* @__PURE__ */ netAddressRefinement(IpAddress, isMulticast, "a multicast address", "IpMulticastAddress");
23562
+ var IpMulticastAddressFromString = /* @__PURE__ */ netAddressRefinement(IpAddressFromString, isMulticast, "a multicast address", "IpMulticastAddressFromString");
23563
+ var MacMulticastAddress = /* @__PURE__ */ netAddressRefinement(MacAddress, isMulticast, "a multicast address", "MacMulticastAddress");
23564
+ var MacMulticastAddressFromString = /* @__PURE__ */ netAddressRefinement(MacAddressFromString, isMulticast, "a multicast address", "MacMulticastAddressFromString");
23565
+ var IpUnicastAddress = /* @__PURE__ */ netAddressRefinement(IpAddress, isUnicast, "a unicast address", "IpUnicastAddress");
23566
+ var IpUnicastAddressFromString = /* @__PURE__ */ netAddressRefinement(IpAddressFromString, isUnicast, "a unicast address", "IpUnicastAddressFromString");
23567
+ var MacUnicastAddress = /* @__PURE__ */ netAddressRefinement(MacAddress, isMacUnicast, "a unicast address", "MacUnicastAddress");
23568
+ var MacUnicastAddressFromString = /* @__PURE__ */ netAddressRefinement(MacAddressFromString, isMacUnicast, "a unicast address", "MacUnicastAddressFromString");
23569
+ var Ipv4BroadcastAddress = /* @__PURE__ */ netAddressRefinement(Ipv4Address, isBroadcast, "a broadcast address", "Ipv4BroadcastAddress");
23570
+ var Ipv4BroadcastAddressFromString = /* @__PURE__ */ netAddressRefinement(Ipv4AddressFromString, isBroadcast, "a broadcast address", "Ipv4BroadcastAddressFromString");
23571
+ var MacBroadcastAddress = /* @__PURE__ */ netAddressRefinement(MacAddress, isMacBroadcast, "a broadcast address", "MacBroadcastAddress");
23572
+ var MacBroadcastAddressFromString = /* @__PURE__ */ netAddressRefinement(MacAddressFromString, isMacBroadcast, "a broadcast address", "MacBroadcastAddressFromString");
23573
+ var IpLoopbackAddress = /* @__PURE__ */ netAddressRefinement(IpAddress, isLoopback, "a loopback address", "IpLoopbackAddress");
23574
+ var IpLoopbackAddressFromString = /* @__PURE__ */ netAddressRefinement(IpAddressFromString, isLoopback, "a loopback address", "IpLoopbackAddressFromString");
23575
+ var IpLinkLocalAddress = /* @__PURE__ */ netAddressRefinement(IpAddress, isLinkLocal, "a link-local address", "IpLinkLocalAddress");
23576
+ var IpLinkLocalAddressFromString = /* @__PURE__ */ netAddressRefinement(IpAddressFromString, isLinkLocal, "a link-local address", "IpLinkLocalAddressFromString");
23577
+ var IpUnspecifiedAddress = /* @__PURE__ */ netAddressRefinement(IpAddress, isUnspecified, "an unspecified address", "IpUnspecifiedAddress");
23578
+ var IpUnspecifiedAddressFromString = /* @__PURE__ */ netAddressRefinement(IpAddressFromString, isUnspecified, "an unspecified address", "IpUnspecifiedAddressFromString");
23579
+ var Ipv4PrivateAddress = /* @__PURE__ */ netAddressRefinement(Ipv4Address, isPrivate, "a private address", "Ipv4PrivateAddress");
23580
+ var Ipv4PrivateAddressFromString = /* @__PURE__ */ netAddressRefinement(Ipv4AddressFromString, isPrivate, "a private address", "Ipv4PrivateAddressFromString");
23581
+ var Ipv6UniqueLocalAddress = /* @__PURE__ */ netAddressRefinement(Ipv6Address, isUniqueLocal, "a unique-local address", "Ipv6UniqueLocalAddress");
23582
+ var Ipv6UniqueLocalAddressFromString = /* @__PURE__ */ netAddressRefinement(Ipv6AddressFromString, isUniqueLocal, "a unique-local address", "Ipv6UniqueLocalAddressFromString");
23583
+ var MacLocallyAdministeredAddress = /* @__PURE__ */ netAddressRefinement(MacAddress, isMacLocallyAdministered, "a locally administered address", "MacLocallyAdministeredAddress");
23584
+ var MacLocallyAdministeredAddressFromString = /* @__PURE__ */ netAddressRefinement(MacAddressFromString, isMacLocallyAdministered, "a locally administered address", "MacLocallyAdministeredAddressFromString");
23585
+ var MacUniversallyAdministeredAddress = /* @__PURE__ */ netAddressRefinement(MacAddress, isMacUniversallyAdministered, "a universally administered address", "MacUniversallyAdministeredAddress");
23586
+ var MacUniversallyAdministeredAddressFromString = /* @__PURE__ */ netAddressRefinement(MacAddressFromString, isMacUniversallyAdministered, "a universally administered address", "MacUniversallyAdministeredAddressFromString");
23303
23587
  var Ipv4Interface = /* @__PURE__ */ declare(isIpv4Interface, {
23304
23588
  identifier: "Ipv4Interface"
23305
23589
  });
@@ -23311,7 +23595,7 @@ var Ipv6InterfaceFromString = /* @__PURE__ */ netAddressFromString(Ipv6Interface
23311
23595
  var IpInterface = /* @__PURE__ */ declare(isIpInterface, {
23312
23596
  identifier: "IpInterface"
23313
23597
  });
23314
- var IpInterfaceFromString = /* @__PURE__ */ netAddressFromString(IpInterface, fromString2, format4, "IpInterfaceFromString");
23598
+ var IpInterfaceFromString = /* @__PURE__ */ netAddressFromString(IpInterface, fromString3, format4, "IpInterfaceFromString");
23315
23599
  var Ipv4Network = /* @__PURE__ */ declare(isIpv4Network, {
23316
23600
  identifier: "Ipv4Network"
23317
23601
  });
@@ -23323,7 +23607,7 @@ var Ipv6NetworkFromString = /* @__PURE__ */ netAddressFromString(Ipv6Network, ip
23323
23607
  var IpNetwork = /* @__PURE__ */ declare(isIpNetwork, {
23324
23608
  identifier: "IpNetwork"
23325
23609
  });
23326
- var IpNetworkFromString = /* @__PURE__ */ netAddressFromString(IpNetwork, fromString3, format5, "IpNetworkFromString");
23610
+ var IpNetworkFromString = /* @__PURE__ */ netAddressFromString(IpNetwork, fromString4, format5, "IpNetworkFromString");
23327
23611
  var InetAddressV4 = /* @__PURE__ */ declare(isInetAddressV4, {
23328
23612
  identifier: "InetAddressV4"
23329
23613
  });
@@ -23482,7 +23766,7 @@ function Exit(value3, error, defect) {
23482
23766
  }
23483
23767
  }))
23484
23768
  });
23485
- return make22(schema.ast, {
23769
+ return make21(schema.ast, {
23486
23770
  value: value3,
23487
23771
  error,
23488
23772
  defect
@@ -23620,7 +23904,7 @@ function Graph(type, node, edge) {
23620
23904
  }) => graphToArbitrary(type, node2, edge2),
23621
23905
  toEquivalence: ([node2, edge2]) => graphToEquivalence(node2, edge2)
23622
23906
  });
23623
- return make22(schema.ast, {
23907
+ return make21(schema.ast, {
23624
23908
  type,
23625
23909
  node,
23626
23910
  edge
@@ -23664,7 +23948,7 @@ function HashMap(key, value3) {
23664
23948
  }) => hashMapLink(withArrayLengthConstraints(ArraySchema(Tuple2([key2, value4])).check(isUniqueKey()), constraint?.minSize, constraint?.maxSize)),
23665
23949
  toEquivalence: ([key2, value4]) => makeCompareMap(key2, value4)
23666
23950
  });
23667
- return make22(schema.ast, {
23951
+ return make21(schema.ast, {
23668
23952
  key,
23669
23953
  value: value3
23670
23954
  });
@@ -23706,7 +23990,7 @@ function HashSet(value3) {
23706
23990
  }) => hashSetLink(withArrayLengthConstraints(ArraySchema(value4).check(isUnique()), constraint?.minSize, constraint?.maxSize)),
23707
23991
  toEquivalence: ([value4]) => makeCompareSet(value4)
23708
23992
  });
23709
- return make22(schema.ast, {
23993
+ return make21(schema.ast, {
23710
23994
  value: value3
23711
23995
  });
23712
23996
  }
@@ -23750,7 +24034,7 @@ function Option(value3) {
23750
24034
  }
23751
24035
  }))
23752
24036
  });
23753
- return make22(schema.ast, {
24037
+ return make21(schema.ast, {
23754
24038
  value: value3
23755
24039
  });
23756
24040
  }
@@ -23831,7 +24115,7 @@ var UrlParams = /* @__PURE__ */ declare(isUrlParams, {
23831
24115
  expected: "UrlParams",
23832
24116
  toEquivalence: () => Equivalence7,
23833
24117
  toCodec: () => link()(ArraySchema(Tuple2([String5, String5])), transform2({
23834
- decode: make19,
24118
+ decode: make18,
23835
24119
  encode: (self) => self.params
23836
24120
  }))
23837
24121
  });
@@ -23840,7 +24124,7 @@ var JsonFromUrlParamsField = (field, options) => UrlParams.pipe(decodeTo2(fromJs
23840
24124
  onNone: () => fail5(new Pointer([field], new MissingKey(void 0))),
23841
24125
  onSome: succeed5
23842
24126
  }),
23843
- encode: (value3) => succeed5(make19([[field, value3]]))
24127
+ encode: (value3) => succeed5(make18([[field, value3]]))
23844
24128
  })));
23845
24129
  var RecordFromUrlParams = /* @__PURE__ */ UrlParams.pipe(/* @__PURE__ */ decodeTo2(/* @__PURE__ */ Record2(String5, /* @__PURE__ */ Union2([String5, /* @__PURE__ */ NonEmptyArray(String5)])), /* @__PURE__ */ transform2({
23846
24130
  decode: toReadonlyRecord,
@@ -23876,7 +24160,9 @@ function Redacted(value3, options) {
23876
24160
  if (isRedacted(input)) {
23877
24161
  const label2 = decodeLabel !== void 0 ? mapErrorEager2(decodeLabel(input.label, poptions), (issue) => new Pointer(["label"], issue)) : void_3;
23878
24162
  return flatMapEager2(label2, () => mapBothEager2(decodeUnknownEffect(value4)(value2(input), poptions), {
23879
- onSuccess: () => input,
24163
+ onSuccess: (value5) => make17(value5, {
24164
+ label: input.label
24165
+ }),
23880
24166
  onFailure: () => {
23881
24167
  return new Composite(ast, [new Pointer(["value"], new InvalidValue(void 0, input, poptions))], input, poptions);
23882
24168
  }
@@ -23897,14 +24183,14 @@ function Redacted(value3, options) {
23897
24183
  }),
23898
24184
  expected: "Redacted",
23899
24185
  toCodecJson: ([value4]) => link()(value4, {
23900
- decode: transform((e) => make18(e, {
24186
+ decode: transform((e) => make17(e, {
23901
24187
  label
23902
24188
  })),
23903
24189
  encode: disallowJsonEncode ? forbidden((oe) => "Cannot serialize Redacted" + (isSome2(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform(value2)
23904
24190
  }),
23905
24191
  toEquivalence: ([value4]) => makeEquivalence6(value4)
23906
24192
  });
23907
- return make22(schema.ast, {
24193
+ return make21(schema.ast, {
23908
24194
  value: value3
23909
24195
  });
23910
24196
  }
@@ -23913,7 +24199,7 @@ function RedactedFromValue(value3, options) {
23913
24199
  label: options?.label,
23914
24200
  disallowJsonEncode: options?.disallowEncode
23915
24201
  }), {
23916
- decode: transform((t) => make18(t, {
24202
+ decode: transform((t) => make17(t, {
23917
24203
  label: options?.label
23918
24204
  })),
23919
24205
  encode: options?.disallowEncode ? forbidden((oe) => "Cannot encode Redacted" + (isSome2(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform(value2)
@@ -23966,7 +24252,7 @@ function Result(success, failure) {
23966
24252
  }
23967
24253
  }))
23968
24254
  });
23969
- return make22(schema.ast, {
24255
+ return make21(schema.ast, {
23970
24256
  success,
23971
24257
  failure
23972
24258
  });
@@ -24007,7 +24293,7 @@ function makeClass(Inherited, identifier2, struct2, annotations, proto) {
24007
24293
  return getClassSchema(this).rebuild(ast);
24008
24294
  }
24009
24295
  static make(input, options) {
24010
- return make15(getClassSchema(this))(input ?? {}, options);
24296
+ return make14(getClassSchema(this))(input ?? {}, options);
24011
24297
  }
24012
24298
  static makeOption(input, options) {
24013
24299
  return makeOption(getClassSchema(this))(input ?? {}, options);
@@ -24066,7 +24352,7 @@ function getClassSchemaFactory(from, identifier2, annotations) {
24066
24352
  const ClassTypeId = getClassTypeId(identifier2);
24067
24353
  const isClassValue = (input) => input instanceof self || hasProperty(input, ClassTypeId);
24068
24354
  const transformation = getClassTransformation(self);
24069
- const to = make22(new Declaration([from.ast], () => (input, ast, options) => {
24355
+ const to = make21(new Declaration([from.ast], () => (input, ast, options) => {
24070
24356
  return isClassValue(input) ? succeed5(input) : fail5(new InvalidType(ast, input, options));
24071
24357
  }, {
24072
24358
  identifier: identifier2,
@@ -24166,8 +24452,8 @@ function toIsoFocus2(schema) {
24166
24452
  }
24167
24453
  function overrideToCodecIso(to, transformation) {
24168
24454
  return (schema) => {
24169
- return make22(annotate(schema.ast, {
24170
- toCodecIso: () => new Link(to.ast, make11(transformation))
24455
+ return make21(annotate(schema.ast, {
24456
+ toCodecIso: () => new Link(to.ast, makeTransformation(transformation))
24171
24457
  }), {
24172
24458
  schema
24173
24459
  });
@@ -24181,7 +24467,7 @@ function Tree(node) {
24181
24467
  const Tree2 = Union2([node, ArraySchema(Tree$ref), Record2(String5, Tree$ref)]);
24182
24468
  return Tree2;
24183
24469
  }
24184
- var Json2 = /* @__PURE__ */ make22(/* @__PURE__ */ annotate(Json, {
24470
+ var Json2 = /* @__PURE__ */ make21(/* @__PURE__ */ annotate(Json, {
24185
24471
  toCode: () => ({
24186
24472
  runtime: "Schema.Json",
24187
24473
  Type: "Schema.Json"
@@ -24194,7 +24480,7 @@ var JsonError = /* @__PURE__ */ Struct3({
24194
24480
  stack: /* @__PURE__ */ optionalKey2(String5),
24195
24481
  cause: /* @__PURE__ */ optionalKey2(Json2)
24196
24482
  });
24197
- var MutableJson2 = /* @__PURE__ */ make22(/* @__PURE__ */ annotate(MutableJson, {
24483
+ var MutableJson2 = /* @__PURE__ */ make21(/* @__PURE__ */ annotate(MutableJson, {
24198
24484
  toCode: () => ({
24199
24485
  runtime: "Schema.MutableJson",
24200
24486
  Type: "Schema.MutableJson"
@@ -24383,6 +24669,9 @@ var RPC_METHODS = {
24383
24669
  officialCodexSetAutoControl: "officialCodex.setAutoControl",
24384
24670
  telegramBridgeGetStatus: "telegramBridge.getStatus",
24385
24671
  telegramBridgeTestToken: "telegramBridge.testToken",
24672
+ computerUseGetStatus: "computerUse.getStatus",
24673
+ computerUseSetHarness: "computerUse.setHarness",
24674
+ computerUseEnableBrowser: "computerUse.enableBrowser",
24386
24675
  codexConfigGet: "codexConfig.get",
24387
24676
  codexConfigSaveRaw: "codexConfig.saveRaw",
24388
24677
  codexConfigUpdate: "codexConfig.update",
@@ -24654,6 +24943,18 @@ var DesktopRpcRequestBody = Schema_exports.Union([
24654
24943
  RPC_METHODS.telegramBridgeTestToken,
24655
24944
  Schema_exports.Struct({ token: Schema_exports.Union([Schema_exports.String, Schema_exports.Null]) })
24656
24945
  ),
24946
+ tagRequestBody(
24947
+ RPC_METHODS.computerUseGetStatus,
24948
+ Schema_exports.Struct({ probe: Schema_exports.Boolean })
24949
+ ),
24950
+ tagRequestBody(
24951
+ RPC_METHODS.computerUseSetHarness,
24952
+ Schema_exports.Struct({
24953
+ harness: Schema_exports.Union([Schema_exports.Literal("claude"), Schema_exports.Literal("omp")]),
24954
+ enabled: Schema_exports.Boolean
24955
+ })
24956
+ ),
24957
+ tagRequestBody(RPC_METHODS.computerUseEnableBrowser, Schema_exports.Struct({})),
24657
24958
  tagRequestBody(
24658
24959
  RPC_METHODS.codexConfigGet,
24659
24960
  Schema_exports.Struct({
@@ -25305,14 +25606,14 @@ async function stopChildAndWait(child) {
25305
25606
  if (child.exitCode !== null || child.signalCode !== null) {
25306
25607
  return;
25307
25608
  }
25308
- const wait = () => new Promise((resolve2) => {
25609
+ const wait = () => new Promise((resolve3) => {
25309
25610
  let settled = false;
25310
25611
  const finish = (exited2) => {
25311
25612
  if (settled) return;
25312
25613
  settled = true;
25313
25614
  clearTimeout(timer);
25314
25615
  child.off("close", onClose);
25315
- resolve2(exited2);
25616
+ resolve3(exited2);
25316
25617
  };
25317
25618
  const onClose = () => finish(true);
25318
25619
  const timer = setTimeout(() => finish(false), CHILD_EXIT_TIMEOUT_MS);
@@ -25435,10 +25736,10 @@ function createRpcMessageReader(rl) {
25435
25736
  if (closedError) {
25436
25737
  return Promise.reject(closedError);
25437
25738
  }
25438
- return new Promise((resolve2, reject) => {
25739
+ return new Promise((resolve3, reject) => {
25439
25740
  const waiter = {
25440
25741
  predicate: () => true,
25441
- resolve: resolve2,
25742
+ resolve: resolve3,
25442
25743
  reject,
25443
25744
  timer: setTimeout(
25444
25745
  () => {
@@ -25472,10 +25773,10 @@ function createRpcMessageReader(rl) {
25472
25773
  if (closedError) {
25473
25774
  return Promise.reject(closedError);
25474
25775
  }
25475
- return new Promise((resolve2, reject) => {
25776
+ return new Promise((resolve3, reject) => {
25476
25777
  const waiter = {
25477
25778
  predicate,
25478
- resolve: resolve2,
25779
+ resolve: resolve3,
25479
25780
  reject,
25480
25781
  timer: setTimeout(
25481
25782
  () => {
@@ -25642,14 +25943,7 @@ async function writeAtomicPath(filePath, content) {
25642
25943
  }
25643
25944
  try {
25644
25945
  await import_node_fs7.promises.rename(tempPath, filePath);
25645
- if (process.platform !== "win32") {
25646
- const dirHandle = await import_node_fs7.promises.open(dir, "r");
25647
- try {
25648
- await dirHandle.sync();
25649
- } finally {
25650
- await dirHandle.close();
25651
- }
25652
- }
25946
+ await syncDirectory(dir);
25653
25947
  } finally {
25654
25948
  await import_node_fs7.promises.rm(tempPath, { force: true }).catch(() => void 0);
25655
25949
  }
@@ -25728,7 +26022,7 @@ async function hasExternalOpenFileHandle(filePath) {
25728
26022
  return false;
25729
26023
  }
25730
26024
  const lsofCommand = process.platform === "darwin" ? "/usr/sbin/lsof" : "lsof";
25731
- return new Promise((resolve2) => {
26025
+ return new Promise((resolve3) => {
25732
26026
  const child = (0, import_node_child_process5.spawn)(lsofCommand, ["-F", "p", "--", filePath], {
25733
26027
  stdio: ["ignore", "pipe", "ignore"]
25734
26028
  });
@@ -25738,7 +26032,7 @@ async function hasExternalOpenFileHandle(filePath) {
25738
26032
  if (settled) return;
25739
26033
  settled = true;
25740
26034
  clearTimeout(timer);
25741
- resolve2(result2);
26035
+ resolve3(result2);
25742
26036
  };
25743
26037
  const timer = setTimeout(() => {
25744
26038
  child.kill("SIGKILL");
@@ -25875,8 +26169,8 @@ async function acquireCodexAuthFileLock(filePath) {
25875
26169
  const queueKey = import_node_path11.default.resolve(filePath);
25876
26170
  const predecessor = authFileLockQueues.get(queueKey) ?? Promise.resolve();
25877
26171
  let finishTurn;
25878
- const turn = new Promise((resolve2) => {
25879
- finishTurn = resolve2;
26172
+ const turn = new Promise((resolve3) => {
26173
+ finishTurn = resolve3;
25880
26174
  });
25881
26175
  authFileLockQueues.set(queueKey, turn);
25882
26176
  await predecessor;
@@ -25985,7 +26279,7 @@ function isRpcResponseForRequest(message, requestId) {
25985
26279
  return Object.prototype.hasOwnProperty.call(message, "result") || Object.prototype.hasOwnProperty.call(message, "error");
25986
26280
  }
25987
26281
  async function readRpcResponseById(rl, requestId, timeoutMs) {
25988
- return new Promise((resolve2, reject) => {
26282
+ return new Promise((resolve3, reject) => {
25989
26283
  const timer = setTimeout(
25990
26284
  () => {
25991
26285
  cleanup();
@@ -26015,7 +26309,7 @@ async function readRpcResponseById(rl, requestId, timeoutMs) {
26015
26309
  return;
26016
26310
  }
26017
26311
  cleanup();
26018
- resolve2(parsed);
26312
+ resolve3(parsed);
26019
26313
  };
26020
26314
  rl.on("line", onLine);
26021
26315
  rl.on("close", onClose);
@@ -26795,7 +27089,7 @@ async function findOfficialCodexThreadRecord(profileHome, threadId, options = {}
26795
27089
  // ../../packages/runtime-codex/src/codex/sharedHistory.ts
26796
27090
  var import_node_crypto12 = require("crypto");
26797
27091
  var import_node_fs9 = require("fs");
26798
- var import_promises5 = require("fs/promises");
27092
+ var import_promises6 = require("fs/promises");
26799
27093
  var import_node_path13 = __toESM(require("path"), 1);
26800
27094
  var HISTORY_MARKER = ".codexuse-shared-history-v1.json";
26801
27095
  var HISTORY_INDEX = "session_index.jsonl";
@@ -26899,7 +27193,7 @@ var OFFICIAL_CODEX_APP_NAMES = [
26899
27193
  "Codex.app"
26900
27194
  ];
26901
27195
  function sleep3(ms) {
26902
- return new Promise((resolve2) => setTimeout(resolve2, ms));
27196
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
26903
27197
  }
26904
27198
  function logOfficialCodexTakeoverPhase(trace, candidate, phase, context2 = {}) {
26905
27199
  console.warn("[official-codex-takeover]", {
@@ -30502,7 +30796,7 @@ function isBridgeInstallDrift(value3) {
30502
30796
  return reason === "bridge-command-runtime-missing" || reason === "bridge-health-missing" || reason === "bridge-health-degraded" || reason === "bridge-binding-missing";
30503
30797
  }
30504
30798
  async function runCdpCommandSequence(debuggerUrl, commands, timeoutMs = CODEX_CDP_REQUEST_TIMEOUT_MS) {
30505
- return await new Promise((resolve2, reject) => {
30799
+ return await new Promise((resolve3, reject) => {
30506
30800
  const ws = new WebSocket(debuggerUrl);
30507
30801
  const results = [];
30508
30802
  let commandIndex = 0;
@@ -30523,7 +30817,7 @@ async function runCdpCommandSequence(debuggerUrl, commands, timeoutMs = CODEX_CD
30523
30817
  const sendNext = () => {
30524
30818
  currentCommand = commands[commandIndex] ?? null;
30525
30819
  if (!currentCommand) {
30526
- settle(() => resolve2(results));
30820
+ settle(() => resolve3(results));
30527
30821
  return;
30528
30822
  }
30529
30823
  requestId += 1;
@@ -30577,7 +30871,7 @@ async function verifyCdpBindingRoundTrip(debuggerUrl) {
30577
30871
  )});
30578
30872
  return true;
30579
30873
  })()`;
30580
- return await new Promise((resolve2) => {
30874
+ return await new Promise((resolve3) => {
30581
30875
  const ws = new WebSocket(debuggerUrl);
30582
30876
  let settled = false;
30583
30877
  let evaluateSent = false;
@@ -30594,7 +30888,7 @@ async function verifyCdpBindingRoundTrip(debuggerUrl) {
30594
30888
  ws.close();
30595
30889
  } catch {
30596
30890
  }
30597
- resolve2(ok);
30891
+ resolve3(ok);
30598
30892
  };
30599
30893
  const send = (id2, method, params) => {
30600
30894
  ws.send(JSON.stringify({ id: id2, method, params }));
@@ -30956,8 +31250,8 @@ async function startOfficialCodexBridgeActionListenerOnce(args2) {
30956
31250
  bridgeActionListenerProfiles.delete(args2.debuggerUrl);
30957
31251
  const waiters = bridgeActionListenerHealthWaiters.get(args2.debuggerUrl);
30958
31252
  bridgeActionListenerHealthWaiters.delete(args2.debuggerUrl);
30959
- for (const resolve2 of waiters?.values() ?? []) {
30960
- resolve2(false);
31253
+ for (const resolve3 of waiters?.values() ?? []) {
31254
+ resolve3(false);
30961
31255
  }
30962
31256
  bridgeActionListenerSilentCloses.add(existingListener);
30963
31257
  try {
@@ -30971,8 +31265,8 @@ async function startOfficialCodexBridgeActionListenerOnce(args2) {
30971
31265
  return false;
30972
31266
  }
30973
31267
  let resolveReady;
30974
- const ready = new Promise((resolve2) => {
30975
- resolveReady = resolve2;
31268
+ const ready = new Promise((resolve3) => {
31269
+ resolveReady = resolve3;
30976
31270
  });
30977
31271
  bridgeActionListenerReady.set(args2.debuggerUrl, ready);
30978
31272
  let ws;
@@ -31027,8 +31321,8 @@ async function startOfficialCodexBridgeActionListenerOnce(args2) {
31027
31321
  bridgeActionListenerProfiles.delete(args2.debuggerUrl);
31028
31322
  const waiters = bridgeActionListenerHealthWaiters.get(args2.debuggerUrl);
31029
31323
  bridgeActionListenerHealthWaiters.delete(args2.debuggerUrl);
31030
- for (const resolve2 of waiters?.values() ?? []) {
31031
- resolve2(false);
31324
+ for (const resolve3 of waiters?.values() ?? []) {
31325
+ resolve3(false);
31032
31326
  }
31033
31327
  }
31034
31328
  settleReady(false);
@@ -31066,17 +31360,17 @@ async function startOfficialCodexBridgeActionListenerOnce(args2) {
31066
31360
  };
31067
31361
  bridgeActionListenerVerifiers.set(args2.debuggerUrl, async () => {
31068
31362
  const id2 = (0, import_node_crypto13.randomUUID)();
31069
- return await new Promise((resolve2) => {
31363
+ return await new Promise((resolve3) => {
31070
31364
  const waiters = bridgeActionListenerHealthWaiters.get(args2.debuggerUrl) ?? /* @__PURE__ */ new Map();
31071
31365
  bridgeActionListenerHealthWaiters.set(args2.debuggerUrl, waiters);
31072
31366
  const timeout2 = setTimeout(() => {
31073
31367
  waiters.delete(id2);
31074
- resolve2(false);
31368
+ resolve3(false);
31075
31369
  }, CODEX_CDP_REQUEST_TIMEOUT_MS);
31076
31370
  waiters.set(id2, (ok) => {
31077
31371
  clearTimeout(timeout2);
31078
31372
  waiters.delete(id2);
31079
- resolve2(ok);
31373
+ resolve3(ok);
31080
31374
  });
31081
31375
  if (send("Runtime.evaluate", {
31082
31376
  expression: `window[${JSON.stringify(CODEXUSE_BRIDGE_BINDING_NAME)}](${JSON.stringify(
@@ -31086,7 +31380,7 @@ async function startOfficialCodexBridgeActionListenerOnce(args2) {
31086
31380
  }) === null) {
31087
31381
  clearTimeout(timeout2);
31088
31382
  waiters.delete(id2);
31089
- resolve2(false);
31383
+ resolve3(false);
31090
31384
  }
31091
31385
  });
31092
31386
  });
@@ -31555,7 +31849,7 @@ async function waitForBridgeStateAfterLaunch(instance) {
31555
31849
  const deadline = Date.now() + CODEX_BRIDGE_LAUNCH_WAIT_MS;
31556
31850
  let latest = await refreshBridgeStateIfNeeded(instance, true, true, true, true);
31557
31851
  while (latest.bridgeStatus !== "healthy" && Date.now() < deadline) {
31558
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
31852
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
31559
31853
  latest = await refreshBridgeStateIfNeeded(
31560
31854
  {
31561
31855
  ...instance,
@@ -31584,15 +31878,15 @@ async function waitForCdpTargetAfterLaunch(cdpPort) {
31584
31878
  if (Date.now() >= deadline) {
31585
31879
  return null;
31586
31880
  }
31587
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
31881
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
31588
31882
  }
31589
31883
  }
31590
31884
  async function waitForBridgeStateAfterReload(instance) {
31591
31885
  const deadline = Date.now() + CODEX_BRIDGE_LAUNCH_WAIT_MS;
31592
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
31886
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
31593
31887
  let latest = await refreshBridgeStateIfNeeded(instance, true, true, true, true);
31594
31888
  while (latest.bridgeStatus !== "healthy" && Date.now() < deadline) {
31595
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
31889
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
31596
31890
  latest = await refreshBridgeStateIfNeeded(
31597
31891
  {
31598
31892
  ...instance,
@@ -31690,7 +31984,7 @@ async function recordOfficialCodexActivity(input) {
31690
31984
  }
31691
31985
  }
31692
31986
  function runCommand2(command, args2, timeoutMs = COMMAND_TIMEOUT_MS) {
31693
- return new Promise((resolve2) => {
31987
+ return new Promise((resolve3) => {
31694
31988
  const child = (0, import_node_child_process6.spawn)(command, args2, {
31695
31989
  stdio: ["ignore", "pipe", "pipe"]
31696
31990
  });
@@ -31709,7 +32003,7 @@ function runCommand2(command, args2, timeoutMs = COMMAND_TIMEOUT_MS) {
31709
32003
  });
31710
32004
  child.on("error", (error) => {
31711
32005
  clearTimeout(timer);
31712
- resolve2({
32006
+ resolve3({
31713
32007
  code: -1,
31714
32008
  stdout,
31715
32009
  stderr: error instanceof Error ? error.message : String(error),
@@ -31718,7 +32012,7 @@ function runCommand2(command, args2, timeoutMs = COMMAND_TIMEOUT_MS) {
31718
32012
  });
31719
32013
  child.on("close", (code) => {
31720
32014
  clearTimeout(timer);
31721
- resolve2({ code, stdout, stderr, timedOut });
32015
+ resolve3({ code, stdout, stderr, timedOut });
31722
32016
  });
31723
32017
  });
31724
32018
  }
@@ -31975,7 +32269,7 @@ async function waitForNewMainPid(candidate, previousPids, cdpPort, telemetryLabe
31975
32269
  if (matches.length > 1) {
31976
32270
  return null;
31977
32271
  }
31978
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
32272
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
31979
32273
  }
31980
32274
  return null;
31981
32275
  }
@@ -31990,7 +32284,7 @@ async function waitForAppServerPid(mainPid, profileHome) {
31990
32284
  if (pid !== null) {
31991
32285
  return pid;
31992
32286
  }
31993
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
32287
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
31994
32288
  }
31995
32289
  return null;
31996
32290
  }
@@ -32003,7 +32297,7 @@ async function waitForAttestedProcessEpoch(args2) {
32003
32297
  }
32004
32298
  } catch {
32005
32299
  }
32006
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
32300
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
32007
32301
  }
32008
32302
  return false;
32009
32303
  }
@@ -32025,7 +32319,7 @@ async function waitForProcessEpochsExit(expectedRows, timeoutMs) {
32025
32319
  if (remaining.size === 0) {
32026
32320
  return [];
32027
32321
  }
32028
- await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
32322
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
32029
32323
  }
32030
32324
  return Array.from(remaining.values());
32031
32325
  }
@@ -32630,14 +32924,14 @@ async function openCodexWithProfileHome(candidate, profileHome, profileName, pre
32630
32924
  }
32631
32925
  child.unref();
32632
32926
  const spawnError = await new Promise(
32633
- (resolve2) => {
32927
+ (resolve3) => {
32634
32928
  let settled = false;
32635
32929
  const settle = (reason) => {
32636
32930
  if (settled) {
32637
32931
  return;
32638
32932
  }
32639
32933
  settled = true;
32640
- resolve2(reason);
32934
+ resolve3(reason);
32641
32935
  };
32642
32936
  child.once(
32643
32937
  "error",
@@ -32775,10 +33069,14 @@ function officialCodexAppPriority(appPath) {
32775
33069
  const priority = OFFICIAL_CODEX_APP_NAMES.indexOf(import_node_path14.default.basename(appPath));
32776
33070
  return priority >= 0 ? priority : OFFICIAL_CODEX_APP_NAMES.length;
32777
33071
  }
33072
+ function hasBundledCodexCli(appPath) {
33073
+ const resources = import_node_path14.default.join(appPath, "Contents", "Resources");
33074
+ return (0, import_node_fs10.existsSync)(import_node_path14.default.join(resources, "codex")) || (0, import_node_fs10.existsSync)(import_node_path14.default.join(resources, "codex-cli", "bin", "codex"));
33075
+ }
32778
33076
  async function collectCodexAppCandidates(rawPaths) {
32779
33077
  const candidates = [];
32780
33078
  for (const appPath of rawPaths) {
32781
- if (!(0, import_node_fs10.existsSync)(appPath) || !OFFICIAL_CODEX_APP_NAMES.includes(import_node_path14.default.basename(appPath)) || !(0, import_node_fs10.existsSync)(import_node_path14.default.join(appPath, "Contents", "Resources", "codex"))) {
33079
+ if (!(0, import_node_fs10.existsSync)(appPath) || !OFFICIAL_CODEX_APP_NAMES.includes(import_node_path14.default.basename(appPath)) || !hasBundledCodexCli(appPath)) {
32782
33080
  continue;
32783
33081
  }
32784
33082
  const bundleId = await readBundleString(appPath, "CFBundleIdentifier");
@@ -33393,6 +33691,9 @@ function createAppServerRequestClientExpression(options = {}) {
33393
33691
  } catch {
33394
33692
  }
33395
33693
  if (/^\\s*class\\b/.test(source)) continue;
33694
+ // React hooks also mention sendRequest, and calling one outside a
33695
+ // component throws React error #321, which failed every account read.
33696
+ if (/\\(0,\\s*[\\w$]+\\.c\\)\\(\\d+\\)|\\buse(?:Context|State|Ref|Memo|Callback|Effect|SyncExternalStore)\\b/.test(source)) continue;
33396
33697
  if (source.includes(".sendRequest(") || source.includes("send-cli-request-for-host")) return value;
33397
33698
  }
33398
33699
  return null;
@@ -33435,6 +33736,95 @@ function createAppServerRequestClientExpression(options = {}) {
33435
33736
  }
33436
33737
  throw new Error("codex-app-chatgpt-api-client-not-found");
33437
33738
  };
33739
+ // Codex App builds since September 2026 keep the app-server connection in
33740
+ // a scoped store rather than in React props. An exported getter, the one
33741
+ // that throws "AppServerManager RPC is not connected", takes the store
33742
+ // handle a component holds and a host id.
33743
+ const findScopedStoreHandle = () => {
33744
+ const roots = [];
33745
+ const codexRoot = window.__codexRoot?._internalRoot?.current;
33746
+ if (codexRoot) roots.push(codexRoot);
33747
+ const rootElement = document.querySelector("#root");
33748
+ for (const key of Object.getOwnPropertyNames(rootElement || {})) {
33749
+ if (key.startsWith("__reactContainer$") && rootElement[key]) roots.push(rootElement[key]);
33750
+ }
33751
+ const queue = roots.slice();
33752
+ const seen = new WeakSet();
33753
+ for (let cursor = 0; cursor < queue.length && cursor < 80000; cursor += 1) {
33754
+ const value = queue[cursor];
33755
+ if (!value || (typeof value !== "object" && typeof value !== "function") || seen.has(value)) {
33756
+ continue;
33757
+ }
33758
+ seen.add(value);
33759
+ if (
33760
+ typeof value.get === "function" &&
33761
+ typeof value.getOwnValue === "function" &&
33762
+ "scope" in value &&
33763
+ "node" in value
33764
+ ) {
33765
+ return value;
33766
+ }
33767
+ let names = [];
33768
+ try {
33769
+ names = Object.getOwnPropertyNames(value);
33770
+ } catch {
33771
+ }
33772
+ for (const key of names) {
33773
+ if ([
33774
+ "window",
33775
+ "self",
33776
+ "globalThis",
33777
+ "ownerDocument",
33778
+ "defaultView",
33779
+ "parentNode",
33780
+ "parentElement"
33781
+ ].includes(key)) continue;
33782
+ let descriptor = null;
33783
+ try {
33784
+ descriptor = Object.getOwnPropertyDescriptor(value, key);
33785
+ } catch {
33786
+ }
33787
+ const child = descriptor && "value" in descriptor ? descriptor.value : null;
33788
+ if (
33789
+ child &&
33790
+ (typeof child === "object" || typeof child === "function") &&
33791
+ !(typeof Node !== "undefined" && child instanceof Node)
33792
+ ) {
33793
+ queue.push(child);
33794
+ }
33795
+ }
33796
+ }
33797
+ throw new Error("codex-app-scoped-store-not-found");
33798
+ };
33799
+ const resolveScopedHostClient = async () => {
33800
+ if (typeof state.scopedHostClient?.sendRequest === "function") {
33801
+ return state.scopedHostClient;
33802
+ }
33803
+ const handle = findScopedStoreHandle();
33804
+ for (const url of codexAppAssetUrls()) {
33805
+ let module = null;
33806
+ try {
33807
+ module = await loadCodexAppModuleByUrl(url);
33808
+ } catch {
33809
+ continue;
33810
+ }
33811
+ for (const value of Object.values(module || {})) {
33812
+ if (typeof value !== "function") continue;
33813
+ let source = "";
33814
+ try {
33815
+ source = Function.prototype.toString.call(value);
33816
+ } catch {
33817
+ }
33818
+ if (!source.includes("AppServerManager RPC is not connected")) continue;
33819
+ const client = value(handle, "local");
33820
+ if (typeof client?.sendRequest === "function") {
33821
+ state.scopedHostClient = client;
33822
+ return client;
33823
+ }
33824
+ }
33825
+ }
33826
+ throw new Error("codex-app-scoped-host-client-not-found");
33827
+ };
33438
33828
  const resolveClient = async () => {
33439
33829
  try {
33440
33830
  const directHostClient = resolveDirectHostClient();
@@ -33445,6 +33835,16 @@ function createAppServerRequestClientExpression(options = {}) {
33445
33835
  } catch (error) {
33446
33836
  state.directHostError = sanitizeError(error, "direct-host-unavailable");
33447
33837
  }
33838
+ try {
33839
+ const scopedHostClient = await resolveScopedHostClient();
33840
+ // sendRequest here is a store proxy: calling it works, .bind does not.
33841
+ return {
33842
+ directHost: true,
33843
+ sendRequest: (...args) => scopedHostClient.sendRequest(...args)
33844
+ };
33845
+ } catch (error) {
33846
+ state.scopedHostError = sanitizeError(error, "scoped-host-unavailable");
33847
+ }
33448
33848
  try {
33449
33849
  const sendRequest = await resolveHostRequest();
33450
33850
  return { sendRequest };
@@ -35041,8 +35441,8 @@ function notificationMatchesProcessEpoch(notification, epoch) {
35041
35441
  function waitForOfficialCodexAccountLoginNotification(observedAfter, processEpoch) {
35042
35442
  let settled = false;
35043
35443
  let resolvePromise;
35044
- const promise2 = new Promise((resolve2) => {
35045
- resolvePromise = resolve2;
35444
+ const promise2 = new Promise((resolve3) => {
35445
+ resolvePromise = resolve3;
35046
35446
  });
35047
35447
  const finish = (value3) => {
35048
35448
  if (settled) return;
@@ -37591,7 +37991,7 @@ var ProfileManager = class {
37591
37991
  }
37592
37992
  async readActiveAuthFile() {
37593
37993
  try {
37594
- const raw = await import_fs.promises.readFile(this.activeAuth, "utf8");
37994
+ const raw = await import_fs3.promises.readFile(this.activeAuth, "utf8");
37595
37995
  const trimmed = raw.trim();
37596
37996
  if (!trimmed) {
37597
37997
  return null;
@@ -37613,7 +38013,7 @@ var ProfileManager = class {
37613
38013
  async readActiveAuthFileStrict() {
37614
38014
  let raw;
37615
38015
  try {
37616
- raw = await import_fs.promises.readFile(this.activeAuth, "utf8");
38016
+ raw = await import_fs3.promises.readFile(this.activeAuth, "utf8");
37617
38017
  } catch (error) {
37618
38018
  if (this.isNotFoundError(error)) {
37619
38019
  return null;
@@ -37647,7 +38047,7 @@ var ProfileManager = class {
37647
38047
  async captureAuthSnapshotAtPath(authPath) {
37648
38048
  let raw;
37649
38049
  try {
37650
- raw = await import_fs.promises.readFile(authPath, "utf8");
38050
+ raw = await import_fs3.promises.readFile(authPath, "utf8");
37651
38051
  } catch (error) {
37652
38052
  if (this.isNotFoundError(error)) {
37653
38053
  return this.emptyAuthSnapshot();
@@ -38069,7 +38469,7 @@ var ProfileManager = class {
38069
38469
  async initialize() {
38070
38470
  this.profileHomesRoot = resolveProfileCodexHomesRoot();
38071
38471
  try {
38072
- await import_fs.promises.mkdir(this.codexDir, { recursive: true });
38472
+ await import_fs3.promises.mkdir(this.codexDir, { recursive: true });
38073
38473
  } catch (error) {
38074
38474
  logError("Failed to ensure Codex directory exists:", error);
38075
38475
  throw errorWithCause("Failed to initialize profile manager", error);
@@ -38159,7 +38559,7 @@ var ProfileManager = class {
38159
38559
  const targetHome = this.getProfileHomePath(nextHomeId);
38160
38560
  let sourceExists = true;
38161
38561
  try {
38162
- await import_fs.promises.access(sourceHome);
38562
+ await import_fs3.promises.access(sourceHome);
38163
38563
  } catch (error) {
38164
38564
  if (!this.isNotFoundError(error)) {
38165
38565
  throw error;
@@ -38169,7 +38569,7 @@ var ProfileManager = class {
38169
38569
  if (sourceExists) {
38170
38570
  let targetExists = true;
38171
38571
  try {
38172
- await import_fs.promises.access(targetHome);
38572
+ await import_fs3.promises.access(targetHome);
38173
38573
  } catch (error) {
38174
38574
  if (!this.isNotFoundError(error)) {
38175
38575
  throw error;
@@ -38201,7 +38601,7 @@ var ProfileManager = class {
38201
38601
  } else {
38202
38602
  const releaseGuard = await this.acquireProfileHomeMutationGuard(record2);
38203
38603
  try {
38204
- await import_fs.promises.rename(sourceHome, targetHome);
38604
+ await import_fs3.promises.rename(sourceHome, targetHome);
38205
38605
  } finally {
38206
38606
  await releaseGuard();
38207
38607
  }
@@ -38342,11 +38742,11 @@ var ProfileManager = class {
38342
38742
  dir,
38343
38743
  `.${import_path.default.basename(filePath)}.${process.pid}.${(0, import_node_crypto15.randomUUID)()}.tmp`
38344
38744
  );
38345
- await import_fs.promises.mkdir(dir, { recursive: true, mode: 448 });
38745
+ await import_fs3.promises.mkdir(dir, { recursive: true, mode: 448 });
38346
38746
  if (process.platform !== "win32") {
38347
- await import_fs.promises.chmod(dir, 448);
38747
+ await import_fs3.promises.chmod(dir, 448);
38348
38748
  }
38349
- const handle = await import_fs.promises.open(tempPath, "wx", 384);
38749
+ const handle = await import_fs3.promises.open(tempPath, "wx", 384);
38350
38750
  try {
38351
38751
  await handle.writeFile(contents, "utf8");
38352
38752
  await handle.sync();
@@ -38355,25 +38755,18 @@ var ProfileManager = class {
38355
38755
  }
38356
38756
  try {
38357
38757
  if (process.platform !== "win32") {
38358
- await import_fs.promises.chmod(tempPath, 384);
38359
- }
38360
- await import_fs.promises.rename(tempPath, filePath);
38361
- if (process.platform !== "win32") {
38362
- const dirHandle = await import_fs.promises.open(dir, "r");
38363
- try {
38364
- await dirHandle.sync();
38365
- } finally {
38366
- await dirHandle.close();
38367
- }
38758
+ await import_fs3.promises.chmod(tempPath, 384);
38368
38759
  }
38760
+ await import_fs3.promises.rename(tempPath, filePath);
38761
+ await syncDirectory(dir);
38369
38762
  } finally {
38370
38763
  try {
38371
- await import_fs.promises.rm(tempPath, { force: true });
38764
+ await import_fs3.promises.rm(tempPath, { force: true });
38372
38765
  } catch {
38373
38766
  }
38374
38767
  }
38375
38768
  if (process.platform !== "win32") {
38376
- await import_fs.promises.chmod(filePath, 384);
38769
+ await import_fs3.promises.chmod(filePath, 384);
38377
38770
  }
38378
38771
  }
38379
38772
  async writeAtomicWithReadback(filePath, contents, label) {
@@ -38405,9 +38798,9 @@ var ProfileManager = class {
38405
38798
  async cleanupProfileAuthCas(authPath) {
38406
38799
  const paths = this.profileAuthCasPaths(authPath);
38407
38800
  await Promise.all([
38408
- import_fs.promises.rm(paths.manifest, { force: true }),
38409
- import_fs.promises.rm(paths.backup, { force: true }),
38410
- import_fs.promises.rm(paths.replaced, { force: true })
38801
+ import_fs3.promises.rm(paths.manifest, { force: true }),
38802
+ import_fs3.promises.rm(paths.backup, { force: true }),
38803
+ import_fs3.promises.rm(paths.replaced, { force: true })
38411
38804
  ]);
38412
38805
  }
38413
38806
  async rollbackProfileAuthCas(authPath, manifest) {
@@ -38432,7 +38825,7 @@ var ProfileManager = class {
38432
38825
  throw new Error("Profile auth rollback backup is missing.");
38433
38826
  }
38434
38827
  if (currentRaw !== null) {
38435
- await import_fs.promises.rename(authPath, paths.replaced);
38828
+ await import_fs3.promises.rename(authPath, paths.replaced);
38436
38829
  const replacedRaw = await this.readOptionalFile(paths.replaced);
38437
38830
  if (this.fingerprintAuthContent(replacedRaw) !== manifest.targetFingerprint) {
38438
38831
  if (await this.readOptionalFile(authPath) === null && replacedRaw) {
@@ -38488,7 +38881,7 @@ var ProfileManager = class {
38488
38881
  let displaced = false;
38489
38882
  try {
38490
38883
  if (expectedRaw !== null) {
38491
- await import_fs.promises.rename(authPath, paths.backup);
38884
+ await import_fs3.promises.rename(authPath, paths.backup);
38492
38885
  displaced = true;
38493
38886
  if (await this.readOptionalFile(paths.backup) !== expectedRaw) {
38494
38887
  throw new Error(
@@ -38631,7 +39024,7 @@ var ProfileManager = class {
38631
39024
  }
38632
39025
  async readOptionalFile(filePath) {
38633
39026
  try {
38634
- return await import_fs.promises.readFile(filePath, "utf8");
39027
+ return await import_fs3.promises.readFile(filePath, "utf8");
38635
39028
  } catch (error) {
38636
39029
  if (this.isNotFoundError(error)) {
38637
39030
  return null;
@@ -38671,13 +39064,13 @@ var ProfileManager = class {
38671
39064
  return value3;
38672
39065
  }
38673
39066
  async cleanupAuthMutationFiles() {
38674
- await import_fs.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_MANIFEST_NAME), {
39067
+ await import_fs3.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_MANIFEST_NAME), {
38675
39068
  force: true
38676
39069
  });
38677
- await import_fs.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_BACKUP_NAME), {
39070
+ await import_fs3.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_BACKUP_NAME), {
38678
39071
  force: true
38679
39072
  });
38680
- await import_fs.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_REPLACED_NAME), {
39073
+ await import_fs3.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_REPLACED_NAME), {
38681
39074
  force: true
38682
39075
  });
38683
39076
  }
@@ -38687,7 +39080,7 @@ var ProfileManager = class {
38687
39080
  dir,
38688
39081
  `.${import_path.default.basename(filePath)}.${process.pid}.${(0, import_node_crypto15.randomUUID)()}.install`
38689
39082
  );
38690
- const handle = await import_fs.promises.open(tempPath, "wx", 384);
39083
+ const handle = await import_fs3.promises.open(tempPath, "wx", 384);
38691
39084
  try {
38692
39085
  await handle.writeFile(contents, "utf8");
38693
39086
  await handle.sync();
@@ -38695,17 +39088,10 @@ var ProfileManager = class {
38695
39088
  await handle.close();
38696
39089
  }
38697
39090
  try {
38698
- await import_fs.promises.link(tempPath, filePath);
38699
- if (process.platform !== "win32") {
38700
- const dirHandle = await import_fs.promises.open(dir, "r");
38701
- try {
38702
- await dirHandle.sync();
38703
- } finally {
38704
- await dirHandle.close();
38705
- }
38706
- }
39091
+ await import_fs3.promises.link(tempPath, filePath);
39092
+ await syncDirectory(dir);
38707
39093
  } finally {
38708
- await import_fs.promises.rm(tempPath, { force: true });
39094
+ await import_fs3.promises.rm(tempPath, { force: true });
38709
39095
  }
38710
39096
  }
38711
39097
  async replaceActiveAuthIfCurrent(expectedSourceRaw, targetRaw) {
@@ -38718,7 +39104,7 @@ var ProfileManager = class {
38718
39104
  );
38719
39105
  }
38720
39106
  } else {
38721
- await import_fs.promises.rename(this.activeAuth, backupPath);
39107
+ await import_fs3.promises.rename(this.activeAuth, backupPath);
38722
39108
  const displacedRaw2 = await this.readOptionalFile(backupPath);
38723
39109
  if (displacedRaw2 !== expectedSourceRaw) {
38724
39110
  if (displacedRaw2 !== null && await this.readOptionalFile(this.activeAuth) === null) {
@@ -38799,8 +39185,8 @@ var ProfileManager = class {
38799
39185
  async beginAuthMutation(operation, targetFingerprint) {
38800
39186
  const sourceRaw = await this.readOptionalFile(this.activeAuth);
38801
39187
  const backupPath = import_path.default.join(this.codexDir, AUTH_MUTATION_BACKUP_NAME);
38802
- await import_fs.promises.rm(backupPath, { force: true });
38803
- await import_fs.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_REPLACED_NAME), {
39188
+ await import_fs3.promises.rm(backupPath, { force: true });
39189
+ await import_fs3.promises.rm(import_path.default.join(this.codexDir, AUTH_MUTATION_REPLACED_NAME), {
38804
39190
  force: true
38805
39191
  });
38806
39192
  const manifest = {
@@ -38854,7 +39240,7 @@ var ProfileManager = class {
38854
39240
  );
38855
39241
  }
38856
39242
  if (currentRaw !== null) {
38857
- await import_fs.promises.rename(this.activeAuth, replacedPath);
39243
+ await import_fs3.promises.rename(this.activeAuth, replacedPath);
38858
39244
  const replacedRaw = await this.readOptionalFile(replacedPath);
38859
39245
  if (this.fingerprintAuthContent(replacedRaw) !== manifest.targetFingerprint) {
38860
39246
  if (await this.readOptionalFile(this.activeAuth) === null && replacedRaw) {
@@ -39636,11 +40022,11 @@ var ProfileManager = class {
39636
40022
  async removeProfileHome(record2, recoverable) {
39637
40023
  const profileHome = this.getProfileHomePath(record2.homeId);
39638
40024
  if (!recoverable) {
39639
- await import_fs.promises.rm(profileHome, { recursive: true, force: true });
40025
+ await import_fs3.promises.rm(profileHome, { recursive: true, force: true });
39640
40026
  return null;
39641
40027
  }
39642
40028
  try {
39643
- await import_fs.promises.access(profileHome);
40029
+ await import_fs3.promises.access(profileHome);
39644
40030
  } catch (error) {
39645
40031
  if (this.isNotFoundError(error)) {
39646
40032
  return null;
@@ -39648,13 +40034,13 @@ var ProfileManager = class {
39648
40034
  throw error;
39649
40035
  }
39650
40036
  const trashRoot = process.platform === "darwin" ? import_path.default.join(process.env.HOME || import_node_os8.default.homedir(), ".Trash") : import_path.default.join(getUserDataDir(), "deleted-profile-homes");
39651
- await import_fs.promises.mkdir(trashRoot, { recursive: true, mode: 448 });
40037
+ await import_fs3.promises.mkdir(trashRoot, { recursive: true, mode: 448 });
39652
40038
  const safeName = record2.name.replace(/[^A-Za-z0-9._-]+/g, "-").slice(0, 48) || "profile";
39653
40039
  const destination = import_path.default.join(
39654
40040
  trashRoot,
39655
40041
  `CodexUse-${safeName}-${(0, import_node_crypto15.randomUUID)()}`
39656
40042
  );
39657
- await import_fs.promises.rename(profileHome, destination);
40043
+ await import_fs3.promises.rename(profileHome, destination);
39658
40044
  return destination;
39659
40045
  }
39660
40046
  async deleteProfileRecordAndHome(record2, options = {}) {
@@ -39884,7 +40270,7 @@ var ProfileManager = class {
39884
40270
  async syncProfileTokensFromActiveAuth(profileName, baselineProfile, authPath) {
39885
40271
  const targetPath = authPath ?? this.activeAuth;
39886
40272
  try {
39887
- const authRaw = await import_fs.promises.readFile(targetPath, "utf8");
40273
+ const authRaw = await import_fs3.promises.readFile(targetPath, "utf8");
39888
40274
  await this.syncProfileTokensFromAuthContent(profileName, baselineProfile, authRaw);
39889
40275
  } catch (error) {
39890
40276
  if (!this.isNotFoundError(error)) {
@@ -39896,7 +40282,7 @@ var ProfileManager = class {
39896
40282
  const authPath = import_path.default.join(this.getProfileHomePath(homeId), "auth.json");
39897
40283
  let fileKey;
39898
40284
  try {
39899
- const stats = await import_fs.promises.stat(authPath);
40285
+ const stats = await import_fs3.promises.stat(authPath);
39900
40286
  fileKey = `${stats.mtimeMs}:${stats.size}`;
39901
40287
  const cached2 = this.profileHomeAuthSyncCache.get(profileName);
39902
40288
  const currentRecency2 = this.getProfileTokenRecencyMs(baselineProfile);
@@ -39911,7 +40297,7 @@ var ProfileManager = class {
39911
40297
  }
39912
40298
  let authRaw;
39913
40299
  try {
39914
- authRaw = await import_fs.promises.readFile(authPath, "utf8");
40300
+ authRaw = await import_fs3.promises.readFile(authPath, "utf8");
39915
40301
  } catch (error) {
39916
40302
  if (!this.isNotFoundError(error)) {
39917
40303
  logWarn(`Failed to read profile-home auth for '${profileName}' while syncing tokens:`, error);
@@ -40003,7 +40389,7 @@ var ProfileManager = class {
40003
40389
  const source = (0, import_path2.join)(this.codexDir, file);
40004
40390
  const destination = (0, import_path2.join)(targetCodexHome, file);
40005
40391
  try {
40006
- await import_fs.promises.copyFile(source, destination, import_fs.constants.COPYFILE_EXCL);
40392
+ await import_fs3.promises.copyFile(source, destination, import_fs3.constants.COPYFILE_EXCL);
40007
40393
  if (file === "config.toml") {
40008
40394
  copiedToml = true;
40009
40395
  }
@@ -40065,7 +40451,7 @@ var ProfileManager = class {
40065
40451
  }
40066
40452
  async isProfileHomeMutationMarkerLive(deletingPath) {
40067
40453
  try {
40068
- const owner = JSON.parse(await import_fs.promises.readFile(deletingPath, "utf8"));
40454
+ const owner = JSON.parse(await import_fs3.promises.readFile(deletingPath, "utf8"));
40069
40455
  const expiresAt = typeof owner.expiresAt === "number" && Number.isFinite(owner.expiresAt) ? owner.expiresAt : null;
40070
40456
  const ownerId = typeof owner.ownerId === "string" ? owner.ownerId : null;
40071
40457
  const ownerStartedAt = typeof owner.ownerStartedAt === "number" ? owner.ownerStartedAt : null;
@@ -40086,10 +40472,10 @@ var ProfileManager = class {
40086
40472
  const releaseIntent = await this.acquireProfileHomeWriteIntent(record2);
40087
40473
  let operationError = null;
40088
40474
  try {
40089
- await import_fs.promises.mkdir(leaseDir, { recursive: true, mode: 448 });
40475
+ await import_fs3.promises.mkdir(leaseDir, { recursive: true, mode: 448 });
40090
40476
  let deletingMarkerExists = true;
40091
40477
  try {
40092
- await import_fs.promises.access(deletingPath);
40478
+ await import_fs3.promises.access(deletingPath);
40093
40479
  } catch (error) {
40094
40480
  if (this.isNotFoundError(error)) {
40095
40481
  deletingMarkerExists = false;
@@ -40101,10 +40487,10 @@ var ProfileManager = class {
40101
40487
  if (await this.isProfileHomeMutationMarkerLive(deletingPath)) {
40102
40488
  throw new Error(`Profile '${record2.name}' is being removed or replaced.`);
40103
40489
  }
40104
- await import_fs.promises.rm(deletingPath, { force: true });
40490
+ await import_fs3.promises.rm(deletingPath, { force: true });
40105
40491
  }
40106
40492
  activeProfileRuntimeLeasePaths.add(leasePath);
40107
- const auth = await import_fs.promises.readFile(
40493
+ const auth = await import_fs3.promises.readFile(
40108
40494
  (0, import_path2.join)(this.getProfileHomePath(record2.homeId), "auth.json"),
40109
40495
  "utf8"
40110
40496
  );
@@ -40120,7 +40506,7 @@ var ProfileManager = class {
40120
40506
  })
40121
40507
  );
40122
40508
  try {
40123
- await import_fs.promises.access(deletingPath);
40509
+ await import_fs3.promises.access(deletingPath);
40124
40510
  throw new Error(
40125
40511
  `Profile '${record2.name}' is being removed or replaced.`
40126
40512
  );
@@ -40138,8 +40524,8 @@ var ProfileManager = class {
40138
40524
  );
40139
40525
  if (operationError || releaseError) {
40140
40526
  await Promise.allSettled([
40141
- import_fs.promises.rm(leasePath, { force: true }),
40142
- import_fs.promises.rm(backupPath, { force: true })
40527
+ import_fs3.promises.rm(leasePath, { force: true }),
40528
+ import_fs3.promises.rm(backupPath, { force: true })
40143
40529
  ]);
40144
40530
  activeProfileRuntimeLeasePaths.delete(leasePath);
40145
40531
  if (operationError && releaseError) {
@@ -40162,18 +40548,18 @@ var ProfileManager = class {
40162
40548
  this.getProfileRuntimeLeaseDir(record2.homeId),
40163
40549
  `${leaseId}.auth.backup`
40164
40550
  );
40165
- const backup = await import_fs.promises.readFile(backupPath, "utf8");
40551
+ const backup = await import_fs3.promises.readFile(backupPath, "utf8");
40166
40552
  const releaseIntent = await this.acquireProfileHomeWriteIntent(record2);
40167
40553
  try {
40168
40554
  const leaseDir = this.getProfileRuntimeLeaseDir(record2.homeId);
40169
- for (const entry of await import_fs.promises.readdir(leaseDir)) {
40555
+ for (const entry of await import_fs3.promises.readdir(leaseDir)) {
40170
40556
  if (!entry.endsWith(".json") || entry === `${leaseId}.json`) {
40171
40557
  continue;
40172
40558
  }
40173
40559
  try {
40174
40560
  const leasePath = (0, import_path2.join)(leaseDir, entry);
40175
40561
  const lease = JSON.parse(
40176
- await import_fs.promises.readFile(leasePath, "utf8")
40562
+ await import_fs3.promises.readFile(leasePath, "utf8")
40177
40563
  );
40178
40564
  if (this.resolveLiveProfileRuntimeLeasePid(lease, leasePath)) {
40179
40565
  throw new Error(
@@ -40224,10 +40610,10 @@ var ProfileManager = class {
40224
40610
  const currentLeaseRaw = await this.readOptionalFile(leasePath);
40225
40611
  const currentLease = currentLeaseRaw ? JSON.parse(currentLeaseRaw) : null;
40226
40612
  if (!currentLease || currentLease.id !== leaseId || currentLease.released === true) {
40227
- await import_fs.promises.rm(backupPath, { force: true });
40613
+ await import_fs3.promises.rm(backupPath, { force: true });
40228
40614
  }
40229
40615
  } catch (error) {
40230
- await import_fs.promises.rm(backupPath, { force: true });
40616
+ await import_fs3.promises.rm(backupPath, { force: true });
40231
40617
  throw error;
40232
40618
  }
40233
40619
  }
@@ -40240,7 +40626,7 @@ var ProfileManager = class {
40240
40626
  try {
40241
40627
  let leaseRaw = null;
40242
40628
  try {
40243
- leaseRaw = await import_fs.promises.readFile(leasePath, "utf8");
40629
+ leaseRaw = await import_fs3.promises.readFile(leasePath, "utf8");
40244
40630
  } catch (error) {
40245
40631
  if (!this.isNotFoundError(error)) {
40246
40632
  throw error;
@@ -40263,8 +40649,8 @@ var ProfileManager = class {
40263
40649
  );
40264
40650
  }
40265
40651
  const results = await Promise.allSettled([
40266
- import_fs.promises.rm(leasePath, { force: true }),
40267
- ...options.preserveBackup === true ? [] : [import_fs.promises.rm((0, import_path2.join)(leaseDir, `${leaseId}.auth.backup`), { force: true })]
40652
+ import_fs3.promises.rm(leasePath, { force: true }),
40653
+ ...options.preserveBackup === true ? [] : [import_fs3.promises.rm((0, import_path2.join)(leaseDir, `${leaseId}.auth.backup`), { force: true })]
40268
40654
  ]);
40269
40655
  const failed = results.find(
40270
40656
  (result2) => result2.status === "rejected"
@@ -40297,7 +40683,7 @@ var ProfileManager = class {
40297
40683
  profileName: record2.name
40298
40684
  });
40299
40685
  const openMarker = async () => {
40300
- const handle = await import_fs.promises.open(deletingPath, "wx", 384);
40686
+ const handle = await import_fs3.promises.open(deletingPath, "wx", 384);
40301
40687
  try {
40302
40688
  await handle.writeFile(
40303
40689
  JSON.stringify({
@@ -40312,14 +40698,14 @@ var ProfileManager = class {
40312
40698
  );
40313
40699
  await handle.sync();
40314
40700
  } catch (error) {
40315
- await import_fs.promises.rm(deletingPath, { force: true });
40701
+ await import_fs3.promises.rm(deletingPath, { force: true });
40316
40702
  throw error;
40317
40703
  } finally {
40318
40704
  await handle.close();
40319
40705
  }
40320
40706
  };
40321
40707
  try {
40322
- await import_fs.promises.mkdir(leaseDir, { recursive: true, mode: 448 });
40708
+ await import_fs3.promises.mkdir(leaseDir, { recursive: true, mode: 448 });
40323
40709
  try {
40324
40710
  await openMarker();
40325
40711
  } catch (error) {
@@ -40333,7 +40719,7 @@ var ProfileManager = class {
40333
40719
  error
40334
40720
  );
40335
40721
  }
40336
- await import_fs.promises.rm(deletingPath, { force: true });
40722
+ await import_fs3.promises.rm(deletingPath, { force: true });
40337
40723
  try {
40338
40724
  await openMarker();
40339
40725
  } catch (retryError) {
@@ -40358,7 +40744,7 @@ var ProfileManager = class {
40358
40744
  throw error;
40359
40745
  }
40360
40746
  try {
40361
- const entries3 = await import_fs.promises.readdir(leaseDir);
40747
+ const entries3 = await import_fs3.promises.readdir(leaseDir);
40362
40748
  const officialInstances = await getOfficialCodexProfileInstances({
40363
40749
  profileNames: [record2.name]
40364
40750
  });
@@ -40385,12 +40771,12 @@ var ProfileManager = class {
40385
40771
  let leasePid = 0;
40386
40772
  try {
40387
40773
  const parsed = JSON.parse(
40388
- await import_fs.promises.readFile(leasePath, "utf8")
40774
+ await import_fs3.promises.readFile(leasePath, "utf8")
40389
40775
  );
40390
40776
  if (parsed.released === true) {
40391
40777
  await Promise.allSettled([
40392
- import_fs.promises.rm(leasePath, { force: true }),
40393
- import_fs.promises.rm(backupPath, { force: true })
40778
+ import_fs3.promises.rm(leasePath, { force: true }),
40779
+ import_fs3.promises.rm(backupPath, { force: true })
40394
40780
  ]);
40395
40781
  continue;
40396
40782
  }
@@ -40404,14 +40790,14 @@ var ProfileManager = class {
40404
40790
  );
40405
40791
  }
40406
40792
  await Promise.allSettled([
40407
- import_fs.promises.rm(leasePath, { force: true }),
40408
- import_fs.promises.rm(backupPath, { force: true })
40793
+ import_fs3.promises.rm(leasePath, { force: true }),
40794
+ import_fs3.promises.rm(backupPath, { force: true })
40409
40795
  ]);
40410
40796
  }
40411
40797
  } catch (error) {
40412
40798
  try {
40413
40799
  try {
40414
- await import_fs.promises.rm(deletingPath, { force: true });
40800
+ await import_fs3.promises.rm(deletingPath, { force: true });
40415
40801
  } finally {
40416
40802
  await releaseProfileHomeMutationIntent(
40417
40803
  record2.homeId,
@@ -40430,7 +40816,7 @@ var ProfileManager = class {
40430
40816
  let markerError = null;
40431
40817
  let ownsMarker = false;
40432
40818
  try {
40433
- const owner = JSON.parse(await import_fs.promises.readFile(deletingPath, "utf8"));
40819
+ const owner = JSON.parse(await import_fs3.promises.readFile(deletingPath, "utf8"));
40434
40820
  if (owner.id !== mutationId) {
40435
40821
  markerError = new Error(
40436
40822
  `Profile '${record2.name}' mutation marker ownership changed unexpectedly.`
@@ -40446,7 +40832,7 @@ var ProfileManager = class {
40446
40832
  let markerReleaseError = null;
40447
40833
  if (ownsMarker) {
40448
40834
  try {
40449
- await import_fs.promises.rm(deletingPath);
40835
+ await import_fs3.promises.rm(deletingPath);
40450
40836
  } catch (error) {
40451
40837
  markerReleaseError = error;
40452
40838
  }
@@ -40476,7 +40862,7 @@ var ProfileManager = class {
40476
40862
  const configPath = (0, import_path2.join)(profileHome, "config.toml");
40477
40863
  let raw;
40478
40864
  try {
40479
- raw = await import_fs.promises.readFile(configPath, "utf8");
40865
+ raw = await import_fs3.promises.readFile(configPath, "utf8");
40480
40866
  } catch (error) {
40481
40867
  if (!this.isNotFoundError(error)) {
40482
40868
  logWarn(`Failed to read config for profile home '${profileHome}':`, error);
@@ -40506,7 +40892,7 @@ var ProfileManager = class {
40506
40892
  (0, import_toml2.stringify)(parsed)
40507
40893
  );
40508
40894
  try {
40509
- await import_fs.promises.writeFile(configPath, sanitized, "utf8");
40895
+ await import_fs3.promises.writeFile(configPath, sanitized, "utf8");
40510
40896
  } catch (error) {
40511
40897
  logWarn(`Failed to write sanitized config.toml for profile home '${profileHome}':`, error);
40512
40898
  }
@@ -40524,9 +40910,9 @@ var ProfileManager = class {
40524
40910
  }
40525
40911
  }
40526
40912
  const profileHome = this.getProfileHomePath(record2.homeId);
40527
- await import_fs.promises.mkdir(profileHome, { recursive: true, mode: 448 });
40913
+ await import_fs3.promises.mkdir(profileHome, { recursive: true, mode: 448 });
40528
40914
  if (process.platform !== "win32") {
40529
- await import_fs.promises.chmod(profileHome, 448);
40915
+ await import_fs3.promises.chmod(profileHome, 448);
40530
40916
  }
40531
40917
  const authPath = (0, import_path2.join)(profileHome, "auth.json");
40532
40918
  await this.withProfileAuthFileLock(authPath, async (currentRaw) => {
@@ -40652,7 +41038,7 @@ var ProfileManager = class {
40652
41038
  let syncError = null;
40653
41039
  let finalAuthContent = null;
40654
41040
  try {
40655
- finalAuthContent = await import_fs.promises.readFile(authPath, "utf8");
41041
+ finalAuthContent = await import_fs3.promises.readFile(authPath, "utf8");
40656
41042
  } catch (error) {
40657
41043
  if (!this.isNotFoundError(error)) {
40658
41044
  logWarn(`Failed to read isolated auth for '${profileName}' after action:`, error);
@@ -40789,7 +41175,7 @@ var ProfileManager = class {
40789
41175
  throw new Error("Profile runtime lease is no longer active.");
40790
41176
  }
40791
41177
  const lease = JSON.parse(
40792
- await import_fs.promises.readFile(leasePath, "utf8")
41178
+ await import_fs3.promises.readFile(leasePath, "utf8")
40793
41179
  );
40794
41180
  if (lease.id !== leaseId || lease.ownerId !== PROCESS_OWNER_ID2 || lease.released === true) {
40795
41181
  throw new Error(
@@ -40825,7 +41211,7 @@ var ProfileManager = class {
40825
41211
  );
40826
41212
  let finalAuthContent = null;
40827
41213
  try {
40828
- finalAuthContent = await import_fs.promises.readFile(authPath, "utf8");
41214
+ finalAuthContent = await import_fs3.promises.readFile(authPath, "utf8");
40829
41215
  } catch (error) {
40830
41216
  if (!this.isNotFoundError(error)) {
40831
41217
  logWarn(`Failed to read isolated auth for '${profileName}' while syncing runtime:`, error);
@@ -40905,7 +41291,7 @@ var ProfileManager = class {
40905
41291
  async readAuthFileForImport(authPath, actionLabel) {
40906
41292
  let authRaw;
40907
41293
  try {
40908
- authRaw = await import_fs.promises.readFile(authPath, "utf8");
41294
+ authRaw = await import_fs3.promises.readFile(authPath, "utf8");
40909
41295
  } catch (error) {
40910
41296
  if (this.isNotFoundError(error)) {
40911
41297
  throw errorWithCause(
@@ -41756,7 +42142,7 @@ var ProfileManager = class {
41756
42142
  const profileHome = this.getProfileHomePath(record2.homeId);
41757
42143
  let homeExisted = true;
41758
42144
  try {
41759
- await import_fs.promises.access(profileHome);
42145
+ await import_fs3.promises.access(profileHome);
41760
42146
  } catch (error) {
41761
42147
  if (!this.isNotFoundError(error)) {
41762
42148
  throw error;
@@ -41782,7 +42168,7 @@ var ProfileManager = class {
41782
42168
  const sourceHome = this.getProfileHomePath(sourceHomeId);
41783
42169
  let sourceHomeExists = true;
41784
42170
  try {
41785
- await import_fs.promises.access(sourceHome);
42171
+ await import_fs3.promises.access(sourceHome);
41786
42172
  } catch (error) {
41787
42173
  if (!this.isNotFoundError(error)) {
41788
42174
  throw error;
@@ -41790,16 +42176,16 @@ var ProfileManager = class {
41790
42176
  sourceHomeExists = false;
41791
42177
  }
41792
42178
  if (sourceHomeExists) {
41793
- await import_fs.promises.cp(sourceHome, profileHome, {
42179
+ await import_fs3.promises.cp(sourceHome, profileHome, {
41794
42180
  recursive: true,
41795
42181
  errorOnExist: true,
41796
42182
  force: false
41797
42183
  });
41798
42184
  }
41799
42185
  }
41800
- await import_fs.promises.mkdir(profileHome, { recursive: true, mode: 448 });
42186
+ await import_fs3.promises.mkdir(profileHome, { recursive: true, mode: 448 });
41801
42187
  if (process.platform !== "win32") {
41802
- await import_fs.promises.chmod(profileHome, 448);
42188
+ await import_fs3.promises.chmod(profileHome, 448);
41803
42189
  }
41804
42190
  await this.writeProfileAuthAtomic(
41805
42191
  (0, import_path2.join)(profileHome, "auth.json"),
@@ -41854,7 +42240,7 @@ var ProfileManager = class {
41854
42240
  const rollbackResults = await Promise.allSettled(
41855
42241
  Array.from(
41856
42242
  preparedHomeIds,
41857
- (homeId) => import_fs.promises.rm(this.getProfileHomePath(homeId), {
42243
+ (homeId) => import_fs3.promises.rm(this.getProfileHomePath(homeId), {
41858
42244
  recursive: true,
41859
42245
  force: true
41860
42246
  })
@@ -41924,7 +42310,7 @@ var ProfileManager = class {
41924
42310
  let deleted = 0;
41925
42311
  for (const homeId of homeIds) {
41926
42312
  try {
41927
- await import_fs.promises.rm(this.getProfileHomePath(homeId), {
42313
+ await import_fs3.promises.rm(this.getProfileHomePath(homeId), {
41928
42314
  recursive: true,
41929
42315
  force: true
41930
42316
  });
@@ -43438,8 +43824,8 @@ async function runCodexLogin(mode, envOverrides = {}) {
43438
43824
  env: { ...process.env, ...envOverrides },
43439
43825
  shell
43440
43826
  });
43441
- const exitCode = await new Promise((resolve2) => {
43442
- child.on("close", (code) => resolve2(code ?? 0));
43827
+ const exitCode = await new Promise((resolve3) => {
43828
+ child.on("close", (code) => resolve3(code ?? 0));
43443
43829
  });
43444
43830
  if (exitCode !== 0) {
43445
43831
  throw new Error(`Codex CLI login failed (exit code ${exitCode}).`);
@@ -43501,7 +43887,7 @@ function compareCandidates(left, right) {
43501
43887
  }
43502
43888
  async function runCommand3(codexPath, args2, timeoutMs) {
43503
43889
  const command = buildCodexCommand2(codexPath, args2);
43504
- return new Promise((resolve2) => {
43890
+ return new Promise((resolve3) => {
43505
43891
  const child = (0, import_node_child_process9.spawn)(command.command, command.args, {
43506
43892
  env: process.env,
43507
43893
  shell: command.shell,
@@ -43518,7 +43904,7 @@ async function runCommand3(codexPath, args2, timeoutMs) {
43518
43904
  }
43519
43905
  settled = true;
43520
43906
  clearTimeout(timer);
43521
- resolve2({ code, stdout, stderr, timedOut });
43907
+ resolve3({ code, stdout, stderr, timedOut });
43522
43908
  };
43523
43909
  timer = setTimeout(() => {
43524
43910
  timedOut = true;
@@ -43596,9 +43982,9 @@ async function runCodexWithProfile(manager, profileName, codexArgs) {
43596
43982
  shell: command.shell,
43597
43983
  stdio: "inherit"
43598
43984
  });
43599
- const childResult = new Promise((resolve2, reject) => {
43985
+ const childResult = new Promise((resolve3, reject) => {
43600
43986
  child.once("error", reject);
43601
- child.once("close", (code, signal) => resolve2({ code, signal }));
43987
+ child.once("close", (code, signal) => resolve3({ code, signal }));
43602
43988
  });
43603
43989
  void childResult.catch(() => void 0);
43604
43990
  const relaySignal = (signal) => {
@@ -43893,8 +44279,8 @@ async function acquireOfficialCodexSwitchIntent(input) {
43893
44279
  }
43894
44280
  let resolvePending = () => void 0;
43895
44281
  const pendingAcquisition = {
43896
- promise: new Promise((resolve2) => {
43897
- resolvePending = resolve2;
44282
+ promise: new Promise((resolve3) => {
44283
+ resolvePending = resolve3;
43898
44284
  }),
43899
44285
  resolve: () => resolvePending(),
43900
44286
  error: null
@@ -45303,8 +45689,8 @@ async function coordinateCliOfficialCodexProfileSwitch(options) {
45303
45689
  )) {
45304
45690
  return "completed";
45305
45691
  }
45306
- await new Promise((resolve2) => {
45307
- wakeNotificationWaiter = resolve2;
45692
+ await new Promise((resolve3) => {
45693
+ wakeNotificationWaiter = resolve3;
45308
45694
  });
45309
45695
  }
45310
45696
  };
@@ -45674,7 +46060,7 @@ async function runAutoRollPass(manager, options) {
45674
46060
  };
45675
46061
  }
45676
46062
  function delay2(ms) {
45677
- return new Promise((resolve2) => setTimeout(resolve2, ms));
46063
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
45678
46064
  }
45679
46065
  async function handleProfileCommand(args2, version) {
45680
46066
  const split = splitPassthroughArgs(args2);
@@ -46182,14 +46568,6 @@ var JOURNAL_FILENAME = "cloud-sync-pull.journal.json";
46182
46568
  function getCloudSyncJournalPath() {
46183
46569
  return import_node_path21.default.join(getUserDataDir(), JOURNAL_FILENAME);
46184
46570
  }
46185
- async function syncDirectory(dir) {
46186
- const directory = await import_node_fs16.promises.open(dir, "r");
46187
- try {
46188
- await directory.sync();
46189
- } finally {
46190
- await directory.close();
46191
- }
46192
- }
46193
46571
  async function writeCloudSyncJournal(journal) {
46194
46572
  const target = getCloudSyncJournalPath();
46195
46573
  const dir = import_node_path21.default.dirname(target);
@@ -46242,7 +46620,7 @@ function requireCloudSyncPassphrase(value3) {
46242
46620
  return normalized;
46243
46621
  }
46244
46622
  async function deriveKey(passphrase, salt, params = SCRYPT_PARAMS) {
46245
- return new Promise((resolve2, reject) => {
46623
+ return new Promise((resolve3, reject) => {
46246
46624
  (0, import_node_crypto19.scrypt)(passphrase, salt, params.keyLength, {
46247
46625
  N: params.N,
46248
46626
  r: params.r,
@@ -46253,7 +46631,7 @@ async function deriveKey(passphrase, salt, params = SCRYPT_PARAMS) {
46253
46631
  reject(error);
46254
46632
  return;
46255
46633
  }
46256
- resolve2(Buffer.from(key));
46634
+ resolve3(Buffer.from(key));
46257
46635
  });
46258
46636
  });
46259
46637
  }
@@ -47106,7 +47484,7 @@ async function ensureCliStorageReady() {
47106
47484
  }
47107
47485
 
47108
47486
  // src/app/main.ts
47109
- var VERSION = true ? "6.3.0" : "0.0.0";
47487
+ var VERSION = true ? "6.4.1" : "0.0.0";
47110
47488
  async function runCli() {
47111
47489
  const args2 = process.argv.slice(2);
47112
47490
  if (args2.length === 0) {