@martinffx/atelier 3.6.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,60 +32739,6 @@ 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-(astra|sol|luna)$/.test(id)) {
32108
- return ["default", ...id.endsWith("astra") ? [] : ["off"], "low", "medium", "high", "xhigh", "max"];
32109
- }
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"]];
32112
- }
32113
- if (harness === "opencode") {
32114
- if (/^(glm-5\.3(-flash)?|kimi-k3|deepseek-v4(\.1-flash|-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
- }
32119
- return ["default"];
32120
- }
32121
- function assertThinking(harness, model, thinking, session = false) {
32122
- if (thinking !== undefined && !thinkingChoices(harness, model, session).includes(thinking)) {
32123
- throw new InvalidConfigError(`${model} does not support ${thinking} thinking in ${harness}${session ? " sessions" : ""}`);
32124
- }
32125
- }
32126
- function codexThinking(thinking, legacy) {
32127
- if (thinking === undefined)
32128
- return legacy;
32129
- if (thinking === "default")
32130
- return;
32131
- return thinking === "off" ? "none" : thinking;
32132
- }
32133
- function claudeModel(model) {
32134
- 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;
32135
- }
32136
- function claudeModeModels(model) {
32137
- return model === "opusplan" ? { build: claudeModel("sonnet"), plan: claudeModel("opus") } : { build: claudeModel(model), plan: claudeModel(model) };
32138
- }
32139
- var OPENCODE_THINKING_KEYS = ["reasoningEffort", "thinking", "effort", "reasoningConfig"];
32140
- function openCodeThinkingOptions(model, thinking) {
32141
- assertThinking("opencode", model, thinking);
32142
- if (!thinking || thinking === "default")
32143
- return {};
32144
- if (model.startsWith("amazon-bedrock/")) {
32145
- return { reasoningConfig: { type: "adaptive", maxReasoningEffort: thinking, display: "summarized" } };
32146
- }
32147
- if (model.includes("claude-"))
32148
- return { effort: thinking };
32149
- if (thinking === "on" || thinking === "off") {
32150
- if (model.includes("gpt-6-"))
32151
- return { reasoningEffort: "none" };
32152
- return { thinking: { type: thinking === "off" ? "disabled" : model.includes("minimax") ? "adaptive" : "enabled" } };
32153
- }
32154
- return { reasoningEffort: thinking };
32155
- }
32156
-
32157
32742
  // src/services/prompt.ts
32158
32743
  async function promptForSection(adapter, section) {
32159
32744
  return adapter.promptSection(esm_default12, section);
@@ -32170,114 +32755,107 @@ async function promptForOpenCodeProvider(prompt, choices, current) {
32170
32755
  ]);
32171
32756
  return answer.provider;
32172
32757
  }
32173
- async function promptForSimpleModels(prompt, section, models, harness = "claude") {
32174
- const answers = await prompt.prompt([
32175
- {
32176
- type: "list",
32177
- name: "default_model",
32178
- message: "Select default model",
32179
- choices: modelChoices(models, section.default_model),
32180
- default: section.default_model
32181
- },
32182
- ...AGENT_NAMES.map((name) => ({
32183
- type: "list",
32184
- name,
32185
- message: `Select model for ${name}`,
32186
- choices: modelChoices(models, section.agents.find((a) => a.name === name)?.model),
32187
- default: section.agents.find((a) => a.name === name)?.model || models[0]
32188
- }))
32189
- ]);
32190
- const selectedModel = answers.default_model || section.default_model;
32191
- const result = {
32192
- ...section,
32193
- default_model: selectedModel,
32194
- agents: AGENT_NAMES.map((name) => {
32195
- const agent = section.agents.find((a) => a.name === name);
32196
- return {
32197
- ...agent,
32198
- template: name,
32199
- name,
32200
- model: answers[name] || agent?.model || models[0]
32201
- };
32202
- })
32203
- };
32204
- await promptThinking(prompt, harness, result, section);
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);
32205
32761
  return result;
32206
32762
  }
32207
- async function promptForOpenCodeModels(prompt, section, models, provider) {
32208
- const answers = await prompt.prompt([
32209
- {
32210
- type: "list",
32211
- name: "build_model",
32212
- message: "Select model for build",
32213
- choices: modelChoices(models, section.build_model),
32214
- default: section.build_model
32215
- },
32216
- {
32217
- type: "list",
32218
- name: "plan_model",
32219
- message: "Select model for plan",
32220
- choices: modelChoices(models, section.plan_model),
32221
- default: section.plan_model
32222
- },
32223
- ...AGENT_NAMES.map((name) => ({
32224
- type: "list",
32225
- name,
32226
- message: `Select model for ${name}`,
32227
- choices: modelChoices(models, section.agents.find((a) => a.name === name)?.model),
32228
- default: section.agents.find((a) => a.name === name)?.model || models[0]
32229
- }))
32230
- ]);
32231
- const result = {
32232
- ...section,
32233
- provider,
32234
- build_model: answers.build_model || section.build_model,
32235
- plan_model: answers.plan_model || section.plan_model,
32236
- agents: AGENT_NAMES.map((name) => {
32237
- const agent = section.agents.find((a) => a.name === name);
32238
- return {
32239
- ...agent,
32240
- template: name,
32241
- name,
32242
- model: answers[name] || agent?.model || models[0]
32243
- };
32244
- })
32245
- };
32246
- await promptThinking(prompt, "opencode", result, section);
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;
32775
+ }
32247
32776
  return result;
32248
32777
  }
32249
- function modelChoices(models, saved) {
32250
- return [...new Set([...models, ...saved ? [saved] : []])];
32251
- }
32252
- async function promptThinking(prompt, harness, config, previous) {
32253
- const modelFor = (section, mode) => ("default_model" in section) ? section.default_model : section[`${mode}_model`];
32254
- const slots = ["build", "plan"].filter((mode) => !(mode === "plan" && harness === "claude" && modelFor(config, mode) !== "opusplan")).map((mode) => ({
32255
- name: `${mode}_thinking`,
32256
- label: mode,
32257
- model: modelFor(config, mode),
32258
- oldModel: modelFor(previous, mode),
32259
- saved: previous[`${mode}_thinking`],
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,
32260
32799
  session: true,
32261
32800
  set: (value) => {
32262
- config[`${mode}_thinking`] = value;
32801
+ config.build_thinking = value;
32263
32802
  }
32264
- }));
32265
- for (const agent of config.agents) {
32266
- const old = previous.agents.find((a) => a.name === agent.name);
32267
- slots.push({ name: `${agent.name}_thinking`, label: agent.name, model: agent.model, oldModel: old?.model ?? "", saved: old?.thinking, session: false, set: (value) => {
32268
- agent.thinking = value;
32269
- } });
32270
- }
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);
32839
+ }
32840
+ config.agents = agents;
32841
+ }
32842
+ async function promptThinking(prompt, slots, harness) {
32271
32843
  const questions = slots.map((slot) => {
32272
32844
  const choices = thinkingChoices(harness, slot.model, slot.session);
32273
- const saved = slot.model === slot.oldModel && (slot.saved === undefined || choices.includes(slot.saved)) ? slot.saved : "default";
32274
- 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);
32275
32850
  return {
32276
32851
  type: "list",
32277
32852
  name: slot.name,
32278
32853
  message: `Select thinking for ${slot.label} (${slot.model})`,
32279
- choices: saved === undefined ? [{ name: "Keep existing behavior", value: "keep" }, ...choices] : choices,
32280
- 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"
32281
32859
  };
32282
32860
  });
32283
32861
  const answers = await prompt.prompt(questions);
@@ -32285,15 +32863,13 @@ async function promptThinking(prompt, harness, config, previous) {
32285
32863
  if (answers[slot.name] !== undefined)
32286
32864
  slot.set(answers[slot.name] === "keep" ? undefined : answers[slot.name]);
32287
32865
  }
32288
- if (harness === "claude" && "default_model" in config && config.default_model !== "opusplan")
32289
- config.plan_thinking = config.build_thinking;
32290
32866
  }
32291
32867
  function formatFileList(files) {
32292
32868
  return files.map((f) => ` ${f.action === "delete" ? "-" : f.exists ? "~" : "+"} ${f.path}`).join(`
32293
32869
  `);
32294
32870
  }
32295
32871
  function guardProvider(provider) {
32296
- if (!provider || !["opencode-zen", "opencode-go", "amazon-bedrock", "openai"].includes(provider)) {
32872
+ if (!provider || !["opencode-zen", "opencode-go", "amazon-bedrock", "openai", "openrouter", "google"].includes(provider)) {
32297
32873
  throw new InvalidConfigError("A valid provider must be selected for OpenCode");
32298
32874
  }
32299
32875
  return provider;
@@ -32548,57 +33124,51 @@ var ThinkingSchema = enumType(THINKING_LEVELS);
32548
33124
  var AgentSchema = objectType({
32549
33125
  template: enumType(AGENT_NAMES),
32550
33126
  name: enumType(AGENT_NAMES),
32551
- model: stringType().min(1)
33127
+ model: stringType().min(1),
33128
+ thinking: ThinkingSchema.optional()
32552
33129
  });
32553
- var ThinkingAgentSchema = AgentSchema.extend({ thinking: ThinkingSchema.optional() });
32554
33130
  var SimpleConfigSchema = objectType({
32555
33131
  provider: stringType().optional(),
32556
33132
  default_model: stringType().min(1),
32557
33133
  build_thinking: ThinkingSchema.optional(),
32558
- plan_thinking: ThinkingSchema.optional(),
32559
- agents: arrayType(ThinkingAgentSchema).min(1)
32560
- });
32561
- var CursorConfigSchema = objectType({
32562
33134
  agents: arrayType(AgentSchema).min(1)
32563
- }).strict();
32564
- var OPENCODE_PROVIDERS = ["opencode-zen", "opencode-go", "amazon-bedrock", "openai"];
33135
+ });
33136
+ var OPENCODE_PROVIDERS = ["opencode-zen", "opencode-go", "amazon-bedrock", "openai", "openrouter", "google"];
32565
33137
  var OpenCodeConfigSchema = objectType({
32566
33138
  provider: enumType(OPENCODE_PROVIDERS),
32567
- build_model: stringType().min(1),
32568
- plan_model: stringType().min(1),
33139
+ default_model: stringType().min(1),
32569
33140
  build_thinking: ThinkingSchema.optional(),
32570
33141
  plan_thinking: ThinkingSchema.optional(),
32571
- agents: arrayType(ThinkingAgentSchema).min(1)
33142
+ agents: arrayType(AgentSchema).min(1),
33143
+ warming: booleanType().optional()
32572
33144
  }).superRefine((config, ctx) => checkThinking("opencode", config, ctx));
