@enactprotocol/mcp-server 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +750 -628
- package/dist/index.js.bak +750 -628
- package/package.json +2 -5
package/dist/index.js
CHANGED
|
@@ -7496,7 +7496,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
|
|
|
7496
7496
|
if (!(this instanceof SonicBoom)) {
|
|
7497
7497
|
return new SonicBoom(opts);
|
|
7498
7498
|
}
|
|
7499
|
-
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {};
|
|
7499
|
+
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir: mkdir2, retryEAGAIN, fsync, contentMode, mode } = opts || {};
|
|
7500
7500
|
fd = fd || dest;
|
|
7501
7501
|
this._len = 0;
|
|
7502
7502
|
this.fd = -1;
|
|
@@ -7521,7 +7521,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
|
|
|
7521
7521
|
this.append = append || false;
|
|
7522
7522
|
this.mode = mode;
|
|
7523
7523
|
this.retryEAGAIN = retryEAGAIN || (() => true);
|
|
7524
|
-
this.mkdir =
|
|
7524
|
+
this.mkdir = mkdir2 || false;
|
|
7525
7525
|
let fsWriteSync;
|
|
7526
7526
|
let fsWrite;
|
|
7527
7527
|
if (contentMode === kContentModeBuffer) {
|
|
@@ -8213,7 +8213,7 @@ var require_thread_stream = __commonJS((exports, module) => {
|
|
|
8213
8213
|
var { version } = require_package();
|
|
8214
8214
|
var { EventEmitter } = __require("events");
|
|
8215
8215
|
var { Worker } = __require("worker_threads");
|
|
8216
|
-
var { join } = __require("path");
|
|
8216
|
+
var { join: join2 } = __require("path");
|
|
8217
8217
|
var { pathToFileURL } = __require("url");
|
|
8218
8218
|
var { wait } = require_wait();
|
|
8219
8219
|
var {
|
|
@@ -8249,7 +8249,7 @@ var require_thread_stream = __commonJS((exports, module) => {
|
|
|
8249
8249
|
function createWorker(stream, opts) {
|
|
8250
8250
|
const { filename, workerData } = opts;
|
|
8251
8251
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
8252
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
8252
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join2(__dirname, "lib", "worker.js");
|
|
8253
8253
|
const worker = new Worker(toExecute, {
|
|
8254
8254
|
...opts.workerOpts,
|
|
8255
8255
|
trackUnmanagedFds: false,
|
|
@@ -8633,7 +8633,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
8633
8633
|
var __dirname = "/Users/keithgroves/projects/enact/enact-cli/node_modules/pino/lib";
|
|
8634
8634
|
var { createRequire: createRequire2 } = __require("module");
|
|
8635
8635
|
var getCallers = require_caller();
|
|
8636
|
-
var { join, isAbsolute, sep } = __require("node:path");
|
|
8636
|
+
var { join: join2, isAbsolute, sep } = __require("node:path");
|
|
8637
8637
|
var sleep = require_atomic_sleep();
|
|
8638
8638
|
var onExit = require_on_exit_leak_free();
|
|
8639
8639
|
var ThreadStream = require_thread_stream();
|
|
@@ -8696,7 +8696,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
8696
8696
|
throw new Error("only one of target or targets can be specified");
|
|
8697
8697
|
}
|
|
8698
8698
|
if (targets) {
|
|
8699
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
8699
|
+
target = bundlerOverrides["pino-worker"] || join2(__dirname, "worker.js");
|
|
8700
8700
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
8701
8701
|
return {
|
|
8702
8702
|
...dest,
|
|
@@ -8713,7 +8713,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
8713
8713
|
});
|
|
8714
8714
|
});
|
|
8715
8715
|
} else if (pipeline2) {
|
|
8716
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
8716
|
+
target = bundlerOverrides["pino-worker"] || join2(__dirname, "worker.js");
|
|
8717
8717
|
options.pipelines = [pipeline2.map((dest) => {
|
|
8718
8718
|
return {
|
|
8719
8719
|
...dest,
|
|
@@ -8735,7 +8735,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
8735
8735
|
return origin;
|
|
8736
8736
|
}
|
|
8737
8737
|
if (origin === "pino/file") {
|
|
8738
|
-
return
|
|
8738
|
+
return join2(__dirname, "..", "file.js");
|
|
8739
8739
|
}
|
|
8740
8740
|
let fixTarget2;
|
|
8741
8741
|
for (const filePath of callers) {
|
|
@@ -9638,7 +9638,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
|
|
|
9638
9638
|
return circularValue;
|
|
9639
9639
|
}
|
|
9640
9640
|
let res = "";
|
|
9641
|
-
let
|
|
9641
|
+
let join2 = ",";
|
|
9642
9642
|
const originalIndentation = indentation;
|
|
9643
9643
|
if (Array.isArray(value)) {
|
|
9644
9644
|
if (value.length === 0) {
|
|
@@ -9652,7 +9652,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
|
|
|
9652
9652
|
indentation += spacer;
|
|
9653
9653
|
res += `
|
|
9654
9654
|
${indentation}`;
|
|
9655
|
-
|
|
9655
|
+
join2 = `,
|
|
9656
9656
|
${indentation}`;
|
|
9657
9657
|
}
|
|
9658
9658
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -9660,13 +9660,13 @@ ${indentation}`;
|
|
|
9660
9660
|
for (;i < maximumValuesToStringify - 1; i++) {
|
|
9661
9661
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
9662
9662
|
res += tmp2 !== undefined ? tmp2 : "null";
|
|
9663
|
-
res +=
|
|
9663
|
+
res += join2;
|
|
9664
9664
|
}
|
|
9665
9665
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
9666
9666
|
res += tmp !== undefined ? tmp : "null";
|
|
9667
9667
|
if (value.length - 1 > maximumBreadth) {
|
|
9668
9668
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
9669
|
-
res += `${
|
|
9669
|
+
res += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
9670
9670
|
}
|
|
9671
9671
|
if (spacer !== "") {
|
|
9672
9672
|
res += `
|
|
@@ -9687,7 +9687,7 @@ ${originalIndentation}`;
|
|
|
9687
9687
|
let separator = "";
|
|
9688
9688
|
if (spacer !== "") {
|
|
9689
9689
|
indentation += spacer;
|
|
9690
|
-
|
|
9690
|
+
join2 = `,
|
|
9691
9691
|
${indentation}`;
|
|
9692
9692
|
whitespace = " ";
|
|
9693
9693
|
}
|
|
@@ -9701,13 +9701,13 @@ ${indentation}`;
|
|
|
9701
9701
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
9702
9702
|
if (tmp !== undefined) {
|
|
9703
9703
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
9704
|
-
separator =
|
|
9704
|
+
separator = join2;
|
|
9705
9705
|
}
|
|
9706
9706
|
}
|
|
9707
9707
|
if (keyLength > maximumBreadth) {
|
|
9708
9708
|
const removedKeys = keyLength - maximumBreadth;
|
|
9709
9709
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
9710
|
-
separator =
|
|
9710
|
+
separator = join2;
|
|
9711
9711
|
}
|
|
9712
9712
|
if (spacer !== "" && separator.length > 1) {
|
|
9713
9713
|
res = `
|
|
@@ -9747,7 +9747,7 @@ ${originalIndentation}`;
|
|
|
9747
9747
|
}
|
|
9748
9748
|
const originalIndentation = indentation;
|
|
9749
9749
|
let res = "";
|
|
9750
|
-
let
|
|
9750
|
+
let join2 = ",";
|
|
9751
9751
|
if (Array.isArray(value)) {
|
|
9752
9752
|
if (value.length === 0) {
|
|
9753
9753
|
return "[]";
|
|
@@ -9760,7 +9760,7 @@ ${originalIndentation}`;
|
|
|
9760
9760
|
indentation += spacer;
|
|
9761
9761
|
res += `
|
|
9762
9762
|
${indentation}`;
|
|
9763
|
-
|
|
9763
|
+
join2 = `,
|
|
9764
9764
|
${indentation}`;
|
|
9765
9765
|
}
|
|
9766
9766
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -9768,13 +9768,13 @@ ${indentation}`;
|
|
|
9768
9768
|
for (;i < maximumValuesToStringify - 1; i++) {
|
|
9769
9769
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
9770
9770
|
res += tmp2 !== undefined ? tmp2 : "null";
|
|
9771
|
-
res +=
|
|
9771
|
+
res += join2;
|
|
9772
9772
|
}
|
|
9773
9773
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
9774
9774
|
res += tmp !== undefined ? tmp : "null";
|
|
9775
9775
|
if (value.length - 1 > maximumBreadth) {
|
|
9776
9776
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
9777
|
-
res += `${
|
|
9777
|
+
res += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
9778
9778
|
}
|
|
9779
9779
|
if (spacer !== "") {
|
|
9780
9780
|
res += `
|
|
@@ -9787,7 +9787,7 @@ ${originalIndentation}`;
|
|
|
9787
9787
|
let whitespace = "";
|
|
9788
9788
|
if (spacer !== "") {
|
|
9789
9789
|
indentation += spacer;
|
|
9790
|
-
|
|
9790
|
+
join2 = `,
|
|
9791
9791
|
${indentation}`;
|
|
9792
9792
|
whitespace = " ";
|
|
9793
9793
|
}
|
|
@@ -9796,7 +9796,7 @@ ${indentation}`;
|
|
|
9796
9796
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
9797
9797
|
if (tmp !== undefined) {
|
|
9798
9798
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
9799
|
-
separator =
|
|
9799
|
+
separator = join2;
|
|
9800
9800
|
}
|
|
9801
9801
|
}
|
|
9802
9802
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -9853,20 +9853,20 @@ ${originalIndentation}`;
|
|
|
9853
9853
|
indentation += spacer;
|
|
9854
9854
|
let res2 = `
|
|
9855
9855
|
${indentation}`;
|
|
9856
|
-
const
|
|
9856
|
+
const join3 = `,
|
|
9857
9857
|
${indentation}`;
|
|
9858
9858
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
9859
9859
|
let i = 0;
|
|
9860
9860
|
for (;i < maximumValuesToStringify - 1; i++) {
|
|
9861
9861
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
9862
9862
|
res2 += tmp2 !== undefined ? tmp2 : "null";
|
|
9863
|
-
res2 +=
|
|
9863
|
+
res2 += join3;
|
|
9864
9864
|
}
|
|
9865
9865
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
9866
9866
|
res2 += tmp !== undefined ? tmp : "null";
|
|
9867
9867
|
if (value.length - 1 > maximumBreadth) {
|
|
9868
9868
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
9869
|
-
res2 += `${
|
|
9869
|
+
res2 += `${join3}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
9870
9870
|
}
|
|
9871
9871
|
res2 += `
|
|
9872
9872
|
${originalIndentation}`;
|
|
@@ -9882,16 +9882,16 @@ ${originalIndentation}`;
|
|
|
9882
9882
|
return '"[Object]"';
|
|
9883
9883
|
}
|
|
9884
9884
|
indentation += spacer;
|
|
9885
|
-
const
|
|
9885
|
+
const join2 = `,
|
|
9886
9886
|
${indentation}`;
|
|
9887
9887
|
let res = "";
|
|
9888
9888
|
let separator = "";
|
|
9889
9889
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
9890
9890
|
if (isTypedArrayWithEntries(value)) {
|
|
9891
|
-
res += stringifyTypedArray(value,
|
|
9891
|
+
res += stringifyTypedArray(value, join2, maximumBreadth);
|
|
9892
9892
|
keys = keys.slice(value.length);
|
|
9893
9893
|
maximumPropertiesToStringify -= value.length;
|
|
9894
|
-
separator =
|
|
9894
|
+
separator = join2;
|
|
9895
9895
|
}
|
|
9896
9896
|
if (deterministic) {
|
|
9897
9897
|
keys = sort(keys, comparator);
|
|
@@ -9902,13 +9902,13 @@ ${indentation}`;
|
|
|
9902
9902
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
9903
9903
|
if (tmp !== undefined) {
|
|
9904
9904
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
9905
|
-
separator =
|
|
9905
|
+
separator = join2;
|
|
9906
9906
|
}
|
|
9907
9907
|
}
|
|
9908
9908
|
if (keyLength > maximumBreadth) {
|
|
9909
9909
|
const removedKeys = keyLength - maximumBreadth;
|
|
9910
9910
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
9911
|
-
separator =
|
|
9911
|
+
separator = join2;
|
|
9912
9912
|
}
|
|
9913
9913
|
if (separator !== "") {
|
|
9914
9914
|
res = `
|
|
@@ -14339,23 +14339,23 @@ var require_printer = __commonJS((exports) => {
|
|
|
14339
14339
|
leave: (node) => "$" + node.name
|
|
14340
14340
|
},
|
|
14341
14341
|
Document: {
|
|
14342
|
-
leave: (node) =>
|
|
14342
|
+
leave: (node) => join2(node.definitions, `
|
|
14343
14343
|
|
|
14344
14344
|
`)
|
|
14345
14345
|
},
|
|
14346
14346
|
OperationDefinition: {
|
|
14347
14347
|
leave(node) {
|
|
14348
|
-
const varDefs = wrap("(",
|
|
14349
|
-
const prefix =
|
|
14348
|
+
const varDefs = wrap("(", join2(node.variableDefinitions, ", "), ")");
|
|
14349
|
+
const prefix = join2([
|
|
14350
14350
|
node.operation,
|
|
14351
|
-
|
|
14352
|
-
|
|
14351
|
+
join2([node.name, varDefs]),
|
|
14352
|
+
join2(node.directives, " ")
|
|
14353
14353
|
], " ");
|
|
14354
14354
|
return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
|
|
14355
14355
|
}
|
|
14356
14356
|
},
|
|
14357
14357
|
VariableDefinition: {
|
|
14358
|
-
leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ",
|
|
14358
|
+
leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join2(directives, " "))
|
|
14359
14359
|
},
|
|
14360
14360
|
SelectionSet: {
|
|
14361
14361
|
leave: ({ selections }) => block(selections)
|
|
@@ -14363,32 +14363,32 @@ var require_printer = __commonJS((exports) => {
|
|
|
14363
14363
|
Field: {
|
|
14364
14364
|
leave({ alias, name, arguments: args, directives, selectionSet }) {
|
|
14365
14365
|
const prefix = wrap("", alias, ": ") + name;
|
|
14366
|
-
let argsLine = prefix + wrap("(",
|
|
14366
|
+
let argsLine = prefix + wrap("(", join2(args, ", "), ")");
|
|
14367
14367
|
if (argsLine.length > MAX_LINE_LENGTH) {
|
|
14368
14368
|
argsLine = prefix + wrap(`(
|
|
14369
|
-
`, indent(
|
|
14369
|
+
`, indent(join2(args, `
|
|
14370
14370
|
`)), `
|
|
14371
14371
|
)`);
|
|
14372
14372
|
}
|
|
14373
|
-
return
|
|
14373
|
+
return join2([argsLine, join2(directives, " "), selectionSet], " ");
|
|
14374
14374
|
}
|
|
14375
14375
|
},
|
|
14376
14376
|
Argument: {
|
|
14377
14377
|
leave: ({ name, value }) => name + ": " + value
|
|
14378
14378
|
},
|
|
14379
14379
|
FragmentSpread: {
|
|
14380
|
-
leave: ({ name, directives }) => "..." + name + wrap(" ",
|
|
14380
|
+
leave: ({ name, directives }) => "..." + name + wrap(" ", join2(directives, " "))
|
|
14381
14381
|
},
|
|
14382
14382
|
InlineFragment: {
|
|
14383
|
-
leave: ({ typeCondition, directives, selectionSet }) =>
|
|
14383
|
+
leave: ({ typeCondition, directives, selectionSet }) => join2([
|
|
14384
14384
|
"...",
|
|
14385
14385
|
wrap("on ", typeCondition),
|
|
14386
|
-
|
|
14386
|
+
join2(directives, " "),
|
|
14387
14387
|
selectionSet
|
|
14388
14388
|
], " ")
|
|
14389
14389
|
},
|
|
14390
14390
|
FragmentDefinition: {
|
|
14391
|
-
leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => `fragment ${name}${wrap("(",
|
|
14391
|
+
leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => `fragment ${name}${wrap("(", join2(variableDefinitions, ", "), ")")} ` + `on ${typeCondition} ${wrap("", join2(directives, " "), " ")}` + selectionSet
|
|
14392
14392
|
},
|
|
14393
14393
|
IntValue: {
|
|
14394
14394
|
leave: ({ value }) => value
|
|
@@ -14409,16 +14409,16 @@ var require_printer = __commonJS((exports) => {
|
|
|
14409
14409
|
leave: ({ value }) => value
|
|
14410
14410
|
},
|
|
14411
14411
|
ListValue: {
|
|
14412
|
-
leave: ({ values }) => "[" +
|
|
14412
|
+
leave: ({ values }) => "[" + join2(values, ", ") + "]"
|
|
14413
14413
|
},
|
|
14414
14414
|
ObjectValue: {
|
|
14415
|
-
leave: ({ fields }) => "{" +
|
|
14415
|
+
leave: ({ fields }) => "{" + join2(fields, ", ") + "}"
|
|
14416
14416
|
},
|
|
14417
14417
|
ObjectField: {
|
|
14418
14418
|
leave: ({ name, value }) => name + ": " + value
|
|
14419
14419
|
},
|
|
14420
14420
|
Directive: {
|
|
14421
|
-
leave: ({ name, arguments: args }) => "@" + name + wrap("(",
|
|
14421
|
+
leave: ({ name, arguments: args }) => "@" + name + wrap("(", join2(args, ", "), ")")
|
|
14422
14422
|
},
|
|
14423
14423
|
NamedType: {
|
|
14424
14424
|
leave: ({ name }) => name
|
|
@@ -14431,115 +14431,115 @@ var require_printer = __commonJS((exports) => {
|
|
|
14431
14431
|
},
|
|
14432
14432
|
SchemaDefinition: {
|
|
14433
14433
|
leave: ({ description, directives, operationTypes }) => wrap("", description, `
|
|
14434
|
-
`) +
|
|
14434
|
+
`) + join2(["schema", join2(directives, " "), block(operationTypes)], " ")
|
|
14435
14435
|
},
|
|
14436
14436
|
OperationTypeDefinition: {
|
|
14437
14437
|
leave: ({ operation, type }) => operation + ": " + type
|
|
14438
14438
|
},
|
|
14439
14439
|
ScalarTypeDefinition: {
|
|
14440
14440
|
leave: ({ description, name, directives }) => wrap("", description, `
|
|
14441
|
-
`) +
|
|
14441
|
+
`) + join2(["scalar", name, join2(directives, " ")], " ")
|
|
14442
14442
|
},
|
|
14443
14443
|
ObjectTypeDefinition: {
|
|
14444
14444
|
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, `
|
|
14445
|
-
`) +
|
|
14445
|
+
`) + join2([
|
|
14446
14446
|
"type",
|
|
14447
14447
|
name,
|
|
14448
|
-
wrap("implements ",
|
|
14449
|
-
|
|
14448
|
+
wrap("implements ", join2(interfaces, " & ")),
|
|
14449
|
+
join2(directives, " "),
|
|
14450
14450
|
block(fields)
|
|
14451
14451
|
], " ")
|
|
14452
14452
|
},
|
|
14453
14453
|
FieldDefinition: {
|
|
14454
14454
|
leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, `
|
|
14455
14455
|
`) + name + (hasMultilineItems(args) ? wrap(`(
|
|
14456
|
-
`, indent(
|
|
14456
|
+
`, indent(join2(args, `
|
|
14457
14457
|
`)), `
|
|
14458
|
-
)`) : wrap("(",
|
|
14458
|
+
)`) : wrap("(", join2(args, ", "), ")")) + ": " + type + wrap(" ", join2(directives, " "))
|
|
14459
14459
|
},
|
|
14460
14460
|
InputValueDefinition: {
|
|
14461
14461
|
leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, `
|
|
14462
|
-
`) +
|
|
14462
|
+
`) + join2([name + ": " + type, wrap("= ", defaultValue), join2(directives, " ")], " ")
|
|
14463
14463
|
},
|
|
14464
14464
|
InterfaceTypeDefinition: {
|
|
14465
14465
|
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, `
|
|
14466
|
-
`) +
|
|
14466
|
+
`) + join2([
|
|
14467
14467
|
"interface",
|
|
14468
14468
|
name,
|
|
14469
|
-
wrap("implements ",
|
|
14470
|
-
|
|
14469
|
+
wrap("implements ", join2(interfaces, " & ")),
|
|
14470
|
+
join2(directives, " "),
|
|
14471
14471
|
block(fields)
|
|
14472
14472
|
], " ")
|
|
14473
14473
|
},
|
|
14474
14474
|
UnionTypeDefinition: {
|
|
14475
14475
|
leave: ({ description, name, directives, types: types2 }) => wrap("", description, `
|
|
14476
|
-
`) +
|
|
14476
|
+
`) + join2(["union", name, join2(directives, " "), wrap("= ", join2(types2, " | "))], " ")
|
|
14477
14477
|
},
|
|
14478
14478
|
EnumTypeDefinition: {
|
|
14479
14479
|
leave: ({ description, name, directives, values }) => wrap("", description, `
|
|
14480
|
-
`) +
|
|
14480
|
+
`) + join2(["enum", name, join2(directives, " "), block(values)], " ")
|
|
14481
14481
|
},
|
|
14482
14482
|
EnumValueDefinition: {
|
|
14483
14483
|
leave: ({ description, name, directives }) => wrap("", description, `
|
|
14484
|
-
`) +
|
|
14484
|
+
`) + join2([name, join2(directives, " ")], " ")
|
|
14485
14485
|
},
|
|
14486
14486
|
InputObjectTypeDefinition: {
|
|
14487
14487
|
leave: ({ description, name, directives, fields }) => wrap("", description, `
|
|
14488
|
-
`) +
|
|
14488
|
+
`) + join2(["input", name, join2(directives, " "), block(fields)], " ")
|
|
14489
14489
|
},
|
|
14490
14490
|
DirectiveDefinition: {
|
|
14491
14491
|
leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, `
|
|
14492
14492
|
`) + "directive @" + name + (hasMultilineItems(args) ? wrap(`(
|
|
14493
|
-
`, indent(
|
|
14493
|
+
`, indent(join2(args, `
|
|
14494
14494
|
`)), `
|
|
14495
|
-
)`) : wrap("(",
|
|
14495
|
+
)`) : wrap("(", join2(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join2(locations, " | ")
|
|
14496
14496
|
},
|
|
14497
14497
|
SchemaExtension: {
|
|
14498
|
-
leave: ({ directives, operationTypes }) =>
|
|
14498
|
+
leave: ({ directives, operationTypes }) => join2(["extend schema", join2(directives, " "), block(operationTypes)], " ")
|
|
14499
14499
|
},
|
|
14500
14500
|
ScalarTypeExtension: {
|
|
14501
|
-
leave: ({ name, directives }) =>
|
|
14501
|
+
leave: ({ name, directives }) => join2(["extend scalar", name, join2(directives, " ")], " ")
|
|
14502
14502
|
},
|
|
14503
14503
|
ObjectTypeExtension: {
|
|
14504
|
-
leave: ({ name, interfaces, directives, fields }) =>
|
|
14504
|
+
leave: ({ name, interfaces, directives, fields }) => join2([
|
|
14505
14505
|
"extend type",
|
|
14506
14506
|
name,
|
|
14507
|
-
wrap("implements ",
|
|
14508
|
-
|
|
14507
|
+
wrap("implements ", join2(interfaces, " & ")),
|
|
14508
|
+
join2(directives, " "),
|
|
14509
14509
|
block(fields)
|
|
14510
14510
|
], " ")
|
|
14511
14511
|
},
|
|
14512
14512
|
InterfaceTypeExtension: {
|
|
14513
|
-
leave: ({ name, interfaces, directives, fields }) =>
|
|
14513
|
+
leave: ({ name, interfaces, directives, fields }) => join2([
|
|
14514
14514
|
"extend interface",
|
|
14515
14515
|
name,
|
|
14516
|
-
wrap("implements ",
|
|
14517
|
-
|
|
14516
|
+
wrap("implements ", join2(interfaces, " & ")),
|
|
14517
|
+
join2(directives, " "),
|
|
14518
14518
|
block(fields)
|
|
14519
14519
|
], " ")
|
|
14520
14520
|
},
|
|
14521
14521
|
UnionTypeExtension: {
|
|
14522
|
-
leave: ({ name, directives, types: types2 }) =>
|
|
14522
|
+
leave: ({ name, directives, types: types2 }) => join2([
|
|
14523
14523
|
"extend union",
|
|
14524
14524
|
name,
|
|
14525
|
-
|
|
14526
|
-
wrap("= ",
|
|
14525
|
+
join2(directives, " "),
|
|
14526
|
+
wrap("= ", join2(types2, " | "))
|
|
14527
14527
|
], " ")
|
|
14528
14528
|
},
|
|
14529
14529
|
EnumTypeExtension: {
|
|
14530
|
-
leave: ({ name, directives, values }) =>
|
|
14530
|
+
leave: ({ name, directives, values }) => join2(["extend enum", name, join2(directives, " "), block(values)], " ")
|
|
14531
14531
|
},
|
|
14532
14532
|
InputObjectTypeExtension: {
|
|
14533
|
-
leave: ({ name, directives, fields }) =>
|
|
14533
|
+
leave: ({ name, directives, fields }) => join2(["extend input", name, join2(directives, " "), block(fields)], " ")
|
|
14534
14534
|
}
|
|
14535
14535
|
};
|
|
14536
|
-
function
|
|
14536
|
+
function join2(maybeArray, separator = "") {
|
|
14537
14537
|
var _maybeArray$filter$jo;
|
|
14538
14538
|
return (_maybeArray$filter$jo = maybeArray === null || maybeArray === undefined ? undefined : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== undefined ? _maybeArray$filter$jo : "";
|
|
14539
14539
|
}
|
|
14540
14540
|
function block(array2) {
|
|
14541
14541
|
return wrap(`{
|
|
14542
|
-
`, indent(
|
|
14542
|
+
`, indent(join2(array2, `
|
|
14543
14543
|
`)), `
|
|
14544
14544
|
}`);
|
|
14545
14545
|
}
|
|
@@ -30130,8 +30130,8 @@ var require_adm_zip = __commonJS((exports, module) => {
|
|
|
30130
30130
|
return null;
|
|
30131
30131
|
}
|
|
30132
30132
|
function fixPath(zipPath) {
|
|
30133
|
-
const { join, normalize, sep } = pth.posix;
|
|
30134
|
-
return
|
|
30133
|
+
const { join: join2, normalize, sep } = pth.posix;
|
|
30134
|
+
return join2(".", normalize(sep + zipPath.split("\\").join(sep) + sep));
|
|
30135
30135
|
}
|
|
30136
30136
|
function filenameFilter(filterfn) {
|
|
30137
30137
|
if (filterfn instanceof RegExp) {
|
|
@@ -41520,7 +41520,7 @@ var require_path_reservations = __commonJS((exports, module) => {
|
|
|
41520
41520
|
var assert = __require("assert");
|
|
41521
41521
|
var normalize = require_normalize_unicode();
|
|
41522
41522
|
var stripSlashes = require_strip_trailing_slashes();
|
|
41523
|
-
var { join } = __require("path");
|
|
41523
|
+
var { join: join2 } = __require("path");
|
|
41524
41524
|
var platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
|
|
41525
41525
|
var isWindows = platform === "win32";
|
|
41526
41526
|
module.exports = () => {
|
|
@@ -41529,7 +41529,7 @@ var require_path_reservations = __commonJS((exports, module) => {
|
|
|
41529
41529
|
const getDirs = (path4) => {
|
|
41530
41530
|
const dirs = path4.split("/").slice(0, -1).reduce((set2, path5) => {
|
|
41531
41531
|
if (set2.length) {
|
|
41532
|
-
path5 =
|
|
41532
|
+
path5 = join2(set2[set2.length - 1], path5);
|
|
41533
41533
|
}
|
|
41534
41534
|
set2.push(path5 || "/");
|
|
41535
41535
|
return set2;
|
|
@@ -41597,7 +41597,7 @@ var require_path_reservations = __commonJS((exports, module) => {
|
|
|
41597
41597
|
};
|
|
41598
41598
|
const reserve = (paths, fn) => {
|
|
41599
41599
|
paths = isWindows ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
41600
|
-
return stripSlashes(
|
|
41600
|
+
return stripSlashes(join2(normalize(p))).toLowerCase();
|
|
41601
41601
|
});
|
|
41602
41602
|
const dirs = new Set(paths.map((path4) => getDirs(path4)).reduce((a, b) => a.concat(b)));
|
|
41603
41603
|
reservations.set(fn, { dirs, paths });
|
|
@@ -41644,7 +41644,7 @@ var require_unpack = __commonJS((exports, module) => {
|
|
|
41644
41644
|
var fs2 = __require("fs");
|
|
41645
41645
|
var fsm = require_fs_minipass();
|
|
41646
41646
|
var path4 = __require("path");
|
|
41647
|
-
var
|
|
41647
|
+
var mkdir2 = require_mkdir();
|
|
41648
41648
|
var wc = require_winchars();
|
|
41649
41649
|
var pathReservations = require_path_reservations();
|
|
41650
41650
|
var stripAbsolutePath = require_strip_absolute_path();
|
|
@@ -41890,7 +41890,7 @@ var require_unpack = __commonJS((exports, module) => {
|
|
|
41890
41890
|
}
|
|
41891
41891
|
}
|
|
41892
41892
|
[MKDIR](dir, mode, cb) {
|
|
41893
|
-
|
|
41893
|
+
mkdir2(normPath(dir), {
|
|
41894
41894
|
uid: this.uid,
|
|
41895
41895
|
gid: this.gid,
|
|
41896
41896
|
processUid: this.processUid,
|
|
@@ -42281,7 +42281,7 @@ var require_unpack = __commonJS((exports, module) => {
|
|
|
42281
42281
|
}
|
|
42282
42282
|
[MKDIR](dir, mode) {
|
|
42283
42283
|
try {
|
|
42284
|
-
return
|
|
42284
|
+
return mkdir2.sync(normPath(dir), {
|
|
42285
42285
|
uid: this.uid,
|
|
42286
42286
|
gid: this.gid,
|
|
42287
42287
|
processUid: this.processUid,
|
|
@@ -45981,7 +45981,7 @@ var require_typescript = __commonJS((exports, module) => {
|
|
|
45981
45981
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
45982
45982
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
45983
45983
|
writeCommentRange: () => writeCommentRange,
|
|
45984
|
-
writeFile: () =>
|
|
45984
|
+
writeFile: () => writeFile2,
|
|
45985
45985
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
45986
45986
|
zipWith: () => zipWith
|
|
45987
45987
|
});
|
|
@@ -51771,8 +51771,8 @@ ${lanes.join(`
|
|
|
51771
51771
|
writeOutputIsTTY() {
|
|
51772
51772
|
return process.stdout.isTTY;
|
|
51773
51773
|
},
|
|
51774
|
-
readFile,
|
|
51775
|
-
writeFile:
|
|
51774
|
+
readFile: readFile2,
|
|
51775
|
+
writeFile: writeFile22,
|
|
51776
51776
|
watchFile: watchFile2,
|
|
51777
51777
|
watchDirectory,
|
|
51778
51778
|
preferNonRecursiveWatch: !fsSupportsRecursiveFsWatch,
|
|
@@ -51964,7 +51964,7 @@ ${lanes.join(`
|
|
|
51964
51964
|
function fsWatchWorker(fileOrDirectory, recursive, callback) {
|
|
51965
51965
|
return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ? { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
|
|
51966
51966
|
}
|
|
51967
|
-
function
|
|
51967
|
+
function readFile2(fileName, _encoding) {
|
|
51968
51968
|
let buffer;
|
|
51969
51969
|
try {
|
|
51970
51970
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -51989,7 +51989,7 @@ ${lanes.join(`
|
|
|
51989
51989
|
}
|
|
51990
51990
|
return buffer.toString("utf8");
|
|
51991
51991
|
}
|
|
51992
|
-
function
|
|
51992
|
+
function writeFile22(fileName, data, writeByteOrderMark) {
|
|
51993
51993
|
if (writeByteOrderMark) {
|
|
51994
51994
|
data = byteOrderMarkIndicator + data;
|
|
51995
51995
|
}
|
|
@@ -63260,7 +63260,7 @@ ${lanes.join(`
|
|
|
63260
63260
|
sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
|
|
63261
63261
|
return combinePaths(newDirPath, sourceFilePath);
|
|
63262
63262
|
}
|
|
63263
|
-
function
|
|
63263
|
+
function writeFile2(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
63264
63264
|
host.writeFile(fileName, text, writeByteOrderMark, (hostErrorMessage) => {
|
|
63265
63265
|
diagnostics.add(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
|
63266
63266
|
}, sourceFiles, data);
|
|
@@ -63272,12 +63272,12 @@ ${lanes.join(`
|
|
|
63272
63272
|
createDirectory(directoryPath);
|
|
63273
63273
|
}
|
|
63274
63274
|
}
|
|
63275
|
-
function writeFileEnsuringDirectories(path5, data, writeByteOrderMark,
|
|
63275
|
+
function writeFileEnsuringDirectories(path5, data, writeByteOrderMark, writeFile22, createDirectory, directoryExists) {
|
|
63276
63276
|
try {
|
|
63277
|
-
|
|
63277
|
+
writeFile22(path5, data, writeByteOrderMark);
|
|
63278
63278
|
} catch {
|
|
63279
63279
|
ensureDirectoriesExist(getDirectoryPath(normalizePath(path5)), createDirectory, directoryExists);
|
|
63280
|
-
|
|
63280
|
+
writeFile22(path5, data, writeByteOrderMark);
|
|
63281
63281
|
}
|
|
63282
63282
|
}
|
|
63283
63283
|
function getLineOfLocalPosition(sourceFile, pos) {
|
|
@@ -82765,7 +82765,7 @@ ${lanes.join(`
|
|
|
82765
82765
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
82766
82766
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
82767
82767
|
}
|
|
82768
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
82768
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile2) {
|
|
82769
82769
|
const options = {};
|
|
82770
82770
|
let watchOptions;
|
|
82771
82771
|
const fileNames = [];
|
|
@@ -82803,7 +82803,7 @@ ${lanes.join(`
|
|
|
82803
82803
|
}
|
|
82804
82804
|
}
|
|
82805
82805
|
function parseResponseFile(fileName) {
|
|
82806
|
-
const text = tryReadFile(fileName,
|
|
82806
|
+
const text = tryReadFile(fileName, readFile2 || ((fileName2) => sys.readFile(fileName2)));
|
|
82807
82807
|
if (!isString(text)) {
|
|
82808
82808
|
errors2.push(text);
|
|
82809
82809
|
return;
|
|
@@ -82906,8 +82906,8 @@ ${lanes.join(`
|
|
|
82906
82906
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
82907
82907
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
82908
82908
|
};
|
|
82909
|
-
function parseCommandLine(commandLine,
|
|
82910
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
82909
|
+
function parseCommandLine(commandLine, readFile2) {
|
|
82910
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile2);
|
|
82911
82911
|
}
|
|
82912
82912
|
function getOptionFromName(optionName, allowShort) {
|
|
82913
82913
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -82975,8 +82975,8 @@ ${lanes.join(`
|
|
|
82975
82975
|
result.originalFileName = result.fileName;
|
|
82976
82976
|
return parseJsonSourceFileConfigFileContent(result, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd), undefined, extraFileExtensions, extendedConfigCache, watchOptionsToExtend);
|
|
82977
82977
|
}
|
|
82978
|
-
function readConfigFile(fileName,
|
|
82979
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
82978
|
+
function readConfigFile(fileName, readFile2) {
|
|
82979
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile2);
|
|
82980
82980
|
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
82981
82981
|
}
|
|
82982
82982
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -82986,14 +82986,14 @@ ${lanes.join(`
|
|
|
82986
82986
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined
|
|
82987
82987
|
};
|
|
82988
82988
|
}
|
|
82989
|
-
function readJsonConfigFile(fileName,
|
|
82990
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
82989
|
+
function readJsonConfigFile(fileName, readFile2) {
|
|
82990
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile2);
|
|
82991
82991
|
return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
82992
82992
|
}
|
|
82993
|
-
function tryReadFile(fileName,
|
|
82993
|
+
function tryReadFile(fileName, readFile2) {
|
|
82994
82994
|
let text;
|
|
82995
82995
|
try {
|
|
82996
|
-
text =
|
|
82996
|
+
text = readFile2(fileName);
|
|
82997
82997
|
} catch (e2) {
|
|
82998
82998
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e2.message);
|
|
82999
82999
|
}
|
|
@@ -145204,7 +145204,7 @@ ${lanes.join(`
|
|
|
145204
145204
|
return;
|
|
145205
145205
|
}
|
|
145206
145206
|
const buildInfo = host.getBuildInfo() || { version };
|
|
145207
|
-
|
|
145207
|
+
writeFile2(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo });
|
|
145208
145208
|
emittedFilesList == null || emittedFilesList.push(buildInfoPath);
|
|
145209
145209
|
}
|
|
145210
145210
|
function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath) {
|
|
@@ -145363,14 +145363,14 @@ ${lanes.join(`
|
|
|
145363
145363
|
}
|
|
145364
145364
|
if (sourceMapFilePath) {
|
|
145365
145365
|
const sourceMap = sourceMapGenerator.toString();
|
|
145366
|
-
|
|
145366
|
+
writeFile2(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
|
|
145367
145367
|
}
|
|
145368
145368
|
} else {
|
|
145369
145369
|
writer.writeLine();
|
|
145370
145370
|
}
|
|
145371
145371
|
const text = writer.getText();
|
|
145372
145372
|
const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
|
|
145373
|
-
|
|
145373
|
+
writeFile2(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
|
145374
145374
|
writer.clear();
|
|
145375
145375
|
return !data.skippedDtsWrite;
|
|
145376
145376
|
}
|
|
@@ -145537,7 +145537,7 @@ ${lanes.join(`
|
|
|
145537
145537
|
printBundle,
|
|
145538
145538
|
writeNode,
|
|
145539
145539
|
writeList,
|
|
145540
|
-
writeFile:
|
|
145540
|
+
writeFile: writeFile22,
|
|
145541
145541
|
writeBundle
|
|
145542
145542
|
};
|
|
145543
145543
|
function printNode(hint, node, sourceFile) {
|
|
@@ -145570,7 +145570,7 @@ ${lanes.join(`
|
|
|
145570
145570
|
return endPrint();
|
|
145571
145571
|
}
|
|
145572
145572
|
function printFile(sourceFile) {
|
|
145573
|
-
|
|
145573
|
+
writeFile22(sourceFile, beginPrint(), undefined);
|
|
145574
145574
|
return endPrint();
|
|
145575
145575
|
}
|
|
145576
145576
|
function writeNode(hint, node, sourceFile, output) {
|
|
@@ -145604,7 +145604,7 @@ ${lanes.join(`
|
|
|
145604
145604
|
reset2();
|
|
145605
145605
|
writer = previousWriter;
|
|
145606
145606
|
}
|
|
145607
|
-
function
|
|
145607
|
+
function writeFile22(sourceFile, output, sourceMapGenerator2) {
|
|
145608
145608
|
isOwnFileEmit = true;
|
|
145609
145609
|
const previousWriter = writer;
|
|
145610
145610
|
setWriter(output, sourceMapGenerator2);
|
|
@@ -149409,7 +149409,7 @@ ${lanes.join(`
|
|
|
149409
149409
|
getDirectories,
|
|
149410
149410
|
readDirectory,
|
|
149411
149411
|
createDirectory: host.createDirectory && createDirectory,
|
|
149412
|
-
writeFile: host.writeFile &&
|
|
149412
|
+
writeFile: host.writeFile && writeFile22,
|
|
149413
149413
|
addOrDeleteFileOrDirectory,
|
|
149414
149414
|
addOrDeleteFile,
|
|
149415
149415
|
clearCache,
|
|
@@ -149468,7 +149468,7 @@ ${lanes.join(`
|
|
|
149468
149468
|
const index = binarySearch(entries, name, identity2, compareStringsCaseSensitive);
|
|
149469
149469
|
return index >= 0;
|
|
149470
149470
|
}
|
|
149471
|
-
function
|
|
149471
|
+
function writeFile22(fileName, data, writeByteOrderMark) {
|
|
149472
149472
|
const path5 = toPath3(fileName);
|
|
149473
149473
|
const result = getCachedFileSystemEntriesForBaseDir(path5);
|
|
149474
149474
|
if (result) {
|
|
@@ -149891,12 +149891,12 @@ ${lanes.join(`
|
|
|
149891
149891
|
function createCompilerHost(options, setParentNodes) {
|
|
149892
149892
|
return createCompilerHostWorker(options, setParentNodes);
|
|
149893
149893
|
}
|
|
149894
|
-
function createGetSourceFile(
|
|
149894
|
+
function createGetSourceFile(readFile2, setParentNodes) {
|
|
149895
149895
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
149896
149896
|
let text;
|
|
149897
149897
|
try {
|
|
149898
149898
|
mark("beforeIORead");
|
|
149899
|
-
text =
|
|
149899
|
+
text = readFile2(fileName);
|
|
149900
149900
|
mark("afterIORead");
|
|
149901
149901
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
149902
149902
|
} catch (e2) {
|
|
@@ -150687,7 +150687,7 @@ ${lanes.join(`
|
|
|
150687
150687
|
getSourceOfProjectReferenceRedirect,
|
|
150688
150688
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
150689
150689
|
});
|
|
150690
|
-
const
|
|
150690
|
+
const readFile2 = host.readFile.bind(host);
|
|
150691
150691
|
(_e = tracing) == null || _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
150692
150692
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
150693
150693
|
(_f = tracing) == null || _f.pop();
|
|
@@ -150864,7 +150864,7 @@ ${lanes.join(`
|
|
|
150864
150864
|
shouldTransformImportCall,
|
|
150865
150865
|
emitBuildInfo,
|
|
150866
150866
|
fileExists,
|
|
150867
|
-
readFile,
|
|
150867
|
+
readFile: readFile2,
|
|
150868
150868
|
directoryExists,
|
|
150869
150869
|
getSymlinkCache,
|
|
150870
150870
|
realpath: (_o = host.realpath) == null ? undefined : _o.bind(host),
|
|
@@ -150872,7 +150872,7 @@ ${lanes.join(`
|
|
|
150872
150872
|
getCanonicalFileName,
|
|
150873
150873
|
getFileIncludeReasons: () => programDiagnostics.getFileReasons(),
|
|
150874
150874
|
structureIsReused,
|
|
150875
|
-
writeFile:
|
|
150875
|
+
writeFile: writeFile22,
|
|
150876
150876
|
getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
|
|
150877
150877
|
};
|
|
150878
150878
|
onProgramCreateComplete();
|
|
@@ -151322,7 +151322,7 @@ ${lanes.join(`
|
|
|
151322
151322
|
getProjectReferenceRedirect,
|
|
151323
151323
|
isSourceOfProjectReferenceRedirect,
|
|
151324
151324
|
getSymlinkCache,
|
|
151325
|
-
writeFile: writeFileCallback ||
|
|
151325
|
+
writeFile: writeFileCallback || writeFile22,
|
|
151326
151326
|
isEmitBlocked,
|
|
151327
151327
|
shouldTransformImportCall,
|
|
151328
151328
|
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
@@ -151352,7 +151352,7 @@ ${lanes.join(`
|
|
|
151352
151352
|
getGlobalTypingsCacheLocation: program.getGlobalTypingsCacheLocation
|
|
151353
151353
|
};
|
|
151354
151354
|
}
|
|
151355
|
-
function
|
|
151355
|
+
function writeFile22(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
151356
151356
|
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
151357
151357
|
}
|
|
151358
151358
|
function emitBuildInfo(writeFileCallback) {
|
|
@@ -153062,10 +153062,10 @@ ${lanes.join(`
|
|
|
153062
153062
|
}
|
|
153063
153063
|
}
|
|
153064
153064
|
var emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true };
|
|
153065
|
-
function handleNoEmitOptions(program, sourceFile,
|
|
153065
|
+
function handleNoEmitOptions(program, sourceFile, writeFile22, cancellationToken) {
|
|
153066
153066
|
const options = program.getCompilerOptions();
|
|
153067
153067
|
if (options.noEmit) {
|
|
153068
|
-
return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(
|
|
153068
|
+
return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile22, cancellationToken);
|
|
153069
153069
|
}
|
|
153070
153070
|
if (!options.noEmitOnError)
|
|
153071
153071
|
return;
|
|
@@ -153082,7 +153082,7 @@ ${lanes.join(`
|
|
|
153082
153082
|
return;
|
|
153083
153083
|
let emittedFiles;
|
|
153084
153084
|
if (!sourceFile) {
|
|
153085
|
-
const emitResult = program.emitBuildInfo(
|
|
153085
|
+
const emitResult = program.emitBuildInfo(writeFile22, cancellationToken);
|
|
153086
153086
|
if (emitResult.diagnostics)
|
|
153087
153087
|
diagnostics = [...diagnostics, ...emitResult.diagnostics];
|
|
153088
153088
|
emittedFiles = emitResult.emittedFiles;
|
|
@@ -153420,9 +153420,9 @@ ${lanes.join(`
|
|
|
153420
153420
|
}
|
|
153421
153421
|
function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
|
|
153422
153422
|
const outputFiles = [];
|
|
153423
|
-
const { emitSkipped, diagnostics } = program.emit(sourceFile,
|
|
153423
|
+
const { emitSkipped, diagnostics } = program.emit(sourceFile, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit);
|
|
153424
153424
|
return { outputFiles, emitSkipped, diagnostics };
|
|
153425
|
-
function
|
|
153425
|
+
function writeFile22(fileName, text, writeByteOrderMark) {
|
|
153426
153426
|
outputFiles.push({ name: fileName, writeByteOrderMark, text });
|
|
153427
153427
|
}
|
|
153428
153428
|
}
|
|
@@ -154618,16 +154618,16 @@ ${lanes.join(`
|
|
|
154618
154618
|
notImplemented();
|
|
154619
154619
|
}
|
|
154620
154620
|
return builderProgram;
|
|
154621
|
-
function emitBuildInfo(
|
|
154621
|
+
function emitBuildInfo(writeFile22, cancellationToken) {
|
|
154622
154622
|
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
154623
154623
|
if (getBuildInfoEmitPending(state)) {
|
|
154624
|
-
const result = state.program.emitBuildInfo(
|
|
154624
|
+
const result = state.program.emitBuildInfo(writeFile22 || maybeBind(host, host.writeFile), cancellationToken);
|
|
154625
154625
|
state.buildInfoEmitPending = false;
|
|
154626
154626
|
return result;
|
|
154627
154627
|
}
|
|
154628
154628
|
return emitSkippedWithNoDiagnostics;
|
|
154629
154629
|
}
|
|
154630
|
-
function emitNextAffectedFileOrDtsErrors(
|
|
154630
|
+
function emitNextAffectedFileOrDtsErrors(writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers, isForDtsErrors) {
|
|
154631
154631
|
var _a, _b, _c, _d;
|
|
154632
154632
|
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
154633
154633
|
let affected = getNextAffectedFile(state, cancellationToken, host);
|
|
@@ -154671,7 +154671,7 @@ ${lanes.join(`
|
|
|
154671
154671
|
if (isForDtsErrors || !getBuildInfoEmitPending(state))
|
|
154672
154672
|
return;
|
|
154673
154673
|
const affected2 = state.program;
|
|
154674
|
-
const result2 = affected2.emitBuildInfo(
|
|
154674
|
+
const result2 = affected2.emitBuildInfo(writeFile22 || maybeBind(host, host.writeFile), cancellationToken);
|
|
154675
154675
|
state.buildInfoEmitPending = false;
|
|
154676
154676
|
return { result: result2, affected: affected2 };
|
|
154677
154677
|
}
|
|
@@ -154681,7 +154681,7 @@ ${lanes.join(`
|
|
|
154681
154681
|
emitOnly = 0;
|
|
154682
154682
|
if (emitKind & 56)
|
|
154683
154683
|
emitOnly = emitOnly === undefined ? 1 : undefined;
|
|
154684
|
-
const result = !isForDtsErrors ? state.program.emit(affected === state.program ? undefined : affected, getWriteFileCallback(
|
|
154684
|
+
const result = !isForDtsErrors ? state.program.emit(affected === state.program ? undefined : affected, getWriteFileCallback(writeFile22, customTransformers), cancellationToken, emitOnly, customTransformers, undefined, true) : {
|
|
154685
154685
|
emitSkipped: true,
|
|
154686
154686
|
diagnostics: state.program.getDeclarationDiagnostics(affected === state.program ? undefined : affected, cancellationToken)
|
|
154687
154687
|
};
|
|
@@ -154723,13 +154723,13 @@ ${lanes.join(`
|
|
|
154723
154723
|
if (emitDiagnosticsPerFile)
|
|
154724
154724
|
state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
|
|
154725
154725
|
}
|
|
154726
|
-
function emitNextAffectedFile(
|
|
154727
|
-
return emitNextAffectedFileOrDtsErrors(
|
|
154726
|
+
function emitNextAffectedFile(writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
154727
|
+
return emitNextAffectedFileOrDtsErrors(writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers, false);
|
|
154728
154728
|
}
|
|
154729
|
-
function getWriteFileCallback(
|
|
154729
|
+
function getWriteFileCallback(writeFile22, customTransformers) {
|
|
154730
154730
|
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
154731
154731
|
if (!getEmitDeclarations(state.compilerOptions))
|
|
154732
|
-
return
|
|
154732
|
+
return writeFile22 || maybeBind(host, host.writeFile);
|
|
154733
154733
|
return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
154734
154734
|
var _a, _b, _c;
|
|
154735
154735
|
if (isDeclarationFileName(fileName)) {
|
|
@@ -154771,8 +154771,8 @@ ${lanes.join(`
|
|
|
154771
154771
|
state.outSignature = newSignature;
|
|
154772
154772
|
}
|
|
154773
154773
|
}
|
|
154774
|
-
if (
|
|
154775
|
-
|
|
154774
|
+
if (writeFile22)
|
|
154775
|
+
writeFile22(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
154776
154776
|
else if (host.writeFile)
|
|
154777
154777
|
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
154778
154778
|
else
|
|
@@ -154795,12 +154795,12 @@ ${lanes.join(`
|
|
|
154795
154795
|
}
|
|
154796
154796
|
};
|
|
154797
154797
|
}
|
|
154798
|
-
function emit(targetSourceFile,
|
|
154798
|
+
function emit(targetSourceFile, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
154799
154799
|
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
154800
154800
|
if (kind === 1) {
|
|
154801
154801
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
154802
154802
|
}
|
|
154803
|
-
const result = handleNoEmitOptions(builderProgram, targetSourceFile,
|
|
154803
|
+
const result = handleNoEmitOptions(builderProgram, targetSourceFile, writeFile22, cancellationToken);
|
|
154804
154804
|
if (result)
|
|
154805
154805
|
return result;
|
|
154806
154806
|
if (!targetSourceFile) {
|
|
@@ -154810,7 +154810,7 @@ ${lanes.join(`
|
|
|
154810
154810
|
let diagnostics;
|
|
154811
154811
|
let emittedFiles = [];
|
|
154812
154812
|
let affectedEmitResult;
|
|
154813
|
-
while (affectedEmitResult = emitNextAffectedFile(
|
|
154813
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
154814
154814
|
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
154815
154815
|
diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
154816
154816
|
emittedFiles = addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
@@ -154826,7 +154826,7 @@ ${lanes.join(`
|
|
|
154826
154826
|
clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, false);
|
|
154827
154827
|
}
|
|
154828
154828
|
}
|
|
154829
|
-
const emitResult = state.program.emit(targetSourceFile, getWriteFileCallback(
|
|
154829
|
+
const emitResult = state.program.emit(targetSourceFile, getWriteFileCallback(writeFile22, customTransformers), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
154830
154830
|
handleNonEmitBuilderWithEmitOrDtsErrors(targetSourceFile, emitOnlyDtsFiles, false, emitResult.diagnostics);
|
|
154831
154831
|
return emitResult;
|
|
154832
154832
|
}
|
|
@@ -155105,8 +155105,8 @@ ${lanes.join(`
|
|
|
155105
155105
|
getSyntacticDiagnostics: (sourceFile, cancellationToken) => getProgram().getSyntacticDiagnostics(sourceFile, cancellationToken),
|
|
155106
155106
|
getDeclarationDiagnostics: (sourceFile, cancellationToken) => getProgram().getDeclarationDiagnostics(sourceFile, cancellationToken),
|
|
155107
155107
|
getSemanticDiagnostics: (sourceFile, cancellationToken) => getProgram().getSemanticDiagnostics(sourceFile, cancellationToken),
|
|
155108
|
-
emit: (sourceFile,
|
|
155109
|
-
emitBuildInfo: (
|
|
155108
|
+
emit: (sourceFile, writeFile22, cancellationToken, emitOnlyDts, customTransformers) => getProgram().emit(sourceFile, writeFile22, cancellationToken, emitOnlyDts, customTransformers),
|
|
155109
|
+
emitBuildInfo: (writeFile22, cancellationToken) => getProgram().emitBuildInfo(writeFile22, cancellationToken),
|
|
155110
155110
|
getAllDependencies: notImplemented,
|
|
155111
155111
|
getCurrentDirectory: () => getProgram().getCurrentDirectory(),
|
|
155112
155112
|
close: noop3
|
|
@@ -156366,7 +156366,7 @@ ${lanes.join(`
|
|
|
156366
156366
|
const fileName = isString(file) ? file : file.fileName;
|
|
156367
156367
|
return fileNameConvertor ? fileNameConvertor(fileName) : fileName;
|
|
156368
156368
|
}
|
|
156369
|
-
function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary,
|
|
156369
|
+
function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
156370
156370
|
const options = program.getCompilerOptions();
|
|
156371
156371
|
const allDiagnostics = program.getConfigFileParsingDiagnostics().slice();
|
|
156372
156372
|
const configFileParsingDiagnosticsLength = allDiagnostics.length;
|
|
@@ -156383,7 +156383,7 @@ ${lanes.join(`
|
|
|
156383
156383
|
}
|
|
156384
156384
|
}
|
|
156385
156385
|
}
|
|
156386
|
-
const emitResult = options.listFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(undefined,
|
|
156386
|
+
const emitResult = options.listFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(undefined, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
156387
156387
|
addRange(allDiagnostics, emitResult.diagnostics);
|
|
156388
156388
|
const diagnostics = sortAndDeduplicateDiagnostics(allDiagnostics);
|
|
156389
156389
|
diagnostics.forEach(reportDiagnostic);
|
|
@@ -156403,8 +156403,8 @@ ${lanes.join(`
|
|
|
156403
156403
|
diagnostics
|
|
156404
156404
|
};
|
|
156405
156405
|
}
|
|
156406
|
-
function emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, write, reportSummary,
|
|
156407
|
-
const { emitResult, diagnostics } = emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary,
|
|
156406
|
+
function emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, write, reportSummary, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
156407
|
+
const { emitResult, diagnostics } = emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
156408
156408
|
if (emitResult.emitSkipped && diagnostics.length > 0) {
|
|
156409
156409
|
return 1;
|
|
156410
156410
|
} else if (diagnostics.length > 0) {
|
|
@@ -157679,20 +157679,20 @@ ${lanes.join(`
|
|
|
157679
157679
|
getAllDependencies: (sourceFile) => withProgramOrEmptyArray((program2) => program2.getAllDependencies(sourceFile)),
|
|
157680
157680
|
getSemanticDiagnostics: (sourceFile, cancellationToken) => withProgramOrEmptyArray((program2) => program2.getSemanticDiagnostics(sourceFile, cancellationToken)),
|
|
157681
157681
|
getSemanticDiagnosticsOfNextAffectedFile: (cancellationToken, ignoreSourceFile) => withProgramOrUndefined((program2) => program2.getSemanticDiagnosticsOfNextAffectedFile && program2.getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile)),
|
|
157682
|
-
emit: (targetSourceFile,
|
|
157682
|
+
emit: (targetSourceFile, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers) => {
|
|
157683
157683
|
if (targetSourceFile || emitOnlyDtsFiles) {
|
|
157684
157684
|
return withProgramOrUndefined((program2) => {
|
|
157685
157685
|
var _a, _b;
|
|
157686
|
-
return program2.emit(targetSourceFile,
|
|
157686
|
+
return program2.emit(targetSourceFile, writeFile22, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? undefined : _b.call(_a, project)));
|
|
157687
157687
|
});
|
|
157688
157688
|
}
|
|
157689
157689
|
executeSteps(0, cancellationToken);
|
|
157690
|
-
return emit(
|
|
157690
|
+
return emit(writeFile22, cancellationToken, customTransformers);
|
|
157691
157691
|
},
|
|
157692
157692
|
done
|
|
157693
157693
|
};
|
|
157694
|
-
function done(cancellationToken,
|
|
157695
|
-
executeSteps(3, cancellationToken,
|
|
157694
|
+
function done(cancellationToken, writeFile22, customTransformers) {
|
|
157695
|
+
executeSteps(3, cancellationToken, writeFile22, customTransformers);
|
|
157696
157696
|
mark("SolutionBuilder::Projects built");
|
|
157697
157697
|
return doneInvalidatedProject(state, projectPath);
|
|
157698
157698
|
}
|
|
@@ -157792,7 +157792,7 @@ ${lanes.join(`
|
|
|
157792
157792
|
step = 2;
|
|
157793
157793
|
return emitResult;
|
|
157794
157794
|
}
|
|
157795
|
-
function executeSteps(till, cancellationToken,
|
|
157795
|
+
function executeSteps(till, cancellationToken, writeFile22, customTransformers) {
|
|
157796
157796
|
while (step <= till && step < 3) {
|
|
157797
157797
|
const currentStep = step;
|
|
157798
157798
|
switch (step) {
|
|
@@ -157800,7 +157800,7 @@ ${lanes.join(`
|
|
|
157800
157800
|
createProgram2();
|
|
157801
157801
|
break;
|
|
157802
157802
|
case 1:
|
|
157803
|
-
emit(
|
|
157803
|
+
emit(writeFile22, cancellationToken, customTransformers);
|
|
157804
157804
|
break;
|
|
157805
157805
|
case 2:
|
|
157806
157806
|
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
|
|
@@ -158355,14 +158355,14 @@ ${lanes.join(`
|
|
|
158355
158355
|
}
|
|
158356
158356
|
}
|
|
158357
158357
|
}
|
|
158358
|
-
function build(state, project, cancellationToken,
|
|
158358
|
+
function build(state, project, cancellationToken, writeFile22, getCustomTransformers, onlyReferences) {
|
|
158359
158359
|
mark("SolutionBuilder::beforeBuild");
|
|
158360
|
-
const result = buildWorker(state, project, cancellationToken,
|
|
158360
|
+
const result = buildWorker(state, project, cancellationToken, writeFile22, getCustomTransformers, onlyReferences);
|
|
158361
158361
|
mark("SolutionBuilder::afterBuild");
|
|
158362
158362
|
measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
|
|
158363
158363
|
return result;
|
|
158364
158364
|
}
|
|
158365
|
-
function buildWorker(state, project, cancellationToken,
|
|
158365
|
+
function buildWorker(state, project, cancellationToken, writeFile22, getCustomTransformers, onlyReferences) {
|
|
158366
158366
|
const buildOrder = getBuildOrderFor(state, project, onlyReferences);
|
|
158367
158367
|
if (!buildOrder)
|
|
158368
158368
|
return 3;
|
|
@@ -158374,7 +158374,7 @@ ${lanes.join(`
|
|
|
158374
158374
|
if (!invalidatedProject)
|
|
158375
158375
|
break;
|
|
158376
158376
|
reportQueue = false;
|
|
158377
|
-
invalidatedProject.done(cancellationToken,
|
|
158377
|
+
invalidatedProject.done(cancellationToken, writeFile22, getCustomTransformers == null ? undefined : getCustomTransformers(invalidatedProject.project));
|
|
158378
158378
|
if (!state.diagnostics.has(invalidatedProject.projectPath))
|
|
158379
158379
|
successfulProjects++;
|
|
158380
158380
|
}
|
|
@@ -158575,9 +158575,9 @@ ${lanes.join(`
|
|
|
158575
158575
|
function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions) {
|
|
158576
158576
|
const state = createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions);
|
|
158577
158577
|
return {
|
|
158578
|
-
build: (project, cancellationToken,
|
|
158578
|
+
build: (project, cancellationToken, writeFile22, getCustomTransformers) => build(state, project, cancellationToken, writeFile22, getCustomTransformers),
|
|
158579
158579
|
clean: (project) => clean(state, project),
|
|
158580
|
-
buildReferences: (project, cancellationToken,
|
|
158580
|
+
buildReferences: (project, cancellationToken, writeFile22, getCustomTransformers) => build(state, project, cancellationToken, writeFile22, getCustomTransformers, true),
|
|
158581
158581
|
cleanReferences: (project) => clean(state, project, true),
|
|
158582
158582
|
getNextInvalidatedProject: (cancellationToken) => {
|
|
158583
158583
|
setupInitialBuild(state, cancellationToken);
|
|
@@ -201244,7 +201244,7 @@ ${options.prefix}` : `
|
|
|
201244
201244
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
201245
201245
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
201246
201246
|
writeCommentRange: () => writeCommentRange,
|
|
201247
|
-
writeFile: () =>
|
|
201247
|
+
writeFile: () => writeFile2,
|
|
201248
201248
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
201249
201249
|
zipWith: () => zipWith
|
|
201250
201250
|
});
|
|
@@ -203072,7 +203072,7 @@ ${options.prefix}` : `
|
|
|
203072
203072
|
this.builderState = BuilderState.create(this.program, this.builderState, true);
|
|
203073
203073
|
return mapDefined(BuilderState.getFilesAffectedBy(this.builderState, this.program, scriptInfo.path, this.cancellationToken, this.projectService.host), (sourceFile) => this.shouldEmitFile(this.projectService.getScriptInfoForPath(sourceFile.path)) ? sourceFile.fileName : undefined);
|
|
203074
203074
|
}
|
|
203075
|
-
emitFile(scriptInfo,
|
|
203075
|
+
emitFile(scriptInfo, writeFile22) {
|
|
203076
203076
|
if (!this.languageServiceEnabled || !this.shouldEmitFile(scriptInfo)) {
|
|
203077
203077
|
return { emitSkipped: true, diagnostics: emptyArray2 };
|
|
203078
203078
|
}
|
|
@@ -203080,7 +203080,7 @@ ${options.prefix}` : `
|
|
|
203080
203080
|
if (!emitSkipped) {
|
|
203081
203081
|
for (const outputFile of outputFiles) {
|
|
203082
203082
|
const outputFileAbsoluteFileName = getNormalizedAbsolutePath(outputFile.name, this.currentDirectory);
|
|
203083
|
-
|
|
203083
|
+
writeFile22(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark);
|
|
203084
203084
|
}
|
|
203085
203085
|
if (this.builderState && getEmitDeclarations(this.compilerOptions)) {
|
|
203086
203086
|
const dtsFiles = outputFiles.filter((f3) => isDeclarationFileName(f3.name));
|
|
@@ -225973,12 +225973,91 @@ class StdioServerTransport {
|
|
|
225973
225973
|
}
|
|
225974
225974
|
}
|
|
225975
225975
|
|
|
225976
|
+
// ../shared/dist/utils/config.js
|
|
225977
|
+
import { homedir } from "os";
|
|
225978
|
+
import { join } from "path";
|
|
225979
|
+
import { existsSync } from "fs";
|
|
225980
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
225981
|
+
var CONFIG_DIR = join(homedir(), ".enact");
|
|
225982
|
+
var CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
225983
|
+
var TRUSTED_KEYS_DIR = join(CONFIG_DIR, "trusted-keys");
|
|
225984
|
+
async function ensureConfig() {
|
|
225985
|
+
if (!existsSync(CONFIG_DIR)) {
|
|
225986
|
+
await mkdir(CONFIG_DIR, { recursive: true });
|
|
225987
|
+
}
|
|
225988
|
+
if (!existsSync(CONFIG_FILE)) {
|
|
225989
|
+
const defaultConfig = {
|
|
225990
|
+
history: [],
|
|
225991
|
+
urls: {
|
|
225992
|
+
frontend: DEFAULT_FRONTEND_URL,
|
|
225993
|
+
api: DEFAULT_API_URL
|
|
225994
|
+
}
|
|
225995
|
+
};
|
|
225996
|
+
await writeFile(CONFIG_FILE, JSON.stringify(defaultConfig, null, 2));
|
|
225997
|
+
}
|
|
225998
|
+
}
|
|
225999
|
+
async function readConfig() {
|
|
226000
|
+
await ensureConfig();
|
|
226001
|
+
try {
|
|
226002
|
+
const data = await readFile(CONFIG_FILE, "utf8");
|
|
226003
|
+
const config = JSON.parse(data);
|
|
226004
|
+
if (!config.urls) {
|
|
226005
|
+
config.urls = {
|
|
226006
|
+
frontend: DEFAULT_FRONTEND_URL,
|
|
226007
|
+
api: DEFAULT_API_URL
|
|
226008
|
+
};
|
|
226009
|
+
await writeConfig(config);
|
|
226010
|
+
}
|
|
226011
|
+
return config;
|
|
226012
|
+
} catch (error) {
|
|
226013
|
+
console.error("Failed to read config:", error.message);
|
|
226014
|
+
return {
|
|
226015
|
+
history: [],
|
|
226016
|
+
urls: {
|
|
226017
|
+
frontend: DEFAULT_FRONTEND_URL,
|
|
226018
|
+
api: DEFAULT_API_URL
|
|
226019
|
+
}
|
|
226020
|
+
};
|
|
226021
|
+
}
|
|
226022
|
+
}
|
|
226023
|
+
async function writeConfig(config) {
|
|
226024
|
+
await ensureConfig();
|
|
226025
|
+
await writeFile(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
226026
|
+
}
|
|
226027
|
+
var DEFAULT_FRONTEND_URL = "https://enact.tools";
|
|
226028
|
+
var DEFAULT_API_URL = "https://xjnhhxwxovjifdxdwzih.supabase.co";
|
|
226029
|
+
async function getFrontendUrl() {
|
|
226030
|
+
if (process.env.ENACT_FRONTEND_URL) {
|
|
226031
|
+
return process.env.ENACT_FRONTEND_URL;
|
|
226032
|
+
}
|
|
226033
|
+
const config = await readConfig();
|
|
226034
|
+
if (config.urls?.frontend) {
|
|
226035
|
+
return config.urls.frontend;
|
|
226036
|
+
}
|
|
226037
|
+
return DEFAULT_FRONTEND_URL;
|
|
226038
|
+
}
|
|
226039
|
+
async function getApiUrl() {
|
|
226040
|
+
if (process.env.ENACT_API_URL) {
|
|
226041
|
+
return process.env.ENACT_API_URL;
|
|
226042
|
+
}
|
|
226043
|
+
const config = await readConfig();
|
|
226044
|
+
if (config.urls?.api) {
|
|
226045
|
+
return config.urls.api;
|
|
226046
|
+
}
|
|
226047
|
+
return DEFAULT_API_URL;
|
|
226048
|
+
}
|
|
226049
|
+
|
|
225976
226050
|
// ../shared/dist/api/enact-api.js
|
|
225977
226051
|
class EnactApiClient {
|
|
225978
|
-
constructor(baseUrl
|
|
226052
|
+
constructor(baseUrl, supabaseUrl) {
|
|
225979
226053
|
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
225980
226054
|
this.supabaseUrl = supabaseUrl.replace(/\/$/, "");
|
|
225981
226055
|
}
|
|
226056
|
+
static async create(baseUrl, supabaseUrl) {
|
|
226057
|
+
const frontendUrl = baseUrl || await getFrontendUrl();
|
|
226058
|
+
const apiUrl = supabaseUrl || await getApiUrl();
|
|
226059
|
+
return new EnactApiClient(frontendUrl, apiUrl);
|
|
226060
|
+
}
|
|
225982
226061
|
async makeRequest(endpoint, options = {}, token, tokenType = "jwt") {
|
|
225983
226062
|
const url = endpoint.startsWith("http") ? endpoint : `${this.supabaseUrl}${endpoint}`;
|
|
225984
226063
|
const headers = {
|
|
@@ -226260,7 +226339,7 @@ class EnactApiClient {
|
|
|
226260
226339
|
};
|
|
226261
226340
|
}
|
|
226262
226341
|
}
|
|
226263
|
-
var enactApi = new EnactApiClient;
|
|
226342
|
+
var enactApi = new EnactApiClient("https://enact.tools", "https://xjnhhxwxovjifdxdwzih.supabase.co");
|
|
226264
226343
|
|
|
226265
226344
|
class EnactApiError extends Error {
|
|
226266
226345
|
constructor(message, statusCode, endpoint) {
|
|
@@ -227370,11 +227449,11 @@ import * as crypto2 from "crypto";
|
|
|
227370
227449
|
import path from "node:path";
|
|
227371
227450
|
import os from "node:os";
|
|
227372
227451
|
import process3 from "node:process";
|
|
227373
|
-
var
|
|
227452
|
+
var homedir2 = os.homedir();
|
|
227374
227453
|
var tmpdir = os.tmpdir();
|
|
227375
227454
|
var { env } = process3;
|
|
227376
227455
|
var macos = (name) => {
|
|
227377
|
-
const library = path.join(
|
|
227456
|
+
const library = path.join(homedir2, "Library");
|
|
227378
227457
|
return {
|
|
227379
227458
|
data: path.join(library, "Application Support", name),
|
|
227380
227459
|
config: path.join(library, "Preferences", name),
|
|
@@ -227384,8 +227463,8 @@ var macos = (name) => {
|
|
|
227384
227463
|
};
|
|
227385
227464
|
};
|
|
227386
227465
|
var windows = (name) => {
|
|
227387
|
-
const appData = env.APPDATA || path.join(
|
|
227388
|
-
const localAppData = env.LOCALAPPDATA || path.join(
|
|
227466
|
+
const appData = env.APPDATA || path.join(homedir2, "AppData", "Roaming");
|
|
227467
|
+
const localAppData = env.LOCALAPPDATA || path.join(homedir2, "AppData", "Local");
|
|
227389
227468
|
return {
|
|
227390
227469
|
data: path.join(localAppData, name, "Data"),
|
|
227391
227470
|
config: path.join(appData, name, "Config"),
|
|
@@ -227395,12 +227474,12 @@ var windows = (name) => {
|
|
|
227395
227474
|
};
|
|
227396
227475
|
};
|
|
227397
227476
|
var linux = (name) => {
|
|
227398
|
-
const username = path.basename(
|
|
227477
|
+
const username = path.basename(homedir2);
|
|
227399
227478
|
return {
|
|
227400
|
-
data: path.join(env.XDG_DATA_HOME || path.join(
|
|
227401
|
-
config: path.join(env.XDG_CONFIG_HOME || path.join(
|
|
227402
|
-
cache: path.join(env.XDG_CACHE_HOME || path.join(
|
|
227403
|
-
log: path.join(env.XDG_STATE_HOME || path.join(
|
|
227479
|
+
data: path.join(env.XDG_DATA_HOME || path.join(homedir2, ".local", "share"), name),
|
|
227480
|
+
config: path.join(env.XDG_CONFIG_HOME || path.join(homedir2, ".config"), name),
|
|
227481
|
+
cache: path.join(env.XDG_CACHE_HOME || path.join(homedir2, ".cache"), name),
|
|
227482
|
+
log: path.join(env.XDG_STATE_HOME || path.join(homedir2, ".local", "state"), name),
|
|
227404
227483
|
temp: path.join(tmpdir, username, name)
|
|
227405
227484
|
};
|
|
227406
227485
|
};
|
|
@@ -235462,6 +235541,49 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
235462
235541
|
});
|
|
235463
235542
|
});
|
|
235464
235543
|
}
|
|
235544
|
+
async setupDirectoryMount(client, container, mountSpec) {
|
|
235545
|
+
try {
|
|
235546
|
+
let localPath2;
|
|
235547
|
+
let containerPath;
|
|
235548
|
+
const colonIndex = mountSpec.indexOf(":");
|
|
235549
|
+
if (colonIndex > 0) {
|
|
235550
|
+
const potentialDriveLetter = mountSpec.substring(0, colonIndex);
|
|
235551
|
+
const isWindowsDrive = potentialDriveLetter.length === 1 && /[A-Za-z]/.test(potentialDriveLetter);
|
|
235552
|
+
if (isWindowsDrive) {
|
|
235553
|
+
const nextColonIndex = mountSpec.indexOf(":", colonIndex + 1);
|
|
235554
|
+
if (nextColonIndex > 0) {
|
|
235555
|
+
localPath2 = mountSpec.substring(0, nextColonIndex);
|
|
235556
|
+
containerPath = mountSpec.substring(nextColonIndex + 1);
|
|
235557
|
+
} else {
|
|
235558
|
+
localPath2 = mountSpec;
|
|
235559
|
+
containerPath = "/workspace/src";
|
|
235560
|
+
}
|
|
235561
|
+
} else {
|
|
235562
|
+
localPath2 = mountSpec.substring(0, colonIndex);
|
|
235563
|
+
containerPath = mountSpec.substring(colonIndex + 1);
|
|
235564
|
+
}
|
|
235565
|
+
} else if (colonIndex === 0) {
|
|
235566
|
+
localPath2 = "";
|
|
235567
|
+
containerPath = mountSpec.substring(1);
|
|
235568
|
+
} else {
|
|
235569
|
+
localPath2 = mountSpec;
|
|
235570
|
+
containerPath = "/workspace/src";
|
|
235571
|
+
}
|
|
235572
|
+
const path7 = __require("path");
|
|
235573
|
+
const resolvedLocalPath = path7.resolve(localPath2);
|
|
235574
|
+
const fs4 = __require("fs");
|
|
235575
|
+
if (!fs4.existsSync(resolvedLocalPath)) {
|
|
235576
|
+
throw new Error(`Mount source directory does not exist: ${resolvedLocalPath}`);
|
|
235577
|
+
}
|
|
235578
|
+
const hostDirectory = client.host().directory(resolvedLocalPath);
|
|
235579
|
+
container = container.withMountedDirectory(containerPath, hostDirectory);
|
|
235580
|
+
logger_default.debug(`\uD83D\uDCC2 Mounted ${resolvedLocalPath} -> ${containerPath}`);
|
|
235581
|
+
return container;
|
|
235582
|
+
} catch (error) {
|
|
235583
|
+
logger_default.error(`Failed to setup directory mount: ${error}`);
|
|
235584
|
+
throw error;
|
|
235585
|
+
}
|
|
235586
|
+
}
|
|
235465
235587
|
async setupContainer(client, environment, inputs, tool) {
|
|
235466
235588
|
const containerImage = tool?.from || this.options.baseImage;
|
|
235467
235589
|
logger_default.debug(`\uD83D\uDE80 Setting up container with image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`);
|
|
@@ -235469,6 +235591,9 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
235469
235591
|
logger_default.debug("\uD83D\uDCE6 Base container created");
|
|
235470
235592
|
container = container.withWorkdir(this.options.workdir);
|
|
235471
235593
|
logger_default.debug(`\uD83D\uDCC1 Working directory set to: ${this.options.workdir}`);
|
|
235594
|
+
if (environment.mount) {
|
|
235595
|
+
container = await this.setupDirectoryMount(client, container, environment.mount);
|
|
235596
|
+
}
|
|
235472
235597
|
for (const [key, value] of Object.entries(environment.vars)) {
|
|
235473
235598
|
container = container.withEnvVariable(key, String(value));
|
|
235474
235599
|
}
|
|
@@ -235793,37 +235918,6 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
235793
235918
|
process.exit(1);
|
|
235794
235919
|
}
|
|
235795
235920
|
}
|
|
235796
|
-
forceCleanup() {
|
|
235797
|
-
if (this.isShuttingDown)
|
|
235798
|
-
return;
|
|
235799
|
-
try {
|
|
235800
|
-
logger_default.info("\uD83D\uDD04 Force cleaning up Dagger engines...");
|
|
235801
|
-
const result = spawnSync("docker", [
|
|
235802
|
-
"ps",
|
|
235803
|
-
"--all",
|
|
235804
|
-
"--filter",
|
|
235805
|
-
"name=dagger-engine",
|
|
235806
|
-
"--format",
|
|
235807
|
-
"{{.Names}}"
|
|
235808
|
-
], {
|
|
235809
|
-
encoding: "utf8",
|
|
235810
|
-
timeout: 5000
|
|
235811
|
-
});
|
|
235812
|
-
if (result.stdout) {
|
|
235813
|
-
const names = result.stdout.trim().split(`
|
|
235814
|
-
`).filter((n) => n.trim());
|
|
235815
|
-
if (names.length > 0) {
|
|
235816
|
-
logger_default.info(`Found ${names.length} engine containers, force removing...`);
|
|
235817
|
-
for (const name of names) {
|
|
235818
|
-
spawnSync("docker", ["rm", "-f", name.trim()], { timeout: 3000 });
|
|
235819
|
-
}
|
|
235820
|
-
logger_default.info("✅ Force cleanup completed");
|
|
235821
|
-
}
|
|
235822
|
-
}
|
|
235823
|
-
} catch (error) {
|
|
235824
|
-
logger_default.debug("Force cleanup failed (this is usually fine):", error);
|
|
235825
|
-
}
|
|
235826
|
-
}
|
|
235827
235921
|
getEngineStatus() {
|
|
235828
235922
|
return {
|
|
235829
235923
|
health: { ...this.engineHealth },
|
|
@@ -235842,11 +235936,11 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
235842
235936
|
|
|
235843
235937
|
// ../shared/dist/utils/env-loader.js
|
|
235844
235938
|
var import_dotenv = __toESM(require_main(), 1);
|
|
235845
|
-
import { join as
|
|
235846
|
-
import { homedir as
|
|
235847
|
-
import { existsSync as
|
|
235848
|
-
import { readFile } from "fs/promises";
|
|
235849
|
-
var
|
|
235939
|
+
import { join as join3 } from "path";
|
|
235940
|
+
import { homedir as homedir3 } from "os";
|
|
235941
|
+
import { existsSync as existsSync3 } from "fs";
|
|
235942
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
235943
|
+
var CONFIG_DIR2 = join3(homedir3(), ".enact");
|
|
235850
235944
|
function extractPackageNamespace(toolName) {
|
|
235851
235945
|
const parts = toolName.split("/");
|
|
235852
235946
|
if (parts.length < 2) {
|
|
@@ -235858,7 +235952,7 @@ function extractPackageNamespace(toolName) {
|
|
|
235858
235952
|
return parts[0];
|
|
235859
235953
|
}
|
|
235860
235954
|
function getPackageEnvPath(packageNamespace) {
|
|
235861
|
-
return
|
|
235955
|
+
return join3(CONFIG_DIR2, "env", packageNamespace, ".env");
|
|
235862
235956
|
}
|
|
235863
235957
|
function decryptValue(encryptedValue) {
|
|
235864
235958
|
try {
|
|
@@ -235869,11 +235963,11 @@ function decryptValue(encryptedValue) {
|
|
|
235869
235963
|
}
|
|
235870
235964
|
async function readPackageEnvConfig(packageNamespace) {
|
|
235871
235965
|
const envFile = getPackageEnvPath(packageNamespace);
|
|
235872
|
-
if (!
|
|
235966
|
+
if (!existsSync3(envFile)) {
|
|
235873
235967
|
return { variables: {} };
|
|
235874
235968
|
}
|
|
235875
235969
|
try {
|
|
235876
|
-
const data = await
|
|
235970
|
+
const data = await readFile2(envFile, "utf8");
|
|
235877
235971
|
if (data.trim().startsWith("{")) {
|
|
235878
235972
|
return JSON.parse(data);
|
|
235879
235973
|
} else {
|
|
@@ -235902,7 +235996,7 @@ function loadPackageEnvFile(toolName) {
|
|
|
235902
235996
|
try {
|
|
235903
235997
|
const packageNamespace = extractPackageNamespace(toolName);
|
|
235904
235998
|
const packageEnvPath = getPackageEnvPath(packageNamespace);
|
|
235905
|
-
if (!
|
|
235999
|
+
if (!existsSync3(packageEnvPath)) {
|
|
235906
236000
|
return {};
|
|
235907
236001
|
}
|
|
235908
236002
|
const result = import_dotenv.config({ path: packageEnvPath });
|
|
@@ -238730,6 +238824,15 @@ class EnactCore {
|
|
|
238730
238824
|
this.apiClient = new EnactApiClient(this.options.apiUrl, this.options.supabaseUrl);
|
|
238731
238825
|
this.executionProvider = this.createExecutionProvider();
|
|
238732
238826
|
}
|
|
238827
|
+
static async create(options = {}) {
|
|
238828
|
+
const frontendUrl = options.apiUrl || await getFrontendUrl();
|
|
238829
|
+
const apiUrl = options.supabaseUrl || await getApiUrl();
|
|
238830
|
+
return new EnactCore({
|
|
238831
|
+
...options,
|
|
238832
|
+
apiUrl: frontendUrl,
|
|
238833
|
+
supabaseUrl: apiUrl
|
|
238834
|
+
});
|
|
238835
|
+
}
|
|
238733
238836
|
setAuthToken(token) {
|
|
238734
238837
|
this.options.authToken = token;
|
|
238735
238838
|
}
|
|
@@ -238938,7 +239041,6 @@ class EnactCore {
|
|
|
238938
239041
|
const messageHash = CryptoUtils.hash(docString);
|
|
238939
239042
|
const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
|
|
238940
239043
|
const isValid2 = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command"] });
|
|
238941
|
-
console.log("Final verification result:", isValid2);
|
|
238942
239044
|
if (!isValid2) {
|
|
238943
239045
|
throw new Error(`Tool ${tool.name} has invalid signatures`);
|
|
238944
239046
|
}
|
|
@@ -238968,7 +239070,8 @@ class EnactCore {
|
|
|
238968
239070
|
vars: { ...envVars, ...validatedInputs },
|
|
238969
239071
|
resources: {
|
|
238970
239072
|
timeout: options.timeout || tool.timeout || this.options.defaultTimeout
|
|
238971
|
-
}
|
|
239073
|
+
},
|
|
239074
|
+
mount: options.mount
|
|
238972
239075
|
});
|
|
238973
239076
|
} catch (error) {
|
|
238974
239077
|
return {
|
|
@@ -239124,13 +239227,296 @@ class EnactCore {
|
|
|
239124
239227
|
return `exec_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
239125
239228
|
}
|
|
239126
239229
|
}
|
|
239127
|
-
// ../shared/dist/
|
|
239128
|
-
|
|
239129
|
-
import {
|
|
239130
|
-
|
|
239131
|
-
|
|
239230
|
+
// ../shared/dist/LocalToolResolver.js
|
|
239231
|
+
var yaml2 = __toESM(require_dist3(), 1);
|
|
239232
|
+
import { promises as fs5, readFileSync as readFileSync3, writeFileSync } from "fs";
|
|
239233
|
+
import { join as join4, resolve, basename as basename2 } from "path";
|
|
239234
|
+
class LocalToolResolver {
|
|
239235
|
+
constructor(enactCore, localToolsDir = "./tools", cacheDir = "./.tool-cache") {
|
|
239236
|
+
this.enactCore = enactCore;
|
|
239237
|
+
this.toolCache = new Map;
|
|
239238
|
+
this.aliases = new Map;
|
|
239239
|
+
this.favorites = new Set;
|
|
239240
|
+
this.localToolsDir = resolve(localToolsDir);
|
|
239241
|
+
this.cacheDir = resolve(cacheDir);
|
|
239242
|
+
this.loadConfiguration();
|
|
239243
|
+
}
|
|
239244
|
+
async resolveTool(toolName) {
|
|
239245
|
+
const resolvedName = this.aliases.get(toolName) || toolName;
|
|
239246
|
+
const localTool = await this.getLocalTool(resolvedName);
|
|
239247
|
+
if (localTool) {
|
|
239248
|
+
return {
|
|
239249
|
+
tool: localTool,
|
|
239250
|
+
source: "local",
|
|
239251
|
+
metadata: { path: localTool.path }
|
|
239252
|
+
};
|
|
239253
|
+
}
|
|
239254
|
+
const cachedTool = this.toolCache.get(resolvedName);
|
|
239255
|
+
if (cachedTool && !this.isCacheExpired(cachedTool)) {
|
|
239256
|
+
return {
|
|
239257
|
+
tool: cachedTool,
|
|
239258
|
+
source: "cache",
|
|
239259
|
+
metadata: { cachedAt: cachedTool.lastModified }
|
|
239260
|
+
};
|
|
239261
|
+
}
|
|
239262
|
+
try {
|
|
239263
|
+
const registryTool = await this.enactCore.getToolByName(resolvedName);
|
|
239264
|
+
if (registryTool) {
|
|
239265
|
+
await this.cacheRegistryTool(resolvedName, registryTool);
|
|
239266
|
+
return {
|
|
239267
|
+
tool: registryTool,
|
|
239268
|
+
source: "registry",
|
|
239269
|
+
metadata: { cached: true }
|
|
239270
|
+
};
|
|
239271
|
+
}
|
|
239272
|
+
} catch (error) {
|
|
239273
|
+
logger_default.debug(`Registry lookup failed for ${resolvedName}:`, error);
|
|
239274
|
+
}
|
|
239275
|
+
return null;
|
|
239276
|
+
}
|
|
239277
|
+
async getLocalTool(toolName) {
|
|
239278
|
+
const possiblePaths = [
|
|
239279
|
+
join4(this.localToolsDir, `${toolName}.yaml`),
|
|
239280
|
+
join4(this.localToolsDir, `${toolName}.yml`),
|
|
239281
|
+
join4(this.localToolsDir, toolName, "tool.yaml"),
|
|
239282
|
+
join4(this.localToolsDir, toolName, "tool.yml"),
|
|
239283
|
+
join4(this.localToolsDir, toolName, `${toolName}.yaml`),
|
|
239284
|
+
join4(this.localToolsDir, toolName, `${toolName}.yml`)
|
|
239285
|
+
];
|
|
239286
|
+
for (const toolPath of possiblePaths) {
|
|
239287
|
+
try {
|
|
239288
|
+
const stats = await fs5.stat(toolPath);
|
|
239289
|
+
const content = await fs5.readFile(toolPath, "utf-8");
|
|
239290
|
+
const definition = yaml2.parse(content);
|
|
239291
|
+
if (definition && (definition.name === toolName || definition.name === undefined)) {
|
|
239292
|
+
return {
|
|
239293
|
+
name: definition.name || toolName,
|
|
239294
|
+
path: toolPath,
|
|
239295
|
+
definition,
|
|
239296
|
+
lastModified: stats.mtime,
|
|
239297
|
+
cached: false
|
|
239298
|
+
};
|
|
239299
|
+
}
|
|
239300
|
+
} catch (error) {
|
|
239301
|
+
continue;
|
|
239302
|
+
}
|
|
239303
|
+
}
|
|
239304
|
+
return null;
|
|
239305
|
+
}
|
|
239306
|
+
async cacheRegistryTool(toolName, tool) {
|
|
239307
|
+
try {
|
|
239308
|
+
await fs5.mkdir(this.cacheDir, { recursive: true });
|
|
239309
|
+
const cachePath = join4(this.cacheDir, `${toolName}.yaml`);
|
|
239310
|
+
const cacheData = {
|
|
239311
|
+
...tool,
|
|
239312
|
+
_cached: true,
|
|
239313
|
+
_cachedAt: new Date().toISOString(),
|
|
239314
|
+
_source: "registry"
|
|
239315
|
+
};
|
|
239316
|
+
await fs5.writeFile(cachePath, yaml2.stringify(cacheData));
|
|
239317
|
+
this.toolCache.set(toolName, {
|
|
239318
|
+
name: toolName,
|
|
239319
|
+
path: cachePath,
|
|
239320
|
+
definition: tool,
|
|
239321
|
+
lastModified: new Date,
|
|
239322
|
+
cached: true
|
|
239323
|
+
});
|
|
239324
|
+
logger_default.debug(`Cached registry tool: ${toolName}`);
|
|
239325
|
+
} catch (error) {
|
|
239326
|
+
logger_default.warn(`Failed to cache tool ${toolName}:`, error);
|
|
239327
|
+
}
|
|
239328
|
+
}
|
|
239329
|
+
isCacheExpired(tool, maxAge = 24 * 60 * 60 * 1000) {
|
|
239330
|
+
return Date.now() - tool.lastModified.getTime() > maxAge;
|
|
239331
|
+
}
|
|
239332
|
+
async listAllTools() {
|
|
239333
|
+
const localTools = await this.scanLocalTools();
|
|
239334
|
+
const cachedTools = Array.from(this.toolCache.values());
|
|
239335
|
+
return {
|
|
239336
|
+
local: localTools,
|
|
239337
|
+
cached: cachedTools,
|
|
239338
|
+
favorites: Array.from(this.favorites),
|
|
239339
|
+
aliases: Object.fromEntries(this.aliases)
|
|
239340
|
+
};
|
|
239341
|
+
}
|
|
239342
|
+
async scanLocalTools() {
|
|
239343
|
+
const tools = [];
|
|
239344
|
+
try {
|
|
239345
|
+
await fs5.mkdir(this.localToolsDir, { recursive: true });
|
|
239346
|
+
const entries = await this.scanDirectory(this.localToolsDir);
|
|
239347
|
+
for (const entry of entries) {
|
|
239348
|
+
if (entry.endsWith(".yaml") || entry.endsWith(".yml")) {
|
|
239349
|
+
try {
|
|
239350
|
+
const content = await fs5.readFile(entry, "utf-8");
|
|
239351
|
+
const definition = yaml2.parse(content);
|
|
239352
|
+
if (definition && (definition.name || definition.command)) {
|
|
239353
|
+
const stats = await fs5.stat(entry);
|
|
239354
|
+
tools.push({
|
|
239355
|
+
name: definition.name || basename2(entry, ".yaml").replace(".yml", ""),
|
|
239356
|
+
path: entry,
|
|
239357
|
+
definition,
|
|
239358
|
+
lastModified: stats.mtime,
|
|
239359
|
+
cached: false
|
|
239360
|
+
});
|
|
239361
|
+
}
|
|
239362
|
+
} catch (error) {
|
|
239363
|
+
logger_default.debug(`Skipping invalid tool file ${entry}:`, error);
|
|
239364
|
+
}
|
|
239365
|
+
}
|
|
239366
|
+
}
|
|
239367
|
+
} catch (error) {
|
|
239368
|
+
logger_default.warn(`Failed to scan local tools directory:`, error);
|
|
239369
|
+
}
|
|
239370
|
+
return tools;
|
|
239371
|
+
}
|
|
239372
|
+
async scanDirectory(dir) {
|
|
239373
|
+
const files = [];
|
|
239374
|
+
try {
|
|
239375
|
+
const entries = await fs5.readdir(dir, { withFileTypes: true });
|
|
239376
|
+
for (const entry of entries) {
|
|
239377
|
+
const fullPath = join4(dir, entry.name);
|
|
239378
|
+
if (entry.isDirectory()) {
|
|
239379
|
+
const subFiles = await this.scanDirectory(fullPath);
|
|
239380
|
+
files.push(...subFiles);
|
|
239381
|
+
} else if (entry.isFile()) {
|
|
239382
|
+
files.push(fullPath);
|
|
239383
|
+
}
|
|
239384
|
+
}
|
|
239385
|
+
} catch (error) {
|
|
239386
|
+
logger_default.debug(`Cannot scan directory ${dir}:`, error);
|
|
239387
|
+
}
|
|
239388
|
+
return files;
|
|
239389
|
+
}
|
|
239390
|
+
addToFavorites(toolName) {
|
|
239391
|
+
this.favorites.add(toolName);
|
|
239392
|
+
this.saveConfiguration();
|
|
239393
|
+
}
|
|
239394
|
+
addAlias(alias, toolName) {
|
|
239395
|
+
this.aliases.set(alias, toolName);
|
|
239396
|
+
this.saveConfiguration();
|
|
239397
|
+
}
|
|
239398
|
+
async getSuggestions(partial) {
|
|
239399
|
+
const allTools = await this.listAllTools();
|
|
239400
|
+
const suggestions = new Set;
|
|
239401
|
+
allTools.local.forEach((tool) => {
|
|
239402
|
+
if (tool.name.includes(partial)) {
|
|
239403
|
+
suggestions.add(tool.name);
|
|
239404
|
+
}
|
|
239405
|
+
});
|
|
239406
|
+
this.favorites.forEach((fav) => {
|
|
239407
|
+
if (fav.includes(partial)) {
|
|
239408
|
+
suggestions.add(fav);
|
|
239409
|
+
}
|
|
239410
|
+
});
|
|
239411
|
+
this.aliases.forEach((toolName, alias) => {
|
|
239412
|
+
if (alias.includes(partial) || toolName.includes(partial)) {
|
|
239413
|
+
suggestions.add(alias);
|
|
239414
|
+
}
|
|
239415
|
+
});
|
|
239416
|
+
return Array.from(suggestions).slice(0, 10);
|
|
239417
|
+
}
|
|
239418
|
+
async cleanupCache() {
|
|
239419
|
+
let cleaned = 0;
|
|
239420
|
+
for (const [toolName, tool] of this.toolCache.entries()) {
|
|
239421
|
+
if (this.isCacheExpired(tool)) {
|
|
239422
|
+
try {
|
|
239423
|
+
await fs5.unlink(tool.path);
|
|
239424
|
+
this.toolCache.delete(toolName);
|
|
239425
|
+
cleaned++;
|
|
239426
|
+
} catch (error) {
|
|
239427
|
+
logger_default.debug(`Failed to clean cache for ${toolName}:`, error);
|
|
239428
|
+
}
|
|
239429
|
+
}
|
|
239430
|
+
}
|
|
239431
|
+
logger_default.info(`Cleaned ${cleaned} expired cache entries`);
|
|
239432
|
+
return cleaned;
|
|
239433
|
+
}
|
|
239434
|
+
loadConfiguration() {
|
|
239435
|
+
try {
|
|
239436
|
+
const configPath = join4(this.localToolsDir, "config.json");
|
|
239437
|
+
const config = JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
239438
|
+
if (config.aliases) {
|
|
239439
|
+
this.aliases = new Map(Object.entries(config.aliases));
|
|
239440
|
+
}
|
|
239441
|
+
if (config.favorites) {
|
|
239442
|
+
this.favorites = new Set(config.favorites);
|
|
239443
|
+
}
|
|
239444
|
+
} catch (error) {
|
|
239445
|
+
logger_default.debug("No tool configuration found, using defaults");
|
|
239446
|
+
}
|
|
239447
|
+
}
|
|
239448
|
+
saveConfiguration() {
|
|
239449
|
+
try {
|
|
239450
|
+
const configPath = join4(this.localToolsDir, "config.json");
|
|
239451
|
+
const config = {
|
|
239452
|
+
aliases: Object.fromEntries(this.aliases),
|
|
239453
|
+
favorites: Array.from(this.favorites),
|
|
239454
|
+
lastUpdated: new Date().toISOString()
|
|
239455
|
+
};
|
|
239456
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
239457
|
+
} catch (error) {
|
|
239458
|
+
logger_default.warn("Failed to save tool configuration:", error);
|
|
239459
|
+
}
|
|
239460
|
+
}
|
|
239461
|
+
async initialize() {
|
|
239462
|
+
await fs5.mkdir(this.localToolsDir, { recursive: true });
|
|
239463
|
+
await fs5.mkdir(this.cacheDir, { recursive: true });
|
|
239464
|
+
const tools = await this.scanLocalTools();
|
|
239465
|
+
if (tools.length === 0) {
|
|
239466
|
+
const sampleTool = {
|
|
239467
|
+
name: "hello-world",
|
|
239468
|
+
description: "A simple hello world tool",
|
|
239469
|
+
version: "1.0.0",
|
|
239470
|
+
command: 'echo "Hello, World!"',
|
|
239471
|
+
inputSchema: {
|
|
239472
|
+
properties: {
|
|
239473
|
+
message: {
|
|
239474
|
+
type: "string",
|
|
239475
|
+
description: "Custom message to display"
|
|
239476
|
+
}
|
|
239477
|
+
}
|
|
239478
|
+
}
|
|
239479
|
+
};
|
|
239480
|
+
const samplePath = join4(this.localToolsDir, "hello-world.yaml");
|
|
239481
|
+
await fs5.writeFile(samplePath, yaml2.stringify(sampleTool));
|
|
239482
|
+
logger_default.info(`Created sample tool at ${samplePath}`);
|
|
239483
|
+
}
|
|
239484
|
+
const readmePath = join4(this.localToolsDir, "README.md");
|
|
239485
|
+
const readme = `# Local Tools Directory
|
|
239486
|
+
|
|
239487
|
+
This directory contains your local Enact tools. Tools can be organized as:
|
|
239488
|
+
|
|
239489
|
+
## File Structure
|
|
239490
|
+
- \`tool-name.yaml\` - Single tool file
|
|
239491
|
+
- \`tool-name/tool.yaml\` - Tool in subdirectory
|
|
239492
|
+
- \`tool-name/tool-name.yaml\` - Named tool in subdirectory
|
|
239493
|
+
|
|
239494
|
+
## Configuration
|
|
239495
|
+
- \`config.json\` - Aliases and favorites configuration
|
|
239496
|
+
|
|
239497
|
+
## Cache
|
|
239498
|
+
Registry tools are cached in \`.tool-cache/\` for faster access.
|
|
239499
|
+
|
|
239500
|
+
## Priority Order
|
|
239501
|
+
1. Favorites (if name matches)
|
|
239502
|
+
2. Local tools
|
|
239503
|
+
3. Cached registry tools
|
|
239504
|
+
4. Registry lookup
|
|
239505
|
+
|
|
239506
|
+
Use the MCP tools to manage this directory programmatically.
|
|
239507
|
+
`;
|
|
239508
|
+
try {
|
|
239509
|
+
await fs5.access(readmePath);
|
|
239510
|
+
} catch {
|
|
239511
|
+
await fs5.writeFile(readmePath, readme);
|
|
239512
|
+
}
|
|
239513
|
+
}
|
|
239514
|
+
}
|
|
239515
|
+
var LocalToolResolver_default = LocalToolResolver;
|
|
239132
239516
|
// ../shared/dist/utils/help.js
|
|
239133
239517
|
var __dirname = "/Users/keithgroves/projects/enact/enact-cli/packages/shared/dist/utils";
|
|
239518
|
+
// ../shared/dist/utils/version.js
|
|
239519
|
+
var __filename = "/Users/keithgroves/projects/enact/enact-cli/packages/shared/dist/utils/version.js";
|
|
239134
239520
|
// ../shared/dist/utils/logger.js
|
|
239135
239521
|
var LogLevel;
|
|
239136
239522
|
(function(LogLevel2) {
|
|
@@ -239269,32 +239655,109 @@ function validateSilentEnvironment() {
|
|
|
239269
239655
|
issues
|
|
239270
239656
|
};
|
|
239271
239657
|
}
|
|
239272
|
-
// ../shared/dist/
|
|
239273
|
-
|
|
239658
|
+
// ../shared/dist/services/McpCoreService.js
|
|
239659
|
+
class McpCoreService {
|
|
239660
|
+
constructor(options) {
|
|
239661
|
+
this.core = new EnactCore({
|
|
239662
|
+
apiUrl: options?.apiUrl || "https://enact.tools",
|
|
239663
|
+
supabaseUrl: options?.supabaseUrl || "https://xjnhhxwxovjifdxdwzih.supabase.co",
|
|
239664
|
+
authToken: options?.authToken
|
|
239665
|
+
});
|
|
239666
|
+
}
|
|
239667
|
+
static async create(options) {
|
|
239668
|
+
const frontendUrl = options?.apiUrl || await getFrontendUrl();
|
|
239669
|
+
const apiUrl = options?.supabaseUrl || await getApiUrl();
|
|
239670
|
+
return new McpCoreService({
|
|
239671
|
+
...options,
|
|
239672
|
+
apiUrl: frontendUrl,
|
|
239673
|
+
supabaseUrl: apiUrl
|
|
239674
|
+
});
|
|
239675
|
+
}
|
|
239676
|
+
setAuthToken(token) {
|
|
239677
|
+
this.core.setAuthToken(token);
|
|
239678
|
+
}
|
|
239679
|
+
async searchTools(query, options) {
|
|
239680
|
+
const searchOptions = {
|
|
239681
|
+
query,
|
|
239682
|
+
limit: options?.limit,
|
|
239683
|
+
tags: options?.tags,
|
|
239684
|
+
author: options?.author
|
|
239685
|
+
};
|
|
239686
|
+
return await this.core.searchTools(searchOptions);
|
|
239687
|
+
}
|
|
239688
|
+
async getToolInfo(name) {
|
|
239689
|
+
return await this.core.getToolByName(name);
|
|
239690
|
+
}
|
|
239691
|
+
async executeToolByName(name, inputs = {}, options) {
|
|
239692
|
+
const executeOptions = {
|
|
239693
|
+
timeout: options?.timeout,
|
|
239694
|
+
force: options?.force,
|
|
239695
|
+
dryRun: options?.dryRun
|
|
239696
|
+
};
|
|
239697
|
+
return await this.core.executeToolByName(name, inputs, executeOptions);
|
|
239698
|
+
}
|
|
239699
|
+
async executeRawTool(toolYaml, inputs = {}, options) {
|
|
239700
|
+
const executeOptions = {
|
|
239701
|
+
timeout: options?.timeout,
|
|
239702
|
+
force: options?.force,
|
|
239703
|
+
dryRun: options?.dryRun
|
|
239704
|
+
};
|
|
239705
|
+
return await this.core.executeRawTool(toolYaml, inputs, executeOptions);
|
|
239706
|
+
}
|
|
239707
|
+
async toolExists(name) {
|
|
239708
|
+
return await this.core.toolExists(name);
|
|
239709
|
+
}
|
|
239710
|
+
async getToolsByTags(tags, limit = 20) {
|
|
239711
|
+
return await this.core.getToolsByTags(tags, limit);
|
|
239712
|
+
}
|
|
239713
|
+
async getToolsByAuthor(author, limit = 20) {
|
|
239714
|
+
return await this.core.getToolsByAuthor(author, limit);
|
|
239715
|
+
}
|
|
239716
|
+
async getTools(options) {
|
|
239717
|
+
return await this.core.getTools(options);
|
|
239718
|
+
}
|
|
239719
|
+
async getAuthStatus() {
|
|
239720
|
+
return await this.core.getAuthStatus();
|
|
239721
|
+
}
|
|
239722
|
+
async isAvailable() {
|
|
239723
|
+
return true;
|
|
239724
|
+
}
|
|
239725
|
+
async getPathInfo() {
|
|
239726
|
+
return {
|
|
239727
|
+
detectedPath: "core-library",
|
|
239728
|
+
isAvailable: true,
|
|
239729
|
+
version: "2.0.0-core"
|
|
239730
|
+
};
|
|
239731
|
+
}
|
|
239732
|
+
async publishTool(tool) {
|
|
239733
|
+
return await this.core.publishTool(tool);
|
|
239734
|
+
}
|
|
239735
|
+
}
|
|
239736
|
+
var mcpCoreService = new McpCoreService;
|
|
239274
239737
|
// ../shared/dist/web/env-manager-server.js
|
|
239275
239738
|
import { createServer } from "http";
|
|
239276
|
-
import { parse as
|
|
239277
|
-
import { readFile as
|
|
239278
|
-
import { existsSync as
|
|
239279
|
-
import { join as
|
|
239739
|
+
import { parse as parse4 } from "url";
|
|
239740
|
+
import { readFile as readFile3, writeFile as writeFile2, mkdir as mkdir2, readdir, stat as stat2 } from "fs/promises";
|
|
239741
|
+
import { existsSync as existsSync4 } from "fs";
|
|
239742
|
+
import { join as join5, dirname as dirname3 } from "path";
|
|
239280
239743
|
import { homedir as homedir4 } from "os";
|
|
239281
239744
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
239282
239745
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
239283
239746
|
var __dirname3 = dirname3(__filename3);
|
|
239284
|
-
var CONFIG_DIR3 =
|
|
239285
|
-
var ENV_BASE_DIR =
|
|
239747
|
+
var CONFIG_DIR3 = join5(homedir4(), ".enact");
|
|
239748
|
+
var ENV_BASE_DIR = join5(CONFIG_DIR3, "env");
|
|
239286
239749
|
function findStaticDir() {
|
|
239287
239750
|
const candidates = [
|
|
239288
|
-
|
|
239289
|
-
|
|
239290
|
-
|
|
239291
|
-
|
|
239292
|
-
|
|
239293
|
-
|
|
239294
|
-
|
|
239751
|
+
join5(__dirname3, "web", "static"),
|
|
239752
|
+
join5(__dirname3, "static"),
|
|
239753
|
+
join5(__dirname3, "..", "src", "web", "static"),
|
|
239754
|
+
join5(__dirname3, "..", "..", "src", "web", "static"),
|
|
239755
|
+
join5(process.cwd(), "src", "web", "static"),
|
|
239756
|
+
join5(__dirname3, "..", "..", "..", "src", "web", "static"),
|
|
239757
|
+
join5(__dirname3, "..", "..", "src", "web", "static")
|
|
239295
239758
|
];
|
|
239296
239759
|
for (const candidate of candidates) {
|
|
239297
|
-
if (
|
|
239760
|
+
if (existsSync4(join5(candidate, "index.html"))) {
|
|
239298
239761
|
logger_default.debug(`Found static directory: ${candidate}`);
|
|
239299
239762
|
return candidate;
|
|
239300
239763
|
}
|
|
@@ -239338,7 +239801,7 @@ function generateDotEnv(vars) {
|
|
|
239338
239801
|
}
|
|
239339
239802
|
async function getAllPackageNamespaces() {
|
|
239340
239803
|
const packages = [];
|
|
239341
|
-
if (!
|
|
239804
|
+
if (!existsSync4(ENV_BASE_DIR)) {
|
|
239342
239805
|
return packages;
|
|
239343
239806
|
}
|
|
239344
239807
|
try {
|
|
@@ -239352,7 +239815,7 @@ async function scanDirectory(dir, relativePath, packages) {
|
|
|
239352
239815
|
try {
|
|
239353
239816
|
const entries = await readdir(dir);
|
|
239354
239817
|
for (const entry of entries) {
|
|
239355
|
-
const fullPath =
|
|
239818
|
+
const fullPath = join5(dir, entry);
|
|
239356
239819
|
const stats = await stat2(fullPath);
|
|
239357
239820
|
if (stats.isDirectory()) {
|
|
239358
239821
|
const newRelativePath = relativePath ? `${relativePath}/${entry}` : entry;
|
|
@@ -239360,7 +239823,7 @@ async function scanDirectory(dir, relativePath, packages) {
|
|
|
239360
239823
|
} else if (entry === ".env") {
|
|
239361
239824
|
const namespace = relativePath || "root";
|
|
239362
239825
|
try {
|
|
239363
|
-
const content = await
|
|
239826
|
+
const content = await readFile3(fullPath, "utf8");
|
|
239364
239827
|
const variables = parseDotEnv(content);
|
|
239365
239828
|
packages.push({
|
|
239366
239829
|
namespace,
|
|
@@ -239377,12 +239840,12 @@ async function scanDirectory(dir, relativePath, packages) {
|
|
|
239377
239840
|
}
|
|
239378
239841
|
}
|
|
239379
239842
|
async function getPackageEnvVars(namespace) {
|
|
239380
|
-
const envFile =
|
|
239381
|
-
if (!
|
|
239843
|
+
const envFile = join5(ENV_BASE_DIR, namespace, ".env");
|
|
239844
|
+
if (!existsSync4(envFile)) {
|
|
239382
239845
|
return {};
|
|
239383
239846
|
}
|
|
239384
239847
|
try {
|
|
239385
|
-
const content = await
|
|
239848
|
+
const content = await readFile3(envFile, "utf8");
|
|
239386
239849
|
return parseDotEnv(content);
|
|
239387
239850
|
} catch (error) {
|
|
239388
239851
|
logger_default.error(`Failed to read env file for ${namespace}:`, error);
|
|
@@ -239390,15 +239853,15 @@ async function getPackageEnvVars(namespace) {
|
|
|
239390
239853
|
}
|
|
239391
239854
|
}
|
|
239392
239855
|
async function setPackageEnvVar(namespace, key, value) {
|
|
239393
|
-
const envFile =
|
|
239856
|
+
const envFile = join5(ENV_BASE_DIR, namespace, ".env");
|
|
239394
239857
|
const envDir = dirname3(envFile);
|
|
239395
|
-
if (!
|
|
239396
|
-
await
|
|
239858
|
+
if (!existsSync4(envDir)) {
|
|
239859
|
+
await mkdir2(envDir, { recursive: true });
|
|
239397
239860
|
}
|
|
239398
239861
|
const existingVars = await getPackageEnvVars(namespace);
|
|
239399
239862
|
existingVars[key] = value;
|
|
239400
239863
|
const envContent = generateDotEnv(existingVars);
|
|
239401
|
-
await
|
|
239864
|
+
await writeFile2(envFile, envContent, "utf8");
|
|
239402
239865
|
}
|
|
239403
239866
|
async function deletePackageEnvVar(namespace, key) {
|
|
239404
239867
|
const existingVars = await getPackageEnvVars(namespace);
|
|
@@ -239406,13 +239869,13 @@ async function deletePackageEnvVar(namespace, key) {
|
|
|
239406
239869
|
throw new Error(`Environment variable '${key}' not found in package '${namespace}'`);
|
|
239407
239870
|
}
|
|
239408
239871
|
delete existingVars[key];
|
|
239409
|
-
const envFile =
|
|
239872
|
+
const envFile = join5(ENV_BASE_DIR, namespace, ".env");
|
|
239410
239873
|
const envContent = generateDotEnv(existingVars);
|
|
239411
|
-
await
|
|
239874
|
+
await writeFile2(envFile, envContent, "utf8");
|
|
239412
239875
|
}
|
|
239413
239876
|
async function serveStaticFile(filePath, res) {
|
|
239414
239877
|
try {
|
|
239415
|
-
const content = await
|
|
239878
|
+
const content = await readFile3(filePath, "utf8");
|
|
239416
239879
|
const ext = filePath.split(".").pop()?.toLowerCase();
|
|
239417
239880
|
let contentType = "text/plain";
|
|
239418
239881
|
switch (ext) {
|
|
@@ -239438,7 +239901,7 @@ async function serveStaticFile(filePath, res) {
|
|
|
239438
239901
|
}
|
|
239439
239902
|
}
|
|
239440
239903
|
async function handleRequest(req, res) {
|
|
239441
|
-
const urlParts =
|
|
239904
|
+
const urlParts = parse4(req.url || "", true);
|
|
239442
239905
|
const pathname = urlParts.pathname || "/";
|
|
239443
239906
|
const method = req.method || "GET";
|
|
239444
239907
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
@@ -239451,11 +239914,11 @@ async function handleRequest(req, res) {
|
|
|
239451
239914
|
}
|
|
239452
239915
|
try {
|
|
239453
239916
|
if (pathname === "/") {
|
|
239454
|
-
await serveStaticFile(
|
|
239917
|
+
await serveStaticFile(join5(STATIC_DIR, "index.html"), res);
|
|
239455
239918
|
} else if (pathname === "/style.css") {
|
|
239456
|
-
await serveStaticFile(
|
|
239919
|
+
await serveStaticFile(join5(STATIC_DIR, "style.css"), res);
|
|
239457
239920
|
} else if (pathname === "/app.js") {
|
|
239458
|
-
await serveStaticFile(
|
|
239921
|
+
await serveStaticFile(join5(STATIC_DIR, "app.js"), res);
|
|
239459
239922
|
} else if (pathname === "/favicon.ico") {
|
|
239460
239923
|
const favicon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">\uD83C\uDF10</text></svg>`;
|
|
239461
239924
|
res.writeHead(200, { "Content-Type": "image/svg+xml" });
|
|
@@ -239472,13 +239935,13 @@ async function handleRequest(req, res) {
|
|
|
239472
239935
|
res.end(JSON.stringify({ error: "Namespace is required" }));
|
|
239473
239936
|
return;
|
|
239474
239937
|
}
|
|
239475
|
-
const envDir =
|
|
239476
|
-
const envFile =
|
|
239477
|
-
if (!
|
|
239478
|
-
await
|
|
239938
|
+
const envDir = join5(ENV_BASE_DIR, namespace);
|
|
239939
|
+
const envFile = join5(envDir, ".env");
|
|
239940
|
+
if (!existsSync4(envDir)) {
|
|
239941
|
+
await mkdir2(envDir, { recursive: true });
|
|
239479
239942
|
}
|
|
239480
|
-
if (!
|
|
239481
|
-
await
|
|
239943
|
+
if (!existsSync4(envFile)) {
|
|
239944
|
+
await writeFile2(envFile, "", "utf8");
|
|
239482
239945
|
}
|
|
239483
239946
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
239484
239947
|
res.end(JSON.stringify({ success: true }));
|
|
@@ -239520,31 +239983,31 @@ async function handleRequest(req, res) {
|
|
|
239520
239983
|
}
|
|
239521
239984
|
}
|
|
239522
239985
|
function getRequestBody(req) {
|
|
239523
|
-
return new Promise((
|
|
239986
|
+
return new Promise((resolve2, reject) => {
|
|
239524
239987
|
let body = "";
|
|
239525
239988
|
req.on("data", (chunk) => {
|
|
239526
239989
|
body += chunk.toString();
|
|
239527
239990
|
});
|
|
239528
239991
|
req.on("end", () => {
|
|
239529
|
-
|
|
239992
|
+
resolve2(body);
|
|
239530
239993
|
});
|
|
239531
239994
|
req.on("error", reject);
|
|
239532
239995
|
});
|
|
239533
239996
|
}
|
|
239534
239997
|
function startEnvManagerServer(port = 5555) {
|
|
239535
|
-
return new Promise((
|
|
239998
|
+
return new Promise((resolve2, reject) => {
|
|
239536
239999
|
const server2 = createServer(handleRequest);
|
|
239537
240000
|
server2.listen(port, () => {
|
|
239538
240001
|
const actualPort = server2.address()?.port || port;
|
|
239539
240002
|
logger_default.info(`\uD83C\uDF10 Environment Manager web server started on http://localhost:${actualPort}`);
|
|
239540
|
-
|
|
240003
|
+
resolve2({ server: server2, port: actualPort });
|
|
239541
240004
|
});
|
|
239542
240005
|
server2.on("error", (error) => {
|
|
239543
240006
|
if (error.code === "EADDRINUSE") {
|
|
239544
240007
|
server2.listen(0, () => {
|
|
239545
240008
|
const actualPort = server2.address()?.port;
|
|
239546
240009
|
logger_default.info(`\uD83C\uDF10 Environment Manager web server started on http://localhost:${actualPort} (port ${port} was in use)`);
|
|
239547
|
-
|
|
240010
|
+
resolve2({ server: server2, port: actualPort });
|
|
239548
240011
|
});
|
|
239549
240012
|
} else {
|
|
239550
240013
|
reject(error);
|
|
@@ -239552,373 +240015,26 @@ function startEnvManagerServer(port = 5555) {
|
|
|
239552
240015
|
});
|
|
239553
240016
|
});
|
|
239554
240017
|
}
|
|
239555
|
-
// ../shared/dist/LocalToolResolver.js
|
|
239556
|
-
var yaml2 = __toESM(require_dist3(), 1);
|
|
239557
|
-
import { promises as fs5, readFileSync as readFileSync3, writeFileSync } from "fs";
|
|
239558
|
-
import { join as join5, resolve, basename as basename2 } from "path";
|
|
239559
|
-
class LocalToolResolver {
|
|
239560
|
-
constructor(enactCore, localToolsDir = "./tools", cacheDir = "./.tool-cache") {
|
|
239561
|
-
this.enactCore = enactCore;
|
|
239562
|
-
this.toolCache = new Map;
|
|
239563
|
-
this.aliases = new Map;
|
|
239564
|
-
this.favorites = new Set;
|
|
239565
|
-
this.localToolsDir = resolve(localToolsDir);
|
|
239566
|
-
this.cacheDir = resolve(cacheDir);
|
|
239567
|
-
this.loadConfiguration();
|
|
239568
|
-
}
|
|
239569
|
-
async resolveTool(toolName) {
|
|
239570
|
-
const resolvedName = this.aliases.get(toolName) || toolName;
|
|
239571
|
-
const localTool = await this.getLocalTool(resolvedName);
|
|
239572
|
-
if (localTool) {
|
|
239573
|
-
return {
|
|
239574
|
-
tool: localTool,
|
|
239575
|
-
source: "local",
|
|
239576
|
-
metadata: { path: localTool.path }
|
|
239577
|
-
};
|
|
239578
|
-
}
|
|
239579
|
-
const cachedTool = this.toolCache.get(resolvedName);
|
|
239580
|
-
if (cachedTool && !this.isCacheExpired(cachedTool)) {
|
|
239581
|
-
return {
|
|
239582
|
-
tool: cachedTool,
|
|
239583
|
-
source: "cache",
|
|
239584
|
-
metadata: { cachedAt: cachedTool.lastModified }
|
|
239585
|
-
};
|
|
239586
|
-
}
|
|
239587
|
-
try {
|
|
239588
|
-
const registryTool = await this.enactCore.getToolByName(resolvedName);
|
|
239589
|
-
if (registryTool) {
|
|
239590
|
-
await this.cacheRegistryTool(resolvedName, registryTool);
|
|
239591
|
-
return {
|
|
239592
|
-
tool: registryTool,
|
|
239593
|
-
source: "registry",
|
|
239594
|
-
metadata: { cached: true }
|
|
239595
|
-
};
|
|
239596
|
-
}
|
|
239597
|
-
} catch (error) {
|
|
239598
|
-
logger_default.debug(`Registry lookup failed for ${resolvedName}:`, error);
|
|
239599
|
-
}
|
|
239600
|
-
return null;
|
|
239601
|
-
}
|
|
239602
|
-
async getLocalTool(toolName) {
|
|
239603
|
-
const possiblePaths = [
|
|
239604
|
-
join5(this.localToolsDir, `${toolName}.yaml`),
|
|
239605
|
-
join5(this.localToolsDir, `${toolName}.yml`),
|
|
239606
|
-
join5(this.localToolsDir, toolName, "tool.yaml"),
|
|
239607
|
-
join5(this.localToolsDir, toolName, "tool.yml"),
|
|
239608
|
-
join5(this.localToolsDir, toolName, `${toolName}.yaml`),
|
|
239609
|
-
join5(this.localToolsDir, toolName, `${toolName}.yml`)
|
|
239610
|
-
];
|
|
239611
|
-
for (const toolPath of possiblePaths) {
|
|
239612
|
-
try {
|
|
239613
|
-
const stats = await fs5.stat(toolPath);
|
|
239614
|
-
const content = await fs5.readFile(toolPath, "utf-8");
|
|
239615
|
-
const definition = yaml2.parse(content);
|
|
239616
|
-
if (definition && (definition.name === toolName || definition.name === undefined)) {
|
|
239617
|
-
return {
|
|
239618
|
-
name: definition.name || toolName,
|
|
239619
|
-
path: toolPath,
|
|
239620
|
-
definition,
|
|
239621
|
-
lastModified: stats.mtime,
|
|
239622
|
-
cached: false
|
|
239623
|
-
};
|
|
239624
|
-
}
|
|
239625
|
-
} catch (error) {
|
|
239626
|
-
continue;
|
|
239627
|
-
}
|
|
239628
|
-
}
|
|
239629
|
-
return null;
|
|
239630
|
-
}
|
|
239631
|
-
async cacheRegistryTool(toolName, tool) {
|
|
239632
|
-
try {
|
|
239633
|
-
await fs5.mkdir(this.cacheDir, { recursive: true });
|
|
239634
|
-
const cachePath = join5(this.cacheDir, `${toolName}.yaml`);
|
|
239635
|
-
const cacheData = {
|
|
239636
|
-
...tool,
|
|
239637
|
-
_cached: true,
|
|
239638
|
-
_cachedAt: new Date().toISOString(),
|
|
239639
|
-
_source: "registry"
|
|
239640
|
-
};
|
|
239641
|
-
await fs5.writeFile(cachePath, yaml2.stringify(cacheData));
|
|
239642
|
-
this.toolCache.set(toolName, {
|
|
239643
|
-
name: toolName,
|
|
239644
|
-
path: cachePath,
|
|
239645
|
-
definition: tool,
|
|
239646
|
-
lastModified: new Date,
|
|
239647
|
-
cached: true
|
|
239648
|
-
});
|
|
239649
|
-
logger_default.debug(`Cached registry tool: ${toolName}`);
|
|
239650
|
-
} catch (error) {
|
|
239651
|
-
logger_default.warn(`Failed to cache tool ${toolName}:`, error);
|
|
239652
|
-
}
|
|
239653
|
-
}
|
|
239654
|
-
isCacheExpired(tool, maxAge = 24 * 60 * 60 * 1000) {
|
|
239655
|
-
return Date.now() - tool.lastModified.getTime() > maxAge;
|
|
239656
|
-
}
|
|
239657
|
-
async listAllTools() {
|
|
239658
|
-
const localTools = await this.scanLocalTools();
|
|
239659
|
-
const cachedTools = Array.from(this.toolCache.values());
|
|
239660
|
-
return {
|
|
239661
|
-
local: localTools,
|
|
239662
|
-
cached: cachedTools,
|
|
239663
|
-
favorites: Array.from(this.favorites),
|
|
239664
|
-
aliases: Object.fromEntries(this.aliases)
|
|
239665
|
-
};
|
|
239666
|
-
}
|
|
239667
|
-
async scanLocalTools() {
|
|
239668
|
-
const tools = [];
|
|
239669
|
-
try {
|
|
239670
|
-
await fs5.mkdir(this.localToolsDir, { recursive: true });
|
|
239671
|
-
const entries = await this.scanDirectory(this.localToolsDir);
|
|
239672
|
-
for (const entry of entries) {
|
|
239673
|
-
if (entry.endsWith(".yaml") || entry.endsWith(".yml")) {
|
|
239674
|
-
try {
|
|
239675
|
-
const content = await fs5.readFile(entry, "utf-8");
|
|
239676
|
-
const definition = yaml2.parse(content);
|
|
239677
|
-
if (definition && (definition.name || definition.command)) {
|
|
239678
|
-
const stats = await fs5.stat(entry);
|
|
239679
|
-
tools.push({
|
|
239680
|
-
name: definition.name || basename2(entry, ".yaml").replace(".yml", ""),
|
|
239681
|
-
path: entry,
|
|
239682
|
-
definition,
|
|
239683
|
-
lastModified: stats.mtime,
|
|
239684
|
-
cached: false
|
|
239685
|
-
});
|
|
239686
|
-
}
|
|
239687
|
-
} catch (error) {
|
|
239688
|
-
logger_default.debug(`Skipping invalid tool file ${entry}:`, error);
|
|
239689
|
-
}
|
|
239690
|
-
}
|
|
239691
|
-
}
|
|
239692
|
-
} catch (error) {
|
|
239693
|
-
logger_default.warn(`Failed to scan local tools directory:`, error);
|
|
239694
|
-
}
|
|
239695
|
-
return tools;
|
|
239696
|
-
}
|
|
239697
|
-
async scanDirectory(dir) {
|
|
239698
|
-
const files = [];
|
|
239699
|
-
try {
|
|
239700
|
-
const entries = await fs5.readdir(dir, { withFileTypes: true });
|
|
239701
|
-
for (const entry of entries) {
|
|
239702
|
-
const fullPath = join5(dir, entry.name);
|
|
239703
|
-
if (entry.isDirectory()) {
|
|
239704
|
-
const subFiles = await this.scanDirectory(fullPath);
|
|
239705
|
-
files.push(...subFiles);
|
|
239706
|
-
} else if (entry.isFile()) {
|
|
239707
|
-
files.push(fullPath);
|
|
239708
|
-
}
|
|
239709
|
-
}
|
|
239710
|
-
} catch (error) {
|
|
239711
|
-
logger_default.debug(`Cannot scan directory ${dir}:`, error);
|
|
239712
|
-
}
|
|
239713
|
-
return files;
|
|
239714
|
-
}
|
|
239715
|
-
addToFavorites(toolName) {
|
|
239716
|
-
this.favorites.add(toolName);
|
|
239717
|
-
this.saveConfiguration();
|
|
239718
|
-
}
|
|
239719
|
-
addAlias(alias, toolName) {
|
|
239720
|
-
this.aliases.set(alias, toolName);
|
|
239721
|
-
this.saveConfiguration();
|
|
239722
|
-
}
|
|
239723
|
-
async getSuggestions(partial) {
|
|
239724
|
-
const allTools = await this.listAllTools();
|
|
239725
|
-
const suggestions = new Set;
|
|
239726
|
-
allTools.local.forEach((tool) => {
|
|
239727
|
-
if (tool.name.includes(partial)) {
|
|
239728
|
-
suggestions.add(tool.name);
|
|
239729
|
-
}
|
|
239730
|
-
});
|
|
239731
|
-
this.favorites.forEach((fav) => {
|
|
239732
|
-
if (fav.includes(partial)) {
|
|
239733
|
-
suggestions.add(fav);
|
|
239734
|
-
}
|
|
239735
|
-
});
|
|
239736
|
-
this.aliases.forEach((toolName, alias) => {
|
|
239737
|
-
if (alias.includes(partial) || toolName.includes(partial)) {
|
|
239738
|
-
suggestions.add(alias);
|
|
239739
|
-
}
|
|
239740
|
-
});
|
|
239741
|
-
return Array.from(suggestions).slice(0, 10);
|
|
239742
|
-
}
|
|
239743
|
-
async cleanupCache() {
|
|
239744
|
-
let cleaned = 0;
|
|
239745
|
-
for (const [toolName, tool] of this.toolCache.entries()) {
|
|
239746
|
-
if (this.isCacheExpired(tool)) {
|
|
239747
|
-
try {
|
|
239748
|
-
await fs5.unlink(tool.path);
|
|
239749
|
-
this.toolCache.delete(toolName);
|
|
239750
|
-
cleaned++;
|
|
239751
|
-
} catch (error) {
|
|
239752
|
-
logger_default.debug(`Failed to clean cache for ${toolName}:`, error);
|
|
239753
|
-
}
|
|
239754
|
-
}
|
|
239755
|
-
}
|
|
239756
|
-
logger_default.info(`Cleaned ${cleaned} expired cache entries`);
|
|
239757
|
-
return cleaned;
|
|
239758
|
-
}
|
|
239759
|
-
loadConfiguration() {
|
|
239760
|
-
try {
|
|
239761
|
-
const configPath = join5(this.localToolsDir, "config.json");
|
|
239762
|
-
const config2 = JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
239763
|
-
if (config2.aliases) {
|
|
239764
|
-
this.aliases = new Map(Object.entries(config2.aliases));
|
|
239765
|
-
}
|
|
239766
|
-
if (config2.favorites) {
|
|
239767
|
-
this.favorites = new Set(config2.favorites);
|
|
239768
|
-
}
|
|
239769
|
-
} catch (error) {
|
|
239770
|
-
logger_default.debug("No tool configuration found, using defaults");
|
|
239771
|
-
}
|
|
239772
|
-
}
|
|
239773
|
-
saveConfiguration() {
|
|
239774
|
-
try {
|
|
239775
|
-
const configPath = join5(this.localToolsDir, "config.json");
|
|
239776
|
-
const config2 = {
|
|
239777
|
-
aliases: Object.fromEntries(this.aliases),
|
|
239778
|
-
favorites: Array.from(this.favorites),
|
|
239779
|
-
lastUpdated: new Date().toISOString()
|
|
239780
|
-
};
|
|
239781
|
-
writeFileSync(configPath, JSON.stringify(config2, null, 2));
|
|
239782
|
-
} catch (error) {
|
|
239783
|
-
logger_default.warn("Failed to save tool configuration:", error);
|
|
239784
|
-
}
|
|
239785
|
-
}
|
|
239786
|
-
async initialize() {
|
|
239787
|
-
await fs5.mkdir(this.localToolsDir, { recursive: true });
|
|
239788
|
-
await fs5.mkdir(this.cacheDir, { recursive: true });
|
|
239789
|
-
const tools = await this.scanLocalTools();
|
|
239790
|
-
if (tools.length === 0) {
|
|
239791
|
-
const sampleTool = {
|
|
239792
|
-
name: "hello-world",
|
|
239793
|
-
description: "A simple hello world tool",
|
|
239794
|
-
version: "1.0.0",
|
|
239795
|
-
command: 'echo "Hello, World!"',
|
|
239796
|
-
inputSchema: {
|
|
239797
|
-
properties: {
|
|
239798
|
-
message: {
|
|
239799
|
-
type: "string",
|
|
239800
|
-
description: "Custom message to display"
|
|
239801
|
-
}
|
|
239802
|
-
}
|
|
239803
|
-
}
|
|
239804
|
-
};
|
|
239805
|
-
const samplePath = join5(this.localToolsDir, "hello-world.yaml");
|
|
239806
|
-
await fs5.writeFile(samplePath, yaml2.stringify(sampleTool));
|
|
239807
|
-
logger_default.info(`Created sample tool at ${samplePath}`);
|
|
239808
|
-
}
|
|
239809
|
-
const readmePath = join5(this.localToolsDir, "README.md");
|
|
239810
|
-
const readme = `# Local Tools Directory
|
|
239811
|
-
|
|
239812
|
-
This directory contains your local Enact tools. Tools can be organized as:
|
|
239813
|
-
|
|
239814
|
-
## File Structure
|
|
239815
|
-
- \`tool-name.yaml\` - Single tool file
|
|
239816
|
-
- \`tool-name/tool.yaml\` - Tool in subdirectory
|
|
239817
|
-
- \`tool-name/tool-name.yaml\` - Named tool in subdirectory
|
|
239818
|
-
|
|
239819
|
-
## Configuration
|
|
239820
|
-
- \`config.json\` - Aliases and favorites configuration
|
|
239821
|
-
|
|
239822
|
-
## Cache
|
|
239823
|
-
Registry tools are cached in \`.tool-cache/\` for faster access.
|
|
239824
|
-
|
|
239825
|
-
## Priority Order
|
|
239826
|
-
1. Favorites (if name matches)
|
|
239827
|
-
2. Local tools
|
|
239828
|
-
3. Cached registry tools
|
|
239829
|
-
4. Registry lookup
|
|
239830
|
-
|
|
239831
|
-
Use the MCP tools to manage this directory programmatically.
|
|
239832
|
-
`;
|
|
239833
|
-
try {
|
|
239834
|
-
await fs5.access(readmePath);
|
|
239835
|
-
} catch {
|
|
239836
|
-
await fs5.writeFile(readmePath, readme);
|
|
239837
|
-
}
|
|
239838
|
-
}
|
|
239839
|
-
}
|
|
239840
|
-
var LocalToolResolver_default = LocalToolResolver;
|
|
239841
|
-
// ../shared/dist/services/McpCoreService.js
|
|
239842
|
-
class McpCoreService {
|
|
239843
|
-
constructor(options) {
|
|
239844
|
-
this.core = new EnactCore({
|
|
239845
|
-
apiUrl: options?.apiUrl || "https://enact.tools",
|
|
239846
|
-
supabaseUrl: options?.supabaseUrl || "https://xjnhhxwxovjifdxdwzih.supabase.co",
|
|
239847
|
-
authToken: options?.authToken
|
|
239848
|
-
});
|
|
239849
|
-
}
|
|
239850
|
-
setAuthToken(token) {
|
|
239851
|
-
this.core.setAuthToken(token);
|
|
239852
|
-
}
|
|
239853
|
-
async searchTools(query, options) {
|
|
239854
|
-
const searchOptions = {
|
|
239855
|
-
query,
|
|
239856
|
-
limit: options?.limit,
|
|
239857
|
-
tags: options?.tags,
|
|
239858
|
-
author: options?.author
|
|
239859
|
-
};
|
|
239860
|
-
return await this.core.searchTools(searchOptions);
|
|
239861
|
-
}
|
|
239862
|
-
async getToolInfo(name) {
|
|
239863
|
-
return await this.core.getToolByName(name);
|
|
239864
|
-
}
|
|
239865
|
-
async executeToolByName(name, inputs = {}, options) {
|
|
239866
|
-
const executeOptions = {
|
|
239867
|
-
timeout: options?.timeout,
|
|
239868
|
-
force: options?.force,
|
|
239869
|
-
dryRun: options?.dryRun
|
|
239870
|
-
};
|
|
239871
|
-
return await this.core.executeToolByName(name, inputs, executeOptions);
|
|
239872
|
-
}
|
|
239873
|
-
async executeRawTool(toolYaml, inputs = {}, options) {
|
|
239874
|
-
const executeOptions = {
|
|
239875
|
-
timeout: options?.timeout,
|
|
239876
|
-
force: options?.force,
|
|
239877
|
-
dryRun: options?.dryRun
|
|
239878
|
-
};
|
|
239879
|
-
return await this.core.executeRawTool(toolYaml, inputs, executeOptions);
|
|
239880
|
-
}
|
|
239881
|
-
async toolExists(name) {
|
|
239882
|
-
return await this.core.toolExists(name);
|
|
239883
|
-
}
|
|
239884
|
-
async getToolsByTags(tags, limit = 20) {
|
|
239885
|
-
return await this.core.getToolsByTags(tags, limit);
|
|
239886
|
-
}
|
|
239887
|
-
async getToolsByAuthor(author, limit = 20) {
|
|
239888
|
-
return await this.core.getToolsByAuthor(author, limit);
|
|
239889
|
-
}
|
|
239890
|
-
async getTools(options) {
|
|
239891
|
-
return await this.core.getTools(options);
|
|
239892
|
-
}
|
|
239893
|
-
async getAuthStatus() {
|
|
239894
|
-
return await this.core.getAuthStatus();
|
|
239895
|
-
}
|
|
239896
|
-
async isAvailable() {
|
|
239897
|
-
return true;
|
|
239898
|
-
}
|
|
239899
|
-
async getPathInfo() {
|
|
239900
|
-
return {
|
|
239901
|
-
detectedPath: "core-library",
|
|
239902
|
-
isAvailable: true,
|
|
239903
|
-
version: "2.0.0-core"
|
|
239904
|
-
};
|
|
239905
|
-
}
|
|
239906
|
-
async publishTool(tool) {
|
|
239907
|
-
return await this.core.publishTool(tool);
|
|
239908
|
-
}
|
|
239909
|
-
}
|
|
239910
|
-
var mcpCoreService = new McpCoreService;
|
|
239911
240018
|
// ../shared/dist/lib/enact-direct.js
|
|
239912
240019
|
class EnactDirect {
|
|
239913
240020
|
constructor(options = {}) {
|
|
239914
240021
|
this.core = new EnactCore({
|
|
239915
|
-
apiUrl: options.apiUrl || process.env.
|
|
239916
|
-
supabaseUrl: options.supabaseUrl || process.env.
|
|
240022
|
+
apiUrl: options.apiUrl || process.env.ENACT_FRONTEND_URL || "https://enact.tools",
|
|
240023
|
+
supabaseUrl: options.supabaseUrl || process.env.ENACT_API_URL || "https://xjnhhxwxovjifdxdwzih.supabase.co",
|
|
239917
240024
|
executionProvider: "direct",
|
|
239918
240025
|
authToken: options.authToken || process.env.ENACT_AUTH_TOKEN,
|
|
239919
240026
|
defaultTimeout: options.defaultTimeout || "30s"
|
|
239920
240027
|
});
|
|
239921
240028
|
}
|
|
240029
|
+
static async create(options = {}) {
|
|
240030
|
+
const frontendUrl = options.apiUrl || process.env.ENACT_FRONTEND_URL || await getFrontendUrl();
|
|
240031
|
+
const apiUrl = options.supabaseUrl || process.env.ENACT_API_URL || await getApiUrl();
|
|
240032
|
+
return new EnactDirect({
|
|
240033
|
+
...options,
|
|
240034
|
+
apiUrl: frontendUrl,
|
|
240035
|
+
supabaseUrl: apiUrl
|
|
240036
|
+
});
|
|
240037
|
+
}
|
|
239922
240038
|
async executeToolByName(name, inputs = {}, options = {}) {
|
|
239923
240039
|
return this.core.executeToolByName(name, inputs, options);
|
|
239924
240040
|
}
|
|
@@ -239970,8 +240086,8 @@ if (true) {
|
|
|
239970
240086
|
}
|
|
239971
240087
|
}
|
|
239972
240088
|
var enactCore = new EnactCore({
|
|
239973
|
-
apiUrl: process.env.
|
|
239974
|
-
supabaseUrl: process.env.
|
|
240089
|
+
apiUrl: process.env.ENACT_FRONTEND_URL || "https://enact.tools",
|
|
240090
|
+
supabaseUrl: process.env.ENACT_API_URL || "https://xjnhhxwxovjifdxdwzih.supabase.co",
|
|
239975
240091
|
executionProvider: process.env.ENACT_EXECUTION_PROVIDER || "dagger",
|
|
239976
240092
|
authToken: process.env.ENACT_AUTH_TOKEN,
|
|
239977
240093
|
defaultTimeout: "120s"
|
|
@@ -240071,7 +240187,8 @@ server2.registerTool("execute-tool-by-name", {
|
|
|
240071
240187
|
dryRun: exports_external.boolean().optional().describe("Dry run mode"),
|
|
240072
240188
|
verbose: exports_external.boolean().optional().describe("Verbose output"),
|
|
240073
240189
|
async: exports_external.boolean().optional().describe("Run in background for long operations"),
|
|
240074
|
-
forceRegistry: exports_external.boolean().optional().describe("Skip local resolution and go straight to registry")
|
|
240190
|
+
forceRegistry: exports_external.boolean().optional().describe("Skip local resolution and go straight to registry"),
|
|
240191
|
+
mount: exports_external.string().optional().describe("Mount local directory to container (format: 'localPath' or 'localPath:containerPath')")
|
|
240075
240192
|
}
|
|
240076
240193
|
}, async (params) => {
|
|
240077
240194
|
const {
|
|
@@ -240083,7 +240200,8 @@ server2.registerTool("execute-tool-by-name", {
|
|
|
240083
240200
|
dryRun,
|
|
240084
240201
|
verbose,
|
|
240085
240202
|
async = false,
|
|
240086
|
-
forceRegistry = false
|
|
240203
|
+
forceRegistry = false,
|
|
240204
|
+
mount
|
|
240087
240205
|
} = params;
|
|
240088
240206
|
try {
|
|
240089
240207
|
logger_default.info(`Executing tool: ${name} (localFile: ${localFile}, async: ${async})`);
|
|
@@ -240174,7 +240292,7 @@ ${suggestions.map((s2) => ` • ${s2}`).join(`
|
|
|
240174
240292
|
}
|
|
240175
240293
|
const isLongRunning = toolToExecute.name.includes("dagger") || toolToExecute.name.includes("docker") || toolToExecute.name.includes("build") || async;
|
|
240176
240294
|
if (isLongRunning) {
|
|
240177
|
-
const operationId = `${toolToExecute.name}-${Date.now()}-${Math.random().toString(36).
|
|
240295
|
+
const operationId = `${toolToExecute.name}-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
240178
240296
|
let executionPromise;
|
|
240179
240297
|
if (isLocalFile) {
|
|
240180
240298
|
const yamlContent = await import("fs/promises").then((fs6) => fs6.readFile(toolToExecute.path, "utf-8"));
|
|
@@ -240183,6 +240301,7 @@ ${suggestions.map((s2) => ` • ${s2}`).join(`
|
|
|
240183
240301
|
force: dangerouslySkipVerification || true,
|
|
240184
240302
|
dryRun,
|
|
240185
240303
|
verbose,
|
|
240304
|
+
mount,
|
|
240186
240305
|
isLocalFile: true
|
|
240187
240306
|
});
|
|
240188
240307
|
} else {
|
|
@@ -240191,6 +240310,7 @@ ${suggestions.map((s2) => ` • ${s2}`).join(`
|
|
|
240191
240310
|
force: dangerouslySkipVerification,
|
|
240192
240311
|
dryRun,
|
|
240193
240312
|
verbose,
|
|
240313
|
+
mount,
|
|
240194
240314
|
isLocalFile: false
|
|
240195
240315
|
});
|
|
240196
240316
|
}
|
|
@@ -240233,14 +240353,16 @@ Operation ID: ${operationId}
|
|
|
240233
240353
|
timeout: timeout3 || "120s",
|
|
240234
240354
|
force: dangerouslySkipVerification || true,
|
|
240235
240355
|
dryRun,
|
|
240236
|
-
verbose
|
|
240356
|
+
verbose,
|
|
240357
|
+
mount
|
|
240237
240358
|
});
|
|
240238
240359
|
} else {
|
|
240239
240360
|
result = await enactCore.executeToolByName(toolToExecute.name || name, inputs, {
|
|
240240
240361
|
timeout: timeout3 || "120s",
|
|
240241
240362
|
force: dangerouslySkipVerification,
|
|
240242
240363
|
dryRun,
|
|
240243
|
-
verbose
|
|
240364
|
+
verbose,
|
|
240365
|
+
mount
|
|
240244
240366
|
});
|
|
240245
240367
|
}
|
|
240246
240368
|
if (!result.success) {
|