@synergenius/flow-weaver 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +260 -200
- package/dist/cli/commands/docs.d.ts +11 -0
- package/dist/cli/commands/docs.js +77 -0
- package/dist/cli/flow-weaver.mjs +1077 -543
- package/dist/cli/index.js +51 -0
- package/dist/diagram/geometry.d.ts +9 -4
- package/dist/diagram/geometry.js +219 -30
- package/dist/diagram/renderer.js +137 -116
- package/dist/docs/index.d.ts +54 -0
- package/dist/docs/index.js +256 -0
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/tools-docs.d.ts +3 -0
- package/dist/mcp/tools-docs.js +62 -0
- package/dist/mcp/tools-editor.js +3 -1
- package/dist/mcp/tools-query.js +3 -1
- package/dist/mcp/workflow-executor.js +4 -2
- package/package.json +10 -4
package/dist/cli/flow-weaver.mjs
CHANGED
|
@@ -935,8 +935,8 @@ var require_command = __commonJS({
|
|
|
935
935
|
"node_modules/commander/lib/command.js"(exports2) {
|
|
936
936
|
var EventEmitter2 = __require("events").EventEmitter;
|
|
937
937
|
var childProcess = __require("child_process");
|
|
938
|
-
var
|
|
939
|
-
var
|
|
938
|
+
var path38 = __require("path");
|
|
939
|
+
var fs37 = __require("fs");
|
|
940
940
|
var process6 = __require("process");
|
|
941
941
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
942
942
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1759,10 +1759,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1759
1759
|
let launchWithNode = false;
|
|
1760
1760
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1761
1761
|
function findFile(baseDir, baseName) {
|
|
1762
|
-
const localBin =
|
|
1763
|
-
if (
|
|
1764
|
-
if (sourceExt.includes(
|
|
1765
|
-
const foundExt = sourceExt.find((ext2) =>
|
|
1762
|
+
const localBin = path38.resolve(baseDir, baseName);
|
|
1763
|
+
if (fs37.existsSync(localBin)) return localBin;
|
|
1764
|
+
if (sourceExt.includes(path38.extname(baseName))) return void 0;
|
|
1765
|
+
const foundExt = sourceExt.find((ext2) => fs37.existsSync(`${localBin}${ext2}`));
|
|
1766
1766
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1767
1767
|
return void 0;
|
|
1768
1768
|
}
|
|
@@ -1773,23 +1773,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1773
1773
|
if (this._scriptPath) {
|
|
1774
1774
|
let resolvedScriptPath;
|
|
1775
1775
|
try {
|
|
1776
|
-
resolvedScriptPath =
|
|
1776
|
+
resolvedScriptPath = fs37.realpathSync(this._scriptPath);
|
|
1777
1777
|
} catch (err) {
|
|
1778
1778
|
resolvedScriptPath = this._scriptPath;
|
|
1779
1779
|
}
|
|
1780
|
-
executableDir =
|
|
1780
|
+
executableDir = path38.resolve(path38.dirname(resolvedScriptPath), executableDir);
|
|
1781
1781
|
}
|
|
1782
1782
|
if (executableDir) {
|
|
1783
1783
|
let localFile = findFile(executableDir, executableFile);
|
|
1784
1784
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1785
|
-
const legacyName =
|
|
1785
|
+
const legacyName = path38.basename(this._scriptPath, path38.extname(this._scriptPath));
|
|
1786
1786
|
if (legacyName !== this._name) {
|
|
1787
1787
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
1790
|
executableFile = localFile || executableFile;
|
|
1791
1791
|
}
|
|
1792
|
-
launchWithNode = sourceExt.includes(
|
|
1792
|
+
launchWithNode = sourceExt.includes(path38.extname(executableFile));
|
|
1793
1793
|
let proc2;
|
|
1794
1794
|
if (process6.platform !== "win32") {
|
|
1795
1795
|
if (launchWithNode) {
|
|
@@ -2572,7 +2572,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2572
2572
|
* @return {Command}
|
|
2573
2573
|
*/
|
|
2574
2574
|
nameFromFilename(filename) {
|
|
2575
|
-
this._name =
|
|
2575
|
+
this._name = path38.basename(filename, path38.extname(filename));
|
|
2576
2576
|
return this;
|
|
2577
2577
|
}
|
|
2578
2578
|
/**
|
|
@@ -2586,9 +2586,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2586
2586
|
* @param {string} [path]
|
|
2587
2587
|
* @return {string|null|Command}
|
|
2588
2588
|
*/
|
|
2589
|
-
executableDir(
|
|
2590
|
-
if (
|
|
2591
|
-
this._executableDir =
|
|
2589
|
+
executableDir(path39) {
|
|
2590
|
+
if (path39 === void 0) return this._executableDir;
|
|
2591
|
+
this._executableDir = path39;
|
|
2592
2592
|
return this;
|
|
2593
2593
|
}
|
|
2594
2594
|
/**
|
|
@@ -6458,10 +6458,10 @@ var init_esm3 = __esm({
|
|
|
6458
6458
|
* Return a void Promise that resolves once the stream ends.
|
|
6459
6459
|
*/
|
|
6460
6460
|
async promise() {
|
|
6461
|
-
return new Promise((
|
|
6461
|
+
return new Promise((resolve27, reject2) => {
|
|
6462
6462
|
this.on(DESTROYED, () => reject2(new Error("stream destroyed")));
|
|
6463
6463
|
this.on("error", (er) => reject2(er));
|
|
6464
|
-
this.on("end", () =>
|
|
6464
|
+
this.on("end", () => resolve27());
|
|
6465
6465
|
});
|
|
6466
6466
|
}
|
|
6467
6467
|
/**
|
|
@@ -6485,7 +6485,7 @@ var init_esm3 = __esm({
|
|
|
6485
6485
|
return Promise.resolve({ done: false, value: res });
|
|
6486
6486
|
if (this[EOF])
|
|
6487
6487
|
return stop();
|
|
6488
|
-
let
|
|
6488
|
+
let resolve27;
|
|
6489
6489
|
let reject2;
|
|
6490
6490
|
const onerr = (er) => {
|
|
6491
6491
|
this.off("data", ondata);
|
|
@@ -6499,19 +6499,19 @@ var init_esm3 = __esm({
|
|
|
6499
6499
|
this.off("end", onend);
|
|
6500
6500
|
this.off(DESTROYED, ondestroy);
|
|
6501
6501
|
this.pause();
|
|
6502
|
-
|
|
6502
|
+
resolve27({ value: value2, done: !!this[EOF] });
|
|
6503
6503
|
};
|
|
6504
6504
|
const onend = () => {
|
|
6505
6505
|
this.off("error", onerr);
|
|
6506
6506
|
this.off("data", ondata);
|
|
6507
6507
|
this.off(DESTROYED, ondestroy);
|
|
6508
6508
|
stop();
|
|
6509
|
-
|
|
6509
|
+
resolve27({ done: true, value: void 0 });
|
|
6510
6510
|
};
|
|
6511
6511
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
6512
6512
|
return new Promise((res2, rej) => {
|
|
6513
6513
|
reject2 = rej;
|
|
6514
|
-
|
|
6514
|
+
resolve27 = res2;
|
|
6515
6515
|
this.once(DESTROYED, ondestroy);
|
|
6516
6516
|
this.once("error", onerr);
|
|
6517
6517
|
this.once("end", onend);
|
|
@@ -6886,12 +6886,12 @@ var init_esm4 = __esm({
|
|
|
6886
6886
|
/**
|
|
6887
6887
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
6888
6888
|
*/
|
|
6889
|
-
resolve(
|
|
6890
|
-
if (!
|
|
6889
|
+
resolve(path38) {
|
|
6890
|
+
if (!path38) {
|
|
6891
6891
|
return this;
|
|
6892
6892
|
}
|
|
6893
|
-
const rootPath = this.getRootString(
|
|
6894
|
-
const dir =
|
|
6893
|
+
const rootPath = this.getRootString(path38);
|
|
6894
|
+
const dir = path38.substring(rootPath.length);
|
|
6895
6895
|
const dirParts = dir.split(this.splitSep);
|
|
6896
6896
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
6897
6897
|
return result;
|
|
@@ -7495,9 +7495,9 @@ var init_esm4 = __esm({
|
|
|
7495
7495
|
if (this.#asyncReaddirInFlight) {
|
|
7496
7496
|
await this.#asyncReaddirInFlight;
|
|
7497
7497
|
} else {
|
|
7498
|
-
let
|
|
7498
|
+
let resolve27 = () => {
|
|
7499
7499
|
};
|
|
7500
|
-
this.#asyncReaddirInFlight = new Promise((res) =>
|
|
7500
|
+
this.#asyncReaddirInFlight = new Promise((res) => resolve27 = res);
|
|
7501
7501
|
try {
|
|
7502
7502
|
for (const e of await this.#fs.promises.readdir(fullpath, {
|
|
7503
7503
|
withFileTypes: true
|
|
@@ -7510,7 +7510,7 @@ var init_esm4 = __esm({
|
|
|
7510
7510
|
children.provisional = 0;
|
|
7511
7511
|
}
|
|
7512
7512
|
this.#asyncReaddirInFlight = void 0;
|
|
7513
|
-
|
|
7513
|
+
resolve27();
|
|
7514
7514
|
}
|
|
7515
7515
|
return children.slice(0, children.provisional);
|
|
7516
7516
|
}
|
|
@@ -7643,8 +7643,8 @@ var init_esm4 = __esm({
|
|
|
7643
7643
|
/**
|
|
7644
7644
|
* @internal
|
|
7645
7645
|
*/
|
|
7646
|
-
getRootString(
|
|
7647
|
-
return win32.parse(
|
|
7646
|
+
getRootString(path38) {
|
|
7647
|
+
return win32.parse(path38).root;
|
|
7648
7648
|
}
|
|
7649
7649
|
/**
|
|
7650
7650
|
* @internal
|
|
@@ -7690,8 +7690,8 @@ var init_esm4 = __esm({
|
|
|
7690
7690
|
/**
|
|
7691
7691
|
* @internal
|
|
7692
7692
|
*/
|
|
7693
|
-
getRootString(
|
|
7694
|
-
return
|
|
7693
|
+
getRootString(path38) {
|
|
7694
|
+
return path38.startsWith("/") ? "/" : "";
|
|
7695
7695
|
}
|
|
7696
7696
|
/**
|
|
7697
7697
|
* @internal
|
|
@@ -7740,8 +7740,8 @@ var init_esm4 = __esm({
|
|
|
7740
7740
|
*
|
|
7741
7741
|
* @internal
|
|
7742
7742
|
*/
|
|
7743
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
7744
|
-
this.#fs = fsFromOption(
|
|
7743
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs37 = defaultFS } = {}) {
|
|
7744
|
+
this.#fs = fsFromOption(fs37);
|
|
7745
7745
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
7746
7746
|
cwd = fileURLToPath(cwd);
|
|
7747
7747
|
}
|
|
@@ -7780,11 +7780,11 @@ var init_esm4 = __esm({
|
|
|
7780
7780
|
/**
|
|
7781
7781
|
* Get the depth of a provided path, string, or the cwd
|
|
7782
7782
|
*/
|
|
7783
|
-
depth(
|
|
7784
|
-
if (typeof
|
|
7785
|
-
|
|
7783
|
+
depth(path38 = this.cwd) {
|
|
7784
|
+
if (typeof path38 === "string") {
|
|
7785
|
+
path38 = this.cwd.resolve(path38);
|
|
7786
7786
|
}
|
|
7787
|
-
return
|
|
7787
|
+
return path38.depth();
|
|
7788
7788
|
}
|
|
7789
7789
|
/**
|
|
7790
7790
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -8271,9 +8271,9 @@ var init_esm4 = __esm({
|
|
|
8271
8271
|
process6();
|
|
8272
8272
|
return results;
|
|
8273
8273
|
}
|
|
8274
|
-
chdir(
|
|
8274
|
+
chdir(path38 = this.cwd) {
|
|
8275
8275
|
const oldCwd = this.cwd;
|
|
8276
|
-
this.cwd = typeof
|
|
8276
|
+
this.cwd = typeof path38 === "string" ? this.cwd.resolve(path38) : path38;
|
|
8277
8277
|
this.cwd[setAsCwd](oldCwd);
|
|
8278
8278
|
}
|
|
8279
8279
|
};
|
|
@@ -8299,8 +8299,8 @@ var init_esm4 = __esm({
|
|
|
8299
8299
|
/**
|
|
8300
8300
|
* @internal
|
|
8301
8301
|
*/
|
|
8302
|
-
newRoot(
|
|
8303
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8302
|
+
newRoot(fs37) {
|
|
8303
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs37 });
|
|
8304
8304
|
}
|
|
8305
8305
|
/**
|
|
8306
8306
|
* Return true if the provided path string is an absolute path
|
|
@@ -8328,8 +8328,8 @@ var init_esm4 = __esm({
|
|
|
8328
8328
|
/**
|
|
8329
8329
|
* @internal
|
|
8330
8330
|
*/
|
|
8331
|
-
newRoot(
|
|
8332
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8331
|
+
newRoot(fs37) {
|
|
8332
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs37 });
|
|
8333
8333
|
}
|
|
8334
8334
|
/**
|
|
8335
8335
|
* Return true if the provided path string is an absolute path
|
|
@@ -8648,8 +8648,8 @@ var init_processor = __esm({
|
|
|
8648
8648
|
}
|
|
8649
8649
|
// match, absolute, ifdir
|
|
8650
8650
|
entries() {
|
|
8651
|
-
return [...this.store.entries()].map(([
|
|
8652
|
-
|
|
8651
|
+
return [...this.store.entries()].map(([path38, n]) => [
|
|
8652
|
+
path38,
|
|
8653
8653
|
!!(n & 2),
|
|
8654
8654
|
!!(n & 1)
|
|
8655
8655
|
]);
|
|
@@ -8862,9 +8862,9 @@ var init_walker = __esm({
|
|
|
8862
8862
|
signal;
|
|
8863
8863
|
maxDepth;
|
|
8864
8864
|
includeChildMatches;
|
|
8865
|
-
constructor(patterns,
|
|
8865
|
+
constructor(patterns, path38, opts) {
|
|
8866
8866
|
this.patterns = patterns;
|
|
8867
|
-
this.path =
|
|
8867
|
+
this.path = path38;
|
|
8868
8868
|
this.opts = opts;
|
|
8869
8869
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
8870
8870
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -8883,11 +8883,11 @@ var init_walker = __esm({
|
|
|
8883
8883
|
});
|
|
8884
8884
|
}
|
|
8885
8885
|
}
|
|
8886
|
-
#ignored(
|
|
8887
|
-
return this.seen.has(
|
|
8886
|
+
#ignored(path38) {
|
|
8887
|
+
return this.seen.has(path38) || !!this.#ignore?.ignored?.(path38);
|
|
8888
8888
|
}
|
|
8889
|
-
#childrenIgnored(
|
|
8890
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
8889
|
+
#childrenIgnored(path38) {
|
|
8890
|
+
return !!this.#ignore?.childrenIgnored?.(path38);
|
|
8891
8891
|
}
|
|
8892
8892
|
// backpressure mechanism
|
|
8893
8893
|
pause() {
|
|
@@ -9102,8 +9102,8 @@ var init_walker = __esm({
|
|
|
9102
9102
|
};
|
|
9103
9103
|
GlobWalker = class extends GlobUtil {
|
|
9104
9104
|
matches = /* @__PURE__ */ new Set();
|
|
9105
|
-
constructor(patterns,
|
|
9106
|
-
super(patterns,
|
|
9105
|
+
constructor(patterns, path38, opts) {
|
|
9106
|
+
super(patterns, path38, opts);
|
|
9107
9107
|
}
|
|
9108
9108
|
matchEmit(e) {
|
|
9109
9109
|
this.matches.add(e);
|
|
@@ -9140,8 +9140,8 @@ var init_walker = __esm({
|
|
|
9140
9140
|
};
|
|
9141
9141
|
GlobStream = class extends GlobUtil {
|
|
9142
9142
|
results;
|
|
9143
|
-
constructor(patterns,
|
|
9144
|
-
super(patterns,
|
|
9143
|
+
constructor(patterns, path38, opts) {
|
|
9144
|
+
super(patterns, path38, opts);
|
|
9145
9145
|
this.results = new Minipass({
|
|
9146
9146
|
signal: this.signal,
|
|
9147
9147
|
objectMode: true
|
|
@@ -9741,7 +9741,7 @@ var require_util = __commonJS({
|
|
|
9741
9741
|
var normalize2 = createSafeHandler((url2) => {
|
|
9742
9742
|
});
|
|
9743
9743
|
exports2.normalize = normalize2;
|
|
9744
|
-
function
|
|
9744
|
+
function join21(aRoot, aPath) {
|
|
9745
9745
|
const pathType = getURLType(aPath);
|
|
9746
9746
|
const rootType = getURLType(aRoot);
|
|
9747
9747
|
aRoot = ensureDirectory(aRoot);
|
|
@@ -9771,7 +9771,7 @@ var require_util = __commonJS({
|
|
|
9771
9771
|
const newPath = withBase(aPath, withBase(aRoot, base));
|
|
9772
9772
|
return computeRelativeURL(base, newPath);
|
|
9773
9773
|
}
|
|
9774
|
-
exports2.join =
|
|
9774
|
+
exports2.join = join21;
|
|
9775
9775
|
function relative5(rootURL, targetURL) {
|
|
9776
9776
|
const result = relativeIfPossible(rootURL, targetURL);
|
|
9777
9777
|
return typeof result === "string" ? result : normalize2(targetURL);
|
|
@@ -9800,8 +9800,8 @@ var require_util = __commonJS({
|
|
|
9800
9800
|
sourceURL = sourceURL.replace(/^\//, "");
|
|
9801
9801
|
}
|
|
9802
9802
|
let url2 = normalize2(sourceURL || "");
|
|
9803
|
-
if (sourceRoot) url2 =
|
|
9804
|
-
if (sourceMapURL) url2 =
|
|
9803
|
+
if (sourceRoot) url2 = join21(sourceRoot, url2);
|
|
9804
|
+
if (sourceMapURL) url2 = join21(trimFilename(sourceMapURL), url2);
|
|
9805
9805
|
return url2;
|
|
9806
9806
|
}
|
|
9807
9807
|
exports2.computeSourceURL = computeSourceURL;
|
|
@@ -10352,17 +10352,17 @@ var require_binary_search = __commonJS({
|
|
|
10352
10352
|
var require_read_wasm = __commonJS({
|
|
10353
10353
|
"node_modules/source-map/lib/read-wasm.js"(exports2, module2) {
|
|
10354
10354
|
"use strict";
|
|
10355
|
-
var
|
|
10356
|
-
var
|
|
10355
|
+
var fs37 = __require("fs");
|
|
10356
|
+
var path38 = __require("path");
|
|
10357
10357
|
module2.exports = function readWasm() {
|
|
10358
|
-
return new Promise((
|
|
10359
|
-
const wasmPath =
|
|
10360
|
-
|
|
10358
|
+
return new Promise((resolve27, reject2) => {
|
|
10359
|
+
const wasmPath = path38.join(__dirname, "mappings.wasm");
|
|
10360
|
+
fs37.readFile(wasmPath, null, (error2, data) => {
|
|
10361
10361
|
if (error2) {
|
|
10362
10362
|
reject2(error2);
|
|
10363
10363
|
return;
|
|
10364
10364
|
}
|
|
10365
|
-
|
|
10365
|
+
resolve27(data.buffer);
|
|
10366
10366
|
});
|
|
10367
10367
|
});
|
|
10368
10368
|
};
|
|
@@ -12506,13 +12506,13 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
|
|
|
12506
12506
|
connections.filter((c) => c.from.node === c.to.node).map((c) => c.from.node)
|
|
12507
12507
|
);
|
|
12508
12508
|
const nonSelfLoopConnections = connections.filter((c) => c.from.node !== c.to.node);
|
|
12509
|
-
const dfs = (nodeName,
|
|
12509
|
+
const dfs = (nodeName, path38) => {
|
|
12510
12510
|
if (recursionStack.has(nodeName)) {
|
|
12511
12511
|
if (selfLoopNodes.has(nodeName)) {
|
|
12512
12512
|
return false;
|
|
12513
12513
|
}
|
|
12514
|
-
const cycleStart =
|
|
12515
|
-
const cyclePath = [...
|
|
12514
|
+
const cycleStart = path38.indexOf(nodeName);
|
|
12515
|
+
const cyclePath = [...path38.slice(cycleStart), nodeName];
|
|
12516
12516
|
const cycleNodes = cyclePath.slice(0, -1);
|
|
12517
12517
|
const sortedCycle = [...cycleNodes].sort();
|
|
12518
12518
|
const cycleKey = sortedCycle.join(",");
|
|
@@ -12534,7 +12534,7 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
|
|
|
12534
12534
|
return false;
|
|
12535
12535
|
}
|
|
12536
12536
|
recursionStack.add(nodeName);
|
|
12537
|
-
const newPath = [...
|
|
12537
|
+
const newPath = [...path38, nodeName];
|
|
12538
12538
|
const instance = instances.find((n) => n.id === nodeName);
|
|
12539
12539
|
if (!instance) {
|
|
12540
12540
|
recursionStack.delete(nodeName);
|
|
@@ -14515,15 +14515,15 @@ var require_route = __commonJS({
|
|
|
14515
14515
|
};
|
|
14516
14516
|
}
|
|
14517
14517
|
function wrapConversion(toModel, graph) {
|
|
14518
|
-
const
|
|
14518
|
+
const path38 = [graph[toModel].parent, toModel];
|
|
14519
14519
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
14520
14520
|
let cur = graph[toModel].parent;
|
|
14521
14521
|
while (graph[cur].parent) {
|
|
14522
|
-
|
|
14522
|
+
path38.unshift(graph[cur].parent);
|
|
14523
14523
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
14524
14524
|
cur = graph[cur].parent;
|
|
14525
14525
|
}
|
|
14526
|
-
fn.conversion =
|
|
14526
|
+
fn.conversion = path38;
|
|
14527
14527
|
return fn;
|
|
14528
14528
|
}
|
|
14529
14529
|
module2.exports = function(fromModel) {
|
|
@@ -15004,7 +15004,7 @@ var require_lib4 = __commonJS({
|
|
|
15004
15004
|
// node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js
|
|
15005
15005
|
var require_XMLHttpRequest = __commonJS({
|
|
15006
15006
|
"node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js"(exports2, module2) {
|
|
15007
|
-
var
|
|
15007
|
+
var fs37 = __require("fs");
|
|
15008
15008
|
var Url = __require("url");
|
|
15009
15009
|
var spawn2 = __require("child_process").spawn;
|
|
15010
15010
|
module2.exports = XMLHttpRequest3;
|
|
@@ -15162,7 +15162,7 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
15162
15162
|
throw new Error("XMLHttpRequest: Only GET method is supported");
|
|
15163
15163
|
}
|
|
15164
15164
|
if (settings.async) {
|
|
15165
|
-
|
|
15165
|
+
fs37.readFile(unescape(url2.pathname), function(error2, data2) {
|
|
15166
15166
|
if (error2) {
|
|
15167
15167
|
self2.handleError(error2, error2.errno || -1);
|
|
15168
15168
|
} else {
|
|
@@ -15174,7 +15174,7 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
15174
15174
|
});
|
|
15175
15175
|
} else {
|
|
15176
15176
|
try {
|
|
15177
|
-
this.response =
|
|
15177
|
+
this.response = fs37.readFileSync(unescape(url2.pathname));
|
|
15178
15178
|
this.responseText = this.response.toString("utf8");
|
|
15179
15179
|
this.status = 200;
|
|
15180
15180
|
setState(self2.DONE);
|
|
@@ -15300,15 +15300,15 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
15300
15300
|
} else {
|
|
15301
15301
|
var contentFile = ".node-xmlhttprequest-content-" + process.pid;
|
|
15302
15302
|
var syncFile = ".node-xmlhttprequest-sync-" + process.pid;
|
|
15303
|
-
|
|
15303
|
+
fs37.writeFileSync(syncFile, "", "utf8");
|
|
15304
15304
|
var execString = "var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http" + (ssl ? "s" : "") + ".request;var options = " + JSON.stringify(options) + ";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('" + syncFile + "');});response.on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});}).on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});" + (data ? "req.write('" + JSON.stringify(data).slice(1, -1).replace(/'/g, "\\'") + "');" : "") + "req.end();";
|
|
15305
15305
|
var syncProc = spawn2(process.argv[0], ["-e", execString]);
|
|
15306
15306
|
var statusText;
|
|
15307
|
-
while (
|
|
15307
|
+
while (fs37.existsSync(syncFile)) {
|
|
15308
15308
|
}
|
|
15309
|
-
self2.responseText =
|
|
15309
|
+
self2.responseText = fs37.readFileSync(contentFile, "utf8");
|
|
15310
15310
|
syncProc.stdin.end();
|
|
15311
|
-
|
|
15311
|
+
fs37.unlinkSync(contentFile);
|
|
15312
15312
|
if (self2.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)) {
|
|
15313
15313
|
var errorObj = JSON.parse(self2.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/, ""));
|
|
15314
15314
|
self2.handleError(errorObj, 503);
|
|
@@ -22688,7 +22688,7 @@ var require_compile = __commonJS({
|
|
|
22688
22688
|
const schOrFunc = root2.refs[ref];
|
|
22689
22689
|
if (schOrFunc)
|
|
22690
22690
|
return schOrFunc;
|
|
22691
|
-
let _sch =
|
|
22691
|
+
let _sch = resolve27.call(this, root2, ref);
|
|
22692
22692
|
if (_sch === void 0) {
|
|
22693
22693
|
const schema2 = (_a = root2.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
22694
22694
|
const { schemaId } = this.opts;
|
|
@@ -22715,7 +22715,7 @@ var require_compile = __commonJS({
|
|
|
22715
22715
|
function sameSchemaEnv(s1, s2) {
|
|
22716
22716
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
22717
22717
|
}
|
|
22718
|
-
function
|
|
22718
|
+
function resolve27(root2, ref) {
|
|
22719
22719
|
let sch;
|
|
22720
22720
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
22721
22721
|
ref = sch;
|
|
@@ -22930,8 +22930,8 @@ var require_utils = __commonJS({
|
|
|
22930
22930
|
}
|
|
22931
22931
|
return ind;
|
|
22932
22932
|
}
|
|
22933
|
-
function removeDotSegments(
|
|
22934
|
-
let input =
|
|
22933
|
+
function removeDotSegments(path38) {
|
|
22934
|
+
let input = path38;
|
|
22935
22935
|
const output = [];
|
|
22936
22936
|
let nextSlash = -1;
|
|
22937
22937
|
let len = 0;
|
|
@@ -23130,8 +23130,8 @@ var require_schemes = __commonJS({
|
|
|
23130
23130
|
wsComponent.secure = void 0;
|
|
23131
23131
|
}
|
|
23132
23132
|
if (wsComponent.resourceName) {
|
|
23133
|
-
const [
|
|
23134
|
-
wsComponent.path =
|
|
23133
|
+
const [path38, query] = wsComponent.resourceName.split("?");
|
|
23134
|
+
wsComponent.path = path38 && path38 !== "/" ? path38 : void 0;
|
|
23135
23135
|
wsComponent.query = query;
|
|
23136
23136
|
wsComponent.resourceName = void 0;
|
|
23137
23137
|
}
|
|
@@ -23290,7 +23290,7 @@ var require_fast_uri = __commonJS({
|
|
|
23290
23290
|
}
|
|
23291
23291
|
return uri;
|
|
23292
23292
|
}
|
|
23293
|
-
function
|
|
23293
|
+
function resolve27(baseURI, relativeURI, options) {
|
|
23294
23294
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
23295
23295
|
const resolved = resolveComponent(parse7(baseURI, schemelessOptions), parse7(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
23296
23296
|
schemelessOptions.skipEscape = true;
|
|
@@ -23517,7 +23517,7 @@ var require_fast_uri = __commonJS({
|
|
|
23517
23517
|
var fastUri = {
|
|
23518
23518
|
SCHEMES,
|
|
23519
23519
|
normalize: normalize2,
|
|
23520
|
-
resolve:
|
|
23520
|
+
resolve: resolve27,
|
|
23521
23521
|
resolveComponent,
|
|
23522
23522
|
equal,
|
|
23523
23523
|
serialize,
|
|
@@ -26493,12 +26493,12 @@ var require_dist = __commonJS({
|
|
|
26493
26493
|
throw new Error(`Unknown format "${name}"`);
|
|
26494
26494
|
return f;
|
|
26495
26495
|
};
|
|
26496
|
-
function addFormats(ajv, list,
|
|
26496
|
+
function addFormats(ajv, list, fs37, exportName) {
|
|
26497
26497
|
var _a;
|
|
26498
26498
|
var _b;
|
|
26499
26499
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
26500
26500
|
for (const f of list)
|
|
26501
|
-
ajv.addFormat(f,
|
|
26501
|
+
ajv.addFormat(f, fs37[f]);
|
|
26502
26502
|
}
|
|
26503
26503
|
module2.exports = exports2 = formatsPlugin;
|
|
26504
26504
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -29945,9 +29945,9 @@ function shouldUseStepTag(portName, port) {
|
|
|
29945
29945
|
|
|
29946
29946
|
// src/sugar-optimizer.ts
|
|
29947
29947
|
init_constants();
|
|
29948
|
-
function validatePathMacro(
|
|
29948
|
+
function validatePathMacro(path38, connections, instances) {
|
|
29949
29949
|
const instanceIds = new Set(instances.map((inst) => inst.id));
|
|
29950
|
-
for (const step of
|
|
29950
|
+
for (const step of path38.steps) {
|
|
29951
29951
|
if (step.node === "Start" || step.node === "Exit") continue;
|
|
29952
29952
|
if (!instanceIds.has(step.node)) return false;
|
|
29953
29953
|
}
|
|
@@ -29957,9 +29957,9 @@ function validatePathMacro(path37, connections, instances) {
|
|
|
29957
29957
|
connKeys.add(`${conn.from.node}.${conn.from.port}->${conn.to.node}.${conn.to.port}`);
|
|
29958
29958
|
}
|
|
29959
29959
|
}
|
|
29960
|
-
for (let i = 0; i <
|
|
29961
|
-
const current2 =
|
|
29962
|
-
const next =
|
|
29960
|
+
for (let i = 0; i < path38.steps.length - 1; i++) {
|
|
29961
|
+
const current2 = path38.steps[i];
|
|
29962
|
+
const next = path38.steps[i + 1];
|
|
29963
29963
|
const route = current2.route || "ok";
|
|
29964
29964
|
let expectedKey;
|
|
29965
29965
|
if (current2.node === "Start") {
|
|
@@ -30052,12 +30052,12 @@ function detectSugarPatterns(connections, instances, existingMacros, nodeTypes,
|
|
|
30052
30052
|
}
|
|
30053
30053
|
const candidateRoutes = [];
|
|
30054
30054
|
const MAX_ROUTES = 20;
|
|
30055
|
-
function dfs(node,
|
|
30055
|
+
function dfs(node, path38, visited) {
|
|
30056
30056
|
if (candidateRoutes.length >= MAX_ROUTES) return;
|
|
30057
30057
|
if (node === "Exit") {
|
|
30058
|
-
|
|
30059
|
-
candidateRoutes.push([...
|
|
30060
|
-
|
|
30058
|
+
path38.push({ node: "Exit" });
|
|
30059
|
+
candidateRoutes.push([...path38]);
|
|
30060
|
+
path38.pop();
|
|
30061
30061
|
return;
|
|
30062
30062
|
}
|
|
30063
30063
|
if (visited.has(node)) return;
|
|
@@ -30069,15 +30069,15 @@ function detectSugarPatterns(connections, instances, existingMacros, nodeTypes,
|
|
|
30069
30069
|
}
|
|
30070
30070
|
if (edges.ok && !coveredByExistingMacro.has(edges.ok === "Exit" ? "" : edges.ok)) {
|
|
30071
30071
|
const step = node === "Start" ? { node: "Start" } : { node };
|
|
30072
|
-
|
|
30073
|
-
dfs(edges.ok,
|
|
30074
|
-
|
|
30072
|
+
path38.push(step);
|
|
30073
|
+
dfs(edges.ok, path38, visited);
|
|
30074
|
+
path38.pop();
|
|
30075
30075
|
}
|
|
30076
30076
|
if (edges.fail && !coveredByExistingMacro.has(edges.fail === "Exit" ? "" : edges.fail)) {
|
|
30077
30077
|
const step = { node, route: "fail" };
|
|
30078
|
-
|
|
30079
|
-
dfs(edges.fail,
|
|
30080
|
-
|
|
30078
|
+
path38.push(step);
|
|
30079
|
+
dfs(edges.fail, path38, visited);
|
|
30080
|
+
path38.pop();
|
|
30081
30081
|
}
|
|
30082
30082
|
visited.delete(node);
|
|
30083
30083
|
}
|
|
@@ -32812,19 +32812,19 @@ function toKey(value2) {
|
|
|
32812
32812
|
var toKey_default = toKey;
|
|
32813
32813
|
|
|
32814
32814
|
// node_modules/lodash-es/_baseGet.js
|
|
32815
|
-
function baseGet(object3,
|
|
32816
|
-
|
|
32817
|
-
var index = 0, length =
|
|
32815
|
+
function baseGet(object3, path38) {
|
|
32816
|
+
path38 = castPath_default(path38, object3);
|
|
32817
|
+
var index = 0, length = path38.length;
|
|
32818
32818
|
while (object3 != null && index < length) {
|
|
32819
|
-
object3 = object3[toKey_default(
|
|
32819
|
+
object3 = object3[toKey_default(path38[index++])];
|
|
32820
32820
|
}
|
|
32821
32821
|
return index && index == length ? object3 : void 0;
|
|
32822
32822
|
}
|
|
32823
32823
|
var baseGet_default = baseGet;
|
|
32824
32824
|
|
|
32825
32825
|
// node_modules/lodash-es/get.js
|
|
32826
|
-
function get(object3,
|
|
32827
|
-
var result = object3 == null ? void 0 : baseGet_default(object3,
|
|
32826
|
+
function get(object3, path38, defaultValue) {
|
|
32827
|
+
var result = object3 == null ? void 0 : baseGet_default(object3, path38);
|
|
32828
32828
|
return result === void 0 ? defaultValue : result;
|
|
32829
32829
|
}
|
|
32830
32830
|
var get_default = get;
|
|
@@ -33736,11 +33736,11 @@ function baseHasIn(object3, key) {
|
|
|
33736
33736
|
var baseHasIn_default = baseHasIn;
|
|
33737
33737
|
|
|
33738
33738
|
// node_modules/lodash-es/_hasPath.js
|
|
33739
|
-
function hasPath(object3,
|
|
33740
|
-
|
|
33741
|
-
var index = -1, length =
|
|
33739
|
+
function hasPath(object3, path38, hasFunc) {
|
|
33740
|
+
path38 = castPath_default(path38, object3);
|
|
33741
|
+
var index = -1, length = path38.length, result = false;
|
|
33742
33742
|
while (++index < length) {
|
|
33743
|
-
var key = toKey_default(
|
|
33743
|
+
var key = toKey_default(path38[index]);
|
|
33744
33744
|
if (!(result = object3 != null && hasFunc(object3, key))) {
|
|
33745
33745
|
break;
|
|
33746
33746
|
}
|
|
@@ -33755,21 +33755,21 @@ function hasPath(object3, path37, hasFunc) {
|
|
|
33755
33755
|
var hasPath_default = hasPath;
|
|
33756
33756
|
|
|
33757
33757
|
// node_modules/lodash-es/hasIn.js
|
|
33758
|
-
function hasIn(object3,
|
|
33759
|
-
return object3 != null && hasPath_default(object3,
|
|
33758
|
+
function hasIn(object3, path38) {
|
|
33759
|
+
return object3 != null && hasPath_default(object3, path38, baseHasIn_default);
|
|
33760
33760
|
}
|
|
33761
33761
|
var hasIn_default = hasIn;
|
|
33762
33762
|
|
|
33763
33763
|
// node_modules/lodash-es/_baseMatchesProperty.js
|
|
33764
33764
|
var COMPARE_PARTIAL_FLAG6 = 1;
|
|
33765
33765
|
var COMPARE_UNORDERED_FLAG4 = 2;
|
|
33766
|
-
function baseMatchesProperty(
|
|
33767
|
-
if (isKey_default(
|
|
33768
|
-
return matchesStrictComparable_default(toKey_default(
|
|
33766
|
+
function baseMatchesProperty(path38, srcValue) {
|
|
33767
|
+
if (isKey_default(path38) && isStrictComparable_default(srcValue)) {
|
|
33768
|
+
return matchesStrictComparable_default(toKey_default(path38), srcValue);
|
|
33769
33769
|
}
|
|
33770
33770
|
return function(object3) {
|
|
33771
|
-
var objValue = get_default(object3,
|
|
33772
|
-
return objValue === void 0 && objValue === srcValue ? hasIn_default(object3,
|
|
33771
|
+
var objValue = get_default(object3, path38);
|
|
33772
|
+
return objValue === void 0 && objValue === srcValue ? hasIn_default(object3, path38) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
|
|
33773
33773
|
};
|
|
33774
33774
|
}
|
|
33775
33775
|
var baseMatchesProperty_default = baseMatchesProperty;
|
|
@@ -33783,16 +33783,16 @@ function baseProperty(key) {
|
|
|
33783
33783
|
var baseProperty_default = baseProperty;
|
|
33784
33784
|
|
|
33785
33785
|
// node_modules/lodash-es/_basePropertyDeep.js
|
|
33786
|
-
function basePropertyDeep(
|
|
33786
|
+
function basePropertyDeep(path38) {
|
|
33787
33787
|
return function(object3) {
|
|
33788
|
-
return baseGet_default(object3,
|
|
33788
|
+
return baseGet_default(object3, path38);
|
|
33789
33789
|
};
|
|
33790
33790
|
}
|
|
33791
33791
|
var basePropertyDeep_default = basePropertyDeep;
|
|
33792
33792
|
|
|
33793
33793
|
// node_modules/lodash-es/property.js
|
|
33794
|
-
function property(
|
|
33795
|
-
return isKey_default(
|
|
33794
|
+
function property(path38) {
|
|
33795
|
+
return isKey_default(path38) ? baseProperty_default(toKey_default(path38)) : basePropertyDeep_default(path38);
|
|
33796
33796
|
}
|
|
33797
33797
|
var property_default = property;
|
|
33798
33798
|
|
|
@@ -34160,8 +34160,8 @@ function baseHas(object3, key) {
|
|
|
34160
34160
|
var baseHas_default = baseHas;
|
|
34161
34161
|
|
|
34162
34162
|
// node_modules/lodash-es/has.js
|
|
34163
|
-
function has(object3,
|
|
34164
|
-
return object3 != null && hasPath_default(object3,
|
|
34163
|
+
function has(object3, path38) {
|
|
34164
|
+
return object3 != null && hasPath_default(object3, path38, baseHas_default);
|
|
34165
34165
|
}
|
|
34166
34166
|
var has_default = has;
|
|
34167
34167
|
|
|
@@ -34284,14 +34284,14 @@ function negate(predicate) {
|
|
|
34284
34284
|
var negate_default = negate;
|
|
34285
34285
|
|
|
34286
34286
|
// node_modules/lodash-es/_baseSet.js
|
|
34287
|
-
function baseSet(object3,
|
|
34287
|
+
function baseSet(object3, path38, value2, customizer) {
|
|
34288
34288
|
if (!isObject_default(object3)) {
|
|
34289
34289
|
return object3;
|
|
34290
34290
|
}
|
|
34291
|
-
|
|
34292
|
-
var index = -1, length =
|
|
34291
|
+
path38 = castPath_default(path38, object3);
|
|
34292
|
+
var index = -1, length = path38.length, lastIndex = length - 1, nested = object3;
|
|
34293
34293
|
while (nested != null && ++index < length) {
|
|
34294
|
-
var key = toKey_default(
|
|
34294
|
+
var key = toKey_default(path38[index]), newValue = value2;
|
|
34295
34295
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
34296
34296
|
return object3;
|
|
34297
34297
|
}
|
|
@@ -34299,7 +34299,7 @@ function baseSet(object3, path37, value2, customizer) {
|
|
|
34299
34299
|
var objValue = nested[key];
|
|
34300
34300
|
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
34301
34301
|
if (newValue === void 0) {
|
|
34302
|
-
newValue = isObject_default(objValue) ? objValue : isIndex_default(
|
|
34302
|
+
newValue = isObject_default(objValue) ? objValue : isIndex_default(path38[index + 1]) ? [] : {};
|
|
34303
34303
|
}
|
|
34304
34304
|
}
|
|
34305
34305
|
assignValue_default(nested, key, newValue);
|
|
@@ -34313,9 +34313,9 @@ var baseSet_default = baseSet;
|
|
|
34313
34313
|
function basePickBy(object3, paths, predicate) {
|
|
34314
34314
|
var index = -1, length = paths.length, result = {};
|
|
34315
34315
|
while (++index < length) {
|
|
34316
|
-
var
|
|
34317
|
-
if (predicate(value2,
|
|
34318
|
-
baseSet_default(result, castPath_default(
|
|
34316
|
+
var path38 = paths[index], value2 = baseGet_default(object3, path38);
|
|
34317
|
+
if (predicate(value2, path38)) {
|
|
34318
|
+
baseSet_default(result, castPath_default(path38, object3), value2);
|
|
34319
34319
|
}
|
|
34320
34320
|
}
|
|
34321
34321
|
return result;
|
|
@@ -34331,8 +34331,8 @@ function pickBy(object3, predicate) {
|
|
|
34331
34331
|
return [prop];
|
|
34332
34332
|
});
|
|
34333
34333
|
predicate = baseIteratee_default(predicate);
|
|
34334
|
-
return basePickBy_default(object3, props, function(value2,
|
|
34335
|
-
return predicate(value2,
|
|
34334
|
+
return basePickBy_default(object3, props, function(value2, path38) {
|
|
34335
|
+
return predicate(value2, path38[0]);
|
|
34336
34336
|
});
|
|
34337
34337
|
}
|
|
34338
34338
|
var pickBy_default = pickBy;
|
|
@@ -36831,12 +36831,12 @@ function assignCategoriesMapProp(tokenTypes) {
|
|
|
36831
36831
|
singleAssignCategoriesToksMap([], currTokType);
|
|
36832
36832
|
});
|
|
36833
36833
|
}
|
|
36834
|
-
function singleAssignCategoriesToksMap(
|
|
36835
|
-
forEach_default(
|
|
36834
|
+
function singleAssignCategoriesToksMap(path38, nextNode) {
|
|
36835
|
+
forEach_default(path38, (pathNode) => {
|
|
36836
36836
|
nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
|
|
36837
36837
|
});
|
|
36838
36838
|
forEach_default(nextNode.CATEGORIES, (nextCategory) => {
|
|
36839
|
-
const newPath =
|
|
36839
|
+
const newPath = path38.concat(nextNode);
|
|
36840
36840
|
if (!includes_default(newPath, nextCategory)) {
|
|
36841
36841
|
singleAssignCategoriesToksMap(newPath, nextCategory);
|
|
36842
36842
|
}
|
|
@@ -37680,10 +37680,10 @@ var GastRefResolverVisitor = class extends GAstVisitor {
|
|
|
37680
37680
|
|
|
37681
37681
|
// node_modules/chevrotain/lib/src/parse/grammar/interpreter.js
|
|
37682
37682
|
var AbstractNextPossibleTokensWalker = class extends RestWalker {
|
|
37683
|
-
constructor(topProd,
|
|
37683
|
+
constructor(topProd, path38) {
|
|
37684
37684
|
super();
|
|
37685
37685
|
this.topProd = topProd;
|
|
37686
|
-
this.path =
|
|
37686
|
+
this.path = path38;
|
|
37687
37687
|
this.possibleTokTypes = [];
|
|
37688
37688
|
this.nextProductionName = "";
|
|
37689
37689
|
this.nextProductionOccurrence = 0;
|
|
@@ -37727,9 +37727,9 @@ var AbstractNextPossibleTokensWalker = class extends RestWalker {
|
|
|
37727
37727
|
}
|
|
37728
37728
|
};
|
|
37729
37729
|
var NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker {
|
|
37730
|
-
constructor(topProd,
|
|
37731
|
-
super(topProd,
|
|
37732
|
-
this.path =
|
|
37730
|
+
constructor(topProd, path38) {
|
|
37731
|
+
super(topProd, path38);
|
|
37732
|
+
this.path = path38;
|
|
37733
37733
|
this.nextTerminalName = "";
|
|
37734
37734
|
this.nextTerminalOccurrence = 0;
|
|
37735
37735
|
this.nextTerminalName = this.path.lastTok.name;
|
|
@@ -38325,10 +38325,10 @@ function initializeArrayOfArrays(size) {
|
|
|
38325
38325
|
}
|
|
38326
38326
|
return result;
|
|
38327
38327
|
}
|
|
38328
|
-
function pathToHashKeys(
|
|
38328
|
+
function pathToHashKeys(path38) {
|
|
38329
38329
|
let keys2 = [""];
|
|
38330
|
-
for (let i = 0; i <
|
|
38331
|
-
const tokType =
|
|
38330
|
+
for (let i = 0; i < path38.length; i++) {
|
|
38331
|
+
const tokType = path38[i];
|
|
38332
38332
|
const longerKeys = [];
|
|
38333
38333
|
for (let j = 0; j < keys2.length; j++) {
|
|
38334
38334
|
const currShorterKey = keys2[j];
|
|
@@ -38567,7 +38567,7 @@ function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
|
|
|
38567
38567
|
}
|
|
38568
38568
|
return errors2;
|
|
38569
38569
|
}
|
|
38570
|
-
function validateNoLeftRecursion(topRule, currRule, errMsgProvider,
|
|
38570
|
+
function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path38 = []) {
|
|
38571
38571
|
const errors2 = [];
|
|
38572
38572
|
const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
|
|
38573
38573
|
if (isEmpty_default(nextNonTerminals)) {
|
|
@@ -38579,15 +38579,15 @@ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path37 = [])
|
|
|
38579
38579
|
errors2.push({
|
|
38580
38580
|
message: errMsgProvider.buildLeftRecursionError({
|
|
38581
38581
|
topLevelRule: topRule,
|
|
38582
|
-
leftRecursionPath:
|
|
38582
|
+
leftRecursionPath: path38
|
|
38583
38583
|
}),
|
|
38584
38584
|
type: ParserDefinitionErrorType.LEFT_RECURSION,
|
|
38585
38585
|
ruleName
|
|
38586
38586
|
});
|
|
38587
38587
|
}
|
|
38588
|
-
const validNextSteps = difference_default(nextNonTerminals,
|
|
38588
|
+
const validNextSteps = difference_default(nextNonTerminals, path38.concat([topRule]));
|
|
38589
38589
|
const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => {
|
|
38590
|
-
const newPath = clone_default(
|
|
38590
|
+
const newPath = clone_default(path38);
|
|
38591
38591
|
newPath.push(currRefRule);
|
|
38592
38592
|
return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
|
|
38593
38593
|
});
|
|
@@ -46201,7 +46201,7 @@ function processResult(result, scope) {
|
|
|
46201
46201
|
}
|
|
46202
46202
|
return result !== NOTHING ? result : void 0;
|
|
46203
46203
|
}
|
|
46204
|
-
function finalize(rootScope, value2,
|
|
46204
|
+
function finalize(rootScope, value2, path38) {
|
|
46205
46205
|
if (isFrozen(value2))
|
|
46206
46206
|
return value2;
|
|
46207
46207
|
const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
|
|
@@ -46209,7 +46209,7 @@ function finalize(rootScope, value2, path37) {
|
|
|
46209
46209
|
if (!state) {
|
|
46210
46210
|
each(
|
|
46211
46211
|
value2,
|
|
46212
|
-
(key, childValue) => finalizeProperty(rootScope, state, value2, key, childValue,
|
|
46212
|
+
(key, childValue) => finalizeProperty(rootScope, state, value2, key, childValue, path38),
|
|
46213
46213
|
useStrictIteration
|
|
46214
46214
|
);
|
|
46215
46215
|
return value2;
|
|
@@ -46239,16 +46239,16 @@ function finalize(rootScope, value2, path37) {
|
|
|
46239
46239
|
result,
|
|
46240
46240
|
key,
|
|
46241
46241
|
childValue,
|
|
46242
|
-
|
|
46242
|
+
path38,
|
|
46243
46243
|
isSet22
|
|
46244
46244
|
),
|
|
46245
46245
|
useStrictIteration
|
|
46246
46246
|
);
|
|
46247
46247
|
maybeFreeze(rootScope, result, false);
|
|
46248
|
-
if (
|
|
46248
|
+
if (path38 && rootScope.patches_) {
|
|
46249
46249
|
getPlugin("Patches").generatePatches_(
|
|
46250
46250
|
state,
|
|
46251
|
-
|
|
46251
|
+
path38,
|
|
46252
46252
|
rootScope.patches_,
|
|
46253
46253
|
rootScope.inversePatches_
|
|
46254
46254
|
);
|
|
@@ -46270,9 +46270,9 @@ function finalizeProperty(rootScope, parentState, targetObject, prop, childValue
|
|
|
46270
46270
|
if (process.env.NODE_ENV !== "production" && childValue === targetObject)
|
|
46271
46271
|
die(5);
|
|
46272
46272
|
if (isDraft(childValue)) {
|
|
46273
|
-
const
|
|
46273
|
+
const path38 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
46274
46274
|
!has2(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
46275
|
-
const res = finalize(rootScope, childValue,
|
|
46275
|
+
const res = finalize(rootScope, childValue, path38);
|
|
46276
46276
|
set(targetObject, prop, res);
|
|
46277
46277
|
if (isDraft(res)) {
|
|
46278
46278
|
rootScope.canAutoFreeze_ = false;
|
|
@@ -56997,17 +56997,17 @@ function buildAdjacency(ast) {
|
|
|
56997
56997
|
function enumeratePaths(ast) {
|
|
56998
56998
|
const { fromStart, toExit, edges } = buildAdjacency(ast);
|
|
56999
56999
|
const paths = [];
|
|
57000
|
-
function dfs(current2,
|
|
57000
|
+
function dfs(current2, path38, visited) {
|
|
57001
57001
|
if (toExit.has(current2)) {
|
|
57002
|
-
paths.push([...
|
|
57002
|
+
paths.push([...path38, "Exit"]);
|
|
57003
57003
|
}
|
|
57004
57004
|
const targets = edges.get(current2) || [];
|
|
57005
57005
|
for (const next of targets) {
|
|
57006
57006
|
if (!visited.has(next)) {
|
|
57007
57007
|
visited.add(next);
|
|
57008
|
-
|
|
57009
|
-
dfs(next,
|
|
57010
|
-
|
|
57008
|
+
path38.push(next);
|
|
57009
|
+
dfs(next, path38, visited);
|
|
57010
|
+
path38.pop();
|
|
57011
57011
|
visited.delete(next);
|
|
57012
57012
|
}
|
|
57013
57013
|
}
|
|
@@ -57021,22 +57021,22 @@ function enumeratePaths(ast) {
|
|
|
57021
57021
|
function buildGraph(ast) {
|
|
57022
57022
|
const { fromStart, toExit, edges } = buildAdjacency(ast);
|
|
57023
57023
|
const lines = [];
|
|
57024
|
-
function dfs(current2,
|
|
57024
|
+
function dfs(current2, path38, visited) {
|
|
57025
57025
|
if (toExit.has(current2)) {
|
|
57026
|
-
lines.push([...
|
|
57026
|
+
lines.push([...path38, "Exit"].join(" -> "));
|
|
57027
57027
|
}
|
|
57028
57028
|
const targets = edges.get(current2) || [];
|
|
57029
57029
|
for (const next of targets) {
|
|
57030
57030
|
if (!visited.has(next)) {
|
|
57031
57031
|
visited.add(next);
|
|
57032
|
-
|
|
57033
|
-
dfs(next,
|
|
57034
|
-
|
|
57032
|
+
path38.push(next);
|
|
57033
|
+
dfs(next, path38, visited);
|
|
57034
|
+
path38.pop();
|
|
57035
57035
|
visited.delete(next);
|
|
57036
57036
|
}
|
|
57037
57037
|
}
|
|
57038
57038
|
if (targets.length === 0 && !toExit.has(current2)) {
|
|
57039
|
-
lines.push(
|
|
57039
|
+
lines.push(path38.join(" -> "));
|
|
57040
57040
|
}
|
|
57041
57041
|
}
|
|
57042
57042
|
fromStart.forEach((startNode) => {
|
|
@@ -57947,14 +57947,14 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
|
|
|
57947
57947
|
radii[i + 1] *= scale;
|
|
57948
57948
|
}
|
|
57949
57949
|
}
|
|
57950
|
-
let
|
|
57950
|
+
let path38 = `M ${waypoints[0][0]},${waypoints[0][1]}`;
|
|
57951
57951
|
for (let i = 1; i < waypoints.length - 1; i++) {
|
|
57952
57952
|
const prev = waypoints[i - 1];
|
|
57953
57953
|
const curr = waypoints[i];
|
|
57954
57954
|
const next = waypoints[i + 1];
|
|
57955
57955
|
const r = radii[i];
|
|
57956
57956
|
if (r < 2) {
|
|
57957
|
-
|
|
57957
|
+
path38 += ` L ${curr[0]},${curr[1]}`;
|
|
57958
57958
|
continue;
|
|
57959
57959
|
}
|
|
57960
57960
|
const dPrev = [prev[0] - curr[0], prev[1] - curr[1]];
|
|
@@ -57967,12 +57967,12 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
|
|
|
57967
57967
|
const arcEnd = [curr[0] + uNext[0] * r, curr[1] + uNext[1] * r];
|
|
57968
57968
|
const cross = dPrev[0] * dNext[1] - dPrev[1] * dNext[0];
|
|
57969
57969
|
const sweep = cross > 0 ? 0 : 1;
|
|
57970
|
-
|
|
57971
|
-
|
|
57970
|
+
path38 += ` L ${arcStart[0]},${arcStart[1]}`;
|
|
57971
|
+
path38 += ` A ${r} ${r} 0 0 ${sweep} ${arcEnd[0]},${arcEnd[1]}`;
|
|
57972
57972
|
}
|
|
57973
57973
|
const last2 = waypoints[waypoints.length - 1];
|
|
57974
|
-
|
|
57975
|
-
return
|
|
57974
|
+
path38 += ` L ${last2[0]},${last2[1]}`;
|
|
57975
|
+
return path38;
|
|
57976
57976
|
}
|
|
57977
57977
|
function computeWaypoints(from, to, nodeBoxes, sourceNodeId, targetNodeId, padding, exitStub, entryStub, allocator) {
|
|
57978
57978
|
const isSelfConnection = sourceNodeId === targetNodeId;
|
|
@@ -58119,7 +58119,7 @@ function calculateOrthogonalPath(from, to, nodeBoxes, sourceNodeId, targetNodeId
|
|
|
58119
58119
|
}
|
|
58120
58120
|
function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNodeId, options, allocator) {
|
|
58121
58121
|
try {
|
|
58122
|
-
const
|
|
58122
|
+
const path38 = calculateOrthogonalPath(
|
|
58123
58123
|
from,
|
|
58124
58124
|
to,
|
|
58125
58125
|
nodeBoxes,
|
|
@@ -58128,8 +58128,8 @@ function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNo
|
|
|
58128
58128
|
options,
|
|
58129
58129
|
allocator
|
|
58130
58130
|
);
|
|
58131
|
-
if (!
|
|
58132
|
-
return
|
|
58131
|
+
if (!path38 || path38.length < 5) return null;
|
|
58132
|
+
return path38;
|
|
58133
58133
|
} catch {
|
|
58134
58134
|
return null;
|
|
58135
58135
|
}
|
|
@@ -58143,13 +58143,16 @@ var PORT_PADDING_Y = 18;
|
|
|
58143
58143
|
var NODE_MIN_WIDTH = 90;
|
|
58144
58144
|
var NODE_MIN_HEIGHT = 90;
|
|
58145
58145
|
var BORDER_RADIUS = 6;
|
|
58146
|
-
var LAYER_GAP_X =
|
|
58146
|
+
var LAYER_GAP_X = 300;
|
|
58147
|
+
var LABEL_CLEARANCE = 42;
|
|
58148
|
+
var MIN_EDGE_GAP = 112;
|
|
58147
58149
|
var NODE_GAP_Y = 60;
|
|
58148
58150
|
var LABEL_HEIGHT = 20;
|
|
58149
58151
|
var LABEL_GAP = 12;
|
|
58150
|
-
var
|
|
58152
|
+
var SCOPE_PADDING_X = 140;
|
|
58153
|
+
var SCOPE_PADDING_Y = 40;
|
|
58151
58154
|
var SCOPE_PORT_COLUMN = 50;
|
|
58152
|
-
var SCOPE_INNER_GAP_X =
|
|
58155
|
+
var SCOPE_INNER_GAP_X = 240;
|
|
58153
58156
|
var ORTHOGONAL_DISTANCE_THRESHOLD = 300;
|
|
58154
58157
|
var CHAR_WIDTHS = {
|
|
58155
58158
|
" ": 2.78,
|
|
@@ -58256,6 +58259,18 @@ function measureText(text) {
|
|
|
58256
58259
|
}
|
|
58257
58260
|
return width;
|
|
58258
58261
|
}
|
|
58262
|
+
function portBadgeWidth(port) {
|
|
58263
|
+
const abbrev = TYPE_ABBREVIATIONS[port.dataType] ?? port.dataType;
|
|
58264
|
+
const typeWidth = measureText(abbrev);
|
|
58265
|
+
const labelWidth = measureText(port.label);
|
|
58266
|
+
const pad = 7;
|
|
58267
|
+
const divGap = 4;
|
|
58268
|
+
return pad + typeWidth + divGap + 1 + divGap + labelWidth + pad;
|
|
58269
|
+
}
|
|
58270
|
+
function portLabelExtent(port) {
|
|
58271
|
+
const badgeGap = 5;
|
|
58272
|
+
return PORT_RADIUS + badgeGap + portBadgeWidth(port);
|
|
58273
|
+
}
|
|
58259
58274
|
function computeNodeDimensions(node) {
|
|
58260
58275
|
const maxPorts = Math.max(node.inputs.length, node.outputs.length);
|
|
58261
58276
|
const portsHeight = maxPorts > 0 ? PORT_PADDING_Y + maxPorts * PORT_SIZE + (maxPorts - 1) * PORT_GAP + PORT_PADDING_Y : 0;
|
|
@@ -58309,13 +58324,13 @@ function computeConnectionPath(sx, sy, tx, ty) {
|
|
|
58309
58324
|
const deUy = deY / deLen;
|
|
58310
58325
|
const [cx, cy] = quadCurveControl(bx, by, dx, dy, -deUx, -deUy);
|
|
58311
58326
|
const [fx, fy] = quadCurveControl(gx, gy, ex, ey, deUx, deUy);
|
|
58312
|
-
let
|
|
58313
|
-
|
|
58314
|
-
|
|
58315
|
-
|
|
58316
|
-
|
|
58317
|
-
|
|
58318
|
-
return
|
|
58327
|
+
let path38 = `M ${cx},${cy} M ${ax},${ay}`;
|
|
58328
|
+
path38 += ` L ${bx},${by}`;
|
|
58329
|
+
path38 += ` Q ${cx},${cy} ${dx},${dy}`;
|
|
58330
|
+
path38 += ` L ${ex},${ey}`;
|
|
58331
|
+
path38 += ` Q ${fx},${fy} ${gx},${gy}`;
|
|
58332
|
+
path38 += ` L ${hx},${hy}`;
|
|
58333
|
+
return path38;
|
|
58319
58334
|
}
|
|
58320
58335
|
function orderedPorts(ports, direction) {
|
|
58321
58336
|
const cloned = {};
|
|
@@ -58454,8 +58469,12 @@ function buildScopeSubGraph(parentNode, parentNt, scopeName, childIds, ast, node
|
|
|
58454
58469
|
const parentUI = ast.ui?.instances?.find((u) => u.name === parentNode.id);
|
|
58455
58470
|
const uiWidth = parentUI?.expandedWidth ?? parentUI?.width;
|
|
58456
58471
|
const uiHeight = parentUI?.expandedHeight ?? parentUI?.height;
|
|
58457
|
-
const
|
|
58458
|
-
const
|
|
58472
|
+
const maxLeftLabelExtent = scopeOutputPorts.length > 0 ? Math.max(...scopeOutputPorts.map(portLabelExtent)) : 0;
|
|
58473
|
+
const maxRightLabelExtent = scopeInputPorts.length > 0 ? Math.max(...scopeInputPorts.map(portLabelExtent)) : 0;
|
|
58474
|
+
const minInnerWidth = maxLeftLabelExtent + LABEL_CLEARANCE + maxRightLabelExtent;
|
|
58475
|
+
const contentWidth = Math.max(childrenWidth, minInnerWidth);
|
|
58476
|
+
const computedWidth = SCOPE_PORT_COLUMN + SCOPE_PADDING_X + contentWidth + SCOPE_PADDING_X + SCOPE_PORT_COLUMN;
|
|
58477
|
+
const computedHeight = SCOPE_PADDING_Y * 2 + Math.max(childrenHeight, scopeOutPortsHeight, scopeInPortsHeight);
|
|
58459
58478
|
parentNode.width = Math.max(parentNode.width, uiWidth ?? computedWidth);
|
|
58460
58479
|
parentNode.height = Math.max(parentNode.height, uiHeight ?? computedHeight);
|
|
58461
58480
|
parentNode.scopeChildren = children;
|
|
@@ -58466,13 +58485,13 @@ function finalizeScopePositions(parentNode, ast, theme = "dark") {
|
|
|
58466
58485
|
const children = parentNode.scopeChildren;
|
|
58467
58486
|
const scopePorts = parentNode.scopePorts;
|
|
58468
58487
|
if (!children || children.length === 0 || !scopePorts) return;
|
|
58469
|
-
const innerLeft = parentNode.x + SCOPE_PORT_COLUMN +
|
|
58470
|
-
const innerRight = parentNode.x + parentNode.width - SCOPE_PORT_COLUMN -
|
|
58488
|
+
const innerLeft = parentNode.x + SCOPE_PORT_COLUMN + SCOPE_PADDING_X;
|
|
58489
|
+
const innerRight = parentNode.x + parentNode.width - SCOPE_PORT_COLUMN - SCOPE_PADDING_X;
|
|
58471
58490
|
const innerWidth = innerRight - innerLeft;
|
|
58472
58491
|
const lastChild = children[children.length - 1];
|
|
58473
58492
|
const childrenBlockWidth = lastChild.x + lastChild.width;
|
|
58474
58493
|
const centerOffsetX = innerLeft + (innerWidth - childrenBlockWidth) / 2;
|
|
58475
|
-
const scopeOriginY = parentNode.y +
|
|
58494
|
+
const scopeOriginY = parentNode.y + SCOPE_PADDING_Y;
|
|
58476
58495
|
for (const child of children) {
|
|
58477
58496
|
child.x += centerOffsetX;
|
|
58478
58497
|
child.y += scopeOriginY;
|
|
@@ -58599,7 +58618,7 @@ function finalizeScopePositions(parentNode, ast, theme = "dark") {
|
|
|
58599
58618
|
function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetPort, theme = "dark") {
|
|
58600
58619
|
const sourceColor = getPortColor(sourcePort.dataType, sourcePort.isFailure, theme);
|
|
58601
58620
|
const targetColor = getPortColor(targetPort.dataType, targetPort.isFailure, theme);
|
|
58602
|
-
const
|
|
58621
|
+
const path38 = computeConnectionPath(sourcePort.cx, sourcePort.cy, targetPort.cx, targetPort.cy);
|
|
58603
58622
|
return {
|
|
58604
58623
|
fromNode,
|
|
58605
58624
|
fromPort,
|
|
@@ -58608,13 +58627,136 @@ function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetP
|
|
|
58608
58627
|
sourceColor,
|
|
58609
58628
|
targetColor,
|
|
58610
58629
|
isStepConnection: sourcePort.dataType === "STEP",
|
|
58611
|
-
path:
|
|
58630
|
+
path: path38
|
|
58612
58631
|
};
|
|
58613
58632
|
}
|
|
58614
58633
|
function portsColumnHeight(count) {
|
|
58615
58634
|
if (count === 0) return 0;
|
|
58616
58635
|
return PORT_PADDING_Y + count * PORT_SIZE + (count - 1) * PORT_GAP + PORT_PADDING_Y;
|
|
58617
58636
|
}
|
|
58637
|
+
function extractExplicitPositions(ast) {
|
|
58638
|
+
const positions = /* @__PURE__ */ new Map();
|
|
58639
|
+
if (ast.ui?.startNode?.x != null && ast.ui.startNode.y != null) {
|
|
58640
|
+
positions.set("Start", { x: ast.ui.startNode.x, y: ast.ui.startNode.y });
|
|
58641
|
+
}
|
|
58642
|
+
if (ast.ui?.exitNode?.x != null && ast.ui.exitNode.y != null) {
|
|
58643
|
+
positions.set("Exit", { x: ast.ui.exitNode.x, y: ast.ui.exitNode.y });
|
|
58644
|
+
}
|
|
58645
|
+
for (const inst of ast.instances) {
|
|
58646
|
+
if (inst.config?.x != null && inst.config.y != null) {
|
|
58647
|
+
positions.set(inst.id, { x: inst.config.x, y: inst.config.y });
|
|
58648
|
+
}
|
|
58649
|
+
}
|
|
58650
|
+
return positions;
|
|
58651
|
+
}
|
|
58652
|
+
function layerOutputExtent(layerNodes, diagramNodes) {
|
|
58653
|
+
let max = 0;
|
|
58654
|
+
for (const id of layerNodes) {
|
|
58655
|
+
const node = diagramNodes.get(id);
|
|
58656
|
+
max = Math.max(max, maxPortLabelExtent(node.outputs));
|
|
58657
|
+
}
|
|
58658
|
+
return max;
|
|
58659
|
+
}
|
|
58660
|
+
function layerInputExtent(layerNodes, diagramNodes) {
|
|
58661
|
+
let max = 0;
|
|
58662
|
+
for (const id of layerNodes) {
|
|
58663
|
+
const node = diagramNodes.get(id);
|
|
58664
|
+
max = Math.max(max, maxPortLabelExtent(node.inputs));
|
|
58665
|
+
}
|
|
58666
|
+
return max;
|
|
58667
|
+
}
|
|
58668
|
+
function assignLayerCoordinates(layers, diagramNodes) {
|
|
58669
|
+
const filtered = layers.map((l) => l.filter((id) => diagramNodes.has(id)));
|
|
58670
|
+
let currentX = 0;
|
|
58671
|
+
for (let i = 0; i < filtered.length; i++) {
|
|
58672
|
+
const layerNodes = filtered[i];
|
|
58673
|
+
if (layerNodes.length === 0) {
|
|
58674
|
+
currentX += LAYER_GAP_X;
|
|
58675
|
+
continue;
|
|
58676
|
+
}
|
|
58677
|
+
const maxWidth = Math.max(...layerNodes.map((id) => diagramNodes.get(id).width));
|
|
58678
|
+
const totalHeight = layerNodes.reduce((sum, id) => {
|
|
58679
|
+
const n = diagramNodes.get(id);
|
|
58680
|
+
return sum + n.height + LABEL_HEIGHT + LABEL_GAP;
|
|
58681
|
+
}, 0) + (layerNodes.length - 1) * NODE_GAP_Y;
|
|
58682
|
+
let currentY = -totalHeight / 2;
|
|
58683
|
+
for (const id of layerNodes) {
|
|
58684
|
+
const node = diagramNodes.get(id);
|
|
58685
|
+
currentY += LABEL_HEIGHT + LABEL_GAP;
|
|
58686
|
+
node.x = currentX + (maxWidth - node.width) / 2;
|
|
58687
|
+
node.y = currentY;
|
|
58688
|
+
currentY += node.height + NODE_GAP_Y;
|
|
58689
|
+
}
|
|
58690
|
+
const nextLayerNodes = filtered[i + 1];
|
|
58691
|
+
if (nextLayerNodes && nextLayerNodes.length > 0) {
|
|
58692
|
+
const outputOverhang = layerOutputExtent(layerNodes, diagramNodes);
|
|
58693
|
+
const inputOverhang = layerInputExtent(nextLayerNodes, diagramNodes);
|
|
58694
|
+
const labelMinGap = outputOverhang + LABEL_CLEARANCE + inputOverhang;
|
|
58695
|
+
const edgeGap = Math.max(labelMinGap, LAYER_GAP_X - maxWidth, MIN_EDGE_GAP);
|
|
58696
|
+
currentX += maxWidth + edgeGap;
|
|
58697
|
+
} else {
|
|
58698
|
+
currentX += maxWidth + LAYER_GAP_X;
|
|
58699
|
+
}
|
|
58700
|
+
}
|
|
58701
|
+
}
|
|
58702
|
+
function assignUnpositionedNodes(layers, diagramNodes, explicitPositions) {
|
|
58703
|
+
for (const [id, pos] of explicitPositions) {
|
|
58704
|
+
const node = diagramNodes.get(id);
|
|
58705
|
+
if (node) {
|
|
58706
|
+
node.x = pos.x;
|
|
58707
|
+
node.y = pos.y;
|
|
58708
|
+
}
|
|
58709
|
+
}
|
|
58710
|
+
const filtered = layers.map((l) => l.filter((id) => diagramNodes.has(id)));
|
|
58711
|
+
let currentX = 0;
|
|
58712
|
+
for (let i = 0; i < filtered.length; i++) {
|
|
58713
|
+
const layerNodes = filtered[i];
|
|
58714
|
+
if (layerNodes.length === 0) {
|
|
58715
|
+
currentX += LAYER_GAP_X;
|
|
58716
|
+
continue;
|
|
58717
|
+
}
|
|
58718
|
+
const unpositioned = layerNodes.filter((id) => !explicitPositions.has(id));
|
|
58719
|
+
const maxWidth = Math.max(...layerNodes.map((id) => diagramNodes.get(id).width));
|
|
58720
|
+
if (unpositioned.length > 0) {
|
|
58721
|
+
const totalHeight = unpositioned.reduce((sum, id) => {
|
|
58722
|
+
const n = diagramNodes.get(id);
|
|
58723
|
+
return sum + n.height + LABEL_HEIGHT + LABEL_GAP;
|
|
58724
|
+
}, 0) + (unpositioned.length - 1) * NODE_GAP_Y;
|
|
58725
|
+
let currentY = -totalHeight / 2;
|
|
58726
|
+
for (const id of unpositioned) {
|
|
58727
|
+
const node = diagramNodes.get(id);
|
|
58728
|
+
currentY += LABEL_HEIGHT + LABEL_GAP;
|
|
58729
|
+
node.x = currentX + (maxWidth - node.width) / 2;
|
|
58730
|
+
node.y = currentY;
|
|
58731
|
+
currentY += node.height + NODE_GAP_Y;
|
|
58732
|
+
}
|
|
58733
|
+
}
|
|
58734
|
+
const nextLayerNodes = filtered[i + 1];
|
|
58735
|
+
if (nextLayerNodes && nextLayerNodes.length > 0) {
|
|
58736
|
+
const outputOverhang = layerOutputExtent(layerNodes, diagramNodes);
|
|
58737
|
+
const inputOverhang = layerInputExtent(nextLayerNodes, diagramNodes);
|
|
58738
|
+
const labelMinGap = outputOverhang + LABEL_CLEARANCE + inputOverhang;
|
|
58739
|
+
const edgeGap = Math.max(labelMinGap, LAYER_GAP_X - maxWidth, MIN_EDGE_GAP);
|
|
58740
|
+
currentX += maxWidth + edgeGap;
|
|
58741
|
+
} else {
|
|
58742
|
+
currentX += maxWidth + LAYER_GAP_X;
|
|
58743
|
+
}
|
|
58744
|
+
}
|
|
58745
|
+
}
|
|
58746
|
+
function resolveHorizontalOverlaps(diagramNodes) {
|
|
58747
|
+
const nodes = [...diagramNodes.values()].sort((a, b) => a.x - b.x);
|
|
58748
|
+
for (let i = 1; i < nodes.length; i++) {
|
|
58749
|
+
const prev = nodes[i - 1];
|
|
58750
|
+
const curr = nodes[i];
|
|
58751
|
+
const prevRightExtent = maxPortLabelExtent(prev.outputs);
|
|
58752
|
+
const currLeftExtent = maxPortLabelExtent(curr.inputs);
|
|
58753
|
+
const minGap = Math.max(prevRightExtent + LABEL_CLEARANCE + currLeftExtent, MIN_EDGE_GAP);
|
|
58754
|
+
const actualGap = curr.x - (prev.x + prev.width);
|
|
58755
|
+
if (actualGap < minGap) {
|
|
58756
|
+
curr.x = prev.x + prev.width + minGap;
|
|
58757
|
+
}
|
|
58758
|
+
}
|
|
58759
|
+
}
|
|
58618
58760
|
function buildDiagramGraph(ast, options = {}) {
|
|
58619
58761
|
const themeName = options.theme ?? "dark";
|
|
58620
58762
|
const nodeTypeMap = /* @__PURE__ */ new Map();
|
|
@@ -58712,28 +58854,24 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
58712
58854
|
if (!parentNt) continue;
|
|
58713
58855
|
buildScopeSubGraph(parentNode, parentNt, scopeName, childIds, ast, nodeTypeMap, themeName);
|
|
58714
58856
|
}
|
|
58715
|
-
const
|
|
58716
|
-
|
|
58717
|
-
|
|
58718
|
-
|
|
58719
|
-
|
|
58720
|
-
currentX += LAYER_GAP_X;
|
|
58721
|
-
continue;
|
|
58722
|
-
}
|
|
58723
|
-
const maxWidth = Math.max(...layerNodes.map((id) => diagramNodes.get(id).width));
|
|
58724
|
-
const totalHeight = layerNodes.reduce((sum, id) => {
|
|
58725
|
-
const n = diagramNodes.get(id);
|
|
58726
|
-
return sum + n.height + LABEL_HEIGHT + LABEL_GAP;
|
|
58727
|
-
}, 0) + (layerNodes.length - 1) * NODE_GAP_Y;
|
|
58728
|
-
let currentY = -totalHeight / 2;
|
|
58729
|
-
for (const id of layerNodes) {
|
|
58857
|
+
const explicitPositions = extractExplicitPositions(ast);
|
|
58858
|
+
const allPositioned = [...diagramNodes.keys()].every((id) => explicitPositions.has(id));
|
|
58859
|
+
const nonePositioned = ![...diagramNodes.keys()].some((id) => explicitPositions.has(id));
|
|
58860
|
+
if (allPositioned) {
|
|
58861
|
+
for (const [id, pos] of explicitPositions) {
|
|
58730
58862
|
const node = diagramNodes.get(id);
|
|
58731
|
-
|
|
58732
|
-
|
|
58733
|
-
|
|
58734
|
-
|
|
58863
|
+
if (node) {
|
|
58864
|
+
node.x = pos.x;
|
|
58865
|
+
node.y = pos.y;
|
|
58866
|
+
}
|
|
58735
58867
|
}
|
|
58736
|
-
|
|
58868
|
+
resolveHorizontalOverlaps(diagramNodes);
|
|
58869
|
+
} else if (nonePositioned) {
|
|
58870
|
+
const { layers } = layoutWorkflow(ast);
|
|
58871
|
+
assignLayerCoordinates(layers, diagramNodes);
|
|
58872
|
+
} else {
|
|
58873
|
+
const { layers } = layoutWorkflow(ast);
|
|
58874
|
+
assignUnpositionedNodes(layers, diagramNodes, explicitPositions);
|
|
58737
58875
|
}
|
|
58738
58876
|
for (const node of diagramNodes.values()) {
|
|
58739
58877
|
computePortPositions(node);
|
|
@@ -58862,7 +59000,7 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
58862
59000
|
const dx = tx - sx;
|
|
58863
59001
|
const dy = ty - sy;
|
|
58864
59002
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
58865
|
-
let
|
|
59003
|
+
let path38;
|
|
58866
59004
|
if (distance > ORTHOGONAL_DISTANCE_THRESHOLD) {
|
|
58867
59005
|
const orthoPath = calculateOrthogonalPathSafe(
|
|
58868
59006
|
[sx, sy],
|
|
@@ -58873,9 +59011,9 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
58873
59011
|
{ fromPortIndex: pc.fromPortIndex, toPortIndex: pc.toPortIndex },
|
|
58874
59012
|
allocator
|
|
58875
59013
|
);
|
|
58876
|
-
|
|
59014
|
+
path38 = orthoPath ?? computeConnectionPath(sx, sy, tx, ty);
|
|
58877
59015
|
} else {
|
|
58878
|
-
|
|
59016
|
+
path38 = computeConnectionPath(sx, sy, tx, ty);
|
|
58879
59017
|
}
|
|
58880
59018
|
const sourceColor = getPortColor(pc.sourcePort.dataType, pc.sourcePort.isFailure, themeName);
|
|
58881
59019
|
const targetColor = getPortColor(pc.targetPort.dataType, pc.targetPort.isFailure, themeName);
|
|
@@ -58887,7 +59025,7 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
58887
59025
|
sourceColor,
|
|
58888
59026
|
targetColor,
|
|
58889
59027
|
isStepConnection: pc.sourcePort.dataType === "STEP",
|
|
58890
|
-
path:
|
|
59028
|
+
path: path38
|
|
58891
59029
|
});
|
|
58892
59030
|
}
|
|
58893
59031
|
for (const node of nodes) {
|
|
@@ -58954,12 +59092,12 @@ function resolveDefaultIcon(nt) {
|
|
|
58954
59092
|
if (nt.variant === "WORKFLOW" || nt.variant === "IMPORTED_WORKFLOW") return "flow";
|
|
58955
59093
|
return "code";
|
|
58956
59094
|
}
|
|
58957
|
-
function pathExtent(
|
|
59095
|
+
function pathExtent(path38) {
|
|
58958
59096
|
let maxX = -Infinity;
|
|
58959
59097
|
let maxY = -Infinity;
|
|
58960
59098
|
const pattern = /(-?[\d.]+),(-?[\d.]+)/g;
|
|
58961
59099
|
let m;
|
|
58962
|
-
while ((m = pattern.exec(
|
|
59100
|
+
while ((m = pattern.exec(path38)) !== null) {
|
|
58963
59101
|
maxX = Math.max(maxX, parseFloat(m[1]));
|
|
58964
59102
|
maxY = Math.max(maxY, parseFloat(m[2]));
|
|
58965
59103
|
}
|
|
@@ -59026,63 +59164,81 @@ function renderSVG(graph, options = {}) {
|
|
|
59026
59164
|
parts2.push(`<rect width="${vbWidth}" height="${vbHeight}" fill="url(#dot-grid)"/>`);
|
|
59027
59165
|
parts2.push(`<g class="connections">`);
|
|
59028
59166
|
for (let i = 0; i < graph.connections.length; i++) {
|
|
59029
|
-
|
|
59030
|
-
const dashAttr = conn.isStepConnection ? "" : ' stroke-dasharray="8 4"';
|
|
59031
|
-
parts2.push(
|
|
59032
|
-
` <path d="${conn.path}" fill="none" stroke="url(#conn-grad-${i})" stroke-width="3"${dashAttr} stroke-linecap="round"/>`
|
|
59033
|
-
);
|
|
59167
|
+
renderConnection(parts2, graph.connections[i], i);
|
|
59034
59168
|
}
|
|
59035
59169
|
parts2.push(`</g>`);
|
|
59036
59170
|
parts2.push(`<g class="nodes">`);
|
|
59037
59171
|
for (const node of graph.nodes) {
|
|
59038
|
-
parts2.push(renderNode(node, theme, themeName,
|
|
59172
|
+
parts2.push(renderNode(node, theme, themeName, allConnections));
|
|
59173
|
+
}
|
|
59174
|
+
parts2.push(`</g>`);
|
|
59175
|
+
parts2.push(`<g class="labels">`);
|
|
59176
|
+
for (const node of graph.nodes) {
|
|
59177
|
+
renderNodeLabel(parts2, node, theme);
|
|
59178
|
+
renderPortLabelsForNode(parts2, node, theme, themeName, showPortLabels);
|
|
59179
|
+
if (node.scopeChildren) {
|
|
59180
|
+
for (const child of node.scopeChildren) {
|
|
59181
|
+
renderNodeLabel(parts2, child, theme);
|
|
59182
|
+
}
|
|
59183
|
+
if (showPortLabels && node.scopePorts) {
|
|
59184
|
+
renderPortLabels(parts2, node.id, node.scopePorts.inputs, node.scopePorts.outputs, theme, themeName);
|
|
59185
|
+
}
|
|
59186
|
+
for (const child of node.scopeChildren) {
|
|
59187
|
+
renderPortLabelsForNode(parts2, child, theme, themeName, showPortLabels);
|
|
59188
|
+
}
|
|
59189
|
+
}
|
|
59039
59190
|
}
|
|
59040
59191
|
parts2.push(`</g>`);
|
|
59041
59192
|
parts2.push(`</svg>`);
|
|
59042
59193
|
return parts2.join("\n");
|
|
59043
59194
|
}
|
|
59044
|
-
function
|
|
59045
|
-
const
|
|
59046
|
-
parts2.push(` <g>`);
|
|
59047
|
-
const isScoped = !!(node.scopeChildren && node.scopeChildren.length > 0);
|
|
59048
|
-
const labelText = escapeXml(node.label);
|
|
59049
|
-
const textWidth = labelText.length * 7;
|
|
59050
|
-
const labelBgWidth = textWidth + 16;
|
|
59051
|
-
const labelBgHeight = LABEL_HEIGHT;
|
|
59052
|
-
const labelBgX = isScoped ? node.x : node.x + node.width / 2 - labelBgWidth / 2;
|
|
59053
|
-
const labelBgY = node.y - LABEL_GAP - labelBgHeight;
|
|
59054
|
-
const labelTextX = isScoped ? node.x + 8 : node.x + node.width / 2;
|
|
59055
|
-
const labelAnchor = isScoped ? "start" : "middle";
|
|
59195
|
+
function renderConnection(parts2, conn, gradIndex) {
|
|
59196
|
+
const dashAttr = conn.isStepConnection ? "" : ' stroke-dasharray="8 4"';
|
|
59056
59197
|
parts2.push(
|
|
59057
|
-
`
|
|
59198
|
+
` <path d="${conn.path}" fill="none" stroke="url(#conn-grad-${gradIndex})" stroke-width="3"${dashAttr} stroke-linecap="round" data-source="${escapeXml(conn.fromNode)}.${escapeXml(conn.fromPort)}" data-target="${escapeXml(conn.toNode)}.${escapeXml(conn.toPort)}"/>`
|
|
59058
59199
|
);
|
|
59200
|
+
}
|
|
59201
|
+
function renderScopeConnection(parts2, conn, allConnections) {
|
|
59202
|
+
const gradIndex = allConnections.indexOf(conn);
|
|
59203
|
+
if (gradIndex < 0) return;
|
|
59204
|
+
const dashAttr = conn.isStepConnection ? "" : ' stroke-dasharray="8 4"';
|
|
59059
59205
|
parts2.push(
|
|
59060
|
-
` <
|
|
59206
|
+
` <path d="${conn.path}" fill="none" stroke="url(#conn-grad-${gradIndex})" stroke-width="2.5"${dashAttr} stroke-linecap="round" data-source="${escapeXml(conn.fromNode)}.${escapeXml(conn.fromPort)}" data-target="${escapeXml(conn.toNode)}.${escapeXml(conn.toPort)}"/>`
|
|
59061
59207
|
);
|
|
59208
|
+
}
|
|
59209
|
+
function renderNodeBody(parts2, node, theme, indent) {
|
|
59062
59210
|
const strokeColor = node.color !== "#334155" ? node.color : theme.nodeIconColor;
|
|
59063
59211
|
parts2.push(
|
|
59064
|
-
|
|
59212
|
+
`${indent}<rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="${BORDER_RADIUS}" fill="${theme.nodeFill}" stroke="${strokeColor}" stroke-width="2"/>`
|
|
59065
59213
|
);
|
|
59214
|
+
const iconPath = NODE_ICON_PATHS[node.icon] ?? NODE_ICON_PATHS.code;
|
|
59215
|
+
const iconColor = node.color !== "#334155" ? node.color : theme.nodeIconColor;
|
|
59216
|
+
const iconSize = 40;
|
|
59217
|
+
const iconX = node.x + (node.width - iconSize) / 2;
|
|
59218
|
+
const iconY = node.y + (node.height - iconSize) / 2;
|
|
59219
|
+
parts2.push(
|
|
59220
|
+
`${indent}<svg x="${iconX}" y="${iconY}" width="${iconSize}" height="${iconSize}" viewBox="0 -960 960 960"><path d="${iconPath}" fill="${iconColor}"/></svg>`
|
|
59221
|
+
);
|
|
59222
|
+
}
|
|
59223
|
+
function renderNode(node, theme, themeName, allConnections) {
|
|
59224
|
+
const parts2 = [];
|
|
59225
|
+
parts2.push(` <g data-node-id="${escapeXml(node.id)}">`);
|
|
59066
59226
|
if (node.scopeChildren && node.scopeChildren.length > 0) {
|
|
59067
|
-
|
|
59068
|
-
} else {
|
|
59069
|
-
const iconPath = getNodeIconPath(node);
|
|
59070
|
-
const iconColor = getNodeIconColor(node, theme);
|
|
59071
|
-
const iconSize = 40;
|
|
59072
|
-
const iconX = node.x + (node.width - iconSize) / 2;
|
|
59073
|
-
const iconY = node.y + (node.height - iconSize) / 2;
|
|
59227
|
+
const strokeColor = node.color !== "#334155" ? node.color : theme.nodeIconColor;
|
|
59074
59228
|
parts2.push(
|
|
59075
|
-
` <
|
|
59229
|
+
` <rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="${BORDER_RADIUS}" fill="${theme.nodeFill}" stroke="${strokeColor}" stroke-width="2"/>`
|
|
59076
59230
|
);
|
|
59231
|
+
renderScopedContent(parts2, node, theme, themeName, allConnections);
|
|
59232
|
+
} else {
|
|
59233
|
+
renderNodeBody(parts2, node, theme, " ");
|
|
59077
59234
|
}
|
|
59078
|
-
|
|
59235
|
+
renderPortDots(parts2, node.id, node.inputs, node.outputs, themeName);
|
|
59079
59236
|
parts2.push(` </g>`);
|
|
59080
59237
|
return parts2.join("\n");
|
|
59081
59238
|
}
|
|
59082
|
-
function renderScopedContent(parts2, node, theme, themeName,
|
|
59239
|
+
function renderScopedContent(parts2, node, theme, themeName, allConnections) {
|
|
59083
59240
|
const children = node.scopeChildren;
|
|
59084
59241
|
const scopePorts = node.scopePorts;
|
|
59085
|
-
const scopeConns = node.scopeConnections ?? [];
|
|
59086
59242
|
const scopeX = node.x + SCOPE_PORT_COLUMN;
|
|
59087
59243
|
const scopeY = node.y + 4;
|
|
59088
59244
|
const scopeW = node.width - SCOPE_PORT_COLUMN * 2;
|
|
@@ -59090,92 +59246,82 @@ function renderScopedContent(parts2, node, theme, themeName, showPortLabels, all
|
|
|
59090
59246
|
parts2.push(
|
|
59091
59247
|
` <rect x="${scopeX}" y="${scopeY}" width="${scopeW}" height="${scopeH}" rx="4" fill="none" stroke="${theme.scopeAreaStroke}" stroke-width="1" stroke-dasharray="4 2" opacity="0.5"/>`
|
|
59092
59248
|
);
|
|
59093
|
-
|
|
59094
|
-
|
|
59249
|
+
for (const conn of node.scopeConnections ?? []) {
|
|
59250
|
+
renderScopeConnection(parts2, conn, allConnections);
|
|
59095
59251
|
}
|
|
59096
|
-
|
|
59097
|
-
|
|
59098
|
-
if (gradIndex < 0) continue;
|
|
59099
|
-
const dashAttr = conn.isStepConnection ? "" : ' stroke-dasharray="8 4"';
|
|
59100
|
-
parts2.push(
|
|
59101
|
-
` <path d="${conn.path}" fill="none" stroke="url(#conn-grad-${gradIndex})" stroke-width="2.5"${dashAttr} stroke-linecap="round"/>`
|
|
59102
|
-
);
|
|
59252
|
+
if (scopePorts) {
|
|
59253
|
+
renderPortDots(parts2, node.id, scopePorts.inputs, scopePorts.outputs, themeName);
|
|
59103
59254
|
}
|
|
59104
59255
|
for (const child of children) {
|
|
59105
|
-
|
|
59106
|
-
|
|
59107
|
-
|
|
59108
|
-
|
|
59109
|
-
const childLabelBgH = LABEL_HEIGHT;
|
|
59110
|
-
const childLabelBgX = childLabelX - childLabelBgW / 2;
|
|
59111
|
-
const childLabelBgY = child.y - LABEL_GAP - childLabelBgH;
|
|
59112
|
-
parts2.push(
|
|
59113
|
-
` <rect x="${childLabelBgX}" y="${childLabelBgY}" width="${childLabelBgW}" height="${childLabelBgH}" rx="6" fill="${theme.labelBadgeFill}" opacity="0.8"/>`
|
|
59114
|
-
);
|
|
59115
|
-
parts2.push(
|
|
59116
|
-
` <text class="node-label" x="${childLabelX}" y="${childLabelBgY + childLabelBgH / 2 + 6}" text-anchor="middle" fill="${child.color !== "#334155" ? child.color : theme.labelColor}">${childLabelText}</text>`
|
|
59117
|
-
);
|
|
59118
|
-
const childStroke = child.color !== "#334155" ? child.color : theme.nodeIconColor;
|
|
59119
|
-
parts2.push(
|
|
59120
|
-
` <rect x="${child.x}" y="${child.y}" width="${child.width}" height="${child.height}" rx="${BORDER_RADIUS}" fill="${theme.nodeFill}" stroke="${childStroke}" stroke-width="2"/>`
|
|
59121
|
-
);
|
|
59122
|
-
const iconPath = getNodeIconPath(child);
|
|
59123
|
-
const iconColor = getNodeIconColor(child, theme);
|
|
59124
|
-
const iconSize = 40;
|
|
59125
|
-
const iconX = child.x + (child.width - iconSize) / 2;
|
|
59126
|
-
const iconY = child.y + (child.height - iconSize) / 2;
|
|
59127
|
-
parts2.push(
|
|
59128
|
-
` <svg x="${iconX}" y="${iconY}" width="${iconSize}" height="${iconSize}" viewBox="0 -960 960 960"><path d="${iconPath}" fill="${iconColor}"/></svg>`
|
|
59129
|
-
);
|
|
59130
|
-
renderPorts(parts2, child.inputs, child.outputs, theme, themeName, showPortLabels);
|
|
59256
|
+
parts2.push(` <g data-node-id="${escapeXml(child.id)}">`);
|
|
59257
|
+
renderNodeBody(parts2, child, theme, " ");
|
|
59258
|
+
renderPortDots(parts2, child.id, child.inputs, child.outputs, themeName);
|
|
59259
|
+
parts2.push(` </g>`);
|
|
59131
59260
|
}
|
|
59132
59261
|
}
|
|
59133
|
-
function
|
|
59134
|
-
|
|
59262
|
+
function renderNodeLabel(parts2, node, theme) {
|
|
59263
|
+
const isScoped = !!(node.scopeChildren && node.scopeChildren.length > 0);
|
|
59264
|
+
const labelText = escapeXml(node.label);
|
|
59265
|
+
const textWidth = labelText.length * 7;
|
|
59266
|
+
const labelBgWidth = textWidth + 16;
|
|
59267
|
+
const labelBgHeight = LABEL_HEIGHT;
|
|
59268
|
+
const labelBgX = isScoped ? node.x : node.x + node.width / 2 - labelBgWidth / 2;
|
|
59269
|
+
const labelBgY = node.y - LABEL_GAP - labelBgHeight;
|
|
59270
|
+
const labelTextX = isScoped ? node.x + 8 : node.x + node.width / 2;
|
|
59271
|
+
const labelAnchor = isScoped ? "start" : "middle";
|
|
59272
|
+
parts2.push(` <g data-label-for="${escapeXml(node.id)}">`);
|
|
59273
|
+
parts2.push(` <rect x="${labelBgX}" y="${labelBgY}" width="${labelBgWidth}" height="${labelBgHeight}" rx="6" fill="${theme.labelBadgeFill}" opacity="0.8"/>`);
|
|
59274
|
+
parts2.push(` <text class="node-label" x="${labelTextX}" y="${labelBgY + labelBgHeight / 2 + 6}" text-anchor="${labelAnchor}" fill="${node.color !== "#334155" ? node.color : theme.labelColor}">${labelText}</text>`);
|
|
59275
|
+
parts2.push(` </g>`);
|
|
59135
59276
|
}
|
|
59136
|
-
function
|
|
59137
|
-
if (
|
|
59138
|
-
|
|
59277
|
+
function renderPortLabelsForNode(parts2, node, theme, themeName, showPortLabels) {
|
|
59278
|
+
if (showPortLabels) {
|
|
59279
|
+
renderPortLabels(parts2, node.id, node.inputs, node.outputs, theme, themeName);
|
|
59280
|
+
}
|
|
59139
59281
|
}
|
|
59140
|
-
function
|
|
59282
|
+
function renderPortDots(parts2, nodeId, inputs, outputs, themeName) {
|
|
59141
59283
|
for (const port of [...inputs, ...outputs]) {
|
|
59142
59284
|
const color = getPortColor(port.dataType, port.isFailure, themeName);
|
|
59143
59285
|
const ringColor = getPortRingColor(port.dataType, port.isFailure, themeName);
|
|
59144
|
-
|
|
59145
|
-
|
|
59146
|
-
|
|
59147
|
-
|
|
59148
|
-
|
|
59149
|
-
|
|
59150
|
-
|
|
59151
|
-
|
|
59152
|
-
|
|
59153
|
-
|
|
59154
|
-
|
|
59155
|
-
|
|
59156
|
-
|
|
59157
|
-
|
|
59158
|
-
|
|
59159
|
-
|
|
59160
|
-
|
|
59161
|
-
|
|
59162
|
-
|
|
59163
|
-
|
|
59164
|
-
|
|
59165
|
-
|
|
59166
|
-
|
|
59167
|
-
|
|
59168
|
-
|
|
59169
|
-
|
|
59170
|
-
|
|
59171
|
-
|
|
59172
|
-
|
|
59173
|
-
|
|
59174
|
-
|
|
59175
|
-
|
|
59176
|
-
|
|
59177
|
-
|
|
59286
|
+
const dir = port.direction === "INPUT" ? "input" : "output";
|
|
59287
|
+
parts2.push(` <circle cx="${port.cx}" cy="${port.cy}" r="${PORT_RADIUS}" fill="${color}" stroke="${ringColor}" stroke-width="2" data-port-id="${escapeXml(nodeId)}.${escapeXml(port.name)}" data-direction="${dir}"/>`);
|
|
59288
|
+
}
|
|
59289
|
+
}
|
|
59290
|
+
function renderPortLabels(parts2, nodeId, inputs, outputs, theme, themeName) {
|
|
59291
|
+
for (const port of [...inputs, ...outputs]) {
|
|
59292
|
+
const color = getPortColor(port.dataType, port.isFailure, themeName);
|
|
59293
|
+
const isInput = port.direction === "INPUT";
|
|
59294
|
+
const abbrev = TYPE_ABBREVIATIONS[port.dataType] ?? port.dataType;
|
|
59295
|
+
const portId = `${escapeXml(nodeId)}.${escapeXml(port.name)}`;
|
|
59296
|
+
const portLabel = port.label;
|
|
59297
|
+
const typeWidth = measureText(abbrev);
|
|
59298
|
+
const labelWidth = measureText(portLabel);
|
|
59299
|
+
const pad = 7;
|
|
59300
|
+
const divGap = 4;
|
|
59301
|
+
const badgeWidth = pad + typeWidth + divGap + 1 + divGap + labelWidth + pad;
|
|
59302
|
+
const badgeHeight = 16;
|
|
59303
|
+
const badgeGap = 5;
|
|
59304
|
+
const rr = badgeHeight / 2;
|
|
59305
|
+
const badgeX = isInput ? port.cx - PORT_RADIUS - badgeGap - badgeWidth : port.cx + PORT_RADIUS + badgeGap;
|
|
59306
|
+
const badgeY = port.cy - badgeHeight / 2;
|
|
59307
|
+
parts2.push(` <g data-port-label="${portId}">`);
|
|
59308
|
+
parts2.push(` <rect x="${badgeX}" y="${badgeY}" width="${badgeWidth}" height="${badgeHeight}" rx="${rr}" fill="${theme.nodeFill}" stroke="${theme.labelBadgeBorder}" stroke-width="1"/>`);
|
|
59309
|
+
if (isInput) {
|
|
59310
|
+
const typeX = badgeX + badgeWidth - pad - typeWidth / 2;
|
|
59311
|
+
const divX = typeX - typeWidth / 2 - divGap;
|
|
59312
|
+
const nameX = divX - divGap;
|
|
59313
|
+
parts2.push(` <line x1="${divX}" y1="${badgeY + 3}" x2="${divX}" y2="${badgeY + badgeHeight - 3}" stroke="${theme.labelBadgeBorder}" stroke-width="1"/>`);
|
|
59314
|
+
parts2.push(` <text class="port-label" x="${nameX}" y="${port.cy + 3.5}" text-anchor="end">${escapeXml(portLabel)}</text>`);
|
|
59315
|
+
parts2.push(` <text class="port-type-label" x="${typeX}" y="${port.cy + 3.5}" text-anchor="middle" fill="${color}">${escapeXml(abbrev)}</text>`);
|
|
59316
|
+
} else {
|
|
59317
|
+
const typeX = badgeX + pad + typeWidth / 2;
|
|
59318
|
+
const divX = badgeX + pad + typeWidth + divGap;
|
|
59319
|
+
const nameX = divX + 1 + divGap;
|
|
59320
|
+
parts2.push(` <line x1="${divX}" y1="${badgeY + 3}" x2="${divX}" y2="${badgeY + badgeHeight - 3}" stroke="${theme.labelBadgeBorder}" stroke-width="1"/>`);
|
|
59321
|
+
parts2.push(` <text class="port-type-label" x="${typeX}" y="${port.cy + 3.5}" text-anchor="middle" fill="${color}">${escapeXml(abbrev)}</text>`);
|
|
59322
|
+
parts2.push(` <text class="port-label" x="${nameX}" y="${port.cy + 3.5}" text-anchor="start">${escapeXml(portLabel)}</text>`);
|
|
59178
59323
|
}
|
|
59324
|
+
parts2.push(` </g>`);
|
|
59179
59325
|
}
|
|
59180
59326
|
}
|
|
59181
59327
|
|
|
@@ -61570,13 +61716,13 @@ var PromisePolyfill = class extends Promise {
|
|
|
61570
61716
|
// Available starting from Node 22
|
|
61571
61717
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
61572
61718
|
static withResolver() {
|
|
61573
|
-
let
|
|
61719
|
+
let resolve27;
|
|
61574
61720
|
let reject2;
|
|
61575
61721
|
const promise = new Promise((res, rej) => {
|
|
61576
|
-
|
|
61722
|
+
resolve27 = res;
|
|
61577
61723
|
reject2 = rej;
|
|
61578
61724
|
});
|
|
61579
|
-
return { promise, resolve:
|
|
61725
|
+
return { promise, resolve: resolve27, reject: reject2 };
|
|
61580
61726
|
}
|
|
61581
61727
|
};
|
|
61582
61728
|
|
|
@@ -61610,7 +61756,7 @@ function createPrompt(view) {
|
|
|
61610
61756
|
output
|
|
61611
61757
|
});
|
|
61612
61758
|
const screen = new ScreenManager(rl);
|
|
61613
|
-
const { promise, resolve:
|
|
61759
|
+
const { promise, resolve: resolve27, reject: reject2 } = PromisePolyfill.withResolver();
|
|
61614
61760
|
const cancel = () => reject2(new CancelPromptError());
|
|
61615
61761
|
if (signal) {
|
|
61616
61762
|
const abort = () => reject2(new AbortPromptError({ cause: signal.reason }));
|
|
@@ -61637,7 +61783,7 @@ function createPrompt(view) {
|
|
|
61637
61783
|
cycle(() => {
|
|
61638
61784
|
try {
|
|
61639
61785
|
const nextView = view(config2, (value2) => {
|
|
61640
|
-
setImmediate(() =>
|
|
61786
|
+
setImmediate(() => resolve27(value2));
|
|
61641
61787
|
});
|
|
61642
61788
|
if (nextView === void 0) {
|
|
61643
61789
|
const callerFilename = callSites[1]?.getFileName();
|
|
@@ -62218,13 +62364,13 @@ var PromisePolyfill2 = class extends Promise {
|
|
|
62218
62364
|
// Available starting from Node 22
|
|
62219
62365
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
62220
62366
|
static withResolver() {
|
|
62221
|
-
let
|
|
62367
|
+
let resolve27;
|
|
62222
62368
|
let reject2;
|
|
62223
62369
|
const promise = new Promise((res, rej) => {
|
|
62224
|
-
|
|
62370
|
+
resolve27 = res;
|
|
62225
62371
|
reject2 = rej;
|
|
62226
62372
|
});
|
|
62227
|
-
return { promise, resolve:
|
|
62373
|
+
return { promise, resolve: resolve27, reject: reject2 };
|
|
62228
62374
|
}
|
|
62229
62375
|
};
|
|
62230
62376
|
|
|
@@ -62258,7 +62404,7 @@ function createPrompt2(view) {
|
|
|
62258
62404
|
output
|
|
62259
62405
|
});
|
|
62260
62406
|
const screen = new ScreenManager2(rl);
|
|
62261
|
-
const { promise, resolve:
|
|
62407
|
+
const { promise, resolve: resolve27, reject: reject2 } = PromisePolyfill2.withResolver();
|
|
62262
62408
|
const cancel = () => reject2(new CancelPromptError2());
|
|
62263
62409
|
if (signal) {
|
|
62264
62410
|
const abort = () => reject2(new AbortPromptError2({ cause: signal.reason }));
|
|
@@ -62285,7 +62431,7 @@ function createPrompt2(view) {
|
|
|
62285
62431
|
cycle(() => {
|
|
62286
62432
|
try {
|
|
62287
62433
|
const nextView = view(config2, (value2) => {
|
|
62288
|
-
setImmediate(() =>
|
|
62434
|
+
setImmediate(() => resolve27(value2));
|
|
62289
62435
|
});
|
|
62290
62436
|
if (nextView === void 0) {
|
|
62291
62437
|
const callerFilename = callSites[1]?.getFileName();
|
|
@@ -62837,13 +62983,13 @@ var PromisePolyfill3 = class extends Promise {
|
|
|
62837
62983
|
// Available starting from Node 22
|
|
62838
62984
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
62839
62985
|
static withResolver() {
|
|
62840
|
-
let
|
|
62986
|
+
let resolve27;
|
|
62841
62987
|
let reject2;
|
|
62842
62988
|
const promise = new Promise((res, rej) => {
|
|
62843
|
-
|
|
62989
|
+
resolve27 = res;
|
|
62844
62990
|
reject2 = rej;
|
|
62845
62991
|
});
|
|
62846
|
-
return { promise, resolve:
|
|
62992
|
+
return { promise, resolve: resolve27, reject: reject2 };
|
|
62847
62993
|
}
|
|
62848
62994
|
};
|
|
62849
62995
|
|
|
@@ -62877,7 +63023,7 @@ function createPrompt3(view) {
|
|
|
62877
63023
|
output
|
|
62878
63024
|
});
|
|
62879
63025
|
const screen = new ScreenManager3(rl);
|
|
62880
|
-
const { promise, resolve:
|
|
63026
|
+
const { promise, resolve: resolve27, reject: reject2 } = PromisePolyfill3.withResolver();
|
|
62881
63027
|
const cancel = () => reject2(new CancelPromptError3());
|
|
62882
63028
|
if (signal) {
|
|
62883
63029
|
const abort = () => reject2(new AbortPromptError3({ cause: signal.reason }));
|
|
@@ -62904,7 +63050,7 @@ function createPrompt3(view) {
|
|
|
62904
63050
|
cycle(() => {
|
|
62905
63051
|
try {
|
|
62906
63052
|
const nextView = view(config2, (value2) => {
|
|
62907
|
-
setImmediate(() =>
|
|
63053
|
+
setImmediate(() => resolve27(value2));
|
|
62908
63054
|
});
|
|
62909
63055
|
if (nextView === void 0) {
|
|
62910
63056
|
const callerFilename = callSites[1]?.getFileName();
|
|
@@ -63764,6 +63910,7 @@ import { spawn } from "child_process";
|
|
|
63764
63910
|
import * as path18 from "path";
|
|
63765
63911
|
import * as fs17 from "fs";
|
|
63766
63912
|
import * as os from "os";
|
|
63913
|
+
import { pathToFileURL } from "url";
|
|
63767
63914
|
import ts4 from "typescript";
|
|
63768
63915
|
async function executeWorkflowFromFile(filePath, params, options) {
|
|
63769
63916
|
const resolvedPath = path18.resolve(filePath);
|
|
@@ -63814,7 +63961,7 @@ async function executeWorkflowFromFile(filePath, params, options) {
|
|
|
63814
63961
|
if (options?.mocks) {
|
|
63815
63962
|
globalThis.__fw_mocks__ = options.mocks;
|
|
63816
63963
|
}
|
|
63817
|
-
const mod = await import(tmpFile);
|
|
63964
|
+
const mod = await import(pathToFileURL(tmpFile).href);
|
|
63818
63965
|
const exportedFn = findExportedFunction(mod, options?.workflowName);
|
|
63819
63966
|
if (!exportedFn) {
|
|
63820
63967
|
throw new Error(
|
|
@@ -65347,12 +65494,12 @@ function parse4(str2) {
|
|
|
65347
65494
|
uri.queryKey = queryKey(uri, uri["query"]);
|
|
65348
65495
|
return uri;
|
|
65349
65496
|
}
|
|
65350
|
-
function pathNames(obj,
|
|
65351
|
-
const regx = /\/{2,9}/g, names =
|
|
65352
|
-
if (
|
|
65497
|
+
function pathNames(obj, path38) {
|
|
65498
|
+
const regx = /\/{2,9}/g, names = path38.replace(regx, "/").split("/");
|
|
65499
|
+
if (path38.slice(0, 1) == "/" || path38.length === 0) {
|
|
65353
65500
|
names.splice(0, 1);
|
|
65354
65501
|
}
|
|
65355
|
-
if (
|
|
65502
|
+
if (path38.slice(-1) == "/") {
|
|
65356
65503
|
names.splice(names.length - 1, 1);
|
|
65357
65504
|
}
|
|
65358
65505
|
return names;
|
|
@@ -65970,7 +66117,7 @@ var protocol2 = Socket.protocol;
|
|
|
65970
66117
|
// node_modules/socket.io-client/build/esm-debug/url.js
|
|
65971
66118
|
var import_debug7 = __toESM(require_src(), 1);
|
|
65972
66119
|
var debug7 = (0, import_debug7.default)("socket.io-client:url");
|
|
65973
|
-
function url(uri,
|
|
66120
|
+
function url(uri, path38 = "", loc) {
|
|
65974
66121
|
let obj = uri;
|
|
65975
66122
|
loc = loc || typeof location !== "undefined" && location;
|
|
65976
66123
|
if (null == uri)
|
|
@@ -66004,7 +66151,7 @@ function url(uri, path37 = "", loc) {
|
|
|
66004
66151
|
obj.path = obj.path || "/";
|
|
66005
66152
|
const ipv62 = obj.host.indexOf(":") !== -1;
|
|
66006
66153
|
const host = ipv62 ? "[" + obj.host + "]" : obj.host;
|
|
66007
|
-
obj.id = obj.protocol + "://" + host + ":" + obj.port +
|
|
66154
|
+
obj.id = obj.protocol + "://" + host + ":" + obj.port + path38;
|
|
66008
66155
|
obj.href = obj.protocol + "://" + host + (loc && loc.port === obj.port ? "" : ":" + obj.port);
|
|
66009
66156
|
return obj;
|
|
66010
66157
|
}
|
|
@@ -66656,9 +66803,9 @@ var Socket2 = class extends import_component_emitter5.Emitter {
|
|
|
66656
66803
|
* @return a Promise that will be fulfilled when the server acknowledges the event
|
|
66657
66804
|
*/
|
|
66658
66805
|
emitWithAck(ev, ...args) {
|
|
66659
|
-
return new Promise((
|
|
66806
|
+
return new Promise((resolve27, reject2) => {
|
|
66660
66807
|
const fn = (arg1, arg2) => {
|
|
66661
|
-
return arg1 ? reject2(arg1) :
|
|
66808
|
+
return arg1 ? reject2(arg1) : resolve27(arg2);
|
|
66662
66809
|
};
|
|
66663
66810
|
fn.withError = true;
|
|
66664
66811
|
args.push(fn);
|
|
@@ -67631,8 +67778,8 @@ function lookup(uri, opts) {
|
|
|
67631
67778
|
const parsed = url(uri, opts.path || "/socket.io");
|
|
67632
67779
|
const source = parsed.source;
|
|
67633
67780
|
const id = parsed.id;
|
|
67634
|
-
const
|
|
67635
|
-
const sameNamespace = cache[id] &&
|
|
67781
|
+
const path38 = parsed.path;
|
|
67782
|
+
const sameNamespace = cache[id] && path38 in cache[id]["nsps"];
|
|
67636
67783
|
const newConnection = opts.forceNew || opts["force new connection"] || false === opts.multiplex || sameNamespace;
|
|
67637
67784
|
let io;
|
|
67638
67785
|
if (newConnection) {
|
|
@@ -68176,8 +68323,8 @@ function getErrorMap() {
|
|
|
68176
68323
|
|
|
68177
68324
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
68178
68325
|
var makeIssue = (params) => {
|
|
68179
|
-
const { data, path:
|
|
68180
|
-
const fullPath = [...
|
|
68326
|
+
const { data, path: path38, errorMaps, issueData } = params;
|
|
68327
|
+
const fullPath = [...path38, ...issueData.path || []];
|
|
68181
68328
|
const fullIssue = {
|
|
68182
68329
|
...issueData,
|
|
68183
68330
|
path: fullPath
|
|
@@ -68293,11 +68440,11 @@ var errorUtil;
|
|
|
68293
68440
|
|
|
68294
68441
|
// node_modules/zod/v3/types.js
|
|
68295
68442
|
var ParseInputLazyPath = class {
|
|
68296
|
-
constructor(parent, value2,
|
|
68443
|
+
constructor(parent, value2, path38, key) {
|
|
68297
68444
|
this._cachedPath = [];
|
|
68298
68445
|
this.parent = parent;
|
|
68299
68446
|
this.data = value2;
|
|
68300
|
-
this._path =
|
|
68447
|
+
this._path = path38;
|
|
68301
68448
|
this._key = key;
|
|
68302
68449
|
}
|
|
68303
68450
|
get path() {
|
|
@@ -71934,10 +72081,10 @@ function assignProp(target, prop, value2) {
|
|
|
71934
72081
|
configurable: true
|
|
71935
72082
|
});
|
|
71936
72083
|
}
|
|
71937
|
-
function getElementAtPath(obj,
|
|
71938
|
-
if (!
|
|
72084
|
+
function getElementAtPath(obj, path38) {
|
|
72085
|
+
if (!path38)
|
|
71939
72086
|
return obj;
|
|
71940
|
-
return
|
|
72087
|
+
return path38.reduce((acc, key) => acc?.[key], obj);
|
|
71941
72088
|
}
|
|
71942
72089
|
function promiseAllObject(promisesObj) {
|
|
71943
72090
|
const keys2 = Object.keys(promisesObj);
|
|
@@ -72257,11 +72404,11 @@ function aborted(x, startIndex = 0) {
|
|
|
72257
72404
|
}
|
|
72258
72405
|
return false;
|
|
72259
72406
|
}
|
|
72260
|
-
function prefixIssues(
|
|
72407
|
+
function prefixIssues(path38, issues) {
|
|
72261
72408
|
return issues.map((iss) => {
|
|
72262
72409
|
var _a;
|
|
72263
72410
|
(_a = iss).path ?? (_a.path = []);
|
|
72264
|
-
iss.path.unshift(
|
|
72411
|
+
iss.path.unshift(path38);
|
|
72265
72412
|
return iss;
|
|
72266
72413
|
});
|
|
72267
72414
|
}
|
|
@@ -79770,7 +79917,7 @@ var Protocol = class {
|
|
|
79770
79917
|
return;
|
|
79771
79918
|
}
|
|
79772
79919
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
79773
|
-
await new Promise((
|
|
79920
|
+
await new Promise((resolve27) => setTimeout(resolve27, pollInterval));
|
|
79774
79921
|
options?.signal?.throwIfAborted();
|
|
79775
79922
|
}
|
|
79776
79923
|
} catch (error2) {
|
|
@@ -79787,7 +79934,7 @@ var Protocol = class {
|
|
|
79787
79934
|
*/
|
|
79788
79935
|
request(request, resultSchema, options) {
|
|
79789
79936
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
79790
|
-
return new Promise((
|
|
79937
|
+
return new Promise((resolve27, reject2) => {
|
|
79791
79938
|
const earlyReject = (error2) => {
|
|
79792
79939
|
reject2(error2);
|
|
79793
79940
|
};
|
|
@@ -79865,7 +80012,7 @@ var Protocol = class {
|
|
|
79865
80012
|
if (!parseResult.success) {
|
|
79866
80013
|
reject2(parseResult.error);
|
|
79867
80014
|
} else {
|
|
79868
|
-
|
|
80015
|
+
resolve27(parseResult.data);
|
|
79869
80016
|
}
|
|
79870
80017
|
} catch (error2) {
|
|
79871
80018
|
reject2(error2);
|
|
@@ -80126,12 +80273,12 @@ var Protocol = class {
|
|
|
80126
80273
|
}
|
|
80127
80274
|
} catch {
|
|
80128
80275
|
}
|
|
80129
|
-
return new Promise((
|
|
80276
|
+
return new Promise((resolve27, reject2) => {
|
|
80130
80277
|
if (signal.aborted) {
|
|
80131
80278
|
reject2(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
80132
80279
|
return;
|
|
80133
80280
|
}
|
|
80134
|
-
const timeoutId = setTimeout(
|
|
80281
|
+
const timeoutId = setTimeout(resolve27, interval);
|
|
80135
80282
|
signal.addEventListener("abort", () => {
|
|
80136
80283
|
clearTimeout(timeoutId);
|
|
80137
80284
|
reject2(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -81090,7 +81237,7 @@ var McpServer = class {
|
|
|
81090
81237
|
let task = createTaskResult.task;
|
|
81091
81238
|
const pollInterval = task.pollInterval ?? 5e3;
|
|
81092
81239
|
while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
|
|
81093
|
-
await new Promise((
|
|
81240
|
+
await new Promise((resolve27) => setTimeout(resolve27, pollInterval));
|
|
81094
81241
|
const updatedTask = await extra.taskStore.getTask(taskId);
|
|
81095
81242
|
if (!updatedTask) {
|
|
81096
81243
|
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
|
|
@@ -81733,12 +81880,12 @@ var StdioServerTransport = class {
|
|
|
81733
81880
|
this.onclose?.();
|
|
81734
81881
|
}
|
|
81735
81882
|
send(message) {
|
|
81736
|
-
return new Promise((
|
|
81883
|
+
return new Promise((resolve27) => {
|
|
81737
81884
|
const json2 = serializeMessage(message);
|
|
81738
81885
|
if (this._stdout.write(json2)) {
|
|
81739
|
-
|
|
81886
|
+
resolve27();
|
|
81740
81887
|
} else {
|
|
81741
|
-
this._stdout.once("drain",
|
|
81888
|
+
this._stdout.once("drain", resolve27);
|
|
81742
81889
|
}
|
|
81743
81890
|
});
|
|
81744
81891
|
}
|
|
@@ -81952,17 +82099,17 @@ var EditorConnection = class {
|
|
|
81952
82099
|
return { requestId: "", success: false, error: "Not connected" };
|
|
81953
82100
|
}
|
|
81954
82101
|
const requestId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
81955
|
-
return new Promise((
|
|
82102
|
+
return new Promise((resolve27) => {
|
|
81956
82103
|
const handler = (data) => {
|
|
81957
82104
|
if (data.requestId === requestId) {
|
|
81958
82105
|
clearTimeout(timeout);
|
|
81959
82106
|
this.socket.off("fw:ack", handler);
|
|
81960
|
-
|
|
82107
|
+
resolve27(data);
|
|
81961
82108
|
}
|
|
81962
82109
|
};
|
|
81963
82110
|
const timeout = setTimeout(() => {
|
|
81964
82111
|
this.socket.off("fw:ack", handler);
|
|
81965
|
-
|
|
82112
|
+
resolve27({ requestId, success: false, error: "Timeout" });
|
|
81966
82113
|
}, this.ackTimeout);
|
|
81967
82114
|
this.socket.on("fw:ack", handler);
|
|
81968
82115
|
this.socket.emit("integration:command", { requestId, action, params });
|
|
@@ -81979,17 +82126,17 @@ var EditorConnection = class {
|
|
|
81979
82126
|
return { requestId: "", success: false, error: "Not connected" };
|
|
81980
82127
|
}
|
|
81981
82128
|
const requestId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
81982
|
-
return new Promise((
|
|
82129
|
+
return new Promise((resolve27) => {
|
|
81983
82130
|
const handler = (data) => {
|
|
81984
82131
|
if (data.requestId === requestId) {
|
|
81985
82132
|
clearTimeout(timeout);
|
|
81986
82133
|
this.socket.off("fw:ack", handler);
|
|
81987
|
-
|
|
82134
|
+
resolve27(data);
|
|
81988
82135
|
}
|
|
81989
82136
|
};
|
|
81990
82137
|
const timeout = setTimeout(() => {
|
|
81991
82138
|
this.socket.off("fw:ack", handler);
|
|
81992
|
-
|
|
82139
|
+
resolve27({ requestId, success: false, error: "Timeout" });
|
|
81993
82140
|
}, this.ackTimeout);
|
|
81994
82141
|
this.socket.on("fw:ack", handler);
|
|
81995
82142
|
this.socket.emit("integration:batch", { requestId, commands });
|
|
@@ -82017,11 +82164,11 @@ function defaultRegistrationDeps() {
|
|
|
82017
82164
|
return { stdout: "", exitCode: 1 };
|
|
82018
82165
|
}
|
|
82019
82166
|
},
|
|
82020
|
-
prompt: (question) => new Promise((
|
|
82167
|
+
prompt: (question) => new Promise((resolve27) => {
|
|
82021
82168
|
const rl = readline8.createInterface({ input: process.stdin, output: process.stderr });
|
|
82022
82169
|
rl.question(question, (answer) => {
|
|
82023
82170
|
rl.close();
|
|
82024
|
-
|
|
82171
|
+
resolve27(answer.trim().toLowerCase());
|
|
82025
82172
|
});
|
|
82026
82173
|
}),
|
|
82027
82174
|
log: (msg) => process.stderr.write(msg + "\n"),
|
|
@@ -82305,7 +82452,7 @@ function registerEditorTools(mcp, connection, buffer) {
|
|
|
82305
82452
|
);
|
|
82306
82453
|
mcp.tool(
|
|
82307
82454
|
"fw_execute_workflow",
|
|
82308
|
-
"Run the current workflow with optional parameters and return the result.",
|
|
82455
|
+
"Run the current workflow with optional parameters and return the result. Includes per-node execution trace by default (STATUS_CHANGED, VARIABLE_SET events) \u2014 use includeTrace: false to disable.",
|
|
82309
82456
|
{
|
|
82310
82457
|
filePath: external_exports.string().optional().describe(
|
|
82311
82458
|
"Path to workflow file. When provided, compiles and executes directly (no editor needed)"
|
|
@@ -82507,7 +82654,7 @@ ${parseResult.errors.join("\n")}`
|
|
|
82507
82654
|
);
|
|
82508
82655
|
mcp.tool(
|
|
82509
82656
|
"fw_compile",
|
|
82510
|
-
"Compile a workflow to executable code. Use target=inngest for per-node step.run() durability.",
|
|
82657
|
+
"Compile a workflow to executable code. Only regenerates code inside @flow-weaver-runtime and @flow-weaver-body marker sections \u2014 user code outside markers is preserved. Set production: true to strip debug instrumentation. Use target=inngest for per-node step.run() durability.",
|
|
82511
82658
|
{
|
|
82512
82659
|
filePath: external_exports.string().describe("Path to the workflow file"),
|
|
82513
82660
|
write: external_exports.boolean().optional().describe("Whether to write the output file (default: true)"),
|
|
@@ -82560,8 +82707,8 @@ ${parseResult.errors.join("\n")}`);
|
|
|
82560
82707
|
});
|
|
82561
82708
|
const outputFile = filePath.replace(/\.ts$/, ".inngest.ts");
|
|
82562
82709
|
if (args.write !== false) {
|
|
82563
|
-
const
|
|
82564
|
-
|
|
82710
|
+
const fs37 = await import("fs");
|
|
82711
|
+
fs37.writeFileSync(outputFile, code, "utf8");
|
|
82565
82712
|
}
|
|
82566
82713
|
return makeToolResult({
|
|
82567
82714
|
target: "inngest",
|
|
@@ -83991,8 +84138,8 @@ var OpenAPIGenerator = class {
|
|
|
83991
84138
|
doc.paths["/health"] = this.generateHealthEndpoint();
|
|
83992
84139
|
doc.paths["/workflows"] = this.generateListEndpoint();
|
|
83993
84140
|
for (const endpoint of endpoints) {
|
|
83994
|
-
const
|
|
83995
|
-
doc.paths[
|
|
84141
|
+
const path38 = options.basePath ? `${options.basePath}${endpoint.path}` : endpoint.path;
|
|
84142
|
+
doc.paths[path38] = this.generateWorkflowEndpoint(endpoint);
|
|
83996
84143
|
}
|
|
83997
84144
|
return doc;
|
|
83998
84145
|
}
|
|
@@ -89599,6 +89746,287 @@ function registerDiagramTools(mcp) {
|
|
|
89599
89746
|
);
|
|
89600
89747
|
}
|
|
89601
89748
|
|
|
89749
|
+
// src/docs/index.ts
|
|
89750
|
+
import * as fs27 from "fs";
|
|
89751
|
+
import * as path30 from "path";
|
|
89752
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
89753
|
+
function getDocsDir() {
|
|
89754
|
+
const thisFile = fileURLToPath4(import.meta.url);
|
|
89755
|
+
const packageRoot = path30.resolve(path30.dirname(thisFile), "..", "..");
|
|
89756
|
+
return path30.join(packageRoot, "docs", "reference");
|
|
89757
|
+
}
|
|
89758
|
+
function parseFrontmatter(raw) {
|
|
89759
|
+
const fmMatch = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
89760
|
+
if (!fmMatch) {
|
|
89761
|
+
return {
|
|
89762
|
+
frontmatter: { name: "", description: "", keywords: [] },
|
|
89763
|
+
body: raw
|
|
89764
|
+
};
|
|
89765
|
+
}
|
|
89766
|
+
const fmBlock = fmMatch[1];
|
|
89767
|
+
const body = fmMatch[2];
|
|
89768
|
+
let name = "";
|
|
89769
|
+
let description = "";
|
|
89770
|
+
let keywords = [];
|
|
89771
|
+
for (const line of fmBlock.split("\n")) {
|
|
89772
|
+
const nameMatch = line.match(/^name:\s*(.+)$/);
|
|
89773
|
+
if (nameMatch) {
|
|
89774
|
+
name = nameMatch[1].trim();
|
|
89775
|
+
continue;
|
|
89776
|
+
}
|
|
89777
|
+
const descMatch = line.match(/^description:\s*(.+)$/);
|
|
89778
|
+
if (descMatch) {
|
|
89779
|
+
description = descMatch[1].trim();
|
|
89780
|
+
continue;
|
|
89781
|
+
}
|
|
89782
|
+
const kwMatch = line.match(/^keywords:\s*\[(.+)\]$/);
|
|
89783
|
+
if (kwMatch) {
|
|
89784
|
+
keywords = kwMatch[1].split(",").map((k) => k.trim().replace(/^['"]|['"]$/g, ""));
|
|
89785
|
+
continue;
|
|
89786
|
+
}
|
|
89787
|
+
}
|
|
89788
|
+
return { frontmatter: { name, description, keywords }, body };
|
|
89789
|
+
}
|
|
89790
|
+
function splitSections(body) {
|
|
89791
|
+
const lines = body.split("\n");
|
|
89792
|
+
const sections = [];
|
|
89793
|
+
let currentHeading = "";
|
|
89794
|
+
let currentLevel = 0;
|
|
89795
|
+
let currentLines = [];
|
|
89796
|
+
function flush() {
|
|
89797
|
+
if (currentHeading || currentLines.length > 0) {
|
|
89798
|
+
const content = currentLines.join("\n").trim();
|
|
89799
|
+
const codeBlocks = [];
|
|
89800
|
+
const codeRe = /```[\s\S]*?```/g;
|
|
89801
|
+
let m;
|
|
89802
|
+
while ((m = codeRe.exec(content)) !== null) {
|
|
89803
|
+
codeBlocks.push(m[0]);
|
|
89804
|
+
}
|
|
89805
|
+
sections.push({
|
|
89806
|
+
heading: currentHeading,
|
|
89807
|
+
level: currentLevel,
|
|
89808
|
+
content,
|
|
89809
|
+
codeBlocks
|
|
89810
|
+
});
|
|
89811
|
+
}
|
|
89812
|
+
}
|
|
89813
|
+
for (const line of lines) {
|
|
89814
|
+
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
89815
|
+
if (headingMatch) {
|
|
89816
|
+
flush();
|
|
89817
|
+
currentLevel = headingMatch[1].length;
|
|
89818
|
+
currentHeading = headingMatch[2];
|
|
89819
|
+
currentLines = [];
|
|
89820
|
+
} else {
|
|
89821
|
+
currentLines.push(line);
|
|
89822
|
+
}
|
|
89823
|
+
}
|
|
89824
|
+
flush();
|
|
89825
|
+
return sections;
|
|
89826
|
+
}
|
|
89827
|
+
function listTopics() {
|
|
89828
|
+
const docsDir = getDocsDir();
|
|
89829
|
+
if (!fs27.existsSync(docsDir)) return [];
|
|
89830
|
+
const files = fs27.readdirSync(docsDir).filter((f) => f.endsWith(".md")).sort();
|
|
89831
|
+
return files.map((file) => {
|
|
89832
|
+
const raw = fs27.readFileSync(path30.join(docsDir, file), "utf-8");
|
|
89833
|
+
const { frontmatter } = parseFrontmatter(raw);
|
|
89834
|
+
return {
|
|
89835
|
+
slug: file.replace(/\.md$/, ""),
|
|
89836
|
+
name: frontmatter.name,
|
|
89837
|
+
description: frontmatter.description,
|
|
89838
|
+
keywords: frontmatter.keywords
|
|
89839
|
+
};
|
|
89840
|
+
});
|
|
89841
|
+
}
|
|
89842
|
+
function readTopic(slug, compact2) {
|
|
89843
|
+
const docsDir = getDocsDir();
|
|
89844
|
+
const filePath = path30.join(docsDir, `${slug}.md`);
|
|
89845
|
+
if (!fs27.existsSync(filePath)) return null;
|
|
89846
|
+
const raw = fs27.readFileSync(filePath, "utf-8");
|
|
89847
|
+
const { frontmatter, body } = parseFrontmatter(raw);
|
|
89848
|
+
const content = compact2 ? buildCompactContent(frontmatter, body) : body.trim();
|
|
89849
|
+
return {
|
|
89850
|
+
slug,
|
|
89851
|
+
name: frontmatter.name,
|
|
89852
|
+
description: frontmatter.description,
|
|
89853
|
+
keywords: frontmatter.keywords,
|
|
89854
|
+
content
|
|
89855
|
+
};
|
|
89856
|
+
}
|
|
89857
|
+
function readTopicStructured(slug) {
|
|
89858
|
+
const docsDir = getDocsDir();
|
|
89859
|
+
const filePath = path30.join(docsDir, `${slug}.md`);
|
|
89860
|
+
if (!fs27.existsSync(filePath)) return null;
|
|
89861
|
+
const raw = fs27.readFileSync(filePath, "utf-8");
|
|
89862
|
+
const { frontmatter, body } = parseFrontmatter(raw);
|
|
89863
|
+
const sections = splitSections(body);
|
|
89864
|
+
return {
|
|
89865
|
+
slug,
|
|
89866
|
+
name: frontmatter.name,
|
|
89867
|
+
description: frontmatter.description,
|
|
89868
|
+
keywords: frontmatter.keywords,
|
|
89869
|
+
sections
|
|
89870
|
+
};
|
|
89871
|
+
}
|
|
89872
|
+
function searchDocs(query) {
|
|
89873
|
+
const topics = listTopics();
|
|
89874
|
+
const docsDir = getDocsDir();
|
|
89875
|
+
const queryLower = query.toLowerCase();
|
|
89876
|
+
const queryTerms = queryLower.split(/\s+/).filter(Boolean);
|
|
89877
|
+
const results = [];
|
|
89878
|
+
for (const topic of topics) {
|
|
89879
|
+
const keywordMatch = topic.keywords.some(
|
|
89880
|
+
(kw) => queryTerms.some((term) => kw.toLowerCase().includes(term))
|
|
89881
|
+
);
|
|
89882
|
+
const filePath = path30.join(docsDir, `${topic.slug}.md`);
|
|
89883
|
+
const raw = fs27.readFileSync(filePath, "utf-8");
|
|
89884
|
+
const { body } = parseFrontmatter(raw);
|
|
89885
|
+
const sections = splitSections(body);
|
|
89886
|
+
for (const section of sections) {
|
|
89887
|
+
const sectionLower = section.content.toLowerCase();
|
|
89888
|
+
const headingLower = section.heading.toLowerCase();
|
|
89889
|
+
let relevance = 0;
|
|
89890
|
+
if (sectionLower.includes(queryLower)) {
|
|
89891
|
+
relevance += 10;
|
|
89892
|
+
}
|
|
89893
|
+
for (const term of queryTerms) {
|
|
89894
|
+
if (headingLower.includes(term)) relevance += 5;
|
|
89895
|
+
if (sectionLower.includes(term)) relevance += 2;
|
|
89896
|
+
}
|
|
89897
|
+
if (keywordMatch) relevance += 3;
|
|
89898
|
+
if (relevance > 0) {
|
|
89899
|
+
const lines = section.content.split("\n");
|
|
89900
|
+
const matchingLines = [];
|
|
89901
|
+
for (const line of lines) {
|
|
89902
|
+
if (queryTerms.some((term) => line.toLowerCase().includes(term))) {
|
|
89903
|
+
matchingLines.push(line.trim());
|
|
89904
|
+
if (matchingLines.length >= 3) break;
|
|
89905
|
+
}
|
|
89906
|
+
}
|
|
89907
|
+
results.push({
|
|
89908
|
+
topic: topic.name,
|
|
89909
|
+
slug: topic.slug,
|
|
89910
|
+
section: section.heading,
|
|
89911
|
+
heading: section.heading,
|
|
89912
|
+
excerpt: matchingLines.join("\n") || section.content.slice(0, 200),
|
|
89913
|
+
relevance
|
|
89914
|
+
});
|
|
89915
|
+
}
|
|
89916
|
+
}
|
|
89917
|
+
}
|
|
89918
|
+
results.sort((a, b) => b.relevance - a.relevance);
|
|
89919
|
+
return results;
|
|
89920
|
+
}
|
|
89921
|
+
function buildCompactContent(frontmatter, body) {
|
|
89922
|
+
const lines = body.split("\n");
|
|
89923
|
+
const output = [];
|
|
89924
|
+
output.push(`# ${frontmatter.name}`);
|
|
89925
|
+
output.push(frontmatter.description);
|
|
89926
|
+
output.push("");
|
|
89927
|
+
let inCodeBlock = false;
|
|
89928
|
+
let inTable = false;
|
|
89929
|
+
for (const line of lines) {
|
|
89930
|
+
if (line.trimStart().startsWith("```")) {
|
|
89931
|
+
inCodeBlock = !inCodeBlock;
|
|
89932
|
+
output.push(line);
|
|
89933
|
+
continue;
|
|
89934
|
+
}
|
|
89935
|
+
if (inCodeBlock) {
|
|
89936
|
+
output.push(line);
|
|
89937
|
+
continue;
|
|
89938
|
+
}
|
|
89939
|
+
if (line.match(/^#{1,6}\s/)) {
|
|
89940
|
+
output.push("");
|
|
89941
|
+
output.push(line);
|
|
89942
|
+
continue;
|
|
89943
|
+
}
|
|
89944
|
+
if (line.trim().startsWith("|")) {
|
|
89945
|
+
inTable = true;
|
|
89946
|
+
output.push(line);
|
|
89947
|
+
continue;
|
|
89948
|
+
}
|
|
89949
|
+
if (inTable && !line.trim().startsWith("|")) {
|
|
89950
|
+
inTable = false;
|
|
89951
|
+
}
|
|
89952
|
+
if (line.trim().startsWith("- ") || line.trim().startsWith("* ") || line.trim().startsWith("> ")) {
|
|
89953
|
+
output.push(line);
|
|
89954
|
+
continue;
|
|
89955
|
+
}
|
|
89956
|
+
}
|
|
89957
|
+
return output.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
89958
|
+
}
|
|
89959
|
+
|
|
89960
|
+
// src/mcp/tools-docs.ts
|
|
89961
|
+
function registerDocsTools(mcp) {
|
|
89962
|
+
mcp.tool(
|
|
89963
|
+
"fw_docs",
|
|
89964
|
+
'Browse Flow Weaver documentation and reference guides. Use action="list" to see topics, action="read" to read a topic, action="search" to search across all docs.',
|
|
89965
|
+
{
|
|
89966
|
+
action: external_exports.enum(["list", "read", "search"]).describe("What to do: list topics, read a topic, or search"),
|
|
89967
|
+
topic: external_exports.string().optional().describe('Topic slug to read (for action="read")'),
|
|
89968
|
+
query: external_exports.string().optional().describe('Search query (for action="search")'),
|
|
89969
|
+
compact: external_exports.boolean().optional().describe("Return compact LLM-friendly version (default: false)")
|
|
89970
|
+
},
|
|
89971
|
+
async (args) => {
|
|
89972
|
+
try {
|
|
89973
|
+
switch (args.action) {
|
|
89974
|
+
case "list": {
|
|
89975
|
+
const topics = listTopics();
|
|
89976
|
+
return makeToolResult({
|
|
89977
|
+
topics: topics.map((t) => ({
|
|
89978
|
+
slug: t.slug,
|
|
89979
|
+
name: t.name,
|
|
89980
|
+
description: t.description,
|
|
89981
|
+
keywords: t.keywords
|
|
89982
|
+
}))
|
|
89983
|
+
});
|
|
89984
|
+
}
|
|
89985
|
+
case "read": {
|
|
89986
|
+
if (!args.topic) {
|
|
89987
|
+
return makeErrorResult("MISSING_PARAM", 'The "topic" parameter is required for action="read"');
|
|
89988
|
+
}
|
|
89989
|
+
const doc = readTopic(args.topic, args.compact ?? false);
|
|
89990
|
+
if (!doc) {
|
|
89991
|
+
const available = listTopics().map((t) => t.slug);
|
|
89992
|
+
return makeErrorResult(
|
|
89993
|
+
"TOPIC_NOT_FOUND",
|
|
89994
|
+
`Unknown topic "${args.topic}". Available topics: ${available.join(", ")}`
|
|
89995
|
+
);
|
|
89996
|
+
}
|
|
89997
|
+
return makeToolResult({
|
|
89998
|
+
name: doc.name,
|
|
89999
|
+
description: doc.description,
|
|
90000
|
+
content: doc.content
|
|
90001
|
+
});
|
|
90002
|
+
}
|
|
90003
|
+
case "search": {
|
|
90004
|
+
if (!args.query) {
|
|
90005
|
+
return makeErrorResult("MISSING_PARAM", 'The "query" parameter is required for action="search"');
|
|
90006
|
+
}
|
|
90007
|
+
const results = searchDocs(args.query);
|
|
90008
|
+
return makeToolResult({
|
|
90009
|
+
query: args.query,
|
|
90010
|
+
results: results.slice(0, 20).map((r) => ({
|
|
90011
|
+
topic: r.topic,
|
|
90012
|
+
slug: r.slug,
|
|
90013
|
+
heading: r.heading,
|
|
90014
|
+
excerpt: r.excerpt,
|
|
90015
|
+
relevance: r.relevance
|
|
90016
|
+
}))
|
|
90017
|
+
});
|
|
90018
|
+
}
|
|
90019
|
+
}
|
|
90020
|
+
} catch (err) {
|
|
90021
|
+
return makeErrorResult(
|
|
90022
|
+
"DOCS_ERROR",
|
|
90023
|
+
`fw_docs failed: ${err instanceof Error ? err.message : String(err)}`
|
|
90024
|
+
);
|
|
90025
|
+
}
|
|
90026
|
+
}
|
|
90027
|
+
);
|
|
90028
|
+
}
|
|
90029
|
+
|
|
89602
90030
|
// src/mcp/resources.ts
|
|
89603
90031
|
function registerResources(mcp, connection, buffer) {
|
|
89604
90032
|
mcp.resource(
|
|
@@ -89701,6 +90129,7 @@ async function startMcpServer(options) {
|
|
|
89701
90129
|
registerExportTools(mcp);
|
|
89702
90130
|
registerMarketplaceTools(mcp);
|
|
89703
90131
|
registerDiagramTools(mcp);
|
|
90132
|
+
registerDocsTools(mcp);
|
|
89704
90133
|
registerResources(mcp, connection, buffer);
|
|
89705
90134
|
if (!options._testDeps && options.stdio) {
|
|
89706
90135
|
const transport = new StdioServerTransport();
|
|
@@ -89732,20 +90161,20 @@ async function sendCommand(serverUrl, action, params) {
|
|
|
89732
90161
|
transports: ["websocket", "polling"]
|
|
89733
90162
|
});
|
|
89734
90163
|
try {
|
|
89735
|
-
await new Promise((
|
|
89736
|
-
socket.on("connect", () =>
|
|
90164
|
+
await new Promise((resolve27, reject2) => {
|
|
90165
|
+
socket.on("connect", () => resolve27());
|
|
89737
90166
|
socket.on("connect_error", (err) => reject2(err));
|
|
89738
90167
|
setTimeout(() => reject2(new Error("Connection timeout")), ACK_TIMEOUT);
|
|
89739
90168
|
});
|
|
89740
90169
|
const requestId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
89741
|
-
const result = await new Promise((
|
|
90170
|
+
const result = await new Promise((resolve27) => {
|
|
89742
90171
|
const timeout = setTimeout(() => {
|
|
89743
|
-
|
|
90172
|
+
resolve27({ requestId, success: false, error: "Timeout" });
|
|
89744
90173
|
}, ACK_TIMEOUT);
|
|
89745
90174
|
socket.on("fw:ack", (data) => {
|
|
89746
90175
|
if (data.requestId === requestId) {
|
|
89747
90176
|
clearTimeout(timeout);
|
|
89748
|
-
|
|
90177
|
+
resolve27(data);
|
|
89749
90178
|
}
|
|
89750
90179
|
});
|
|
89751
90180
|
socket.emit("integration:command", { requestId, action, params });
|
|
@@ -89775,20 +90204,20 @@ async function sendBatch(serverUrl, commands) {
|
|
|
89775
90204
|
transports: ["websocket", "polling"]
|
|
89776
90205
|
});
|
|
89777
90206
|
try {
|
|
89778
|
-
await new Promise((
|
|
89779
|
-
socket.on("connect", () =>
|
|
90207
|
+
await new Promise((resolve27, reject2) => {
|
|
90208
|
+
socket.on("connect", () => resolve27());
|
|
89780
90209
|
socket.on("connect_error", (err) => reject2(err));
|
|
89781
90210
|
setTimeout(() => reject2(new Error("Connection timeout")), ACK_TIMEOUT);
|
|
89782
90211
|
});
|
|
89783
90212
|
const requestId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
89784
|
-
const result = await new Promise((
|
|
90213
|
+
const result = await new Promise((resolve27) => {
|
|
89785
90214
|
const timeout = setTimeout(() => {
|
|
89786
|
-
|
|
90215
|
+
resolve27({ requestId, success: false, error: "Timeout" });
|
|
89787
90216
|
}, ACK_TIMEOUT);
|
|
89788
90217
|
socket.on("fw:ack", (data) => {
|
|
89789
90218
|
if (data.requestId === requestId) {
|
|
89790
90219
|
clearTimeout(timeout);
|
|
89791
|
-
|
|
90220
|
+
resolve27(data);
|
|
89792
90221
|
}
|
|
89793
90222
|
});
|
|
89794
90223
|
socket.emit("integration:batch", { requestId, commands });
|
|
@@ -89842,7 +90271,7 @@ async function uiBatch(json2, options) {
|
|
|
89842
90271
|
}
|
|
89843
90272
|
|
|
89844
90273
|
// src/cli/commands/grammar.ts
|
|
89845
|
-
import * as
|
|
90274
|
+
import * as fs28 from "fs";
|
|
89846
90275
|
async function grammarCommand(options = {}) {
|
|
89847
90276
|
const { format = "html", output } = options;
|
|
89848
90277
|
try {
|
|
@@ -89861,7 +90290,7 @@ async function grammarCommand(options = {}) {
|
|
|
89861
90290
|
content = generateGrammarDiagrams();
|
|
89862
90291
|
}
|
|
89863
90292
|
if (output) {
|
|
89864
|
-
|
|
90293
|
+
fs28.writeFileSync(output, content, "utf-8");
|
|
89865
90294
|
logger.success(`Grammar written to ${output}`);
|
|
89866
90295
|
} else {
|
|
89867
90296
|
process.stdout.write(content);
|
|
@@ -89873,11 +90302,11 @@ async function grammarCommand(options = {}) {
|
|
|
89873
90302
|
}
|
|
89874
90303
|
|
|
89875
90304
|
// src/cli/commands/run.ts
|
|
89876
|
-
import * as
|
|
89877
|
-
import * as
|
|
90305
|
+
import * as path31 from "path";
|
|
90306
|
+
import * as fs29 from "fs";
|
|
89878
90307
|
async function runCommand(input, options) {
|
|
89879
|
-
const filePath =
|
|
89880
|
-
if (!
|
|
90308
|
+
const filePath = path31.resolve(input);
|
|
90309
|
+
if (!fs29.existsSync(filePath)) {
|
|
89881
90310
|
throw new Error(`File not found: ${filePath}`);
|
|
89882
90311
|
}
|
|
89883
90312
|
let params = {};
|
|
@@ -89888,12 +90317,12 @@ async function runCommand(input, options) {
|
|
|
89888
90317
|
throw new Error(`Invalid JSON in --params: ${options.params}`);
|
|
89889
90318
|
}
|
|
89890
90319
|
} else if (options.paramsFile) {
|
|
89891
|
-
const paramsFilePath =
|
|
89892
|
-
if (!
|
|
90320
|
+
const paramsFilePath = path31.resolve(options.paramsFile);
|
|
90321
|
+
if (!fs29.existsSync(paramsFilePath)) {
|
|
89893
90322
|
throw new Error(`Params file not found: ${paramsFilePath}`);
|
|
89894
90323
|
}
|
|
89895
90324
|
try {
|
|
89896
|
-
const content =
|
|
90325
|
+
const content = fs29.readFileSync(paramsFilePath, "utf8");
|
|
89897
90326
|
params = JSON.parse(content);
|
|
89898
90327
|
} catch {
|
|
89899
90328
|
throw new Error(`Failed to parse params file: ${options.paramsFile}`);
|
|
@@ -89907,12 +90336,12 @@ async function runCommand(input, options) {
|
|
|
89907
90336
|
throw new Error(`Invalid JSON in --mocks: ${options.mocks}`);
|
|
89908
90337
|
}
|
|
89909
90338
|
} else if (options.mocksFile) {
|
|
89910
|
-
const mocksFilePath =
|
|
89911
|
-
if (!
|
|
90339
|
+
const mocksFilePath = path31.resolve(options.mocksFile);
|
|
90340
|
+
if (!fs29.existsSync(mocksFilePath)) {
|
|
89912
90341
|
throw new Error(`Mocks file not found: ${mocksFilePath}`);
|
|
89913
90342
|
}
|
|
89914
90343
|
try {
|
|
89915
|
-
const content =
|
|
90344
|
+
const content = fs29.readFileSync(mocksFilePath, "utf8");
|
|
89916
90345
|
mocks = JSON.parse(content);
|
|
89917
90346
|
} catch {
|
|
89918
90347
|
throw new Error(`Failed to parse mocks file: ${options.mocksFile}`);
|
|
@@ -90013,12 +90442,12 @@ async function runCommand(input, options) {
|
|
|
90013
90442
|
}
|
|
90014
90443
|
|
|
90015
90444
|
// src/cli/commands/serve.ts
|
|
90016
|
-
import * as
|
|
90017
|
-
import * as
|
|
90445
|
+
import * as path32 from "path";
|
|
90446
|
+
import * as fs31 from "fs";
|
|
90018
90447
|
|
|
90019
90448
|
// src/server/workflow-registry.ts
|
|
90020
90449
|
init_esm5();
|
|
90021
|
-
import * as
|
|
90450
|
+
import * as fs30 from "fs";
|
|
90022
90451
|
var WorkflowRegistry = class {
|
|
90023
90452
|
constructor(workflowDir, options = {}) {
|
|
90024
90453
|
this.workflowDir = workflowDir;
|
|
@@ -90053,7 +90482,7 @@ var WorkflowRegistry = class {
|
|
|
90053
90482
|
this.endpoints.clear();
|
|
90054
90483
|
for (const file of files) {
|
|
90055
90484
|
try {
|
|
90056
|
-
const content =
|
|
90485
|
+
const content = fs30.readFileSync(file, "utf8");
|
|
90057
90486
|
if (!content.includes("@flowWeaver")) {
|
|
90058
90487
|
continue;
|
|
90059
90488
|
}
|
|
@@ -90445,11 +90874,11 @@ var WebhookServer = class {
|
|
|
90445
90874
|
|
|
90446
90875
|
// src/cli/commands/serve.ts
|
|
90447
90876
|
async function serveCommand(dir, options) {
|
|
90448
|
-
const workflowDir =
|
|
90449
|
-
if (!
|
|
90877
|
+
const workflowDir = path32.resolve(dir || ".");
|
|
90878
|
+
if (!fs31.existsSync(workflowDir)) {
|
|
90450
90879
|
throw new Error(`Directory not found: ${workflowDir}`);
|
|
90451
90880
|
}
|
|
90452
|
-
if (!
|
|
90881
|
+
if (!fs31.statSync(workflowDir).isDirectory()) {
|
|
90453
90882
|
throw new Error(`Not a directory: ${workflowDir}`);
|
|
90454
90883
|
}
|
|
90455
90884
|
const port = options.port ?? 3e3;
|
|
@@ -90492,10 +90921,10 @@ async function serveCommand(dir, options) {
|
|
|
90492
90921
|
}
|
|
90493
90922
|
|
|
90494
90923
|
// src/export/index.ts
|
|
90495
|
-
import * as
|
|
90496
|
-
import * as
|
|
90924
|
+
import * as path33 from "path";
|
|
90925
|
+
import * as fs32 from "fs";
|
|
90497
90926
|
import * as os3 from "os";
|
|
90498
|
-
import { fileURLToPath as
|
|
90927
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
90499
90928
|
|
|
90500
90929
|
// src/export/templates.ts
|
|
90501
90930
|
var LAMBDA_TEMPLATE = `{{GENERATED_HEADER}}
|
|
@@ -90667,13 +91096,13 @@ Outputs:
|
|
|
90667
91096
|
`;
|
|
90668
91097
|
|
|
90669
91098
|
// src/export/index.ts
|
|
90670
|
-
var __filename =
|
|
90671
|
-
var __dirname2 =
|
|
91099
|
+
var __filename = fileURLToPath5(import.meta.url);
|
|
91100
|
+
var __dirname2 = path33.dirname(__filename);
|
|
90672
91101
|
async function exportMultiWorkflow(options) {
|
|
90673
|
-
const inputPath =
|
|
90674
|
-
const outputDir =
|
|
91102
|
+
const inputPath = path33.resolve(options.input);
|
|
91103
|
+
const outputDir = path33.resolve(options.output);
|
|
90675
91104
|
const isDryRun = options.dryRun ?? false;
|
|
90676
|
-
if (!
|
|
91105
|
+
if (!fs32.existsSync(inputPath)) {
|
|
90677
91106
|
throw new Error(`Input file not found: ${inputPath}`);
|
|
90678
91107
|
}
|
|
90679
91108
|
const parser3 = new AnnotationParser();
|
|
@@ -90691,22 +91120,22 @@ async function exportMultiWorkflow(options) {
|
|
|
90691
91120
|
throw new Error(`None of the requested workflows found. Available: ${available}`);
|
|
90692
91121
|
}
|
|
90693
91122
|
}
|
|
90694
|
-
const workDir = isDryRun ?
|
|
90695
|
-
|
|
90696
|
-
|
|
90697
|
-
|
|
91123
|
+
const workDir = isDryRun ? path33.join(os3.tmpdir(), `fw-export-multi-dryrun-${Date.now()}`) : outputDir;
|
|
91124
|
+
fs32.mkdirSync(workDir, { recursive: true });
|
|
91125
|
+
fs32.mkdirSync(path33.join(workDir, "workflows"), { recursive: true });
|
|
91126
|
+
fs32.mkdirSync(path33.join(workDir, "runtime"), { recursive: true });
|
|
90698
91127
|
const compiledWorkflows = [];
|
|
90699
91128
|
try {
|
|
90700
91129
|
for (const workflow of selectedWorkflows) {
|
|
90701
|
-
const workflowOutputPath =
|
|
90702
|
-
|
|
91130
|
+
const workflowOutputPath = path33.join(workDir, "workflows", `${workflow.name}.ts`);
|
|
91131
|
+
fs32.copyFileSync(inputPath, workflowOutputPath);
|
|
90703
91132
|
await compileWorkflow(workflowOutputPath, {
|
|
90704
91133
|
write: true,
|
|
90705
91134
|
inPlace: true,
|
|
90706
91135
|
parse: { workflowName: workflow.functionName },
|
|
90707
91136
|
generate: { production: options.production ?? true }
|
|
90708
91137
|
});
|
|
90709
|
-
const compiledCode =
|
|
91138
|
+
const compiledCode = fs32.readFileSync(workflowOutputPath, "utf8");
|
|
90710
91139
|
compiledWorkflows.push({
|
|
90711
91140
|
name: workflow.name,
|
|
90712
91141
|
functionName: workflow.functionName,
|
|
@@ -90714,24 +91143,24 @@ async function exportMultiWorkflow(options) {
|
|
|
90714
91143
|
code: compiledCode
|
|
90715
91144
|
});
|
|
90716
91145
|
}
|
|
90717
|
-
const runtimeDir =
|
|
90718
|
-
const libraryRuntimeDir =
|
|
91146
|
+
const runtimeDir = path33.join(workDir, "runtime");
|
|
91147
|
+
const libraryRuntimeDir = path33.resolve(__dirname2, "../runtime");
|
|
90719
91148
|
const runtimeFiles = ["function-registry.ts", "parameter-resolver.ts", "builtin-functions.ts"];
|
|
90720
91149
|
for (const file of runtimeFiles) {
|
|
90721
|
-
const srcPath =
|
|
90722
|
-
const destPath =
|
|
90723
|
-
if (
|
|
90724
|
-
|
|
91150
|
+
const srcPath = path33.join(libraryRuntimeDir, file);
|
|
91151
|
+
const destPath = path33.join(runtimeDir, file);
|
|
91152
|
+
if (fs32.existsSync(srcPath)) {
|
|
91153
|
+
fs32.copyFileSync(srcPath, destPath);
|
|
90725
91154
|
}
|
|
90726
91155
|
}
|
|
90727
91156
|
const result = generateMultiHandler(options.target, compiledWorkflows, workDir, options);
|
|
90728
91157
|
if (!isDryRun) {
|
|
90729
91158
|
for (const file of result.files) {
|
|
90730
|
-
const dirPath =
|
|
90731
|
-
if (!
|
|
90732
|
-
|
|
91159
|
+
const dirPath = path33.dirname(file.path);
|
|
91160
|
+
if (!fs32.existsSync(dirPath)) {
|
|
91161
|
+
fs32.mkdirSync(dirPath, { recursive: true });
|
|
90733
91162
|
}
|
|
90734
|
-
|
|
91163
|
+
fs32.writeFileSync(file.path, file.content);
|
|
90735
91164
|
}
|
|
90736
91165
|
}
|
|
90737
91166
|
return {
|
|
@@ -90744,7 +91173,7 @@ async function exportMultiWorkflow(options) {
|
|
|
90744
91173
|
} finally {
|
|
90745
91174
|
if (isDryRun) {
|
|
90746
91175
|
try {
|
|
90747
|
-
|
|
91176
|
+
fs32.rmSync(workDir, { recursive: true, force: true });
|
|
90748
91177
|
} catch {
|
|
90749
91178
|
}
|
|
90750
91179
|
}
|
|
@@ -90752,28 +91181,28 @@ async function exportMultiWorkflow(options) {
|
|
|
90752
91181
|
}
|
|
90753
91182
|
function generateMultiHandler(target, workflows, outputDir, options) {
|
|
90754
91183
|
const files = [];
|
|
90755
|
-
const serviceName =
|
|
91184
|
+
const serviceName = path33.basename(options.input, path33.extname(options.input)) + "-service";
|
|
90756
91185
|
const workflowImports = workflows.map((w) => `import { ${w.functionName} } from './workflows/${w.name}.js';`).join("\n");
|
|
90757
91186
|
const workflowEntries = workflows.map((w) => ` '${w.name}': ${w.functionName},`).join("\n");
|
|
90758
91187
|
const openApiSpec = generateMultiWorkflowOpenAPI(workflows, serviceName);
|
|
90759
91188
|
switch (target) {
|
|
90760
91189
|
case "lambda":
|
|
90761
91190
|
files.push({
|
|
90762
|
-
path:
|
|
91191
|
+
path: path33.join(outputDir, "handler.ts"),
|
|
90763
91192
|
content: generateLambdaMultiHandler(workflowImports, workflowEntries, serviceName)
|
|
90764
91193
|
});
|
|
90765
91194
|
files.push({
|
|
90766
|
-
path:
|
|
91195
|
+
path: path33.join(outputDir, "openapi.ts"),
|
|
90767
91196
|
content: `// Generated OpenAPI specification
|
|
90768
91197
|
export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
90769
91198
|
`
|
|
90770
91199
|
});
|
|
90771
91200
|
files.push({
|
|
90772
|
-
path:
|
|
91201
|
+
path: path33.join(outputDir, "template.yaml"),
|
|
90773
91202
|
content: generateLambdaSAMMultiTemplate(serviceName, workflows.length)
|
|
90774
91203
|
});
|
|
90775
91204
|
files.push({
|
|
90776
|
-
path:
|
|
91205
|
+
path: path33.join(outputDir, "package.json"),
|
|
90777
91206
|
content: JSON.stringify(
|
|
90778
91207
|
{
|
|
90779
91208
|
name: `fw-${serviceName}`,
|
|
@@ -90794,7 +91223,7 @@ export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
|
90794
91223
|
)
|
|
90795
91224
|
});
|
|
90796
91225
|
files.push({
|
|
90797
|
-
path:
|
|
91226
|
+
path: path33.join(outputDir, "tsconfig.json"),
|
|
90798
91227
|
content: JSON.stringify(
|
|
90799
91228
|
{
|
|
90800
91229
|
compilerOptions: {
|
|
@@ -90815,17 +91244,17 @@ export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
|
90815
91244
|
break;
|
|
90816
91245
|
case "vercel":
|
|
90817
91246
|
files.push({
|
|
90818
|
-
path:
|
|
91247
|
+
path: path33.join(outputDir, "api", "[workflow].ts"),
|
|
90819
91248
|
content: generateVercelMultiHandler(workflowImports, workflowEntries, serviceName)
|
|
90820
91249
|
});
|
|
90821
91250
|
files.push({
|
|
90822
|
-
path:
|
|
91251
|
+
path: path33.join(outputDir, "openapi.ts"),
|
|
90823
91252
|
content: `// Generated OpenAPI specification
|
|
90824
91253
|
export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
90825
91254
|
`
|
|
90826
91255
|
});
|
|
90827
91256
|
files.push({
|
|
90828
|
-
path:
|
|
91257
|
+
path: path33.join(outputDir, "vercel.json"),
|
|
90829
91258
|
content: JSON.stringify(
|
|
90830
91259
|
{
|
|
90831
91260
|
functions: {
|
|
@@ -90842,17 +91271,17 @@ export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
|
90842
91271
|
break;
|
|
90843
91272
|
case "cloudflare":
|
|
90844
91273
|
files.push({
|
|
90845
|
-
path:
|
|
91274
|
+
path: path33.join(outputDir, "index.ts"),
|
|
90846
91275
|
content: generateCloudflareMultiHandler(workflowImports, workflowEntries, serviceName)
|
|
90847
91276
|
});
|
|
90848
91277
|
files.push({
|
|
90849
|
-
path:
|
|
91278
|
+
path: path33.join(outputDir, "openapi.ts"),
|
|
90850
91279
|
content: `// Generated OpenAPI specification
|
|
90851
91280
|
export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
90852
91281
|
`
|
|
90853
91282
|
});
|
|
90854
91283
|
files.push({
|
|
90855
|
-
path:
|
|
91284
|
+
path: path33.join(outputDir, "wrangler.toml"),
|
|
90856
91285
|
content: `name = "${serviceName}"
|
|
90857
91286
|
main = "dist/index.js"
|
|
90858
91287
|
compatibility_date = "2024-01-01"
|
|
@@ -90862,7 +91291,7 @@ command = "npm run build"
|
|
|
90862
91291
|
`
|
|
90863
91292
|
});
|
|
90864
91293
|
files.push({
|
|
90865
|
-
path:
|
|
91294
|
+
path: path33.join(outputDir, "package.json"),
|
|
90866
91295
|
content: JSON.stringify(
|
|
90867
91296
|
{
|
|
90868
91297
|
name: `fw-${serviceName}`,
|
|
@@ -90884,7 +91313,7 @@ command = "npm run build"
|
|
|
90884
91313
|
)
|
|
90885
91314
|
});
|
|
90886
91315
|
files.push({
|
|
90887
|
-
path:
|
|
91316
|
+
path: path33.join(outputDir, "tsconfig.json"),
|
|
90888
91317
|
content: JSON.stringify(
|
|
90889
91318
|
{
|
|
90890
91319
|
compilerOptions: {
|
|
@@ -90905,17 +91334,17 @@ command = "npm run build"
|
|
|
90905
91334
|
break;
|
|
90906
91335
|
case "inngest":
|
|
90907
91336
|
files.push({
|
|
90908
|
-
path:
|
|
91337
|
+
path: path33.join(outputDir, "handler.ts"),
|
|
90909
91338
|
content: generateInngestMultiHandler(workflowImports, workflowEntries, serviceName, workflows)
|
|
90910
91339
|
});
|
|
90911
91340
|
files.push({
|
|
90912
|
-
path:
|
|
91341
|
+
path: path33.join(outputDir, "openapi.ts"),
|
|
90913
91342
|
content: `// Generated OpenAPI specification
|
|
90914
91343
|
export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
90915
91344
|
`
|
|
90916
91345
|
});
|
|
90917
91346
|
files.push({
|
|
90918
|
-
path:
|
|
91347
|
+
path: path33.join(outputDir, "package.json"),
|
|
90919
91348
|
content: JSON.stringify(
|
|
90920
91349
|
{
|
|
90921
91350
|
name: `fw-${serviceName}`,
|
|
@@ -90941,7 +91370,7 @@ export const openApiSpec = ${JSON.stringify(openApiSpec, null, 2)};
|
|
|
90941
91370
|
)
|
|
90942
91371
|
});
|
|
90943
91372
|
files.push({
|
|
90944
|
-
path:
|
|
91373
|
+
path: path33.join(outputDir, "tsconfig.json"),
|
|
90945
91374
|
content: JSON.stringify(
|
|
90946
91375
|
{
|
|
90947
91376
|
compilerOptions: {
|
|
@@ -91397,10 +91826,10 @@ async function exportWorkflow(options) {
|
|
|
91397
91826
|
if (options.multi) {
|
|
91398
91827
|
return exportMultiWorkflow(options);
|
|
91399
91828
|
}
|
|
91400
|
-
const inputPath =
|
|
91401
|
-
const outputDir =
|
|
91829
|
+
const inputPath = path33.resolve(options.input);
|
|
91830
|
+
const outputDir = path33.resolve(options.output);
|
|
91402
91831
|
const isDryRun = options.dryRun ?? false;
|
|
91403
|
-
if (!
|
|
91832
|
+
if (!fs32.existsSync(inputPath)) {
|
|
91404
91833
|
throw new Error(`Input file not found: ${inputPath}`);
|
|
91405
91834
|
}
|
|
91406
91835
|
const parser3 = new AnnotationParser();
|
|
@@ -91415,8 +91844,8 @@ async function exportWorkflow(options) {
|
|
|
91415
91844
|
const available = parseResult.workflows.map((w) => w.name).join(", ");
|
|
91416
91845
|
throw new Error(`Workflow "${options.workflow}" not found. Available: ${available}`);
|
|
91417
91846
|
}
|
|
91418
|
-
const workDir = isDryRun ?
|
|
91419
|
-
|
|
91847
|
+
const workDir = isDryRun ? path33.join(os3.tmpdir(), `fw-export-dryrun-${Date.now()}`) : outputDir;
|
|
91848
|
+
fs32.mkdirSync(workDir, { recursive: true });
|
|
91420
91849
|
let compiledContent;
|
|
91421
91850
|
let compiledPath;
|
|
91422
91851
|
try {
|
|
@@ -91426,11 +91855,11 @@ async function exportWorkflow(options) {
|
|
|
91426
91855
|
workDir,
|
|
91427
91856
|
options.production
|
|
91428
91857
|
);
|
|
91429
|
-
compiledContent =
|
|
91858
|
+
compiledContent = fs32.readFileSync(compiledPath, "utf8");
|
|
91430
91859
|
} finally {
|
|
91431
91860
|
if (isDryRun) {
|
|
91432
91861
|
try {
|
|
91433
|
-
|
|
91862
|
+
fs32.rmSync(workDir, { recursive: true, force: true });
|
|
91434
91863
|
} catch {
|
|
91435
91864
|
}
|
|
91436
91865
|
}
|
|
@@ -91445,8 +91874,8 @@ async function exportWorkflow(options) {
|
|
|
91445
91874
|
handler = generateHandler(options.target, compiledPath, workflow.functionName);
|
|
91446
91875
|
}
|
|
91447
91876
|
const handlerFileName = getHandlerFileName(options.target, workflow.name);
|
|
91448
|
-
const handlerPath =
|
|
91449
|
-
const workflowOutputPath =
|
|
91877
|
+
const handlerPath = path33.join(outputDir, handlerFileName);
|
|
91878
|
+
const workflowOutputPath = path33.join(outputDir, "workflow.ts");
|
|
91450
91879
|
const configFiles = generateConfigFiles(
|
|
91451
91880
|
options.target,
|
|
91452
91881
|
workflow.name,
|
|
@@ -91454,16 +91883,16 @@ async function exportWorkflow(options) {
|
|
|
91454
91883
|
workflow.description
|
|
91455
91884
|
);
|
|
91456
91885
|
if (!isDryRun) {
|
|
91457
|
-
|
|
91458
|
-
const handlerDir =
|
|
91459
|
-
if (!
|
|
91460
|
-
|
|
91886
|
+
fs32.mkdirSync(outputDir, { recursive: true });
|
|
91887
|
+
const handlerDir = path33.dirname(handlerPath);
|
|
91888
|
+
if (!fs32.existsSync(handlerDir)) {
|
|
91889
|
+
fs32.mkdirSync(handlerDir, { recursive: true });
|
|
91461
91890
|
}
|
|
91462
|
-
|
|
91891
|
+
fs32.writeFileSync(handlerPath, handler);
|
|
91463
91892
|
for (const file of configFiles) {
|
|
91464
|
-
|
|
91893
|
+
fs32.writeFileSync(file.path, file.content);
|
|
91465
91894
|
}
|
|
91466
|
-
|
|
91895
|
+
fs32.writeFileSync(workflowOutputPath, compiledContent);
|
|
91467
91896
|
}
|
|
91468
91897
|
const files = [
|
|
91469
91898
|
{ path: handlerPath, content: handler },
|
|
@@ -91478,8 +91907,8 @@ async function exportWorkflow(options) {
|
|
|
91478
91907
|
};
|
|
91479
91908
|
}
|
|
91480
91909
|
async function compileToOutput(inputPath, functionName, outputDir, production) {
|
|
91481
|
-
const outputPath =
|
|
91482
|
-
|
|
91910
|
+
const outputPath = path33.join(outputDir, "workflow.ts");
|
|
91911
|
+
fs32.copyFileSync(inputPath, outputPath);
|
|
91483
91912
|
await compileWorkflow(outputPath, {
|
|
91484
91913
|
write: true,
|
|
91485
91914
|
inPlace: true,
|
|
@@ -91490,7 +91919,7 @@ async function compileToOutput(inputPath, functionName, outputDir, production) {
|
|
|
91490
91919
|
}
|
|
91491
91920
|
function generateHandler(target, workflowPath, functionName) {
|
|
91492
91921
|
const template = getTemplate(target);
|
|
91493
|
-
const relativePath = target === "vercel" ? `../${
|
|
91922
|
+
const relativePath = target === "vercel" ? `../${path33.basename(workflowPath).replace(".ts", ".js")}` : `./${path33.basename(workflowPath).replace(".ts", ".js")}`;
|
|
91494
91923
|
return template.replace("{{GENERATED_HEADER}}", getGeneratedBranding().header(`export --target ${target}`)).replace("{{WORKFLOW_IMPORT}}", `import { ${functionName} } from '${relativePath}';`).replace(/\{\{FUNCTION_NAME\}\}/g, functionName).replace("{{MAX_DURATION}}", "60");
|
|
91495
91924
|
}
|
|
91496
91925
|
function getTemplate(target) {
|
|
@@ -91522,14 +91951,14 @@ function generateConfigFiles(target, workflowName, outputDir, description) {
|
|
|
91522
91951
|
switch (target) {
|
|
91523
91952
|
case "lambda":
|
|
91524
91953
|
files.push({
|
|
91525
|
-
path:
|
|
91954
|
+
path: path33.join(outputDir, "template.yaml"),
|
|
91526
91955
|
content: SAM_TEMPLATE2.replace(/\{\{WORKFLOW_NAME\}\}/g, workflowName).replace(
|
|
91527
91956
|
"{{WORKFLOW_DESCRIPTION}}",
|
|
91528
91957
|
description || `Flow Weaver workflow: ${workflowName}`
|
|
91529
91958
|
).replace(/\{\{WORKFLOW_PATH\}\}/g, workflowName)
|
|
91530
91959
|
});
|
|
91531
91960
|
files.push({
|
|
91532
|
-
path:
|
|
91961
|
+
path: path33.join(outputDir, "package.json"),
|
|
91533
91962
|
content: JSON.stringify(
|
|
91534
91963
|
{
|
|
91535
91964
|
name: `fw-${workflowName}`,
|
|
@@ -91550,7 +91979,7 @@ function generateConfigFiles(target, workflowName, outputDir, description) {
|
|
|
91550
91979
|
)
|
|
91551
91980
|
});
|
|
91552
91981
|
files.push({
|
|
91553
|
-
path:
|
|
91982
|
+
path: path33.join(outputDir, "tsconfig.json"),
|
|
91554
91983
|
content: JSON.stringify(
|
|
91555
91984
|
{
|
|
91556
91985
|
compilerOptions: {
|
|
@@ -91571,7 +92000,7 @@ function generateConfigFiles(target, workflowName, outputDir, description) {
|
|
|
91571
92000
|
break;
|
|
91572
92001
|
case "vercel":
|
|
91573
92002
|
files.push({
|
|
91574
|
-
path:
|
|
92003
|
+
path: path33.join(outputDir, "vercel.json"),
|
|
91575
92004
|
content: JSON.stringify(
|
|
91576
92005
|
{
|
|
91577
92006
|
functions: {
|
|
@@ -91588,7 +92017,7 @@ function generateConfigFiles(target, workflowName, outputDir, description) {
|
|
|
91588
92017
|
break;
|
|
91589
92018
|
case "cloudflare":
|
|
91590
92019
|
files.push({
|
|
91591
|
-
path:
|
|
92020
|
+
path: path33.join(outputDir, "wrangler.toml"),
|
|
91592
92021
|
content: `name = "${workflowName}"
|
|
91593
92022
|
main = "dist/index.js"
|
|
91594
92023
|
compatibility_date = "2024-01-01"
|
|
@@ -91598,7 +92027,7 @@ command = "npm run build"
|
|
|
91598
92027
|
`
|
|
91599
92028
|
});
|
|
91600
92029
|
files.push({
|
|
91601
|
-
path:
|
|
92030
|
+
path: path33.join(outputDir, "package.json"),
|
|
91602
92031
|
content: JSON.stringify(
|
|
91603
92032
|
{
|
|
91604
92033
|
name: `fw-${workflowName}`,
|
|
@@ -91620,7 +92049,7 @@ command = "npm run build"
|
|
|
91620
92049
|
)
|
|
91621
92050
|
});
|
|
91622
92051
|
files.push({
|
|
91623
|
-
path:
|
|
92052
|
+
path: path33.join(outputDir, "tsconfig.json"),
|
|
91624
92053
|
content: JSON.stringify(
|
|
91625
92054
|
{
|
|
91626
92055
|
compilerOptions: {
|
|
@@ -91641,7 +92070,7 @@ command = "npm run build"
|
|
|
91641
92070
|
break;
|
|
91642
92071
|
case "inngest":
|
|
91643
92072
|
files.push({
|
|
91644
|
-
path:
|
|
92073
|
+
path: path33.join(outputDir, "package.json"),
|
|
91645
92074
|
content: JSON.stringify(
|
|
91646
92075
|
{
|
|
91647
92076
|
name: `fw-${workflowName}`,
|
|
@@ -91665,7 +92094,7 @@ command = "npm run build"
|
|
|
91665
92094
|
)
|
|
91666
92095
|
});
|
|
91667
92096
|
files.push({
|
|
91668
|
-
path:
|
|
92097
|
+
path: path33.join(outputDir, "tsconfig.json"),
|
|
91669
92098
|
content: JSON.stringify(
|
|
91670
92099
|
{
|
|
91671
92100
|
compilerOptions: {
|
|
@@ -91817,14 +92246,14 @@ async function exportCommand(input, options) {
|
|
|
91817
92246
|
}
|
|
91818
92247
|
|
|
91819
92248
|
// src/cli/commands/openapi.ts
|
|
91820
|
-
import * as
|
|
91821
|
-
import * as
|
|
92249
|
+
import * as path34 from "path";
|
|
92250
|
+
import * as fs33 from "fs";
|
|
91822
92251
|
async function openapiCommand(dir, options) {
|
|
91823
|
-
const workflowDir =
|
|
91824
|
-
if (!
|
|
92252
|
+
const workflowDir = path34.resolve(dir);
|
|
92253
|
+
if (!fs33.existsSync(workflowDir)) {
|
|
91825
92254
|
throw new Error(`Directory not found: ${workflowDir}`);
|
|
91826
92255
|
}
|
|
91827
|
-
if (!
|
|
92256
|
+
if (!fs33.statSync(workflowDir).isDirectory()) {
|
|
91828
92257
|
throw new Error(`Not a directory: ${workflowDir}`);
|
|
91829
92258
|
}
|
|
91830
92259
|
const registry2 = new WorkflowRegistry(workflowDir);
|
|
@@ -91843,8 +92272,8 @@ async function openapiCommand(dir, options) {
|
|
|
91843
92272
|
const format = options.format || "json";
|
|
91844
92273
|
const spec = format === "yaml" ? generateOpenAPIYaml(endpoints, generatorOptions) : generateOpenAPIJson(endpoints, generatorOptions);
|
|
91845
92274
|
if (options.output) {
|
|
91846
|
-
const outputPath =
|
|
91847
|
-
|
|
92275
|
+
const outputPath = path34.resolve(options.output);
|
|
92276
|
+
fs33.writeFileSync(outputPath, spec);
|
|
91848
92277
|
logger.success(`OpenAPI specification written to ${outputPath}`);
|
|
91849
92278
|
} else {
|
|
91850
92279
|
process.stdout.write(spec + "\n");
|
|
@@ -91852,8 +92281,8 @@ async function openapiCommand(dir, options) {
|
|
|
91852
92281
|
}
|
|
91853
92282
|
|
|
91854
92283
|
// src/cli/commands/plugin.ts
|
|
91855
|
-
import * as
|
|
91856
|
-
import * as
|
|
92284
|
+
import * as fs34 from "fs";
|
|
92285
|
+
import * as path35 from "path";
|
|
91857
92286
|
var PLUGIN_NAME_RE = /^[a-zA-Z0-9][-a-zA-Z0-9_.]*$/;
|
|
91858
92287
|
var VALID_AREAS = ["sidebar", "main", "toolbar", "modal", "panel"];
|
|
91859
92288
|
function validatePluginName(name) {
|
|
@@ -91980,18 +92409,18 @@ async function pluginInitCommand(name, options) {
|
|
|
91980
92409
|
}
|
|
91981
92410
|
return;
|
|
91982
92411
|
}
|
|
91983
|
-
const targetDir =
|
|
92412
|
+
const targetDir = path35.resolve("plugins", name);
|
|
91984
92413
|
const filesCreated = [];
|
|
91985
92414
|
const filesSkipped = [];
|
|
91986
92415
|
for (const [relativePath, content] of Object.entries(files)) {
|
|
91987
|
-
const absPath =
|
|
91988
|
-
const dir =
|
|
91989
|
-
|
|
91990
|
-
if (
|
|
92416
|
+
const absPath = path35.join(targetDir, relativePath);
|
|
92417
|
+
const dir = path35.dirname(absPath);
|
|
92418
|
+
fs34.mkdirSync(dir, { recursive: true });
|
|
92419
|
+
if (fs34.existsSync(absPath) && !force) {
|
|
91991
92420
|
filesSkipped.push(relativePath);
|
|
91992
92421
|
continue;
|
|
91993
92422
|
}
|
|
91994
|
-
|
|
92423
|
+
fs34.writeFileSync(absPath, content, "utf8");
|
|
91995
92424
|
filesCreated.push(relativePath);
|
|
91996
92425
|
}
|
|
91997
92426
|
logger.section("Plugin scaffolded");
|
|
@@ -92010,8 +92439,8 @@ async function pluginInitCommand(name, options) {
|
|
|
92010
92439
|
|
|
92011
92440
|
// src/cli/commands/migrate.ts
|
|
92012
92441
|
init_esm5();
|
|
92013
|
-
import * as
|
|
92014
|
-
import * as
|
|
92442
|
+
import * as fs35 from "fs";
|
|
92443
|
+
import * as path36 from "path";
|
|
92015
92444
|
async function migrateCommand(globPattern, options = {}) {
|
|
92016
92445
|
const { dryRun = false, diff = false } = options;
|
|
92017
92446
|
const files = globSync(globPattern, { ignore: ["**/node_modules/**", "**/*.generated.ts"] });
|
|
@@ -92027,9 +92456,9 @@ async function migrateCommand(globPattern, options = {}) {
|
|
|
92027
92456
|
let skippedCount = 0;
|
|
92028
92457
|
let errorCount = 0;
|
|
92029
92458
|
for (const file of files) {
|
|
92030
|
-
const filePath =
|
|
92459
|
+
const filePath = path36.resolve(file);
|
|
92031
92460
|
try {
|
|
92032
|
-
const sourceCode =
|
|
92461
|
+
const sourceCode = fs35.readFileSync(filePath, "utf8");
|
|
92033
92462
|
const parseResult = await parseWorkflow(filePath);
|
|
92034
92463
|
if (parseResult.errors.length > 0) {
|
|
92035
92464
|
logger.error(` ${file}: parse errors \u2014 skipping`);
|
|
@@ -92062,7 +92491,7 @@ ${file}:`);
|
|
|
92062
92491
|
migratedCount++;
|
|
92063
92492
|
continue;
|
|
92064
92493
|
}
|
|
92065
|
-
|
|
92494
|
+
fs35.writeFileSync(filePath, genResult.code, "utf8");
|
|
92066
92495
|
logger.success(` ${file}: migrated`);
|
|
92067
92496
|
migratedCount++;
|
|
92068
92497
|
} catch (error2) {
|
|
@@ -92192,9 +92621,82 @@ async function changelogCommand(options = {}) {
|
|
|
92192
92621
|
}
|
|
92193
92622
|
}
|
|
92194
92623
|
|
|
92624
|
+
// src/cli/commands/docs.ts
|
|
92625
|
+
async function docsListCommand(options) {
|
|
92626
|
+
const topics = listTopics();
|
|
92627
|
+
if (topics.length === 0) {
|
|
92628
|
+
logger.error("No documentation topics found.");
|
|
92629
|
+
process.exit(1);
|
|
92630
|
+
}
|
|
92631
|
+
if (options.json) {
|
|
92632
|
+
process.stdout.write(JSON.stringify({ topics }, null, 2) + "\n");
|
|
92633
|
+
return;
|
|
92634
|
+
}
|
|
92635
|
+
logger.section("Flow Weaver Documentation");
|
|
92636
|
+
logger.newline();
|
|
92637
|
+
const maxSlug = Math.max(...topics.map((t) => t.slug.length));
|
|
92638
|
+
for (const topic of topics) {
|
|
92639
|
+
logger.log(` ${topic.slug.padEnd(maxSlug + 2)} ${topic.description}`);
|
|
92640
|
+
}
|
|
92641
|
+
logger.newline();
|
|
92642
|
+
logger.log(" Usage: flow-weaver docs <topic>");
|
|
92643
|
+
logger.log(" Search: flow-weaver docs search <query>");
|
|
92644
|
+
logger.newline();
|
|
92645
|
+
}
|
|
92646
|
+
async function docsReadCommand(topic, options) {
|
|
92647
|
+
if (options.json) {
|
|
92648
|
+
const structured = readTopicStructured(topic);
|
|
92649
|
+
if (!structured) {
|
|
92650
|
+
logger.error(`Unknown topic: "${topic}". Run "flow-weaver docs" to see available topics.`);
|
|
92651
|
+
process.exit(1);
|
|
92652
|
+
}
|
|
92653
|
+
process.stdout.write(JSON.stringify(structured, null, 2) + "\n");
|
|
92654
|
+
return;
|
|
92655
|
+
}
|
|
92656
|
+
const doc = readTopic(topic, options.compact);
|
|
92657
|
+
if (!doc) {
|
|
92658
|
+
logger.error(`Unknown topic: "${topic}". Run "flow-weaver docs" to see available topics.`);
|
|
92659
|
+
process.exit(1);
|
|
92660
|
+
}
|
|
92661
|
+
process.stdout.write(doc.content + "\n");
|
|
92662
|
+
}
|
|
92663
|
+
async function docsSearchCommand(query, options) {
|
|
92664
|
+
const results = searchDocs(query);
|
|
92665
|
+
if (options.json) {
|
|
92666
|
+
process.stdout.write(JSON.stringify({ query, results }, null, 2) + "\n");
|
|
92667
|
+
return;
|
|
92668
|
+
}
|
|
92669
|
+
if (results.length === 0) {
|
|
92670
|
+
logger.log(`No results found for "${query}".`);
|
|
92671
|
+
return;
|
|
92672
|
+
}
|
|
92673
|
+
logger.section(`Search results for "${query}"`);
|
|
92674
|
+
logger.newline();
|
|
92675
|
+
const seen = /* @__PURE__ */ new Set();
|
|
92676
|
+
let shown = 0;
|
|
92677
|
+
for (const result of results) {
|
|
92678
|
+
const key = `${result.slug}:${result.heading}`;
|
|
92679
|
+
if (seen.has(key)) continue;
|
|
92680
|
+
seen.add(key);
|
|
92681
|
+
logger.log(` [${result.slug}] ${result.heading}`);
|
|
92682
|
+
if (result.excerpt) {
|
|
92683
|
+
const excerptLines = result.excerpt.split("\n").slice(0, 2);
|
|
92684
|
+
for (const line of excerptLines) {
|
|
92685
|
+
logger.log(` ${line}`);
|
|
92686
|
+
}
|
|
92687
|
+
}
|
|
92688
|
+
logger.newline();
|
|
92689
|
+
shown++;
|
|
92690
|
+
if (shown >= 15) break;
|
|
92691
|
+
}
|
|
92692
|
+
logger.log(` ${results.length} matching section(s) across ${new Set(results.map((r) => r.slug)).size} topic(s).`);
|
|
92693
|
+
logger.log(" Read a topic: flow-weaver docs <topic>");
|
|
92694
|
+
logger.newline();
|
|
92695
|
+
}
|
|
92696
|
+
|
|
92195
92697
|
// src/cli/commands/market.ts
|
|
92196
|
-
import * as
|
|
92197
|
-
import * as
|
|
92698
|
+
import * as fs36 from "fs";
|
|
92699
|
+
import * as path37 from "path";
|
|
92198
92700
|
import { execSync as execSync6 } from "child_process";
|
|
92199
92701
|
async function marketInitCommand(name, options = {}) {
|
|
92200
92702
|
if (!name.startsWith("flowweaver-pack-")) {
|
|
@@ -92202,11 +92704,11 @@ async function marketInitCommand(name, options = {}) {
|
|
|
92202
92704
|
logger.warn(`Name should follow "flowweaver-pack-*" convention, using "${suggested}"`);
|
|
92203
92705
|
name = suggested;
|
|
92204
92706
|
}
|
|
92205
|
-
const targetDir =
|
|
92206
|
-
if (
|
|
92207
|
-
const stat =
|
|
92707
|
+
const targetDir = path37.resolve(name);
|
|
92708
|
+
if (fs36.existsSync(targetDir)) {
|
|
92709
|
+
const stat = fs36.statSync(targetDir);
|
|
92208
92710
|
if (stat.isDirectory()) {
|
|
92209
|
-
const contents =
|
|
92711
|
+
const contents = fs36.readdirSync(targetDir);
|
|
92210
92712
|
if (contents.length > 0) {
|
|
92211
92713
|
logger.error(`Directory "${name}" already exists and is not empty`);
|
|
92212
92714
|
process.exit(1);
|
|
@@ -92221,13 +92723,13 @@ async function marketInitCommand(name, options = {}) {
|
|
|
92221
92723
|
logger.newline();
|
|
92222
92724
|
const dirs = [
|
|
92223
92725
|
targetDir,
|
|
92224
|
-
|
|
92225
|
-
|
|
92226
|
-
|
|
92227
|
-
|
|
92726
|
+
path37.join(targetDir, "src"),
|
|
92727
|
+
path37.join(targetDir, "src", "node-types"),
|
|
92728
|
+
path37.join(targetDir, "src", "workflows"),
|
|
92729
|
+
path37.join(targetDir, "src", "patterns")
|
|
92228
92730
|
];
|
|
92229
92731
|
for (const dir of dirs) {
|
|
92230
|
-
|
|
92732
|
+
fs36.mkdirSync(dir, { recursive: true });
|
|
92231
92733
|
}
|
|
92232
92734
|
const shortName = name.replace(/^flowweaver-pack-/, "");
|
|
92233
92735
|
const pkg = {
|
|
@@ -92258,8 +92760,8 @@ async function marketInitCommand(name, options = {}) {
|
|
|
92258
92760
|
},
|
|
92259
92761
|
files: ["dist", "flowweaver.manifest.json", "README.md", "LICENSE"]
|
|
92260
92762
|
};
|
|
92261
|
-
|
|
92262
|
-
|
|
92763
|
+
fs36.writeFileSync(
|
|
92764
|
+
path37.join(targetDir, "package.json"),
|
|
92263
92765
|
JSON.stringify(pkg, null, 2) + "\n"
|
|
92264
92766
|
);
|
|
92265
92767
|
const tsconfig = {
|
|
@@ -92277,8 +92779,8 @@ async function marketInitCommand(name, options = {}) {
|
|
|
92277
92779
|
include: ["src"],
|
|
92278
92780
|
exclude: ["node_modules", "dist"]
|
|
92279
92781
|
};
|
|
92280
|
-
|
|
92281
|
-
|
|
92782
|
+
fs36.writeFileSync(
|
|
92783
|
+
path37.join(targetDir, "tsconfig.json"),
|
|
92282
92784
|
JSON.stringify(tsconfig, null, 2) + "\n"
|
|
92283
92785
|
);
|
|
92284
92786
|
const sampleNodeType = `/**
|
|
@@ -92296,21 +92798,21 @@ export function sample(execute: () => void, data: string): { result: string } {
|
|
|
92296
92798
|
return { result: data.toUpperCase() };
|
|
92297
92799
|
}
|
|
92298
92800
|
`;
|
|
92299
|
-
|
|
92300
|
-
|
|
92301
|
-
|
|
92801
|
+
fs36.writeFileSync(path37.join(targetDir, "src", "node-types", "sample.ts"), sampleNodeType);
|
|
92802
|
+
fs36.writeFileSync(
|
|
92803
|
+
path37.join(targetDir, "src", "node-types", "index.ts"),
|
|
92302
92804
|
"export { sample } from './sample.js';\n"
|
|
92303
92805
|
);
|
|
92304
|
-
|
|
92305
|
-
|
|
92806
|
+
fs36.writeFileSync(
|
|
92807
|
+
path37.join(targetDir, "src", "workflows", "index.ts"),
|
|
92306
92808
|
"// Export workflows here\n"
|
|
92307
92809
|
);
|
|
92308
|
-
|
|
92309
|
-
|
|
92810
|
+
fs36.writeFileSync(
|
|
92811
|
+
path37.join(targetDir, "src", "patterns", "index.ts"),
|
|
92310
92812
|
"// Export patterns here\n"
|
|
92311
92813
|
);
|
|
92312
|
-
|
|
92313
|
-
|
|
92814
|
+
fs36.writeFileSync(
|
|
92815
|
+
path37.join(targetDir, "src", "index.ts"),
|
|
92314
92816
|
[
|
|
92315
92817
|
"export * from './node-types/index.js';",
|
|
92316
92818
|
"export * from './workflows/index.js';",
|
|
@@ -92343,9 +92845,9 @@ npm run pack # Generate flowweaver.manifest.json
|
|
|
92343
92845
|
npm publish # Publish to npm
|
|
92344
92846
|
\`\`\`
|
|
92345
92847
|
`;
|
|
92346
|
-
|
|
92347
|
-
|
|
92348
|
-
|
|
92848
|
+
fs36.writeFileSync(path37.join(targetDir, "README.md"), readme);
|
|
92849
|
+
fs36.writeFileSync(
|
|
92850
|
+
path37.join(targetDir, ".gitignore"),
|
|
92349
92851
|
["node_modules", "dist", "*.tgz", ""].join("\n")
|
|
92350
92852
|
);
|
|
92351
92853
|
logger.success("Created package.json");
|
|
@@ -92365,7 +92867,7 @@ npm publish # Publish to npm
|
|
|
92365
92867
|
logger.newline();
|
|
92366
92868
|
}
|
|
92367
92869
|
async function marketPackCommand(directory, options = {}) {
|
|
92368
|
-
const dir =
|
|
92870
|
+
const dir = path37.resolve(directory ?? ".");
|
|
92369
92871
|
const { json: json2 = false, verbose = false } = options;
|
|
92370
92872
|
if (!json2) {
|
|
92371
92873
|
logger.section("Packing Marketplace Package");
|
|
@@ -92404,21 +92906,21 @@ async function marketPackCommand(directory, options = {}) {
|
|
|
92404
92906
|
}
|
|
92405
92907
|
const outPath = writeManifest(dir, manifest);
|
|
92406
92908
|
logger.newline();
|
|
92407
|
-
logger.success(`Manifest written to ${
|
|
92909
|
+
logger.success(`Manifest written to ${path37.relative(dir, outPath)}`);
|
|
92408
92910
|
if (warnings.length > 0) {
|
|
92409
92911
|
logger.warn(`${warnings.length} warning(s) \u2014 consider fixing before publishing`);
|
|
92410
92912
|
}
|
|
92411
92913
|
logger.newline();
|
|
92412
92914
|
}
|
|
92413
92915
|
async function marketPublishCommand(directory, options = {}) {
|
|
92414
|
-
const dir =
|
|
92916
|
+
const dir = path37.resolve(directory ?? ".");
|
|
92415
92917
|
const { dryRun = false, tag } = options;
|
|
92416
92918
|
logger.section("Publishing Marketplace Package");
|
|
92417
92919
|
await marketPackCommand(dir, { json: false });
|
|
92418
|
-
if (!
|
|
92920
|
+
if (!fs36.existsSync(path37.join(dir, "LICENSE"))) {
|
|
92419
92921
|
logger.warn("LICENSE file not found \u2014 consider adding one");
|
|
92420
92922
|
}
|
|
92421
|
-
const pkg = JSON.parse(
|
|
92923
|
+
const pkg = JSON.parse(fs36.readFileSync(path37.join(dir, "package.json"), "utf-8"));
|
|
92422
92924
|
logger.info(`Publishing ${pkg.name}@${pkg.version}`);
|
|
92423
92925
|
const npmArgs = ["publish"];
|
|
92424
92926
|
if (dryRun) npmArgs.push("--dry-run");
|
|
@@ -92453,7 +92955,7 @@ async function marketInstallCommand(packageSpec, options = {}) {
|
|
|
92453
92955
|
process.exit(1);
|
|
92454
92956
|
}
|
|
92455
92957
|
const packageName = resolvePackageName2(packageSpec);
|
|
92456
|
-
const manifest = readManifest(
|
|
92958
|
+
const manifest = readManifest(path37.join(process.cwd(), "node_modules", packageName));
|
|
92457
92959
|
if (json2) {
|
|
92458
92960
|
console.log(JSON.stringify({
|
|
92459
92961
|
success: true,
|
|
@@ -92537,7 +93039,7 @@ async function marketListCommand(options = {}) {
|
|
|
92537
93039
|
}
|
|
92538
93040
|
function resolvePackageName2(spec) {
|
|
92539
93041
|
if (spec.endsWith(".tgz") || spec.endsWith(".tar.gz")) {
|
|
92540
|
-
const base =
|
|
93042
|
+
const base = path37.basename(spec, spec.endsWith(".tar.gz") ? ".tar.gz" : ".tgz");
|
|
92541
93043
|
const match2 = base.match(/^(.+)-\d+\.\d+\.\d+/);
|
|
92542
93044
|
return match2 ? match2[1] : base;
|
|
92543
93045
|
}
|
|
@@ -92586,7 +93088,7 @@ function displayInstalledPackage(pkg) {
|
|
|
92586
93088
|
}
|
|
92587
93089
|
|
|
92588
93090
|
// src/cli/index.ts
|
|
92589
|
-
var version2 = true ? "0.
|
|
93091
|
+
var version2 = true ? "0.3.0" : "0.0.0-dev";
|
|
92590
93092
|
var program2 = new Command();
|
|
92591
93093
|
program2.name("flow-weaver").description("Flow Weaver Annotations - Compile and validate workflow files").version(version2, "-v, --version", "Output the current version");
|
|
92592
93094
|
program2.configureOutput({
|
|
@@ -92855,6 +93357,31 @@ program2.command("changelog").description("Generate changelog from git history,
|
|
|
92855
93357
|
process.exit(1);
|
|
92856
93358
|
}
|
|
92857
93359
|
});
|
|
93360
|
+
var docsCmd = program2.command("docs").description("Browse reference documentation");
|
|
93361
|
+
docsCmd.command("list", { isDefault: true }).description("List available documentation topics").option("--json", "Output as JSON", false).option("--compact", "Compact output", false).action(async (options) => {
|
|
93362
|
+
try {
|
|
93363
|
+
await docsListCommand(options);
|
|
93364
|
+
} catch (error2) {
|
|
93365
|
+
logger.error(`Command failed: ${getErrorMessage(error2)}`);
|
|
93366
|
+
process.exit(1);
|
|
93367
|
+
}
|
|
93368
|
+
});
|
|
93369
|
+
docsCmd.command("read <topic>").description("Read a documentation topic").option("--json", "Output as JSON", false).option("--compact", "Return compact LLM-friendly version", false).action(async (topic, options) => {
|
|
93370
|
+
try {
|
|
93371
|
+
await docsReadCommand(topic, options);
|
|
93372
|
+
} catch (error2) {
|
|
93373
|
+
logger.error(`Command failed: ${getErrorMessage(error2)}`);
|
|
93374
|
+
process.exit(1);
|
|
93375
|
+
}
|
|
93376
|
+
});
|
|
93377
|
+
docsCmd.command("search <query>").description("Search across all documentation").option("--json", "Output as JSON", false).action(async (query, options) => {
|
|
93378
|
+
try {
|
|
93379
|
+
await docsSearchCommand(query, options);
|
|
93380
|
+
} catch (error2) {
|
|
93381
|
+
logger.error(`Command failed: ${getErrorMessage(error2)}`);
|
|
93382
|
+
process.exit(1);
|
|
93383
|
+
}
|
|
93384
|
+
});
|
|
92858
93385
|
var marketCmd = program2.command("market").description("Discover, install, and publish marketplace packages");
|
|
92859
93386
|
marketCmd.command("init <name>").description("Scaffold a new marketplace package").option("-d, --description <desc>", "Package description").option("-a, --author <author>", "Author name").option("-y, --yes", "Skip prompts and use defaults", false).action(async (name, options) => {
|
|
92860
93387
|
try {
|
|
@@ -92956,6 +93483,13 @@ program2.on("--help", () => {
|
|
|
92956
93483
|
logger.log(" $ flow-weaver market search openai");
|
|
92957
93484
|
logger.log(" $ flow-weaver market list");
|
|
92958
93485
|
logger.newline();
|
|
93486
|
+
logger.section("Documentation");
|
|
93487
|
+
logger.log(" $ flow-weaver docs");
|
|
93488
|
+
logger.log(" $ flow-weaver docs read error-codes");
|
|
93489
|
+
logger.log(" $ flow-weaver docs read scaffold --compact");
|
|
93490
|
+
logger.log(' $ flow-weaver docs search "missing workflow"');
|
|
93491
|
+
logger.log(" $ flow-weaver docs read error-codes --json");
|
|
93492
|
+
logger.newline();
|
|
92959
93493
|
logger.section("Migration & Changelog");
|
|
92960
93494
|
logger.log(" $ flow-weaver migrate '**/*.ts'");
|
|
92961
93495
|
logger.log(" $ flow-weaver migrate '**/*.ts' --dry-run");
|