@ada-mcp/mcp-server 0.1.11 → 0.1.13
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 +1618 -1374
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -6,6 +6,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
9
16
|
var __copyProps = (to, from, except, desc) => {
|
|
10
17
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
18
|
for (let key of __getOwnPropNames(from))
|
|
@@ -23,14 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
30
|
mod
|
|
24
31
|
));
|
|
25
32
|
|
|
26
|
-
// src/bootstrap-deps.ts
|
|
27
|
-
var import_node_fs3 = __toESM(require("node:fs"));
|
|
28
|
-
var import_node_path10 = __toESM(require("node:path"));
|
|
29
|
-
|
|
30
|
-
// ../ada-agent/dist/config.js
|
|
31
|
-
var import_promises2 = __toESM(require("node:fs/promises"), 1);
|
|
32
|
-
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
33
|
-
|
|
34
33
|
// ../../node_modules/js-yaml/dist/js-yaml.mjs
|
|
35
34
|
function isNothing(subject) {
|
|
36
35
|
return typeof subject === "undefined" || subject === null;
|
|
@@ -64,20 +63,6 @@ function repeat(string, count) {
|
|
|
64
63
|
function isNegativeZero(number) {
|
|
65
64
|
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
66
65
|
}
|
|
67
|
-
var isNothing_1 = isNothing;
|
|
68
|
-
var isObject_1 = isObject;
|
|
69
|
-
var toArray_1 = toArray;
|
|
70
|
-
var repeat_1 = repeat;
|
|
71
|
-
var isNegativeZero_1 = isNegativeZero;
|
|
72
|
-
var extend_1 = extend;
|
|
73
|
-
var common = {
|
|
74
|
-
isNothing: isNothing_1,
|
|
75
|
-
isObject: isObject_1,
|
|
76
|
-
toArray: toArray_1,
|
|
77
|
-
repeat: repeat_1,
|
|
78
|
-
isNegativeZero: isNegativeZero_1,
|
|
79
|
-
extend: extend_1
|
|
80
|
-
};
|
|
81
66
|
function formatError(exception2, compact) {
|
|
82
67
|
var where = "", message = exception2.reason || "(unknown reason)";
|
|
83
68
|
if (!exception2.mark) return message;
|
|
@@ -102,12 +87,6 @@ function YAMLException$1(reason, mark) {
|
|
|
102
87
|
this.stack = new Error().stack || "";
|
|
103
88
|
}
|
|
104
89
|
}
|
|
105
|
-
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
106
|
-
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
107
|
-
YAMLException$1.prototype.toString = function toString(compact) {
|
|
108
|
-
return this.name + ": " + formatError(this, compact);
|
|
109
|
-
};
|
|
110
|
-
var exception = YAMLException$1;
|
|
111
90
|
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
112
91
|
var head = "";
|
|
113
92
|
var tail = "";
|
|
@@ -179,24 +158,6 @@ function makeSnippet(mark, options) {
|
|
|
179
158
|
}
|
|
180
159
|
return result.replace(/\n$/, "");
|
|
181
160
|
}
|
|
182
|
-
var snippet = makeSnippet;
|
|
183
|
-
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
184
|
-
"kind",
|
|
185
|
-
"multi",
|
|
186
|
-
"resolve",
|
|
187
|
-
"construct",
|
|
188
|
-
"instanceOf",
|
|
189
|
-
"predicate",
|
|
190
|
-
"represent",
|
|
191
|
-
"representName",
|
|
192
|
-
"defaultStyle",
|
|
193
|
-
"styleAliases"
|
|
194
|
-
];
|
|
195
|
-
var YAML_NODE_KINDS = [
|
|
196
|
-
"scalar",
|
|
197
|
-
"sequence",
|
|
198
|
-
"mapping"
|
|
199
|
-
];
|
|
200
161
|
function compileStyleAliases(map2) {
|
|
201
162
|
var result = {};
|
|
202
163
|
if (map2 !== null) {
|
|
@@ -235,7 +196,6 @@ function Type$1(tag, options) {
|
|
|
235
196
|
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
236
197
|
}
|
|
237
198
|
}
|
|
238
|
-
var type = Type$1;
|
|
239
199
|
function compileList(schema2, name) {
|
|
240
200
|
var result = [];
|
|
241
201
|
schema2[name].forEach(function(currentType) {
|
|
@@ -278,69 +238,6 @@ function compileMap() {
|
|
|
278
238
|
function Schema$1(definition) {
|
|
279
239
|
return this.extend(definition);
|
|
280
240
|
}
|
|
281
|
-
Schema$1.prototype.extend = function extend2(definition) {
|
|
282
|
-
var implicit = [];
|
|
283
|
-
var explicit = [];
|
|
284
|
-
if (definition instanceof type) {
|
|
285
|
-
explicit.push(definition);
|
|
286
|
-
} else if (Array.isArray(definition)) {
|
|
287
|
-
explicit = explicit.concat(definition);
|
|
288
|
-
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
289
|
-
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
290
|
-
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
291
|
-
} else {
|
|
292
|
-
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
293
|
-
}
|
|
294
|
-
implicit.forEach(function(type$1) {
|
|
295
|
-
if (!(type$1 instanceof type)) {
|
|
296
|
-
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
297
|
-
}
|
|
298
|
-
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
|
299
|
-
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
300
|
-
}
|
|
301
|
-
if (type$1.multi) {
|
|
302
|
-
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
explicit.forEach(function(type$1) {
|
|
306
|
-
if (!(type$1 instanceof type)) {
|
|
307
|
-
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
var result = Object.create(Schema$1.prototype);
|
|
311
|
-
result.implicit = (this.implicit || []).concat(implicit);
|
|
312
|
-
result.explicit = (this.explicit || []).concat(explicit);
|
|
313
|
-
result.compiledImplicit = compileList(result, "implicit");
|
|
314
|
-
result.compiledExplicit = compileList(result, "explicit");
|
|
315
|
-
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
316
|
-
return result;
|
|
317
|
-
};
|
|
318
|
-
var schema = Schema$1;
|
|
319
|
-
var str = new type("tag:yaml.org,2002:str", {
|
|
320
|
-
kind: "scalar",
|
|
321
|
-
construct: function(data) {
|
|
322
|
-
return data !== null ? data : "";
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
var seq = new type("tag:yaml.org,2002:seq", {
|
|
326
|
-
kind: "sequence",
|
|
327
|
-
construct: function(data) {
|
|
328
|
-
return data !== null ? data : [];
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
var map = new type("tag:yaml.org,2002:map", {
|
|
332
|
-
kind: "mapping",
|
|
333
|
-
construct: function(data) {
|
|
334
|
-
return data !== null ? data : {};
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
var failsafe = new schema({
|
|
338
|
-
explicit: [
|
|
339
|
-
str,
|
|
340
|
-
seq,
|
|
341
|
-
map
|
|
342
|
-
]
|
|
343
|
-
});
|
|
344
241
|
function resolveYamlNull(data) {
|
|
345
242
|
if (data === null) return true;
|
|
346
243
|
var max = data.length;
|
|
@@ -352,30 +249,6 @@ function constructYamlNull() {
|
|
|
352
249
|
function isNull(object) {
|
|
353
250
|
return object === null;
|
|
354
251
|
}
|
|
355
|
-
var _null = new type("tag:yaml.org,2002:null", {
|
|
356
|
-
kind: "scalar",
|
|
357
|
-
resolve: resolveYamlNull,
|
|
358
|
-
construct: constructYamlNull,
|
|
359
|
-
predicate: isNull,
|
|
360
|
-
represent: {
|
|
361
|
-
canonical: function() {
|
|
362
|
-
return "~";
|
|
363
|
-
},
|
|
364
|
-
lowercase: function() {
|
|
365
|
-
return "null";
|
|
366
|
-
},
|
|
367
|
-
uppercase: function() {
|
|
368
|
-
return "NULL";
|
|
369
|
-
},
|
|
370
|
-
camelcase: function() {
|
|
371
|
-
return "Null";
|
|
372
|
-
},
|
|
373
|
-
empty: function() {
|
|
374
|
-
return "";
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
defaultStyle: "lowercase"
|
|
378
|
-
});
|
|
379
252
|
function resolveYamlBoolean(data) {
|
|
380
253
|
if (data === null) return false;
|
|
381
254
|
var max = data.length;
|
|
@@ -387,24 +260,6 @@ function constructYamlBoolean(data) {
|
|
|
387
260
|
function isBoolean(object) {
|
|
388
261
|
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
389
262
|
}
|
|
390
|
-
var bool = new type("tag:yaml.org,2002:bool", {
|
|
391
|
-
kind: "scalar",
|
|
392
|
-
resolve: resolveYamlBoolean,
|
|
393
|
-
construct: constructYamlBoolean,
|
|
394
|
-
predicate: isBoolean,
|
|
395
|
-
represent: {
|
|
396
|
-
lowercase: function(object) {
|
|
397
|
-
return object ? "true" : "false";
|
|
398
|
-
},
|
|
399
|
-
uppercase: function(object) {
|
|
400
|
-
return object ? "TRUE" : "FALSE";
|
|
401
|
-
},
|
|
402
|
-
camelcase: function(object) {
|
|
403
|
-
return object ? "True" : "False";
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
defaultStyle: "lowercase"
|
|
407
|
-
});
|
|
408
263
|
function isHexCode(c) {
|
|
409
264
|
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
410
265
|
}
|
|
@@ -490,38 +345,6 @@ function constructYamlInteger(data) {
|
|
|
490
345
|
function isInteger(object) {
|
|
491
346
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
492
347
|
}
|
|
493
|
-
var int = new type("tag:yaml.org,2002:int", {
|
|
494
|
-
kind: "scalar",
|
|
495
|
-
resolve: resolveYamlInteger,
|
|
496
|
-
construct: constructYamlInteger,
|
|
497
|
-
predicate: isInteger,
|
|
498
|
-
represent: {
|
|
499
|
-
binary: function(obj) {
|
|
500
|
-
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
501
|
-
},
|
|
502
|
-
octal: function(obj) {
|
|
503
|
-
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
504
|
-
},
|
|
505
|
-
decimal: function(obj) {
|
|
506
|
-
return obj.toString(10);
|
|
507
|
-
},
|
|
508
|
-
/* eslint-disable max-len */
|
|
509
|
-
hexadecimal: function(obj) {
|
|
510
|
-
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
defaultStyle: "decimal",
|
|
514
|
-
styleAliases: {
|
|
515
|
-
binary: [2, "bin"],
|
|
516
|
-
octal: [8, "oct"],
|
|
517
|
-
decimal: [10, "dec"],
|
|
518
|
-
hexadecimal: [16, "hex"]
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
var YAML_FLOAT_PATTERN = new RegExp(
|
|
522
|
-
// 2.5e4, 2.5 and integers
|
|
523
|
-
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
524
|
-
);
|
|
525
348
|
function resolveYamlFloat(data) {
|
|
526
349
|
if (data === null) return false;
|
|
527
350
|
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
@@ -545,7 +368,6 @@ function constructYamlFloat(data) {
|
|
|
545
368
|
}
|
|
546
369
|
return sign * parseFloat(value, 10);
|
|
547
370
|
}
|
|
548
|
-
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
549
371
|
function representYamlFloat(object, style) {
|
|
550
372
|
var res;
|
|
551
373
|
if (isNaN(object)) {
|
|
@@ -584,29 +406,6 @@ function representYamlFloat(object, style) {
|
|
|
584
406
|
function isFloat(object) {
|
|
585
407
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
586
408
|
}
|
|
587
|
-
var float = new type("tag:yaml.org,2002:float", {
|
|
588
|
-
kind: "scalar",
|
|
589
|
-
resolve: resolveYamlFloat,
|
|
590
|
-
construct: constructYamlFloat,
|
|
591
|
-
predicate: isFloat,
|
|
592
|
-
represent: representYamlFloat,
|
|
593
|
-
defaultStyle: "lowercase"
|
|
594
|
-
});
|
|
595
|
-
var json = failsafe.extend({
|
|
596
|
-
implicit: [
|
|
597
|
-
_null,
|
|
598
|
-
bool,
|
|
599
|
-
int,
|
|
600
|
-
float
|
|
601
|
-
]
|
|
602
|
-
});
|
|
603
|
-
var core = json;
|
|
604
|
-
var YAML_DATE_REGEXP = new RegExp(
|
|
605
|
-
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
606
|
-
);
|
|
607
|
-
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
608
|
-
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
609
|
-
);
|
|
610
409
|
function resolveYamlTimestamp(data) {
|
|
611
410
|
if (data === null) return false;
|
|
612
411
|
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
@@ -647,21 +446,9 @@ function constructYamlTimestamp(data) {
|
|
|
647
446
|
function representYamlTimestamp(object) {
|
|
648
447
|
return object.toISOString();
|
|
649
448
|
}
|
|
650
|
-
var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
651
|
-
kind: "scalar",
|
|
652
|
-
resolve: resolveYamlTimestamp,
|
|
653
|
-
construct: constructYamlTimestamp,
|
|
654
|
-
instanceOf: Date,
|
|
655
|
-
represent: representYamlTimestamp
|
|
656
|
-
});
|
|
657
449
|
function resolveYamlMerge(data) {
|
|
658
450
|
return data === "<<" || data === null;
|
|
659
451
|
}
|
|
660
|
-
var merge = new type("tag:yaml.org,2002:merge", {
|
|
661
|
-
kind: "scalar",
|
|
662
|
-
resolve: resolveYamlMerge
|
|
663
|
-
});
|
|
664
|
-
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
665
452
|
function resolveYamlBinary(data) {
|
|
666
453
|
if (data === null) return false;
|
|
667
454
|
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
@@ -729,15 +516,6 @@ function representYamlBinary(object) {
|
|
|
729
516
|
function isBinary(obj) {
|
|
730
517
|
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
731
518
|
}
|
|
732
|
-
var binary = new type("tag:yaml.org,2002:binary", {
|
|
733
|
-
kind: "scalar",
|
|
734
|
-
resolve: resolveYamlBinary,
|
|
735
|
-
construct: constructYamlBinary,
|
|
736
|
-
predicate: isBinary,
|
|
737
|
-
represent: representYamlBinary
|
|
738
|
-
});
|
|
739
|
-
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
740
|
-
var _toString$2 = Object.prototype.toString;
|
|
741
519
|
function resolveYamlOmap(data) {
|
|
742
520
|
if (data === null) return true;
|
|
743
521
|
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
@@ -760,12 +538,6 @@ function resolveYamlOmap(data) {
|
|
|
760
538
|
function constructYamlOmap(data) {
|
|
761
539
|
return data !== null ? data : [];
|
|
762
540
|
}
|
|
763
|
-
var omap = new type("tag:yaml.org,2002:omap", {
|
|
764
|
-
kind: "sequence",
|
|
765
|
-
resolve: resolveYamlOmap,
|
|
766
|
-
construct: constructYamlOmap
|
|
767
|
-
});
|
|
768
|
-
var _toString$1 = Object.prototype.toString;
|
|
769
541
|
function resolveYamlPairs(data) {
|
|
770
542
|
if (data === null) return true;
|
|
771
543
|
var index, length, pair, keys, result, object = data;
|
|
@@ -790,12 +562,6 @@ function constructYamlPairs(data) {
|
|
|
790
562
|
}
|
|
791
563
|
return result;
|
|
792
564
|
}
|
|
793
|
-
var pairs = new type("tag:yaml.org,2002:pairs", {
|
|
794
|
-
kind: "sequence",
|
|
795
|
-
resolve: resolveYamlPairs,
|
|
796
|
-
construct: constructYamlPairs
|
|
797
|
-
});
|
|
798
|
-
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
799
565
|
function resolveYamlSet(data) {
|
|
800
566
|
if (data === null) return true;
|
|
801
567
|
var key, object = data;
|
|
@@ -809,36 +575,6 @@ function resolveYamlSet(data) {
|
|
|
809
575
|
function constructYamlSet(data) {
|
|
810
576
|
return data !== null ? data : {};
|
|
811
577
|
}
|
|
812
|
-
var set = new type("tag:yaml.org,2002:set", {
|
|
813
|
-
kind: "mapping",
|
|
814
|
-
resolve: resolveYamlSet,
|
|
815
|
-
construct: constructYamlSet
|
|
816
|
-
});
|
|
817
|
-
var _default = core.extend({
|
|
818
|
-
implicit: [
|
|
819
|
-
timestamp,
|
|
820
|
-
merge
|
|
821
|
-
],
|
|
822
|
-
explicit: [
|
|
823
|
-
binary,
|
|
824
|
-
omap,
|
|
825
|
-
pairs,
|
|
826
|
-
set
|
|
827
|
-
]
|
|
828
|
-
});
|
|
829
|
-
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
830
|
-
var CONTEXT_FLOW_IN = 1;
|
|
831
|
-
var CONTEXT_FLOW_OUT = 2;
|
|
832
|
-
var CONTEXT_BLOCK_IN = 3;
|
|
833
|
-
var CONTEXT_BLOCK_OUT = 4;
|
|
834
|
-
var CHOMPING_CLIP = 1;
|
|
835
|
-
var CHOMPING_STRIP = 2;
|
|
836
|
-
var CHOMPING_KEEP = 3;
|
|
837
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
838
|
-
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
839
|
-
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
840
|
-
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
841
|
-
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
842
578
|
function _class(obj) {
|
|
843
579
|
return Object.prototype.toString.call(obj);
|
|
844
580
|
}
|
|
@@ -907,13 +643,6 @@ function setProperty(object, key, value) {
|
|
|
907
643
|
object[key] = value;
|
|
908
644
|
}
|
|
909
645
|
}
|
|
910
|
-
var simpleEscapeCheck = new Array(256);
|
|
911
|
-
var simpleEscapeMap = new Array(256);
|
|
912
|
-
for (i = 0; i < 256; i++) {
|
|
913
|
-
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
914
|
-
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
915
|
-
}
|
|
916
|
-
var i;
|
|
917
646
|
function State$1(input2, options) {
|
|
918
647
|
this.input = input2;
|
|
919
648
|
this.filename = options["filename"] || null;
|
|
@@ -952,54 +681,6 @@ function throwWarning(state, message) {
|
|
|
952
681
|
state.onWarning.call(null, generateError(state, message));
|
|
953
682
|
}
|
|
954
683
|
}
|
|
955
|
-
var directiveHandlers = {
|
|
956
|
-
YAML: function handleYamlDirective(state, name, args) {
|
|
957
|
-
var match, major, minor;
|
|
958
|
-
if (state.version !== null) {
|
|
959
|
-
throwError(state, "duplication of %YAML directive");
|
|
960
|
-
}
|
|
961
|
-
if (args.length !== 1) {
|
|
962
|
-
throwError(state, "YAML directive accepts exactly one argument");
|
|
963
|
-
}
|
|
964
|
-
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
965
|
-
if (match === null) {
|
|
966
|
-
throwError(state, "ill-formed argument of the YAML directive");
|
|
967
|
-
}
|
|
968
|
-
major = parseInt(match[1], 10);
|
|
969
|
-
minor = parseInt(match[2], 10);
|
|
970
|
-
if (major !== 1) {
|
|
971
|
-
throwError(state, "unacceptable YAML version of the document");
|
|
972
|
-
}
|
|
973
|
-
state.version = args[0];
|
|
974
|
-
state.checkLineBreaks = minor < 2;
|
|
975
|
-
if (minor !== 1 && minor !== 2) {
|
|
976
|
-
throwWarning(state, "unsupported YAML version of the document");
|
|
977
|
-
}
|
|
978
|
-
},
|
|
979
|
-
TAG: function handleTagDirective(state, name, args) {
|
|
980
|
-
var handle, prefix;
|
|
981
|
-
if (args.length !== 2) {
|
|
982
|
-
throwError(state, "TAG directive accepts exactly two arguments");
|
|
983
|
-
}
|
|
984
|
-
handle = args[0];
|
|
985
|
-
prefix = args[1];
|
|
986
|
-
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
987
|
-
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
988
|
-
}
|
|
989
|
-
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
990
|
-
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
991
|
-
}
|
|
992
|
-
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
993
|
-
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
994
|
-
}
|
|
995
|
-
try {
|
|
996
|
-
prefix = decodeURIComponent(prefix);
|
|
997
|
-
} catch (err) {
|
|
998
|
-
throwError(state, "tag prefix is malformed: " + prefix);
|
|
999
|
-
}
|
|
1000
|
-
state.tagMap[handle] = prefix;
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
684
|
function captureSegment(state, start, end, checkJson) {
|
|
1004
685
|
var _position, _length, _character, _result;
|
|
1005
686
|
if (start < end) {
|
|
@@ -1977,74 +1658,6 @@ function load$1(input2, options) {
|
|
|
1977
1658
|
}
|
|
1978
1659
|
throw new exception("expected a single document in the stream, but found more");
|
|
1979
1660
|
}
|
|
1980
|
-
var loadAll_1 = loadAll$1;
|
|
1981
|
-
var load_1 = load$1;
|
|
1982
|
-
var loader = {
|
|
1983
|
-
loadAll: loadAll_1,
|
|
1984
|
-
load: load_1
|
|
1985
|
-
};
|
|
1986
|
-
var _toString = Object.prototype.toString;
|
|
1987
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1988
|
-
var CHAR_BOM = 65279;
|
|
1989
|
-
var CHAR_TAB = 9;
|
|
1990
|
-
var CHAR_LINE_FEED = 10;
|
|
1991
|
-
var CHAR_CARRIAGE_RETURN = 13;
|
|
1992
|
-
var CHAR_SPACE = 32;
|
|
1993
|
-
var CHAR_EXCLAMATION = 33;
|
|
1994
|
-
var CHAR_DOUBLE_QUOTE = 34;
|
|
1995
|
-
var CHAR_SHARP = 35;
|
|
1996
|
-
var CHAR_PERCENT = 37;
|
|
1997
|
-
var CHAR_AMPERSAND = 38;
|
|
1998
|
-
var CHAR_SINGLE_QUOTE = 39;
|
|
1999
|
-
var CHAR_ASTERISK = 42;
|
|
2000
|
-
var CHAR_COMMA = 44;
|
|
2001
|
-
var CHAR_MINUS = 45;
|
|
2002
|
-
var CHAR_COLON = 58;
|
|
2003
|
-
var CHAR_EQUALS = 61;
|
|
2004
|
-
var CHAR_GREATER_THAN = 62;
|
|
2005
|
-
var CHAR_QUESTION = 63;
|
|
2006
|
-
var CHAR_COMMERCIAL_AT = 64;
|
|
2007
|
-
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2008
|
-
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2009
|
-
var CHAR_GRAVE_ACCENT = 96;
|
|
2010
|
-
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2011
|
-
var CHAR_VERTICAL_LINE = 124;
|
|
2012
|
-
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2013
|
-
var ESCAPE_SEQUENCES = {};
|
|
2014
|
-
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2015
|
-
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2016
|
-
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2017
|
-
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2018
|
-
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2019
|
-
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2020
|
-
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2021
|
-
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2022
|
-
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2023
|
-
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2024
|
-
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2025
|
-
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2026
|
-
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2027
|
-
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2028
|
-
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2029
|
-
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2030
|
-
"y",
|
|
2031
|
-
"Y",
|
|
2032
|
-
"yes",
|
|
2033
|
-
"Yes",
|
|
2034
|
-
"YES",
|
|
2035
|
-
"on",
|
|
2036
|
-
"On",
|
|
2037
|
-
"ON",
|
|
2038
|
-
"n",
|
|
2039
|
-
"N",
|
|
2040
|
-
"no",
|
|
2041
|
-
"No",
|
|
2042
|
-
"NO",
|
|
2043
|
-
"off",
|
|
2044
|
-
"Off",
|
|
2045
|
-
"OFF"
|
|
2046
|
-
];
|
|
2047
|
-
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
2048
1661
|
function compileStyleMap(schema2, map2) {
|
|
2049
1662
|
var result, keys, index, length, tag, style, type2;
|
|
2050
1663
|
if (map2 === null) return {};
|
|
@@ -2081,8 +1694,6 @@ function encodeHex(character) {
|
|
|
2081
1694
|
}
|
|
2082
1695
|
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2083
1696
|
}
|
|
2084
|
-
var QUOTING_TYPE_SINGLE = 1;
|
|
2085
|
-
var QUOTING_TYPE_DOUBLE = 2;
|
|
2086
1697
|
function State(options) {
|
|
2087
1698
|
this.schema = options["schema"] || _default;
|
|
2088
1699
|
this.indent = Math.max(1, options["indent"] || 2);
|
|
@@ -2174,11 +1785,6 @@ function needIndentIndicator(string) {
|
|
|
2174
1785
|
var leadingSpaceRe = /^\n* /;
|
|
2175
1786
|
return leadingSpaceRe.test(string);
|
|
2176
1787
|
}
|
|
2177
|
-
var STYLE_PLAIN = 1;
|
|
2178
|
-
var STYLE_SINGLE = 2;
|
|
2179
|
-
var STYLE_LITERAL = 3;
|
|
2180
|
-
var STYLE_FOLDED = 4;
|
|
2181
|
-
var STYLE_DOUBLE = 5;
|
|
2182
1788
|
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
2183
1789
|
var i;
|
|
2184
1790
|
var char = 0;
|
|
@@ -2601,63 +2207,458 @@ function dump$1(input2, options) {
|
|
|
2601
2207
|
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
|
2602
2208
|
return "";
|
|
2603
2209
|
}
|
|
2604
|
-
var dump_1 = dump$1;
|
|
2605
|
-
var dumper = {
|
|
2606
|
-
dump: dump_1
|
|
2607
|
-
};
|
|
2608
2210
|
function renamed(from, to) {
|
|
2609
2211
|
return function() {
|
|
2610
2212
|
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
2611
2213
|
};
|
|
2612
2214
|
}
|
|
2613
|
-
var Type
|
|
2614
|
-
var
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2215
|
+
var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str, seq, map, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN, CONTEXT_FLOW_OUT, CONTEXT_BLOCK_IN, CONTEXT_BLOCK_OUT, CHOMPING_CLIP, CHOMPING_STRIP, CHOMPING_KEEP, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM, CHAR_TAB, CHAR_LINE_FEED, CHAR_CARRIAGE_RETURN, CHAR_SPACE, CHAR_EXCLAMATION, CHAR_DOUBLE_QUOTE, CHAR_SHARP, CHAR_PERCENT, CHAR_AMPERSAND, CHAR_SINGLE_QUOTE, CHAR_ASTERISK, CHAR_COMMA, CHAR_MINUS, CHAR_COLON, CHAR_EQUALS, CHAR_GREATER_THAN, CHAR_QUESTION, CHAR_COMMERCIAL_AT, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_GRAVE_ACCENT, CHAR_LEFT_CURLY_BRACKET, CHAR_VERTICAL_LINE, CHAR_RIGHT_CURLY_BRACKET, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE, QUOTING_TYPE_DOUBLE, STYLE_PLAIN, STYLE_SINGLE, STYLE_LITERAL, STYLE_FOLDED, STYLE_DOUBLE, dump_1, dumper, Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump, jsYaml;
|
|
2216
|
+
var init_js_yaml = __esm({
|
|
2217
|
+
"../../node_modules/js-yaml/dist/js-yaml.mjs"() {
|
|
2218
|
+
isNothing_1 = isNothing;
|
|
2219
|
+
isObject_1 = isObject;
|
|
2220
|
+
toArray_1 = toArray;
|
|
2221
|
+
repeat_1 = repeat;
|
|
2222
|
+
isNegativeZero_1 = isNegativeZero;
|
|
2223
|
+
extend_1 = extend;
|
|
2224
|
+
common = {
|
|
2225
|
+
isNothing: isNothing_1,
|
|
2226
|
+
isObject: isObject_1,
|
|
2227
|
+
toArray: toArray_1,
|
|
2228
|
+
repeat: repeat_1,
|
|
2229
|
+
isNegativeZero: isNegativeZero_1,
|
|
2230
|
+
extend: extend_1
|
|
2231
|
+
};
|
|
2232
|
+
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
2233
|
+
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
2234
|
+
YAMLException$1.prototype.toString = function toString(compact) {
|
|
2235
|
+
return this.name + ": " + formatError(this, compact);
|
|
2236
|
+
};
|
|
2237
|
+
exception = YAMLException$1;
|
|
2238
|
+
snippet = makeSnippet;
|
|
2239
|
+
TYPE_CONSTRUCTOR_OPTIONS = [
|
|
2240
|
+
"kind",
|
|
2241
|
+
"multi",
|
|
2242
|
+
"resolve",
|
|
2243
|
+
"construct",
|
|
2244
|
+
"instanceOf",
|
|
2245
|
+
"predicate",
|
|
2246
|
+
"represent",
|
|
2247
|
+
"representName",
|
|
2248
|
+
"defaultStyle",
|
|
2249
|
+
"styleAliases"
|
|
2250
|
+
];
|
|
2251
|
+
YAML_NODE_KINDS = [
|
|
2252
|
+
"scalar",
|
|
2253
|
+
"sequence",
|
|
2254
|
+
"mapping"
|
|
2255
|
+
];
|
|
2256
|
+
type = Type$1;
|
|
2257
|
+
Schema$1.prototype.extend = function extend2(definition) {
|
|
2258
|
+
var implicit = [];
|
|
2259
|
+
var explicit = [];
|
|
2260
|
+
if (definition instanceof type) {
|
|
2261
|
+
explicit.push(definition);
|
|
2262
|
+
} else if (Array.isArray(definition)) {
|
|
2263
|
+
explicit = explicit.concat(definition);
|
|
2264
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
2265
|
+
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
2266
|
+
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
2267
|
+
} else {
|
|
2268
|
+
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
2269
|
+
}
|
|
2270
|
+
implicit.forEach(function(type$1) {
|
|
2271
|
+
if (!(type$1 instanceof type)) {
|
|
2272
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
2273
|
+
}
|
|
2274
|
+
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
|
2275
|
+
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
2276
|
+
}
|
|
2277
|
+
if (type$1.multi) {
|
|
2278
|
+
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2281
|
+
explicit.forEach(function(type$1) {
|
|
2282
|
+
if (!(type$1 instanceof type)) {
|
|
2283
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
2284
|
+
}
|
|
2285
|
+
});
|
|
2286
|
+
var result = Object.create(Schema$1.prototype);
|
|
2287
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
2288
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
2289
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
2290
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
2291
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
2292
|
+
return result;
|
|
2293
|
+
};
|
|
2294
|
+
schema = Schema$1;
|
|
2295
|
+
str = new type("tag:yaml.org,2002:str", {
|
|
2296
|
+
kind: "scalar",
|
|
2297
|
+
construct: function(data) {
|
|
2298
|
+
return data !== null ? data : "";
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
seq = new type("tag:yaml.org,2002:seq", {
|
|
2302
|
+
kind: "sequence",
|
|
2303
|
+
construct: function(data) {
|
|
2304
|
+
return data !== null ? data : [];
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
map = new type("tag:yaml.org,2002:map", {
|
|
2308
|
+
kind: "mapping",
|
|
2309
|
+
construct: function(data) {
|
|
2310
|
+
return data !== null ? data : {};
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
failsafe = new schema({
|
|
2314
|
+
explicit: [
|
|
2315
|
+
str,
|
|
2316
|
+
seq,
|
|
2317
|
+
map
|
|
2318
|
+
]
|
|
2319
|
+
});
|
|
2320
|
+
_null = new type("tag:yaml.org,2002:null", {
|
|
2321
|
+
kind: "scalar",
|
|
2322
|
+
resolve: resolveYamlNull,
|
|
2323
|
+
construct: constructYamlNull,
|
|
2324
|
+
predicate: isNull,
|
|
2325
|
+
represent: {
|
|
2326
|
+
canonical: function() {
|
|
2327
|
+
return "~";
|
|
2328
|
+
},
|
|
2329
|
+
lowercase: function() {
|
|
2330
|
+
return "null";
|
|
2331
|
+
},
|
|
2332
|
+
uppercase: function() {
|
|
2333
|
+
return "NULL";
|
|
2334
|
+
},
|
|
2335
|
+
camelcase: function() {
|
|
2336
|
+
return "Null";
|
|
2337
|
+
},
|
|
2338
|
+
empty: function() {
|
|
2339
|
+
return "";
|
|
2340
|
+
}
|
|
2341
|
+
},
|
|
2342
|
+
defaultStyle: "lowercase"
|
|
2343
|
+
});
|
|
2344
|
+
bool = new type("tag:yaml.org,2002:bool", {
|
|
2345
|
+
kind: "scalar",
|
|
2346
|
+
resolve: resolveYamlBoolean,
|
|
2347
|
+
construct: constructYamlBoolean,
|
|
2348
|
+
predicate: isBoolean,
|
|
2349
|
+
represent: {
|
|
2350
|
+
lowercase: function(object) {
|
|
2351
|
+
return object ? "true" : "false";
|
|
2352
|
+
},
|
|
2353
|
+
uppercase: function(object) {
|
|
2354
|
+
return object ? "TRUE" : "FALSE";
|
|
2355
|
+
},
|
|
2356
|
+
camelcase: function(object) {
|
|
2357
|
+
return object ? "True" : "False";
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2360
|
+
defaultStyle: "lowercase"
|
|
2361
|
+
});
|
|
2362
|
+
int = new type("tag:yaml.org,2002:int", {
|
|
2363
|
+
kind: "scalar",
|
|
2364
|
+
resolve: resolveYamlInteger,
|
|
2365
|
+
construct: constructYamlInteger,
|
|
2366
|
+
predicate: isInteger,
|
|
2367
|
+
represent: {
|
|
2368
|
+
binary: function(obj) {
|
|
2369
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
2370
|
+
},
|
|
2371
|
+
octal: function(obj) {
|
|
2372
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
2373
|
+
},
|
|
2374
|
+
decimal: function(obj) {
|
|
2375
|
+
return obj.toString(10);
|
|
2376
|
+
},
|
|
2377
|
+
/* eslint-disable max-len */
|
|
2378
|
+
hexadecimal: function(obj) {
|
|
2379
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
2380
|
+
}
|
|
2381
|
+
},
|
|
2382
|
+
defaultStyle: "decimal",
|
|
2383
|
+
styleAliases: {
|
|
2384
|
+
binary: [2, "bin"],
|
|
2385
|
+
octal: [8, "oct"],
|
|
2386
|
+
decimal: [10, "dec"],
|
|
2387
|
+
hexadecimal: [16, "hex"]
|
|
2388
|
+
}
|
|
2389
|
+
});
|
|
2390
|
+
YAML_FLOAT_PATTERN = new RegExp(
|
|
2391
|
+
// 2.5e4, 2.5 and integers
|
|
2392
|
+
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
2393
|
+
);
|
|
2394
|
+
SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
2395
|
+
float = new type("tag:yaml.org,2002:float", {
|
|
2396
|
+
kind: "scalar",
|
|
2397
|
+
resolve: resolveYamlFloat,
|
|
2398
|
+
construct: constructYamlFloat,
|
|
2399
|
+
predicate: isFloat,
|
|
2400
|
+
represent: representYamlFloat,
|
|
2401
|
+
defaultStyle: "lowercase"
|
|
2402
|
+
});
|
|
2403
|
+
json = failsafe.extend({
|
|
2404
|
+
implicit: [
|
|
2405
|
+
_null,
|
|
2406
|
+
bool,
|
|
2407
|
+
int,
|
|
2408
|
+
float
|
|
2409
|
+
]
|
|
2410
|
+
});
|
|
2411
|
+
core = json;
|
|
2412
|
+
YAML_DATE_REGEXP = new RegExp(
|
|
2413
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
2414
|
+
);
|
|
2415
|
+
YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
2416
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
2417
|
+
);
|
|
2418
|
+
timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
2419
|
+
kind: "scalar",
|
|
2420
|
+
resolve: resolveYamlTimestamp,
|
|
2421
|
+
construct: constructYamlTimestamp,
|
|
2422
|
+
instanceOf: Date,
|
|
2423
|
+
represent: representYamlTimestamp
|
|
2424
|
+
});
|
|
2425
|
+
merge = new type("tag:yaml.org,2002:merge", {
|
|
2426
|
+
kind: "scalar",
|
|
2427
|
+
resolve: resolveYamlMerge
|
|
2428
|
+
});
|
|
2429
|
+
BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
2430
|
+
binary = new type("tag:yaml.org,2002:binary", {
|
|
2431
|
+
kind: "scalar",
|
|
2432
|
+
resolve: resolveYamlBinary,
|
|
2433
|
+
construct: constructYamlBinary,
|
|
2434
|
+
predicate: isBinary,
|
|
2435
|
+
represent: representYamlBinary
|
|
2436
|
+
});
|
|
2437
|
+
_hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
2438
|
+
_toString$2 = Object.prototype.toString;
|
|
2439
|
+
omap = new type("tag:yaml.org,2002:omap", {
|
|
2440
|
+
kind: "sequence",
|
|
2441
|
+
resolve: resolveYamlOmap,
|
|
2442
|
+
construct: constructYamlOmap
|
|
2443
|
+
});
|
|
2444
|
+
_toString$1 = Object.prototype.toString;
|
|
2445
|
+
pairs = new type("tag:yaml.org,2002:pairs", {
|
|
2446
|
+
kind: "sequence",
|
|
2447
|
+
resolve: resolveYamlPairs,
|
|
2448
|
+
construct: constructYamlPairs
|
|
2449
|
+
});
|
|
2450
|
+
_hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
2451
|
+
set = new type("tag:yaml.org,2002:set", {
|
|
2452
|
+
kind: "mapping",
|
|
2453
|
+
resolve: resolveYamlSet,
|
|
2454
|
+
construct: constructYamlSet
|
|
2455
|
+
});
|
|
2456
|
+
_default = core.extend({
|
|
2457
|
+
implicit: [
|
|
2458
|
+
timestamp,
|
|
2459
|
+
merge
|
|
2460
|
+
],
|
|
2461
|
+
explicit: [
|
|
2462
|
+
binary,
|
|
2463
|
+
omap,
|
|
2464
|
+
pairs,
|
|
2465
|
+
set
|
|
2466
|
+
]
|
|
2467
|
+
});
|
|
2468
|
+
_hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
2469
|
+
CONTEXT_FLOW_IN = 1;
|
|
2470
|
+
CONTEXT_FLOW_OUT = 2;
|
|
2471
|
+
CONTEXT_BLOCK_IN = 3;
|
|
2472
|
+
CONTEXT_BLOCK_OUT = 4;
|
|
2473
|
+
CHOMPING_CLIP = 1;
|
|
2474
|
+
CHOMPING_STRIP = 2;
|
|
2475
|
+
CHOMPING_KEEP = 3;
|
|
2476
|
+
PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
2477
|
+
PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
2478
|
+
PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
2479
|
+
PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
2480
|
+
PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
2481
|
+
simpleEscapeCheck = new Array(256);
|
|
2482
|
+
simpleEscapeMap = new Array(256);
|
|
2483
|
+
for (i = 0; i < 256; i++) {
|
|
2484
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
2485
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
2486
|
+
}
|
|
2487
|
+
directiveHandlers = {
|
|
2488
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
2489
|
+
var match, major, minor;
|
|
2490
|
+
if (state.version !== null) {
|
|
2491
|
+
throwError(state, "duplication of %YAML directive");
|
|
2492
|
+
}
|
|
2493
|
+
if (args.length !== 1) {
|
|
2494
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
2495
|
+
}
|
|
2496
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
2497
|
+
if (match === null) {
|
|
2498
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
2499
|
+
}
|
|
2500
|
+
major = parseInt(match[1], 10);
|
|
2501
|
+
minor = parseInt(match[2], 10);
|
|
2502
|
+
if (major !== 1) {
|
|
2503
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
2504
|
+
}
|
|
2505
|
+
state.version = args[0];
|
|
2506
|
+
state.checkLineBreaks = minor < 2;
|
|
2507
|
+
if (minor !== 1 && minor !== 2) {
|
|
2508
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
2509
|
+
}
|
|
2510
|
+
},
|
|
2511
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
2512
|
+
var handle, prefix;
|
|
2513
|
+
if (args.length !== 2) {
|
|
2514
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
2515
|
+
}
|
|
2516
|
+
handle = args[0];
|
|
2517
|
+
prefix = args[1];
|
|
2518
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
2519
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
2520
|
+
}
|
|
2521
|
+
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
2522
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
2523
|
+
}
|
|
2524
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
2525
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
2526
|
+
}
|
|
2527
|
+
try {
|
|
2528
|
+
prefix = decodeURIComponent(prefix);
|
|
2529
|
+
} catch (err) {
|
|
2530
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
2531
|
+
}
|
|
2532
|
+
state.tagMap[handle] = prefix;
|
|
2533
|
+
}
|
|
2534
|
+
};
|
|
2535
|
+
loadAll_1 = loadAll$1;
|
|
2536
|
+
load_1 = load$1;
|
|
2537
|
+
loader = {
|
|
2538
|
+
loadAll: loadAll_1,
|
|
2539
|
+
load: load_1
|
|
2540
|
+
};
|
|
2541
|
+
_toString = Object.prototype.toString;
|
|
2542
|
+
_hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2543
|
+
CHAR_BOM = 65279;
|
|
2544
|
+
CHAR_TAB = 9;
|
|
2545
|
+
CHAR_LINE_FEED = 10;
|
|
2546
|
+
CHAR_CARRIAGE_RETURN = 13;
|
|
2547
|
+
CHAR_SPACE = 32;
|
|
2548
|
+
CHAR_EXCLAMATION = 33;
|
|
2549
|
+
CHAR_DOUBLE_QUOTE = 34;
|
|
2550
|
+
CHAR_SHARP = 35;
|
|
2551
|
+
CHAR_PERCENT = 37;
|
|
2552
|
+
CHAR_AMPERSAND = 38;
|
|
2553
|
+
CHAR_SINGLE_QUOTE = 39;
|
|
2554
|
+
CHAR_ASTERISK = 42;
|
|
2555
|
+
CHAR_COMMA = 44;
|
|
2556
|
+
CHAR_MINUS = 45;
|
|
2557
|
+
CHAR_COLON = 58;
|
|
2558
|
+
CHAR_EQUALS = 61;
|
|
2559
|
+
CHAR_GREATER_THAN = 62;
|
|
2560
|
+
CHAR_QUESTION = 63;
|
|
2561
|
+
CHAR_COMMERCIAL_AT = 64;
|
|
2562
|
+
CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2563
|
+
CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2564
|
+
CHAR_GRAVE_ACCENT = 96;
|
|
2565
|
+
CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2566
|
+
CHAR_VERTICAL_LINE = 124;
|
|
2567
|
+
CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2568
|
+
ESCAPE_SEQUENCES = {};
|
|
2569
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2570
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2571
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2572
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2573
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2574
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2575
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2576
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2577
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2578
|
+
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2579
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2580
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2581
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2582
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2583
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2584
|
+
DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2585
|
+
"y",
|
|
2586
|
+
"Y",
|
|
2587
|
+
"yes",
|
|
2588
|
+
"Yes",
|
|
2589
|
+
"YES",
|
|
2590
|
+
"on",
|
|
2591
|
+
"On",
|
|
2592
|
+
"ON",
|
|
2593
|
+
"n",
|
|
2594
|
+
"N",
|
|
2595
|
+
"no",
|
|
2596
|
+
"No",
|
|
2597
|
+
"NO",
|
|
2598
|
+
"off",
|
|
2599
|
+
"Off",
|
|
2600
|
+
"OFF"
|
|
2601
|
+
];
|
|
2602
|
+
DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
2603
|
+
QUOTING_TYPE_SINGLE = 1;
|
|
2604
|
+
QUOTING_TYPE_DOUBLE = 2;
|
|
2605
|
+
STYLE_PLAIN = 1;
|
|
2606
|
+
STYLE_SINGLE = 2;
|
|
2607
|
+
STYLE_LITERAL = 3;
|
|
2608
|
+
STYLE_FOLDED = 4;
|
|
2609
|
+
STYLE_DOUBLE = 5;
|
|
2610
|
+
dump_1 = dump$1;
|
|
2611
|
+
dumper = {
|
|
2612
|
+
dump: dump_1
|
|
2613
|
+
};
|
|
2614
|
+
Type = type;
|
|
2615
|
+
Schema = schema;
|
|
2616
|
+
FAILSAFE_SCHEMA = failsafe;
|
|
2617
|
+
JSON_SCHEMA = json;
|
|
2618
|
+
CORE_SCHEMA = core;
|
|
2619
|
+
DEFAULT_SCHEMA = _default;
|
|
2620
|
+
load = loader.load;
|
|
2621
|
+
loadAll = loader.loadAll;
|
|
2622
|
+
dump = dumper.dump;
|
|
2623
|
+
YAMLException = exception;
|
|
2624
|
+
types = {
|
|
2625
|
+
binary,
|
|
2626
|
+
float,
|
|
2627
|
+
map,
|
|
2628
|
+
null: _null,
|
|
2629
|
+
pairs,
|
|
2630
|
+
set,
|
|
2631
|
+
timestamp,
|
|
2632
|
+
bool,
|
|
2633
|
+
int,
|
|
2634
|
+
merge,
|
|
2635
|
+
omap,
|
|
2636
|
+
seq,
|
|
2637
|
+
str
|
|
2638
|
+
};
|
|
2639
|
+
safeLoad = renamed("safeLoad", "load");
|
|
2640
|
+
safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
2641
|
+
safeDump = renamed("safeDump", "dump");
|
|
2642
|
+
jsYaml = {
|
|
2643
|
+
Type,
|
|
2644
|
+
Schema,
|
|
2645
|
+
FAILSAFE_SCHEMA,
|
|
2646
|
+
JSON_SCHEMA,
|
|
2647
|
+
CORE_SCHEMA,
|
|
2648
|
+
DEFAULT_SCHEMA,
|
|
2649
|
+
load,
|
|
2650
|
+
loadAll,
|
|
2651
|
+
dump,
|
|
2652
|
+
YAMLException,
|
|
2653
|
+
types,
|
|
2654
|
+
safeLoad,
|
|
2655
|
+
safeLoadAll,
|
|
2656
|
+
safeDump
|
|
2657
|
+
};
|
|
2658
|
+
}
|
|
2659
|
+
});
|
|
2657
2660
|
|
|
2658
2661
|
// ../../packages/core-runtime/src/index.ts
|
|
2659
|
-
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
2660
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
2661
2662
|
function isObject2(value) {
|
|
2662
2663
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2663
2664
|
}
|
|
@@ -2718,96 +2719,25 @@ function createJsonLogger(source) {
|
|
|
2718
2719
|
console.log(line);
|
|
2719
2720
|
};
|
|
2720
2721
|
}
|
|
2722
|
+
var import_promises, import_node_path;
|
|
2723
|
+
var init_src = __esm({
|
|
2724
|
+
"../../packages/core-runtime/src/index.ts"() {
|
|
2725
|
+
"use strict";
|
|
2726
|
+
import_promises = __toESM(require("node:fs/promises"), 1);
|
|
2727
|
+
import_node_path = __toESM(require("node:path"), 1);
|
|
2728
|
+
}
|
|
2729
|
+
});
|
|
2721
2730
|
|
|
2722
2731
|
// ../ada-agent/dist/bundled-config.generated.js
|
|
2723
|
-
var bundledDefaultConfigYaml
|
|
2732
|
+
var bundledDefaultConfigYaml;
|
|
2733
|
+
var init_bundled_config_generated = __esm({
|
|
2734
|
+
"../ada-agent/dist/bundled-config.generated.js"() {
|
|
2735
|
+
"use strict";
|
|
2736
|
+
bundledDefaultConfigYaml = 'agent:\r\n id: "ada-agent-local"\r\n mode: "foreground"\r\n setupOnFirstRun: true\r\n\r\nbootstrapUI:\r\n enabled: true\r\n mode: "auto" # auto | cli | gui\r\n host: "127.0.0.1"\r\n port: 17650\r\n autoOpenBrowser: true\r\n sessionTtlSec: 600\r\n secretsProvider: "auto" # auto | keychain | credman | file\r\n native:\r\n enabled: false\r\n command: "" # e.g. ./bootstrap-ui / .\\bootstrap-ui.exe\r\n args: []\r\n timeoutMs: 120000\r\n fallbackToWeb: true\r\n\r\ntransport:\r\n mode: "auto"\r\n streamProtocol: "websocket"\r\n requestPath: "/api/v1/execute"\r\n healthPath: "/health"\r\n streamPath: "/ws"\r\n requestTimeoutMs: 15000\r\n\r\ngraphics:\r\n enabled: false\r\n fallbackOnSemanticFailure: false\r\n minConfidence: 0.8\r\n\r\nmonitoring:\r\n enabled: false\r\n platforms: ["web", "android", "ios", "harmony"] # \u53EF\u9009\u5B50\u96C6\r\n sampleEvery: 1 # \u6BCF N \u6761\u64CD\u4F5C\u91C7\u6837\u4E00\u6B21\uFF0C1 \u8868\u793A\u5168\u91CF\r\n outputDir: "artifacts/monitoring"\r\n onFailureOnly: false # true \u65F6\u4EC5\u5931\u8D25\u64CD\u4F5C\u6293\u56FE\uFF0C\u6027\u80FD\u66F4\u4F18\r\n groupBySession: true # \u6309 sessionId/requestId \u5206\u5C42\u5F52\u6863\r\n nonBlocking: true # true \u65F6\u76D1\u63A7\u5F02\u6B65\u6267\u884C\uFF0C\u4E0D\u963B\u585E\u4E3B\u94FE\u8DEF\r\n resolution:\r\n maxWidth: 1280\r\n maxHeight: 720\r\n keepAspectRatio: true # \u4FDD\u6301\u6BD4\u4F8B\uFF0C\u907F\u514D\u76D1\u63A7\u56FE\u50CF\u53D8\u5F62\r\n\r\nqueue:\r\n inboxDir: "tasks/inbox"\r\n processedDir: "tasks/processed"\r\n failedDir: "tasks/failed"\r\n pollIntervalMs: 3000\r\n maxFileRetryAttempts: 2\r\n\r\ndependencies:\r\n autoInstallOnStart: true\r\n playwrightBrowser: "chromium" # chromium | firefox | webkit | all\r\n playwrightInstallTargets: ["chromium"] # chromium | chrome | msedge | firefox | webkit | all\r\n playwrightDownloadHost: "https://cdn.playwright.dev"\r\n # \u56FD\u5185 npm \u955C\u50CF\uFF08\u6309\u4F18\u5148\u7EA7\uFF1Binstall-deps \u542F\u52A8\u65F6\u6D4B\u901F\u9009\u6700\u5FEB\uFF0C\u65E0\u9700\u7528\u6237\u914D\u7F6E\uFF09\r\n npmRegistryCandidates:\r\n - "https://registry.npmmirror.com" # \u963F\u91CC\u4E91 / npmmirror\uFF08\u63A8\u8350\uFF09\r\n - "https://mirrors.cloud.tencent.com/npm" # \u817E\u8BAF\u4E91\r\n - "https://repo.huaweicloud.com/repository/npm" # \u534E\u4E3A\u4E91\r\n - "https://registry.npmjs.org" # \u5B98\u65B9\u515C\u5E95\r\n playwrightHostCandidates:\r\n - "https://cdn.playwright.dev"\r\n - "https://playwright.azureedge.net"\r\n - "https://npmmirror.com/mirrors/playwright"\r\n - "https://cdn.npmmirror.com/binaries/playwright"\r\n # \u539F\u751F WebDriver\uFF08geckodriver / chromedriver\uFF09\u7EDF\u4E00\u653E\u5728\u9879\u76EE dirver \u76EE\u5F55\r\n nativeDriversDir: "dirver"\r\n geckodriverVersion: "latest" # \u5982 0.36.0\uFF1Binstall-deps --only=selenium \u65F6\u4E0B\u8F7D\u5230\u6B64\u76EE\u5F55\r\n chromedriverVersion: "latest" # \u5982 137\u3001135\u3001match-chrome\uFF08\u5339\u914D\u672C\u673A Chrome \u4E3B\u7248\u672C\uFF09\r\n\r\nappium:\r\n serverUrl: "http://127.0.0.1:4723"\r\n requiredDrivers: ["uiautomator2", "xcuitest", "harmonyos"]\r\n';
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2724
2739
|
|
|
2725
2740
|
// ../ada-agent/dist/config.js
|
|
2726
|
-
var DEFAULT_CONFIG_RELATIVE = import_node_path2.default.join("config", "default.yaml");
|
|
2727
|
-
var LOCAL_DATA_DIR = import_node_path2.default.join(".ada-agent");
|
|
2728
|
-
var EFFECTIVE_CONFIG_FILE = import_node_path2.default.join(LOCAL_DATA_DIR, "agent.config.yaml");
|
|
2729
|
-
var defaultConfig = {
|
|
2730
|
-
agent: {
|
|
2731
|
-
id: "ada-agent-local",
|
|
2732
|
-
mode: "foreground",
|
|
2733
|
-
setupOnFirstRun: true
|
|
2734
|
-
},
|
|
2735
|
-
bootstrapUI: {
|
|
2736
|
-
enabled: true,
|
|
2737
|
-
mode: "auto",
|
|
2738
|
-
host: "127.0.0.1",
|
|
2739
|
-
port: 17650,
|
|
2740
|
-
autoOpenBrowser: true,
|
|
2741
|
-
sessionTtlSec: 600,
|
|
2742
|
-
secretsProvider: "auto",
|
|
2743
|
-
native: {
|
|
2744
|
-
enabled: false,
|
|
2745
|
-
command: "",
|
|
2746
|
-
args: [],
|
|
2747
|
-
timeoutMs: 12e4,
|
|
2748
|
-
fallbackToWeb: true
|
|
2749
|
-
}
|
|
2750
|
-
},
|
|
2751
|
-
transport: {
|
|
2752
|
-
mode: "auto",
|
|
2753
|
-
streamProtocol: "websocket",
|
|
2754
|
-
requestPath: "/api/v1/execute",
|
|
2755
|
-
healthPath: "/health",
|
|
2756
|
-
streamPath: "/ws",
|
|
2757
|
-
requestTimeoutMs: 15e3
|
|
2758
|
-
},
|
|
2759
|
-
graphics: {
|
|
2760
|
-
enabled: false,
|
|
2761
|
-
fallbackOnSemanticFailure: false,
|
|
2762
|
-
minConfidence: 0.8
|
|
2763
|
-
},
|
|
2764
|
-
monitoring: {
|
|
2765
|
-
enabled: false,
|
|
2766
|
-
platforms: ["web", "android", "ios", "harmony"],
|
|
2767
|
-
sampleEvery: 1,
|
|
2768
|
-
outputDir: "artifacts/monitoring",
|
|
2769
|
-
onFailureOnly: false,
|
|
2770
|
-
groupBySession: true,
|
|
2771
|
-
nonBlocking: true,
|
|
2772
|
-
resolution: {
|
|
2773
|
-
maxWidth: 1280,
|
|
2774
|
-
maxHeight: 720,
|
|
2775
|
-
keepAspectRatio: true
|
|
2776
|
-
}
|
|
2777
|
-
},
|
|
2778
|
-
queue: {
|
|
2779
|
-
inboxDir: "tasks/inbox",
|
|
2780
|
-
processedDir: "tasks/processed",
|
|
2781
|
-
failedDir: "tasks/failed",
|
|
2782
|
-
pollIntervalMs: 3e3,
|
|
2783
|
-
maxFileRetryAttempts: 2
|
|
2784
|
-
},
|
|
2785
|
-
dependencies: {
|
|
2786
|
-
autoInstallOnStart: true,
|
|
2787
|
-
playwrightBrowser: "chromium",
|
|
2788
|
-
playwrightInstallTargets: ["chromium"],
|
|
2789
|
-
playwrightDownloadHost: "https://cdn.playwright.dev",
|
|
2790
|
-
npmRegistryCandidates: [
|
|
2791
|
-
"https://registry.npmmirror.com",
|
|
2792
|
-
"https://mirrors.cloud.tencent.com/npm",
|
|
2793
|
-
"https://repo.huaweicloud.com/repository/npm",
|
|
2794
|
-
"https://registry.npmjs.org"
|
|
2795
|
-
],
|
|
2796
|
-
playwrightHostCandidates: [
|
|
2797
|
-
"https://cdn.playwright.dev",
|
|
2798
|
-
"https://playwright.azureedge.net",
|
|
2799
|
-
"https://npmmirror.com/mirrors/playwright",
|
|
2800
|
-
"https://cdn.npmmirror.com/binaries/playwright"
|
|
2801
|
-
],
|
|
2802
|
-
nativeDriversDir: "dirver",
|
|
2803
|
-
geckodriverVersion: "latest",
|
|
2804
|
-
chromedriverVersion: "latest"
|
|
2805
|
-
},
|
|
2806
|
-
appium: {
|
|
2807
|
-
serverUrl: "http://127.0.0.1:4723",
|
|
2808
|
-
requiredDrivers: ["uiautomator2", "xcuitest", "harmonyos"]
|
|
2809
|
-
}
|
|
2810
|
-
};
|
|
2811
2741
|
function mergeConfig(base, overrides) {
|
|
2812
2742
|
return {
|
|
2813
2743
|
...base,
|
|
@@ -2871,11 +2801,104 @@ function maskToken(token) {
|
|
|
2871
2801
|
}
|
|
2872
2802
|
return `${token.slice(0, 4)}***${token.slice(-4)}`;
|
|
2873
2803
|
}
|
|
2804
|
+
var import_promises2, import_node_path2, DEFAULT_CONFIG_RELATIVE, LOCAL_DATA_DIR, EFFECTIVE_CONFIG_FILE, defaultConfig;
|
|
2805
|
+
var init_config = __esm({
|
|
2806
|
+
"../ada-agent/dist/config.js"() {
|
|
2807
|
+
"use strict";
|
|
2808
|
+
import_promises2 = __toESM(require("node:fs/promises"), 1);
|
|
2809
|
+
import_node_path2 = __toESM(require("node:path"), 1);
|
|
2810
|
+
init_js_yaml();
|
|
2811
|
+
init_src();
|
|
2812
|
+
init_bundled_config_generated();
|
|
2813
|
+
DEFAULT_CONFIG_RELATIVE = import_node_path2.default.join("config", "default.yaml");
|
|
2814
|
+
LOCAL_DATA_DIR = import_node_path2.default.join(".ada-agent");
|
|
2815
|
+
EFFECTIVE_CONFIG_FILE = import_node_path2.default.join(LOCAL_DATA_DIR, "agent.config.yaml");
|
|
2816
|
+
defaultConfig = {
|
|
2817
|
+
agent: {
|
|
2818
|
+
id: "ada-agent-local",
|
|
2819
|
+
mode: "foreground",
|
|
2820
|
+
setupOnFirstRun: true
|
|
2821
|
+
},
|
|
2822
|
+
bootstrapUI: {
|
|
2823
|
+
enabled: true,
|
|
2824
|
+
mode: "auto",
|
|
2825
|
+
host: "127.0.0.1",
|
|
2826
|
+
port: 17650,
|
|
2827
|
+
autoOpenBrowser: true,
|
|
2828
|
+
sessionTtlSec: 600,
|
|
2829
|
+
secretsProvider: "auto",
|
|
2830
|
+
native: {
|
|
2831
|
+
enabled: false,
|
|
2832
|
+
command: "",
|
|
2833
|
+
args: [],
|
|
2834
|
+
timeoutMs: 12e4,
|
|
2835
|
+
fallbackToWeb: true
|
|
2836
|
+
}
|
|
2837
|
+
},
|
|
2838
|
+
transport: {
|
|
2839
|
+
mode: "auto",
|
|
2840
|
+
streamProtocol: "websocket",
|
|
2841
|
+
requestPath: "/api/v1/execute",
|
|
2842
|
+
healthPath: "/health",
|
|
2843
|
+
streamPath: "/ws",
|
|
2844
|
+
requestTimeoutMs: 15e3
|
|
2845
|
+
},
|
|
2846
|
+
graphics: {
|
|
2847
|
+
enabled: false,
|
|
2848
|
+
fallbackOnSemanticFailure: false,
|
|
2849
|
+
minConfidence: 0.8
|
|
2850
|
+
},
|
|
2851
|
+
monitoring: {
|
|
2852
|
+
enabled: false,
|
|
2853
|
+
platforms: ["web", "android", "ios", "harmony"],
|
|
2854
|
+
sampleEvery: 1,
|
|
2855
|
+
outputDir: "artifacts/monitoring",
|
|
2856
|
+
onFailureOnly: false,
|
|
2857
|
+
groupBySession: true,
|
|
2858
|
+
nonBlocking: true,
|
|
2859
|
+
resolution: {
|
|
2860
|
+
maxWidth: 1280,
|
|
2861
|
+
maxHeight: 720,
|
|
2862
|
+
keepAspectRatio: true
|
|
2863
|
+
}
|
|
2864
|
+
},
|
|
2865
|
+
queue: {
|
|
2866
|
+
inboxDir: "tasks/inbox",
|
|
2867
|
+
processedDir: "tasks/processed",
|
|
2868
|
+
failedDir: "tasks/failed",
|
|
2869
|
+
pollIntervalMs: 3e3,
|
|
2870
|
+
maxFileRetryAttempts: 2
|
|
2871
|
+
},
|
|
2872
|
+
dependencies: {
|
|
2873
|
+
autoInstallOnStart: true,
|
|
2874
|
+
playwrightBrowser: "chromium",
|
|
2875
|
+
playwrightInstallTargets: ["chromium"],
|
|
2876
|
+
playwrightDownloadHost: "https://cdn.playwright.dev",
|
|
2877
|
+
npmRegistryCandidates: [
|
|
2878
|
+
"https://registry.npmmirror.com",
|
|
2879
|
+
"https://mirrors.cloud.tencent.com/npm",
|
|
2880
|
+
"https://repo.huaweicloud.com/repository/npm",
|
|
2881
|
+
"https://registry.npmjs.org"
|
|
2882
|
+
],
|
|
2883
|
+
playwrightHostCandidates: [
|
|
2884
|
+
"https://cdn.playwright.dev",
|
|
2885
|
+
"https://playwright.azureedge.net",
|
|
2886
|
+
"https://npmmirror.com/mirrors/playwright",
|
|
2887
|
+
"https://cdn.npmmirror.com/binaries/playwright"
|
|
2888
|
+
],
|
|
2889
|
+
nativeDriversDir: "dirver",
|
|
2890
|
+
geckodriverVersion: "latest",
|
|
2891
|
+
chromedriverVersion: "latest"
|
|
2892
|
+
},
|
|
2893
|
+
appium: {
|
|
2894
|
+
serverUrl: "http://127.0.0.1:4723",
|
|
2895
|
+
requiredDrivers: ["uiautomator2", "xcuitest", "harmonyos"]
|
|
2896
|
+
}
|
|
2897
|
+
};
|
|
2898
|
+
}
|
|
2899
|
+
});
|
|
2874
2900
|
|
|
2875
2901
|
// ../ada-agent/dist/secrets.js
|
|
2876
|
-
var import_promises3 = __toESM(require("node:fs/promises"), 1);
|
|
2877
|
-
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
2878
|
-
var SECRET_FILE = "secrets.json";
|
|
2879
2902
|
function resolveProvider(provider) {
|
|
2880
2903
|
if (provider === "keychain" || provider === "credman") {
|
|
2881
2904
|
return "file";
|
|
@@ -2905,26 +2928,31 @@ async function loadSecret(provider, cwd = process.cwd()) {
|
|
|
2905
2928
|
return null;
|
|
2906
2929
|
}
|
|
2907
2930
|
}
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2931
|
+
var import_promises3, import_node_path3, SECRET_FILE;
|
|
2932
|
+
var init_secrets = __esm({
|
|
2933
|
+
"../ada-agent/dist/secrets.js"() {
|
|
2934
|
+
"use strict";
|
|
2935
|
+
import_promises3 = __toESM(require("node:fs/promises"), 1);
|
|
2936
|
+
import_node_path3 = __toESM(require("node:path"), 1);
|
|
2937
|
+
init_config();
|
|
2938
|
+
SECRET_FILE = "secrets.json";
|
|
2939
|
+
}
|
|
2940
|
+
});
|
|
2915
2941
|
|
|
2916
2942
|
// ../ada-agent/dist/logger.js
|
|
2917
|
-
var baseLog = createJsonLogger("ada-agent");
|
|
2918
2943
|
function log(level, payload) {
|
|
2919
2944
|
baseLog(level, payload);
|
|
2920
2945
|
}
|
|
2946
|
+
var baseLog;
|
|
2947
|
+
var init_logger = __esm({
|
|
2948
|
+
"../ada-agent/dist/logger.js"() {
|
|
2949
|
+
"use strict";
|
|
2950
|
+
init_src();
|
|
2951
|
+
baseLog = createJsonLogger("ada-agent");
|
|
2952
|
+
}
|
|
2953
|
+
});
|
|
2921
2954
|
|
|
2922
2955
|
// ../../packages/native-drivers/src/index.ts
|
|
2923
|
-
var import_node_child_process = require("node:child_process");
|
|
2924
|
-
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
2925
|
-
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
2926
|
-
var DEFAULT_NATIVE_DRIVERS_DIR = "dirver";
|
|
2927
|
-
var CHROME_FOR_TESTING_JSON = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json";
|
|
2928
2956
|
async function fileExists(filePath) {
|
|
2929
2957
|
try {
|
|
2930
2958
|
await import_promises4.default.access(filePath);
|
|
@@ -3431,9 +3459,19 @@ async function ensureNativeWebDrivers(options = {}) {
|
|
|
3431
3459
|
}
|
|
3432
3460
|
return resolved;
|
|
3433
3461
|
}
|
|
3462
|
+
var import_node_child_process, import_promises4, import_node_path4, DEFAULT_NATIVE_DRIVERS_DIR, CHROME_FOR_TESTING_JSON;
|
|
3463
|
+
var init_src2 = __esm({
|
|
3464
|
+
"../../packages/native-drivers/src/index.ts"() {
|
|
3465
|
+
"use strict";
|
|
3466
|
+
import_node_child_process = require("node:child_process");
|
|
3467
|
+
import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
3468
|
+
import_node_path4 = __toESM(require("node:path"), 1);
|
|
3469
|
+
DEFAULT_NATIVE_DRIVERS_DIR = "dirver";
|
|
3470
|
+
CHROME_FOR_TESTING_JSON = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json";
|
|
3471
|
+
}
|
|
3472
|
+
});
|
|
3434
3473
|
|
|
3435
3474
|
// ../ada-agent/dist/dependency-installer.js
|
|
3436
|
-
var require2 = (0, import_node_module.createRequire)(import_node_path5.default.join(process.cwd(), "package.json"));
|
|
3437
3475
|
function shouldUseShell(command) {
|
|
3438
3476
|
if (process.platform !== "win32") {
|
|
3439
3477
|
return false;
|
|
@@ -3604,12 +3642,6 @@ async function probePlaywrightBrowserArtifact(host, browserVersion) {
|
|
|
3604
3642
|
function requiredAppiumDrivers(config) {
|
|
3605
3643
|
return Array.from(new Set(config.appium.requiredDrivers ?? []));
|
|
3606
3644
|
}
|
|
3607
|
-
var DEFAULT_NPM_REGISTRY_CANDIDATES = [
|
|
3608
|
-
"https://registry.npmmirror.com",
|
|
3609
|
-
"https://mirrors.cloud.tencent.com/npm",
|
|
3610
|
-
"https://repo.huaweicloud.com/repository/npm",
|
|
3611
|
-
"https://registry.npmjs.org"
|
|
3612
|
-
];
|
|
3613
3645
|
function npmProxyRegistry() {
|
|
3614
3646
|
return process.env.ADA_NPM_PROXY_REGISTRY ?? DEFAULT_NPM_REGISTRY_CANDIDATES[0];
|
|
3615
3647
|
}
|
|
@@ -3709,16 +3741,6 @@ async function resolveCompatibleDriverSpecs(driver) {
|
|
|
3709
3741
|
}
|
|
3710
3742
|
return Array.from(new Set(specs));
|
|
3711
3743
|
}
|
|
3712
|
-
var detectedBestRegistryByKey = /* @__PURE__ */ new Map();
|
|
3713
|
-
var PROGRESS_STEPS = [
|
|
3714
|
-
"deps.ensure.start",
|
|
3715
|
-
"registry.probe.start",
|
|
3716
|
-
"packages.install.start",
|
|
3717
|
-
"playwright.host.probe.start",
|
|
3718
|
-
"playwright.browser.install.start",
|
|
3719
|
-
"appium.driver.ensure.start",
|
|
3720
|
-
"deps.ensure.done"
|
|
3721
|
-
];
|
|
3722
3744
|
function stepMeta(stage) {
|
|
3723
3745
|
const idx = PROGRESS_STEPS.indexOf(stage);
|
|
3724
3746
|
if (idx === -1) {
|
|
@@ -3827,13 +3849,6 @@ function playwrightDownloadHost(config) {
|
|
|
3827
3849
|
function normalizeHostUrl(url) {
|
|
3828
3850
|
return url.replace(/\/$/, "");
|
|
3829
3851
|
}
|
|
3830
|
-
var DEFAULT_PLAYWRIGHT_HOST_CANDIDATES = [
|
|
3831
|
-
"https://cdn.playwright.dev",
|
|
3832
|
-
"https://playwright.azureedge.net",
|
|
3833
|
-
"https://npmmirror.com/mirrors/playwright",
|
|
3834
|
-
"https://cdn.npmmirror.com/binaries/playwright"
|
|
3835
|
-
];
|
|
3836
|
-
var PLAYWRIGHT_HOST_FALLBACK = DEFAULT_PLAYWRIGHT_HOST_CANDIDATES[0];
|
|
3837
3852
|
function playwrightProbeUrls(host) {
|
|
3838
3853
|
const h = normalizeHostUrl(host);
|
|
3839
3854
|
if (h.includes("npmmirror.com/mirrors/playwright")) {
|
|
@@ -4161,14 +4176,6 @@ async function ensureAppiumDrivers(config, onLogLine) {
|
|
|
4161
4176
|
}
|
|
4162
4177
|
return missing;
|
|
4163
4178
|
}
|
|
4164
|
-
var PW_INSTALL_TARGETS = /* @__PURE__ */ new Set([
|
|
4165
|
-
"chromium",
|
|
4166
|
-
"chrome",
|
|
4167
|
-
"firefox",
|
|
4168
|
-
"webkit",
|
|
4169
|
-
"msedge",
|
|
4170
|
-
"all"
|
|
4171
|
-
]);
|
|
4172
4179
|
function filterPlaywrightTargetsOverride(raw) {
|
|
4173
4180
|
if (!raw?.length) {
|
|
4174
4181
|
return void 0;
|
|
@@ -4494,13 +4501,52 @@ async function getDependencyHealth(config) {
|
|
|
4494
4501
|
missingAppiumDrivers
|
|
4495
4502
|
};
|
|
4496
4503
|
}
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
+
var import_node_module, import_node_fs, import_node_child_process2, import_promises5, import_node_path5, require2, DEFAULT_NPM_REGISTRY_CANDIDATES, detectedBestRegistryByKey, PROGRESS_STEPS, DEFAULT_PLAYWRIGHT_HOST_CANDIDATES, PLAYWRIGHT_HOST_FALLBACK, PW_INSTALL_TARGETS;
|
|
4505
|
+
var init_dependency_installer = __esm({
|
|
4506
|
+
"../ada-agent/dist/dependency-installer.js"() {
|
|
4507
|
+
"use strict";
|
|
4508
|
+
import_node_module = require("node:module");
|
|
4509
|
+
import_node_fs = require("node:fs");
|
|
4510
|
+
import_node_child_process2 = require("node:child_process");
|
|
4511
|
+
import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
4512
|
+
import_node_path5 = __toESM(require("node:path"), 1);
|
|
4513
|
+
init_logger();
|
|
4514
|
+
init_config();
|
|
4515
|
+
init_src2();
|
|
4516
|
+
require2 = (0, import_node_module.createRequire)(import_node_path5.default.join(process.cwd(), "package.json"));
|
|
4517
|
+
DEFAULT_NPM_REGISTRY_CANDIDATES = [
|
|
4518
|
+
"https://registry.npmmirror.com",
|
|
4519
|
+
"https://mirrors.cloud.tencent.com/npm",
|
|
4520
|
+
"https://repo.huaweicloud.com/repository/npm",
|
|
4521
|
+
"https://registry.npmjs.org"
|
|
4522
|
+
];
|
|
4523
|
+
detectedBestRegistryByKey = /* @__PURE__ */ new Map();
|
|
4524
|
+
PROGRESS_STEPS = [
|
|
4525
|
+
"deps.ensure.start",
|
|
4526
|
+
"registry.probe.start",
|
|
4527
|
+
"packages.install.start",
|
|
4528
|
+
"playwright.host.probe.start",
|
|
4529
|
+
"playwright.browser.install.start",
|
|
4530
|
+
"appium.driver.ensure.start",
|
|
4531
|
+
"deps.ensure.done"
|
|
4532
|
+
];
|
|
4533
|
+
DEFAULT_PLAYWRIGHT_HOST_CANDIDATES = [
|
|
4534
|
+
"https://cdn.playwright.dev",
|
|
4535
|
+
"https://playwright.azureedge.net",
|
|
4536
|
+
"https://npmmirror.com/mirrors/playwright",
|
|
4537
|
+
"https://cdn.npmmirror.com/binaries/playwright"
|
|
4538
|
+
];
|
|
4539
|
+
PLAYWRIGHT_HOST_FALLBACK = DEFAULT_PLAYWRIGHT_HOST_CANDIDATES[0];
|
|
4540
|
+
PW_INSTALL_TARGETS = /* @__PURE__ */ new Set([
|
|
4541
|
+
"chromium",
|
|
4542
|
+
"chrome",
|
|
4543
|
+
"firefox",
|
|
4544
|
+
"webkit",
|
|
4545
|
+
"msedge",
|
|
4546
|
+
"all"
|
|
4547
|
+
]);
|
|
4548
|
+
}
|
|
4549
|
+
});
|
|
4504
4550
|
|
|
4505
4551
|
// ../../packages/driver-rpc/src/index.ts
|
|
4506
4552
|
function parseWebEngineFromPayload(payload) {
|
|
@@ -4524,11 +4570,13 @@ function asRecord(value) {
|
|
|
4524
4570
|
function getString(value) {
|
|
4525
4571
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
4526
4572
|
}
|
|
4573
|
+
var init_src3 = __esm({
|
|
4574
|
+
"../../packages/driver-rpc/src/index.ts"() {
|
|
4575
|
+
"use strict";
|
|
4576
|
+
}
|
|
4577
|
+
});
|
|
4527
4578
|
|
|
4528
4579
|
// ../../packages/plugin-host/src/index.ts
|
|
4529
|
-
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
4530
|
-
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
4531
|
-
var import_node_module2 = require("node:module");
|
|
4532
4580
|
function assertManifest(plugin) {
|
|
4533
4581
|
const m = plugin.manifest;
|
|
4534
4582
|
if (!m.id || !m.version) {
|
|
@@ -4544,113 +4592,6 @@ function assertManifest(plugin) {
|
|
|
4544
4592
|
throw new Error(`Invalid plugin manifest (${m.id}): version must look like semver`);
|
|
4545
4593
|
}
|
|
4546
4594
|
}
|
|
4547
|
-
var PluginHost = class {
|
|
4548
|
-
plugins = /* @__PURE__ */ new Map();
|
|
4549
|
-
webEngines = /* @__PURE__ */ new Map();
|
|
4550
|
-
manifests = /* @__PURE__ */ new Map();
|
|
4551
|
-
pluginById = /* @__PURE__ */ new Map();
|
|
4552
|
-
initializedPluginIds = /* @__PURE__ */ new Set();
|
|
4553
|
-
register(plugin) {
|
|
4554
|
-
assertManifest(plugin);
|
|
4555
|
-
if (this.manifests.has(plugin.manifest.id)) {
|
|
4556
|
-
throw new Error(`Plugin already registered: ${plugin.manifest.id}`);
|
|
4557
|
-
}
|
|
4558
|
-
const mobilePlatforms = plugin.manifest.platforms.filter((p) => p !== "web");
|
|
4559
|
-
if (plugin.manifest.platforms.includes("web")) {
|
|
4560
|
-
const engine = manifestWebEngine(plugin.manifest);
|
|
4561
|
-
if (this.webEngines.has(engine)) {
|
|
4562
|
-
throw new Error(`Web engine already registered: ${engine} (reject ${plugin.manifest.id})`);
|
|
4563
|
-
}
|
|
4564
|
-
this.webEngines.set(engine, plugin);
|
|
4565
|
-
}
|
|
4566
|
-
for (const platform of mobilePlatforms) {
|
|
4567
|
-
if (this.plugins.has(platform)) {
|
|
4568
|
-
throw new Error(`Platform already has plugin (${platform}), reject: ${plugin.manifest.id}`);
|
|
4569
|
-
}
|
|
4570
|
-
this.plugins.set(platform, plugin);
|
|
4571
|
-
}
|
|
4572
|
-
this.manifests.set(plugin.manifest.id, plugin.manifest);
|
|
4573
|
-
this.pluginById.set(plugin.manifest.id, plugin);
|
|
4574
|
-
}
|
|
4575
|
-
registerWebEngine(plugin) {
|
|
4576
|
-
this.register(plugin);
|
|
4577
|
-
}
|
|
4578
|
-
/** Resolve driver for a command (web routes by payload.engine). */
|
|
4579
|
-
resolve(command) {
|
|
4580
|
-
if (command.platform === "web") {
|
|
4581
|
-
const engine = parseWebEngineFromPayload(command.payload);
|
|
4582
|
-
const plugin2 = this.webEngines.get(engine);
|
|
4583
|
-
if (!plugin2) {
|
|
4584
|
-
if (engine === "selenium") {
|
|
4585
|
-
throw new Error(
|
|
4586
|
-
"WEB_ENGINE_SELENIUM_NOT_INSTALLED: register @ada/driver-selenium and ensure GeckoDriver/ChromeDriver is on PATH"
|
|
4587
|
-
);
|
|
4588
|
-
}
|
|
4589
|
-
throw new Error(`WEB_ENGINE_UNKNOWN: ${engine}`);
|
|
4590
|
-
}
|
|
4591
|
-
return plugin2;
|
|
4592
|
-
}
|
|
4593
|
-
const plugin = this.plugins.get(command.platform);
|
|
4594
|
-
if (!plugin) {
|
|
4595
|
-
throw new Error(`No plugin registered for platform: ${command.platform}`);
|
|
4596
|
-
}
|
|
4597
|
-
return plugin;
|
|
4598
|
-
}
|
|
4599
|
-
/** Legacy: mobile platforms only; web defaults to playwright. */
|
|
4600
|
-
resolvePlatform(platform) {
|
|
4601
|
-
if (platform === "web") {
|
|
4602
|
-
const plugin = this.webEngines.get("playwright");
|
|
4603
|
-
if (!plugin) {
|
|
4604
|
-
throw new Error("No web engine registered (playwright)");
|
|
4605
|
-
}
|
|
4606
|
-
return plugin;
|
|
4607
|
-
}
|
|
4608
|
-
return this.resolve({ requestId: "", sessionId: "", platform, command: "navigate" });
|
|
4609
|
-
}
|
|
4610
|
-
listWebEngines() {
|
|
4611
|
-
return Array.from(this.webEngines.keys());
|
|
4612
|
-
}
|
|
4613
|
-
listManifests() {
|
|
4614
|
-
return Array.from(this.manifests.values());
|
|
4615
|
-
}
|
|
4616
|
-
async ensureInitialized(pluginId, timeoutMs = 15e3) {
|
|
4617
|
-
if (this.initializedPluginIds.has(pluginId)) {
|
|
4618
|
-
return;
|
|
4619
|
-
}
|
|
4620
|
-
const plugin = this.pluginById.get(pluginId);
|
|
4621
|
-
if (!plugin) {
|
|
4622
|
-
throw new Error(`Plugin not registered: ${pluginId}`);
|
|
4623
|
-
}
|
|
4624
|
-
await Promise.race([
|
|
4625
|
-
plugin.init(),
|
|
4626
|
-
new Promise(
|
|
4627
|
-
(_, reject) => setTimeout(() => reject(new Error(`Plugin init timeout: ${pluginId}`)), timeoutMs)
|
|
4628
|
-
)
|
|
4629
|
-
]);
|
|
4630
|
-
this.initializedPluginIds.add(pluginId);
|
|
4631
|
-
}
|
|
4632
|
-
async healthCheck(timeoutMs = 5e3) {
|
|
4633
|
-
const items = [];
|
|
4634
|
-
for (const [id] of this.manifests) {
|
|
4635
|
-
try {
|
|
4636
|
-
await this.ensureInitialized(id, timeoutMs);
|
|
4637
|
-
items.push({ id, ok: true, message: "healthy" });
|
|
4638
|
-
} catch (error) {
|
|
4639
|
-
items.push({
|
|
4640
|
-
id,
|
|
4641
|
-
ok: false,
|
|
4642
|
-
message: error instanceof Error ? error.message : String(error)
|
|
4643
|
-
});
|
|
4644
|
-
}
|
|
4645
|
-
}
|
|
4646
|
-
return items;
|
|
4647
|
-
}
|
|
4648
|
-
};
|
|
4649
|
-
var DEFAULT_PLUGIN_MODULE_IDS = [
|
|
4650
|
-
"@ada/driver-playwright",
|
|
4651
|
-
"@ada/driver-appium",
|
|
4652
|
-
"@ada/driver-selenium"
|
|
4653
|
-
];
|
|
4654
4595
|
function isPluginModule(mod) {
|
|
4655
4596
|
if (!mod || typeof mod !== "object") {
|
|
4656
4597
|
return false;
|
|
@@ -4721,6 +4662,123 @@ function registerRuntimePlugins(host, options) {
|
|
|
4721
4662
|
const fallbackModuleIds = options?.moduleIds?.length ? options.moduleIds : DEFAULT_PLUGIN_MODULE_IDS;
|
|
4722
4663
|
return registerPluginsFromModuleIds(host, fallbackModuleIds);
|
|
4723
4664
|
}
|
|
4665
|
+
var import_node_fs2, import_node_path6, import_node_module2, PluginHost, DEFAULT_PLUGIN_MODULE_IDS;
|
|
4666
|
+
var init_src4 = __esm({
|
|
4667
|
+
"../../packages/plugin-host/src/index.ts"() {
|
|
4668
|
+
"use strict";
|
|
4669
|
+
init_src3();
|
|
4670
|
+
import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
4671
|
+
import_node_path6 = __toESM(require("node:path"), 1);
|
|
4672
|
+
import_node_module2 = require("node:module");
|
|
4673
|
+
PluginHost = class {
|
|
4674
|
+
plugins = /* @__PURE__ */ new Map();
|
|
4675
|
+
webEngines = /* @__PURE__ */ new Map();
|
|
4676
|
+
manifests = /* @__PURE__ */ new Map();
|
|
4677
|
+
pluginById = /* @__PURE__ */ new Map();
|
|
4678
|
+
initializedPluginIds = /* @__PURE__ */ new Set();
|
|
4679
|
+
register(plugin) {
|
|
4680
|
+
assertManifest(plugin);
|
|
4681
|
+
if (this.manifests.has(plugin.manifest.id)) {
|
|
4682
|
+
throw new Error(`Plugin already registered: ${plugin.manifest.id}`);
|
|
4683
|
+
}
|
|
4684
|
+
const mobilePlatforms = plugin.manifest.platforms.filter((p) => p !== "web");
|
|
4685
|
+
if (plugin.manifest.platforms.includes("web")) {
|
|
4686
|
+
const engine = manifestWebEngine(plugin.manifest);
|
|
4687
|
+
if (this.webEngines.has(engine)) {
|
|
4688
|
+
throw new Error(`Web engine already registered: ${engine} (reject ${plugin.manifest.id})`);
|
|
4689
|
+
}
|
|
4690
|
+
this.webEngines.set(engine, plugin);
|
|
4691
|
+
}
|
|
4692
|
+
for (const platform of mobilePlatforms) {
|
|
4693
|
+
if (this.plugins.has(platform)) {
|
|
4694
|
+
throw new Error(`Platform already has plugin (${platform}), reject: ${plugin.manifest.id}`);
|
|
4695
|
+
}
|
|
4696
|
+
this.plugins.set(platform, plugin);
|
|
4697
|
+
}
|
|
4698
|
+
this.manifests.set(plugin.manifest.id, plugin.manifest);
|
|
4699
|
+
this.pluginById.set(plugin.manifest.id, plugin);
|
|
4700
|
+
}
|
|
4701
|
+
registerWebEngine(plugin) {
|
|
4702
|
+
this.register(plugin);
|
|
4703
|
+
}
|
|
4704
|
+
/** Resolve driver for a command (web routes by payload.engine). */
|
|
4705
|
+
resolve(command) {
|
|
4706
|
+
if (command.platform === "web") {
|
|
4707
|
+
const engine = parseWebEngineFromPayload(command.payload);
|
|
4708
|
+
const plugin2 = this.webEngines.get(engine);
|
|
4709
|
+
if (!plugin2) {
|
|
4710
|
+
if (engine === "selenium") {
|
|
4711
|
+
throw new Error(
|
|
4712
|
+
"WEB_ENGINE_SELENIUM_NOT_INSTALLED: register @ada/driver-selenium and ensure GeckoDriver/ChromeDriver is on PATH"
|
|
4713
|
+
);
|
|
4714
|
+
}
|
|
4715
|
+
throw new Error(`WEB_ENGINE_UNKNOWN: ${engine}`);
|
|
4716
|
+
}
|
|
4717
|
+
return plugin2;
|
|
4718
|
+
}
|
|
4719
|
+
const plugin = this.plugins.get(command.platform);
|
|
4720
|
+
if (!plugin) {
|
|
4721
|
+
throw new Error(`No plugin registered for platform: ${command.platform}`);
|
|
4722
|
+
}
|
|
4723
|
+
return plugin;
|
|
4724
|
+
}
|
|
4725
|
+
/** Legacy: mobile platforms only; web defaults to playwright. */
|
|
4726
|
+
resolvePlatform(platform) {
|
|
4727
|
+
if (platform === "web") {
|
|
4728
|
+
const plugin = this.webEngines.get("playwright");
|
|
4729
|
+
if (!plugin) {
|
|
4730
|
+
throw new Error("No web engine registered (playwright)");
|
|
4731
|
+
}
|
|
4732
|
+
return plugin;
|
|
4733
|
+
}
|
|
4734
|
+
return this.resolve({ requestId: "", sessionId: "", platform, command: "navigate" });
|
|
4735
|
+
}
|
|
4736
|
+
listWebEngines() {
|
|
4737
|
+
return Array.from(this.webEngines.keys());
|
|
4738
|
+
}
|
|
4739
|
+
listManifests() {
|
|
4740
|
+
return Array.from(this.manifests.values());
|
|
4741
|
+
}
|
|
4742
|
+
async ensureInitialized(pluginId, timeoutMs = 15e3) {
|
|
4743
|
+
if (this.initializedPluginIds.has(pluginId)) {
|
|
4744
|
+
return;
|
|
4745
|
+
}
|
|
4746
|
+
const plugin = this.pluginById.get(pluginId);
|
|
4747
|
+
if (!plugin) {
|
|
4748
|
+
throw new Error(`Plugin not registered: ${pluginId}`);
|
|
4749
|
+
}
|
|
4750
|
+
await Promise.race([
|
|
4751
|
+
plugin.init(),
|
|
4752
|
+
new Promise(
|
|
4753
|
+
(_, reject) => setTimeout(() => reject(new Error(`Plugin init timeout: ${pluginId}`)), timeoutMs)
|
|
4754
|
+
)
|
|
4755
|
+
]);
|
|
4756
|
+
this.initializedPluginIds.add(pluginId);
|
|
4757
|
+
}
|
|
4758
|
+
async healthCheck(timeoutMs = 5e3) {
|
|
4759
|
+
const items = [];
|
|
4760
|
+
for (const [id] of this.manifests) {
|
|
4761
|
+
try {
|
|
4762
|
+
await this.ensureInitialized(id, timeoutMs);
|
|
4763
|
+
items.push({ id, ok: true, message: "healthy" });
|
|
4764
|
+
} catch (error) {
|
|
4765
|
+
items.push({
|
|
4766
|
+
id,
|
|
4767
|
+
ok: false,
|
|
4768
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4769
|
+
});
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
return items;
|
|
4773
|
+
}
|
|
4774
|
+
};
|
|
4775
|
+
DEFAULT_PLUGIN_MODULE_IDS = [
|
|
4776
|
+
"@ada/driver-playwright",
|
|
4777
|
+
"@ada/driver-appium",
|
|
4778
|
+
"@ada/driver-selenium"
|
|
4779
|
+
];
|
|
4780
|
+
}
|
|
4781
|
+
});
|
|
4724
4782
|
|
|
4725
4783
|
// ../ada-agent/dist/plugin-registry.js
|
|
4726
4784
|
function buildPluginHost() {
|
|
@@ -4732,6 +4790,12 @@ function listBuiltInPluginManifests() {
|
|
|
4732
4790
|
const host = new PluginHost();
|
|
4733
4791
|
return registerRuntimePlugins(host);
|
|
4734
4792
|
}
|
|
4793
|
+
var init_plugin_registry = __esm({
|
|
4794
|
+
"../ada-agent/dist/plugin-registry.js"() {
|
|
4795
|
+
"use strict";
|
|
4796
|
+
init_src4();
|
|
4797
|
+
}
|
|
4798
|
+
});
|
|
4735
4799
|
|
|
4736
4800
|
// ../ada-agent/dist/doctor.js
|
|
4737
4801
|
async function dirExists2(dirPath) {
|
|
@@ -4908,10 +4972,22 @@ async function checkAppiumServer(serverUrl) {
|
|
|
4908
4972
|
};
|
|
4909
4973
|
}
|
|
4910
4974
|
}
|
|
4975
|
+
var import_promises6, import_node_net, import_node_path7, import_node_url, import_node_child_process3;
|
|
4976
|
+
var init_doctor = __esm({
|
|
4977
|
+
"../ada-agent/dist/doctor.js"() {
|
|
4978
|
+
"use strict";
|
|
4979
|
+
import_promises6 = __toESM(require("node:fs/promises"), 1);
|
|
4980
|
+
import_node_net = __toESM(require("node:net"), 1);
|
|
4981
|
+
import_node_path7 = __toESM(require("node:path"), 1);
|
|
4982
|
+
import_node_url = require("node:url");
|
|
4983
|
+
import_node_child_process3 = require("node:child_process");
|
|
4984
|
+
init_dependency_installer();
|
|
4985
|
+
init_plugin_registry();
|
|
4986
|
+
init_config();
|
|
4987
|
+
}
|
|
4988
|
+
});
|
|
4911
4989
|
|
|
4912
4990
|
// ../ada-agent/dist/setup-cli.js
|
|
4913
|
-
var import_promises7 = __toESM(require("node:readline/promises"), 1);
|
|
4914
|
-
var import_node_process = require("node:process");
|
|
4915
4991
|
function parseTags(raw) {
|
|
4916
4992
|
return raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
4917
4993
|
}
|
|
@@ -4952,9 +5028,16 @@ async function runSetupCli() {
|
|
|
4952
5028
|
rl.close();
|
|
4953
5029
|
}
|
|
4954
5030
|
}
|
|
5031
|
+
var import_promises7, import_node_process;
|
|
5032
|
+
var init_setup_cli = __esm({
|
|
5033
|
+
"../ada-agent/dist/setup-cli.js"() {
|
|
5034
|
+
"use strict";
|
|
5035
|
+
import_promises7 = __toESM(require("node:readline/promises"), 1);
|
|
5036
|
+
import_node_process = require("node:process");
|
|
5037
|
+
}
|
|
5038
|
+
});
|
|
4955
5039
|
|
|
4956
5040
|
// ../ada-agent/dist/setup-native.js
|
|
4957
|
-
var import_node_child_process4 = require("node:child_process");
|
|
4958
5041
|
function normalizeOutput(raw) {
|
|
4959
5042
|
const parsed = JSON.parse(raw);
|
|
4960
5043
|
if (!parsed.serverUrl || !parsed.tenant || !parsed.environment) {
|
|
@@ -5015,21 +5098,15 @@ async function runSetupNative(config) {
|
|
|
5015
5098
|
});
|
|
5016
5099
|
});
|
|
5017
5100
|
}
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5101
|
+
var import_node_child_process4;
|
|
5102
|
+
var init_setup_native = __esm({
|
|
5103
|
+
"../ada-agent/dist/setup-native.js"() {
|
|
5104
|
+
"use strict";
|
|
5105
|
+
import_node_child_process4 = require("node:child_process");
|
|
5106
|
+
}
|
|
5107
|
+
});
|
|
5023
5108
|
|
|
5024
5109
|
// ../ada-agent/dist/setup-state.js
|
|
5025
|
-
var PW_TARGET = /* @__PURE__ */ new Set([
|
|
5026
|
-
"chromium",
|
|
5027
|
-
"chrome",
|
|
5028
|
-
"firefox",
|
|
5029
|
-
"webkit",
|
|
5030
|
-
"msedge",
|
|
5031
|
-
"all"
|
|
5032
|
-
]);
|
|
5033
5110
|
function normalizePlaywrightTargets(raw) {
|
|
5034
5111
|
const list = (raw ?? []).map((x) => String(x).toLowerCase().trim()).filter((x) => PW_TARGET.has(x));
|
|
5035
5112
|
if (list.includes("all")) {
|
|
@@ -5095,6 +5172,22 @@ async function persistAgentSetup(config, input2) {
|
|
|
5095
5172
|
await saveEffectiveConfig(updated);
|
|
5096
5173
|
return updated;
|
|
5097
5174
|
}
|
|
5175
|
+
var PW_TARGET;
|
|
5176
|
+
var init_setup_state = __esm({
|
|
5177
|
+
"../ada-agent/dist/setup-state.js"() {
|
|
5178
|
+
"use strict";
|
|
5179
|
+
init_config();
|
|
5180
|
+
init_secrets();
|
|
5181
|
+
PW_TARGET = /* @__PURE__ */ new Set([
|
|
5182
|
+
"chromium",
|
|
5183
|
+
"chrome",
|
|
5184
|
+
"firefox",
|
|
5185
|
+
"webkit",
|
|
5186
|
+
"msedge",
|
|
5187
|
+
"all"
|
|
5188
|
+
]);
|
|
5189
|
+
}
|
|
5190
|
+
});
|
|
5098
5191
|
|
|
5099
5192
|
// ../ada-agent/dist/bootstrap-ui.js
|
|
5100
5193
|
function parseDependencyInstallScope(value) {
|
|
@@ -5587,6 +5680,17 @@ async function openBrowser(url) {
|
|
|
5587
5680
|
}
|
|
5588
5681
|
spawn6("xdg-open", [url], { detached: true, stdio: "ignore" }).unref();
|
|
5589
5682
|
}
|
|
5683
|
+
var import_node_http, import_node_crypto, import_node_url2;
|
|
5684
|
+
var init_bootstrap_ui = __esm({
|
|
5685
|
+
"../ada-agent/dist/bootstrap-ui.js"() {
|
|
5686
|
+
"use strict";
|
|
5687
|
+
import_node_http = __toESM(require("node:http"), 1);
|
|
5688
|
+
import_node_crypto = require("node:crypto");
|
|
5689
|
+
import_node_url2 = require("node:url");
|
|
5690
|
+
init_setup_state();
|
|
5691
|
+
init_dependency_installer();
|
|
5692
|
+
}
|
|
5693
|
+
});
|
|
5590
5694
|
|
|
5591
5695
|
// ../../packages/transport-http/src/index.ts
|
|
5592
5696
|
function normalizeBaseUrl(baseUrl) {
|
|
@@ -5600,177 +5704,189 @@ function withTimeoutSignal(timeoutMs) {
|
|
|
5600
5704
|
cancel: () => clearTimeout(timer)
|
|
5601
5705
|
};
|
|
5602
5706
|
}
|
|
5603
|
-
var HttpTransport
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5707
|
+
var HttpTransport;
|
|
5708
|
+
var init_src5 = __esm({
|
|
5709
|
+
"../../packages/transport-http/src/index.ts"() {
|
|
5710
|
+
"use strict";
|
|
5711
|
+
HttpTransport = class {
|
|
5712
|
+
baseUrl;
|
|
5713
|
+
requestPath;
|
|
5714
|
+
healthPath;
|
|
5715
|
+
defaultTimeoutMs;
|
|
5716
|
+
constructor(options) {
|
|
5717
|
+
this.baseUrl = normalizeBaseUrl(options.baseUrl);
|
|
5718
|
+
this.requestPath = options.requestPath ?? "/api/v1/execute";
|
|
5719
|
+
this.healthPath = options.healthPath ?? "/health";
|
|
5720
|
+
this.defaultTimeoutMs = options.defaultTimeoutMs ?? 8e3;
|
|
5721
|
+
}
|
|
5722
|
+
async connect() {
|
|
5723
|
+
}
|
|
5724
|
+
async close() {
|
|
5725
|
+
}
|
|
5726
|
+
async sendRequest(request) {
|
|
5727
|
+
const timeoutMs = request.timeoutMs ?? this.defaultTimeoutMs;
|
|
5728
|
+
const timeout = withTimeoutSignal(timeoutMs);
|
|
5729
|
+
try {
|
|
5730
|
+
const res = await fetch(`${this.baseUrl}${this.requestPath}`, {
|
|
5731
|
+
method: "POST",
|
|
5732
|
+
headers: { "Content-Type": "application/json" },
|
|
5733
|
+
body: JSON.stringify(request),
|
|
5734
|
+
signal: timeout.signal
|
|
5735
|
+
});
|
|
5736
|
+
const data = await res.json().catch(() => ({}));
|
|
5737
|
+
if (!res.ok) {
|
|
5738
|
+
return {
|
|
5739
|
+
requestId: request.requestId,
|
|
5740
|
+
success: false,
|
|
5741
|
+
error: data.error ?? `http status ${res.status}`
|
|
5742
|
+
};
|
|
5743
|
+
}
|
|
5744
|
+
return {
|
|
5745
|
+
requestId: data.requestId ?? request.requestId,
|
|
5746
|
+
success: Boolean(data.success ?? true),
|
|
5747
|
+
payload: data.payload,
|
|
5748
|
+
error: data.error
|
|
5749
|
+
};
|
|
5750
|
+
} catch (error) {
|
|
5751
|
+
return {
|
|
5752
|
+
requestId: request.requestId,
|
|
5753
|
+
success: false,
|
|
5754
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5755
|
+
};
|
|
5756
|
+
} finally {
|
|
5757
|
+
timeout.cancel();
|
|
5758
|
+
}
|
|
5635
5759
|
}
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
signal: timeout.signal
|
|
5658
|
-
});
|
|
5659
|
-
return {
|
|
5660
|
-
ok: res.ok,
|
|
5661
|
-
detail: res.ok ? "http health endpoint reachable" : `http status ${res.status}`
|
|
5662
|
-
};
|
|
5663
|
-
} catch (error) {
|
|
5664
|
-
return {
|
|
5665
|
-
ok: false,
|
|
5666
|
-
detail: error instanceof Error ? error.message : String(error)
|
|
5667
|
-
};
|
|
5668
|
-
} finally {
|
|
5669
|
-
timeout.cancel();
|
|
5670
|
-
}
|
|
5760
|
+
async health() {
|
|
5761
|
+
const timeout = withTimeoutSignal(this.defaultTimeoutMs);
|
|
5762
|
+
try {
|
|
5763
|
+
const res = await fetch(`${this.baseUrl}${this.healthPath}`, {
|
|
5764
|
+
method: "GET",
|
|
5765
|
+
signal: timeout.signal
|
|
5766
|
+
});
|
|
5767
|
+
return {
|
|
5768
|
+
ok: res.ok,
|
|
5769
|
+
detail: res.ok ? "http health endpoint reachable" : `http status ${res.status}`
|
|
5770
|
+
};
|
|
5771
|
+
} catch (error) {
|
|
5772
|
+
return {
|
|
5773
|
+
ok: false,
|
|
5774
|
+
detail: error instanceof Error ? error.message : String(error)
|
|
5775
|
+
};
|
|
5776
|
+
} finally {
|
|
5777
|
+
timeout.cancel();
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5780
|
+
};
|
|
5671
5781
|
}
|
|
5672
|
-
};
|
|
5782
|
+
});
|
|
5673
5783
|
|
|
5674
5784
|
// ../../packages/transport-stream/src/index.ts
|
|
5675
|
-
var StreamTransport
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5785
|
+
var StreamTransport;
|
|
5786
|
+
var init_src6 = __esm({
|
|
5787
|
+
"../../packages/transport-stream/src/index.ts"() {
|
|
5788
|
+
"use strict";
|
|
5789
|
+
StreamTransport = class {
|
|
5790
|
+
url;
|
|
5791
|
+
defaultTimeoutMs;
|
|
5792
|
+
socket = null;
|
|
5793
|
+
pending = /* @__PURE__ */ new Map();
|
|
5794
|
+
constructor(options) {
|
|
5795
|
+
this.url = options.url;
|
|
5796
|
+
this.defaultTimeoutMs = options.defaultTimeoutMs ?? 1e4;
|
|
5797
|
+
}
|
|
5798
|
+
async connect() {
|
|
5799
|
+
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
|
5800
|
+
return;
|
|
5801
|
+
}
|
|
5802
|
+
await new Promise((resolve, reject) => {
|
|
5803
|
+
try {
|
|
5804
|
+
const ws = new WebSocket(this.url);
|
|
5805
|
+
ws.onopen = () => {
|
|
5806
|
+
this.socket = ws;
|
|
5807
|
+
resolve();
|
|
5808
|
+
};
|
|
5809
|
+
ws.onerror = () => reject(new Error("stream transport connect failed"));
|
|
5810
|
+
ws.onmessage = (event) => this.onMessage(event.data);
|
|
5811
|
+
ws.onclose = () => {
|
|
5812
|
+
this.socket = null;
|
|
5813
|
+
this.rejectAllPending("stream transport closed");
|
|
5814
|
+
};
|
|
5815
|
+
} catch (error) {
|
|
5816
|
+
reject(error);
|
|
5817
|
+
}
|
|
5818
|
+
});
|
|
5819
|
+
}
|
|
5820
|
+
async close() {
|
|
5821
|
+
if (!this.socket) {
|
|
5822
|
+
return;
|
|
5823
|
+
}
|
|
5824
|
+
this.socket.close();
|
|
5825
|
+
this.socket = null;
|
|
5826
|
+
this.rejectAllPending("stream transport closed by caller");
|
|
5827
|
+
}
|
|
5828
|
+
async sendRequest(request) {
|
|
5829
|
+
if (!this.socket || this.socket.readyState !== WebSocket.OPEN) {
|
|
5830
|
+
return {
|
|
5831
|
+
requestId: request.requestId,
|
|
5832
|
+
success: false,
|
|
5833
|
+
error: "stream transport not connected"
|
|
5834
|
+
};
|
|
5835
|
+
}
|
|
5836
|
+
const timeoutMs = request.timeoutMs ?? this.defaultTimeoutMs;
|
|
5837
|
+
return new Promise((resolve, reject) => {
|
|
5838
|
+
const timer = setTimeout(() => {
|
|
5839
|
+
this.pending.delete(request.requestId);
|
|
5840
|
+
resolve({
|
|
5841
|
+
requestId: request.requestId,
|
|
5842
|
+
success: false,
|
|
5843
|
+
error: `stream request timeout after ${timeoutMs}ms`
|
|
5844
|
+
});
|
|
5845
|
+
}, timeoutMs);
|
|
5846
|
+
this.pending.set(request.requestId, { resolve, reject, timer });
|
|
5847
|
+
this.socket?.send(JSON.stringify(request));
|
|
5848
|
+
});
|
|
5849
|
+
}
|
|
5850
|
+
async health() {
|
|
5851
|
+
const connected = Boolean(this.socket && this.socket.readyState === WebSocket.OPEN);
|
|
5852
|
+
return {
|
|
5853
|
+
ok: connected,
|
|
5854
|
+
detail: connected ? "stream connected" : "stream not connected"
|
|
5700
5855
|
};
|
|
5701
|
-
} catch (error) {
|
|
5702
|
-
reject(error);
|
|
5703
5856
|
}
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
this.pending.delete(request.requestId);
|
|
5726
|
-
resolve({
|
|
5727
|
-
requestId: request.requestId,
|
|
5728
|
-
success: false,
|
|
5729
|
-
error: `stream request timeout after ${timeoutMs}ms`
|
|
5857
|
+
onMessage(raw) {
|
|
5858
|
+
let parsed = null;
|
|
5859
|
+
try {
|
|
5860
|
+
parsed = JSON.parse(String(raw));
|
|
5861
|
+
} catch {
|
|
5862
|
+
return;
|
|
5863
|
+
}
|
|
5864
|
+
if (!parsed?.requestId) {
|
|
5865
|
+
return;
|
|
5866
|
+
}
|
|
5867
|
+
const pending = this.pending.get(parsed.requestId);
|
|
5868
|
+
if (!pending) {
|
|
5869
|
+
return;
|
|
5870
|
+
}
|
|
5871
|
+
clearTimeout(pending.timer);
|
|
5872
|
+
this.pending.delete(parsed.requestId);
|
|
5873
|
+
pending.resolve({
|
|
5874
|
+
requestId: parsed.requestId,
|
|
5875
|
+
success: Boolean(parsed.success),
|
|
5876
|
+
payload: parsed.payload,
|
|
5877
|
+
error: parsed.error
|
|
5730
5878
|
});
|
|
5731
|
-
}
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
ok: connected,
|
|
5740
|
-
detail: connected ? "stream connected" : "stream not connected"
|
|
5879
|
+
}
|
|
5880
|
+
rejectAllPending(message) {
|
|
5881
|
+
for (const [requestId, pending] of this.pending) {
|
|
5882
|
+
clearTimeout(pending.timer);
|
|
5883
|
+
pending.resolve({ requestId, success: false, error: message });
|
|
5884
|
+
}
|
|
5885
|
+
this.pending.clear();
|
|
5886
|
+
}
|
|
5741
5887
|
};
|
|
5742
5888
|
}
|
|
5743
|
-
|
|
5744
|
-
let parsed = null;
|
|
5745
|
-
try {
|
|
5746
|
-
parsed = JSON.parse(String(raw));
|
|
5747
|
-
} catch {
|
|
5748
|
-
return;
|
|
5749
|
-
}
|
|
5750
|
-
if (!parsed?.requestId) {
|
|
5751
|
-
return;
|
|
5752
|
-
}
|
|
5753
|
-
const pending = this.pending.get(parsed.requestId);
|
|
5754
|
-
if (!pending) {
|
|
5755
|
-
return;
|
|
5756
|
-
}
|
|
5757
|
-
clearTimeout(pending.timer);
|
|
5758
|
-
this.pending.delete(parsed.requestId);
|
|
5759
|
-
pending.resolve({
|
|
5760
|
-
requestId: parsed.requestId,
|
|
5761
|
-
success: Boolean(parsed.success),
|
|
5762
|
-
payload: parsed.payload,
|
|
5763
|
-
error: parsed.error
|
|
5764
|
-
});
|
|
5765
|
-
}
|
|
5766
|
-
rejectAllPending(message) {
|
|
5767
|
-
for (const [requestId, pending] of this.pending) {
|
|
5768
|
-
clearTimeout(pending.timer);
|
|
5769
|
-
pending.resolve({ requestId, success: false, error: message });
|
|
5770
|
-
}
|
|
5771
|
-
this.pending.clear();
|
|
5772
|
-
}
|
|
5773
|
-
};
|
|
5889
|
+
});
|
|
5774
5890
|
|
|
5775
5891
|
// ../ada-agent/dist/transport-client.js
|
|
5776
5892
|
function joinUrl(base, suffix) {
|
|
@@ -5810,36 +5926,6 @@ function toCommandResult(command, response) {
|
|
|
5810
5926
|
data: payload
|
|
5811
5927
|
};
|
|
5812
5928
|
}
|
|
5813
|
-
var TransportExecutor = class {
|
|
5814
|
-
transport;
|
|
5815
|
-
mode;
|
|
5816
|
-
constructor(transport, mode) {
|
|
5817
|
-
this.transport = transport;
|
|
5818
|
-
this.mode = mode;
|
|
5819
|
-
}
|
|
5820
|
-
async execute(command) {
|
|
5821
|
-
const response = await this.transport.sendRequest({
|
|
5822
|
-
requestId: command.requestId,
|
|
5823
|
-
sessionId: command.sessionId,
|
|
5824
|
-
action: "ada_execute",
|
|
5825
|
-
payload: { command }
|
|
5826
|
-
});
|
|
5827
|
-
const result = toCommandResult(command, response);
|
|
5828
|
-
log("info", {
|
|
5829
|
-
event: "transport.command.executed",
|
|
5830
|
-
details: {
|
|
5831
|
-
mode: this.mode,
|
|
5832
|
-
requestId: command.requestId,
|
|
5833
|
-
success: result.success,
|
|
5834
|
-
errorCode: result.errorCode
|
|
5835
|
-
}
|
|
5836
|
-
});
|
|
5837
|
-
return result;
|
|
5838
|
-
}
|
|
5839
|
-
async close() {
|
|
5840
|
-
await this.transport.close();
|
|
5841
|
-
}
|
|
5842
|
-
};
|
|
5843
5929
|
async function tryCreateHttpTransport(config, secret) {
|
|
5844
5930
|
const transport = new HttpTransport({
|
|
5845
5931
|
baseUrl: secret.serverUrl,
|
|
@@ -5898,44 +5984,50 @@ async function createRuntimeTransport(config, secret) {
|
|
|
5898
5984
|
return tryCreateHttpTransport(config, secret);
|
|
5899
5985
|
}
|
|
5900
5986
|
}
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5987
|
+
var TransportExecutor;
|
|
5988
|
+
var init_transport_client = __esm({
|
|
5989
|
+
"../ada-agent/dist/transport-client.js"() {
|
|
5990
|
+
"use strict";
|
|
5991
|
+
init_src5();
|
|
5992
|
+
init_src6();
|
|
5993
|
+
init_logger();
|
|
5994
|
+
TransportExecutor = class {
|
|
5995
|
+
transport;
|
|
5996
|
+
mode;
|
|
5997
|
+
constructor(transport, mode) {
|
|
5998
|
+
this.transport = transport;
|
|
5999
|
+
this.mode = mode;
|
|
6000
|
+
}
|
|
6001
|
+
async execute(command) {
|
|
6002
|
+
const response = await this.transport.sendRequest({
|
|
6003
|
+
requestId: command.requestId,
|
|
6004
|
+
sessionId: command.sessionId,
|
|
6005
|
+
action: "ada_execute",
|
|
6006
|
+
payload: { command }
|
|
6007
|
+
});
|
|
6008
|
+
const result = toCommandResult(command, response);
|
|
6009
|
+
log("info", {
|
|
6010
|
+
event: "transport.command.executed",
|
|
6011
|
+
details: {
|
|
6012
|
+
mode: this.mode,
|
|
6013
|
+
requestId: command.requestId,
|
|
6014
|
+
success: result.success,
|
|
6015
|
+
errorCode: result.errorCode
|
|
6016
|
+
}
|
|
6017
|
+
});
|
|
6018
|
+
return result;
|
|
6019
|
+
}
|
|
6020
|
+
async close() {
|
|
6021
|
+
await this.transport.close();
|
|
6022
|
+
}
|
|
6023
|
+
};
|
|
6024
|
+
}
|
|
6025
|
+
});
|
|
5905
6026
|
|
|
5906
6027
|
// ../ada-agent/dist/task-loader.js
|
|
5907
|
-
var import_promises8 = __toESM(require("node:fs/promises"), 1);
|
|
5908
6028
|
function isObject3(value) {
|
|
5909
6029
|
return typeof value === "object" && value !== null;
|
|
5910
6030
|
}
|
|
5911
|
-
var allowedCommands = /* @__PURE__ */ new Set([
|
|
5912
|
-
"click",
|
|
5913
|
-
"type",
|
|
5914
|
-
"swipe",
|
|
5915
|
-
"assertVisible",
|
|
5916
|
-
"screenshot",
|
|
5917
|
-
"navigate",
|
|
5918
|
-
"hover",
|
|
5919
|
-
"press",
|
|
5920
|
-
"select",
|
|
5921
|
-
"scroll",
|
|
5922
|
-
"wait",
|
|
5923
|
-
"assertText",
|
|
5924
|
-
"getText",
|
|
5925
|
-
"back",
|
|
5926
|
-
"home",
|
|
5927
|
-
"launchApp",
|
|
5928
|
-
"terminateApp",
|
|
5929
|
-
"custom",
|
|
5930
|
-
"invoke",
|
|
5931
|
-
"forward",
|
|
5932
|
-
"newTab",
|
|
5933
|
-
"switchTab",
|
|
5934
|
-
"uploadFile",
|
|
5935
|
-
"dragDrop",
|
|
5936
|
-
"reload",
|
|
5937
|
-
"closeTab"
|
|
5938
|
-
]);
|
|
5939
6031
|
function assertTask(value, index) {
|
|
5940
6032
|
if (!isObject3(value)) {
|
|
5941
6033
|
throw new Error(`Task[${index}] is not an object.`);
|
|
@@ -5970,253 +6062,292 @@ async function loadTaskFile(filePath) {
|
|
|
5970
6062
|
}
|
|
5971
6063
|
return parsed.map((item, idx) => assertTask(item, idx));
|
|
5972
6064
|
}
|
|
6065
|
+
var import_promises8, allowedCommands;
|
|
6066
|
+
var init_task_loader = __esm({
|
|
6067
|
+
"../ada-agent/dist/task-loader.js"() {
|
|
6068
|
+
"use strict";
|
|
6069
|
+
import_promises8 = __toESM(require("node:fs/promises"), 1);
|
|
6070
|
+
allowedCommands = /* @__PURE__ */ new Set([
|
|
6071
|
+
"click",
|
|
6072
|
+
"type",
|
|
6073
|
+
"swipe",
|
|
6074
|
+
"assertVisible",
|
|
6075
|
+
"screenshot",
|
|
6076
|
+
"navigate",
|
|
6077
|
+
"hover",
|
|
6078
|
+
"press",
|
|
6079
|
+
"select",
|
|
6080
|
+
"scroll",
|
|
6081
|
+
"wait",
|
|
6082
|
+
"assertText",
|
|
6083
|
+
"getText",
|
|
6084
|
+
"back",
|
|
6085
|
+
"home",
|
|
6086
|
+
"launchApp",
|
|
6087
|
+
"terminateApp",
|
|
6088
|
+
"custom",
|
|
6089
|
+
"invoke",
|
|
6090
|
+
"forward",
|
|
6091
|
+
"newTab",
|
|
6092
|
+
"switchTab",
|
|
6093
|
+
"uploadFile",
|
|
6094
|
+
"dragDrop",
|
|
6095
|
+
"reload",
|
|
6096
|
+
"closeTab"
|
|
6097
|
+
]);
|
|
6098
|
+
}
|
|
6099
|
+
});
|
|
5973
6100
|
|
|
5974
6101
|
// ../../packages/core-kernel/src/index.ts
|
|
5975
|
-
var DriverSessionManager
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
return existed;
|
|
5989
|
-
}
|
|
5990
|
-
const created = await plugin.createSession(command.platform);
|
|
5991
|
-
this.sessions.set(key, created);
|
|
5992
|
-
return created;
|
|
5993
|
-
}
|
|
5994
|
-
get(command) {
|
|
5995
|
-
const key = this.sessionKey(command);
|
|
5996
|
-
return this.sessions.get(key);
|
|
5997
|
-
}
|
|
5998
|
-
list() {
|
|
5999
|
-
const items = [];
|
|
6000
|
-
for (const [key, session] of this.sessions.entries()) {
|
|
6001
|
-
const parts = key.split(":");
|
|
6002
|
-
if (parts[0] === "web" && parts.length >= 3) {
|
|
6003
|
-
items.push({
|
|
6004
|
-
platform: "web",
|
|
6005
|
-
engine: parts[1],
|
|
6006
|
-
sessionId: parts.slice(2).join(":"),
|
|
6007
|
-
driverSessionId: session.id
|
|
6008
|
-
});
|
|
6009
|
-
continue;
|
|
6102
|
+
var DriverSessionManager, RetryPolicyEngine, ResultAssembler, FeatureNegotiator, TaskExecutor;
|
|
6103
|
+
var init_src7 = __esm({
|
|
6104
|
+
"../../packages/core-kernel/src/index.ts"() {
|
|
6105
|
+
"use strict";
|
|
6106
|
+
init_src3();
|
|
6107
|
+
DriverSessionManager = class {
|
|
6108
|
+
sessions = /* @__PURE__ */ new Map();
|
|
6109
|
+
sessionKey(command) {
|
|
6110
|
+
if (command.platform === "web") {
|
|
6111
|
+
const engine = parseWebEngineFromPayload(command.payload);
|
|
6112
|
+
return `web:${engine}:${command.sessionId}`;
|
|
6113
|
+
}
|
|
6114
|
+
return `${command.platform}:${command.sessionId}`;
|
|
6010
6115
|
}
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6116
|
+
async getOrCreate(plugin, command) {
|
|
6117
|
+
const key = this.sessionKey(command);
|
|
6118
|
+
const existed = this.sessions.get(key);
|
|
6119
|
+
if (existed) {
|
|
6120
|
+
return existed;
|
|
6121
|
+
}
|
|
6122
|
+
const created = await plugin.createSession(command.platform);
|
|
6123
|
+
this.sessions.set(key, created);
|
|
6124
|
+
return created;
|
|
6125
|
+
}
|
|
6126
|
+
get(command) {
|
|
6127
|
+
const key = this.sessionKey(command);
|
|
6128
|
+
return this.sessions.get(key);
|
|
6129
|
+
}
|
|
6130
|
+
list() {
|
|
6131
|
+
const items = [];
|
|
6132
|
+
for (const [key, session] of this.sessions.entries()) {
|
|
6133
|
+
const parts = key.split(":");
|
|
6134
|
+
if (parts[0] === "web" && parts.length >= 3) {
|
|
6135
|
+
items.push({
|
|
6136
|
+
platform: "web",
|
|
6137
|
+
engine: parts[1],
|
|
6138
|
+
sessionId: parts.slice(2).join(":"),
|
|
6139
|
+
driverSessionId: session.id
|
|
6140
|
+
});
|
|
6141
|
+
continue;
|
|
6142
|
+
}
|
|
6143
|
+
const idx = key.indexOf(":");
|
|
6144
|
+
if (idx <= 0) {
|
|
6145
|
+
continue;
|
|
6146
|
+
}
|
|
6147
|
+
items.push({
|
|
6148
|
+
platform: key.slice(0, idx),
|
|
6149
|
+
sessionId: key.slice(idx + 1),
|
|
6150
|
+
driverSessionId: session.id
|
|
6151
|
+
});
|
|
6152
|
+
}
|
|
6153
|
+
return items;
|
|
6154
|
+
}
|
|
6155
|
+
clear(command) {
|
|
6156
|
+
const key = this.sessionKey(command);
|
|
6157
|
+
const existed = this.sessions.get(key);
|
|
6158
|
+
this.sessions.delete(key);
|
|
6159
|
+
return existed;
|
|
6160
|
+
}
|
|
6161
|
+
clearByPlatformSession(platform, sessionId, options) {
|
|
6162
|
+
if (platform === "web") {
|
|
6163
|
+
const engine = options?.engine ?? parseWebEngineFromPayload(options?.payload);
|
|
6164
|
+
const key2 = `web:${engine}:${sessionId}`;
|
|
6165
|
+
const existed2 = this.sessions.get(key2);
|
|
6166
|
+
this.sessions.delete(key2);
|
|
6167
|
+
return existed2;
|
|
6168
|
+
}
|
|
6169
|
+
const key = `${platform}:${sessionId}`;
|
|
6170
|
+
const existed = this.sessions.get(key);
|
|
6171
|
+
this.sessions.delete(key);
|
|
6172
|
+
return existed;
|
|
6173
|
+
}
|
|
6174
|
+
clearWebSession(sessionId, engine) {
|
|
6175
|
+
const key = `web:${engine}:${sessionId}`;
|
|
6176
|
+
const existed = this.sessions.get(key);
|
|
6177
|
+
this.sessions.delete(key);
|
|
6178
|
+
return existed;
|
|
6179
|
+
}
|
|
6180
|
+
clearAll() {
|
|
6181
|
+
const all = Array.from(this.sessions.values());
|
|
6182
|
+
this.sessions.clear();
|
|
6183
|
+
return all;
|
|
6014
6184
|
}
|
|
6015
|
-
items.push({
|
|
6016
|
-
platform: key.slice(0, idx),
|
|
6017
|
-
sessionId: key.slice(idx + 1),
|
|
6018
|
-
driverSessionId: session.id
|
|
6019
|
-
});
|
|
6020
|
-
}
|
|
6021
|
-
return items;
|
|
6022
|
-
}
|
|
6023
|
-
clear(command) {
|
|
6024
|
-
const key = this.sessionKey(command);
|
|
6025
|
-
const existed = this.sessions.get(key);
|
|
6026
|
-
this.sessions.delete(key);
|
|
6027
|
-
return existed;
|
|
6028
|
-
}
|
|
6029
|
-
clearByPlatformSession(platform, sessionId, options) {
|
|
6030
|
-
if (platform === "web") {
|
|
6031
|
-
const engine = options?.engine ?? parseWebEngineFromPayload(options?.payload);
|
|
6032
|
-
const key2 = `web:${engine}:${sessionId}`;
|
|
6033
|
-
const existed2 = this.sessions.get(key2);
|
|
6034
|
-
this.sessions.delete(key2);
|
|
6035
|
-
return existed2;
|
|
6036
|
-
}
|
|
6037
|
-
const key = `${platform}:${sessionId}`;
|
|
6038
|
-
const existed = this.sessions.get(key);
|
|
6039
|
-
this.sessions.delete(key);
|
|
6040
|
-
return existed;
|
|
6041
|
-
}
|
|
6042
|
-
clearWebSession(sessionId, engine) {
|
|
6043
|
-
const key = `web:${engine}:${sessionId}`;
|
|
6044
|
-
const existed = this.sessions.get(key);
|
|
6045
|
-
this.sessions.delete(key);
|
|
6046
|
-
return existed;
|
|
6047
|
-
}
|
|
6048
|
-
clearAll() {
|
|
6049
|
-
const all = Array.from(this.sessions.values());
|
|
6050
|
-
this.sessions.clear();
|
|
6051
|
-
return all;
|
|
6052
|
-
}
|
|
6053
|
-
};
|
|
6054
|
-
var RetryPolicyEngine = class {
|
|
6055
|
-
constructor(maxAttempts, retryableErrorCodes) {
|
|
6056
|
-
this.maxAttempts = maxAttempts;
|
|
6057
|
-
this.retryableErrorCodes = retryableErrorCodes;
|
|
6058
|
-
}
|
|
6059
|
-
shouldRetry(result, attempt) {
|
|
6060
|
-
if (attempt >= this.maxAttempts) {
|
|
6061
|
-
return false;
|
|
6062
|
-
}
|
|
6063
|
-
if (result.success) {
|
|
6064
|
-
return false;
|
|
6065
|
-
}
|
|
6066
|
-
if (!result.errorCode) {
|
|
6067
|
-
return true;
|
|
6068
|
-
}
|
|
6069
|
-
return this.retryableErrorCodes.has(result.errorCode);
|
|
6070
|
-
}
|
|
6071
|
-
};
|
|
6072
|
-
var ResultAssembler = class {
|
|
6073
|
-
success(requestId, data) {
|
|
6074
|
-
return {
|
|
6075
|
-
requestId,
|
|
6076
|
-
success: true,
|
|
6077
|
-
data
|
|
6078
6185
|
};
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6186
|
+
RetryPolicyEngine = class {
|
|
6187
|
+
constructor(maxAttempts, retryableErrorCodes) {
|
|
6188
|
+
this.maxAttempts = maxAttempts;
|
|
6189
|
+
this.retryableErrorCodes = retryableErrorCodes;
|
|
6190
|
+
}
|
|
6191
|
+
shouldRetry(result, attempt) {
|
|
6192
|
+
if (attempt >= this.maxAttempts) {
|
|
6193
|
+
return false;
|
|
6194
|
+
}
|
|
6195
|
+
if (result.success) {
|
|
6196
|
+
return false;
|
|
6197
|
+
}
|
|
6198
|
+
if (!result.errorCode) {
|
|
6199
|
+
return true;
|
|
6200
|
+
}
|
|
6201
|
+
return this.retryableErrorCodes.has(result.errorCode);
|
|
6202
|
+
}
|
|
6086
6203
|
};
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6204
|
+
ResultAssembler = class {
|
|
6205
|
+
success(requestId, data) {
|
|
6206
|
+
return {
|
|
6207
|
+
requestId,
|
|
6208
|
+
success: true,
|
|
6209
|
+
data
|
|
6210
|
+
};
|
|
6211
|
+
}
|
|
6212
|
+
failure(requestId, errorCode, errorMessage) {
|
|
6213
|
+
return {
|
|
6214
|
+
requestId,
|
|
6215
|
+
success: false,
|
|
6216
|
+
errorCode,
|
|
6217
|
+
errorMessage
|
|
6218
|
+
};
|
|
6219
|
+
}
|
|
6220
|
+
normalize(requestId, result) {
|
|
6221
|
+
return {
|
|
6222
|
+
requestId,
|
|
6223
|
+
success: Boolean(result.success),
|
|
6224
|
+
data: result.data,
|
|
6225
|
+
errorCode: result.errorCode,
|
|
6226
|
+
errorMessage: result.errorMessage
|
|
6227
|
+
};
|
|
6228
|
+
}
|
|
6095
6229
|
};
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6230
|
+
FeatureNegotiator = class {
|
|
6231
|
+
normalize(command) {
|
|
6232
|
+
if (command === "click") {
|
|
6233
|
+
return "tap";
|
|
6234
|
+
}
|
|
6235
|
+
return command;
|
|
6236
|
+
}
|
|
6237
|
+
check(plugin, command) {
|
|
6238
|
+
const expected = this.normalize(command.command);
|
|
6239
|
+
const declared = new Set(plugin.manifest.capabilities.map((item) => this.normalize(item)));
|
|
6240
|
+
if (declared.has(expected)) {
|
|
6241
|
+
return { ok: true };
|
|
6242
|
+
}
|
|
6243
|
+
return {
|
|
6244
|
+
ok: false,
|
|
6245
|
+
code: "DRIVER_CAPABILITY_UNSUPPORTED",
|
|
6246
|
+
message: `Plugin ${plugin.manifest.id} does not support command ${command.command} on platform ${command.platform}`
|
|
6247
|
+
};
|
|
6248
|
+
}
|
|
6115
6249
|
};
|
|
6116
|
-
|
|
6117
|
-
}
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6250
|
+
TaskExecutor = class {
|
|
6251
|
+
constructor(pluginHost, options = {}) {
|
|
6252
|
+
this.pluginHost = pluginHost;
|
|
6253
|
+
this.maxAttempts = Math.max(1, options.maxAttempts ?? 2);
|
|
6254
|
+
this.retry = new RetryPolicyEngine(
|
|
6255
|
+
this.maxAttempts,
|
|
6256
|
+
new Set(options.retryableErrorCodes ?? ["TRANSIENT_DRIVER_ERROR", "NETWORK_TIMEOUT"])
|
|
6257
|
+
);
|
|
6258
|
+
}
|
|
6259
|
+
retry;
|
|
6260
|
+
maxAttempts;
|
|
6261
|
+
sessions = new DriverSessionManager();
|
|
6262
|
+
resultAssembler = new ResultAssembler();
|
|
6263
|
+
featureNegotiator = new FeatureNegotiator();
|
|
6264
|
+
async resolveContext(command) {
|
|
6265
|
+
const plugin = this.pluginHost.resolve(command);
|
|
6266
|
+
await this.pluginHost.ensureInitialized(plugin.manifest.id);
|
|
6267
|
+
const session = await this.sessions.getOrCreate(plugin, command);
|
|
6268
|
+
return { plugin, session };
|
|
6269
|
+
}
|
|
6270
|
+
async execute(command) {
|
|
6271
|
+
let attempt = 0;
|
|
6272
|
+
let lastFailure = this.resultAssembler.failure(command.requestId, "KERNEL_EXECUTION_FAILED", "unknown error");
|
|
6273
|
+
while (attempt < this.maxAttempts) {
|
|
6274
|
+
attempt += 1;
|
|
6275
|
+
try {
|
|
6276
|
+
const context = await this.resolveContext(command);
|
|
6277
|
+
const feature = this.featureNegotiator.check(context.plugin, command);
|
|
6278
|
+
if (!feature.ok) {
|
|
6279
|
+
return this.resultAssembler.failure(command.requestId, feature.code, feature.message);
|
|
6280
|
+
}
|
|
6281
|
+
const result = await context.plugin.execute(context.session, command);
|
|
6282
|
+
const normalized = this.resultAssembler.normalize(command.requestId, result);
|
|
6283
|
+
if (this.retry.shouldRetry(normalized, attempt)) {
|
|
6284
|
+
this.sessions.clear(command);
|
|
6285
|
+
lastFailure = normalized;
|
|
6286
|
+
continue;
|
|
6287
|
+
}
|
|
6288
|
+
return normalized;
|
|
6289
|
+
} catch (error) {
|
|
6290
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6291
|
+
const failed = this.resultAssembler.failure(command.requestId, "KERNEL_EXECUTION_FAILED", message);
|
|
6292
|
+
if (this.retry.shouldRetry(failed, attempt)) {
|
|
6293
|
+
this.sessions.clear(command);
|
|
6294
|
+
lastFailure = failed;
|
|
6295
|
+
continue;
|
|
6296
|
+
}
|
|
6297
|
+
return failed;
|
|
6298
|
+
}
|
|
6148
6299
|
}
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6300
|
+
return lastFailure;
|
|
6301
|
+
}
|
|
6302
|
+
listSessions() {
|
|
6303
|
+
return this.sessions.list();
|
|
6304
|
+
}
|
|
6305
|
+
async closeSession(platform, sessionId, options) {
|
|
6306
|
+
const plat = platform;
|
|
6307
|
+
const engine = plat === "web" ? options?.engine ?? parseWebEngineFromPayload(options?.payload) : void 0;
|
|
6308
|
+
const plugin = plat === "web" ? this.pluginHost.resolve({
|
|
6309
|
+
requestId: "",
|
|
6310
|
+
sessionId,
|
|
6311
|
+
platform: "web",
|
|
6312
|
+
command: "navigate",
|
|
6313
|
+
payload: { engine, ...options?.payload }
|
|
6314
|
+
}) : this.pluginHost.resolve({
|
|
6315
|
+
requestId: "",
|
|
6316
|
+
sessionId,
|
|
6317
|
+
platform: plat,
|
|
6318
|
+
command: "navigate"
|
|
6319
|
+
});
|
|
6320
|
+
const session = this.sessions.clearByPlatformSession(platform, sessionId, {
|
|
6321
|
+
engine,
|
|
6322
|
+
payload: options?.payload
|
|
6323
|
+
});
|
|
6324
|
+
if (!session) {
|
|
6325
|
+
return false;
|
|
6155
6326
|
}
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
6159
|
-
const failed = this.resultAssembler.failure(command.requestId, "KERNEL_EXECUTION_FAILED", message);
|
|
6160
|
-
if (this.retry.shouldRetry(failed, attempt)) {
|
|
6161
|
-
this.sessions.clear(command);
|
|
6162
|
-
lastFailure = failed;
|
|
6163
|
-
continue;
|
|
6327
|
+
if (plugin.destroySession) {
|
|
6328
|
+
await plugin.destroySession(session);
|
|
6164
6329
|
}
|
|
6165
|
-
return
|
|
6330
|
+
return true;
|
|
6166
6331
|
}
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
command: "navigate",
|
|
6181
|
-
payload: { engine, ...options?.payload }
|
|
6182
|
-
}) : this.pluginHost.resolve({
|
|
6183
|
-
requestId: "",
|
|
6184
|
-
sessionId,
|
|
6185
|
-
platform: plat,
|
|
6186
|
-
command: "navigate"
|
|
6187
|
-
});
|
|
6188
|
-
const session = this.sessions.clearByPlatformSession(platform, sessionId, {
|
|
6189
|
-
engine,
|
|
6190
|
-
payload: options?.payload
|
|
6191
|
-
});
|
|
6192
|
-
if (!session) {
|
|
6193
|
-
return false;
|
|
6194
|
-
}
|
|
6195
|
-
if (plugin.destroySession) {
|
|
6196
|
-
await plugin.destroySession(session);
|
|
6197
|
-
}
|
|
6198
|
-
return true;
|
|
6199
|
-
}
|
|
6200
|
-
async closeAllSessions() {
|
|
6201
|
-
const all = this.sessions.list();
|
|
6202
|
-
let closed = 0;
|
|
6203
|
-
for (const item of all) {
|
|
6204
|
-
const ok = await this.closeSession(item.platform, item.sessionId, {
|
|
6205
|
-
engine: item.engine,
|
|
6206
|
-
payload: item.engine ? { engine: item.engine } : void 0
|
|
6207
|
-
});
|
|
6208
|
-
if (ok) {
|
|
6209
|
-
closed += 1;
|
|
6332
|
+
async closeAllSessions() {
|
|
6333
|
+
const all = this.sessions.list();
|
|
6334
|
+
let closed = 0;
|
|
6335
|
+
for (const item of all) {
|
|
6336
|
+
const ok = await this.closeSession(item.platform, item.sessionId, {
|
|
6337
|
+
engine: item.engine,
|
|
6338
|
+
payload: item.engine ? { engine: item.engine } : void 0
|
|
6339
|
+
});
|
|
6340
|
+
if (ok) {
|
|
6341
|
+
closed += 1;
|
|
6342
|
+
}
|
|
6343
|
+
}
|
|
6344
|
+
return closed;
|
|
6210
6345
|
}
|
|
6211
|
-
}
|
|
6212
|
-
return closed;
|
|
6346
|
+
};
|
|
6213
6347
|
}
|
|
6214
|
-
};
|
|
6348
|
+
});
|
|
6215
6349
|
|
|
6216
6350
|
// ../ada-agent/dist/monitoring.js
|
|
6217
|
-
var import_promises9 = __toESM(require("node:fs/promises"), 1);
|
|
6218
|
-
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
6219
|
-
var import_jimp = require("jimp");
|
|
6220
6351
|
function shouldMonitorCommand(command, config, index) {
|
|
6221
6352
|
if (!config.monitoring.enabled) {
|
|
6222
6353
|
return false;
|
|
@@ -6307,6 +6438,16 @@ async function captureOperationMonitor(command, result, index, context) {
|
|
|
6307
6438
|
}
|
|
6308
6439
|
});
|
|
6309
6440
|
}
|
|
6441
|
+
var import_promises9, import_node_path8, import_jimp;
|
|
6442
|
+
var init_monitoring = __esm({
|
|
6443
|
+
"../ada-agent/dist/monitoring.js"() {
|
|
6444
|
+
"use strict";
|
|
6445
|
+
import_promises9 = __toESM(require("node:fs/promises"), 1);
|
|
6446
|
+
import_node_path8 = __toESM(require("node:path"), 1);
|
|
6447
|
+
import_jimp = require("jimp");
|
|
6448
|
+
init_logger();
|
|
6449
|
+
}
|
|
6450
|
+
});
|
|
6310
6451
|
|
|
6311
6452
|
// ../ada-agent/dist/runtime.js
|
|
6312
6453
|
async function runTaskset(commands, options = {}) {
|
|
@@ -6366,6 +6507,15 @@ async function runForegroundLoop(skipDemo = false, options = {}) {
|
|
|
6366
6507
|
}
|
|
6367
6508
|
await runDemoTaskset(options);
|
|
6368
6509
|
}
|
|
6510
|
+
var init_runtime = __esm({
|
|
6511
|
+
"../ada-agent/dist/runtime.js"() {
|
|
6512
|
+
"use strict";
|
|
6513
|
+
init_src7();
|
|
6514
|
+
init_plugin_registry();
|
|
6515
|
+
init_logger();
|
|
6516
|
+
init_monitoring();
|
|
6517
|
+
}
|
|
6518
|
+
});
|
|
6369
6519
|
|
|
6370
6520
|
// ../ada-agent/dist/queue-runner.js
|
|
6371
6521
|
async function ensureDirs(config) {
|
|
@@ -6460,6 +6610,17 @@ async function watchQueue(config, shouldStop, options = {}) {
|
|
|
6460
6610
|
}
|
|
6461
6611
|
log("info", { event: "queue.watch.stopped" });
|
|
6462
6612
|
}
|
|
6613
|
+
var import_promises10, import_node_path9;
|
|
6614
|
+
var init_queue_runner = __esm({
|
|
6615
|
+
"../ada-agent/dist/queue-runner.js"() {
|
|
6616
|
+
"use strict";
|
|
6617
|
+
import_promises10 = __toESM(require("node:fs/promises"), 1);
|
|
6618
|
+
import_node_path9 = __toESM(require("node:path"), 1);
|
|
6619
|
+
init_task_loader();
|
|
6620
|
+
init_runtime();
|
|
6621
|
+
init_logger();
|
|
6622
|
+
}
|
|
6623
|
+
});
|
|
6463
6624
|
|
|
6464
6625
|
// ../../packages/agent-core/src/index.ts
|
|
6465
6626
|
async function getHealthSnapshot() {
|
|
@@ -6614,148 +6775,28 @@ async function runStartFlow(options) {
|
|
|
6614
6775
|
await runtimeTransport?.close();
|
|
6615
6776
|
}
|
|
6616
6777
|
}
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
return s === "0" || s === "false" || s === "no" || s === "off" || s === "skip" || s === "none";
|
|
6636
|
-
}
|
|
6637
|
-
function parseInstallDepsSpec(raw) {
|
|
6638
|
-
const trimmed = String(raw ?? "").trim();
|
|
6639
|
-
if (!trimmed) {
|
|
6640
|
-
return ["playwright"];
|
|
6641
|
-
}
|
|
6642
|
-
const lower = trimmed.toLowerCase();
|
|
6643
|
-
if (isFalsy(lower)) {
|
|
6644
|
-
return null;
|
|
6645
|
-
}
|
|
6646
|
-
if (lower === "all") {
|
|
6647
|
-
return ["all"];
|
|
6648
|
-
}
|
|
6649
|
-
const scopes = [];
|
|
6650
|
-
for (const part of lower.split(/[,+\s]+/)) {
|
|
6651
|
-
const token = part.trim();
|
|
6652
|
-
if (!token) continue;
|
|
6653
|
-
if (token === "all") return ["all"];
|
|
6654
|
-
if (INSTALL_SCOPE_TOKENS.has(token)) {
|
|
6655
|
-
scopes.push(token);
|
|
6656
|
-
}
|
|
6657
|
-
}
|
|
6658
|
-
return scopes.length > 0 ? scopes : ["playwright"];
|
|
6659
|
-
}
|
|
6660
|
-
function resolveBootstrapInstallDeps(argv2) {
|
|
6661
|
-
const skipFlag = argv2.includes("--skip-install-deps");
|
|
6662
|
-
const skipEnv = isTruthy(process.env.ADA_MCP_SKIP_INSTALL_DEPS);
|
|
6663
|
-
if (skipFlag || skipEnv) {
|
|
6664
|
-
return { skip: true };
|
|
6665
|
-
}
|
|
6666
|
-
const fromArg = argv2.find((x) => x.startsWith("--install-deps="))?.slice("--install-deps=".length);
|
|
6667
|
-
const fromEnv = process.env.ADA_MCP_INSTALL_DEPS;
|
|
6668
|
-
const spec = fromArg !== void 0 && fromArg.length > 0 ? fromArg : fromEnv;
|
|
6669
|
-
const scopes = parseInstallDepsSpec(spec);
|
|
6670
|
-
if (!scopes) {
|
|
6671
|
-
return { skip: true };
|
|
6672
|
-
}
|
|
6673
|
-
const force = argv2.includes("--install-deps-force") || isTruthy(process.env.ADA_MCP_INSTALL_DEPS_FORCE);
|
|
6674
|
-
const extras = {};
|
|
6675
|
-
const gecko = argv2.find((x) => x.startsWith("--geckodriver-version="))?.slice("--geckodriver-version=".length) ?? process.env.ADA_MCP_GECKODRIVER_VERSION;
|
|
6676
|
-
const chrome = argv2.find((x) => x.startsWith("--chromedriver-version="))?.slice("--chromedriver-version=".length) ?? process.env.ADA_MCP_CHROMEDRIVER_VERSION;
|
|
6677
|
-
const nativeDir = argv2.find((x) => x.startsWith("--native-drivers-dir="))?.slice("--native-drivers-dir=".length) ?? process.env.ADA_MCP_NATIVE_DRIVERS_DIR;
|
|
6678
|
-
if (gecko) extras.geckodriverVersion = gecko;
|
|
6679
|
-
if (chrome) extras.chromedriverVersion = chrome;
|
|
6680
|
-
if (nativeDir) extras.nativeDriversDir = nativeDir;
|
|
6681
|
-
return { skip: false, scopes, force, extras };
|
|
6682
|
-
}
|
|
6683
|
-
var PREINSTALL_PLAYWRIGHT_HOST_ALLOW = /* @__PURE__ */ new Set([
|
|
6684
|
-
"https://cdn.playwright.dev",
|
|
6685
|
-
"https://playwright.azureedge.net"
|
|
6686
|
-
]);
|
|
6687
|
-
function normalizePlaywrightHost(url) {
|
|
6688
|
-
return url.replace(/\/$/, "");
|
|
6689
|
-
}
|
|
6690
|
-
function applyPreinstallPlaywrightHostFile() {
|
|
6691
|
-
if (process.env.PLAYWRIGHT_DOWNLOAD_HOST?.trim()) {
|
|
6692
|
-
return;
|
|
6693
|
-
}
|
|
6694
|
-
const roots = [process.env.INIT_CWD, process.cwd()].filter(
|
|
6695
|
-
(x) => typeof x === "string" && x.trim().length > 0
|
|
6696
|
-
);
|
|
6697
|
-
for (const root of roots) {
|
|
6698
|
-
const file = import_node_path10.default.join(root, ".ada-mcp-playwright-host");
|
|
6699
|
-
try {
|
|
6700
|
-
const host = normalizePlaywrightHost(import_node_fs3.default.readFileSync(file, "utf8").trim());
|
|
6701
|
-
if (host.length > 0 && PREINSTALL_PLAYWRIGHT_HOST_ALLOW.has(host)) {
|
|
6702
|
-
process.env.PLAYWRIGHT_DOWNLOAD_HOST = host;
|
|
6703
|
-
console.error(`[ADA-MCP] using playwright CDN from ${file}: ${host}`);
|
|
6704
|
-
return;
|
|
6705
|
-
}
|
|
6706
|
-
if (host.length > 0) {
|
|
6707
|
-
console.error(
|
|
6708
|
-
`[ADA-MCP] ignore preinstall playwright CDN (runtime will re-probe): ${host}`
|
|
6709
|
-
);
|
|
6710
|
-
return;
|
|
6711
|
-
}
|
|
6712
|
-
} catch {
|
|
6713
|
-
}
|
|
6714
|
-
}
|
|
6715
|
-
}
|
|
6716
|
-
function ensureDefaultInstallTimeouts() {
|
|
6717
|
-
if (!process.env.ADA_INSTALL_STRATEGY_TIMEOUT_MS?.trim()) {
|
|
6718
|
-
process.env.ADA_INSTALL_STRATEGY_TIMEOUT_MS = "120000";
|
|
6719
|
-
}
|
|
6720
|
-
if (!process.env.ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS?.trim()) {
|
|
6721
|
-
process.env.ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS = "900000";
|
|
6722
|
-
}
|
|
6723
|
-
}
|
|
6724
|
-
async function runBootstrapInstallDeps(argv2) {
|
|
6725
|
-
applyPreinstallPlaywrightHostFile();
|
|
6726
|
-
ensureDefaultInstallTimeouts();
|
|
6727
|
-
const plan = resolveBootstrapInstallDeps(argv2);
|
|
6728
|
-
if (plan.skip) {
|
|
6729
|
-
console.error("[ADA-MCP] dependency bootstrap skipped (--skip-install-deps / ADA_MCP_SKIP_INSTALL_DEPS)");
|
|
6730
|
-
return;
|
|
6778
|
+
var init_src8 = __esm({
|
|
6779
|
+
"../../packages/agent-core/src/index.ts"() {
|
|
6780
|
+
"use strict";
|
|
6781
|
+
init_config();
|
|
6782
|
+
init_secrets();
|
|
6783
|
+
init_dependency_installer();
|
|
6784
|
+
init_doctor();
|
|
6785
|
+
init_plugin_registry();
|
|
6786
|
+
init_setup_cli();
|
|
6787
|
+
init_setup_native();
|
|
6788
|
+
init_bootstrap_ui();
|
|
6789
|
+
init_setup_state();
|
|
6790
|
+
init_transport_client();
|
|
6791
|
+
init_src3();
|
|
6792
|
+
init_queue_runner();
|
|
6793
|
+
init_runtime();
|
|
6794
|
+
init_task_loader();
|
|
6795
|
+
init_logger();
|
|
6731
6796
|
}
|
|
6732
|
-
|
|
6733
|
-
console.error(`[ADA-MCP] dependency bootstrap start (scope=${label}, force=${plan.force})`);
|
|
6734
|
-
for (const scope of plan.scopes) {
|
|
6735
|
-
console.error(`[ADA-MCP] installing: ${scope}`);
|
|
6736
|
-
await installDependencies(scope, plan.force, (line) => {
|
|
6737
|
-
console.error(`[ADA-MCP] ${line}`);
|
|
6738
|
-
}, plan.extras);
|
|
6739
|
-
}
|
|
6740
|
-
console.error("[ADA-MCP] dependency bootstrap done");
|
|
6741
|
-
}
|
|
6742
|
-
|
|
6743
|
-
// src/main.ts
|
|
6744
|
-
var import_promises13 = __toESM(require("node:fs/promises"));
|
|
6745
|
-
var import_node_fs5 = require("node:fs");
|
|
6746
|
-
var import_node_net2 = __toESM(require("node:net"));
|
|
6747
|
-
var import_node_path14 = __toESM(require("node:path"));
|
|
6748
|
-
var import_node_child_process5 = require("node:child_process");
|
|
6749
|
-
var import_node_url4 = require("node:url");
|
|
6750
|
-
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
6751
|
-
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6752
|
-
var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
6797
|
+
});
|
|
6753
6798
|
|
|
6754
6799
|
// src/executor.ts
|
|
6755
|
-
var import_node_fs4 = require("node:fs");
|
|
6756
|
-
var import_node_path11 = __toESM(require("node:path"));
|
|
6757
|
-
var import_node_url3 = require("node:url");
|
|
6758
|
-
var import_meta = {};
|
|
6759
6800
|
function ensureBundledPluginDir() {
|
|
6760
6801
|
if (process.env.ADA_PLUGIN_DIR?.trim()) {
|
|
6761
6802
|
return;
|
|
@@ -6783,8 +6824,6 @@ function buildPluginHost2() {
|
|
|
6783
6824
|
registerRuntimePlugins(host);
|
|
6784
6825
|
return host;
|
|
6785
6826
|
}
|
|
6786
|
-
var manifests = registerRuntimePlugins(new PluginHost());
|
|
6787
|
-
var sharedExecutor = new TaskExecutor(buildPluginHost2());
|
|
6788
6827
|
async function runCommand3(command) {
|
|
6789
6828
|
return sharedExecutor.execute(command);
|
|
6790
6829
|
}
|
|
@@ -6804,18 +6843,31 @@ async function closeSession(platform, sessionId, options) {
|
|
|
6804
6843
|
async function closeAllSessions() {
|
|
6805
6844
|
return sharedExecutor.closeAllSessions();
|
|
6806
6845
|
}
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6846
|
+
var import_node_fs4, import_node_path11, import_node_url3, import_meta, manifests, sharedExecutor;
|
|
6847
|
+
var init_executor = __esm({
|
|
6848
|
+
"src/executor.ts"() {
|
|
6849
|
+
"use strict";
|
|
6850
|
+
import_node_fs4 = require("node:fs");
|
|
6851
|
+
import_node_path11 = __toESM(require("node:path"));
|
|
6852
|
+
import_node_url3 = require("node:url");
|
|
6853
|
+
init_src7();
|
|
6854
|
+
init_src4();
|
|
6855
|
+
import_meta = {};
|
|
6856
|
+
manifests = registerRuntimePlugins(new PluginHost());
|
|
6857
|
+
sharedExecutor = new TaskExecutor(buildPluginHost2());
|
|
6858
|
+
}
|
|
6859
|
+
});
|
|
6811
6860
|
|
|
6812
6861
|
// src/bundled-config.generated.ts
|
|
6813
|
-
var bundledDefaultConfigYaml2
|
|
6862
|
+
var bundledDefaultConfigYaml2;
|
|
6863
|
+
var init_bundled_config_generated2 = __esm({
|
|
6864
|
+
"src/bundled-config.generated.ts"() {
|
|
6865
|
+
"use strict";
|
|
6866
|
+
bundledDefaultConfigYaml2 = 'agent:\r\n id: "ada-agent-local"\r\n mode: "foreground"\r\n setupOnFirstRun: true\r\n\r\nbootstrapUI:\r\n enabled: true\r\n mode: "auto" # auto | cli | gui\r\n host: "127.0.0.1"\r\n port: 17650\r\n autoOpenBrowser: true\r\n sessionTtlSec: 600\r\n secretsProvider: "auto" # auto | keychain | credman | file\r\n native:\r\n enabled: false\r\n command: "" # e.g. ./bootstrap-ui / .\\bootstrap-ui.exe\r\n args: []\r\n timeoutMs: 120000\r\n fallbackToWeb: true\r\n\r\ntransport:\r\n mode: "auto"\r\n streamProtocol: "websocket"\r\n requestPath: "/api/v1/execute"\r\n healthPath: "/health"\r\n streamPath: "/ws"\r\n requestTimeoutMs: 15000\r\n\r\ngraphics:\r\n enabled: false\r\n fallbackOnSemanticFailure: false\r\n minConfidence: 0.8\r\n\r\nmonitoring:\r\n enabled: false\r\n platforms: ["web", "android", "ios", "harmony"] # \u53EF\u9009\u5B50\u96C6\r\n sampleEvery: 1 # \u6BCF N \u6761\u64CD\u4F5C\u91C7\u6837\u4E00\u6B21\uFF0C1 \u8868\u793A\u5168\u91CF\r\n outputDir: "artifacts/monitoring"\r\n onFailureOnly: false # true \u65F6\u4EC5\u5931\u8D25\u64CD\u4F5C\u6293\u56FE\uFF0C\u6027\u80FD\u66F4\u4F18\r\n groupBySession: true # \u6309 sessionId/requestId \u5206\u5C42\u5F52\u6863\r\n nonBlocking: true # true \u65F6\u76D1\u63A7\u5F02\u6B65\u6267\u884C\uFF0C\u4E0D\u963B\u585E\u4E3B\u94FE\u8DEF\r\n resolution:\r\n maxWidth: 1280\r\n maxHeight: 720\r\n keepAspectRatio: true # \u4FDD\u6301\u6BD4\u4F8B\uFF0C\u907F\u514D\u76D1\u63A7\u56FE\u50CF\u53D8\u5F62\r\n\r\nqueue:\r\n inboxDir: "tasks/inbox"\r\n processedDir: "tasks/processed"\r\n failedDir: "tasks/failed"\r\n pollIntervalMs: 3000\r\n maxFileRetryAttempts: 2\r\n\r\ndependencies:\r\n autoInstallOnStart: true\r\n playwrightBrowser: "chromium" # chromium | firefox | webkit | all\r\n playwrightInstallTargets: ["chromium"] # chromium | chrome | msedge | firefox | webkit | all\r\n playwrightDownloadHost: "https://cdn.playwright.dev"\r\n # \u56FD\u5185 npm \u955C\u50CF\uFF08\u6309\u4F18\u5148\u7EA7\uFF1Binstall-deps \u542F\u52A8\u65F6\u6D4B\u901F\u9009\u6700\u5FEB\uFF0C\u65E0\u9700\u7528\u6237\u914D\u7F6E\uFF09\r\n npmRegistryCandidates:\r\n - "https://registry.npmmirror.com" # \u963F\u91CC\u4E91 / npmmirror\uFF08\u63A8\u8350\uFF09\r\n - "https://mirrors.cloud.tencent.com/npm" # \u817E\u8BAF\u4E91\r\n - "https://repo.huaweicloud.com/repository/npm" # \u534E\u4E3A\u4E91\r\n - "https://registry.npmjs.org" # \u5B98\u65B9\u515C\u5E95\r\n playwrightHostCandidates:\r\n - "https://cdn.playwright.dev"\r\n - "https://playwright.azureedge.net"\r\n - "https://npmmirror.com/mirrors/playwright"\r\n - "https://cdn.npmmirror.com/binaries/playwright"\r\n # \u539F\u751F WebDriver\uFF08geckodriver / chromedriver\uFF09\u7EDF\u4E00\u653E\u5728\u9879\u76EE dirver \u76EE\u5F55\r\n nativeDriversDir: "dirver"\r\n geckodriverVersion: "latest" # \u5982 0.36.0\uFF1Binstall-deps --only=selenium \u65F6\u4E0B\u8F7D\u5230\u6B64\u76EE\u5F55\r\n chromedriverVersion: "latest" # \u5982 137\u3001135\u3001match-chrome\uFF08\u5339\u914D\u672C\u673A Chrome \u4E3B\u7248\u672C\uFF09\r\n\r\nappium:\r\n serverUrl: "http://127.0.0.1:4723"\r\n requiredDrivers: ["uiautomator2", "xcuitest", "harmonyos"]\r\n';
|
|
6867
|
+
}
|
|
6868
|
+
});
|
|
6814
6869
|
|
|
6815
6870
|
// src/config.ts
|
|
6816
|
-
var DEFAULT_CONFIG_RELATIVE2 = import_node_path12.default.join("config", "default.yaml");
|
|
6817
|
-
var LOCAL_DATA_DIR2 = import_node_path12.default.join(".ada-agent");
|
|
6818
|
-
var EFFECTIVE_CONFIG_FILE2 = import_node_path12.default.join(LOCAL_DATA_DIR2, "agent.config.yaml");
|
|
6819
6871
|
async function resolveWorkspaceRoot4(startDir = process.cwd()) {
|
|
6820
6872
|
return resolveWorkspaceRoot(DEFAULT_CONFIG_RELATIVE2, startDir);
|
|
6821
6873
|
}
|
|
@@ -6839,11 +6891,22 @@ async function loadAgentConfig(cwd = process.cwd()) {
|
|
|
6839
6891
|
return defaultConfig2;
|
|
6840
6892
|
}
|
|
6841
6893
|
}
|
|
6894
|
+
var import_promises11, import_node_path12, DEFAULT_CONFIG_RELATIVE2, LOCAL_DATA_DIR2, EFFECTIVE_CONFIG_FILE2;
|
|
6895
|
+
var init_config2 = __esm({
|
|
6896
|
+
"src/config.ts"() {
|
|
6897
|
+
"use strict";
|
|
6898
|
+
import_promises11 = __toESM(require("node:fs/promises"));
|
|
6899
|
+
import_node_path12 = __toESM(require("node:path"));
|
|
6900
|
+
init_js_yaml();
|
|
6901
|
+
init_src();
|
|
6902
|
+
init_bundled_config_generated2();
|
|
6903
|
+
DEFAULT_CONFIG_RELATIVE2 = import_node_path12.default.join("config", "default.yaml");
|
|
6904
|
+
LOCAL_DATA_DIR2 = import_node_path12.default.join(".ada-agent");
|
|
6905
|
+
EFFECTIVE_CONFIG_FILE2 = import_node_path12.default.join(LOCAL_DATA_DIR2, "agent.config.yaml");
|
|
6906
|
+
}
|
|
6907
|
+
});
|
|
6842
6908
|
|
|
6843
6909
|
// src/monitoring.ts
|
|
6844
|
-
var import_promises12 = __toESM(require("node:fs/promises"));
|
|
6845
|
-
var import_node_path13 = __toESM(require("node:path"));
|
|
6846
|
-
var import_jimp2 = require("jimp");
|
|
6847
6910
|
function getScreenshotPath2(result) {
|
|
6848
6911
|
const value = result.data?.screenshot;
|
|
6849
6912
|
return typeof value === "string" ? value : null;
|
|
@@ -6892,17 +6955,28 @@ async function captureMcpMonitor(command, result, options, runCommand4) {
|
|
|
6892
6955
|
await image.write(targetPath);
|
|
6893
6956
|
return targetPath;
|
|
6894
6957
|
}
|
|
6958
|
+
var import_promises12, import_node_path13, import_jimp2;
|
|
6959
|
+
var init_monitoring2 = __esm({
|
|
6960
|
+
"src/monitoring.ts"() {
|
|
6961
|
+
"use strict";
|
|
6962
|
+
import_promises12 = __toESM(require("node:fs/promises"));
|
|
6963
|
+
import_node_path13 = __toESM(require("node:path"));
|
|
6964
|
+
import_jimp2 = require("jimp");
|
|
6965
|
+
}
|
|
6966
|
+
});
|
|
6895
6967
|
|
|
6896
6968
|
// src/main.ts
|
|
6969
|
+
var main_exports = {};
|
|
6970
|
+
__export(main_exports, {
|
|
6971
|
+
createAdaMcpProtocolServer: () => createAdaMcpProtocolServer,
|
|
6972
|
+
server: () => server,
|
|
6973
|
+
startMcpServer: () => startMcpServer
|
|
6974
|
+
});
|
|
6897
6975
|
function textResult(data) {
|
|
6898
6976
|
return {
|
|
6899
6977
|
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
6900
6978
|
};
|
|
6901
6979
|
}
|
|
6902
|
-
var appiumEnsureJob = null;
|
|
6903
|
-
var persistedHomesCache = null;
|
|
6904
|
-
var appiumReadyCache = null;
|
|
6905
|
-
var APPIUM_READY_CACHE_TTL_MS = 3e3;
|
|
6906
6980
|
function isMobilePlatform(v) {
|
|
6907
6981
|
return v === "android" || v === "ios" || v === "harmony";
|
|
6908
6982
|
}
|
|
@@ -7018,10 +7092,13 @@ function resolveAndroidSdkRoot() {
|
|
|
7018
7092
|
});
|
|
7019
7093
|
const adbPath = (adbLookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
7020
7094
|
const adbSdkRoot = adbPath ? import_node_path14.default.dirname(import_node_path14.default.dirname(adbPath)) : null;
|
|
7095
|
+
const workspaceRoot = process.cwd();
|
|
7096
|
+
const projectAndroidHome = import_node_path14.default.join(workspaceRoot, "ANDROID_HOME");
|
|
7021
7097
|
const candidates = [
|
|
7022
7098
|
process.env.ANDROID_SDK_ROOT,
|
|
7023
7099
|
process.env.ANDROID_HOME,
|
|
7024
7100
|
persisted.androidHome,
|
|
7101
|
+
(0, import_node_fs5.existsSync)(projectAndroidHome) ? projectAndroidHome : null,
|
|
7025
7102
|
adbSdkRoot,
|
|
7026
7103
|
process.env.LOCALAPPDATA ? import_node_path14.default.join(process.env.LOCALAPPDATA, "Android", "Sdk") : null,
|
|
7027
7104
|
process.env.USERPROFILE ? import_node_path14.default.join(process.env.USERPROFILE, "AppData", "Local", "Android", "Sdk") : null
|
|
@@ -7054,10 +7131,11 @@ function hasAppiumDriver(homeDir, driverName) {
|
|
|
7054
7131
|
}
|
|
7055
7132
|
function resolveAppiumHome(platform) {
|
|
7056
7133
|
const persisted = loadPersistedHomes();
|
|
7134
|
+
const projectAppiumHome = import_node_path14.default.join(process.cwd(), "APPIUM_HOME");
|
|
7057
7135
|
const candidates = [
|
|
7058
7136
|
process.env.APPIUM_HOME,
|
|
7059
7137
|
persisted.appiumHome,
|
|
7060
|
-
|
|
7138
|
+
(0, import_node_fs5.existsSync)(projectAppiumHome) ? projectAppiumHome : null,
|
|
7061
7139
|
process.env.USERPROFILE,
|
|
7062
7140
|
process.env.USERPROFILE ? import_node_path14.default.join(process.env.USERPROFILE, ".appium") : null
|
|
7063
7141
|
].map((v) => typeof v === "string" ? v.trim() : "").filter(Boolean);
|
|
@@ -7346,38 +7424,6 @@ function normalizePlatform(v) {
|
|
|
7346
7424
|
}
|
|
7347
7425
|
return "web";
|
|
7348
7426
|
}
|
|
7349
|
-
var supportedCommands = /* @__PURE__ */ new Set([
|
|
7350
|
-
"click",
|
|
7351
|
-
"type",
|
|
7352
|
-
"swipe",
|
|
7353
|
-
"assertVisible",
|
|
7354
|
-
"screenshot",
|
|
7355
|
-
"navigate",
|
|
7356
|
-
"hover",
|
|
7357
|
-
"press",
|
|
7358
|
-
"select",
|
|
7359
|
-
"scroll",
|
|
7360
|
-
"forward",
|
|
7361
|
-
"newTab",
|
|
7362
|
-
"switchTab",
|
|
7363
|
-
"uploadFile",
|
|
7364
|
-
"dragDrop",
|
|
7365
|
-
"wait",
|
|
7366
|
-
"assertText",
|
|
7367
|
-
"getText",
|
|
7368
|
-
"back",
|
|
7369
|
-
"reload",
|
|
7370
|
-
"closeTab",
|
|
7371
|
-
"home",
|
|
7372
|
-
"launchApp",
|
|
7373
|
-
"terminateApp",
|
|
7374
|
-
"custom",
|
|
7375
|
-
"invoke"
|
|
7376
|
-
]);
|
|
7377
|
-
var riskyCommandDefaults = ["custom", "invoke", "launchApp", "terminateApp"];
|
|
7378
|
-
var riskyCommandAllowlist = new Set(
|
|
7379
|
-
(process.env.ADA_MCP_RISKY_COMMAND_WHITELIST ?? riskyCommandDefaults.join(",")).split(",").map((item) => item.trim()).filter(Boolean)
|
|
7380
|
-
);
|
|
7381
7427
|
function normalizeCommand(v) {
|
|
7382
7428
|
if (typeof v === "string" && supportedCommands.has(v)) {
|
|
7383
7429
|
return v;
|
|
@@ -7423,8 +7469,6 @@ function runMonitorCapture(command, result, options) {
|
|
|
7423
7469
|
}
|
|
7424
7470
|
return job;
|
|
7425
7471
|
}
|
|
7426
|
-
var perfStats = /* @__PURE__ */ new Map();
|
|
7427
|
-
var PERF_MAX_SAMPLES_PER_LABEL = 500;
|
|
7428
7472
|
function recordPerf(label, elapsedMs) {
|
|
7429
7473
|
const arr = perfStats.get(label) ?? [];
|
|
7430
7474
|
arr.push(elapsedMs);
|
|
@@ -7544,7 +7588,6 @@ async function loadTaskFile2(taskFilePath) {
|
|
|
7544
7588
|
return toCommandEnvelope(obj);
|
|
7545
7589
|
});
|
|
7546
7590
|
}
|
|
7547
|
-
var shuttingDown = false;
|
|
7548
7591
|
async function gracefulShutdown(reason) {
|
|
7549
7592
|
if (shuttingDown) {
|
|
7550
7593
|
return;
|
|
@@ -8521,7 +8564,6 @@ function createAdaMcpProtocolServer() {
|
|
|
8521
8564
|
wireAdaMcpProtocolServer(instance);
|
|
8522
8565
|
return instance;
|
|
8523
8566
|
}
|
|
8524
|
-
var server = createAdaMcpProtocolServer();
|
|
8525
8567
|
async function startMcpServer() {
|
|
8526
8568
|
const binaryCommand = process.execPath;
|
|
8527
8569
|
const cwd = process.cwd();
|
|
@@ -8587,13 +8629,71 @@ async function startMcpServer() {
|
|
|
8587
8629
|
await server.connect(transport);
|
|
8588
8630
|
console.error("[ADA-MCP] server connected");
|
|
8589
8631
|
}
|
|
8632
|
+
var import_promises13, import_node_fs5, import_node_net2, import_node_path14, import_node_child_process5, import_node_url4, import_server, import_stdio, import_types, appiumEnsureJob, persistedHomesCache, appiumReadyCache, APPIUM_READY_CACHE_TTL_MS, supportedCommands, riskyCommandDefaults, riskyCommandAllowlist, perfStats, PERF_MAX_SAMPLES_PER_LABEL, shuttingDown, server;
|
|
8633
|
+
var init_main = __esm({
|
|
8634
|
+
"src/main.ts"() {
|
|
8635
|
+
"use strict";
|
|
8636
|
+
import_promises13 = __toESM(require("node:fs/promises"));
|
|
8637
|
+
import_node_fs5 = require("node:fs");
|
|
8638
|
+
import_node_net2 = __toESM(require("node:net"));
|
|
8639
|
+
import_node_path14 = __toESM(require("node:path"));
|
|
8640
|
+
import_node_child_process5 = require("node:child_process");
|
|
8641
|
+
import_node_url4 = require("node:url");
|
|
8642
|
+
import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
8643
|
+
import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
8644
|
+
import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
8645
|
+
init_executor();
|
|
8646
|
+
init_config2();
|
|
8647
|
+
init_monitoring2();
|
|
8648
|
+
init_src8();
|
|
8649
|
+
appiumEnsureJob = null;
|
|
8650
|
+
persistedHomesCache = null;
|
|
8651
|
+
appiumReadyCache = null;
|
|
8652
|
+
APPIUM_READY_CACHE_TTL_MS = 3e3;
|
|
8653
|
+
supportedCommands = /* @__PURE__ */ new Set([
|
|
8654
|
+
"click",
|
|
8655
|
+
"type",
|
|
8656
|
+
"swipe",
|
|
8657
|
+
"assertVisible",
|
|
8658
|
+
"screenshot",
|
|
8659
|
+
"navigate",
|
|
8660
|
+
"hover",
|
|
8661
|
+
"press",
|
|
8662
|
+
"select",
|
|
8663
|
+
"scroll",
|
|
8664
|
+
"forward",
|
|
8665
|
+
"newTab",
|
|
8666
|
+
"switchTab",
|
|
8667
|
+
"uploadFile",
|
|
8668
|
+
"dragDrop",
|
|
8669
|
+
"wait",
|
|
8670
|
+
"assertText",
|
|
8671
|
+
"getText",
|
|
8672
|
+
"back",
|
|
8673
|
+
"reload",
|
|
8674
|
+
"closeTab",
|
|
8675
|
+
"home",
|
|
8676
|
+
"launchApp",
|
|
8677
|
+
"terminateApp",
|
|
8678
|
+
"custom",
|
|
8679
|
+
"invoke"
|
|
8680
|
+
]);
|
|
8681
|
+
riskyCommandDefaults = ["custom", "invoke", "launchApp", "terminateApp"];
|
|
8682
|
+
riskyCommandAllowlist = new Set(
|
|
8683
|
+
(process.env.ADA_MCP_RISKY_COMMAND_WHITELIST ?? riskyCommandDefaults.join(",")).split(",").map((item) => item.trim()).filter(Boolean)
|
|
8684
|
+
);
|
|
8685
|
+
perfStats = /* @__PURE__ */ new Map();
|
|
8686
|
+
PERF_MAX_SAMPLES_PER_LABEL = 500;
|
|
8687
|
+
shuttingDown = false;
|
|
8688
|
+
server = createAdaMcpProtocolServer();
|
|
8689
|
+
}
|
|
8690
|
+
});
|
|
8590
8691
|
|
|
8591
8692
|
// src/remote-server.ts
|
|
8592
|
-
var
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
var REMOTE_REQUEST_TIMEOUT_MS = 15e3;
|
|
8693
|
+
var remote_server_exports = {};
|
|
8694
|
+
__export(remote_server_exports, {
|
|
8695
|
+
startRemoteServer: () => startRemoteServer
|
|
8696
|
+
});
|
|
8597
8697
|
function isAuthorizedHeaders(headers, apiKey) {
|
|
8598
8698
|
const key = String(headers["x-api-key"] ?? "");
|
|
8599
8699
|
if (key && key === apiKey) return true;
|
|
@@ -8848,6 +8948,148 @@ async function startRemoteServer(options) {
|
|
|
8848
8948
|
console.error(`[ADA-MCP-REMOTE] listening on http://${options.host}:${options.port}`);
|
|
8849
8949
|
console.error(`[ADA-MCP-REMOTE] MCP Streamable HTTP: POST|GET|DELETE http://${options.host}:${options.port}/mcp (with API key)`);
|
|
8850
8950
|
}
|
|
8951
|
+
var import_node_crypto2, import_express, import_streamableHttp, import_types2, REMOTE_REQUEST_TIMEOUT_MS;
|
|
8952
|
+
var init_remote_server = __esm({
|
|
8953
|
+
"src/remote-server.ts"() {
|
|
8954
|
+
"use strict";
|
|
8955
|
+
import_node_crypto2 = require("node:crypto");
|
|
8956
|
+
init_src8();
|
|
8957
|
+
import_express = require("@modelcontextprotocol/sdk/server/express.js");
|
|
8958
|
+
import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
8959
|
+
import_types2 = require("@modelcontextprotocol/sdk/types.js");
|
|
8960
|
+
init_executor();
|
|
8961
|
+
init_main();
|
|
8962
|
+
REMOTE_REQUEST_TIMEOUT_MS = 15e3;
|
|
8963
|
+
}
|
|
8964
|
+
});
|
|
8965
|
+
|
|
8966
|
+
// src/bootstrap-deps.ts
|
|
8967
|
+
var import_node_fs3 = __toESM(require("node:fs"));
|
|
8968
|
+
var import_node_path10 = __toESM(require("node:path"));
|
|
8969
|
+
init_src8();
|
|
8970
|
+
var INSTALL_SCOPE_TOKENS = /* @__PURE__ */ new Set([
|
|
8971
|
+
"playwright",
|
|
8972
|
+
"selenium",
|
|
8973
|
+
"appium",
|
|
8974
|
+
"drivers",
|
|
8975
|
+
"mobile",
|
|
8976
|
+
"android",
|
|
8977
|
+
"ios",
|
|
8978
|
+
"harmony"
|
|
8979
|
+
]);
|
|
8980
|
+
function isTruthy(v) {
|
|
8981
|
+
const s = String(v ?? "").trim().toLowerCase();
|
|
8982
|
+
return s === "1" || s === "true" || s === "yes" || s === "on";
|
|
8983
|
+
}
|
|
8984
|
+
function isFalsy(v) {
|
|
8985
|
+
const s = String(v ?? "").trim().toLowerCase();
|
|
8986
|
+
return s === "0" || s === "false" || s === "no" || s === "off" || s === "skip" || s === "none";
|
|
8987
|
+
}
|
|
8988
|
+
function parseInstallDepsSpec(raw) {
|
|
8989
|
+
const trimmed = String(raw ?? "").trim();
|
|
8990
|
+
if (!trimmed) {
|
|
8991
|
+
return ["playwright"];
|
|
8992
|
+
}
|
|
8993
|
+
const lower = trimmed.toLowerCase();
|
|
8994
|
+
if (isFalsy(lower)) {
|
|
8995
|
+
return null;
|
|
8996
|
+
}
|
|
8997
|
+
if (lower === "all") {
|
|
8998
|
+
return ["all"];
|
|
8999
|
+
}
|
|
9000
|
+
const scopes = [];
|
|
9001
|
+
for (const part of lower.split(/[,+\s]+/)) {
|
|
9002
|
+
const token = part.trim();
|
|
9003
|
+
if (!token) continue;
|
|
9004
|
+
if (token === "all") return ["all"];
|
|
9005
|
+
if (INSTALL_SCOPE_TOKENS.has(token)) {
|
|
9006
|
+
scopes.push(token);
|
|
9007
|
+
}
|
|
9008
|
+
}
|
|
9009
|
+
return scopes.length > 0 ? scopes : ["playwright"];
|
|
9010
|
+
}
|
|
9011
|
+
function resolveBootstrapInstallDeps(argv2) {
|
|
9012
|
+
const skipFlag = argv2.includes("--skip-install-deps");
|
|
9013
|
+
const skipEnv = isTruthy(process.env.ADA_MCP_SKIP_INSTALL_DEPS);
|
|
9014
|
+
if (skipFlag || skipEnv) {
|
|
9015
|
+
return { skip: true };
|
|
9016
|
+
}
|
|
9017
|
+
const fromArg = argv2.find((x) => x.startsWith("--install-deps="))?.slice("--install-deps=".length);
|
|
9018
|
+
const fromEnv = process.env.ADA_MCP_INSTALL_DEPS;
|
|
9019
|
+
const spec = fromArg !== void 0 && fromArg.length > 0 ? fromArg : fromEnv;
|
|
9020
|
+
const scopes = parseInstallDepsSpec(spec);
|
|
9021
|
+
if (!scopes) {
|
|
9022
|
+
return { skip: true };
|
|
9023
|
+
}
|
|
9024
|
+
const force = argv2.includes("--install-deps-force") || isTruthy(process.env.ADA_MCP_INSTALL_DEPS_FORCE);
|
|
9025
|
+
const extras = {};
|
|
9026
|
+
const gecko = argv2.find((x) => x.startsWith("--geckodriver-version="))?.slice("--geckodriver-version=".length) ?? process.env.ADA_MCP_GECKODRIVER_VERSION;
|
|
9027
|
+
const chrome = argv2.find((x) => x.startsWith("--chromedriver-version="))?.slice("--chromedriver-version=".length) ?? process.env.ADA_MCP_CHROMEDRIVER_VERSION;
|
|
9028
|
+
const nativeDir = argv2.find((x) => x.startsWith("--native-drivers-dir="))?.slice("--native-drivers-dir=".length) ?? process.env.ADA_MCP_NATIVE_DRIVERS_DIR;
|
|
9029
|
+
if (gecko) extras.geckodriverVersion = gecko;
|
|
9030
|
+
if (chrome) extras.chromedriverVersion = chrome;
|
|
9031
|
+
if (nativeDir) extras.nativeDriversDir = nativeDir;
|
|
9032
|
+
return { skip: false, scopes, force, extras };
|
|
9033
|
+
}
|
|
9034
|
+
var PREINSTALL_PLAYWRIGHT_HOST_ALLOW = /* @__PURE__ */ new Set([
|
|
9035
|
+
"https://cdn.playwright.dev",
|
|
9036
|
+
"https://playwright.azureedge.net"
|
|
9037
|
+
]);
|
|
9038
|
+
function normalizePlaywrightHost(url) {
|
|
9039
|
+
return url.replace(/\/$/, "");
|
|
9040
|
+
}
|
|
9041
|
+
function applyPreinstallPlaywrightHostFile() {
|
|
9042
|
+
if (process.env.PLAYWRIGHT_DOWNLOAD_HOST?.trim()) {
|
|
9043
|
+
return;
|
|
9044
|
+
}
|
|
9045
|
+
const roots = [process.env.INIT_CWD, process.cwd()].filter(
|
|
9046
|
+
(x) => typeof x === "string" && x.trim().length > 0
|
|
9047
|
+
);
|
|
9048
|
+
for (const root of roots) {
|
|
9049
|
+
const file = import_node_path10.default.join(root, ".ada-mcp-playwright-host");
|
|
9050
|
+
try {
|
|
9051
|
+
const host = normalizePlaywrightHost(import_node_fs3.default.readFileSync(file, "utf8").trim());
|
|
9052
|
+
if (host.length > 0 && PREINSTALL_PLAYWRIGHT_HOST_ALLOW.has(host)) {
|
|
9053
|
+
process.env.PLAYWRIGHT_DOWNLOAD_HOST = host;
|
|
9054
|
+
console.error(`[ADA-MCP] using playwright CDN from ${file}: ${host}`);
|
|
9055
|
+
return;
|
|
9056
|
+
}
|
|
9057
|
+
if (host.length > 0) {
|
|
9058
|
+
console.error(
|
|
9059
|
+
`[ADA-MCP] ignore preinstall playwright CDN (runtime will re-probe): ${host}`
|
|
9060
|
+
);
|
|
9061
|
+
return;
|
|
9062
|
+
}
|
|
9063
|
+
} catch {
|
|
9064
|
+
}
|
|
9065
|
+
}
|
|
9066
|
+
}
|
|
9067
|
+
function ensureDefaultInstallTimeouts() {
|
|
9068
|
+
if (!process.env.ADA_INSTALL_STRATEGY_TIMEOUT_MS?.trim()) {
|
|
9069
|
+
process.env.ADA_INSTALL_STRATEGY_TIMEOUT_MS = "120000";
|
|
9070
|
+
}
|
|
9071
|
+
if (!process.env.ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS?.trim()) {
|
|
9072
|
+
process.env.ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS = "900000";
|
|
9073
|
+
}
|
|
9074
|
+
}
|
|
9075
|
+
async function runBootstrapInstallDeps(argv2) {
|
|
9076
|
+
applyPreinstallPlaywrightHostFile();
|
|
9077
|
+
ensureDefaultInstallTimeouts();
|
|
9078
|
+
const plan = resolveBootstrapInstallDeps(argv2);
|
|
9079
|
+
if (plan.skip) {
|
|
9080
|
+
console.error("[ADA-MCP] dependency bootstrap skipped (--skip-install-deps / ADA_MCP_SKIP_INSTALL_DEPS)");
|
|
9081
|
+
return;
|
|
9082
|
+
}
|
|
9083
|
+
const label = plan.scopes.join(",");
|
|
9084
|
+
console.error(`[ADA-MCP] dependency bootstrap start (scope=${label}, force=${plan.force})`);
|
|
9085
|
+
for (const scope of plan.scopes) {
|
|
9086
|
+
console.error(`[ADA-MCP] installing: ${scope}`);
|
|
9087
|
+
await installDependencies(scope, plan.force, (line) => {
|
|
9088
|
+
console.error(`[ADA-MCP] ${line}`);
|
|
9089
|
+
}, plan.extras);
|
|
9090
|
+
}
|
|
9091
|
+
console.error("[ADA-MCP] dependency bootstrap done");
|
|
9092
|
+
}
|
|
8851
9093
|
|
|
8852
9094
|
// src/cli.ts
|
|
8853
9095
|
function argValue(name, fallback = "") {
|
|
@@ -8881,7 +9123,8 @@ if (isServerMode) {
|
|
|
8881
9123
|
}
|
|
8882
9124
|
void (async () => {
|
|
8883
9125
|
await runBootstrapInstallDeps(argv);
|
|
8884
|
-
|
|
9126
|
+
const { startRemoteServer: startRemoteServer2 } = await Promise.resolve().then(() => (init_remote_server(), remote_server_exports));
|
|
9127
|
+
await startRemoteServer2({ host, port, apiKey, allowRisky, riskyMode, riskyCommands, allowedHosts });
|
|
8885
9128
|
})().catch((error) => {
|
|
8886
9129
|
console.error(error);
|
|
8887
9130
|
process.exit(1);
|
|
@@ -8889,7 +9132,8 @@ if (isServerMode) {
|
|
|
8889
9132
|
} else {
|
|
8890
9133
|
void (async () => {
|
|
8891
9134
|
await runBootstrapInstallDeps(argv);
|
|
8892
|
-
await
|
|
9135
|
+
const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_main(), main_exports));
|
|
9136
|
+
await startMcpServer2();
|
|
8893
9137
|
})().catch((error) => {
|
|
8894
9138
|
console.error(error);
|
|
8895
9139
|
process.exit(1);
|