@telepath-computer/television 0.1.104 → 0.1.106
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/cli.cjs +1146 -149
- package/dist/skills/television/SKILL.md +10 -0
- package/dist/views/markdown/index.html +7 -7
- package/dist/web/assets/index-dt9xJolN.js +559 -0
- package/dist/web/index.html +1 -1
- package/package.json +4 -4
- package/dist/web/assets/index-BBB99HrI.js +0 -559
package/dist/cli.cjs
CHANGED
|
@@ -6173,9 +6173,8 @@ var require_side_channel_list = __commonJS({
|
|
|
6173
6173
|
}
|
|
6174
6174
|
},
|
|
6175
6175
|
"delete": function(key) {
|
|
6176
|
-
var root = $o && $o.next;
|
|
6177
6176
|
var deletedNode = listDelete($o, key);
|
|
6178
|
-
if (deletedNode &&
|
|
6177
|
+
if (deletedNode && $o && !$o.next) {
|
|
6179
6178
|
$o = void 0;
|
|
6180
6179
|
}
|
|
6181
6180
|
return !!deletedNode;
|
|
@@ -21706,10 +21705,7 @@ var require_json = __commonJS({
|
|
|
21706
21705
|
var index = str.indexOf(char);
|
|
21707
21706
|
var partial2 = "";
|
|
21708
21707
|
if (index !== -1) {
|
|
21709
|
-
partial2 = str.substring(0, index) + JSON_SYNTAX_CHAR;
|
|
21710
|
-
for (var i = index + 1; i < str.length; i++) {
|
|
21711
|
-
partial2 += JSON_SYNTAX_CHAR;
|
|
21712
|
-
}
|
|
21708
|
+
partial2 = str.substring(0, index) + new Array(str.length - index + 1).join(JSON_SYNTAX_CHAR);
|
|
21713
21709
|
}
|
|
21714
21710
|
try {
|
|
21715
21711
|
JSON.parse(partial2);
|
|
@@ -21876,9 +21872,9 @@ var require_text = __commonJS({
|
|
|
21876
21872
|
}
|
|
21877
21873
|
});
|
|
21878
21874
|
|
|
21879
|
-
// ../../node_modules/qs/lib/formats.js
|
|
21875
|
+
// ../../node_modules/body-parser/node_modules/qs/lib/formats.js
|
|
21880
21876
|
var require_formats = __commonJS({
|
|
21881
|
-
"../../node_modules/qs/lib/formats.js"(exports2, module2) {
|
|
21877
|
+
"../../node_modules/body-parser/node_modules/qs/lib/formats.js"(exports2, module2) {
|
|
21882
21878
|
"use strict";
|
|
21883
21879
|
var replace = String.prototype.replace;
|
|
21884
21880
|
var percentTwenties = /%20/g;
|
|
@@ -21902,9 +21898,9 @@ var require_formats = __commonJS({
|
|
|
21902
21898
|
}
|
|
21903
21899
|
});
|
|
21904
21900
|
|
|
21905
|
-
// ../../node_modules/qs/lib/utils.js
|
|
21901
|
+
// ../../node_modules/body-parser/node_modules/qs/lib/utils.js
|
|
21906
21902
|
var require_utils = __commonJS({
|
|
21907
|
-
"../../node_modules/qs/lib/utils.js"(exports2, module2) {
|
|
21903
|
+
"../../node_modules/body-parser/node_modules/qs/lib/utils.js"(exports2, module2) {
|
|
21908
21904
|
"use strict";
|
|
21909
21905
|
var formats = require_formats();
|
|
21910
21906
|
var getSideChannel = require_side_channel();
|
|
@@ -21971,6 +21967,8 @@ var require_utils = __commonJS({
|
|
|
21971
21967
|
var newIndex = getMaxIndex(target) + 1;
|
|
21972
21968
|
target[newIndex] = source;
|
|
21973
21969
|
setMaxIndex(target, newIndex);
|
|
21970
|
+
} else if (options && options.strictMerge) {
|
|
21971
|
+
return [target, source];
|
|
21974
21972
|
} else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
|
|
21975
21973
|
target[source] = true;
|
|
21976
21974
|
}
|
|
@@ -22164,9 +22162,9 @@ var require_utils = __commonJS({
|
|
|
22164
22162
|
}
|
|
22165
22163
|
});
|
|
22166
22164
|
|
|
22167
|
-
// ../../node_modules/qs/lib/stringify.js
|
|
22165
|
+
// ../../node_modules/body-parser/node_modules/qs/lib/stringify.js
|
|
22168
22166
|
var require_stringify = __commonJS({
|
|
22169
|
-
"../../node_modules/qs/lib/stringify.js"(exports2, module2) {
|
|
22167
|
+
"../../node_modules/body-parser/node_modules/qs/lib/stringify.js"(exports2, module2) {
|
|
22170
22168
|
"use strict";
|
|
22171
22169
|
var getSideChannel = require_side_channel();
|
|
22172
22170
|
var utils = require_utils();
|
|
@@ -22447,9 +22445,9 @@ var require_stringify = __commonJS({
|
|
|
22447
22445
|
}
|
|
22448
22446
|
});
|
|
22449
22447
|
|
|
22450
|
-
// ../../node_modules/qs/lib/parse.js
|
|
22448
|
+
// ../../node_modules/body-parser/node_modules/qs/lib/parse.js
|
|
22451
22449
|
var require_parse = __commonJS({
|
|
22452
|
-
"../../node_modules/qs/lib/parse.js"(exports2, module2) {
|
|
22450
|
+
"../../node_modules/body-parser/node_modules/qs/lib/parse.js"(exports2, module2) {
|
|
22453
22451
|
"use strict";
|
|
22454
22452
|
var utils = require_utils();
|
|
22455
22453
|
var has = Object.prototype.hasOwnProperty;
|
|
@@ -22474,6 +22472,7 @@ var require_parse = __commonJS({
|
|
|
22474
22472
|
parseArrays: true,
|
|
22475
22473
|
plainObjects: false,
|
|
22476
22474
|
strictDepth: false,
|
|
22475
|
+
strictMerge: true,
|
|
22477
22476
|
strictNullHandling: false,
|
|
22478
22477
|
throwOnLimitExceeded: false
|
|
22479
22478
|
};
|
|
@@ -22500,9 +22499,9 @@ var require_parse = __commonJS({
|
|
|
22500
22499
|
var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
|
|
22501
22500
|
var parts = cleanStr.split(
|
|
22502
22501
|
options.delimiter,
|
|
22503
|
-
options.throwOnLimitExceeded ? limit + 1 : limit
|
|
22502
|
+
options.throwOnLimitExceeded && typeof limit !== "undefined" ? limit + 1 : limit
|
|
22504
22503
|
);
|
|
22505
|
-
if (options.throwOnLimitExceeded && parts.length > limit) {
|
|
22504
|
+
if (options.throwOnLimitExceeded && typeof limit !== "undefined" && parts.length > limit) {
|
|
22506
22505
|
throw new RangeError("Parameter limit exceeded. Only " + limit + " parameter" + (limit === 1 ? "" : "s") + " allowed.");
|
|
22507
22506
|
}
|
|
22508
22507
|
var skipIndex = -1;
|
|
@@ -22562,7 +22561,7 @@ var require_parse = __commonJS({
|
|
|
22562
22561
|
}
|
|
22563
22562
|
if (key !== null) {
|
|
22564
22563
|
var existing = has.call(obj, key);
|
|
22565
|
-
if (existing && options.duplicates === "combine") {
|
|
22564
|
+
if (existing && (options.duplicates === "combine" || part.indexOf("[]=") > -1)) {
|
|
22566
22565
|
obj[key] = utils.combine(
|
|
22567
22566
|
obj[key],
|
|
22568
22567
|
val,
|
|
@@ -22719,6 +22718,7 @@ var require_parse = __commonJS({
|
|
|
22719
22718
|
parseArrays: opts.parseArrays !== false,
|
|
22720
22719
|
plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
|
|
22721
22720
|
strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
|
|
22721
|
+
strictMerge: typeof opts.strictMerge === "boolean" ? !!opts.strictMerge : defaults.strictMerge,
|
|
22722
22722
|
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
22723
22723
|
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
|
|
22724
22724
|
};
|
|
@@ -22744,9 +22744,9 @@ var require_parse = __commonJS({
|
|
|
22744
22744
|
}
|
|
22745
22745
|
});
|
|
22746
22746
|
|
|
22747
|
-
// ../../node_modules/qs/lib/index.js
|
|
22747
|
+
// ../../node_modules/body-parser/node_modules/qs/lib/index.js
|
|
22748
22748
|
var require_lib2 = __commonJS({
|
|
22749
|
-
"../../node_modules/qs/lib/index.js"(exports2, module2) {
|
|
22749
|
+
"../../node_modules/body-parser/node_modules/qs/lib/index.js"(exports2, module2) {
|
|
22750
22750
|
"use strict";
|
|
22751
22751
|
var stringify = require_stringify();
|
|
22752
22752
|
var parse3 = require_parse();
|
|
@@ -22877,14 +22877,14 @@ var require_urlencoded = __commonJS({
|
|
|
22877
22877
|
}
|
|
22878
22878
|
function parameterCount(body, limit) {
|
|
22879
22879
|
var count = 0;
|
|
22880
|
-
var index =
|
|
22881
|
-
|
|
22880
|
+
var index = -1;
|
|
22881
|
+
do {
|
|
22882
22882
|
count++;
|
|
22883
|
-
|
|
22884
|
-
if (count === limit) {
|
|
22883
|
+
if (count > limit) {
|
|
22885
22884
|
return void 0;
|
|
22886
22885
|
}
|
|
22887
|
-
|
|
22886
|
+
index = body.indexOf("&", index + 1);
|
|
22887
|
+
} while (index !== -1);
|
|
22888
22888
|
return count;
|
|
22889
22889
|
}
|
|
22890
22890
|
function parser(name) {
|
|
@@ -24993,13 +24993,896 @@ var require_init = __commonJS({
|
|
|
24993
24993
|
}
|
|
24994
24994
|
});
|
|
24995
24995
|
|
|
24996
|
+
// ../../node_modules/qs/lib/formats.js
|
|
24997
|
+
var require_formats2 = __commonJS({
|
|
24998
|
+
"../../node_modules/qs/lib/formats.js"(exports2, module2) {
|
|
24999
|
+
"use strict";
|
|
25000
|
+
var replace = String.prototype.replace;
|
|
25001
|
+
var percentTwenties = /%20/g;
|
|
25002
|
+
var Format = {
|
|
25003
|
+
RFC1738: "RFC1738",
|
|
25004
|
+
RFC3986: "RFC3986"
|
|
25005
|
+
};
|
|
25006
|
+
module2.exports = {
|
|
25007
|
+
"default": Format.RFC3986,
|
|
25008
|
+
formatters: {
|
|
25009
|
+
RFC1738: function(value) {
|
|
25010
|
+
return replace.call(value, percentTwenties, "+");
|
|
25011
|
+
},
|
|
25012
|
+
RFC3986: function(value) {
|
|
25013
|
+
return String(value);
|
|
25014
|
+
}
|
|
25015
|
+
},
|
|
25016
|
+
RFC1738: Format.RFC1738,
|
|
25017
|
+
RFC3986: Format.RFC3986
|
|
25018
|
+
};
|
|
25019
|
+
}
|
|
25020
|
+
});
|
|
25021
|
+
|
|
25022
|
+
// ../../node_modules/qs/lib/utils.js
|
|
25023
|
+
var require_utils2 = __commonJS({
|
|
25024
|
+
"../../node_modules/qs/lib/utils.js"(exports2, module2) {
|
|
25025
|
+
"use strict";
|
|
25026
|
+
var formats = require_formats2();
|
|
25027
|
+
var getSideChannel = require_side_channel();
|
|
25028
|
+
var has = Object.prototype.hasOwnProperty;
|
|
25029
|
+
var isArray = Array.isArray;
|
|
25030
|
+
var overflowChannel = getSideChannel();
|
|
25031
|
+
var markOverflow = function markOverflow2(obj, maxIndex) {
|
|
25032
|
+
overflowChannel.set(obj, maxIndex);
|
|
25033
|
+
return obj;
|
|
25034
|
+
};
|
|
25035
|
+
var isOverflow = function isOverflow2(obj) {
|
|
25036
|
+
return overflowChannel.has(obj);
|
|
25037
|
+
};
|
|
25038
|
+
var getMaxIndex = function getMaxIndex2(obj) {
|
|
25039
|
+
return overflowChannel.get(obj);
|
|
25040
|
+
};
|
|
25041
|
+
var setMaxIndex = function setMaxIndex2(obj, maxIndex) {
|
|
25042
|
+
overflowChannel.set(obj, maxIndex);
|
|
25043
|
+
};
|
|
25044
|
+
var hexTable = function() {
|
|
25045
|
+
var array2 = [];
|
|
25046
|
+
for (var i = 0; i < 256; ++i) {
|
|
25047
|
+
array2[array2.length] = "%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase();
|
|
25048
|
+
}
|
|
25049
|
+
return array2;
|
|
25050
|
+
}();
|
|
25051
|
+
var compactQueue = function compactQueue2(queue) {
|
|
25052
|
+
while (queue.length > 1) {
|
|
25053
|
+
var item = queue.pop();
|
|
25054
|
+
var obj = item.obj[item.prop];
|
|
25055
|
+
if (isArray(obj)) {
|
|
25056
|
+
var compacted = [];
|
|
25057
|
+
for (var j = 0; j < obj.length; ++j) {
|
|
25058
|
+
if (typeof obj[j] !== "undefined") {
|
|
25059
|
+
compacted[compacted.length] = obj[j];
|
|
25060
|
+
}
|
|
25061
|
+
}
|
|
25062
|
+
item.obj[item.prop] = compacted;
|
|
25063
|
+
}
|
|
25064
|
+
}
|
|
25065
|
+
};
|
|
25066
|
+
var arrayToObject = function arrayToObject2(source, options) {
|
|
25067
|
+
var obj = options && options.plainObjects ? { __proto__: null } : {};
|
|
25068
|
+
for (var i = 0; i < source.length; ++i) {
|
|
25069
|
+
if (typeof source[i] !== "undefined") {
|
|
25070
|
+
obj[i] = source[i];
|
|
25071
|
+
}
|
|
25072
|
+
}
|
|
25073
|
+
return obj;
|
|
25074
|
+
};
|
|
25075
|
+
var merge2 = function merge3(target, source, options) {
|
|
25076
|
+
if (!source) {
|
|
25077
|
+
return target;
|
|
25078
|
+
}
|
|
25079
|
+
if (typeof source !== "object" && typeof source !== "function") {
|
|
25080
|
+
if (isArray(target)) {
|
|
25081
|
+
var nextIndex = target.length;
|
|
25082
|
+
if (options && typeof options.arrayLimit === "number" && nextIndex > options.arrayLimit) {
|
|
25083
|
+
return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
|
|
25084
|
+
}
|
|
25085
|
+
target[nextIndex] = source;
|
|
25086
|
+
} else if (target && typeof target === "object") {
|
|
25087
|
+
if (isOverflow(target)) {
|
|
25088
|
+
var newIndex = getMaxIndex(target) + 1;
|
|
25089
|
+
target[newIndex] = source;
|
|
25090
|
+
setMaxIndex(target, newIndex);
|
|
25091
|
+
} else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
|
|
25092
|
+
target[source] = true;
|
|
25093
|
+
}
|
|
25094
|
+
} else {
|
|
25095
|
+
return [target, source];
|
|
25096
|
+
}
|
|
25097
|
+
return target;
|
|
25098
|
+
}
|
|
25099
|
+
if (!target || typeof target !== "object") {
|
|
25100
|
+
if (isOverflow(source)) {
|
|
25101
|
+
var sourceKeys = Object.keys(source);
|
|
25102
|
+
var result = options && options.plainObjects ? { __proto__: null, 0: target } : { 0: target };
|
|
25103
|
+
for (var m = 0; m < sourceKeys.length; m++) {
|
|
25104
|
+
var oldKey = parseInt(sourceKeys[m], 10);
|
|
25105
|
+
result[oldKey + 1] = source[sourceKeys[m]];
|
|
25106
|
+
}
|
|
25107
|
+
return markOverflow(result, getMaxIndex(source) + 1);
|
|
25108
|
+
}
|
|
25109
|
+
var combined = [target].concat(source);
|
|
25110
|
+
if (options && typeof options.arrayLimit === "number" && combined.length > options.arrayLimit) {
|
|
25111
|
+
return markOverflow(arrayToObject(combined, options), combined.length - 1);
|
|
25112
|
+
}
|
|
25113
|
+
return combined;
|
|
25114
|
+
}
|
|
25115
|
+
var mergeTarget = target;
|
|
25116
|
+
if (isArray(target) && !isArray(source)) {
|
|
25117
|
+
mergeTarget = arrayToObject(target, options);
|
|
25118
|
+
}
|
|
25119
|
+
if (isArray(target) && isArray(source)) {
|
|
25120
|
+
source.forEach(function(item, i) {
|
|
25121
|
+
if (has.call(target, i)) {
|
|
25122
|
+
var targetItem = target[i];
|
|
25123
|
+
if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
|
|
25124
|
+
target[i] = merge3(targetItem, item, options);
|
|
25125
|
+
} else {
|
|
25126
|
+
target[target.length] = item;
|
|
25127
|
+
}
|
|
25128
|
+
} else {
|
|
25129
|
+
target[i] = item;
|
|
25130
|
+
}
|
|
25131
|
+
});
|
|
25132
|
+
return target;
|
|
25133
|
+
}
|
|
25134
|
+
return Object.keys(source).reduce(function(acc, key) {
|
|
25135
|
+
var value = source[key];
|
|
25136
|
+
if (has.call(acc, key)) {
|
|
25137
|
+
acc[key] = merge3(acc[key], value, options);
|
|
25138
|
+
} else {
|
|
25139
|
+
acc[key] = value;
|
|
25140
|
+
}
|
|
25141
|
+
if (isOverflow(source) && !isOverflow(acc)) {
|
|
25142
|
+
markOverflow(acc, getMaxIndex(source));
|
|
25143
|
+
}
|
|
25144
|
+
if (isOverflow(acc)) {
|
|
25145
|
+
var keyNum = parseInt(key, 10);
|
|
25146
|
+
if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
|
|
25147
|
+
setMaxIndex(acc, keyNum);
|
|
25148
|
+
}
|
|
25149
|
+
}
|
|
25150
|
+
return acc;
|
|
25151
|
+
}, mergeTarget);
|
|
25152
|
+
};
|
|
25153
|
+
var assign = function assignSingleSource(target, source) {
|
|
25154
|
+
return Object.keys(source).reduce(function(acc, key) {
|
|
25155
|
+
acc[key] = source[key];
|
|
25156
|
+
return acc;
|
|
25157
|
+
}, target);
|
|
25158
|
+
};
|
|
25159
|
+
var decode3 = function(str, defaultDecoder, charset) {
|
|
25160
|
+
var strWithoutPlus = str.replace(/\+/g, " ");
|
|
25161
|
+
if (charset === "iso-8859-1") {
|
|
25162
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
25163
|
+
}
|
|
25164
|
+
try {
|
|
25165
|
+
return decodeURIComponent(strWithoutPlus);
|
|
25166
|
+
} catch (e) {
|
|
25167
|
+
return strWithoutPlus;
|
|
25168
|
+
}
|
|
25169
|
+
};
|
|
25170
|
+
var limit = 1024;
|
|
25171
|
+
var encode3 = function encode4(str, defaultEncoder, charset, kind, format) {
|
|
25172
|
+
if (str.length === 0) {
|
|
25173
|
+
return str;
|
|
25174
|
+
}
|
|
25175
|
+
var string4 = str;
|
|
25176
|
+
if (typeof str === "symbol") {
|
|
25177
|
+
string4 = Symbol.prototype.toString.call(str);
|
|
25178
|
+
} else if (typeof str !== "string") {
|
|
25179
|
+
string4 = String(str);
|
|
25180
|
+
}
|
|
25181
|
+
if (charset === "iso-8859-1") {
|
|
25182
|
+
return escape(string4).replace(/%u[0-9a-f]{4}/gi, function($0) {
|
|
25183
|
+
return "%26%23" + parseInt($0.slice(2), 16) + "%3B";
|
|
25184
|
+
});
|
|
25185
|
+
}
|
|
25186
|
+
var out = "";
|
|
25187
|
+
for (var j = 0; j < string4.length; j += limit) {
|
|
25188
|
+
var segment = string4.length >= limit ? string4.slice(j, j + limit) : string4;
|
|
25189
|
+
var arr = [];
|
|
25190
|
+
for (var i = 0; i < segment.length; ++i) {
|
|
25191
|
+
var c = segment.charCodeAt(i);
|
|
25192
|
+
if (c === 45 || c === 46 || c === 95 || c === 126 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || format === formats.RFC1738 && (c === 40 || c === 41)) {
|
|
25193
|
+
arr[arr.length] = segment.charAt(i);
|
|
25194
|
+
continue;
|
|
25195
|
+
}
|
|
25196
|
+
if (c < 128) {
|
|
25197
|
+
arr[arr.length] = hexTable[c];
|
|
25198
|
+
continue;
|
|
25199
|
+
}
|
|
25200
|
+
if (c < 2048) {
|
|
25201
|
+
arr[arr.length] = hexTable[192 | c >> 6] + hexTable[128 | c & 63];
|
|
25202
|
+
continue;
|
|
25203
|
+
}
|
|
25204
|
+
if (c < 55296 || c >= 57344) {
|
|
25205
|
+
arr[arr.length] = hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
|
|
25206
|
+
continue;
|
|
25207
|
+
}
|
|
25208
|
+
i += 1;
|
|
25209
|
+
c = 65536 + ((c & 1023) << 10 | segment.charCodeAt(i) & 1023);
|
|
25210
|
+
arr[arr.length] = hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
|
|
25211
|
+
}
|
|
25212
|
+
out += arr.join("");
|
|
25213
|
+
}
|
|
25214
|
+
return out;
|
|
25215
|
+
};
|
|
25216
|
+
var compact = function compact2(value) {
|
|
25217
|
+
var queue = [{ obj: { o: value }, prop: "o" }];
|
|
25218
|
+
var refs = [];
|
|
25219
|
+
for (var i = 0; i < queue.length; ++i) {
|
|
25220
|
+
var item = queue[i];
|
|
25221
|
+
var obj = item.obj[item.prop];
|
|
25222
|
+
var keys = Object.keys(obj);
|
|
25223
|
+
for (var j = 0; j < keys.length; ++j) {
|
|
25224
|
+
var key = keys[j];
|
|
25225
|
+
var val = obj[key];
|
|
25226
|
+
if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) {
|
|
25227
|
+
queue[queue.length] = { obj, prop: key };
|
|
25228
|
+
refs[refs.length] = val;
|
|
25229
|
+
}
|
|
25230
|
+
}
|
|
25231
|
+
}
|
|
25232
|
+
compactQueue(queue);
|
|
25233
|
+
return value;
|
|
25234
|
+
};
|
|
25235
|
+
var isRegExp = function isRegExp2(obj) {
|
|
25236
|
+
return Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
25237
|
+
};
|
|
25238
|
+
var isBuffer = function isBuffer2(obj) {
|
|
25239
|
+
if (!obj || typeof obj !== "object") {
|
|
25240
|
+
return false;
|
|
25241
|
+
}
|
|
25242
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
25243
|
+
};
|
|
25244
|
+
var combine = function combine2(a, b, arrayLimit, plainObjects) {
|
|
25245
|
+
if (isOverflow(a)) {
|
|
25246
|
+
var newIndex = getMaxIndex(a) + 1;
|
|
25247
|
+
a[newIndex] = b;
|
|
25248
|
+
setMaxIndex(a, newIndex);
|
|
25249
|
+
return a;
|
|
25250
|
+
}
|
|
25251
|
+
var result = [].concat(a, b);
|
|
25252
|
+
if (result.length > arrayLimit) {
|
|
25253
|
+
return markOverflow(arrayToObject(result, { plainObjects }), result.length - 1);
|
|
25254
|
+
}
|
|
25255
|
+
return result;
|
|
25256
|
+
};
|
|
25257
|
+
var maybeMap = function maybeMap2(val, fn) {
|
|
25258
|
+
if (isArray(val)) {
|
|
25259
|
+
var mapped = [];
|
|
25260
|
+
for (var i = 0; i < val.length; i += 1) {
|
|
25261
|
+
mapped[mapped.length] = fn(val[i]);
|
|
25262
|
+
}
|
|
25263
|
+
return mapped;
|
|
25264
|
+
}
|
|
25265
|
+
return fn(val);
|
|
25266
|
+
};
|
|
25267
|
+
module2.exports = {
|
|
25268
|
+
arrayToObject,
|
|
25269
|
+
assign,
|
|
25270
|
+
combine,
|
|
25271
|
+
compact,
|
|
25272
|
+
decode: decode3,
|
|
25273
|
+
encode: encode3,
|
|
25274
|
+
isBuffer,
|
|
25275
|
+
isOverflow,
|
|
25276
|
+
isRegExp,
|
|
25277
|
+
markOverflow,
|
|
25278
|
+
maybeMap,
|
|
25279
|
+
merge: merge2
|
|
25280
|
+
};
|
|
25281
|
+
}
|
|
25282
|
+
});
|
|
25283
|
+
|
|
25284
|
+
// ../../node_modules/qs/lib/stringify.js
|
|
25285
|
+
var require_stringify2 = __commonJS({
|
|
25286
|
+
"../../node_modules/qs/lib/stringify.js"(exports2, module2) {
|
|
25287
|
+
"use strict";
|
|
25288
|
+
var getSideChannel = require_side_channel();
|
|
25289
|
+
var utils = require_utils2();
|
|
25290
|
+
var formats = require_formats2();
|
|
25291
|
+
var has = Object.prototype.hasOwnProperty;
|
|
25292
|
+
var arrayPrefixGenerators = {
|
|
25293
|
+
brackets: function brackets(prefix) {
|
|
25294
|
+
return prefix + "[]";
|
|
25295
|
+
},
|
|
25296
|
+
comma: "comma",
|
|
25297
|
+
indices: function indices(prefix, key) {
|
|
25298
|
+
return prefix + "[" + key + "]";
|
|
25299
|
+
},
|
|
25300
|
+
repeat: function repeat(prefix) {
|
|
25301
|
+
return prefix;
|
|
25302
|
+
}
|
|
25303
|
+
};
|
|
25304
|
+
var isArray = Array.isArray;
|
|
25305
|
+
var push = Array.prototype.push;
|
|
25306
|
+
var pushToArray = function(arr, valueOrArray) {
|
|
25307
|
+
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
25308
|
+
};
|
|
25309
|
+
var toISO = Date.prototype.toISOString;
|
|
25310
|
+
var defaultFormat = formats["default"];
|
|
25311
|
+
var defaults = {
|
|
25312
|
+
addQueryPrefix: false,
|
|
25313
|
+
allowDots: false,
|
|
25314
|
+
allowEmptyArrays: false,
|
|
25315
|
+
arrayFormat: "indices",
|
|
25316
|
+
charset: "utf-8",
|
|
25317
|
+
charsetSentinel: false,
|
|
25318
|
+
commaRoundTrip: false,
|
|
25319
|
+
delimiter: "&",
|
|
25320
|
+
encode: true,
|
|
25321
|
+
encodeDotInKeys: false,
|
|
25322
|
+
encoder: utils.encode,
|
|
25323
|
+
encodeValuesOnly: false,
|
|
25324
|
+
filter: void 0,
|
|
25325
|
+
format: defaultFormat,
|
|
25326
|
+
formatter: formats.formatters[defaultFormat],
|
|
25327
|
+
// deprecated
|
|
25328
|
+
indices: false,
|
|
25329
|
+
serializeDate: function serializeDate(date5) {
|
|
25330
|
+
return toISO.call(date5);
|
|
25331
|
+
},
|
|
25332
|
+
skipNulls: false,
|
|
25333
|
+
strictNullHandling: false
|
|
25334
|
+
};
|
|
25335
|
+
var isNonNullishPrimitive = function isNonNullishPrimitive2(v) {
|
|
25336
|
+
return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
|
|
25337
|
+
};
|
|
25338
|
+
var sentinel = {};
|
|
25339
|
+
var stringify = function stringify2(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
25340
|
+
var obj = object2;
|
|
25341
|
+
var tmpSc = sideChannel;
|
|
25342
|
+
var step = 0;
|
|
25343
|
+
var findFlag = false;
|
|
25344
|
+
while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) {
|
|
25345
|
+
var pos = tmpSc.get(object2);
|
|
25346
|
+
step += 1;
|
|
25347
|
+
if (typeof pos !== "undefined") {
|
|
25348
|
+
if (pos === step) {
|
|
25349
|
+
throw new RangeError("Cyclic object value");
|
|
25350
|
+
} else {
|
|
25351
|
+
findFlag = true;
|
|
25352
|
+
}
|
|
25353
|
+
}
|
|
25354
|
+
if (typeof tmpSc.get(sentinel) === "undefined") {
|
|
25355
|
+
step = 0;
|
|
25356
|
+
}
|
|
25357
|
+
}
|
|
25358
|
+
if (typeof filter === "function") {
|
|
25359
|
+
obj = filter(prefix, obj);
|
|
25360
|
+
} else if (obj instanceof Date) {
|
|
25361
|
+
obj = serializeDate(obj);
|
|
25362
|
+
} else if (generateArrayPrefix === "comma" && isArray(obj)) {
|
|
25363
|
+
obj = utils.maybeMap(obj, function(value2) {
|
|
25364
|
+
if (value2 instanceof Date) {
|
|
25365
|
+
return serializeDate(value2);
|
|
25366
|
+
}
|
|
25367
|
+
return value2;
|
|
25368
|
+
});
|
|
25369
|
+
}
|
|
25370
|
+
if (obj === null) {
|
|
25371
|
+
if (strictNullHandling) {
|
|
25372
|
+
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
|
|
25373
|
+
}
|
|
25374
|
+
obj = "";
|
|
25375
|
+
}
|
|
25376
|
+
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
25377
|
+
if (encoder) {
|
|
25378
|
+
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format);
|
|
25379
|
+
return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))];
|
|
25380
|
+
}
|
|
25381
|
+
return [formatter(prefix) + "=" + formatter(String(obj))];
|
|
25382
|
+
}
|
|
25383
|
+
var values = [];
|
|
25384
|
+
if (typeof obj === "undefined") {
|
|
25385
|
+
return values;
|
|
25386
|
+
}
|
|
25387
|
+
var objKeys;
|
|
25388
|
+
if (generateArrayPrefix === "comma" && isArray(obj)) {
|
|
25389
|
+
if (encodeValuesOnly && encoder) {
|
|
25390
|
+
obj = utils.maybeMap(obj, encoder);
|
|
25391
|
+
}
|
|
25392
|
+
objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
|
|
25393
|
+
} else if (isArray(filter)) {
|
|
25394
|
+
objKeys = filter;
|
|
25395
|
+
} else {
|
|
25396
|
+
var keys = Object.keys(obj);
|
|
25397
|
+
objKeys = sort ? keys.sort(sort) : keys;
|
|
25398
|
+
}
|
|
25399
|
+
var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix);
|
|
25400
|
+
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
|
|
25401
|
+
if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
|
|
25402
|
+
return adjustedPrefix + "[]";
|
|
25403
|
+
}
|
|
25404
|
+
for (var j = 0; j < objKeys.length; ++j) {
|
|
25405
|
+
var key = objKeys[j];
|
|
25406
|
+
var value = typeof key === "object" && key && typeof key.value !== "undefined" ? key.value : obj[key];
|
|
25407
|
+
if (skipNulls && value === null) {
|
|
25408
|
+
continue;
|
|
25409
|
+
}
|
|
25410
|
+
var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key);
|
|
25411
|
+
var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]");
|
|
25412
|
+
sideChannel.set(object2, step);
|
|
25413
|
+
var valueSideChannel = getSideChannel();
|
|
25414
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
25415
|
+
pushToArray(values, stringify2(
|
|
25416
|
+
value,
|
|
25417
|
+
keyPrefix,
|
|
25418
|
+
generateArrayPrefix,
|
|
25419
|
+
commaRoundTrip,
|
|
25420
|
+
allowEmptyArrays,
|
|
25421
|
+
strictNullHandling,
|
|
25422
|
+
skipNulls,
|
|
25423
|
+
encodeDotInKeys,
|
|
25424
|
+
generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder,
|
|
25425
|
+
filter,
|
|
25426
|
+
sort,
|
|
25427
|
+
allowDots,
|
|
25428
|
+
serializeDate,
|
|
25429
|
+
format,
|
|
25430
|
+
formatter,
|
|
25431
|
+
encodeValuesOnly,
|
|
25432
|
+
charset,
|
|
25433
|
+
valueSideChannel
|
|
25434
|
+
));
|
|
25435
|
+
}
|
|
25436
|
+
return values;
|
|
25437
|
+
};
|
|
25438
|
+
var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
|
|
25439
|
+
if (!opts) {
|
|
25440
|
+
return defaults;
|
|
25441
|
+
}
|
|
25442
|
+
if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
|
|
25443
|
+
throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
|
|
25444
|
+
}
|
|
25445
|
+
if (typeof opts.encodeDotInKeys !== "undefined" && typeof opts.encodeDotInKeys !== "boolean") {
|
|
25446
|
+
throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
|
|
25447
|
+
}
|
|
25448
|
+
if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") {
|
|
25449
|
+
throw new TypeError("Encoder has to be a function.");
|
|
25450
|
+
}
|
|
25451
|
+
var charset = opts.charset || defaults.charset;
|
|
25452
|
+
if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
|
|
25453
|
+
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
25454
|
+
}
|
|
25455
|
+
var format = formats["default"];
|
|
25456
|
+
if (typeof opts.format !== "undefined") {
|
|
25457
|
+
if (!has.call(formats.formatters, opts.format)) {
|
|
25458
|
+
throw new TypeError("Unknown format option provided.");
|
|
25459
|
+
}
|
|
25460
|
+
format = opts.format;
|
|
25461
|
+
}
|
|
25462
|
+
var formatter = formats.formatters[format];
|
|
25463
|
+
var filter = defaults.filter;
|
|
25464
|
+
if (typeof opts.filter === "function" || isArray(opts.filter)) {
|
|
25465
|
+
filter = opts.filter;
|
|
25466
|
+
}
|
|
25467
|
+
var arrayFormat;
|
|
25468
|
+
if (opts.arrayFormat in arrayPrefixGenerators) {
|
|
25469
|
+
arrayFormat = opts.arrayFormat;
|
|
25470
|
+
} else if ("indices" in opts) {
|
|
25471
|
+
arrayFormat = opts.indices ? "indices" : "repeat";
|
|
25472
|
+
} else {
|
|
25473
|
+
arrayFormat = defaults.arrayFormat;
|
|
25474
|
+
}
|
|
25475
|
+
if ("commaRoundTrip" in opts && typeof opts.commaRoundTrip !== "boolean") {
|
|
25476
|
+
throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
|
|
25477
|
+
}
|
|
25478
|
+
var allowDots = typeof opts.allowDots === "undefined" ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
|
|
25479
|
+
return {
|
|
25480
|
+
addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults.addQueryPrefix,
|
|
25481
|
+
allowDots,
|
|
25482
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
25483
|
+
arrayFormat,
|
|
25484
|
+
charset,
|
|
25485
|
+
charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
25486
|
+
commaRoundTrip: !!opts.commaRoundTrip,
|
|
25487
|
+
delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
|
|
25488
|
+
encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode,
|
|
25489
|
+
encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
|
|
25490
|
+
encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder,
|
|
25491
|
+
encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
|
|
25492
|
+
filter,
|
|
25493
|
+
format,
|
|
25494
|
+
formatter,
|
|
25495
|
+
serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate,
|
|
25496
|
+
skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults.skipNulls,
|
|
25497
|
+
sort: typeof opts.sort === "function" ? opts.sort : null,
|
|
25498
|
+
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
|
|
25499
|
+
};
|
|
25500
|
+
};
|
|
25501
|
+
module2.exports = function(object2, opts) {
|
|
25502
|
+
var obj = object2;
|
|
25503
|
+
var options = normalizeStringifyOptions(opts);
|
|
25504
|
+
var objKeys;
|
|
25505
|
+
var filter;
|
|
25506
|
+
if (typeof options.filter === "function") {
|
|
25507
|
+
filter = options.filter;
|
|
25508
|
+
obj = filter("", obj);
|
|
25509
|
+
} else if (isArray(options.filter)) {
|
|
25510
|
+
filter = options.filter;
|
|
25511
|
+
objKeys = filter;
|
|
25512
|
+
}
|
|
25513
|
+
var keys = [];
|
|
25514
|
+
if (typeof obj !== "object" || obj === null) {
|
|
25515
|
+
return "";
|
|
25516
|
+
}
|
|
25517
|
+
var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
|
|
25518
|
+
var commaRoundTrip = generateArrayPrefix === "comma" && options.commaRoundTrip;
|
|
25519
|
+
if (!objKeys) {
|
|
25520
|
+
objKeys = Object.keys(obj);
|
|
25521
|
+
}
|
|
25522
|
+
if (options.sort) {
|
|
25523
|
+
objKeys.sort(options.sort);
|
|
25524
|
+
}
|
|
25525
|
+
var sideChannel = getSideChannel();
|
|
25526
|
+
for (var i = 0; i < objKeys.length; ++i) {
|
|
25527
|
+
var key = objKeys[i];
|
|
25528
|
+
var value = obj[key];
|
|
25529
|
+
if (options.skipNulls && value === null) {
|
|
25530
|
+
continue;
|
|
25531
|
+
}
|
|
25532
|
+
pushToArray(keys, stringify(
|
|
25533
|
+
value,
|
|
25534
|
+
key,
|
|
25535
|
+
generateArrayPrefix,
|
|
25536
|
+
commaRoundTrip,
|
|
25537
|
+
options.allowEmptyArrays,
|
|
25538
|
+
options.strictNullHandling,
|
|
25539
|
+
options.skipNulls,
|
|
25540
|
+
options.encodeDotInKeys,
|
|
25541
|
+
options.encode ? options.encoder : null,
|
|
25542
|
+
options.filter,
|
|
25543
|
+
options.sort,
|
|
25544
|
+
options.allowDots,
|
|
25545
|
+
options.serializeDate,
|
|
25546
|
+
options.format,
|
|
25547
|
+
options.formatter,
|
|
25548
|
+
options.encodeValuesOnly,
|
|
25549
|
+
options.charset,
|
|
25550
|
+
sideChannel
|
|
25551
|
+
));
|
|
25552
|
+
}
|
|
25553
|
+
var joined = keys.join(options.delimiter);
|
|
25554
|
+
var prefix = options.addQueryPrefix === true ? "?" : "";
|
|
25555
|
+
if (options.charsetSentinel) {
|
|
25556
|
+
if (options.charset === "iso-8859-1") {
|
|
25557
|
+
prefix += "utf8=%26%2310003%3B&";
|
|
25558
|
+
} else {
|
|
25559
|
+
prefix += "utf8=%E2%9C%93&";
|
|
25560
|
+
}
|
|
25561
|
+
}
|
|
25562
|
+
return joined.length > 0 ? prefix + joined : "";
|
|
25563
|
+
};
|
|
25564
|
+
}
|
|
25565
|
+
});
|
|
25566
|
+
|
|
25567
|
+
// ../../node_modules/qs/lib/parse.js
|
|
25568
|
+
var require_parse2 = __commonJS({
|
|
25569
|
+
"../../node_modules/qs/lib/parse.js"(exports2, module2) {
|
|
25570
|
+
"use strict";
|
|
25571
|
+
var utils = require_utils2();
|
|
25572
|
+
var has = Object.prototype.hasOwnProperty;
|
|
25573
|
+
var isArray = Array.isArray;
|
|
25574
|
+
var defaults = {
|
|
25575
|
+
allowDots: false,
|
|
25576
|
+
allowEmptyArrays: false,
|
|
25577
|
+
allowPrototypes: false,
|
|
25578
|
+
allowSparse: false,
|
|
25579
|
+
arrayLimit: 20,
|
|
25580
|
+
charset: "utf-8",
|
|
25581
|
+
charsetSentinel: false,
|
|
25582
|
+
comma: false,
|
|
25583
|
+
decodeDotInKeys: false,
|
|
25584
|
+
decoder: utils.decode,
|
|
25585
|
+
delimiter: "&",
|
|
25586
|
+
depth: 5,
|
|
25587
|
+
duplicates: "combine",
|
|
25588
|
+
ignoreQueryPrefix: false,
|
|
25589
|
+
interpretNumericEntities: false,
|
|
25590
|
+
parameterLimit: 1e3,
|
|
25591
|
+
parseArrays: true,
|
|
25592
|
+
plainObjects: false,
|
|
25593
|
+
strictDepth: false,
|
|
25594
|
+
strictNullHandling: false,
|
|
25595
|
+
throwOnLimitExceeded: false
|
|
25596
|
+
};
|
|
25597
|
+
var interpretNumericEntities = function(str) {
|
|
25598
|
+
return str.replace(/&#(\d+);/g, function($0, numberStr) {
|
|
25599
|
+
return String.fromCharCode(parseInt(numberStr, 10));
|
|
25600
|
+
});
|
|
25601
|
+
};
|
|
25602
|
+
var parseArrayValue = function(val, options, currentArrayLength) {
|
|
25603
|
+
if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) {
|
|
25604
|
+
return val.split(",");
|
|
25605
|
+
}
|
|
25606
|
+
if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
|
|
25607
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
25608
|
+
}
|
|
25609
|
+
return val;
|
|
25610
|
+
};
|
|
25611
|
+
var isoSentinel = "utf8=%26%2310003%3B";
|
|
25612
|
+
var charsetSentinel = "utf8=%E2%9C%93";
|
|
25613
|
+
var parseValues = function parseQueryStringValues(str, options) {
|
|
25614
|
+
var obj = { __proto__: null };
|
|
25615
|
+
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
|
|
25616
|
+
cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
25617
|
+
var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
|
|
25618
|
+
var parts = cleanStr.split(
|
|
25619
|
+
options.delimiter,
|
|
25620
|
+
options.throwOnLimitExceeded ? limit + 1 : limit
|
|
25621
|
+
);
|
|
25622
|
+
if (options.throwOnLimitExceeded && parts.length > limit) {
|
|
25623
|
+
throw new RangeError("Parameter limit exceeded. Only " + limit + " parameter" + (limit === 1 ? "" : "s") + " allowed.");
|
|
25624
|
+
}
|
|
25625
|
+
var skipIndex = -1;
|
|
25626
|
+
var i;
|
|
25627
|
+
var charset = options.charset;
|
|
25628
|
+
if (options.charsetSentinel) {
|
|
25629
|
+
for (i = 0; i < parts.length; ++i) {
|
|
25630
|
+
if (parts[i].indexOf("utf8=") === 0) {
|
|
25631
|
+
if (parts[i] === charsetSentinel) {
|
|
25632
|
+
charset = "utf-8";
|
|
25633
|
+
} else if (parts[i] === isoSentinel) {
|
|
25634
|
+
charset = "iso-8859-1";
|
|
25635
|
+
}
|
|
25636
|
+
skipIndex = i;
|
|
25637
|
+
i = parts.length;
|
|
25638
|
+
}
|
|
25639
|
+
}
|
|
25640
|
+
}
|
|
25641
|
+
for (i = 0; i < parts.length; ++i) {
|
|
25642
|
+
if (i === skipIndex) {
|
|
25643
|
+
continue;
|
|
25644
|
+
}
|
|
25645
|
+
var part = parts[i];
|
|
25646
|
+
var bracketEqualsPos = part.indexOf("]=");
|
|
25647
|
+
var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1;
|
|
25648
|
+
var key;
|
|
25649
|
+
var val;
|
|
25650
|
+
if (pos === -1) {
|
|
25651
|
+
key = options.decoder(part, defaults.decoder, charset, "key");
|
|
25652
|
+
val = options.strictNullHandling ? null : "";
|
|
25653
|
+
} else {
|
|
25654
|
+
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key");
|
|
25655
|
+
if (key !== null) {
|
|
25656
|
+
val = utils.maybeMap(
|
|
25657
|
+
parseArrayValue(
|
|
25658
|
+
part.slice(pos + 1),
|
|
25659
|
+
options,
|
|
25660
|
+
isArray(obj[key]) ? obj[key].length : 0
|
|
25661
|
+
),
|
|
25662
|
+
function(encodedVal) {
|
|
25663
|
+
return options.decoder(encodedVal, defaults.decoder, charset, "value");
|
|
25664
|
+
}
|
|
25665
|
+
);
|
|
25666
|
+
}
|
|
25667
|
+
}
|
|
25668
|
+
if (val && options.interpretNumericEntities && charset === "iso-8859-1") {
|
|
25669
|
+
val = interpretNumericEntities(String(val));
|
|
25670
|
+
}
|
|
25671
|
+
if (part.indexOf("[]=") > -1) {
|
|
25672
|
+
val = isArray(val) ? [val] : val;
|
|
25673
|
+
}
|
|
25674
|
+
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
|
25675
|
+
if (options.throwOnLimitExceeded) {
|
|
25676
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
25677
|
+
}
|
|
25678
|
+
val = utils.combine([], val, options.arrayLimit, options.plainObjects);
|
|
25679
|
+
}
|
|
25680
|
+
if (key !== null) {
|
|
25681
|
+
var existing = has.call(obj, key);
|
|
25682
|
+
if (existing && options.duplicates === "combine") {
|
|
25683
|
+
obj[key] = utils.combine(
|
|
25684
|
+
obj[key],
|
|
25685
|
+
val,
|
|
25686
|
+
options.arrayLimit,
|
|
25687
|
+
options.plainObjects
|
|
25688
|
+
);
|
|
25689
|
+
} else if (!existing || options.duplicates === "last") {
|
|
25690
|
+
obj[key] = val;
|
|
25691
|
+
}
|
|
25692
|
+
}
|
|
25693
|
+
}
|
|
25694
|
+
return obj;
|
|
25695
|
+
};
|
|
25696
|
+
var parseObject = function(chain, val, options, valuesParsed) {
|
|
25697
|
+
var currentArrayLength = 0;
|
|
25698
|
+
if (chain.length > 0 && chain[chain.length - 1] === "[]") {
|
|
25699
|
+
var parentKey = chain.slice(0, -1).join("");
|
|
25700
|
+
currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
|
|
25701
|
+
}
|
|
25702
|
+
var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
|
|
25703
|
+
for (var i = chain.length - 1; i >= 0; --i) {
|
|
25704
|
+
var obj;
|
|
25705
|
+
var root = chain[i];
|
|
25706
|
+
if (root === "[]" && options.parseArrays) {
|
|
25707
|
+
if (utils.isOverflow(leaf)) {
|
|
25708
|
+
obj = leaf;
|
|
25709
|
+
} else {
|
|
25710
|
+
obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils.combine(
|
|
25711
|
+
[],
|
|
25712
|
+
leaf,
|
|
25713
|
+
options.arrayLimit,
|
|
25714
|
+
options.plainObjects
|
|
25715
|
+
);
|
|
25716
|
+
}
|
|
25717
|
+
} else {
|
|
25718
|
+
obj = options.plainObjects ? { __proto__: null } : {};
|
|
25719
|
+
var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
|
|
25720
|
+
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
|
|
25721
|
+
var index = parseInt(decodedRoot, 10);
|
|
25722
|
+
var isValidArrayIndex = !isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && options.parseArrays;
|
|
25723
|
+
if (!options.parseArrays && decodedRoot === "") {
|
|
25724
|
+
obj = { 0: leaf };
|
|
25725
|
+
} else if (isValidArrayIndex && index < options.arrayLimit) {
|
|
25726
|
+
obj = [];
|
|
25727
|
+
obj[index] = leaf;
|
|
25728
|
+
} else if (isValidArrayIndex && options.throwOnLimitExceeded) {
|
|
25729
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
25730
|
+
} else if (isValidArrayIndex) {
|
|
25731
|
+
obj[index] = leaf;
|
|
25732
|
+
utils.markOverflow(obj, index);
|
|
25733
|
+
} else if (decodedRoot !== "__proto__") {
|
|
25734
|
+
obj[decodedRoot] = leaf;
|
|
25735
|
+
}
|
|
25736
|
+
}
|
|
25737
|
+
leaf = obj;
|
|
25738
|
+
}
|
|
25739
|
+
return leaf;
|
|
25740
|
+
};
|
|
25741
|
+
var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options) {
|
|
25742
|
+
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
|
|
25743
|
+
if (options.depth <= 0) {
|
|
25744
|
+
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
25745
|
+
if (!options.allowPrototypes) {
|
|
25746
|
+
return;
|
|
25747
|
+
}
|
|
25748
|
+
}
|
|
25749
|
+
return [key];
|
|
25750
|
+
}
|
|
25751
|
+
var brackets = /(\[[^[\]]*])/;
|
|
25752
|
+
var child = /(\[[^[\]]*])/g;
|
|
25753
|
+
var segment = brackets.exec(key);
|
|
25754
|
+
var parent = segment ? key.slice(0, segment.index) : key;
|
|
25755
|
+
var keys = [];
|
|
25756
|
+
if (parent) {
|
|
25757
|
+
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
25758
|
+
if (!options.allowPrototypes) {
|
|
25759
|
+
return;
|
|
25760
|
+
}
|
|
25761
|
+
}
|
|
25762
|
+
keys[keys.length] = parent;
|
|
25763
|
+
}
|
|
25764
|
+
var i = 0;
|
|
25765
|
+
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
|
25766
|
+
i += 1;
|
|
25767
|
+
var segmentContent = segment[1].slice(1, -1);
|
|
25768
|
+
if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
|
|
25769
|
+
if (!options.allowPrototypes) {
|
|
25770
|
+
return;
|
|
25771
|
+
}
|
|
25772
|
+
}
|
|
25773
|
+
keys[keys.length] = segment[1];
|
|
25774
|
+
}
|
|
25775
|
+
if (segment) {
|
|
25776
|
+
if (options.strictDepth === true) {
|
|
25777
|
+
throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
|
|
25778
|
+
}
|
|
25779
|
+
keys[keys.length] = "[" + key.slice(segment.index) + "]";
|
|
25780
|
+
}
|
|
25781
|
+
return keys;
|
|
25782
|
+
};
|
|
25783
|
+
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
25784
|
+
if (!givenKey) {
|
|
25785
|
+
return;
|
|
25786
|
+
}
|
|
25787
|
+
var keys = splitKeyIntoSegments(givenKey, options);
|
|
25788
|
+
if (!keys) {
|
|
25789
|
+
return;
|
|
25790
|
+
}
|
|
25791
|
+
return parseObject(keys, val, options, valuesParsed);
|
|
25792
|
+
};
|
|
25793
|
+
var normalizeParseOptions = function normalizeParseOptions2(opts) {
|
|
25794
|
+
if (!opts) {
|
|
25795
|
+
return defaults;
|
|
25796
|
+
}
|
|
25797
|
+
if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
|
|
25798
|
+
throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
|
|
25799
|
+
}
|
|
25800
|
+
if (typeof opts.decodeDotInKeys !== "undefined" && typeof opts.decodeDotInKeys !== "boolean") {
|
|
25801
|
+
throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
|
|
25802
|
+
}
|
|
25803
|
+
if (opts.decoder !== null && typeof opts.decoder !== "undefined" && typeof opts.decoder !== "function") {
|
|
25804
|
+
throw new TypeError("Decoder has to be a function.");
|
|
25805
|
+
}
|
|
25806
|
+
if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
|
|
25807
|
+
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
25808
|
+
}
|
|
25809
|
+
if (typeof opts.throwOnLimitExceeded !== "undefined" && typeof opts.throwOnLimitExceeded !== "boolean") {
|
|
25810
|
+
throw new TypeError("`throwOnLimitExceeded` option must be a boolean");
|
|
25811
|
+
}
|
|
25812
|
+
var charset = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
|
|
25813
|
+
var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates;
|
|
25814
|
+
if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") {
|
|
25815
|
+
throw new TypeError("The duplicates option must be either combine, first, or last");
|
|
25816
|
+
}
|
|
25817
|
+
var allowDots = typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
|
|
25818
|
+
return {
|
|
25819
|
+
allowDots,
|
|
25820
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
25821
|
+
allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
25822
|
+
allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse,
|
|
25823
|
+
arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults.arrayLimit,
|
|
25824
|
+
charset,
|
|
25825
|
+
charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
25826
|
+
comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma,
|
|
25827
|
+
decodeDotInKeys: typeof opts.decodeDotInKeys === "boolean" ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
|
|
25828
|
+
decoder: typeof opts.decoder === "function" ? opts.decoder : defaults.decoder,
|
|
25829
|
+
delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
|
|
25830
|
+
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
25831
|
+
depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults.depth,
|
|
25832
|
+
duplicates,
|
|
25833
|
+
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
|
25834
|
+
interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
|
|
25835
|
+
parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults.parameterLimit,
|
|
25836
|
+
parseArrays: opts.parseArrays !== false,
|
|
25837
|
+
plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
|
|
25838
|
+
strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
|
|
25839
|
+
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
25840
|
+
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
|
|
25841
|
+
};
|
|
25842
|
+
};
|
|
25843
|
+
module2.exports = function(str, opts) {
|
|
25844
|
+
var options = normalizeParseOptions(opts);
|
|
25845
|
+
if (str === "" || str === null || typeof str === "undefined") {
|
|
25846
|
+
return options.plainObjects ? { __proto__: null } : {};
|
|
25847
|
+
}
|
|
25848
|
+
var tempObj = typeof str === "string" ? parseValues(str, options) : str;
|
|
25849
|
+
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
25850
|
+
var keys = Object.keys(tempObj);
|
|
25851
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
25852
|
+
var key = keys[i];
|
|
25853
|
+
var newObj = parseKeys(key, tempObj[key], options, typeof str === "string");
|
|
25854
|
+
obj = utils.merge(obj, newObj, options);
|
|
25855
|
+
}
|
|
25856
|
+
if (options.allowSparse === true) {
|
|
25857
|
+
return obj;
|
|
25858
|
+
}
|
|
25859
|
+
return utils.compact(obj);
|
|
25860
|
+
};
|
|
25861
|
+
}
|
|
25862
|
+
});
|
|
25863
|
+
|
|
25864
|
+
// ../../node_modules/qs/lib/index.js
|
|
25865
|
+
var require_lib3 = __commonJS({
|
|
25866
|
+
"../../node_modules/qs/lib/index.js"(exports2, module2) {
|
|
25867
|
+
"use strict";
|
|
25868
|
+
var stringify = require_stringify2();
|
|
25869
|
+
var parse3 = require_parse2();
|
|
25870
|
+
var formats = require_formats2();
|
|
25871
|
+
module2.exports = {
|
|
25872
|
+
formats,
|
|
25873
|
+
parse: parse3,
|
|
25874
|
+
stringify
|
|
25875
|
+
};
|
|
25876
|
+
}
|
|
25877
|
+
});
|
|
25878
|
+
|
|
24996
25879
|
// ../../node_modules/express/lib/middleware/query.js
|
|
24997
25880
|
var require_query = __commonJS({
|
|
24998
25881
|
"../../node_modules/express/lib/middleware/query.js"(exports2, module2) {
|
|
24999
25882
|
"use strict";
|
|
25000
25883
|
var merge2 = require_utils_merge();
|
|
25001
25884
|
var parseUrl = require_parseurl();
|
|
25002
|
-
var qs =
|
|
25885
|
+
var qs = require_lib3();
|
|
25003
25886
|
module2.exports = function query(options) {
|
|
25004
25887
|
var opts = merge2({}, options);
|
|
25005
25888
|
var queryparse = qs.parse;
|
|
@@ -27493,7 +28376,7 @@ var require_proxy_addr = __commonJS({
|
|
|
27493
28376
|
});
|
|
27494
28377
|
|
|
27495
28378
|
// ../../node_modules/express/lib/utils.js
|
|
27496
|
-
var
|
|
28379
|
+
var require_utils3 = __commonJS({
|
|
27497
28380
|
"../../node_modules/express/lib/utils.js"(exports2) {
|
|
27498
28381
|
"use strict";
|
|
27499
28382
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
@@ -27504,7 +28387,7 @@ var require_utils2 = __commonJS({
|
|
|
27504
28387
|
var mime = require_send().mime;
|
|
27505
28388
|
var etag = require_etag();
|
|
27506
28389
|
var proxyaddr = require_proxy_addr();
|
|
27507
|
-
var qs =
|
|
28390
|
+
var qs = require_lib3();
|
|
27508
28391
|
var querystring = require("querystring");
|
|
27509
28392
|
exports2.etag = createETagGenerator({ weak: false });
|
|
27510
28393
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
@@ -27641,9 +28524,9 @@ var require_application = __commonJS({
|
|
|
27641
28524
|
var debug = require_src3()("express:application");
|
|
27642
28525
|
var View = require_view();
|
|
27643
28526
|
var http2 = require("http");
|
|
27644
|
-
var compileETag =
|
|
27645
|
-
var compileQueryParser =
|
|
27646
|
-
var compileTrust =
|
|
28527
|
+
var compileETag = require_utils3().compileETag;
|
|
28528
|
+
var compileQueryParser = require_utils3().compileQueryParser;
|
|
28529
|
+
var compileTrust = require_utils3().compileTrust;
|
|
27647
28530
|
var deprecate = require_depd()("express");
|
|
27648
28531
|
var flatten = require_array_flatten();
|
|
27649
28532
|
var merge2 = require_utils_merge();
|
|
@@ -28918,15 +29801,15 @@ var require_response = __commonJS({
|
|
|
28918
29801
|
var encodeUrl = require_encodeurl();
|
|
28919
29802
|
var escapeHtml = require_escape_html();
|
|
28920
29803
|
var http2 = require("http");
|
|
28921
|
-
var isAbsolute =
|
|
29804
|
+
var isAbsolute = require_utils3().isAbsolute;
|
|
28922
29805
|
var onFinished = require_on_finished();
|
|
28923
29806
|
var path10 = require("path");
|
|
28924
29807
|
var statuses = require_statuses();
|
|
28925
29808
|
var merge2 = require_utils_merge();
|
|
28926
29809
|
var sign = require_cookie_signature().sign;
|
|
28927
|
-
var normalizeType =
|
|
28928
|
-
var normalizeTypes =
|
|
28929
|
-
var setCharset =
|
|
29810
|
+
var normalizeType = require_utils3().normalizeType;
|
|
29811
|
+
var normalizeTypes = require_utils3().normalizeTypes;
|
|
29812
|
+
var setCharset = require_utils3().setCharset;
|
|
28930
29813
|
var cookie = require_cookie();
|
|
28931
29814
|
var send = require_send();
|
|
28932
29815
|
var extname = path10.extname;
|
|
@@ -33259,7 +34142,7 @@ __export(index_exports, {
|
|
|
33259
34142
|
});
|
|
33260
34143
|
module.exports = __toCommonJS(index_exports);
|
|
33261
34144
|
var import_node_child_process3 = require("node:child_process");
|
|
33262
|
-
var
|
|
34145
|
+
var import_node_fs7 = require("node:fs");
|
|
33263
34146
|
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
33264
34147
|
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
33265
34148
|
var import_node_module = require("node:module");
|
|
@@ -33296,12 +34179,45 @@ function plistPath(home, name) {
|
|
|
33296
34179
|
function unitPath(home, name) {
|
|
33297
34180
|
return (0, import_node_path.join)(home, ".config", "systemd", "user", `${name}.service`);
|
|
33298
34181
|
}
|
|
34182
|
+
var invalidXmlCharPattern = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/;
|
|
34183
|
+
var envKeyPattern = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
34184
|
+
var safeSystemdEnvValuePattern = /^[A-Za-z0-9_./:@,=+-]*$/;
|
|
34185
|
+
function xmlEscape(s) {
|
|
34186
|
+
return s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
34187
|
+
}
|
|
34188
|
+
function validateXmlString(s) {
|
|
34189
|
+
if (invalidXmlCharPattern.test(s)) {
|
|
34190
|
+
throw new Error("string contains characters that are not allowed in XML 1.0");
|
|
34191
|
+
}
|
|
34192
|
+
}
|
|
34193
|
+
function validateEnvKey(k) {
|
|
34194
|
+
if (!envKeyPattern.test(k)) {
|
|
34195
|
+
throw new Error(`invalid environment variable key: ${k}`);
|
|
34196
|
+
}
|
|
34197
|
+
}
|
|
34198
|
+
function formatSystemdEnvValue(v) {
|
|
34199
|
+
if (v.includes("\0") || v.includes("\n")) {
|
|
34200
|
+
throw new Error("systemd environment values cannot contain NUL or newline characters");
|
|
34201
|
+
}
|
|
34202
|
+
if (safeSystemdEnvValuePattern.test(v))
|
|
34203
|
+
return v;
|
|
34204
|
+
return `"${v.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
34205
|
+
}
|
|
33299
34206
|
function renderPlist(name, programArgs, env) {
|
|
33300
|
-
|
|
34207
|
+
validateXmlString(name);
|
|
34208
|
+
const entries = programArgs.map((arg) => {
|
|
34209
|
+
validateXmlString(arg);
|
|
34210
|
+
return ` <string>${xmlEscape(arg)}</string>`;
|
|
34211
|
+
}).join("\n");
|
|
33301
34212
|
let envBlock = "";
|
|
33302
34213
|
if (env && Object.keys(env).length > 0) {
|
|
33303
|
-
const envEntries = Object.entries(env).map(([k, v]) =>
|
|
33304
|
-
|
|
34214
|
+
const envEntries = Object.entries(env).map(([k, v]) => {
|
|
34215
|
+
validateXmlString(k);
|
|
34216
|
+
validateEnvKey(k);
|
|
34217
|
+
validateXmlString(v);
|
|
34218
|
+
return ` <key>${xmlEscape(k)}</key>
|
|
34219
|
+
<string>${xmlEscape(v)}</string>`;
|
|
34220
|
+
}).join("\n");
|
|
33305
34221
|
envBlock = `
|
|
33306
34222
|
<key>EnvironmentVariables</key>
|
|
33307
34223
|
<dict>
|
|
@@ -33313,7 +34229,7 @@ ${envEntries}
|
|
|
33313
34229
|
<plist version="1.0">
|
|
33314
34230
|
<dict>
|
|
33315
34231
|
<key>Label</key>
|
|
33316
|
-
<string>${name}</string>
|
|
34232
|
+
<string>${xmlEscape(name)}</string>
|
|
33317
34233
|
<key>ProgramArguments</key>
|
|
33318
34234
|
<array>
|
|
33319
34235
|
${entries}
|
|
@@ -33321,7 +34237,9 @@ ${entries}
|
|
|
33321
34237
|
<key>RunAtLoad</key>
|
|
33322
34238
|
<true/>
|
|
33323
34239
|
<key>KeepAlive</key>
|
|
33324
|
-
<true
|
|
34240
|
+
<true/>
|
|
34241
|
+
<key>ProcessType</key>
|
|
34242
|
+
<string>Background</string>${envBlock}
|
|
33325
34243
|
</dict>
|
|
33326
34244
|
</plist>
|
|
33327
34245
|
`;
|
|
@@ -33333,7 +34251,10 @@ function quoteSystemdArg(arg) {
|
|
|
33333
34251
|
}
|
|
33334
34252
|
function renderUnit(description, programArgs, env) {
|
|
33335
34253
|
const execStart = programArgs.map(quoteSystemdArg).join(" ");
|
|
33336
|
-
const envLines = env ? Object.entries(env).map(([k, v]) =>
|
|
34254
|
+
const envLines = env ? Object.entries(env).map(([k, v]) => {
|
|
34255
|
+
validateEnvKey(k);
|
|
34256
|
+
return `Environment=${k}=${formatSystemdEnvValue(v)}`;
|
|
34257
|
+
}).join("\n") : "";
|
|
33337
34258
|
return `[Unit]
|
|
33338
34259
|
Description=${description}
|
|
33339
34260
|
|
|
@@ -34130,6 +35051,7 @@ var import_express2 = __toESM(require_express2(), 1);
|
|
|
34130
35051
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
34131
35052
|
|
|
34132
35053
|
// ../server/src/config.ts
|
|
35054
|
+
var import_node_fs2 = require("node:fs");
|
|
34133
35055
|
var import_node_os2 = __toESM(require("node:os"), 1);
|
|
34134
35056
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
34135
35057
|
var TRUE_ENV_VALUE = "true";
|
|
@@ -34141,12 +35063,14 @@ var ACP_AGENT_PROFILES = {
|
|
|
34141
35063
|
agent: "openclaw",
|
|
34142
35064
|
command: "openclaw",
|
|
34143
35065
|
args: ["acp"],
|
|
35066
|
+
envPrefix: "OPENCLAW_",
|
|
34144
35067
|
sessionIdStrategy: "deterministic"
|
|
34145
35068
|
},
|
|
34146
35069
|
hermes: {
|
|
34147
35070
|
agent: "hermes",
|
|
34148
35071
|
command: "hermes",
|
|
34149
35072
|
args: ["acp"],
|
|
35073
|
+
envPrefix: "HERMES_",
|
|
34150
35074
|
sessionIdStrategy: "mapped"
|
|
34151
35075
|
}
|
|
34152
35076
|
};
|
|
@@ -34162,9 +35086,7 @@ function getTelevisionStoragePath() {
|
|
|
34162
35086
|
function resolveACPAgentProfile(env = process.env) {
|
|
34163
35087
|
const rawAgent = env[TELEVISION_ACP_AGENT_ENV];
|
|
34164
35088
|
if (rawAgent === void 0) {
|
|
34165
|
-
|
|
34166
|
-
'TELEVISION_ACP_AGENT is required for server startup. Set it to "openclaw" or "hermes".'
|
|
34167
|
-
);
|
|
35089
|
+
return null;
|
|
34168
35090
|
}
|
|
34169
35091
|
const agent = rawAgent.trim().toLowerCase();
|
|
34170
35092
|
if (agent === "openclaw" || agent === "hermes") {
|
|
@@ -34174,13 +35096,50 @@ function resolveACPAgentProfile(env = process.env) {
|
|
|
34174
35096
|
`Unsupported TELEVISION_ACP_AGENT "${rawAgent}". Supported values: openclaw, hermes.`
|
|
34175
35097
|
);
|
|
34176
35098
|
}
|
|
35099
|
+
function buildPersistedACPEnvironment(env) {
|
|
35100
|
+
const pathValue = env.PATH;
|
|
35101
|
+
if (pathValue === void 0) {
|
|
35102
|
+
throw new Error("PATH is required to build the persisted ACP environment.");
|
|
35103
|
+
}
|
|
35104
|
+
const profile = resolveACPAgentProfile(env);
|
|
35105
|
+
if (!profile) {
|
|
35106
|
+
return { PATH: pathValue };
|
|
35107
|
+
}
|
|
35108
|
+
const snapshot = {
|
|
35109
|
+
PATH: pathValue,
|
|
35110
|
+
[TELEVISION_ACP_AGENT_ENV]: profile.agent
|
|
35111
|
+
};
|
|
35112
|
+
for (const [key, value] of Object.entries(env)) {
|
|
35113
|
+
if (key.startsWith(profile.envPrefix) && value !== void 0) {
|
|
35114
|
+
snapshot[key] = value;
|
|
35115
|
+
}
|
|
35116
|
+
}
|
|
35117
|
+
return snapshot;
|
|
35118
|
+
}
|
|
35119
|
+
function canExecuteFile(filePath) {
|
|
35120
|
+
try {
|
|
35121
|
+
return (0, import_node_fs2.statSync)(filePath).isFile() && (0, import_node_fs2.accessSync)(filePath, import_node_fs2.constants.X_OK) === void 0;
|
|
35122
|
+
} catch {
|
|
35123
|
+
return false;
|
|
35124
|
+
}
|
|
35125
|
+
}
|
|
35126
|
+
function isACPCommandResolvable(command, envSnapshot) {
|
|
35127
|
+
if (command.includes(import_node_path2.default.sep)) {
|
|
35128
|
+
return canExecuteFile(command);
|
|
35129
|
+
}
|
|
35130
|
+
const pathValue = envSnapshot.PATH;
|
|
35131
|
+
if (!pathValue) {
|
|
35132
|
+
return false;
|
|
35133
|
+
}
|
|
35134
|
+
return pathValue.split(import_node_path2.default.delimiter).filter((entry) => entry.length > 0).some((entry) => canExecuteFile(import_node_path2.default.join(entry, command)));
|
|
35135
|
+
}
|
|
34177
35136
|
function isVitestRuntime() {
|
|
34178
35137
|
return process.env.VITEST === TRUE_ENV_VALUE;
|
|
34179
35138
|
}
|
|
34180
35139
|
|
|
34181
35140
|
// ../server/src/routes.ts
|
|
34182
35141
|
var import_express = __toESM(require_express2(), 1);
|
|
34183
|
-
var
|
|
35142
|
+
var import_node_fs4 = require("node:fs");
|
|
34184
35143
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
34185
35144
|
|
|
34186
35145
|
// ../../node_modules/zod/v4/classic/external.js
|
|
@@ -48109,7 +49068,7 @@ function getArtifactEntryFilePath(storagePath, artifactID, kind, state) {
|
|
|
48109
49068
|
}
|
|
48110
49069
|
|
|
48111
49070
|
// ../server/src/themes.ts
|
|
48112
|
-
var
|
|
49071
|
+
var import_node_fs3 = require("node:fs");
|
|
48113
49072
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
48114
49073
|
var HTTP_NOT_FOUND_STATUS = 404;
|
|
48115
49074
|
var THEME_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
|
|
@@ -48138,7 +49097,7 @@ function themeExists(storagePath, name) {
|
|
|
48138
49097
|
return false;
|
|
48139
49098
|
}
|
|
48140
49099
|
try {
|
|
48141
|
-
return (0,
|
|
49100
|
+
return (0, import_node_fs3.statSync)(getThemeEntryPath(storagePath, name)).isFile();
|
|
48142
49101
|
} catch {
|
|
48143
49102
|
return false;
|
|
48144
49103
|
}
|
|
@@ -48160,7 +49119,7 @@ function serveThemeCSS(storagePath) {
|
|
|
48160
49119
|
return;
|
|
48161
49120
|
}
|
|
48162
49121
|
try {
|
|
48163
|
-
const css = (0,
|
|
49122
|
+
const css = (0, import_node_fs3.readFileSync)(getThemeEntryPath(storagePath, name), "utf8");
|
|
48164
49123
|
res.type("text/css").setHeader("Cache-Control", "no-cache").send(rewriteThemeURLs(css, name));
|
|
48165
49124
|
} catch (error48) {
|
|
48166
49125
|
if (error48.code === "ENOENT") {
|
|
@@ -48562,8 +49521,8 @@ function registerRoutes(app, store, options) {
|
|
|
48562
49521
|
let realPublicDir;
|
|
48563
49522
|
let realRequestedPath;
|
|
48564
49523
|
try {
|
|
48565
|
-
realPublicDir = (0,
|
|
48566
|
-
realRequestedPath = (0,
|
|
49524
|
+
realPublicDir = (0, import_node_fs4.realpathSync)(publicDir);
|
|
49525
|
+
realRequestedPath = (0, import_node_fs4.realpathSync)(requestedPath);
|
|
48567
49526
|
} catch {
|
|
48568
49527
|
sendError(res, HTTP_NOT_FOUND, "Not found");
|
|
48569
49528
|
return;
|
|
@@ -48597,7 +49556,7 @@ function registerRoutes(app, store, options) {
|
|
|
48597
49556
|
sendError(res, HTTP_FORBIDDEN, "Only the primary content file is HTTP-writable");
|
|
48598
49557
|
});
|
|
48599
49558
|
app.get("/display", ...auth, (_req, res) => {
|
|
48600
|
-
res.json(store.getDisplayState());
|
|
49559
|
+
res.json({ ...store.getDisplayState(), acpEnabled: options.acpEnabled });
|
|
48601
49560
|
});
|
|
48602
49561
|
app.patch("/display", ...auth, (req, res) => {
|
|
48603
49562
|
const parsed = patchDisplaySchema.safeParse(req.body);
|
|
@@ -48893,7 +49852,7 @@ var ACPBridge = class extends withDisposable(class {
|
|
|
48893
49852
|
constructor(options) {
|
|
48894
49853
|
super();
|
|
48895
49854
|
this.send = options.send;
|
|
48896
|
-
this.profile = options.profile
|
|
49855
|
+
this.profile = options.profile;
|
|
48897
49856
|
this.launchProcess = options.launchProcess ?? launchACPProcess;
|
|
48898
49857
|
this.sessionCwd = import_node_path6.default.resolve(process.cwd());
|
|
48899
49858
|
}
|
|
@@ -49039,9 +49998,12 @@ var ACPServer = class extends withDisposable(class {
|
|
|
49039
49998
|
profile;
|
|
49040
49999
|
constructor(options) {
|
|
49041
50000
|
super();
|
|
50001
|
+
if (!options.profile) {
|
|
50002
|
+
throw new Error("ACPServer requires an ACP agent profile.");
|
|
50003
|
+
}
|
|
49042
50004
|
this.authToken = options.authToken;
|
|
49043
50005
|
this.publicServer = options.publicServer;
|
|
49044
|
-
this.profile = options.profile
|
|
50006
|
+
this.profile = options.profile;
|
|
49045
50007
|
this.wsServer = new import_websocket_server.default({ noServer: true });
|
|
49046
50008
|
this.wsServer.on("connection", (socket, request) => {
|
|
49047
50009
|
if (!this.publicServer && !isAuthorizedQueryToken(request.url, this.authToken)) {
|
|
@@ -49100,7 +50062,7 @@ var ACPServer = class extends withDisposable(class {
|
|
|
49100
50062
|
|
|
49101
50063
|
// ../server/src/canonical.ts
|
|
49102
50064
|
var import_node_crypto3 = require("node:crypto");
|
|
49103
|
-
var
|
|
50065
|
+
var import_node_fs5 = require("node:fs");
|
|
49104
50066
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
49105
50067
|
var CACHE_CONTROL_NO_CACHE = "no-cache";
|
|
49106
50068
|
var HTTP_NOT_MODIFIED_STATUS = 304;
|
|
@@ -49126,7 +50088,7 @@ function serveCanonicalStyles(options) {
|
|
|
49126
50088
|
};
|
|
49127
50089
|
}
|
|
49128
50090
|
function loadCanonicalBundle(canonicalDir) {
|
|
49129
|
-
const css = (0,
|
|
50091
|
+
const css = (0, import_node_fs5.readFileSync)(import_node_path7.default.join(canonicalDir, CANONICAL_STYLESHEET), "utf8");
|
|
49130
50092
|
return { css, hash: hashContent(css) };
|
|
49131
50093
|
}
|
|
49132
50094
|
function buildCanonicalResponse(bundle, store) {
|
|
@@ -49139,7 +50101,7 @@ function buildCanonicalResponse(bundle, store) {
|
|
|
49139
50101
|
return { body: bundle.css, etag: buildETag(bundle.hash, NO_THEME_HASH) };
|
|
49140
50102
|
}
|
|
49141
50103
|
try {
|
|
49142
|
-
const themeCSS = (0,
|
|
50104
|
+
const themeCSS = (0, import_node_fs5.readFileSync)(getThemeEntryPath(store.storagePath, activeThemeName), "utf8");
|
|
49143
50105
|
return {
|
|
49144
50106
|
body: `${bundle.css}
|
|
49145
50107
|
|
|
@@ -49202,8 +50164,14 @@ var Server = class {
|
|
|
49202
50164
|
});
|
|
49203
50165
|
this.app.use(import_express2.default.json());
|
|
49204
50166
|
this.events = new EventStreamServer({ store: this.store, publicServer: this.publicServer });
|
|
50167
|
+
this.acp = options.acpProfile ? new ACPServer({
|
|
50168
|
+
authToken: this.store.authToken,
|
|
50169
|
+
publicServer: this.publicServer,
|
|
50170
|
+
profile: options.acpProfile
|
|
50171
|
+
}) : null;
|
|
49205
50172
|
registerRoutes(this.app, this.store, {
|
|
49206
|
-
requireAuth: this.publicServer ? null : this.requireAuthorization
|
|
50173
|
+
requireAuth: this.publicServer ? null : this.requireAuthorization,
|
|
50174
|
+
acpEnabled: this.acp !== null
|
|
49207
50175
|
});
|
|
49208
50176
|
if (options.canonicalDir) {
|
|
49209
50177
|
this.app.get(
|
|
@@ -49218,11 +50186,6 @@ var Server = class {
|
|
|
49218
50186
|
if (options.staticDir) {
|
|
49219
50187
|
this.app.use(import_express2.default.static(options.staticDir));
|
|
49220
50188
|
}
|
|
49221
|
-
this.acp = new ACPServer({
|
|
49222
|
-
authToken: this.store.authToken,
|
|
49223
|
-
publicServer: this.publicServer,
|
|
49224
|
-
profile: options.acpProfile
|
|
49225
|
-
});
|
|
49226
50189
|
this.httpServer.on("upgrade", (request, socket, head) => {
|
|
49227
50190
|
const parsed = new URL(request.url ?? "/", this.baseURL);
|
|
49228
50191
|
const duplex = socket;
|
|
@@ -49230,7 +50193,7 @@ var Server = class {
|
|
|
49230
50193
|
this.events.handleUpgrade(request, duplex, head);
|
|
49231
50194
|
return;
|
|
49232
50195
|
}
|
|
49233
|
-
if (parsed.pathname === "/acp") {
|
|
50196
|
+
if (parsed.pathname === "/acp" && this.acp) {
|
|
49234
50197
|
this.acp.handleUpgrade(request, duplex, head);
|
|
49235
50198
|
return;
|
|
49236
50199
|
}
|
|
@@ -49262,13 +50225,17 @@ var Server = class {
|
|
|
49262
50225
|
return this.store.authToken;
|
|
49263
50226
|
}
|
|
49264
50227
|
getACPBridgePID() {
|
|
49265
|
-
return this.acp
|
|
50228
|
+
return this.acp?.getChildPIDs()[0] ?? null;
|
|
49266
50229
|
}
|
|
49267
50230
|
getACPBridgePIDs() {
|
|
49268
|
-
return this.acp
|
|
50231
|
+
return this.acp?.getChildPIDs() ?? [];
|
|
49269
50232
|
}
|
|
49270
50233
|
async dispose() {
|
|
49271
|
-
await Promise.all([
|
|
50234
|
+
await Promise.all([
|
|
50235
|
+
this.events.dispose(),
|
|
50236
|
+
this.acp?.dispose() ?? Promise.resolve(),
|
|
50237
|
+
Promise.resolve(this.store.dispose())
|
|
50238
|
+
]);
|
|
49272
50239
|
await new Promise((resolve, reject) => {
|
|
49273
50240
|
this.httpServer.closeAllConnections?.();
|
|
49274
50241
|
this.httpServer.closeIdleConnections?.();
|
|
@@ -49291,7 +50258,7 @@ var Server = class {
|
|
|
49291
50258
|
};
|
|
49292
50259
|
|
|
49293
50260
|
// ../server/src/server-store.ts
|
|
49294
|
-
var
|
|
50261
|
+
var import_node_fs6 = require("node:fs");
|
|
49295
50262
|
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
49296
50263
|
|
|
49297
50264
|
// ../server/src/file-watcher.ts
|
|
@@ -49331,7 +50298,7 @@ var ServerStore = class extends EventTarget {
|
|
|
49331
50298
|
super();
|
|
49332
50299
|
this.storagePath = options.storagePath;
|
|
49333
50300
|
this.watchContentFile = options.watchContentFile ?? defaultWatchContentFile;
|
|
49334
|
-
this.bundledViewsPath = options.bundledViewsPath && (0,
|
|
50301
|
+
this.bundledViewsPath = options.bundledViewsPath && (0, import_node_fs6.existsSync)(options.bundledViewsPath) ? options.bundledViewsPath : null;
|
|
49335
50302
|
this.ensureDirectories();
|
|
49336
50303
|
this.views = this.scanViewRegistry();
|
|
49337
50304
|
this.authToken = this.loadOrCreateAuthToken();
|
|
@@ -49386,7 +50353,7 @@ var ServerStore = class extends EventTarget {
|
|
|
49386
50353
|
return this._artifacts.get(id);
|
|
49387
50354
|
}
|
|
49388
50355
|
hasTrashedArtifact(id) {
|
|
49389
|
-
return (0,
|
|
50356
|
+
return (0, import_node_fs6.existsSync)(getArtifactTrashMetadataPath(this.storagePath, id));
|
|
49390
50357
|
}
|
|
49391
50358
|
/**
|
|
49392
50359
|
* Resolve the absolute filesystem path where an artifact's primary content
|
|
@@ -49425,11 +50392,11 @@ var ServerStore = class extends EventTarget {
|
|
|
49425
50392
|
throw new NotFoundError(`Artifact not found: ${id}`, { entityType: "artifact", entityID: id });
|
|
49426
50393
|
}
|
|
49427
50394
|
try {
|
|
49428
|
-
(0,
|
|
50395
|
+
(0, import_node_fs6.accessSync)(contentPath, import_node_fs6.constants.R_OK);
|
|
49429
50396
|
} catch {
|
|
49430
50397
|
throw new NotFoundError(`Artifact content not readable: ${id}`, { entityType: "artifact content", entityID: id });
|
|
49431
50398
|
}
|
|
49432
|
-
return (0,
|
|
50399
|
+
return (0, import_node_fs6.readFileSync)(contentPath);
|
|
49433
50400
|
}
|
|
49434
50401
|
/**
|
|
49435
50402
|
* Replace an artifact's content at the resolved content path.
|
|
@@ -49455,10 +50422,10 @@ var ServerStore = class extends EventTarget {
|
|
|
49455
50422
|
`Artifact ${id} has no committed content yet. Use commit or abandon after writing the pending bundle`
|
|
49456
50423
|
);
|
|
49457
50424
|
}
|
|
49458
|
-
if (!(0,
|
|
50425
|
+
if (!(0, import_node_fs6.existsSync)(import_node_path9.default.dirname(contentPath))) {
|
|
49459
50426
|
throw new NotFoundError(`Artifact content not readable: ${id}`, { entityType: "artifact content", entityID: id });
|
|
49460
50427
|
}
|
|
49461
|
-
(0,
|
|
50428
|
+
(0, import_node_fs6.writeFileSync)(contentPath, content);
|
|
49462
50429
|
}
|
|
49463
50430
|
listScreens() {
|
|
49464
50431
|
return [...this.screens.values()];
|
|
@@ -49525,8 +50492,8 @@ var ServerStore = class extends EventTarget {
|
|
|
49525
50492
|
throw new InvalidRequestError(`Artifact ${artifactID} already has pending work. Use commit or abandon before editing again`);
|
|
49526
50493
|
}
|
|
49527
50494
|
const pendingPath = getArtifactPendingBundlePath(this.storagePath, artifactID);
|
|
49528
|
-
(0,
|
|
49529
|
-
(0,
|
|
50495
|
+
(0, import_node_fs6.rmSync)(pendingPath, { recursive: true, force: true });
|
|
50496
|
+
(0, import_node_fs6.cpSync)(
|
|
49530
50497
|
getArtifactCommittedBundlePath(this.storagePath, artifactID),
|
|
49531
50498
|
pendingPath,
|
|
49532
50499
|
{ recursive: true }
|
|
@@ -49550,8 +50517,8 @@ var ServerStore = class extends EventTarget {
|
|
|
49550
50517
|
const pendingPath = getArtifactPendingBundlePath(this.storagePath, artifactID);
|
|
49551
50518
|
const committedPath = getArtifactCommittedBundlePath(this.storagePath, artifactID);
|
|
49552
50519
|
this.stopWatchingArtifactContent(artifactID);
|
|
49553
|
-
(0,
|
|
49554
|
-
(0,
|
|
50520
|
+
(0, import_node_fs6.rmSync)(committedPath, { recursive: true, force: true });
|
|
50521
|
+
(0, import_node_fs6.renameSync)(pendingPath, committedPath);
|
|
49555
50522
|
artifact.status = "committed";
|
|
49556
50523
|
this.writeArtifact(artifact);
|
|
49557
50524
|
this._artifacts.set(artifactID, artifact);
|
|
@@ -49571,7 +50538,7 @@ var ServerStore = class extends EventTarget {
|
|
|
49571
50538
|
if (artifact.status !== "pending") {
|
|
49572
50539
|
throw new InvalidRequestError(`Artifact ${artifactID} has no pending work to abandon`);
|
|
49573
50540
|
}
|
|
49574
|
-
(0,
|
|
50541
|
+
(0, import_node_fs6.rmSync)(getArtifactPendingBundlePath(this.storagePath, artifactID), { recursive: true, force: true });
|
|
49575
50542
|
if (!this.hasCommittedBundle(artifactID)) {
|
|
49576
50543
|
this.cascadeArtifactRemoval(artifactID);
|
|
49577
50544
|
return;
|
|
@@ -49847,13 +50814,13 @@ var ServerStore = class extends EventTarget {
|
|
|
49847
50814
|
this.dispose();
|
|
49848
50815
|
}
|
|
49849
50816
|
load() {
|
|
49850
|
-
if ((0,
|
|
49851
|
-
for (const file2 of (0,
|
|
50817
|
+
if ((0, import_node_fs6.existsSync)(this.screensDir)) {
|
|
50818
|
+
for (const file2 of (0, import_node_fs6.readdirSync)(this.screensDir)) {
|
|
49852
50819
|
if (!file2.endsWith(JSON_FILE_SUFFIX)) continue;
|
|
49853
50820
|
const filePath = import_node_path9.default.join(this.screensDir, file2);
|
|
49854
50821
|
let raw;
|
|
49855
50822
|
try {
|
|
49856
|
-
raw = JSON.parse((0,
|
|
50823
|
+
raw = JSON.parse((0, import_node_fs6.readFileSync)(filePath, "utf8"));
|
|
49857
50824
|
} catch (error48) {
|
|
49858
50825
|
console.warn(`Skipping malformed JSON file: ${filePath}`, error48);
|
|
49859
50826
|
continue;
|
|
@@ -49869,10 +50836,10 @@ var ServerStore = class extends EventTarget {
|
|
|
49869
50836
|
});
|
|
49870
50837
|
}
|
|
49871
50838
|
}
|
|
49872
|
-
if (!(0,
|
|
50839
|
+
if (!(0, import_node_fs6.existsSync)(this.artifactsDir)) {
|
|
49873
50840
|
return;
|
|
49874
50841
|
}
|
|
49875
|
-
for (const file2 of (0,
|
|
50842
|
+
for (const file2 of (0, import_node_fs6.readdirSync)(this.artifactsDir)) {
|
|
49876
50843
|
if (!file2.endsWith(JSON_FILE_SUFFIX)) {
|
|
49877
50844
|
continue;
|
|
49878
50845
|
}
|
|
@@ -49905,7 +50872,7 @@ var ServerStore = class extends EventTarget {
|
|
|
49905
50872
|
return;
|
|
49906
50873
|
}
|
|
49907
50874
|
try {
|
|
49908
|
-
(0,
|
|
50875
|
+
(0, import_node_fs6.accessSync)(contentPath, import_node_fs6.constants.R_OK);
|
|
49909
50876
|
const watcher = this.watchContentFile(contentPath, () => {
|
|
49910
50877
|
this.scheduleArtifactContentChangedEvent(artifactID);
|
|
49911
50878
|
});
|
|
@@ -50024,7 +50991,7 @@ var ServerStore = class extends EventTarget {
|
|
|
50024
50991
|
* metadata field.
|
|
50025
50992
|
*/
|
|
50026
50993
|
hasCommittedBundle(artifactID) {
|
|
50027
|
-
return (0,
|
|
50994
|
+
return (0, import_node_fs6.existsSync)(getArtifactCommittedBundlePath(this.storagePath, artifactID));
|
|
50028
50995
|
}
|
|
50029
50996
|
createKindArtifact(input) {
|
|
50030
50997
|
const kind = input.kind;
|
|
@@ -50094,9 +51061,9 @@ var ServerStore = class extends EventTarget {
|
|
|
50094
51061
|
this.persistDisplayState();
|
|
50095
51062
|
}
|
|
50096
51063
|
ensureDirectories() {
|
|
50097
|
-
(0,
|
|
50098
|
-
(0,
|
|
50099
|
-
(0,
|
|
51064
|
+
(0, import_node_fs6.mkdirSync)(this.screensDir, { recursive: true });
|
|
51065
|
+
(0, import_node_fs6.mkdirSync)(this.artifactsDir, { recursive: true });
|
|
51066
|
+
(0, import_node_fs6.mkdirSync)(getThemesDir(this.storagePath), { recursive: true });
|
|
50100
51067
|
}
|
|
50101
51068
|
/**
|
|
50102
51069
|
* Cascade the last-reference removal of `artifactID`: move the bundle to
|
|
@@ -50113,12 +51080,12 @@ var ServerStore = class extends EventTarget {
|
|
|
50113
51080
|
}
|
|
50114
51081
|
const affectedScreenIDs = this.collectReferencingScreenIDs(artifactID);
|
|
50115
51082
|
if (artifact.kind === "web-bundle") {
|
|
50116
|
-
(0,
|
|
51083
|
+
(0, import_node_fs6.rmSync)(getArtifactPendingBundlePath(this.storagePath, artifactID), { recursive: true, force: true });
|
|
50117
51084
|
}
|
|
50118
51085
|
this.stopWatchingArtifactContent(artifactID);
|
|
50119
51086
|
if (artifact.kind === "web-bundle" && artifact.status === "pending" && !this.hasCommittedBundle(artifactID)) {
|
|
50120
51087
|
this._artifacts.delete(artifactID);
|
|
50121
|
-
(0,
|
|
51088
|
+
(0, import_node_fs6.rmSync)(getArtifactLiveMetadataPath(this.storagePath, artifactID), { force: true });
|
|
50122
51089
|
this.stripArtifactFromScreens(artifactID, affectedScreenIDs);
|
|
50123
51090
|
this.emitArtifactRemovedEvents(artifactID, affectedScreenIDs);
|
|
50124
51091
|
return {
|
|
@@ -50132,7 +51099,7 @@ var ServerStore = class extends EventTarget {
|
|
|
50132
51099
|
status: "committed"
|
|
50133
51100
|
});
|
|
50134
51101
|
this._artifacts.delete(artifactID);
|
|
50135
|
-
(0,
|
|
51102
|
+
(0, import_node_fs6.rmSync)(getArtifactLiveMetadataPath(this.storagePath, artifactID), { force: true });
|
|
50136
51103
|
this.stripArtifactFromScreens(artifactID, affectedScreenIDs);
|
|
50137
51104
|
this.emitArtifactRemovedEvents(artifactID, affectedScreenIDs);
|
|
50138
51105
|
return result;
|
|
@@ -50157,8 +51124,8 @@ var ServerStore = class extends EventTarget {
|
|
|
50157
51124
|
}
|
|
50158
51125
|
trashArtifact(artifact) {
|
|
50159
51126
|
const metadataPath = getArtifactTrashMetadataPath(this.storagePath, artifact.id);
|
|
50160
|
-
(0,
|
|
50161
|
-
(0,
|
|
51127
|
+
(0, import_node_fs6.mkdirSync)(import_node_path9.default.dirname(metadataPath), { recursive: true });
|
|
51128
|
+
(0, import_node_fs6.writeFileSync)(metadataPath, JSON.stringify(artifact, null, JSON_INDENT_SPACES));
|
|
50162
51129
|
switch (artifact.kind) {
|
|
50163
51130
|
case "url": {
|
|
50164
51131
|
const externalURL = artifact.externalURL;
|
|
@@ -50189,9 +51156,9 @@ var ServerStore = class extends EventTarget {
|
|
|
50189
51156
|
case "web-bundle": {
|
|
50190
51157
|
const committedBundlePath = getArtifactCommittedBundlePath(this.storagePath, artifact.id);
|
|
50191
51158
|
const bundlePath = getArtifactTrashBundlePath(this.storagePath, artifact.id);
|
|
50192
|
-
(0,
|
|
50193
|
-
if ((0,
|
|
50194
|
-
(0,
|
|
51159
|
+
(0, import_node_fs6.rmSync)(bundlePath, { recursive: true, force: true });
|
|
51160
|
+
if ((0, import_node_fs6.existsSync)(committedBundlePath)) {
|
|
51161
|
+
(0, import_node_fs6.renameSync)(committedBundlePath, bundlePath);
|
|
50195
51162
|
}
|
|
50196
51163
|
return {
|
|
50197
51164
|
outcome: "trashed",
|
|
@@ -50205,9 +51172,9 @@ var ServerStore = class extends EventTarget {
|
|
|
50205
51172
|
}
|
|
50206
51173
|
trashScreen(screen) {
|
|
50207
51174
|
const metadataPath = getTrashedScreenMetadataPath(this.storagePath, screen.id);
|
|
50208
|
-
(0,
|
|
50209
|
-
(0,
|
|
50210
|
-
(0,
|
|
51175
|
+
(0, import_node_fs6.mkdirSync)(import_node_path9.default.dirname(metadataPath), { recursive: true });
|
|
51176
|
+
(0, import_node_fs6.writeFileSync)(metadataPath, JSON.stringify(screen, null, JSON_INDENT_SPACES));
|
|
51177
|
+
(0, import_node_fs6.rmSync)(import_node_path9.default.join(this.screensDir, `${screen.id}.json`), { force: true });
|
|
50211
51178
|
this.screens.delete(screen.id);
|
|
50212
51179
|
return metadataPath;
|
|
50213
51180
|
}
|
|
@@ -50225,7 +51192,7 @@ var ServerStore = class extends EventTarget {
|
|
|
50225
51192
|
}
|
|
50226
51193
|
let entries;
|
|
50227
51194
|
try {
|
|
50228
|
-
entries = (0,
|
|
51195
|
+
entries = (0, import_node_fs6.readdirSync)(this.bundledViewsPath);
|
|
50229
51196
|
} catch (error48) {
|
|
50230
51197
|
console.warn(`Failed to read bundled views directory: ${this.bundledViewsPath}`, error48);
|
|
50231
51198
|
return [];
|
|
@@ -50234,7 +51201,7 @@ var ServerStore = class extends EventTarget {
|
|
|
50234
51201
|
for (const id of entries) {
|
|
50235
51202
|
const viewDir = import_node_path9.default.join(this.bundledViewsPath, id);
|
|
50236
51203
|
try {
|
|
50237
|
-
if (!(0,
|
|
51204
|
+
if (!(0, import_node_fs6.statSync)(viewDir).isDirectory()) {
|
|
50238
51205
|
continue;
|
|
50239
51206
|
}
|
|
50240
51207
|
} catch {
|
|
@@ -50243,7 +51210,7 @@ var ServerStore = class extends EventTarget {
|
|
|
50243
51210
|
const manifestPath = import_node_path9.default.join(viewDir, "manifest.json");
|
|
50244
51211
|
let raw;
|
|
50245
51212
|
try {
|
|
50246
|
-
raw = (0,
|
|
51213
|
+
raw = (0, import_node_fs6.readFileSync)(manifestPath, "utf8");
|
|
50247
51214
|
} catch {
|
|
50248
51215
|
console.warn(`Skipping view "${id}": cannot read manifest at ${manifestPath}`);
|
|
50249
51216
|
continue;
|
|
@@ -50266,12 +51233,12 @@ var ServerStore = class extends EventTarget {
|
|
|
50266
51233
|
return registry2;
|
|
50267
51234
|
}
|
|
50268
51235
|
loadDisplayState() {
|
|
50269
|
-
if (!(0,
|
|
51236
|
+
if (!(0, import_node_fs6.existsSync)(this.displayStatePath)) {
|
|
50270
51237
|
return false;
|
|
50271
51238
|
}
|
|
50272
51239
|
let raw;
|
|
50273
51240
|
try {
|
|
50274
|
-
raw = (0,
|
|
51241
|
+
raw = (0, import_node_fs6.readFileSync)(this.displayStatePath, "utf8");
|
|
50275
51242
|
} catch {
|
|
50276
51243
|
return false;
|
|
50277
51244
|
}
|
|
@@ -50289,7 +51256,7 @@ var ServerStore = class extends EventTarget {
|
|
|
50289
51256
|
return false;
|
|
50290
51257
|
}
|
|
50291
51258
|
persistDisplayState() {
|
|
50292
|
-
(0,
|
|
51259
|
+
(0, import_node_fs6.writeFileSync)(
|
|
50293
51260
|
this.displayStatePath,
|
|
50294
51261
|
JSON.stringify(this.getDisplayState(), null, JSON_INDENT_SPACES)
|
|
50295
51262
|
);
|
|
@@ -50311,11 +51278,11 @@ var ServerStore = class extends EventTarget {
|
|
|
50311
51278
|
return firstScreen.id;
|
|
50312
51279
|
}
|
|
50313
51280
|
loadOrCreateAuthToken() {
|
|
50314
|
-
if ((0,
|
|
50315
|
-
return (0,
|
|
51281
|
+
if ((0, import_node_fs6.existsSync)(this.tokenPath)) {
|
|
51282
|
+
return (0, import_node_fs6.readFileSync)(this.tokenPath, "utf8").trim();
|
|
50316
51283
|
}
|
|
50317
51284
|
const token = createToken();
|
|
50318
|
-
(0,
|
|
51285
|
+
(0, import_node_fs6.writeFileSync)(this.tokenPath, `${token}
|
|
50319
51286
|
`);
|
|
50320
51287
|
return token;
|
|
50321
51288
|
}
|
|
@@ -50323,12 +51290,12 @@ var ServerStore = class extends EventTarget {
|
|
|
50323
51290
|
if (!this.screens.has(screen.id)) {
|
|
50324
51291
|
throw new Error(`Cannot persist screen ${screen.id}: not in live map`);
|
|
50325
51292
|
}
|
|
50326
|
-
(0,
|
|
51293
|
+
(0, import_node_fs6.writeFileSync)(import_node_path9.default.join(this.screensDir, `${screen.id}.json`), JSON.stringify(screen, null, JSON_INDENT_SPACES));
|
|
50327
51294
|
}
|
|
50328
51295
|
readArtifactFile(filePath, expectedID) {
|
|
50329
51296
|
let raw;
|
|
50330
51297
|
try {
|
|
50331
|
-
raw = (0,
|
|
51298
|
+
raw = (0, import_node_fs6.readFileSync)(filePath, "utf8");
|
|
50332
51299
|
} catch (error48) {
|
|
50333
51300
|
throw this.invalidMetadataFile(filePath, "unreadable", error48);
|
|
50334
51301
|
}
|
|
@@ -50367,16 +51334,16 @@ Review docs/storage.md for the current schema, and either update the file to mat
|
|
|
50367
51334
|
return cause !== void 0 ? new Error(message, { cause }) : new Error(message);
|
|
50368
51335
|
}
|
|
50369
51336
|
writeArtifact(artifact) {
|
|
50370
|
-
(0,
|
|
51337
|
+
(0, import_node_fs6.writeFileSync)(getArtifactLiveMetadataPath(this.storagePath, artifact.id), JSON.stringify(artifact, null, JSON_INDENT_SPACES));
|
|
50371
51338
|
}
|
|
50372
51339
|
scaffoldPendingBundle(artifactID) {
|
|
50373
51340
|
const publicDir = getArtifactPublicDirPath(this.storagePath, artifactID, "pending");
|
|
50374
|
-
(0,
|
|
51341
|
+
(0, import_node_fs6.mkdirSync)(publicDir, { recursive: true });
|
|
50375
51342
|
}
|
|
50376
51343
|
scaffoldCommittedBundle(artifactID) {
|
|
50377
51344
|
const publicDir = getArtifactPublicDirPath(this.storagePath, artifactID, "committed");
|
|
50378
|
-
(0,
|
|
50379
|
-
(0,
|
|
51345
|
+
(0, import_node_fs6.mkdirSync)(publicDir, { recursive: true });
|
|
51346
|
+
(0, import_node_fs6.writeFileSync)(getArtifactEntryFilePath(this.storagePath, artifactID, "web-bundle", "committed"), "");
|
|
50380
51347
|
}
|
|
50381
51348
|
get screensDir() {
|
|
50382
51349
|
return import_node_path9.default.join(this.storagePath, "screens");
|
|
@@ -50397,7 +51364,7 @@ Review docs/storage.md for the current schema, and either update the file to mat
|
|
|
50397
51364
|
throw new InvalidRequestError("externalFilePath must be normalized and must not contain traversal segments");
|
|
50398
51365
|
}
|
|
50399
51366
|
try {
|
|
50400
|
-
(0,
|
|
51367
|
+
(0, import_node_fs6.accessSync)(sourcePath, import_node_fs6.constants.R_OK);
|
|
50401
51368
|
} catch {
|
|
50402
51369
|
throw new InvalidRequestError(`externalFilePath does not exist or is not readable: ${sourcePath}`);
|
|
50403
51370
|
}
|
|
@@ -50476,14 +51443,14 @@ function resolveVercelSkillsInstallerBin() {
|
|
|
50476
51443
|
return localRequire.resolve("skills/bin/cli.mjs");
|
|
50477
51444
|
}
|
|
50478
51445
|
function readCLIVersion() {
|
|
50479
|
-
if ("0.1.
|
|
50480
|
-
return "0.1.
|
|
51446
|
+
if ("0.1.106".length > 0) {
|
|
51447
|
+
return "0.1.106";
|
|
50481
51448
|
}
|
|
50482
51449
|
const devPackageJsonPath = import_node_path10.default.join(getDevPackageDir(), "package.json");
|
|
50483
|
-
if (!(0,
|
|
51450
|
+
if (!(0, import_node_fs7.existsSync)(devPackageJsonPath)) {
|
|
50484
51451
|
throw new Error("Could not resolve package.json for repo-local CLI version.");
|
|
50485
51452
|
}
|
|
50486
|
-
return JSON.parse((0,
|
|
51453
|
+
return JSON.parse((0, import_node_fs7.readFileSync)(devPackageJsonPath, "utf8")).version;
|
|
50487
51454
|
}
|
|
50488
51455
|
var FRONTMATTER_DELIMITER = "---\n";
|
|
50489
51456
|
var FRONTMATTER_DELIMITER_LENGTH = FRONTMATTER_DELIMITER.length;
|
|
@@ -50540,59 +51507,59 @@ function resolveStaticDir() {
|
|
|
50540
51507
|
if (!process.argv[1]) {
|
|
50541
51508
|
return void 0;
|
|
50542
51509
|
}
|
|
50543
|
-
const entryDir = import_node_path10.default.dirname((0,
|
|
51510
|
+
const entryDir = import_node_path10.default.dirname((0, import_node_fs7.realpathSync)(process.argv[1]));
|
|
50544
51511
|
const resolved = import_node_path10.default.resolve(entryDir, "./web");
|
|
50545
|
-
return (0,
|
|
51512
|
+
return (0, import_node_fs7.existsSync)(import_node_path10.default.join(resolved, "index.html")) ? resolved : void 0;
|
|
50546
51513
|
}
|
|
50547
51514
|
function resolveBundledViewsPath() {
|
|
50548
51515
|
if (process.argv[1]) {
|
|
50549
|
-
const entryDir = import_node_path10.default.dirname((0,
|
|
51516
|
+
const entryDir = import_node_path10.default.dirname((0, import_node_fs7.realpathSync)(process.argv[1]));
|
|
50550
51517
|
const resolved = import_node_path10.default.resolve(entryDir, "./views");
|
|
50551
|
-
return (0,
|
|
51518
|
+
return (0, import_node_fs7.existsSync)(resolved) ? resolved : void 0;
|
|
50552
51519
|
}
|
|
50553
51520
|
const devViewsPath = import_node_path10.default.join(getDevPackageDir(), "dist/views");
|
|
50554
|
-
return (0,
|
|
51521
|
+
return (0, import_node_fs7.existsSync)(devViewsPath) ? devViewsPath : void 0;
|
|
50555
51522
|
}
|
|
50556
51523
|
function resolveCanonicalDir() {
|
|
50557
51524
|
if (process.argv[1]) {
|
|
50558
|
-
const entryDir = import_node_path10.default.dirname((0,
|
|
51525
|
+
const entryDir = import_node_path10.default.dirname((0, import_node_fs7.realpathSync)(process.argv[1]));
|
|
50559
51526
|
const resolved = import_node_path10.default.resolve(entryDir, "./canonical/v1");
|
|
50560
|
-
return (0,
|
|
51527
|
+
return (0, import_node_fs7.existsSync)(resolved) ? resolved : void 0;
|
|
50561
51528
|
}
|
|
50562
51529
|
const devCanonicalPath = import_node_path10.default.resolve(
|
|
50563
51530
|
getDevPackageDir(),
|
|
50564
51531
|
"../server/dist/canonical/v1"
|
|
50565
51532
|
);
|
|
50566
|
-
return (0,
|
|
51533
|
+
return (0, import_node_fs7.existsSync)(devCanonicalPath) ? devCanonicalPath : void 0;
|
|
50567
51534
|
}
|
|
50568
51535
|
function resolveBundledSkillsRoot() {
|
|
50569
|
-
const builtPath = typeof process.argv[1] === "string" ? import_node_path10.default.resolve(import_node_path10.default.dirname((0,
|
|
50570
|
-
if (builtPath && (0,
|
|
51536
|
+
const builtPath = typeof process.argv[1] === "string" ? import_node_path10.default.resolve(import_node_path10.default.dirname((0, import_node_fs7.realpathSync)(process.argv[1])), "./skills") : void 0;
|
|
51537
|
+
if (builtPath && (0, import_node_fs7.existsSync)(builtPath)) {
|
|
50571
51538
|
return builtPath;
|
|
50572
51539
|
}
|
|
50573
51540
|
const devPath = import_node_path10.default.resolve(getDevPackageDir(), "../skills/dist");
|
|
50574
|
-
return (0,
|
|
51541
|
+
return (0, import_node_fs7.existsSync)(devPath) ? devPath : void 0;
|
|
50575
51542
|
}
|
|
50576
51543
|
function copyBundledSkillsToDestination(bundledSkillsRoot, destinationRoot) {
|
|
50577
|
-
if ((0,
|
|
51544
|
+
if ((0, import_node_fs7.existsSync)(destinationRoot) && !(0, import_node_fs7.statSync)(destinationRoot).isDirectory()) {
|
|
50578
51545
|
throw new Error(`Skills destination is not a directory: ${destinationRoot}`);
|
|
50579
51546
|
}
|
|
50580
|
-
(0,
|
|
51547
|
+
(0, import_node_fs7.mkdirSync)(destinationRoot, { recursive: true });
|
|
50581
51548
|
const copied = [];
|
|
50582
|
-
const entries = (0,
|
|
51549
|
+
const entries = (0, import_node_fs7.readdirSync)(bundledSkillsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).sort((a, b) => a.name.localeCompare(b.name));
|
|
50583
51550
|
for (const entry of entries) {
|
|
50584
51551
|
const sourcePath = import_node_path10.default.join(bundledSkillsRoot, entry.name);
|
|
50585
51552
|
const destinationPath = import_node_path10.default.join(destinationRoot, entry.name);
|
|
50586
|
-
(0,
|
|
50587
|
-
(0,
|
|
51553
|
+
(0, import_node_fs7.rmSync)(destinationPath, { recursive: true, force: true });
|
|
51554
|
+
(0, import_node_fs7.cpSync)(sourcePath, destinationPath, { recursive: true });
|
|
50588
51555
|
copied.push({ name: entry.name, sourcePath, destinationPath });
|
|
50589
51556
|
}
|
|
50590
51557
|
return copied;
|
|
50591
51558
|
}
|
|
50592
51559
|
function isInTempDirectory(inputPath) {
|
|
50593
51560
|
try {
|
|
50594
|
-
const realTmp = (0,
|
|
50595
|
-
const realInput = (0,
|
|
51561
|
+
const realTmp = (0, import_node_fs7.realpathSync)(import_node_os4.default.tmpdir());
|
|
51562
|
+
const realInput = (0, import_node_fs7.existsSync)(inputPath) ? (0, import_node_fs7.realpathSync)(inputPath) : import_node_path10.default.resolve(inputPath);
|
|
50596
51563
|
const relative = import_node_path10.default.relative(realTmp, realInput);
|
|
50597
51564
|
return relative !== "" && !relative.startsWith("..") && !import_node_path10.default.isAbsolute(relative);
|
|
50598
51565
|
} catch {
|
|
@@ -50604,7 +51571,7 @@ function validateExternalArtifactPath(commandName, inputPath) {
|
|
|
50604
51571
|
throw createDirectiveError(`tv ${commandName} requires --path to be an absolute path.`);
|
|
50605
51572
|
}
|
|
50606
51573
|
try {
|
|
50607
|
-
(0,
|
|
51574
|
+
(0, import_node_fs7.accessSync)(inputPath, import_node_fs7.constants.R_OK);
|
|
50608
51575
|
} catch {
|
|
50609
51576
|
throw createDirectiveError(`tv ${commandName} could not read --path ${inputPath}.`);
|
|
50610
51577
|
}
|
|
@@ -50736,10 +51703,10 @@ function formatCommanderError(argv, error48) {
|
|
|
50736
51703
|
}
|
|
50737
51704
|
function readAuthToken(storagePath) {
|
|
50738
51705
|
const tokenPath = import_node_path10.default.join(storagePath, "token");
|
|
50739
|
-
if (!(0,
|
|
51706
|
+
if (!(0, import_node_fs7.existsSync)(tokenPath)) {
|
|
50740
51707
|
return void 0;
|
|
50741
51708
|
}
|
|
50742
|
-
const token = (0,
|
|
51709
|
+
const token = (0, import_node_fs7.readFileSync)(tokenPath, "utf8").trim();
|
|
50743
51710
|
return token.length > 0 ? token : void 0;
|
|
50744
51711
|
}
|
|
50745
51712
|
function readOrCreateAuthToken(storagePath) {
|
|
@@ -50750,7 +51717,7 @@ function createEnvironment(environment) {
|
|
|
50750
51717
|
stdout: environment.stdout ?? process.stdout,
|
|
50751
51718
|
stderr: environment.stderr ?? process.stderr,
|
|
50752
51719
|
createClient: environment.createClient ?? ((serverURL, token) => new TelevisionClient(serverURL, { token })),
|
|
50753
|
-
createServer: environment.createServer ?? ((options
|
|
51720
|
+
createServer: environment.createServer ?? ((options) => new Server({
|
|
50754
51721
|
store: new ServerStore({
|
|
50755
51722
|
storagePath: options.storagePath ?? getTelevisionStoragePath(),
|
|
50756
51723
|
...options.bundledViewsPath ? { bundledViewsPath: options.bundledViewsPath } : {}
|
|
@@ -50760,7 +51727,7 @@ function createEnvironment(environment) {
|
|
|
50760
51727
|
staticDir: options.staticDir,
|
|
50761
51728
|
canonicalDir: options.canonicalDir,
|
|
50762
51729
|
public: options.public,
|
|
50763
|
-
acpProfile:
|
|
51730
|
+
acpProfile: options.acpProfile
|
|
50764
51731
|
})),
|
|
50765
51732
|
createDaemon: environment.createDaemon ?? ((options = {}) => {
|
|
50766
51733
|
const args = [process.argv[1], "serve"];
|
|
@@ -50772,7 +51739,8 @@ function createEnvironment(environment) {
|
|
|
50772
51739
|
name: DAEMON_NAME,
|
|
50773
51740
|
description: "Television server \u2014 virtual display for agents",
|
|
50774
51741
|
command: process.execPath,
|
|
50775
|
-
args
|
|
51742
|
+
args,
|
|
51743
|
+
env: options.env
|
|
50776
51744
|
});
|
|
50777
51745
|
}),
|
|
50778
51746
|
resolveStaticDir: environment.resolveStaticDir ?? (() => resolveStaticDir()),
|
|
@@ -50794,21 +51762,45 @@ function createProgram(env, argv = []) {
|
|
|
50794
51762
|
const createAuthenticatedClient = (serverURL) => {
|
|
50795
51763
|
return env.createClient(serverURL, readAuthToken(getTelevisionStoragePath()));
|
|
50796
51764
|
};
|
|
51765
|
+
const uninstallPersistedService = async () => {
|
|
51766
|
+
const daemon = env.createDaemon();
|
|
51767
|
+
await daemon.uninstall();
|
|
51768
|
+
writeJSON(env.stdout, { status: "stopped" });
|
|
51769
|
+
};
|
|
50797
51770
|
program2.name("tv").description("Television \u2014 virtual display for agents").version(readCLIVersion()).showSuggestionAfterError(false).addHelpText("after", buildAgentHelpNote()).configureOutput({
|
|
50798
51771
|
writeOut: (str) => env.stdout.write(str),
|
|
50799
51772
|
writeErr: (str) => env.stderr.write(str),
|
|
50800
51773
|
outputError: () => {
|
|
50801
51774
|
}
|
|
50802
51775
|
}).exitOverride();
|
|
50803
|
-
program2.command("serve").description("Start the Television server").option("--host <address>", "Address to bind to").option("--port <number>", "Port to listen on", parsePortOption).option("--storage-path <path>", "Directory for persisted screen data").option("--public", "Serve without auth").option("--persist", "Install as a persistent system service").action(async (opts) => {
|
|
51776
|
+
program2.command("serve").description("Start the Television server").option("--host <address>", "Address to bind to").option("--port <number>", "Port to listen on", parsePortOption).option("--storage-path <path>", "Directory for persisted screen data").option("--public", "Serve without auth").option("--persist", "Install as a persistent system service").option("--persist-uninstall", "Uninstall the persistent system service").action(async (opts) => {
|
|
51777
|
+
if (opts.persist && opts.persistUninstall) {
|
|
51778
|
+
throw createDirectiveError("Use either `--persist` or `--persist-uninstall`, not both.");
|
|
51779
|
+
}
|
|
51780
|
+
if (opts.persistUninstall) {
|
|
51781
|
+
await uninstallPersistedService();
|
|
51782
|
+
return;
|
|
51783
|
+
}
|
|
50804
51784
|
if (opts.persist) {
|
|
50805
51785
|
const storagePath = opts.storagePath ?? getTelevisionStoragePath();
|
|
51786
|
+
const profile2 = resolveACPAgentProfile(process.env);
|
|
51787
|
+
const daemonEnv = buildPersistedACPEnvironment(process.env);
|
|
51788
|
+
if (profile2 && !isACPCommandResolvable(profile2.command, daemonEnv)) {
|
|
51789
|
+
throw createDirectiveError(
|
|
51790
|
+
`Could not find ACP agent command \`${profile2.command}\` for \`TELEVISION_ACP_AGENT=${profile2.agent}\` on the persisted PATH. Set TELEVISION_ACP_AGENT to \`openclaw\` or \`hermes\`, and ensure the selected agent binary is available on PATH before running \`tv serve --persist\`.`
|
|
51791
|
+
);
|
|
51792
|
+
}
|
|
50806
51793
|
const daemon = env.createDaemon({
|
|
50807
51794
|
host: opts.host,
|
|
50808
51795
|
port: opts.port,
|
|
50809
51796
|
storagePath,
|
|
50810
|
-
public: opts.public
|
|
51797
|
+
public: opts.public,
|
|
51798
|
+
env: daemonEnv
|
|
50811
51799
|
});
|
|
51800
|
+
const daemonStatus = await daemon.status();
|
|
51801
|
+
if (daemonStatus.installed || daemonStatus.running) {
|
|
51802
|
+
await daemon.uninstall();
|
|
51803
|
+
}
|
|
50812
51804
|
await daemon.install();
|
|
50813
51805
|
writeJSON(
|
|
50814
51806
|
env.stdout,
|
|
@@ -50820,6 +51812,12 @@ function createProgram(env, argv = []) {
|
|
|
50820
51812
|
);
|
|
50821
51813
|
return;
|
|
50822
51814
|
}
|
|
51815
|
+
const profile = resolveACPAgentProfile(process.env);
|
|
51816
|
+
if (profile && !isACPCommandResolvable(profile.command, process.env)) {
|
|
51817
|
+
throw createDirectiveError(
|
|
51818
|
+
`Could not find ACP agent command \`${profile.command}\` for \`TELEVISION_ACP_AGENT=${profile.agent}\` on PATH. Set TELEVISION_ACP_AGENT to \`openclaw\` or \`hermes\`, and ensure the selected agent binary is available on PATH before running \`tv serve\`.`
|
|
51819
|
+
);
|
|
51820
|
+
}
|
|
50823
51821
|
const server = env.createServer({
|
|
50824
51822
|
host: opts.host,
|
|
50825
51823
|
port: opts.port,
|
|
@@ -50827,7 +51825,8 @@ function createProgram(env, argv = []) {
|
|
|
50827
51825
|
staticDir: env.resolveStaticDir(),
|
|
50828
51826
|
canonicalDir: env.resolveCanonicalDir(),
|
|
50829
51827
|
bundledViewsPath: env.resolveBundledViewsPath(),
|
|
50830
|
-
public: opts.public
|
|
51828
|
+
public: opts.public,
|
|
51829
|
+
...profile ? { acpProfile: profile } : {}
|
|
50831
51830
|
});
|
|
50832
51831
|
await server.start();
|
|
50833
51832
|
writeJSON(env.stdout, opts.public ? { serverURL: server.getBaseURL() } : { serverURL: server.getBaseURL(), token: server.getAuthToken() });
|
|
@@ -51104,9 +52103,7 @@ If you wish to display temporary content to the user, use a web bundle artifact
|
|
|
51104
52103
|
}
|
|
51105
52104
|
});
|
|
51106
52105
|
program2.command("stop").description("Stop the Television system service").action(async () => {
|
|
51107
|
-
|
|
51108
|
-
await daemon.uninstall();
|
|
51109
|
-
writeJSON(env.stdout, { status: "stopped" });
|
|
52106
|
+
await uninstallPersistedService();
|
|
51110
52107
|
});
|
|
51111
52108
|
program2.command("status").description("Check Television server and service status").option("--server <url>", "Server URL", DEFAULT_SERVER_URL).action(async (opts) => {
|
|
51112
52109
|
const result = {
|