32573
33145
  var CLAUDE_OPTIONAL_BUILTINS = ["cron", "chrome", "remote-trigger"];
32574
33146
  var ClaudeConfigSchema = SimpleConfigSchema.extend({
32575
33147
  disabled_builtins: arrayType(enumType(CLAUDE_OPTIONAL_BUILTINS)).optional()
32576
- }).superRefine((config, ctx) => {
32577
- checkThinking("claude", config, ctx);
32578
- if (config.default_model !== "opusplan" && config.plan_thinking !== undefined && config.plan_thinking !== config.build_thinking) {
32579
- ctx.addIssue({ code: "custom", path: ["plan_thinking"], message: "Separate Claude Plan/Build thinking requires opusplan" });
32580
- }
32581
- });
32582
- 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));
32583
33152
  function checkThinking(harness, config, ctx) {
32584
33153
  const check = (model, thinking, path, session = false) => {
32585
33154
  if (thinking !== undefined && !thinkingChoices(harness, model, session).includes(thinking)) {
32586
33155
  ctx.addIssue({ code: "custom", path, message: `${model} does not support ${thinking} thinking` });
32587
33156
  }
32588
33157
  };
32589
- check("default_model" in config ? config.default_model : config.build_model, config.build_thinking, ["build_thinking"], true);
32590
- 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"]);
32591
33160
  config.agents.forEach((agent, i) => check(agent.model, agent.thinking, ["agents", i, "thinking"]));
32592
33161
  }
32593
33162
 
32594
33163
  // src/adapters/claude.ts
32595
- var ANTHROPIC_MODELS = ["haiku", "sonnet", "opus", "fable", "best", "opusplan"];
33164
+ var ANTHROPIC_MODELS = ["haiku", "sonnet", "opus", "fable", "best"];
33165
+ var SESSION_ONLY_MODELS = ["opusplan"];
32596
33166
  var DEFAULT_MODELS = {
32597
- default_model: "opusplan",
33167
+ default_model: "opus",
32598
33168
  sentinel: "haiku",
32599
33169
  oracle: "opus",
32600
33170
  architect: "opus",
32601
- keymaker: "haiku"
33171
+ keymaker: "sonnet"
32602
33172
  };
