@neriros/ralphy 2.3.0 → 2.4.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/mcp/index.js CHANGED
@@ -44,7 +44,6 @@ var __export = (target, all) => {
44
44
  set: __exportSetter.bind(all, name)
45
45
  });
46
46
  };
47
- var __require = import.meta.require;
48
47
 
49
48
  // node_modules/.bun/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js
50
49
  var require_code = __commonJS((exports) => {
@@ -6518,2892 +6517,8 @@ var require_dist = __commonJS((exports, module) => {
6518
6517
  exports.default = formatsPlugin;
6519
6518
  });
6520
6519
 
6521
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/common.js
6522
- var require_common = __commonJS((exports, module) => {
6523
- function isNothing(subject) {
6524
- return typeof subject === "undefined" || subject === null;
6525
- }
6526
- function isObject2(subject) {
6527
- return typeof subject === "object" && subject !== null;
6528
- }
6529
- function toArray(sequence) {
6530
- if (Array.isArray(sequence))
6531
- return sequence;
6532
- else if (isNothing(sequence))
6533
- return [];
6534
- return [sequence];
6535
- }
6536
- function extend2(target, source) {
6537
- var index, length, key, sourceKeys;
6538
- if (source) {
6539
- sourceKeys = Object.keys(source);
6540
- for (index = 0, length = sourceKeys.length;index < length; index += 1) {
6541
- key = sourceKeys[index];
6542
- target[key] = source[key];
6543
- }
6544
- }
6545
- return target;
6546
- }
6547
- function repeat(string4, count) {
6548
- var result = "", cycle;
6549
- for (cycle = 0;cycle < count; cycle += 1) {
6550
- result += string4;
6551
- }
6552
- return result;
6553
- }
6554
- function isNegativeZero(number4) {
6555
- return number4 === 0 && Number.NEGATIVE_INFINITY === 1 / number4;
6556
- }
6557
- exports.isNothing = isNothing;
6558
- exports.isObject = isObject2;
6559
- exports.toArray = toArray;
6560
- exports.repeat = repeat;
6561
- exports.isNegativeZero = isNegativeZero;
6562
- exports.extend = extend2;
6563
- });
6564
-
6565
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/exception.js
6566
- var require_exception = __commonJS((exports, module) => {
6567
- function YAMLException(reason, mark) {
6568
- Error.call(this);
6569
- this.name = "YAMLException";
6570
- this.reason = reason;
6571
- this.mark = mark;
6572
- this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
6573
- if (Error.captureStackTrace) {
6574
- Error.captureStackTrace(this, this.constructor);
6575
- } else {
6576
- this.stack = new Error().stack || "";
6577
- }
6578
- }
6579
- YAMLException.prototype = Object.create(Error.prototype);
6580
- YAMLException.prototype.constructor = YAMLException;
6581
- YAMLException.prototype.toString = function toString(compact) {
6582
- var result = this.name + ": ";
6583
- result += this.reason || "(unknown reason)";
6584
- if (!compact && this.mark) {
6585
- result += " " + this.mark.toString();
6586
- }
6587
- return result;
6588
- };
6589
- module.exports = YAMLException;
6590
- });
6591
-
6592
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/mark.js
6593
- var require_mark = __commonJS((exports, module) => {
6594
- var common = require_common();
6595
- function Mark(name, buffer, position, line, column) {
6596
- this.name = name;
6597
- this.buffer = buffer;
6598
- this.position = position;
6599
- this.line = line;
6600
- this.column = column;
6601
- }
6602
- Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
6603
- var head, start, tail, end, snippet;
6604
- if (!this.buffer)
6605
- return null;
6606
- indent = indent || 4;
6607
- maxLength = maxLength || 75;
6608
- head = "";
6609
- start = this.position;
6610
- while (start > 0 && `\x00\r
6611
- \x85\u2028\u2029`.indexOf(this.buffer.charAt(start - 1)) === -1) {
6612
- start -= 1;
6613
- if (this.position - start > maxLength / 2 - 1) {
6614
- head = " ... ";
6615
- start += 5;
6616
- break;
6617
- }
6618
- }
6619
- tail = "";
6620
- end = this.position;
6621
- while (end < this.buffer.length && `\x00\r
6622
- \x85\u2028\u2029`.indexOf(this.buffer.charAt(end)) === -1) {
6623
- end += 1;
6624
- if (end - this.position > maxLength / 2 - 1) {
6625
- tail = " ... ";
6626
- end -= 5;
6627
- break;
6628
- }
6629
- }
6630
- snippet = this.buffer.slice(start, end);
6631
- return common.repeat(" ", indent) + head + snippet + tail + `
6632
- ` + common.repeat(" ", indent + this.position - start + head.length) + "^";
6633
- };
6634
- Mark.prototype.toString = function toString(compact) {
6635
- var snippet, where = "";
6636
- if (this.name) {
6637
- where += 'in "' + this.name + '" ';
6638
- }
6639
- where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
6640
- if (!compact) {
6641
- snippet = this.getSnippet();
6642
- if (snippet) {
6643
- where += `:
6644
- ` + snippet;
6645
- }
6646
- }
6647
- return where;
6648
- };
6649
- module.exports = Mark;
6650
- });
6651
-
6652
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type.js
6653
- var require_type = __commonJS((exports, module) => {
6654
- var YAMLException = require_exception();
6655
- var TYPE_CONSTRUCTOR_OPTIONS = [
6656
- "kind",
6657
- "resolve",
6658
- "construct",
6659
- "instanceOf",
6660
- "predicate",
6661
- "represent",
6662
- "defaultStyle",
6663
- "styleAliases"
6664
- ];
6665
- var YAML_NODE_KINDS = [
6666
- "scalar",
6667
- "sequence",
6668
- "mapping"
6669
- ];
6670
- function compileStyleAliases(map2) {
6671
- var result = {};
6672
- if (map2 !== null) {
6673
- Object.keys(map2).forEach(function(style) {
6674
- map2[style].forEach(function(alias) {
6675
- result[String(alias)] = style;
6676
- });
6677
- });
6678
- }
6679
- return result;
6680
- }
6681
- function Type(tag, options) {
6682
- options = options || {};
6683
- Object.keys(options).forEach(function(name) {
6684
- if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
6685
- throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
6686
- }
6687
- });
6688
- this.tag = tag;
6689
- this.kind = options["kind"] || null;
6690
- this.resolve = options["resolve"] || function() {
6691
- return true;
6692
- };
6693
- this.construct = options["construct"] || function(data) {
6694
- return data;
6695
- };
6696
- this.instanceOf = options["instanceOf"] || null;
6697
- this.predicate = options["predicate"] || null;
6698
- this.represent = options["represent"] || null;
6699
- this.defaultStyle = options["defaultStyle"] || null;
6700
- this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
6701
- if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
6702
- throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
6703
- }
6704
- }
6705
- module.exports = Type;
6706
- });
6707
-
6708
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema.js
6709
- var require_schema = __commonJS((exports, module) => {
6710
- var common = require_common();
6711
- var YAMLException = require_exception();
6712
- var Type = require_type();
6713
- function compileList(schema, name, result) {
6714
- var exclude = [];
6715
- schema.include.forEach(function(includedSchema) {
6716
- result = compileList(includedSchema, name, result);
6717
- });
6718
- schema[name].forEach(function(currentType) {
6719
- result.forEach(function(previousType, previousIndex) {
6720
- if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
6721
- exclude.push(previousIndex);
6722
- }
6723
- });
6724
- result.push(currentType);
6725
- });
6726
- return result.filter(function(type, index) {
6727
- return exclude.indexOf(index) === -1;
6728
- });
6729
- }
6730
- function compileMap() {
6731
- var result = {
6732
- scalar: {},
6733
- sequence: {},
6734
- mapping: {},
6735
- fallback: {}
6736
- }, index, length;
6737
- function collectType(type) {
6738
- result[type.kind][type.tag] = result["fallback"][type.tag] = type;
6739
- }
6740
- for (index = 0, length = arguments.length;index < length; index += 1) {
6741
- arguments[index].forEach(collectType);
6742
- }
6743
- return result;
6744
- }
6745
- function Schema(definition) {
6746
- this.include = definition.include || [];
6747
- this.implicit = definition.implicit || [];
6748
- this.explicit = definition.explicit || [];
6749
- this.implicit.forEach(function(type) {
6750
- if (type.loadKind && type.loadKind !== "scalar") {
6751
- throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
6752
- }
6753
- });
6754
- this.compiledImplicit = compileList(this, "implicit", []);
6755
- this.compiledExplicit = compileList(this, "explicit", []);
6756
- this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
6757
- }
6758
- Schema.DEFAULT = null;
6759
- Schema.create = function createSchema() {
6760
- var schemas4, types2;
6761
- switch (arguments.length) {
6762
- case 1:
6763
- schemas4 = Schema.DEFAULT;
6764
- types2 = arguments[0];
6765
- break;
6766
- case 2:
6767
- schemas4 = arguments[0];
6768
- types2 = arguments[1];
6769
- break;
6770
- default:
6771
- throw new YAMLException("Wrong number of arguments for Schema.create function");
6772
- }
6773
- schemas4 = common.toArray(schemas4);
6774
- types2 = common.toArray(types2);
6775
- if (!schemas4.every(function(schema) {
6776
- return schema instanceof Schema;
6777
- })) {
6778
- throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
6779
- }
6780
- if (!types2.every(function(type) {
6781
- return type instanceof Type;
6782
- })) {
6783
- throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
6784
- }
6785
- return new Schema({
6786
- include: schemas4,
6787
- explicit: types2
6788
- });
6789
- };
6790
- module.exports = Schema;
6791
- });
6792
-
6793
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/str.js
6794
- var require_str = __commonJS((exports, module) => {
6795
- var Type = require_type();
6796
- module.exports = new Type("tag:yaml.org,2002:str", {
6797
- kind: "scalar",
6798
- construct: function(data) {
6799
- return data !== null ? data : "";
6800
- }
6801
- });
6802
- });
6803
-
6804
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/seq.js
6805
- var require_seq = __commonJS((exports, module) => {
6806
- var Type = require_type();
6807
- module.exports = new Type("tag:yaml.org,2002:seq", {
6808
- kind: "sequence",
6809
- construct: function(data) {
6810
- return data !== null ? data : [];
6811
- }
6812
- });
6813
- });
6814
-
6815
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/map.js
6816
- var require_map = __commonJS((exports, module) => {
6817
- var Type = require_type();
6818
- module.exports = new Type("tag:yaml.org,2002:map", {
6819
- kind: "mapping",
6820
- construct: function(data) {
6821
- return data !== null ? data : {};
6822
- }
6823
- });
6824
- });
6825
-
6826
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
6827
- var require_failsafe = __commonJS((exports, module) => {
6828
- var Schema = require_schema();
6829
- module.exports = new Schema({
6830
- explicit: [
6831
- require_str(),
6832
- require_seq(),
6833
- require_map()
6834
- ]
6835
- });
6836
- });
6837
-
6838
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/null.js
6839
- var require_null = __commonJS((exports, module) => {
6840
- var Type = require_type();
6841
- function resolveYamlNull(data) {
6842
- if (data === null)
6843
- return true;
6844
- var max = data.length;
6845
- return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
6846
- }
6847
- function constructYamlNull() {
6848
- return null;
6849
- }
6850
- function isNull(object4) {
6851
- return object4 === null;
6852
- }
6853
- module.exports = new Type("tag:yaml.org,2002:null", {
6854
- kind: "scalar",
6855
- resolve: resolveYamlNull,
6856
- construct: constructYamlNull,
6857
- predicate: isNull,
6858
- represent: {
6859
- canonical: function() {
6860
- return "~";
6861
- },
6862
- lowercase: function() {
6863
- return "null";
6864
- },
6865
- uppercase: function() {
6866
- return "NULL";
6867
- },
6868
- camelcase: function() {
6869
- return "Null";
6870
- }
6871
- },
6872
- defaultStyle: "lowercase"
6873
- });
6874
- });
6875
-
6876
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/bool.js
6877
- var require_bool = __commonJS((exports, module) => {
6878
- var Type = require_type();
6879
- function resolveYamlBoolean(data) {
6880
- if (data === null)
6881
- return false;
6882
- var max = data.length;
6883
- return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
6884
- }
6885
- function constructYamlBoolean(data) {
6886
- return data === "true" || data === "True" || data === "TRUE";
6887
- }
6888
- function isBoolean(object4) {
6889
- return Object.prototype.toString.call(object4) === "[object Boolean]";
6890
- }
6891
- module.exports = new Type("tag:yaml.org,2002:bool", {
6892
- kind: "scalar",
6893
- resolve: resolveYamlBoolean,
6894
- construct: constructYamlBoolean,
6895
- predicate: isBoolean,
6896
- represent: {
6897
- lowercase: function(object4) {
6898
- return object4 ? "true" : "false";
6899
- },
6900
- uppercase: function(object4) {
6901
- return object4 ? "TRUE" : "FALSE";
6902
- },
6903
- camelcase: function(object4) {
6904
- return object4 ? "True" : "False";
6905
- }
6906
- },
6907
- defaultStyle: "lowercase"
6908
- });
6909
- });
6910
-
6911
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/int.js
6912
- var require_int = __commonJS((exports, module) => {
6913
- var common = require_common();
6914
- var Type = require_type();
6915
- function isHexCode(c) {
6916
- return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
6917
- }
6918
- function isOctCode(c) {
6919
- return 48 <= c && c <= 55;
6920
- }
6921
- function isDecCode(c) {
6922
- return 48 <= c && c <= 57;
6923
- }
6924
- function resolveYamlInteger(data) {
6925
- if (data === null)
6926
- return false;
6927
- var max = data.length, index = 0, hasDigits = false, ch;
6928
- if (!max)
6929
- return false;
6930
- ch = data[index];
6931
- if (ch === "-" || ch === "+") {
6932
- ch = data[++index];
6933
- }
6934
- if (ch === "0") {
6935
- if (index + 1 === max)
6936
- return true;
6937
- ch = data[++index];
6938
- if (ch === "b") {
6939
- index++;
6940
- for (;index < max; index++) {
6941
- ch = data[index];
6942
- if (ch === "_")
6943
- continue;
6944
- if (ch !== "0" && ch !== "1")
6945
- return false;
6946
- hasDigits = true;
6947
- }
6948
- return hasDigits && ch !== "_";
6949
- }
6950
- if (ch === "x") {
6951
- index++;
6952
- for (;index < max; index++) {
6953
- ch = data[index];
6954
- if (ch === "_")
6955
- continue;
6956
- if (!isHexCode(data.charCodeAt(index)))
6957
- return false;
6958
- hasDigits = true;
6959
- }
6960
- return hasDigits && ch !== "_";
6961
- }
6962
- for (;index < max; index++) {
6963
- ch = data[index];
6964
- if (ch === "_")
6965
- continue;
6966
- if (!isOctCode(data.charCodeAt(index)))
6967
- return false;
6968
- hasDigits = true;
6969
- }
6970
- return hasDigits && ch !== "_";
6971
- }
6972
- if (ch === "_")
6973
- return false;
6974
- for (;index < max; index++) {
6975
- ch = data[index];
6976
- if (ch === "_")
6977
- continue;
6978
- if (ch === ":")
6979
- break;
6980
- if (!isDecCode(data.charCodeAt(index))) {
6981
- return false;
6982
- }
6983
- hasDigits = true;
6984
- }
6985
- if (!hasDigits || ch === "_")
6986
- return false;
6987
- if (ch !== ":")
6988
- return true;
6989
- return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
6990
- }
6991
- function constructYamlInteger(data) {
6992
- var value = data, sign = 1, ch, base, digits = [];
6993
- if (value.indexOf("_") !== -1) {
6994
- value = value.replace(/_/g, "");
6995
- }
6996
- ch = value[0];
6997
- if (ch === "-" || ch === "+") {
6998
- if (ch === "-")
6999
- sign = -1;
7000
- value = value.slice(1);
7001
- ch = value[0];
7002
- }
7003
- if (value === "0")
7004
- return 0;
7005
- if (ch === "0") {
7006
- if (value[1] === "b")
7007
- return sign * parseInt(value.slice(2), 2);
7008
- if (value[1] === "x")
7009
- return sign * parseInt(value, 16);
7010
- return sign * parseInt(value, 8);
7011
- }
7012
- if (value.indexOf(":") !== -1) {
7013
- value.split(":").forEach(function(v) {
7014
- digits.unshift(parseInt(v, 10));
7015
- });
7016
- value = 0;
7017
- base = 1;
7018
- digits.forEach(function(d) {
7019
- value += d * base;
7020
- base *= 60;
7021
- });
7022
- return sign * value;
7023
- }
7024
- return sign * parseInt(value, 10);
7025
- }
7026
- function isInteger(object4) {
7027
- return Object.prototype.toString.call(object4) === "[object Number]" && (object4 % 1 === 0 && !common.isNegativeZero(object4));
7028
- }
7029
- module.exports = new Type("tag:yaml.org,2002:int", {
7030
- kind: "scalar",
7031
- resolve: resolveYamlInteger,
7032
- construct: constructYamlInteger,
7033
- predicate: isInteger,
7034
- represent: {
7035
- binary: function(obj) {
7036
- return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
7037
- },
7038
- octal: function(obj) {
7039
- return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1);
7040
- },
7041
- decimal: function(obj) {
7042
- return obj.toString(10);
7043
- },
7044
- hexadecimal: function(obj) {
7045
- return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
7046
- }
7047
- },
7048
- defaultStyle: "decimal",
7049
- styleAliases: {
7050
- binary: [2, "bin"],
7051
- octal: [8, "oct"],
7052
- decimal: [10, "dec"],
7053
- hexadecimal: [16, "hex"]
7054
- }
7055
- });
7056
- });
7057
-
7058
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/float.js
7059
- var require_float = __commonJS((exports, module) => {
7060
- var common = require_common();
7061
- var Type = require_type();
7062
- var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
7063
- function resolveYamlFloat(data) {
7064
- if (data === null)
7065
- return false;
7066
- if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
7067
- return false;
7068
- }
7069
- return true;
7070
- }
7071
- function constructYamlFloat(data) {
7072
- var value, sign, base, digits;
7073
- value = data.replace(/_/g, "").toLowerCase();
7074
- sign = value[0] === "-" ? -1 : 1;
7075
- digits = [];
7076
- if ("+-".indexOf(value[0]) >= 0) {
7077
- value = value.slice(1);
7078
- }
7079
- if (value === ".inf") {
7080
- return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
7081
- } else if (value === ".nan") {
7082
- return NaN;
7083
- } else if (value.indexOf(":") >= 0) {
7084
- value.split(":").forEach(function(v) {
7085
- digits.unshift(parseFloat(v, 10));
7086
- });
7087
- value = 0;
7088
- base = 1;
7089
- digits.forEach(function(d) {
7090
- value += d * base;
7091
- base *= 60;
7092
- });
7093
- return sign * value;
7094
- }
7095
- return sign * parseFloat(value, 10);
7096
- }
7097
- var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
7098
- function representYamlFloat(object4, style) {
7099
- var res;
7100
- if (isNaN(object4)) {
7101
- switch (style) {
7102
- case "lowercase":
7103
- return ".nan";
7104
- case "uppercase":
7105
- return ".NAN";
7106
- case "camelcase":
7107
- return ".NaN";
7108
- }
7109
- } else if (Number.POSITIVE_INFINITY === object4) {
7110
- switch (style) {
7111
- case "lowercase":
7112
- return ".inf";
7113
- case "uppercase":
7114
- return ".INF";
7115
- case "camelcase":
7116
- return ".Inf";
7117
- }
7118
- } else if (Number.NEGATIVE_INFINITY === object4) {
7119
- switch (style) {
7120
- case "lowercase":
7121
- return "-.inf";
7122
- case "uppercase":
7123
- return "-.INF";
7124
- case "camelcase":
7125
- return "-.Inf";
7126
- }
7127
- } else if (common.isNegativeZero(object4)) {
7128
- return "-0.0";
7129
- }
7130
- res = object4.toString(10);
7131
- return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
7132
- }
7133
- function isFloat(object4) {
7134
- return Object.prototype.toString.call(object4) === "[object Number]" && (object4 % 1 !== 0 || common.isNegativeZero(object4));
7135
- }
7136
- module.exports = new Type("tag:yaml.org,2002:float", {
7137
- kind: "scalar",
7138
- resolve: resolveYamlFloat,
7139
- construct: constructYamlFloat,
7140
- predicate: isFloat,
7141
- represent: representYamlFloat,
7142
- defaultStyle: "lowercase"
7143
- });
7144
- });
7145
-
7146
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/json.js
7147
- var require_json = __commonJS((exports, module) => {
7148
- var Schema = require_schema();
7149
- module.exports = new Schema({
7150
- include: [
7151
- require_failsafe()
7152
- ],
7153
- implicit: [
7154
- require_null(),
7155
- require_bool(),
7156
- require_int(),
7157
- require_float()
7158
- ]
7159
- });
7160
- });
7161
-
7162
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/core.js
7163
- var require_core3 = __commonJS((exports, module) => {
7164
- var Schema = require_schema();
7165
- module.exports = new Schema({
7166
- include: [
7167
- require_json()
7168
- ]
7169
- });
7170
- });
7171
-
7172
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
7173
- var require_timestamp = __commonJS((exports, module) => {
7174
- var Type = require_type();
7175
- var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
7176
- var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9]?)" + "-([0-9][0-9]?)" + "(?:[Tt]|[ \\t]+)" + "([0-9][0-9]?)" + ":([0-9][0-9])" + ":([0-9][0-9])" + "(?:\\.([0-9]*))?" + "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + "(?::([0-9][0-9]))?))?$");
7177
- function resolveYamlTimestamp(data) {
7178
- if (data === null)
7179
- return false;
7180
- if (YAML_DATE_REGEXP.exec(data) !== null)
7181
- return true;
7182
- if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
7183
- return true;
7184
- return false;
7185
- }
7186
- function constructYamlTimestamp(data) {
7187
- var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date4;
7188
- match = YAML_DATE_REGEXP.exec(data);
7189
- if (match === null)
7190
- match = YAML_TIMESTAMP_REGEXP.exec(data);
7191
- if (match === null)
7192
- throw new Error("Date resolve error");
7193
- year = +match[1];
7194
- month = +match[2] - 1;
7195
- day = +match[3];
7196
- if (!match[4]) {
7197
- return new Date(Date.UTC(year, month, day));
7198
- }
7199
- hour = +match[4];
7200
- minute = +match[5];
7201
- second = +match[6];
7202
- if (match[7]) {
7203
- fraction = match[7].slice(0, 3);
7204
- while (fraction.length < 3) {
7205
- fraction += "0";
7206
- }
7207
- fraction = +fraction;
7208
- }
7209
- if (match[9]) {
7210
- tz_hour = +match[10];
7211
- tz_minute = +(match[11] || 0);
7212
- delta = (tz_hour * 60 + tz_minute) * 60000;
7213
- if (match[9] === "-")
7214
- delta = -delta;
7215
- }
7216
- date4 = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
7217
- if (delta)
7218
- date4.setTime(date4.getTime() - delta);
7219
- return date4;
7220
- }
7221
- function representYamlTimestamp(object4) {
7222
- return object4.toISOString();
7223
- }
7224
- module.exports = new Type("tag:yaml.org,2002:timestamp", {
7225
- kind: "scalar",
7226
- resolve: resolveYamlTimestamp,
7227
- construct: constructYamlTimestamp,
7228
- instanceOf: Date,
7229
- represent: representYamlTimestamp
7230
- });
7231
- });
7232
-
7233
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/merge.js
7234
- var require_merge = __commonJS((exports, module) => {
7235
- var Type = require_type();
7236
- function resolveYamlMerge(data) {
7237
- return data === "<<" || data === null;
7238
- }
7239
- module.exports = new Type("tag:yaml.org,2002:merge", {
7240
- kind: "scalar",
7241
- resolve: resolveYamlMerge
7242
- });
7243
- });
7244
-
7245
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/binary.js
7246
- var require_binary = __commonJS((exports, module) => {
7247
- var NodeBuffer;
7248
- try {
7249
- _require = __require;
7250
- NodeBuffer = _require("buffer").Buffer;
7251
- } catch (__) {}
7252
- var _require;
7253
- var Type = require_type();
7254
- var BASE64_MAP = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
7255
- \r`;
7256
- function resolveYamlBinary(data) {
7257
- if (data === null)
7258
- return false;
7259
- var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
7260
- for (idx = 0;idx < max; idx++) {
7261
- code = map2.indexOf(data.charAt(idx));
7262
- if (code > 64)
7263
- continue;
7264
- if (code < 0)
7265
- return false;
7266
- bitlen += 6;
7267
- }
7268
- return bitlen % 8 === 0;
7269
- }
7270
- function constructYamlBinary(data) {
7271
- var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
7272
- for (idx = 0;idx < max; idx++) {
7273
- if (idx % 4 === 0 && idx) {
7274
- result.push(bits >> 16 & 255);
7275
- result.push(bits >> 8 & 255);
7276
- result.push(bits & 255);
7277
- }
7278
- bits = bits << 6 | map2.indexOf(input.charAt(idx));
7279
- }
7280
- tailbits = max % 4 * 6;
7281
- if (tailbits === 0) {
7282
- result.push(bits >> 16 & 255);
7283
- result.push(bits >> 8 & 255);
7284
- result.push(bits & 255);
7285
- } else if (tailbits === 18) {
7286
- result.push(bits >> 10 & 255);
7287
- result.push(bits >> 2 & 255);
7288
- } else if (tailbits === 12) {
7289
- result.push(bits >> 4 & 255);
7290
- }
7291
- if (NodeBuffer) {
7292
- return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
7293
- }
7294
- return result;
7295
- }
7296
- function representYamlBinary(object4) {
7297
- var result = "", bits = 0, idx, tail, max = object4.length, map2 = BASE64_MAP;
7298
- for (idx = 0;idx < max; idx++) {
7299
- if (idx % 3 === 0 && idx) {
7300
- result += map2[bits >> 18 & 63];
7301
- result += map2[bits >> 12 & 63];
7302
- result += map2[bits >> 6 & 63];
7303
- result += map2[bits & 63];
7304
- }
7305
- bits = (bits << 8) + object4[idx];
7306
- }
7307
- tail = max % 3;
7308
- if (tail === 0) {
7309
- result += map2[bits >> 18 & 63];
7310
- result += map2[bits >> 12 & 63];
7311
- result += map2[bits >> 6 & 63];
7312
- result += map2[bits & 63];
7313
- } else if (tail === 2) {
7314
- result += map2[bits >> 10 & 63];
7315
- result += map2[bits >> 4 & 63];
7316
- result += map2[bits << 2 & 63];
7317
- result += map2[64];
7318
- } else if (tail === 1) {
7319
- result += map2[bits >> 2 & 63];
7320
- result += map2[bits << 4 & 63];
7321
- result += map2[64];
7322
- result += map2[64];
7323
- }
7324
- return result;
7325
- }
7326
- function isBinary(object4) {
7327
- return NodeBuffer && NodeBuffer.isBuffer(object4);
7328
- }
7329
- module.exports = new Type("tag:yaml.org,2002:binary", {
7330
- kind: "scalar",
7331
- resolve: resolveYamlBinary,
7332
- construct: constructYamlBinary,
7333
- predicate: isBinary,
7334
- represent: representYamlBinary
7335
- });
7336
- });
7337
-
7338
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/omap.js
7339
- var require_omap = __commonJS((exports, module) => {
7340
- var Type = require_type();
7341
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
7342
- var _toString = Object.prototype.toString;
7343
- function resolveYamlOmap(data) {
7344
- if (data === null)
7345
- return true;
7346
- var objectKeys = [], index, length, pair, pairKey, pairHasKey, object4 = data;
7347
- for (index = 0, length = object4.length;index < length; index += 1) {
7348
- pair = object4[index];
7349
- pairHasKey = false;
7350
- if (_toString.call(pair) !== "[object Object]")
7351
- return false;
7352
- for (pairKey in pair) {
7353
- if (_hasOwnProperty.call(pair, pairKey)) {
7354
- if (!pairHasKey)
7355
- pairHasKey = true;
7356
- else
7357
- return false;
7358
- }
7359
- }
7360
- if (!pairHasKey)
7361
- return false;
7362
- if (objectKeys.indexOf(pairKey) === -1)
7363
- objectKeys.push(pairKey);
7364
- else
7365
- return false;
7366
- }
7367
- return true;
7368
- }
7369
- function constructYamlOmap(data) {
7370
- return data !== null ? data : [];
7371
- }
7372
- module.exports = new Type("tag:yaml.org,2002:omap", {
7373
- kind: "sequence",
7374
- resolve: resolveYamlOmap,
7375
- construct: constructYamlOmap
7376
- });
7377
- });
7378
-
7379
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/pairs.js
7380
- var require_pairs = __commonJS((exports, module) => {
7381
- var Type = require_type();
7382
- var _toString = Object.prototype.toString;
7383
- function resolveYamlPairs(data) {
7384
- if (data === null)
7385
- return true;
7386
- var index, length, pair, keys, result, object4 = data;
7387
- result = new Array(object4.length);
7388
- for (index = 0, length = object4.length;index < length; index += 1) {
7389
- pair = object4[index];
7390
- if (_toString.call(pair) !== "[object Object]")
7391
- return false;
7392
- keys = Object.keys(pair);
7393
- if (keys.length !== 1)
7394
- return false;
7395
- result[index] = [keys[0], pair[keys[0]]];
7396
- }
7397
- return true;
7398
- }
7399
- function constructYamlPairs(data) {
7400
- if (data === null)
7401
- return [];
7402
- var index, length, pair, keys, result, object4 = data;
7403
- result = new Array(object4.length);
7404
- for (index = 0, length = object4.length;index < length; index += 1) {
7405
- pair = object4[index];
7406
- keys = Object.keys(pair);
7407
- result[index] = [keys[0], pair[keys[0]]];
7408
- }
7409
- return result;
7410
- }
7411
- module.exports = new Type("tag:yaml.org,2002:pairs", {
7412
- kind: "sequence",
7413
- resolve: resolveYamlPairs,
7414
- construct: constructYamlPairs
7415
- });
7416
- });
7417
-
7418
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/set.js
7419
- var require_set = __commonJS((exports, module) => {
7420
- var Type = require_type();
7421
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
7422
- function resolveYamlSet(data) {
7423
- if (data === null)
7424
- return true;
7425
- var key, object4 = data;
7426
- for (key in object4) {
7427
- if (_hasOwnProperty.call(object4, key)) {
7428
- if (object4[key] !== null)
7429
- return false;
7430
- }
7431
- }
7432
- return true;
7433
- }
7434
- function constructYamlSet(data) {
7435
- return data !== null ? data : {};
7436
- }
7437
- module.exports = new Type("tag:yaml.org,2002:set", {
7438
- kind: "mapping",
7439
- resolve: resolveYamlSet,
7440
- construct: constructYamlSet
7441
- });
7442
- });
7443
-
7444
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
7445
- var require_default_safe = __commonJS((exports, module) => {
7446
- var Schema = require_schema();
7447
- module.exports = new Schema({
7448
- include: [
7449
- require_core3()
7450
- ],
7451
- implicit: [
7452
- require_timestamp(),
7453
- require_merge()
7454
- ],
7455
- explicit: [
7456
- require_binary(),
7457
- require_omap(),
7458
- require_pairs(),
7459
- require_set()
7460
- ]
7461
- });
7462
- });
7463
-
7464
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
7465
- var require_undefined = __commonJS((exports, module) => {
7466
- var Type = require_type();
7467
- function resolveJavascriptUndefined() {
7468
- return true;
7469
- }
7470
- function constructJavascriptUndefined() {
7471
- return;
7472
- }
7473
- function representJavascriptUndefined() {
7474
- return "";
7475
- }
7476
- function isUndefined(object4) {
7477
- return typeof object4 === "undefined";
7478
- }
7479
- module.exports = new Type("tag:yaml.org,2002:js/undefined", {
7480
- kind: "scalar",
7481
- resolve: resolveJavascriptUndefined,
7482
- construct: constructJavascriptUndefined,
7483
- predicate: isUndefined,
7484
- represent: representJavascriptUndefined
7485
- });
7486
- });
7487
-
7488
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
7489
- var require_regexp = __commonJS((exports, module) => {
7490
- var Type = require_type();
7491
- function resolveJavascriptRegExp(data) {
7492
- if (data === null)
7493
- return false;
7494
- if (data.length === 0)
7495
- return false;
7496
- var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
7497
- if (regexp[0] === "/") {
7498
- if (tail)
7499
- modifiers = tail[1];
7500
- if (modifiers.length > 3)
7501
- return false;
7502
- if (regexp[regexp.length - modifiers.length - 1] !== "/")
7503
- return false;
7504
- }
7505
- return true;
7506
- }
7507
- function constructJavascriptRegExp(data) {
7508
- var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
7509
- if (regexp[0] === "/") {
7510
- if (tail)
7511
- modifiers = tail[1];
7512
- regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
7513
- }
7514
- return new RegExp(regexp, modifiers);
7515
- }
7516
- function representJavascriptRegExp(object4) {
7517
- var result = "/" + object4.source + "/";
7518
- if (object4.global)
7519
- result += "g";
7520
- if (object4.multiline)
7521
- result += "m";
7522
- if (object4.ignoreCase)
7523
- result += "i";
7524
- return result;
7525
- }
7526
- function isRegExp(object4) {
7527
- return Object.prototype.toString.call(object4) === "[object RegExp]";
7528
- }
7529
- module.exports = new Type("tag:yaml.org,2002:js/regexp", {
7530
- kind: "scalar",
7531
- resolve: resolveJavascriptRegExp,
7532
- construct: constructJavascriptRegExp,
7533
- predicate: isRegExp,
7534
- represent: representJavascriptRegExp
7535
- });
7536
- });
7537
-
7538
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/function.js
7539
- var require_function = __commonJS((exports, module) => {
7540
- var esprima;
7541
- try {
7542
- _require = __require;
7543
- esprima = _require("esprima");
7544
- } catch (_) {
7545
- if (typeof window !== "undefined")
7546
- esprima = window.esprima;
7547
- }
7548
- var _require;
7549
- var Type = require_type();
7550
- function resolveJavascriptFunction(data) {
7551
- if (data === null)
7552
- return false;
7553
- try {
7554
- var source = "(" + data + ")", ast = esprima.parse(source, { range: true });
7555
- if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
7556
- return false;
7557
- }
7558
- return true;
7559
- } catch (err) {
7560
- return false;
7561
- }
7562
- }
7563
- function constructJavascriptFunction(data) {
7564
- var source = "(" + data + ")", ast = esprima.parse(source, { range: true }), params = [], body;
7565
- if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
7566
- throw new Error("Failed to resolve function");
7567
- }
7568
- ast.body[0].expression.params.forEach(function(param) {
7569
- params.push(param.name);
7570
- });
7571
- body = ast.body[0].expression.body.range;
7572
- if (ast.body[0].expression.body.type === "BlockStatement") {
7573
- return new Function(params, source.slice(body[0] + 1, body[1] - 1));
7574
- }
7575
- return new Function(params, "return " + source.slice(body[0], body[1]));
7576
- }
7577
- function representJavascriptFunction(object4) {
7578
- return object4.toString();
7579
- }
7580
- function isFunction(object4) {
7581
- return Object.prototype.toString.call(object4) === "[object Function]";
7582
- }
7583
- module.exports = new Type("tag:yaml.org,2002:js/function", {
7584
- kind: "scalar",
7585
- resolve: resolveJavascriptFunction,
7586
- construct: constructJavascriptFunction,
7587
- predicate: isFunction,
7588
- represent: representJavascriptFunction
7589
- });
7590
- });
7591
-
7592
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
7593
- var require_default_full = __commonJS((exports, module) => {
7594
- var Schema = require_schema();
7595
- module.exports = Schema.DEFAULT = new Schema({
7596
- include: [
7597
- require_default_safe()
7598
- ],
7599
- explicit: [
7600
- require_undefined(),
7601
- require_regexp(),
7602
- require_function()
7603
- ]
7604
- });
7605
- });
7606
-
7607
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/loader.js
7608
- var require_loader = __commonJS((exports, module) => {
7609
- var common = require_common();
7610
- var YAMLException = require_exception();
7611
- var Mark = require_mark();
7612
- var DEFAULT_SAFE_SCHEMA = require_default_safe();
7613
- var DEFAULT_FULL_SCHEMA = require_default_full();
7614
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
7615
- var CONTEXT_FLOW_IN = 1;
7616
- var CONTEXT_FLOW_OUT = 2;
7617
- var CONTEXT_BLOCK_IN = 3;
7618
- var CONTEXT_BLOCK_OUT = 4;
7619
- var CHOMPING_CLIP = 1;
7620
- var CHOMPING_STRIP = 2;
7621
- var CHOMPING_KEEP = 3;
7622
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
7623
- var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
7624
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
7625
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
7626
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
7627
- function _class(obj) {
7628
- return Object.prototype.toString.call(obj);
7629
- }
7630
- function is_EOL(c) {
7631
- return c === 10 || c === 13;
7632
- }
7633
- function is_WHITE_SPACE(c) {
7634
- return c === 9 || c === 32;
7635
- }
7636
- function is_WS_OR_EOL(c) {
7637
- return c === 9 || c === 32 || c === 10 || c === 13;
7638
- }
7639
- function is_FLOW_INDICATOR(c) {
7640
- return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
7641
- }
7642
- function fromHexCode(c) {
7643
- var lc;
7644
- if (48 <= c && c <= 57) {
7645
- return c - 48;
7646
- }
7647
- lc = c | 32;
7648
- if (97 <= lc && lc <= 102) {
7649
- return lc - 97 + 10;
7650
- }
7651
- return -1;
7652
- }
7653
- function escapedHexLen(c) {
7654
- if (c === 120) {
7655
- return 2;
7656
- }
7657
- if (c === 117) {
7658
- return 4;
7659
- }
7660
- if (c === 85) {
7661
- return 8;
7662
- }
7663
- return 0;
7664
- }
7665
- function fromDecimalCode(c) {
7666
- if (48 <= c && c <= 57) {
7667
- return c - 48;
7668
- }
7669
- return -1;
7670
- }
7671
- function simpleEscapeSequence(c) {
7672
- return c === 48 ? "\x00" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "\t" : c === 9 ? "\t" : c === 110 ? `
7673
- ` : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
7674
- }
7675
- function charFromCodepoint(c) {
7676
- if (c <= 65535) {
7677
- return String.fromCharCode(c);
7678
- }
7679
- return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
7680
- }
7681
- function setProperty(object4, key, value) {
7682
- if (key === "__proto__") {
7683
- Object.defineProperty(object4, key, {
7684
- configurable: true,
7685
- enumerable: true,
7686
- writable: true,
7687
- value
7688
- });
7689
- } else {
7690
- object4[key] = value;
7691
- }
7692
- }
7693
- var simpleEscapeCheck = new Array(256);
7694
- var simpleEscapeMap = new Array(256);
7695
- for (i = 0;i < 256; i++) {
7696
- simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
7697
- simpleEscapeMap[i] = simpleEscapeSequence(i);
7698
- }
7699
- var i;
7700
- function State(input, options) {
7701
- this.input = input;
7702
- this.filename = options["filename"] || null;
7703
- this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
7704
- this.onWarning = options["onWarning"] || null;
7705
- this.legacy = options["legacy"] || false;
7706
- this.json = options["json"] || false;
7707
- this.listener = options["listener"] || null;
7708
- this.implicitTypes = this.schema.compiledImplicit;
7709
- this.typeMap = this.schema.compiledTypeMap;
7710
- this.length = input.length;
7711
- this.position = 0;
7712
- this.line = 0;
7713
- this.lineStart = 0;
7714
- this.lineIndent = 0;
7715
- this.documents = [];
7716
- }
7717
- function generateError(state, message) {
7718
- return new YAMLException(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart));
7719
- }
7720
- function throwError(state, message) {
7721
- throw generateError(state, message);
7722
- }
7723
- function throwWarning(state, message) {
7724
- if (state.onWarning) {
7725
- state.onWarning.call(null, generateError(state, message));
7726
- }
7727
- }
7728
- var directiveHandlers = {
7729
- YAML: function handleYamlDirective(state, name, args) {
7730
- var match, major, minor;
7731
- if (state.version !== null) {
7732
- throwError(state, "duplication of %YAML directive");
7733
- }
7734
- if (args.length !== 1) {
7735
- throwError(state, "YAML directive accepts exactly one argument");
7736
- }
7737
- match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
7738
- if (match === null) {
7739
- throwError(state, "ill-formed argument of the YAML directive");
7740
- }
7741
- major = parseInt(match[1], 10);
7742
- minor = parseInt(match[2], 10);
7743
- if (major !== 1) {
7744
- throwError(state, "unacceptable YAML version of the document");
7745
- }
7746
- state.version = args[0];
7747
- state.checkLineBreaks = minor < 2;
7748
- if (minor !== 1 && minor !== 2) {
7749
- throwWarning(state, "unsupported YAML version of the document");
7750
- }
7751
- },
7752
- TAG: function handleTagDirective(state, name, args) {
7753
- var handle, prefix;
7754
- if (args.length !== 2) {
7755
- throwError(state, "TAG directive accepts exactly two arguments");
7756
- }
7757
- handle = args[0];
7758
- prefix = args[1];
7759
- if (!PATTERN_TAG_HANDLE.test(handle)) {
7760
- throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
7761
- }
7762
- if (_hasOwnProperty.call(state.tagMap, handle)) {
7763
- throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
7764
- }
7765
- if (!PATTERN_TAG_URI.test(prefix)) {
7766
- throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
7767
- }
7768
- state.tagMap[handle] = prefix;
7769
- }
7770
- };
7771
- function captureSegment(state, start, end, checkJson) {
7772
- var _position, _length2, _character, _result;
7773
- if (start < end) {
7774
- _result = state.input.slice(start, end);
7775
- if (checkJson) {
7776
- for (_position = 0, _length2 = _result.length;_position < _length2; _position += 1) {
7777
- _character = _result.charCodeAt(_position);
7778
- if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
7779
- throwError(state, "expected valid JSON character");
7780
- }
7781
- }
7782
- } else if (PATTERN_NON_PRINTABLE.test(_result)) {
7783
- throwError(state, "the stream contains non-printable characters");
7784
- }
7785
- state.result += _result;
7786
- }
7787
- }
7788
- function mergeMappings(state, destination, source, overridableKeys) {
7789
- var sourceKeys, key, index, quantity;
7790
- if (!common.isObject(source)) {
7791
- throwError(state, "cannot merge mappings; the provided source object is unacceptable");
7792
- }
7793
- sourceKeys = Object.keys(source);
7794
- for (index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
7795
- key = sourceKeys[index];
7796
- if (!_hasOwnProperty.call(destination, key)) {
7797
- setProperty(destination, key, source[key]);
7798
- overridableKeys[key] = true;
7799
- }
7800
- }
7801
- }
7802
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
7803
- var index, quantity;
7804
- if (Array.isArray(keyNode)) {
7805
- keyNode = Array.prototype.slice.call(keyNode);
7806
- for (index = 0, quantity = keyNode.length;index < quantity; index += 1) {
7807
- if (Array.isArray(keyNode[index])) {
7808
- throwError(state, "nested arrays are not supported inside keys");
7809
- }
7810
- if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
7811
- keyNode[index] = "[object Object]";
7812
- }
7813
- }
7814
- }
7815
- if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
7816
- keyNode = "[object Object]";
7817
- }
7818
- keyNode = String(keyNode);
7819
- if (_result === null) {
7820
- _result = {};
7821
- }
7822
- if (keyTag === "tag:yaml.org,2002:merge") {
7823
- if (Array.isArray(valueNode)) {
7824
- for (index = 0, quantity = valueNode.length;index < quantity; index += 1) {
7825
- mergeMappings(state, _result, valueNode[index], overridableKeys);
7826
- }
7827
- } else {
7828
- mergeMappings(state, _result, valueNode, overridableKeys);
7829
- }
7830
- } else {
7831
- if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
7832
- state.line = startLine || state.line;
7833
- state.position = startPos || state.position;
7834
- throwError(state, "duplicated mapping key");
7835
- }
7836
- setProperty(_result, keyNode, valueNode);
7837
- delete overridableKeys[keyNode];
7838
- }
7839
- return _result;
7840
- }
7841
- function readLineBreak(state) {
7842
- var ch;
7843
- ch = state.input.charCodeAt(state.position);
7844
- if (ch === 10) {
7845
- state.position++;
7846
- } else if (ch === 13) {
7847
- state.position++;
7848
- if (state.input.charCodeAt(state.position) === 10) {
7849
- state.position++;
7850
- }
7851
- } else {
7852
- throwError(state, "a line break is expected");
7853
- }
7854
- state.line += 1;
7855
- state.lineStart = state.position;
7856
- }
7857
- function skipSeparationSpace(state, allowComments, checkIndent) {
7858
- var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
7859
- while (ch !== 0) {
7860
- while (is_WHITE_SPACE(ch)) {
7861
- ch = state.input.charCodeAt(++state.position);
7862
- }
7863
- if (allowComments && ch === 35) {
7864
- do {
7865
- ch = state.input.charCodeAt(++state.position);
7866
- } while (ch !== 10 && ch !== 13 && ch !== 0);
7867
- }
7868
- if (is_EOL(ch)) {
7869
- readLineBreak(state);
7870
- ch = state.input.charCodeAt(state.position);
7871
- lineBreaks++;
7872
- state.lineIndent = 0;
7873
- while (ch === 32) {
7874
- state.lineIndent++;
7875
- ch = state.input.charCodeAt(++state.position);
7876
- }
7877
- } else {
7878
- break;
7879
- }
7880
- }
7881
- if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
7882
- throwWarning(state, "deficient indentation");
7883
- }
7884
- return lineBreaks;
7885
- }
7886
- function testDocumentSeparator(state) {
7887
- var _position = state.position, ch;
7888
- ch = state.input.charCodeAt(_position);
7889
- if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
7890
- _position += 3;
7891
- ch = state.input.charCodeAt(_position);
7892
- if (ch === 0 || is_WS_OR_EOL(ch)) {
7893
- return true;
7894
- }
7895
- }
7896
- return false;
7897
- }
7898
- function writeFoldedLines(state, count) {
7899
- if (count === 1) {
7900
- state.result += " ";
7901
- } else if (count > 1) {
7902
- state.result += common.repeat(`
7903
- `, count - 1);
7904
- }
7905
- }
7906
- function readPlainScalar(state, nodeIndent, withinFlowCollection) {
7907
- var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
7908
- ch = state.input.charCodeAt(state.position);
7909
- if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
7910
- return false;
7911
- }
7912
- if (ch === 63 || ch === 45) {
7913
- following = state.input.charCodeAt(state.position + 1);
7914
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
7915
- return false;
7916
- }
7917
- }
7918
- state.kind = "scalar";
7919
- state.result = "";
7920
- captureStart = captureEnd = state.position;
7921
- hasPendingContent = false;
7922
- while (ch !== 0) {
7923
- if (ch === 58) {
7924
- following = state.input.charCodeAt(state.position + 1);
7925
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
7926
- break;
7927
- }
7928
- } else if (ch === 35) {
7929
- preceding = state.input.charCodeAt(state.position - 1);
7930
- if (is_WS_OR_EOL(preceding)) {
7931
- break;
7932
- }
7933
- } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
7934
- break;
7935
- } else if (is_EOL(ch)) {
7936
- _line = state.line;
7937
- _lineStart = state.lineStart;
7938
- _lineIndent = state.lineIndent;
7939
- skipSeparationSpace(state, false, -1);
7940
- if (state.lineIndent >= nodeIndent) {
7941
- hasPendingContent = true;
7942
- ch = state.input.charCodeAt(state.position);
7943
- continue;
7944
- } else {
7945
- state.position = captureEnd;
7946
- state.line = _line;
7947
- state.lineStart = _lineStart;
7948
- state.lineIndent = _lineIndent;
7949
- break;
7950
- }
7951
- }
7952
- if (hasPendingContent) {
7953
- captureSegment(state, captureStart, captureEnd, false);
7954
- writeFoldedLines(state, state.line - _line);
7955
- captureStart = captureEnd = state.position;
7956
- hasPendingContent = false;
7957
- }
7958
- if (!is_WHITE_SPACE(ch)) {
7959
- captureEnd = state.position + 1;
7960
- }
7961
- ch = state.input.charCodeAt(++state.position);
7962
- }
7963
- captureSegment(state, captureStart, captureEnd, false);
7964
- if (state.result) {
7965
- return true;
7966
- }
7967
- state.kind = _kind;
7968
- state.result = _result;
7969
- return false;
7970
- }
7971
- function readSingleQuotedScalar(state, nodeIndent) {
7972
- var ch, captureStart, captureEnd;
7973
- ch = state.input.charCodeAt(state.position);
7974
- if (ch !== 39) {
7975
- return false;
7976
- }
7977
- state.kind = "scalar";
7978
- state.result = "";
7979
- state.position++;
7980
- captureStart = captureEnd = state.position;
7981
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
7982
- if (ch === 39) {
7983
- captureSegment(state, captureStart, state.position, true);
7984
- ch = state.input.charCodeAt(++state.position);
7985
- if (ch === 39) {
7986
- captureStart = state.position;
7987
- state.position++;
7988
- captureEnd = state.position;
7989
- } else {
7990
- return true;
7991
- }
7992
- } else if (is_EOL(ch)) {
7993
- captureSegment(state, captureStart, captureEnd, true);
7994
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
7995
- captureStart = captureEnd = state.position;
7996
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
7997
- throwError(state, "unexpected end of the document within a single quoted scalar");
7998
- } else {
7999
- state.position++;
8000
- captureEnd = state.position;
8001
- }
8002
- }
8003
- throwError(state, "unexpected end of the stream within a single quoted scalar");
8004
- }
8005
- function readDoubleQuotedScalar(state, nodeIndent) {
8006
- var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
8007
- ch = state.input.charCodeAt(state.position);
8008
- if (ch !== 34) {
8009
- return false;
8010
- }
8011
- state.kind = "scalar";
8012
- state.result = "";
8013
- state.position++;
8014
- captureStart = captureEnd = state.position;
8015
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
8016
- if (ch === 34) {
8017
- captureSegment(state, captureStart, state.position, true);
8018
- state.position++;
8019
- return true;
8020
- } else if (ch === 92) {
8021
- captureSegment(state, captureStart, state.position, true);
8022
- ch = state.input.charCodeAt(++state.position);
8023
- if (is_EOL(ch)) {
8024
- skipSeparationSpace(state, false, nodeIndent);
8025
- } else if (ch < 256 && simpleEscapeCheck[ch]) {
8026
- state.result += simpleEscapeMap[ch];
8027
- state.position++;
8028
- } else if ((tmp = escapedHexLen(ch)) > 0) {
8029
- hexLength = tmp;
8030
- hexResult = 0;
8031
- for (;hexLength > 0; hexLength--) {
8032
- ch = state.input.charCodeAt(++state.position);
8033
- if ((tmp = fromHexCode(ch)) >= 0) {
8034
- hexResult = (hexResult << 4) + tmp;
8035
- } else {
8036
- throwError(state, "expected hexadecimal character");
8037
- }
8038
- }
8039
- state.result += charFromCodepoint(hexResult);
8040
- state.position++;
8041
- } else {
8042
- throwError(state, "unknown escape sequence");
8043
- }
8044
- captureStart = captureEnd = state.position;
8045
- } else if (is_EOL(ch)) {
8046
- captureSegment(state, captureStart, captureEnd, true);
8047
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
8048
- captureStart = captureEnd = state.position;
8049
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
8050
- throwError(state, "unexpected end of the document within a double quoted scalar");
8051
- } else {
8052
- state.position++;
8053
- captureEnd = state.position;
8054
- }
8055
- }
8056
- throwError(state, "unexpected end of the stream within a double quoted scalar");
8057
- }
8058
- function readFlowCollection(state, nodeIndent) {
8059
- var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch;
8060
- ch = state.input.charCodeAt(state.position);
8061
- if (ch === 91) {
8062
- terminator = 93;
8063
- isMapping = false;
8064
- _result = [];
8065
- } else if (ch === 123) {
8066
- terminator = 125;
8067
- isMapping = true;
8068
- _result = {};
8069
- } else {
8070
- return false;
8071
- }
8072
- if (state.anchor !== null) {
8073
- state.anchorMap[state.anchor] = _result;
8074
- }
8075
- ch = state.input.charCodeAt(++state.position);
8076
- while (ch !== 0) {
8077
- skipSeparationSpace(state, true, nodeIndent);
8078
- ch = state.input.charCodeAt(state.position);
8079
- if (ch === terminator) {
8080
- state.position++;
8081
- state.tag = _tag;
8082
- state.anchor = _anchor;
8083
- state.kind = isMapping ? "mapping" : "sequence";
8084
- state.result = _result;
8085
- return true;
8086
- } else if (!readNext) {
8087
- throwError(state, "missed comma between flow collection entries");
8088
- }
8089
- keyTag = keyNode = valueNode = null;
8090
- isPair = isExplicitPair = false;
8091
- if (ch === 63) {
8092
- following = state.input.charCodeAt(state.position + 1);
8093
- if (is_WS_OR_EOL(following)) {
8094
- isPair = isExplicitPair = true;
8095
- state.position++;
8096
- skipSeparationSpace(state, true, nodeIndent);
8097
- }
8098
- }
8099
- _line = state.line;
8100
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
8101
- keyTag = state.tag;
8102
- keyNode = state.result;
8103
- skipSeparationSpace(state, true, nodeIndent);
8104
- ch = state.input.charCodeAt(state.position);
8105
- if ((isExplicitPair || state.line === _line) && ch === 58) {
8106
- isPair = true;
8107
- ch = state.input.charCodeAt(++state.position);
8108
- skipSeparationSpace(state, true, nodeIndent);
8109
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
8110
- valueNode = state.result;
8111
- }
8112
- if (isMapping) {
8113
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
8114
- } else if (isPair) {
8115
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
8116
- } else {
8117
- _result.push(keyNode);
8118
- }
8119
- skipSeparationSpace(state, true, nodeIndent);
8120
- ch = state.input.charCodeAt(state.position);
8121
- if (ch === 44) {
8122
- readNext = true;
8123
- ch = state.input.charCodeAt(++state.position);
8124
- } else {
8125
- readNext = false;
8126
- }
8127
- }
8128
- throwError(state, "unexpected end of the stream within a flow collection");
8129
- }
8130
- function readBlockScalar(state, nodeIndent) {
8131
- var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
8132
- ch = state.input.charCodeAt(state.position);
8133
- if (ch === 124) {
8134
- folding = false;
8135
- } else if (ch === 62) {
8136
- folding = true;
8137
- } else {
8138
- return false;
8139
- }
8140
- state.kind = "scalar";
8141
- state.result = "";
8142
- while (ch !== 0) {
8143
- ch = state.input.charCodeAt(++state.position);
8144
- if (ch === 43 || ch === 45) {
8145
- if (CHOMPING_CLIP === chomping) {
8146
- chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
8147
- } else {
8148
- throwError(state, "repeat of a chomping mode identifier");
8149
- }
8150
- } else if ((tmp = fromDecimalCode(ch)) >= 0) {
8151
- if (tmp === 0) {
8152
- throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
8153
- } else if (!detectedIndent) {
8154
- textIndent = nodeIndent + tmp - 1;
8155
- detectedIndent = true;
8156
- } else {
8157
- throwError(state, "repeat of an indentation width identifier");
8158
- }
8159
- } else {
8160
- break;
8161
- }
8162
- }
8163
- if (is_WHITE_SPACE(ch)) {
8164
- do {
8165
- ch = state.input.charCodeAt(++state.position);
8166
- } while (is_WHITE_SPACE(ch));
8167
- if (ch === 35) {
8168
- do {
8169
- ch = state.input.charCodeAt(++state.position);
8170
- } while (!is_EOL(ch) && ch !== 0);
8171
- }
8172
- }
8173
- while (ch !== 0) {
8174
- readLineBreak(state);
8175
- state.lineIndent = 0;
8176
- ch = state.input.charCodeAt(state.position);
8177
- while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
8178
- state.lineIndent++;
8179
- ch = state.input.charCodeAt(++state.position);
8180
- }
8181
- if (!detectedIndent && state.lineIndent > textIndent) {
8182
- textIndent = state.lineIndent;
8183
- }
8184
- if (is_EOL(ch)) {
8185
- emptyLines++;
8186
- continue;
8187
- }
8188
- if (state.lineIndent < textIndent) {
8189
- if (chomping === CHOMPING_KEEP) {
8190
- state.result += common.repeat(`
8191
- `, didReadContent ? 1 + emptyLines : emptyLines);
8192
- } else if (chomping === CHOMPING_CLIP) {
8193
- if (didReadContent) {
8194
- state.result += `
8195
- `;
8196
- }
8197
- }
8198
- break;
8199
- }
8200
- if (folding) {
8201
- if (is_WHITE_SPACE(ch)) {
8202
- atMoreIndented = true;
8203
- state.result += common.repeat(`
8204
- `, didReadContent ? 1 + emptyLines : emptyLines);
8205
- } else if (atMoreIndented) {
8206
- atMoreIndented = false;
8207
- state.result += common.repeat(`
8208
- `, emptyLines + 1);
8209
- } else if (emptyLines === 0) {
8210
- if (didReadContent) {
8211
- state.result += " ";
8212
- }
8213
- } else {
8214
- state.result += common.repeat(`
8215
- `, emptyLines);
8216
- }
8217
- } else {
8218
- state.result += common.repeat(`
8219
- `, didReadContent ? 1 + emptyLines : emptyLines);
8220
- }
8221
- didReadContent = true;
8222
- detectedIndent = true;
8223
- emptyLines = 0;
8224
- captureStart = state.position;
8225
- while (!is_EOL(ch) && ch !== 0) {
8226
- ch = state.input.charCodeAt(++state.position);
8227
- }
8228
- captureSegment(state, captureStart, state.position, false);
8229
- }
8230
- return true;
8231
- }
8232
- function readBlockSequence(state, nodeIndent) {
8233
- var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
8234
- if (state.anchor !== null) {
8235
- state.anchorMap[state.anchor] = _result;
8236
- }
8237
- ch = state.input.charCodeAt(state.position);
8238
- while (ch !== 0) {
8239
- if (ch !== 45) {
8240
- break;
8241
- }
8242
- following = state.input.charCodeAt(state.position + 1);
8243
- if (!is_WS_OR_EOL(following)) {
8244
- break;
8245
- }
8246
- detected = true;
8247
- state.position++;
8248
- if (skipSeparationSpace(state, true, -1)) {
8249
- if (state.lineIndent <= nodeIndent) {
8250
- _result.push(null);
8251
- ch = state.input.charCodeAt(state.position);
8252
- continue;
8253
- }
8254
- }
8255
- _line = state.line;
8256
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
8257
- _result.push(state.result);
8258
- skipSeparationSpace(state, true, -1);
8259
- ch = state.input.charCodeAt(state.position);
8260
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
8261
- throwError(state, "bad indentation of a sequence entry");
8262
- } else if (state.lineIndent < nodeIndent) {
8263
- break;
8264
- }
8265
- }
8266
- if (detected) {
8267
- state.tag = _tag;
8268
- state.anchor = _anchor;
8269
- state.kind = "sequence";
8270
- state.result = _result;
8271
- return true;
8272
- }
8273
- return false;
8274
- }
8275
- function readBlockMapping(state, nodeIndent, flowIndent) {
8276
- var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
8277
- if (state.anchor !== null) {
8278
- state.anchorMap[state.anchor] = _result;
8279
- }
8280
- ch = state.input.charCodeAt(state.position);
8281
- while (ch !== 0) {
8282
- following = state.input.charCodeAt(state.position + 1);
8283
- _line = state.line;
8284
- _pos = state.position;
8285
- if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
8286
- if (ch === 63) {
8287
- if (atExplicitKey) {
8288
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
8289
- keyTag = keyNode = valueNode = null;
8290
- }
8291
- detected = true;
8292
- atExplicitKey = true;
8293
- allowCompact = true;
8294
- } else if (atExplicitKey) {
8295
- atExplicitKey = false;
8296
- allowCompact = true;
8297
- } else {
8298
- throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
8299
- }
8300
- state.position += 1;
8301
- ch = following;
8302
- } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
8303
- if (state.line === _line) {
8304
- ch = state.input.charCodeAt(state.position);
8305
- while (is_WHITE_SPACE(ch)) {
8306
- ch = state.input.charCodeAt(++state.position);
8307
- }
8308
- if (ch === 58) {
8309
- ch = state.input.charCodeAt(++state.position);
8310
- if (!is_WS_OR_EOL(ch)) {
8311
- throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
8312
- }
8313
- if (atExplicitKey) {
8314
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
8315
- keyTag = keyNode = valueNode = null;
8316
- }
8317
- detected = true;
8318
- atExplicitKey = false;
8319
- allowCompact = false;
8320
- keyTag = state.tag;
8321
- keyNode = state.result;
8322
- } else if (detected) {
8323
- throwError(state, "can not read an implicit mapping pair; a colon is missed");
8324
- } else {
8325
- state.tag = _tag;
8326
- state.anchor = _anchor;
8327
- return true;
8328
- }
8329
- } else if (detected) {
8330
- throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
8331
- } else {
8332
- state.tag = _tag;
8333
- state.anchor = _anchor;
8334
- return true;
8335
- }
8336
- } else {
8337
- break;
8338
- }
8339
- if (state.line === _line || state.lineIndent > nodeIndent) {
8340
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
8341
- if (atExplicitKey) {
8342
- keyNode = state.result;
8343
- } else {
8344
- valueNode = state.result;
8345
- }
8346
- }
8347
- if (!atExplicitKey) {
8348
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
8349
- keyTag = keyNode = valueNode = null;
8350
- }
8351
- skipSeparationSpace(state, true, -1);
8352
- ch = state.input.charCodeAt(state.position);
8353
- }
8354
- if (state.lineIndent > nodeIndent && ch !== 0) {
8355
- throwError(state, "bad indentation of a mapping entry");
8356
- } else if (state.lineIndent < nodeIndent) {
8357
- break;
8358
- }
8359
- }
8360
- if (atExplicitKey) {
8361
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
8362
- }
8363
- if (detected) {
8364
- state.tag = _tag;
8365
- state.anchor = _anchor;
8366
- state.kind = "mapping";
8367
- state.result = _result;
8368
- }
8369
- return detected;
8370
- }
8371
- function readTagProperty(state) {
8372
- var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
8373
- ch = state.input.charCodeAt(state.position);
8374
- if (ch !== 33)
8375
- return false;
8376
- if (state.tag !== null) {
8377
- throwError(state, "duplication of a tag property");
8378
- }
8379
- ch = state.input.charCodeAt(++state.position);
8380
- if (ch === 60) {
8381
- isVerbatim = true;
8382
- ch = state.input.charCodeAt(++state.position);
8383
- } else if (ch === 33) {
8384
- isNamed = true;
8385
- tagHandle = "!!";
8386
- ch = state.input.charCodeAt(++state.position);
8387
- } else {
8388
- tagHandle = "!";
8389
- }
8390
- _position = state.position;
8391
- if (isVerbatim) {
8392
- do {
8393
- ch = state.input.charCodeAt(++state.position);
8394
- } while (ch !== 0 && ch !== 62);
8395
- if (state.position < state.length) {
8396
- tagName = state.input.slice(_position, state.position);
8397
- ch = state.input.charCodeAt(++state.position);
8398
- } else {
8399
- throwError(state, "unexpected end of the stream within a verbatim tag");
8400
- }
8401
- } else {
8402
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
8403
- if (ch === 33) {
8404
- if (!isNamed) {
8405
- tagHandle = state.input.slice(_position - 1, state.position + 1);
8406
- if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
8407
- throwError(state, "named tag handle cannot contain such characters");
8408
- }
8409
- isNamed = true;
8410
- _position = state.position + 1;
8411
- } else {
8412
- throwError(state, "tag suffix cannot contain exclamation marks");
8413
- }
8414
- }
8415
- ch = state.input.charCodeAt(++state.position);
8416
- }
8417
- tagName = state.input.slice(_position, state.position);
8418
- if (PATTERN_FLOW_INDICATORS.test(tagName)) {
8419
- throwError(state, "tag suffix cannot contain flow indicator characters");
8420
- }
8421
- }
8422
- if (tagName && !PATTERN_TAG_URI.test(tagName)) {
8423
- throwError(state, "tag name cannot contain such characters: " + tagName);
8424
- }
8425
- if (isVerbatim) {
8426
- state.tag = tagName;
8427
- } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
8428
- state.tag = state.tagMap[tagHandle] + tagName;
8429
- } else if (tagHandle === "!") {
8430
- state.tag = "!" + tagName;
8431
- } else if (tagHandle === "!!") {
8432
- state.tag = "tag:yaml.org,2002:" + tagName;
8433
- } else {
8434
- throwError(state, 'undeclared tag handle "' + tagHandle + '"');
8435
- }
8436
- return true;
8437
- }
8438
- function readAnchorProperty(state) {
8439
- var _position, ch;
8440
- ch = state.input.charCodeAt(state.position);
8441
- if (ch !== 38)
8442
- return false;
8443
- if (state.anchor !== null) {
8444
- throwError(state, "duplication of an anchor property");
8445
- }
8446
- ch = state.input.charCodeAt(++state.position);
8447
- _position = state.position;
8448
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
8449
- ch = state.input.charCodeAt(++state.position);
8450
- }
8451
- if (state.position === _position) {
8452
- throwError(state, "name of an anchor node must contain at least one character");
8453
- }
8454
- state.anchor = state.input.slice(_position, state.position);
8455
- return true;
8456
- }
8457
- function readAlias(state) {
8458
- var _position, alias, ch;
8459
- ch = state.input.charCodeAt(state.position);
8460
- if (ch !== 42)
8461
- return false;
8462
- ch = state.input.charCodeAt(++state.position);
8463
- _position = state.position;
8464
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
8465
- ch = state.input.charCodeAt(++state.position);
8466
- }
8467
- if (state.position === _position) {
8468
- throwError(state, "name of an alias node must contain at least one character");
8469
- }
8470
- alias = state.input.slice(_position, state.position);
8471
- if (!_hasOwnProperty.call(state.anchorMap, alias)) {
8472
- throwError(state, 'unidentified alias "' + alias + '"');
8473
- }
8474
- state.result = state.anchorMap[alias];
8475
- skipSeparationSpace(state, true, -1);
8476
- return true;
8477
- }
8478
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
8479
- var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent;
8480
- if (state.listener !== null) {
8481
- state.listener("open", state);
8482
- }
8483
- state.tag = null;
8484
- state.anchor = null;
8485
- state.kind = null;
8486
- state.result = null;
8487
- allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
8488
- if (allowToSeek) {
8489
- if (skipSeparationSpace(state, true, -1)) {
8490
- atNewLine = true;
8491
- if (state.lineIndent > parentIndent) {
8492
- indentStatus = 1;
8493
- } else if (state.lineIndent === parentIndent) {
8494
- indentStatus = 0;
8495
- } else if (state.lineIndent < parentIndent) {
8496
- indentStatus = -1;
8497
- }
8498
- }
8499
- }
8500
- if (indentStatus === 1) {
8501
- while (readTagProperty(state) || readAnchorProperty(state)) {
8502
- if (skipSeparationSpace(state, true, -1)) {
8503
- atNewLine = true;
8504
- allowBlockCollections = allowBlockStyles;
8505
- if (state.lineIndent > parentIndent) {
8506
- indentStatus = 1;
8507
- } else if (state.lineIndent === parentIndent) {
8508
- indentStatus = 0;
8509
- } else if (state.lineIndent < parentIndent) {
8510
- indentStatus = -1;
8511
- }
8512
- } else {
8513
- allowBlockCollections = false;
8514
- }
8515
- }
8516
- }
8517
- if (allowBlockCollections) {
8518
- allowBlockCollections = atNewLine || allowCompact;
8519
- }
8520
- if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
8521
- if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
8522
- flowIndent = parentIndent;
8523
- } else {
8524
- flowIndent = parentIndent + 1;
8525
- }
8526
- blockIndent = state.position - state.lineStart;
8527
- if (indentStatus === 1) {
8528
- if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
8529
- hasContent = true;
8530
- } else {
8531
- if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
8532
- hasContent = true;
8533
- } else if (readAlias(state)) {
8534
- hasContent = true;
8535
- if (state.tag !== null || state.anchor !== null) {
8536
- throwError(state, "alias node should not have any properties");
8537
- }
8538
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
8539
- hasContent = true;
8540
- if (state.tag === null) {
8541
- state.tag = "?";
8542
- }
8543
- }
8544
- if (state.anchor !== null) {
8545
- state.anchorMap[state.anchor] = state.result;
8546
- }
8547
- }
8548
- } else if (indentStatus === 0) {
8549
- hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
8550
- }
8551
- }
8552
- if (state.tag !== null && state.tag !== "!") {
8553
- if (state.tag === "?") {
8554
- if (state.result !== null && state.kind !== "scalar") {
8555
- throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
8556
- }
8557
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length;typeIndex < typeQuantity; typeIndex += 1) {
8558
- type = state.implicitTypes[typeIndex];
8559
- if (type.resolve(state.result)) {
8560
- state.result = type.construct(state.result);
8561
- state.tag = type.tag;
8562
- if (state.anchor !== null) {
8563
- state.anchorMap[state.anchor] = state.result;
8564
- }
8565
- break;
8566
- }
8567
- }
8568
- } else if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
8569
- type = state.typeMap[state.kind || "fallback"][state.tag];
8570
- if (state.result !== null && type.kind !== state.kind) {
8571
- throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
8572
- }
8573
- if (!type.resolve(state.result)) {
8574
- throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
8575
- } else {
8576
- state.result = type.construct(state.result);
8577
- if (state.anchor !== null) {
8578
- state.anchorMap[state.anchor] = state.result;
8579
- }
8580
- }
8581
- } else {
8582
- throwError(state, "unknown tag !<" + state.tag + ">");
8583
- }
8584
- }
8585
- if (state.listener !== null) {
8586
- state.listener("close", state);
8587
- }
8588
- return state.tag !== null || state.anchor !== null || hasContent;
8589
- }
8590
- function readDocument(state) {
8591
- var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
8592
- state.version = null;
8593
- state.checkLineBreaks = state.legacy;
8594
- state.tagMap = {};
8595
- state.anchorMap = {};
8596
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
8597
- skipSeparationSpace(state, true, -1);
8598
- ch = state.input.charCodeAt(state.position);
8599
- if (state.lineIndent > 0 || ch !== 37) {
8600
- break;
8601
- }
8602
- hasDirectives = true;
8603
- ch = state.input.charCodeAt(++state.position);
8604
- _position = state.position;
8605
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
8606
- ch = state.input.charCodeAt(++state.position);
8607
- }
8608
- directiveName = state.input.slice(_position, state.position);
8609
- directiveArgs = [];
8610
- if (directiveName.length < 1) {
8611
- throwError(state, "directive name must not be less than one character in length");
8612
- }
8613
- while (ch !== 0) {
8614
- while (is_WHITE_SPACE(ch)) {
8615
- ch = state.input.charCodeAt(++state.position);
8616
- }
8617
- if (ch === 35) {
8618
- do {
8619
- ch = state.input.charCodeAt(++state.position);
8620
- } while (ch !== 0 && !is_EOL(ch));
8621
- break;
8622
- }
8623
- if (is_EOL(ch))
8624
- break;
8625
- _position = state.position;
8626
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
8627
- ch = state.input.charCodeAt(++state.position);
8628
- }
8629
- directiveArgs.push(state.input.slice(_position, state.position));
8630
- }
8631
- if (ch !== 0)
8632
- readLineBreak(state);
8633
- if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
8634
- directiveHandlers[directiveName](state, directiveName, directiveArgs);
8635
- } else {
8636
- throwWarning(state, 'unknown document directive "' + directiveName + '"');
8637
- }
8638
- }
8639
- skipSeparationSpace(state, true, -1);
8640
- if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
8641
- state.position += 3;
8642
- skipSeparationSpace(state, true, -1);
8643
- } else if (hasDirectives) {
8644
- throwError(state, "directives end mark is expected");
8645
- }
8646
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
8647
- skipSeparationSpace(state, true, -1);
8648
- if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
8649
- throwWarning(state, "non-ASCII line breaks are interpreted as content");
8650
- }
8651
- state.documents.push(state.result);
8652
- if (state.position === state.lineStart && testDocumentSeparator(state)) {
8653
- if (state.input.charCodeAt(state.position) === 46) {
8654
- state.position += 3;
8655
- skipSeparationSpace(state, true, -1);
8656
- }
8657
- return;
8658
- }
8659
- if (state.position < state.length - 1) {
8660
- throwError(state, "end of the stream or a document separator is expected");
8661
- } else {
8662
- return;
8663
- }
8664
- }
8665
- function loadDocuments(input, options) {
8666
- input = String(input);
8667
- options = options || {};
8668
- if (input.length !== 0) {
8669
- if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
8670
- input += `
8671
- `;
8672
- }
8673
- if (input.charCodeAt(0) === 65279) {
8674
- input = input.slice(1);
8675
- }
8676
- }
8677
- var state = new State(input, options);
8678
- var nullpos = input.indexOf("\x00");
8679
- if (nullpos !== -1) {
8680
- state.position = nullpos;
8681
- throwError(state, "null byte is not allowed in input");
8682
- }
8683
- state.input += "\x00";
8684
- while (state.input.charCodeAt(state.position) === 32) {
8685
- state.lineIndent += 1;
8686
- state.position += 1;
8687
- }
8688
- while (state.position < state.length - 1) {
8689
- readDocument(state);
8690
- }
8691
- return state.documents;
8692
- }
8693
- function loadAll(input, iterator, options) {
8694
- if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
8695
- options = iterator;
8696
- iterator = null;
8697
- }
8698
- var documents = loadDocuments(input, options);
8699
- if (typeof iterator !== "function") {
8700
- return documents;
8701
- }
8702
- for (var index = 0, length = documents.length;index < length; index += 1) {
8703
- iterator(documents[index]);
8704
- }
8705
- }
8706
- function load(input, options) {
8707
- var documents = loadDocuments(input, options);
8708
- if (documents.length === 0) {
8709
- return;
8710
- } else if (documents.length === 1) {
8711
- return documents[0];
8712
- }
8713
- throw new YAMLException("expected a single document in the stream, but found more");
8714
- }
8715
- function safeLoadAll(input, iterator, options) {
8716
- if (typeof iterator === "object" && iterator !== null && typeof options === "undefined") {
8717
- options = iterator;
8718
- iterator = null;
8719
- }
8720
- return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
8721
- }
8722
- function safeLoad(input, options) {
8723
- return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
8724
- }
8725
- exports.loadAll = loadAll;
8726
- exports.load = load;
8727
- exports.safeLoadAll = safeLoadAll;
8728
- exports.safeLoad = safeLoad;
8729
- });
8730
-
8731
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/dumper.js
8732
- var require_dumper = __commonJS((exports, module) => {
8733
- var common = require_common();
8734
- var YAMLException = require_exception();
8735
- var DEFAULT_FULL_SCHEMA = require_default_full();
8736
- var DEFAULT_SAFE_SCHEMA = require_default_safe();
8737
- var _toString = Object.prototype.toString;
8738
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
8739
- var CHAR_TAB = 9;
8740
- var CHAR_LINE_FEED = 10;
8741
- var CHAR_CARRIAGE_RETURN = 13;
8742
- var CHAR_SPACE = 32;
8743
- var CHAR_EXCLAMATION = 33;
8744
- var CHAR_DOUBLE_QUOTE = 34;
8745
- var CHAR_SHARP = 35;
8746
- var CHAR_PERCENT = 37;
8747
- var CHAR_AMPERSAND = 38;
8748
- var CHAR_SINGLE_QUOTE = 39;
8749
- var CHAR_ASTERISK = 42;
8750
- var CHAR_COMMA = 44;
8751
- var CHAR_MINUS = 45;
8752
- var CHAR_COLON = 58;
8753
- var CHAR_EQUALS = 61;
8754
- var CHAR_GREATER_THAN = 62;
8755
- var CHAR_QUESTION = 63;
8756
- var CHAR_COMMERCIAL_AT = 64;
8757
- var CHAR_LEFT_SQUARE_BRACKET = 91;
8758
- var CHAR_RIGHT_SQUARE_BRACKET = 93;
8759
- var CHAR_GRAVE_ACCENT = 96;
8760
- var CHAR_LEFT_CURLY_BRACKET = 123;
8761
- var CHAR_VERTICAL_LINE = 124;
8762
- var CHAR_RIGHT_CURLY_BRACKET = 125;
8763
- var ESCAPE_SEQUENCES = {};
8764
- ESCAPE_SEQUENCES[0] = "\\0";
8765
- ESCAPE_SEQUENCES[7] = "\\a";
8766
- ESCAPE_SEQUENCES[8] = "\\b";
8767
- ESCAPE_SEQUENCES[9] = "\\t";
8768
- ESCAPE_SEQUENCES[10] = "\\n";
8769
- ESCAPE_SEQUENCES[11] = "\\v";
8770
- ESCAPE_SEQUENCES[12] = "\\f";
8771
- ESCAPE_SEQUENCES[13] = "\\r";
8772
- ESCAPE_SEQUENCES[27] = "\\e";
8773
- ESCAPE_SEQUENCES[34] = "\\\"";
8774
- ESCAPE_SEQUENCES[92] = "\\\\";
8775
- ESCAPE_SEQUENCES[133] = "\\N";
8776
- ESCAPE_SEQUENCES[160] = "\\_";
8777
- ESCAPE_SEQUENCES[8232] = "\\L";
8778
- ESCAPE_SEQUENCES[8233] = "\\P";
8779
- var DEPRECATED_BOOLEANS_SYNTAX = [
8780
- "y",
8781
- "Y",
8782
- "yes",
8783
- "Yes",
8784
- "YES",
8785
- "on",
8786
- "On",
8787
- "ON",
8788
- "n",
8789
- "N",
8790
- "no",
8791
- "No",
8792
- "NO",
8793
- "off",
8794
- "Off",
8795
- "OFF"
8796
- ];
8797
- function compileStyleMap(schema, map2) {
8798
- var result, keys, index, length, tag, style, type;
8799
- if (map2 === null)
8800
- return {};
8801
- result = {};
8802
- keys = Object.keys(map2);
8803
- for (index = 0, length = keys.length;index < length; index += 1) {
8804
- tag = keys[index];
8805
- style = String(map2[tag]);
8806
- if (tag.slice(0, 2) === "!!") {
8807
- tag = "tag:yaml.org,2002:" + tag.slice(2);
8808
- }
8809
- type = schema.compiledTypeMap["fallback"][tag];
8810
- if (type && _hasOwnProperty.call(type.styleAliases, style)) {
8811
- style = type.styleAliases[style];
8812
- }
8813
- result[tag] = style;
8814
- }
8815
- return result;
8816
- }
8817
- function encodeHex(character) {
8818
- var string4, handle, length;
8819
- string4 = character.toString(16).toUpperCase();
8820
- if (character <= 255) {
8821
- handle = "x";
8822
- length = 2;
8823
- } else if (character <= 65535) {
8824
- handle = "u";
8825
- length = 4;
8826
- } else if (character <= 4294967295) {
8827
- handle = "U";
8828
- length = 8;
8829
- } else {
8830
- throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
8831
- }
8832
- return "\\" + handle + common.repeat("0", length - string4.length) + string4;
8833
- }
8834
- function State(options) {
8835
- this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
8836
- this.indent = Math.max(1, options["indent"] || 2);
8837
- this.noArrayIndent = options["noArrayIndent"] || false;
8838
- this.skipInvalid = options["skipInvalid"] || false;
8839
- this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
8840
- this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
8841
- this.sortKeys = options["sortKeys"] || false;
8842
- this.lineWidth = options["lineWidth"] || 80;
8843
- this.noRefs = options["noRefs"] || false;
8844
- this.noCompatMode = options["noCompatMode"] || false;
8845
- this.condenseFlow = options["condenseFlow"] || false;
8846
- this.implicitTypes = this.schema.compiledImplicit;
8847
- this.explicitTypes = this.schema.compiledExplicit;
8848
- this.tag = null;
8849
- this.result = "";
8850
- this.duplicates = [];
8851
- this.usedDuplicates = null;
8852
- }
8853
- function indentString(string4, spaces) {
8854
- var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string4.length;
8855
- while (position < length) {
8856
- next = string4.indexOf(`
8857
- `, position);
8858
- if (next === -1) {
8859
- line = string4.slice(position);
8860
- position = length;
8861
- } else {
8862
- line = string4.slice(position, next + 1);
8863
- position = next + 1;
8864
- }
8865
- if (line.length && line !== `
8866
- `)
8867
- result += ind;
8868
- result += line;
8869
- }
8870
- return result;
8871
- }
8872
- function generateNextLine(state, level) {
8873
- return `
8874
- ` + common.repeat(" ", state.indent * level);
8875
- }
8876
- function testImplicitResolving(state, str) {
8877
- var index, length, type;
8878
- for (index = 0, length = state.implicitTypes.length;index < length; index += 1) {
8879
- type = state.implicitTypes[index];
8880
- if (type.resolve(str)) {
8881
- return true;
8882
- }
8883
- }
8884
- return false;
8885
- }
8886
- function isWhitespace(c) {
8887
- return c === CHAR_SPACE || c === CHAR_TAB;
8888
- }
8889
- function isPrintable(c) {
8890
- return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
8891
- }
8892
- function isNsChar(c) {
8893
- return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
8894
- }
8895
- function isPlainSafe(c, prev) {
8896
- return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
8897
- }
8898
- function isPlainSafeFirst(c) {
8899
- return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
8900
- }
8901
- function needIndentIndicator(string4) {
8902
- var leadingSpaceRe = /^\n* /;
8903
- return leadingSpaceRe.test(string4);
8904
- }
8905
- var STYLE_PLAIN = 1;
8906
- var STYLE_SINGLE = 2;
8907
- var STYLE_LITERAL = 3;
8908
- var STYLE_FOLDED = 4;
8909
- var STYLE_DOUBLE = 5;
8910
- function chooseScalarStyle(string4, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
8911
- var i;
8912
- var char, prev_char;
8913
- var hasLineBreak = false;
8914
- var hasFoldableLine = false;
8915
- var shouldTrackWidth = lineWidth !== -1;
8916
- var previousLineBreak = -1;
8917
- var plain = isPlainSafeFirst(string4.charCodeAt(0)) && !isWhitespace(string4.charCodeAt(string4.length - 1));
8918
- if (singleLineOnly) {
8919
- for (i = 0;i < string4.length; i++) {
8920
- char = string4.charCodeAt(i);
8921
- if (!isPrintable(char)) {
8922
- return STYLE_DOUBLE;
8923
- }
8924
- prev_char = i > 0 ? string4.charCodeAt(i - 1) : null;
8925
- plain = plain && isPlainSafe(char, prev_char);
8926
- }
8927
- } else {
8928
- for (i = 0;i < string4.length; i++) {
8929
- char = string4.charCodeAt(i);
8930
- if (char === CHAR_LINE_FEED) {
8931
- hasLineBreak = true;
8932
- if (shouldTrackWidth) {
8933
- hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string4[previousLineBreak + 1] !== " ";
8934
- previousLineBreak = i;
8935
- }
8936
- } else if (!isPrintable(char)) {
8937
- return STYLE_DOUBLE;
8938
- }
8939
- prev_char = i > 0 ? string4.charCodeAt(i - 1) : null;
8940
- plain = plain && isPlainSafe(char, prev_char);
8941
- }
8942
- hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string4[previousLineBreak + 1] !== " ");
8943
- }
8944
- if (!hasLineBreak && !hasFoldableLine) {
8945
- return plain && !testAmbiguousType(string4) ? STYLE_PLAIN : STYLE_SINGLE;
8946
- }
8947
- if (indentPerLevel > 9 && needIndentIndicator(string4)) {
8948
- return STYLE_DOUBLE;
8949
- }
8950
- return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
8951
- }
8952
- function writeScalar(state, string4, level, iskey) {
8953
- state.dump = function() {
8954
- if (string4.length === 0) {
8955
- return "''";
8956
- }
8957
- if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string4) !== -1) {
8958
- return "'" + string4 + "'";
8959
- }
8960
- var indent = state.indent * Math.max(1, level);
8961
- var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
8962
- var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
8963
- function testAmbiguity(string5) {
8964
- return testImplicitResolving(state, string5);
8965
- }
8966
- switch (chooseScalarStyle(string4, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
8967
- case STYLE_PLAIN:
8968
- return string4;
8969
- case STYLE_SINGLE:
8970
- return "'" + string4.replace(/'/g, "''") + "'";
8971
- case STYLE_LITERAL:
8972
- return "|" + blockHeader(string4, state.indent) + dropEndingNewline(indentString(string4, indent));
8973
- case STYLE_FOLDED:
8974
- return ">" + blockHeader(string4, state.indent) + dropEndingNewline(indentString(foldString(string4, lineWidth), indent));
8975
- case STYLE_DOUBLE:
8976
- return '"' + escapeString(string4, lineWidth) + '"';
8977
- default:
8978
- throw new YAMLException("impossible error: invalid scalar style");
8979
- }
8980
- }();
8981
- }
8982
- function blockHeader(string4, indentPerLevel) {
8983
- var indentIndicator = needIndentIndicator(string4) ? String(indentPerLevel) : "";
8984
- var clip = string4[string4.length - 1] === `
8985
- `;
8986
- var keep = clip && (string4[string4.length - 2] === `
8987
- ` || string4 === `
8988
- `);
8989
- var chomp = keep ? "+" : clip ? "" : "-";
8990
- return indentIndicator + chomp + `
8991
- `;
8992
- }
8993
- function dropEndingNewline(string4) {
8994
- return string4[string4.length - 1] === `
8995
- ` ? string4.slice(0, -1) : string4;
8996
- }
8997
- function foldString(string4, width) {
8998
- var lineRe = /(\n+)([^\n]*)/g;
8999
- var result = function() {
9000
- var nextLF = string4.indexOf(`
9001
- `);
9002
- nextLF = nextLF !== -1 ? nextLF : string4.length;
9003
- lineRe.lastIndex = nextLF;
9004
- return foldLine(string4.slice(0, nextLF), width);
9005
- }();
9006
- var prevMoreIndented = string4[0] === `
9007
- ` || string4[0] === " ";
9008
- var moreIndented;
9009
- var match;
9010
- while (match = lineRe.exec(string4)) {
9011
- var prefix = match[1], line = match[2];
9012
- moreIndented = line[0] === " ";
9013
- result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
9014
- ` : "") + foldLine(line, width);
9015
- prevMoreIndented = moreIndented;
9016
- }
9017
- return result;
9018
- }
9019
- function foldLine(line, width) {
9020
- if (line === "" || line[0] === " ")
9021
- return line;
9022
- var breakRe = / [^ ]/g;
9023
- var match;
9024
- var start = 0, end, curr = 0, next = 0;
9025
- var result = "";
9026
- while (match = breakRe.exec(line)) {
9027
- next = match.index;
9028
- if (next - start > width) {
9029
- end = curr > start ? curr : next;
9030
- result += `
9031
- ` + line.slice(start, end);
9032
- start = end + 1;
9033
- }
9034
- curr = next;
9035
- }
9036
- result += `
9037
- `;
9038
- if (line.length - start > width && curr > start) {
9039
- result += line.slice(start, curr) + `
9040
- ` + line.slice(curr + 1);
9041
- } else {
9042
- result += line.slice(start);
9043
- }
9044
- return result.slice(1);
9045
- }
9046
- function escapeString(string4) {
9047
- var result = "";
9048
- var char, nextChar;
9049
- var escapeSeq;
9050
- for (var i = 0;i < string4.length; i++) {
9051
- char = string4.charCodeAt(i);
9052
- if (char >= 55296 && char <= 56319) {
9053
- nextChar = string4.charCodeAt(i + 1);
9054
- if (nextChar >= 56320 && nextChar <= 57343) {
9055
- result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
9056
- i++;
9057
- continue;
9058
- }
9059
- }
9060
- escapeSeq = ESCAPE_SEQUENCES[char];
9061
- result += !escapeSeq && isPrintable(char) ? string4[i] : escapeSeq || encodeHex(char);
9062
- }
9063
- return result;
9064
- }
9065
- function writeFlowSequence(state, level, object4) {
9066
- var _result = "", _tag = state.tag, index, length;
9067
- for (index = 0, length = object4.length;index < length; index += 1) {
9068
- if (writeNode(state, level, object4[index], false, false)) {
9069
- if (index !== 0)
9070
- _result += "," + (!state.condenseFlow ? " " : "");
9071
- _result += state.dump;
9072
- }
9073
- }
9074
- state.tag = _tag;
9075
- state.dump = "[" + _result + "]";
9076
- }
9077
- function writeBlockSequence(state, level, object4, compact) {
9078
- var _result = "", _tag = state.tag, index, length;
9079
- for (index = 0, length = object4.length;index < length; index += 1) {
9080
- if (writeNode(state, level + 1, object4[index], true, true)) {
9081
- if (!compact || index !== 0) {
9082
- _result += generateNextLine(state, level);
9083
- }
9084
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
9085
- _result += "-";
9086
- } else {
9087
- _result += "- ";
9088
- }
9089
- _result += state.dump;
9090
- }
9091
- }
9092
- state.tag = _tag;
9093
- state.dump = _result || "[]";
9094
- }
9095
- function writeFlowMapping(state, level, object4) {
9096
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object4), index, length, objectKey, objectValue, pairBuffer;
9097
- for (index = 0, length = objectKeyList.length;index < length; index += 1) {
9098
- pairBuffer = "";
9099
- if (index !== 0)
9100
- pairBuffer += ", ";
9101
- if (state.condenseFlow)
9102
- pairBuffer += '"';
9103
- objectKey = objectKeyList[index];
9104
- objectValue = object4[objectKey];
9105
- if (!writeNode(state, level, objectKey, false, false)) {
9106
- continue;
9107
- }
9108
- if (state.dump.length > 1024)
9109
- pairBuffer += "? ";
9110
- pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
9111
- if (!writeNode(state, level, objectValue, false, false)) {
9112
- continue;
9113
- }
9114
- pairBuffer += state.dump;
9115
- _result += pairBuffer;
9116
- }
9117
- state.tag = _tag;
9118
- state.dump = "{" + _result + "}";
9119
- }
9120
- function writeBlockMapping(state, level, object4, compact) {
9121
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object4), index, length, objectKey, objectValue, explicitPair, pairBuffer;
9122
- if (state.sortKeys === true) {
9123
- objectKeyList.sort();
9124
- } else if (typeof state.sortKeys === "function") {
9125
- objectKeyList.sort(state.sortKeys);
9126
- } else if (state.sortKeys) {
9127
- throw new YAMLException("sortKeys must be a boolean or a function");
9128
- }
9129
- for (index = 0, length = objectKeyList.length;index < length; index += 1) {
9130
- pairBuffer = "";
9131
- if (!compact || index !== 0) {
9132
- pairBuffer += generateNextLine(state, level);
9133
- }
9134
- objectKey = objectKeyList[index];
9135
- objectValue = object4[objectKey];
9136
- if (!writeNode(state, level + 1, objectKey, true, true, true)) {
9137
- continue;
9138
- }
9139
- explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
9140
- if (explicitPair) {
9141
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
9142
- pairBuffer += "?";
9143
- } else {
9144
- pairBuffer += "? ";
9145
- }
9146
- }
9147
- pairBuffer += state.dump;
9148
- if (explicitPair) {
9149
- pairBuffer += generateNextLine(state, level);
9150
- }
9151
- if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
9152
- continue;
9153
- }
9154
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
9155
- pairBuffer += ":";
9156
- } else {
9157
- pairBuffer += ": ";
9158
- }
9159
- pairBuffer += state.dump;
9160
- _result += pairBuffer;
9161
- }
9162
- state.tag = _tag;
9163
- state.dump = _result || "{}";
9164
- }
9165
- function detectType(state, object4, explicit) {
9166
- var _result, typeList, index, length, type, style;
9167
- typeList = explicit ? state.explicitTypes : state.implicitTypes;
9168
- for (index = 0, length = typeList.length;index < length; index += 1) {
9169
- type = typeList[index];
9170
- if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object4 === "object" && object4 instanceof type.instanceOf) && (!type.predicate || type.predicate(object4))) {
9171
- state.tag = explicit ? type.tag : "?";
9172
- if (type.represent) {
9173
- style = state.styleMap[type.tag] || type.defaultStyle;
9174
- if (_toString.call(type.represent) === "[object Function]") {
9175
- _result = type.represent(object4, style);
9176
- } else if (_hasOwnProperty.call(type.represent, style)) {
9177
- _result = type.represent[style](object4, style);
9178
- } else {
9179
- throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
9180
- }
9181
- state.dump = _result;
9182
- }
9183
- return true;
9184
- }
9185
- }
9186
- return false;
9187
- }
9188
- function writeNode(state, level, object4, block, compact, iskey) {
9189
- state.tag = null;
9190
- state.dump = object4;
9191
- if (!detectType(state, object4, false)) {
9192
- detectType(state, object4, true);
9193
- }
9194
- var type = _toString.call(state.dump);
9195
- if (block) {
9196
- block = state.flowLevel < 0 || state.flowLevel > level;
9197
- }
9198
- var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
9199
- if (objectOrArray) {
9200
- duplicateIndex = state.duplicates.indexOf(object4);
9201
- duplicate = duplicateIndex !== -1;
9202
- }
9203
- if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
9204
- compact = false;
9205
- }
9206
- if (duplicate && state.usedDuplicates[duplicateIndex]) {
9207
- state.dump = "*ref_" + duplicateIndex;
9208
- } else {
9209
- if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
9210
- state.usedDuplicates[duplicateIndex] = true;
9211
- }
9212
- if (type === "[object Object]") {
9213
- if (block && Object.keys(state.dump).length !== 0) {
9214
- writeBlockMapping(state, level, state.dump, compact);
9215
- if (duplicate) {
9216
- state.dump = "&ref_" + duplicateIndex + state.dump;
9217
- }
9218
- } else {
9219
- writeFlowMapping(state, level, state.dump);
9220
- if (duplicate) {
9221
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
9222
- }
9223
- }
9224
- } else if (type === "[object Array]") {
9225
- var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
9226
- if (block && state.dump.length !== 0) {
9227
- writeBlockSequence(state, arrayLevel, state.dump, compact);
9228
- if (duplicate) {
9229
- state.dump = "&ref_" + duplicateIndex + state.dump;
9230
- }
9231
- } else {
9232
- writeFlowSequence(state, arrayLevel, state.dump);
9233
- if (duplicate) {
9234
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
9235
- }
9236
- }
9237
- } else if (type === "[object String]") {
9238
- if (state.tag !== "?") {
9239
- writeScalar(state, state.dump, level, iskey);
9240
- }
9241
- } else {
9242
- if (state.skipInvalid)
9243
- return false;
9244
- throw new YAMLException("unacceptable kind of an object to dump " + type);
9245
- }
9246
- if (state.tag !== null && state.tag !== "?") {
9247
- state.dump = "!<" + state.tag + "> " + state.dump;
9248
- }
9249
- }
9250
- return true;
9251
- }
9252
- function getDuplicateReferences(object4, state) {
9253
- var objects = [], duplicatesIndexes = [], index, length;
9254
- inspectNode(object4, objects, duplicatesIndexes);
9255
- for (index = 0, length = duplicatesIndexes.length;index < length; index += 1) {
9256
- state.duplicates.push(objects[duplicatesIndexes[index]]);
9257
- }
9258
- state.usedDuplicates = new Array(length);
9259
- }
9260
- function inspectNode(object4, objects, duplicatesIndexes) {
9261
- var objectKeyList, index, length;
9262
- if (object4 !== null && typeof object4 === "object") {
9263
- index = objects.indexOf(object4);
9264
- if (index !== -1) {
9265
- if (duplicatesIndexes.indexOf(index) === -1) {
9266
- duplicatesIndexes.push(index);
9267
- }
9268
- } else {
9269
- objects.push(object4);
9270
- if (Array.isArray(object4)) {
9271
- for (index = 0, length = object4.length;index < length; index += 1) {
9272
- inspectNode(object4[index], objects, duplicatesIndexes);
9273
- }
9274
- } else {
9275
- objectKeyList = Object.keys(object4);
9276
- for (index = 0, length = objectKeyList.length;index < length; index += 1) {
9277
- inspectNode(object4[objectKeyList[index]], objects, duplicatesIndexes);
9278
- }
9279
- }
9280
- }
9281
- }
9282
- }
9283
- function dump(input, options) {
9284
- options = options || {};
9285
- var state = new State(options);
9286
- if (!state.noRefs)
9287
- getDuplicateReferences(input, state);
9288
- if (writeNode(state, 0, input, true, true))
9289
- return state.dump + `
9290
- `;
9291
- return "";
9292
- }
9293
- function safeDump(input, options) {
9294
- return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
9295
- }
9296
- exports.dump = dump;
9297
- exports.safeDump = safeDump;
9298
- });
9299
-
9300
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml.js
9301
- var require_js_yaml = __commonJS((exports, module) => {
9302
- var loader = require_loader();
9303
- var dumper = require_dumper();
9304
- function deprecated(name) {
9305
- return function() {
9306
- throw new Error("Function " + name + " is deprecated and cannot be used.");
9307
- };
9308
- }
9309
- exports.Type = require_type();
9310
- exports.Schema = require_schema();
9311
- exports.FAILSAFE_SCHEMA = require_failsafe();
9312
- exports.JSON_SCHEMA = require_json();
9313
- exports.CORE_SCHEMA = require_core3();
9314
- exports.DEFAULT_SAFE_SCHEMA = require_default_safe();
9315
- exports.DEFAULT_FULL_SCHEMA = require_default_full();
9316
- exports.load = loader.load;
9317
- exports.loadAll = loader.loadAll;
9318
- exports.safeLoad = loader.safeLoad;
9319
- exports.safeLoadAll = loader.safeLoadAll;
9320
- exports.dump = dumper.dump;
9321
- exports.safeDump = dumper.safeDump;
9322
- exports.YAMLException = require_exception();
9323
- exports.MINIMAL_SCHEMA = require_failsafe();
9324
- exports.SAFE_SCHEMA = require_default_safe();
9325
- exports.DEFAULT_SCHEMA = require_default_full();
9326
- exports.scan = deprecated("scan");
9327
- exports.parse = deprecated("parse");
9328
- exports.compose = deprecated("compose");
9329
- exports.addConstructor = deprecated("addConstructor");
9330
- });
9331
-
9332
- // node_modules/.bun/js-yaml@3.14.2/node_modules/js-yaml/index.js
9333
- var require_js_yaml2 = __commonJS((exports, module) => {
9334
- var yaml = require_js_yaml();
9335
- module.exports = yaml;
9336
- });
9337
-
9338
- // node_modules/.bun/front-matter@4.0.2/node_modules/front-matter/index.js
9339
- var require_front_matter = __commonJS((exports, module) => {
9340
- var parser = require_js_yaml2();
9341
- var optionalByteOrderMark = "\\ufeff?";
9342
- var platform = typeof process !== "undefined" ? process.platform : "";
9343
- var pattern = "^(" + optionalByteOrderMark + "(= yaml =|---)" + "$([\\s\\S]*?)" + "^(?:\\2|\\.\\.\\.)\\s*" + "$" + (platform === "win32" ? "\\r?" : "") + "(?:\\n)?)";
9344
- var regex = new RegExp(pattern, "m");
9345
- module.exports = extractor;
9346
- module.exports.test = test;
9347
- function extractor(string4, options) {
9348
- string4 = string4 || "";
9349
- var defaultOptions2 = { allowUnsafe: false };
9350
- options = options instanceof Object ? { ...defaultOptions2, ...options } : defaultOptions2;
9351
- options.allowUnsafe = Boolean(options.allowUnsafe);
9352
- var lines = string4.split(/(\r?\n)/);
9353
- if (lines[0] && /= yaml =|---/.test(lines[0])) {
9354
- return parse6(string4, options.allowUnsafe);
9355
- } else {
9356
- return {
9357
- attributes: {},
9358
- body: string4,
9359
- bodyBegin: 1
9360
- };
9361
- }
9362
- }
9363
- function computeLocation(match, body) {
9364
- var line = 1;
9365
- var pos = body.indexOf(`
9366
- `);
9367
- var offset = match.index + match[0].length;
9368
- while (pos !== -1) {
9369
- if (pos >= offset) {
9370
- return line;
9371
- }
9372
- line++;
9373
- pos = body.indexOf(`
9374
- `, pos + 1);
9375
- }
9376
- return line;
9377
- }
9378
- function parse6(string4, allowUnsafe) {
9379
- var match = regex.exec(string4);
9380
- if (!match) {
9381
- return {
9382
- attributes: {},
9383
- body: string4,
9384
- bodyBegin: 1
9385
- };
9386
- }
9387
- var loader = allowUnsafe ? parser.load : parser.safeLoad;
9388
- var yaml = match[match.length - 1].replace(/^\s+|\s+$/g, "");
9389
- var attributes = loader(yaml) || {};
9390
- var body = string4.replace(match[0], "");
9391
- var line = computeLocation(match, string4);
9392
- return {
9393
- attributes,
9394
- body,
9395
- bodyBegin: line,
9396
- frontmatter: yaml
9397
- };
9398
- }
9399
- function test(string4) {
9400
- string4 = string4 || "";
9401
- return regex.test(string4);
9402
- }
9403
- });
9404
-
9405
6520
  // apps/mcp/src/index.ts
