@vivix-labs/studio-chat-mcp 0.1.10 → 0.1.12
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 +11 -13
- package/dist/chat-ui/index.html +21 -21
- package/dist/server.js +3 -2
- package/dist/setup.js +109 -20
- package/dist/shared.d.ts +2 -0
- package/package.json +1 -1
- package/skills/vivix-studio-chat/SKILL.md +7 -0
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.12",
|
|
29433
29433
|
type: "module",
|
|
29434
29434
|
engines: {
|
|
29435
29435
|
node: ">=22.12.0"
|
|
@@ -38506,7 +38506,7 @@ var actionInput = external_exports.object({
|
|
|
38506
38506
|
function mapChatResult(result) {
|
|
38507
38507
|
const { bindings: _bindings, ...structuredContent } = result.structuredContent;
|
|
38508
38508
|
return {
|
|
38509
|
-
content: [{ type: "text", text: result.text }],
|
|
38509
|
+
content: result.text ? [{ type: "text", text: result.text }] : [],
|
|
38510
38510
|
structuredContent,
|
|
38511
38511
|
...(result.view || result.message) && {
|
|
38512
38512
|
_meta: {
|
|
@@ -38741,6 +38741,7 @@ function createChatServer(options2) {
|
|
|
38741
38741
|
// The component's CSP restricts HTTPS media to its declared media origins.
|
|
38742
38742
|
// This outer policy must permit those origins before the component can narrow them.
|
|
38743
38743
|
ui: {
|
|
38744
|
+
prefersBorder: false,
|
|
38744
38745
|
csp: {
|
|
38745
38746
|
connectDomains: [],
|
|
38746
38747
|
resourceDomains: [...options2.resourceDomains ?? defaultResourceDomains, "data:", "blob:"],
|
package/dist/setup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// scripts/setup.mjs
|
|
2
2
|
import { execFileSync } from "node:child_process";
|
|
3
|
-
import {
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
import { join, resolve } from "node:path";
|
|
5
|
+
import { join, resolve as resolve2 } from "node:path";
|
|
6
6
|
import {
|
|
7
7
|
lstat,
|
|
8
8
|
mkdir,
|
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
} from "node:fs/promises";
|
|
17
17
|
import { setTimeout as delay } from "node:timers/promises";
|
|
18
18
|
|
|
19
|
+
// scripts/codex-config.mjs
|
|
20
|
+
import { resolve } from "node:path";
|
|
21
|
+
|
|
19
22
|
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
|
|
20
23
|
function getLineColFromPtr(string, ptr) {
|
|
21
24
|
let lines = string.slice(0, ptr).split(/\r?\n/);
|
|
@@ -774,6 +777,102 @@ function parse(toml, options = {}) {
|
|
|
774
777
|
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/stringify.js
|
|
775
778
|
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
776
779
|
|
|
780
|
+
// scripts/codex-config.mjs
|
|
781
|
+
var LEGACY_KEY_PATTERN = /^vivix-studio-chat-[0-9a-f]{10}$/;
|
|
782
|
+
var TABLE_HEADER_PATTERN = /^\s*(\[\[?)\s*([^\[\]]+?)\s*\]\]?\s*(?:#.*)?$/;
|
|
783
|
+
function resolveBridgeLaunch(cli2) {
|
|
784
|
+
if (/\.[cm]?js$/i.test(cli2)) {
|
|
785
|
+
return { command: process.execPath, args: [resolve(cli2), "agent", "mcp"] };
|
|
786
|
+
}
|
|
787
|
+
const command = cli2.includes("/") || cli2.includes("\\") ? resolve(cli2) : cli2;
|
|
788
|
+
return { command, args: ["agent", "mcp"] };
|
|
789
|
+
}
|
|
790
|
+
function parseTableSegments(header) {
|
|
791
|
+
const segments = [];
|
|
792
|
+
let index = 0;
|
|
793
|
+
while (index < header.length) {
|
|
794
|
+
while (index < header.length && /[\s.]/.test(header[index])) index++;
|
|
795
|
+
if (index >= header.length) break;
|
|
796
|
+
const quote = header[index];
|
|
797
|
+
if (quote === '"' || quote === "'") {
|
|
798
|
+
let value = "";
|
|
799
|
+
index++;
|
|
800
|
+
while (index < header.length && header[index] !== quote) {
|
|
801
|
+
if (quote === '"' && header[index] === "\\" && index + 1 < header.length) {
|
|
802
|
+
index++;
|
|
803
|
+
}
|
|
804
|
+
value += header[index++];
|
|
805
|
+
}
|
|
806
|
+
index++;
|
|
807
|
+
segments.push(value);
|
|
808
|
+
} else {
|
|
809
|
+
let value = "";
|
|
810
|
+
while (index < header.length && header[index] !== ".") {
|
|
811
|
+
value += header[index++];
|
|
812
|
+
}
|
|
813
|
+
segments.push(value.trim());
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
return segments;
|
|
817
|
+
}
|
|
818
|
+
function isManagedServerEntry(key, value) {
|
|
819
|
+
if (key === "vivix-studio-chat") return true;
|
|
820
|
+
return LEGACY_KEY_PATTERN.test(key) && typeof value?.url === "string" && value.url.endsWith("/v1/user/http/studio-chat/mcp");
|
|
821
|
+
}
|
|
822
|
+
function matchesStdioEntry(entry, launch2, xdgConfigHome) {
|
|
823
|
+
if (!entry || entry.enabled === false) return false;
|
|
824
|
+
if (entry.url !== void 0 || entry.http_headers !== void 0) return false;
|
|
825
|
+
if (entry.command !== launch2.command) return false;
|
|
826
|
+
if (JSON.stringify(entry.args ?? []) !== JSON.stringify(launch2.args)) return false;
|
|
827
|
+
const expectedEnv = xdgConfigHome ? { XDG_CONFIG_HOME: xdgConfigHome } : void 0;
|
|
828
|
+
return JSON.stringify(entry.env ?? void 0) === JSON.stringify(expectedEnv);
|
|
829
|
+
}
|
|
830
|
+
function stripManagedTables(existingToml, managedKeys) {
|
|
831
|
+
if (!existingToml) return "";
|
|
832
|
+
const kept = [];
|
|
833
|
+
let skipping = false;
|
|
834
|
+
for (const line of existingToml.split(/\r?\n/)) {
|
|
835
|
+
const match = TABLE_HEADER_PATTERN.exec(line);
|
|
836
|
+
if (match) {
|
|
837
|
+
const isArrayTable = match[1] === "[[";
|
|
838
|
+
const segments = parseTableSegments(match[2]);
|
|
839
|
+
skipping = !isArrayTable && segments[0] === "mcp_servers" && managedKeys.has(segments[1]);
|
|
840
|
+
}
|
|
841
|
+
if (!skipping) kept.push(line);
|
|
842
|
+
}
|
|
843
|
+
while (kept.length && kept[kept.length - 1].trim() === "") kept.pop();
|
|
844
|
+
return kept.join("\n");
|
|
845
|
+
}
|
|
846
|
+
function upsertCodexStdioConfig(existingToml, launch2, xdgConfigHome) {
|
|
847
|
+
const parsed = parse(existingToml || "");
|
|
848
|
+
const servers = parsed.mcp_servers || {};
|
|
849
|
+
const managedKeys = new Set(
|
|
850
|
+
Object.entries(servers).filter(([key, value]) => isManagedServerEntry(key, value)).map(([key]) => key)
|
|
851
|
+
);
|
|
852
|
+
const legacyExtras = [...managedKeys].some((key) => key !== "vivix-studio-chat");
|
|
853
|
+
if (!legacyExtras && matchesStdioEntry(servers["vivix-studio-chat"], launch2, xdgConfigHome)) {
|
|
854
|
+
return { changed: false, content: existingToml };
|
|
855
|
+
}
|
|
856
|
+
const base = stripManagedTables(existingToml, managedKeys);
|
|
857
|
+
const lines = [
|
|
858
|
+
"[mcp_servers.vivix-studio-chat]",
|
|
859
|
+
`command = ${JSON.stringify(launch2.command)}`,
|
|
860
|
+
`args = ${JSON.stringify(launch2.args)}`
|
|
861
|
+
];
|
|
862
|
+
if (xdgConfigHome) {
|
|
863
|
+
lines.push(
|
|
864
|
+
"[mcp_servers.vivix-studio-chat.env]",
|
|
865
|
+
`XDG_CONFIG_HOME = ${JSON.stringify(xdgConfigHome)}`
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
const section = lines.join("\n") + "\n";
|
|
869
|
+
const next2 = base ? `${base}
|
|
870
|
+
|
|
871
|
+
${section}` : section;
|
|
872
|
+
parse(next2);
|
|
873
|
+
return { changed: true, content: next2 };
|
|
874
|
+
}
|
|
875
|
+
|
|
777
876
|
// scripts/setup.mjs
|
|
778
877
|
var [cli, scratch] = process.argv.slice(2);
|
|
779
878
|
var profile = process.env.XDG_CONFIG_HOME ? join(process.env.XDG_CONFIG_HOME, "vivix-studio") : join(homedir(), ".vivix-studio");
|
|
@@ -900,7 +999,7 @@ for (const [id, skill] of [
|
|
|
900
999
|
await mkdir(parent, { recursive: true });
|
|
901
1000
|
const link = await present(dest);
|
|
902
1001
|
if (link) {
|
|
903
|
-
const old2 = link.isSymbolicLink() &&
|
|
1002
|
+
const old2 = link.isSymbolicLink() && resolve2(parent, await readlink(dest));
|
|
904
1003
|
if (old2 === source) continue;
|
|
905
1004
|
if (!old2 || !old2.startsWith(packageStore + "/") || !old2.endsWith("/skills/" + skill)) {
|
|
906
1005
|
console.log("Retained personal Skill: " + dest);
|
|
@@ -930,21 +1029,9 @@ var old = await readFile(path, "utf8").catch((e) => {
|
|
|
930
1029
|
if (e.code !== "ENOENT") throw e;
|
|
931
1030
|
return "";
|
|
932
1031
|
});
|
|
933
|
-
var
|
|
934
|
-
var
|
|
935
|
-
|
|
936
|
-
);
|
|
937
|
-
if (!expected) {
|
|
938
|
-
let key = "vivix-studio-chat";
|
|
939
|
-
if (Object.hasOwn(servers, key)) {
|
|
940
|
-
const suffix = createHash("sha256").update(conn.url).digest("hex").slice(0, 10);
|
|
941
|
-
key += "-" + suffix;
|
|
942
|
-
if (Object.hasOwn(servers, key))
|
|
943
|
-
throw Error("Existing Codex MCP configuration conflicts with this connection.");
|
|
944
|
-
}
|
|
945
|
-
const section = "\n[mcp_servers." + key + "]\nurl = " + JSON.stringify(conn.url) + "\n[mcp_servers." + key + ".http_headers]\nAuthorization = " + JSON.stringify(conn.headers.Authorization) + "\n";
|
|
946
|
-
const next = old + section;
|
|
947
|
-
parse(next);
|
|
1032
|
+
var launch = resolveBridgeLaunch(cli);
|
|
1033
|
+
var { changed, content: next } = upsertCodexStdioConfig(old, launch, process.env.XDG_CONFIG_HOME);
|
|
1034
|
+
if (changed) {
|
|
948
1035
|
const tmp = path + "." + randomUUID() + ".tmp";
|
|
949
1036
|
try {
|
|
950
1037
|
await writeFile(tmp, next, { mode: 384, flag: "wx" });
|
|
@@ -952,13 +1039,15 @@ if (!expected) {
|
|
|
952
1039
|
if (e.code !== "ENOENT") throw e;
|
|
953
1040
|
return "";
|
|
954
1041
|
}) !== old)
|
|
955
|
-
throw Error("
|
|
1042
|
+
throw Error("Agent configuration changed during setup. Rerun the installer.");
|
|
956
1043
|
await rename(tmp, path);
|
|
957
1044
|
} finally {
|
|
958
1045
|
await rm(tmp, { force: true });
|
|
959
1046
|
}
|
|
960
1047
|
}
|
|
961
|
-
console.log(
|
|
1048
|
+
console.log(
|
|
1049
|
+
"Studio Chat is configured for new conversations (CLI and Workbench are ready immediately)."
|
|
1050
|
+
);
|
|
962
1051
|
/*! Bundled license information:
|
|
963
1052
|
|
|
964
1053
|
smol-toml/dist/error.js:
|
package/dist/shared.d.ts
CHANGED
|
@@ -91,6 +91,8 @@ export interface ChatCardProps {
|
|
|
91
91
|
data: Record<string, unknown>;
|
|
92
92
|
projectId: string;
|
|
93
93
|
target: OperationTarget;
|
|
94
|
+
/** Theme the host currently displays. Absent when the host declares none; it may change while mounted. */
|
|
95
|
+
theme?: 'light' | 'dark';
|
|
94
96
|
/** Download an original card media URL through the MCP Apps host, when supported. */
|
|
95
97
|
download?(media: { uri: string; name: string }): Promise<void>;
|
|
96
98
|
/** Read bytes of a local media path declared by this card, without a public URL. */
|
package/package.json
CHANGED
|
@@ -56,6 +56,13 @@ before display or playback. It needs no preview ID,
|
|
|
56
56
|
import or public URL. A remote MCP Host cannot read a path on the user's computer.
|
|
57
57
|
This whole-file preview does not provide progressive long-video playback.
|
|
58
58
|
|
|
59
|
+
If the interactive card tools are not active in the current conversation,
|
|
60
|
+
proactively tell the user in natural language (without mentioning internal
|
|
61
|
+
protocol/server names or hardcoding a client name) that interactive cards are
|
|
62
|
+
not active in this session yet and suggest starting a new conversation to
|
|
63
|
+
experience the full interactive features, while continuing via the CLI and
|
|
64
|
+
Studio Workbench.
|
|
65
|
+
|
|
59
66
|
If discovery returns no ready matching capability, report that status and retain
|
|
60
67
|
the draft. For an unmet general presentation need, follow the installed
|
|
61
68
|
`chat-components` custom-visualization route and `vivix-studio-ui` guidance when
|