@agalmic/contextengine 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -11
- package/dist/contextengine.mjs +929 -270
- package/package.json +1 -1
package/dist/contextengine.mjs
CHANGED
|
@@ -274,27 +274,27 @@ var require_bn = __commonJS({
|
|
|
274
274
|
var total = number.length - start;
|
|
275
275
|
var mod = total % limbLen;
|
|
276
276
|
var end = Math.min(total, total - mod) + start;
|
|
277
|
-
var
|
|
277
|
+
var word2 = 0;
|
|
278
278
|
for (var i = start; i < end; i += limbLen) {
|
|
279
|
-
|
|
279
|
+
word2 = parseBase(number, i, i + limbLen, base);
|
|
280
280
|
this.imuln(limbPow);
|
|
281
|
-
if (this.words[0] +
|
|
282
|
-
this.words[0] +=
|
|
281
|
+
if (this.words[0] + word2 < 67108864) {
|
|
282
|
+
this.words[0] += word2;
|
|
283
283
|
} else {
|
|
284
|
-
this._iaddn(
|
|
284
|
+
this._iaddn(word2);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
if (mod !== 0) {
|
|
288
288
|
var pow = 1;
|
|
289
|
-
|
|
289
|
+
word2 = parseBase(number, i, number.length, base);
|
|
290
290
|
for (i = 0; i < mod; i++) {
|
|
291
291
|
pow *= base;
|
|
292
292
|
}
|
|
293
293
|
this.imuln(pow);
|
|
294
|
-
if (this.words[0] +
|
|
295
|
-
this.words[0] +=
|
|
294
|
+
if (this.words[0] + word2 < 67108864) {
|
|
295
|
+
this.words[0] += word2;
|
|
296
296
|
} else {
|
|
297
|
-
this._iaddn(
|
|
297
|
+
this._iaddn(word2);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
this._strip();
|
|
@@ -468,7 +468,7 @@ var require_bn = __commonJS({
|
|
|
468
468
|
var carry = 0;
|
|
469
469
|
for (var i = 0; i < this.length; i++) {
|
|
470
470
|
var w = this.words[i];
|
|
471
|
-
var
|
|
471
|
+
var word2 = ((w << off | carry) & 16777215).toString(16);
|
|
472
472
|
carry = w >>> 24 - off & 16777215;
|
|
473
473
|
off += 2;
|
|
474
474
|
if (off >= 26) {
|
|
@@ -476,9 +476,9 @@ var require_bn = __commonJS({
|
|
|
476
476
|
i--;
|
|
477
477
|
}
|
|
478
478
|
if (carry !== 0 || i !== this.length - 1) {
|
|
479
|
-
out = zeros[6 -
|
|
479
|
+
out = zeros[6 - word2.length] + word2 + out;
|
|
480
480
|
} else {
|
|
481
|
-
out =
|
|
481
|
+
out = word2 + out;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
if (carry !== 0) {
|
|
@@ -563,22 +563,22 @@ var require_bn = __commonJS({
|
|
|
563
563
|
var position = 0;
|
|
564
564
|
var carry = 0;
|
|
565
565
|
for (var i = 0, shift = 0; i < this.length; i++) {
|
|
566
|
-
var
|
|
567
|
-
res[position++] =
|
|
566
|
+
var word2 = this.words[i] << shift | carry;
|
|
567
|
+
res[position++] = word2 & 255;
|
|
568
568
|
if (position < res.length) {
|
|
569
|
-
res[position++] =
|
|
569
|
+
res[position++] = word2 >> 8 & 255;
|
|
570
570
|
}
|
|
571
571
|
if (position < res.length) {
|
|
572
|
-
res[position++] =
|
|
572
|
+
res[position++] = word2 >> 16 & 255;
|
|
573
573
|
}
|
|
574
574
|
if (shift === 6) {
|
|
575
575
|
if (position < res.length) {
|
|
576
|
-
res[position++] =
|
|
576
|
+
res[position++] = word2 >> 24 & 255;
|
|
577
577
|
}
|
|
578
578
|
carry = 0;
|
|
579
579
|
shift = 0;
|
|
580
580
|
} else {
|
|
581
|
-
carry =
|
|
581
|
+
carry = word2 >>> 24;
|
|
582
582
|
shift += 2;
|
|
583
583
|
}
|
|
584
584
|
}
|
|
@@ -593,22 +593,22 @@ var require_bn = __commonJS({
|
|
|
593
593
|
var position = res.length - 1;
|
|
594
594
|
var carry = 0;
|
|
595
595
|
for (var i = 0, shift = 0; i < this.length; i++) {
|
|
596
|
-
var
|
|
597
|
-
res[position--] =
|
|
596
|
+
var word2 = this.words[i] << shift | carry;
|
|
597
|
+
res[position--] = word2 & 255;
|
|
598
598
|
if (position >= 0) {
|
|
599
|
-
res[position--] =
|
|
599
|
+
res[position--] = word2 >> 8 & 255;
|
|
600
600
|
}
|
|
601
601
|
if (position >= 0) {
|
|
602
|
-
res[position--] =
|
|
602
|
+
res[position--] = word2 >> 16 & 255;
|
|
603
603
|
}
|
|
604
604
|
if (shift === 6) {
|
|
605
605
|
if (position >= 0) {
|
|
606
|
-
res[position--] =
|
|
606
|
+
res[position--] = word2 >> 24 & 255;
|
|
607
607
|
}
|
|
608
608
|
carry = 0;
|
|
609
609
|
shift = 0;
|
|
610
610
|
} else {
|
|
611
|
-
carry =
|
|
611
|
+
carry = word2 >>> 24;
|
|
612
612
|
shift += 2;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
@@ -1847,9 +1847,9 @@ var require_bn = __commonJS({
|
|
|
1847
1847
|
}
|
|
1848
1848
|
var carry = 0;
|
|
1849
1849
|
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
|
|
1850
|
-
var
|
|
1851
|
-
this.words[i] = carry << 26 - r |
|
|
1852
|
-
carry =
|
|
1850
|
+
var word2 = this.words[i] | 0;
|
|
1851
|
+
this.words[i] = carry << 26 - r | word2 >>> r;
|
|
1852
|
+
carry = word2 & mask;
|
|
1853
1853
|
}
|
|
1854
1854
|
if (maskedWords && carry !== 0) {
|
|
1855
1855
|
maskedWords.words[maskedWords.length++] = carry;
|
|
@@ -2830,9 +2830,9 @@ var require_bn = __commonJS({
|
|
|
2830
2830
|
start = 26;
|
|
2831
2831
|
}
|
|
2832
2832
|
for (i = num.length - 1; i >= 0; i--) {
|
|
2833
|
-
var
|
|
2833
|
+
var word2 = num.words[i];
|
|
2834
2834
|
for (var j = start - 1; j >= 0; j--) {
|
|
2835
|
-
var bit =
|
|
2835
|
+
var bit = word2 >> j & 1;
|
|
2836
2836
|
if (res !== wnd[0]) {
|
|
2837
2837
|
res = this.sqr(res);
|
|
2838
2838
|
}
|
|
@@ -5521,12 +5521,12 @@ var require_abstract_coder = __commonJS({
|
|
|
5521
5521
|
var logger = new logger_1.Logger(_version_1.version);
|
|
5522
5522
|
function checkResultErrors(result) {
|
|
5523
5523
|
var errors = [];
|
|
5524
|
-
var checkErrors = function(
|
|
5524
|
+
var checkErrors = function(path4, object) {
|
|
5525
5525
|
if (!Array.isArray(object)) {
|
|
5526
5526
|
return;
|
|
5527
5527
|
}
|
|
5528
5528
|
for (var key in object) {
|
|
5529
|
-
var childPath =
|
|
5529
|
+
var childPath = path4.slice();
|
|
5530
5530
|
childPath.push(key);
|
|
5531
5531
|
try {
|
|
5532
5532
|
checkErrors(childPath, object[key]);
|
|
@@ -7618,8 +7618,8 @@ var require_bytes32 = __commonJS({
|
|
|
7618
7618
|
var constants_1 = require_lib8();
|
|
7619
7619
|
var bytes_1 = require_lib2();
|
|
7620
7620
|
var utf8_1 = require_utf8();
|
|
7621
|
-
function formatBytes32String(
|
|
7622
|
-
var bytes = (0, utf8_1.toUtf8Bytes)(
|
|
7621
|
+
function formatBytes32String(text6) {
|
|
7622
|
+
var bytes = (0, utf8_1.toUtf8Bytes)(text6);
|
|
7623
7623
|
if (bytes.length > 31) {
|
|
7624
7624
|
throw new Error("bytes32 string must be less than 32 bytes");
|
|
7625
7625
|
}
|
|
@@ -8137,8 +8137,8 @@ var require_id = __commonJS({
|
|
|
8137
8137
|
exports.id = void 0;
|
|
8138
8138
|
var keccak256_1 = require_lib5();
|
|
8139
8139
|
var strings_1 = require_lib9();
|
|
8140
|
-
function id(
|
|
8141
|
-
return (0, keccak256_1.keccak256)((0, strings_1.toUtf8Bytes)(
|
|
8140
|
+
function id(text6) {
|
|
8141
|
+
return (0, keccak256_1.keccak256)((0, strings_1.toUtf8Bytes)(text6));
|
|
8142
8142
|
}
|
|
8143
8143
|
exports.id = id;
|
|
8144
8144
|
}
|
|
@@ -11022,27 +11022,27 @@ var require_bn2 = __commonJS({
|
|
|
11022
11022
|
var total = number.length - start;
|
|
11023
11023
|
var mod = total % limbLen;
|
|
11024
11024
|
var end = Math.min(total, total - mod) + start;
|
|
11025
|
-
var
|
|
11025
|
+
var word2 = 0;
|
|
11026
11026
|
for (var i = start; i < end; i += limbLen) {
|
|
11027
|
-
|
|
11027
|
+
word2 = parseBase(number, i, i + limbLen, base);
|
|
11028
11028
|
this.imuln(limbPow);
|
|
11029
|
-
if (this.words[0] +
|
|
11030
|
-
this.words[0] +=
|
|
11029
|
+
if (this.words[0] + word2 < 67108864) {
|
|
11030
|
+
this.words[0] += word2;
|
|
11031
11031
|
} else {
|
|
11032
|
-
this._iaddn(
|
|
11032
|
+
this._iaddn(word2);
|
|
11033
11033
|
}
|
|
11034
11034
|
}
|
|
11035
11035
|
if (mod !== 0) {
|
|
11036
11036
|
var pow = 1;
|
|
11037
|
-
|
|
11037
|
+
word2 = parseBase(number, i, number.length, base);
|
|
11038
11038
|
for (i = 0; i < mod; i++) {
|
|
11039
11039
|
pow *= base;
|
|
11040
11040
|
}
|
|
11041
11041
|
this.imuln(pow);
|
|
11042
|
-
if (this.words[0] +
|
|
11043
|
-
this.words[0] +=
|
|
11042
|
+
if (this.words[0] + word2 < 67108864) {
|
|
11043
|
+
this.words[0] += word2;
|
|
11044
11044
|
} else {
|
|
11045
|
-
this._iaddn(
|
|
11045
|
+
this._iaddn(word2);
|
|
11046
11046
|
}
|
|
11047
11047
|
}
|
|
11048
11048
|
this.strip();
|
|
@@ -11198,7 +11198,7 @@ var require_bn2 = __commonJS({
|
|
|
11198
11198
|
var carry = 0;
|
|
11199
11199
|
for (var i = 0; i < this.length; i++) {
|
|
11200
11200
|
var w = this.words[i];
|
|
11201
|
-
var
|
|
11201
|
+
var word2 = ((w << off | carry) & 16777215).toString(16);
|
|
11202
11202
|
carry = w >>> 24 - off & 16777215;
|
|
11203
11203
|
off += 2;
|
|
11204
11204
|
if (off >= 26) {
|
|
@@ -11206,9 +11206,9 @@ var require_bn2 = __commonJS({
|
|
|
11206
11206
|
i--;
|
|
11207
11207
|
}
|
|
11208
11208
|
if (carry !== 0 || i !== this.length - 1) {
|
|
11209
|
-
out = zeros[6 -
|
|
11209
|
+
out = zeros[6 - word2.length] + word2 + out;
|
|
11210
11210
|
} else {
|
|
11211
|
-
out =
|
|
11211
|
+
out = word2 + out;
|
|
11212
11212
|
}
|
|
11213
11213
|
}
|
|
11214
11214
|
if (carry !== 0) {
|
|
@@ -12529,9 +12529,9 @@ var require_bn2 = __commonJS({
|
|
|
12529
12529
|
}
|
|
12530
12530
|
var carry = 0;
|
|
12531
12531
|
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
|
|
12532
|
-
var
|
|
12533
|
-
this.words[i] = carry << 26 - r |
|
|
12534
|
-
carry =
|
|
12532
|
+
var word2 = this.words[i] | 0;
|
|
12533
|
+
this.words[i] = carry << 26 - r | word2 >>> r;
|
|
12534
|
+
carry = word2 & mask;
|
|
12535
12535
|
}
|
|
12536
12536
|
if (maskedWords && carry !== 0) {
|
|
12537
12537
|
maskedWords.words[maskedWords.length++] = carry;
|
|
@@ -13503,9 +13503,9 @@ var require_bn2 = __commonJS({
|
|
|
13503
13503
|
start = 26;
|
|
13504
13504
|
}
|
|
13505
13505
|
for (i = num.length - 1; i >= 0; i--) {
|
|
13506
|
-
var
|
|
13506
|
+
var word2 = num.words[i];
|
|
13507
13507
|
for (var j = start - 1; j >= 0; j--) {
|
|
13508
|
-
var bit =
|
|
13508
|
+
var bit = word2 >> j & 1;
|
|
13509
13509
|
if (res !== wnd[0]) {
|
|
13510
13510
|
res = this.sqr(res);
|
|
13511
13511
|
}
|
|
@@ -13648,11 +13648,11 @@ var require_utils = __commonJS({
|
|
|
13648
13648
|
return res;
|
|
13649
13649
|
}
|
|
13650
13650
|
utils.toArray = toArray;
|
|
13651
|
-
function zero2(
|
|
13652
|
-
if (
|
|
13653
|
-
return "0" +
|
|
13651
|
+
function zero2(word2) {
|
|
13652
|
+
if (word2.length === 1)
|
|
13653
|
+
return "0" + word2;
|
|
13654
13654
|
else
|
|
13655
|
-
return
|
|
13655
|
+
return word2;
|
|
13656
13656
|
}
|
|
13657
13657
|
utils.zero2 = zero2;
|
|
13658
13658
|
function toHex(msg) {
|
|
@@ -15422,30 +15422,30 @@ var require_utils3 = __commonJS({
|
|
|
15422
15422
|
return res;
|
|
15423
15423
|
}
|
|
15424
15424
|
exports.toHex32 = toHex32;
|
|
15425
|
-
function zero2(
|
|
15426
|
-
if (
|
|
15427
|
-
return "0" +
|
|
15425
|
+
function zero2(word2) {
|
|
15426
|
+
if (word2.length === 1)
|
|
15427
|
+
return "0" + word2;
|
|
15428
15428
|
else
|
|
15429
|
-
return
|
|
15429
|
+
return word2;
|
|
15430
15430
|
}
|
|
15431
15431
|
exports.zero2 = zero2;
|
|
15432
|
-
function zero8(
|
|
15433
|
-
if (
|
|
15434
|
-
return "0" +
|
|
15435
|
-
else if (
|
|
15436
|
-
return "00" +
|
|
15437
|
-
else if (
|
|
15438
|
-
return "000" +
|
|
15439
|
-
else if (
|
|
15440
|
-
return "0000" +
|
|
15441
|
-
else if (
|
|
15442
|
-
return "00000" +
|
|
15443
|
-
else if (
|
|
15444
|
-
return "000000" +
|
|
15445
|
-
else if (
|
|
15446
|
-
return "0000000" +
|
|
15432
|
+
function zero8(word2) {
|
|
15433
|
+
if (word2.length === 7)
|
|
15434
|
+
return "0" + word2;
|
|
15435
|
+
else if (word2.length === 6)
|
|
15436
|
+
return "00" + word2;
|
|
15437
|
+
else if (word2.length === 5)
|
|
15438
|
+
return "000" + word2;
|
|
15439
|
+
else if (word2.length === 4)
|
|
15440
|
+
return "0000" + word2;
|
|
15441
|
+
else if (word2.length === 3)
|
|
15442
|
+
return "00000" + word2;
|
|
15443
|
+
else if (word2.length === 2)
|
|
15444
|
+
return "000000" + word2;
|
|
15445
|
+
else if (word2.length === 1)
|
|
15446
|
+
return "0000000" + word2;
|
|
15447
15447
|
else
|
|
15448
|
-
return
|
|
15448
|
+
return word2;
|
|
15449
15449
|
}
|
|
15450
15450
|
exports.zero8 = zero8;
|
|
15451
15451
|
function join32(msg, start, end, endian) {
|
|
@@ -20715,11 +20715,11 @@ var require_wordlist = __commonJS({
|
|
|
20715
20715
|
Wordlist2.check = function(wordlist) {
|
|
20716
20716
|
var words = [];
|
|
20717
20717
|
for (var i = 0; i < 2048; i++) {
|
|
20718
|
-
var
|
|
20719
|
-
if (i !== wordlist.getWordIndex(
|
|
20718
|
+
var word2 = wordlist.getWord(i);
|
|
20719
|
+
if (i !== wordlist.getWordIndex(word2)) {
|
|
20720
20720
|
return "0x";
|
|
20721
20721
|
}
|
|
20722
|
-
words.push(
|
|
20722
|
+
words.push(word2);
|
|
20723
20723
|
}
|
|
20724
20724
|
return (0, hash_1.id)(words.join("\n") + "\n");
|
|
20725
20725
|
};
|
|
@@ -20795,9 +20795,9 @@ var require_lang_cz = __commonJS({
|
|
|
20795
20795
|
loadWords(this);
|
|
20796
20796
|
return wordlist[index];
|
|
20797
20797
|
};
|
|
20798
|
-
LangCz2.prototype.getWordIndex = function(
|
|
20798
|
+
LangCz2.prototype.getWordIndex = function(word2) {
|
|
20799
20799
|
loadWords(this);
|
|
20800
|
-
return wordlist.indexOf(
|
|
20800
|
+
return wordlist.indexOf(word2);
|
|
20801
20801
|
};
|
|
20802
20802
|
return LangCz2;
|
|
20803
20803
|
})(wordlist_1.Wordlist)
|
|
@@ -20857,9 +20857,9 @@ var require_lang_en = __commonJS({
|
|
|
20857
20857
|
loadWords(this);
|
|
20858
20858
|
return wordlist[index];
|
|
20859
20859
|
};
|
|
20860
|
-
LangEn2.prototype.getWordIndex = function(
|
|
20860
|
+
LangEn2.prototype.getWordIndex = function(word2) {
|
|
20861
20861
|
loadWords(this);
|
|
20862
|
-
return wordlist.indexOf(
|
|
20862
|
+
return wordlist.indexOf(word2);
|
|
20863
20863
|
};
|
|
20864
20864
|
return LangEn2;
|
|
20865
20865
|
})(wordlist_1.Wordlist)
|
|
@@ -20900,15 +20900,15 @@ var require_lang_es = __commonJS({
|
|
|
20900
20900
|
var words = "A/bacoAbdomenAbejaAbiertoAbogadoAbonoAbortoAbrazoAbrirAbueloAbusoAcabarAcademiaAccesoAccio/nAceiteAcelgaAcentoAceptarA/cidoAclararAcne/AcogerAcosoActivoActoActrizActuarAcudirAcuerdoAcusarAdictoAdmitirAdoptarAdornoAduanaAdultoAe/reoAfectarAficio/nAfinarAfirmarA/gilAgitarAgoni/aAgostoAgotarAgregarAgrioAguaAgudoA/guilaAgujaAhogoAhorroAireAislarAjedrezAjenoAjusteAlacra/nAlambreAlarmaAlbaA/lbumAlcaldeAldeaAlegreAlejarAlertaAletaAlfilerAlgaAlgodo/nAliadoAlientoAlivioAlmaAlmejaAlmi/barAltarAltezaAltivoAltoAlturaAlumnoAlzarAmableAmanteAmapolaAmargoAmasarA/mbarA/mbitoAmenoAmigoAmistadAmorAmparoAmplioAnchoAncianoAnclaAndarAnde/nAnemiaA/nguloAnilloA/nimoAni/sAnotarAntenaAntiguoAntojoAnualAnularAnuncioA~adirA~ejoA~oApagarAparatoApetitoApioAplicarApodoAporteApoyoAprenderAprobarApuestaApuroAradoAra~aArarA/rbitroA/rbolArbustoArchivoArcoArderArdillaArduoA/reaA/ridoAriesArmoni/aArne/sAromaArpaArpo/nArregloArrozArrugaArteArtistaAsaAsadoAsaltoAscensoAsegurarAseoAsesorAsientoAsiloAsistirAsnoAsombroA/speroAstillaAstroAstutoAsumirAsuntoAtajoAtaqueAtarAtentoAteoA/ticoAtletaA/tomoAtraerAtrozAtu/nAudazAudioAugeAulaAumentoAusenteAutorAvalAvanceAvaroAveAvellanaAvenaAvestruzAvio/nAvisoAyerAyudaAyunoAzafra/nAzarAzoteAzu/carAzufreAzulBabaBaborBacheBahi/aBaileBajarBalanzaBalco/nBaldeBambu/BancoBandaBa~oBarbaBarcoBarnizBarroBa/sculaBasto/nBasuraBatallaBateri/aBatirBatutaBau/lBazarBebe/BebidaBelloBesarBesoBestiaBichoBienBingoBlancoBloqueBlusaBoaBobinaBoboBocaBocinaBodaBodegaBoinaBolaBoleroBolsaBombaBondadBonitoBonoBonsa/iBordeBorrarBosqueBoteBoti/nBo/vedaBozalBravoBrazoBrechaBreveBrilloBrincoBrisaBrocaBromaBronceBroteBrujaBruscoBrutoBuceoBucleBuenoBueyBufandaBufo/nBu/hoBuitreBultoBurbujaBurlaBurroBuscarButacaBuzo/nCaballoCabezaCabinaCabraCacaoCada/verCadenaCaerCafe/Cai/daCaima/nCajaCajo/nCalCalamarCalcioCaldoCalidadCalleCalmaCalorCalvoCamaCambioCamelloCaminoCampoCa/ncerCandilCanelaCanguroCanicaCantoCa~aCa~o/nCaobaCaosCapazCapita/nCapoteCaptarCapuchaCaraCarbo/nCa/rcelCaretaCargaCari~oCarneCarpetaCarroCartaCasaCascoCaseroCaspaCastorCatorceCatreCaudalCausaCazoCebollaCederCedroCeldaCe/lebreCelosoCe/lulaCementoCenizaCentroCercaCerdoCerezaCeroCerrarCertezaCe/spedCetroChacalChalecoChampu/ChanclaChapaCharlaChicoChisteChivoChoqueChozaChuletaChuparCiclo/nCiegoCieloCienCiertoCifraCigarroCimaCincoCineCintaCipre/sCircoCiruelaCisneCitaCiudadClamorClanClaroClaseClaveClienteClimaCli/nicaCobreCoccio/nCochinoCocinaCocoCo/digoCodoCofreCogerCoheteCoji/nCojoColaColchaColegioColgarColinaCollarColmoColumnaCombateComerComidaCo/modoCompraCondeConejoCongaConocerConsejoContarCopaCopiaCorazo/nCorbataCorchoCordo/nCoronaCorrerCoserCosmosCostaCra/neoCra/terCrearCrecerCrei/doCremaCri/aCrimenCriptaCrisisCromoCro/nicaCroquetaCrudoCruzCuadroCuartoCuatroCuboCubrirCucharaCuelloCuentoCuerdaCuestaCuevaCuidarCulebraCulpaCultoCumbreCumplirCunaCunetaCuotaCupo/nCu/pulaCurarCuriosoCursoCurvaCutisDamaDanzaDarDardoDa/tilDeberDe/bilDe/cadaDecirDedoDefensaDefinirDejarDelfi/nDelgadoDelitoDemoraDensoDentalDeporteDerechoDerrotaDesayunoDeseoDesfileDesnudoDestinoDesvi/oDetalleDetenerDeudaDi/aDiabloDiademaDiamanteDianaDiarioDibujoDictarDienteDietaDiezDifi/cilDignoDilemaDiluirDineroDirectoDirigirDiscoDise~oDisfrazDivaDivinoDobleDoceDolorDomingoDonDonarDoradoDormirDorsoDosDosisDrago/nDrogaDuchaDudaDueloDue~oDulceDu/oDuqueDurarDurezaDuroE/banoEbrioEcharEcoEcuadorEdadEdicio/nEdificioEditorEducarEfectoEficazEjeEjemploElefanteElegirElementoElevarElipseE/liteElixirElogioEludirEmbudoEmitirEmocio/nEmpateEmpe~oEmpleoEmpresaEnanoEncargoEnchufeEnci/aEnemigoEneroEnfadoEnfermoEnga~oEnigmaEnlaceEnormeEnredoEnsayoEnse~arEnteroEntrarEnvaseEnvi/oE/pocaEquipoErizoEscalaEscenaEscolarEscribirEscudoEsenciaEsferaEsfuerzoEspadaEspejoEspi/aEsposaEspumaEsqui/EstarEsteEstiloEstufaEtapaEternoE/ticaEtniaEvadirEvaluarEventoEvitarExactoExamenExcesoExcusaExentoExigirExilioExistirE/xitoExpertoExplicarExponerExtremoFa/bricaFa/bulaFachadaFa/cilFactorFaenaFajaFaldaFalloFalsoFaltarFamaFamiliaFamosoFarao/nFarmaciaFarolFarsaFaseFatigaFaunaFavorFaxFebreroFechaFelizFeoFeriaFerozFe/rtilFervorFesti/nFiableFianzaFiarFibraFiccio/nFichaFideoFiebreFielFieraFiestaFiguraFijarFijoFilaFileteFilialFiltroFinFincaFingirFinitoFirmaFlacoFlautaFlechaFlorFlotaFluirFlujoFlu/orFobiaFocaFogataFogo/nFolioFolletoFondoFormaForroFortunaForzarFosaFotoFracasoFra/gilFranjaFraseFraudeFrei/rFrenoFresaFri/oFritoFrutaFuegoFuenteFuerzaFugaFumarFuncio/nFundaFurgo/nFuriaFusilFu/tbolFuturoGacelaGafasGaitaGajoGalaGaleri/aGalloGambaGanarGanchoGangaGansoGarajeGarzaGasolinaGastarGatoGavila/nGemeloGemirGenGe/neroGenioGenteGeranioGerenteGermenGestoGiganteGimnasioGirarGiroGlaciarGloboGloriaGolGolfoGolosoGolpeGomaGordoGorilaGorraGotaGoteoGozarGradaGra/ficoGranoGrasaGratisGraveGrietaGrilloGripeGrisGritoGrosorGru/aGruesoGrumoGrupoGuanteGuapoGuardiaGuerraGui/aGui~oGuionGuisoGuitarraGusanoGustarHaberHa/bilHablarHacerHachaHadaHallarHamacaHarinaHazHaza~aHebillaHebraHechoHeladoHelioHembraHerirHermanoHe/roeHervirHieloHierroHi/gadoHigieneHijoHimnoHistoriaHocicoHogarHogueraHojaHombreHongoHonorHonraHoraHormigaHornoHostilHoyoHuecoHuelgaHuertaHuesoHuevoHuidaHuirHumanoHu/medoHumildeHumoHundirHuraca/nHurtoIconoIdealIdiomaI/doloIglesiaIglu/IgualIlegalIlusio/nImagenIma/nImitarImparImperioImponerImpulsoIncapazI/ndiceInerteInfielInformeIngenioInicioInmensoInmuneInnatoInsectoInstanteIntere/sI/ntimoIntuirInu/tilInviernoIraIrisIroni/aIslaIsloteJabali/Jabo/nJamo/nJarabeJardi/nJarraJaulaJazmi/nJefeJeringaJineteJornadaJorobaJovenJoyaJuergaJuevesJuezJugadorJugoJugueteJuicioJuncoJunglaJunioJuntarJu/piterJurarJustoJuvenilJuzgarKiloKoalaLabioLacioLacraLadoLadro/nLagartoLa/grimaLagunaLaicoLamerLa/minaLa/mparaLanaLanchaLangostaLanzaLa/pizLargoLarvaLa/stimaLataLa/texLatirLaurelLavarLazoLealLeccio/nLecheLectorLeerLegio/nLegumbreLejanoLenguaLentoLe~aLeo/nLeopardoLesio/nLetalLetraLeveLeyendaLibertadLibroLicorLi/derLidiarLienzoLigaLigeroLimaLi/miteLimo/nLimpioLinceLindoLi/neaLingoteLinoLinternaLi/quidoLisoListaLiteraLitioLitroLlagaLlamaLlantoLlaveLlegarLlenarLlevarLlorarLloverLluviaLoboLocio/nLocoLocuraLo/gicaLogroLombrizLomoLonjaLoteLuchaLucirLugarLujoLunaLunesLupaLustroLutoLuzMacetaMachoMaderaMadreMaduroMaestroMafiaMagiaMagoMai/zMaldadMaletaMallaMaloMama/MamboMamutMancoMandoManejarMangaManiqui/ManjarManoMansoMantaMa~anaMapaMa/quinaMarMarcoMareaMarfilMargenMaridoMa/rmolMarro/nMartesMarzoMasaMa/scaraMasivoMatarMateriaMatizMatrizMa/ximoMayorMazorcaMechaMedallaMedioMe/dulaMejillaMejorMelenaMelo/nMemoriaMenorMensajeMenteMenu/MercadoMerengueMe/ritoMesMeso/nMetaMeterMe/todoMetroMezclaMiedoMielMiembroMigaMilMilagroMilitarMillo/nMimoMinaMineroMi/nimoMinutoMiopeMirarMisaMiseriaMisilMismoMitadMitoMochilaMocio/nModaModeloMohoMojarMoldeMolerMolinoMomentoMomiaMonarcaMonedaMonjaMontoMo~oMoradaMorderMorenoMorirMorroMorsaMortalMoscaMostrarMotivoMoverMo/vilMozoMuchoMudarMuebleMuelaMuerteMuestraMugreMujerMulaMuletaMultaMundoMu~ecaMuralMuroMu/sculoMuseoMusgoMu/sicaMusloNa/carNacio/nNadarNaipeNaranjaNarizNarrarNasalNatalNativoNaturalNa/useaNavalNaveNavidadNecioNe/ctarNegarNegocioNegroNeo/nNervioNetoNeutroNevarNeveraNichoNidoNieblaNietoNi~ezNi~oNi/tidoNivelNoblezaNocheNo/minaNoriaNormaNorteNotaNoticiaNovatoNovelaNovioNubeNucaNu/cleoNudilloNudoNueraNueveNuezNuloNu/meroNutriaOasisObesoObispoObjetoObraObreroObservarObtenerObvioOcaOcasoOce/anoOchentaOchoOcioOcreOctavoOctubreOcultoOcuparOcurrirOdiarOdioOdiseaOesteOfensaOfertaOficioOfrecerOgroOi/doOi/rOjoOlaOleadaOlfatoOlivoOllaOlmoOlorOlvidoOmbligoOndaOnzaOpacoOpcio/nO/peraOpinarOponerOptarO/pticaOpuestoOracio/nOradorOralO/rbitaOrcaOrdenOrejaO/rganoOrgi/aOrgulloOrienteOrigenOrillaOroOrquestaOrugaOsadi/aOscuroOseznoOsoOstraOto~oOtroOvejaO/vuloO/xidoOxi/genoOyenteOzonoPactoPadrePaellaPa/ginaPagoPai/sPa/jaroPalabraPalcoPaletaPa/lidoPalmaPalomaPalparPanPanalPa/nicoPanteraPa~ueloPapa/PapelPapillaPaquetePararParcelaParedParirParoPa/rpadoParquePa/rrafoPartePasarPaseoPasio/nPasoPastaPataPatioPatriaPausaPautaPavoPayasoPeato/nPecadoPeceraPechoPedalPedirPegarPeinePelarPelda~oPeleaPeligroPellejoPeloPelucaPenaPensarPe~o/nPeo/nPeorPepinoPeque~oPeraPerchaPerderPerezaPerfilPericoPerlaPermisoPerroPersonaPesaPescaPe/simoPesta~aPe/taloPetro/leoPezPezu~aPicarPicho/nPiePiedraPiernaPiezaPijamaPilarPilotoPimientaPinoPintorPinzaPi~aPiojoPipaPirataPisarPiscinaPisoPistaPito/nPizcaPlacaPlanPlataPlayaPlazaPleitoPlenoPlomoPlumaPluralPobrePocoPoderPodioPoemaPoesi/aPoetaPolenPolici/aPolloPolvoPomadaPomeloPomoPompaPonerPorcio/nPortalPosadaPoseerPosiblePostePotenciaPotroPozoPradoPrecozPreguntaPremioPrensaPresoPrevioPrimoPri/ncipePrisio/nPrivarProaProbarProcesoProductoProezaProfesorProgramaProlePromesaProntoPropioPro/ximoPruebaPu/blicoPucheroPudorPuebloPuertaPuestoPulgaPulirPulmo/nPulpoPulsoPumaPuntoPu~alPu~oPupaPupilaPure/QuedarQuejaQuemarQuererQuesoQuietoQui/micaQuinceQuitarRa/banoRabiaRaboRacio/nRadicalRai/zRamaRampaRanchoRangoRapazRa/pidoRaptoRasgoRaspaRatoRayoRazaRazo/nReaccio/nRealidadReba~oReboteRecaerRecetaRechazoRecogerRecreoRectoRecursoRedRedondoReducirReflejoReformaRefra/nRefugioRegaloRegirReglaRegresoRehe/nReinoRei/rRejaRelatoRelevoRelieveRellenoRelojRemarRemedioRemoRencorRendirRentaRepartoRepetirReposoReptilResRescateResinaRespetoRestoResumenRetiroRetornoRetratoReunirReve/sRevistaReyRezarRicoRiegoRiendaRiesgoRifaRi/gidoRigorRinco/nRi~o/nRi/oRiquezaRisaRitmoRitoRizoRobleRoceRociarRodarRodeoRodillaRoerRojizoRojoRomeroRomperRonRoncoRondaRopaRoperoRosaRoscaRostroRotarRubi/RuborRudoRuedaRugirRuidoRuinaRuletaRuloRumboRumorRupturaRutaRutinaSa/badoSaberSabioSableSacarSagazSagradoSalaSaldoSaleroSalirSalmo/nSalo/nSalsaSaltoSaludSalvarSambaSancio/nSandi/aSanearSangreSanidadSanoSantoSapoSaqueSardinaSarte/nSastreSata/nSaunaSaxofo/nSeccio/nSecoSecretoSectaSedSeguirSeisSelloSelvaSemanaSemillaSendaSensorSe~alSe~orSepararSepiaSequi/aSerSerieSermo/nServirSesentaSesio/nSetaSetentaSeveroSexoSextoSidraSiestaSieteSigloSignoSi/labaSilbarSilencioSillaSi/mboloSimioSirenaSistemaSitioSituarSobreSocioSodioSolSolapaSoldadoSoledadSo/lidoSoltarSolucio/nSombraSondeoSonidoSonoroSonrisaSopaSoplarSoporteSordoSorpresaSorteoSoste/nSo/tanoSuaveSubirSucesoSudorSuegraSueloSue~oSuerteSufrirSujetoSulta/nSumarSuperarSuplirSuponerSupremoSurSurcoSure~oSurgirSustoSutilTabacoTabiqueTablaTabu/TacoTactoTajoTalarTalcoTalentoTallaTalo/nTama~oTamborTangoTanqueTapaTapeteTapiaTapo/nTaquillaTardeTareaTarifaTarjetaTarotTarroTartaTatuajeTauroTazaTazo/nTeatroTechoTeclaTe/cnicaTejadoTejerTejidoTelaTele/fonoTemaTemorTemploTenazTenderTenerTenisTensoTeori/aTerapiaTercoTe/rminoTernuraTerrorTesisTesoroTestigoTeteraTextoTezTibioTiburo/nTiempoTiendaTierraTiesoTigreTijeraTildeTimbreTi/midoTimoTintaTi/oTi/picoTipoTiraTiro/nTita/nTi/tereTi/tuloTizaToallaTobilloTocarTocinoTodoTogaToldoTomarTonoTontoToparTopeToqueTo/raxToreroTormentaTorneoToroTorpedoTorreTorsoTortugaTosToscoToserTo/xicoTrabajoTractorTraerTra/ficoTragoTrajeTramoTranceTratoTraumaTrazarTre/bolTreguaTreintaTrenTreparTresTribuTrigoTripaTristeTriunfoTrofeoTrompaTroncoTropaTroteTrozoTrucoTruenoTrufaTuberi/aTuboTuertoTumbaTumorTu/nelTu/nicaTurbinaTurismoTurnoTutorUbicarU/lceraUmbralUnidadUnirUniversoUnoUntarU~aUrbanoUrbeUrgenteUrnaUsarUsuarioU/tilUtopi/aUvaVacaVaci/oVacunaVagarVagoVainaVajillaValeVa/lidoValleValorVa/lvulaVampiroVaraVariarVaro/nVasoVecinoVectorVehi/culoVeinteVejezVelaVeleroVelozVenaVencerVendaVenenoVengarVenirVentaVenusVerVeranoVerboVerdeVeredaVerjaVersoVerterVi/aViajeVibrarVicioVi/ctimaVidaVi/deoVidrioViejoViernesVigorVilVillaVinagreVinoVi~edoVioli/nViralVirgoVirtudVisorVi/speraVistaVitaminaViudoVivazViveroVivirVivoVolca/nVolumenVolverVorazVotarVotoVozVueloVulgarYacerYateYeguaYemaYernoYesoYodoYogaYogurZafiroZanjaZapatoZarzaZonaZorroZumoZurdo";
|
|
20901
20901
|
var lookup = {};
|
|
20902
20902
|
var wordlist = null;
|
|
20903
|
-
function dropDiacritic(
|
|
20903
|
+
function dropDiacritic(word2) {
|
|
20904
20904
|
wordlist_1.logger.checkNormalize();
|
|
20905
|
-
return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(
|
|
20905
|
+
return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word2.normalize("NFD").toLowerCase()), function(c) {
|
|
20906
20906
|
return c >= 65 && c <= 90 || c >= 97 && c <= 123;
|
|
20907
20907
|
}));
|
|
20908
20908
|
}
|
|
20909
|
-
function expand(
|
|
20909
|
+
function expand(word2) {
|
|
20910
20910
|
var output = [];
|
|
20911
|
-
Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(
|
|
20911
|
+
Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word2), function(c) {
|
|
20912
20912
|
if (c === 47) {
|
|
20913
20913
|
output.push(204);
|
|
20914
20914
|
output.push(129);
|
|
@@ -20929,8 +20929,8 @@ var require_lang_es = __commonJS({
|
|
|
20929
20929
|
wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) {
|
|
20930
20930
|
return expand(w);
|
|
20931
20931
|
});
|
|
20932
|
-
wordlist.forEach(function(
|
|
20933
|
-
lookup[dropDiacritic(
|
|
20932
|
+
wordlist.forEach(function(word2, index) {
|
|
20933
|
+
lookup[dropDiacritic(word2)] = index;
|
|
20934
20934
|
});
|
|
20935
20935
|
if (wordlist_1.Wordlist.check(lang) !== "0xf74fb7092aeacdfbf8959557de22098da512207fb9f109cb526994938cf40300") {
|
|
20936
20936
|
wordlist = null;
|
|
@@ -20948,9 +20948,9 @@ var require_lang_es = __commonJS({
|
|
|
20948
20948
|
loadWords(this);
|
|
20949
20949
|
return wordlist[index];
|
|
20950
20950
|
};
|
|
20951
|
-
LangEs2.prototype.getWordIndex = function(
|
|
20951
|
+
LangEs2.prototype.getWordIndex = function(word2) {
|
|
20952
20952
|
loadWords(this);
|
|
20953
|
-
return lookup[dropDiacritic(
|
|
20953
|
+
return lookup[dropDiacritic(word2)];
|
|
20954
20954
|
};
|
|
20955
20955
|
return LangEs2;
|
|
20956
20956
|
})(wordlist_1.Wordlist)
|
|
@@ -20991,15 +20991,15 @@ var require_lang_fr = __commonJS({
|
|
|
20991
20991
|
var words = "AbaisserAbandonAbdiquerAbeilleAbolirAborderAboutirAboyerAbrasifAbreuverAbriterAbrogerAbruptAbsenceAbsoluAbsurdeAbusifAbyssalAcade/mieAcajouAcarienAccablerAccepterAcclamerAccoladeAccrocheAccuserAcerbeAchatAcheterAcidulerAcierAcompteAcque/rirAcronymeActeurActifActuelAdepteAde/quatAdhe/sifAdjectifAdjugerAdmettreAdmirerAdopterAdorerAdoucirAdresseAdroitAdulteAdverbeAe/rerAe/ronefAffaireAffecterAfficheAffreuxAffublerAgacerAgencerAgileAgiterAgraferAgre/ableAgrumeAiderAiguilleAilierAimableAisanceAjouterAjusterAlarmerAlchimieAlerteAlge-breAlgueAlie/nerAlimentAlle/gerAlliageAllouerAllumerAlourdirAlpagaAltesseAlve/oleAmateurAmbiguAmbreAme/nagerAmertumeAmidonAmiralAmorcerAmourAmovibleAmphibieAmpleurAmusantAnalyseAnaphoreAnarchieAnatomieAncienAne/antirAngleAngoisseAnguleuxAnimalAnnexerAnnonceAnnuelAnodinAnomalieAnonymeAnormalAntenneAntidoteAnxieuxApaiserApe/ritifAplanirApologieAppareilAppelerApporterAppuyerAquariumAqueducArbitreArbusteArdeurArdoiseArgentArlequinArmatureArmementArmoireArmureArpenterArracherArriverArroserArsenicArte/rielArticleAspectAsphalteAspirerAssautAsservirAssietteAssocierAssurerAsticotAstreAstuceAtelierAtomeAtriumAtroceAttaqueAttentifAttirerAttraperAubaineAubergeAudaceAudibleAugurerAuroreAutomneAutrucheAvalerAvancerAvariceAvenirAverseAveugleAviateurAvideAvionAviserAvoineAvouerAvrilAxialAxiomeBadgeBafouerBagageBaguetteBaignadeBalancerBalconBaleineBalisageBambinBancaireBandageBanlieueBannie-reBanquierBarbierBarilBaronBarqueBarrageBassinBastionBatailleBateauBatterieBaudrierBavarderBeletteBe/lierBeloteBe/ne/ficeBerceauBergerBerlineBermudaBesaceBesogneBe/tailBeurreBiberonBicycleBiduleBijouBilanBilingueBillardBinaireBiologieBiopsieBiotypeBiscuitBisonBistouriBitumeBizarreBlafardBlagueBlanchirBlessantBlinderBlondBloquerBlousonBobardBobineBoireBoiserBolideBonbonBondirBonheurBonifierBonusBordureBorneBotteBoucleBoueuxBougieBoulonBouquinBourseBoussoleBoutiqueBoxeurBrancheBrasierBraveBrebisBre-cheBreuvageBricolerBrigadeBrillantBriocheBriqueBrochureBroderBronzerBrousseBroyeurBrumeBrusqueBrutalBruyantBuffleBuissonBulletinBureauBurinBustierButinerButoirBuvableBuvetteCabanonCabineCachetteCadeauCadreCafe/ineCaillouCaissonCalculerCalepinCalibreCalmerCalomnieCalvaireCamaradeCame/raCamionCampagneCanalCanetonCanonCantineCanularCapableCaporalCapriceCapsuleCapterCapucheCarabineCarboneCaresserCaribouCarnageCarotteCarreauCartonCascadeCasierCasqueCassureCauserCautionCavalierCaverneCaviarCe/dilleCeintureCe/lesteCelluleCendrierCensurerCentralCercleCe/re/bralCeriseCernerCerveauCesserChagrinChaiseChaleurChambreChanceChapitreCharbonChasseurChatonChaussonChavirerChemiseChenilleChe/quierChercherChevalChienChiffreChignonChime-reChiotChlorureChocolatChoisirChoseChouetteChromeChuteCigareCigogneCimenterCine/maCintrerCirculerCirerCirqueCiterneCitoyenCitronCivilClaironClameurClaquerClasseClavierClientClignerClimatClivageClocheClonageCloporteCobaltCobraCocasseCocotierCoderCodifierCoffreCognerCohe/sionCoifferCoincerCole-reColibriCollineColmaterColonelCombatCome/dieCommandeCompactConcertConduireConfierCongelerConnoterConsonneContactConvexeCopainCopieCorailCorbeauCordageCornicheCorpusCorrectCorte-geCosmiqueCostumeCotonCoudeCoupureCourageCouteauCouvrirCoyoteCrabeCrainteCravateCrayonCre/atureCre/diterCre/meuxCreuserCrevetteCriblerCrierCristalCrite-reCroireCroquerCrotaleCrucialCruelCrypterCubiqueCueillirCuille-reCuisineCuivreCulminerCultiverCumulerCupideCuratifCurseurCyanureCycleCylindreCyniqueDaignerDamierDangerDanseurDauphinDe/battreDe/biterDe/borderDe/briderDe/butantDe/calerDe/cembreDe/chirerDe/ciderDe/clarerDe/corerDe/crireDe/cuplerDe/daleDe/ductifDe/esseDe/fensifDe/filerDe/frayerDe/gagerDe/givrerDe/glutirDe/graferDe/jeunerDe/liceDe/logerDemanderDemeurerDe/molirDe/nicherDe/nouerDentelleDe/nuderDe/partDe/penserDe/phaserDe/placerDe/poserDe/rangerDe/roberDe/sastreDescenteDe/sertDe/signerDe/sobe/irDessinerDestrierDe/tacherDe/testerDe/tourerDe/tresseDevancerDevenirDevinerDevoirDiableDialogueDiamantDicterDiffe/rerDige/rerDigitalDigneDiluerDimancheDiminuerDioxydeDirectifDirigerDiscuterDisposerDissiperDistanceDivertirDiviserDocileDocteurDogmeDoigtDomaineDomicileDompterDonateurDonjonDonnerDopamineDortoirDorureDosageDoseurDossierDotationDouanierDoubleDouceurDouterDoyenDragonDraperDresserDribblerDroitureDuperieDuplexeDurableDurcirDynastieE/blouirE/carterE/charpeE/chelleE/clairerE/clipseE/cloreE/cluseE/coleE/conomieE/corceE/couterE/craserE/cre/merE/crivainE/crouE/cumeE/cureuilE/difierE/duquerEffacerEffectifEffigieEffortEffrayerEffusionE/galiserE/garerE/jecterE/laborerE/largirE/lectronE/le/gantE/le/phantE/le-veE/ligibleE/litismeE/logeE/luciderE/luderEmballerEmbellirEmbryonE/meraudeE/missionEmmenerE/motionE/mouvoirEmpereurEmployerEmporterEmpriseE/mulsionEncadrerEnche-reEnclaveEncocheEndiguerEndosserEndroitEnduireE/nergieEnfanceEnfermerEnfouirEngagerEnginEngloberE/nigmeEnjamberEnjeuEnleverEnnemiEnnuyeuxEnrichirEnrobageEnseigneEntasserEntendreEntierEntourerEntraverE/nume/rerEnvahirEnviableEnvoyerEnzymeE/olienE/paissirE/pargneE/patantE/pauleE/picerieE/pide/mieE/pierE/pilogueE/pineE/pisodeE/pitapheE/poqueE/preuveE/prouverE/puisantE/querreE/quipeE/rigerE/rosionErreurE/ruptionEscalierEspadonEspe-ceEspie-gleEspoirEspritEsquiverEssayerEssenceEssieuEssorerEstimeEstomacEstradeE/tage-reE/talerE/tancheE/tatiqueE/teindreE/tendoirE/ternelE/thanolE/thiqueEthnieE/tirerE/tofferE/toileE/tonnantE/tourdirE/trangeE/troitE/tudeEuphorieE/valuerE/vasionE/ventailE/videnceE/viterE/volutifE/voquerExactExage/rerExaucerExcellerExcitantExclusifExcuseExe/cuterExempleExercerExhalerExhorterExigenceExilerExisterExotiqueExpe/dierExplorerExposerExprimerExquisExtensifExtraireExulterFableFabuleuxFacetteFacileFactureFaiblirFalaiseFameuxFamilleFarceurFarfeluFarineFaroucheFascinerFatalFatigueFauconFautifFaveurFavoriFe/brileFe/conderFe/de/rerFe/linFemmeFe/murFendoirFe/odalFermerFe/roceFerveurFestivalFeuilleFeutreFe/vrierFiascoFicelerFictifFide-leFigureFilatureFiletageFilie-reFilleulFilmerFilouFiltrerFinancerFinirFioleFirmeFissureFixerFlairerFlammeFlasqueFlatteurFle/auFle-cheFleurFlexionFloconFloreFluctuerFluideFluvialFolieFonderieFongibleFontaineForcerForgeronFormulerFortuneFossileFoudreFouge-reFouillerFoulureFourmiFragileFraiseFranchirFrapperFrayeurFre/gateFreinerFrelonFre/mirFre/ne/sieFre-reFriableFrictionFrissonFrivoleFroidFromageFrontalFrotterFruitFugitifFuiteFureurFurieuxFurtifFusionFuturGagnerGalaxieGalerieGambaderGarantirGardienGarnirGarrigueGazelleGazonGe/antGe/latineGe/luleGendarmeGe/ne/ralGe/nieGenouGentilGe/ologieGe/ome-treGe/raniumGermeGestuelGeyserGibierGiclerGirafeGivreGlaceGlaiveGlisserGlobeGloireGlorieuxGolfeurGommeGonflerGorgeGorilleGoudronGouffreGoulotGoupilleGourmandGoutteGraduelGraffitiGraineGrandGrappinGratuitGravirGrenatGriffureGrillerGrimperGrognerGronderGrotteGroupeGrugerGrutierGruye-reGue/pardGuerrierGuideGuimauveGuitareGustatifGymnasteGyrostatHabitudeHachoirHalteHameauHangarHannetonHaricotHarmonieHarponHasardHe/liumHe/matomeHerbeHe/rissonHermineHe/ronHe/siterHeureuxHibernerHibouHilarantHistoireHiverHomardHommageHomoge-neHonneurHonorerHonteuxHordeHorizonHorlogeHormoneHorribleHouleuxHousseHublotHuileuxHumainHumbleHumideHumourHurlerHydromelHygie-neHymneHypnoseIdylleIgnorerIguaneIlliciteIllusionImageImbiberImiterImmenseImmobileImmuableImpactImpe/rialImplorerImposerImprimerImputerIncarnerIncendieIncidentInclinerIncoloreIndexerIndiceInductifIne/ditIneptieInexactInfiniInfligerInformerInfusionInge/rerInhalerInhiberInjecterInjureInnocentInoculerInonderInscrireInsecteInsigneInsoliteInspirerInstinctInsulterIntactIntenseIntimeIntrigueIntuitifInutileInvasionInventerInviterInvoquerIroniqueIrradierIrre/elIrriterIsolerIvoireIvresseJaguarJaillirJambeJanvierJardinJaugerJauneJavelotJetableJetonJeudiJeunesseJoindreJoncherJonglerJoueurJouissifJournalJovialJoyauJoyeuxJubilerJugementJuniorJuponJuristeJusticeJuteuxJuve/nileKayakKimonoKiosqueLabelLabialLabourerLace/rerLactoseLaguneLaineLaisserLaitierLambeauLamelleLampeLanceurLangageLanterneLapinLargeurLarmeLaurierLavaboLavoirLectureLe/galLe/gerLe/gumeLessiveLettreLevierLexiqueLe/zardLiasseLibe/rerLibreLicenceLicorneLie-geLie-vreLigatureLigoterLigueLimerLimiteLimonadeLimpideLine/aireLingotLionceauLiquideLisie-reListerLithiumLitigeLittoralLivreurLogiqueLointainLoisirLombricLoterieLouerLourdLoutreLouveLoyalLubieLucideLucratifLueurLugubreLuisantLumie-reLunaireLundiLuronLutterLuxueuxMachineMagasinMagentaMagiqueMaigreMaillonMaintienMairieMaisonMajorerMalaxerMale/ficeMalheurMaliceMalletteMammouthMandaterManiableManquantManteauManuelMarathonMarbreMarchandMardiMaritimeMarqueurMarronMartelerMascotteMassifMate/rielMatie-reMatraqueMaudireMaussadeMauveMaximalMe/chantMe/connuMe/dailleMe/decinMe/diterMe/duseMeilleurMe/langeMe/lodieMembreMe/moireMenacerMenerMenhirMensongeMentorMercrediMe/riteMerleMessagerMesureMe/talMe/te/oreMe/thodeMe/tierMeubleMiaulerMicrobeMietteMignonMigrerMilieuMillionMimiqueMinceMine/ralMinimalMinorerMinuteMiracleMiroiterMissileMixteMobileModerneMoelleuxMondialMoniteurMonnaieMonotoneMonstreMontagneMonumentMoqueurMorceauMorsureMortierMoteurMotifMoucheMoufleMoulinMoussonMoutonMouvantMultipleMunitionMurailleMure-neMurmureMuscleMuse/umMusicienMutationMuterMutuelMyriadeMyrtilleMyste-reMythiqueNageurNappeNarquoisNarrerNatationNationNatureNaufrageNautiqueNavireNe/buleuxNectarNe/fasteNe/gationNe/gligerNe/gocierNeigeNerveuxNettoyerNeuroneNeutronNeveuNicheNickelNitrateNiveauNobleNocifNocturneNoirceurNoisetteNomadeNombreuxNommerNormatifNotableNotifierNotoireNourrirNouveauNovateurNovembreNoviceNuageNuancerNuireNuisibleNume/roNuptialNuqueNutritifObe/irObjectifObligerObscurObserverObstacleObtenirObturerOccasionOccuperOce/anOctobreOctroyerOctuplerOculaireOdeurOdorantOffenserOfficierOffrirOgiveOiseauOisillonOlfactifOlivierOmbrageOmettreOnctueuxOndulerOne/reuxOniriqueOpaleOpaqueOpe/rerOpinionOpportunOpprimerOpterOptiqueOrageuxOrangeOrbiteOrdonnerOreilleOrganeOrgueilOrificeOrnementOrqueOrtieOscillerOsmoseOssatureOtarieOuraganOursonOutilOutragerOuvrageOvationOxydeOxyge-neOzonePaisiblePalacePalmare-sPalourdePalperPanachePandaPangolinPaniquerPanneauPanoramaPantalonPapayePapierPapoterPapyrusParadoxeParcelleParesseParfumerParlerParoleParrainParsemerPartagerParureParvenirPassionPaste-quePaternelPatiencePatronPavillonPavoiserPayerPaysagePeignePeintrePelagePe/licanPellePelousePeluchePendulePe/ne/trerPe/niblePensifPe/nuriePe/pitePe/plumPerdrixPerforerPe/riodePermuterPerplexePersilPertePeserPe/talePetitPe/trirPeuplePharaonPhobiePhoquePhotonPhrasePhysiquePianoPicturalPie-cePierrePieuvrePilotePinceauPipettePiquerPiroguePiscinePistonPivoterPixelPizzaPlacardPlafondPlaisirPlanerPlaquePlastronPlateauPleurerPlexusPliagePlombPlongerPluiePlumagePochettePoe/siePoe-tePointePoirierPoissonPoivrePolairePolicierPollenPolygonePommadePompierPonctuelPonde/rerPoneyPortiquePositionPosse/derPosturePotagerPoteauPotionPoucePoulainPoumonPourprePoussinPouvoirPrairiePratiquePre/cieuxPre/direPre/fixePre/ludePre/nomPre/sencePre/textePre/voirPrimitifPrincePrisonPriverProble-meProce/derProdigeProfondProgre-sProieProjeterProloguePromenerPropreProspe-reProte/gerProuesseProverbePrudencePruneauPsychosePublicPuceronPuiserPulpePulsarPunaisePunitifPupitrePurifierPuzzlePyramideQuasarQuerelleQuestionQuie/tudeQuitterQuotientRacineRaconterRadieuxRagondinRaideurRaisinRalentirRallongeRamasserRapideRasageRatisserRavagerRavinRayonnerRe/actifRe/agirRe/aliserRe/animerRecevoirRe/citerRe/clamerRe/colterRecruterReculerRecyclerRe/digerRedouterRefaireRe/flexeRe/formerRefrainRefugeRe/galienRe/gionRe/glageRe/gulierRe/ite/rerRejeterRejouerRelatifReleverReliefRemarqueReme-deRemiseRemonterRemplirRemuerRenardRenfortReniflerRenoncerRentrerRenvoiReplierReporterRepriseReptileRequinRe/serveRe/sineuxRe/soudreRespectResterRe/sultatRe/tablirRetenirRe/ticuleRetomberRetracerRe/unionRe/ussirRevancheRevivreRe/volteRe/vulsifRichesseRideauRieurRigideRigolerRincerRiposterRisibleRisqueRituelRivalRivie-reRocheuxRomanceRompreRonceRondinRoseauRosierRotatifRotorRotuleRougeRouilleRouleauRoutineRoyaumeRubanRubisRucheRuelleRugueuxRuinerRuisseauRuserRustiqueRythmeSablerSaboterSabreSacocheSafariSagesseSaisirSaladeSaliveSalonSaluerSamediSanctionSanglierSarcasmeSardineSaturerSaugrenuSaumonSauterSauvageSavantSavonnerScalpelScandaleSce/le/ratSce/narioSceptreSche/maScienceScinderScoreScrutinSculpterSe/anceSe/cableSe/cherSecouerSe/cre/terSe/datifSe/duireSeigneurSe/jourSe/lectifSemaineSemblerSemenceSe/minalSe/nateurSensibleSentenceSe/parerSe/quenceSereinSergentSe/rieuxSerrureSe/rumServiceSe/sameSe/virSevrageSextupleSide/ralSie-cleSie/gerSifflerSigleSignalSilenceSiliciumSimpleSince-reSinistreSiphonSiropSismiqueSituerSkierSocialSocleSodiumSoigneuxSoldatSoleilSolitudeSolubleSombreSommeilSomnolerSondeSongeurSonnetteSonoreSorcierSortirSosieSottiseSoucieuxSoudureSouffleSouleverSoupapeSourceSoutirerSouvenirSpacieuxSpatialSpe/cialSphe-reSpiralStableStationSternumStimulusStipulerStrictStudieuxStupeurStylisteSublimeSubstratSubtilSubvenirSucce-sSucreSuffixeSugge/rerSuiveurSulfateSuperbeSupplierSurfaceSuricateSurmenerSurpriseSursautSurvieSuspectSyllabeSymboleSyme/trieSynapseSyntaxeSyste-meTabacTablierTactileTaillerTalentTalismanTalonnerTambourTamiserTangibleTapisTaquinerTarderTarifTartineTasseTatamiTatouageTaupeTaureauTaxerTe/moinTemporelTenailleTendreTeneurTenirTensionTerminerTerneTerribleTe/tineTexteThe-meThe/orieThe/rapieThoraxTibiaTie-deTimideTirelireTiroirTissuTitaneTitreTituberTobogganTole/rantTomateToniqueTonneauToponymeTorcheTordreTornadeTorpilleTorrentTorseTortueTotemToucherTournageTousserToxineTractionTraficTragiqueTrahirTrainTrancherTravailTre-fleTremperTre/sorTreuilTriageTribunalTricoterTrilogieTriompheTriplerTriturerTrivialTromboneTroncTropicalTroupeauTuileTulipeTumulteTunnelTurbineTuteurTutoyerTuyauTympanTyphonTypiqueTyranUbuesqueUltimeUltrasonUnanimeUnifierUnionUniqueUnitaireUniversUraniumUrbainUrticantUsageUsineUsuelUsureUtileUtopieVacarmeVaccinVagabondVagueVaillantVaincreVaisseauValableValiseVallonValveVampireVanilleVapeurVarierVaseuxVassalVasteVecteurVedetteVe/ge/talVe/hiculeVeinardVe/loceVendrediVe/ne/rerVengerVenimeuxVentouseVerdureVe/rinVernirVerrouVerserVertuVestonVe/te/ranVe/tusteVexantVexerViaducViandeVictoireVidangeVide/oVignetteVigueurVilainVillageVinaigreViolonVipe-reVirementVirtuoseVirusVisageViseurVisionVisqueuxVisuelVitalVitesseViticoleVitrineVivaceVivipareVocationVoguerVoileVoisinVoitureVolailleVolcanVoltigerVolumeVoraceVortexVoterVouloirVoyageVoyelleWagonXe/nonYachtZe-breZe/nithZesteZoologie";
|
|
20992
20992
|
var wordlist = null;
|
|
20993
20993
|
var lookup = {};
|
|
20994
|
-
function dropDiacritic(
|
|
20994
|
+
function dropDiacritic(word2) {
|
|
20995
20995
|
wordlist_1.logger.checkNormalize();
|
|
20996
|
-
return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(
|
|
20996
|
+
return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word2.normalize("NFD").toLowerCase()), function(c) {
|
|
20997
20997
|
return c >= 65 && c <= 90 || c >= 97 && c <= 123;
|
|
20998
20998
|
}));
|
|
20999
20999
|
}
|
|
21000
|
-
function expand(
|
|
21000
|
+
function expand(word2) {
|
|
21001
21001
|
var output = [];
|
|
21002
|
-
Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(
|
|
21002
|
+
Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word2), function(c) {
|
|
21003
21003
|
if (c === 47) {
|
|
21004
21004
|
output.push(204);
|
|
21005
21005
|
output.push(129);
|
|
@@ -21019,8 +21019,8 @@ var require_lang_fr = __commonJS({
|
|
|
21019
21019
|
wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) {
|
|
21020
21020
|
return expand(w);
|
|
21021
21021
|
});
|
|
21022
|
-
wordlist.forEach(function(
|
|
21023
|
-
lookup[dropDiacritic(
|
|
21022
|
+
wordlist.forEach(function(word2, index) {
|
|
21023
|
+
lookup[dropDiacritic(word2)] = index;
|
|
21024
21024
|
});
|
|
21025
21025
|
if (wordlist_1.Wordlist.check(lang) !== "0x51deb7ae009149dc61a6bd18a918eb7ac78d2775726c68e598b92d002519b045") {
|
|
21026
21026
|
wordlist = null;
|
|
@@ -21038,9 +21038,9 @@ var require_lang_fr = __commonJS({
|
|
|
21038
21038
|
loadWords(this);
|
|
21039
21039
|
return wordlist[index];
|
|
21040
21040
|
};
|
|
21041
|
-
LangFr2.prototype.getWordIndex = function(
|
|
21041
|
+
LangFr2.prototype.getWordIndex = function(word2) {
|
|
21042
21042
|
loadWords(this);
|
|
21043
|
-
return lookup[dropDiacritic(
|
|
21043
|
+
return lookup[dropDiacritic(word2)];
|
|
21044
21044
|
};
|
|
21045
21045
|
return LangFr2;
|
|
21046
21046
|
})(wordlist_1.Wordlist)
|
|
@@ -21097,8 +21097,8 @@ var require_lang_ja = __commonJS({
|
|
|
21097
21097
|
];
|
|
21098
21098
|
var mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt";
|
|
21099
21099
|
var wordlist = null;
|
|
21100
|
-
function hex(
|
|
21101
|
-
return (0, bytes_1.hexlify)((0, strings_1.toUtf8Bytes)(
|
|
21100
|
+
function hex(word2) {
|
|
21101
|
+
return (0, bytes_1.hexlify)((0, strings_1.toUtf8Bytes)(word2));
|
|
21102
21102
|
}
|
|
21103
21103
|
var KiYoKu = "0xe3818de38284e3818f";
|
|
21104
21104
|
var KyoKu = "0xe3818de38283e3818f";
|
|
@@ -21114,10 +21114,10 @@ var require_lang_ja = __commonJS({
|
|
|
21114
21114
|
transform[(0, strings_1.toUtf8String)([227, 129, 163])] = (0, strings_1.toUtf8String)([227, 129, 164]);
|
|
21115
21115
|
transform[(0, strings_1.toUtf8String)([227, 130, 131])] = (0, strings_1.toUtf8String)([227, 130, 132]);
|
|
21116
21116
|
transform[(0, strings_1.toUtf8String)([227, 130, 135])] = (0, strings_1.toUtf8String)([227, 130, 136]);
|
|
21117
|
-
function normalize2(
|
|
21117
|
+
function normalize2(word3) {
|
|
21118
21118
|
var result = "";
|
|
21119
|
-
for (var i2 = 0; i2 <
|
|
21120
|
-
var kana =
|
|
21119
|
+
for (var i2 = 0; i2 < word3.length; i2++) {
|
|
21120
|
+
var kana = word3[i2];
|
|
21121
21121
|
var target = transform[kana];
|
|
21122
21122
|
if (target === false) {
|
|
21123
21123
|
continue;
|
|
@@ -21143,14 +21143,14 @@ var require_lang_ja = __commonJS({
|
|
|
21143
21143
|
for (var length_1 = 3; length_1 <= 9; length_1++) {
|
|
21144
21144
|
var d = data[length_1 - 3];
|
|
21145
21145
|
for (var offset = 0; offset < d.length; offset += length_1) {
|
|
21146
|
-
var
|
|
21146
|
+
var word2 = [];
|
|
21147
21147
|
for (var i = 0; i < length_1; i++) {
|
|
21148
21148
|
var k = mapping.indexOf(d[offset + i]);
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21149
|
+
word2.push(227);
|
|
21150
|
+
word2.push(k & 64 ? 130 : 129);
|
|
21151
|
+
word2.push((k & 63) + 128);
|
|
21152
21152
|
}
|
|
21153
|
-
wordlist.push((0, strings_1.toUtf8String)(
|
|
21153
|
+
wordlist.push((0, strings_1.toUtf8String)(word2));
|
|
21154
21154
|
}
|
|
21155
21155
|
}
|
|
21156
21156
|
wordlist.sort(sortJapanese);
|
|
@@ -21175,9 +21175,9 @@ var require_lang_ja = __commonJS({
|
|
|
21175
21175
|
loadWords(this);
|
|
21176
21176
|
return wordlist[index];
|
|
21177
21177
|
};
|
|
21178
|
-
LangJa2.prototype.getWordIndex = function(
|
|
21178
|
+
LangJa2.prototype.getWordIndex = function(word2) {
|
|
21179
21179
|
loadWords(this);
|
|
21180
|
-
return wordlist.indexOf(
|
|
21180
|
+
return wordlist.indexOf(word2);
|
|
21181
21181
|
};
|
|
21182
21182
|
LangJa2.prototype.split = function(mnemonic) {
|
|
21183
21183
|
wordlist_1.logger.checkNormalize();
|
|
@@ -21250,11 +21250,11 @@ var require_lang_ko = __commonJS({
|
|
|
21250
21250
|
data.forEach(function(data2, length) {
|
|
21251
21251
|
length += 4;
|
|
21252
21252
|
for (var i = 0; i < data2.length; i += length) {
|
|
21253
|
-
var
|
|
21253
|
+
var word2 = "";
|
|
21254
21254
|
for (var j = 0; j < length; j++) {
|
|
21255
|
-
|
|
21255
|
+
word2 += getHangul(codes.indexOf(data2[i + j]));
|
|
21256
21256
|
}
|
|
21257
|
-
wordlist.push(
|
|
21257
|
+
wordlist.push(word2);
|
|
21258
21258
|
}
|
|
21259
21259
|
});
|
|
21260
21260
|
wordlist.sort();
|
|
@@ -21274,9 +21274,9 @@ var require_lang_ko = __commonJS({
|
|
|
21274
21274
|
loadWords(this);
|
|
21275
21275
|
return wordlist[index];
|
|
21276
21276
|
};
|
|
21277
|
-
LangKo2.prototype.getWordIndex = function(
|
|
21277
|
+
LangKo2.prototype.getWordIndex = function(word2) {
|
|
21278
21278
|
loadWords(this);
|
|
21279
|
-
return wordlist.indexOf(
|
|
21279
|
+
return wordlist.indexOf(word2);
|
|
21280
21280
|
};
|
|
21281
21281
|
return LangKo2;
|
|
21282
21282
|
})(wordlist_1.Wordlist)
|
|
@@ -21336,9 +21336,9 @@ var require_lang_it = __commonJS({
|
|
|
21336
21336
|
loadWords(this);
|
|
21337
21337
|
return wordlist[index];
|
|
21338
21338
|
};
|
|
21339
|
-
LangIt2.prototype.getWordIndex = function(
|
|
21339
|
+
LangIt2.prototype.getWordIndex = function(word2) {
|
|
21340
21340
|
loadWords(this);
|
|
21341
|
-
return wordlist.indexOf(
|
|
21341
|
+
return wordlist.indexOf(word2);
|
|
21342
21342
|
};
|
|
21343
21343
|
return LangIt2;
|
|
21344
21344
|
})(wordlist_1.Wordlist)
|
|
@@ -21425,9 +21425,9 @@ var require_lang_zh = __commonJS({
|
|
|
21425
21425
|
loadWords(this);
|
|
21426
21426
|
return wordlist[this.locale][index];
|
|
21427
21427
|
};
|
|
21428
|
-
LangZh2.prototype.getWordIndex = function(
|
|
21428
|
+
LangZh2.prototype.getWordIndex = function(word2) {
|
|
21429
21429
|
loadWords(this);
|
|
21430
|
-
return wordlist[this.locale].indexOf(
|
|
21430
|
+
return wordlist[this.locale].indexOf(word2);
|
|
21431
21431
|
};
|
|
21432
21432
|
LangZh2.prototype.split = function(mnemonic) {
|
|
21433
21433
|
mnemonic = mnemonic.replace(/(?:\u3000| )+/g, "");
|
|
@@ -21610,9 +21610,9 @@ var require_lib23 = __commonJS({
|
|
|
21610
21610
|
if (index > 4294967295) {
|
|
21611
21611
|
throw new Error("invalid index - " + String(index));
|
|
21612
21612
|
}
|
|
21613
|
-
var
|
|
21614
|
-
if (
|
|
21615
|
-
|
|
21613
|
+
var path4 = this.path;
|
|
21614
|
+
if (path4) {
|
|
21615
|
+
path4 += "/" + (index & ~HardenedBit);
|
|
21616
21616
|
}
|
|
21617
21617
|
var data = new Uint8Array(37);
|
|
21618
21618
|
if (index & HardenedBit) {
|
|
@@ -21620,8 +21620,8 @@ var require_lib23 = __commonJS({
|
|
|
21620
21620
|
throw new Error("cannot derive child of neutered node");
|
|
21621
21621
|
}
|
|
21622
21622
|
data.set((0, bytes_1.arrayify)(this.privateKey), 1);
|
|
21623
|
-
if (
|
|
21624
|
-
|
|
21623
|
+
if (path4) {
|
|
21624
|
+
path4 += "'";
|
|
21625
21625
|
}
|
|
21626
21626
|
} else {
|
|
21627
21627
|
data.set((0, bytes_1.arrayify)(this.publicKey));
|
|
@@ -21640,21 +21640,21 @@ var require_lib23 = __commonJS({
|
|
|
21640
21640
|
var ek = new signing_key_1.SigningKey((0, bytes_1.hexlify)(IL));
|
|
21641
21641
|
Ki = ek._addPoint(this.publicKey);
|
|
21642
21642
|
}
|
|
21643
|
-
var mnemonicOrPath =
|
|
21643
|
+
var mnemonicOrPath = path4;
|
|
21644
21644
|
var srcMnemonic = this.mnemonic;
|
|
21645
21645
|
if (srcMnemonic) {
|
|
21646
21646
|
mnemonicOrPath = Object.freeze({
|
|
21647
21647
|
phrase: srcMnemonic.phrase,
|
|
21648
|
-
path:
|
|
21648
|
+
path: path4,
|
|
21649
21649
|
locale: srcMnemonic.locale || "en"
|
|
21650
21650
|
});
|
|
21651
21651
|
}
|
|
21652
21652
|
return new HDNode2(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath);
|
|
21653
21653
|
};
|
|
21654
|
-
HDNode2.prototype.derivePath = function(
|
|
21655
|
-
var components =
|
|
21654
|
+
HDNode2.prototype.derivePath = function(path4) {
|
|
21655
|
+
var components = path4.split("/");
|
|
21656
21656
|
if (components.length === 0 || components[0] === "m" && this.depth !== 0) {
|
|
21657
|
-
throw new Error("invalid path - " +
|
|
21657
|
+
throw new Error("invalid path - " + path4);
|
|
21658
21658
|
}
|
|
21659
21659
|
if (components[0] === "m") {
|
|
21660
21660
|
components.shift();
|
|
@@ -21923,13 +21923,13 @@ var require_aes_js = __commonJS({
|
|
|
21923
21923
|
targetArray.set(sourceArray, targetStart);
|
|
21924
21924
|
}
|
|
21925
21925
|
var convertUtf8 = /* @__PURE__ */ (function() {
|
|
21926
|
-
function toBytes(
|
|
21926
|
+
function toBytes(text6) {
|
|
21927
21927
|
var result = [], i = 0;
|
|
21928
|
-
|
|
21929
|
-
while (i <
|
|
21930
|
-
var c =
|
|
21928
|
+
text6 = encodeURI(text6);
|
|
21929
|
+
while (i < text6.length) {
|
|
21930
|
+
var c = text6.charCodeAt(i++);
|
|
21931
21931
|
if (c === 37) {
|
|
21932
|
-
result.push(parseInt(
|
|
21932
|
+
result.push(parseInt(text6.substr(i, 2), 16));
|
|
21933
21933
|
i += 2;
|
|
21934
21934
|
} else {
|
|
21935
21935
|
result.push(c);
|
|
@@ -21960,10 +21960,10 @@ var require_aes_js = __commonJS({
|
|
|
21960
21960
|
};
|
|
21961
21961
|
})();
|
|
21962
21962
|
var convertHex = /* @__PURE__ */ (function() {
|
|
21963
|
-
function toBytes(
|
|
21963
|
+
function toBytes(text6) {
|
|
21964
21964
|
var result = [];
|
|
21965
|
-
for (var i = 0; i <
|
|
21966
|
-
result.push(parseInt(
|
|
21965
|
+
for (var i = 0; i < text6.length; i += 2) {
|
|
21966
|
+
result.push(parseInt(text6.substr(i, 2), 16));
|
|
21967
21967
|
}
|
|
21968
21968
|
return result;
|
|
21969
21969
|
}
|
|
@@ -22460,9 +22460,9 @@ var require_utils4 = __commonJS({
|
|
|
22460
22460
|
return (0, bytes_1.arrayify)(password);
|
|
22461
22461
|
}
|
|
22462
22462
|
exports.getPassword = getPassword;
|
|
22463
|
-
function searchPath(object,
|
|
22463
|
+
function searchPath(object, path4) {
|
|
22464
22464
|
var currentChild = object;
|
|
22465
|
-
var comps =
|
|
22465
|
+
var comps = path4.toLowerCase().split("/");
|
|
22466
22466
|
for (var i = 0; i < comps.length; i++) {
|
|
22467
22467
|
var matchingChild = null;
|
|
22468
22468
|
for (var key in currentChild) {
|
|
@@ -23297,12 +23297,12 @@ var require_keystore = __commonJS({
|
|
|
23297
23297
|
var mnemonicIv = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "x-ethers/mnemonicCounter"));
|
|
23298
23298
|
var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv);
|
|
23299
23299
|
var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);
|
|
23300
|
-
var
|
|
23300
|
+
var path4 = (0, utils_1.searchPath)(data, "x-ethers/path") || hdnode_1.defaultPath;
|
|
23301
23301
|
var locale = (0, utils_1.searchPath)(data, "x-ethers/locale") || "en";
|
|
23302
23302
|
var entropy = (0, bytes_1.arrayify)(mnemonicAesCtr.decrypt(mnemonicCiphertext));
|
|
23303
23303
|
try {
|
|
23304
23304
|
var mnemonic = (0, hdnode_1.entropyToMnemonic)(entropy, locale);
|
|
23305
|
-
var node = hdnode_1.HDNode.fromMnemonic(mnemonic, null, locale).derivePath(
|
|
23305
|
+
var node = hdnode_1.HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path4);
|
|
23306
23306
|
if (node.privateKey != account.privateKey) {
|
|
23307
23307
|
throw new Error("mnemonic mismatch");
|
|
23308
23308
|
}
|
|
@@ -23412,12 +23412,12 @@ var require_keystore = __commonJS({
|
|
|
23412
23412
|
var privateKey = (0, bytes_1.arrayify)(account.privateKey);
|
|
23413
23413
|
var passwordBytes = (0, utils_1.getPassword)(password);
|
|
23414
23414
|
var entropy = null;
|
|
23415
|
-
var
|
|
23415
|
+
var path4 = null;
|
|
23416
23416
|
var locale = null;
|
|
23417
23417
|
if (hasMnemonic(account)) {
|
|
23418
23418
|
var srcMnemonic = account.mnemonic;
|
|
23419
23419
|
entropy = (0, bytes_1.arrayify)((0, hdnode_1.mnemonicToEntropy)(srcMnemonic.phrase, srcMnemonic.locale || "en"));
|
|
23420
|
-
|
|
23420
|
+
path4 = srcMnemonic.path || hdnode_1.defaultPath;
|
|
23421
23421
|
locale = srcMnemonic.locale || "en";
|
|
23422
23422
|
}
|
|
23423
23423
|
var client = options.client;
|
|
@@ -23503,7 +23503,7 @@ var require_keystore = __commonJS({
|
|
|
23503
23503
|
gethFilename: "UTC--" + timestamp + "--" + data.address,
|
|
23504
23504
|
mnemonicCounter: (0, bytes_1.hexlify)(mnemonicIv).substring(2),
|
|
23505
23505
|
mnemonicCiphertext: (0, bytes_1.hexlify)(mnemonicCiphertext).substring(2),
|
|
23506
|
-
path:
|
|
23506
|
+
path: path4,
|
|
23507
23507
|
locale,
|
|
23508
23508
|
version: "0.1"
|
|
23509
23509
|
};
|
|
@@ -23894,11 +23894,11 @@ var require_lib26 = __commonJS({
|
|
|
23894
23894
|
Wallet2.fromEncryptedJsonSync = function(json, password) {
|
|
23895
23895
|
return new Wallet2((0, json_wallets_1.decryptJsonWalletSync)(json, password));
|
|
23896
23896
|
};
|
|
23897
|
-
Wallet2.fromMnemonic = function(mnemonic,
|
|
23898
|
-
if (!
|
|
23899
|
-
|
|
23897
|
+
Wallet2.fromMnemonic = function(mnemonic, path4, wordlist) {
|
|
23898
|
+
if (!path4) {
|
|
23899
|
+
path4 = hdnode_1.defaultPath;
|
|
23900
23900
|
}
|
|
23901
|
-
return new Wallet2(hdnode_1.HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(
|
|
23901
|
+
return new Wallet2(hdnode_1.HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(path4));
|
|
23902
23902
|
};
|
|
23903
23903
|
return Wallet2;
|
|
23904
23904
|
})(abstract_signer_1.Signer)
|
|
@@ -34673,13 +34673,13 @@ var require_ipc_provider = __commonJS({
|
|
|
34673
34673
|
/** @class */
|
|
34674
34674
|
(function(_super) {
|
|
34675
34675
|
__extends(IpcProvider2, _super);
|
|
34676
|
-
function IpcProvider2(
|
|
34676
|
+
function IpcProvider2(path4, network) {
|
|
34677
34677
|
var _this = this;
|
|
34678
|
-
if (
|
|
34678
|
+
if (path4 == null) {
|
|
34679
34679
|
logger.throwError("missing path", logger_1.Logger.errors.MISSING_ARGUMENT, { arg: "path" });
|
|
34680
34680
|
}
|
|
34681
|
-
_this = _super.call(this, "ipc://" +
|
|
34682
|
-
(0, properties_1.defineReadOnly)(_this, "path",
|
|
34681
|
+
_this = _super.call(this, "ipc://" + path4, network) || this;
|
|
34682
|
+
(0, properties_1.defineReadOnly)(_this, "path", path4);
|
|
34683
34683
|
return _this;
|
|
34684
34684
|
}
|
|
34685
34685
|
IpcProvider2.prototype.send = function(method, params) {
|
|
@@ -35278,21 +35278,21 @@ var require_web3_provider = __commonJS({
|
|
|
35278
35278
|
if (provider == null) {
|
|
35279
35279
|
logger.throwArgumentError("missing provider", "provider", provider);
|
|
35280
35280
|
}
|
|
35281
|
-
var
|
|
35281
|
+
var path4 = null;
|
|
35282
35282
|
var jsonRpcFetchFunc = null;
|
|
35283
35283
|
var subprovider = null;
|
|
35284
35284
|
if (typeof provider === "function") {
|
|
35285
|
-
|
|
35285
|
+
path4 = "unknown:";
|
|
35286
35286
|
jsonRpcFetchFunc = provider;
|
|
35287
35287
|
} else {
|
|
35288
|
-
|
|
35289
|
-
if (!
|
|
35290
|
-
|
|
35288
|
+
path4 = provider.host || provider.path || "";
|
|
35289
|
+
if (!path4 && provider.isMetaMask) {
|
|
35290
|
+
path4 = "metamask";
|
|
35291
35291
|
}
|
|
35292
35292
|
subprovider = provider;
|
|
35293
35293
|
if (provider.request) {
|
|
35294
|
-
if (
|
|
35295
|
-
|
|
35294
|
+
if (path4 === "") {
|
|
35295
|
+
path4 = "eip-1193:";
|
|
35296
35296
|
}
|
|
35297
35297
|
jsonRpcFetchFunc = buildEip1193Fetcher(provider);
|
|
35298
35298
|
} else if (provider.sendAsync) {
|
|
@@ -35302,11 +35302,11 @@ var require_web3_provider = __commonJS({
|
|
|
35302
35302
|
} else {
|
|
35303
35303
|
logger.throwArgumentError("unsupported provider", "provider", provider);
|
|
35304
35304
|
}
|
|
35305
|
-
if (!
|
|
35306
|
-
|
|
35305
|
+
if (!path4) {
|
|
35306
|
+
path4 = "unknown:";
|
|
35307
35307
|
}
|
|
35308
35308
|
}
|
|
35309
|
-
_this = _super.call(this,
|
|
35309
|
+
_this = _super.call(this, path4, network) || this;
|
|
35310
35310
|
(0, properties_1.defineReadOnly)(_this, "jsonRpcFetchFunc", jsonRpcFetchFunc);
|
|
35311
35311
|
(0, properties_1.defineReadOnly)(_this, "provider", subprovider);
|
|
35312
35312
|
return _this;
|
|
@@ -36406,15 +36406,15 @@ var SETTINGS = Object.freeze({
|
|
|
36406
36406
|
var MAX_LABEL_LENGTH = 80;
|
|
36407
36407
|
var trim = (value) => String(value ?? "").trim();
|
|
36408
36408
|
var normalizeLabel = (value, field) => {
|
|
36409
|
-
const
|
|
36410
|
-
if (
|
|
36411
|
-
return
|
|
36409
|
+
const text6 = trim(value).replace(/\s+/g, " ");
|
|
36410
|
+
if (text6.length > MAX_LABEL_LENGTH) throw new Error(`${field} must be ${MAX_LABEL_LENGTH} characters or fewer.`);
|
|
36411
|
+
return text6;
|
|
36412
36412
|
};
|
|
36413
36413
|
var normalizeHttpOrigin = (value, field) => {
|
|
36414
|
-
const
|
|
36414
|
+
const text6 = trim(value);
|
|
36415
36415
|
let parsed;
|
|
36416
36416
|
try {
|
|
36417
|
-
parsed = new URL(
|
|
36417
|
+
parsed = new URL(text6);
|
|
36418
36418
|
} catch {
|
|
36419
36419
|
throw new Error(`${field} must be an http(s) origin.`);
|
|
36420
36420
|
}
|
|
@@ -36425,11 +36425,11 @@ var normalizeHttpOrigin = (value, field) => {
|
|
|
36425
36425
|
};
|
|
36426
36426
|
var isLocalUrl = (url) => ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
36427
36427
|
var normalizeRpcUrl = (value, allowLocal) => {
|
|
36428
|
-
const
|
|
36429
|
-
if (!
|
|
36428
|
+
const text6 = trim(value);
|
|
36429
|
+
if (!text6) return "";
|
|
36430
36430
|
let parsed;
|
|
36431
36431
|
try {
|
|
36432
|
-
parsed = new URL(
|
|
36432
|
+
parsed = new URL(text6);
|
|
36433
36433
|
} catch {
|
|
36434
36434
|
throw new Error("CE_MCP_RPC_URL must be an https URL.");
|
|
36435
36435
|
}
|
|
@@ -36640,9 +36640,9 @@ var DIAGNOSTICS = /\[ See: |\((?=\w+=)|\b(?:requestBody|body|url|transaction|dat
|
|
|
36640
36640
|
var URLS = /\b[a-z][\w+.-]*:\/\/[^\s"'`]+/gi;
|
|
36641
36641
|
var hostOnly = (url) => /<\w+>/.test(url) ? url : url.replace(/^([^:]+:\/\/)(?:[^/?#]*@)?([^/?#]*)[\s\S]*$/, "$1$2");
|
|
36642
36642
|
var describeError = (error) => {
|
|
36643
|
-
const
|
|
36644
|
-
const cut =
|
|
36645
|
-
return (cut < 0 ?
|
|
36643
|
+
const text6 = String(error?.message || error || "").slice(0, MAX_ERROR_LENGTH);
|
|
36644
|
+
const cut = text6.search(DIAGNOSTICS);
|
|
36645
|
+
return (cut < 0 ? text6 : text6.slice(0, cut)).trimEnd().replace(URLS, hostOnly) || "Unknown error.";
|
|
36646
36646
|
};
|
|
36647
36647
|
var DEFAULT_TOOL_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
36648
36648
|
var createMcpServer = ({
|
|
@@ -36665,8 +36665,8 @@ var createMcpServer = ({
|
|
|
36665
36665
|
...annotations ? { annotations } : {}
|
|
36666
36666
|
}));
|
|
36667
36667
|
const toolResult = (value, isError = false) => {
|
|
36668
|
-
const
|
|
36669
|
-
const result = { content: [{ type: "text", text:
|
|
36668
|
+
const text6 = typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
36669
|
+
const result = { content: [{ type: "text", text: text6 }] };
|
|
36670
36670
|
if (!isError && isRecord2(value) && protocolVersion >= STRUCTURED_CONTENT_SINCE) {
|
|
36671
36671
|
result.structuredContent = value;
|
|
36672
36672
|
}
|
|
@@ -36761,11 +36761,11 @@ var createMcpServer = ({
|
|
|
36761
36761
|
}
|
|
36762
36762
|
};
|
|
36763
36763
|
const handleLine = async (line) => {
|
|
36764
|
-
const
|
|
36765
|
-
if (!
|
|
36764
|
+
const text6 = String(line || "").trim();
|
|
36765
|
+
if (!text6) return "";
|
|
36766
36766
|
let decoded;
|
|
36767
36767
|
try {
|
|
36768
|
-
decoded = JSON.parse(
|
|
36768
|
+
decoded = JSON.parse(text6);
|
|
36769
36769
|
} catch {
|
|
36770
36770
|
return JSON.stringify(errorResponse(null, PARSE_ERROR, "Parse error."));
|
|
36771
36771
|
}
|
|
@@ -38350,10 +38350,10 @@ var normalizeAnswerValue = (question = {}, value) => {
|
|
|
38350
38350
|
return { ok: true, value: votes };
|
|
38351
38351
|
}
|
|
38352
38352
|
case "freeform": {
|
|
38353
|
-
const
|
|
38354
|
-
if (!
|
|
38355
|
-
if (
|
|
38356
|
-
return { ok: true, value:
|
|
38353
|
+
const text6 = trim3(value);
|
|
38354
|
+
if (!text6) return fail("Freeform answers must be non-empty text.");
|
|
38355
|
+
if (text6.length > MAX_FREEFORM_LENGTH) return fail(`Freeform answers must be ${MAX_FREEFORM_LENGTH} characters or fewer.`);
|
|
38356
|
+
return { ok: true, value: text6 };
|
|
38357
38357
|
}
|
|
38358
38358
|
default:
|
|
38359
38359
|
return fail(`Unsupported question type "${trim3(question.type)}".`);
|
|
@@ -38380,7 +38380,7 @@ var legacyIsAmbiguous = (type, options, singleSelect) => {
|
|
|
38380
38380
|
const labels = validOptions(options).map((o) => o.trim().toLowerCase());
|
|
38381
38381
|
return labels.length === 0 || labels.some((label) => label.includes(":") || label.includes(",")) || !singleSelect && labels.length === 1 && labels[0] === "single";
|
|
38382
38382
|
};
|
|
38383
|
-
var v2Text = (
|
|
38383
|
+
var v2Text = (text6) => (text6 || "").trim().toLowerCase().normalize("NFC");
|
|
38384
38384
|
var v2Preimage = (type, prompt, options, singleSelect) => JSON.stringify(["ce-question-id", 2, type, v2Text(prompt), validOptions(options).map(v2Text), !!singleSelect]);
|
|
38385
38385
|
var createQuestionIdDerivation = (ethers7) => {
|
|
38386
38386
|
const { id: hash } = ethers7.utils;
|
|
@@ -38484,10 +38484,10 @@ var normalizeOptionList = (options) => {
|
|
|
38484
38484
|
};
|
|
38485
38485
|
var buildQuestionRecord = ({ type = "binary", prompt, options, singleSelect = false, voiceCredits, tags = [], creator, session, profile = {} }) => {
|
|
38486
38486
|
if (!QUESTION_TYPES.includes(type)) return fail2(`Question type must be one of: ${QUESTION_TYPES.join(", ")}.`);
|
|
38487
|
-
const
|
|
38488
|
-
if (!
|
|
38489
|
-
if (
|
|
38490
|
-
const record = { id: "", type, prompt:
|
|
38487
|
+
const text6 = trim4(prompt);
|
|
38488
|
+
if (!text6) return fail2("The statement text is empty.");
|
|
38489
|
+
if (text6.length > MAX_PROMPT_LENGTH) return fail2(`Statements must be ${MAX_PROMPT_LENGTH} characters or fewer.`);
|
|
38490
|
+
const record = { id: "", type, prompt: text6 };
|
|
38491
38491
|
let optionList = [];
|
|
38492
38492
|
if (type === "multichoice" || type === "quadratic") {
|
|
38493
38493
|
const normalized2 = normalizeOptionList(options);
|
|
@@ -38514,7 +38514,7 @@ var buildQuestionRecord = ({ type = "binary", prompt, options, singleSelect = fa
|
|
|
38514
38514
|
record.sessionName = trim4(session.sessionName) || session.sessionSlug;
|
|
38515
38515
|
record.sessionSlug = session.sessionSlug;
|
|
38516
38516
|
record.sessionId = session.sessionId;
|
|
38517
|
-
record.id = generateQuestionId(type,
|
|
38517
|
+
record.id = generateQuestionId(type, text6, optionList, record.singleSelect === true, credits);
|
|
38518
38518
|
return { ok: true, id: record.id, record };
|
|
38519
38519
|
};
|
|
38520
38520
|
|
|
@@ -38662,14 +38662,14 @@ var WorkerRequestError = class extends Error {
|
|
|
38662
38662
|
this.details = details;
|
|
38663
38663
|
}
|
|
38664
38664
|
};
|
|
38665
|
-
var explainFailure = (status, error,
|
|
38665
|
+
var explainFailure = (status, error, path4) => {
|
|
38666
38666
|
const detail = error.slice(0, MAX_ERROR_DETAIL);
|
|
38667
38667
|
if (status === 401) return `Sign-in expired or was rejected (${detail || "401"}).`;
|
|
38668
38668
|
if (status === 403 && /origin/i.test(detail)) {
|
|
38669
38669
|
return `The Worker refused this sign-in origin (${detail}). Ask the session admin to allow it.`;
|
|
38670
38670
|
}
|
|
38671
38671
|
if (status === 403) return `Not allowed: ${detail || "this session\u2019s access rules deny the request"}.`;
|
|
38672
|
-
if (status === 404 &&
|
|
38672
|
+
if (status === 404 && path4.startsWith("/session-config")) return "No hosted session with that name exists on this Worker.";
|
|
38673
38673
|
if (status === 410) return "This session has ended and no longer accepts answers.";
|
|
38674
38674
|
if (status === 429) return `Rate limited by the Worker (${detail || "429"}). Wait a minute and retry.`;
|
|
38675
38675
|
return detail || `Worker request failed (${status}).`;
|
|
@@ -38746,8 +38746,17 @@ var resolveLoginOrigin = (config, trustedOrigins) => {
|
|
|
38746
38746
|
}
|
|
38747
38747
|
return origin;
|
|
38748
38748
|
};
|
|
38749
|
-
var createWorkerClient = ({
|
|
38750
|
-
|
|
38749
|
+
var createWorkerClient = ({
|
|
38750
|
+
workerOrigin,
|
|
38751
|
+
slug,
|
|
38752
|
+
trustedOrigins,
|
|
38753
|
+
wallet,
|
|
38754
|
+
fetchImpl = globalThis.fetch,
|
|
38755
|
+
now = () => Date.now(),
|
|
38756
|
+
registryConfigLoader,
|
|
38757
|
+
sessionId: joinedSessionId = ""
|
|
38758
|
+
}) => {
|
|
38759
|
+
let sessionId = joinedSessionId;
|
|
38751
38760
|
let config = null;
|
|
38752
38761
|
let configLoadedAt = 0;
|
|
38753
38762
|
let loginOrigin = "";
|
|
@@ -38756,7 +38765,9 @@ var createWorkerClient = ({ workerOrigin, slug, trustedOrigins, wallet, fetchImp
|
|
|
38756
38765
|
let pendingLogin = null;
|
|
38757
38766
|
let presence = null;
|
|
38758
38767
|
let presenceLoadedAt = -Infinity;
|
|
38759
|
-
|
|
38768
|
+
let features = null;
|
|
38769
|
+
let featuresLoadedAt = -Infinity;
|
|
38770
|
+
const request = async (path4, { method = "GET", headers = {}, body, form, auth = false, retried = false, maxBytes = MAX_RESPONSE_BYTES, signal } = {}) => {
|
|
38760
38771
|
const checkpoint = () => {
|
|
38761
38772
|
if (signal?.aborted) throw new Error("Stopped before the Worker request was sent.");
|
|
38762
38773
|
};
|
|
@@ -38765,7 +38776,7 @@ var createWorkerClient = ({ workerOrigin, slug, trustedOrigins, wallet, fetchImp
|
|
|
38765
38776
|
checkpoint();
|
|
38766
38777
|
let response;
|
|
38767
38778
|
try {
|
|
38768
|
-
response = await fetchImpl(`${workerOrigin}${
|
|
38779
|
+
response = await fetchImpl(`${workerOrigin}${path4}`, {
|
|
38769
38780
|
method,
|
|
38770
38781
|
redirect: "error",
|
|
38771
38782
|
headers: {
|
|
@@ -38773,7 +38784,7 @@ var createWorkerClient = ({ workerOrigin, slug, trustedOrigins, wallet, fetchImp
|
|
|
38773
38784
|
...auth ? { Authorization: `Bearer ${token}`, "X-Group-Slug": slug } : {},
|
|
38774
38785
|
...headers
|
|
38775
38786
|
},
|
|
38776
|
-
...body === void 0 ? {} : { body: JSON.stringify(body) },
|
|
38787
|
+
...form ? { body: form } : body === void 0 ? {} : { body: JSON.stringify(body) },
|
|
38777
38788
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
38778
38789
|
});
|
|
38779
38790
|
} catch (error2) {
|
|
@@ -38792,13 +38803,13 @@ var createWorkerClient = ({ workerOrigin, slug, trustedOrigins, wallet, fetchImp
|
|
|
38792
38803
|
const error = isRecord4(data) ? text(data.error) || text(data.message) : "";
|
|
38793
38804
|
if (response.status === 401 && auth && !retried && (!error || TOKEN_ERROR_RE.test(error))) {
|
|
38794
38805
|
token = "";
|
|
38795
|
-
return request(
|
|
38806
|
+
return request(path4, { method, headers, body, form, auth, retried: true, maxBytes, signal });
|
|
38796
38807
|
}
|
|
38797
38808
|
if (response.status === 401 && error && !TOKEN_ERROR_RE.test(error)) {
|
|
38798
38809
|
throw new WorkerRequestError(error.slice(0, MAX_ERROR_DETAIL), { status: 401, code: error });
|
|
38799
38810
|
}
|
|
38800
38811
|
if (!response.ok) {
|
|
38801
|
-
throw new WorkerRequestError(explainFailure(response.status, error,
|
|
38812
|
+
throw new WorkerRequestError(explainFailure(response.status, error, path4), {
|
|
38802
38813
|
status: response.status,
|
|
38803
38814
|
code: isRecord4(data) ? text(data.code) || text(data.reason) || error : "",
|
|
38804
38815
|
details: { balanceEth: text(data?.balanceEth), thresholdEth: text(data?.thresholdEth) }
|
|
@@ -38919,7 +38930,28 @@ var createWorkerClient = ({ workerOrigin, slug, trustedOrigins, wallet, fetchImp
|
|
|
38919
38930
|
});
|
|
38920
38931
|
return isRecord4(result?.storageRef) ? result.storageRef : { id: text(result?.id) };
|
|
38921
38932
|
};
|
|
38933
|
+
const uploadForm = async (form, { signal } = {}) => {
|
|
38934
|
+
const result = await request("/storage/upload", { signal, method: "POST", auth: true, form });
|
|
38935
|
+
return isRecord4(result?.storageRef) ? result.storageRef : { id: text(result?.id) };
|
|
38936
|
+
};
|
|
38937
|
+
const contextAction = (body, { signal } = {}) => request("/storage/context", { method: "POST", auth: true, signal, body });
|
|
38922
38938
|
const joinGroup = (groupId, { signal } = {}) => request("/groups/join", { method: "POST", auth: true, signal, body: { sessionId, groupId } });
|
|
38939
|
+
const leaveGroup = (groupId, { signal } = {}) => request("/groups/leave", { method: "POST", auth: true, signal, body: { sessionId, groupId } });
|
|
38940
|
+
const listGroups = async () => {
|
|
38941
|
+
const data = await request(`/groups/list?sessionId=${encodeURIComponent(sessionId)}`, { auth: true });
|
|
38942
|
+
return Array.isArray(data?.groups) ? data.groups.filter(isRecord4) : [];
|
|
38943
|
+
};
|
|
38944
|
+
const listMyMemberships = async () => {
|
|
38945
|
+
const data = await request(`/groups/my-memberships?sessionId=${encodeURIComponent(sessionId)}`, { auth: true });
|
|
38946
|
+
return Array.isArray(data?.memberships) ? data.memberships.filter(isRecord4) : [];
|
|
38947
|
+
};
|
|
38948
|
+
const readFeatures = async () => {
|
|
38949
|
+
if (now() - featuresLoadedAt >= CONFIG_MAX_AGE_MS) {
|
|
38950
|
+
features = await request("/capabilities").then((data) => Array.isArray(data?.features) ? data.features.map(text).filter(Boolean) : null).catch(() => null);
|
|
38951
|
+
featuresLoadedAt = now();
|
|
38952
|
+
}
|
|
38953
|
+
return features;
|
|
38954
|
+
};
|
|
38923
38955
|
const describeTestEth = async () => {
|
|
38924
38956
|
await refreshConfig();
|
|
38925
38957
|
if (now() - presenceLoadedAt >= CONFIG_MAX_AGE_MS) {
|
|
@@ -38940,7 +38972,13 @@ var createWorkerClient = ({ workerOrigin, slug, trustedOrigins, wallet, fetchImp
|
|
|
38940
38972
|
listAll,
|
|
38941
38973
|
read,
|
|
38942
38974
|
upload,
|
|
38975
|
+
uploadForm,
|
|
38976
|
+
contextAction,
|
|
38943
38977
|
joinGroup,
|
|
38978
|
+
leaveGroup,
|
|
38979
|
+
listGroups,
|
|
38980
|
+
listMyMemberships,
|
|
38981
|
+
readFeatures,
|
|
38944
38982
|
request,
|
|
38945
38983
|
get config() {
|
|
38946
38984
|
return config;
|
|
@@ -39660,6 +39698,28 @@ var isPreferredStorageVersion = (candidate, current) => {
|
|
|
39660
39698
|
return candidateAdmin ? age > 0 : age < 0;
|
|
39661
39699
|
};
|
|
39662
39700
|
|
|
39701
|
+
// shared/secretText.mjs
|
|
39702
|
+
var SECRET_PATTERNS = [
|
|
39703
|
+
/\bsk-[\w-]{16,}/,
|
|
39704
|
+
/\b[rs]k_(?:live|test)_[A-Za-z\d]{16,}/,
|
|
39705
|
+
/\bhf_[A-Za-z\d]{30,}/,
|
|
39706
|
+
/\bAIza[\w-]{30,}/,
|
|
39707
|
+
/\b(?:gsk|ghp|gho|ghu|ghs|ghr|github_pat|glpat|xox[abpr])[-_][\w-]{16,}/,
|
|
39708
|
+
/(?<![\w:])\d{6,12}:[\w-]{30,40}(?![\w-])/,
|
|
39709
|
+
/\balchemy(?:api)?\.(?:com|io)\/v2\/[\w-]{16,}/i,
|
|
39710
|
+
/\binfura\.io\/v3\/[\da-f]{32}/i,
|
|
39711
|
+
/-----BEGIN [A-Z ]{0,40}PRIVATE KEY-----/,
|
|
39712
|
+
/"kty"\s*:/,
|
|
39713
|
+
/\bBearer\s+[\w.~+/=-]{16,}/i,
|
|
39714
|
+
/\b[a-z][a-z\d+.-]{0,31}:\/\/[^\s/?#@]*@/i,
|
|
39715
|
+
/[?&#](?:access_token|api[_-]?key|key|token|secret|password|sig|signature|auth)=[^&#\s]/i,
|
|
39716
|
+
/#(?:[^\s#]*&)?k=[^&#\s]/
|
|
39717
|
+
];
|
|
39718
|
+
var HEX_KEY = /(?<![/\w])(?:0x)?[0-9a-f]{64,}\b/i;
|
|
39719
|
+
var TOKEN_RUN = /(?<![\w/-])[\w-]{40}(?![\w-])/g;
|
|
39720
|
+
var hasHexKey = (text6) => typeof text6 === "string" && HEX_KEY.test(text6);
|
|
39721
|
+
var looksSecret = (text6) => typeof text6 === "string" && (hasHexKey(text6) || SECRET_PATTERNS.some((pattern) => pattern.test(text6)) || (text6.match(TOKEN_RUN) || []).some((run) => /[A-Z]/.test(run) && /[a-z]/.test(run) && /\d/.test(run)));
|
|
39722
|
+
|
|
39663
39723
|
// shared/sessionContext.mjs
|
|
39664
39724
|
var SESSION_CONTEXT_LIMITS = Object.freeze({
|
|
39665
39725
|
titleChars: 80,
|
|
@@ -39698,8 +39758,368 @@ var normalizeSessionContext = (value) => {
|
|
|
39698
39758
|
return { title, paragraphs, links };
|
|
39699
39759
|
};
|
|
39700
39760
|
|
|
39701
|
-
//
|
|
39761
|
+
// shared/sessionConfigEdits.mjs
|
|
39762
|
+
var WORKER_CANONICAL_SET_CONFIG_KEYS = Object.freeze([
|
|
39763
|
+
"slug",
|
|
39764
|
+
"sessionId",
|
|
39765
|
+
"sessionIdHex",
|
|
39766
|
+
"configRevision",
|
|
39767
|
+
"sessionName",
|
|
39768
|
+
"sessionInfo",
|
|
39769
|
+
"sessionContext",
|
|
39770
|
+
"appearance",
|
|
39771
|
+
"sessionHeaderImg",
|
|
39772
|
+
"sessionEndsAt",
|
|
39773
|
+
"defaultTags",
|
|
39774
|
+
"defaultGroupTags",
|
|
39775
|
+
"defaultSbtTags",
|
|
39776
|
+
"questionsGenPrompt",
|
|
39777
|
+
"agentInstructions",
|
|
39778
|
+
"interviewMode",
|
|
39779
|
+
"interviewModeEnabled",
|
|
39780
|
+
"pileAutoAdvanceEnabled",
|
|
39781
|
+
"defaultFilterState",
|
|
39782
|
+
"defaultFeaturedSBTs",
|
|
39783
|
+
"autoFeatureSBTsBySessionSlug",
|
|
39784
|
+
"HIGHLIGHTED_QUESTION_IDS",
|
|
39785
|
+
"BLOCKED_QUESTION_IDS",
|
|
39786
|
+
"HIGHLIGHTED_SURVEY_IDS",
|
|
39787
|
+
"BLOCKED_SURVEY_IDS",
|
|
39788
|
+
"adminAddress",
|
|
39789
|
+
"adminAddresses",
|
|
39790
|
+
"resultsAdminAddresses",
|
|
39791
|
+
"corsWorkerUrl",
|
|
39792
|
+
"allowOrigins",
|
|
39793
|
+
"sessionModeProfile",
|
|
39794
|
+
"agentSessionWrapped",
|
|
39795
|
+
"agentHttp",
|
|
39796
|
+
"resultsExposure",
|
|
39797
|
+
"workerAuthority",
|
|
39798
|
+
"workerRoles",
|
|
39799
|
+
"roles",
|
|
39800
|
+
"authorization",
|
|
39801
|
+
"groupCreationPolicy",
|
|
39802
|
+
"contextAdditionPolicy",
|
|
39803
|
+
"storageProfile",
|
|
39804
|
+
"storageEnvelope",
|
|
39805
|
+
"ai",
|
|
39806
|
+
"limits",
|
|
39807
|
+
"scopes",
|
|
39808
|
+
"networkChainId",
|
|
39809
|
+
"contracts",
|
|
39810
|
+
"embeddedDeployHelperEnabled",
|
|
39811
|
+
"litCredentials",
|
|
39812
|
+
"resultsAnalysis",
|
|
39813
|
+
"responseFieldEncryption",
|
|
39814
|
+
"linkedWorkerGroups",
|
|
39815
|
+
"workerGroupsBootstrap"
|
|
39816
|
+
]);
|
|
39817
|
+
var CURATED_ID_LIST_KEYS = Object.freeze([
|
|
39818
|
+
"HIGHLIGHTED_QUESTION_IDS",
|
|
39819
|
+
"BLOCKED_QUESTION_IDS",
|
|
39820
|
+
"HIGHLIGHTED_SURVEY_IDS",
|
|
39821
|
+
"BLOCKED_SURVEY_IDS"
|
|
39822
|
+
]);
|
|
39823
|
+
var MAX_AGENT_INSTRUCTIONS_CHARS = 8e3;
|
|
39824
|
+
var CONTENT_FIELDS = /* @__PURE__ */ new Set([
|
|
39825
|
+
"sessionName",
|
|
39826
|
+
"sessionInfo",
|
|
39827
|
+
"sessionContext",
|
|
39828
|
+
"questionsGenPrompt",
|
|
39829
|
+
"appearance",
|
|
39830
|
+
"sessionHeaderImg",
|
|
39831
|
+
"agentInstructions",
|
|
39832
|
+
// Checked again when each file publishes, so changing it signs no one out.
|
|
39833
|
+
"contextAdditionPolicy",
|
|
39834
|
+
// Checked on each atlas build and read and never held in a sign-in, so
|
|
39835
|
+
// changing it signs no one out either.
|
|
39836
|
+
"resultsAdminAddresses",
|
|
39837
|
+
// Read on each interview request and never held in a sign-in, so changing
|
|
39838
|
+
// any interview setting, even turning interviews off, signs no one out.
|
|
39839
|
+
"interviewModeEnabled",
|
|
39840
|
+
"interviewMode",
|
|
39841
|
+
...CURATED_ID_LIST_KEYS
|
|
39842
|
+
]);
|
|
39843
|
+
|
|
39844
|
+
// shared/sessionContextSources.mjs
|
|
39845
|
+
var CONTEXT_ROLE = "context";
|
|
39846
|
+
var CONTEXT_TAGS = Object.freeze({
|
|
39847
|
+
role: "CE-DocRole",
|
|
39848
|
+
kind: "CE-DocKind",
|
|
39849
|
+
name: "CE-DocName",
|
|
39850
|
+
mime: "CE-DocMime",
|
|
39851
|
+
url: "CE-ContextUrl",
|
|
39852
|
+
fetchedAt: "CE-ContextFetchedAt",
|
|
39853
|
+
derivedFrom: "CE-DocDerivedFromTx",
|
|
39854
|
+
readBy: "CE-ReadBy",
|
|
39855
|
+
readModel: "CE-ReadModel",
|
|
39856
|
+
readAt: "CE-ReadAt",
|
|
39857
|
+
// Self-declared by an agent on what it adds: a label in the list, never a reason for access.
|
|
39858
|
+
adderKind: "CE-AdderKind",
|
|
39859
|
+
adderName: "CE-AdderName"
|
|
39860
|
+
});
|
|
39861
|
+
var CONTEXT_SOURCE_LIMITS = Object.freeze({
|
|
39862
|
+
pdfBytes: 20 * 1024 * 1024,
|
|
39863
|
+
textFileBytes: 1024 * 1024,
|
|
39864
|
+
// A linked page as fetched, before its text is taken out.
|
|
39865
|
+
pageBytes: 2 * 1024 * 1024,
|
|
39866
|
+
snapshotChars: 1e5,
|
|
39867
|
+
// Text the session's AI returns for a PDF.
|
|
39868
|
+
readTextChars: 1e5,
|
|
39869
|
+
titleChars: 120,
|
|
39870
|
+
// A link is also a storage tag, and tag values stop at 1,024 characters.
|
|
39871
|
+
urlChars: 1e3,
|
|
39872
|
+
// The groups one item may be locked to; reading it checks each in turn.
|
|
39873
|
+
lockedGroups: 20,
|
|
39874
|
+
// An agent's display name, as long as its profile allows.
|
|
39875
|
+
adderNameChars: 80
|
|
39876
|
+
});
|
|
39877
|
+
var CONTEXT_FILE_TYPES = Object.freeze({
|
|
39878
|
+
pdf: "application/pdf",
|
|
39879
|
+
md: "text/markdown",
|
|
39880
|
+
markdown: "text/markdown",
|
|
39881
|
+
txt: "text/plain",
|
|
39882
|
+
csv: "text/csv",
|
|
39883
|
+
json: "application/json"
|
|
39884
|
+
});
|
|
39885
|
+
var CONTEXT_FILE_MIMES = new Set(Object.values(CONTEXT_FILE_TYPES));
|
|
39886
|
+
var ADMINS_ONLY_ACCESS = Object.freeze({
|
|
39887
|
+
match: "all",
|
|
39888
|
+
conditions: Object.freeze([Object.freeze({ kind: "worker_role", role: "admin" })])
|
|
39889
|
+
});
|
|
39702
39890
|
var text3 = (value) => typeof value === "string" ? value.trim() : "";
|
|
39891
|
+
var participantsMayAddContext = (config) => config?.contextAdditionPolicy !== "admin_only";
|
|
39892
|
+
var CONTEXT_AGENT_ADDER = "agent";
|
|
39893
|
+
var NAME_CONTROLS = /[\p{Cc}\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/gu;
|
|
39894
|
+
var agentAdderName = (name = "") => text3(text3(name).replace(NAME_CONTROLS, " ").replace(/\s+/g, " ").slice(0, CONTEXT_SOURCE_LIMITS.adderNameChars));
|
|
39895
|
+
var agentAdderTags = (name = "") => {
|
|
39896
|
+
const clean = agentAdderName(name);
|
|
39897
|
+
return [
|
|
39898
|
+
{ name: CONTEXT_TAGS.adderKind, value: CONTEXT_AGENT_ADDER },
|
|
39899
|
+
...clean ? [{ name: CONTEXT_TAGS.adderName, value: clean }] : []
|
|
39900
|
+
];
|
|
39901
|
+
};
|
|
39902
|
+
var resolveContextFileType = ({ name = "", type = "" } = {}) => {
|
|
39903
|
+
const declared = text3(type).split(";")[0].toLowerCase();
|
|
39904
|
+
if (CONTEXT_FILE_MIMES.has(declared)) return declared;
|
|
39905
|
+
const extension = /\.([a-z0-9]+)$/i.exec(text3(name))?.[1]?.toLowerCase() || "";
|
|
39906
|
+
return Object.hasOwn(CONTEXT_FILE_TYPES, extension) ? CONTEXT_FILE_TYPES[extension] : "";
|
|
39907
|
+
};
|
|
39908
|
+
var contextFileByteLimit = (contentType) => contentType === CONTEXT_FILE_TYPES.pdf ? CONTEXT_SOURCE_LIMITS.pdfBytes : CONTEXT_SOURCE_LIMITS.textFileBytes;
|
|
39909
|
+
|
|
39910
|
+
// mcp/lib/contextAdditions.mjs
|
|
39911
|
+
import fs2 from "node:fs/promises";
|
|
39912
|
+
import path3 from "node:path";
|
|
39913
|
+
var MIB = 1024 * 1024;
|
|
39914
|
+
var PDF = CONTEXT_FILE_TYPES.pdf;
|
|
39915
|
+
var MAX_FILE_NAME = 180;
|
|
39916
|
+
var isRecord6 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
39917
|
+
var word = (value) => String(value ?? "").trim().toLowerCase();
|
|
39918
|
+
var plain = (value) => String(value ?? "").replace(new RegExp("\\p{Cc}", "gu"), " ").replace(/\s+/g, " ").trim();
|
|
39919
|
+
var megabytes = (bytes) => `${bytes / MIB} MB`;
|
|
39920
|
+
var workerReadsContext = (config) => {
|
|
39921
|
+
const profile = isRecord6(config?.storageProfile) ? config.storageProfile : {};
|
|
39922
|
+
const access = isRecord6(profile.payloadAccessControl) ? profile.payloadAccessControl : {};
|
|
39923
|
+
return ["cloudflare", "cf", "r2"].includes(word(profile.backend)) && word(access.encryption) !== "lit" && word(access.mode) !== "lit_encrypted";
|
|
39924
|
+
};
|
|
39925
|
+
var contextInvitation = ({ links }) => ({
|
|
39926
|
+
invitation: `You\u2019re invited to add context to this session: ${links ? "a file, a link or text" : "a file or text"}. Everyone in the session will see it.`,
|
|
39927
|
+
how: `Call add_context with exactly one of file (a local path)${links ? ", url" : ""} or text (with an optional title). Pass adminsOnly to show it to the session\u2019s admins alone.`,
|
|
39928
|
+
limits: {
|
|
39929
|
+
file: `PDF up to ${megabytes(CONTEXT_SOURCE_LIMITS.pdfBytes)}; Markdown, plain text, CSV or JSON up to ${megabytes(CONTEXT_SOURCE_LIMITS.textFileBytes)}.`,
|
|
39930
|
+
...links ? { url: `A public https:// page of up to ${megabytes(CONTEXT_SOURCE_LIMITS.pageBytes)}, which the Session Worker reads once; the link up to ${CONTEXT_SOURCE_LIMITS.urlChars} characters.` } : {},
|
|
39931
|
+
text: `Up to ${megabytes(CONTEXT_SOURCE_LIMITS.textFileBytes)}, stored as a Markdown file; a title up to ${CONTEXT_SOURCE_LIMITS.titleChars} characters.`
|
|
39932
|
+
}
|
|
39933
|
+
});
|
|
39934
|
+
var MORE_SECRETS = [
|
|
39935
|
+
/\beyJ[\w-]{10,}\.eyJ[\w-]{10,}\.[\w-]{10,}/,
|
|
39936
|
+
/"(?:client_?secret|(?:refresh|access|id|auth|session)_?token|private_?key|api_?key|secret_?(?:access_?)?key|password|passwd)"\s*:\s*"[^"\s]{8,}"/i
|
|
39937
|
+
];
|
|
39938
|
+
var refuseSecret = (value, what) => {
|
|
39939
|
+
if (looksSecret(value) || MORE_SECRETS.some((pattern) => pattern.test(value))) {
|
|
39940
|
+
throw new Error(`${what} looks like it holds a key, token or password, so nothing was added.`);
|
|
39941
|
+
}
|
|
39942
|
+
};
|
|
39943
|
+
var checkContextLink = ({ url, title }) => {
|
|
39944
|
+
const link = String(url ?? "").trim();
|
|
39945
|
+
if (!/^https:\/\/\S+$/i.test(link)) throw new Error("Pass an https:// link to a public page.");
|
|
39946
|
+
if (link.length > CONTEXT_SOURCE_LIMITS.urlChars) throw new Error(`The link must be ${CONTEXT_SOURCE_LIMITS.urlChars} characters or fewer.`);
|
|
39947
|
+
const name = plain(title);
|
|
39948
|
+
if (name.length > CONTEXT_SOURCE_LIMITS.titleChars) throw new Error(`The title must be ${CONTEXT_SOURCE_LIMITS.titleChars} characters or fewer.`);
|
|
39949
|
+
refuseSecret(link, "The link");
|
|
39950
|
+
refuseSecret(name, "The title");
|
|
39951
|
+
return { url: link, title: name };
|
|
39952
|
+
};
|
|
39953
|
+
var readContextFile = async (filePath, { stateDir }) => {
|
|
39954
|
+
const given = path3.resolve(String(filePath ?? "").trim());
|
|
39955
|
+
let real;
|
|
39956
|
+
try {
|
|
39957
|
+
real = await fs2.realpath(given);
|
|
39958
|
+
} catch {
|
|
39959
|
+
throw new Error(`There is no file at ${given}.`);
|
|
39960
|
+
}
|
|
39961
|
+
const state = await fs2.realpath(stateDir).catch(() => path3.resolve(stateDir));
|
|
39962
|
+
if (real === state || real.startsWith(`${state}${path3.sep}`)) {
|
|
39963
|
+
throw new Error("Files in the MCP\u2019s state folder, which holds this agent\u2019s key, are never added.");
|
|
39964
|
+
}
|
|
39965
|
+
if (real.split(path3.sep).some((part) => part.startsWith("."))) {
|
|
39966
|
+
throw new Error("Hidden files, and files in hidden folders, often hold keys and settings, so they are never added. Copy the file to an ordinary folder to add it.");
|
|
39967
|
+
}
|
|
39968
|
+
const stat = await fs2.stat(real);
|
|
39969
|
+
if (!stat.isFile()) throw new Error(`${given} is not a file.`);
|
|
39970
|
+
const name = path3.basename(real);
|
|
39971
|
+
const contentType = resolveContextFileType({ name });
|
|
39972
|
+
if (!contentType) throw new Error("Add a PDF, Markdown, plain text, CSV or JSON file.");
|
|
39973
|
+
const limit = contextFileByteLimit(contentType);
|
|
39974
|
+
const tooLarge = () => new Error(`${name} is larger than ${megabytes(limit)}, the most for a ${contentType === PDF ? "PDF" : "text file"}.`);
|
|
39975
|
+
if (stat.size > limit) throw tooLarge();
|
|
39976
|
+
const bytes = await fs2.readFile(real);
|
|
39977
|
+
if (bytes.length > limit) throw tooLarge();
|
|
39978
|
+
if (contentType === PDF) {
|
|
39979
|
+
if (bytes.subarray(0, 5).toString("latin1") !== "%PDF-") throw new Error(`${name} is not a PDF.`);
|
|
39980
|
+
} else {
|
|
39981
|
+
let content;
|
|
39982
|
+
try {
|
|
39983
|
+
content = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
39984
|
+
} catch {
|
|
39985
|
+
throw new Error(`${name} is not UTF-8 text.`);
|
|
39986
|
+
}
|
|
39987
|
+
refuseSecret(content, name);
|
|
39988
|
+
}
|
|
39989
|
+
return { name: name.slice(0, MAX_FILE_NAME), contentType, bytes };
|
|
39990
|
+
};
|
|
39991
|
+
var buildNote = ({ text: text6, title }) => {
|
|
39992
|
+
const content = typeof text6 === "string" ? text6.trim() : "";
|
|
39993
|
+
if (!content) throw new Error("Pass the text to add.");
|
|
39994
|
+
const bytes = Buffer.from(content, "utf8");
|
|
39995
|
+
if (bytes.length > CONTEXT_SOURCE_LIMITS.textFileBytes) {
|
|
39996
|
+
throw new Error(`The text is larger than ${megabytes(CONTEXT_SOURCE_LIMITS.textFileBytes)}, the most for a text file.`);
|
|
39997
|
+
}
|
|
39998
|
+
const named = plain(title);
|
|
39999
|
+
if (named.length > CONTEXT_SOURCE_LIMITS.titleChars) throw new Error(`The title must be ${CONTEXT_SOURCE_LIMITS.titleChars} characters or fewer.`);
|
|
40000
|
+
refuseSecret(content, "The text");
|
|
40001
|
+
refuseSecret(named, "The title");
|
|
40002
|
+
const firstLine = plain(content.split("\n")[0].replace(/^#+\s*/, "")).slice(0, CONTEXT_SOURCE_LIMITS.titleChars);
|
|
40003
|
+
const base = (named || firstLine || "Note").replace(/\.(?:md|markdown)$/i, "") || "Note";
|
|
40004
|
+
return { name: `${base}.md`, contentType: CONTEXT_FILE_TYPES.md, bytes };
|
|
40005
|
+
};
|
|
40006
|
+
var contextUploadForm = ({ name, contentType, bytes }, { adminsOnly = false, adderName = "" } = {}) => {
|
|
40007
|
+
const form = new FormData();
|
|
40008
|
+
form.append("file", new Blob([bytes], { type: contentType }), name);
|
|
40009
|
+
form.append("backend", "cloudflare");
|
|
40010
|
+
form.append("resource", "docsContext");
|
|
40011
|
+
form.append("contentType", contentType);
|
|
40012
|
+
form.append("payloadEncrypted", "false");
|
|
40013
|
+
form.append("tags", JSON.stringify([
|
|
40014
|
+
{ name: "CE-DocLibrary", value: "1" },
|
|
40015
|
+
{ name: CONTEXT_TAGS.kind, value: "file" },
|
|
40016
|
+
{ name: "CE-DocStorage", value: "cloudflare" },
|
|
40017
|
+
{ name: CONTEXT_TAGS.role, value: CONTEXT_ROLE },
|
|
40018
|
+
{ name: CONTEXT_TAGS.name, value: name },
|
|
40019
|
+
{ name: CONTEXT_TAGS.mime, value: contentType },
|
|
40020
|
+
...agentAdderTags(adderName)
|
|
40021
|
+
]));
|
|
40022
|
+
if (adminsOnly) form.append("accessConditions", JSON.stringify(ADMINS_ONLY_ACCESS));
|
|
40023
|
+
return form;
|
|
40024
|
+
};
|
|
40025
|
+
|
|
40026
|
+
// mcp/lib/knownSessions.mjs
|
|
40027
|
+
var LIST_PATH = "/known-sessions.json";
|
|
40028
|
+
var TIMEOUT_MS = 1e4;
|
|
40029
|
+
var MAX_LIST_BYTES = 512 * 1024;
|
|
40030
|
+
var MAX_AGE_MS = 6e4;
|
|
40031
|
+
var MAX_REDIRECTS = 2;
|
|
40032
|
+
var MAX_NAME_LENGTH = 120;
|
|
40033
|
+
var isRecord7 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
40034
|
+
var Unreadable = class extends Error {
|
|
40035
|
+
};
|
|
40036
|
+
var createKnownSessions = ({ fetchImpl = globalThis.fetch, now = () => Date.now(), allowLocalWorkers = false } = {}) => {
|
|
40037
|
+
const cache = /* @__PURE__ */ new Map();
|
|
40038
|
+
const siteOf = (origin) => normalizeWorkerOrigin(origin, { allowLocalWorkers });
|
|
40039
|
+
const fetchList = async (site) => {
|
|
40040
|
+
let url = `${site}${LIST_PATH}`;
|
|
40041
|
+
for (let hop = 0; ; hop += 1) {
|
|
40042
|
+
let response;
|
|
40043
|
+
try {
|
|
40044
|
+
response = await fetchImpl(url, { redirect: "manual", headers: { Accept: "application/json" }, signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
40045
|
+
} catch (error) {
|
|
40046
|
+
throw new Unreadable(error?.name === "TimeoutError" ? "the site took too long to answer" : "the site could not be reached");
|
|
40047
|
+
}
|
|
40048
|
+
if (response.status >= 300 && response.status < 400) {
|
|
40049
|
+
if (hop >= MAX_REDIRECTS) throw new Unreadable("the site redirected too many times");
|
|
40050
|
+
let next;
|
|
40051
|
+
try {
|
|
40052
|
+
next = new URL(text(response.headers.get("location")), url);
|
|
40053
|
+
if (next.pathname !== LIST_PATH || next.search || next.username || next.password) throw new Error();
|
|
40054
|
+
url = `${siteOf(next.origin)}${LIST_PATH}`;
|
|
40055
|
+
} catch {
|
|
40056
|
+
throw new Unreadable("the site redirected somewhere other than a public https copy of the list");
|
|
40057
|
+
}
|
|
40058
|
+
continue;
|
|
40059
|
+
}
|
|
40060
|
+
if (response.status === 404) return null;
|
|
40061
|
+
if (!response.ok) throw new Unreadable(`the site answered ${response.status}`);
|
|
40062
|
+
if (!text(response.headers.get("content-type")).toLowerCase().includes("json")) return null;
|
|
40063
|
+
let body;
|
|
40064
|
+
try {
|
|
40065
|
+
body = await readLimitedText(response, MAX_LIST_BYTES);
|
|
40066
|
+
} catch (error) {
|
|
40067
|
+
if (error instanceof WorkerRequestError) throw new Unreadable("the list is too large");
|
|
40068
|
+
throw new Unreadable(error?.name === "TimeoutError" ? "the site took too long to answer" : "the list could not be read");
|
|
40069
|
+
}
|
|
40070
|
+
let list;
|
|
40071
|
+
try {
|
|
40072
|
+
list = JSON.parse(body);
|
|
40073
|
+
} catch {
|
|
40074
|
+
throw new Unreadable("the list is not valid JSON");
|
|
40075
|
+
}
|
|
40076
|
+
if (!isRecord7(list)) throw new Unreadable("the list is not a set of sessions");
|
|
40077
|
+
return list;
|
|
40078
|
+
}
|
|
40079
|
+
};
|
|
40080
|
+
const readList = (site) => {
|
|
40081
|
+
const cached = cache.get(site);
|
|
40082
|
+
if (cached && now() - cached.at < MAX_AGE_MS) return cached.list;
|
|
40083
|
+
const list = fetchList(site);
|
|
40084
|
+
cache.set(site, { at: now(), list });
|
|
40085
|
+
list.catch(() => {
|
|
40086
|
+
if (cache.get(site)?.list === list) cache.delete(site);
|
|
40087
|
+
});
|
|
40088
|
+
return list;
|
|
40089
|
+
};
|
|
40090
|
+
const lookup = async (appOrigin, slug) => {
|
|
40091
|
+
let site;
|
|
40092
|
+
try {
|
|
40093
|
+
site = siteOf(appOrigin);
|
|
40094
|
+
} catch {
|
|
40095
|
+
return { status: "unlisted" };
|
|
40096
|
+
}
|
|
40097
|
+
const listUrl = `${site}${LIST_PATH}`;
|
|
40098
|
+
let list;
|
|
40099
|
+
try {
|
|
40100
|
+
list = await readList(site);
|
|
40101
|
+
} catch (error) {
|
|
40102
|
+
return { status: "unreadable", listUrl, reason: error instanceof Unreadable ? error.message : "the list could not be read" };
|
|
40103
|
+
}
|
|
40104
|
+
if (!list || !Object.hasOwn(list, slug)) return { status: "unlisted" };
|
|
40105
|
+
const entry = list[slug];
|
|
40106
|
+
let workerOrigin = "";
|
|
40107
|
+
try {
|
|
40108
|
+
workerOrigin = normalizeWorkerOrigin(text(entry?.worker), { allowLocalWorkers });
|
|
40109
|
+
} catch {
|
|
40110
|
+
}
|
|
40111
|
+
const sessionId = normalizeSessionIdHex(text(entry?.sessionId));
|
|
40112
|
+
if (!isRecord7(entry) || !workerOrigin || !sessionId) {
|
|
40113
|
+
return { status: "unreadable", listUrl, reason: `its entry for "${slug}" has no usable Worker or session ID` };
|
|
40114
|
+
}
|
|
40115
|
+
const name = text(entry.name).slice(0, MAX_NAME_LENGTH);
|
|
40116
|
+
return { status: "listed", workerOrigin, sessionId, ...name ? { name } : {} };
|
|
40117
|
+
};
|
|
40118
|
+
return { lookup };
|
|
40119
|
+
};
|
|
40120
|
+
|
|
40121
|
+
// mcp/lib/results.mjs
|
|
40122
|
+
var text4 = (value) => typeof value === "string" ? value.trim() : "";
|
|
39703
40123
|
var MAX_FREEFORM_SAMPLES = 5;
|
|
39704
40124
|
var MAX_SAMPLE_LENGTH = 280;
|
|
39705
40125
|
var isNewer = (candidate, current) => !current || candidate.createdAt > current.createdAt || candidate.createdAt === current.createdAt && candidate.storageId > current.storageId;
|
|
@@ -39708,11 +40128,11 @@ var latestAnswersByQuestion = (entries, { sessionSlug, sessionId, registryConfig
|
|
|
39708
40128
|
for (const entry of entries) {
|
|
39709
40129
|
const payload = entry?.payload;
|
|
39710
40130
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) continue;
|
|
39711
|
-
const questionId = (
|
|
40131
|
+
const questionId = (text4(payload.questionID) || text4(payload.questionId)).toLowerCase();
|
|
39712
40132
|
if (registryConfig) {
|
|
39713
40133
|
if (!questionIds?.has(questionId) || !registryResponseMatchesSession(payload, registryConfig) || payload.answer?.encrypted === true) continue;
|
|
39714
|
-
} else if (
|
|
39715
|
-
const responder =
|
|
40134
|
+
} else if (text4(payload.sessionSlug) !== sessionSlug || normalizeSessionIdHex(text4(payload.sessionId)) !== sessionId) continue;
|
|
40135
|
+
const responder = text4(entry.responder).toLowerCase();
|
|
39716
40136
|
if (!questionId || !responder) continue;
|
|
39717
40137
|
const answers = byQuestion.get(questionId) || /* @__PURE__ */ new Map();
|
|
39718
40138
|
const current = answers.get(responder);
|
|
@@ -39744,21 +40164,21 @@ var BINARY_VOTES = Object.freeze({
|
|
|
39744
40164
|
0: "Unsure"
|
|
39745
40165
|
});
|
|
39746
40166
|
var validValue = (question, entry) => {
|
|
39747
|
-
const payloadType =
|
|
40167
|
+
const payloadType = text4(entry?.payload?.type);
|
|
39748
40168
|
if (payloadType && payloadType !== question.type) return void 0;
|
|
39749
40169
|
const value = rawValue(entry);
|
|
39750
40170
|
if (value === void 0 || value === null || value === "*") return void 0;
|
|
39751
40171
|
switch (question.type) {
|
|
39752
40172
|
case "binary": {
|
|
39753
40173
|
const scalar = Array.isArray(value) && value.every((item) => ["string", "number"].includes(typeof item)) ? value.join(",") : value;
|
|
39754
|
-
const key = typeof scalar === "boolean" || typeof scalar === "number" ? String(scalar) :
|
|
40174
|
+
const key = typeof scalar === "boolean" || typeof scalar === "number" ? String(scalar) : text4(scalar).toLowerCase();
|
|
39755
40175
|
return Object.hasOwn(BINARY_VOTES, key) ? BINARY_VOTES[key] : void 0;
|
|
39756
40176
|
}
|
|
39757
40177
|
case "rating":
|
|
39758
40178
|
return normalizeRatingAnswer(value, question) ?? void 0;
|
|
39759
40179
|
case "multichoice": {
|
|
39760
|
-
const options = (Array.isArray(question.options) ? question.options : []).map(
|
|
39761
|
-
const picks = (Array.isArray(value) ? value : [value]).map(
|
|
40180
|
+
const options = (Array.isArray(question.options) ? question.options : []).map(text4).filter(Boolean);
|
|
40181
|
+
const picks = (Array.isArray(value) ? value : [value]).map(text4);
|
|
39762
40182
|
if (!picks.length || picks.some((pick) => !pick)) return void 0;
|
|
39763
40183
|
const canonical = options.length ? picks.map((pick) => options.find((option) => option.toLowerCase() === pick.toLowerCase()) || "") : picks;
|
|
39764
40184
|
if (canonical.some((pick) => !pick)) return void 0;
|
|
@@ -39809,7 +40229,7 @@ var summarizeQuestion = (question, answersByResponder = /* @__PURE__ */ new Map(
|
|
|
39809
40229
|
return { ...summary, scale: { min: scale.min, max: scale.max }, mean, histogram };
|
|
39810
40230
|
}
|
|
39811
40231
|
case "multichoice": {
|
|
39812
|
-
const counts = new Map((Array.isArray(question.options) ? question.options : []).map(
|
|
40232
|
+
const counts = new Map((Array.isArray(question.options) ? question.options : []).map(text4).filter(Boolean).map((option) => [option, 0]));
|
|
39813
40233
|
answered.forEach((entry) => validValue(question, entry).forEach((option) => counts.set(option, (counts.get(option) || 0) + 1)));
|
|
39814
40234
|
return { ...summary, counts: Object.fromEntries(counts) };
|
|
39815
40235
|
}
|
|
@@ -39860,7 +40280,7 @@ var POLL_MS = 2e3;
|
|
|
39860
40280
|
var GAS_HEADROOM_PERCENT = 130;
|
|
39861
40281
|
var PASSWORD_CLAIM_GAS_BUDGET = 4e5;
|
|
39862
40282
|
var trim7 = (value) => typeof value === "string" ? value.trim() : typeof value === "number" ? String(value) : "";
|
|
39863
|
-
var
|
|
40283
|
+
var isRecord8 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
39864
40284
|
var defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
39865
40285
|
var { deriveGroupPasswordWallet } = createGroupPasswordDerivation(import_ethers6.ethers);
|
|
39866
40286
|
var normalizeGroupPasswordInput = (raw) => {
|
|
@@ -39883,7 +40303,7 @@ var decodeInviteCode = (raw) => {
|
|
|
39883
40303
|
if (!code || code.length > 4096) return null;
|
|
39884
40304
|
try {
|
|
39885
40305
|
const parsed = JSON.parse(Buffer.from(code.replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8"));
|
|
39886
|
-
if (!
|
|
40306
|
+
if (!isRecord8(parsed) || Object.keys(parsed).sort().join(",") !== "a,c,n,s") return null;
|
|
39887
40307
|
const chainId = import_ethers6.ethers.BigNumber.from(String(parsed.c));
|
|
39888
40308
|
const slot = import_ethers6.ethers.BigNumber.from(String(parsed.n));
|
|
39889
40309
|
const sbtAddress = import_ethers6.ethers.utils.getAddress(String(parsed.a));
|
|
@@ -40141,8 +40561,16 @@ var MISSING_RECORD_RETRY_MS = 6e4;
|
|
|
40141
40561
|
var MAX_OWN_ANSWER_ITEMS = 5e3;
|
|
40142
40562
|
var MAX_TITLE_LENGTH = 120;
|
|
40143
40563
|
var MAX_DESCRIPTION_LENGTH = 2e3;
|
|
40564
|
+
var MAX_GROUPS = 100;
|
|
40565
|
+
var MAX_GROUP_TAGS = 20;
|
|
40566
|
+
var MAX_TAG_LENGTH2 = 80;
|
|
40567
|
+
var CONTEXT_ADMINS_ONLY = "This session limits context to its admins, so nothing was added.";
|
|
40568
|
+
var CONTEXT_ENDED = "This session has ended, so it takes no more context.";
|
|
40569
|
+
var CONTEXT_NO_LINKS = "This session\u2019s Worker doesn\u2019t take links from participants yet. You can add a file or text.";
|
|
40570
|
+
var CONTEXT_NO_FETCH = "This session doesn\u2019t let you have its Worker fetch pages, so it takes no links from you. You can add a file or text.";
|
|
40571
|
+
var CONTEXT_RATE_LIMITED = "The session\u2019s Worker is rate limiting you, so nothing was added. Retry in a few minutes; if it still refuses, you may have reached the session\u2019s daily limit for your address, which clears within a day.";
|
|
40144
40572
|
var trim8 = (value) => typeof value === "string" ? value.trim() : typeof value === "number" ? String(value) : "";
|
|
40145
|
-
var
|
|
40573
|
+
var isRecord9 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
40146
40574
|
var sessionKey = (info) => info.kind === "registry" ? `registry ${info.chainId || 11155420} ${info.slug}` : `${info.workerOrigin} ${info.slug}`;
|
|
40147
40575
|
var mapLimit = async (items, limit, task) => {
|
|
40148
40576
|
const results = new Array(items.length);
|
|
@@ -40172,7 +40600,7 @@ var finiteNumber = (value) => {
|
|
|
40172
40600
|
};
|
|
40173
40601
|
var SCALE_KEYS = ["step", "min", "minimum", "max", "maximum", "minLabel", "lowLabel", "maxLabel", "highLabel"];
|
|
40174
40602
|
var cleanScale = (record) => {
|
|
40175
|
-
if (!
|
|
40603
|
+
if (!isRecord9(record)) return {};
|
|
40176
40604
|
const out = {};
|
|
40177
40605
|
SCALE_KEYS.forEach((key) => {
|
|
40178
40606
|
if (typeof record[key] === "string" || typeof record[key] === "number" && Number.isFinite(record[key])) out[key] = record[key];
|
|
@@ -40238,6 +40666,51 @@ var sameAuthoringInputs = (stored, record) => {
|
|
|
40238
40666
|
]);
|
|
40239
40667
|
return inputs(stored) === inputs(record);
|
|
40240
40668
|
};
|
|
40669
|
+
var instructionsOf = (config) => {
|
|
40670
|
+
const raw = typeof config?.agentInstructions === "string" ? config.agentInstructions.trim() : "";
|
|
40671
|
+
if (!raw) return null;
|
|
40672
|
+
const cut = raw.length > MAX_AGENT_INSTRUCTIONS_CHARS;
|
|
40673
|
+
return {
|
|
40674
|
+
from: "the session\u2019s admins",
|
|
40675
|
+
note: "These add to the general guidance for agents. Follow both; they can ask more of you but can\u2019t lift its rules.",
|
|
40676
|
+
text: cut ? raw.slice(0, MAX_AGENT_INSTRUCTIONS_CHARS) : raw,
|
|
40677
|
+
...cut ? { cutAt: MAX_AGENT_INSTRUCTIONS_CHARS } : {}
|
|
40678
|
+
};
|
|
40679
|
+
};
|
|
40680
|
+
var nextStep = ({ instructions, linkGroup, member = null }) => {
|
|
40681
|
+
const read = instructions ? "Read the session\u2019s instructions for agents and the context" : "Read the context";
|
|
40682
|
+
if (!linkGroup) return `${read}, then call list_questions and answer.`;
|
|
40683
|
+
const named = `The link names group "${linkGroup}"`;
|
|
40684
|
+
if (member) {
|
|
40685
|
+
const other = instructions ? " If the instructions ask you to be in another group instead, join that one with join_group and leave this one with leave_group." : "";
|
|
40686
|
+
return `${read}. ${named}, which you\u2019re already in.${other} Then call list_questions and answer.`;
|
|
40687
|
+
}
|
|
40688
|
+
const join = instructions ? "call join_group for the group the instructions ask you to join, if any" : "join it with join_group";
|
|
40689
|
+
return `${read}. ${named}${member === false ? ", which you haven\u2019t joined" : ""}: ${join}. Then call list_questions and answer.`;
|
|
40690
|
+
};
|
|
40691
|
+
var WHO_CAN_END_MEMBERSHIP = {
|
|
40692
|
+
both: "Members can leave with leave_group, and admins can remove them.",
|
|
40693
|
+
admin_only: "Only admins can remove members; members can\u2019t leave.",
|
|
40694
|
+
member_only: "Members can leave with leave_group; admins can\u2019t remove them.",
|
|
40695
|
+
neither: "No one can end a membership."
|
|
40696
|
+
};
|
|
40697
|
+
var GROUP_REFUSALS = {
|
|
40698
|
+
worker_group_not_found: (id) => `This session has no group "${id}".`,
|
|
40699
|
+
worker_group_join_denied: (id) => `Group "${id}" isn\u2019t open to joining; its admins add members.`,
|
|
40700
|
+
worker_group_join_ended: (id) => `Joining group "${id}" has closed.`,
|
|
40701
|
+
worker_group_member_cap_exceeded: (id) => `Group "${id}" has no room for more members.`,
|
|
40702
|
+
worker_group_member_not_found: (id) => `You aren\u2019t a member of group "${id}".`,
|
|
40703
|
+
worker_group_leave_denied: (id) => `Group "${id}" doesn\u2019t let members leave.`
|
|
40704
|
+
};
|
|
40705
|
+
var groupRefusal = (error, id) => error instanceof WorkerRequestError && Object.hasOwn(GROUP_REFUSALS, error.code) ? new Error(GROUP_REFUSALS[error.code](id)) : error;
|
|
40706
|
+
var contextRefusal = (error, { olderLink = false } = {}) => {
|
|
40707
|
+
if (!(error instanceof WorkerRequestError)) return error;
|
|
40708
|
+
if (error.code === "context_admin_required") return new Error(olderLink ? CONTEXT_NO_LINKS : CONTEXT_ADMINS_ONLY);
|
|
40709
|
+
if (error.code === "context_link_fetch_denied") return new Error(CONTEXT_NO_FETCH);
|
|
40710
|
+
if (error.status === 410) return new Error(CONTEXT_ENDED);
|
|
40711
|
+
if (error.status === 429) return new Error(CONTEXT_RATE_LIMITED);
|
|
40712
|
+
return error;
|
|
40713
|
+
};
|
|
40241
40714
|
var progressNotes = (questions, mine) => ({
|
|
40242
40715
|
...questions.locked ? { lockedQuestions: questions.locked } : {},
|
|
40243
40716
|
...questions.complete === false ? { questionsComplete: false } : {},
|
|
@@ -40289,7 +40762,8 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40289
40762
|
wallet,
|
|
40290
40763
|
fetchImpl,
|
|
40291
40764
|
now,
|
|
40292
|
-
|
|
40765
|
+
// A hosted session reopened from state must still be the one the agent joined.
|
|
40766
|
+
...onchain ? { registryConfigLoader: onchain.loadConfig } : { sessionId: text(info.sessionId) }
|
|
40293
40767
|
}),
|
|
40294
40768
|
records: /* @__PURE__ */ new Map(),
|
|
40295
40769
|
missing: /* @__PURE__ */ new Map()
|
|
@@ -40297,9 +40771,84 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40297
40771
|
}
|
|
40298
40772
|
return sessions.get(key);
|
|
40299
40773
|
};
|
|
40774
|
+
const knownSessions = createKnownSessions({ fetchImpl, now, allowLocalWorkers: config.allowLocalWorkers });
|
|
40775
|
+
const resolveLink = async (link) => {
|
|
40776
|
+
const parsed = parseSessionLink(link, { allowLocalWorkers: config.allowLocalWorkers });
|
|
40777
|
+
if (parsed.kind !== "registry") return parsed;
|
|
40778
|
+
const found = await knownSessions.lookup(parsed.appOrigin, parsed.slug);
|
|
40779
|
+
if (found.status === "unlisted") return parsed;
|
|
40780
|
+
if (found.status === "unreadable") {
|
|
40781
|
+
throw new Error(
|
|
40782
|
+
`The list of known sessions at ${found.listUrl} could not be read (${found.reason}). If this session is on a Session Worker, ask for its link with worker=, the Worker\u2019s address; otherwise try again later.`
|
|
40783
|
+
);
|
|
40784
|
+
}
|
|
40785
|
+
const hosted = { ...parsed, workerOrigin: found.workerOrigin, listedSessionId: found.sessionId };
|
|
40786
|
+
delete hosted.kind;
|
|
40787
|
+
delete hosted.chainId;
|
|
40788
|
+
return hosted;
|
|
40789
|
+
};
|
|
40790
|
+
const hasEnded = (sessionConfig) => {
|
|
40791
|
+
const endsAt = Date.parse(text(sessionConfig?.sessionEndsAt));
|
|
40792
|
+
return Number.isFinite(endsAt) && endsAt <= now();
|
|
40793
|
+
};
|
|
40794
|
+
const isSessionAdmin = (ctx, sessionConfig) => {
|
|
40795
|
+
const self2 = wallet.address.toLowerCase();
|
|
40796
|
+
const admins = [sessionConfig?.adminAddress, ...Array.isArray(sessionConfig?.adminAddresses) ? sessionConfig.adminAddresses : []];
|
|
40797
|
+
return admins.some((address) => text(address).toLowerCase() === self2) || ctx.client.tokenClaims?.scopes?.admin === true;
|
|
40798
|
+
};
|
|
40799
|
+
const mayAddLinks = (ctx, sessionConfig) => isSessionAdmin(ctx, sessionConfig) || ctx.client.tokenClaims?.scopes?.fetch === true;
|
|
40800
|
+
const describeGroups = async (ctx) => {
|
|
40801
|
+
let listed;
|
|
40802
|
+
let mine;
|
|
40803
|
+
try {
|
|
40804
|
+
[listed, mine] = await Promise.all([ctx.client.listGroups(), ctx.client.listMyMemberships()]);
|
|
40805
|
+
} catch (error) {
|
|
40806
|
+
if (error instanceof WorkerRequestError && error.status === 501) return {};
|
|
40807
|
+
if (error instanceof WorkerRequestError && error.code === "worker_group_capacity_reconciliation_required") {
|
|
40808
|
+
return { groupsUnavailable: "This session\u2019s groups can\u2019t be listed on its Worker yet." };
|
|
40809
|
+
}
|
|
40810
|
+
return { groupsUnavailable: describeError(error) };
|
|
40811
|
+
}
|
|
40812
|
+
const idOf = (group) => text(group?.groupId).toLowerCase();
|
|
40813
|
+
const memberOf = new Map(mine.filter((entry) => idOf(entry.group)).map((entry) => [idOf(entry.group), entry]));
|
|
40814
|
+
const entries = [
|
|
40815
|
+
...listed.filter((group) => idOf(group)).map((group) => ({ group, member: memberOf.has(idOf(group)), memberCount: group.memberCount })),
|
|
40816
|
+
...[...memberOf.values()].filter((entry) => !listed.some((group) => idOf(group) === idOf(entry.group))).map((entry) => ({ group: entry.group, member: true, memberCount: entry.memberCount }))
|
|
40817
|
+
];
|
|
40818
|
+
const groups = entries.slice(0, MAX_GROUPS).map(({ group, member, memberCount }) => {
|
|
40819
|
+
const tags = Array.isArray(group.tags) ? group.tags.map((tag) => text(tag).slice(0, MAX_TAG_LENGTH2)).filter(Boolean).slice(0, MAX_GROUP_TAGS) : [];
|
|
40820
|
+
const members = Number.isSafeInteger(memberCount) && memberCount >= 0 ? memberCount : null;
|
|
40821
|
+
const limit = Number.isSafeInteger(group.memberLimit) && group.memberLimit > 0 ? group.memberLimit : 0;
|
|
40822
|
+
const closesAt = text(group.joinEndsAt);
|
|
40823
|
+
const open = text(group.joinMode).toLowerCase() === "open";
|
|
40824
|
+
let joining = open ? "Open: join with join_group." : "Only admins add members.";
|
|
40825
|
+
if (open && closesAt && Date.parse(closesAt) <= now()) joining = "Joining has closed.";
|
|
40826
|
+
else if (open && limit && members !== null && members >= limit) joining = "Full.";
|
|
40827
|
+
const removalAuth = text(group.removalAuth).toLowerCase() || "both";
|
|
40828
|
+
return {
|
|
40829
|
+
groupId: text(group.groupId),
|
|
40830
|
+
name: text(group.label).slice(0, MAX_TITLE_LENGTH),
|
|
40831
|
+
...text(group.description) ? { description: text(group.description).slice(0, MAX_DESCRIPTION_LENGTH) } : {},
|
|
40832
|
+
...tags.length ? { tags } : {},
|
|
40833
|
+
joining,
|
|
40834
|
+
...open && closesAt ? { joinClosesAt: closesAt } : {},
|
|
40835
|
+
...members !== null ? { members } : {},
|
|
40836
|
+
...limit ? { memberLimit: limit } : {},
|
|
40837
|
+
member,
|
|
40838
|
+
...Object.hasOwn(WHO_CAN_END_MEMBERSHIP, removalAuth) ? { whoCanEndMembership: WHO_CAN_END_MEMBERSHIP[removalAuth] } : {}
|
|
40839
|
+
};
|
|
40840
|
+
});
|
|
40841
|
+
return { groups };
|
|
40842
|
+
};
|
|
40843
|
+
const invitationFor = async (ctx, sessionConfig) => {
|
|
40844
|
+
if (ctx.registry || !participantsMayAddContext(sessionConfig) || hasEnded(sessionConfig) || !workerReadsContext(sessionConfig)) return {};
|
|
40845
|
+
const features = await ctx.client.readFeatures();
|
|
40846
|
+
if (!features?.includes("participant_context_v1")) return {};
|
|
40847
|
+
return { addingContext: contextInvitation({ links: features.includes("participant_context_links_v1") && mayAddLinks(ctx, sessionConfig) }) };
|
|
40848
|
+
};
|
|
40300
40849
|
const remember = (ctx, title, recruitmentSource) => saveState((fresh) => {
|
|
40301
40850
|
const key = sessionKey(ctx.info);
|
|
40302
|
-
const stored =
|
|
40851
|
+
const stored = isRecord9(fresh.sessions[key]) ? fresh.sessions[key] : {};
|
|
40303
40852
|
const previous = stored.sessionId && stored.sessionId !== ctx.client.sessionId ? {} : stored;
|
|
40304
40853
|
fresh.sessions[key] = {
|
|
40305
40854
|
...previous,
|
|
@@ -40316,12 +40865,12 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40316
40865
|
});
|
|
40317
40866
|
const sessionState = (ctx) => {
|
|
40318
40867
|
const entry = state?.sessions?.[sessionKey(ctx.info)];
|
|
40319
|
-
return
|
|
40868
|
+
return isRecord9(entry) ? entry : {};
|
|
40320
40869
|
};
|
|
40321
40870
|
const rememberAnswers = (ctx, answered) => saveState((fresh) => {
|
|
40322
40871
|
const entry = fresh.sessions[sessionKey(ctx.info)];
|
|
40323
|
-
if (!
|
|
40324
|
-
entry.answers =
|
|
40872
|
+
if (!isRecord9(entry) || entry.sessionId !== ctx.client.sessionId) return;
|
|
40873
|
+
entry.answers = isRecord9(entry.answers) ? entry.answers : {};
|
|
40325
40874
|
answered.forEach(({ questionId, record, answeredAt, chainOrder, requestId }) => {
|
|
40326
40875
|
entry.answers[questionId] = {
|
|
40327
40876
|
value: record.answer.value,
|
|
@@ -40336,10 +40885,10 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40336
40885
|
await loadState();
|
|
40337
40886
|
const ref = trim8(session);
|
|
40338
40887
|
if (/^https?:\/\//i.test(ref)) {
|
|
40339
|
-
const parsed =
|
|
40888
|
+
const parsed = await resolveLink(ref);
|
|
40340
40889
|
const key2 = sessionKey(parsed);
|
|
40341
|
-
if (!state.sessions[key2]) throw new Error("Join this session first with join_session.");
|
|
40342
|
-
return
|
|
40890
|
+
if (!isRecord9(state.sessions[key2])) throw new Error("Join this session first with join_session.");
|
|
40891
|
+
return openEntry(state.sessions[key2]);
|
|
40343
40892
|
}
|
|
40344
40893
|
let key = state.current;
|
|
40345
40894
|
if (ref) {
|
|
@@ -40350,14 +40899,15 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40350
40899
|
if (!key) throw new Error(`No joined session named "${slug}". Join it first with join_session.`);
|
|
40351
40900
|
}
|
|
40352
40901
|
const entry = state.sessions[key];
|
|
40353
|
-
if (!key || !
|
|
40354
|
-
return
|
|
40355
|
-
workerOrigin: normalizeWorkerOrigin(entry.workerOrigin, { allowLocalWorkers: config.allowLocalWorkers }),
|
|
40356
|
-
slug: normalizeSessionSlug(entry.slug),
|
|
40357
|
-
appOrigin: text(entry.appOrigin),
|
|
40358
|
-
...entry.kind === "registry" ? { kind: "registry", chainId: entry.chainId } : {}
|
|
40359
|
-
});
|
|
40902
|
+
if (!key || !isRecord9(entry)) throw new Error("No session joined yet. Call join_session with a session link.");
|
|
40903
|
+
return openEntry(entry);
|
|
40360
40904
|
};
|
|
40905
|
+
const openEntry = async (entry) => openSession({
|
|
40906
|
+
workerOrigin: normalizeWorkerOrigin(entry.workerOrigin, { allowLocalWorkers: config.allowLocalWorkers }),
|
|
40907
|
+
slug: normalizeSessionSlug(entry.slug),
|
|
40908
|
+
appOrigin: text(entry.appOrigin),
|
|
40909
|
+
...entry.kind === "registry" ? { kind: "registry", chainId: entry.chainId } : { sessionId: text(entry.sessionId) }
|
|
40910
|
+
});
|
|
40361
40911
|
const ensureReady = async (ctx) => {
|
|
40362
40912
|
await ctx.client.refreshConfig();
|
|
40363
40913
|
ctx.info.appOrigin = ctx.client.loginOrigin;
|
|
@@ -40400,7 +40950,7 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40400
40950
|
const all2 = [];
|
|
40401
40951
|
for (const row of result.items) {
|
|
40402
40952
|
try {
|
|
40403
|
-
if (!
|
|
40953
|
+
if (!isRecord9(row.payload) || typeof row.payload.type !== "string") continue;
|
|
40404
40954
|
const payload = isLockedQuestion(row.payload) ? { ...row.payload, prompt: "[encrypted]", locked: true } : row.payload;
|
|
40405
40955
|
if (typeof payload.prompt !== "string") continue;
|
|
40406
40956
|
all2.push({
|
|
@@ -40429,7 +40979,7 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40429
40979
|
rows.forEach((item, index) => {
|
|
40430
40980
|
try {
|
|
40431
40981
|
const payload = payloads[index];
|
|
40432
|
-
if (!
|
|
40982
|
+
if (!isRecord9(payload) || typeof payload.prompt !== "string" || typeof payload.type !== "string") return;
|
|
40433
40983
|
if (text(payload.sessionSlug) !== ctx.info.slug) return;
|
|
40434
40984
|
if (text(payload.sessionId) && normalizeSessionIdHex(text(payload.sessionId)) !== ctx.client.sessionId) return;
|
|
40435
40985
|
const id = (text(payload.id) || text(item.metadata?.resourceId)).toLowerCase();
|
|
@@ -40524,9 +41074,9 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40524
41074
|
let complete = scan.complete;
|
|
40525
41075
|
const blocks = /* @__PURE__ */ new Map();
|
|
40526
41076
|
await loadState();
|
|
40527
|
-
const local = sessionState(ctx).sessionId === ctx.client.sessionId &&
|
|
41077
|
+
const local = sessionState(ctx).sessionId === ctx.client.sessionId && isRecord9(sessionState(ctx).answers) ? sessionState(ctx).answers : {};
|
|
40528
41078
|
for (const [questionId, answer] of Object.entries(local)) {
|
|
40529
|
-
if (!
|
|
41079
|
+
if (!isRecord9(answer)) continue;
|
|
40530
41080
|
if (ctx.registry && (!scan.complete || !ctx.registry.containsBlock(answer.blockNumber))) continue;
|
|
40531
41081
|
const known = mine.get(questionId);
|
|
40532
41082
|
const chainOrder = scan.chainOrders?.get(questionId);
|
|
@@ -40564,12 +41114,12 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40564
41114
|
address: wallet.address,
|
|
40565
41115
|
profile: profile(),
|
|
40566
41116
|
currentSession: state.sessions[state.current]?.slug || null,
|
|
40567
|
-
sessions: await mapLimit(Object.values(state.sessions).filter(
|
|
41117
|
+
sessions: await mapLimit(Object.values(state.sessions).filter(isRecord9), READ_CONCURRENCY, async (entry) => ({
|
|
40568
41118
|
session: entry.slug,
|
|
40569
41119
|
title: entry.title || entry.slug,
|
|
40570
41120
|
webUrl: buildSessionWebUrl(entry),
|
|
40571
41121
|
joinedAt: entry.joinedAt,
|
|
40572
|
-
testEth: await
|
|
41122
|
+
testEth: await openEntry(entry).then((ctx) => ctx.client.describeTestEth()).catch(() => ({ offered: false, reason: "Session availability could not be checked." }))
|
|
40573
41123
|
}))
|
|
40574
41124
|
};
|
|
40575
41125
|
},
|
|
@@ -40586,7 +41136,7 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40586
41136
|
async joinSession({ link, worker, session, inviteCode, groupPassword, claimPassword } = {}) {
|
|
40587
41137
|
let parsed;
|
|
40588
41138
|
if (trim8(link)) {
|
|
40589
|
-
parsed =
|
|
41139
|
+
parsed = await resolveLink(link);
|
|
40590
41140
|
} else if (trim8(worker) && trim8(session)) {
|
|
40591
41141
|
parsed = {
|
|
40592
41142
|
appOrigin: config.appOrigin,
|
|
@@ -40602,6 +41152,12 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40602
41152
|
sessions.delete(sessionKey(parsed));
|
|
40603
41153
|
const ctx = await openSession(parsed);
|
|
40604
41154
|
const sessionConfig = await ctx.client.loadConfig();
|
|
41155
|
+
if (parsed.listedSessionId && ctx.client.sessionId !== parsed.listedSessionId) {
|
|
41156
|
+
sessions.delete(sessionKey(parsed));
|
|
41157
|
+
throw new Error(
|
|
41158
|
+
`The Session Worker listed for "${parsed.slug}" answers for a different session, so it was not joined. Ask for the session\u2019s link with worker=, the Worker\u2019s address.`
|
|
41159
|
+
);
|
|
41160
|
+
}
|
|
40605
41161
|
ctx.info.appOrigin = ctx.client.loginOrigin;
|
|
40606
41162
|
const outcome = { ...sessionSummary(ctx, sessionConfig), address: wallet.address };
|
|
40607
41163
|
const claims = parsed.sbtClaims.filter((claim) => claim.auto);
|
|
@@ -40654,23 +41210,22 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40654
41210
|
outcome.readOnlyReason = describeError(loginError);
|
|
40655
41211
|
outcome.note = "Joined read-only: public questions and results are available, but uploads, answers, statements, and faucet requests need Worker access.";
|
|
40656
41212
|
}
|
|
40657
|
-
const scopes =
|
|
41213
|
+
const scopes = isRecord9(tokenClaims?.scopes) ? tokenClaims.scopes : {};
|
|
40658
41214
|
outcome.scopes = Object.keys(scopes).filter((scope) => scopes[scope] === true);
|
|
40659
|
-
if (parsed.joinGroupId) {
|
|
40660
|
-
checkpoint();
|
|
40661
|
-
try {
|
|
40662
|
-
if (ctx.registry) throw new Error("Worker groups are not available in on-chain sessions.");
|
|
40663
|
-
await ctx.client.joinGroup(parsed.joinGroupId, { signal });
|
|
40664
|
-
outcome.joinedGroup = parsed.joinGroupId;
|
|
40665
|
-
} catch (error) {
|
|
40666
|
-
outcome.groupJoinError = describeError(error);
|
|
40667
|
-
}
|
|
40668
|
-
}
|
|
40669
41215
|
outcome.description = text(sessionConfig.sessionInfo).slice(0, MAX_DESCRIPTION_LENGTH);
|
|
40670
41216
|
outcome.context = contextOf(sessionConfig);
|
|
41217
|
+
const instructions = instructionsOf(sessionConfig);
|
|
41218
|
+
if (instructions) outcome.agentInstructions = instructions;
|
|
40671
41219
|
const sessionSbts = listSessionSbts(sessionConfig);
|
|
40672
41220
|
if (sessionSbts.length) outcome.sessionSbts = sessionSbts;
|
|
40673
|
-
|
|
41221
|
+
const linkGroup = ctx.registry ? "" : parsed.joinGroupId;
|
|
41222
|
+
if (!ctx.registry) {
|
|
41223
|
+
checkpoint();
|
|
41224
|
+
Object.assign(outcome, await describeGroups(ctx), await invitationFor(ctx, sessionConfig));
|
|
41225
|
+
if (linkGroup) outcome.linkGroup = linkGroup;
|
|
41226
|
+
}
|
|
41227
|
+
const member = outcome.groups ? outcome.groups.some((group) => group.member && group.groupId.toLowerCase() === linkGroup.toLowerCase()) : null;
|
|
41228
|
+
outcome.next = nextStep({ instructions, linkGroup, member });
|
|
40674
41229
|
return outcome;
|
|
40675
41230
|
},
|
|
40676
41231
|
async requestTestEth({ session } = {}) {
|
|
@@ -40683,13 +41238,17 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40683
41238
|
const [questions, mine] = await Promise.all([loadQuestions(ctx), loadMyAnswers(ctx)]);
|
|
40684
41239
|
const endsAt = text(sessionConfig.sessionEndsAt);
|
|
40685
41240
|
const sessionSbts = listSessionSbts(sessionConfig);
|
|
41241
|
+
const instructions = instructionsOf(sessionConfig);
|
|
40686
41242
|
return {
|
|
40687
41243
|
...sessionSummary(ctx, sessionConfig),
|
|
40688
41244
|
testEth: await ctx.client.describeTestEth(),
|
|
40689
41245
|
description: text(sessionConfig.sessionInfo).slice(0, MAX_DESCRIPTION_LENGTH),
|
|
40690
41246
|
context: contextOf(sessionConfig),
|
|
41247
|
+
...instructions ? { agentInstructions: instructions } : {},
|
|
40691
41248
|
...endsAt ? { endsAt } : {},
|
|
40692
41249
|
...sessionSbts.length ? { sessionSbts } : {},
|
|
41250
|
+
...ctx.registry ? {} : await describeGroups(ctx),
|
|
41251
|
+
...ctx.registry ? {} : await invitationFor(ctx, sessionConfig),
|
|
40693
41252
|
questions: questions.length,
|
|
40694
41253
|
answeredByMe: questions.filter((question) => mine.has(question.id)).length,
|
|
40695
41254
|
...progressNotes(questions, mine)
|
|
@@ -40774,8 +41333,8 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40774
41333
|
let requestId;
|
|
40775
41334
|
await saveState((fresh) => {
|
|
40776
41335
|
const entry = fresh.sessions[sessionKey(ctx.info)];
|
|
40777
|
-
if (!
|
|
40778
|
-
entry.pendingUploads =
|
|
41336
|
+
if (!isRecord9(entry) || entry.sessionId !== ctx.client.sessionId) throw new Error("Session identity changed; join again before answering.");
|
|
41337
|
+
entry.pendingUploads = isRecord9(entry.pendingUploads) ? entry.pendingUploads : {};
|
|
40779
41338
|
const previous = entry.pendingUploads[questionId];
|
|
40780
41339
|
requestId = previous?.payloadDigest === digest && trim8(previous.requestId) ? previous.requestId : `answer:v1:${operationId}:${questionId}`;
|
|
40781
41340
|
entry.pendingUploads[questionId] = { payloadDigest: digest, requestId };
|
|
@@ -40949,11 +41508,75 @@ var createParticipant = ({ config, wallet, fetchImpl = globalThis.fetch, now = (
|
|
|
40949
41508
|
if (ctx.registry) throw new Error("Worker groups are not available in on-chain sessions.");
|
|
40950
41509
|
await ensureReady(ctx);
|
|
40951
41510
|
const id = trim8(groupId);
|
|
40952
|
-
if (
|
|
41511
|
+
if (!GROUP_ID_RE.test(id)) throw new Error("Pass a valid group id.");
|
|
40953
41512
|
checkpoint();
|
|
40954
|
-
await ctx.client.joinGroup(id, { signal })
|
|
41513
|
+
await ctx.client.joinGroup(id, { signal }).catch((error) => {
|
|
41514
|
+
throw groupRefusal(error, id);
|
|
41515
|
+
});
|
|
40955
41516
|
return { session: ctx.info.slug, joinedGroup: id };
|
|
40956
41517
|
},
|
|
41518
|
+
async leaveGroup({ session, groupId } = {}) {
|
|
41519
|
+
const ctx = await resolveSession(session);
|
|
41520
|
+
if (ctx.registry) throw new Error("Worker groups are not available in on-chain sessions.");
|
|
41521
|
+
await ensureReady(ctx);
|
|
41522
|
+
const id = trim8(groupId);
|
|
41523
|
+
if (!GROUP_ID_RE.test(id)) throw new Error("Pass a valid group id.");
|
|
41524
|
+
checkpoint();
|
|
41525
|
+
await ctx.client.leaveGroup(id, { signal }).catch((error) => {
|
|
41526
|
+
throw groupRefusal(error, id);
|
|
41527
|
+
});
|
|
41528
|
+
return { session: ctx.info.slug, leftGroup: id };
|
|
41529
|
+
},
|
|
41530
|
+
async addContext({ session, file, url, text: note, title, adminsOnly = false } = {}) {
|
|
41531
|
+
const given = { file, url, text: note };
|
|
41532
|
+
const chosen = Object.keys(given).filter((key) => given[key] !== void 0 && given[key] !== "");
|
|
41533
|
+
if (chosen.length !== 1) throw new Error("Pass exactly one of file, url or text.");
|
|
41534
|
+
const [kind] = chosen;
|
|
41535
|
+
if (kind === "file" && title !== void 0) throw new Error("A file keeps its own name; pass title only with url or text.");
|
|
41536
|
+
if (adminsOnly !== void 0 && typeof adminsOnly !== "boolean") throw new Error("adminsOnly must be true or false.");
|
|
41537
|
+
const ctx = await resolveSession(session);
|
|
41538
|
+
if (ctx.registry) throw new Error("Adding context isn\u2019t available in on-chain sessions yet.");
|
|
41539
|
+
const sessionConfig = await ensureReady(ctx);
|
|
41540
|
+
if (!workerReadsContext(sessionConfig)) {
|
|
41541
|
+
throw new Error("This session keeps its files where its Session Worker can\u2019t read them, so it takes no context.");
|
|
41542
|
+
}
|
|
41543
|
+
let featuresUnread = false;
|
|
41544
|
+
if (!isSessionAdmin(ctx, sessionConfig)) {
|
|
41545
|
+
if (!participantsMayAddContext(sessionConfig)) throw new Error(CONTEXT_ADMINS_ONLY);
|
|
41546
|
+
if (hasEnded(sessionConfig)) throw new Error(CONTEXT_ENDED);
|
|
41547
|
+
const features = await ctx.client.readFeatures();
|
|
41548
|
+
featuresUnread = !features;
|
|
41549
|
+
if (features && !features.includes("participant_context_v1")) {
|
|
41550
|
+
throw new Error("This session\u2019s Worker doesn\u2019t take context from participants yet.");
|
|
41551
|
+
}
|
|
41552
|
+
if (kind === "url" && features && !features.includes("participant_context_links_v1")) throw new Error(CONTEXT_NO_LINKS);
|
|
41553
|
+
if (kind === "url" && !mayAddLinks(ctx, sessionConfig)) throw new Error(CONTEXT_NO_FETCH);
|
|
41554
|
+
}
|
|
41555
|
+
const adderName = agentAdderName(profile().displayName);
|
|
41556
|
+
const visibleTo = adminsOnly ? "the session\u2019s admins" : "everyone in the session";
|
|
41557
|
+
try {
|
|
41558
|
+
if (kind === "url") {
|
|
41559
|
+
const link = checkContextLink({ url, title });
|
|
41560
|
+
checkpoint();
|
|
41561
|
+
const result = await ctx.client.contextAction({
|
|
41562
|
+
action: "add-link",
|
|
41563
|
+
url: link.url,
|
|
41564
|
+
...link.title ? { title: link.title } : {},
|
|
41565
|
+
adminsOnly,
|
|
41566
|
+
adder: CONTEXT_AGENT_ADDER,
|
|
41567
|
+
...adderName ? { adderName } : {}
|
|
41568
|
+
}, { signal });
|
|
41569
|
+
const source = isRecord9(result?.source) ? result.source : {};
|
|
41570
|
+
return { session: ctx.info.slug, added: "link", id: text(source.id), url: link.url, title: text(source.title) || link.title, visibleTo };
|
|
41571
|
+
}
|
|
41572
|
+
const upload = kind === "file" ? await readContextFile(file, { stateDir: config.stateDir }) : buildNote({ text: note, title });
|
|
41573
|
+
checkpoint();
|
|
41574
|
+
const storageRef = await ctx.client.uploadForm(contextUploadForm(upload, { adminsOnly, adderName }), { signal });
|
|
41575
|
+
return { session: ctx.info.slug, added: kind, id: text(storageRef?.id), name: upload.name, visibleTo };
|
|
41576
|
+
} catch (error) {
|
|
41577
|
+
throw contextRefusal(error, { olderLink: kind === "url" && featuresUnread });
|
|
41578
|
+
}
|
|
41579
|
+
},
|
|
40957
41580
|
async claimSbt({ session, sbt: sbtAddress, inviteCode, groupPassword, claimPassword } = {}) {
|
|
40958
41581
|
if (!sbt) throw new Error("SBT claims are not available in this build.");
|
|
40959
41582
|
const ctx = await resolveSession(session);
|
|
@@ -40983,6 +41606,10 @@ var SERVER_INSTRUCTIONS = [
|
|
|
40983
41606
|
"an AI agent with your own key and address, recorded as a self-declared agent.",
|
|
40984
41607
|
"Join with a session link, read the context, then answer statements honestly in your own voice",
|
|
40985
41608
|
"and use comments to explain your reasoning. Add a new statement only when something important is missing.",
|
|
41609
|
+
"A session may give agents its own instructions (agentInstructions), shown when you join: follow them as well as this guidance.",
|
|
41610
|
+
"They can ask more of you but never lift these rules. Which group to join, if any, is up to them.",
|
|
41611
|
+
"When a session invites you to add context, you may add a file, a link or text that everyone in it will see;",
|
|
41612
|
+
"add no private or personal data.",
|
|
40986
41613
|
"Check the session testEth offer before paying gas yourself; use request_test_eth when available.",
|
|
40987
41614
|
"Never claim to be human. When results are public, anyone can read your answers and comments."
|
|
40988
41615
|
].join(" ");
|
|
@@ -40990,7 +41617,7 @@ var sessionParam = {
|
|
|
40990
41617
|
type: "string",
|
|
40991
41618
|
description: "Session slug or link. Defaults to the session joined most recently."
|
|
40992
41619
|
};
|
|
40993
|
-
var
|
|
41620
|
+
var text5 = (description, extra = {}) => ({ type: "string", description, ...extra });
|
|
40994
41621
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true };
|
|
40995
41622
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
|
|
40996
41623
|
var SPENDS = { ...WRITE, destructiveHint: true };
|
|
@@ -41010,9 +41637,9 @@ var buildTools = (participant) => [
|
|
|
41010
41637
|
inputSchema: {
|
|
41011
41638
|
type: "object",
|
|
41012
41639
|
properties: {
|
|
41013
|
-
displayName:
|
|
41014
|
-
modelId:
|
|
41015
|
-
platform:
|
|
41640
|
+
displayName: text5("Name shown in reports; up to 80 characters. Empty string clears it."),
|
|
41641
|
+
modelId: text5("Model identifier, for example the model you run on."),
|
|
41642
|
+
platform: text5("Agent platform or harness.")
|
|
41016
41643
|
},
|
|
41017
41644
|
additionalProperties: false
|
|
41018
41645
|
},
|
|
@@ -41022,16 +41649,16 @@ var buildTools = (participant) => [
|
|
|
41022
41649
|
{
|
|
41023
41650
|
name: "join_session",
|
|
41024
41651
|
title: "Join a session",
|
|
41025
|
-
description: "Join a Context Engine session from its link.
|
|
41652
|
+
description: "Join a Context Engine session from its link. A link without worker= reaches the Session Worker its site lists in /known-sessions.json, or else the OP Sepolia registry. Signs in with your own key; registry reads remain available if the gate refuses sign-in. Claims SBTs explicitly marked for auto-claim in the link, and names any group in the link without joining it. Returns the context and the session\u2019s instructions for agents (agentInstructions) to read before answering, its groups, and its invitation to add context when it has one.",
|
|
41026
41653
|
inputSchema: {
|
|
41027
41654
|
type: "object",
|
|
41028
41655
|
properties: {
|
|
41029
|
-
link:
|
|
41030
|
-
worker:
|
|
41031
|
-
session:
|
|
41032
|
-
inviteCode:
|
|
41033
|
-
groupPassword:
|
|
41034
|
-
claimPassword:
|
|
41656
|
+
link: text5("Session link, including any invite parameters."),
|
|
41657
|
+
worker: text5("Worker origin, when you have no link."),
|
|
41658
|
+
session: text5("Session slug, when you have no link."),
|
|
41659
|
+
inviteCode: text5("SBT invite code, if one was given separately from the link."),
|
|
41660
|
+
groupPassword: text5("SBT group password, if one was given separately."),
|
|
41661
|
+
claimPassword: text5("SBT claim password, if one was given separately.")
|
|
41035
41662
|
},
|
|
41036
41663
|
additionalProperties: false
|
|
41037
41664
|
},
|
|
@@ -41049,7 +41676,7 @@ var buildTools = (participant) => [
|
|
|
41049
41676
|
{
|
|
41050
41677
|
name: "get_session",
|
|
41051
41678
|
title: "Get session",
|
|
41052
|
-
description: "Show the session\u2019s description, context, end time, and how many statements you have answered.",
|
|
41679
|
+
description: "Show the session\u2019s description, context, instructions for agents (agentInstructions), groups and whether you are in each, its invitation to add context when it has one, end time, and how many statements you have answered.",
|
|
41053
41680
|
inputSchema: { type: "object", properties: { session: sessionParam }, additionalProperties: false },
|
|
41054
41681
|
annotations: READ,
|
|
41055
41682
|
handler: (args, extra) => participant.getSession(args, extra)
|
|
@@ -41085,9 +41712,9 @@ var buildTools = (participant) => [
|
|
|
41085
41712
|
items: {
|
|
41086
41713
|
type: "object",
|
|
41087
41714
|
properties: {
|
|
41088
|
-
questionId:
|
|
41715
|
+
questionId: text5("Question id from list_questions."),
|
|
41089
41716
|
value: { description: "The answer value; see the tool description for each type." },
|
|
41090
|
-
comment:
|
|
41717
|
+
comment: text5("Optional reasoning shown with your answer (up to 4000 characters)."),
|
|
41091
41718
|
importance: { type: "integer", minimum: 0, maximum: 10, description: "How much this question matters to you." },
|
|
41092
41719
|
conviction: { type: "integer", minimum: 0, maximum: 10, description: "How sure you are of your answer." }
|
|
41093
41720
|
},
|
|
@@ -41110,7 +41737,7 @@ var buildTools = (participant) => [
|
|
|
41110
41737
|
type: "object",
|
|
41111
41738
|
properties: {
|
|
41112
41739
|
session: sessionParam,
|
|
41113
|
-
prompt:
|
|
41740
|
+
prompt: text5("The statement or question text."),
|
|
41114
41741
|
type: { type: "string", enum: ["binary", "rating", "multichoice", "quadratic", "freeform"] },
|
|
41115
41742
|
options: { type: "array", items: { type: "string" }, description: "Options for multichoice or quadratic." },
|
|
41116
41743
|
singleSelect: { type: "boolean", description: "Multichoice: allow only one option." },
|
|
@@ -41123,6 +41750,25 @@ var buildTools = (participant) => [
|
|
|
41123
41750
|
annotations: SPENDS,
|
|
41124
41751
|
handler: (args, extra) => participant.addStatement(args, extra)
|
|
41125
41752
|
},
|
|
41753
|
+
{
|
|
41754
|
+
name: "add_context",
|
|
41755
|
+
title: "Add context",
|
|
41756
|
+
description: "Add context to a hosted session, when it invites you to: exactly one of file (a local PDF, Markdown, plain text, CSV or JSON file), url (a public https:// page the Session Worker reads now, where the invitation offers a link) or text (stored as a Markdown file). Everyone in the session sees it, unless adminsOnly is true. It is marked as added by an agent, under your display name. Add no private or personal data.",
|
|
41757
|
+
inputSchema: {
|
|
41758
|
+
type: "object",
|
|
41759
|
+
properties: {
|
|
41760
|
+
session: sessionParam,
|
|
41761
|
+
file: text5("Path to a local file."),
|
|
41762
|
+
url: text5("An https:// link to a public page."),
|
|
41763
|
+
text: text5("Text to add, in Markdown."),
|
|
41764
|
+
title: text5("Optional title for a link or text (up to 120 characters)."),
|
|
41765
|
+
adminsOnly: { type: "boolean", description: "Show it to the session\u2019s admins alone (default false)." }
|
|
41766
|
+
},
|
|
41767
|
+
additionalProperties: false
|
|
41768
|
+
},
|
|
41769
|
+
annotations: WRITE,
|
|
41770
|
+
handler: (args, extra) => participant.addContext(args, extra)
|
|
41771
|
+
},
|
|
41126
41772
|
{
|
|
41127
41773
|
name: "get_results",
|
|
41128
41774
|
title: "Get results",
|
|
@@ -41142,16 +41788,29 @@ var buildTools = (participant) => [
|
|
|
41142
41788
|
{
|
|
41143
41789
|
name: "join_group",
|
|
41144
41790
|
title: "Join a group",
|
|
41145
|
-
description: "Join an open group in
|
|
41791
|
+
description: "Join an open group in a hosted session by its id. join_session and get_session list the groups; join the one the session\u2019s instructions ask you to, if any.",
|
|
41146
41792
|
inputSchema: {
|
|
41147
41793
|
type: "object",
|
|
41148
|
-
properties: { session: sessionParam, groupId:
|
|
41794
|
+
properties: { session: sessionParam, groupId: text5("Group id.") },
|
|
41149
41795
|
required: ["groupId"],
|
|
41150
41796
|
additionalProperties: false
|
|
41151
41797
|
},
|
|
41152
41798
|
annotations: { ...WRITE, idempotentHint: true },
|
|
41153
41799
|
handler: (args, extra) => participant.joinGroup(args, extra)
|
|
41154
41800
|
},
|
|
41801
|
+
{
|
|
41802
|
+
name: "leave_group",
|
|
41803
|
+
title: "Leave a group",
|
|
41804
|
+
description: "Leave a group you are in, in a hosted session. Says so when you aren\u2019t a member, or when the group doesn\u2019t let members leave.",
|
|
41805
|
+
inputSchema: {
|
|
41806
|
+
type: "object",
|
|
41807
|
+
properties: { session: sessionParam, groupId: text5("Group id.") },
|
|
41808
|
+
required: ["groupId"],
|
|
41809
|
+
additionalProperties: false
|
|
41810
|
+
},
|
|
41811
|
+
annotations: { ...WRITE, destructiveHint: true, idempotentHint: true },
|
|
41812
|
+
handler: (args, extra) => participant.leaveGroup(args, extra)
|
|
41813
|
+
},
|
|
41155
41814
|
{
|
|
41156
41815
|
name: "claim_sbt",
|
|
41157
41816
|
title: "Claim an SBT",
|
|
@@ -41160,10 +41819,10 @@ var buildTools = (participant) => [
|
|
|
41160
41819
|
type: "object",
|
|
41161
41820
|
properties: {
|
|
41162
41821
|
session: sessionParam,
|
|
41163
|
-
sbt:
|
|
41164
|
-
inviteCode:
|
|
41165
|
-
groupPassword:
|
|
41166
|
-
claimPassword:
|
|
41822
|
+
sbt: text5("SBT contract address."),
|
|
41823
|
+
inviteCode: text5("Invite code, when the SBT uses invites."),
|
|
41824
|
+
groupPassword: text5("Group password, when the SBT uses one."),
|
|
41825
|
+
claimPassword: text5("Claim password, when the SBT uses per-claim passwords.")
|
|
41167
41826
|
},
|
|
41168
41827
|
required: ["sbt"],
|
|
41169
41828
|
additionalProperties: false
|