@martinffx/atelier 3.7.0 → 3.8.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/atelier.js CHANGED
@@ -4559,7 +4559,7 @@ var require_sbcs = __commonJS(function(exports2) {
4559
4559
  return mod && mod.__esModule ? mod : { default: mod };
4560
4560
  };
4561
4561
  Object.defineProperty(exports2, "__esModule", { value: true });
4562
- exports2.KOI8_R = exports2.windows_1256 = exports2.windows_1251 = exports2.ISO_8859_9 = exports2.ISO_8859_8 = exports2.ISO_8859_7 = exports2.ISO_8859_6 = exports2.ISO_8859_5 = exports2.ISO_8859_2 = exports2.ISO_8859_1 = undefined;
4562
+ exports2.KOI8_R = exports2.windows_874 = exports2.windows_1258 = exports2.windows_1257 = exports2.windows_1256 = exports2.windows_1251 = exports2.ISO_8859_9 = exports2.ISO_8859_8 = exports2.ISO_8859_7 = exports2.ISO_8859_6 = exports2.ISO_8859_5 = exports2.ISO_8859_2 = exports2.ISO_8859_1 = undefined;
4563
4563
  var match_1 = __importDefault(require_match());
4564
4564
  var N_GRAM_MASK = 16777215;
4565
4565
 
@@ -8575,6 +8575,446 @@ var require_sbcs = __commonJS(function(exports2) {
8575
8575
  }
8576
8576
  exports2.windows_1256 = windows_1256;
8577
8577
 
8578
+ class windows_1257 extends sbcs {
8579
+ match(det) {
8580
+ return det.inputBytes.some((byte) => byte >= 128) ? super.match(det) : null;
8581
+ }
8582
+ byteMap() {
8583
+ const byteMap = new Array(256).fill(32);
8584
+ byteMap[39] = 0;
8585
+ for (let i = 65;i <= 90; i++)
8586
+ byteMap[i] = i + 32;
8587
+ for (let i = 97;i <= 122; i++)
8588
+ byteMap[i] = i;
8589
+ byteMap[142] = 142;
8590
+ byteMap[168] = byteMap[184] = 184;
8591
+ byteMap[170] = byteMap[186] = 186;
8592
+ byteMap[175] = byteMap[191] = 191;
8593
+ byteMap[181] = 181;
8594
+ for (let i = 192;i <= 214; i++)
8595
+ byteMap[i] = i + 32;
8596
+ for (let i = 216;i <= 222; i++)
8597
+ byteMap[i] = i + 32;
8598
+ byteMap[223] = 223;
8599
+ for (let i = 224;i <= 246; i++)
8600
+ byteMap[i] = i;
8601
+ for (let i = 248;i <= 254; i++)
8602
+ byteMap[i] = i;
8603
+ return byteMap;
8604
+ }
8605
+ ngrams() {
8606
+ return [
8607
+ new NGramsPlusLang("et", [
8608
+ 2122090,
8609
+ 2122098,
8610
+ 2123109,
8611
+ 2124135,
8612
+ 2124385,
8613
+ 2124641,
8614
+ 2124645,
8615
+ 2124649,
8616
+ 2124655,
8617
+ 2124661,
8618
+ 2124897,
8619
+ 2125417,
8620
+ 2125678,
8621
+ 2126441,
8622
+ 2126693,
8623
+ 2126949,
8624
+ 6365281,
8625
+ 6365290,
8626
+ 6365291,
8627
+ 6365292,
8628
+ 6382112,
8629
+ 6382624,
8630
+ 6384499,
8631
+ 6386549,
8632
+ 6386785,
8633
+ 6387297,
8634
+ 6561908,
8635
+ 6578464,
8636
+ 6583667,
8637
+ 6627435,
8638
+ 6627443,
8639
+ 6645100,
8640
+ 6645107,
8641
+ 6646816,
8642
+ 6646885,
8643
+ 6646900,
8644
+ 6648608,
8645
+ 6648692,
8646
+ 6889579,
8647
+ 6906912,
8648
+ 6910570,
8649
+ 6910752,
8650
+ 6971680,
8651
+ 7037299,
8652
+ 7038309,
8653
+ 7039346,
8654
+ 7040879,
8655
+ 7041893,
8656
+ 7041908,
8657
+ 7104875,
8658
+ 7107616,
8659
+ 7544929,
8660
+ 7544939,
8661
+ 7562528,
8662
+ 7562604,
8663
+ 7566437,
8664
+ 7566441,
8665
+ 7566708,
8666
+ 7627115,
8667
+ 7627124,
8668
+ 7629088,
8669
+ 7697184,
8670
+ 7697253,
8671
+ 7697505
8672
+ ]),
8673
+ new NGramsPlusLang("lv", [
8674
+ 2122098,
8675
+ 2122601,
8676
+ 2122849,
8677
+ 2124146,
8678
+ 2124154,
8679
+ 2124897,
8680
+ 2125282,
8681
+ 2125921,
8682
+ 2125938,
8683
+ 2126433,
8684
+ 2126689,
8685
+ 2126699,
8686
+ 2126949,
8687
+ 2127214,
8688
+ 2127457,
8689
+ 6365289,
8690
+ 6365301,
8691
+ 6365302,
8692
+ 6382185,
8693
+ 6383904,
8694
+ 6384499,
8695
+ 6384751,
8696
+ 6385778,
8697
+ 6386293,
8698
+ 6386464,
8699
+ 6386806,
8700
+ 6449509,
8701
+ 6452512,
8702
+ 6515052,
8703
+ 6515060,
8704
+ 6578464,
8705
+ 6578546,
8706
+ 6583584,
8707
+ 6584864,
8708
+ 6644850,
8709
+ 6646123,
8710
+ 6646643,
8711
+ 6647393,
8712
+ 6648608,
8713
+ 6680693,
8714
+ 6889577,
8715
+ 6907236,
8716
+ 6907376,
8717
+ 6908642,
8718
+ 6909046,
8719
+ 7041908,
8720
+ 7102836,
8721
+ 7106404,
8722
+ 7233824,
8723
+ 7300193,
8724
+ 7496043,
8725
+ 7501166,
8726
+ 7544947,
8727
+ 7544949,
8728
+ 7544950,
8729
+ 7566453,
8730
+ 7566574,
8731
+ 7632160,
8732
+ 7632489,
8733
+ 7676022,
8734
+ 7695904,
8735
+ 7697184,
8736
+ 7758188,
8737
+ 14840608
8738
+ ]),
8739
+ new NGramsPlusLang("lt", [
8740
+ 2122089,
8741
+ 2122341,
8742
+ 2124146,
8743
+ 2124641,
8744
+ 2124905,
8745
+ 2125167,
8746
+ 2126433,
8747
+ 2126689,
8748
+ 2126699,
8749
+ 2126709,
8750
+ 2126945,
8751
+ 2126949,
8752
+ 2126965,
8753
+ 2127457,
8754
+ 2127465,
8755
+ 6365300,
8756
+ 6365424,
8757
+ 6383904,
8758
+ 6383988,
8759
+ 6384112,
8760
+ 6384738,
8761
+ 6384993,
8762
+ 6385268,
8763
+ 6386274,
8764
+ 6386292,
8765
+ 6386976,
8766
+ 6387050,
8767
+ 6418553,
8768
+ 6447392,
8769
+ 6448489,
8770
+ 6448494,
8771
+ 6647401,
8772
+ 6648949,
8773
+ 6889569,
8774
+ 6889577,
8775
+ 6889579,
8776
+ 6889581,
8777
+ 6906217,
8778
+ 6907246,
8779
+ 6907252,
8780
+ 6909543,
8781
+ 6910496,
8782
+ 6910752,
8783
+ 6942827,
8784
+ 6971757,
8785
+ 6972704,
8786
+ 7037289,
8787
+ 7037292,
8788
+ 7103073,
8789
+ 7104869,
8790
+ 7170419,
8791
+ 7171947,
8792
+ 7269152,
8793
+ 7301733,
8794
+ 7302009,
8795
+ 7303968,
8796
+ 7496176,
8797
+ 7544937,
8798
+ 7544939,
8799
+ 7544950,
8800
+ 7564129,
8801
+ 7629088,
8802
+ 7632246,
8803
+ 7957356
8804
+ ])
8805
+ ];
8806
+ }
8807
+ name() {
8808
+ return "windows-1257";
8809
+ }
8810
+ }
8811
+ exports2.windows_1257 = windows_1257;
8812
+
8813
+ class windows_1258 extends sbcs {
8814
+ match(det) {
8815
+ return det.inputBytes.some((byte) => byte >= 128) ? super.match(det) : null;
8816
+ }
8817
+ byteMap() {
8818
+ const byteMap = new Array(256).fill(32);
8819
+ byteMap[39] = 0;
8820
+ for (let i = 65;i <= 90; i++)
8821
+ byteMap[i] = i + 32;
8822
+ for (let i = 97;i <= 122; i++)
8823
+ byteMap[i] = i;
8824
+ byteMap[131] = 131;
8825
+ byteMap[136] = 136;
8826
+ byteMap[140] = byteMap[156] = 156;
8827
+ byteMap[159] = 255;
8828
+ byteMap[170] = 170;
8829
+ byteMap[181] = 181;
8830
+ byteMap[186] = 186;
8831
+ for (let i = 192;i <= 203; i++)
8832
+ byteMap[i] = i + 32;
8833
+ byteMap[204] = 204;
8834
+ for (let i = 205;i <= 209; i++)
8835
+ byteMap[i] = i + 32;
8836
+ byteMap[210] = 210;
8837
+ for (let i = 211;i <= 214; i++)
8838
+ byteMap[i] = i + 32;
8839
+ for (let i = 216;i <= 221; i++)
8840
+ byteMap[i] = i + 32;
8841
+ byteMap[222] = 222;
8842
+ byteMap[223] = 223;
8843
+ for (let i = 224;i <= 246; i++)
8844
+ byteMap[i] = i;
8845
+ for (let i = 248;i <= 253; i++)
8846
+ byteMap[i] = i;
8847
+ byteMap[255] = 255;
8848
+ return byteMap;
8849
+ }
8850
+ ngrams() {
8851
+ return [
8852
+ 2122600,
8853
+ 2122721,
8854
+ 2123625,
8855
+ 2123887,
8856
+ 2125415,
8857
+ 2125928,
8858
+ 2126952,
8859
+ 2126953,
8860
+ 2126962,
8861
+ 2127465,
8862
+ 2127584,
8863
+ 6419060,
8864
+ 6496355,
8865
+ 6496374,
8866
+ 6514720,
8867
+ 6514925,
8868
+ 6545763,
8869
+ 6758504,
8870
+ 6758510,
8871
+ 6758516,
8872
+ 6758518,
8873
+ 6812782,
8874
+ 6815198,
8875
+ 6815221,
8876
+ 6824052,
8877
+ 6844402,
8878
+ 6876526,
8879
+ 6889582,
8880
+ 6889588,
8881
+ 6941394,
8882
+ 6941420,
8883
+ 6941426,
8884
+ 7217251,
8885
+ 7217262,
8886
+ 7217268,
8887
+ 7235360,
8888
+ 7235572,
8889
+ 7235581,
8890
+ 7235616,
8891
+ 7302759,
8892
+ 7336547,
8893
+ 7610483,
8894
+ 7629053,
8895
+ 7629290,
8896
+ 7631471,
8897
+ 7676020,
8898
+ 7760362,
8899
+ 7790624,
8900
+ 13396256,
8901
+ 13397607,
8902
+ 14557288,
8903
+ 14771048,
8904
+ 15395950,
8905
+ 15397492,
8906
+ 15494759,
8907
+ 15496224,
8908
+ 15560296,
8909
+ 15885088,
8910
+ 15886624,
8911
+ 15887904,
8912
+ 15889440,
8913
+ 16018976,
8914
+ 16108649,
8915
+ 16643532
8916
+ ];
8917
+ }
8918
+ name() {
8919
+ return "windows-1258";
8920
+ }
8921
+ language() {
8922
+ return "vi";
8923
+ }
8924
+ }
8925
+ exports2.windows_1258 = windows_1258;
8926
+
8927
+ class windows_874 extends sbcs {
8928
+ byteMap() {
8929
+ const byteMap = new Array(256).fill(32);
8930
+ byteMap[39] = 0;
8931
+ for (let i = 65;i <= 90; i++)
8932
+ byteMap[i] = i + 32;
8933
+ for (let i = 97;i <= 122; i++)
8934
+ byteMap[i] = i;
8935
+ for (let i = 161;i <= 218; i++)
8936
+ byteMap[i] = i;
8937
+ for (let i = 223;i <= 251; i++)
8938
+ byteMap[i] = i;
8939
+ return byteMap;
8940
+ }
8941
+ ngrams() {
8942
+ return [
8943
+ 2138578,
8944
+ 2138856,
8945
+ 2146514,
8946
+ 2148291,
8947
+ 2154949,
8948
+ 10604985,
8949
+ 10605251,
8950
+ 10669479,
8951
+ 10671554,
8952
+ 10799058,
8953
+ 11064263,
8954
+ 11195847,
8955
+ 11200960,
8956
+ 11200995,
8957
+ 11910083,
8958
+ 12042976,
8959
+ 12042979,
8960
+ 12047848,
8961
+ 12132544,
8962
+ 12165586,
8963
+ 12173522,
8964
+ 12305360,
8965
+ 12314553,
8966
+ 12636873,
8967
+ 12828960,
8968
+ 12829619,
8969
+ 12829633,
8970
+ 12832936,
8971
+ 12832994,
8972
+ 12837026,
8973
+ 13091779,
8974
+ 13095353,
8975
+ 13095617,
8976
+ 13096117,
8977
+ 13226679,
8978
+ 13226724,
8979
+ 13293544,
8980
+ 13477063,
8981
+ 13674707,
8982
+ 13689538,
8983
+ 13744416,
8984
+ 13805473,
8985
+ 13812171,
8986
+ 13812452,
8987
+ 13812512,
8988
+ 13812704,
8989
+ 13814226,
8990
+ 13821111,
8991
+ 13879249,
8992
+ 13940155,
8993
+ 14009017,
8994
+ 14010324,
8995
+ 14149837,
8996
+ 14721749,
8997
+ 14728167,
8998
+ 14796240,
8999
+ 14860964,
9000
+ 14920425,
9001
+ 14924193,
9002
+ 14989250,
9003
+ 15258279,
9004
+ 15262634,
9005
+ 15319250,
9006
+ 15328185
9007
+ ];
9008
+ }
9009
+ name() {
9010
+ return "windows-874";
9011
+ }
9012
+ language() {
9013
+ return "th";
9014
+ }
9015
+ }
9016
+ exports2.windows_874 = windows_874;
9017
+
8578
9018
  class KOI8_R extends sbcs {
8579
9019
  byteMap() {
8580
9020
  return [
@@ -9130,6 +9570,9 @@ var require_lib2 = __commonJS(function(exports2) {
9130
9570
  new sbcs.ISO_8859_9,
9131
9571
  new sbcs.windows_1251,
9132
9572
  new sbcs.windows_1256,
9573
+ new sbcs.windows_1257,
9574
+ new sbcs.windows_1258,
9575
+ new sbcs.windows_874,
9133
9576
  new sbcs.KOI8_R,
9134
9577
  new ascii_1.default
9135
9578
  ];
@@ -9547,7 +9990,7 @@ var require_utf32 = __commonJS(function(exports2) {
9547
9990
  }
9548
9991
  Utf32Encoder.prototype.write = function(str2) {
9549
9992
  var src = Buffer2.from(str2, "ucs2");
9550
- var dst = Buffer2.alloc(src.length * 2);
9993
+ var dst = Buffer2.alloc(src.length * 2 + 4);
9551
9994
  var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
9552
9995
  var offset = 0;
9553
9996
  for (var i = 0;i < src.length; i += 2) {
@@ -9614,9 +10057,9 @@ var require_utf32 = __commonJS(function(exports2) {
9614
10057
  }
9615
10058
  if (overflow.length === 4) {
9616
10059
  if (isLE) {
9617
- codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24;
10060
+ codepoint = overflow[0] | overflow[1] << 8 | overflow[2] << 16 | overflow[3] << 24;
9618
10061
  } else {
9619
- codepoint = overflow[i + 3] | overflow[i + 2] << 8 | overflow[i + 1] << 16 | overflow[i] << 24;
10062
+ codepoint = overflow[3] | overflow[2] << 8 | overflow[1] << 16 | overflow[0] << 24;
9620
10063
  }
9621
10064
  overflow.length = 0;
9622
10065
  offset = _writeCodepoint(dst, offset, codepoint, badChar);
@@ -9651,7 +10094,11 @@ var require_utf32 = __commonJS(function(exports2) {
9651
10094
  return offset;
9652
10095
  }
9653
10096
  Utf32Decoder.prototype.end = function() {
10097
+ if (this.overflow.length === 0) {
10098
+ return;
10099
+ }
9654
10100
  this.overflow.length = 0;
10101
+ return String.fromCharCode(this.badChar);
9655
10102
  };
9656
10103
  exports2.utf32 = Utf32AutoCodec;
9657
10104
  exports2.ucs4 = "utf32";
@@ -10268,6 +10715,8 @@ var require_sbcs_data = __commonJS(function(exports2, module2) {
10268
10715
  elot928: "iso88597",
10269
10716
  hebrew: "iso88598",
10270
10717
  hebrew8: "iso88598",
10718
+ iso88598i: "iso88598",
10719
+ iso88598e: "iso88598",
10271
10720
  turkish: "iso88599",
10272
10721
  turkish8: "iso88599",
10273
10722
  thai: "iso885911",
@@ -23025,7 +23474,7 @@ var require_omap = __commonJS(function(exports2, module2) {
23025
23474
  function resolveYamlOmap(data) {
23026
23475
  if (data === null)
23027
23476
  return true;
23028
- var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
23477
+ var objectKeys = {}, index, length, pair, pairKey, pairHasKey, object = data;
23029
23478
  for (index = 0, length = object.length;index < length; index += 1) {
23030
23479
  pair = object[index];
23031
23480
  pairHasKey = false;
@@ -23041,10 +23490,9 @@ var require_omap = __commonJS(function(exports2, module2) {
23041
23490
  }
23042
23491
  if (!pairHasKey)
23043
23492
  return false;
23044
- if (objectKeys.indexOf(pairKey) === -1)
23045
- objectKeys.push(pairKey);
23046
- else
23493
+ if (_hasOwnProperty.call(objectKeys, pairKey))
23047
23494
  return false;
23495
+ Object.defineProperty(objectKeys, pairKey, { value: true });
23048
23496
  }
23049
23497
  return true;
23050
23498
  }
@@ -23387,6 +23835,7 @@ var require_loader = __commonJS(function(exports2, module2) {
23387
23835
  this.legacy = options2["legacy"] || false;
23388
23836
  this.json = options2["json"] || false;
23389
23837
  this.listener = options2["listener"] || null;
23838
+ this.maxTotalMergeKeys = typeof options2["maxTotalMergeKeys"] === "number" ? options2["maxTotalMergeKeys"] : 1e4;
23390
23839
  this.implicitTypes = this.schema.compiledImplicit;
23391
23840
  this.typeMap = this.schema.compiledTypeMap;
23392
23841
  this.length = input.length;
@@ -23394,6 +23843,7 @@ var require_loader = __commonJS(function(exports2, module2) {
23394
23843
  this.line = 0;
23395
23844
  this.lineStart = 0;
23396
23845
  this.lineIndent = 0;
23846
+ this.totalMergeKeys = 0;
23397
23847
  this.documents = [];
23398
23848
  }
23399
23849
  function generateError(state, message) {
@@ -23467,14 +23917,22 @@ var require_loader = __commonJS(function(exports2, module2) {
23467
23917
  state.result += _result;
23468
23918
  }
23469
23919
  }
23920
+ function chargeMergeWork(state) {
23921
+ state.totalMergeKeys += 1;
23922
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
23923
+ throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
23924
+ }
23925
+ }
23470
23926
  function mergeMappings(state, destination, source, overridableKeys) {
23471
23927
  var sourceKeys, key, index, quantity;
23472
23928
  if (!common.isObject(source)) {
23473
23929
  throwError(state, "cannot merge mappings; the provided source object is unacceptable");
23474
23930
  }
23931
+ chargeMergeWork(state);
23475
23932
  sourceKeys = Object.keys(source);
23476
23933
  for (index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
23477
23934
  key = sourceKeys[index];
23935
+ chargeMergeWork(state);
23478
23936
  if (!_hasOwnProperty.call(destination, key)) {
23479
23937
  setProperty(destination, key, source[key]);
23480
23938
  overridableKeys[key] = true;
@@ -23503,6 +23961,9 @@ var require_loader = __commonJS(function(exports2, module2) {
23503
23961
  }
23504
23962
  if (keyTag === "tag:yaml.org,2002:merge") {
23505
23963
  if (Array.isArray(valueNode)) {
23964
+ if (valueNode.length > 100) {
23965
+ throwError(state, "abnormal merge sequence size");
23966
+ }
23506
23967
  for (index = 0, quantity = valueNode.length;index < quantity; index += 1) {
23507
23968
  mergeMappings(state, _result, valueNode[index], overridableKeys);
23508
23969
  }
@@ -31854,7 +32315,7 @@ var nullableType = ZodNullable.create;
31854
32315
  var preprocessType = ZodEffects.createWithPreprocess;
31855
32316
  var pipelineType = ZodPipeline.create;
31856
32317
  // src/constants.ts
31857
- var Harness = ["claude", "opencode", "codex", "cursor"];
32318
+ var Harness = ["claude", "opencode", "codex"];
31858
32319
  var AGENT_NAMES = ["sentinel", "oracle", "architect", "keymaker"];
31859
32320
  var LEGACY_AGENT_NAME = "recon";
31860
32321
 
@@ -31941,6 +32402,131 @@ function listAdapters() {
31941
32402
  return [...adapters.values()];
31942
32403
  }
31943
32404
 
32405
+ // src/utils/thinking.ts
32406
+ var THINKING_LEVELS = ["default", "off", "on", "low", "medium", "high", "xhigh", "max"];
32407
+ function thinkingChoices(harness, model, session = false) {
32408
+ const id = modelId(model);
32409
+ if (/gpt-6(\.1)?-(astra|sol|luna|terra)$/.test(id)) {
32410
+ return ["default", .../astra$|6\.1-sol$/.test(id) ? [] : ["off"], "low", "medium", "high", "xhigh", "max"];
32411
+ }
32412
+ if (/^(opus|opusplan|sonnet|haiku|fable|best)$/.test(id) || /claude-(opus-5[-.]5|fable-5[-.]1|sonnet-5[-.]5|haiku-5[-.]5)$/.test(id)) {
32413
+ return ["default", "low", "medium", "high", "xhigh", ...harness === "claude" && session ? [] : ["max"]];
32414
+ }
32415
+ if (harness === "opencode") {
32416
+ if (/^(glm-5\.3(-flash)?|kimi-k3(\.1-pro)?|deepseek-v4(\.1-flash(-1017)?|-pro))$/.test(id))
32417
+ return ["default", "low", "high", "max"];
32418
+ if (/^(mimo-v2\.6-(pro|flash)(-free)?|minimax-m3(-free)?)$/.test(id))
32419
+ return ["default", "off", "on"];
32420
+ if (id === "minimax-m3.1-flash")
32421
+ return ["default", "low", "medium", "high", "xhigh", "max"];
32422
+ if (/^(gemini-4-argon(-contributor)?|gemini-3\.[5-8]-flash(-lite)?)$/.test(id))
32423
+ return ["default", "low", "medium", "high"];
32424
+ if (id === "grok-4.7")
32425
+ return ["default", "low", "medium", "high", "xhigh"];
32426
+ if (/^mistral-large-4(-0)?$/.test(id))
32427
+ return ["default", "off", "high"];
32428
+ if (/^inkling(-2)?(-small)?(-free)?$/.test(id))
32429
+ return ["default", "off", "low", "medium", "high", "max"];
32430
+ if (/^muse-(spark-1\.3(-contributor)?|wonder(-1\.0)?)$/.test(id))
32431
+ return ["default", "low", "medium", "high", "xhigh", "max"];
32432
+ if (id === "muse-spark-open")
32433
+ return ["default", "low", "medium", "high", "xhigh"];
32434
+ if (/^nemotron-3\.5-super-vl(-free)?$/.test(id))
32435
+ return ["default", "off", "low", "medium", "high", "xhigh"];
32436
+ if (id === "qwen3.8-max")
32437
+ return ["default", "off", "low", "medium", "xhigh"];
32438
+ if (/^qwen3\.8-max-(0902|prime)$/.test(id))
32439
+ return ["default", "low", "medium", "high", "xhigh"];
32440
+ if (id === "hy4")
32441
+ return ["default", "off", "high"];
32442
+ if (id === "step-5-preview")
32443
+ return ["default", "low", "medium", "high"];
32444
+ if (id === "ling-3.1-flash")
32445
+ return ["default", "off", "on"];
32446
+ if (/^beam-(free|1\.0-501b-a23b)$/.test(id))
32447
+ return ["default", "low", "medium", "high", "xhigh", "max"];
32448
+ }
32449
+ return ["default"];
32450
+ }
32451
+ var ROLES = ["session", ...AGENT_NAMES];
32452
+ var KIMI = /^kimi-k3(\.1-pro)?$/;
32453
+ var BEAM = /^beam-(free|1\.0-501b-a23b)$/;
32454
+ var RECOMMENDED = [
32455
+ [KIMI, [["low"], ["low"], ["high"], ["high"], ["low", "high"]]],
32456
+ [/^gemini-(4-argon(-contributor)?|\d(\.\d)?-flash(-lite)?)$/, [["medium"], ["low"], ["high"], ["high"], ["high", "medium"]]],
32457
+ [/^deepseek-v4(\.1-flash(-1017)?|-pro)$/, [["high"], ["low"], ["high"], ["high"], ["high"]]],
32458
+ [/^gpt-6(\.1)?-sol$/, [["medium"], ["low"], ["xhigh", "high"], ["high"], ["medium"]]],
32459
+ [/^gpt-6(\.1)?-(terra|luna)$/, [["medium"], ["low"], ["high"], ["high"], ["medium"]]],
32460
+ [/^gpt-6(\.1)?-astra$/, [["high"], ["low"], ["xhigh"], ["high"], ["medium"]]],
32461
+ [/^(opus|opusplan|fable|best)$|(^|\.)claude-(opus|fable)-/, [["medium"], ["low"], ["xhigh"], ["high"], ["medium"]]],
32462
+ [/^(sonnet|haiku)$|(^|\.)claude-(sonnet|haiku)-/, [["medium"], ["low", "default"], ["high"], ["high"], ["default"]]],
32463
+ [/^glm-5\.3(-flash)?$/, [["high"], ["low"], ["high"], ["high"], ["high"]]],
32464
+ [/^muse-(wonder(-1\.0)?|spark-1\.3(-contributor)?)$/, [["medium"], ["low"], ["xhigh", "high"], ["high"], ["high", "medium"]]],
32465
+ [/^grok-4\.7$/, [["medium"], ["low"], ["high"], ["high"], ["medium"]]],
32466
+ [/^inkling(-2)?-small(-free)?$/, [["medium"], ["low"], ["high"], ["high"], ["high"]]],
32467
+ [/^mimo-v2\.6-(pro|flash)(-free)?$/, [["on"], ["off"], ["on"], ["on"], ["on"]]],
32468
+ [/^minimax-m3\.1-flash$/, [["medium"], ["low"], ["high"], ["high"], ["high"]]],
32469
+ [/^mistral-large-4(-0)?$/, [["high"], ["off"], ["high"], ["high"], ["high"]]],
32470
+ [/^nemotron-3\.5-super-vl(-free)?$/, [["medium"], ["low"], ["high"], ["high"], ["high"]]],
32471
+ [/^qwen3\.8-max(-0902|-prime)?$/, [["medium"], ["low"], ["xhigh"], ["high", "xhigh"], ["medium"]]],
32472
+ [/^hy4$/, [["high"], ["off"], ["high"], ["high"], ["high"]]],
32473
+ [/^step-5-preview$/, [["medium"], ["low"], ["high"], ["high"], ["high", "medium"]]],
32474
+ [/^ling-3\.1-flash$/, [["on"], ["off"], ["on"], ["on"], ["on"]]],
32475
+ [BEAM, [["low"], ["low"], ["high"], ["high"], ["low", "high"]]]
32476
+ ];
32477
+ var modelId = (model) => model.split("/").at(-1).toLowerCase();
32478
+ function recommendedThinking(model, slot) {
32479
+ const index = ROLES.indexOf(slot === "plan" ? "architect" : slot);
32480
+ const id = modelId(model);
32481
+ return RECOMMENDED.find(([pattern]) => pattern.test(id))?.[1][index] ?? [];
32482
+ }
32483
+ function defaultThinking(model, slot) {
32484
+ return recommendedThinking(model, slot)[0] ?? "default";
32485
+ }
32486
+ function avoidsProviderDefault(model) {
32487
+ const id = modelId(model);
32488
+ return KIMI.test(id) || BEAM.test(id);
32489
+ }
32490
+ function assertThinking(harness, model, thinking, session = false) {
32491
+ if (thinking !== undefined && !thinkingChoices(harness, model, session).includes(thinking)) {
32492
+ throw new InvalidConfigError(`${model} does not support ${thinking} thinking in ${harness}${session ? " sessions" : ""}`);
32493
+ }
32494
+ }
32495
+ function codexThinking(thinking, legacy) {
32496
+ if (thinking === undefined)
32497
+ return legacy;
32498
+ if (thinking === "default")
32499
+ return;
32500
+ return thinking === "off" ? "none" : thinking;
32501
+ }
32502
+ function claudeModel(model) {
32503
+ return { opus: "claude-opus-5-5", fable: "claude-fable-5-1", best: "claude-fable-5-1", sonnet: "claude-sonnet-5-5", haiku: "claude-haiku-5-5" }[model] ?? model;
32504
+ }
32505
+ var OPENCODE_THINKING_KEYS = ["reasoningEffort", "thinking", "effort", "reasoningConfig", "reasoning", "thinkingConfig"];
32506
+ function openCodeThinkingOptions(model, thinking) {
32507
+ assertThinking("opencode", model, thinking);
32508
+ if (!thinking || thinking === "default")
32509
+ return {};
32510
+ if (model.startsWith("amazon-bedrock/")) {
32511
+ return { reasoningConfig: { type: "adaptive", maxReasoningEffort: thinking, display: "summarized" } };
32512
+ }
32513
+ if (model.startsWith("openrouter/")) {
32514
+ if (thinking === "on" || thinking === "off")
32515
+ return { reasoning: { enabled: thinking === "on" } };
32516
+ return { reasoning: { effort: thinking } };
32517
+ }
32518
+ if (model.startsWith("google/"))
32519
+ return { thinkingConfig: { thinkingLevel: thinking } };
32520
+ if (model.includes("claude-"))
32521
+ return { effort: thinking };
32522
+ if (thinking === "on" || thinking === "off") {
32523
+ if (/gpt-6|mistral-large|inkling|nemotron|hy4/.test(model))
32524
+ return { reasoningEffort: "none" };
32525
+ return { thinking: { type: thinking === "off" ? "disabled" : model.includes("minimax") ? "adaptive" : "enabled" } };
32526
+ }
32527
+ return { reasoningEffort: thinking };
32528
+ }
32529
+
31944
32530
  // src/utils/result.ts
31945
32531
  function ok(value) {
31946
32532
  return { ok: true, value };
@@ -31997,8 +32583,14 @@ function readConfig(path = CONFIG_PATH) {
31997
32583
  message: "Config format has changed"
31998
32584
  });
31999
32585
  }
32586
+ if (hasOnlyCursorHarness(parsed)) {
32587
+ return err({
32588
+ type: "invalid",
32589
+ message: "This config only configures Cursor, which is no longer supported. Run `atelier remove --harness cursor` on version 3.7.0 (for example `npx @martinffx/atelier@3.7.0 remove --harness cursor`), or delete ~/.atelier/config.json."
32590
+ });
32591
+ }
32000
32592
  try {
32001
- return ok(validateConfig(migrateLegacyAgentName(parsed)));
32593
+ return ok(validateConfig(migrateLegacyPlanMode(migrateLegacyAgentName(parsed))));
32002
32594
  } catch (validationErr) {
32003
32595
  const message = validationErr instanceof Error ? validationErr.message : String(validationErr);
32004
32596
  return err({ type: "invalid", message });
@@ -32032,6 +32624,53 @@ function migrateLegacyAgentName(config) {
32032
32624
  }
32033
32625
  return migrated;
32034
32626
  }
32627
+ function migrateLegacyPlanMode(config) {
32628
+ if (typeof config !== "object" || config === null) {
32629
+ return config;
32630
+ }
32631
+ const migrated = { ...config };
32632
+ const claude = migrated.claude;
32633
+ if (typeof claude === "object" && claude !== null) {
32634
+ const section = { ...claude };
32635
+ if (section.default_model === "opusplan") {
32636
+ section.build_thinking = section.plan_thinking ?? section.build_thinking;
32637
+ }
32638
+ if (Array.isArray(section.agents)) {
32639
+ section.agents = section.agents.map((agent) => {
32640
+ if (typeof agent !== "object" || agent === null || agent.model !== "opusplan") {
32641
+ return agent;
32642
+ }
32643
+ return { ...agent, model: "opus" };
32644
+ });
32645
+ }
32646
+ delete section.plan_thinking;
32647
+ migrated.claude = section;
32648
+ }
32649
+ const opencode = migrated.opencode;
32650
+ if (typeof opencode === "object" && opencode !== null) {
32651
+ const section = { ...opencode };
32652
+ const legacy = section.build_model !== undefined || section.plan_model !== undefined;
32653
+ if (section.default_model === undefined && section.build_model !== undefined) {
32654
+ section.default_model = section.build_model;
32655
+ }
32656
+ delete section.build_model;
32657
+ delete section.plan_model;
32658
+ if (legacy) {
32659
+ const supported = typeof section.default_model === "string" ? thinkingChoices("opencode", section.default_model) : [];
32660
+ if (!supported.includes(section.plan_thinking))
32661
+ delete section.plan_thinking;
32662
+ }
32663
+ migrated.opencode = section;
32664
+ }
32665
+ return migrated;
32666
+ }
32667
+ function hasOnlyCursorHarness(config) {
32668
+ if (typeof config !== "object" || config === null) {
32669
+ return false;
32670
+ }
32671
+ const record = config;
32672
+ return "cursor" in record && Harness.every((harness) => record[harness] == null);
32673
+ }
32035
32674
  function isOldFlatConfig(config) {
32036
32675
  if (typeof config !== "object" || config === null) {
32037
32676
  return false;
@@ -32100,207 +32739,123 @@ function resolveBasePath(harness) {
32100
32739
  return harness === "opencode" ? getGlobalOpencodeDir() : homedir2();
32101
32740
  }
32102
32741
 
32103
- // src/utils/thinking.ts
32104
- var THINKING_LEVELS = ["default", "off", "on", "low", "medium", "high", "xhigh", "max"];
32105
- function thinkingChoices(harness, model, session = false) {
32106
- const id = model.split("/").at(-1).toLowerCase();
32107
- if (/gpt-6(\.1)?-(astra|sol|luna|terra)$/.test(id)) {
32108
- return ["default", .../astra$|6\.1-sol$/.test(id) ? [] : ["off"], "low", "medium", "high", "xhigh", "max"];
32742
+ // src/services/prompt.ts
32743
+ async function promptForSection(adapter, section) {
32744
+ return adapter.promptSection(esm_default12, section);
32745
+ }
32746
+ async function promptForOpenCodeProvider(prompt, choices, current) {
32747
+ const answer = await prompt.prompt([
32748
+ {
32749
+ type: "list",
32750
+ name: "provider",
32751
+ message: "Which provider are you using?",
32752
+ choices,
32753
+ default: current
32754
+ }
32755
+ ]);
32756
+ return answer.provider;
32757
+ }
32758
+ async function promptForSimpleModels(prompt, section, models, harness = "claude", recommended, sessionOnly = []) {
32759
+ const result = { ...section };
32760
+ await promptModelsAndThinking(prompt, harness, result, section, models, recommended, sessionOnly);
32761
+ return result;
32762
+ }
32763
+ async function promptForOpenCodeModels(prompt, section, models, provider, recommended) {
32764
+ const result = { ...section, provider };
32765
+ await promptModelsAndThinking(prompt, "opencode", result, section, models, recommended);
32766
+ if (provider === "openrouter") {
32767
+ const { warming } = await prompt.prompt([{
32768
+ type: "confirm",
32769
+ name: "warming",
32770
+ message: "Keep idle sessions warm? This sends keep-alive requests every few minutes, which cost money (requires OpenCode 2.2.6 or later)",
32771
+ default: section.warming ?? false
32772
+ }]);
32773
+ if (warming !== undefined)
32774
+ result.warming = warming;
32109
32775
  }
32110
- if (/^(opus|opusplan|sonnet|haiku|fable|best)$/.test(id) || /claude-(opus-5[-.]5|fable-5[-.]1|sonnet-5[-.]5|haiku-5[-.]5)$/.test(id)) {
32111
- return ["default", "low", "medium", "high", "xhigh", ...harness === "claude" && session ? [] : ["max"]];
32776
+ return result;
32777
+ }
32778
+ function modelChoices(models, saved, recommended) {
32779
+ return [...new Set([...models, ...saved ? [saved] : []])].map((value) => ({ name: value === recommended ? `${value} (recommended)` : value, value }));
32780
+ }
32781
+ async function promptModelsAndThinking(prompt, harness, config, previous, models, recommended, sessionOnly = []) {
32782
+ const hasPlan = harness !== "claude";
32783
+ const sessionAnswer = await prompt.prompt([{
32784
+ type: "list",
32785
+ name: "default_model",
32786
+ message: "Select default model",
32787
+ choices: modelChoices([...models, ...sessionOnly], previous.default_model, recommended?.default_model),
32788
+ default: previous.default_model
32789
+ }]);
32790
+ config.default_model = sessionAnswer.default_model || previous.default_model;
32791
+ const planConfig = config;
32792
+ await promptThinking(prompt, [{
32793
+ name: "build_thinking",
32794
+ role: "session",
32795
+ label: harness === "claude" ? "session" : "build",
32796
+ model: config.default_model,
32797
+ oldModel: previous.default_model,
32798
+ saved: previous.build_thinking,
32799
+ session: true,
32800
+ set: (value) => {
32801
+ config.build_thinking = value;
32802
+ }
32803
+ }, ...hasPlan ? [{
32804
+ name: "plan_thinking",
32805
+ role: "plan",
32806
+ label: "plan",
32807
+ model: config.default_model,
32808
+ oldModel: previous.default_model,
32809
+ saved: previous.plan_thinking,
32810
+ session: false,
32811
+ set: (value) => {
32812
+ planConfig.plan_thinking = value;
32813
+ }
32814
+ }] : []], harness);
32815
+ const agents = [];
32816
+ for (const name of AGENT_NAMES) {
32817
+ const old = previous.agents.find((a) => a.name === name);
32818
+ const answer = await prompt.prompt([{
32819
+ type: "list",
32820
+ name,
32821
+ message: `Select model for ${name}`,
32822
+ choices: modelChoices(models, old?.model, recommended?.agents.find((a) => a.name === name)?.model),
32823
+ default: old?.model || models[0]
32824
+ }]);
32825
+ const agent = { ...old, template: name, name, model: answer[name] || old?.model || models[0] };
32826
+ agents.push(agent);
32827
+ await promptThinking(prompt, [{
32828
+ name: `${name}_thinking`,
32829
+ role: name,
32830
+ label: name,
32831
+ model: agent.model,
32832
+ oldModel: old?.model ?? "",
32833
+ saved: old?.thinking,
32834
+ session: false,
32835
+ set: (value) => {
32836
+ agent.thinking = value;
32837
+ }
32838
+ }], harness);
32112
32839
  }
32113
- if (harness === "opencode") {
32114
- if (/^(glm-5\.3(-flash)?|kimi-k3(\.1-pro)?|deepseek-v4(\.1-flash(-1017)?|-pro))$/.test(id))
32115
- return ["default", "low", "high", "max"];
32116
- if (/^(mimo-v2\.6-(pro|flash)(-free)?|minimax-m3(-free)?)$/.test(id))
32117
- return ["default", "off", "on"];
32118
- if (id === "minimax-m3.1-flash")
32119
- return ["default", "low", "medium", "high", "xhigh", "max"];
32120
- if (/^(gemini-4-argon(-contributor)?|gemini-3\.[5-8]-flash(-lite)?)$/.test(id))
32121
- return ["default", "low", "medium", "high"];
32122
- if (id === "grok-4.7")
32123
- return ["default", "low", "medium", "high", "xhigh"];
32124
- if (/^mistral-large-4(-0)?$/.test(id))
32125
- return ["default", "off", "high"];
32126
- if (/^inkling(-2)?(-small)?(-free)?$/.test(id))
32127
- return ["default", "off", "low", "medium", "high", "max"];
32128
- if (/^muse-(spark-1\.3(-contributor)?|wonder(-1\.0)?)$/.test(id))
32129
- return ["default", "low", "medium", "high", "xhigh", "max"];
32130
- if (id === "muse-spark-open")
32131
- return ["default", "low", "medium", "high", "xhigh"];
32132
- if (/^nemotron-3\.5-super-vl(-free)?$/.test(id))
32133
- return ["default", "off", "low", "medium", "high", "xhigh"];
32134
- }
32135
- return ["default"];
32136
- }
32137
- function assertThinking(harness, model, thinking, session = false) {
32138
- if (thinking !== undefined && !thinkingChoices(harness, model, session).includes(thinking)) {
32139
- throw new InvalidConfigError(`${model} does not support ${thinking} thinking in ${harness}${session ? " sessions" : ""}`);
32140
- }
32141
- }
32142
- function codexThinking(thinking, legacy) {
32143
- if (thinking === undefined)
32144
- return legacy;
32145
- if (thinking === "default")
32146
- return;
32147
- return thinking === "off" ? "none" : thinking;
32148
- }
32149
- function claudeModel(model) {
32150
- return { opus: "claude-opus-5-5", fable: "claude-fable-5-1", best: "claude-fable-5-1", sonnet: "claude-sonnet-5-5", haiku: "claude-haiku-5-5" }[model] ?? model;
32151
- }
32152
- function claudeModeModels(model) {
32153
- return model === "opusplan" ? { build: claudeModel("sonnet"), plan: claudeModel("opus") } : { build: claudeModel(model), plan: claudeModel(model) };
32154
- }
32155
- var OPENCODE_THINKING_KEYS = ["reasoningEffort", "thinking", "effort", "reasoningConfig", "reasoning", "thinkingConfig"];
32156
- function openCodeThinkingOptions(model, thinking) {
32157
- assertThinking("opencode", model, thinking);
32158
- if (!thinking || thinking === "default")
32159
- return {};
32160
- if (model.startsWith("amazon-bedrock/")) {
32161
- return { reasoningConfig: { type: "adaptive", maxReasoningEffort: thinking, display: "summarized" } };
32162
- }
32163
- if (model.startsWith("openrouter/")) {
32164
- if (thinking === "on" || thinking === "off")
32165
- return { reasoning: { enabled: thinking === "on" } };
32166
- return { reasoning: { effort: thinking } };
32167
- }
32168
- if (model.startsWith("google/"))
32169
- return { thinkingConfig: { thinkingLevel: thinking } };
32170
- if (model.includes("claude-"))
32171
- return { effort: thinking };
32172
- if (thinking === "on" || thinking === "off") {
32173
- if (/gpt-6|mistral-large|inkling|nemotron/.test(model))
32174
- return { reasoningEffort: "none" };
32175
- return { thinking: { type: thinking === "off" ? "disabled" : model.includes("minimax") ? "adaptive" : "enabled" } };
32176
- }
32177
- return { reasoningEffort: thinking };
32178
- }
32179
-
32180
- // src/services/prompt.ts
32181
- async function promptForSection(adapter, section) {
32182
- return adapter.promptSection(esm_default12, section);
32840
+ config.agents = agents;
32183
32841
  }
32184
- async function promptForOpenCodeProvider(prompt, choices, current) {
32185
- const answer = await prompt.prompt([
32186
- {
32187
- type: "list",
32188
- name: "provider",
32189
- message: "Which provider are you using?",
32190
- choices,
32191
- default: current
32192
- }
32193
- ]);
32194
- return answer.provider;
32195
- }
32196
- async function promptForSimpleModels(prompt, section, models, harness = "claude") {
32197
- const answers = await prompt.prompt([
32198
- {
32199
- type: "list",
32200
- name: "default_model",
32201
- message: "Select default model",
32202
- choices: modelChoices(models, section.default_model),
32203
- default: section.default_model
32204
- },
32205
- ...AGENT_NAMES.map((name) => ({
32206
- type: "list",
32207
- name,
32208
- message: `Select model for ${name}`,
32209
- choices: modelChoices(models, section.agents.find((a) => a.name === name)?.model),
32210
- default: section.agents.find((a) => a.name === name)?.model || models[0]
32211
- }))
32212
- ]);
32213
- const selectedModel = answers.default_model || section.default_model;
32214
- const result = {
32215
- ...section,
32216
- default_model: selectedModel,
32217
- agents: AGENT_NAMES.map((name) => {
32218
- const agent = section.agents.find((a) => a.name === name);
32219
- return {
32220
- ...agent,
32221
- template: name,
32222
- name,
32223
- model: answers[name] || agent?.model || models[0]
32224
- };
32225
- })
32226
- };
32227
- await promptThinking(prompt, harness, result, section);
32228
- return result;
32229
- }
32230
- async function promptForOpenCodeModels(prompt, section, models, provider) {
32231
- const answers = await prompt.prompt([
32232
- {
32233
- type: "list",
32234
- name: "build_model",
32235
- message: "Select model for build",
32236
- choices: modelChoices(models, section.build_model),
32237
- default: section.build_model
32238
- },
32239
- {
32240
- type: "list",
32241
- name: "plan_model",
32242
- message: "Select model for plan",
32243
- choices: modelChoices(models, section.plan_model),
32244
- default: section.plan_model
32245
- },
32246
- ...AGENT_NAMES.map((name) => ({
32247
- type: "list",
32248
- name,
32249
- message: `Select model for ${name}`,
32250
- choices: modelChoices(models, section.agents.find((a) => a.name === name)?.model),
32251
- default: section.agents.find((a) => a.name === name)?.model || models[0]
32252
- }))
32253
- ]);
32254
- const result = {
32255
- ...section,
32256
- provider,
32257
- build_model: answers.build_model || section.build_model,
32258
- plan_model: answers.plan_model || section.plan_model,
32259
- agents: AGENT_NAMES.map((name) => {
32260
- const agent = section.agents.find((a) => a.name === name);
32261
- return {
32262
- ...agent,
32263
- template: name,
32264
- name,
32265
- model: answers[name] || agent?.model || models[0]
32266
- };
32267
- })
32268
- };
32269
- await promptThinking(prompt, "opencode", result, section);
32270
- return result;
32271
- }
32272
- function modelChoices(models, saved) {
32273
- return [...new Set([...models, ...saved ? [saved] : []])];
32274
- }
32275
- async function promptThinking(prompt, harness, config, previous) {
32276
- const modelFor = (section, mode) => ("default_model" in section) ? section.default_model : section[`${mode}_model`];
32277
- const slots = ["build", "plan"].filter((mode) => !(mode === "plan" && harness === "claude" && modelFor(config, mode) !== "opusplan")).map((mode) => ({
32278
- name: `${mode}_thinking`,
32279
- label: mode,
32280
- model: modelFor(config, mode),
32281
- oldModel: modelFor(previous, mode),
32282
- saved: previous[`${mode}_thinking`],
32283
- session: true,
32284
- set: (value) => {
32285
- config[`${mode}_thinking`] = value;
32286
- }
32287
- }));
32288
- for (const agent of config.agents) {
32289
- const old = previous.agents.find((a) => a.name === agent.name);
32290
- slots.push({ name: `${agent.name}_thinking`, label: agent.name, model: agent.model, oldModel: old?.model ?? "", saved: old?.thinking, session: false, set: (value) => {
32291
- agent.thinking = value;
32292
- } });
32293
- }
32842
+ async function promptThinking(prompt, slots, harness) {
32294
32843
  const questions = slots.map((slot) => {
32295
32844
  const choices = thinkingChoices(harness, slot.model, slot.session);
32296
- const saved = slot.model === slot.oldModel && (slot.saved === undefined || choices.includes(slot.saved)) ? slot.saved : "default";
32297
- slot.set(saved);
32845
+ const recommended = recommendedThinking(slot.model, slot.role).filter((level) => choices.includes(level));
32846
+ const fallback = recommended[0] ?? "default";
32847
+ const unchanged = slot.model === slot.oldModel && (slot.saved === undefined || choices.includes(slot.saved));
32848
+ const preselected = unchanged ? slot.saved === "default" && avoidsProviderDefault(slot.model) ? fallback : slot.saved : fallback;
32849
+ slot.set(preselected);
32298
32850
  return {
32299
32851
  type: "list",
32300
32852
  name: slot.name,
32301
32853
  message: `Select thinking for ${slot.label} (${slot.model})`,
32302
- choices: saved === undefined ? [{ name: "Keep existing behavior", value: "keep" }, ...choices] : choices,
32303
- default: saved ?? "keep"
32854
+ choices: [
32855
+ ...preselected === undefined ? [{ name: "Keep existing behavior", value: "keep" }] : [],
32856
+ ...choices.map((level) => ({ name: recommended.includes(level) ? `${level} (recommended)` : level, value: level }))
32857
+ ],
32858
+ default: preselected ?? "keep"
32304
32859
  };
32305
32860
  });
32306
32861
  const answers = await prompt.prompt(questions);
@@ -32308,8 +32863,6 @@ async function promptThinking(prompt, harness, config, previous) {
32308
32863
  if (answers[slot.name] !== undefined)
32309
32864
  slot.set(answers[slot.name] === "keep" ? undefined : answers[slot.name]);
32310
32865
  }
32311
- if (harness === "claude" && "default_model" in config && config.default_model !== "opusplan")
32312
- config.plan_thinking = config.build_thinking;
32313
32866
  }
32314
32867
  function formatFileList(files) {
32315
32868
  return files.map((f) => ` ${f.action === "delete" ? "-" : f.exists ? "~" : "+"} ${f.path}`).join(`
@@ -32571,53 +33124,47 @@ var ThinkingSchema = enumType(THINKING_LEVELS);
32571
33124
  var AgentSchema = objectType({
32572
33125
  template: enumType(AGENT_NAMES),
32573
33126
  name: enumType(AGENT_NAMES),
32574
- model: stringType().min(1)
33127
+ model: stringType().min(1),
33128
+ thinking: ThinkingSchema.optional()
32575
33129
  });
32576
- var ThinkingAgentSchema = AgentSchema.extend({ thinking: ThinkingSchema.optional() });
32577
33130
  var SimpleConfigSchema = objectType({
32578
33131
  provider: stringType().optional(),
32579
33132
  default_model: stringType().min(1),
32580
33133
  build_thinking: ThinkingSchema.optional(),
32581
- plan_thinking: ThinkingSchema.optional(),
32582
- agents: arrayType(ThinkingAgentSchema).min(1)
32583
- });
32584
- var CursorConfigSchema = objectType({
32585
33134
  agents: arrayType(AgentSchema).min(1)
32586
- }).strict();
33135
+ });
32587
33136
  var OPENCODE_PROVIDERS = ["opencode-zen", "opencode-go", "amazon-bedrock", "openai", "openrouter", "google"];
32588
33137
  var OpenCodeConfigSchema = objectType({
32589
33138
  provider: enumType(OPENCODE_PROVIDERS),
32590
- build_model: stringType().min(1),
32591
- plan_model: stringType().min(1),
33139
+ default_model: stringType().min(1),
32592
33140
  build_thinking: ThinkingSchema.optional(),
32593
33141
  plan_thinking: ThinkingSchema.optional(),
32594
- agents: arrayType(ThinkingAgentSchema).min(1)
33142
+ agents: arrayType(AgentSchema).min(1),
33143
+ warming: booleanType().optional()
32595
33144
  }).superRefine((config, ctx) => checkThinking("opencode", config, ctx));
32596
33145
  var CLAUDE_OPTIONAL_BUILTINS = ["cron", "chrome", "remote-trigger"];
32597
33146
  var ClaudeConfigSchema = SimpleConfigSchema.extend({
32598
33147
  disabled_builtins: arrayType(enumType(CLAUDE_OPTIONAL_BUILTINS)).optional()
32599
- }).superRefine((config, ctx) => {
32600
- checkThinking("claude", config, ctx);
32601
- if (config.default_model !== "opusplan" && config.plan_thinking !== undefined && config.plan_thinking !== config.build_thinking) {
32602
- ctx.addIssue({ code: "custom", path: ["plan_thinking"], message: "Separate Claude Plan/Build thinking requires opusplan" });
32603
- }
32604
- });
32605
- var CodexConfigSchema = SimpleConfigSchema.superRefine((config, ctx) => checkThinking("codex", config, ctx));
33148
+ }).superRefine((config, ctx) => checkThinking("claude", config, ctx));
33149
+ var CodexConfigSchema = SimpleConfigSchema.extend({
33150
+ plan_thinking: ThinkingSchema.optional()
33151
+ }).superRefine((config, ctx) => checkThinking("codex", config, ctx));
32606
33152
  function checkThinking(harness, config, ctx) {
32607
33153
  const check = (model, thinking, path, session = false) => {
32608
33154
  if (thinking !== undefined && !thinkingChoices(harness, model, session).includes(thinking)) {
32609
33155
  ctx.addIssue({ code: "custom", path, message: `${model} does not support ${thinking} thinking` });
32610
33156
  }
32611
33157
  };
32612
- check("default_model" in config ? config.default_model : config.build_model, config.build_thinking, ["build_thinking"], true);
32613
- check("default_model" in config ? config.default_model : config.plan_model, config.plan_thinking, ["plan_thinking"], true);
33158
+ check(config.default_model, config.build_thinking, ["build_thinking"], true);
33159
+ check(config.default_model, config.plan_thinking, ["plan_thinking"]);
32614
33160
  config.agents.forEach((agent, i) => check(agent.model, agent.thinking, ["agents", i, "thinking"]));
32615
33161
  }
32616
33162
 
32617
33163
  // src/adapters/claude.ts
32618
- var ANTHROPIC_MODELS = ["haiku", "sonnet", "opus", "fable", "best", "opusplan"];
33164
+ var ANTHROPIC_MODELS = ["haiku", "sonnet", "opus", "fable", "best"];
33165
+ var SESSION_ONLY_MODELS = ["opusplan"];
32619
33166
  var DEFAULT_MODELS = {
32620
- default_model: "opusplan",
33167
+ default_model: "opus",
32621
33168
  sentinel: "haiku",
32622
33169
  oracle: "opus",
32623
33170
  architect: "opus",
@@ -32653,13 +33200,12 @@ function defaultSection() {
32653
33200
  return {
32654
33201
  provider: "anthropic",
32655
33202
  default_model: DEFAULT_MODELS.default_model,
32656
- build_thinking: "high",
32657
- plan_thinking: "high",
33203
+ build_thinking: defaultThinking(DEFAULT_MODELS.default_model, "session"),
32658
33204
  agents: AGENT_NAMES.map((name) => ({
32659
33205
  template: name,
32660
33206
  name,
32661
33207
  model: DEFAULT_MODELS[name],
32662
- thinking: name === "sentinel" || name === "keymaker" ? "default" : name === "oracle" ? "xhigh" : "high"
33208
+ thinking: defaultThinking(DEFAULT_MODELS[name], name)
32663
33209
  }))
32664
33210
  };
32665
33211
  }
@@ -32668,7 +33214,7 @@ function modelsForProvider(_provider) {
32668
33214
  }
32669
33215
  async function promptSection(prompt, section) {
32670
33216
  const claude = section;
32671
- const result = await promptForSimpleModels(prompt, claude, modelsForProvider());
33217
+ const result = await promptForSimpleModels(prompt, claude, modelsForProvider(), "claude", defaultSection(), SESSION_ONLY_MODELS);
32672
33218
  const { disabled } = await prompt.prompt([{
32673
33219
  type: "checkbox",
32674
33220
  name: "disabled",
@@ -32708,14 +33254,15 @@ function mergeHarnessConfig(section, basePath) {
32708
33254
  const settingsPath = join7(claudeDir, "settings.json");
32709
33255
  const existing = readExistingSettings(settingsPath);
32710
33256
  const isNew = Object.keys(existing).length === 0;
33257
+ removeStaleSonnetEffort(existing, config.default_model);
32711
33258
  const settings = {
32712
33259
  ...existing,
32713
33260
  $schema: "https://json.schemastore.org/claude-code-settings.json",
32714
33261
  ...CLAUDE_AI_OPT_OUTS,
32715
33262
  model: config.default_model || DEFAULT_MODELS.default_model
32716
33263
  };
32717
- applyModeThinking(settings, config);
32718
- applyAutoCompactWindow(settings, config);
33264
+ applySessionThinking(settings, config);
33265
+ removeLegacyAutoCompactWindow(settings);
32719
33266
  applyBuiltins(settings, CONFLICTING_BUILTINS);
32720
33267
  for (const name of CLAUDE_OPTIONAL_BUILTINS) {
32721
33268
  if (config.disabled_builtins?.includes(name))
@@ -32774,52 +33321,25 @@ function removeAtelierSettings(claudeDir, config) {
32774
33321
  return;
32775
33322
  }
32776
33323
  const content = parseSettingsJson(settingsPath);
33324
+ removeStaleSonnetEffort(content, config.default_model);
32777
33325
  delete content.$schema;
32778
33326
  delete content.model;
32779
33327
  for (const [key, value] of Object.entries(CLAUDE_AI_OPT_OUTS)) {
32780
33328
  if (content[key] === value)
32781
33329
  delete content[key];
32782
33330
  }
32783
- applyModeThinking(content, config, true);
32784
- applyAutoCompactWindow(content, config, true);
33331
+ applySessionThinking(content, config, true);
33332
+ removeLegacyAutoCompactWindow(content);
32785
33333
  removeBuiltins(content, CONFLICTING_BUILTINS);
32786
33334
  for (const patch of Object.values(OPTIONAL_BUILTINS))
32787
33335
  removeBuiltins(content, patch);
32788
33336
  writeOrDeleteSettings(settingsPath, content);
32789
33337
  }
32790
- function applyModeThinking(settings, config, remove = false) {
32791
- const models = claudeModeModels(config.default_model);
32792
- const modelSettings = { ...settings.modelSettings };
32793
- for (const mode of ["build", "plan"]) {
32794
- const thinking = config[`${mode}_thinking`];
32795
- if (thinking === undefined)
32796
- continue;
32797
- const entry = { ...modelSettings[models[mode]] };
32798
- if (remove || thinking === "default")
32799
- delete entry.effortLevel;
32800
- else
32801
- entry.effortLevel = thinking;
32802
- if (Object.keys(entry).length)
32803
- modelSettings[models[mode]] = entry;
32804
- else
32805
- delete modelSettings[models[mode]];
32806
- }
32807
- if (Object.keys(modelSettings).length)
32808
- settings.modelSettings = modelSettings;
32809
- else
32810
- delete settings.modelSettings;
32811
- }
32812
- var OPUSPLAN_AUTO_COMPACT_WINDOW = 190000;
32813
- function applyAutoCompactWindow(settings, config, remove = false) {
32814
- const models = claudeModeModels("opusplan");
32815
- const enabled = !remove && config.default_model === "opusplan";
33338
+ function editModelSettings(settings, models, edit) {
32816
33339
  const modelSettings = { ...settings.modelSettings };
32817
- for (const model of new Set([models.build, models.plan])) {
33340
+ for (const model of models) {
32818
33341
  const entry = { ...modelSettings[model] };
32819
- if (enabled)
32820
- entry.autoCompactWindow ??= OPUSPLAN_AUTO_COMPACT_WINDOW;
32821
- else if (entry.autoCompactWindow === OPUSPLAN_AUTO_COMPACT_WINDOW)
32822
- delete entry.autoCompactWindow;
33342
+ edit(entry);
32823
33343
  if (Object.keys(entry).length)
32824
33344
  modelSettings[model] = entry;
32825
33345
  else
@@ -32830,6 +33350,33 @@ function applyAutoCompactWindow(settings, config, remove = false) {
32830
33350
  else
32831
33351
  delete settings.modelSettings;
32832
33352
  }
33353
+ function applySessionThinking(settings, config, remove = false) {
33354
+ const thinking = config.build_thinking;
33355
+ if (thinking === undefined)
33356
+ return;
33357
+ const models = config.default_model === "opusplan" ? [claudeModel("opus"), claudeModel("sonnet")] : [claudeModel(config.default_model)];
33358
+ editModelSettings(settings, models, (entry) => {
33359
+ if (remove || thinking === "default")
33360
+ delete entry.effortLevel;
33361
+ else
33362
+ entry.effortLevel = thinking;
33363
+ });
33364
+ }
33365
+ function removeStaleSonnetEffort(settings, nextModel) {
33366
+ if (settings.model !== "opusplan" || nextModel === "opusplan")
33367
+ return;
33368
+ editModelSettings(settings, [claudeModel("sonnet")], (entry) => {
33369
+ delete entry.effortLevel;
33370
+ });
33371
+ }
33372
+ var LEGACY_AUTO_COMPACT_WINDOW = 190000;
33373
+ var LEGACY_AUTO_COMPACT_MODELS = ["claude-sonnet-5-5", "claude-opus-5-5"];
33374
+ function removeLegacyAutoCompactWindow(settings) {
33375
+ editModelSettings(settings, LEGACY_AUTO_COMPACT_MODELS, (entry) => {
33376
+ if (entry.autoCompactWindow === LEGACY_AUTO_COMPACT_WINDOW)
33377
+ delete entry.autoCompactWindow;
33378
+ });
33379
+ }
32833
33380
  function applyBuiltins(settings, patch) {
32834
33381
  Object.assign(settings, patch.settings);
32835
33382
  if (patch.env)
@@ -32954,7 +33501,6 @@ var PROVIDER_MODELS = {
32954
33501
  "glm-5.3",
32955
33502
  "glm-5.3-flash",
32956
33503
  "kimi-k3",
32957
- "kimi-k2.7-code",
32958
33504
  "deepseek-v4.1-flash",
32959
33505
  "deepseek-v4-pro",
32960
33506
  "minimax-m3",
@@ -32969,7 +33515,8 @@ var PROVIDER_MODELS = {
32969
33515
  "muse-wonder-1.0",
32970
33516
  "inkling-2-small-free",
32971
33517
  "nemotron-3.5-super-vl-free",
32972
- "nemotron-3.5-lightning-free"
33518
+ "nemotron-3.5-lightning-free",
33519
+ "beam-free"
32973
33520
  ].map((id) => `opencode/${id}`),
32974
33521
  "opencode-go": [
32975
33522
  "glm-5.3",
@@ -32988,7 +33535,10 @@ var PROVIDER_MODELS = {
32988
33535
  "claude-haiku-5-5",
32989
33536
  "gemini-4-argon",
32990
33537
  "grok-4.7",
32991
- "muse-spark-1.3-contributor"
33538
+ "muse-spark-1.3-contributor",
33539
+ "hy4",
33540
+ "step-5-preview",
33541
+ "beam-free"
32992
33542
  ].map((id) => `opencode-go/${id}`),
32993
33543
  "amazon-bedrock": [
32994
33544
  "us.anthropic.claude-opus-5-5",
@@ -32996,7 +33546,7 @@ var PROVIDER_MODELS = {
32996
33546
  "us.anthropic.claude-sonnet-5-5",
32997
33547
  "us.anthropic.claude-haiku-5-5"
32998
33548
  ].map((id) => `amazon-bedrock/${id}`),
32999
- openai: ["gpt-6.1-sol", "gpt-6.1-terra", "gpt-6-astra", "gpt-6-sol", "gpt-6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.3-codex-spark"].map((id) => `openai/${id}`),
33549
+ openai: ["gpt-6.1-sol", "gpt-6.1-terra", "gpt-6-astra", "gpt-6-sol", "gpt-6-luna"].map((id) => `openai/${id}`),
33000
33550
  openrouter: [
33001
33551
  "anthropic/claude-opus-5.5",
33002
33552
  "anthropic/claude-fable-5.1",
@@ -33020,17 +33570,23 @@ var PROVIDER_MODELS = {
33020
33570
  "minimax/minimax-m3.1-flash",
33021
33571
  "minimax/minimax-m3",
33022
33572
  "qwen/qwen3.8-flash",
33573
+ "qwen/qwen3.8-max-0902",
33574
+ "qwen/qwen3.8-max-prime",
33023
33575
  "xiaomi/mimo-v2.6-pro",
33024
33576
  "mistralai/mistral-large-4-0",
33025
33577
  "thinkingmachines/inkling",
33026
33578
  "thinkingmachines/inkling-small",
33027
33579
  "nvidia/nemotron-3.5-super-vl",
33028
33580
  "nvidia/nemotron-3.5-lightning",
33581
+ "tencent/hy4",
33582
+ "stepfun/step-5-preview",
33583
+ "inclusionai/ling-3.1-flash",
33584
+ "reflection/beam-1.0-501b-a23b",
33029
33585
  "meta/muse-spark-1.3",
33030
33586
  "meta/muse-spark-open",
33031
33587
  "meta/muse-wonder"
33032
33588
  ].map((id) => `openrouter/${id}`),
33033
- google: ["gemini-4-argon", "gemini-3.8-flash", "gemini-3.7-flash", "gemini-3.5-flash-lite"].map((id) => `google/${id}`)
33589
+ google: ["gemini-4-argon", "gemini-3.8-flash", "gemini-3.5-flash-lite"].map((id) => `google/${id}`)
33034
33590
  };
33035
33591
  var DEFAULT_MODELS2 = {
33036
33592
  "opencode-zen": {
@@ -33038,48 +33594,42 @@ var DEFAULT_MODELS2 = {
33038
33594
  oracle: "opencode/kimi-k3",
33039
33595
  architect: "opencode/glm-5.3",
33040
33596
  keymaker: "opencode/deepseek-v4.1-flash",
33041
- build: "opencode/deepseek-v4.1-flash",
33042
- plan: "opencode/glm-5.3"
33597
+ default: "opencode/kimi-k3"
33043
33598
  },
33044
33599
  "opencode-go": {
33045
33600
  sentinel: "opencode-go/glm-5.3-flash",
33046
33601
  oracle: "opencode-go/mimo-v2.6-pro",
33047
33602
  architect: "opencode-go/glm-5.3",
33048
33603
  keymaker: "opencode-go/deepseek-v4.1-flash",
33049
- build: "opencode-go/deepseek-v4.1-flash",
33050
- plan: "opencode-go/glm-5.3"
33604
+ default: "opencode-go/kimi-k3.1-pro"
33051
33605
  },
33052
33606
  "amazon-bedrock": {
33053
33607
  sentinel: "amazon-bedrock/us.anthropic.claude-haiku-5-5",
33054
33608
  oracle: "amazon-bedrock/us.anthropic.claude-fable-5-1",
33055
33609
  architect: "amazon-bedrock/us.anthropic.claude-opus-5-5",
33056
33610
  keymaker: "amazon-bedrock/us.anthropic.claude-sonnet-5-5",
33057
- build: "amazon-bedrock/us.anthropic.claude-sonnet-5-5",
33058
- plan: "amazon-bedrock/us.anthropic.claude-opus-5-5"
33611
+ default: "amazon-bedrock/us.anthropic.claude-opus-5-5"
33059
33612
  },
33060
33613
  openai: {
33061
33614
  sentinel: "openai/gpt-6-luna",
33062
33615
  oracle: "openai/gpt-6-astra",
33063
33616
  architect: "openai/gpt-6-astra",
33064
33617
  keymaker: "openai/gpt-6-sol",
33065
- build: "openai/gpt-6-sol",
33066
- plan: "openai/gpt-6-astra"
33618
+ default: "openai/gpt-6-astra"
33067
33619
  },
33068
33620
  openrouter: {
33069
33621
  sentinel: "openrouter/z-ai/glm-5.3-flash",
33070
33622
  oracle: "openrouter/moonshotai/kimi-k3.1-pro",
33071
33623
  architect: "openrouter/z-ai/glm-5.3",
33072
33624
  keymaker: "openrouter/deepseek/deepseek-v4.1-flash-1017",
33073
- build: "openrouter/deepseek/deepseek-v4.1-flash-1017",
33074
- plan: "openrouter/z-ai/glm-5.3"
33625
+ default: "openrouter/moonshotai/kimi-k3.1-pro"
33075
33626
  },
33076
33627
  google: {
33077
33628
  sentinel: "google/gemini-3.5-flash-lite",
33078
33629
  oracle: "google/gemini-4-argon",
33079
33630
  architect: "google/gemini-4-argon",
33080
33631
  keymaker: "google/gemini-3.8-flash",
33081
- build: "google/gemini-3.8-flash",
33082
- plan: "google/gemini-4-argon"
33632
+ default: "google/gemini-4-argon"
33083
33633
  }
33084
33634
  };
33085
33635
  var COMMAND_MARKER = "<!-- Generated by Atelier -->";
@@ -33100,15 +33650,14 @@ function defaultSection2(provider) {
33100
33650
  const defaults = DEFAULT_MODELS2[selectedProvider];
33101
33651
  return {
33102
33652
  provider: selectedProvider,
33103
- build_model: defaults.build,
33104
- plan_model: defaults.plan,
33105
- build_thinking: "high",
33106
- plan_thinking: selectedProvider === "openai" ? "xhigh" : "high",
33653
+ default_model: defaults.default,
33654
+ build_thinking: defaultThinking(defaults.default, "session"),
33655
+ plan_thinking: defaultThinking(defaults.default, "plan"),
33107
33656
  agents: AGENT_NAMES.map((name) => ({
33108
33657
  template: name,
33109
33658
  name,
33110
33659
  model: defaults[name],
33111
- thinking: name === "keymaker" ? selectedProvider === "amazon-bedrock" ? "default" : "high" : name === "sentinel" ? "low" : name === "oracle" && selectedProvider === "opencode-go" ? "on" : name === "architect" && selectedProvider === "openai" ? "xhigh" : "high"
33660
+ thinking: defaultThinking(defaults[name], name)
33112
33661
  }))
33113
33662
  };
33114
33663
  }
@@ -33120,7 +33669,7 @@ async function promptSection2(prompt, section) {
33120
33669
  const openCodeSection = section;
33121
33670
  const provider = guardProvider(await promptForOpenCodeProvider(prompt, OPENCODE_PROVIDERS2, openCodeSection.provider));
33122
33671
  const models = modelsForProvider2(provider);
33123
- return promptForOpenCodeModels(prompt, provider === openCodeSection.provider ? openCodeSection : defaultSection2(provider), models, provider);
33672
+ return promptForOpenCodeModels(prompt, provider === openCodeSection.provider ? openCodeSection : defaultSection2(provider), models, provider, defaultSection2(provider));
33124
33673
  }
33125
33674
  function installAgents2(section, basePath, sharedConfig) {
33126
33675
  const config = OpenCodeConfigSchema.parse(section);
@@ -33194,26 +33743,37 @@ function mergeHarnessConfig2(section, basePath) {
33194
33743
  } catch (err) {
33195
33744
  throw new FileWriteError(basePath, err instanceof Error ? err.message : String(err));
33196
33745
  }
33197
- const sentinel = config.agents.find((a) => a.name === "sentinel");
33198
- const architect = config.agents.find((a) => a.name === "architect");
33199
33746
  const existingAgents = existing.agent;
33200
- for (const mode of ["build", "plan"]) {
33201
- if (config[`${mode}_thinking`] === undefined || !existingAgents?.[mode])
33202
- continue;
33747
+ if (config.build_thinking !== undefined && existingAgents?.build) {
33748
+ for (const key of OPENCODE_THINKING_KEYS)
33749
+ delete existingAgents.build[key];
33750
+ }
33751
+ const existingPlan = existingAgents?.plan;
33752
+ const userOwnsPlan = existingPlan !== undefined && !isAtelierPlan(existingPlan);
33753
+ if (config.plan_thinking !== undefined && userOwnsPlan) {
33754
+ console.log(`Skipped agent.plan in ${shortPath(opencodeJsonPath)} because it is not managed by Atelier.`);
33755
+ }
33756
+ if (config.plan_thinking === undefined) {
33757
+ if (existingAgents && typeof existingAgents === "object" && !Array.isArray(existingAgents))
33758
+ stripModeEntry(existingAgents, "plan");
33759
+ } else if (!userOwnsPlan && existingAgents?.plan) {
33203
33760
  for (const key of OPENCODE_THINKING_KEYS)
33204
- delete existingAgents[mode][key];
33761
+ delete existingAgents.plan[key];
33205
33762
  }
33206
33763
  const atelierFields = {
33764
+ model: config.default_model,
33207
33765
  agent: {
33208
33766
  build: {
33209
33767
  mode: "primary",
33210
- model: config.build_model || sentinel?.model || DEFAULT_MODELS2[config.provider].build,
33211
- ...openCodeThinkingOptions(config.build_model, config.build_thinking)
33768
+ model: config.default_model,
33769
+ ...openCodeThinkingOptions(config.default_model, config.build_thinking)
33212
33770
  },
33213
- plan: {
33214
- mode: "primary",
33215
- model: config.plan_model || architect?.model || DEFAULT_MODELS2[config.provider].plan,
33216
- ...openCodeThinkingOptions(config.plan_model, config.plan_thinking)
33771
+ ...config.plan_thinking === undefined || userOwnsPlan ? {} : {
33772
+ plan: {
33773
+ mode: "primary",
33774
+ model: config.default_model,
33775
+ ...openCodeThinkingOptions(config.default_model, config.plan_thinking)
33776
+ }
33217
33777
  }
33218
33778
  }
33219
33779
  };
@@ -33226,6 +33786,18 @@ function mergeHarnessConfig2(section, basePath) {
33226
33786
  }
33227
33787
  };
33228
33788
  }
33789
+ const legacyProvider = existing.provider;
33790
+ const hasLegacyOpenrouter = !!legacyProvider && typeof legacyProvider === "object" && !Array.isArray(legacyProvider) && legacyProvider.openrouter !== undefined;
33791
+ if (config.provider === "openrouter" && config.warming === true && hasLegacyOpenrouter) {
33792
+ removeWarming(existing);
33793
+ console.log(`Skipped providers.openrouter.settings.cache.warming in ${shortPath(opencodeJsonPath)} because provider.openrouter is present; warming was not applied.`);
33794
+ } else if (config.provider === "openrouter" && config.warming === true) {
33795
+ const warming = ["providers", "openrouter", "settings", "cache", "warming"].reduce((node, key) => node && typeof node === "object" ? node[key] : undefined, existing);
33796
+ if (typeof warming !== "object" || warming === null)
33797
+ atelierFields.providers = { openrouter: { settings: { cache: { warming: true } } } };
33798
+ } else if (config.provider !== "openrouter" || config.warming === false) {
33799
+ removeWarming(existing);
33800
+ }
33229
33801
  const merged = deepMerge2(existing, atelierFields);
33230
33802
  try {
33231
33803
  writeFileSync4(opencodeJsonPath, JSON.stringify(merged, null, 2) + `
@@ -33374,7 +33946,7 @@ function writeOrDeleteOpenCodeJson(basePath, config) {
33374
33946
  if (!existsSync4(opencodeJsonPath)) {
33375
33947
  return;
33376
33948
  }
33377
- const content = stripOpenCodeConfig(readExistingOpenCodeJson(opencodeJsonPath), config.provider);
33949
+ const content = stripOpenCodeConfig(readExistingOpenCodeJson(opencodeJsonPath), config.provider, config.default_model);
33378
33950
  try {
33379
33951
  if (Object.keys(content).length === 0) {
33380
33952
  rmSync3(opencodeJsonPath, { force: true });
@@ -33397,17 +33969,28 @@ function readExistingOpenCodeJson(opencodeJsonPath) {
33397
33969
  throw new HarnessConfigError(opencodeJsonPath, err instanceof Error ? err.message : String(err));
33398
33970
  }
33399
33971
  }
33400
- function stripOpenCodeConfig(content, provider) {
33972
+ function isAtelierPlan(entry) {
33973
+ return typeof entry === "object" && entry !== null && !Array.isArray(entry) && entry.mode === "primary";
33974
+ }
33975
+ function stripModeEntry(agent, mode) {
33976
+ const entry = agent[mode];
33977
+ if (!entry || typeof entry !== "object" || Array.isArray(entry))
33978
+ return;
33979
+ const record = entry;
33980
+ if (mode === "plan" && !isAtelierPlan(record))
33981
+ return;
33982
+ for (const key of ["mode", "model", ...OPENCODE_THINKING_KEYS])
33983
+ delete record[key];
33984
+ if (!Object.keys(record).length)
33985
+ delete agent[mode];
33986
+ }
33987
+ function stripOpenCodeConfig(content, provider, sessionModel) {
33988
+ if (content.model === sessionModel)
33989
+ delete content.model;
33401
33990
  if (content.agent && typeof content.agent === "object" && !Array.isArray(content.agent)) {
33402
33991
  const agent = content.agent;
33403
33992
  for (const mode of ["build", "plan"]) {
33404
- const entry = agent[mode];
33405
- if (!entry || typeof entry !== "object" || Array.isArray(entry))
33406
- continue;
33407
- for (const key of ["mode", "model", ...OPENCODE_THINKING_KEYS])
33408
- delete entry[key];
33409
- if (!Object.keys(entry).length)
33410
- delete agent[mode];
33993
+ stripModeEntry(agent, mode);
33411
33994
  }
33412
33995
  if (Object.keys(agent).length === 0) {
33413
33996
  delete content.agent;
@@ -33428,8 +34011,26 @@ function stripOpenCodeConfig(content, provider) {
33428
34011
  delete content.provider;
33429
34012
  }
33430
34013
  }
34014
+ removeWarming(content);
33431
34015
  return content;
33432
34016
  }
34017
+ function removeWarming(content) {
34018
+ const path = ["providers", "openrouter", "settings", "cache"];
34019
+ const chain = [content];
34020
+ for (const key of path) {
34021
+ const next = chain[chain.length - 1][key];
34022
+ if (!next || typeof next !== "object" || Array.isArray(next))
34023
+ return;
34024
+ chain.push(next);
34025
+ }
34026
+ const cache = chain[chain.length - 1];
34027
+ if (cache.warming !== true)
34028
+ return;
34029
+ delete cache.warming;
34030
+ for (let i = chain.length - 1;i > 0 && !Object.keys(chain[i]).length; i--) {
34031
+ delete chain[i - 1][path[i - 1]];
34032
+ }
34033
+ }
33433
34034
  function getOpencodeRoot(basePath) {
33434
34035
  return basePath === getGlobalOpencodeDir() ? basePath : join8(basePath, ".opencode");
33435
34036
  }
@@ -33449,7 +34050,7 @@ function deepMerge2(target, source) {
33449
34050
  import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync6, existsSync as existsSync5, rmSync as rmSync4, rmdirSync as rmdirSync3, readdirSync as readdirSync4 } from "fs";
33450
34051
  import { join as join9 } from "path";
33451
34052
 
33452
- // node_modules/smol-toml/dist/date.js
34053
+ // node_modules/smol-toml/dist/error.js
33453
34054
  /*!
33454
34055
  * Copyright (c) Squirrel Chat et al., All rights reserved.
33455
34056
  * SPDX-License-Identifier: BSD-3-Clause
@@ -33477,150 +34078,30 @@ import { join as join9 } from "path";
33477
34078
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33478
34079
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33479
34080
  */
33480
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
33481
-
33482
- class TomlDate extends Date {
33483
- #hasDate = false;
33484
- #hasTime = false;
33485
- #offset = null;
33486
- constructor(date) {
33487
- let hasDate = true;
33488
- let hasTime = true;
33489
- let offset = "Z";
33490
- if (typeof date === "string") {
33491
- let match = date.match(DATE_TIME_RE);
33492
- if (match) {
33493
- if (!match[1]) {
33494
- hasDate = false;
33495
- date = `0000-01-01T${date}`;
33496
- }
33497
- hasTime = !!match[2];
33498
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
33499
- if (match[2] && +match[2] > 23) {
33500
- date = "";
33501
- } else {
33502
- offset = match[3] || null;
33503
- date = date.toUpperCase();
33504
- if (!offset && hasTime)
33505
- date += "Z";
33506
- }
33507
- } else {
33508
- date = "";
33509
- }
33510
- }
33511
- super(date);
33512
- if (!isNaN(this.getTime())) {
33513
- this.#hasDate = hasDate;
33514
- this.#hasTime = hasTime;
33515
- this.#offset = offset;
34081
+ function getLineColFromPtr(string, ptr) {
34082
+ let lines = string.slice(0, ptr).split(/\r?\n/);
34083
+ return [lines.length, lines.pop().length + 1];
34084
+ }
34085
+ function makeCodeBlock(string, line, column) {
34086
+ let lines = string.split(/\r?\n/);
34087
+ let codeblock = "";
34088
+ let numberLen = (Math.log10(line + 1) | 0) + 1;
34089
+ for (let i = line - 1;i <= line + 1; i++) {
34090
+ let l = lines[i - 1];
34091
+ if (!l)
34092
+ continue;
34093
+ codeblock += i.toString().padEnd(numberLen, " ");
34094
+ codeblock += ": ";
34095
+ codeblock += l;
34096
+ codeblock += `
34097
+ `;
34098
+ if (i === line) {
34099
+ codeblock += " ".repeat(numberLen + column + 2);
34100
+ codeblock += `^
34101
+ `;
33516
34102
  }
33517
34103
  }
33518
- isDateTime() {
33519
- return this.#hasDate && this.#hasTime;
33520
- }
33521
- isLocal() {
33522
- return !this.#hasDate || !this.#hasTime || !this.#offset;
33523
- }
33524
- isDate() {
33525
- return this.#hasDate && !this.#hasTime;
33526
- }
33527
- isTime() {
33528
- return this.#hasTime && !this.#hasDate;
33529
- }
33530
- isValid() {
33531
- return this.#hasDate || this.#hasTime;
33532
- }
33533
- toISOString() {
33534
- let iso = super.toISOString();
33535
- if (this.isDate())
33536
- return iso.slice(0, 10);
33537
- if (this.isTime())
33538
- return iso.slice(11, 23);
33539
- if (this.#offset === null)
33540
- return iso.slice(0, -1);
33541
- if (this.#offset === "Z")
33542
- return iso;
33543
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
33544
- offset = this.#offset[0] === "-" ? offset : -offset;
33545
- let offsetDate = new Date(this.getTime() - offset * 60000);
33546
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
33547
- }
33548
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
33549
- let date = new TomlDate(jsDate);
33550
- date.#offset = offset;
33551
- return date;
33552
- }
33553
- static wrapAsLocalDateTime(jsDate) {
33554
- let date = new TomlDate(jsDate);
33555
- date.#offset = null;
33556
- return date;
33557
- }
33558
- static wrapAsLocalDate(jsDate) {
33559
- let date = new TomlDate(jsDate);
33560
- date.#hasTime = false;
33561
- date.#offset = null;
33562
- return date;
33563
- }
33564
- static wrapAsLocalTime(jsDate) {
33565
- let date = new TomlDate(jsDate);
33566
- date.#hasDate = false;
33567
- date.#offset = null;
33568
- return date;
33569
- }
33570
- }
33571
-
33572
- // node_modules/smol-toml/dist/error.js
33573
- /*!
33574
- * Copyright (c) Squirrel Chat et al., All rights reserved.
33575
- * SPDX-License-Identifier: BSD-3-Clause
33576
- *
33577
- * Redistribution and use in source and binary forms, with or without
33578
- * modification, are permitted provided that the following conditions are met:
33579
- *
33580
- * 1. Redistributions of source code must retain the above copyright notice, this
33581
- * list of conditions and the following disclaimer.
33582
- * 2. Redistributions in binary form must reproduce the above copyright notice,
33583
- * this list of conditions and the following disclaimer in the
33584
- * documentation and/or other materials provided with the distribution.
33585
- * 3. Neither the name of the copyright holder nor the names of its contributors
33586
- * may be used to endorse or promote products derived from this software without
33587
- * specific prior written permission.
33588
- *
33589
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33590
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33591
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33592
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33593
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33594
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33595
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33596
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33597
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33598
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33599
- */
33600
- function getLineColFromPtr(string, ptr) {
33601
- let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
33602
- return [lines.length, lines.pop().length + 1];
33603
- }
33604
- function makeCodeBlock(string, line, column) {
33605
- let lines = string.split(/\r\n|\n|\r/g);
33606
- let codeblock = "";
33607
- let numberLen = (Math.log10(line + 1) | 0) + 1;
33608
- for (let i = line - 1;i <= line + 1; i++) {
33609
- let l = lines[i - 1];
33610
- if (!l)
33611
- continue;
33612
- codeblock += i.toString().padEnd(numberLen, " ");
33613
- codeblock += ": ";
33614
- codeblock += l;
33615
- codeblock += `
33616
- `;
33617
- if (i === line) {
33618
- codeblock += " ".repeat(numberLen + column + 2);
33619
- codeblock += `^
33620
- `;
33621
- }
33622
- }
33623
- return codeblock;
34104
+ return codeblock;
33624
34105
  }
33625
34106
 
33626
34107
  class TomlError extends Error {
@@ -33637,6 +34118,9 @@ ${codeblock}`, options2);
33637
34118
  this.column = column;
33638
34119
  this.codeblock = codeblock;
33639
34120
  }
34121
+ static x(message, ctx, ptr) {
34122
+ throw new TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
34123
+ }
33640
34124
  }
33641
34125
 
33642
34126
  // node_modules/smol-toml/dist/primitive.js
@@ -33667,159 +34151,99 @@ ${codeblock}`, options2);
33667
34151
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33668
34152
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33669
34153
  */
33670
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
33671
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
33672
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
33673
- function parseString(str2, ptr) {
33674
- let c = str2[ptr++];
34154
+ function parseString(ctx) {
34155
+ let startPtr = ctx.p;
34156
+ let c = ctx.s.charCodeAt(ctx.p++);
33675
34157
  let first = c;
33676
- let isLiteral = c === "'";
33677
- let isMultiline = c === str2[ptr] && c === str2[ptr + 1];
34158
+ let isLiteral = c === 39;
34159
+ let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
33678
34160
  if (isMultiline) {
33679
- if (str2[ptr += 2] === `
33680
- `)
33681
- ptr++;
33682
- else if (str2[ptr] === "\r" && str2[ptr + 1] === `
33683
- `)
33684
- ptr += 2;
34161
+ if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
34162
+ ctx.p++;
34163
+ else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
34164
+ ctx.p += 2;
33685
34165
  }
33686
34166
  let parsed = "";
33687
- let sliceStart = ptr;
34167
+ let sliceStart = ctx.p;
33688
34168
  let state = 0;
33689
- for (let i = ptr;i < str2.length; i++) {
33690
- c = str2[i];
33691
- if (isMultiline && (c === `
33692
- ` || c === "\r" && str2[i + 1] === `
33693
- `)) {
34169
+ for (;ctx.p < ctx.s.length; ctx.p++) {
34170
+ c = ctx.s.charCodeAt(ctx.p);
34171
+ if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
33694
34172
  state = state && 3;
33695
- } else if (c < " " && c !== "\t" || c === "\x7F") {
33696
- throw new TomlError("control characters are not allowed in strings", {
33697
- toml: str2,
33698
- ptr: i
33699
- });
33700
- } else if ((!state || state === 3) && c === first && (!isMultiline || str2[i + 1] === first && str2[i + 2] === first)) {
34173
+ } else if (c < 32 && c !== 9 || c === 127) {
34174
+ TomlError.x("control characters are not allowed in strings", ctx);
34175
+ } else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
33701
34176
  if (isMultiline) {
33702
- if (str2[i + 3] === first)
33703
- i++;
33704
- if (str2[i + 3] === first)
33705
- i++;
34177
+ if (ctx.s.charCodeAt(ctx.p + 3) === first)
34178
+ ctx.p++;
34179
+ if (ctx.s.charCodeAt(ctx.p + 3) === first)
34180
+ ctx.p++;
33706
34181
  }
33707
- return [
33708
- state ? parsed : parsed + str2.slice(sliceStart, i),
33709
- i + (isMultiline ? 3 : 1)
33710
- ];
34182
+ if (!state) {
34183
+ let s = ctx.s.slice(sliceStart, ctx.p);
34184
+ parsed = parsed ? parsed + s : s;
34185
+ }
34186
+ ctx.p += isMultiline ? 3 : 1;
34187
+ return parsed;
33711
34188
  } else if (!state) {
33712
- if (!isLiteral && c === "\\") {
33713
- parsed += str2.slice(sliceStart, sliceStart = i);
34189
+ if (!isLiteral && c === 92) {
34190
+ parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
33714
34191
  state = 1;
33715
34192
  }
33716
34193
  } else if (state === 1) {
33717
- if (c === "x" || c === "u" || c === "U") {
34194
+ if (c === 120 || c === 117 || c === 85) {
34195
+ let errPtr = ctx.p++ - 1;
33718
34196
  let value = 0;
33719
- let len = c === "x" ? 2 : c === "u" ? 4 : 8;
33720
- for (let j = 0;j < len; j++, i++) {
33721
- let hex = str2.charCodeAt(i + 1);
34197
+ let len = c === 120 ? 2 : c === 117 ? 4 : 8;
34198
+ for (let j = 0;j < len; j++, ctx.p++) {
34199
+ let hex = ctx.s.charCodeAt(ctx.p);
33722
34200
  let digit = hex >= 48 && hex <= 57 ? hex - 48 : hex >= 65 && hex <= 70 ? hex - 65 + 10 : hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1;
33723
34201
  if (digit < 0)
33724
- throw new TomlError("invalid non-hex character in unicode escape", { toml: str2, ptr: i + 1 });
34202
+ TomlError.x("invalid non-hex character in unicode escape", ctx);
33725
34203
  value = value << 4 | digit;
33726
34204
  }
33727
34205
  if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
33728
- throw new TomlError("invalid unicode escape", { toml: str2, ptr: i });
34206
+ TomlError.x("invalid unicode escape", ctx, errPtr);
33729
34207
  }
33730
34208
  parsed += String.fromCodePoint(value);
33731
- sliceStart = i + 1;
34209
+ sliceStart = ctx.p--;
33732
34210
  state = 0;
33733
- } else if (c === " " || c === "\t") {
34211
+ } else if (isMultiline && (c === 32 || c === 9)) {
33734
34212
  state = 2;
33735
34213
  } else {
33736
- if (c === "b")
34214
+ if (c === 98)
33737
34215
  parsed += "\b";
33738
- else if (c === "t")
34216
+ else if (c === 116)
33739
34217
  parsed += "\t";
33740
- else if (c === "n")
34218
+ else if (c === 110)
33741
34219
  parsed += `
33742
34220
  `;
33743
- else if (c === "f")
34221
+ else if (c === 102)
33744
34222
  parsed += "\f";
33745
- else if (c === "r")
34223
+ else if (c === 114)
33746
34224
  parsed += "\r";
33747
- else if (c === "e")
34225
+ else if (c === 101)
33748
34226
  parsed += "\x1B";
33749
- else if (c === '"')
34227
+ else if (c === 34)
33750
34228
  parsed += '"';
33751
- else if (c === "\\")
34229
+ else if (c === 92)
33752
34230
  parsed += "\\";
33753
34231
  else
33754
- throw new TomlError("unrecognized escape sequence", { toml: str2, ptr: i });
33755
- sliceStart = i + 1;
34232
+ TomlError.x("unrecognised escape sequence", ctx);
34233
+ sliceStart = ctx.p + 1;
33756
34234
  state = 0;
33757
34235
  }
33758
- } else if (c !== " " && c !== "\t") {
33759
- if (state === 2) {
33760
- throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
33761
- toml: str2,
33762
- ptr: sliceStart
33763
- });
33764
- }
33765
- state = !isLiteral && c === "\\" ? 1 : 0;
33766
- sliceStart = i;
33767
- }
33768
- }
33769
- throw new TomlError("unfinished string", { toml: str2, ptr });
33770
- }
33771
- function parseValue(value, toml, ptr, integersAsBigInt) {
33772
- if (value === "true")
33773
- return true;
33774
- if (value === "false")
33775
- return false;
33776
- if (value === "-inf")
33777
- return -Infinity;
33778
- if (value === "inf" || value === "+inf")
33779
- return Infinity;
33780
- if (value === "nan" || value === "+nan" || value === "-nan")
33781
- return NaN;
33782
- if (value === "-0")
33783
- return integersAsBigInt ? 0n : 0;
33784
- let isInt = INT_REGEX.test(value);
33785
- if (isInt || FLOAT_REGEX.test(value)) {
33786
- if (LEADING_ZERO.test(value)) {
33787
- throw new TomlError("leading zeroes are not allowed", {
33788
- toml,
33789
- ptr
33790
- });
33791
- }
33792
- value = value.replace(/_/g, "");
33793
- let numeric = +value;
33794
- if (isNaN(numeric)) {
33795
- throw new TomlError("invalid number", {
33796
- toml,
33797
- ptr
33798
- });
33799
- }
33800
- if (isInt) {
33801
- if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
33802
- throw new TomlError("integer value cannot be represented losslessly", {
33803
- toml,
33804
- ptr
33805
- });
33806
- }
33807
- if (isInt || integersAsBigInt === true)
33808
- numeric = BigInt(value);
34236
+ } else if (c !== 32 && c !== 9) {
34237
+ if (state === 2)
34238
+ TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
34239
+ state = !isLiteral && c === 92 ? 1 : 0;
34240
+ sliceStart = ctx.p;
33809
34241
  }
33810
- return numeric;
33811
34242
  }
33812
- const date = new TomlDate(value);
33813
- if (!date.isValid()) {
33814
- throw new TomlError("invalid value", {
33815
- toml,
33816
- ptr
33817
- });
33818
- }
33819
- return date;
34243
+ TomlError.x("unfinished string", ctx, startPtr);
33820
34244
  }
33821
34245
 
33822
- // node_modules/smol-toml/dist/util.js
34246
+ // node_modules/smol-toml/dist/date.js
33823
34247
  /*!
33824
34248
  * Copyright (c) Squirrel Chat et al., All rights reserved.
33825
34249
  * SPDX-License-Identifier: BSD-3-Clause
@@ -33847,65 +34271,119 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
33847
34271
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33848
34272
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33849
34273
  */
33850
- function indexOfNewline(str2, start = 0, end = str2.length) {
33851
- let idx = str2.indexOf(`
33852
- `, start);
33853
- if (str2[idx - 1] === "\r")
33854
- idx--;
33855
- return idx <= end ? idx : -1;
33856
- }
33857
- function skipComment(str2, ptr) {
33858
- for (let i = ptr;i < str2.length; i++) {
33859
- let c = str2[i];
33860
- if (c === `
33861
- `)
33862
- return i;
33863
- if (c === "\r" && str2[i + 1] === `
33864
- `)
33865
- return i + 1;
33866
- if (c < " " && c !== "\t" || c === "\x7F") {
33867
- throw new TomlError("control characters are not allowed in comments", {
33868
- toml: str2,
33869
- ptr
33870
- });
34274
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
34275
+
34276
+ class TomlDate extends Date {
34277
+ #hasDate = false;
34278
+ #hasTime = false;
34279
+ #offset = null;
34280
+ constructor(date, fasttype, unsafeDelim) {
34281
+ let hasDate = true;
34282
+ let hasTime = true;
34283
+ let offset = "Z";
34284
+ let c;
34285
+ if (typeof date === "string") {
34286
+ if (fasttype)
34287
+ prep: {
34288
+ if (fasttype < 3) {
34289
+ if (+date.slice(11, 13) > 23) {
34290
+ date = "";
34291
+ break prep;
34292
+ }
34293
+ if (fasttype === 2) {
34294
+ offset = null;
34295
+ date += "Z";
34296
+ } else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
34297
+ offset = date.slice(date.length - 6);
34298
+ }
34299
+ if (unsafeDelim)
34300
+ date = date.slice(0, 10) + "T" + date.slice(11);
34301
+ } else if (fasttype === 4) {
34302
+ date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
34303
+ }
34304
+ hasDate = fasttype !== 4;
34305
+ hasTime = fasttype !== 3;
34306
+ }
34307
+ else {
34308
+ let match = date.match(DATE_TIME_RE);
34309
+ if (match) {
34310
+ if (!match[1]) {
34311
+ hasDate = false;
34312
+ date = `0000-01-01T${date}`;
34313
+ }
34314
+ hasTime = !!match[2];
34315
+ hasTime && date[10] === " " && (date = date.replace(" ", "T"));
34316
+ if (match[2] && +match[2] > 23) {
34317
+ date = "";
34318
+ } else {
34319
+ offset = match[3] || null;
34320
+ if (!offset && hasTime)
34321
+ date += "Z";
34322
+ }
34323
+ } else {
34324
+ date = "";
34325
+ }
34326
+ }
34327
+ }
34328
+ super(date);
34329
+ if (!isNaN(this.getTime())) {
34330
+ this.#hasDate = hasDate;
34331
+ this.#hasTime = hasTime;
34332
+ this.#offset = offset;
33871
34333
  }
33872
34334
  }
33873
- return str2.length;
33874
- }
33875
- function skipVoid(str2, ptr, banNewLines, banComments) {
33876
- let c;
33877
- while (true) {
33878
- while ((c = str2[ptr]) === " " || c === "\t" || !banNewLines && (c === `
33879
- ` || c === "\r" && str2[ptr + 1] === `
33880
- `))
33881
- ptr++;
33882
- if (banComments || c !== "#")
33883
- break;
33884
- ptr = skipComment(str2, ptr);
33885
- }
33886
- return ptr;
33887
- }
33888
- function skipUntil(str2, ptr, sep, end, banNewLines = false) {
33889
- if (!end) {
33890
- ptr = indexOfNewline(str2, ptr);
33891
- return ptr < 0 ? str2.length : ptr;
33892
- }
33893
- for (let i = ptr;i < str2.length; i++) {
33894
- let c = str2[i];
33895
- if (c === "#") {
33896
- i = indexOfNewline(str2, i);
33897
- } else if (c === sep) {
33898
- return i + 1;
33899
- } else if (c === end || banNewLines && (c === `
33900
- ` || c === "\r" && str2[i + 1] === `
33901
- `)) {
33902
- return i;
33903
- }
33904
- }
33905
- throw new TomlError("cannot find end of structure", {
33906
- toml: str2,
33907
- ptr
33908
- });
34335
+ isDateTime() {
34336
+ return this.#hasDate && this.#hasTime;
34337
+ }
34338
+ isLocal() {
34339
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
34340
+ }
34341
+ isDate() {
34342
+ return this.#hasDate && !this.#hasTime;
34343
+ }
34344
+ isTime() {
34345
+ return this.#hasTime && !this.#hasDate;
34346
+ }
34347
+ isValid() {
34348
+ return this.#hasDate || this.#hasTime;
34349
+ }
34350
+ toISOString() {
34351
+ let iso = super.toISOString();
34352
+ if (this.isDate())
34353
+ return iso.slice(0, 10);
34354
+ if (this.isTime())
34355
+ return iso.slice(11, 23);
34356
+ if (this.#offset === null)
34357
+ return iso.slice(0, -1);
34358
+ if (this.#offset === "Z" || this.#offset === "z")
34359
+ return iso;
34360
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
34361
+ offset = this.#offset[0] === "-" ? offset : -offset;
34362
+ let offsetDate = new Date(this.getTime() - offset * 60000);
34363
+ return offsetDate.toISOString().slice(0, -1) + this.#offset;
34364
+ }
34365
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
34366
+ let date = new TomlDate(jsDate);
34367
+ date.#offset = offset;
34368
+ return date;
34369
+ }
34370
+ static wrapAsLocalDateTime(jsDate) {
34371
+ let date = new TomlDate(jsDate);
34372
+ date.#offset = null;
34373
+ return date;
34374
+ }
34375
+ static wrapAsLocalDate(jsDate) {
34376
+ let date = new TomlDate(jsDate);
34377
+ date.#hasTime = false;
34378
+ date.#offset = null;
34379
+ return date;
34380
+ }
34381
+ static wrapAsLocalTime(jsDate) {
34382
+ let date = new TomlDate(jsDate);
34383
+ date.#hasDate = false;
34384
+ date.#offset = null;
34385
+ return date;
34386
+ }
33909
34387
  }
33910
34388
 
33911
34389
  // node_modules/smol-toml/dist/extract.js
@@ -33936,71 +34414,263 @@ function skipUntil(str2, ptr, sep, end, banNewLines = false) {
33936
34414
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33937
34415
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33938
34416
  */
33939
- function sliceAndTrimEndOf(str2, startPtr, endPtr) {
33940
- let value = str2.slice(startPtr, endPtr);
33941
- let commentIdx = value.indexOf("#");
33942
- if (commentIdx > -1) {
33943
- skipComment(str2, commentIdx);
33944
- value = value.slice(0, commentIdx);
34417
+ function isDigit(char, base = 10) {
34418
+ return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
34419
+ }
34420
+ function isEndOfValue(char, delim) {
34421
+ return char === 32 || char === 9 || char === 10 || char === 13 || delim && (char === delim || char === 44) || char === 35;
34422
+ }
34423
+ function extractValue(ctx, end) {
34424
+ let errPtr = ctx.p;
34425
+ let c = ctx.s.charCodeAt(ctx.p);
34426
+ if (c === 91 || c === 123) {
34427
+ ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
34428
+ let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
34429
+ ctx.d++;
34430
+ return value;
34431
+ }
34432
+ if (c === 34 || c === 39) {
34433
+ return parseString(ctx);
34434
+ }
34435
+ if (c === 116) {
34436
+ if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
34437
+ TomlError.x("invalid value", ctx, errPtr);
34438
+ return ctx.p++, true;
33945
34439
  }
33946
- return [value.trimEnd(), commentIdx];
34440
+ if (c === 102) {
34441
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
34442
+ TomlError.x("invalid value", ctx, errPtr);
34443
+ return ctx.p++, false;
34444
+ }
34445
+ if (c === 43 || c === 45) {
34446
+ return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
34447
+ }
34448
+ if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
34449
+ return parseDate(ctx, c, end);
34450
+ }
34451
+ if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
34452
+ return parseTime(ctx, c, end);
34453
+ }
34454
+ return parseNumber(ctx, ctx.p, c, 0, end);
33947
34455
  }
33948
- function extractValue(str2, ptr, end, depth, integersAsBigInt) {
33949
- if (depth === 0) {
33950
- throw new TomlError("document contains excessively nested structures. aborting.", {
33951
- toml: str2,
33952
- ptr
33953
- });
34456
+ function parseNumber(ctx, startPtr, startChr, sign, endChr) {
34457
+ let c = startChr;
34458
+ let state = 0;
34459
+ let hasUnderscores = false;
34460
+ if (c === 105) {
34461
+ if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
34462
+ TomlError.x("invalid value", ctx, startPtr);
34463
+ return ctx.p++, (sign || 1) / 0;
34464
+ }
34465
+ if (c === 110) {
34466
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
34467
+ TomlError.x("invalid value", ctx, startPtr);
34468
+ return ctx.p++, NaN;
34469
+ }
34470
+ if (c === 48) {
34471
+ if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
34472
+ return ctx.bi === true ? 0n : 0;
34473
+ if (!sign) {
34474
+ if (c === 120)
34475
+ return parseIntegerBaseN(ctx, startPtr, 16, endChr);
34476
+ else if (c === 98)
34477
+ return parseIntegerBaseN(ctx, startPtr, 2, endChr);
34478
+ else if (c === 111)
34479
+ return parseIntegerBaseN(ctx, startPtr, 8, endChr);
34480
+ }
34481
+ if (c === 46)
34482
+ state = 2;
34483
+ else if (c === 101 || c === 69)
34484
+ state = 4;
34485
+ else
34486
+ TomlError.x("illegal leading zero", ctx, startPtr);
34487
+ } else if (!isDigit(c))
34488
+ TomlError.x("invalid value", ctx, startPtr);
34489
+ while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
34490
+ if (!state)
34491
+ state = 1;
34492
+ if (c === 95) {
34493
+ if (!(state & 1))
34494
+ TomlError.x("illegal underscore", ctx);
34495
+ state += 11;
34496
+ hasUnderscores = true;
34497
+ } else if (state === 1 && c === 46)
34498
+ state = 2;
34499
+ else if ((state === 1 || state === 3) && (c === 101 || c === 69))
34500
+ state = 4;
34501
+ else if (state === 4 && (c === 43 || c === 45)) {
34502
+ state = 6;
34503
+ } else if (!isDigit(c))
34504
+ TomlError.x(`illegal character in numeric literal`, ctx);
34505
+ else if (state > 9)
34506
+ state -= 11;
34507
+ else if (!(state & 1))
34508
+ state++;
34509
+ }
34510
+ if (!state) {
34511
+ let val = (startChr - 48) * (sign || 1);
34512
+ return ctx.bi === true ? BigInt(val) : val;
34513
+ }
34514
+ if (!(state & 1))
34515
+ TomlError.x("unfinished numeric value", ctx, startPtr);
34516
+ let str2 = ctx.s.slice(startPtr, ctx.p);
34517
+ if (hasUnderscores)
34518
+ str2 = str2.replaceAll("_", "");
34519
+ return state > 1 ? parseFloat(str2) : parseInteger(ctx, str2, 10, startPtr);
34520
+ }
34521
+ function parseIntegerBaseN(ctx, startPtr, base, endChr) {
34522
+ let c, underscore = 1;
34523
+ while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
34524
+ if (c === 95) {
34525
+ if (underscore & 1)
34526
+ TomlError.x("illegal underscore", ctx);
34527
+ underscore = 3;
34528
+ } else if (!isDigit(c, base))
34529
+ TomlError.x(`illegal character in numeric literal`, ctx);
34530
+ else if (underscore & 1)
34531
+ underscore--;
34532
+ }
34533
+ if (underscore & 1)
34534
+ TomlError.x("unfinished numeric value", ctx);
34535
+ let str2 = ctx.s.slice(startPtr + 2, ctx.p);
34536
+ if (underscore)
34537
+ str2 = str2.replaceAll("_", "");
34538
+ return parseInteger(ctx, str2, base, startPtr);
34539
+ }
34540
+ function parseInteger(ctx, str2, base, startPtr) {
34541
+ if (ctx.bi !== true)
34542
+ int: {
34543
+ let val = parseInt(str2, base);
34544
+ if (!Number.isSafeInteger(val)) {
34545
+ if (ctx.bi)
34546
+ break int;
34547
+ TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
34548
+ }
34549
+ return val;
34550
+ }
34551
+ return base === 10 ? BigInt(str2) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str2);
34552
+ }
34553
+ function parseDate(ctx, c, endChr) {
34554
+ let startPtr = ctx.p++, unsafeSeparator;
34555
+ if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
34556
+ return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
34557
+ }
34558
+ ctx.p += 5;
34559
+ if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
34560
+ TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
34561
+ if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
34562
+ let t = ctx.s.slice(startPtr, ctx.p);
34563
+ return readDate(ctx, t, 3, false, startPtr);
34564
+ }
34565
+ if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
34566
+ TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
34567
+ if (ctx.s.charCodeAt(ctx.p += 3) === 58)
34568
+ ctx.p += 3;
34569
+ if (ctx.s.charCodeAt(ctx.p) === 46)
34570
+ while (isDigit(ctx.s.charCodeAt(++ctx.p)))
34571
+ ;
34572
+ if (c = ctx.s.charCodeAt(ctx.p)) {
34573
+ if (c === 90 || c === 122) {
34574
+ let t = ctx.s.slice(startPtr, ++ctx.p);
34575
+ return readDate(ctx, t, 1, unsafeSeparator, startPtr, "[+00:00]");
34576
+ }
34577
+ if (c === 43 || c === 45) {
34578
+ let t = ctx.s.slice(startPtr, ctx.p += 6);
34579
+ return readDate(ctx, t, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
34580
+ }
34581
+ }
34582
+ let t = ctx.s.slice(startPtr, ctx.p);
34583
+ return readDate(ctx, t, 2, unsafeSeparator, startPtr);
34584
+ }
34585
+ function parseTime(ctx, c, endChr) {
34586
+ let start = ctx.p;
34587
+ if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
34588
+ return parseNumber(ctx, --ctx.p, c, 0, endChr);
34589
+ }
34590
+ if (ctx.s.charCodeAt(ctx.p += 4) === 58)
34591
+ ctx.p += 3;
34592
+ if (ctx.s.charCodeAt(ctx.p) === 46)
34593
+ while (isDigit(ctx.s.charCodeAt(++ctx.p)))
34594
+ ;
34595
+ let t = ctx.s.slice(start, ctx.p);
34596
+ return readDate(ctx, t, 4, false, start);
34597
+ }
34598
+ function readDate(ctx, str2, type, unsafeDelim, errPtr, temporalSuffix) {
34599
+ if (ctx.ld) {
34600
+ let date = new TomlDate(str2, type, unsafeDelim);
34601
+ if (!date.isValid())
34602
+ TomlError.x("invalid date", ctx, errPtr);
34603
+ return date;
33954
34604
  }
33955
- let c = str2[ptr];
33956
- if (c === "[" || c === "{") {
33957
- let [value, endPtr] = c === "[" ? parseArray(str2, ptr, depth, integersAsBigInt) : parseInlineTable(str2, ptr, depth, integersAsBigInt);
33958
- if (end) {
33959
- endPtr = skipVoid(str2, endPtr);
33960
- if (str2[endPtr] === ",")
33961
- endPtr++;
33962
- else if (str2[endPtr] !== end) {
33963
- throw new TomlError("expected comma or end of structure", {
33964
- toml: str2,
33965
- ptr: endPtr
33966
- });
33967
- }
34605
+ try {
34606
+ if (temporalSuffix)
34607
+ str2 += temporalSuffix;
34608
+ switch (type) {
34609
+ case 1:
34610
+ return Temporal.ZonedDateTime.from(str2);
34611
+ case 2:
34612
+ return Temporal.PlainDateTime.from(str2);
34613
+ case 3:
34614
+ return Temporal.PlainDate.from(str2);
34615
+ case 4:
34616
+ return Temporal.PlainTime.from(str2);
33968
34617
  }
33969
- return [value, endPtr];
34618
+ } catch (e) {
34619
+ TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
33970
34620
  }
33971
- if (c === '"' || c === "'") {
33972
- let [parsed, endPtr] = parseString(str2, ptr);
33973
- if (end) {
33974
- endPtr = skipVoid(str2, endPtr);
33975
- if (str2[endPtr] && str2[endPtr] !== "," && str2[endPtr] !== end && str2[endPtr] !== `
33976
- ` && str2[endPtr] !== "\r") {
33977
- throw new TomlError("unexpected character encountered", {
33978
- toml: str2,
33979
- ptr: endPtr
33980
- });
33981
- }
33982
- if (str2[endPtr] === ",")
33983
- endPtr++;
34621
+ }
34622
+
34623
+ // node_modules/smol-toml/dist/util.js
34624
+ /*!
34625
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
34626
+ * SPDX-License-Identifier: BSD-3-Clause
34627
+ *
34628
+ * Redistribution and use in source and binary forms, with or without
34629
+ * modification, are permitted provided that the following conditions are met:
34630
+ *
34631
+ * 1. Redistributions of source code must retain the above copyright notice, this
34632
+ * list of conditions and the following disclaimer.
34633
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
34634
+ * this list of conditions and the following disclaimer in the
34635
+ * documentation and/or other materials provided with the distribution.
34636
+ * 3. Neither the name of the copyright holder nor the names of its contributors
34637
+ * may be used to endorse or promote products derived from this software without
34638
+ * specific prior written permission.
34639
+ *
34640
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34641
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34642
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34643
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
34644
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34645
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34646
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34647
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34648
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34649
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34650
+ */
34651
+ function skipComment(ctx) {
34652
+ for (;ctx.p < ctx.s.length; ctx.p++) {
34653
+ let c = ctx.s.charCodeAt(ctx.p);
34654
+ if (c === 10)
34655
+ break;
34656
+ if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
34657
+ ctx.p++;
34658
+ break;
34659
+ }
34660
+ if (c < 32 && c !== 9 || c === 127) {
34661
+ TomlError.x("control characters are not allowed in comments", ctx);
33984
34662
  }
33985
- return [parsed, endPtr];
33986
- }
33987
- let endPtr = skipUntil(str2, ptr, ",", end);
33988
- let slice = sliceAndTrimEndOf(str2, ptr, endPtr - (str2[endPtr - 1] === "," ? 1 : 0));
33989
- if (!slice[0]) {
33990
- throw new TomlError("incomplete key-value declaration: no value specified", {
33991
- toml: str2,
33992
- ptr
33993
- });
33994
34663
  }
33995
- if (end && slice[1] > -1) {
33996
- endPtr = skipVoid(str2, ptr + slice[1]);
33997
- if (str2[endPtr] === ",")
33998
- endPtr++;
34664
+ }
34665
+ function skipVoid(ctx, banNewLines, banComments) {
34666
+ let c;
34667
+ while (ctx.p < ctx.s.length) {
34668
+ while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
34669
+ ctx.p++;
34670
+ if (banComments || c !== 35)
34671
+ break;
34672
+ skipComment(ctx);
33999
34673
  }
34000
- return [
34001
- parseValue(slice[0], str2, ptr, integersAsBigInt),
34002
- endPtr
34003
- ];
34004
34674
  }
34005
34675
 
34006
34676
  // node_modules/smol-toml/dist/struct.js
@@ -34031,147 +34701,112 @@ function extractValue(str2, ptr, end, depth, integersAsBigInt) {
34031
34701
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34032
34702
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34033
34703
  */
34034
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
34035
- function parseKey(str2, ptr, end = "=") {
34036
- let dot = ptr - 1;
34704
+ function parseKey(ctx, end = 61) {
34705
+ let startPtr;
34706
+ let state = 0;
34037
34707
  let parsed = [];
34038
- let endPtr = str2.indexOf(end, ptr);
34039
- if (endPtr < 0) {
34040
- throw new TomlError("incomplete key-value: cannot find end of key", {
34041
- toml: str2,
34042
- ptr
34043
- });
34044
- }
34708
+ let sliceStart;
34709
+ let c = ctx.s.charCodeAt(startPtr = ctx.p);
34045
34710
  do {
34046
- let c = str2[ptr = ++dot];
34047
- if (c !== " " && c !== "\t") {
34048
- if (c === '"' || c === "'") {
34049
- if (c === str2[ptr + 1] && c === str2[ptr + 2]) {
34050
- throw new TomlError("multiline strings are not allowed in keys", {
34051
- toml: str2,
34052
- ptr
34053
- });
34054
- }
34055
- let [part, eos] = parseString(str2, ptr);
34056
- dot = str2.indexOf(".", eos);
34057
- let strEnd = str2.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
34058
- let newLine = indexOfNewline(strEnd);
34059
- if (newLine > -1) {
34060
- throw new TomlError("newlines are not allowed in keys", {
34061
- toml: str2,
34062
- ptr: ptr + dot + newLine
34063
- });
34064
- }
34065
- if (strEnd.trimStart()) {
34066
- throw new TomlError("found extra tokens after the string part", {
34067
- toml: str2,
34068
- ptr: eos
34069
- });
34070
- }
34071
- if (endPtr < eos) {
34072
- endPtr = str2.indexOf(end, eos);
34073
- if (endPtr < 0) {
34074
- throw new TomlError("incomplete key-value: cannot find end of key", {
34075
- toml: str2,
34076
- ptr
34077
- });
34078
- }
34079
- }
34080
- parsed.push(part);
34081
- } else {
34082
- dot = str2.indexOf(".", ptr);
34083
- let part = str2.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
34084
- if (!KEY_PART_RE.test(part)) {
34085
- throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
34086
- toml: str2,
34087
- ptr
34088
- });
34089
- }
34090
- parsed.push(part.trimEnd());
34711
+ if (c === end) {
34712
+ if (!state)
34713
+ TomlError.x("unexpected end of key", ctx);
34714
+ if (state === 1)
34715
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
34716
+ return ctx.p++, parsed;
34717
+ } else if (c === 46) {
34718
+ if (!state)
34719
+ TomlError.x("illegal empty bare key", ctx);
34720
+ if (state === 1)
34721
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
34722
+ state = 0;
34723
+ } else if (!state && (c === 34 || c === 39)) {
34724
+ if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
34725
+ TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
34726
+ parsed.push(parseString(ctx));
34727
+ state = 2;
34728
+ ctx.p--;
34729
+ } else if (c === 32 || c === 9) {
34730
+ if (state === 1) {
34731
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
34732
+ state = 2;
34091
34733
  }
34734
+ } else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
34735
+ TomlError.x("illegal character in key", ctx);
34736
+ } else if (!state) {
34737
+ state = 1;
34738
+ sliceStart = ctx.p;
34092
34739
  }
34093
- } while (dot + 1 && dot < endPtr);
34094
- return [parsed, skipVoid(str2, endPtr + 1, true, true)];
34740
+ } while (c = ctx.s.charCodeAt(++ctx.p));
34741
+ TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
34095
34742
  }
34096
- function parseInlineTable(str2, ptr, depth, integersAsBigInt) {
34097
- let res = {};
34743
+ function parseInlineTable(ctx) {
34744
+ let startPtr = ctx.p++;
34745
+ let res = Object.create(null);
34098
34746
  let seen = new Set;
34099
34747
  let c;
34100
- ptr++;
34101
- while ((c = str2[ptr++]) !== "}" && c) {
34102
- if (c === ",") {
34103
- throw new TomlError("expected value, found comma", {
34104
- toml: str2,
34105
- ptr: ptr - 1
34106
- });
34107
- } else if (c === "#")
34108
- ptr = skipComment(str2, ptr);
34109
- else if (c !== " " && c !== "\t" && c !== `
34110
- ` && c !== "\r") {
34111
- let k;
34112
- let t = res;
34113
- let hasOwn = false;
34114
- let [key, keyEndPtr] = parseKey(str2, ptr - 1);
34115
- for (let i = 0;i < key.length; i++) {
34116
- if (i)
34117
- t = hasOwn ? t[k] : t[k] = {};
34118
- k = key[i];
34119
- if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
34120
- throw new TomlError("trying to redefine an already defined value", {
34121
- toml: str2,
34122
- ptr
34123
- });
34124
- }
34125
- if (!hasOwn && k === "__proto__") {
34126
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
34127
- }
34748
+ while (ctx.p < ctx.s.length) {
34749
+ skipVoid(ctx);
34750
+ if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
34751
+ ctx.p++;
34752
+ return res;
34753
+ }
34754
+ let k;
34755
+ let t = res;
34756
+ let hasOwn = false;
34757
+ let errPtr = ctx.p;
34758
+ let key = parseKey(ctx);
34759
+ for (let i = 0;i < key.length; i++) {
34760
+ if (i)
34761
+ t = hasOwn ? t[k] : t[k] = Object.create(null);
34762
+ k = key[i];
34763
+ if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
34764
+ TomlError.x("trying to redefine an already defined value", ctx, errPtr);
34765
+ }
34766
+ let unsafe = k === "__proto__";
34767
+ if (ctx.uk && (unsafe || k === "constructor")) {
34768
+ t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
34769
+ break;
34128
34770
  }
34129
- if (hasOwn) {
34130
- throw new TomlError("trying to redefine an already defined value", {
34131
- toml: str2,
34132
- ptr
34133
- });
34771
+ if (!hasOwn && unsafe) {
34772
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
34134
34773
  }
34135
- let [value, valueEndPtr] = extractValue(str2, keyEndPtr, "}", depth - 1, integersAsBigInt);
34774
+ }
34775
+ if (hasOwn) {
34776
+ TomlError.x("trying to redefine an already defined value", ctx, errPtr);
34777
+ }
34778
+ skipVoid(ctx, true, true);
34779
+ let value = extractValue(ctx, 125);
34780
+ if (t && typeof (t[k] = value) === "object")
34136
34781
  seen.add(value);
34137
- t[k] = value;
34138
- ptr = valueEndPtr;
34782
+ skipVoid(ctx);
34783
+ if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
34784
+ return res;
34139
34785
  }
34786
+ if (c !== 44)
34787
+ TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
34140
34788
  }
34141
- if (!c) {
34142
- throw new TomlError("unfinished table encountered", {
34143
- toml: str2,
34144
- ptr
34145
- });
34146
- }
34147
- return [res, ptr];
34789
+ TomlError.x("unfinished table", ctx, startPtr);
34148
34790
  }
34149
- function parseArray(str2, ptr, depth, integersAsBigInt) {
34791
+ function parseArray(ctx) {
34792
+ let startPtr = ctx.p++;
34150
34793
  let res = [];
34151
34794
  let c;
34152
- ptr++;
34153
- while ((c = str2[ptr++]) !== "]" && c) {
34154
- if (c === ",") {
34155
- throw new TomlError("expected value, found comma", {
34156
- toml: str2,
34157
- ptr: ptr - 1
34158
- });
34159
- } else if (c === "#")
34160
- ptr = skipComment(str2, ptr);
34161
- else if (c !== " " && c !== "\t" && c !== `
34162
- ` && c !== "\r") {
34163
- let e = extractValue(str2, ptr - 1, "]", depth - 1, integersAsBigInt);
34164
- res.push(e[0]);
34165
- ptr = e[1];
34166
- }
34167
- }
34168
- if (!c) {
34169
- throw new TomlError("unfinished array encountered", {
34170
- toml: str2,
34171
- ptr
34172
- });
34795
+ while (ctx.p < ctx.s.length) {
34796
+ skipVoid(ctx);
34797
+ if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
34798
+ ctx.p++;
34799
+ return res;
34800
+ }
34801
+ res.push(extractValue(ctx, 93));
34802
+ skipVoid(ctx);
34803
+ if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
34804
+ return res;
34805
+ }
34806
+ if (c !== 44)
34807
+ TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
34173
34808
  }
34174
- return [res, ptr];
34809
+ TomlError.x("unfinished array", ctx, startPtr);
34175
34810
  }
34176
34811
 
34177
34812
  // node_modules/smol-toml/dist/parse.js
@@ -34202,7 +34837,7 @@ function parseArray(str2, ptr, depth, integersAsBigInt) {
34202
34837
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34203
34838
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34204
34839
  */
34205
- function peekTable(key, table, meta, type) {
34840
+ function peekTable(ctx, key, table, meta, type) {
34206
34841
  let t = table;
34207
34842
  let m = meta;
34208
34843
  let k;
@@ -34210,7 +34845,7 @@ function peekTable(key, table, meta, type) {
34210
34845
  let state;
34211
34846
  for (let i = 0;i < key.length; i++) {
34212
34847
  if (i) {
34213
- t = hasOwn ? t[k] : t[k] = {};
34848
+ t = hasOwn ? t[k] : t[k] = Object.create(null);
34214
34849
  m = (state = m[k]).c;
34215
34850
  if (type === 0 && (state.t === 1 || state.t === 2)) {
34216
34851
  return null;
@@ -34226,7 +34861,10 @@ function peekTable(key, table, meta, type) {
34226
34861
  return null;
34227
34862
  }
34228
34863
  if (!hasOwn) {
34229
- if (k === "__proto__") {
34864
+ let unsafe = k === "__proto__";
34865
+ if (ctx.uk && (unsafe || k === "constructor"))
34866
+ return false;
34867
+ if (unsafe) {
34230
34868
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
34231
34869
  Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
34232
34870
  }
@@ -34234,7 +34872,7 @@ function peekTable(key, table, meta, type) {
34234
34872
  t: i < key.length - 1 && type === 2 ? 3 : type,
34235
34873
  d: false,
34236
34874
  i: 0,
34237
- c: {}
34875
+ c: Object.create(null)
34238
34876
  };
34239
34877
  }
34240
34878
  }
@@ -34247,70 +34885,78 @@ function peekTable(key, table, meta, type) {
34247
34885
  state.d = true;
34248
34886
  t[k] = [];
34249
34887
  }
34250
- t[k].push(t = {});
34251
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
34888
+ t[k].push(t = Object.create(null));
34889
+ state.c[state.i++] = state = { t: 1, d: false, i: 0, c: Object.create(null) };
34252
34890
  }
34253
34891
  if (state.d) {
34254
34892
  return null;
34255
34893
  }
34256
34894
  state.d = true;
34257
34895
  if (type === 1) {
34258
- t = hasOwn ? t[k] : t[k] = {};
34896
+ t = hasOwn ? t[k] : t[k] = Object.create(null);
34259
34897
  } else if (type === 0 && hasOwn) {
34260
34898
  return null;
34261
34899
  }
34262
34900
  return [k, t, state.c];
34263
34901
  }
34264
- function parse2(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
34265
- let res = {};
34266
- let meta = {};
34902
+ function validateTablePeek(ctx, peek, ptr) {
34903
+ if (peek === null || ctx.uk === 2)
34904
+ TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
34905
+ }
34906
+ function parse2(toml, options2 = {}) {
34907
+ let ctx = {
34908
+ s: toml,
34909
+ p: 0,
34910
+ d: options2.maxDepth ?? 1000,
34911
+ bi: options2.integersAsBigInt ?? false,
34912
+ ld: options2.useLegacyDate ?? true,
34913
+ uk: options2.unsafeKeyBehaviour === "throw" ? 2 : options2.unsafeKeyBehaviour === "drop" ? 1 : 0
34914
+ };
34915
+ let res = Object.create(null);
34916
+ let meta = Object.create(null);
34917
+ let tmp;
34918
+ let skipping = false;
34267
34919
  let tbl = res;
34268
34920
  let m = meta;
34269
- for (let ptr = skipVoid(toml, 0);ptr < toml.length; ) {
34270
- if (toml[ptr] === "[") {
34271
- let isTableArray = toml[++ptr] === "[";
34272
- let k = parseKey(toml, ptr += +isTableArray, "]");
34921
+ if (toml.charCodeAt(0) === 65279)
34922
+ ctx.p++;
34923
+ skipVoid(ctx);
34924
+ while (ctx.p < toml.length) {
34925
+ if (toml.charCodeAt(ctx.p) === 91) {
34926
+ let isTableArray = toml.charCodeAt(++ctx.p) === 91;
34927
+ tmp = ctx.p += +isTableArray;
34928
+ skipping = false;
34929
+ let k = parseKey(ctx, 93);
34273
34930
  if (isTableArray) {
34274
- if (toml[k[1] - 1] !== "]") {
34275
- throw new TomlError("expected end of table declaration", {
34276
- toml,
34277
- ptr: k[1] - 1
34278
- });
34931
+ if (toml.charCodeAt(ctx.p) !== 93) {
34932
+ TomlError.x("expected end of table array declaration", ctx);
34279
34933
  }
34280
- k[1]++;
34934
+ ctx.p++;
34281
34935
  }
34282
- let p = peekTable(k[0], res, meta, isTableArray ? 2 : 1);
34936
+ let p = peekTable(ctx, k, res, meta, isTableArray ? 2 : 1);
34283
34937
  if (!p) {
34284
- throw new TomlError("trying to redefine an already defined table or value", {
34285
- toml,
34286
- ptr
34287
- });
34938
+ validateTablePeek(ctx, p, tmp);
34939
+ skipping = true;
34940
+ } else {
34941
+ m = p[2];
34942
+ tbl = p[1];
34288
34943
  }
34289
- m = p[2];
34290
- tbl = p[1];
34291
- ptr = k[1];
34292
34944
  } else {
34293
- let k = parseKey(toml, ptr);
34294
- let p = peekTable(k[0], tbl, m, 0);
34295
- if (!p) {
34296
- throw new TomlError("trying to redefine an already defined table or value", {
34297
- toml,
34298
- ptr
34299
- });
34300
- }
34301
- let v = extractValue(toml, k[1], undefined, maxDepth, integersAsBigInt);
34302
- p[1][p[0]] = v[0];
34303
- ptr = v[1];
34304
- }
34305
- ptr = skipVoid(toml, ptr, true);
34306
- if (toml[ptr] && toml[ptr] !== `
34307
- ` && toml[ptr] !== "\r") {
34308
- throw new TomlError("each key-value declaration must be followed by an end-of-line", {
34309
- toml,
34310
- ptr
34311
- });
34312
- }
34313
- ptr = skipVoid(toml, ptr);
34945
+ tmp = ctx.p;
34946
+ let k = parseKey(ctx);
34947
+ let p = peekTable(ctx, k, tbl, m, 0);
34948
+ if (!p && !skipping)
34949
+ validateTablePeek(ctx, p, tmp);
34950
+ skipVoid(ctx, true, true);
34951
+ let v = extractValue(ctx, undefined);
34952
+ if (p && !skipping)
34953
+ p[1][p[0]] = v;
34954
+ }
34955
+ skipVoid(ctx, true);
34956
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
34957
+ TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
34958
+ }
34959
+ skipVoid(ctx);
34314
34960
  }
34315
34961
  return res;
34316
34962
  }
@@ -34344,13 +34990,28 @@ function parse2(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
34344
34990
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34345
34991
  */
34346
34992
  var BARE_KEY = /^[a-z0-9-_]+$/i;
34993
+ var HAS_WELLFORMED = !!"".isWellFormed;
34347
34994
  function extendedTypeOf(obj) {
34348
34995
  let type = typeof obj;
34349
34996
  if (type === "object") {
34350
34997
  if (Array.isArray(obj))
34351
34998
  return "array";
34352
- if (obj instanceof Date)
34999
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date)
34353
35000
  return "date";
35001
+ if (globalThis.Temporal) {
35002
+ if (obj.until) {
35003
+ if (obj instanceof Temporal.ZonedDateTime)
35004
+ return "temporal/tz+uc";
35005
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate)
35006
+ return "temporal/uc";
35007
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant)
35008
+ return "temporal";
35009
+ if (obj instanceof Temporal.PlainYearMonth)
35010
+ return "temporal/x";
35011
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) {
35012
+ return "temporal/x";
35013
+ }
35014
+ }
34354
35015
  }
34355
35016
  return type;
34356
35017
  }
@@ -34361,44 +35022,67 @@ function isArrayOfTables(obj) {
34361
35022
  }
34362
35023
  return obj.length != 0;
34363
35024
  }
35025
+ function formatWellFormedStringUnchecked(s) {
35026
+ return JSON.stringify(s).replaceAll("\x7F", "\\u007f");
35027
+ }
34364
35028
  function formatString(s) {
34365
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
35029
+ return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
35030
+ }
35031
+ function formatKey(s) {
35032
+ if (BARE_KEY.test(s))
35033
+ return s;
35034
+ if (HAS_WELLFORMED && !s.isWellFormed())
35035
+ throw new RangeError("key contains illegal lone surrogates");
35036
+ return formatWellFormedStringUnchecked(s);
34366
35037
  }
34367
- function stringifyValue(val, type, depth, numberAsFloat) {
35038
+ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
34368
35039
  if (depth === 0) {
34369
35040
  throw new Error("Could not stringify the object: maximum object depth exceeded");
34370
35041
  }
34371
- if (type === "number") {
34372
- if (isNaN(val))
34373
- return "nan";
34374
- if (val === Infinity)
34375
- return "inf";
34376
- if (val === -Infinity)
34377
- return "-inf";
34378
- if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
34379
- return val.toFixed(1);
34380
- return val.toString();
34381
- }
34382
- if (type === "bigint" || type === "boolean") {
34383
- return val.toString();
34384
- }
34385
- if (type === "string") {
34386
- return formatString(val);
34387
- }
34388
- if (type === "date") {
34389
- if (isNaN(val.getTime())) {
34390
- throw new TypeError("cannot serialize invalid date");
34391
- }
34392
- return val.toISOString();
34393
- }
34394
- if (type === "object") {
34395
- return stringifyInlineTable(val, depth, numberAsFloat);
34396
- }
34397
- if (type === "array") {
34398
- return stringifyArray(val, depth, numberAsFloat);
35042
+ switch (type) {
35043
+ case "number":
35044
+ if (isNaN(val))
35045
+ return "nan";
35046
+ if (val === Infinity)
35047
+ return "inf";
35048
+ if (val === -Infinity)
35049
+ return "-inf";
35050
+ if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
35051
+ return val.toFixed(1);
35052
+ case "bigint":
35053
+ case "boolean":
35054
+ case "temporal":
35055
+ return val.toString();
35056
+ case "string":
35057
+ return formatString(val);
35058
+ case "date":
35059
+ if (isNaN(val.getTime()))
35060
+ throw new TypeError("cannot serialize invalid date");
35061
+ return val.toISOString();
35062
+ case "object":
35063
+ return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
35064
+ case "array":
35065
+ return stringifyArray(val, depth, numberAsFloat, strictTemporal);
35066
+ case "temporal/tz+uc":
35067
+ if (strictTemporal) {
35068
+ let tz = val.timeZoneId;
35069
+ let tzc = tz.charCodeAt(0);
35070
+ if (tzc !== 43 && tzc !== 45 && (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && !tz.startsWith("GMT") && tz !== "Greenwich" && !tz.startsWith("Etc/"))) {
35071
+ throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
35072
+ }
35073
+ }
35074
+ case "temporal/uc":
35075
+ if (strictTemporal && val.calendarId !== "iso8601")
35076
+ throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
35077
+ return val.toString({
35078
+ calendarName: "never",
35079
+ timeZoneName: "never"
35080
+ });
35081
+ case "temporal/x":
35082
+ throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
34399
35083
  }
34400
35084
  }
34401
- function stringifyInlineTable(obj, depth, numberAsFloat) {
35085
+ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
34402
35086
  let keys = Object.keys(obj);
34403
35087
  if (keys.length === 0)
34404
35088
  return "{}";
@@ -34407,13 +35091,11 @@ function stringifyInlineTable(obj, depth, numberAsFloat) {
34407
35091
  let k = keys[i];
34408
35092
  if (i)
34409
35093
  res += ", ";
34410
- res += BARE_KEY.test(k) ? k : formatString(k);
34411
- res += " = ";
34412
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
35094
+ res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
34413
35095
  }
34414
35096
  return res + " }";
34415
35097
  }
34416
- function stringifyArray(array, depth, numberAsFloat) {
35098
+ function stringifyArray(array, depth, numberAsFloat, strictTemporal) {
34417
35099
  if (array.length === 0)
34418
35100
  return "[]";
34419
35101
  let res = "[ ";
@@ -34423,11 +35105,11 @@ function stringifyArray(array, depth, numberAsFloat) {
34423
35105
  if (array[i] === null || array[i] === undefined) {
34424
35106
  throw new TypeError("arrays cannot contain null or undefined values");
34425
35107
  }
34426
- res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
35108
+ res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat, strictTemporal);
34427
35109
  }
34428
35110
  return res + " ]";
34429
35111
  }
34430
- function stringifyArrayTable(array, key, depth, numberAsFloat) {
35112
+ function stringifyArrayTable(array, key, depth, numberAsFloat, strictTemporal) {
34431
35113
  if (depth === 0) {
34432
35114
  throw new Error("Could not stringify the object: maximum object depth exceeded");
34433
35115
  }
@@ -34436,11 +35118,11 @@ function stringifyArrayTable(array, key, depth, numberAsFloat) {
34436
35118
  res += `${res && `
34437
35119
  `}[[${key}]]
34438
35120
  `;
34439
- res += stringifyTable(0, array[i], key, depth, numberAsFloat);
35121
+ res += stringifyTable(0, array[i], key, depth, numberAsFloat, strictTemporal);
34440
35122
  }
34441
35123
  return res;
34442
35124
  }
34443
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
35125
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
34444
35126
  if (depth === 0) {
34445
35127
  throw new Error("Could not stringify the object: maximum object depth exceeded");
34446
35128
  }
@@ -34454,18 +35136,18 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
34454
35136
  if (type === "symbol" || type === "function") {
34455
35137
  throw new TypeError(`cannot serialize values of type '${type}'`);
34456
35138
  }
34457
- let key = BARE_KEY.test(k) ? k : formatString(k);
35139
+ let key = formatKey(k);
34458
35140
  if (type === "array" && isArrayOfTables(obj[k])) {
34459
35141
  tables += (tables && `
34460
- `) + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
35142
+ `) + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
34461
35143
  } else if (type === "object") {
34462
35144
  let tblKey = prefix ? `${prefix}.${key}` : key;
34463
35145
  tables += (tables && `
34464
- `) + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
35146
+ `) + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
34465
35147
  } else {
34466
35148
  preamble += key;
34467
35149
  preamble += " = ";
34468
- preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
35150
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
34469
35151
  preamble += `
34470
35152
  `;
34471
35153
  }
@@ -34477,11 +35159,11 @@ ${preamble}` : `[${tableKey}]`;
34477
35159
  return preamble && tables ? `${preamble}
34478
35160
  ${tables}` : preamble || tables;
34479
35161
  }
34480
- function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
35162
+ function stringify(obj, { maxDepth = 1000, numbersAsFloat = false, strictTemporal = false } = {}) {
34481
35163
  if (extendedTypeOf(obj) !== "object") {
34482
35164
  throw new TypeError("stringify can only be called with an object");
34483
35165
  }
34484
- let str2 = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
35166
+ let str2 = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
34485
35167
  if (str2[str2.length - 1] !== `
34486
35168
  `)
34487
35169
  return str2 + `
@@ -34520,20 +35202,14 @@ function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
34520
35202
 
34521
35203
  // src/adapters/codex.ts
34522
35204
  var OPENAI_MODELS = [
35205
+ "gpt-6.1-sol",
35206
+ "gpt-6.1-terra",
34523
35207
  "gpt-6-astra",
34524
35208
  "gpt-6-sol",
34525
- "gpt-6-luna",
34526
- "gpt-5.6-sol",
34527
- "gpt-5.6-terra",
34528
- "gpt-5.6-luna",
34529
- "gpt-5.5",
34530
- "gpt-5.4",
34531
- "gpt-5.4-mini",
34532
- "gpt-5.4-nano",
34533
- "gpt-5.3-codex-spark"
35209
+ "gpt-6-luna"
34534
35210
  ];
34535
35211
  var DEFAULT_MODELS3 = {
34536
- default_model: "gpt-6-sol",
35212
+ default_model: "gpt-6-astra",
34537
35213
  sentinel: "gpt-6-luna",
34538
35214
  oracle: "gpt-6-astra",
34539
35215
  architect: "gpt-6-astra",
@@ -34570,13 +35246,13 @@ function defaultSection3() {
34570
35246
  return {
34571
35247
  provider: "openai",
34572
35248
  default_model: DEFAULT_MODELS3.default_model,
34573
- build_thinking: "high",
34574
- plan_thinking: "xhigh",
35249
+ build_thinking: defaultThinking(DEFAULT_MODELS3.default_model, "session"),
35250
+ plan_thinking: defaultThinking(DEFAULT_MODELS3.default_model, "plan"),
34575
35251
  agents: AGENT_NAMES.map((name) => ({
34576
35252
  template: name,
34577
35253
  name,
34578
35254
  model: DEFAULT_MODELS3[name],
34579
- thinking: { sentinel: "low", oracle: "high", architect: "xhigh", keymaker: "medium" }[name]
35255
+ thinking: defaultThinking(DEFAULT_MODELS3[name], name)
34580
35256
  }))
34581
35257
  };
34582
35258
  }
@@ -34584,7 +35260,7 @@ function modelsForProvider3(_provider) {
34584
35260
  return [...OPENAI_MODELS];
34585
35261
  }
34586
35262
  async function promptSection3(prompt, section) {
34587
- return promptForSimpleModels(prompt, section, modelsForProvider3(), "codex");
35263
+ return promptForSimpleModels(prompt, section, modelsForProvider3(), "codex", defaultSection3());
34588
35264
  }
34589
35265
  function installAgents3(section, basePath) {
34590
35266
  const config = CodexConfigSchema.parse(section);
@@ -34631,7 +35307,7 @@ function mergeHarnessConfig3(section, basePath) {
34631
35307
  ...existing,
34632
35308
  model: config.default_model,
34633
35309
  ...effortField("model_reasoning_effort", codexThinking(config.build_thinking, "medium")),
34634
- ...effortField("plan_mode_reasoning_effort", codexThinking(config.plan_thinking, "high")),
35310
+ ...effortField("plan_mode_reasoning_effort", codexThinking(config.plan_thinking)),
34635
35311
  sandbox_mode: "danger-full-access",
34636
35312
  approval_policy: "on-request",
34637
35313
  features: {
@@ -34755,117 +35431,15 @@ function isObject(value) {
34755
35431
  return typeof value === "object" && value !== null && !Array.isArray(value);
34756
35432
  }
34757
35433
 
34758
- // src/adapters/cursor.ts
34759
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync5, rmSync as rmSync5, rmdirSync as rmdirSync4, writeFileSync as writeFileSync6 } from "fs";
34760
- import { join as join10 } from "path";
34761
- var CURSOR_MODELS = [
34762
- "composer-2.5",
34763
- "cursor-grok-4.5-high",
34764
- "gpt-5.6-luna-medium",
34765
- "gpt-5.6-terra-medium",
34766
- "gpt-5.6-sol-medium",
34767
- "claude-opus-4-8-high",
34768
- "claude-sonnet-5-high",
34769
- "kimi-k2.7-code",
34770
- "glm-5.2-high"
34771
- ];
34772
- var DEFAULT_MODELS4 = {
34773
- sentinel: "composer-2.5",
34774
- oracle: "claude-opus-4-8-high",
34775
- architect: "gpt-5.6-sol-medium",
34776
- keymaker: "composer-2.5"
34777
- };
34778
- var cursorAdapter = {
34779
- name: "cursor",
34780
- configSchema: CursorConfigSchema,
34781
- defaultSection: defaultSection4,
34782
- modelsForProvider: modelsForProvider4,
34783
- promptSection: promptSection4,
34784
- installAgents: installAgents4,
34785
- mergeHarnessConfig: mergeHarnessConfig4,
34786
- fileList: fileList4,
34787
- remove: remove5
34788
- };
34789
- function defaultSection4() {
34790
- return {
34791
- agents: AGENT_NAMES.map((name) => ({ template: name, name, model: DEFAULT_MODELS4[name] }))
34792
- };
34793
- }
34794
- function modelsForProvider4(_provider) {
34795
- return CURSOR_MODELS;
34796
- }
34797
- async function promptSection4(prompt, section) {
34798
- const config = section;
34799
- const answers = await prompt.prompt(AGENT_NAMES.map((name) => ({
34800
- type: "list",
34801
- name,
34802
- message: `Select model for ${name}`,
34803
- choices: CURSOR_MODELS,
34804
- default: config.agents.find((agent) => agent.name === name)?.model ?? DEFAULT_MODELS4[name]
34805
- })));
34806
- return {
34807
- agents: AGENT_NAMES.map((name) => ({
34808
- template: name,
34809
- name,
34810
- model: answers[name] ?? DEFAULT_MODELS4[name]
34811
- }))
34812
- };
34813
- }
34814
- function installAgents4(section, basePath) {
34815
- const config = section;
34816
- const agentsDir = join10(basePath, ".cursor", "agents");
34817
- try {
34818
- mkdirSync5(agentsDir, { recursive: true });
34819
- } catch (err) {
34820
- throw new FileWriteError(agentsDir, err instanceof Error ? err.message : String(err));
34821
- }
34822
- rmSync5(join10(agentsDir, `${LEGACY_AGENT_NAME}.md`), { force: true });
34823
- for (const agent of config.agents) {
34824
- const template = readTemplate(agent.template);
34825
- const content = `---
34826
- name: ${agent.name}
34827
- description: ${template.description}
34828
- model: ${agent.model}
34829
- ---
34830
- ${template.body}`;
34831
- const agentPath = join10(agentsDir, `${agent.name}.md`);
34832
- writeFileSync6(agentPath, content);
34833
- console.log(`Created ${shortPath(agentPath)}`);
34834
- }
34835
- }
34836
- function mergeHarnessConfig4(_section, _basePath) {}
34837
- function fileList4(basePath) {
34838
- return AGENT_NAMES.map((name) => {
34839
- const path = join10(basePath, ".cursor", "agents", `${name}.md`);
34840
- return { path, exists: existsSync6(path) };
34841
- });
34842
- }
34843
- function remove5(section, basePath) {
34844
- const config = section;
34845
- const agentsDir = join10(basePath, ".cursor", "agents");
34846
- try {
34847
- for (const agent of config.agents) {
34848
- rmSync5(join10(agentsDir, `${agent.name}.md`), { force: true });
34849
- }
34850
- rmSync5(join10(agentsDir, `${LEGACY_AGENT_NAME}.md`), { force: true });
34851
- if (existsSync6(agentsDir) && readdirSync5(agentsDir).length === 0) {
34852
- rmdirSync4(agentsDir);
34853
- }
34854
- } catch (err) {
34855
- throw new FileWriteError(agentsDir, err instanceof Error ? err.message : String(err));
34856
- }
34857
- }
34858
-
34859
35434
  // src/adapters/index.ts
34860
35435
  registerAdapter(claudeAdapter);
34861
35436
  registerAdapter(opencodeAdapter);
34862
35437
  registerAdapter(codexAdapter);
34863
- registerAdapter(cursorAdapter);
34864
35438
 
34865
35439
  // src/atelier.ts
34866
35440
  var harnessChoices2 = Harness.join(", ");
34867
35441
  var program2 = new Command2;
34868
- program2.name("atelier").description("Atelier CLI - configure Claude Code, OpenCode, Codex, and Cursor for spec-driven development").version("0.1.0");
35442
+ program2.name("atelier").description("Atelier CLI - configure Claude Code, OpenCode, and Codex for spec-driven development").version("0.1.0");
34869
35443
  program2.command("init", { isDefault: true }).description("Initialize atelier globally").option(`--harness <type>`, `Harness type (${harnessChoices2})`).option("--yes", "Non-interactive mode with defaults").action((options2) => {
34870
35444
  init(options2).catch(handleError);
34871
35445
  });