@vivix-labs/studio-chat-mcp 0.1.17 → 0.1.19

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 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.17",
29432
+ version: "0.1.19",
29433
29433
  type: "module",
29434
29434
  engines: {
29435
29435
  node: ">=22.12.0"
@@ -38437,11 +38437,12 @@ function declaredAction(chat, source, action, context) {
38437
38437
  import { constants } from "node:fs";
38438
38438
  import { open as open2 } from "node:fs/promises";
38439
38439
  import { extname, isAbsolute } from "node:path";
38440
+ var finiteNonNegativeInteger = external_exports.number().finite().nonnegative().refine(Number.isInteger, "Expected a non-negative integer.");
38440
38441
  var snapshot = external_exports.object({
38441
38442
  sizeBytes: external_exports.number().int().positive().max(2147483648),
38442
38443
  mtimeMs: external_exports.number().finite(),
38443
- inode: external_exports.number().int().nonnegative(),
38444
- device: external_exports.number().int().nonnegative()
38444
+ inode: finiteNonNegativeInteger,
38445
+ device: finiteNonNegativeInteger
38445
38446
  }).strict();
38446
38447
  var localMediaInput = external_exports.object({
38447
38448
  path: external_exports.string().min(1).max(32768).refine(
@@ -38473,7 +38474,7 @@ async function readLocalMedia(raw) {
38473
38474
  const input2 = localMediaInput.parse(raw);
38474
38475
  const mimeType = mimeTypes[extname(input2.path).toLowerCase()];
38475
38476
  if (!mimeType) throw Error("Choose a supported local image, audio or video file.");
38476
- const file2 = await open2(input2.path, constants.O_RDONLY | constants.O_NONBLOCK);
38477
+ const file2 = await open2(input2.path, constants.O_RDONLY | (constants.O_NONBLOCK ?? 0));
38477
38478
  try {
38478
38479
  const before = await file2.stat();
38479
38480
  if (!before.isFile() || before.size === 0 || before.size > 2147483648)
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/codex-config.mjs
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: [resolve(cli2), "agent", "mcp"] };
823
+ return { command: process.execPath, args: [resolve2(cli2), "agent", "mcp"] };
776
824
  }
777
- const command = cli2.includes("/") || cli2.includes("\\") ? resolve(cli2) : cli2;
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivix-labs/studio-chat-mcp",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.12.0"