codexuse-cli 6.2.11 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js
33
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/parser.js
34
34
  var require_parser = __commonJS({
35
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
35
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
36
36
  "use strict";
37
37
  var ParserEND = 1114112;
38
38
  var ParserError = class _ParserError extends Error {
@@ -155,9 +155,9 @@ var require_parser = __commonJS({
155
155
  }
156
156
  });
157
157
 
158
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js
158
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime.js
159
159
  var require_create_datetime = __commonJS({
160
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
160
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
161
161
  "use strict";
162
162
  module2.exports = (value3) => {
163
163
  const date = new Date(value3);
@@ -170,9 +170,9 @@ var require_create_datetime = __commonJS({
170
170
  }
171
171
  });
172
172
 
173
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js
173
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/format-num.js
174
174
  var require_format_num = __commonJS({
175
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
175
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
176
176
  "use strict";
177
177
  module2.exports = (d, num) => {
178
178
  num = String(num);
@@ -182,9 +182,9 @@ var require_format_num = __commonJS({
182
182
  }
183
183
  });
184
184
 
185
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js
185
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime-float.js
186
186
  var require_create_datetime_float = __commonJS({
187
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
187
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
188
188
  "use strict";
189
189
  var f = require_format_num();
190
190
  var FloatingDateTime = class extends Date {
@@ -209,9 +209,9 @@ var require_create_datetime_float = __commonJS({
209
209
  }
210
210
  });
211
211
 
212
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js
212
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-date.js
213
213
  var require_create_date = __commonJS({
214
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
214
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
215
215
  "use strict";
216
216
  var f = require_format_num();
217
217
  var DateTime = global.Date;
@@ -235,9 +235,9 @@ var require_create_date = __commonJS({
235
235
  }
236
236
  });
237
237
 
238
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js
238
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-time.js
239
239
  var require_create_time = __commonJS({
240
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
240
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
241
241
  "use strict";
242
242
  var f = require_format_num();
243
243
  var Time = class extends Date {
@@ -260,9 +260,9 @@ var require_create_time = __commonJS({
260
260
  }
261
261
  });
262
262
 
263
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js
263
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/toml-parser.js
264
264
  var require_toml_parser = __commonJS({
265
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) {
265
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) {
266
266
  "use strict";
267
267
  module.exports = makeParserClass(require_parser());
268
268
  module.exports.makeParserClass = makeParserClass;
@@ -550,7 +550,7 @@ var require_toml_parser = __commonJS({
550
550
  let target = this.ctx;
551
551
  let finalKey = kv.key.pop();
552
552
  for (let kw of kv.key) {
553
- if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
553
+ if (hasKey(target, kw) && !isTable(target[kw])) {
554
554
  throw this.error(new TomlError("Can't redefine existing key"));
555
555
  }
556
556
  target = target[kw] = target[kw] || Table();
@@ -558,6 +558,7 @@ var require_toml_parser = __commonJS({
558
558
  if (hasKey(target, finalKey)) {
559
559
  throw this.error(new TomlError("Can't redefine existing key"));
560
560
  }
561
+ target[_declared] = true;
561
562
  if (isInteger(kv.value) || isFloat(kv.value)) {
562
563
  target[finalKey] = kv.value.valueOf();
563
564
  } else {
@@ -611,6 +612,8 @@ var require_toml_parser = __commonJS({
611
612
  do {
612
613
  if (this.char === Parser.END || this.char === CTRL_J) {
613
614
  return this.return();
615
+ } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
616
+ throw this.errorControlCharIn("comments");
614
617
  }
615
618
  } while (this.nextChar());
616
619
  }
@@ -816,7 +819,7 @@ var require_toml_parser = __commonJS({
816
819
  } else if (this.atEndOfLine()) {
817
820
  throw this.error(new TomlError("Unterminated string"));
818
821
  } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
819
- throw this.errorControlCharInString();
822
+ throw this.errorControlCharIn("strings");
820
823
  } else {
821
824
  this.consume();
822
825
  }
@@ -845,7 +848,7 @@ var require_toml_parser = __commonJS({
845
848
  } else if (this.char === Parser.END) {
846
849
  throw this.error(new TomlError("Unterminated multi-line string"));
847
850
  } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
848
- throw this.errorControlCharInString();
851
+ throw this.errorControlCharIn("strings");
849
852
  } else {
850
853
  this.consume();
851
854
  }
@@ -861,12 +864,28 @@ var require_toml_parser = __commonJS({
861
864
  }
862
865
  parseLiteralMultiEnd2() {
863
866
  if (this.char === CHAR_APOS) {
864
- return this.return();
867
+ return this.next(this.parseLiteralMultiEnd3);
865
868
  } else {
866
869
  this.state.buf += "''";
867
870
  return this.goto(this.parseLiteralMultiStringContent);
868
871
  }
869
872
  }
873
+ parseLiteralMultiEnd3() {
874
+ if (this.char === CHAR_APOS) {
875
+ this.state.buf += "'";
876
+ return this.next(this.parseLiteralMultiEnd4);
877
+ } else {
878
+ return this.returnNow();
879
+ }
880
+ }
881
+ parseLiteralMultiEnd4() {
882
+ if (this.char === CHAR_APOS) {
883
+ this.state.buf += "'";
884
+ return this.return();
885
+ } else {
886
+ return this.returnNow();
887
+ }
888
+ }
870
889
  /* STRINGS double quoted */
871
890
  parseDoubleString() {
872
891
  if (this.char === CHAR_QUOT) {
@@ -884,7 +903,7 @@ var require_toml_parser = __commonJS({
884
903
  } else if (this.atEndOfLine()) {
885
904
  throw this.error(new TomlError("Unterminated string"));
886
905
  } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
887
- throw this.errorControlCharInString();
906
+ throw this.errorControlCharIn("strings");
888
907
  } else {
889
908
  this.consume();
890
909
  }
@@ -919,19 +938,19 @@ var require_toml_parser = __commonJS({
919
938
  } else if (this.char === Parser.END) {
920
939
  throw this.error(new TomlError("Unterminated multi-line string"));
921
940
  } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
922
- throw this.errorControlCharInString();
941
+ throw this.errorControlCharIn("strings");
923
942
  } else {
924
943
  this.consume();
925
944
  }
926
945
  } while (this.nextChar());
927
946
  }
928
- errorControlCharInString() {
947
+ errorControlCharIn(type) {
929
948
  let displayCode = "\\u00";
930
949
  if (this.char < 16) {
931
950
  displayCode += "0";
932
951
  }
933
952
  displayCode += this.char.toString(16);
934
- return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
953
+ return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in ${type}, use ${displayCode} instead`));
935
954
  }
936
955
  recordMultiEscapeReplacement(replacement) {
937
956
  this.state.buf += replacement;
@@ -947,12 +966,28 @@ var require_toml_parser = __commonJS({
947
966
  }
948
967
  parseMultiEnd2() {
949
968
  if (this.char === CHAR_QUOT) {
950
- return this.return();
969
+ return this.next(this.parseMultiEnd3);
951
970
  } else {
952
971
  this.state.buf += '""';
953
972
  return this.goto(this.parseMultiStringContent);
954
973
  }
955
974
  }
975
+ parseMultiEnd3() {
976
+ if (this.char === CHAR_QUOT) {
977
+ this.state.buf += '"';
978
+ return this.next(this.parseMultiEnd4);
979
+ } else {
980
+ return this.returnNow();
981
+ }
982
+ }
983
+ parseMultiEnd4() {
984
+ if (this.char === CHAR_QUOT) {
985
+ this.state.buf += '"';
986
+ return this.return();
987
+ } else {
988
+ return this.returnNow();
989
+ }
990
+ }
956
991
  parseMultiEscape() {
957
992
  if (this.char === CTRL_M || this.char === CTRL_J) {
958
993
  return this.next(this.parseMultiTrim);
@@ -1493,13 +1528,7 @@ var require_toml_parser = __commonJS({
1493
1528
  }
1494
1529
  }
1495
1530
  recordInlineListValue(value3) {
1496
- if (this.state.resultArr) {
1497
- const listType = this.state.resultArr[_contentType];
1498
- const valueType = tomlType(value3);
1499
- if (listType !== valueType) {
1500
- throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
1501
- }
1502
- } else {
1531
+ if (!this.state.resultArr) {
1503
1532
  this.state.resultArr = InlineList(tomlType(value3));
1504
1533
  }
1505
1534
  if (isFloat(value3) || isInteger(value3)) {
@@ -1560,22 +1589,35 @@ var require_toml_parser = __commonJS({
1560
1589
  } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
1561
1590
  throw this.error(new TomlError("Unterminated inline array"));
1562
1591
  } else if (this.char === CHAR_COMMA) {
1563
- return this.next(this.parseInlineTable);
1592
+ return this.next(this.parseInlineTablePostComma);
1564
1593
  } else if (this.char === CHAR_RCUB) {
1565
1594
  return this.goto(this.parseInlineTable);
1566
1595
  } else {
1567
1596
  throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
1568
1597
  }
1569
1598
  }
1599
+ parseInlineTablePostComma() {
1600
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
1601
+ return null;
1602
+ } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
1603
+ throw this.error(new TomlError("Unterminated inline array"));
1604
+ } else if (this.char === CHAR_COMMA) {
1605
+ throw this.error(new TomlError("Empty elements in inline tables are not permitted"));
1606
+ } else if (this.char === CHAR_RCUB) {
1607
+ throw this.error(new TomlError("Trailing commas in inline tables are not permitted"));
1608
+ } else {
1609
+ return this.goto(this.parseInlineTable);
1610
+ }
1611
+ }
1570
1612
  }
1571
1613
  return TOMLParser;
1572
1614
  }
1573
1615
  }
1574
1616
  });
1575
1617
 
1576
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js
1618
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-pretty-error.js
1577
1619
  var require_parse_pretty_error = __commonJS({
1578
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
1620
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
1579
1621
  "use strict";
1580
1622
  module2.exports = prettyError;
1581
1623
  function prettyError(err, buf) {
@@ -1609,9 +1651,9 @@ var require_parse_pretty_error = __commonJS({
1609
1651
  }
1610
1652
  });
1611
1653
 
1612
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js
1654
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-string.js
1613
1655
  var require_parse_string = __commonJS({
1614
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
1656
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
1615
1657
  "use strict";
1616
1658
  module2.exports = parseString;
1617
1659
  var TOMLParser = require_toml_parser();
@@ -1631,9 +1673,9 @@ var require_parse_string = __commonJS({
1631
1673
  }
1632
1674
  });
1633
1675
 
1634
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js
1676
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-async.js
1635
1677
  var require_parse_async = __commonJS({
1636
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js"(exports2, module2) {
1678
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-async.js"(exports2, module2) {
1637
1679
  "use strict";
1638
1680
  module2.exports = parseAsync;
1639
1681
  var TOMLParser = require_toml_parser();
@@ -1665,9 +1707,9 @@ var require_parse_async = __commonJS({
1665
1707
  }
1666
1708
  });
1667
1709
 
1668
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js
1710
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-stream.js
1669
1711
  var require_parse_stream = __commonJS({
1670
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js"(exports2, module2) {
1712
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-stream.js"(exports2, module2) {
1671
1713
  "use strict";
1672
1714
  module2.exports = parseStream;
1673
1715
  var stream = require("stream");
@@ -1744,9 +1786,9 @@ var require_parse_stream = __commonJS({
1744
1786
  }
1745
1787
  });
1746
1788
 
1747
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js
1789
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse.js
1748
1790
  var require_parse = __commonJS({
1749
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js"(exports2, module2) {
1791
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse.js"(exports2, module2) {
1750
1792
  "use strict";
1751
1793
  module2.exports = require_parse_string();
1752
1794
  module2.exports.async = require_parse_async();
@@ -1755,9 +1797,9 @@ var require_parse = __commonJS({
1755
1797
  }
1756
1798
  });
1757
1799
 
1758
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js
1800
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/stringify.js
1759
1801
  var require_stringify = __commonJS({
1760
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js"(exports2, module2) {
1802
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/stringify.js"(exports2, module2) {
1761
1803
  "use strict";
1762
1804
  module2.exports = stringify3;
1763
1805
  module2.exports.value = stringifyInline;
@@ -1774,9 +1816,6 @@ var require_stringify = __commonJS({
1774
1816
  function typeError(type) {
1775
1817
  return new Error("Can only stringify objects, not " + type);
1776
1818
  }
1777
- function arrayOneTypeError() {
1778
- return new Error("Array values can't have mixed types");
1779
- }
1780
1819
  function getInlineKeys(obj) {
1781
1820
  return Object.keys(obj).filter((key) => isInline(obj[key]));
1782
1821
  }
@@ -1796,12 +1835,12 @@ var require_stringify = __commonJS({
1796
1835
  }
1797
1836
  function stringifyObject(prefix, indent, obj) {
1798
1837
  obj = toJSON(obj);
1799
- var inlineKeys;
1800
- var complexKeys;
1838
+ let inlineKeys;
1839
+ let complexKeys;
1801
1840
  inlineKeys = getInlineKeys(obj);
1802
1841
  complexKeys = getComplexKeys(obj);
1803
- var result2 = [];
1804
- var inlineIndent = indent || "";
1842
+ const result2 = [];
1843
+ const inlineIndent = indent || "";
1805
1844
  inlineKeys.forEach((key) => {
1806
1845
  var type = tomlType2(obj[key]);
1807
1846
  if (type !== "undefined" && type !== "null") {
@@ -1809,7 +1848,7 @@ var require_stringify = __commonJS({
1809
1848
  }
1810
1849
  });
1811
1850
  if (result2.length > 0) result2.push("");
1812
- var complexIndent = prefix && inlineKeys.length > 0 ? indent + " " : "";
1851
+ const complexIndent = prefix && inlineKeys.length > 0 ? indent + " " : "";
1813
1852
  complexKeys.forEach((key) => {
1814
1853
  result2.push(stringifyComplex(prefix, complexIndent, key, obj[key]));
1815
1854
  });
@@ -1857,7 +1896,7 @@ var require_stringify = __commonJS({
1857
1896
  }
1858
1897
  }
1859
1898
  function stringifyKey(key) {
1860
- var keyStr = String(key);
1899
+ const keyStr = String(key);
1861
1900
  if (/^[-A-Za-z0-9_]+$/.test(keyStr)) {
1862
1901
  return keyStr;
1863
1902
  } else {
@@ -1934,9 +1973,7 @@ var require_stringify = __commonJS({
1934
1973
  } else if (Object.is(value3, -0)) {
1935
1974
  return "-0.0";
1936
1975
  }
1937
- var chunks = String(value3).split(".");
1938
- var int = chunks[0];
1939
- var dec = chunks[1] || 0;
1976
+ const [int, dec] = String(value3).split(".");
1940
1977
  return stringifyInteger(int) + "." + dec;
1941
1978
  }
1942
1979
  function stringifyBoolean(value3) {
@@ -1945,27 +1982,10 @@ var require_stringify = __commonJS({
1945
1982
  function stringifyDatetime(value3) {
1946
1983
  return value3.toISOString();
1947
1984
  }
1948
- function isNumber2(type) {
1949
- return type === "float" || type === "integer";
1950
- }
1951
- function arrayType(values2) {
1952
- var contentType = tomlType2(values2[0]);
1953
- if (values2.every((_) => tomlType2(_) === contentType)) return contentType;
1954
- if (values2.every((_) => isNumber2(tomlType2(_)))) return "float";
1955
- return "mixed";
1956
- }
1957
- function validateArray(values2) {
1958
- const type = arrayType(values2);
1959
- if (type === "mixed") {
1960
- throw arrayOneTypeError();
1961
- }
1962
- return type;
1963
- }
1964
1985
  function stringifyInlineArray(values2) {
1965
1986
  values2 = toJSON(values2);
1966
- const type = validateArray(values2);
1967
- var result2 = "[";
1968
- var stringified = values2.map((_) => stringifyInline(_, type));
1987
+ let result2 = "[";
1988
+ const stringified = values2.map((_) => stringifyInline(_));
1969
1989
  if (stringified.join(", ").length > 60 || /\n/.test(stringified)) {
1970
1990
  result2 += "\n " + stringified.join(",\n ") + "\n";
1971
1991
  } else {
@@ -1975,14 +1995,14 @@ var require_stringify = __commonJS({
1975
1995
  }
1976
1996
  function stringifyInlineTable(value3) {
1977
1997
  value3 = toJSON(value3);
1978
- var result2 = [];
1998
+ const result2 = [];
1979
1999
  Object.keys(value3).forEach((key) => {
1980
2000
  result2.push(stringifyKey(key) + " = " + stringifyAnyInline(value3[key], false));
1981
2001
  });
1982
2002
  return "{ " + result2.join(", ") + (result2.length > 0 ? " " : "") + "}";
1983
2003
  }
1984
2004
  function stringifyComplex(prefix, indent, key, value3) {
1985
- var valueType = tomlType2(value3);
2005
+ const valueType = tomlType2(value3);
1986
2006
  if (valueType === "array") {
1987
2007
  return stringifyArrayOfTables(prefix, indent, key, value3);
1988
2008
  } else if (valueType === "table") {
@@ -1993,11 +2013,10 @@ var require_stringify = __commonJS({
1993
2013
  }
1994
2014
  function stringifyArrayOfTables(prefix, indent, key, values2) {
1995
2015
  values2 = toJSON(values2);
1996
- validateArray(values2);
1997
- var firstValueType = tomlType2(values2[0]);
2016
+ const firstValueType = tomlType2(values2[0]);
1998
2017
  if (firstValueType !== "table") throw typeError(firstValueType);
1999
- var fullKey = prefix + stringifyKey(key);
2000
- var result2 = "";
2018
+ const fullKey = prefix + stringifyKey(key);
2019
+ let result2 = "";
2001
2020
  values2.forEach((table) => {
2002
2021
  if (result2.length > 0) result2 += "\n";
2003
2022
  result2 += indent + "[[" + fullKey + "]]\n";
@@ -2006,8 +2025,8 @@ var require_stringify = __commonJS({
2006
2025
  return result2;
2007
2026
  }
2008
2027
  function stringifyComplexTable(prefix, indent, key, value3) {
2009
- var fullKey = prefix + stringifyKey(key);
2010
- var result2 = "";
2028
+ const fullKey = prefix + stringifyKey(key);
2029
+ let result2 = "";
2011
2030
  if (getInlineKeys(value3).length > 0) {
2012
2031
  result2 += indent + "[" + fullKey + "]\n";
2013
2032
  }
@@ -2016,9 +2035,9 @@ var require_stringify = __commonJS({
2016
2035
  }
2017
2036
  });
2018
2037
 
2019
- // ../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js
2038
+ // ../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/toml.js
2020
2039
  var require_toml = __commonJS({
2021
- "../../node_modules/.bun/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js"(exports2) {
2040
+ "../../node_modules/.bun/@iarna+toml@3.0.0/node_modules/@iarna/toml/toml.js"(exports2) {
2022
2041
  "use strict";
2023
2042
  exports2.parse = require_parse();
2024
2043
  exports2.stringify = require_stringify();
@@ -2027,7 +2046,7 @@ var require_toml = __commonJS({
2027
2046
 
2028
2047
  // src/commands/accountPool.ts
2029
2048
  var import_node_crypto16 = require("crypto");
2030
- var import_node_path15 = __toESM(require("path"));
2049
+ var import_node_path16 = __toESM(require("path"));
2031
2050
 
2032
2051
  // ../../packages/contracts/src/settings/types.ts
2033
2052
  var DEFAULT_ACCOUNT_POOL_EXPOSED_MODELS = [
@@ -3464,11 +3483,23 @@ function resolveDefaultUserDataDir() {
3464
3483
  if (configured && import_node_path4.default.isAbsolute(configured)) {
3465
3484
  return import_node_path4.default.resolve(configured);
3466
3485
  }
3467
- const home = process.env.HOME || import_node_os.default.homedir();
3486
+ const home = process.env.HOME || process.env.USERPROFILE || import_node_os.default.homedir();
3468
3487
  if (!home) {
3469
3488
  throw new Error("Unable to resolve home directory for app state.");
3470
3489
  }
3471
- return import_node_path4.default.join(home, "Library", "Application Support", APP_NAME);
3490
+ if (process.platform === "darwin") {
3491
+ return import_node_path4.default.join(home, "Library", "Application Support", APP_NAME);
3492
+ }
3493
+ if (process.platform === "win32") {
3494
+ return import_node_path4.default.join(
3495
+ process.env.APPDATA || import_node_path4.default.join(home, "AppData", "Roaming"),
3496
+ APP_NAME
3497
+ );
3498
+ }
3499
+ return import_node_path4.default.join(
3500
+ process.env.XDG_CONFIG_HOME || import_node_path4.default.join(home, ".config"),
3501
+ APP_NAME
3502
+ );
3472
3503
  }
3473
3504
  function getUserDataDir() {
3474
3505
  return configuredUserDataDir ?? resolveDefaultUserDataDir();
@@ -5643,6 +5674,30 @@ async function readLinuxMachineId() {
5643
5674
  }
5644
5675
  return null;
5645
5676
  }
5677
+ function parseWindowsMachineGuid(output) {
5678
+ const match7 = output.match(/^\s*MachineGuid\s+REG_\w+\s+(.+?)\s*$/im);
5679
+ return normalize(match7?.[1]) || null;
5680
+ }
5681
+ async function readWindowsMachineGuid() {
5682
+ if (process.platform !== "win32") {
5683
+ return null;
5684
+ }
5685
+ try {
5686
+ const { stdout } = await execFileAsync(
5687
+ "reg.exe",
5688
+ [
5689
+ "query",
5690
+ "HKLM\\SOFTWARE\\Microsoft\\Cryptography",
5691
+ "/v",
5692
+ "MachineGuid"
5693
+ ],
5694
+ { timeout: 4e3, windowsHide: true }
5695
+ );
5696
+ return parseWindowsMachineGuid(stdout);
5697
+ } catch {
5698
+ return null;
5699
+ }
5700
+ }
5646
5701
  function hashDeviceComponent(value3) {
5647
5702
  return import_node_crypto4.default.createHash("sha256").update(`codexuse-device:${value3}`).digest("hex");
5648
5703
  }
@@ -5652,7 +5707,7 @@ async function getDeviceId() {
5652
5707
  }
5653
5708
  const dbPath = resolveAppStorageDbPath(getUserDataDir());
5654
5709
  const cached2 = normalize(await readDocument(dbPath, DEVICE_ID_DOCUMENT, normalize));
5655
- const stableDeviceSource = await readHardwareUuid() ?? await readLinuxMachineId();
5710
+ const stableDeviceSource = await readHardwareUuid() ?? await readLinuxMachineId() ?? await readWindowsMachineGuid();
5656
5711
  if (stableDeviceSource) {
5657
5712
  const deviceId2 = hashDeviceComponent(stableDeviceSource);
5658
5713
  if (cached2 !== deviceId2) {
@@ -6612,7 +6667,7 @@ function shouldEnforceProfileLimit(status) {
6612
6667
  // ../../packages/runtime-profiles/src/profiles/profile-manager.ts
6613
6668
  var import_node_crypto15 = require("crypto");
6614
6669
  var import_fs = require("fs");
6615
- var import_node_os5 = __toESM(require("os"), 1);
6670
+ var import_node_os8 = __toESM(require("os"), 1);
6616
6671
  var import_path = __toESM(require("path"), 1);
6617
6672
  var import_path2 = require("path");
6618
6673
  var import_toml2 = __toESM(require_toml(), 1);
@@ -6671,29 +6726,68 @@ function resolveProfileIdentityKeyFromProfile(profile) {
6671
6726
  var import_node_child_process5 = require("child_process");
6672
6727
  var import_node_crypto11 = require("crypto");
6673
6728
  var import_node_readline = __toESM(require("readline"), 1);
6674
- var import_node_fs6 = require("fs");
6675
- var import_node_os3 = __toESM(require("os"), 1);
6676
- var import_node_path10 = __toESM(require("path"), 1);
6729
+ var import_node_fs7 = require("fs");
6730
+ var import_node_os6 = __toESM(require("os"), 1);
6731
+ var import_node_path11 = __toESM(require("path"), 1);
6677
6732
 
6678
6733
  // ../../packages/runtime-codex/src/codex/cli.ts
6679
6734
  var import_node_child_process2 = require("child_process");
6735
+ var import_node_fs5 = require("fs");
6736
+ var import_node_os2 = __toESM(require("os"), 1);
6737
+ var import_node_path6 = __toESM(require("path"), 1);
6738
+
6739
+ // ../../packages/runtime-codex/src/codex/pathCommand.ts
6680
6740
  var import_node_fs4 = require("fs");
6681
6741
  var import_node_path5 = __toESM(require("path"), 1);
6742
+ function isRunnableFile(candidate, platform) {
6743
+ try {
6744
+ if (!(0, import_node_fs4.statSync)(candidate).isFile()) return false;
6745
+ (0, import_node_fs4.accessSync)(candidate, platform === "win32" ? import_node_fs4.constants.F_OK : import_node_fs4.constants.X_OK);
6746
+ return true;
6747
+ } catch {
6748
+ return false;
6749
+ }
6750
+ }
6751
+ function resolveNpmShimEntrypoint(command, shimPath) {
6752
+ if (!/\.(?:cmd|bat)$/i.test(shimPath)) return null;
6753
+ const root = import_node_path5.default.dirname(shimPath);
6754
+ const candidates = command.toLowerCase() === "codex" ? [import_node_path5.default.join(root, "node_modules", "@openai", "codex", "bin", "codex.js")] : command.toLowerCase() === "codexuse" ? [
6755
+ import_node_path5.default.join(root, "node_modules", "codexuse-cli", "dist", "index.js"),
6756
+ import_node_path5.default.join(root, "node_modules", "@codexuse", "cli", "dist", "index.js")
6757
+ ] : [];
6758
+ return candidates.find((candidate) => isRunnableFile(candidate, "win32")) ?? null;
6759
+ }
6760
+ function resolveCommandOnPath(command, env = process.env, platform = process.platform) {
6761
+ const direct = import_node_path5.default.isAbsolute(command) || command.includes("/") || command.includes("\\");
6762
+ const extensions = platform === "win32" && import_node_path5.default.extname(command) === "" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
6763
+ const directories = direct ? [""] : (env.PATH ?? "").split(platform === "win32" ? ";" : ":").map((entry) => entry.trim().replace(/^"+|"+$/g, "")).filter(Boolean);
6764
+ for (const directory of directories) {
6765
+ for (const extension of extensions) {
6766
+ const candidate = direct ? `${command}${extension}` : import_node_path5.default.join(directory, `${command}${extension}`);
6767
+ if (isRunnableFile(candidate, platform)) {
6768
+ return resolveNpmShimEntrypoint(command, candidate) ?? import_node_path5.default.resolve(candidate);
6769
+ }
6770
+ }
6771
+ }
6772
+ return null;
6773
+ }
6774
+
6775
+ // ../../packages/runtime-codex/src/codex/cli.ts
6682
6776
  var STABLE_CHANNEL = "stable";
6683
6777
  var ENV_HINTS = ["CODEX_BINARY", "CODEX_CLI_PATH", "CODEX_PATH"];
6684
6778
  var cachedStatus = null;
6685
6779
  var cachedVersion = null;
6686
6780
  function getPathHintEntries() {
6687
- const homeDir = process.env.HOME ?? "";
6781
+ const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? import_node_os2.default.homedir();
6688
6782
  const homeEntries = homeDir ? [
6689
- import_node_path5.default.join(homeDir, ".local", "bin"),
6690
- import_node_path5.default.join(homeDir, ".fnm", "aliases", "default", "bin"),
6691
- import_node_path5.default.join(homeDir, ".fnm", "current", "bin"),
6692
- import_node_path5.default.join(homeDir, ".volta", "bin"),
6693
- import_node_path5.default.join(homeDir, ".asdf", "shims"),
6694
- import_node_path5.default.join(homeDir, ".bun", "bin")
6783
+ import_node_path6.default.join(homeDir, ".local", "bin"),
6784
+ import_node_path6.default.join(homeDir, ".fnm", "aliases", "default", "bin"),
6785
+ import_node_path6.default.join(homeDir, ".fnm", "current", "bin"),
6786
+ import_node_path6.default.join(homeDir, ".volta", "bin"),
6787
+ import_node_path6.default.join(homeDir, ".asdf", "shims"),
6788
+ import_node_path6.default.join(homeDir, ".bun", "bin")
6695
6789
  ] : [];
6696
- const configuredHints = (process.env.CODEX_PATH_HINTS ?? "").split(import_node_path5.default.delimiter).map((entry) => entry.trim()).filter(Boolean);
6790
+ const configuredHints = (process.env.CODEX_PATH_HINTS ?? "").split(import_node_path6.default.delimiter).map((entry) => entry.trim()).filter(Boolean);
6697
6791
  return [
6698
6792
  "/opt/homebrew/bin",
6699
6793
  "/usr/local/bin",
@@ -6705,9 +6799,9 @@ function fileExists(candidate) {
6705
6799
  if (!candidate) {
6706
6800
  return null;
6707
6801
  }
6708
- const normalized = import_node_path5.default.resolve(candidate);
6802
+ const normalized = import_node_path6.default.resolve(candidate);
6709
6803
  try {
6710
- const stats = (0, import_node_fs4.statSync)(normalized);
6804
+ const stats = (0, import_node_fs5.statSync)(normalized);
6711
6805
  if (stats.isFile()) {
6712
6806
  return normalized;
6713
6807
  }
@@ -6734,17 +6828,14 @@ function resolveCodexFromPath() {
6734
6828
  new Set(
6735
6829
  [
6736
6830
  ...getPathHintEntries(),
6737
- ...pathValue.split(import_node_path5.default.delimiter).map((entry) => entry.trim()).filter(Boolean)
6831
+ ...pathValue.split(import_node_path6.default.delimiter).map((entry) => entry.trim()).filter(Boolean)
6738
6832
  ].filter(Boolean)
6739
6833
  )
6740
6834
  );
6741
- for (const entry of entries3) {
6742
- const candidate = fileExists(import_node_path5.default.join(entry, "codex"));
6743
- if (candidate) {
6744
- return candidate;
6745
- }
6746
- }
6747
- return null;
6835
+ return resolveCommandOnPath("codex", {
6836
+ ...process.env,
6837
+ PATH: entries3.join(import_node_path6.default.delimiter)
6838
+ });
6748
6839
  }
6749
6840
  function buildUnavailableStatus(reason) {
6750
6841
  return {
@@ -6854,7 +6945,8 @@ async function requireCodexCli() {
6854
6945
 
6855
6946
  // ../../packages/runtime-codex/src/codex/command.ts
6856
6947
  var import_node_child_process3 = require("child_process");
6857
- var import_node_path6 = __toESM(require("path"), 1);
6948
+ var import_node_os3 = __toESM(require("os"), 1);
6949
+ var import_node_path7 = __toESM(require("path"), 1);
6858
6950
  var cachedNodeRuntime = null;
6859
6951
  function isJavaScriptEntrypoint(binaryPath) {
6860
6952
  const normalized = binaryPath.trim().toLowerCase();
@@ -6869,20 +6961,21 @@ function resolveNodeRuntime(env) {
6869
6961
  return cachedNodeRuntime;
6870
6962
  }
6871
6963
  const runtimeEnv = { ...process.env, ...env };
6872
- const homeDir = runtimeEnv.HOME ?? "";
6873
- const pathHints = (runtimeEnv.CODEX_PATH_HINTS ?? process.env.CODEX_PATH_HINTS ?? "").split(import_node_path6.default.delimiter).map((entry) => entry.trim()).filter(Boolean);
6964
+ const homeDir = runtimeEnv.HOME ?? runtimeEnv.USERPROFILE ?? import_node_os3.default.homedir();
6965
+ const pathHints = (runtimeEnv.CODEX_PATH_HINTS ?? process.env.CODEX_PATH_HINTS ?? "").split(import_node_path7.default.delimiter).map((entry) => entry.trim()).filter(Boolean);
6874
6966
  const extraPathEntries = [
6875
6967
  "/usr/local/bin",
6876
6968
  "/opt/homebrew/bin",
6877
- import_node_path6.default.join(homeDir, ".local", "bin"),
6878
- import_node_path6.default.join(homeDir, ".fnm", "aliases", "default", "bin"),
6879
- import_node_path6.default.join(homeDir, ".fnm", "current", "bin"),
6969
+ import_node_path7.default.join(homeDir, ".local", "bin"),
6970
+ import_node_path7.default.join(homeDir, ".fnm", "aliases", "default", "bin"),
6971
+ import_node_path7.default.join(homeDir, ".fnm", "current", "bin"),
6972
+ import_node_path7.default.join(homeDir, ".bun", "bin"),
6880
6973
  ...pathHints
6881
6974
  ].filter(Boolean);
6882
6975
  const currentPath = runtimeEnv.PATH ?? "";
6883
6976
  runtimeEnv.PATH = Array.from(
6884
- /* @__PURE__ */ new Set([...extraPathEntries, ...currentPath.split(import_node_path6.default.delimiter).filter(Boolean)])
6885
- ).join(import_node_path6.default.delimiter);
6977
+ /* @__PURE__ */ new Set([...extraPathEntries, ...currentPath.split(import_node_path7.default.delimiter).filter(Boolean)])
6978
+ ).join(import_node_path7.default.delimiter);
6886
6979
  const candidates = Array.from(
6887
6980
  new Set(
6888
6981
  [
@@ -6922,19 +7015,19 @@ function buildCodexCommand(binaryPath, args2, env) {
6922
7015
 
6923
7016
  // ../../packages/runtime-codex/src/codex/home.ts
6924
7017
  var import_node_crypto9 = require("crypto");
6925
- var import_node_fs5 = require("fs");
7018
+ var import_node_fs6 = require("fs");
6926
7019
  var import_promises2 = require("fs/promises");
6927
- var import_node_os2 = __toESM(require("os"), 1);
6928
- var import_node_path7 = __toESM(require("path"), 1);
7020
+ var import_node_os4 = __toESM(require("os"), 1);
7021
+ var import_node_path8 = __toESM(require("path"), 1);
6929
7022
  function resolveHomeDir() {
6930
- return process.env.HOME || import_node_os2.default.homedir();
7023
+ return process.env.HOME || import_node_os4.default.homedir();
6931
7024
  }
6932
7025
  function expandHomePrefix(input, homeDir) {
6933
7026
  if (input === "~") {
6934
7027
  return homeDir;
6935
7028
  }
6936
7029
  if (input.startsWith("~/") || input.startsWith("~\\")) {
6937
- return import_node_path7.default.join(homeDir, input.slice(2));
7030
+ return import_node_path8.default.join(homeDir, input.slice(2));
6938
7031
  }
6939
7032
  return input;
6940
7033
  }
@@ -6950,25 +7043,25 @@ function normalizeCodexHomePath(input) {
6950
7043
  if (!configured) {
6951
7044
  return null;
6952
7045
  }
6953
- return import_node_path7.default.resolve(expandHomePrefix(configured, resolveHomeDir()));
7046
+ return import_node_path8.default.resolve(expandHomePrefix(configured, resolveHomeDir()));
6954
7047
  }
6955
7048
  function resolveDefaultCodexHomeDir() {
6956
- return normalizeCodexHomePath(process.env.CODEX_HOME) ?? import_node_path7.default.join(resolveHomeDir(), ".codex");
7049
+ return normalizeCodexHomePath(process.env.CODEX_HOME) ?? import_node_path8.default.join(resolveHomeDir(), ".codex");
6957
7050
  }
6958
7051
  function resolveCodexSqliteHomeDir(codexHomePath) {
6959
7052
  return normalizeCodexHomePath(process.env.CODEX_SQLITE_HOME) ?? resolveCodexHomeDir({ codexHomePath });
6960
7053
  }
6961
7054
  function resolveCurrentProfileCodexHomeDir(profileHomeId) {
6962
- return import_node_path7.default.join(
7055
+ return import_node_path8.default.join(
6963
7056
  resolveProfileCodexHomesRoot(),
6964
7057
  (0, import_node_crypto9.createHash)("sha256").update(profileHomeId).digest("hex").slice(0, 20)
6965
7058
  );
6966
7059
  }
6967
7060
  function resolveProfileCodexHomeDir(profileHomeId) {
6968
7061
  const current = resolveCurrentProfileCodexHomeDir(profileHomeId);
6969
- const legacy = import_node_path7.default.join(resolveLegacyProfileCodexHomesRoot(), profileHomeId);
6970
- const currentExists = (0, import_node_fs5.existsSync)(current);
6971
- const legacyExists = (0, import_node_fs5.existsSync)(legacy);
7062
+ const legacy = import_node_path8.default.join(resolveLegacyProfileCodexHomesRoot(), profileHomeId);
7063
+ const currentExists = (0, import_node_fs6.existsSync)(current);
7064
+ const legacyExists = (0, import_node_fs6.existsSync)(legacy);
6972
7065
  if (currentExists && legacyExists) {
6973
7066
  return current;
6974
7067
  }
@@ -6976,15 +7069,15 @@ function resolveProfileCodexHomeDir(profileHomeId) {
6976
7069
  }
6977
7070
  function findProfileCodexHomeLocationConflict(profileHomeId) {
6978
7071
  const current = resolveCurrentProfileCodexHomeDir(profileHomeId);
6979
- const legacy = import_node_path7.default.join(resolveLegacyProfileCodexHomesRoot(), profileHomeId);
6980
- return (0, import_node_fs5.existsSync)(current) && (0, import_node_fs5.existsSync)(legacy) ? { current, legacy } : null;
7072
+ const legacy = import_node_path8.default.join(resolveLegacyProfileCodexHomesRoot(), profileHomeId);
7073
+ return (0, import_node_fs6.existsSync)(current) && (0, import_node_fs6.existsSync)(legacy) ? { current, legacy } : null;
6981
7074
  }
6982
7075
  function resolveProfileCodexHomesRoot() {
6983
- return import_node_path7.default.join(resolveHomeDir(), ".codexuse", "p");
7076
+ return import_node_path8.default.join(resolveHomeDir(), ".codexuse", "p");
6984
7077
  }
6985
7078
  async function ensureProfileCodexHomesRoot() {
6986
7079
  const root = resolveProfileCodexHomesRoot();
6987
- const parent = import_node_path7.default.dirname(root);
7080
+ const parent = import_node_path8.default.dirname(root);
6988
7081
  await (0, import_promises2.mkdir)(parent, { recursive: true, mode: 448 });
6989
7082
  await (0, import_promises2.mkdir)(root, { recursive: true, mode: 448 });
6990
7083
  if (process.platform !== "win32") {
@@ -6994,13 +7087,13 @@ async function ensureProfileCodexHomesRoot() {
6994
7087
  return root;
6995
7088
  }
6996
7089
  function resolveLegacyProfileCodexHomesRoot() {
6997
- return import_node_path7.default.join(getUserDataDir(), "profile-homes");
7090
+ return import_node_path8.default.join(getUserDataDir(), "profile-homes");
6998
7091
  }
6999
7092
  async function migrateProfileCodexHomeDir(profileHomeId) {
7000
- const legacy = import_node_path7.default.join(resolveLegacyProfileCodexHomesRoot(), profileHomeId);
7093
+ const legacy = import_node_path8.default.join(resolveLegacyProfileCodexHomesRoot(), profileHomeId);
7001
7094
  const current = resolveCurrentProfileCodexHomeDir(profileHomeId);
7002
- const currentExists = (0, import_node_fs5.existsSync)(current);
7003
- const legacyExists = (0, import_node_fs5.existsSync)(legacy);
7095
+ const currentExists = (0, import_node_fs6.existsSync)(current);
7096
+ const legacyExists = (0, import_node_fs6.existsSync)(legacy);
7004
7097
  if (currentExists && legacyExists) {
7005
7098
  return current;
7006
7099
  }
@@ -7051,6 +7144,7 @@ async function resolveCodexRuntimeContext(options) {
7051
7144
  }
7052
7145
 
7053
7146
  // ../../packages/runtime-codex/src/cli/env.ts
7147
+ var import_node_os5 = __toESM(require("os"), 1);
7054
7148
  function buildCodexChildEnv(overrides = {}) {
7055
7149
  const env = { ...process.env };
7056
7150
  for (const key of Object.keys(env)) {
@@ -7076,7 +7170,7 @@ var import_toml = __toESM(require_toml(), 1);
7076
7170
  // ../../packages/runtime-codex/src/codex/config-metadata.ts
7077
7171
  var import_node_child_process4 = require("child_process");
7078
7172
  var import_promises3 = require("fs/promises");
7079
- var import_node_path8 = __toESM(require("path"), 1);
7173
+ var import_node_path9 = __toESM(require("path"), 1);
7080
7174
  var CONFIG_SCHEMA_URL = "https://raw.githubusercontent.com/openai/codex/main/codex-rs/core/config.schema.json";
7081
7175
  var METADATA_CACHE_TTL_MS = 6e4;
7082
7176
  var FALLBACK_SCHEMA_TOP_LEVEL_KEYS = [
@@ -7262,8 +7356,8 @@ function parseSchemaKeys(schemaRaw) {
7262
7356
  async function readSchemaFromLocal() {
7263
7357
  const candidates = [
7264
7358
  process.env.CODEX_CONFIG_SCHEMA_PATH,
7265
- import_node_path8.default.join(process.cwd(), "codex-rs", "core", "config.schema.json"),
7266
- import_node_path8.default.join(process.cwd(), "node_modules", "@openai", "codex", "codex-rs", "core", "config.schema.json")
7359
+ import_node_path9.default.join(process.cwd(), "codex-rs", "core", "config.schema.json"),
7360
+ import_node_path9.default.join(process.cwd(), "node_modules", "@openai", "codex", "codex-rs", "core", "config.schema.json")
7267
7361
  ].filter((candidate) => Boolean(candidate));
7268
7362
  for (const candidate of candidates) {
7269
7363
  try {
@@ -7369,7 +7463,7 @@ async function getCodexConfigMetadata(forceRefresh = false) {
7369
7463
  // ../../packages/runtime-codex/src/codex/config-io.ts
7370
7464
  var import_node_crypto10 = require("crypto");
7371
7465
  var import_promises4 = require("fs/promises");
7372
- var import_node_path9 = __toESM(require("path"), 1);
7466
+ var import_node_path10 = __toESM(require("path"), 1);
7373
7467
 
7374
7468
  // ../../packages/runtime-codex/src/codex/config-presets.ts
7375
7469
  var DEFAULT_CONFIG_TEMPLATE = [
@@ -7412,10 +7506,10 @@ var YOLO_PRESET = {
7412
7506
 
7413
7507
  // ../../packages/runtime-codex/src/codex/config-io.ts
7414
7508
  function getConfigPath(options) {
7415
- return import_node_path9.default.join(resolveCodexHomeDir(options), "config.toml");
7509
+ return import_node_path10.default.join(resolveCodexHomeDir(options), "config.toml");
7416
7510
  }
7417
7511
  async function ensureConfigDirExists(filePath) {
7418
- const dir = import_node_path9.default.dirname(filePath);
7512
+ const dir = import_node_path10.default.dirname(filePath);
7419
7513
  await (0, import_promises4.mkdir)(dir, { recursive: true });
7420
7514
  }
7421
7515
  async function resolveConfigWriteTarget(configPath) {
@@ -7429,7 +7523,7 @@ async function resolveConfigWriteTarget(configPath) {
7429
7523
  if (error.code !== "ENOENT") {
7430
7524
  throw error;
7431
7525
  }
7432
- return import_node_path9.default.resolve(import_node_path9.default.dirname(configPath), await (0, import_promises4.readlink)(configPath));
7526
+ return import_node_path10.default.resolve(import_node_path10.default.dirname(configPath), await (0, import_promises4.readlink)(configPath));
7433
7527
  }
7434
7528
  } catch (error) {
7435
7529
  if (error.code === "ENOENT") {
@@ -7439,8 +7533,8 @@ async function resolveConfigWriteTarget(configPath) {
7439
7533
  }
7440
7534
  }
7441
7535
  async function removeStaleConfigStagingFiles(targetPath) {
7442
- const directory = import_node_path9.default.dirname(targetPath);
7443
- const prefix = `${import_node_path9.default.basename(targetPath)}.tmp-`;
7536
+ const directory = import_node_path10.default.dirname(targetPath);
7537
+ const prefix = `${import_node_path10.default.basename(targetPath)}.tmp-`;
7444
7538
  const entries3 = await (0, import_promises4.readdir)(directory).catch((error) => {
7445
7539
  if (error.code === "ENOENT") {
7446
7540
  return [];
@@ -7448,7 +7542,7 @@ async function removeStaleConfigStagingFiles(targetPath) {
7448
7542
  throw error;
7449
7543
  });
7450
7544
  await Promise.all(
7451
- entries3.filter((entry) => entry.startsWith(prefix)).map((entry) => (0, import_promises4.rm)(import_node_path9.default.join(directory, entry), { force: true }))
7545
+ entries3.filter((entry) => entry.startsWith(prefix)).map((entry) => (0, import_promises4.rm)(import_node_path10.default.join(directory, entry), { force: true }))
7452
7546
  );
7453
7547
  }
7454
7548
  async function resolveConfigWriteMode(targetPath) {
@@ -7509,7 +7603,7 @@ async function writeConfigContent(content, options) {
7509
7603
  await (0, import_promises4.rename)(stagingPath, targetPath);
7510
7604
  if (process.platform !== "win32") {
7511
7605
  await (0, import_promises4.chmod)(targetPath, mode);
7512
- const directory = await (0, import_promises4.open)(import_node_path9.default.dirname(targetPath), "r");
7606
+ const directory = await (0, import_promises4.open)(import_node_path10.default.dirname(targetPath), "r");
7513
7607
  try {
7514
7608
  await directory.sync();
7515
7609
  } finally {
@@ -7532,7 +7626,7 @@ async function removeConfigContent(options) {
7532
7626
  }
7533
7627
  throw error;
7534
7628
  }
7535
- const directory = await (0, import_promises4.open)(import_node_path9.default.dirname(configPath), "r");
7629
+ const directory = await (0, import_promises4.open)(import_node_path10.default.dirname(configPath), "r");
7536
7630
  try {
7537
7631
  await directory.sync();
7538
7632
  } finally {
@@ -7902,7 +7996,7 @@ function logInfo(...args2) {
7902
7996
  console.info(...args2);
7903
7997
  }
7904
7998
 
7905
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Pipeable.js
7999
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Pipeable.js
7906
8000
  var pipeArguments = (self, args2) => {
7907
8001
  switch (args2.length) {
7908
8002
  case 0:
@@ -7946,7 +8040,7 @@ var Class = /* @__PURE__ */ (function() {
7946
8040
  return PipeableBase;
7947
8041
  })();
7948
8042
 
7949
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Function.js
8043
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Function.js
7950
8044
  var dual = function(arity, body) {
7951
8045
  if (typeof arity === "function") {
7952
8046
  return function() {
@@ -8018,7 +8112,7 @@ function memoizeIdempotent(f) {
8018
8112
  };
8019
8113
  }
8020
8114
 
8021
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/equal.js
8115
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/equal.js
8022
8116
  var getAllObjectKeys = (obj) => {
8023
8117
  const keys4 = new Set(Reflect.ownKeys(obj));
8024
8118
  if (obj.constructor === Object) return keys4;
@@ -8041,7 +8135,7 @@ var getAllObjectKeys = (obj) => {
8041
8135
  };
8042
8136
  var byReferenceInstances = /* @__PURE__ */ new WeakSet();
8043
8137
 
8044
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Predicate.js
8138
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Predicate.js
8045
8139
  function isString(input) {
8046
8140
  return typeof input === "string";
8047
8141
  }
@@ -8086,7 +8180,7 @@ function isError(input) {
8086
8180
  return input instanceof Error;
8087
8181
  }
8088
8182
 
8089
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Hash.js
8183
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Hash.js
8090
8184
  var symbol = "~effect/Hash";
8091
8185
  var hash = (self) => {
8092
8186
  switch (typeof self) {
@@ -8200,7 +8294,7 @@ function withVisitedTracking(obj, fn2) {
8200
8294
  return result2;
8201
8295
  }
8202
8296
 
8203
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Equal.js
8297
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Equal.js
8204
8298
  var symbol2 = "~effect/Equal";
8205
8299
  function equals() {
8206
8300
  if (arguments.length === 1) {
@@ -8392,7 +8486,7 @@ function makeCompareSet(equivalence) {
8392
8486
  var compareSets = /* @__PURE__ */ makeCompareSet(compareBoth);
8393
8487
  var isEqual = (u) => hasProperty(u, symbol2);
8394
8488
 
8395
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Reducer.js
8489
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Reducer.js
8396
8490
  function make(combine2, initialValue, combineAll) {
8397
8491
  return {
8398
8492
  combine: combine2,
@@ -8407,7 +8501,7 @@ function make(combine2, initialValue, combineAll) {
8407
8501
  };
8408
8502
  }
8409
8503
 
8410
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Equivalence.js
8504
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Equivalence.js
8411
8505
  var make2 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
8412
8506
  var isStrictEquivalent = (x, y) => x === y;
8413
8507
  var strictEqual = () => isStrictEquivalent;
@@ -8443,10 +8537,10 @@ function Struct(fields) {
8443
8537
  });
8444
8538
  }
8445
8539
 
8446
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/array.js
8540
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/array.js
8447
8541
  var isArrayNonEmpty = (self) => self.length > 0;
8448
8542
 
8449
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/record.js
8543
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/record.js
8450
8544
  function assignProperty(self, key, value3) {
8451
8545
  if (key === "__proto__") {
8452
8546
  Object.defineProperty(self, key, {
@@ -8468,14 +8562,14 @@ function assignProperties(self, source) {
8468
8562
  }
8469
8563
  }
8470
8564
 
8471
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Combiner.js
8565
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Combiner.js
8472
8566
  function make3(combine2) {
8473
8567
  return {
8474
8568
  combine: combine2
8475
8569
  };
8476
8570
  }
8477
8571
 
8478
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Redactable.js
8572
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Redactable.js
8479
8573
  var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Redactable");
8480
8574
  var isRedactable = (u) => hasProperty(u, symbolRedactable);
8481
8575
  function redact(u) {
@@ -8497,7 +8591,7 @@ var emptyContext = {
8497
8591
  }
8498
8592
  };
8499
8593
 
8500
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Formatter.js
8594
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Formatter.js
8501
8595
  function format(input, options) {
8502
8596
  const space = options?.space ?? 0;
8503
8597
  const ancestors = /* @__PURE__ */ new WeakSet();
@@ -8566,8 +8660,8 @@ var CIRCULAR = "[Circular]";
8566
8660
  function formatPropertyKey(name) {
8567
8661
  return typeof name === "string" ? JSON.stringify(name) : String(name);
8568
8662
  }
8569
- function formatPath(path22) {
8570
- return path22.map((key) => `[${formatPropertyKey(key)}]`).join("");
8663
+ function formatPath(path23) {
8664
+ return path23.map((key) => `[${formatPropertyKey(key)}]`).join("");
8571
8665
  }
8572
8666
  function formatDate(date) {
8573
8667
  try {
@@ -8613,7 +8707,7 @@ function formatJson(input, options) {
8613
8707
  }, options?.space) ?? "null";
8614
8708
  }
8615
8709
 
8616
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Inspectable.js
8710
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Inspectable.js
8617
8711
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
8618
8712
  var toJson = (input) => {
8619
8713
  try {
@@ -8666,7 +8760,7 @@ var Class2 = class {
8666
8760
  }
8667
8761
  };
8668
8762
 
8669
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/stackTraceLimit.js
8763
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/stackTraceLimit.js
8670
8764
  var isStackTraceLimitWritable = () => {
8671
8765
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
8672
8766
  if (desc === void 0) {
@@ -8683,7 +8777,7 @@ var setStackTraceLimit = (value3) => {
8683
8777
  }
8684
8778
  };
8685
8779
 
8686
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Utils.js
8780
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Utils.js
8687
8781
  var SingleShotGen = class _SingleShotGen {
8688
8782
  called = false;
8689
8783
  self;
@@ -8743,7 +8837,7 @@ var pickInternalCall = () => {
8743
8837
  };
8744
8838
  var internalCall = /* @__PURE__ */ pickInternalCall();
8745
8839
 
8746
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/core.js
8840
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/core.js
8747
8841
  var EffectTypeId = `~effect/Effect`;
8748
8842
  var ExitTypeId = `~effect/Exit`;
8749
8843
  var effectVariance = {
@@ -9095,7 +9189,7 @@ var DoneVoid = {
9095
9189
  value: void 0
9096
9190
  };
9097
9191
 
9098
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/option.js
9192
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/option.js
9099
9193
  var TypeId = "~effect/Option";
9100
9194
  var CommonProto = {
9101
9195
  [TypeId]: {
@@ -9161,7 +9255,7 @@ var SomeImpl = function(value3) {
9161
9255
  SomeImpl.prototype = SomeProto;
9162
9256
  var some = (value3) => new SomeImpl(value3);
9163
9257
 
9164
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/result.js
9258
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/result.js
9165
9259
  var TypeId2 = "~effect/Result";
9166
9260
  var CommonProto2 = {
9167
9261
  [TypeId2]: {
@@ -9228,7 +9322,7 @@ var SuccessImpl = function(success) {
9228
9322
  SuccessImpl.prototype = SuccessProto;
9229
9323
  var succeed = (success) => new SuccessImpl(success);
9230
9324
 
9231
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Order.js
9325
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Order.js
9232
9326
  function make4(compare2) {
9233
9327
  return (self, that) => self === that ? 0 : compare2(self, that);
9234
9328
  }
@@ -9258,7 +9352,7 @@ var isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
9258
9352
  var isLessThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== 1);
9259
9353
  var isGreaterThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== -1);
9260
9354
 
9261
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Option.js
9355
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Option.js
9262
9356
  var none2 = () => none;
9263
9357
  var some2 = some;
9264
9358
  var isOption2 = isOption;
@@ -9286,7 +9380,7 @@ var flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(s
9286
9380
  var flatten = /* @__PURE__ */ flatMap(identity);
9287
9381
  var filter = /* @__PURE__ */ dual(2, (self, predicate) => isNone2(self) ? none2() : predicate(self.value) ? some2(self.value) : none2());
9288
9382
 
9289
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Result.js
9383
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Result.js
9290
9384
  var succeed2 = succeed;
9291
9385
  var fail2 = fail;
9292
9386
  var isResult2 = isResult;
@@ -9308,10 +9402,10 @@ var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onFailure) => {
9308
9402
  var getOrThrow = /* @__PURE__ */ getOrThrowWith(identity);
9309
9403
  var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => isFailure2(self) ? fail2(self.failure) : f(self.success));
9310
9404
 
9311
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Tuple.js
9405
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Tuple.js
9312
9406
  var makeEquivalence = Tuple;
9313
9407
 
9314
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Iterable.js
9408
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Iterable.js
9315
9409
  var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
9316
9410
  let i = 0;
9317
9411
  for (const a of self) {
@@ -9330,7 +9424,7 @@ var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
9330
9424
  return none2();
9331
9425
  });
9332
9426
 
9333
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Record.js
9427
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Record.js
9334
9428
  var has = /* @__PURE__ */ dual(2, (self, key) => Object.hasOwn(self, key));
9335
9429
  var map3 = /* @__PURE__ */ dual(2, (self, f) => {
9336
9430
  const out = {
@@ -9355,7 +9449,7 @@ var makeEquivalence2 = (equivalence) => {
9355
9449
  return (self, that) => is3(self, that) && is3(that, self);
9356
9450
  };
9357
9451
 
9358
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Array.js
9452
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Array.js
9359
9453
  var Array2 = globalThis.Array;
9360
9454
  var fromIterable = (collection) => Array2.isArray(collection) ? collection : Array2.from(collection);
9361
9455
  var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
@@ -9400,7 +9494,7 @@ var dedupe = (self) => {
9400
9494
  return out;
9401
9495
  };
9402
9496
 
9403
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/BigDecimal.js
9497
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/BigDecimal.js
9404
9498
  var FINITE_INT_REGEXP = /^[+-]?\d+$/;
9405
9499
  var TypeId3 = "~effect/BigDecimal";
9406
9500
  var BigDecimalProto = {
@@ -9593,7 +9687,7 @@ var toExponential = (n) => {
9593
9687
  var isZero = (n) => n.value === bigint0;
9594
9688
  var isNegative = (n) => n.value < bigint0;
9595
9689
 
9596
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/BigInt.js
9690
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/BigInt.js
9597
9691
  var BigInt3 = globalThis.BigInt;
9598
9692
  var toNumber = (b) => {
9599
9693
  if (b > BigInt3(Number.MAX_SAFE_INTEGER) || b < BigInt3(Number.MIN_SAFE_INTEGER)) {
@@ -9602,13 +9696,13 @@ var toNumber = (b) => {
9602
9696
  return some2(Number(b));
9603
9697
  };
9604
9698
 
9605
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Effectable.js
9699
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Effectable.js
9606
9700
  var Prototype2 = (options) => makePrimitiveProto({
9607
9701
  op: options.label,
9608
9702
  [evaluate]: options.evaluate
9609
9703
  });
9610
9704
 
9611
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Context.js
9705
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Context.js
9612
9706
  var ServiceTypeId = "~effect/Context/Service";
9613
9707
  var Service = function() {
9614
9708
  function KeyClass() {
@@ -9785,7 +9879,7 @@ var serviceNotFoundError = (service2) => {
9785
9879
  };
9786
9880
  var Reference = Service;
9787
9881
 
9788
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Duration.js
9882
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Duration.js
9789
9883
  var TypeId5 = "~effect/Duration";
9790
9884
  var bigint02 = /* @__PURE__ */ BigInt(0);
9791
9885
  var bigint12 = /* @__PURE__ */ BigInt(1);
@@ -10050,7 +10144,7 @@ var Equivalence2 = (self, that) => matchPair(self, that, {
10050
10144
  });
10051
10145
  var equals3 = /* @__PURE__ */ dual(2, (self, that) => Equivalence2(self, that));
10052
10146
 
10053
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Scheduler.js
10147
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Scheduler.js
10054
10148
  var Scheduler = /* @__PURE__ */ Reference("effect/Scheduler", {
10055
10149
  fiberCached: true,
10056
10150
  defaultValue: () => new MixedScheduler()
@@ -10194,7 +10288,7 @@ var PreventSchedulerYield = /* @__PURE__ */ Reference("effect/Scheduler/PreventS
10194
10288
  defaultValue: () => false
10195
10289
  });
10196
10290
 
10197
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Data.js
10291
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Data.js
10198
10292
  var Class3 = class extends Class {
10199
10293
  constructor(props) {
10200
10294
  super();
@@ -10206,7 +10300,7 @@ var Class3 = class extends Class {
10206
10300
  var Error3 = Error2;
10207
10301
  var TaggedError2 = TaggedError;
10208
10302
 
10209
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Encoding.js
10303
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Encoding.js
10210
10304
  var EncodingErrorTypeId = "~effect/Encoding/EncodingError";
10211
10305
  var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")) {
10212
10306
  /**
@@ -10378,14 +10472,14 @@ var fromHexChar = (byte) => {
10378
10472
  throw new TypeError("Invalid input");
10379
10473
  };
10380
10474
 
10381
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Tracer.js
10475
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Tracer.js
10382
10476
  var ParentSpanKey = "effect/Tracer/ParentSpan";
10383
10477
  var TracerKey = "effect/Tracer";
10384
10478
 
10385
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/metric.js
10479
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/metric.js
10386
10480
  var FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics";
10387
10481
 
10388
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/references.js
10482
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/references.js
10389
10483
  var CurrentStackFrame = /* @__PURE__ */ Reference("effect/References/CurrentStackFrame", {
10390
10484
  fiberCached: true,
10391
10485
  defaultValue: constUndefined
@@ -10403,7 +10497,7 @@ var MinimumLogLevel = /* @__PURE__ */ Reference("effect/References/MinimumLogLev
10403
10497
  defaultValue: () => "Info"
10404
10498
  });
10405
10499
 
10406
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/effect.js
10500
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/effect.js
10407
10501
  var Interrupt = class extends ReasonBase {
10408
10502
  constructor(fiberId2, annotations = constEmptyAnnotations) {
10409
10503
  super("Interrupt", annotations, "Interrupted");
@@ -11523,7 +11617,7 @@ var logLevelColors = {
11523
11617
  Fatal: [colors.bgBrightRed, colors.black]
11524
11618
  };
11525
11619
 
11526
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Cause.js
11620
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Cause.js
11527
11621
  var isCause2 = isCause;
11528
11622
  var isReason = isCauseReason;
11529
11623
  var isFailReason2 = isFailReason;
@@ -11535,7 +11629,7 @@ var map6 = causeMap;
11535
11629
  var pretty = causePretty;
11536
11630
  var IllegalArgumentError2 = IllegalArgumentError;
11537
11631
 
11538
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Exit.js
11632
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Exit.js
11539
11633
  var isExit2 = isExit;
11540
11634
  var succeed4 = exitSucceed;
11541
11635
  var failCause2 = exitFailCause;
@@ -11544,7 +11638,7 @@ var void_2 = exitVoid;
11544
11638
  var isSuccess3 = exitIsSuccess;
11545
11639
  var isFailure3 = exitIsFailure;
11546
11640
 
11547
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/dateTime.js
11641
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/dateTime.js
11548
11642
  var TypeId6 = "~effect/DateTime";
11549
11643
  var TimeZoneTypeId = "~effect/DateTime/TimeZone";
11550
11644
  var Proto2 = {
@@ -11931,7 +12025,7 @@ var formatIsoOffset = (self) => {
11931
12025
  };
11932
12026
  var formatIsoZoned = (self) => self.zone._tag === "Offset" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;
11933
12027
 
11934
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Number.js
12028
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Number.js
11935
12029
  var Number3 = globalThis.Number;
11936
12030
  var remainder = /* @__PURE__ */ dual(2, (self, divisor) => {
11937
12031
  const selfString = self.toString();
@@ -11970,11 +12064,11 @@ function toScientificInteger(n) {
11970
12064
  return [coefficient, globalThis.Number(scientific.slice(eIndex + 1)) - digits.length + 1];
11971
12065
  }
11972
12066
 
11973
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/String.js
12067
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/String.js
11974
12068
  var String2 = globalThis.String;
11975
12069
  var trim = (self) => self.trim();
11976
12070
 
11977
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Effect.js
12071
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Effect.js
11978
12072
  var tryPromise2 = tryPromise;
11979
12073
  var succeed5 = succeed3;
11980
12074
  var succeedNone2 = succeedNone;
@@ -11999,7 +12093,7 @@ var flatMapEager2 = flatMapEager;
11999
12093
  var catchEager2 = catchEager;
12000
12094
  var fnUntracedEager2 = fnUntracedEager;
12001
12095
 
12002
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/annotations.js
12096
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/annotations.js
12003
12097
  function resolve(ast) {
12004
12098
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
12005
12099
  }
@@ -12022,7 +12116,7 @@ var getExpected = /* @__PURE__ */ memoize((ast) => {
12022
12116
  });
12023
12117
  var annotationExcludedKeys = /* @__PURE__ */ new Set([SENTINELS_ANNOTATION_KEY, STRUCTURAL_ANNOTATION_KEY, "representation", "arbitraryConstraint", "brands", "toJsonSchema", "toCode", "toEquivalence", "toFormatter", "toCodec", "toCodecJson", "toCodecStringTree", "toCodecIso", "toCodecArbitrary"]);
12024
12118
 
12025
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/parser.js
12119
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/parser.js
12026
12120
  var missing = /* @__PURE__ */ Symbol();
12027
12121
  var succeed6 = succeed4;
12028
12122
  var missingExit = /* @__PURE__ */ succeed6(missing);
@@ -12030,7 +12124,7 @@ var sameExit = /* @__PURE__ */ succeed6(missing);
12030
12124
  var toOption = (value3) => value3 === missing ? none2() : some2(value3);
12031
12125
  var fromOptionExit = (option2) => option2._tag === "None" ? missingExit : succeed6(option2.value);
12032
12126
 
12033
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/SchemaIssue.js
12127
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaIssue.js
12034
12128
  var TypeId7 = "~effect/SchemaIssue/Issue";
12035
12129
  function isIssue(u) {
12036
12130
  return hasProperty(u, TypeId7) && u[TypeId7] === TypeId7;
@@ -12088,9 +12182,9 @@ var Pointer = class extends IssueNodeImpl {
12088
12182
  * The issue that occurred.
12089
12183
  */
12090
12184
  issue;
12091
- constructor(path22, issue) {
12185
+ constructor(path23, issue) {
12092
12186
  super();
12093
- this.path = path22;
12187
+ this.path = path23;
12094
12188
  this.issue = issue;
12095
12189
  }
12096
12190
  };
@@ -12275,43 +12369,43 @@ function getExpectedMessage(expected, issue) {
12275
12369
  const input = formatInput(issue);
12276
12370
  return input === void 0 ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;
12277
12371
  }
12278
- function toDefaultIssues(issue, path22, leafHook, checkHook) {
12372
+ function toDefaultIssues(issue, path23, leafHook, checkHook) {
12279
12373
  switch (issue._tag) {
12280
12374
  case "Filter": {
12281
12375
  const message = checkHook(issue);
12282
12376
  if (message !== void 0) {
12283
12377
  return [{
12284
- path: path22,
12378
+ path: path23,
12285
12379
  message
12286
12380
  }];
12287
12381
  }
12288
12382
  if (issue.issue._tag !== "InvalidValue") {
12289
- return toDefaultIssues(issue.issue, path22, leafHook, checkHook);
12383
+ return toDefaultIssues(issue.issue, path23, leafHook, checkHook);
12290
12384
  }
12291
12385
  const expected = findExpected(issue.issue);
12292
12386
  return [{
12293
- path: path22,
12387
+ path: path23,
12294
12388
  message: expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue)
12295
12389
  }];
12296
12390
  }
12297
12391
  case "Encoding":
12298
- return toDefaultIssues(issue.issue, path22, leafHook, checkHook);
12392
+ return toDefaultIssues(issue.issue, path23, leafHook, checkHook);
12299
12393
  case "Pointer":
12300
- return toDefaultIssues(issue.issue, [...path22, ...issue.path], leafHook, checkHook);
12394
+ return toDefaultIssues(issue.issue, [...path23, ...issue.path], leafHook, checkHook);
12301
12395
  case "Composite":
12302
- return issue.issues.flatMap((issue2) => toDefaultIssues(issue2, path22, leafHook, checkHook));
12396
+ return issue.issues.flatMap((issue2) => toDefaultIssues(issue2, path23, leafHook, checkHook));
12303
12397
  case "AnyOf": {
12304
12398
  if (issue.issues.length === 0) {
12305
12399
  return [{
12306
- path: path22,
12400
+ path: path23,
12307
12401
  message: findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue)
12308
12402
  }];
12309
12403
  }
12310
- return issue.issues.flatMap((issue2) => toDefaultIssues(issue2, path22, leafHook, checkHook));
12404
+ return issue.issues.flatMap((issue2) => toDefaultIssues(issue2, path23, leafHook, checkHook));
12311
12405
  }
12312
12406
  default:
12313
12407
  return [{
12314
- path: path22,
12408
+ path: path23,
12315
12409
  message: leafHook(issue)
12316
12410
  }];
12317
12411
  }
@@ -12330,7 +12424,7 @@ function makeFormatterDefault() {
12330
12424
  return (issue) => formatIssue(issue, "");
12331
12425
  }
12332
12426
  var defaultFormatter = /* @__PURE__ */ makeFormatterDefault();
12333
- function formatIssue(issue, path22) {
12427
+ function formatIssue(issue, path23) {
12334
12428
  let message;
12335
12429
  switch (issue._tag) {
12336
12430
  case "Filter": {
@@ -12339,7 +12433,7 @@ function formatIssue(issue, path22) {
12339
12433
  message = annotated;
12340
12434
  } else {
12341
12435
  if (issue.issue._tag !== "InvalidValue") {
12342
- return formatIssue(issue.issue, path22);
12436
+ return formatIssue(issue.issue, path23);
12343
12437
  }
12344
12438
  const expected = findExpected(issue.issue);
12345
12439
  message = expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);
@@ -12347,13 +12441,13 @@ function formatIssue(issue, path22) {
12347
12441
  break;
12348
12442
  }
12349
12443
  case "Encoding":
12350
- return formatIssue(issue.issue, path22);
12444
+ return formatIssue(issue.issue, path23);
12351
12445
  case "Pointer":
12352
- return formatIssue(issue.issue, path22 + formatPath(issue.path));
12446
+ return formatIssue(issue.issue, path23 + formatPath(issue.path));
12353
12447
  case "Composite":
12354
12448
  case "AnyOf": {
12355
12449
  if (issue._tag === "Composite" || issue.issues.length > 0) {
12356
- return issue.issues.map((issue2) => formatIssue(issue2, path22)).join("\n");
12450
+ return issue.issues.map((issue2) => formatIssue(issue2, path23)).join("\n");
12357
12451
  }
12358
12452
  message = findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);
12359
12453
  break;
@@ -12362,8 +12456,8 @@ function formatIssue(issue, path22) {
12362
12456
  message = defaultLeafHook(issue);
12363
12457
  break;
12364
12458
  }
12365
- return path22 ? `${message}
12366
- at ${path22}` : message;
12459
+ return path23 ? `${message}
12460
+ at ${path23}` : message;
12367
12461
  }
12368
12462
  function findMessage(issue) {
12369
12463
  if (issue._tag === "Pointer") return;
@@ -12373,7 +12467,7 @@ function findMessage(issue) {
12373
12467
  if (typeof message === "string") return message;
12374
12468
  }
12375
12469
 
12376
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/cause.js
12470
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/cause.js
12377
12471
  function getSchemaIssue(cause) {
12378
12472
  let issue;
12379
12473
  for (const reason of cause.reasons) {
@@ -12394,7 +12488,7 @@ function getSchemaIssueOrThrow(cause, message) {
12394
12488
  return issue;
12395
12489
  }
12396
12490
 
12397
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/DateTime.js
12491
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/DateTime.js
12398
12492
  var isDateTime2 = isDateTime;
12399
12493
  var isTimeZone2 = isTimeZone;
12400
12494
  var isTimeZoneOffset2 = isTimeZoneOffset;
@@ -12417,7 +12511,7 @@ var toEpochMillis2 = toEpochMillis;
12417
12511
  var formatIso2 = formatIso;
12418
12512
  var formatIsoZoned2 = formatIsoZoned;
12419
12513
 
12420
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/SchemaGetter.js
12514
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaGetter.js
12421
12515
  var Getter = class extends Class {
12422
12516
  run;
12423
12517
  constructor(run2) {
@@ -12697,7 +12791,7 @@ function collectBracketPathEntries(isLeaf) {
12697
12791
  };
12698
12792
  }
12699
12793
 
12700
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/ByteSize.js
12794
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/ByteSize.js
12701
12795
  var bigint03 = /* @__PURE__ */ BigInt(0);
12702
12796
  var bigint13 = /* @__PURE__ */ BigInt(1);
12703
12797
  var decimalBase = /* @__PURE__ */ BigInt(1e3);
@@ -12823,7 +12917,7 @@ var isByteSize = (input) => typeof input === "bigint" && input >= bigint03;
12823
12917
  var toBigInt = (self) => self;
12824
12918
  var toNumber2 = toNumber;
12825
12919
 
12826
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/SchemaTransformation.js
12920
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaTransformation.js
12827
12921
  var Middleware = class {
12828
12922
  _tag = "Middleware";
12829
12923
  decode;
@@ -13017,7 +13111,7 @@ function fromJsonString(options) {
13017
13111
  var fromFormData = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeFormData(), /* @__PURE__ */ encodeFormData());
13018
13112
  var fromURLSearchParams = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeURLSearchParams(), /* @__PURE__ */ encodeURLSearchParams());
13019
13113
 
13020
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/SchemaAST.js
13114
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaAST.js
13021
13115
  function makeGuard(tag2) {
13022
13116
  return (ast) => ast._tag === tag2;
13023
13117
  }
@@ -13236,10 +13330,13 @@ var Enum = class extends ASTNodeImpl {
13236
13330
  return this.enums.map(([_, value3]) => JSON.stringify(value3)).join(" | ");
13237
13331
  }
13238
13332
  };
13239
- function isTemplateLiteralPart(ast, path22, validated) {
13333
+ function formatTemplateLiteralPath(path23) {
13334
+ return typeof path23 === "number" ? `parts[${path23}]` : path23;
13335
+ }
13336
+ function isTemplateLiteralPart(ast, path23, validated) {
13240
13337
  if (validated.has(ast)) return true;
13241
13338
  if (ast.encoding) {
13242
- throw new Error(`TemplateLiteral parts cannot have an encoding at ${path22}`);
13339
+ throw new Error(`TemplateLiteral parts cannot have an encoding at ${formatTemplateLiteralPath(path23)}`);
13243
13340
  }
13244
13341
  let valid;
13245
13342
  switch (ast._tag) {
@@ -13251,12 +13348,16 @@ function isTemplateLiteralPart(ast, path22, validated) {
13251
13348
  case "Literal":
13252
13349
  valid = !ast.checks;
13253
13350
  break;
13254
- case "TemplateLiteral":
13255
- valid = !ast.checks && ast.parts.every((part, index2) => isTemplateLiteralPart(part, `${path22}.parts[${index2}]`, validated));
13351
+ case "TemplateLiteral": {
13352
+ const currentPath = formatTemplateLiteralPath(path23);
13353
+ valid = !ast.checks && ast.parts.every((part, index2) => isTemplateLiteralPart(part, `${currentPath}.parts[${index2}]`, validated));
13256
13354
  break;
13257
- case "Union":
13258
- valid = !ast.checks && ast.types.every((part, index2) => isTemplateLiteralPart(part, `${path22}.types[${index2}]`, validated));
13355
+ }
13356
+ case "Union": {
13357
+ const currentPath = formatTemplateLiteralPath(path23);
13358
+ valid = !ast.checks && ast.types.every((part, index2) => isTemplateLiteralPart(part, `${currentPath}.types[${index2}]`, validated));
13259
13359
  break;
13360
+ }
13260
13361
  default:
13261
13362
  return false;
13262
13363
  }
@@ -13276,10 +13377,10 @@ var TemplateLiteral = class extends ASTNodeImpl {
13276
13377
  super(annotations, checks, encoding, context2);
13277
13378
  const encodedParts = [];
13278
13379
  const literals = [];
13279
- const validated = /* @__PURE__ */ new WeakSet();
13380
+ const validated = /* @__PURE__ */ new Set();
13280
13381
  for (let index2 = 0; index2 < parts.length; index2++) {
13281
13382
  const part = parts[index2];
13282
- if (!isTemplateLiteralPart(part, `parts[${index2}]`, validated)) {
13383
+ if (!isTemplateLiteralPart(part, index2, validated)) {
13283
13384
  throw new Error(`Invalid TemplateLiteral part ${part._tag}`);
13284
13385
  }
13285
13386
  encodedParts.push(part);
@@ -13714,8 +13815,22 @@ function isIndexSignatureParameterSide(ast) {
13714
13815
  return false;
13715
13816
  }
13716
13817
  }
13818
+ function isIndexSignatureParameterEncodedSide(ast) {
13819
+ const encoded = getLastEncoding(ast);
13820
+ switch (encoded._tag) {
13821
+ case "String":
13822
+ case "Number":
13823
+ case "Symbol":
13824
+ case "TemplateLiteral":
13825
+ return true;
13826
+ case "Union":
13827
+ return encoded.types.every(isIndexSignatureParameterEncodedSide);
13828
+ default:
13829
+ return false;
13830
+ }
13831
+ }
13717
13832
  function isIndexSignatureParameter(ast) {
13718
- return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded(ast));
13833
+ return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterEncodedSide(ast);
13719
13834
  }
13720
13835
  var IndexSignature = class {
13721
13836
  parameter;
@@ -13741,7 +13856,16 @@ var Objects = class extends ASTNodeImpl {
13741
13856
  this.propertySignatures = propertySignatures;
13742
13857
  this.indexSignatures = indexSignatures;
13743
13858
  this.encodingChecks = encodingChecks;
13744
- const duplicates = propertySignatures.map((ps) => ps.name).filter((name, i, arr) => arr.indexOf(name) !== i);
13859
+ const seen = /* @__PURE__ */ new Set();
13860
+ const duplicates = [];
13861
+ for (const propertySignature of propertySignatures) {
13862
+ const name = propertySignature.name;
13863
+ if (seen.has(name)) {
13864
+ duplicates.push(name);
13865
+ } else {
13866
+ seen.add(name);
13867
+ }
13868
+ }
13745
13869
  if (duplicates.length > 0) {
13746
13870
  throw new Error(`Duplicate identifiers: ${JSON.stringify(duplicates)}. ts(2300)`);
13747
13871
  }
@@ -14421,18 +14545,6 @@ function formatIsMutable(isMutable2) {
14421
14545
  function formatIsOptional(isOptional2) {
14422
14546
  return isOptional2 ? "?" : "";
14423
14547
  }
14424
- function memoizeThunk(f) {
14425
- let done2 = false;
14426
- let a;
14427
- return () => {
14428
- if (done2) {
14429
- return a;
14430
- }
14431
- a = f();
14432
- done2 = true;
14433
- return a;
14434
- };
14435
- }
14436
14548
  var Suspend = class extends ASTNodeImpl {
14437
14549
  _tag = "Suspend";
14438
14550
  thunk;
@@ -14441,7 +14553,8 @@ var Suspend = class extends ASTNodeImpl {
14441
14553
  throw new Error("Cannot add checks to Suspend");
14442
14554
  }
14443
14555
  super(annotations, void 0, encoding, context2);
14444
- this.thunk = memoizeThunk(thunk);
14556
+ let ast;
14557
+ this.thunk = () => ast ??= thunk();
14445
14558
  }
14446
14559
  /** @internal */
14447
14560
  getParser(compile) {
@@ -15088,7 +15201,7 @@ var StringTree = /* @__PURE__ */ new Declaration([], () => (input, ast, options)
15088
15201
  });
15089
15202
  var unknownToStringTree = /* @__PURE__ */ new Link(StringTree, /* @__PURE__ */ passthrough2());
15090
15203
 
15091
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Chunk.js
15204
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Chunk.js
15092
15205
  var TypeId10 = "~effect/Chunk";
15093
15206
  function copy(src, srcPos, dest, destPos, len) {
15094
15207
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
@@ -15272,7 +15385,7 @@ var getUnsafe2 = /* @__PURE__ */ dual(2, (self, index2) => {
15272
15385
  });
15273
15386
  var size = (self) => self.length;
15274
15387
 
15275
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Schema.js
15388
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js
15276
15389
  var Schema_exports = {};
15277
15390
  __export(Schema_exports, {
15278
15391
  Any: () => Any2,
@@ -15592,7 +15705,7 @@ __export(Schema_exports, {
15592
15705
  withDecodingDefaultTypeKey: () => withDecodingDefaultTypeKey
15593
15706
  });
15594
15707
 
15595
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/hashMap.js
15708
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/hashMap.js
15596
15709
  var HashMapTypeId = "~effect/HashMap";
15597
15710
  var SHIFT = 5;
15598
15711
  var BUCKET_SIZE = 1 << SHIFT;
@@ -16236,14 +16349,14 @@ var entries = (self) => {
16236
16349
  };
16237
16350
  var size2 = (self) => self.size;
16238
16351
 
16239
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/HashMap.js
16352
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/HashMap.js
16240
16353
  var isHashMap2 = isHashMap;
16241
16354
  var fromIterable4 = fromIterable3;
16242
16355
  var entries2 = entries;
16243
16356
  var toEntries = (self) => Array.from(entries2(self));
16244
16357
  var size3 = size2;
16245
16358
 
16246
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/hashSet.js
16359
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/hashSet.js
16247
16360
  var HashSetTypeId = "~effect/HashSet";
16248
16361
  var HashSetProto = {
16249
16362
  [symbol]() {
@@ -16297,12 +16410,12 @@ var every2 = (self, predicate) => {
16297
16410
  return true;
16298
16411
  };
16299
16412
 
16300
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/HashSet.js
16413
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/HashSet.js
16301
16414
  var fromIterable6 = fromIterable5;
16302
16415
  var isHashSet2 = isHashSet;
16303
16416
  var size5 = size4;
16304
16417
 
16305
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/graph.js
16418
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/graph.js
16306
16419
  var TypeId11 = "~effect/Graph";
16307
16420
  var isGraph = (u) => hasProperty(u, TypeId11);
16308
16421
  var toImpl = (graph) => graph;
@@ -16424,11 +16537,12 @@ var hydrate = (snapshot2) => {
16424
16537
  return graph;
16425
16538
  };
16426
16539
 
16427
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/SchemaParser.js
16540
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaParser.js
16428
16541
  function makeEffect(schema) {
16429
- const parser = runWithCompiler(constructorCompiler, toType(schema.ast));
16542
+ const ast = schema.ast;
16543
+ let parser;
16430
16544
  return (input, options) => {
16431
- return parser(input, options?.disableChecks ? options?.parseOptions ? {
16545
+ return (parser ??= runWithCompiler(constructorCompiler, toType(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
16432
16546
  ...options.parseOptions,
16433
16547
  disableChecks: true
16434
16548
  } : {
@@ -16716,7 +16830,7 @@ function makeParser(ast, compile, compileConstructorDefault2, constructorDefault
16716
16830
  };
16717
16831
  }
16718
16832
 
16719
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/make.js
16833
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/make.js
16720
16834
  var TypeId12 = "~effect/Schema/Schema";
16721
16835
  var SchemaProto = {
16722
16836
  [TypeId12]: TypeId12,
@@ -16736,9 +16850,14 @@ var SchemaProto = {
16736
16850
  function make16(ast, options) {
16737
16851
  function Schema() {
16738
16852
  }
16739
- const self = Object.defineProperties(Object.setPrototypeOf(Schema, SchemaProto), Object.getOwnPropertyDescriptors({
16740
- ...options
16741
- }));
16853
+ const self = Object.setPrototypeOf(Schema, SchemaProto);
16854
+ if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) {
16855
+ Object.defineProperties(self, Object.getOwnPropertyDescriptors({
16856
+ ...options
16857
+ }));
16858
+ } else {
16859
+ Object.assign(self, options);
16860
+ }
16742
16861
  self.ast = ast;
16743
16862
  self.rebuild = (ast2) => make16(ast2, options);
16744
16863
  self.makeEffect = makeEffect(self);
@@ -16747,7 +16866,7 @@ function make16(ast, options) {
16747
16866
  return self;
16748
16867
  }
16749
16868
 
16750
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/JsonPointer.js
16869
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/JsonPointer.js
16751
16870
  function escapeToken(token) {
16752
16871
  return token.replace(/~/g, "~0").replace(/\//g, "~1");
16753
16872
  }
@@ -16773,11 +16892,11 @@ function parseUriFragment(fragment) {
16773
16892
  const pointer = decodeUriFragment(fragment);
16774
16893
  return pointer === void 0 ? void 0 : pointer.length === 0 ? [] : pointer.slice(1).split("/").map(unescapeToken);
16775
16894
  }
16776
- function formatUriFragment(path22) {
16777
- return path22.reduce((fragment, token) => `${fragment}/${formatUriFragmentToken(token)}`, "#");
16895
+ function formatUriFragment(path23) {
16896
+ return path23.reduce((fragment, token) => `${fragment}/${formatUriFragmentToken(token)}`, "#");
16778
16897
  }
16779
16898
 
16780
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/JsonSchema.js
16899
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/JsonSchema.js
16781
16900
  var META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema#";
16782
16901
  var META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
16783
16902
  function isMetaSchemaUri(value3, uri) {
@@ -17137,7 +17256,7 @@ function convertLegacyId(source, out, targetKey, dialect) {
17137
17256
  }
17138
17257
  }
17139
17258
 
17140
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toCodec.js
17259
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toCodec.js
17141
17260
  function toCodecJson(schema) {
17142
17261
  return make16(toCodecJsonAST(schema.ast), {
17143
17262
  schema
@@ -17356,20 +17475,20 @@ function toCodecArrayFromSingleASTStep(ast) {
17356
17475
  return ast._tag === "Declaration" || ast._tag === "Arrays" || ast._tag === "Objects" || ast._tag === "Union" || ast._tag === "Suspend" ? ast.recur(toCodecArrayFromSingleAST) : ast;
17357
17476
  }
17358
17477
 
17359
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/RegExp.js
17478
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/RegExp.js
17360
17479
  var RegExp2 = globalThis.RegExp;
17361
17480
  var escape = (string3) => string3.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
17362
17481
 
17363
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/errors.js
17364
- function errorWithPath(message, path22) {
17365
- if (path22.length > 0) {
17482
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/errors.js
17483
+ function errorWithPath(message, path23) {
17484
+ if (path23.length > 0) {
17366
17485
  message += `
17367
- at ${formatPath(path22)}`;
17486
+ at ${formatPath(path23)}`;
17368
17487
  }
17369
17488
  return new Error(message);
17370
17489
  }
17371
17490
 
17372
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
17491
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
17373
17492
  function formatDefinitionReference(key) {
17374
17493
  return `#/$defs/${formatUriFragmentToken(key)}`;
17375
17494
  }
@@ -17526,11 +17645,11 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17526
17645
  schemas,
17527
17646
  definitions
17528
17647
  };
17529
- function compileDefinition(key, path22) {
17648
+ function compileDefinition(key, path23) {
17530
17649
  const compiled = definitionStates.get(key);
17531
17650
  if (compiled !== void 0) return typeof compiled === "string" ? compiled : key;
17532
17651
  if (!Object.hasOwn(references, key)) {
17533
- throw errorWithPath(`Invalid reference ${key}`, [...path22, "$ref"]);
17652
+ throw errorWithPath(`Invalid reference ${key}`, [...path23, "$ref"]);
17534
17653
  }
17535
17654
  definitionStates.set(key, null);
17536
17655
  const representation = references[key];
@@ -17571,14 +17690,14 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17571
17690
  const annotations = representation.checks.length === 0 ? representation.annotations : representation.checks[representation.checks.length - 1].annotations;
17572
17691
  return typeof annotations?.identifier !== "string" && typeof annotations?.[IDENTIFIER_FALLBACK_KEY] === "string" ? annotations[IDENTIFIER_FALLBACK_KEY] : void 0;
17573
17692
  }
17574
- function annotationSchemas(representation, path22) {
17575
- return representation?.schemas?.map((schema, index2) => recur2(schema, [...path22, "schemas", index2])) ?? [];
17693
+ function annotationSchemas(representation, path23) {
17694
+ return representation?.schemas?.map((schema, index2) => recur2(schema, [...path23, "schemas", index2])) ?? [];
17576
17695
  }
17577
- function compileCheck(check2, type, path22) {
17696
+ function compileCheck(check2, type, path23) {
17578
17697
  const annotations = check2.annotations;
17579
17698
  const callback2 = annotations?.toJsonSchema;
17580
17699
  if (callback2 !== void 0) {
17581
- const schemas2 = annotationSchemas(check2.representation, [...path22, "representation"]);
17700
+ const schemas2 = annotationSchemas(check2.representation, [...path23, "representation"]);
17582
17701
  const fragment = callback2({
17583
17702
  type,
17584
17703
  schemas: schemas2
@@ -17592,7 +17711,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17592
17711
  return check2._tag === "Filter" && hasOnlyKeywords(schema, allowed) && (ordinary2 === void 0 || hasOnlyKeywords(ordinary2, promotableAnnotationKeywords)) ? [schema, true] : [schema];
17593
17712
  }
17594
17713
  if (check2._tag === "Filter") return void 0;
17595
- const children = check2.checks.map((child, index2) => compileCheck(child, type, [...path22, "checks", index2])).filter((child) => child !== void 0);
17714
+ const children = check2.checks.map((child, index2) => compileCheck(child, type, [...path23, "checks", index2])).filter((child) => child !== void 0);
17596
17715
  if (children.length === 0) return void 0;
17597
17716
  const ordinary = collectJsonSchemaAnnotations(annotations, options);
17598
17717
  const allOf = children.map(([schema]) => schema);
@@ -17603,16 +17722,16 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17603
17722
  ...ordinary
17604
17723
  }];
17605
17724
  }
17606
- function recur2(representation, path22) {
17725
+ function recur2(representation, path23) {
17607
17726
  if (representation._tag === "Reference") {
17608
- const canonical = compileDefinition(representation.$ref, path22);
17727
+ const canonical = compileDefinition(representation.$ref, path23);
17609
17728
  return {
17610
17729
  $ref: formatDefinitionReference(canonical)
17611
17730
  };
17612
17731
  }
17613
17732
  const cached2 = compiledRepresentations.get(representation);
17614
17733
  if (cached2 !== void 0) return cached2;
17615
- let output = on(representation, path22);
17734
+ let output = on(representation, path23);
17616
17735
  const ordinary = collectJsonSchemaAnnotations(representation.annotations, options);
17617
17736
  if (ordinary !== void 0) {
17618
17737
  output = {
@@ -17622,7 +17741,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17622
17741
  }
17623
17742
  for (let index2 = 0; index2 < representation.checks.length; index2++) {
17624
17743
  const type = typeof output.type === "string" && isJsonSchemaType(output.type) ? output.type : void 0;
17625
- const check2 = compileCheck(representation.checks[index2], type, [...path22, "checks", index2]);
17744
+ const check2 = compileCheck(representation.checks[index2], type, [...path23, "checks", index2]);
17626
17745
  if (check2 !== void 0) {
17627
17746
  output = appendJsonSchema(output, ...check2);
17628
17747
  }
@@ -17630,7 +17749,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17630
17749
  compiledRepresentations.set(representation, output);
17631
17750
  return output;
17632
17751
  }
17633
- function on(representation, path22) {
17752
+ function on(representation, path23) {
17634
17753
  switch (representation._tag) {
17635
17754
  case "Any":
17636
17755
  case "Unknown":
@@ -17674,7 +17793,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17674
17793
  return {};
17675
17794
  }
17676
17795
  case "Suspend":
17677
- return recur2(representation.thunk, [...path22, "thunk"]);
17796
+ return recur2(representation.thunk, [...path23, "thunk"]);
17678
17797
  case "Never":
17679
17798
  return {
17680
17799
  not: {}
@@ -17709,7 +17828,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17709
17828
  case "Enum": {
17710
17829
  const types = representation.enums.map(([title, literal], index2) => {
17711
17830
  if (typeof literal === "number" && !globalThis.Number.isFinite(literal)) {
17712
- throw errorWithPath(`Invalid numeric enum value ${globalThis.String(literal)}`, [...path22, "enums", index2, 1]);
17831
+ throw errorWithPath(`Invalid numeric enum value ${globalThis.String(literal)}`, [...path23, "enums", index2, 1]);
17713
17832
  }
17714
17833
  return {
17715
17834
  type: typeof literal,
@@ -17730,7 +17849,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17730
17849
  };
17731
17850
  case "Arrays": {
17732
17851
  if (representation.rest.length > 1) {
17733
- throw errorWithPath("Invalid schema representation document", [...path22, "rest"]);
17852
+ throw errorWithPath("Invalid schema representation document", [...path23, "rest"]);
17734
17853
  }
17735
17854
  const out = {
17736
17855
  type: "array"
@@ -17738,7 +17857,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17738
17857
  let minItems = representation.elements.length;
17739
17858
  const prefixItems = representation.elements.map((element, index2) => {
17740
17859
  if (element.isOptional) minItems--;
17741
- const compiled = recur2(element.type, [...path22, "elements", index2, "type"]);
17860
+ const compiled = recur2(element.type, [...path23, "elements", index2, "type"]);
17742
17861
  const annotations = collectJsonSchemaAnnotations(element.annotations, options);
17743
17862
  return annotations === void 0 ? compiled : appendJsonSchema(compiled, annotations);
17744
17863
  });
@@ -17751,7 +17870,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17751
17870
  }
17752
17871
  if (representation.rest.length === 1) {
17753
17872
  delete out.maxItems;
17754
- const rest = recur2(representation.rest[0], [...path22, "rest", 0]);
17873
+ const rest = recur2(representation.rest[0], [...path23, "rest", 0]);
17755
17874
  if (Object.keys(rest).length > 0) out.items = rest;
17756
17875
  else delete out.items;
17757
17876
  }
@@ -17773,10 +17892,10 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17773
17892
  for (let index2 = 0; index2 < representation.propertySignatures.length; index2++) {
17774
17893
  const property = representation.propertySignatures[index2];
17775
17894
  if (typeof property.name !== "string") {
17776
- throw errorWithPath("Invalid schema representation document", [...path22, "propertySignatures", index2, "name"]);
17895
+ throw errorWithPath("Invalid schema representation document", [...path23, "propertySignatures", index2, "name"]);
17777
17896
  }
17778
17897
  const name = property.name;
17779
- const compiled = recur2(property.type, [...path22, "propertySignatures", index2, "type"]);
17898
+ const compiled = recur2(property.type, [...path23, "propertySignatures", index2, "type"]);
17780
17899
  const annotations = collectJsonSchemaAnnotations(property.annotations, options);
17781
17900
  assignProperty(properties, name, annotations === void 0 ? compiled : appendJsonSchema(compiled, annotations));
17782
17901
  if (!property.isOptional) required2.push(name);
@@ -17789,12 +17908,12 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17789
17908
  let hasUnrepresentableIndexPattern = false;
17790
17909
  for (let index2 = 0; index2 < representation.indexSignatures.length; index2++) {
17791
17910
  const signature = representation.indexSignatures[index2];
17792
- let type = recur2(signature.type, [...path22, "indexSignatures", index2, "type"]);
17911
+ let type = recur2(signature.type, [...path23, "indexSignatures", index2, "type"]);
17793
17912
  if (equals(type, {
17794
17913
  not: {}
17795
17914
  })) type = false;
17796
17915
  indexValueSchemas.push(type);
17797
- const patterns = getParameterPatterns(signature.parameter, [...path22, "indexSignatures", index2, "parameter"], /* @__PURE__ */ new Set());
17916
+ const patterns = getParameterPatterns(signature.parameter, [...path23, "indexSignatures", index2, "parameter"], /* @__PURE__ */ new Set());
17798
17917
  if (patterns === void 0) {
17799
17918
  hasUnrepresentableIndexPattern = true;
17800
17919
  continue;
@@ -17820,7 +17939,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17820
17939
  });
17821
17940
  }
17822
17941
  for (let index2 = 0; index2 < representation.indexSignatures.length; index2++) {
17823
- propertyNames.push(recur2(representation.indexSignatures[index2].parameter, [...path22, "indexSignatures", index2, "parameter"]));
17942
+ propertyNames.push(recur2(representation.indexSignatures[index2].parameter, [...path23, "indexSignatures", index2, "parameter"]));
17824
17943
  }
17825
17944
  out.propertyNames = propertyNames.length === 1 ? propertyNames[0] : {
17826
17945
  anyOf: propertyNames
@@ -17850,7 +17969,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17850
17969
  return out;
17851
17970
  }
17852
17971
  case "Union": {
17853
- const types = representation.types.map((type, index2) => recur2(type, [...path22, "types", index2]));
17972
+ const types = representation.types.map((type, index2) => recur2(type, [...path23, "types", index2]));
17854
17973
  if (types.length === 0) return {
17855
17974
  not: {}
17856
17975
  };
@@ -17867,13 +17986,13 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17867
17986
  }
17868
17987
  }
17869
17988
  }
17870
- function getParameterPatterns(parameter, path22, seenReferences) {
17989
+ function getParameterPatterns(parameter, path23, seenReferences) {
17871
17990
  switch (parameter._tag) {
17872
17991
  case "Reference": {
17873
17992
  if (!Object.hasOwn(references, parameter.$ref)) {
17874
- throw errorWithPath(`Invalid reference ${parameter.$ref}`, [...path22, "$ref"]);
17993
+ throw errorWithPath(`Invalid reference ${parameter.$ref}`, [...path23, "$ref"]);
17875
17994
  }
17876
- compileDefinition(parameter.$ref, path22);
17995
+ compileDefinition(parameter.$ref, path23);
17877
17996
  if (seenReferences.has(parameter.$ref)) return void 0;
17878
17997
  const next = new Set(seenReferences).add(parameter.$ref);
17879
17998
  return getParameterPatterns(references[parameter.$ref], ["references", parameter.$ref], next);
@@ -17883,7 +18002,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17883
18002
  if (parameter.checks.length !== 1 || parameter.checks[0]._tag !== "Filter" || parameter.checks[0].annotations?.toJsonSchema === void 0) {
17884
18003
  return void 0;
17885
18004
  }
17886
- const schema = recur2(parameter, path22);
18005
+ const schema = recur2(parameter, path23);
17887
18006
  return schema.type === "string" && typeof schema.pattern === "string" && hasOnlyKeywords(schema, "|type|pattern|title|description|default|examples|readOnly|writeOnly|") ? [schema.pattern] : void 0;
17888
18007
  }
17889
18008
  case "TemplateLiteral":
@@ -17894,7 +18013,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17894
18013
  }
17895
18014
  const patterns = [];
17896
18015
  for (let index2 = 0; index2 < parameter.types.length; index2++) {
17897
- const memberPatterns = getParameterPatterns(parameter.types[index2], [...path22, "types", index2], seenReferences);
18016
+ const memberPatterns = getParameterPatterns(parameter.types[index2], [...path23, "types", index2], seenReferences);
17898
18017
  if (memberPatterns === void 0) return void 0;
17899
18018
  if (memberPatterns.length === 0) return [];
17900
18019
  patterns.push(...memberPatterns);
@@ -17902,7 +18021,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
17902
18021
  return patterns;
17903
18022
  }
17904
18023
  default:
17905
- throw errorWithPath("Invalid schema representation document", path22);
18024
+ throw errorWithPath("Invalid schema representation document", path23);
17906
18025
  }
17907
18026
  }
17908
18027
  }
@@ -17954,7 +18073,7 @@ function toJsonSchemaDocument(document, options) {
17954
18073
  };
17955
18074
  }
17956
18075
 
17957
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toRepresentation.js
18076
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toRepresentation.js
17958
18077
  var defaultReferencePolicy = ({
17959
18078
  identifier: identifier2
17960
18079
  }) => identifier2;
@@ -18271,7 +18390,7 @@ function toRepresentations(asts, options) {
18271
18390
  }
18272
18391
  }
18273
18392
 
18274
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/standardSchema.js
18393
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/standardSchema.js
18275
18394
  function makeStandardResult(exit3) {
18276
18395
  return isSuccess3(exit3) ? exit3.value : {
18277
18396
  issues: [{
@@ -18371,31 +18490,31 @@ function toStandardJSONSchemaV1(self) {
18371
18490
  });
18372
18491
  }
18373
18492
 
18374
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/JsonPatch.js
18493
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/JsonPatch.js
18375
18494
  function get3(oldValue, newValue) {
18376
18495
  const patches = [];
18377
18496
  getLoop(oldValue, newValue, "", patches);
18378
18497
  return patches;
18379
18498
  }
18380
- function getLoop(oldValue, newValue, path22, patches) {
18499
+ function getLoop(oldValue, newValue, path23, patches) {
18381
18500
  if (Object.is(oldValue, newValue)) return;
18382
18501
  if (Array.isArray(oldValue) && Array.isArray(newValue)) {
18383
18502
  const len1 = oldValue.length;
18384
18503
  const len2 = newValue.length;
18385
18504
  const shared = Math.min(len1, len2);
18386
18505
  for (let i = 0; i < shared; i++) {
18387
- getLoop(oldValue[i], newValue[i], `${path22}/${i}`, patches);
18506
+ getLoop(oldValue[i], newValue[i], `${path23}/${i}`, patches);
18388
18507
  }
18389
18508
  for (let i = len1 - 1; i >= len2; i--) {
18390
18509
  patches.push({
18391
18510
  op: "remove",
18392
- path: `${path22}/${i}`
18511
+ path: `${path23}/${i}`
18393
18512
  });
18394
18513
  }
18395
18514
  for (let i = len1; i < len2; i++) {
18396
18515
  patches.push({
18397
18516
  op: "add",
18398
- path: `${path22}/${i}`,
18517
+ path: `${path23}/${i}`,
18399
18518
  value: newValue[i]
18400
18519
  });
18401
18520
  }
@@ -18406,7 +18525,7 @@ function getLoop(oldValue, newValue, path22, patches) {
18406
18525
  const keys22 = Object.keys(newValue);
18407
18526
  const allKeys = Array.from(/* @__PURE__ */ new Set([...keys1, ...keys22])).sort();
18408
18527
  for (const key of allKeys) {
18409
- const keyPath = `${path22}/${escapeToken(key)}`;
18528
+ const keyPath = `${path23}/${escapeToken(key)}`;
18410
18529
  const hasKey1 = Object.hasOwn(oldValue, key);
18411
18530
  const hasKey2 = Object.hasOwn(newValue, key);
18412
18531
  if (hasKey1 && hasKey2) {
@@ -18428,7 +18547,7 @@ function getLoop(oldValue, newValue, path22, patches) {
18428
18547
  }
18429
18548
  patches.push({
18430
18549
  op: "replace",
18431
- path: path22,
18550
+ path: path23,
18432
18551
  value: newValue
18433
18552
  });
18434
18553
  }
@@ -18552,7 +18671,7 @@ function rebuildFromStack(stack, newParent) {
18552
18671
  return acc;
18553
18672
  }
18554
18673
 
18555
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toDifferJsonPatch.js
18674
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toDifferJsonPatch.js
18556
18675
  function toDifferJsonPatch(schema) {
18557
18676
  const serializer = toCodecJson(schema);
18558
18677
  const get5 = encodeSync(serializer);
@@ -18569,7 +18688,7 @@ function toDifferJsonPatch(schema) {
18569
18688
  };
18570
18689
  }
18571
18690
 
18572
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toEncoderXml.js
18691
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toEncoderXml.js
18573
18692
  function toEncoderXml(codec, options) {
18574
18693
  const rootName = resolveIdentifier(codec.ast) ?? resolveTitle(codec.ast);
18575
18694
  const serialize = encodeEffect(toCodecStringTree(codec));
@@ -18668,20 +18787,20 @@ var xml = {
18668
18787
  }
18669
18788
  };
18670
18789
 
18671
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toEquivalence.js
18790
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toEquivalence.js
18672
18791
  var toEquivalence = /* @__PURE__ */ memoize((ast) => {
18673
18792
  return recur(ast, []);
18674
18793
  });
18675
- function recur(ast, path22) {
18794
+ function recur(ast, path23) {
18676
18795
  const annotation = resolve(ast)?.["toEquivalence"];
18677
18796
  if (annotation) {
18678
- return annotation(isDeclaration(ast) ? ast.typeParameters.map((tp) => recur(tp, path22)) : []);
18797
+ return annotation(isDeclaration(ast) ? ast.typeParameters.map((tp) => recur(tp, path23)) : []);
18679
18798
  }
18680
18799
  switch (ast._tag) {
18681
18800
  case "Never":
18682
18801
  return strictEqual();
18683
18802
  case "Declaration":
18684
- return declarationEquivalence(ast, path22);
18803
+ return declarationEquivalence(ast, path23);
18685
18804
  case "Null":
18686
18805
  case "Undefined":
18687
18806
  case "Void":
@@ -18699,9 +18818,9 @@ function recur(ast, path22) {
18699
18818
  case "TemplateLiteral":
18700
18819
  return equals;
18701
18820
  case "Arrays": {
18702
- const elements = ast.elements.map((e, i) => recur(e, [...path22, i]));
18821
+ const elements = ast.elements.map((e, i) => recur(e, [...path23, i]));
18703
18822
  const len = ast.elements.length;
18704
- const rest = ast.rest.map((r, i) => recur(r, [...path22, len + i]));
18823
+ const rest = ast.rest.map((r, i) => recur(r, [...path23, len + i]));
18705
18824
  return make2((a, b) => {
18706
18825
  if (!Array.isArray(a) || !Array.isArray(b)) {
18707
18826
  return false;
@@ -18736,8 +18855,8 @@ function recur(ast, path22) {
18736
18855
  if (ast.propertySignatures.length === 0 && ast.indexSignatures.length === 0) {
18737
18856
  return equals;
18738
18857
  }
18739
- const propertySignatures = ast.propertySignatures.map((ps) => recur(ps.type, [...path22, ps.name]));
18740
- const indexSignatures = ast.indexSignatures.map((is3) => recur(is3.type, path22));
18858
+ const propertySignatures = ast.propertySignatures.map((ps) => recur(ps.type, [...path23, ps.name]));
18859
+ const indexSignatures = ast.indexSignatures.map((is3) => recur(is3.type, path23));
18741
18860
  return make2((a, b) => {
18742
18861
  if (!isObject(a) || !isObject(b)) {
18743
18862
  return false;
@@ -18773,7 +18892,7 @@ function recur(ast, path22) {
18773
18892
  }
18774
18893
  case "Union": {
18775
18894
  const types = toType(ast).types;
18776
- const compiled = new Map(types.map((candidate, i) => [candidate, [_is(candidate), recur(ast.types[i], path22)]]));
18895
+ const compiled = new Map(types.map((candidate, i) => [candidate, [_is(candidate), recur(ast.types[i], path23)]]));
18777
18896
  return make2((a, b) => {
18778
18897
  const candidates = getCandidates(a, types);
18779
18898
  for (let i = 0; i < candidates.length; i++) {
@@ -18786,42 +18905,42 @@ function recur(ast, path22) {
18786
18905
  });
18787
18906
  }
18788
18907
  case "Suspend": {
18789
- const get5 = memoizeThunk(() => recur(ast.thunk(), path22));
18790
- return make2((a, b) => get5()(a, b));
18908
+ let equivalence;
18909
+ return make2((a, b) => (equivalence ??= recur(ast.thunk(), path23))(a, b));
18791
18910
  }
18792
18911
  }
18793
18912
  }
18794
- function declarationEquivalence(ast, path22) {
18913
+ function declarationEquivalence(ast, path23) {
18795
18914
  const representation = ast.annotations?.representation;
18796
18915
  if (representation === void 0) return equals;
18797
18916
  switch (representation.id) {
18798
18917
  case "effect/schema/Option": {
18799
- const [value3] = declarationTypeParameters(ast, path22);
18918
+ const [value3] = declarationTypeParameters(ast, path23);
18800
18919
  return (a, b) => a._tag === b._tag && (a._tag === "None" || value3(a.value, b.value));
18801
18920
  }
18802
18921
  case "effect/schema/Result": {
18803
- const [success, failure] = declarationTypeParameters(ast, path22);
18922
+ const [success, failure] = declarationTypeParameters(ast, path23);
18804
18923
  return (a, b) => a._tag === b._tag && (a._tag === "Success" ? success(a.success, b.success) : failure(a.failure, b.failure));
18805
18924
  }
18806
18925
  case "effect/schema/CauseReason": {
18807
- const [error, defect] = declarationTypeParameters(ast, path22);
18926
+ const [error, defect] = declarationTypeParameters(ast, path23);
18808
18927
  return causeReasonEquivalence(error, defect);
18809
18928
  }
18810
18929
  case "effect/schema/Cause": {
18811
- const [error, defect] = declarationTypeParameters(ast, path22);
18930
+ const [error, defect] = declarationTypeParameters(ast, path23);
18812
18931
  return causeEquivalence(error, defect);
18813
18932
  }
18814
18933
  case "effect/schema/Exit": {
18815
- const [value3, error, defect] = declarationTypeParameters(ast, path22);
18934
+ const [value3, error, defect] = declarationTypeParameters(ast, path23);
18816
18935
  const cause = causeEquivalence(error, defect);
18817
18936
  return (a, b) => a._tag === b._tag && (a._tag === "Success" ? value3(a.value, b.value) : cause(a.cause, b.cause));
18818
18937
  }
18819
18938
  case "effect/schema/ReadonlyMap": {
18820
- const [key, value3] = declarationTypeParameters(ast, path22);
18939
+ const [key, value3] = declarationTypeParameters(ast, path23);
18821
18940
  return makeCompareMap(key, value3);
18822
18941
  }
18823
18942
  case "effect/schema/ReadonlySet":
18824
- return makeCompareSet(declarationTypeParameters(ast, path22)[0]);
18943
+ return makeCompareSet(declarationTypeParameters(ast, path23)[0]);
18825
18944
  case "effect/schema/RegExp":
18826
18945
  return (a, b) => a.source === b.source && a.flags === b.flags;
18827
18946
  case "effect/schema/URL":
@@ -18830,8 +18949,8 @@ function declarationEquivalence(ast, path22) {
18830
18949
  return equals;
18831
18950
  }
18832
18951
  }
18833
- function declarationTypeParameters(ast, path22) {
18834
- return ast.typeParameters.map((parameter) => recur(parameter, path22));
18952
+ function declarationTypeParameters(ast, path23) {
18953
+ return ast.typeParameters.map((parameter) => recur(parameter, path23));
18835
18954
  }
18836
18955
  function causeReasonEquivalence(error, defect) {
18837
18956
  return (a, b) => {
@@ -18851,7 +18970,7 @@ function causeEquivalence(error, defect) {
18851
18970
  return (a, b) => reasons(a.reasons, b.reasons);
18852
18971
  }
18853
18972
 
18854
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toFormatter.js
18973
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toFormatter.js
18855
18974
  function causeReasonToFormatter(error, defect) {
18856
18975
  return (reason) => {
18857
18976
  switch (reason._tag) {
@@ -19049,14 +19168,14 @@ function toFormatter(ast, options) {
19049
19168
  };
19050
19169
  }
19051
19170
  case "Suspend": {
19052
- const get5 = memoizeThunk(() => recur2(ast2.thunk()));
19053
- return (value3) => get5()(value3);
19171
+ let formatter;
19172
+ return (value3) => (formatter ??= recur2(ast2.thunk()))(value3);
19054
19173
  }
19055
19174
  }
19056
19175
  }
19057
19176
  }
19058
19177
 
19059
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Struct.js
19178
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Struct.js
19060
19179
  var Struct_exports = {};
19061
19180
  __export(Struct_exports, {
19062
19181
  Record: () => Record,
@@ -19162,7 +19281,7 @@ function Record(keys4, value3) {
19162
19281
  return out;
19163
19282
  }
19164
19283
 
19165
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Optic.js
19284
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Optic.js
19166
19285
  function makeIso(get5, set3) {
19167
19286
  return make17(primitiveNode("Iso", get5, set3));
19168
19287
  }
@@ -19188,12 +19307,12 @@ var PathNode = class {
19188
19307
  path;
19189
19308
  get;
19190
19309
  set;
19191
- constructor(path22) {
19192
- this.path = path22;
19310
+ constructor(path23) {
19311
+ this.path = path23;
19193
19312
  this.get = (s) => {
19194
19313
  let out = s;
19195
- for (let i = 0; i < path22.length; i++) {
19196
- out = out[path22[i]];
19314
+ for (let i = 0; i < path23.length; i++) {
19315
+ out = out[path23[i]];
19197
19316
  }
19198
19317
  return out;
19199
19318
  };
@@ -19201,12 +19320,12 @@ var PathNode = class {
19201
19320
  const out = cloneShallow(s);
19202
19321
  let current = out;
19203
19322
  let i = 0;
19204
- for (; i < path22.length - 1; i++) {
19205
- const key = path22[i];
19323
+ for (; i < path23.length - 1; i++) {
19324
+ const key = path23[i];
19206
19325
  assignProperty(current, key, cloneShallow(current[key]));
19207
19326
  current = current[key];
19208
19327
  }
19209
- assignProperty(current, path22[i], a);
19328
+ assignProperty(current, path23[i], a);
19210
19329
  return out;
19211
19330
  };
19212
19331
  }
@@ -19508,7 +19627,7 @@ function id() {
19508
19627
  return identityIso;
19509
19628
  }
19510
19629
 
19511
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schema/toIso.js
19630
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toIso.js
19512
19631
  function toIso(schema) {
19513
19632
  const serializer = toCodecIso(schema);
19514
19633
  return makeIso(encodeSync(serializer), decodeSync(serializer));
@@ -19520,13 +19639,13 @@ function toIsoFocus(_) {
19520
19639
  return id();
19521
19640
  }
19522
19641
 
19523
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/schemaError.js
19642
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schemaError.js
19524
19643
  var SchemaErrorTypeId = "~effect/Schema/SchemaError";
19525
19644
  function isSchemaError(u) {
19526
19645
  return hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;
19527
19646
  }
19528
19647
 
19529
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/internal/redacted.js
19648
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/internal/redacted.js
19530
19649
  var redactedRegistry = /* @__PURE__ */ new WeakMap();
19531
19650
  var value = (self) => {
19532
19651
  if (redactedRegistry.has(self)) {
@@ -19536,7 +19655,7 @@ var value = (self) => {
19536
19655
  }
19537
19656
  };
19538
19657
 
19539
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Redacted.js
19658
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Redacted.js
19540
19659
  var TypeId13 = "~effect/Redacted";
19541
19660
  var isRedacted = (u) => hasProperty(u, TypeId13);
19542
19661
  var make18 = (value3, options) => {
@@ -19569,7 +19688,7 @@ var Proto3 = {
19569
19688
  var value2 = value;
19570
19689
  var makeEquivalence6 = (isEquivalent) => make2((x, y) => isEquivalent(value2(x), value2(y)));
19571
19690
 
19572
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/unstable/http/Cookies.js
19691
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/Cookies.js
19573
19692
  var TypeId14 = "~effect/http/Cookies";
19574
19693
  var isCookies = (u) => hasProperty(u, TypeId14);
19575
19694
  var CookieTypeId = "~effect/http/Cookies/Cookie";
@@ -19890,7 +20009,7 @@ var tryDecodeURIComponent = (str) => {
19890
20009
  }
19891
20010
  };
19892
20011
 
19893
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/unstable/http/Headers.js
20012
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/Headers.js
19894
20013
  var TypeId15 = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
19895
20014
  var isHeaders = (u) => hasProperty(u, TypeId15);
19896
20015
  var Proto5 = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.create(null), {
@@ -19977,7 +20096,7 @@ var CurrentRedactedNames = /* @__PURE__ */ Reference("effect/Headers/CurrentReda
19977
20096
  defaultValue: () => ["authorization", "cookie", "set-cookie", "x-api-key"]
19978
20097
  });
19979
20098
 
19980
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/unstable/http/UrlParams.js
20099
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/UrlParams.js
19981
20100
  var TypeId16 = "~effect/http/UrlParams";
19982
20101
  var isUrlParams = (u) => hasProperty(u, TypeId16);
19983
20102
  var Proto6 = {
@@ -20062,7 +20181,7 @@ var toRecord2 = (self) => {
20062
20181
  };
20063
20182
  var toReadonlyRecord = toRecord2;
20064
20183
 
20065
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/unstable/net/NetAddress.js
20184
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/net/NetAddress.js
20066
20185
  var TypeId17 = "~effect/net/NetAddress";
20067
20186
  var getBytes = (self) => self.bytes;
20068
20187
  var NetAddressError = class extends (/* @__PURE__ */ TaggedError2("NetAddressError")) {
@@ -20428,13 +20547,13 @@ var UnixPathProto = {
20428
20547
  return this.toJSON();
20429
20548
  }
20430
20549
  };
20431
- var unixPathAddress = (path22) => {
20550
+ var unixPathAddress = (path23) => {
20432
20551
  const self = Object.create(UnixPathProto);
20433
- self.path = path22;
20552
+ self.path = path23;
20434
20553
  return Object.freeze(self);
20435
20554
  };
20436
20555
 
20437
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/unstable/net/IpInterface.js
20556
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/net/IpInterface.js
20438
20557
  var TypeId18 = "~effect/net/IpInterface";
20439
20558
  var isIpv4Interface = (u) => isIpInterface(u) && isIpv4Address(u.address);
20440
20559
  var isIpv6Interface = (u) => isIpInterface(u) && isIpv6Address(u.address);
@@ -20498,7 +20617,7 @@ var ipv6FromString2 = (input, options) => flatMap2(parseAddressWithPrefix(input,
20498
20617
  var fromString2 = (input, options) => flatMap2(parseAddressWithPrefix(input, options), (parts) => flatMap2(ipFromString(parts.address), (address) => make20(address, parts.prefixLength ?? width(address))));
20499
20618
  var format4 = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
20500
20619
 
20501
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/unstable/net/IpNetwork.js
20620
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/net/IpNetwork.js
20502
20621
  var TypeId19 = "~effect/net/IpNetwork";
20503
20622
  var isIpv4Network = (u) => isIpNetwork(u) && isIpv4Address(u.address);
20504
20623
  var isIpv6Network = (u) => isIpNetwork(u) && isIpv6Address(u.address);
@@ -20569,7 +20688,7 @@ var fromString3 = (input) => {
20569
20688
  };
20570
20689
  var format5 = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
20571
20690
 
20572
- // ../../node_modules/.bun/effect@4.0.0-rc.113/node_modules/effect/dist/Schema.js
20691
+ // ../../node_modules/.bun/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js
20573
20692
  var TypeId20 = TypeId12;
20574
20693
  function declareConstructor() {
20575
20694
  return (typeParameters, run2, annotations) => {
@@ -24331,6 +24450,7 @@ var RPC_METHODS = {
24331
24450
  chatgptWebConfigureFull: "chatgptWeb.configureFull",
24332
24451
  chatgptWebRepairProfile: "chatgptWeb.repairProfile",
24333
24452
  chatgptWebOpenChromeCompanionInstaller: "chatgptWeb.openChromeCompanionInstaller",
24453
+ chatgptWebOpenSetupPage: "chatgptWeb.openSetupPage",
24334
24454
  chatgptWebShowBrowser: "chatgptWeb.showBrowser",
24335
24455
  chatgptWebSignOutProfile: "chatgptWeb.signOutProfile",
24336
24456
  chatgptWebDeleteProfile: "chatgptWeb.deleteProfile",
@@ -24939,6 +25059,16 @@ var DesktopRpcRequestBody = Schema_exports.Union([
24939
25059
  RPC_METHODS.chatgptWebOpenChromeCompanionInstaller,
24940
25060
  Schema_exports.Struct({})
24941
25061
  ),
25062
+ tagRequestBody(
25063
+ RPC_METHODS.chatgptWebOpenSetupPage,
25064
+ Schema_exports.Struct({
25065
+ page: Schema_exports.Union([
25066
+ Schema_exports.Literal("tunnels"),
25067
+ Schema_exports.Literal("api-keys"),
25068
+ Schema_exports.Literal("connector")
25069
+ ])
25070
+ })
25071
+ ),
24942
25072
  tagRequestBody(
24943
25073
  RPC_METHODS.chatgptWebShowBrowser,
24944
25074
  Schema_exports.Struct({ input: ChatGptWebProfileAction })
@@ -25490,7 +25620,7 @@ function fingerprintAuth(content) {
25490
25620
  }
25491
25621
  async function readOptionalFile(filePath) {
25492
25622
  try {
25493
- return await import_node_fs6.promises.readFile(filePath, "utf8");
25623
+ return await import_node_fs7.promises.readFile(filePath, "utf8");
25494
25624
  } catch (error) {
25495
25625
  const code = error && typeof error === "object" && "code" in error ? error.code : null;
25496
25626
  if (code === "ENOENT") return null;
@@ -25498,12 +25628,12 @@ async function readOptionalFile(filePath) {
25498
25628
  }
25499
25629
  }
25500
25630
  async function writeAtomicPath(filePath, content) {
25501
- const dir = import_node_path10.default.dirname(filePath);
25502
- const tempPath = import_node_path10.default.join(
25631
+ const dir = import_node_path11.default.dirname(filePath);
25632
+ const tempPath = import_node_path11.default.join(
25503
25633
  dir,
25504
- `.${import_node_path10.default.basename(filePath)}.${process.pid}.${(0, import_node_crypto11.randomUUID)()}.tmp`
25634
+ `.${import_node_path11.default.basename(filePath)}.${process.pid}.${(0, import_node_crypto11.randomUUID)()}.tmp`
25505
25635
  );
25506
- const handle = await import_node_fs6.promises.open(tempPath, "wx", 384);
25636
+ const handle = await import_node_fs7.promises.open(tempPath, "wx", 384);
25507
25637
  try {
25508
25638
  await handle.writeFile(content, "utf8");
25509
25639
  await handle.sync();
@@ -25511,9 +25641,9 @@ async function writeAtomicPath(filePath, content) {
25511
25641
  await handle.close();
25512
25642
  }
25513
25643
  try {
25514
- await import_node_fs6.promises.rename(tempPath, filePath);
25644
+ await import_node_fs7.promises.rename(tempPath, filePath);
25515
25645
  if (process.platform !== "win32") {
25516
- const dirHandle = await import_node_fs6.promises.open(dir, "r");
25646
+ const dirHandle = await import_node_fs7.promises.open(dir, "r");
25517
25647
  try {
25518
25648
  await dirHandle.sync();
25519
25649
  } finally {
@@ -25521,16 +25651,16 @@ async function writeAtomicPath(filePath, content) {
25521
25651
  }
25522
25652
  }
25523
25653
  } finally {
25524
- await import_node_fs6.promises.rm(tempPath, { force: true }).catch(() => void 0);
25654
+ await import_node_fs7.promises.rm(tempPath, { force: true }).catch(() => void 0);
25525
25655
  }
25526
25656
  }
25527
25657
  async function installAuthFileIfAbsent(filePath, content) {
25528
- const dir = import_node_path10.default.dirname(filePath);
25529
- const tempPath = import_node_path10.default.join(
25658
+ const dir = import_node_path11.default.dirname(filePath);
25659
+ const tempPath = import_node_path11.default.join(
25530
25660
  dir,
25531
- `.${import_node_path10.default.basename(filePath)}.${process.pid}.${(0, import_node_crypto11.randomUUID)()}.install`
25661
+ `.${import_node_path11.default.basename(filePath)}.${process.pid}.${(0, import_node_crypto11.randomUUID)()}.install`
25532
25662
  );
25533
- const handle = await import_node_fs6.promises.open(tempPath, "wx", 384);
25663
+ const handle = await import_node_fs7.promises.open(tempPath, "wx", 384);
25534
25664
  try {
25535
25665
  await handle.writeFile(content, "utf8");
25536
25666
  await handle.sync();
@@ -25538,25 +25668,25 @@ async function installAuthFileIfAbsent(filePath, content) {
25538
25668
  await handle.close();
25539
25669
  }
25540
25670
  try {
25541
- await import_node_fs6.promises.link(tempPath, filePath);
25671
+ await import_node_fs7.promises.link(tempPath, filePath);
25542
25672
  } finally {
25543
- await import_node_fs6.promises.rm(tempPath, { force: true }).catch(() => void 0);
25673
+ await import_node_fs7.promises.rm(tempPath, { force: true }).catch(() => void 0);
25544
25674
  }
25545
25675
  }
25546
25676
  async function linkAuthFileIfAbsent(sourcePath, targetPath) {
25547
- await import_node_fs6.promises.link(sourcePath, targetPath);
25677
+ await import_node_fs7.promises.link(sourcePath, targetPath);
25548
25678
  }
25549
25679
  async function hasExternalOpenFileHandle(filePath) {
25550
25680
  if (process.platform === "linux") {
25551
25681
  let target;
25552
25682
  try {
25553
- target = await import_node_fs6.promises.stat(filePath);
25683
+ target = await import_node_fs7.promises.stat(filePath);
25554
25684
  } catch {
25555
25685
  return true;
25556
25686
  }
25557
25687
  let processes;
25558
25688
  try {
25559
- processes = await import_node_fs6.promises.readdir("/proc", { withFileTypes: true });
25689
+ processes = await import_node_fs7.promises.readdir("/proc", { withFileTypes: true });
25560
25690
  } catch {
25561
25691
  return true;
25562
25692
  }
@@ -25567,7 +25697,7 @@ async function hasExternalOpenFileHandle(filePath) {
25567
25697
  }
25568
25698
  const processPath = `/proc/${entry.name}`;
25569
25699
  try {
25570
- const processStats = await import_node_fs6.promises.stat(processPath);
25700
+ const processStats = await import_node_fs7.promises.stat(processPath);
25571
25701
  if (currentUid !== void 0 && processStats.uid !== currentUid) {
25572
25702
  continue;
25573
25703
  }
@@ -25576,7 +25706,7 @@ async function hasExternalOpenFileHandle(filePath) {
25576
25706
  }
25577
25707
  let descriptors;
25578
25708
  try {
25579
- descriptors = await import_node_fs6.promises.readdir(`${processPath}/fd`);
25709
+ descriptors = await import_node_fs7.promises.readdir(`${processPath}/fd`);
25580
25710
  } catch (error) {
25581
25711
  const code = error && typeof error === "object" && "code" in error ? error.code : null;
25582
25712
  if (code === "ENOENT" || code === "ESRCH") continue;
@@ -25584,7 +25714,7 @@ async function hasExternalOpenFileHandle(filePath) {
25584
25714
  }
25585
25715
  for (const descriptor2 of descriptors) {
25586
25716
  try {
25587
- const descriptorStats = await import_node_fs6.promises.stat(`${processPath}/fd/${descriptor2}`);
25717
+ const descriptorStats = await import_node_fs7.promises.stat(`${processPath}/fd/${descriptor2}`);
25588
25718
  if (descriptorStats.dev === target.dev && descriptorStats.ino === target.ino) {
25589
25719
  return true;
25590
25720
  }
@@ -25631,9 +25761,9 @@ async function hasExternalOpenFileHandle(filePath) {
25631
25761
  async function cleanupAuthWriteback(filePath) {
25632
25762
  const paths = authWritebackPaths(filePath);
25633
25763
  await Promise.all([
25634
- import_node_fs6.promises.rm(paths.manifest, { force: true }),
25635
- import_node_fs6.promises.rm(paths.backup, { force: true }),
25636
- import_node_fs6.promises.rm(paths.replaced, { force: true })
25764
+ import_node_fs7.promises.rm(paths.manifest, { force: true }),
25765
+ import_node_fs7.promises.rm(paths.backup, { force: true }),
25766
+ import_node_fs7.promises.rm(paths.replaced, { force: true })
25637
25767
  ]);
25638
25768
  }
25639
25769
  async function rollbackAuthWriteback(filePath, manifest) {
@@ -25654,8 +25784,8 @@ async function rollbackAuthWriteback(filePath, manifest) {
25654
25784
  "Codex auth changed outside CodexUse during writeback rollback; recovery files were preserved."
25655
25785
  );
25656
25786
  }
25657
- await import_node_fs6.promises.rename(filePath, paths.replaced);
25658
- if (fingerprintAuth(await import_node_fs6.promises.readFile(paths.replaced, "utf8")) !== manifest.targetFingerprint) {
25787
+ await import_node_fs7.promises.rename(filePath, paths.replaced);
25788
+ if (fingerprintAuth(await import_node_fs7.promises.readFile(paths.replaced, "utf8")) !== manifest.targetFingerprint) {
25659
25789
  const replaced = await readOptionalFile(paths.replaced);
25660
25790
  if (await readOptionalFile(filePath) === null && replaced !== null) {
25661
25791
  await installAuthFileIfAbsent(filePath, replaced);
@@ -25692,7 +25822,7 @@ async function replaceAuthFileIfCurrent(filePath, expectedCurrent, replacement)
25692
25822
  await writeAtomicPath(paths.manifest, JSON.stringify(manifest));
25693
25823
  let committed = false;
25694
25824
  try {
25695
- await import_node_fs6.promises.rename(filePath, paths.backup);
25825
+ await import_node_fs7.promises.rename(filePath, paths.backup);
25696
25826
  if (await readOptionalFile(paths.backup) !== expectedCurrent) {
25697
25827
  throw new Error("Codex auth changed while writeback began.");
25698
25828
  }
@@ -25742,7 +25872,7 @@ async function acquireCodexAuthFileSystemLock(filePath) {
25742
25872
  }
25743
25873
  }
25744
25874
  async function acquireCodexAuthFileLock(filePath) {
25745
- const queueKey = import_node_path10.default.resolve(filePath);
25875
+ const queueKey = import_node_path11.default.resolve(filePath);
25746
25876
  const predecessor = authFileLockQueues.get(queueKey) ?? Promise.resolve();
25747
25877
  let finishTurn;
25748
25878
  const turn = new Promise((resolve2) => {
@@ -25775,7 +25905,7 @@ async function acquireCodexAuthFileLock(filePath) {
25775
25905
  }
25776
25906
  }
25777
25907
  async function acquireCodexAuthFileReadLock(filePath) {
25778
- const queueKey = import_node_path10.default.resolve(filePath);
25908
+ const queueKey = import_node_path11.default.resolve(filePath);
25779
25909
  await (authFileLockQueues.get(queueKey) ?? Promise.resolve());
25780
25910
  const releaseReadLock = await acquireCrossProcessFileReadLock(filePath);
25781
25911
  if (!releaseReadLock) {
@@ -25792,7 +25922,7 @@ async function acquireCodexAuthFileReadLock(filePath) {
25792
25922
  async function readAuthFileCached(filePath) {
25793
25923
  let stats;
25794
25924
  try {
25795
- stats = await import_node_fs6.promises.stat(filePath);
25925
+ stats = await import_node_fs7.promises.stat(filePath);
25796
25926
  } catch {
25797
25927
  authFileCache.delete(filePath);
25798
25928
  return null;
@@ -25801,7 +25931,7 @@ async function readAuthFileCached(filePath) {
25801
25931
  if (cached2 && cached2.mtimeMs === stats.mtimeMs && cached2.size === stats.size) {
25802
25932
  return cached2.content;
25803
25933
  }
25804
- const content = await import_node_fs6.promises.readFile(filePath, "utf8");
25934
+ const content = await import_node_fs7.promises.readFile(filePath, "utf8");
25805
25935
  authFileCache.set(filePath, {
25806
25936
  mtimeMs: stats.mtimeMs,
25807
25937
  size: stats.size,
@@ -25820,7 +25950,7 @@ async function writeAuthFileCached(filePath, content, expectedCurrent, options =
25820
25950
  );
25821
25951
  if (!written) return false;
25822
25952
  try {
25823
- const stats = await import_node_fs6.promises.stat(filePath);
25953
+ const stats = await import_node_fs7.promises.stat(filePath);
25824
25954
  authFileCache.set(filePath, {
25825
25955
  mtimeMs: stats.mtimeMs,
25826
25956
  size: stats.size,
@@ -25949,9 +26079,9 @@ function parseRateLimitSnapshotFromRpcMessage(message) {
25949
26079
  return snapshot2;
25950
26080
  }
25951
26081
  function resolveRpcAuthPath(envOverride, authPath) {
25952
- return authPath ?? import_node_path10.default.join(
26082
+ return authPath ?? import_node_path11.default.join(
25953
26083
  resolveCodexHomeDir({
25954
- codexHomePath: envOverride?.CODEX_HOME ?? (envOverride?.HOME ? import_node_path10.default.join(envOverride.HOME, ".codex") : void 0)
26084
+ codexHomePath: envOverride?.CODEX_HOME ?? (envOverride?.HOME ? import_node_path11.default.join(envOverride.HOME, ".codex") : void 0)
25955
26085
  }),
25956
26086
  "auth.json"
25957
26087
  );
@@ -25959,13 +26089,13 @@ function resolveRpcAuthPath(envOverride, authPath) {
25959
26089
  async function fetchRateLimitsViaRpc(envOverride, options = {}) {
25960
26090
  const binaryPath = options.codexPath ?? await requireCodexCli();
25961
26091
  const sourceAuthPath = resolveRpcAuthPath(envOverride, options.authPath);
25962
- const tempHome = await import_node_fs6.promises.mkdtemp(import_node_path10.default.join(import_node_os3.default.tmpdir(), "codex-rpc-"));
25963
- const tempAuthPath = import_node_path10.default.join(tempHome, "auth.json");
26092
+ const tempHome = await import_node_fs7.promises.mkdtemp(import_node_path11.default.join(import_node_os6.default.tmpdir(), "codex-rpc-"));
26093
+ const tempAuthPath = import_node_path11.default.join(tempHome, "auth.json");
25964
26094
  let initialSourceAuth;
25965
26095
  try {
25966
26096
  const authLock = await acquireCodexAuthFileReadLock(sourceAuthPath);
25967
26097
  if (!authLock) {
25968
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true });
26098
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true });
25969
26099
  return null;
25970
26100
  }
25971
26101
  try {
@@ -25974,21 +26104,22 @@ async function fetchRateLimitsViaRpc(envOverride, options = {}) {
25974
26104
  await authLock.release();
25975
26105
  }
25976
26106
  if (!initialSourceAuth) {
25977
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true });
26107
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true });
25978
26108
  return null;
25979
26109
  }
25980
- await import_node_fs6.promises.writeFile(tempAuthPath, initialSourceAuth, {
26110
+ await import_node_fs7.promises.writeFile(tempAuthPath, initialSourceAuth, {
25981
26111
  encoding: "utf8",
25982
26112
  mode: 384
25983
26113
  });
25984
26114
  } catch {
25985
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26115
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
25986
26116
  });
25987
26117
  return null;
25988
26118
  }
25989
26119
  const childEnv = buildCodexChildEnv({
25990
26120
  ...envOverride ?? {},
25991
26121
  HOME: tempHome,
26122
+ USERPROFILE: tempHome,
25992
26123
  CODEX_HOME: tempHome,
25993
26124
  CODEX_SQLITE_HOME: tempHome,
25994
26125
  CODEX_TELEMETRY_LABEL: "codex-rpc",
@@ -26049,7 +26180,7 @@ async function fetchRateLimitsViaRpc(envOverride, options = {}) {
26049
26180
  rl.close();
26050
26181
  await stopChildAndWait(child);
26051
26182
  try {
26052
- const updatedAuth = await import_node_fs6.promises.readFile(tempAuthPath, "utf8");
26183
+ const updatedAuth = await import_node_fs7.promises.readFile(tempAuthPath, "utf8");
26053
26184
  if (updatedAuth.trim().length > 0) {
26054
26185
  const currentSourceAuth = await readAuthFileCached(sourceAuthPath);
26055
26186
  if (shouldWriteBackAuth(initialSourceAuth, currentSourceAuth, updatedAuth)) {
@@ -26078,7 +26209,7 @@ async function fetchRateLimitsViaRpc(envOverride, options = {}) {
26078
26209
  } catch (error) {
26079
26210
  logWarn("Failed to sync refreshed auth after rate-limit probe:", error);
26080
26211
  }
26081
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26212
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26082
26213
  });
26083
26214
  }
26084
26215
  }
@@ -26092,15 +26223,15 @@ async function activateResetWindowViaRpc(envOverride, options = {}) {
26092
26223
  }
26093
26224
  async function activateResetWindowViaRpcIsolated(envOverride, options, sourceAuthPath) {
26094
26225
  const binaryPath = options.codexPath ?? await requireCodexCli();
26095
- const tempHome = await import_node_fs6.promises.mkdtemp(
26096
- import_node_path10.default.join(import_node_os3.default.tmpdir(), "codex-activation-")
26226
+ const tempHome = await import_node_fs7.promises.mkdtemp(
26227
+ import_node_path11.default.join(import_node_os6.default.tmpdir(), "codex-activation-")
26097
26228
  );
26098
- const tempAuthPath = import_node_path10.default.join(tempHome, "auth.json");
26229
+ const tempAuthPath = import_node_path11.default.join(tempHome, "auth.json");
26099
26230
  let initialSourceAuth;
26100
26231
  try {
26101
26232
  const authLock = await acquireCodexAuthFileReadLock(sourceAuthPath);
26102
26233
  if (!authLock) {
26103
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true });
26234
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true });
26104
26235
  return { status: "skipped", reason: "auth-busy" };
26105
26236
  }
26106
26237
  try {
@@ -26109,30 +26240,30 @@ async function activateResetWindowViaRpcIsolated(envOverride, options, sourceAut
26109
26240
  await authLock.release();
26110
26241
  }
26111
26242
  if (!initialSourceAuth) {
26112
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26243
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26113
26244
  });
26114
26245
  return { status: "skipped", reason: "auth-missing" };
26115
26246
  }
26116
- await import_node_fs6.promises.writeFile(tempAuthPath, initialSourceAuth, {
26247
+ await import_node_fs7.promises.writeFile(tempAuthPath, initialSourceAuth, {
26117
26248
  encoding: "utf8",
26118
26249
  mode: 384
26119
26250
  });
26120
26251
  } catch {
26121
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26252
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26122
26253
  });
26123
26254
  return { status: "skipped", reason: "auth-missing" };
26124
26255
  }
26125
26256
  let configuredModel = null;
26126
26257
  try {
26127
26258
  const snapshot2 = await getCodexConfigSnapshot({
26128
- codexHomePath: import_node_path10.default.dirname(sourceAuthPath)
26259
+ codexHomePath: import_node_path11.default.dirname(sourceAuthPath)
26129
26260
  });
26130
26261
  configuredModel = snapshot2.settings.model;
26131
26262
  } catch {
26132
26263
  }
26133
26264
  const activationModel = resolveActivationModel(configuredModel);
26134
- await import_node_fs6.promises.writeFile(
26135
- import_node_path10.default.join(tempHome, "config.toml"),
26265
+ await import_node_fs7.promises.writeFile(
26266
+ import_node_path11.default.join(tempHome, "config.toml"),
26136
26267
  `model = ${JSON.stringify(activationModel)}
26137
26268
  `,
26138
26269
  "utf8"
@@ -26141,6 +26272,7 @@ async function activateResetWindowViaRpcIsolated(envOverride, options, sourceAut
26141
26272
  const childEnv = buildCodexChildEnv({
26142
26273
  ...envOverride ?? {},
26143
26274
  HOME: tempHome,
26275
+ USERPROFILE: tempHome,
26144
26276
  CODEX_HOME: tempHome,
26145
26277
  CODEX_SQLITE_HOME: tempHome,
26146
26278
  CODEX_TELEMETRY_LABEL: "codex-reset-activation",
@@ -26269,7 +26401,7 @@ async function activateResetWindowViaRpcIsolated(envOverride, options, sourceAut
26269
26401
  rl.close();
26270
26402
  await stopChildAndWait(child);
26271
26403
  try {
26272
- const updatedAuth = await import_node_fs6.promises.readFile(tempAuthPath, "utf8");
26404
+ const updatedAuth = await import_node_fs7.promises.readFile(tempAuthPath, "utf8");
26273
26405
  if (updatedAuth.trim().length > 0) {
26274
26406
  const currentSourceAuth = await readAuthFileCached(sourceAuthPath);
26275
26407
  if (shouldWriteBackAuth(initialSourceAuth, currentSourceAuth, updatedAuth)) {
@@ -26304,7 +26436,7 @@ async function activateResetWindowViaRpcIsolated(envOverride, options, sourceAut
26304
26436
  } catch (error) {
26305
26437
  writebackError = error instanceof Error ? error : new Error(String(error));
26306
26438
  }
26307
- await import_node_fs6.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26439
+ await import_node_fs7.promises.rm(tempHome, { recursive: true, force: true }).catch(() => {
26308
26440
  });
26309
26441
  }
26310
26442
  if (activationError && writebackError) {
@@ -26328,13 +26460,13 @@ async function activateResetWindowViaRpcIsolated(envOverride, options, sourceAut
26328
26460
  // ../../packages/runtime-codex/src/codex/officialAppRestart.ts
26329
26461
  var import_node_child_process6 = require("child_process");
26330
26462
  var import_node_crypto13 = require("crypto");
26331
- var import_node_fs9 = require("fs");
26332
- var import_node_os4 = require("os");
26333
- var import_node_path13 = __toESM(require("path"), 1);
26463
+ var import_node_fs10 = require("fs");
26464
+ var import_node_os7 = require("os");
26465
+ var import_node_path14 = __toESM(require("path"), 1);
26334
26466
 
26335
26467
  // ../../packages/runtime-codex/src/codex/threadUsage.ts
26336
- var import_node_fs7 = require("fs");
26337
- var import_node_path11 = __toESM(require("path"), 1);
26468
+ var import_node_fs8 = require("fs");
26469
+ var import_node_path12 = __toESM(require("path"), 1);
26338
26470
  var ROLLOUT_DIRS = ["sessions", "archived_sessions"];
26339
26471
  var SQLITE_EXTENSIONS = /* @__PURE__ */ new Set([".db", ".sqlite", ".sqlite3"]);
26340
26472
  var SILENT_TAKEOVER_HOT_WINDOW_MS = 6e4;
@@ -26346,7 +26478,7 @@ async function collectRolloutFiles(root) {
26346
26478
  async function visit(dir) {
26347
26479
  let entries3;
26348
26480
  try {
26349
- entries3 = await import_node_fs7.promises.readdir(dir, {
26481
+ entries3 = await import_node_fs8.promises.readdir(dir, {
26350
26482
  withFileTypes: true,
26351
26483
  encoding: "utf8"
26352
26484
  });
@@ -26356,7 +26488,7 @@ async function collectRolloutFiles(root) {
26356
26488
  const childVisits = [];
26357
26489
  for (const entry of entries3) {
26358
26490
  const entryName = String(entry.name);
26359
- const entryPath = import_node_path11.default.join(dir, entryName);
26491
+ const entryPath = import_node_path12.default.join(dir, entryName);
26360
26492
  if (entry.isDirectory()) {
26361
26493
  childVisits.push(visit(entryPath));
26362
26494
  continue;
@@ -26374,14 +26506,14 @@ async function collectRolloutFiles(root) {
26374
26506
  async function collectRolloutFilesStrict(root) {
26375
26507
  const files = [];
26376
26508
  async function visit(dir) {
26377
- const entries3 = await import_node_fs7.promises.readdir(dir, {
26509
+ const entries3 = await import_node_fs8.promises.readdir(dir, {
26378
26510
  withFileTypes: true,
26379
26511
  encoding: "utf8"
26380
26512
  });
26381
26513
  await Promise.all(
26382
26514
  entries3.map(async (entry) => {
26383
26515
  const entryName = String(entry.name);
26384
- const entryPath = import_node_path11.default.join(dir, entryName);
26516
+ const entryPath = import_node_path12.default.join(dir, entryName);
26385
26517
  if (entry.isDirectory()) {
26386
26518
  await visit(entryPath);
26387
26519
  } else if (entry.isFile() && entryName.startsWith("rollout-") && entryName.endsWith(".jsonl")) {
@@ -26397,9 +26529,9 @@ async function readOfficialCodexRolloutActivityHeat(profileHome) {
26397
26529
  let latestUpdatedAtMs = null;
26398
26530
  try {
26399
26531
  for (const dirname of ROLLOUT_DIRS) {
26400
- const root = import_node_path11.default.join(profileHome, dirname);
26532
+ const root = import_node_path12.default.join(profileHome, dirname);
26401
26533
  try {
26402
- await import_node_fs7.promises.access(root);
26534
+ await import_node_fs8.promises.access(root);
26403
26535
  } catch (error) {
26404
26536
  if (error.code === "ENOENT") {
26405
26537
  continue;
@@ -26408,7 +26540,7 @@ async function readOfficialCodexRolloutActivityHeat(profileHome) {
26408
26540
  }
26409
26541
  const files = await collectRolloutFilesStrict(root);
26410
26542
  for (const file of files) {
26411
- const stat3 = await import_node_fs7.promises.stat(file);
26543
+ const stat3 = await import_node_fs8.promises.stat(file);
26412
26544
  if (Number.isFinite(stat3.mtimeMs)) {
26413
26545
  latestUpdatedAtMs = Math.max(latestUpdatedAtMs ?? 0, stat3.mtimeMs);
26414
26546
  }
@@ -26429,14 +26561,14 @@ async function findRolloutFileByScan(profileHome, threadId) {
26429
26561
  let best = null;
26430
26562
  const variants = threadIdVariants(threadId);
26431
26563
  for (const dirname of ROLLOUT_DIRS) {
26432
- const root = import_node_path11.default.join(profileHome, dirname);
26564
+ const root = import_node_path12.default.join(profileHome, dirname);
26433
26565
  const files = await collectRolloutFiles(root);
26434
26566
  for (const file of files) {
26435
- const basename = import_node_path11.default.basename(file);
26567
+ const basename = import_node_path12.default.basename(file);
26436
26568
  if (!variants.some((variant) => basename.includes(variant))) {
26437
26569
  continue;
26438
26570
  }
26439
- const stat3 = await import_node_fs7.promises.stat(file).catch(() => null);
26571
+ const stat3 = await import_node_fs8.promises.stat(file).catch(() => null);
26440
26572
  const updatedAtMs = stat3 && Number.isFinite(stat3.mtimeMs) ? stat3.mtimeMs : null;
26441
26573
  if (!best || (updatedAtMs ?? 0) > (best.updatedAtMs ?? 0) || (updatedAtMs ?? 0) === (best.updatedAtMs ?? 0) && file > best.path) {
26442
26574
  best = { path: file, updatedAtMs };
@@ -26508,13 +26640,13 @@ function resolveRolloutPath(profileHome, rolloutPath) {
26508
26640
  if (!rolloutPath) {
26509
26641
  return null;
26510
26642
  }
26511
- return import_node_path11.default.isAbsolute(rolloutPath) ? rolloutPath : import_node_path11.default.join(profileHome, rolloutPath);
26643
+ return import_node_path12.default.isAbsolute(rolloutPath) ? rolloutPath : import_node_path12.default.join(profileHome, rolloutPath);
26512
26644
  }
26513
26645
  async function collectSessionDatabasePaths(profileHome, sqliteHome = profileHome) {
26514
26646
  const paths = [];
26515
- const sqliteDir = import_node_path11.default.join(sqliteHome, "sqlite");
26647
+ const sqliteDir = import_node_path12.default.join(sqliteHome, "sqlite");
26516
26648
  try {
26517
- const entries3 = await import_node_fs7.promises.readdir(sqliteDir, {
26649
+ const entries3 = await import_node_fs8.promises.readdir(sqliteDir, {
26518
26650
  withFileTypes: true,
26519
26651
  encoding: "utf8"
26520
26652
  });
@@ -26523,20 +26655,20 @@ async function collectSessionDatabasePaths(profileHome, sqliteHome = profileHome
26523
26655
  continue;
26524
26656
  }
26525
26657
  const entryName = String(entry.name);
26526
- if (SQLITE_EXTENSIONS.has(import_node_path11.default.extname(entryName))) {
26527
- paths.push(import_node_path11.default.join(sqliteDir, entryName));
26658
+ if (SQLITE_EXTENSIONS.has(import_node_path12.default.extname(entryName))) {
26659
+ paths.push(import_node_path12.default.join(sqliteDir, entryName));
26528
26660
  }
26529
26661
  }
26530
26662
  } catch {
26531
26663
  }
26532
26664
  paths.sort((left, right) => {
26533
- const leftName = import_node_path11.default.basename(left);
26534
- const rightName = import_node_path11.default.basename(right);
26665
+ const leftName = import_node_path12.default.basename(left);
26666
+ const rightName = import_node_path12.default.basename(right);
26535
26667
  if (leftName === "codex-dev.db" && rightName !== "codex-dev.db") return -1;
26536
26668
  if (rightName === "codex-dev.db" && leftName !== "codex-dev.db") return 1;
26537
26669
  return leftName.localeCompare(rightName);
26538
26670
  });
26539
- const legacy = import_node_path11.default.join(sqliteHome, "state_5.sqlite");
26671
+ const legacy = import_node_path12.default.join(sqliteHome, "state_5.sqlite");
26540
26672
  if (!paths.includes(legacy)) {
26541
26673
  paths.push(legacy);
26542
26674
  }
@@ -26596,7 +26728,7 @@ function queryThreadRecordFromTable(db, profileHome, threadId, config) {
26596
26728
  }
26597
26729
  async function readThreadRecordFromDb(profileHome, dbPath, threadId) {
26598
26730
  try {
26599
- await import_node_fs7.promises.access(dbPath);
26731
+ await import_node_fs8.promises.access(dbPath);
26600
26732
  } catch {
26601
26733
  return null;
26602
26734
  }
@@ -26662,9 +26794,9 @@ async function findOfficialCodexThreadRecord(profileHome, threadId, options = {}
26662
26794
 
26663
26795
  // ../../packages/runtime-codex/src/codex/sharedHistory.ts
26664
26796
  var import_node_crypto12 = require("crypto");
26665
- var import_node_fs8 = require("fs");
26797
+ var import_node_fs9 = require("fs");
26666
26798
  var import_promises5 = require("fs/promises");
26667
- var import_node_path12 = __toESM(require("path"), 1);
26799
+ var import_node_path13 = __toESM(require("path"), 1);
26668
26800
  var HISTORY_MARKER = ".codexuse-shared-history-v1.json";
26669
26801
  var HISTORY_INDEX = "session_index.jsonl";
26670
26802
  var HISTORY_DIRECTORIES = [
@@ -26673,13 +26805,13 @@ var HISTORY_DIRECTORIES = [
26673
26805
  "thread-writer-locks"
26674
26806
  ];
26675
26807
  function markerPath(profileHome) {
26676
- return import_node_path12.default.join(profileHome, HISTORY_MARKER);
26808
+ return import_node_path13.default.join(profileHome, HISTORY_MARKER);
26677
26809
  }
26678
26810
  function linkPointsTo(linkPath, targetPath) {
26679
26811
  try {
26680
- const metadata = (0, import_node_fs8.lstatSync)(linkPath);
26812
+ const metadata = (0, import_node_fs9.lstatSync)(linkPath);
26681
26813
  if (!metadata.isSymbolicLink()) return false;
26682
- return import_node_path12.default.resolve(import_node_path12.default.dirname(linkPath), (0, import_node_fs8.readlinkSync)(linkPath)) === import_node_path12.default.resolve(targetPath);
26814
+ return import_node_path13.default.resolve(import_node_path13.default.dirname(linkPath), (0, import_node_fs9.readlinkSync)(linkPath)) === import_node_path13.default.resolve(targetPath);
26683
26815
  } catch {
26684
26816
  return false;
26685
26817
  }
@@ -26687,9 +26819,9 @@ function linkPointsTo(linkPath, targetPath) {
26687
26819
  function parseMarker(profileHome) {
26688
26820
  try {
26689
26821
  const value3 = JSON.parse(
26690
- (0, import_node_fs8.readFileSync)(markerPath(profileHome), "utf8")
26822
+ (0, import_node_fs9.readFileSync)(markerPath(profileHome), "utf8")
26691
26823
  );
26692
- if (value3.version !== 1 || typeof value3.sharedHome !== "string" || !import_node_path12.default.isAbsolute(value3.sharedHome) || typeof value3.sqliteHome !== "string" || !import_node_path12.default.isAbsolute(value3.sqliteHome)) {
26824
+ if (value3.version !== 1 || typeof value3.sharedHome !== "string" || !import_node_path13.default.isAbsolute(value3.sharedHome) || typeof value3.sqliteHome !== "string" || !import_node_path13.default.isAbsolute(value3.sqliteHome)) {
26693
26825
  return null;
26694
26826
  }
26695
26827
  return value3;
@@ -26698,25 +26830,25 @@ function parseMarker(profileHome) {
26698
26830
  }
26699
26831
  }
26700
26832
  function readSharedCodexHistoryConfiguration(profileHome) {
26701
- const normalizedProfileHome = import_node_path12.default.resolve(profileHome);
26833
+ const normalizedProfileHome = import_node_path13.default.resolve(profileHome);
26702
26834
  const marker = parseMarker(normalizedProfileHome);
26703
- if (!marker || import_node_path12.default.resolve(marker.sharedHome) === normalizedProfileHome) {
26835
+ if (!marker || import_node_path13.default.resolve(marker.sharedHome) === normalizedProfileHome) {
26704
26836
  return null;
26705
26837
  }
26706
26838
  if (!HISTORY_DIRECTORIES.every(
26707
26839
  (name) => linkPointsTo(
26708
- import_node_path12.default.join(normalizedProfileHome, name),
26709
- import_node_path12.default.join(marker.sharedHome, name)
26840
+ import_node_path13.default.join(normalizedProfileHome, name),
26841
+ import_node_path13.default.join(marker.sharedHome, name)
26710
26842
  )
26711
26843
  ) || !linkPointsTo(
26712
- import_node_path12.default.join(normalizedProfileHome, HISTORY_INDEX),
26713
- import_node_path12.default.join(marker.sharedHome, HISTORY_INDEX)
26844
+ import_node_path13.default.join(normalizedProfileHome, HISTORY_INDEX),
26845
+ import_node_path13.default.join(marker.sharedHome, HISTORY_INDEX)
26714
26846
  )) {
26715
26847
  return null;
26716
26848
  }
26717
26849
  return {
26718
- sharedHome: import_node_path12.default.resolve(marker.sharedHome),
26719
- sqliteHome: import_node_path12.default.resolve(marker.sqliteHome)
26850
+ sharedHome: import_node_path13.default.resolve(marker.sharedHome),
26851
+ sqliteHome: import_node_path13.default.resolve(marker.sqliteHome)
26720
26852
  };
26721
26853
  }
26722
26854
 
@@ -31044,18 +31176,18 @@ async function startOfficialCodexBridgeActionListenerOnce(args2) {
31044
31176
  if (!requestId || !rememberBridgeActionId(requestId)) {
31045
31177
  return;
31046
31178
  }
31047
- const path22 = typeof payload.path === "string" ? payload.path.trim().slice(0, 64) : "";
31179
+ const path23 = typeof payload.path === "string" ? payload.path.trim().slice(0, 64) : "";
31048
31180
  const requestHandler = officialCodexBridgeRequestHandler;
31049
31181
  void (async () => {
31050
31182
  let result2;
31051
- if (!path22) {
31183
+ if (!path23) {
31052
31184
  result2 = { status: "failed", reason: "missing-path" };
31053
31185
  } else if (!requestHandler) {
31054
31186
  result2 = { status: "failed", reason: "no-request-handler" };
31055
31187
  } else {
31056
31188
  try {
31057
31189
  result2 = await requestHandler({
31058
- path: path22,
31190
+ path: path23,
31059
31191
  payload: payload.payload ?? null,
31060
31192
  sourceProfileName: bridgeActionListenerProfiles.get(args2.debuggerUrl) ?? profileName
31061
31193
  });
@@ -31610,7 +31742,7 @@ var LAUNCH_LOCK_NAME = ".codexuse-launch.lock";
31610
31742
  var LAUNCH_LOCK_WAIT_MS = 6e4;
31611
31743
  async function withProfileLaunchFileLock(profileHome, work, options) {
31612
31744
  const accountKey = options.profileKey?.trim();
31613
- const lockPath = accountKey ? import_node_path13.default.join(resolveProfileCodexHomesRoot(), ".launch-locks", (0, import_node_crypto13.createHash)("sha256").update(accountKey).digest("hex")) : import_node_path13.default.join(profileHome, LAUNCH_LOCK_NAME);
31745
+ const lockPath = accountKey ? import_node_path14.default.join(resolveProfileCodexHomesRoot(), ".launch-locks", (0, import_node_crypto13.createHash)("sha256").update(accountKey).digest("hex")) : import_node_path14.default.join(profileHome, LAUNCH_LOCK_NAME);
31614
31746
  const deadline = Date.now() + (options.waitMs ?? LAUNCH_LOCK_WAIT_MS);
31615
31747
  for (; ; ) {
31616
31748
  const release = await acquireCrossProcessFileLock(lockPath, { busyTimeoutMs: 0 });
@@ -31657,7 +31789,7 @@ async function readProcessRows() {
31657
31789
  return rows;
31658
31790
  }
31659
31791
  function getMainExecutablePath(candidate) {
31660
- return import_node_path13.default.join(candidate.appPath, "Contents", "MacOS", candidate.executableName);
31792
+ return import_node_path14.default.join(candidate.appPath, "Contents", "MacOS", candidate.executableName);
31661
31793
  }
31662
31794
  function isMainProcessRow(row, candidate) {
31663
31795
  return row.args.includes(getMainExecutablePath(candidate));
@@ -32387,16 +32519,16 @@ async function verifyCurrentManagedProfileProof(instance, runtime, candidate, op
32387
32519
  }
32388
32520
  var devToolsActivePortPaths = (appUserDataDir) => {
32389
32521
  const roots = appUserDataDir ? [appUserDataDir] : [
32390
- import_node_path13.default.join((0, import_node_os4.homedir)(), "Library", "Application Support", "OpenAI", "Codex"),
32391
- import_node_path13.default.join((0, import_node_os4.homedir)(), "Library", "Application Support", "Codex"),
32392
- import_node_path13.default.join((0, import_node_os4.homedir)(), "Library", "Application Support", "com.openai.codex"),
32393
- import_node_path13.default.join((0, import_node_os4.homedir)(), "Library", "Application Support", "com.openai.chat")
32522
+ import_node_path14.default.join((0, import_node_os7.homedir)(), "Library", "Application Support", "OpenAI", "Codex"),
32523
+ import_node_path14.default.join((0, import_node_os7.homedir)(), "Library", "Application Support", "Codex"),
32524
+ import_node_path14.default.join((0, import_node_os7.homedir)(), "Library", "Application Support", "com.openai.codex"),
32525
+ import_node_path14.default.join((0, import_node_os7.homedir)(), "Library", "Application Support", "com.openai.chat")
32394
32526
  ];
32395
- return roots.map((root) => import_node_path13.default.join(root, "DevToolsActivePort"));
32527
+ return roots.map((root) => import_node_path14.default.join(root, "DevToolsActivePort"));
32396
32528
  };
32397
32529
  var readDevToolsActivePort = async (filePath) => {
32398
32530
  try {
32399
- const text = await import_node_fs9.promises.readFile(filePath, "utf8");
32531
+ const text = await import_node_fs10.promises.readFile(filePath, "utf8");
32400
32532
  const port = Number(text.split(/\r?\n/, 1)[0]);
32401
32533
  if (!Number.isInteger(port) || port <= 0 || port >= 65536) {
32402
32534
  return null;
@@ -32433,7 +32565,7 @@ function classifyOpenCodexLaunchFailure(error) {
32433
32565
  }
32434
32566
  async function openCodexWithProfileHome(candidate, profileHome, profileName, previousPids, options = {}) {
32435
32567
  const executablePath = getMainExecutablePath(candidate);
32436
- if (!(0, import_node_fs9.existsSync)(executablePath)) {
32568
+ if (!(0, import_node_fs10.existsSync)(executablePath)) {
32437
32569
  return {
32438
32570
  opened: false,
32439
32571
  pid: null,
@@ -32457,7 +32589,7 @@ async function openCodexWithProfileHome(candidate, profileHome, profileName, pre
32457
32589
  let child;
32458
32590
  try {
32459
32591
  if (appUserDataDir) {
32460
- (0, import_node_fs9.mkdirSync)(appUserDataDir, { recursive: true });
32592
+ (0, import_node_fs10.mkdirSync)(appUserDataDir, { recursive: true });
32461
32593
  }
32462
32594
  child = (0, import_node_child_process6.spawn)(
32463
32595
  "/usr/bin/open",
@@ -32609,14 +32741,14 @@ async function openCodexWithProfileHome(candidate, profileHome, profileName, pre
32609
32741
  };
32610
32742
  }
32611
32743
  function resolveCodexLaunchHome(profileHome) {
32612
- if (Buffer.byteLength(import_node_path13.default.join(profileHome, "ipc", "ipc.sock")) >= 100) {
32744
+ if (Buffer.byteLength(import_node_path14.default.join(profileHome, "ipc", "ipc.sock")) >= 100) {
32613
32745
  throw new Error("codex-home-path-too-long");
32614
32746
  }
32615
32747
  return profileHome;
32616
32748
  }
32617
32749
  async function readBundleString(appPath, key) {
32618
- const plistPath = import_node_path13.default.join(appPath, "Contents", "Info.plist");
32619
- if (!(0, import_node_fs9.existsSync)(plistPath)) {
32750
+ const plistPath = import_node_path14.default.join(appPath, "Contents", "Info.plist");
32751
+ if (!(0, import_node_fs10.existsSync)(plistPath)) {
32620
32752
  return null;
32621
32753
  }
32622
32754
  const result2 = await runCommand2("/usr/bin/plutil", [
@@ -32635,18 +32767,18 @@ async function readBundleString(appPath, key) {
32635
32767
  }
32636
32768
  function addStandardOfficialCodexAppPaths(rawPaths) {
32637
32769
  for (const appName of OFFICIAL_CODEX_APP_NAMES) {
32638
- rawPaths.add(import_node_path13.default.join("/Applications", appName));
32639
- rawPaths.add(import_node_path13.default.join((0, import_node_os4.homedir)(), "Applications", appName));
32770
+ rawPaths.add(import_node_path14.default.join("/Applications", appName));
32771
+ rawPaths.add(import_node_path14.default.join((0, import_node_os7.homedir)(), "Applications", appName));
32640
32772
  }
32641
32773
  }
32642
32774
  function officialCodexAppPriority(appPath) {
32643
- const priority = OFFICIAL_CODEX_APP_NAMES.indexOf(import_node_path13.default.basename(appPath));
32775
+ const priority = OFFICIAL_CODEX_APP_NAMES.indexOf(import_node_path14.default.basename(appPath));
32644
32776
  return priority >= 0 ? priority : OFFICIAL_CODEX_APP_NAMES.length;
32645
32777
  }
32646
32778
  async function collectCodexAppCandidates(rawPaths) {
32647
32779
  const candidates = [];
32648
32780
  for (const appPath of rawPaths) {
32649
- if (!(0, import_node_fs9.existsSync)(appPath) || !OFFICIAL_CODEX_APP_NAMES.includes(import_node_path13.default.basename(appPath)) || !(0, import_node_fs9.existsSync)(import_node_path13.default.join(appPath, "Contents", "Resources", "codex"))) {
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"))) {
32650
32782
  continue;
32651
32783
  }
32652
32784
  const bundleId = await readBundleString(appPath, "CFBundleIdentifier");
@@ -32657,7 +32789,7 @@ async function collectCodexAppCandidates(rawPaths) {
32657
32789
  appPath,
32658
32790
  bundleId,
32659
32791
  version: await readBundleString(appPath, "CFBundleShortVersionString"),
32660
- executableName: await readBundleString(appPath, "CFBundleExecutable") ?? import_node_path13.default.basename(appPath, ".app")
32792
+ executableName: await readBundleString(appPath, "CFBundleExecutable") ?? import_node_path14.default.basename(appPath, ".app")
32661
32793
  });
32662
32794
  }
32663
32795
  return candidates.sort(
@@ -32666,7 +32798,7 @@ async function collectCodexAppCandidates(rawPaths) {
32666
32798
  }
32667
32799
  function getRunningCodexPidsFromRows(candidate, rows) {
32668
32800
  const pids = /* @__PURE__ */ new Set();
32669
- const appContentsRoot = `${import_node_path13.default.join(candidate.appPath, "Contents")}${import_node_path13.default.sep}`;
32801
+ const appContentsRoot = `${import_node_path14.default.join(candidate.appPath, "Contents")}${import_node_path14.default.sep}`;
32670
32802
  for (const row of rows) {
32671
32803
  if (row.args.includes(appContentsRoot)) {
32672
32804
  pids.add(row.pid);
@@ -32676,7 +32808,7 @@ function getRunningCodexPidsFromRows(candidate, rows) {
32676
32808
  }
32677
32809
  function getRunningCodexMainPidsFromRows(candidate, rows) {
32678
32810
  const pids = /* @__PURE__ */ new Set();
32679
- const executablePath = import_node_path13.default.join(
32811
+ const executablePath = import_node_path14.default.join(
32680
32812
  candidate.appPath,
32681
32813
  "Contents",
32682
32814
  "MacOS",
@@ -32714,7 +32846,7 @@ async function resolveCodexAppTarget() {
32714
32846
  mainPids: getRunningCodexMainPidsFromRows(candidate, rows)
32715
32847
  })).filter((entry) => entry.mainPids.length > 0);
32716
32848
  const explicit = explicitPath ? runningCandidates.find(
32717
- (entry) => import_node_path13.default.resolve(entry.candidate.appPath) === import_node_path13.default.resolve(explicitPath)
32849
+ (entry) => import_node_path14.default.resolve(entry.candidate.appPath) === import_node_path14.default.resolve(explicitPath)
32718
32850
  ) : null;
32719
32851
  if (runningCandidates.length > 1) {
32720
32852
  return {
@@ -32757,14 +32889,14 @@ function resolveOfficialCodexLaunchConfiguration(profileHome, options = {}) {
32757
32889
  sqliteHome: options.sqliteHome ?? readSharedCodexHistoryConfiguration(profileHome)?.sqliteHome ?? profileHome,
32758
32890
  // Managed profile windows keep Electron state separate as well as CODEX_HOME.
32759
32891
  // Callers can supply another isolated directory or explicitly use stock state.
32760
- userDataDir: options.useDefaultUserData === true ? null : options.userDataDir ?? import_node_path13.default.join(profileHome, "codex-app-user-data")
32892
+ userDataDir: options.useDefaultUserData === true ? null : options.userDataDir ?? import_node_path14.default.join(profileHome, "codex-app-user-data")
32761
32893
  };
32762
32894
  }
32763
32895
  function resolveOfficialCodexThreadSqliteHome(profileHome) {
32764
32896
  return readSharedCodexHistoryConfiguration(profileHome)?.sqliteHome ?? profileHome;
32765
32897
  }
32766
32898
  function sharedCodexLaunchOptions(useDefaultUserData, profileIdentity) {
32767
- const userDataDir = !useDefaultUserData && profileIdentity ? import_node_path13.default.join(
32899
+ const userDataDir = !useDefaultUserData && profileIdentity ? import_node_path14.default.join(
32768
32900
  SHARED_CODEX_HOME,
32769
32901
  "codex-app-user-data",
32770
32902
  (0, import_node_crypto13.createHash)("sha256").update(profileIdentity).digest("hex").slice(0, 16)
@@ -32931,7 +33063,7 @@ function isSharedHomeMainProcessRow(row, candidate) {
32931
33063
  resolveProfileCodexHomesRoot(),
32932
33064
  resolveLegacyProfileCodexHomesRoot()
32933
33065
  ];
32934
- return isMainProcessRow(row, candidate) && managedRoots.every((root) => !row.args.includes(`${root}${import_node_path13.default.sep}`));
33066
+ return isMainProcessRow(row, candidate) && managedRoots.every((root) => !row.args.includes(`${root}${import_node_path14.default.sep}`));
32935
33067
  }
32936
33068
  async function hydrateSharedHomeCdpWindow(rows, candidate) {
32937
33069
  const isRunningCandidate = async (value3) => {
@@ -37005,8 +37137,8 @@ async function releaseProfileHomeMutationIntent(homeId, operationId) {
37005
37137
  }
37006
37138
 
37007
37139
  // ../../packages/runtime-profiles/src/profiles/rate-limit-cache.ts
37008
- var import_node_fs10 = require("fs");
37009
- var import_node_path14 = __toESM(require("path"), 1);
37140
+ var import_node_fs11 = require("fs");
37141
+ var import_node_path15 = __toESM(require("path"), 1);
37010
37142
  var memorySnapshots = /* @__PURE__ */ new Map();
37011
37143
  var persistedSnapshotWriteLock = Promise.resolve();
37012
37144
  var RATE_LIMIT_SNAPSHOT_CACHE_FILE = "rate-limit-snapshots.json";
@@ -37014,12 +37146,12 @@ function cloneSnapshot(snapshot2) {
37014
37146
  return JSON.parse(JSON.stringify(snapshot2));
37015
37147
  }
37016
37148
  function snapshotCachePath() {
37017
- return import_node_path14.default.join(getUserDataDir(), RATE_LIMIT_SNAPSHOT_CACHE_FILE);
37149
+ return import_node_path15.default.join(getUserDataDir(), RATE_LIMIT_SNAPSHOT_CACHE_FILE);
37018
37150
  }
37019
37151
  async function loadPersistedSnapshots() {
37020
37152
  let raw;
37021
37153
  try {
37022
- raw = (await import_node_fs10.promises.readFile(snapshotCachePath(), "utf8")).trim();
37154
+ raw = (await import_node_fs11.promises.readFile(snapshotCachePath(), "utf8")).trim();
37023
37155
  } catch {
37024
37156
  return /* @__PURE__ */ new Map();
37025
37157
  }
@@ -37063,13 +37195,13 @@ async function writePersistedSnapshots(snapshots) {
37063
37195
  2
37064
37196
  );
37065
37197
  try {
37066
- await import_node_fs10.promises.mkdir(import_node_path14.default.dirname(filePath), { recursive: true });
37067
- await import_node_fs10.promises.writeFile(tmpPath, `${payload}
37198
+ await import_node_fs11.promises.mkdir(import_node_path15.default.dirname(filePath), { recursive: true });
37199
+ await import_node_fs11.promises.writeFile(tmpPath, `${payload}
37068
37200
  `, "utf8");
37069
- await import_node_fs10.promises.rename(tmpPath, filePath);
37201
+ await import_node_fs11.promises.rename(tmpPath, filePath);
37070
37202
  } catch {
37071
37203
  try {
37072
- await import_node_fs10.promises.rm(tmpPath, { force: true });
37204
+ await import_node_fs11.promises.rm(tmpPath, { force: true });
37073
37205
  } catch {
37074
37206
  }
37075
37207
  }
@@ -39515,7 +39647,7 @@ var ProfileManager = class {
39515
39647
  }
39516
39648
  throw error;
39517
39649
  }
39518
- const trashRoot = process.platform === "darwin" ? import_path.default.join(process.env.HOME || import_node_os5.default.homedir(), ".Trash") : import_path.default.join(getUserDataDir(), "deleted-profile-homes");
39650
+ 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");
39519
39651
  await import_fs.promises.mkdir(trashRoot, { recursive: true, mode: 448 });
39520
39652
  const safeName = record2.name.replace(/[^A-Za-z0-9._-]+/g, "-").slice(0, 48) || "profile";
39521
39653
  const destination = import_path.default.join(
@@ -40504,6 +40636,7 @@ var ProfileManager = class {
40504
40636
  const leaseId = await this.acquireProfileRuntimeLease(record2);
40505
40637
  const envOverrides = buildCodexChildEnv({
40506
40638
  HOME: profileHome,
40639
+ USERPROFILE: profileHome,
40507
40640
  CODEX_HOME: profileHome,
40508
40641
  CODEX_SQLITE_HOME: profileHome
40509
40642
  });
@@ -40624,6 +40757,7 @@ var ProfileManager = class {
40624
40757
  leaseId,
40625
40758
  env: buildCodexChildEnv({
40626
40759
  HOME: profileHome,
40760
+ USERPROFILE: profileHome,
40627
40761
  CODEX_HOME: profileHome,
40628
40762
  CODEX_SQLITE_HOME: profileHome
40629
40763
  })
@@ -41955,6 +42089,7 @@ async function prepareManagedProfileRuntime(profileManager, profileName, options
41955
42089
  leaseId: null,
41956
42090
  env: buildCodexChildEnv({
41957
42091
  HOME: profileHome,
42092
+ USERPROFILE: profileHome,
41958
42093
  CODEX_HOME: profileHome,
41959
42094
  CODEX_SQLITE_HOME: profileHome
41960
42095
  })
@@ -42464,7 +42599,7 @@ function pruneStore(store) {
42464
42599
  return store;
42465
42600
  }
42466
42601
  function resolveAccountPoolDbPath(stateDir) {
42467
- return import_node_path15.default.join(stateDir, "state.sqlite");
42602
+ return import_node_path16.default.join(stateDir, "state.sqlite");
42468
42603
  }
42469
42604
  async function readStore(stateDir) {
42470
42605
  const dbPath = resolveAccountPoolDbPath(stateDir);
@@ -42565,9 +42700,9 @@ async function listSessions(stateDir) {
42565
42700
  }
42566
42701
  function resolveRuntimeStateDir(runtime, explicitStateDir) {
42567
42702
  if (explicitStateDir) {
42568
- return import_node_path15.default.resolve(explicitStateDir);
42703
+ return import_node_path16.default.resolve(explicitStateDir);
42569
42704
  }
42570
- return import_node_path15.default.join(getUserDataDir(), DESKTOP_RPC_STATE_DIR);
42705
+ return import_node_path16.default.join(getUserDataDir(), DESKTOP_RPC_STATE_DIR);
42571
42706
  }
42572
42707
  function resolveStateDir(flags) {
42573
42708
  const runtimeFlag = parseStringFlag(flags, "--runtime")?.trim().toLowerCase();
@@ -43016,7 +43151,7 @@ async function handleAccountPoolCommand(args2, version) {
43016
43151
 
43017
43152
  // src/commands/codex.ts
43018
43153
  var import_node_child_process9 = require("child_process");
43019
- var import_node_os6 = __toESM(require("os"));
43154
+ var import_node_os9 = __toESM(require("os"));
43020
43155
 
43021
43156
  // ../../packages/runtime-profiles/src/profiles/rate-limit-notifier.ts
43022
43157
  function maxUsedPercent(snapshot2) {
@@ -43135,22 +43270,22 @@ async function assertProfileAccessAllowed(profileManager, profileName) {
43135
43270
  }
43136
43271
 
43137
43272
  // ../../packages/runtime-app-state/src/app/workspaceBindings.ts
43138
- var import_node_fs11 = require("fs");
43139
- var import_node_path16 = __toESM(require("path"), 1);
43273
+ var import_node_fs12 = require("fs");
43274
+ var import_node_path17 = __toESM(require("path"), 1);
43140
43275
  async function canonicalizeWorkspacePath(input, options = {}) {
43141
- const resolved = import_node_path16.default.resolve(input || process.cwd());
43276
+ const resolved = import_node_path17.default.resolve(input || process.cwd());
43142
43277
  try {
43143
- const canonical = await import_node_fs11.promises.realpath(resolved);
43278
+ const canonical = await import_node_fs12.promises.realpath(resolved);
43144
43279
  if (options.requireDirectory !== false) {
43145
- const stats = await import_node_fs11.promises.stat(canonical);
43280
+ const stats = await import_node_fs12.promises.stat(canonical);
43146
43281
  if (!stats.isDirectory()) {
43147
43282
  throw new Error(`Workspace path is not a directory: ${resolved}`);
43148
43283
  }
43149
43284
  }
43150
- return import_node_path16.default.normalize(canonical);
43285
+ return import_node_path17.default.normalize(canonical);
43151
43286
  } catch (error) {
43152
43287
  if (options.requireDirectory === false) {
43153
- return import_node_path16.default.normalize(resolved);
43288
+ return import_node_path17.default.normalize(resolved);
43154
43289
  }
43155
43290
  const message = error instanceof Error ? error.message : String(error);
43156
43291
  const symptom = new Error(
@@ -43217,7 +43352,7 @@ async function resolveWorkspaceProfileBinding(requestedPath) {
43217
43352
  inherited: candidate !== canonical
43218
43353
  };
43219
43354
  }
43220
- const parent = import_node_path16.default.dirname(candidate);
43355
+ const parent = import_node_path17.default.dirname(candidate);
43221
43356
  if (parent === candidate) {
43222
43357
  return null;
43223
43358
  }
@@ -43227,14 +43362,14 @@ async function resolveWorkspaceProfileBinding(requestedPath) {
43227
43362
 
43228
43363
  // src/platform/codexCli.ts
43229
43364
  var import_node_child_process8 = require("child_process");
43230
- var import_node_fs12 = require("fs");
43231
- var import_node_path17 = __toESM(require("path"));
43365
+ var import_node_fs13 = require("fs");
43366
+ var import_node_path18 = __toESM(require("path"));
43232
43367
  var ENV_HINTS2 = ["CODEX_BINARY", "CODEX_CLI_PATH", "CODEX_PATH"];
43233
43368
  function fileExists2(candidate) {
43234
43369
  if (!candidate) return null;
43235
- const resolved = import_node_path17.default.resolve(candidate);
43370
+ const resolved = import_node_path18.default.resolve(candidate);
43236
43371
  try {
43237
- const stat3 = (0, import_node_fs12.statSync)(resolved);
43372
+ const stat3 = (0, import_node_fs13.statSync)(resolved);
43238
43373
  if (stat3.isFile()) return resolved;
43239
43374
  } catch {
43240
43375
  return null;
@@ -43252,9 +43387,9 @@ function resolveFromEnv() {
43252
43387
  }
43253
43388
  function resolveFromPath() {
43254
43389
  const pathValue = process.env.PATH ?? "";
43255
- const entries3 = pathValue.split(import_node_path17.default.delimiter).filter(Boolean);
43390
+ const entries3 = pathValue.split(import_node_path18.default.delimiter).filter(Boolean);
43256
43391
  for (const entry of entries3) {
43257
- const candidate = fileExists2(import_node_path17.default.join(entry, "codex"));
43392
+ const candidate = fileExists2(import_node_path18.default.join(entry, "codex"));
43258
43393
  if (candidate) return candidate;
43259
43394
  }
43260
43395
  return null;
@@ -43435,7 +43570,7 @@ function exitCodeForSignal(signal) {
43435
43570
  if (!signal) return 1;
43436
43571
  if (signal === "SIGINT") return 130;
43437
43572
  if (signal === "SIGTERM") return 143;
43438
- const number3 = import_node_os6.default.constants.signals[signal];
43573
+ const number3 = import_node_os9.default.constants.signals[signal];
43439
43574
  return typeof number3 === "number" ? 128 + number3 : 1;
43440
43575
  }
43441
43576
  async function runCodexWithProfile(manager, profileName, codexArgs) {
@@ -43702,14 +43837,14 @@ async function handleLicense(args2, version) {
43702
43837
  }
43703
43838
 
43704
43839
  // src/commands/profile.ts
43705
- var import_node_fs14 = require("fs");
43706
- var import_node_os7 = __toESM(require("os"));
43707
- var import_node_path19 = __toESM(require("path"));
43840
+ var import_node_fs15 = require("fs");
43841
+ var import_node_os10 = __toESM(require("os"));
43842
+ var import_node_path20 = __toESM(require("path"));
43708
43843
 
43709
43844
  // ../../packages/runtime-app-state/src/app/officialCodexSwitchCoordinator.ts
43710
43845
  var import_node_crypto17 = require("crypto");
43711
- var import_node_fs13 = require("fs");
43712
- var import_node_path18 = __toESM(require("path"), 1);
43846
+ var import_node_fs14 = require("fs");
43847
+ var import_node_path19 = __toESM(require("path"), 1);
43713
43848
  var DEFAULT_SWITCH_INTENT_TTL_MS = 10 * 60 * 1e3;
43714
43849
  var SWITCH_INTENT_RENEW_MS = 30 * 1e3;
43715
43850
  var PROCESS_OWNER_ID3 = (0, import_node_crypto17.randomUUID)();
@@ -44529,7 +44664,7 @@ function formatProfileLabel(name, displayName) {
44529
44664
  }
44530
44665
  var AUTO_ROLL_ACCESS_REQUIRED_MESSAGE = "Auto-roll requires a Pro license or an active trial.";
44531
44666
  async function withIsolatedCodexLogin(mode, action) {
44532
- const home = await import_node_fs14.promises.mkdtemp(import_node_path19.default.join(import_node_os7.default.tmpdir(), "codexuse-cli-login-"));
44667
+ const home = await import_node_fs15.promises.mkdtemp(import_node_path20.default.join(import_node_os10.default.tmpdir(), "codexuse-cli-login-"));
44533
44668
  try {
44534
44669
  await runCodexLogin(mode, {
44535
44670
  HOME: home,
@@ -44537,9 +44672,9 @@ async function withIsolatedCodexLogin(mode, action) {
44537
44672
  CODEX_SQLITE_HOME: home,
44538
44673
  ELECTRON_RUN_AS_NODE: "1"
44539
44674
  });
44540
- return await action(import_node_path19.default.join(home, "auth.json"));
44675
+ return await action(import_node_path20.default.join(home, "auth.json"));
44541
44676
  } finally {
44542
- await import_node_fs14.promises.rm(home, { recursive: true, force: true }).catch(() => void 0);
44677
+ await import_node_fs15.promises.rm(home, { recursive: true, force: true }).catch(() => void 0);
44543
44678
  }
44544
44679
  }
44545
44680
  async function assertOfficialCodexProfileStopped(profileName) {
@@ -46040,15 +46175,15 @@ async function pushRemoteSnapshot(access, snapshot2, options) {
46040
46175
  }
46041
46176
 
46042
46177
  // ../../packages/runtime-profiles/src/cloud-sync/journal.ts
46043
- var import_node_fs15 = require("fs");
46178
+ var import_node_fs16 = require("fs");
46044
46179
  var import_node_crypto18 = require("crypto");
46045
- var import_node_path20 = __toESM(require("path"), 1);
46180
+ var import_node_path21 = __toESM(require("path"), 1);
46046
46181
  var JOURNAL_FILENAME = "cloud-sync-pull.journal.json";
46047
46182
  function getCloudSyncJournalPath() {
46048
- return import_node_path20.default.join(getUserDataDir(), JOURNAL_FILENAME);
46183
+ return import_node_path21.default.join(getUserDataDir(), JOURNAL_FILENAME);
46049
46184
  }
46050
46185
  async function syncDirectory(dir) {
46051
- const directory = await import_node_fs15.promises.open(dir, "r");
46186
+ const directory = await import_node_fs16.promises.open(dir, "r");
46052
46187
  try {
46053
46188
  await directory.sync();
46054
46189
  } finally {
@@ -46057,30 +46192,30 @@ async function syncDirectory(dir) {
46057
46192
  }
46058
46193
  async function writeCloudSyncJournal(journal) {
46059
46194
  const target = getCloudSyncJournalPath();
46060
- const dir = import_node_path20.default.dirname(target);
46061
- await import_node_fs15.promises.mkdir(dir, { recursive: true, mode: 448 });
46062
- await import_node_fs15.promises.chmod(dir, 448);
46195
+ const dir = import_node_path21.default.dirname(target);
46196
+ await import_node_fs16.promises.mkdir(dir, { recursive: true, mode: 448 });
46197
+ await import_node_fs16.promises.chmod(dir, 448);
46063
46198
  const staging = `${target}.tmp-${process.pid}-${(0, import_node_crypto18.randomUUID)()}`;
46064
- await import_node_fs15.promises.writeFile(staging, JSON.stringify(journal), {
46199
+ await import_node_fs16.promises.writeFile(staging, JSON.stringify(journal), {
46065
46200
  encoding: "utf8",
46066
46201
  flag: "wx",
46067
46202
  mode: 384,
46068
46203
  flush: true
46069
46204
  });
46070
- await import_node_fs15.promises.rename(staging, target);
46205
+ await import_node_fs16.promises.rename(staging, target);
46071
46206
  await syncDirectory(dir);
46072
46207
  }
46073
46208
  async function clearCloudSyncJournal() {
46074
46209
  const target = getCloudSyncJournalPath();
46075
46210
  try {
46076
- await import_node_fs15.promises.unlink(target);
46211
+ await import_node_fs16.promises.unlink(target);
46077
46212
  } catch (error) {
46078
46213
  if (error?.code === "ENOENT") {
46079
46214
  return;
46080
46215
  }
46081
46216
  throw error;
46082
46217
  }
46083
- await syncDirectory(import_node_path20.default.dirname(target));
46218
+ await syncDirectory(import_node_path21.default.dirname(target));
46084
46219
  }
46085
46220
 
46086
46221
  // ../../packages/runtime-profiles/src/cloud-sync/encryption.ts
@@ -46877,7 +47012,7 @@ async function handleSync(args2, version) {
46877
47012
  }
46878
47013
 
46879
47014
  // src/commands/workspace.ts
46880
- var import_node_fs16 = require("fs");
47015
+ var import_node_fs17 = require("fs");
46881
47016
  function printWorkspaceHelp() {
46882
47017
  console.log(`Usage:
46883
47018
  codexuse workspace bind <path> <profile>
@@ -46907,7 +47042,7 @@ async function handleWorkspaceCommand(args2) {
46907
47042
  return;
46908
47043
  }
46909
47044
  for (const binding of bindings) {
46910
- const pathState = await import_node_fs16.promises.stat(binding.rootPath).then(() => "").catch(() => " (path missing)");
47045
+ const pathState = await import_node_fs17.promises.stat(binding.rootPath).then(() => "").catch(() => " (path missing)");
46911
47046
  const profileState = profiles.has(binding.profileName) ? "" : " (profile missing)";
46912
47047
  console.log(`${binding.rootPath} -> ${binding.profileName}${pathState}${profileState}`);
46913
47048
  }
@@ -46971,7 +47106,7 @@ async function ensureCliStorageReady() {
46971
47106
  }
46972
47107
 
46973
47108
  // src/app/main.ts
46974
- var VERSION = true ? "6.2.11" : "0.0.0";
47109
+ var VERSION = true ? "6.3.0" : "0.0.0";
46975
47110
  async function runCli() {
46976
47111
  const args2 = process.argv.slice(2);
46977
47112
  if (args2.length === 0) {