32603
33173
  var CLAUDE_AI_OPT_OUTS = {
32604
33174
  disableClaudeAiConnectors: true,
@@ -32630,13 +33200,12 @@ function defaultSection() {
32630
33200
  return {
32631
33201
  provider: "anthropic",
32632
33202
  default_model: DEFAULT_MODELS.default_model,
32633
- build_thinking: "high",
32634
- plan_thinking: "high",
33203
+ build_thinking: defaultThinking(DEFAULT_MODELS.default_model, "session"),
32635
33204
  agents: AGENT_NAMES.map((name) => ({
32636
33205
  template: name,
32637
33206
  name,
32638
33207
  model: DEFAULT_MODELS[name],
32639
- thinking: name === "sentinel" || name === "keymaker" ? "default" : name === "oracle" ? "xhigh" : "high"
33208
+ thinking: defaultThinking(DEFAULT_MODELS[name], name)
32640
33209
  }))
32641
33210
  };
32642
33211
  }
@@ -32645,7 +33214,7 @@ function modelsForProvider(_provider) {
32645
33214
  }
32646
33215
  async function promptSection(prompt, section) {
32647
33216
  const claude = section;
32648
- const result = await promptForSimpleModels(prompt, claude, modelsForProvider());
33217
+ const result = await promptForSimpleModels(prompt, claude, modelsForProvider(), "claude", defaultSection(), SESSION_ONLY_MODELS);
32649
33218
  const { disabled } = await prompt.prompt([{
32650
33219
  type: "checkbox",
32651
33220
  name: "disabled",
@@ -32685,13 +33254,15 @@ function mergeHarnessConfig(section, basePath) {
32685
33254
  const settingsPath = join7(claudeDir, "settings.json");
32686
33255
  const existing = readExistingSettings(settingsPath);
32687
33256
  const isNew = Object.keys(existing).length === 0;
33257
+ removeStaleSonnetEffort(existing, config.default_model);
32688
33258
  const settings = {
32689
33259
  ...existing,
32690
33260
  $schema: "https://json.schemastore.org/claude-code-settings.json",
32691
33261
  ...CLAUDE_AI_OPT_OUTS,
32692
33262
  model: config.default_model || DEFAULT_MODELS.default_model
32693
33263
  };
32694
- applyModeThinking(settings, config);
33264
+ applySessionThinking(settings, config);
33265
+ removeLegacyAutoCompactWindow(settings);
32695
33266
  applyBuiltins(settings, CONFLICTING_BUILTINS);
32696
33267
  for (const name of CLAUDE_OPTIONAL_BUILTINS) {
32697
33268
  if (config.disabled_builtins?.includes(name))
@@ -32750,40 +33321,62 @@ function removeAtelierSettings(claudeDir, config) {
32750
33321
  return;
32751
33322
  }
32752
33323
  const content = parseSettingsJson(settingsPath);
33324
+ removeStaleSonnetEffort(content, config.default_model);
32753
33325
  delete content.$schema;
32754
33326
  delete content.model;
32755
33327
  for (const [key, value] of Object.entries(CLAUDE_AI_OPT_OUTS)) {
32756
33328
  if (content[key] === value)
32757
33329
  delete content[key];
32758
33330
  }
32759
- applyModeThinking(content, config, true);
33331
+ applySessionThinking(content, config, true);
33332
+ removeLegacyAutoCompactWindow(content);
32760
33333
  removeBuiltins(content, CONFLICTING_BUILTINS);
32761
33334
  for (const patch of Object.values(OPTIONAL_BUILTINS))
32762
33335
  removeBuiltins(content, patch);
32763
33336
  writeOrDeleteSettings(settingsPath, content);
32764
33337
  }
32765
- function applyModeThinking(settings, config, remove = false) {
32766
- const models = claudeModeModels(config.default_model);
33338
+ function editModelSettings(settings, models, edit) {
32767
33339
  const modelSettings = { ...settings.modelSettings };
32768
- for (const mode of ["build", "plan"]) {
32769
- const thinking = config[`${mode}_thinking`];
32770
- if (thinking === undefined)
32771
- continue;
32772
- const entry = { ...modelSettings[models[mode]] };
32773
- if (remove || thinking === "default")
32774
- delete entry.effortLevel;
32775
- else
32776
- entry.effortLevel = thinking;
33340
+ for (const model of models) {
33341
+ const entry = { ...modelSettings[model] };
33342
+ edit(entry);
32777
33343
  if (Object.keys(entry).length)
32778
- modelSettings[models[mode]] = entry;
33344
+ modelSettings[model] = entry;
32779
33345
  else
32780
- delete modelSettings[models[mode]];
33346
+ delete modelSettings[model];
32781
33347
  }
32782
33348
  if (Object.keys(modelSettings).length)
32783
33349
  settings.modelSettings = modelSettings;
32784
33350
  else
32785
33351
  delete settings.modelSettings;
32786
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
+ }
32787
33380
  function applyBuiltins(settings, patch) {
32788
33381
  Object.assign(settings, patch.settings);
32789
33382
  if (patch.env)
@@ -32891,83 +33484,152 @@ var OPENCODE_PROVIDERS2 = [
32891
33484
  { name: "OpenCode Zen", value: "opencode-zen" },
32892
33485
  { name: "OpenCode Go", value: "opencode-go" },
32893
33486
  { name: "Amazon Bedrock", value: "amazon-bedrock" },
32894
- { name: "OpenAI", value: "openai" }
33487
+ { name: "OpenAI", value: "openai" },
33488
+ { name: "OpenRouter", value: "openrouter" },
33489
+ { name: "Google Gemini", value: "google" }
32895
33490
  ];
32896
33491
  var PROVIDER_MODELS = {
32897
33492
  "opencode-zen": [
33493
+ "gpt-6.1-sol",
32898
33494
  "gpt-6-astra",
32899
33495
  "gpt-6-sol",
32900
33496
  "gpt-6-luna",
32901
33497
  "claude-opus-5-5",
32902
33498
  "claude-fable-5-1",
32903
33499
  "claude-sonnet-5-5",
32904
- "claude-haiku-4-5",
33500
+ "claude-haiku-5-5",
32905
33501
  "glm-5.3",
32906
33502
  "glm-5.3-flash",
32907
33503
  "kimi-k3",
32908
- "kimi-k2.7-code",
32909
33504
  "deepseek-v4.1-flash",
32910
33505
  "deepseek-v4-pro",
32911
33506
  "minimax-m3",
32912
33507
  "qwen3.8-max",
32913
33508
  "qwen3.8-flash",
32914
33509
  "mimo-v2.6-flash-free",
33510
+ "gemini-4-argon",
32915
33511
  "gemini-3.8-flash",
32916
- "gemini-3.1-pro"
33512
+ "grok-4.7",
33513
+ "mistral-large-4",
33514
+ "muse-spark-1.3",
33515
+ "muse-wonder-1.0",
33516
+ "inkling-2-small-free",
33517
+ "nemotron-3.5-super-vl-free",
33518
+ "nemotron-3.5-lightning-free",
33519
+ "beam-free"
32917
33520
  ].map((id) => `opencode/${id}`),
32918
33521
  "opencode-go": [
32919
33522
  "glm-5.3",
32920
33523
  "glm-5.3-flash",
33524
+ "kimi-k3.1-pro",
32921
33525
  "kimi-k3",
32922
33526
  "deepseek-v4.1-flash",
32923
33527
  "deepseek-v4-pro",
33528
+ "minimax-m3.1-flash",
32924
33529
  "minimax-m3",
32925
33530
  "qwen3.8-max",
32926
33531
  "qwen3.8-flash",
32927
33532
  "mimo-v2.6-pro",
32928
33533
  "mimo-v2.6-flash",
32929
- "gpt-6-luna"
33534
+ "gpt-6-luna",
33535
+ "claude-haiku-5-5",
33536
+ "gemini-4-argon",
33537
+ "grok-4.7",
33538
+ "muse-spark-1.3-contributor",
33539
+ "hy4",
33540
+ "step-5-preview",
33541
+ "beam-free"
32930
33542
  ].map((id) => `opencode-go/${id}`),
32931
33543
  "amazon-bedrock": [
32932
33544
  "us.anthropic.claude-opus-5-5",
32933
33545
  "us.anthropic.claude-fable-5-1",
32934
33546
  "us.anthropic.claude-sonnet-5-5",
32935
- "us.anthropic.claude-haiku-4-5-20251001-v1:0"
33547
+ "us.anthropic.claude-haiku-5-5"
32936
33548
  ].map((id) => `amazon-bedrock/${id}`),
32937
- openai: ["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}`),
33550
+ openrouter: [
33551
+ "anthropic/claude-opus-5.5",
33552
+ "anthropic/claude-fable-5.1",
33553
+ "anthropic/claude-sonnet-5.5",
33554
+ "anthropic/claude-haiku-5.5",
33555
+ "openai/gpt-6.1-sol",
33556
+ "openai/gpt-6.1-terra",
33557
+ "openai/gpt-6-astra",
33558
+ "openai/gpt-6-sol",
33559
+ "openai/gpt-6-luna",
33560
+ "google/gemini-4-argon",
33561
+ "google/gemini-3.8-flash",
33562
+ "z-ai/glm-5.3",
33563
+ "z-ai/glm-5.3-flash",
33564
+ "moonshotai/kimi-k3.1-pro",
33565
+ "moonshotai/kimi-k3",
33566
+ "deepseek/deepseek-v4.1-flash-1017",
33567
+ "deepseek/deepseek-v4.1-flash",
33568
+ "deepseek/deepseek-v4-pro",
33569
+ "x-ai/grok-4.7",
33570
+ "minimax/minimax-m3.1-flash",
33571
+ "minimax/minimax-m3",
33572
+ "qwen/qwen3.8-flash",
33573
+ "qwen/qwen3.8-max-0902",
33574
+ "qwen/qwen3.8-max-prime",
33575
+ "xiaomi/mimo-v2.6-pro",
33576
+ "mistralai/mistral-large-4-0",
33577
+ "thinkingmachines/inkling",
33578
+ "thinkingmachines/inkling-small",
33579
+ "nvidia/nemotron-3.5-super-vl",
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",
33585
+ "meta/muse-spark-1.3",
33586
+ "meta/muse-spark-open",
33587
+ "meta/muse-wonder"
33588
+ ].map((id) => `openrouter/${id}`),
33589
+ google: ["gemini-4-argon", "gemini-3.8-flash", "gemini-3.5-flash-lite"].map((id) => `google/${id}`)
32938
33590
  };
32939
33591
  var DEFAULT_MODELS2 = {
32940
33592
  "opencode-zen": {
32941
33593
  sentinel: "opencode/glm-5.3-flash",
32942
33594
  oracle: "opencode/kimi-k3",
32943
33595
  architect: "opencode/glm-5.3",
32944
- keymaker: "opencode/glm-5.3-flash",
32945
- build: "opencode/deepseek-v4.1-flash",
32946
- plan: "opencode/glm-5.3"
33596
+ keymaker: "opencode/deepseek-v4.1-flash",
33597
+ default: "opencode/kimi-k3"
32947
33598
  },
32948
33599
  "opencode-go": {
32949
33600
  sentinel: "opencode-go/glm-5.3-flash",
32950
33601
  oracle: "opencode-go/mimo-v2.6-pro",
32951
33602
  architect: "opencode-go/glm-5.3",
32952
- keymaker: "opencode-go/glm-5.3-flash",
32953
- build: "opencode-go/deepseek-v4.1-flash",
32954
- plan: "opencode-go/glm-5.3"
33603
+ keymaker: "opencode-go/deepseek-v4.1-flash",
33604
+ default: "opencode-go/kimi-k3.1-pro"
32955
33605
  },
32956
33606
  "amazon-bedrock": {
32957
- sentinel: "amazon-bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0",
33607
+ sentinel: "amazon-bedrock/us.anthropic.claude-haiku-5-5",
32958
33608
  oracle: "amazon-bedrock/us.anthropic.claude-fable-5-1",
32959
33609
  architect: "amazon-bedrock/us.anthropic.claude-opus-5-5",
32960
- keymaker: "amazon-bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0",
32961
- build: "amazon-bedrock/us.anthropic.claude-sonnet-5-5",
32962
- plan: "amazon-bedrock/us.anthropic.claude-opus-5-5"
33610
+ keymaker: "amazon-bedrock/us.anthropic.claude-sonnet-5-5",
33611
+ default: "amazon-bedrock/us.anthropic.claude-opus-5-5"
32963
33612
  },
32964
33613
  openai: {
32965
33614
  sentinel: "openai/gpt-6-luna",
32966
33615
  oracle: "openai/gpt-6-astra",
32967
33616
  architect: "openai/gpt-6-astra",
32968
- keymaker: "openai/gpt-6-luna",
32969
- build: "openai/gpt-6-sol",
32970
- plan: "openai/gpt-6-astra"
33617
+ keymaker: "openai/gpt-6-sol",
33618
+ default: "openai/gpt-6-astra"
33619
+ },
33620
+ openrouter: {
33621
+ sentinel: "openrouter/z-ai/glm-5.3-flash",
33622
+ oracle: "openrouter/moonshotai/kimi-k3.1-pro",
33623
+ architect: "openrouter/z-ai/glm-5.3",
33624
+ keymaker: "openrouter/deepseek/deepseek-v4.1-flash-1017",
33625
+ default: "openrouter/moonshotai/kimi-k3.1-pro"
33626
+ },
33627
+ google: {
33628
+ sentinel: "google/gemini-3.5-flash-lite",
33629
+ oracle: "google/gemini-4-argon",
33630
+ architect: "google/gemini-4-argon",
33631
+ keymaker: "google/gemini-3.8-flash",
33632
+ default: "google/gemini-4-argon"
32971
33633
  }
32972
33634
  };
32973
33635
  var COMMAND_MARKER = "<!-- Generated by Atelier -->";
@@ -32988,15 +33650,14 @@ function defaultSection2(provider) {
32988
33650
  const defaults = DEFAULT_MODELS2[selectedProvider];
32989
33651
  return {
32990
33652
  provider: selectedProvider,
32991
- build_model: defaults.build,
32992
- plan_model: defaults.plan,
32993
- build_thinking: "high",
32994
- 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"),
32995
33656
  agents: AGENT_NAMES.map((name) => ({
32996
33657
  template: name,
32997
33658
  name,
32998
33659
  model: defaults[name],
32999
- thinking: name === "sentinel" || name === "keymaker" ? selectedProvider === "amazon-bedrock" ? "default" : "low" : name === "oracle" && selectedProvider === "opencode-go" ? "on" : name === "architect" && selectedProvider === "openai" ? "xhigh" : "high"
33660
+ thinking: defaultThinking(defaults[name], name)
33000
33661
  }))
33001
33662
  };
33002
33663
  }
@@ -33008,7 +33669,7 @@ async function promptSection2(prompt, section) {
33008
33669
  const openCodeSection = section;
33009
33670
  const provider = guardProvider(await promptForOpenCodeProvider(prompt, OPENCODE_PROVIDERS2, openCodeSection.provider));
33010
33671
  const models = modelsForProvider2(provider);
33011
- 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));
33012
33673
  }
33013
33674
  function installAgents2(section, basePath, sharedConfig) {
33014
33675
  const config = OpenCodeConfigSchema.parse(section);
@@ -33082,26 +33743,37 @@ function mergeHarnessConfig2(section, basePath) {
33082
33743
  } catch (err) {
33083
33744
  throw new FileWriteError(basePath, err instanceof Error ? err.message : String(err));
33084
33745
  }
33085
- const sentinel = config.agents.find((a) => a.name === "sentinel");
33086
- const architect = config.agents.find((a) => a.name === "architect");
33087
33746
  const existingAgents = existing.agent;
33088
- for (const mode of ["build", "plan"]) {
33089
- if (config[`${mode}_thinking`] === undefined || !existingAgents?.[mode])
33090
- continue;
33747
+ if (config.build_thinking !== undefined && existingAgents?.build) {
33091
33748
  for (const key of OPENCODE_THINKING_KEYS)
33092
- delete existingAgents[mode][key];
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) {
33760
+ for (const key of OPENCODE_THINKING_KEYS)
33761
+ delete existingAgents.plan[key];
33093
33762
  }
33094
33763
  const atelierFields = {
33764
+ model: config.default_model,
33095
33765
  agent: {
33096
33766
  build: {
33097
33767
  mode: "primary",
33098
- model: config.build_model || sentinel?.model || DEFAULT_MODELS2[config.provider].build,
33099
- ...openCodeThinkingOptions(config.build_model, config.build_thinking)
33768
+ model: config.default_model,
33769
+ ...openCodeThinkingOptions(config.default_model, config.build_thinking)
33100
33770
  },
33101
- plan: {
33102
- mode: "primary",
33103
- model: config.plan_model || architect?.model || DEFAULT_MODELS2[config.provider].plan,
33104
- ...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
+ }
33105
33777
  }
33106
33778
  }
33107
33779
  };
@@ -33114,6 +33786,18 @@ function mergeHarnessConfig2(section, basePath) {
33114
33786
  }
33115
33787
  };
33116
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
+ }
33117
33801
  const merged = deepMerge2(existing, atelierFields);
33118
33802
  try {
33119
33803
  writeFileSync4(opencodeJsonPath, JSON.stringify(merged, null, 2) + `
@@ -33262,7 +33946,7 @@ function writeOrDeleteOpenCodeJson(basePath, config) {
33262
33946
  if (!existsSync4(opencodeJsonPath)) {
33263
33947
  return;
33264
33948
  }
33265
- const content = stripOpenCodeConfig(readExistingOpenCodeJson(opencodeJsonPath), config.provider);
33949
+ const content = stripOpenCodeConfig(readExistingOpenCodeJson(opencodeJsonPath), config.provider, config.default_model);
33266
33950
  try {
33267
33951
  if (Object.keys(content).length === 0) {
33268
33952
  rmSync3(opencodeJsonPath, { force: true });
@@ -33285,17 +33969,28 @@ function readExistingOpenCodeJson(opencodeJsonPath) {
33285
33969
  throw new HarnessConfigError(opencodeJsonPath, err instanceof Error ? err.message : String(err));
33286
33970
  }
33287
33971
  }
33288
- 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;
33289
33990
  if (content.agent && typeof content.agent === "object" && !Array.isArray(content.agent)) {
33290
33991
  const agent = content.agent;
33291
33992
  for (const mode of ["build", "plan"]) {
33292
- const entry = agent[mode];
33293
- if (!entry || typeof entry !== "object" || Array.isArray(entry))
33294
- continue;
33295
- for (const key of ["mode", "model", ...OPENCODE_THINKING_KEYS])
33296
- delete entry[key];
33297
- if (!Object.keys(entry).length)
33298
- delete agent[mode];
33993
+ stripModeEntry(agent, mode);
33299
33994
  }
33300
33995
  if (Object.keys(agent).length === 0) {
33301
33996
  delete content.agent;
@@ -33316,8 +34011,26 @@ function stripOpenCodeConfig(content, provider) {
33316
34011
  delete content.provider;
33317
34012
  }
33318
34013
  }
34014
+ removeWarming(content);
33319
34015
  return content;
33320
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
+ }
33321
34034
  function getOpencodeRoot(basePath) {
33322
34035
  return basePath === getGlobalOpencodeDir() ? basePath : join8(basePath, ".opencode");
33323
34036
  }
@@ -33337,126 +34050,6 @@ function deepMerge2(target, source) {
33337
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";
33338
34051
  import { join as join9 } from "path";
33339
34052
 
33340
- // node_modules/smol-toml/dist/date.js
33341
- /*!
33342
- * Copyright (c) Squirrel Chat et al., All rights reserved.
33343
- * SPDX-License-Identifier: BSD-3-Clause
33344
- *
33345
- * Redistribution and use in source and binary forms, with or without
33346
- * modification, are permitted provided that the following conditions are met:
33347
- *
33348
- * 1. Redistributions of source code must retain the above copyright notice, this
33349
- * list of conditions and the following disclaimer.
33350
- * 2. Redistributions in binary form must reproduce the above copyright notice,
33351
- * this list of conditions and the following disclaimer in the
33352
- * documentation and/or other materials provided with the distribution.
33353
- * 3. Neither the name of the copyright holder nor the names of its contributors
33354
- * may be used to endorse or promote products derived from this software without
33355
- * specific prior written permission.
33356
- *
33357
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33358
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33359
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33360
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33361
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33362
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33363
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33364
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33365
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33366
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33367
- */
33368
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
33369
-
33370
- class TomlDate extends Date {
33371
- #hasDate = false;
33372
- #hasTime = false;
33373
- #offset = null;
33374
- constructor(date) {
33375
- let hasDate = true;
33376
- let hasTime = true;
33377
- let offset = "Z";
33378
- if (typeof date === "string") {
33379
- let match = date.match(DATE_TIME_RE);
33380
- if (match) {
33381
- if (!match[1]) {
33382
- hasDate = false;
33383
- date = `0000-01-01T${date}`;
33384
- }
33385
- hasTime = !!match[2];
33386
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
33387
- if (match[2] && +match[2] > 23) {
33388
- date = "";
33389
- } else {
33390
- offset = match[3] || null;
33391
- date = date.toUpperCase();
33392
- if (!offset && hasTime)
33393
- date += "Z";
33394
- }
33395
- } else {
33396
- date = "";
33397
- }
33398
- }
33399
- super(date);
33400
- if (!isNaN(this.getTime())) {
33401
- this.#hasDate = hasDate;
33402
- this.#hasTime = hasTime;
33403
- this.#offset = offset;
33404
- }
33405
- }
33406
- isDateTime() {
33407
- return this.#hasDate && this.#hasTime;
33408
- }
33409
- isLocal() {
33410
- return !this.#hasDate || !this.#hasTime || !this.#offset;
33411
- }
33412
- isDate() {
33413
- return this.#hasDate && !this.#hasTime;
33414
- }
33415
- isTime() {
33416
- return this.#hasTime && !this.#hasDate;
33417
- }
33418
- isValid() {
33419
- return this.#hasDate || this.#hasTime;
33420
- }
33421
- toISOString() {
33422
- let iso = super.toISOString();
33423
- if (this.isDate())
33424
- return iso.slice(0, 10);
33425
- if (this.isTime())
33426
- return iso.slice(11, 23);
33427
- if (this.#offset === null)
33428
- return iso.slice(0, -1);
33429
- if (this.#offset === "Z")
33430
- return iso;
33431
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
33432
- offset = this.#offset[0] === "-" ? offset : -offset;
33433
- let offsetDate = new Date(this.getTime() - offset * 60000);
33434
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
33435
- }
33436
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
33437
- let date = new TomlDate(jsDate);
33438
- date.#offset = offset;
33439
- return date;
33440
- }
33441
- static wrapAsLocalDateTime(jsDate) {
33442
- let date = new TomlDate(jsDate);
33443
- date.#offset = null;
33444
- return date;
33445
- }
33446
- static wrapAsLocalDate(jsDate) {
33447
- let date = new TomlDate(jsDate);
33448
- date.#hasTime = false;
33449
- date.#offset = null;
33450
- return date;
33451
- }
33452
- static wrapAsLocalTime(jsDate) {
33453
- let date = new TomlDate(jsDate);
33454
- date.#hasDate = false;
33455
- date.#offset = null;
33456
- return date;
33457
- }
33458
- }
33459
-
33460
34053
  // node_modules/smol-toml/dist/error.js
33461
34054
  /*!
33462
34055
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -33486,11 +34079,11 @@ class TomlDate extends Date {
33486
34079
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33487
34080
  */
33488
34081
  function getLineColFromPtr(string, ptr) {
33489
- let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
34082
+ let lines = string.slice(0, ptr).split(/\r?\n/);
33490
34083
  return [lines.length, lines.pop().length + 1];
33491
34084
  }
33492
34085
  function makeCodeBlock(string, line, column) {
33493
- let lines = string.split(/\r\n|\n|\r/g);
34086
+ let lines = string.split(/\r?\n/);
33494
34087
  let codeblock = "";
33495
34088
  let numberLen = (Math.log10(line + 1) | 0) + 1;
33496
34089
  for (let i = line - 1;i <= line + 1; i++) {
@@ -33525,6 +34118,9 @@ ${codeblock}`, options2);
33525
34118
  this.column = column;
33526
34119
  this.codeblock = codeblock;
33527
34120
  }
34121
+ static x(message, ctx, ptr) {
34122
+ throw new TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
34123
+ }
33528
34124
  }
33529
34125
 
33530
34126
  // node_modules/smol-toml/dist/primitive.js
@@ -33555,159 +34151,99 @@ ${codeblock}`, options2);
33555
34151
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33556
34152
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33557
34153
  */
33558
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
33559
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
33560
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
33561
- function parseString(str2, ptr) {
33562
- let c = str2[ptr++];
34154
+ function parseString(ctx) {
34155
+ let startPtr = ctx.p;
34156
+ let c = ctx.s.charCodeAt(ctx.p++);
33563
34157
  let first = c;
33564
- let isLiteral = c === "'";
33565
- 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);
33566
34160
  if (isMultiline) {
33567
- if (str2[ptr += 2] === `
33568
- `)
33569
- ptr++;
33570
- else if (str2[ptr] === "\r" && str2[ptr + 1] === `
33571
- `)
33572
- 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;
33573
34165
  }
33574
34166
  let parsed = "";
33575
- let sliceStart = ptr;
34167
+ let sliceStart = ctx.p;
33576
34168
  let state = 0;
33577
- for (let i = ptr;i < str2.length; i++) {
33578
- c = str2[i];
33579
- if (isMultiline && (c === `
33580
- ` || c === "\r" && str2[i + 1] === `
33581
- `)) {
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)) {
33582
34172
  state = state && 3;
33583
- } else if (c < " " && c !== "\t" || c === "\x7F") {
33584
- throw new TomlError("control characters are not allowed in strings", {
33585
- toml: str2,
33586
- ptr: i
33587
- });
33588
- } 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)) {
33589
34176
  if (isMultiline) {
33590
- if (str2[i + 3] === first)
33591
- i++;
33592
- if (str2[i + 3] === first)
33593
- 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++;
33594
34181
  }
33595
- return [
33596
- state ? parsed : parsed + str2.slice(sliceStart, i),
33597
- i + (isMultiline ? 3 : 1)
33598
- ];
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;
33599
34188
  } else if (!state) {
33600
- if (!isLiteral && c === "\\") {
33601
- parsed += str2.slice(sliceStart, sliceStart = i);
34189
+ if (!isLiteral && c === 92) {
34190
+ parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
33602
34191
  state = 1;
33603
34192
  }
33604
34193
  } else if (state === 1) {
33605
- if (c === "x" || c === "u" || c === "U") {
34194
+ if (c === 120 || c === 117 || c === 85) {
34195
+ let errPtr = ctx.p++ - 1;
33606
34196
  let value = 0;
33607
- let len = c === "x" ? 2 : c === "u" ? 4 : 8;
33608
- for (let j = 0;j < len; j++, i++) {
33609
- 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);
33610
34200
  let digit = hex >= 48 && hex <= 57 ? hex - 48 : hex >= 65 && hex <= 70 ? hex - 65 + 10 : hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1;
33611
34201
  if (digit < 0)
33612
- 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);
33613
34203
  value = value << 4 | digit;
33614
34204
  }
33615
34205
  if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
33616
- throw new TomlError("invalid unicode escape", { toml: str2, ptr: i });
34206
+ TomlError.x("invalid unicode escape", ctx, errPtr);
33617
34207
  }
33618
34208
  parsed += String.fromCodePoint(value);
33619
- sliceStart = i + 1;
34209
+ sliceStart = ctx.p--;
33620
34210
  state = 0;
33621
- } else if (c === " " || c === "\t") {
34211
+ } else if (isMultiline && (c === 32 || c === 9)) {
33622
34212
  state = 2;
33623
34213
  } else {
33624
- if (c === "b")
34214
+ if (c === 98)
33625
34215
  parsed += "\b";
33626
- else if (c === "t")
34216
+ else if (c === 116)
33627
34217
  parsed += "\t";
33628
- else if (c === "n")
34218
+ else if (c === 110)
33629
34219
  parsed += `
33630
34220
  `;
33631
- else if (c === "f")
34221
+ else if (c === 102)
33632
34222
  parsed += "\f";
33633
- else if (c === "r")
34223
+ else if (c === 114)
33634
34224
  parsed += "\r";
33635
- else if (c === "e")
34225
+ else if (c === 101)
33636
34226
  parsed += "\x1B";
33637
- else if (c === '"')
34227
+ else if (c === 34)
33638
34228
  parsed += '"';
33639
- else if (c === "\\")
34229
+ else if (c === 92)
33640
34230
  parsed += "\\";
33641
34231
  else
33642
- throw new TomlError("unrecognized escape sequence", { toml: str2, ptr: i });
33643
- sliceStart = i + 1;
34232
+ TomlError.x("unrecognised escape sequence", ctx);
34233
+ sliceStart = ctx.p + 1;
33644
34234
  state = 0;
33645
34235
  }
33646
- } else if (c !== " " && c !== "\t") {
33647
- if (state === 2) {
33648
- throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
33649
- toml: str2,
33650
- ptr: sliceStart
33651
- });
33652
- }
33653
- state = !isLiteral && c === "\\" ? 1 : 0;
33654
- sliceStart = i;
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;
33655
34241
  }
33656
34242
  }
33657
- throw new TomlError("unfinished string", { toml: str2, ptr });
33658
- }
33659
- function parseValue(value, toml, ptr, integersAsBigInt) {
33660
- if (value === "true")
33661
- return true;
33662
- if (value === "false")
33663
- return false;
33664
- if (value === "-inf")
33665
- return -Infinity;
33666
- if (value === "inf" || value === "+inf")
33667
- return Infinity;
33668
- if (value === "nan" || value === "+nan" || value === "-nan")
33669
- return NaN;
33670
- if (value === "-0")
33671
- return integersAsBigInt ? 0n : 0;
33672
- let isInt = INT_REGEX.test(value);
33673
- if (isInt || FLOAT_REGEX.test(value)) {
33674
- if (LEADING_ZERO.test(value)) {
33675
- throw new TomlError("leading zeroes are not allowed", {
33676
- toml,
33677
- ptr
33678
- });
33679
- }
33680
- value = value.replace(/_/g, "");
33681
- let numeric = +value;
33682
- if (isNaN(numeric)) {
33683
- throw new TomlError("invalid number", {
33684
- toml,
33685
- ptr
33686
- });
33687
- }
33688
- if (isInt) {
33689
- if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
33690
- throw new TomlError("integer value cannot be represented losslessly", {
33691
- toml,
33692
- ptr
33693
- });
33694
- }
33695
- if (isInt || integersAsBigInt === true)
33696
- numeric = BigInt(value);
33697
- }
33698
- return numeric;
33699
- }
33700
- const date = new TomlDate(value);
33701
- if (!date.isValid()) {
33702
- throw new TomlError("invalid value", {
33703
- toml,
33704
- ptr
33705
- });
33706
- }
33707
- return date;
34243
+ TomlError.x("unfinished string", ctx, startPtr);
33708
34244
  }
33709
34245
 
33710
- // node_modules/smol-toml/dist/util.js
34246
+ // node_modules/smol-toml/dist/date.js
33711
34247
  /*!
33712
34248
  * Copyright (c) Squirrel Chat et al., All rights reserved.
33713
34249
  * SPDX-License-Identifier: BSD-3-Clause
@@ -33735,65 +34271,119 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
33735
34271
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33736
34272
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33737
34273
  */
33738
- function indexOfNewline(str2, start = 0, end = str2.length) {
33739
- let idx = str2.indexOf(`
33740
- `, start);
33741
- if (str2[idx - 1] === "\r")
33742
- idx--;
33743
- return idx <= end ? idx : -1;
33744
- }
33745
- function skipComment(str2, ptr) {
33746
- for (let i = ptr;i < str2.length; i++) {
33747
- let c = str2[i];
33748
- if (c === `
33749
- `)
33750
- return i;
33751
- if (c === "\r" && str2[i + 1] === `
33752
- `)
33753
- return i + 1;
33754
- if (c < " " && c !== "\t" || c === "\x7F") {
33755
- throw new TomlError("control characters are not allowed in comments", {
33756
- toml: str2,
33757
- ptr
33758
- });
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;
33759
34333
  }
33760
34334
  }
33761
- return str2.length;
33762
- }
33763
- function skipVoid(str2, ptr, banNewLines, banComments) {
33764
- let c;
33765
- while (true) {
33766
- while ((c = str2[ptr]) === " " || c === "\t" || !banNewLines && (c === `
33767
- ` || c === "\r" && str2[ptr + 1] === `
33768
- `))
33769
- ptr++;
33770
- if (banComments || c !== "#")
33771
- break;
33772
- ptr = skipComment(str2, ptr);
33773
- }
33774
- return ptr;
33775
- }
33776
- function skipUntil(str2, ptr, sep, end, banNewLines = false) {
33777
- if (!end) {
33778
- ptr = indexOfNewline(str2, ptr);
33779
- return ptr < 0 ? str2.length : ptr;
33780
- }
33781
- for (let i = ptr;i < str2.length; i++) {
33782
- let c = str2[i];
33783
- if (c === "#") {
33784
- i = indexOfNewline(str2, i);
33785
- } else if (c === sep) {
33786
- return i + 1;
33787
- } else if (c === end || banNewLines && (c === `
33788
- ` || c === "\r" && str2[i + 1] === `
33789
- `)) {
33790
- return i;
33791
- }
33792
- }
33793
- throw new TomlError("cannot find end of structure", {
33794
- toml: str2,
33795
- ptr
33796
- });
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
+ }
33797
34387
  }
33798
34388
 
33799
34389
  // node_modules/smol-toml/dist/extract.js
@@ -33824,71 +34414,263 @@ function skipUntil(str2, ptr, sep, end, banNewLines = false) {
33824
34414
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33825
34415
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33826
34416
  */
33827
- function sliceAndTrimEndOf(str2, startPtr, endPtr) {
33828
- let value = str2.slice(startPtr, endPtr);
33829
- let commentIdx = value.indexOf("#");
33830
- if (commentIdx > -1) {
33831
- skipComment(str2, commentIdx);
33832
- 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;
34439
+ }
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);
33833
34447
  }
33834
- return [value.trimEnd(), commentIdx];
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);
33835
34455
  }
33836
- function extractValue(str2, ptr, end, depth, integersAsBigInt) {
33837
- if (depth === 0) {
33838
- throw new TomlError("document contains excessively nested structures. aborting.", {
33839
- toml: str2,
33840
- ptr
33841
- });
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;
33842
34604
  }
33843
- let c = str2[ptr];
33844
- if (c === "[" || c === "{") {
33845
- let [value, endPtr] = c === "[" ? parseArray(str2, ptr, depth, integersAsBigInt) : parseInlineTable(str2, ptr, depth, integersAsBigInt);
33846
- if (end) {
33847
- endPtr = skipVoid(str2, endPtr);
33848
- if (str2[endPtr] === ",")
33849
- endPtr++;
33850
- else if (str2[endPtr] !== end) {
33851
- throw new TomlError("expected comma or end of structure", {
33852
- toml: str2,
33853
- ptr: endPtr
33854
- });
33855
- }
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);
33856
34617
  }
33857
- return [value, endPtr];
34618
+ } catch (e) {
34619
+ TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
33858
34620
  }
33859
- if (c === '"' || c === "'") {
33860
- let [parsed, endPtr] = parseString(str2, ptr);
33861
- if (end) {
33862
- endPtr = skipVoid(str2, endPtr);
33863
- if (str2[endPtr] && str2[endPtr] !== "," && str2[endPtr] !== end && str2[endPtr] !== `
33864
- ` && str2[endPtr] !== "\r") {
33865
- throw new TomlError("unexpected character encountered", {
33866
- toml: str2,
33867
- ptr: endPtr
33868
- });
33869
- }
33870
- if (str2[endPtr] === ",")
33871
- 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);
33872
34662
  }
33873
- return [parsed, endPtr];
33874
- }
33875
- let endPtr = skipUntil(str2, ptr, ",", end);
33876
- let slice = sliceAndTrimEndOf(str2, ptr, endPtr - (str2[endPtr - 1] === "," ? 1 : 0));
33877
- if (!slice[0]) {
33878
- throw new TomlError("incomplete key-value declaration: no value specified", {
33879
- toml: str2,
33880
- ptr
33881
- });
33882
34663
  }
33883
- if (end && slice[1] > -1) {
33884
- endPtr = skipVoid(str2, ptr + slice[1]);
33885
- if (str2[endPtr] === ",")
33886
- 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);
33887
34673
  }
33888
- return [
33889
- parseValue(slice[0], str2, ptr, integersAsBigInt),
33890
- endPtr
33891
- ];
33892
34674
  }
33893
34675
 
33894
34676
  // node_modules/smol-toml/dist/struct.js
@@ -33919,147 +34701,112 @@ function extractValue(str2, ptr, end, depth, integersAsBigInt) {
33919
34701
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33920
34702
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33921
34703
  */
33922
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
33923
- function parseKey(str2, ptr, end = "=") {
33924
- let dot = ptr - 1;
34704
+ function parseKey(ctx, end = 61) {
34705
+ let startPtr;
34706
+ let state = 0;
33925
34707
  let parsed = [];
33926
- let endPtr = str2.indexOf(end, ptr);
33927
- if (endPtr < 0) {
33928
- throw new TomlError("incomplete key-value: cannot find end of key", {
33929
- toml: str2,
33930
- ptr
33931
- });
33932
- }
34708
+ let sliceStart;
34709
+ let c = ctx.s.charCodeAt(startPtr = ctx.p);
33933
34710
  do {
33934
- let c = str2[ptr = ++dot];
33935
- if (c !== " " && c !== "\t") {
33936
- if (c === '"' || c === "'") {
33937
- if (c === str2[ptr + 1] && c === str2[ptr + 2]) {
33938
- throw new TomlError("multiline strings are not allowed in keys", {
33939
- toml: str2,
33940
- ptr
33941
- });
33942
- }
33943
- let [part, eos] = parseString(str2, ptr);
33944
- dot = str2.indexOf(".", eos);
33945
- let strEnd = str2.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
33946
- let newLine = indexOfNewline(strEnd);
33947
- if (newLine > -1) {
33948
- throw new TomlError("newlines are not allowed in keys", {
33949
- toml: str2,
33950
- ptr: ptr + dot + newLine
33951
- });
33952
- }
33953
- if (strEnd.trimStart()) {
33954
- throw new TomlError("found extra tokens after the string part", {
33955
- toml: str2,
33956
- ptr: eos
33957
- });
33958
- }
33959
- if (endPtr < eos) {
33960
- endPtr = str2.indexOf(end, eos);
33961
- if (endPtr < 0) {
33962
- throw new TomlError("incomplete key-value: cannot find end of key", {
33963
- toml: str2,
33964
- ptr
33965
- });
33966
- }
33967
- }
33968
- parsed.push(part);
33969
- } else {
33970
- dot = str2.indexOf(".", ptr);
33971
- let part = str2.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
33972
- if (!KEY_PART_RE.test(part)) {
33973
- throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
33974
- toml: str2,
33975
- ptr
33976
- });
33977
- }
33978
- 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;
33979
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;
33980
34739
  }
33981
- } while (dot + 1 && dot < endPtr);
33982
- 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);
33983
34742
  }
33984
- function parseInlineTable(str2, ptr, depth, integersAsBigInt) {
33985
- let res = {};
34743
+ function parseInlineTable(ctx) {
34744
+ let startPtr = ctx.p++;
34745
+ let res = Object.create(null);
33986
34746
  let seen = new Set;
33987
34747
  let c;
33988
- ptr++;
33989
- while ((c = str2[ptr++]) !== "}" && c) {
33990
- if (c === ",") {
33991
- throw new TomlError("expected value, found comma", {
33992
- toml: str2,
33993
- ptr: ptr - 1
33994
- });
33995
- } else if (c === "#")
33996
- ptr = skipComment(str2, ptr);
33997
- else if (c !== " " && c !== "\t" && c !== `
33998
- ` && c !== "\r") {
33999
- let k;
34000
- let t = res;
34001
- let hasOwn = false;
34002
- let [key, keyEndPtr] = parseKey(str2, ptr - 1);
34003
- for (let i = 0;i < key.length; i++) {
34004
- if (i)
34005
- t = hasOwn ? t[k] : t[k] = {};
34006
- k = key[i];
34007
- if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
34008
- throw new TomlError("trying to redefine an already defined value", {
34009
- toml: str2,
34010
- ptr
34011
- });
34012
- }
34013
- if (!hasOwn && k === "__proto__") {
34014
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
34015
- }
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;
34016
34770
  }
34017
- if (hasOwn) {
34018
- throw new TomlError("trying to redefine an already defined value", {
34019
- toml: str2,
34020
- ptr
34021
- });
34771
+ if (!hasOwn && unsafe) {
34772
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
34022
34773
  }
34023
- 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")
34024
34781
  seen.add(value);
34025
- t[k] = value;
34026
- ptr = valueEndPtr;
34782
+ skipVoid(ctx);
34783
+ if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
34784
+ return res;
34027
34785
  }
34786
+ if (c !== 44)
34787
+ TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
34028
34788
  }
34029
- if (!c) {
34030
- throw new TomlError("unfinished table encountered", {
34031
- toml: str2,
34032
- ptr
34033
- });
34034
- }
34035
- return [res, ptr];
34789
+ TomlError.x("unfinished table", ctx, startPtr);
34036
34790
  }
34037
- function parseArray(str2, ptr, depth, integersAsBigInt) {
34791
+ function parseArray(ctx) {
34792
+ let startPtr = ctx.p++;
34038
34793
  let res = [];
34039
34794
  let c;
34040
- ptr++;
34041
- while ((c = str2[ptr++]) !== "]" && c) {
34042
- if (c === ",") {
34043
- throw new TomlError("expected value, found comma", {
34044
- toml: str2,
34045
- ptr: ptr - 1
34046
- });
34047
- } else if (c === "#")
34048
- ptr = skipComment(str2, ptr);
34049
- else if (c !== " " && c !== "\t" && c !== `
34050
- ` && c !== "\r") {
34051
- let e = extractValue(str2, ptr - 1, "]", depth - 1, integersAsBigInt);
34052
- res.push(e[0]);
34053
- ptr = e[1];
34054
- }
34055
- }
34056
- if (!c) {
34057
- throw new TomlError("unfinished array encountered", {
34058
- toml: str2,
34059
- ptr
34060
- });
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);
34061
34808
  }
34062
- return [res, ptr];
34809
+ TomlError.x("unfinished array", ctx, startPtr);
34063
34810
  }
34064
34811
 
34065
34812
  // node_modules/smol-toml/dist/parse.js
@@ -34090,7 +34837,7 @@ function parseArray(str2, ptr, depth, integersAsBigInt) {
34090
34837
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34091
34838
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34092
34839
  */
34093
- function peekTable(key, table, meta, type) {
34840
+ function peekTable(ctx, key, table, meta, type) {
34094
34841
  let t = table;
34095
34842
  let m = meta;
34096
34843
  let k;
@@ -34098,7 +34845,7 @@ function peekTable(key, table, meta, type) {
34098
34845
  let state;
34099
34846
  for (let i = 0;i < key.length; i++) {
34100
34847
  if (i) {
34101
- t = hasOwn ? t[k] : t[k] = {};
34848
+ t = hasOwn ? t[k] : t[k] = Object.create(null);
34102
34849
  m = (state = m[k]).c;
34103
34850
  if (type === 0 && (state.t === 1 || state.t === 2)) {
34104
34851
  return null;
@@ -34114,7 +34861,10 @@ function peekTable(key, table, meta, type) {
34114
34861
  return null;
34115
34862
  }
34116
34863
  if (!hasOwn) {
34117
- if (k === "__proto__") {
34864
+ let unsafe = k === "__proto__";
34865
+ if (ctx.uk && (unsafe || k === "constructor"))
34866
+ return false;
34867
+ if (unsafe) {
34118
34868
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
34119
34869
  Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
34120
34870
  }
@@ -34122,7 +34872,7 @@ function peekTable(key, table, meta, type) {
34122
34872
  t: i < key.length - 1 && type === 2 ? 3 : type,
34123
34873
  d: false,
34124
34874
  i: 0,
34125
- c: {}
34875
+ c: Object.create(null)
34126
34876
  };
34127
34877
  }
34128
34878
  }
@@ -34135,70 +34885,78 @@ function peekTable(key, table, meta, type) {
34135
34885
  state.d = true;
34136
34886
  t[k] = [];
34137
34887
  }
34138
- t[k].push(t = {});
34139
- 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) };
34140
34890
  }
34141
34891
  if (state.d) {
34142
34892
  return null;
34143
34893
  }
34144
34894
  state.d = true;
34145
34895
  if (type === 1) {
34146
- t = hasOwn ? t[k] : t[k] = {};
34896
+ t = hasOwn ? t[k] : t[k] = Object.create(null);
34147
34897
  } else if (type === 0 && hasOwn) {
34148
34898
  return null;
34149
34899
  }
34150
34900
  return [k, t, state.c];
34151
34901
  }
34152
- function parse2(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
34153
- let res = {};
34154
- 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;
34155
34919
  let tbl = res;
34156
34920
  let m = meta;
34157
- for (let ptr = skipVoid(toml, 0);ptr < toml.length; ) {
34158
- if (toml[ptr] === "[") {
34159
- let isTableArray = toml[++ptr] === "[";
34160
- 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);
34161
34930
  if (isTableArray) {
34162
- if (toml[k[1] - 1] !== "]") {
34163
- throw new TomlError("expected end of table declaration", {
34164
- toml,
34165
- ptr: k[1] - 1
34166
- });
34931
+ if (toml.charCodeAt(ctx.p) !== 93) {
34932
+ TomlError.x("expected end of table array declaration", ctx);
34167
34933
  }
34168
- k[1]++;
34934
+ ctx.p++;
34169
34935
  }
34170
- let p = peekTable(k[0], res, meta, isTableArray ? 2 : 1);
34936
+ let p = peekTable(ctx, k, res, meta, isTableArray ? 2 : 1);
34171
34937
  if (!p) {
34172
- throw new TomlError("trying to redefine an already defined table or value", {
34173
- toml,
34174
- ptr
34175
- });
34938
+ validateTablePeek(ctx, p, tmp);
34939
+ skipping = true;
34940
+ } else {
34941
+ m = p[2];
34942
+ tbl = p[1];
34176
34943
  }
34177
- m = p[2];
34178
- tbl = p[1];
34179
- ptr = k[1];
34180
34944
  } else {
34181
- let k = parseKey(toml, ptr);
34182
- let p = peekTable(k[0], tbl, m, 0);
34183
- if (!p) {
34184
- throw new TomlError("trying to redefine an already defined table or value", {
34185
- toml,
34186
- ptr
34187
- });
34188
- }
34189
- let v = extractValue(toml, k[1], undefined, maxDepth, integersAsBigInt);
34190
- p[1][p[0]] = v[0];
34191
- ptr = v[1];
34192
- }
34193
- ptr = skipVoid(toml, ptr, true);
34194
- if (toml[ptr] && toml[ptr] !== `
34195
- ` && toml[ptr] !== "\r") {
34196
- throw new TomlError("each key-value declaration must be followed by an end-of-line", {
34197
- toml,
34198
- ptr
34199
- });
34200
- }
34201
- 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);
34202
34960
  }
34203
34961
  return res;
34204
34962
  }
@@ -34232,13 +34990,28 @@ function parse2(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
34232
34990
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34233
34991
  */
34234
34992
  var BARE_KEY = /^[a-z0-9-_]+$/i;
34993
+ var HAS_WELLFORMED = !!"".isWellFormed;
34235
34994
  function extendedTypeOf(obj) {
34236
34995
  let type = typeof obj;
34237
34996
  if (type === "object") {
34238
34997
  if (Array.isArray(obj))
34239
34998
  return "array";
34240
- if (obj instanceof Date)
34999
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date)
34241
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
+ }
34242
35015
  }
34243
35016
  return type;
34244
35017
  }
@@ -34249,44 +35022,67 @@ function isArrayOfTables(obj) {
34249
35022
  }
34250
35023
  return obj.length != 0;
34251
35024
  }
35025
+ function formatWellFormedStringUnchecked(s) {
35026
+ return JSON.stringify(s).replaceAll("\x7F", "\\u007f");
35027
+ }
34252
35028
  function formatString(s) {
34253
- 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);
34254
35037
  }
34255
- function stringifyValue(val, type, depth, numberAsFloat) {
35038
+ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
34256
35039
  if (depth === 0) {
34257
35040
  throw new Error("Could not stringify the object: maximum object depth exceeded");
34258
35041
  }
34259
- if (type === "number") {
34260
- if (isNaN(val))
34261
- return "nan";
34262
- if (val === Infinity)
34263
- return "inf";
34264
- if (val === -Infinity)
34265
- return "-inf";
34266
- if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
34267
- return val.toFixed(1);
34268
- return val.toString();
34269
- }
34270
- if (type === "bigint" || type === "boolean") {
34271
- return val.toString();
34272
- }
34273
- if (type === "string") {
34274
- return formatString(val);
34275
- }
34276
- if (type === "date") {
34277
- if (isNaN(val.getTime())) {
34278
- throw new TypeError("cannot serialize invalid date");
34279
- }
34280
- return val.toISOString();
34281
- }
34282
- if (type === "object") {
34283
- return stringifyInlineTable(val, depth, numberAsFloat);
34284
- }
34285
- if (type === "array") {
34286
- 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]);
34287
35083
  }
34288
35084
  }
34289
- function stringifyInlineTable(obj, depth, numberAsFloat) {
35085
+ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
34290
35086
  let keys = Object.keys(obj);
34291
35087
  if (keys.length === 0)
34292
35088
  return "{}";
@@ -34295,13 +35091,11 @@ function stringifyInlineTable(obj, depth, numberAsFloat) {
34295
35091
  let k = keys[i];
34296
35092
  if (i)
34297
35093
  res += ", ";
34298
- res += BARE_KEY.test(k) ? k : formatString(k);
34299
- res += " = ";
34300
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
35094
+ res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
34301
35095
  }
34302
35096
  return res + " }";
34303
35097
  }
34304
- function stringifyArray(array, depth, numberAsFloat) {
35098
+ function stringifyArray(array, depth, numberAsFloat, strictTemporal) {
34305
35099
  if (array.length === 0)
34306
35100
  return "[]";
34307
35101
  let res = "[ ";
@@ -34311,11 +35105,11 @@ function stringifyArray(array, depth, numberAsFloat) {
34311
35105
  if (array[i] === null || array[i] === undefined) {
34312
35106
  throw new TypeError("arrays cannot contain null or undefined values");
34313
35107
  }
34314
- res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
35108
+ res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat, strictTemporal);
34315
35109
  }
34316
35110
  return res + " ]";
34317
35111
  }
34318
- function stringifyArrayTable(array, key, depth, numberAsFloat) {
35112
+ function stringifyArrayTable(array, key, depth, numberAsFloat, strictTemporal) {
34319
35113
  if (depth === 0) {
34320
35114
  throw new Error("Could not stringify the object: maximum object depth exceeded");
34321
35115
  }
@@ -34324,11 +35118,11 @@ function stringifyArrayTable(array, key, depth, numberAsFloat) {
34324
35118
  res += `${res && `
34325
35119
  `}[[${key}]]
34326
35120
  `;
34327
- res += stringifyTable(0, array[i], key, depth, numberAsFloat);
35121
+ res += stringifyTable(0, array[i], key, depth, numberAsFloat, strictTemporal);
34328
35122
  }
34329
35123
  return res;
34330
35124
  }
34331
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
35125
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
34332
35126
  if (depth === 0) {
34333
35127
  throw new Error("Could not stringify the object: maximum object depth exceeded");
34334
35128
  }
@@ -34342,18 +35136,18 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
34342
35136
  if (type === "symbol" || type === "function") {
34343
35137
  throw new TypeError(`cannot serialize values of type '${type}'`);
34344
35138
  }
34345
- let key = BARE_KEY.test(k) ? k : formatString(k);
35139
+ let key = formatKey(k);
34346
35140
  if (type === "array" && isArrayOfTables(obj[k])) {
34347
35141
  tables += (tables && `
34348
- `) + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
35142
+ `) + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
34349
35143
  } else if (type === "object") {
34350
35144
  let tblKey = prefix ? `${prefix}.${key}` : key;
34351
35145
  tables += (tables && `
34352
- `) + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
35146
+ `) + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
34353
35147
  } else {
34354
35148
  preamble += key;
34355
35149
  preamble += " = ";
34356
- preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
35150
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
34357
35151
  preamble += `
34358
35152
  `;
34359
35153
  }
@@ -34365,11 +35159,11 @@ ${preamble}` : `[${tableKey}]`;
34365
35159
  return preamble && tables ? `${preamble}
34366
35160
  ${tables}` : preamble || tables;
34367
35161
  }
34368
- function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
35162
+ function stringify(obj, { maxDepth = 1000, numbersAsFloat = false, strictTemporal = false } = {}) {
34369
35163
  if (extendedTypeOf(obj) !== "object") {
34370
35164
  throw new TypeError("stringify can only be called with an object");
34371
35165
  }
34372
- let str2 = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
35166
+ let str2 = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
34373
35167
  if (str2[str2.length - 1] !== `
34374
35168
  `)
34375
35169
  return str2 + `
@@ -34408,24 +35202,18 @@ function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
34408
35202
 
34409
35203
  // src/adapters/codex.ts
34410
35204
  var OPENAI_MODELS = [
35205
+ "gpt-6.1-sol",
35206
+ "gpt-6.1-terra",
34411
35207
  "gpt-6-astra",
34412
35208
  "gpt-6-sol",
34413
- "gpt-6-luna",
34414
- "gpt-5.6-sol",
34415
- "gpt-5.6-terra",
34416
- "gpt-5.6-luna",
34417
- "gpt-5.5",
34418
- "gpt-5.4",
34419
- "gpt-5.4-mini",
34420
- "gpt-5.4-nano",
34421
- "gpt-5.3-codex-spark"
35209
+ "gpt-6-luna"
34422
35210
  ];
34423
35211
  var DEFAULT_MODELS3 = {
34424
- default_model: "gpt-6-sol",
35212
+ default_model: "gpt-6-astra",
34425
35213
  sentinel: "gpt-6-luna",
34426
35214
  oracle: "gpt-6-astra",
34427
35215
  architect: "gpt-6-astra",
34428
- keymaker: "gpt-6-luna"
35216
+ keymaker: "gpt-6-sol"
34429
35217
  };
34430
35218
  var WRITABLE_AGENTS = ["keymaker"];
34431
35219
  var MANAGED_CODEX_KEYS = [
@@ -34458,13 +35246,13 @@ function defaultSection3() {
34458
35246
  return {
34459
35247
  provider: "openai",
34460
35248
  default_model: DEFAULT_MODELS3.default_model,
34461
- build_thinking: "high",
34462
- plan_thinking: "xhigh",
35249
+ build_thinking: defaultThinking(DEFAULT_MODELS3.default_model, "session"),
35250
+ plan_thinking: defaultThinking(DEFAULT_MODELS3.default_model, "plan"),
34463
35251
  agents: AGENT_NAMES.map((name) => ({
34464
35252
  template: name,
34465
35253
  name,
34466
35254
  model: DEFAULT_MODELS3[name],
34467
- thinking: { sentinel: "low", oracle: "high", architect: "xhigh", keymaker: "low" }[name]
35255
+ thinking: defaultThinking(DEFAULT_MODELS3[name], name)
34468
35256
  }))
34469
35257
  };
34470
35258
  }
@@ -34472,7 +35260,7 @@ function modelsForProvider3(_provider) {
34472
35260
  return [...OPENAI_MODELS];
34473
35261
  }
34474
35262
  async function promptSection3(prompt, section) {
34475
- return promptForSimpleModels(prompt, section, modelsForProvider3(), "codex");
35263
+ return promptForSimpleModels(prompt, section, modelsForProvider3(), "codex", defaultSection3());
34476
35264
  }
34477
35265
  function installAgents3(section, basePath) {
34478
35266
  const config = CodexConfigSchema.parse(section);
@@ -34519,7 +35307,7 @@ function mergeHarnessConfig3(section, basePath) {
34519
35307
  ...existing,
34520
35308
  model: config.default_model,
34521
35309
  ...effortField("model_reasoning_effort", codexThinking(config.build_thinking, "medium")),
34522
- ...effortField("plan_mode_reasoning_effort", codexThinking(config.plan_thinking, "high")),
35310
+ ...effortField("plan_mode_reasoning_effort", codexThinking(config.plan_thinking)),
34523
35311
  sandbox_mode: "danger-full-access",
34524
35312
  approval_policy: "on-request",
34525
35313
  features: {
@@ -34643,117 +35431,15 @@ function isObject(value) {
34643
35431
  return typeof value === "object" && value !== null && !Array.isArray(value);
34644
35432
  }
34645
35433
 
34646
- // src/adapters/cursor.ts
34647
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync5, rmSync as rmSync5, rmdirSync as rmdirSync4, writeFileSync as writeFileSync6 } from "fs";
34648
- import { join as join10 } from "path";
34649
- var CURSOR_MODELS = [
34650
- "composer-2.5",
34651
- "cursor-grok-4.5-high",
34652
- "gpt-5.6-luna-medium",
34653
- "gpt-5.6-terra-medium",
34654
- "gpt-5.6-sol-medium",
34655
- "claude-opus-4-8-high",
34656
- "claude-sonnet-5-high",
34657
- "kimi-k2.7-code",
34658
- "glm-5.2-high"
34659
- ];
34660
- var DEFAULT_MODELS4 = {
34661
- sentinel: "composer-2.5",
34662
- oracle: "claude-opus-4-8-high",
34663
- architect: "gpt-5.6-sol-medium",
34664
- keymaker: "composer-2.5"
34665
- };
34666
- var cursorAdapter = {
34667
- name: "cursor",
34668
- configSchema: CursorConfigSchema,
34669
- defaultSection: defaultSection4,
34670
- modelsForProvider: modelsForProvider4,
34671
- promptSection: promptSection4,
34672
- installAgents: installAgents4,
34673
- mergeHarnessConfig: mergeHarnessConfig4,
34674
- fileList: fileList4,
34675
- remove: remove5
34676
- };
34677
- function defaultSection4() {
34678
- return {
34679
- agents: AGENT_NAMES.map((name) => ({ template: name, name, model: DEFAULT_MODELS4[name] }))
34680
- };
34681
- }
34682
- function modelsForProvider4(_provider) {
34683
- return CURSOR_MODELS;
34684
- }
34685
- async function promptSection4(prompt, section) {
34686
- const config = section;
34687
- const answers = await prompt.prompt(AGENT_NAMES.map((name) => ({
34688
- type: "list",
34689
- name,
34690
- message: `Select model for ${name}`,
34691
- choices: CURSOR_MODELS,
34692
- default: config.agents.find((agent) => agent.name === name)?.model ?? DEFAULT_MODELS4[name]
34693
- })));
34694
- return {
34695
- agents: AGENT_NAMES.map((name) => ({
34696
- template: name,
34697
- name,
34698
- model: answers[name] ?? DEFAULT_MODELS4[name]
34699
- }))
34700
- };
34701
- }
34702
- function installAgents4(section, basePath) {
34703
- const config = section;
34704
- const agentsDir = join10(basePath, ".cursor", "agents");
34705
- try {
34706
- mkdirSync5(agentsDir, { recursive: true });
34707
- } catch (err) {
34708
- throw new FileWriteError(agentsDir, err instanceof Error ? err.message : String(err));
34709
- }
34710
- rmSync5(join10(agentsDir, `${LEGACY_AGENT_NAME}.md`), { force: true });
34711
- for (const agent of config.agents) {
34712
- const template = readTemplate(agent.template);
34713
- const content = `---
34714
- name: ${agent.name}
34715
- description: ${template.description}
34716
- model: ${agent.model}
34717
- ---
34718
- ${template.body}`;
34719
- const agentPath = join10(agentsDir, `${agent.name}.md`);
34720
- writeFileSync6(agentPath, content);
34721
- console.log(`Created ${shortPath(agentPath)}`);
34722
- }
34723
- }
34724
- function mergeHarnessConfig4(_section, _basePath) {}
34725
- function fileList4(basePath) {
34726
- return AGENT_NAMES.map((name) => {
34727
- const path = join10(basePath, ".cursor", "agents", `${name}.md`);
34728
- return { path, exists: existsSync6(path) };
34729
- });
34730
- }
34731
- function remove5(section, basePath) {
34732
- const config = section;
34733
- const agentsDir = join10(basePath, ".cursor", "agents");
34734
- try {
34735
- for (const agent of config.agents) {
34736
- rmSync5(join10(agentsDir, `${agent.name}.md`), { force: true });
34737
- }
34738
- rmSync5(join10(agentsDir, `${LEGACY_AGENT_NAME}.md`), { force: true });
34739
- if (existsSync6(agentsDir) && readdirSync5(agentsDir).length === 0) {
34740
- rmdirSync4(agentsDir);
34741
- }
34742
- } catch (err) {
34743
- throw new FileWriteError(agentsDir, err instanceof Error ? err.message : String(err));
34744
- }
34745
- }
34746
-
34747
35434
  // src/adapters/index.ts
34748
35435
  registerAdapter(claudeAdapter);
34749
35436
  registerAdapter(opencodeAdapter);
34750
35437
  registerAdapter(codexAdapter);
34751
- registerAdapter(cursorAdapter);
34752
35438
 
34753
35439
  // src/atelier.ts
34754
35440
  var harnessChoices2 = Harness.join(", ");
34755
35441
  var program2 = new Command2;
34756
- 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");
34757
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) => {
34758
35444
  init(options2).catch(handleError);
34759
35445
  });