@vivix-labs/studio-chat-mcp 0.1.8 → 0.1.10

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.8",
29432
+ version: "0.1.10",
29433
29433
  type: "module",
29434
29434
  engines: {
29435
29435
  node: ">=22.12.0"
@@ -37978,16 +37978,18 @@ function chatTargets(catalog, source, context) {
37978
37978
  )
37979
37979
  ];
37980
37980
  }
37981
- function readChatBundle(host, scope, target2, digest) {
37981
+ function readChatBundle(host, scope, target2, expected) {
37982
37982
  return host.withOperations(
37983
37983
  scope,
37984
37984
  () => [target2],
37985
37985
  async (runtime) => {
37986
37986
  const source = sourceOperation(runtime, target2);
37987
+ if ("component" in expected && source.chat.component !== expected.component)
37988
+ throw new Error("A compatible Studio card renderer is unavailable.");
37987
37989
  const bundle = await runtime.component(target2, source.chat.component);
37988
- if (bundle.sha256 !== digest)
37990
+ if ("sha256" in expected && bundle.sha256 !== expected.sha256)
37989
37991
  throw new Error("The original Studio card script is unavailable.");
37990
- return bundle.javascript;
37992
+ return bundle;
37991
37993
  }
37992
37994
  );
37993
37995
  }
@@ -38462,7 +38464,7 @@ async function resolveChatMedia(host, scope, ref, fileId) {
38462
38464
  }
38463
38465
 
38464
38466
  // src/chat-server.ts
38465
- var chatResourceUri = "ui://studio/chat/v8.html";
38467
+ var chatResourceUri = "ui://studio/chat/v12.html";
38466
38468
  var historicalChatResourceUris = [
38467
38469
  "ui://studio/chat/v1.html",
38468
38470
  "ui://studio/chat/v2.html",
@@ -38470,7 +38472,11 @@ var historicalChatResourceUris = [
38470
38472
  "ui://studio/chat/v4.html",
38471
38473
  "ui://studio/chat/v5.html",
38472
38474
  "ui://studio/chat/v6.html",
38473
- "ui://studio/chat/v7.html"
38475
+ "ui://studio/chat/v7.html",
38476
+ "ui://studio/chat/v8.html",
38477
+ "ui://studio/chat/v9.html",
38478
+ "ui://studio/chat/v10.html",
38479
+ "ui://studio/chat/v11.html"
38474
38480
  ];
38475
38481
  var chatMimeType = "text/html;profile=mcp-app";
38476
38482
  var defaultResourceDomains = ["https://static.vivi-x.ai"];
@@ -38698,8 +38704,37 @@ function createChatServer(options2) {
38698
38704
  const scope = scopeSchema.parse({ kind: part("kind"), id: part("scopeId") });
38699
38705
  const source = target.parse({ instanceId: part("instance"), operationId: part("operation") });
38700
38706
  const digest = external_exports.string().regex(/^[a-f0-9]{64}$/).parse(variables.digest);
38701
- const script = await readChatBundle(host, scope, source, digest);
38702
- return { contents: [{ uri: uri.href, mimeType: "text/javascript", text: script }] };
38707
+ const bundle = await readChatBundle(host, scope, source, { sha256: digest });
38708
+ return {
38709
+ contents: [{ uri: uri.href, mimeType: "text/javascript", text: bundle.javascript }]
38710
+ };
38711
+ }
38712
+ );
38713
+ server.registerResource(
38714
+ "Compatible Studio card renderer",
38715
+ new ResourceTemplate(
38716
+ "studio://chat-bundles/{kind}/{scopeId}/{instance}/{operation}/components/{component}",
38717
+ { list: void 0 }
38718
+ ),
38719
+ { mimeType: "text/javascript" },
38720
+ async (uri, variables) => {
38721
+ const part = (key) => decodeURIComponent(external_exports.string().parse(variables[key]));
38722
+ const scope = scopeSchema.parse({ kind: part("kind"), id: part("scopeId") });
38723
+ const source = target.parse({ instanceId: part("instance"), operationId: part("operation") });
38724
+ const component = identifier.regex(/^[a-zA-Z0-9._/-]+@[1-9]\d*$/).parse(part("component"));
38725
+ const bundle = await readChatBundle(host, scope, source, { component });
38726
+ return {
38727
+ contents: [
38728
+ {
38729
+ uri: uri.href,
38730
+ mimeType: "text/javascript",
38731
+ text: bundle.javascript,
38732
+ _meta: {
38733
+ "studio/component": { id: component, format: bundle.format, sha256: bundle.sha256 }
38734
+ }
38735
+ }
38736
+ ]
38737
+ };
38703
38738
  }
38704
38739
  );
38705
38740
  const metadata = {
package/dist/setup.js CHANGED
@@ -815,6 +815,14 @@ async function enable(id, scope, options = [], additions) {
815
815
  const current = before.find((item) => item.id === id);
816
816
  if (current && current.package !== name) throw Error("Another plugin owns the instance " + id);
817
817
  const config = { ...current?.config || {} };
818
+ if (id === "chat-components" && !config.libraryInstance) {
819
+ const libraries = cliCall("plugin", "list", ...user).instances.filter(
820
+ (item) => item.package === "@vivix-labs/material-library" && item.state === "ready" && item.config.role === "service"
821
+ );
822
+ if (libraries.length !== 1)
823
+ throw Error("Configure one ready user material library before enabling chat file uploads.");
824
+ config.libraryInstance = scope === user ? libraries[0].id : `user:${libraries[0].id}`;
825
+ }
818
826
  if (additions) {
819
827
  config.targets = { ...config.targets };
820
828
  for (const [key, target] of Object.entries(additions)) {
@@ -829,7 +837,7 @@ async function enable(id, scope, options = [], additions) {
829
837
  }
830
838
  if (current?.state === "ready" && current.version === version && JSON.stringify(config) === JSON.stringify(current.config))
831
839
  return;
832
- if (additions) {
840
+ if (additions || id === "chat-components") {
833
841
  const file = join(scratch, "component-config.json");
834
842
  await writeFile(file, JSON.stringify(config), { mode: 384 });
835
843
  options = [...options, "--config", file];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivix-labs/studio-chat-mcp",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.12.0"