9406
- import { resolve as resolve3, join as join6 } from "path";
6521
+ import { resolve, join as join4 } from "path";
9407
6522
  import { existsSync as existsSync3 } from "fs";
9408
6523
 
9409
6524
  // packages/context/src/context.ts
@@ -17245,7 +14360,7 @@ function object(shape, params) {
17245
14360
  };
17246
14361
  return new ZodMiniObject(def);
17247
14362
  }
17248
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
14363
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
17249
14364
  function isZ4Schema(s) {
17250
14365
  const schema = s;
17251
14366
  return !!schema._zod;
@@ -18072,7 +15187,7 @@ function preprocess(fn, schema) {
18072
15187
  // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/external.js
18073
15188
  config(en_default2());
18074
15189
 
18075
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
15190
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
18076
15191
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
18077
15192
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
18078
15193
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -18081,7 +15196,7 @@ var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" ||
18081
15196
  var ProgressTokenSchema = union([string2(), number2().int()]);
18082
15197
  var CursorSchema = string2();
18083
15198
  var TaskCreationParamsSchema = looseObject({
18084
- ttl: union([number2(), _null3()]).optional(),
15199
+ ttl: number2().optional(),
18085
15200
  pollInterval: number2().optional()
18086
15201
  });
18087
15202
  var TaskMetadataSchema = object2({
@@ -18235,7 +15350,8 @@ var ClientCapabilitiesSchema = object2({
18235
15350
  roots: object2({
18236
15351
  listChanged: boolean2().optional()
18237
15352
  }).optional(),
18238
- tasks: ClientTasksCapabilitySchema.optional()
15353
+ tasks: ClientTasksCapabilitySchema.optional(),
15354
+ extensions: record(string2(), AssertObjectSchema).optional()
18239
15355
  });
18240
15356
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
18241
15357
  protocolVersion: string2(),
@@ -18260,7 +15376,8 @@ var ServerCapabilitiesSchema = object2({
18260
15376
  tools: object2({
18261
15377
  listChanged: boolean2().optional()
18262
15378
  }).optional(),
18263
- tasks: ServerTasksCapabilitySchema.optional()
15379
+ tasks: ServerTasksCapabilitySchema.optional(),
15380
+ extensions: record(string2(), AssertObjectSchema).optional()
18264
15381
  });
18265
15382
  var InitializeResultSchema = ResultSchema.extend({
18266
15383
  protocolVersion: string2(),
@@ -18375,6 +15492,7 @@ var ResourceSchema = object2({
18375
15492
  uri: string2(),
18376
15493
  description: optional(string2()),
18377
15494
  mimeType: optional(string2()),
15495
+ size: optional(number2()),
18378
15496
  annotations: AnnotationsSchema.optional(),
18379
15497
  _meta: optional(looseObject({}))
18380
15498
  });
@@ -18914,12 +16032,12 @@ class UrlElicitationRequiredError extends McpError {
18914
16032
  }
18915
16033
  }
18916
16034
 
18917
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
16035
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
18918
16036
  function isTerminal(status) {
18919
16037
  return status === "completed" || status === "failed" || status === "cancelled";
18920
16038
  }
18921
16039
 
18922
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Options.js
16040
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Options.js
18923
16041
  var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
18924
16042
  var defaultOptions = {
18925
16043
  name: undefined,
@@ -18952,7 +16070,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
18952
16070
  ...defaultOptions,
18953
16071
  ...options
18954
16072
  };
18955
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Refs.js
16073
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Refs.js
18956
16074
  var getRefs = (options) => {
18957
16075
  const _options = getDefaultOptions(options);
18958
16076
  const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
@@ -18971,7 +16089,7 @@ var getRefs = (options) => {
18971
16089
  ]))
18972
16090
  };
18973
16091
  };
18974
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
16092
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
18975
16093
  function addErrorMessage(res, key, errorMessage, refs) {
18976
16094
  if (!refs?.errorMessages)
18977
16095
  return;
@@ -18986,7 +16104,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
18986
16104
  res[key] = value;
18987
16105
  addErrorMessage(res, key, errorMessage, refs);
18988
16106
  }
18989
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
16107
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
18990
16108
  var getRelativePath = (pathA, pathB) => {
18991
16109
  let i = 0;
18992
16110
  for (;i < pathA.length && i < pathB.length; i++) {
@@ -18995,7 +16113,7 @@ var getRelativePath = (pathA, pathB) => {
18995
16113
  }
18996
16114
  return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
18997
16115
  };
18998
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
16116
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
18999
16117
  function parseAnyDef(refs) {
19000
16118
  if (refs.target !== "openAi") {
19001
16119
  return {};
@@ -19011,7 +16129,7 @@ function parseAnyDef(refs) {
19011
16129
  };
19012
16130
  }
19013
16131
 
19014
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
16132
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
19015
16133
  function parseArrayDef(def, refs) {
19016
16134
  const res = {
19017
16135
  type: "array"
@@ -19035,7 +16153,7 @@ function parseArrayDef(def, refs) {
19035
16153
  return res;
19036
16154
  }
19037
16155
 
19038
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
16156
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
19039
16157
  function parseBigintDef(def, refs) {
19040
16158
  const res = {
19041
16159
  type: "integer",
@@ -19081,24 +16199,24 @@ function parseBigintDef(def, refs) {
19081
16199
  return res;
19082
16200
  }
19083
16201
 
19084
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
16202
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
19085
16203
  function parseBooleanDef() {
19086
16204
  return {
19087
16205
  type: "boolean"
19088
16206
  };
19089
16207
  }
19090
16208
 
19091
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
16209
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
19092
16210
  function parseBrandedDef(_def, refs) {
19093
16211
  return parseDef(_def.type._def, refs);
19094
16212
  }
19095
16213
 
19096
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
16214
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
19097
16215
  var parseCatchDef = (def, refs) => {
19098
16216
  return parseDef(def.innerType._def, refs);
19099
16217
  };
19100
16218
 
19101
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
16219
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
19102
16220
  function parseDateDef(def, refs, overrideDateStrategy) {
19103
16221
  const strategy = overrideDateStrategy ?? refs.dateStrategy;
19104
16222
  if (Array.isArray(strategy)) {
@@ -19143,7 +16261,7 @@ var integerDateParser = (def, refs) => {
19143
16261
  return res;
19144
16262
  };
19145
16263
 
19146
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
16264
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
19147
16265
  function parseDefaultDef(_def, refs) {
19148
16266
  return {
19149
16267
  ...parseDef(_def.innerType._def, refs),
@@ -19151,12 +16269,12 @@ function parseDefaultDef(_def, refs) {
19151
16269
  };
19152
16270
  }
19153
16271
 
19154
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
16272
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
19155
16273
  function parseEffectsDef(_def, refs) {
19156
16274
  return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
19157
16275
  }
19158
16276
 
19159
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
16277
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
19160
16278
  function parseEnumDef(def) {
19161
16279
  return {
19162
16280
  type: "string",
@@ -19164,7 +16282,7 @@ function parseEnumDef(def) {
19164
16282
  };
19165
16283
  }
19166
16284
 
19167
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
16285
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
19168
16286
  var isJsonSchema7AllOfType = (type) => {
19169
16287
  if ("type" in type && type.type === "string")
19170
16288
  return false;
@@ -19206,7 +16324,7 @@ function parseIntersectionDef(def, refs) {
19206
16324
  } : undefined;
19207
16325
  }
19208
16326
 
19209
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
16327
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
19210
16328
  function parseLiteralDef(def, refs) {
19211
16329
  const parsedType2 = typeof def.value;
19212
16330
  if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
@@ -19226,7 +16344,7 @@ function parseLiteralDef(def, refs) {
19226
16344
  };
19227
16345
  }
19228
16346
 
19229
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
16347
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
19230
16348
  var emojiRegex2 = undefined;
19231
16349
  var zodPatterns = {
19232
16350
  cuid: /^[cC][^\s-]{8,}$/,
@@ -19523,7 +16641,7 @@ function stringifyRegExpWithFlags(regex, refs) {
19523
16641
  return pattern;
19524
16642
  }
19525
16643
 
19526
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
16644
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
19527
16645
  function parseRecordDef(def, refs) {
19528
16646
  if (refs.target === "openAi") {
19529
16647
  console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
@@ -19575,7 +16693,7 @@ function parseRecordDef(def, refs) {
19575
16693
  return schema;
19576
16694
  }
19577
16695
 
19578
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
16696
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
19579
16697
  function parseMapDef(def, refs) {
19580
16698
  if (refs.mapStrategy === "record") {
19581
16699
  return parseRecordDef(def, refs);
@@ -19600,7 +16718,7 @@ function parseMapDef(def, refs) {
19600
16718
  };
19601
16719
  }
19602
16720
 
19603
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
16721
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
19604
16722
  function parseNativeEnumDef(def) {
19605
16723
  const object3 = def.values;
19606
16724
  const actualKeys = Object.keys(def.values).filter((key) => {
@@ -19614,7 +16732,7 @@ function parseNativeEnumDef(def) {
19614
16732
  };
19615
16733
  }
19616
16734
 
19617
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
16735
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
19618
16736
  function parseNeverDef(refs) {
19619
16737
  return refs.target === "openAi" ? undefined : {
19620
16738
  not: parseAnyDef({
@@ -19624,7 +16742,7 @@ function parseNeverDef(refs) {
19624
16742
  };
19625
16743
  }
19626
16744
 
19627
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
16745
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
19628
16746
  function parseNullDef(refs) {
19629
16747
  return refs.target === "openApi3" ? {
19630
16748
  enum: ["null"],
@@ -19634,7 +16752,7 @@ function parseNullDef(refs) {
19634
16752
  };
19635
16753
  }
19636
16754
 
19637
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
16755
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
19638
16756
  var primitiveMappings = {
19639
16757
  ZodString: "string",
19640
16758
  ZodNumber: "number",
@@ -19702,7 +16820,7 @@ var asAnyOf = (def, refs) => {
19702
16820
  return anyOf.length ? { anyOf } : undefined;
19703
16821
  };
19704
16822
 
19705
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
16823
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
19706
16824
  function parseNullableDef(def, refs) {
19707
16825
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
19708
16826
  if (refs.target === "openApi3") {
@@ -19734,7 +16852,7 @@ function parseNullableDef(def, refs) {
19734
16852
  return base && { anyOf: [base, { type: "null" }] };
19735
16853
  }
19736
16854
 
19737
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
16855
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
19738
16856
  function parseNumberDef(def, refs) {
19739
16857
  const res = {
19740
16858
  type: "number"
@@ -19783,7 +16901,7 @@ function parseNumberDef(def, refs) {
19783
16901
  return res;
19784
16902
  }
19785
16903
 
19786
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
16904
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
19787
16905
  function parseObjectDef(def, refs) {
19788
16906
  const forceOptionalIntoNullable = refs.target === "openAi";
19789
16907
  const result = {
@@ -19853,7 +16971,7 @@ function safeIsOptional(schema) {
19853
16971
  }
19854
16972
  }
19855
16973
 
19856
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
16974
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
19857
16975
  var parseOptionalDef = (def, refs) => {
19858
16976
  if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
19859
16977
  return parseDef(def.innerType._def, refs);
@@ -19872,7 +16990,7 @@ var parseOptionalDef = (def, refs) => {
19872
16990
  } : parseAnyDef(refs);
19873
16991
  };
19874
16992
 
19875
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
16993
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
19876
16994
  var parsePipelineDef = (def, refs) => {
19877
16995
  if (refs.pipeStrategy === "input") {
19878
16996
  return parseDef(def.in._def, refs);
@@ -19892,12 +17010,12 @@ var parsePipelineDef = (def, refs) => {
19892
17010
  };
19893
17011
  };
19894
17012
 
19895
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
17013
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
19896
17014
  function parsePromiseDef(def, refs) {
19897
17015
  return parseDef(def.type._def, refs);
19898
17016
  }
19899
17017
 
19900
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
17018
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
19901
17019
  function parseSetDef(def, refs) {
19902
17020
  const items = parseDef(def.valueType._def, {
19903
17021
  ...refs,
@@ -19917,7 +17035,7 @@ function parseSetDef(def, refs) {
19917
17035
  return schema;
19918
17036
  }
19919
17037
 
19920
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
17038
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
19921
17039
  function parseTupleDef(def, refs) {
19922
17040
  if (def.rest) {
19923
17041
  return {
@@ -19945,24 +17063,24 @@ function parseTupleDef(def, refs) {
19945
17063
  }
19946
17064
  }
19947
17065
 
19948
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
17066
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
19949
17067
  function parseUndefinedDef(refs) {
19950
17068
  return {
19951
17069
  not: parseAnyDef(refs)
19952
17070
  };
19953
17071
  }
19954
17072
 
19955
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
17073
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
19956
17074
  function parseUnknownDef(refs) {
19957
17075
  return parseAnyDef(refs);
19958
17076
  }
19959
17077
 
19960
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
17078
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
19961
17079
  var parseReadonlyDef = (def, refs) => {
19962
17080
  return parseDef(def.innerType._def, refs);
19963
17081
  };
19964
17082
 
19965
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/selectParser.js
17083
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/selectParser.js
19966
17084
  var selectParser = (def, typeName, refs) => {
19967
17085
  switch (typeName) {
19968
17086
  case ZodFirstPartyTypeKind.ZodString:
@@ -20040,7 +17158,7 @@ var selectParser = (def, typeName, refs) => {
20040
17158
  }
20041
17159
  };
20042
17160
 
20043
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parseDef.js
17161
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parseDef.js
20044
17162
  function parseDef(def, refs, forceResolution = false) {
20045
17163
  const seenItem = refs.seen.get(def);
20046
17164
  if (refs.override) {
@@ -20095,7 +17213,7 @@ var addMeta = (def, refs, jsonSchema) => {
20095
17213
  }
20096
17214
  return jsonSchema;
20097
17215
  };
20098
- // node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
17216
+ // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
20099
17217
  var zodToJsonSchema = (schema, options) => {
20100
17218
  const refs = getRefs(options);
20101
17219
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
@@ -20155,7 +17273,7 @@ var zodToJsonSchema = (schema, options) => {
20155
17273
  }
20156
17274
  return combined;
20157
17275
  };
20158
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
17276
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
20159
17277
  function mapMiniTarget(t) {
20160
17278
  if (!t)
20161
17279
  return "draft-7";
@@ -20197,7 +17315,7 @@ function parseWithCompat(schema, data) {
20197
17315
  return result.data;
20198
17316
  }
20199
17317
 
20200
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
17318
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
20201
17319
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
20202
17320
 
20203
17321
  class Protocol {
@@ -20401,6 +17519,10 @@ class Protocol {
20401
17519
  this._progressHandlers.clear();
20402
17520
  this._taskProgressTokens.clear();
20403
17521
  this._pendingDebouncedNotifications.clear();
17522
+ for (const info of this._timeoutInfo.values()) {
17523
+ clearTimeout(info.timeoutId);
17524
+ }
17525
+ this._timeoutInfo.clear();
20404
17526
  for (const controller of this._requestHandlerAbortControllers.values()) {
20405
17527
  controller.abort();
20406
17528
  }
@@ -20531,7 +17653,9 @@ class Protocol {
20531
17653
  await capturedTransport?.send(errorResponse);
20532
17654
  }
20533
17655
  }).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
20534
- this._requestHandlerAbortControllers.delete(request.id);
17656
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
17657
+ this._requestHandlerAbortControllers.delete(request.id);
17658
+ }
20535
17659
  });
20536
17660
  }
20537
17661
  _onprogress(notification) {
@@ -21032,7 +18156,7 @@ function mergeCapabilities(base, additional) {
21032
18156
  return result;
21033
18157
  }
21034
18158
 
21035
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
18159
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
21036
18160
  var import_ajv = __toESM(require_ajv(), 1);
21037
18161
  var import_ajv_formats = __toESM(require_dist(), 1);
21038
18162
  function createDefaultAjvInstance() {
@@ -21072,7 +18196,7 @@ class AjvJsonSchemaValidator {
21072
18196
  }
21073
18197
  }
21074
18198
 
21075
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
18199
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
21076
18200
  class ExperimentalServerTasks {
21077
18201
  constructor(_server) {
21078
18202
  this._server = _server;
@@ -21150,7 +18274,7 @@ class ExperimentalServerTasks {
21150
18274
  }
21151
18275
  }
21152
18276
 
21153
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
18277
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
21154
18278
  function assertToolsCallTaskCapability(requests, method, entityName) {
21155
18279
  if (!requests) {
21156
18280
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -21185,7 +18309,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
21185
18309
  }
21186
18310
  }
21187
18311
 
21188
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
18312
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
21189
18313
  class Server extends Protocol {
21190
18314
  constructor(_serverInfo, options) {
21191
18315
  super(options);
@@ -21518,7 +18642,7 @@ class Server extends Protocol {
21518
18642
  }
21519
18643
  }
21520
18644
 
21521
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
18645
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
21522
18646
  var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
21523
18647
  function isCompletable(schema) {
21524
18648
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -21532,7 +18656,7 @@ var McpZodTypeKind;
21532
18656
  McpZodTypeKind2["Completable"] = "McpCompletable";
21533
18657
  })(McpZodTypeKind || (McpZodTypeKind = {}));
21534
18658
 
21535
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
18659
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
21536
18660
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
21537
18661
  function validateToolName(name) {
21538
18662
  const warnings = [];
@@ -21590,7 +18714,7 @@ function validateAndWarnToolName(name) {
21590
18714
  return result.isValid;
21591
18715
  }
21592
18716
 
21593
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
18717
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
21594
18718
  class ExperimentalMcpServerTasks {
21595
18719
  constructor(_mcpServer) {
21596
18720
  this._mcpServer = _mcpServer;
@@ -21604,7 +18728,7 @@ class ExperimentalMcpServerTasks {
21604
18728
  return mcpServerInternal._createRegisteredTool(name, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler);
21605
18729
  }
21606
18730
  }
21607
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
18731
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
21608
18732
  class McpServer {
21609
18733
  constructor(serverInfo, options) {
21610
18734
  this._registeredResources = {};
@@ -22188,6 +19312,9 @@ class McpServer {
22188
19312
  annotations = rest.shift();
22189
19313
  }
22190
19314
  } else if (typeof firstArg === "object" && firstArg !== null) {
19315
+ if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
19316
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
19317
+ }
22191
19318
  annotations = rest.shift();
22192
19319
  }
22193
19320
  }
@@ -22280,6 +19407,9 @@ function getZodSchemaObject(schema) {
22280
19407
  if (isZodRawShapeCompat(schema)) {
22281
19408
  return objectFromShape(schema);
22282
19409
  }
19410
+ if (!isZodSchemaInstance(schema)) {
19411
+ throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
19412
+ }
22283
19413
  return schema;
22284
19414
  }
22285
19415
  function promptArgumentsFromSchema(schema) {
@@ -22324,10 +19454,10 @@ var EMPTY_COMPLETION_RESULT = {
22324
19454
  }
22325
19455
  };
22326
19456
 
22327
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
19457
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
22328
19458
  import process2 from "process";
22329
19459
 
22330
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
19460
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
22331
19461
  class ReadBuffer {
22332
19462
  append(chunk) {
22333
19463
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
@@ -22357,7 +19487,7 @@ function serializeMessage(message) {
22357
19487
  `;
22358
19488
  }
22359
19489
 
22360
- // node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
19490
+ // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
22361
19491
  class StdioServerTransport {
22362
19492
  constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
22363
19493
  this._stdin = _stdin;
@@ -22416,7 +19546,7 @@ class StdioServerTransport {
22416
19546
  }
22417
19547
 
22418
19548
  // apps/mcp/src/tools.ts
22419
- import { join as join5 } from "path";
19549
+ import { join as join2 } from "path";
22420
19550
  import { spawn } from "child_process";
22421
19551
 
22422
19552
  // packages/core/src/state.ts
@@ -22424,27 +19554,6 @@ import { join } from "path";
22424
19554
  import { execSync } from "child_process";
22425
19555
 
22426
19556
  // packages/types/src/types.ts
22427
- var ContextEntrySchema = exports_external.discriminatedUnion("type", [
22428
- exports_external.object({
22429
- type: exports_external.literal("file"),
22430
- file: exports_external.string(),
22431
- label: exports_external.string()
22432
- }),
22433
- exports_external.object({
22434
- type: exports_external.literal("currentSection"),
22435
- label: exports_external.string()
22436
- })
22437
- ]);
22438
- var PhaseFrontmatterSchema = exports_external.object({
22439
- name: exports_external.string(),
22440
- order: exports_external.number(),
22441
- requires: exports_external.array(exports_external.string()).default([]),
22442
- next: exports_external.string().nullable().default(null),
22443
- autoAdvance: exports_external.enum(["allChecked"]).nullable().default(null),
22444
- loopBack: exports_external.string().nullable().default(null),
22445
- terminal: exports_external.boolean().default(false),
22446
- context: exports_external.array(ContextEntrySchema).default([])
22447
- });
22448
19557
  var IterationUsageSchema = exports_external.object({
22449
19558
  cost_usd: exports_external.number(),
22450
19559
  duration_ms: exports_external.number(),
@@ -22467,7 +19576,7 @@ var HistoryEntrySchema = exports_external.object({
22467
19576
  timestamp: exports_external.string(),
22468
19577
  startedAt: exports_external.string().optional(),
22469
19578
  endedAt: exports_external.string().optional(),
22470
- phase: exports_external.string(),
19579
+ phase: exports_external.string().optional(),
22471
19580
  iteration: exports_external.number(),
22472
19581
  engine: exports_external.string(),
22473
19582
  model: exports_external.string(),
@@ -22475,452 +19584,127 @@ var HistoryEntrySchema = exports_external.object({
22475
19584
  usage: IterationUsageSchema.partial().optional()
22476
19585
  });
22477
19586
  var StateSchema = exports_external.object({
22478
- version: exports_external.string().default("1"),
19587
+ version: exports_external.literal("2"),
22479
19588
  name: exports_external.string(),
22480
19589
  prompt: exports_external.string(),
22481
- phase: exports_external.string(),
19590
+ phase: exports_external.string().default("specify"),
22482
19591
  phaseIteration: exports_external.number().default(0),
22483
- totalIterations: exports_external.number().default(0),
19592
+ iteration: exports_external.number().default(0),
19593
+ status: exports_external.enum(["active", "blocked", "completed"]).default("active"),
19594
+ stopReason: exports_external.string().optional(),
22484
19595
  createdAt: exports_external.string(),
22485
19596
  lastModified: exports_external.string(),
22486
- engine: exports_external.string().default("claude"),
19597
+ engine: exports_external.enum(["claude", "codex"]).default("claude"),
22487
19598
  model: exports_external.string().default("opus"),
22488
- status: exports_external.string().default("active"),
22489
19599
  usage: UsageSchema.default({}),
22490
19600
  history: exports_external.array(HistoryEntrySchema).default([]),
22491
- metadata: exports_external.object({
22492
- branch: exports_external.string().optional()
22493
- }).default({})
19601
+ metadata: exports_external.object({ branch: exports_external.string().optional() }).default({})
19602
+ });
19603
+ var PhaseFrontmatterSchema = exports_external.object({
19604
+ name: exports_external.string(),
19605
+ order: exports_external.number(),
19606
+ requires: exports_external.array(exports_external.string()).default([]),
19607
+ next: exports_external.string().nullable().default(null),
19608
+ autoAdvance: exports_external.enum(["allChecked"]).nullable().default(null),
19609
+ loopBack: exports_external.string().nullable().default(null),
19610
+ terminal: exports_external.boolean().default(false),
19611
+ context: exports_external.array(exports_external.discriminatedUnion("type", [
19612
+ exports_external.object({
19613
+ type: exports_external.literal("file"),
19614
+ file: exports_external.string(),
19615
+ label: exports_external.string()
19616
+ }),
19617
+ exports_external.object({
19618
+ type: exports_external.literal("currentSection"),
19619
+ label: exports_external.string()
19620
+ })
19621
+ ])).default([])
22494
19622
  });
22495
19623
 
22496
- // packages/phases/src/phases.ts
22497
- var import_front_matter = __toESM(require_front_matter(), 1);
22498
- import { resolve as resolve2 } from "path";
22499
- import { readdirSync as readdirSync2, readFileSync as readFileSync2 } from "fs";
22500
-
22501
- // packages/content/src/content.ts
22502
- import { resolve, dirname as dirname2 } from "path";
22503
- import { fileURLToPath } from "url";
22504
- var __dirname2 = dirname2(fileURLToPath(import.meta.url));
22505
- var packageRoot = resolve(__dirname2, "..");
22506
- function resolveScaffoldsDir() {
22507
- return resolve(packageRoot, "scaffolds");
22508
- }
22509
- function resolveTasksDir() {
22510
- return resolve(packageRoot, "tasks");
22511
- }
22512
- function resolvePhasesDir() {
22513
- return resolve(packageRoot, "phases");
22514
- }
22515
- function resolveChecklistsDir() {
22516
- return resolve(packageRoot, "checklists");
22517
- }
22518
-
22519
- // packages/phases/src/phases.ts
22520
- var cachedPhases = null;
22521
- var cachedDir = null;
22522
- function loadPhases(dir = resolvePhasesDir()) {
22523
- if (cachedPhases !== null && cachedDir === dir)
22524
- return cachedPhases;
22525
- const files = readdirSync2(dir).filter((f) => f.endsWith(".md"));
22526
- const phases = [];
22527
- for (const file of files) {
22528
- const content = readFileSync2(resolve2(dir, file), "utf-8");
22529
- const { attributes, body } = import_front_matter.default(content);
22530
- const config2 = PhaseFrontmatterSchema.parse(attributes);
22531
- phases.push({ ...config2, prompt: body.trim() });
22532
- }
22533
- phases.sort((a, b) => a.order - b.order);
22534
- cachedPhases = phases;
22535
- cachedDir = dir;
22536
- return phases;
22537
- }
22538
- function getPhase(name, dir) {
22539
- const phases = loadPhases(dir);
22540
- const phase = phases.find((p) => p.name === name);
22541
- if (!phase)
22542
- throw new Error(`Unknown phase: ${name}`);
22543
- return phase;
22544
- }
22545
- function getNextPhase(current, dir) {
22546
- const phases = loadPhases(dir);
22547
- const phase = phases.find((p) => p.name === current);
22548
- if (!phase)
22549
- throw new Error(`Unknown phase: ${current}`);
22550
- if (phase.next) {
22551
- return phase.next;
22552
- }
22553
- const idx = phases.indexOf(phase);
22554
- if (idx < phases.length - 1) {
22555
- return phases[idx + 1].name;
22556
- }
22557
- return null;
22558
- }
22559
- function getFirstPhase(dir) {
22560
- const phases = loadPhases(dir);
22561
- return phases[0];
22562
- }
22563
- function resolveChecklistDir() {
22564
- return resolveChecklistsDir();
22565
- }
22566
- function listChecklists() {
22567
- const dir = resolveChecklistsDir();
22568
- return readdirSync2(dir).filter((f) => f.endsWith(".md")).map((f) => f.replace(/\.md$/, ""));
22569
- }
22570
-
22571
- // packages/core/src/format.ts
22572
- function formatTaskName(name) {
22573
- return name.trim().toLowerCase().replace(/[\s_]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
22574
- }
22575
-
22576
- // packages/core/src/state.ts
22577
- var STATE_FILE = "state.json";
22578
- function readState(taskDir) {
22579
- const filePath = join(taskDir, STATE_FILE);
22580
- const raw = getStorage().read(filePath);
22581
- if (raw === null)
22582
- throw new Error(`state.json not found in ${taskDir}`);
22583
- return StateSchema.parse(JSON.parse(raw));
22584
- }
22585
- function writeState(taskDir, state) {
22586
- const filePath = join(taskDir, STATE_FILE);
22587
- getStorage().write(filePath, JSON.stringify(state, null, 2) + `
22588
- `);
22589
- }
22590
- function buildInitialState(opts) {
22591
- const now = new Date().toISOString();
22592
- let branch = "main";
22593
- try {
22594
- branch = execSync("git branch --show-current", { encoding: "utf-8" }).trim();
22595
- } catch {}
22596
- return StateSchema.parse({
22597
- name: formatTaskName(opts.name),
22598
- prompt: opts.prompt,
22599
- phase: opts.phase ?? getFirstPhase().name,
22600
- engine: opts.engine ?? "claude",
22601
- model: opts.model ?? "opus",
22602
- createdAt: now,
22603
- lastModified: now,
22604
- metadata: { branch }
22605
- });
22606
- }
22607
-
22608
- // packages/core/src/phases.ts
22609
- import { join as join2 } from "path";
22610
-
22611
- // packages/core/src/progress.ts
22612
- function extractCurrentSection(content) {
22613
- const lines = content.split(`
22614
- `);
22615
- let sectionHeader = "";
22616
- let buf = "";
22617
- let hasUnchecked = false;
22618
- let inSection = false;
22619
- for (const line of lines) {
22620
- if (line.startsWith("## ")) {
22621
- if (inSection && hasUnchecked) {
22622
- return sectionHeader + `
22623
- ` + buf;
22624
- }
22625
- sectionHeader = line;
22626
- buf = "";
22627
- hasUnchecked = false;
22628
- inSection = true;
22629
- continue;
22630
- }
22631
- if (inSection) {
22632
- buf += line + `
22633
- `;
22634
- if (line.startsWith("- [ ]")) {
22635
- hasUnchecked = true;
22636
- }
22637
- }
22638
- }
22639
- if (inSection && hasUnchecked) {
22640
- return sectionHeader + `
22641
- ` + buf;
22642
- }
22643
- return null;
22644
- }
22645
- function countProgress(content) {
22646
- const checked = (content.match(/^- \[x\]/gm) ?? []).length;
22647
- const unchecked = (content.match(/^- \[ \]/gm) ?? []).length;
22648
- return { checked, unchecked, total: checked + unchecked };
22649
- }
22650
-
22651
- // packages/core/src/phases.ts
22652
- function recordPhaseTransition(state, from, to, result) {
22653
- const now = new Date().toISOString();
22654
- return {
22655
- ...state,
22656
- phase: to,
22657
- phaseIteration: 0,
22658
- lastModified: now,
22659
- history: [
22660
- ...state.history,
22661
- {
22662
- timestamp: now,
22663
- phase: from,
22664
- iteration: state.phaseIteration,
22665
- engine: state.engine,
22666
- model: state.model,
22667
- result: result ?? `advance -> ${to}`
22668
- }
22669
- ]
22670
- };
22671
- }
22672
- function advancePhase(state, taskDir) {
22673
- const current = state.phase;
22674
- const config2 = getPhase(current);
22675
- const storage = getStorage();
22676
- if (config2.terminal) {
22677
- throw new Error("Task is already done. Nothing to advance.");
22678
- }
22679
- if (config2.loopBack) {
22680
- const progress = storage.read(join2(taskDir, "PROGRESS.md")) ?? "";
22681
- const hasIssues = /\u26A0\uFE0F/.test(progress);
22682
- if (hasIssues) {
22683
- return recordPhaseTransition(state, current, config2.loopBack, "issues found -> loop back");
22684
- }
22685
- const { unchecked } = countProgress(progress);
22686
- if (unchecked === 0) {
22687
- const terminal = loadPhases().find((p) => p.terminal);
22688
- if (terminal) {
22689
- const updated = recordPhaseTransition(state, current, terminal.name, "no issues found -> advance to done");
22690
- return { ...updated, status: "completed" };
22691
- }
22692
- }
22693
- const nextName2 = getNextPhase(current);
22694
- if (!nextName2)
22695
- throw new Error(`No next phase after ${current}`);
22696
- return recordPhaseTransition(state, current, nextName2, "no issues found -> advance to next section");
22697
- }
22698
- const nextName = getNextPhase(current);
22699
- if (!nextName) {
22700
- throw new Error(`No next phase after ${current}`);
22701
- }
22702
- const nextConfig = getPhase(nextName);
22703
- for (const file of nextConfig.requires) {
22704
- if (storage.read(join2(taskDir, file)) === null) {
22705
- throw new Error(`Cannot advance to ${nextName} \u2014 ${file} does not exist yet`);
22706
- }
22707
- }
22708
- if (nextName === "exec" && current === "plan") {
22709
- let progressContent = storage.read(join2(taskDir, "PROGRESS.md"));
22710
- if (progressContent !== null) {
22711
- const { unchecked } = countProgress(progressContent);
22712
- if (unchecked === 0) {
22713
- throw new Error("Cannot advance to exec \u2014 PROGRESS.md has no unchecked items");
22714
- }
22715
- progressContent = appendChecklists(progressContent);
22716
- storage.write(join2(taskDir, "PROGRESS.md"), progressContent);
22717
- }
22718
- }
22719
- return recordPhaseTransition(state, current, nextName);
22720
- }
22721
- function setPhase(state, taskDir, targetPhase) {
22722
- const from = state.phase;
22723
- const updated = recordPhaseTransition(state, from, targetPhase, `set-phase: ${from} -> ${targetPhase}`);
22724
- writeState(taskDir, updated);
22725
- return updated;
22726
- }
22727
- function appendChecklists(progress) {
22728
- const storage = getStorage();
22729
- const dir = resolveChecklistDir();
22730
- const names = listChecklists();
22731
- const sectionMatches = progress.match(/^## Section \d+/gm);
22732
- let nextSection = (sectionMatches?.length ?? 0) + 1;
22733
- for (const name of names) {
22734
- const raw = storage.read(join2(dir, `${name}.md`));
22735
- if (raw === null)
22736
- continue;
22737
- const h1Match = raw.match(/^# (.+)\n/);
22738
- const title = h1Match ? h1Match[1] : "Checklist";
22739
- const body = h1Match ? raw.slice(h1Match[0].length).replace(/^\n+/, "") : raw;
22740
- progress += `
22741
- ## Section ${nextSection} \u2014 ${title}
22742
-
22743
- ${body.trimEnd()}
22744
- `;
22745
- nextSection++;
22746
- }
22747
- return progress;
22748
- }
22749
-
22750
- // packages/core/src/git.ts
22751
- import { execSync as execSync2 } from "child_process";
22752
- import { join as join3 } from "path";
22753
- function gitAdd(files) {
22754
- execSync2(`git add ${files.map((f) => `"${f}"`).join(" ")}`, {
22755
- stdio: "pipe"
22756
- });
22757
- }
22758
- function gitCommit(message) {
22759
- execSync2(`git commit -m "${message.replace(/"/g, "\\\"")}"`, {
22760
- stdio: "pipe"
22761
- });
22762
- }
22763
- function commitState(taskDir, message) {
22764
- const stateFile = join3(taskDir, "state.json");
22765
- try {
22766
- gitAdd([stateFile]);
22767
- gitCommit(`docs(ralph): ${message}`);
22768
- } catch {}
22769
- }
22770
-
22771
- // packages/core/src/templates.ts
22772
- import { join as join4 } from "path";
22773
- import { readdirSync as readdirSync3, readFileSync as readFileSync3, existsSync as existsSync2, statSync } from "fs";
22774
-
22775
- // packages/core/src/documents.ts
22776
- var TASK_DOCUMENTS = [
22777
- {
22778
- name: "RESEARCH.md",
22779
- scaffold: null,
22780
- promptInjection: null,
22781
- showInStatus: true
22782
- },
22783
- {
22784
- name: "PLAN.md",
22785
- scaffold: null,
22786
- promptInjection: null,
22787
- showInStatus: true
22788
- },
22789
- {
22790
- name: "PROGRESS.md",
22791
- scaffold: null,
22792
- promptInjection: null,
22793
- showInStatus: true
22794
- },
22795
- {
22796
- name: "STEERING.md",
22797
- scaffold: "STEERING",
22798
- fallbackContent: `# Steering \u2014 User Guidance
22799
-
22800
- **Edit this file anytime to steer the task.**
22801
- `,
22802
- promptInjection: {
22803
- phases: "all",
22804
- header: "User Steering (READ FIRST)",
22805
- filterHeaders: true,
22806
- maxLines: 20
22807
- },
22808
- showInStatus: false
22809
- },
22810
- {
22811
- name: "MANUAL_TESTING.md",
22812
- scaffold: "MANUAL_TESTING",
22813
- promptInjection: {
22814
- phases: ["exec", "review"],
22815
- header: "Manual Testing Instructions (READ & FOLLOW)",
22816
- filterHeaders: true,
22817
- maxLines: 20
22818
- },
22819
- showInStatus: false
22820
- },
22821
- {
22822
- name: "INTERACTIVE.md",
22823
- scaffold: null,
22824
- promptInjection: {
22825
- phases: "all",
22826
- header: "Interactive Session Context (READ FIRST)",
22827
- filterHeaders: false,
22828
- maxLines: 0
22829
- },
22830
- showInStatus: false
22831
- }
22832
- ];
22833
- function getDocumentNames() {
22834
- return TASK_DOCUMENTS.map((d) => d.name);
22835
- }
22836
- function getScaffoldDocuments() {
22837
- return TASK_DOCUMENTS.filter((d) => d.scaffold !== null);
19624
+ // packages/core/src/format.ts
19625
+ function formatTaskName(name) {
19626
+ return name.trim().toLowerCase().replace(/[\s_]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
22838
19627
  }
22839
19628
 
22840
- // packages/core/src/templates.ts
22841
- function resolveTemplatePath(name) {
22842
- return join4(resolveScaffoldsDir(), `${name}.md`);
22843
- }
22844
- function scaffoldTaskDocuments(taskDir) {
22845
- const storage = getStorage();
22846
- for (const doc2 of getScaffoldDocuments()) {
22847
- const dest = join4(taskDir, doc2.name);
22848
- if (storage.read(dest) !== null)
22849
- continue;
22850
- const tmpl = storage.read(resolveTemplatePath(doc2.scaffold));
22851
- if (tmpl !== null) {
22852
- storage.write(dest, tmpl);
22853
- } else if (doc2.fallbackContent) {
22854
- storage.write(dest, doc2.fallbackContent);
22855
- }
22856
- }
19629
+ // packages/core/src/state.ts
19630
+ var STATE_FILE = ".ralph-state.json";
19631
+ function readState(changeDir) {
19632
+ const filePath = join(changeDir, STATE_FILE);
19633
+ const raw = getStorage().read(filePath);
19634
+ if (raw === null)
19635
+ throw new Error(`.ralph-state.json not found in ${changeDir}`);
19636
+ return StateSchema.parse(JSON.parse(raw));
22857
19637
  }
22858
- function scaffoldTasksDir(tasksDir) {
22859
- const templateDir = resolveTasksDir();
22860
- if (!existsSync2(templateDir))
22861
- return;
22862
- const storage = getStorage();
22863
- for (const file of readdirSync3(templateDir)) {
22864
- const src = join4(templateDir, file);
22865
- if (statSync(src).isDirectory())
22866
- continue;
22867
- const dest = join4(tasksDir, file);
22868
- if (storage.read(dest) === null) {
22869
- const content = readFileSync3(src, "utf-8");
22870
- storage.write(dest, content);
22871
- }
22872
- }
19638
+ function writeState(changeDir, state) {
19639
+ const filePath = join(changeDir, STATE_FILE);
19640
+ getStorage().write(filePath, JSON.stringify(state, null, 2) + `
19641
+ `);
19642
+ }
19643
+ function buildInitialState(options) {
19644
+ const now = new Date().toISOString();
19645
+ let branch = "main";
19646
+ try {
19647
+ branch = execSync("git branch --show-current", { encoding: "utf-8" }).trim();
19648
+ } catch {}
19649
+ return StateSchema.parse({
19650
+ version: "2",
19651
+ name: formatTaskName(options.name),
19652
+ prompt: options.prompt,
19653
+ engine: options.engine ?? "claude",
19654
+ model: options.model ?? "opus",
19655
+ createdAt: now,
19656
+ lastModified: now,
19657
+ metadata: { branch }
19658
+ });
22873
19659
  }
22874
19660
 
22875
19661
  // apps/mcp/src/tools.ts
22876
- var DOCUMENTS = getDocumentNames();
22877
- function registerTools(server, tasksDir) {
22878
- server.registerTool("ralph_list_tasks", {
22879
- description: "List all ralph tasks with their phase, status, and progress",
19662
+ function safeTool(server, name, config2, callback) {
19663
+ server.registerTool(name, config2, callback);
19664
+ }
19665
+ function registerTools(server, changesDir, changeStore, taskFilesDir = changesDir) {
19666
+ safeTool(server, "ralph_list_changes", {
19667
+ description: "List all active OpenSpec changes with their status",
22880
19668
  inputSchema: {
22881
- includeCompleted: exports_external.boolean().optional().describe("Include tasks in 'done' phase")
19669
+ includeCompleted: exports_external.boolean().optional().describe("Include completed changes")
22882
19670
  }
22883
19671
  }, async ({ includeCompleted }) => {
22884
- return runWithContext(createDefaultContext(), () => {
19672
+ return runWithContext(createDefaultContext(), async () => {
22885
19673
  try {
22886
19674
  const storage = getStorage();
22887
- const entries = storage.list(tasksDir);
22888
- const tasks = [];
22889
- for (const entry of entries) {
22890
- const taskDir = join5(tasksDir, entry);
19675
+ const names = await changeStore.listChanges();
19676
+ const changes = [];
19677
+ for (const name of names) {
19678
+ const changeDir = join2(changesDir, name);
22891
19679
  try {
22892
- const state = readState(taskDir);
22893
- try {
22894
- const phaseConfig = getPhase(state.phase);
22895
- if (!includeCompleted && phaseConfig.terminal)
22896
- continue;
22897
- } catch {}
22898
- let progress = null;
22899
- const progressContent = storage.read(join5(taskDir, "PROGRESS.md"));
22900
- if (progressContent !== null) {
22901
- progress = countProgress(progressContent);
22902
- }
22903
- tasks.push({
19680
+ const state = readState(changeDir);
19681
+ if (!includeCompleted && state.status === "completed")
19682
+ continue;
19683
+ changes.push({
22904
19684
  name: state.name,
22905
- phase: state.phase,
22906
19685
  status: state.status,
22907
- phaseIteration: state.phaseIteration,
22908
- totalIterations: state.totalIterations,
22909
- progress,
19686
+ iteration: state.iteration,
22910
19687
  engine: state.engine,
22911
19688
  model: state.model,
22912
19689
  createdAt: state.createdAt,
22913
19690
  lastModified: state.lastModified
22914
19691
  });
22915
- } catch {}
19692
+ } catch {
19693
+ const stateRaw = storage.read(join2(changeDir, ".ralph-state.json"));
19694
+ if (stateRaw !== null) {
19695
+ changes.push({ name, status: "unknown" });
19696
+ }
19697
+ }
22916
19698
  }
22917
- return { content: [{ type: "text", text: JSON.stringify({ tasks }, null, 2) }] };
19699
+ return {
19700
+ content: [{ type: "text", text: JSON.stringify({ changes }, null, 2) }]
19701
+ };
22918
19702
  } catch (err) {
22919
19703
  return {
22920
19704
  content: [
22921
19705
  {
22922
19706
  type: "text",
22923
- text: `Error listing tasks: ${err instanceof Error ? err.message : err}`
19707
+ text: `Error listing changes: ${err instanceof Error ? err.message : String(err)}`
22924
19708
  }
22925
19709
  ],
22926
19710
  isError: true
@@ -22928,45 +19712,31 @@ function registerTools(server, tasksDir) {
22928
19712
  }
22929
19713
  });
22930
19714
  });
22931
- server.registerTool("ralph_get_task", {
22932
- description: "Get detailed information about a specific task",
22933
- inputSchema: { name: exports_external.string().describe("Task name") }
19715
+ safeTool(server, "ralph_get_change", {
19716
+ description: "Get detailed information about a specific OpenSpec change",
19717
+ inputSchema: { name: exports_external.string().describe("Change name") }
22934
19718
  }, async ({ name }) => {
22935
19719
  return runWithContext(createDefaultContext(), () => {
22936
19720
  try {
22937
19721
  const storage = getStorage();
22938
- const taskDir = join5(tasksDir, name);
22939
- const state = readState(taskDir);
22940
- let progress = null;
22941
- let currentSection = null;
22942
- const progressContent = storage.read(join5(taskDir, "PROGRESS.md"));
22943
- if (progressContent !== null) {
22944
- progress = countProgress(progressContent);
22945
- currentSection = extractCurrentSection(progressContent);
22946
- }
22947
- const documents = [];
22948
- for (const doc2 of DOCUMENTS) {
22949
- if (storage.read(join5(taskDir, doc2)) !== null)
22950
- documents.push(doc2);
22951
- }
22952
- const steering = storage.read(join5(taskDir, "STEERING.md"));
19722
+ const changeDir = join2(changesDir, name);
19723
+ const state = readState(changeDir);
19724
+ const taskDir = join2(taskFilesDir, name);
19725
+ const tasksContent = storage.read(join2(taskDir, "tasks.md"));
19726
+ const proposalContent = storage.read(join2(taskDir, "proposal.md"));
22953
19727
  const result = {
22954
19728
  name: state.name,
22955
19729
  prompt: state.prompt,
22956
- phase: state.phase,
22957
19730
  status: state.status,
22958
- phaseIteration: state.phaseIteration,
22959
- totalIterations: state.totalIterations,
19731
+ iteration: state.iteration,
22960
19732
  engine: state.engine,
22961
19733
  model: state.model,
22962
19734
  createdAt: state.createdAt,
22963
19735
  lastModified: state.lastModified,
22964
- progress,
22965
- currentSection,
22966
- documents,
22967
- steering,
22968
19736
  metadata: state.metadata,
22969
- historyLength: state.history.length
19737
+ historyLength: state.history.length,
19738
+ hasTasks: tasksContent !== null,
19739
+ hasProposal: proposalContent !== null
22970
19740
  };
22971
19741
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
22972
19742
  } catch (err) {
@@ -22974,7 +19744,7 @@ function registerTools(server, tasksDir) {
22974
19744
  content: [
22975
19745
  {
22976
19746
  type: "text",
22977
- text: `Error getting task '${name}': ${err instanceof Error ? err.message : err}`
19747
+ text: `Error getting change '${name}': ${err instanceof Error ? err.message : String(err)}`
22978
19748
  }
22979
19749
  ],
22980
19750
  isError: true
@@ -22982,170 +19752,70 @@ function registerTools(server, tasksDir) {
22982
19752
  }
22983
19753
  });
22984
19754
  });
22985
- server.registerTool("ralph_read_document", {
22986
- description: "Read a document file from a task directory",
19755
+ safeTool(server, "ralph_create_change", {
19756
+ description: "Create a new OpenSpec change and optionally start running it in the background",
22987
19757
  inputSchema: {
22988
- name: exports_external.string().describe("Task name"),
22989
- document: exports_external.enum(DOCUMENTS).describe("Document to read")
19758
+ name: exports_external.string().describe("Change name (used as directory name)"),
19759
+ prompt: exports_external.string().describe("Change description / prompt"),
19760
+ engine: exports_external.string().optional().describe("Engine to use (default: claude)"),
19761
+ model: exports_external.string().optional().describe("Model to use (default: opus)"),
19762
+ run: exports_external.boolean().optional().describe("Start running the change immediately"),
19763
+ maxIterations: exports_external.number().optional().describe("Maximum iterations to run"),
19764
+ maxCostUsd: exports_external.number().optional().describe("Stop when total cost exceeds this USD amount"),
19765
+ maxRuntimeMinutes: exports_external.number().optional().describe("Stop after this many minutes of wall-clock time")
22990
19766
  }
22991
- }, async ({ name, document }) => {
19767
+ }, async ({ name, prompt, engine, model, run, maxIterations, maxCostUsd, maxRuntimeMinutes }) => {
22992
19768
  return runWithContext(createDefaultContext(), () => {
22993
19769
  try {
22994
- const content = getStorage().read(join5(tasksDir, name, document));
22995
- if (content === null) {
19770
+ const changeDir = join2(changesDir, name);
19771
+ const stateExists = getStorage().read(join2(changeDir, ".ralph-state.json")) !== null;
19772
+ if (!stateExists) {
19773
+ const state = buildInitialState({
19774
+ name,
19775
+ prompt,
19776
+ ...engine !== undefined && { engine },
19777
+ ...model !== undefined && { model }
19778
+ });
19779
+ writeState(changeDir, state);
19780
+ }
19781
+ if (!run) {
19782
+ const taskFilesPath = join2(taskFilesDir, name);
22996
19783
  return {
22997
19784
  content: [
22998
19785
  {
22999
19786
  type: "text",
23000
- text: `Document '${document}' does not exist for task '${name}'`
19787
+ text: JSON.stringify({
19788
+ created: name,
19789
+ stateDir: changeDir,
19790
+ taskFilesDir: taskFilesPath,
19791
+ note: "Write proposal.md, design.md, tasks.md, specs/ to taskFilesDir. State (.ralph-state.json) is managed automatically in stateDir."
19792
+ }, null, 2)
23001
19793
  }
23002
- ],
23003
- isError: true
23004
- };
23005
- }
23006
- return { content: [{ type: "text", text: content }] };
23007
- } catch (err) {
23008
- return {
23009
- content: [
23010
- {
23011
- type: "text",
23012
- text: `Error reading document: ${err instanceof Error ? err.message : err}`
23013
- }
23014
- ],
23015
- isError: true
23016
- };
23017
- }
23018
- });
23019
- });
23020
- server.registerTool("ralph_create_task", {
23021
- description: "Create a new ralph task with initial state and steering file",
23022
- inputSchema: {
23023
- name: exports_external.string().describe("Task name (used as directory name)"),
23024
- prompt: exports_external.string().describe("Task prompt/description"),
23025
- engine: exports_external.string().optional().describe("Engine to use (default: claude)"),
23026
- model: exports_external.string().optional().describe("Model to use (default: opus)")
23027
- }
23028
- }, async ({ name, prompt, engine, model }) => {
23029
- return runWithContext(createDefaultContext(), () => {
23030
- try {
23031
- const storage = getStorage();
23032
- const taskDir = join5(tasksDir, name);
23033
- if (storage.read(join5(taskDir, "state.json")) !== null) {
23034
- return {
23035
- content: [{ type: "text", text: `Task '${name}' already exists` }],
23036
- isError: true
23037
- };
23038
- }
23039
- const state = buildInitialState({
23040
- name,
23041
- prompt,
23042
- ...engine !== undefined && { engine },
23043
- ...model !== undefined && { model }
23044
- });
23045
- writeState(taskDir, state);
23046
- scaffoldTaskDocuments(taskDir);
23047
- return {
23048
- content: [
23049
- {
23050
- type: "text",
23051
- text: JSON.stringify({ created: name, phase: state.phase, taskDir }, null, 2)
23052
- }
23053
- ]
23054
- };
23055
- } catch (err) {
23056
- return {
23057
- content: [
23058
- {
23059
- type: "text",
23060
- text: `Error creating task: ${err instanceof Error ? err.message : err}`
23061
- }
23062
- ],
23063
- isError: true
23064
- };
23065
- }
23066
- });
23067
- });
23068
- server.registerTool("ralph_run_task", {
23069
- description: "Start running a task in the background (spawns a detached subprocess)",
23070
- inputSchema: {
23071
- name: exports_external.string().describe("Task name"),
23072
- maxIterations: exports_external.number().optional().describe("Maximum iterations to run"),
23073
- maxCostUsd: exports_external.number().optional().describe("Stop when total cost exceeds this USD amount"),
23074
- maxRuntimeMinutes: exports_external.number().optional().describe("Stop after this many minutes of wall-clock time"),
23075
- engine: exports_external.string().optional().describe("Engine override"),
23076
- model: exports_external.string().optional().describe("Model override")
23077
- }
23078
- }, async ({ name, maxIterations, maxCostUsd, maxRuntimeMinutes, engine, model }) => {
23079
- return runWithContext(createDefaultContext(), () => {
23080
- try {
23081
- const taskDir = join5(tasksDir, name);
23082
- if (getStorage().read(join5(taskDir, "state.json")) === null) {
23083
- return {
23084
- content: [{ type: "text", text: `Task '${name}' does not exist` }],
23085
- isError: true
19794
+ ]
23086
19795
  };
23087
19796
  }
23088
- const args = ["run", "apps/cli/src/index.ts", "task", "--name", name];
19797
+ const cliArgs = ["run", "apps/cli/src/index.ts", "task", "--name", name];
23089
19798
  if (maxIterations)
23090
- args.push(String(maxIterations));
19799
+ cliArgs.push("--max-iterations", String(maxIterations));
23091
19800
  if (maxCostUsd)
23092
- args.push("--max-cost", String(maxCostUsd));
19801
+ cliArgs.push("--max-cost", String(maxCostUsd));
23093
19802
  if (maxRuntimeMinutes)
23094
- args.push("--max-runtime", String(maxRuntimeMinutes));
19803
+ cliArgs.push("--max-runtime", String(maxRuntimeMinutes));
23095
19804
  if (engine)
23096
- args.push("--engine", engine);
19805
+ cliArgs.push("--" + engine);
23097
19806
  if (model)
23098
- args.push("--model", model);
23099
- const child = spawn("bun", args, {
19807
+ cliArgs.push("--model", model);
19808
+ const child = spawn("bun", cliArgs, {
23100
19809
  detached: true,
23101
- stdio: "ignore",
23102
- cwd: join5(tasksDir, "..", "..")
19810
+ stdio: "ignore"
23103
19811
  });
23104
19812
  child.unref();
23105
19813
  return {
23106
19814
  content: [
23107
19815
  {
23108
19816
  type: "text",
23109
- text: JSON.stringify({ started: name, pid: child.pid }, null, 2)
23110
- }
23111
- ]
23112
- };
23113
- } catch (err) {
23114
- return {
23115
- content: [
23116
- {
23117
- type: "text",
23118
- text: `Error running task: ${err instanceof Error ? err.message : err}`
19817
+ text: JSON.stringify({ created: name, started: true, pid: child.pid }, null, 2)
23119
19818
  }
23120
- ],
23121
- isError: true
23122
- };
23123
- }
23124
- });
23125
- });
23126
- server.registerTool("ralph_advance_phase", {
23127
- description: "Advance a task to its next phase, or set a specific phase",
23128
- inputSchema: {
23129
- name: exports_external.string().describe("Task name"),
23130
- phase: exports_external.string().optional().describe("Target phase (if omitted, advances to next phase)")
23131
- }
23132
- }, async ({ name, phase }) => {
23133
- return runWithContext(createDefaultContext(), () => {
23134
- try {
23135
- const taskDir = join5(tasksDir, name);
23136
- const state = readState(taskDir);
23137
- const from = state.phase;
23138
- let updated;
23139
- if (phase) {
23140
- updated = setPhase(state, taskDir, phase);
23141
- } else {
23142
- updated = advancePhase(state, taskDir);
23143
- writeState(taskDir, updated);
23144
- }
23145
- commitState(taskDir, `advance phase: ${from} -> ${updated.phase}`);
23146
- return {
23147
- content: [
23148
- { type: "text", text: JSON.stringify({ from, to: updated.phase }, null, 2) }
23149
19819
  ]
23150
19820
  };
23151
19821
  } catch (err) {
@@ -23153,41 +19823,7 @@ function registerTools(server, tasksDir) {
23153
19823
  content: [
23154
19824
  {
23155
19825
  type: "text",
23156
- text: `Error advancing phase: ${err instanceof Error ? err.message : err}`
23157
- }
23158
- ],
23159
- isError: true
23160
- };
23161
- }
23162
- });
23163
- });
23164
- server.registerTool("ralph_update_steering", {
23165
- description: "Update the STEERING.md file for a task with new guidance",
23166
- inputSchema: {
23167
- name: exports_external.string().describe("Task name"),
23168
- content: exports_external.string().describe("New STEERING.md content")
23169
- }
23170
- }, async ({ name, content }) => {
23171
- return runWithContext(createDefaultContext(), () => {
23172
- try {
23173
- const storage = getStorage();
23174
- const taskDir = join5(tasksDir, name);
23175
- if (storage.read(join5(taskDir, "state.json")) === null) {
23176
- return {
23177
- content: [{ type: "text", text: `Task '${name}' does not exist` }],
23178
- isError: true
23179
- };
23180
- }
23181
- storage.write(join5(taskDir, "STEERING.md"), content);
23182
- return {
23183
- content: [{ type: "text", text: `Updated STEERING.md for task '${name}'` }]
23184
- };
23185
- } catch (err) {
23186
- return {
23187
- content: [
23188
- {
23189
- type: "text",
23190
- text: `Error updating steering: ${err instanceof Error ? err.message : err}`
19826
+ text: `Error creating change: ${err instanceof Error ? err.message : String(err)}`
23191
19827
  }
23192
19828
  ],
23193
19829
  isError: true
@@ -23195,86 +19831,32 @@ function registerTools(server, tasksDir) {
23195
19831
  }
23196
19832
  });
23197
19833
  });
23198
- server.registerTool("ralph_finish_interactive", {
23199
- description: "Finish the interactive planning session. Call this with a summary of everything learned " + "from the conversation: requirements, decisions, constraints, and context. " + "This writes the summary to STEERING.md so all subsequent automated phases have full context. " + "After calling this tool you MUST immediately use /exit to end your session.",
19834
+ safeTool(server, "ralph_append_steering", {
19835
+ description: "Append a steering message to the ## Steering section in proposal.md for a change",
23200
19836
  inputSchema: {
23201
- name: exports_external.string().describe("Task name"),
23202
- context: exports_external.string().describe("Comprehensive summary of the interactive session: refined requirements, " + "architectural decisions, constraints, edge cases, and any user preferences discussed")
19837
+ name: exports_external.string().describe("Change name"),
19838
+ message: exports_external.string().describe("Steering message to append")
23203
19839
  }
23204
- }, async ({ name, context }) => {
23205
- return runWithContext(createDefaultContext(), () => {
19840
+ }, async ({ name, message }) => {
19841
+ return runWithContext(createDefaultContext(), async () => {
23206
19842
  try {
23207
- const storage = getStorage();
23208
- const taskDir = join5(tasksDir, name);
23209
- if (storage.read(join5(taskDir, "state.json")) === null) {
19843
+ const changeDir = join2(changesDir, name);
19844
+ if (getStorage().read(join2(changeDir, ".ralph-state.json")) === null) {
23210
19845
  return {
23211
- content: [{ type: "text", text: `Task '${name}' does not exist` }],
19846
+ content: [{ type: "text", text: `Change '${name}' does not exist` }],
23212
19847
  isError: true
23213
19848
  };
23214
19849
  }
23215
- const interactiveContent = [
23216
- "# Interactive Session Context",
23217
- "",
23218
- "**This context was gathered during an interactive planning session with the user.**",
23219
- "**Treat these as authoritative requirements and decisions.**",
23220
- "",
23221
- context
23222
- ].join(`
23223
- `);
23224
- storage.write(join5(taskDir, "INTERACTIVE.md"), interactiveContent);
23225
- storage.write(join5(taskDir, "_interactive_done"), new Date().toISOString());
23226
- commitState(taskDir, `interactive: save session context for ${name}`);
23227
- return {
23228
- content: [
23229
- {
23230
- type: "text",
23231
- text: [
23232
- `Interactive session complete. Context saved to STEERING.md for task '${name}'.`,
23233
- "",
23234
- "The automated ralph loop will now run all phases (research \u2192 plan \u2192 exec \u2192 review) with this context.",
23235
- "",
23236
- "IMPORTANT: Tell the user to run /exit to end this session so the automated loop can continue.",
23237
- "You cannot exit on your own \u2014 the user must type /exit in the terminal."
23238
- ].join(`
23239
- `)
23240
- }
23241
- ]
23242
- };
23243
- } catch (err) {
23244
- return {
23245
- content: [
23246
- {
23247
- type: "text",
23248
- text: `Error finishing interactive session: ${err instanceof Error ? err.message : err}`
23249
- }
23250
- ],
23251
- isError: true
23252
- };
23253
- }
23254
- });
23255
- });
23256
- server.registerTool("ralph_list_checklists", {
23257
- description: "List available verification checklists with their contents",
23258
- inputSchema: {}
23259
- }, async () => {
23260
- return runWithContext(createDefaultContext(), () => {
23261
- try {
23262
- const storage = getStorage();
23263
- const dir = resolveChecklistDir();
23264
- const names = listChecklists();
23265
- const checklists = names.map((name) => ({
23266
- name,
23267
- content: storage.read(join5(dir, `${name}.md`)) ?? ""
23268
- }));
19850
+ await changeStore.appendSteering(name, message);
23269
19851
  return {
23270
- content: [{ type: "text", text: JSON.stringify({ checklists }, null, 2) }]
19852
+ content: [{ type: "text", text: `Steering appended to change '${name}'` }]
23271
19853
  };
23272
19854
  } catch (err) {
23273
19855
  return {
23274
19856
  content: [
23275
19857
  {
23276
19858
  type: "text",
23277
- text: `Error listing checklists: ${err instanceof Error ? err.message : err}`
19859
+ text: `Error appending steering: ${err instanceof Error ? err.message : String(err)}`
23278
19860
  }
23279
19861
  ],
23280
19862
  isError: true
@@ -23282,68 +19864,26 @@ function registerTools(server, tasksDir) {
23282
19864
  }
23283
19865
  });
23284
19866
  });
23285
- server.registerTool("ralph_apply_checklist", {
23286
- description: "Append verification checklists as new sections at the end of a task's PROGRESS.md",
19867
+ safeTool(server, "ralph_stop", {
19868
+ description: "Stop a running change by writing a STOP signal file",
23287
19869
  inputSchema: {
23288
- name: exports_external.string().describe("Task name"),
23289
- checklists: exports_external.array(exports_external.string()).describe('Checklist names to append (e.g. ["static", "tests"])')
19870
+ name: exports_external.string().describe("Change name"),
19871
+ reason: exports_external.string().optional().describe("Reason for stopping")
23290
19872
  }
23291
- }, async ({ name, checklists }) => {
19873
+ }, async ({ name, reason }) => {
23292
19874
  return runWithContext(createDefaultContext(), () => {
23293
19875
  try {
23294
- const storage = getStorage();
23295
- const taskDir = join5(tasksDir, name);
23296
- if (storage.read(join5(taskDir, "state.json")) === null) {
23297
- return {
23298
- content: [{ type: "text", text: `Task '${name}' does not exist` }],
23299
- isError: true
23300
- };
23301
- }
23302
- const progressPath = join5(taskDir, "PROGRESS.md");
23303
- let progress = storage.read(progressPath);
23304
- if (progress === null) {
23305
- return {
23306
- content: [
23307
- {
23308
- type: "text",
23309
- text: `PROGRESS.md does not exist for task '${name}'`
23310
- }
23311
- ],
23312
- isError: true
23313
- };
23314
- }
23315
- const sectionMatches = progress.match(/^## Section \d+/gm);
23316
- let nextSection = (sectionMatches?.length ?? 0) + 1;
23317
- const dir = resolveChecklistDir();
23318
- const applied = [];
23319
- for (const cl of checklists) {
23320
- const raw = storage.read(join5(dir, `${cl}.md`));
23321
- if (raw === null)
23322
- continue;
23323
- const { title, body } = parseChecklist(raw);
23324
- progress += `
23325
- ## Section ${nextSection} \u2014 ${title}
23326
-
23327
- ${body.trimEnd()}
23328
- `;
23329
- nextSection++;
23330
- applied.push(cl);
23331
- }
23332
- storage.write(progressPath, progress);
19876
+ const taskDir = join2(taskFilesDir, name);
19877
+ getStorage().write(join2(taskDir, "STOP"), reason ?? "Stopped via MCP");
23333
19878
  return {
23334
- content: [
23335
- {
23336
- type: "text",
23337
- text: JSON.stringify({ applied, totalSections: nextSection - 1 }, null, 2)
23338
- }
23339
- ]
19879
+ content: [{ type: "text", text: `Stop signal written for change '${name}'` }]
23340
19880
  };
23341
19881
  } catch (err) {
23342
19882
  return {
23343
19883
  content: [
23344
19884
  {
23345
19885
  type: "text",
23346
- text: `Error applying checklists: ${err instanceof Error ? err.message : err}`
19886
+ text: `Error stopping change: ${err instanceof Error ? err.message : String(err)}`
23347
19887
  }
23348
19888
  ],
23349
19889
  isError: true
@@ -23352,121 +19892,30 @@ ${body.trimEnd()}
23352
19892
  });
23353
19893
  });
23354
19894
  }
23355
- function parseChecklist(content) {
23356
- const match = content.match(/^# (.+)\n/);
23357
- if (match) {
23358
- return { title: match[1], body: content.slice(match[0].length).replace(/^\n+/, "") };
23359
- }
23360
- return { title: "Checklist", body: content };
23361
- }
23362
19895
 
23363
19896
  // apps/mcp/src/prompts.ts
19897
+ function textPrompt(text) {
19898
+ return {
19899
+ messages: [{ role: "user", content: { type: "text", text } }]
19900
+ };
19901
+ }
19902
+ function registerPrompt(server, name, description, argsSchema, cb) {
19903
+ server.prompt(name, description, argsSchema, cb);
19904
+ }
23364
19905
  function registerPrompts(server) {
23365
- server.registerPrompt("ralph-create", {
23366
- title: "Create Ralph Task",
23367
- description: "Create a new ralph task",
23368
- argsSchema: {
23369
- name: exports_external.string().describe("Task name"),
23370
- prompt: exports_external.string().describe("Task description")
23371
- }
23372
- }, async ({ name, prompt }) => ({
23373
- messages: [
23374
- {
23375
- role: "user",
23376
- content: {
23377
- type: "text",
23378
- text: `Create a new ralph task named "${name}" with the following prompt:
19906
+ registerPrompt(server, "ralph-create", "Create a new ralph task", { name: exports_external.string().describe("Task name"), prompt: exports_external.string().describe("Task description") }, async (args) => textPrompt(`Create a new ralph task named "${args.name}" with the following prompt:
23379
19907
 
23380
- ${prompt}`
23381
- }
23382
- }
23383
- ]
23384
- }));
23385
- server.registerPrompt("ralph-list", {
23386
- title: "List Ralph Tasks",
23387
- description: "List all active ralph tasks with status"
23388
- }, async () => ({
23389
- messages: [
23390
- {
23391
- role: "user",
23392
- content: {
23393
- type: "text",
23394
- text: "List all ralph tasks and show their current phase, status, and progress."
23395
- }
23396
- }
23397
- ]
23398
- }));
23399
- server.registerPrompt("ralph-status", {
23400
- title: "Ralph Task Status",
23401
- description: "Get detailed status of a specific task",
23402
- argsSchema: {
23403
- name: exports_external.string().describe("Task name")
23404
- }
23405
- }, async ({ name }) => ({
23406
- messages: [
23407
- {
23408
- role: "user",
23409
- content: {
23410
- type: "text",
23411
- text: `Get the detailed status of ralph task "${name}", including its phase, progress, and any steering guidance.`
23412
- }
23413
- }
23414
- ]
23415
- }));
23416
- server.registerPrompt("ralph-run", {
23417
- title: "Run Ralph Task",
23418
- description: "Run a ralph task in the background",
23419
- argsSchema: {
23420
- name: exports_external.string().describe("Task name")
23421
- }
23422
- }, async ({ name }) => ({
23423
- messages: [
23424
- {
23425
- role: "user",
23426
- content: {
23427
- type: "text",
23428
- text: `Run ralph task "${name}" in the background.`
23429
- }
23430
- }
23431
- ]
23432
- }));
23433
- server.registerPrompt("ralph-advance", {
23434
- title: "Advance Ralph Task",
23435
- description: "Advance a ralph task to its next phase",
23436
- argsSchema: {
23437
- name: exports_external.string().describe("Task name")
23438
- }
23439
- }, async ({ name }) => ({
23440
- messages: [
23441
- {
23442
- role: "user",
23443
- content: {
23444
- type: "text",
23445
- text: `Advance ralph task "${name}" to its next phase.`
23446
- }
23447
- }
23448
- ]
23449
- }));
23450
- server.registerPrompt("ralph-steer", {
23451
- title: "Steer Ralph Task",
23452
- description: "Update STEERING.md with new guidance for a task",
23453
- argsSchema: {
23454
- name: exports_external.string().describe("Task name"),
23455
- guidance: exports_external.string().describe("Steering guidance to add")
23456
- }
23457
- }, async ({ name, guidance }) => ({
23458
- messages: [
23459
- {
23460
- role: "user",
23461
- content: {
23462
- type: "text",
23463
- text: `Update the STEERING.md for ralph task "${name}" with the following guidance:
19908
+ ${args.prompt}`));
19909
+ server.prompt("ralph-list", "List all active ralph tasks with status", async () => textPrompt("List all ralph tasks and show their current phase, status, and progress."));
19910
+ registerPrompt(server, "ralph-status", "Get detailed status of a specific task", { name: exports_external.string().describe("Task name") }, async (args) => textPrompt(`Get the detailed status of ralph task "${args.name}", including its phase, progress, and any steering guidance.`));
19911
+ registerPrompt(server, "ralph-run", "Run a ralph task in the background", { name: exports_external.string().describe("Task name") }, async (args) => textPrompt(`Run ralph task "${args.name}" in the background.`));
19912
+ registerPrompt(server, "ralph-advance", "Advance a ralph task to its next phase", { name: exports_external.string().describe("Task name") }, async (args) => textPrompt(`Advance ralph task "${args.name}" to its next phase.`));
19913
+ registerPrompt(server, "ralph-steer", "Update STEERING.md with new guidance for a task", {
19914
+ name: exports_external.string().describe("Task name"),
19915
+ guidance: exports_external.string().describe("Steering guidance to add")
19916
+ }, async (args) => textPrompt(`Update the STEERING.md for ralph task "${args.name}" with the following guidance:
23464
19917
 
23465
- ${guidance}`
23466
- }
23467
- }
23468
- ]
23469
- }));
19918
+ ${args.guidance}`));
23470
19919
  }
23471
19920
 
23472
19921
  // node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
@@ -23978,36 +20427,142 @@ function error2(msg) {
23978
20427
  console.error(typeof msg === "string" ? msg : format(msg));
23979
20428
  }
23980
20429
 
20430
+ // packages/openspec/src/openspec-change-store.ts
20431
+ import { join as join3 } from "path";
20432
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, readdirSync as readdirSync2, existsSync as existsSync2 } from "fs";
20433
+ import { spawnSync } from "child_process";
20434
+
20435
+ class OpenSpecChangeStore {
20436
+ createChange(name, description) {
20437
+ const result = spawnSync("bunx", ["openspec", "new", "change", name, "--description", description], { stdio: "inherit", encoding: "utf-8" });
20438
+ if (result.status !== 0) {
20439
+ throw new Error(`openspec new change failed with exit code ${result.status ?? "unknown"}`);
20440
+ }
20441
+ return Promise.resolve();
20442
+ }
20443
+ getChangeDirectory(name) {
20444
+ return join3("openspec", "changes", name);
20445
+ }
20446
+ listChanges() {
20447
+ const result = spawnSync("bunx", ["openspec", "list", "--json"], { encoding: "utf-8" });
20448
+ if (result.stdout) {
20449
+ try {
20450
+ const parsed = JSON.parse(result.stdout);
20451
+ if (Array.isArray(parsed)) {
20452
+ return Promise.resolve(parsed.map((item) => String(item)));
20453
+ }
20454
+ if (parsed && typeof parsed === "object" && "changes" in parsed && parsed.changes) {
20455
+ return Promise.resolve(parsed.changes.map((change) => change.name));
20456
+ }
20457
+ } catch {}
20458
+ }
20459
+ const changesDir = join3("openspec", "changes");
20460
+ if (!existsSync2(changesDir))
20461
+ return Promise.resolve([]);
20462
+ const names = readdirSync2(changesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
20463
+ return Promise.resolve(names);
20464
+ }
20465
+ readTaskList(name) {
20466
+ const path = join3("openspec", "changes", name, "tasks.md");
20467
+ if (!existsSync2(path))
20468
+ return Promise.resolve("");
20469
+ return Promise.resolve(readFileSync2(path, "utf-8"));
20470
+ }
20471
+ writeTaskList(name, content) {
20472
+ const path = join3("openspec", "changes", name, "tasks.md");
20473
+ writeFileSync2(path, content, "utf-8");
20474
+ return Promise.resolve();
20475
+ }
20476
+ appendSteering(name, message) {
20477
+ const path = join3("openspec", "changes", name, "steering.md");
20478
+ const existing = existsSync2(path) ? readFileSync2(path, "utf-8") : null;
20479
+ const updated = existing ? `${message}
20480
+
20481
+ ${existing.trimStart()}` : `${message}
20482
+ `;
20483
+ writeFileSync2(path, updated, "utf-8");
20484
+ return Promise.resolve();
20485
+ }
20486
+ readSection(name, artifact, heading) {
20487
+ const path = join3("openspec", "changes", name, artifact);
20488
+ if (!existsSync2(path))
20489
+ return Promise.resolve("");
20490
+ const content = readFileSync2(path, "utf-8");
20491
+ const headingIndex = content.indexOf(heading);
20492
+ if (headingIndex === -1)
20493
+ return Promise.resolve("");
20494
+ const afterHeading = content.slice(headingIndex + heading.length);
20495
+ const levelMatch = heading.match(/^(#+)/);
20496
+ const level = levelMatch ? levelMatch[1].length : 2;
20497
+ const nextHeadingPattern = new RegExp(`\\n#{1,${level}} `);
20498
+ const nextMatch = afterHeading.match(nextHeadingPattern);
20499
+ const sectionContent = nextMatch ? afterHeading.slice(0, nextMatch.index) : afterHeading;
20500
+ return Promise.resolve(sectionContent.trim());
20501
+ }
20502
+ validateChange(name) {
20503
+ const result = spawnSync("bunx", ["openspec", "validate", name, "--json", "--no-interactive"], {
20504
+ encoding: "utf-8"
20505
+ });
20506
+ if (result.stdout) {
20507
+ try {
20508
+ const parsed = JSON.parse(result.stdout);
20509
+ return Promise.resolve({
20510
+ valid: parsed.valid ?? result.status === 0,
20511
+ warnings: parsed.warnings ?? [],
20512
+ errors: parsed.errors ?? []
20513
+ });
20514
+ } catch {}
20515
+ }
20516
+ return Promise.resolve({
20517
+ valid: result.status === 0,
20518
+ warnings: [],
20519
+ errors: result.stderr ? [result.stderr] : []
20520
+ });
20521
+ }
20522
+ archiveChange(name) {
20523
+ const result = spawnSync("bunx", ["openspec", "archive", name, "-y", "--skip-specs"], {
20524
+ stdio: "inherit",
20525
+ encoding: "utf-8"
20526
+ });
20527
+ if (result.status !== 0) {
20528
+ throw new Error(`openspec archive failed with exit code ${result.status ?? "unknown"}`);
20529
+ }
20530
+ return Promise.resolve();
20531
+ }
20532
+ }
23981
20533
  // apps/mcp/src/index.ts
23982
- function resolveTasksDir2(startDir) {
20534
+ function findProjectRoot(startDir) {
23983
20535
  let dir = startDir;
23984
20536
  while (dir !== "/") {
23985
- const candidate = join6(dir, ".ralph", "tasks");
23986
- if (existsSync3(candidate))
23987
- return candidate;
23988
- dir = resolve3(dir, "..");
20537
+ if (existsSync3(join4(dir, "openspec")))
20538
+ return dir;
20539
+ dir = resolve(dir, "..");
23989
20540
  }
23990
- return join6(startDir, ".ralph", "tasks");
20541
+ return startDir;
23991
20542
  }
23992
20543
  async function main() {
23993
20544
  const args = process.argv.slice(2);
23994
- let projectDir = process.cwd();
20545
+ let startDir = process.cwd();
23995
20546
  const dirIdx = args.indexOf("--dir");
23996
20547
  if (dirIdx !== -1 && args[dirIdx + 1]) {
23997
- projectDir = resolve3(args[dirIdx + 1]);
20548
+ startDir = resolve(args[dirIdx + 1]);
23998
20549
  }
23999
- const tasksDir = resolveTasksDir2(projectDir);
24000
- runWithContext(createDefaultContext(), () => scaffoldTasksDir(tasksDir));
20550
+ const projectRoot = findProjectRoot(startDir);
20551
+ const changesDir = join4(projectRoot, ".ralph", "tasks");
20552
+ const taskFilesDir = join4(projectRoot, "openspec", "changes");
20553
+ const changeStore = new OpenSpecChangeStore;
24001
20554
  const server = new McpServer({
24002
20555
  name: "ralph",
24003
20556
  version: "1.0.0"
24004
20557
  });
24005
- registerTools(server, tasksDir);
24006
- registerPrompts(server);
20558
+ runWithContext(createDefaultContext(), () => {
20559
+ registerTools(server, changesDir, changeStore, taskFilesDir);
20560
+ registerPrompts(server);
20561
+ });
24007
20562
  const transport = new StdioServerTransport;
24008
20563
  await server.connect(transport);
24009
20564
  }
24010
20565
  await main().catch((err) => {
24011
- error2(err instanceof Error ? err.message : err);
20566
+ error2(err instanceof Error ? err.message : String(err));
24012
20567
  process.exit(1);
24013
20568
  });