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