@vivix-labs/studio-chat-mcp 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +1 -1
- package/dist/setup.js +53 -22
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -29429,7 +29429,7 @@ data:
|
|
|
29429
29429
|
// package.json
|
|
29430
29430
|
var package_default = {
|
|
29431
29431
|
name: "@vivix-labs/studio-chat-mcp",
|
|
29432
|
-
version: "0.1.
|
|
29432
|
+
version: "0.1.18",
|
|
29433
29433
|
type: "module",
|
|
29434
29434
|
engines: {
|
|
29435
29435
|
node: ">=22.12.0"
|
package/dist/setup.js
CHANGED
|
@@ -1,13 +1,61 @@
|
|
|
1
1
|
// scripts/setup.mjs
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
3
2
|
import { randomUUID } from "node:crypto";
|
|
4
3
|
import { homedir } from "node:os";
|
|
5
4
|
import { join } from "node:path";
|
|
6
5
|
import { lstat, mkdir, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
7
6
|
import { setTimeout as delay } from "node:timers/promises";
|
|
8
7
|
|
|
9
|
-
// scripts/
|
|
8
|
+
// scripts/cli-launch.mjs
|
|
9
|
+
import { execFileSync } from "node:child_process";
|
|
10
10
|
import { resolve } from "node:path";
|
|
11
|
+
function resolveCliInvocation(cli2, args, { platform = process.platform, execPath = process.execPath } = {}) {
|
|
12
|
+
if (!cli2) throw Error("Missing Vivix Studio CLI entry path.");
|
|
13
|
+
if (/\.[cm]?js$/i.test(cli2)) {
|
|
14
|
+
return { command: execPath, args: [resolve(cli2), ...args] };
|
|
15
|
+
}
|
|
16
|
+
if (platform === "win32") {
|
|
17
|
+
throw Error(
|
|
18
|
+
`Studio Chat setup on Windows requires a JavaScript CLI entry (dist/cli.js), got: ${cli2}`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return { command: cli2, args: [...args] };
|
|
22
|
+
}
|
|
23
|
+
function invokeCliJson(cli2, args, { exec = execFileSync, platform = process.platform, execPath = process.execPath } = {}) {
|
|
24
|
+
const invocation = resolveCliInvocation(cli2, [...args, "--json"], { platform, execPath });
|
|
25
|
+
let stdout;
|
|
26
|
+
let spawnError;
|
|
27
|
+
try {
|
|
28
|
+
stdout = exec(invocation.command, invocation.args, {
|
|
29
|
+
encoding: "utf8",
|
|
30
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
31
|
+
stdio: ["ignore", "pipe", "inherit"],
|
|
32
|
+
windowsHide: true
|
|
33
|
+
});
|
|
34
|
+
} catch (error) {
|
|
35
|
+
spawnError = error;
|
|
36
|
+
stdout = error?.stdout;
|
|
37
|
+
}
|
|
38
|
+
if (typeof stdout !== "string" || !stdout.trim()) {
|
|
39
|
+
if (spawnError) throw spawnError;
|
|
40
|
+
throw Error("Studio CLI returned empty output.");
|
|
41
|
+
}
|
|
42
|
+
let reply;
|
|
43
|
+
try {
|
|
44
|
+
reply = JSON.parse(stdout);
|
|
45
|
+
} catch (parseError) {
|
|
46
|
+
if (spawnError) throw spawnError;
|
|
47
|
+
throw parseError;
|
|
48
|
+
}
|
|
49
|
+
if (!reply?.ok)
|
|
50
|
+
throw Object.assign(
|
|
51
|
+
Error((reply?.error?.code ?? "CLI_ERROR") + ": " + (reply?.error?.message ?? "CLI failed.")),
|
|
52
|
+
{ code: reply?.error?.code }
|
|
53
|
+
);
|
|
54
|
+
return reply.data;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// scripts/codex-config.mjs
|
|
58
|
+
import { resolve as resolve2 } from "node:path";
|
|
11
59
|
|
|
12
60
|
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
|
|
13
61
|
function getLineColFromPtr(string, ptr) {
|
|
@@ -772,9 +820,9 @@ var LEGACY_KEY_PATTERN = /^vivix-studio-chat-[0-9a-f]{10}$/;
|
|
|
772
820
|
var TABLE_HEADER_PATTERN = /^\s*(\[\[?)\s*([^\[\]]+?)\s*\]\]?\s*(?:#.*)?$/;
|
|
773
821
|
function resolveBridgeLaunch(cli2) {
|
|
774
822
|
if (/\.[cm]?js$/i.test(cli2)) {
|
|
775
|
-
return { command: process.execPath, args: [
|
|
823
|
+
return { command: process.execPath, args: [resolve2(cli2), "agent", "mcp"] };
|
|
776
824
|
}
|
|
777
|
-
const command = cli2.includes("/") || cli2.includes("\\") ?
|
|
825
|
+
const command = cli2.includes("/") || cli2.includes("\\") ? resolve2(cli2) : cli2;
|
|
778
826
|
return { command, args: ["agent", "mcp"] };
|
|
779
827
|
}
|
|
780
828
|
function parseTableSegments(header) {
|
|
@@ -870,24 +918,7 @@ var read = async (path2) => JSON.parse(await readFile(path2, "utf8"));
|
|
|
870
918
|
var present = (path2) => lstat(path2).catch((error) => {
|
|
871
919
|
if (error.code !== "ENOENT") throw error;
|
|
872
920
|
});
|
|
873
|
-
var cliCall = (...args) =>
|
|
874
|
-
let stdout;
|
|
875
|
-
try {
|
|
876
|
-
stdout = execFileSync(cli, [...args, "--json"], {
|
|
877
|
-
encoding: "utf8",
|
|
878
|
-
maxBuffer: 16 * 1024 * 1024,
|
|
879
|
-
stdio: ["ignore", "pipe", "inherit"]
|
|
880
|
-
});
|
|
881
|
-
} catch (error) {
|
|
882
|
-
stdout = error.stdout;
|
|
883
|
-
}
|
|
884
|
-
const reply = JSON.parse(stdout);
|
|
885
|
-
if (!reply.ok)
|
|
886
|
-
throw Object.assign(Error(reply.error.code + ": " + reply.error.message), {
|
|
887
|
-
code: reply.error.code
|
|
888
|
-
});
|
|
889
|
-
return reply.data;
|
|
890
|
-
};
|
|
921
|
+
var cliCall = (...args) => invokeCliJson(cli, args);
|
|
891
922
|
var user = ["--scope", "user"];
|
|
892
923
|
var pins = await read(join(scratch, "chat-pins.json"));
|
|
893
924
|
var packages = {
|