@vivix-labs/studio-chat-mcp 0.1.2 → 0.1.3
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 +27 -2
- package/dist/chat-ui/index.html +19 -19
- package/dist/server.js +515 -52
- package/dist/shared.d.ts +26 -0
- package/package.json +1 -1
- package/skills/vivix-studio-chat/SKILL.md +13 -2
package/dist/server.js
CHANGED
|
@@ -514,11 +514,11 @@ var require_codegen = __commonJS({
|
|
|
514
514
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
515
515
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
516
516
|
}
|
|
517
|
-
optimizeNames(names,
|
|
517
|
+
optimizeNames(names, constants2) {
|
|
518
518
|
if (!names[this.name.str])
|
|
519
519
|
return;
|
|
520
520
|
if (this.rhs)
|
|
521
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
521
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
522
522
|
return this;
|
|
523
523
|
}
|
|
524
524
|
get names() {
|
|
@@ -535,10 +535,10 @@ var require_codegen = __commonJS({
|
|
|
535
535
|
render({ _n }) {
|
|
536
536
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
537
537
|
}
|
|
538
|
-
optimizeNames(names,
|
|
538
|
+
optimizeNames(names, constants2) {
|
|
539
539
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
540
540
|
return;
|
|
541
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
541
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
542
542
|
return this;
|
|
543
543
|
}
|
|
544
544
|
get names() {
|
|
@@ -599,8 +599,8 @@ var require_codegen = __commonJS({
|
|
|
599
599
|
optimizeNodes() {
|
|
600
600
|
return `${this.code}` ? this : void 0;
|
|
601
601
|
}
|
|
602
|
-
optimizeNames(names,
|
|
603
|
-
this.code = optimizeExpr(this.code, names,
|
|
602
|
+
optimizeNames(names, constants2) {
|
|
603
|
+
this.code = optimizeExpr(this.code, names, constants2);
|
|
604
604
|
return this;
|
|
605
605
|
}
|
|
606
606
|
get names() {
|
|
@@ -629,12 +629,12 @@ var require_codegen = __commonJS({
|
|
|
629
629
|
}
|
|
630
630
|
return nodes.length > 0 ? this : void 0;
|
|
631
631
|
}
|
|
632
|
-
optimizeNames(names,
|
|
632
|
+
optimizeNames(names, constants2) {
|
|
633
633
|
const { nodes } = this;
|
|
634
634
|
let i = nodes.length;
|
|
635
635
|
while (i--) {
|
|
636
636
|
const n = nodes[i];
|
|
637
|
-
if (n.optimizeNames(names,
|
|
637
|
+
if (n.optimizeNames(names, constants2))
|
|
638
638
|
continue;
|
|
639
639
|
subtractNames(names, n.names);
|
|
640
640
|
nodes.splice(i, 1);
|
|
@@ -687,12 +687,12 @@ var require_codegen = __commonJS({
|
|
|
687
687
|
return void 0;
|
|
688
688
|
return this;
|
|
689
689
|
}
|
|
690
|
-
optimizeNames(names,
|
|
690
|
+
optimizeNames(names, constants2) {
|
|
691
691
|
var _a3;
|
|
692
|
-
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names,
|
|
693
|
-
if (!(super.optimizeNames(names,
|
|
692
|
+
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants2);
|
|
693
|
+
if (!(super.optimizeNames(names, constants2) || this.else))
|
|
694
694
|
return;
|
|
695
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
695
|
+
this.condition = optimizeExpr(this.condition, names, constants2);
|
|
696
696
|
return this;
|
|
697
697
|
}
|
|
698
698
|
get names() {
|
|
@@ -715,10 +715,10 @@ var require_codegen = __commonJS({
|
|
|
715
715
|
render(opts) {
|
|
716
716
|
return `for(${this.iteration})` + super.render(opts);
|
|
717
717
|
}
|
|
718
|
-
optimizeNames(names,
|
|
719
|
-
if (!super.optimizeNames(names,
|
|
718
|
+
optimizeNames(names, constants2) {
|
|
719
|
+
if (!super.optimizeNames(names, constants2))
|
|
720
720
|
return;
|
|
721
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
721
|
+
this.iteration = optimizeExpr(this.iteration, names, constants2);
|
|
722
722
|
return this;
|
|
723
723
|
}
|
|
724
724
|
get names() {
|
|
@@ -754,10 +754,10 @@ var require_codegen = __commonJS({
|
|
|
754
754
|
render(opts) {
|
|
755
755
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
756
756
|
}
|
|
757
|
-
optimizeNames(names,
|
|
758
|
-
if (!super.optimizeNames(names,
|
|
757
|
+
optimizeNames(names, constants2) {
|
|
758
|
+
if (!super.optimizeNames(names, constants2))
|
|
759
759
|
return;
|
|
760
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
760
|
+
this.iterable = optimizeExpr(this.iterable, names, constants2);
|
|
761
761
|
return this;
|
|
762
762
|
}
|
|
763
763
|
get names() {
|
|
@@ -799,11 +799,11 @@ var require_codegen = __commonJS({
|
|
|
799
799
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
800
800
|
return this;
|
|
801
801
|
}
|
|
802
|
-
optimizeNames(names,
|
|
802
|
+
optimizeNames(names, constants2) {
|
|
803
803
|
var _a3, _b;
|
|
804
|
-
super.optimizeNames(names,
|
|
805
|
-
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names,
|
|
806
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
804
|
+
super.optimizeNames(names, constants2);
|
|
805
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants2);
|
|
806
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants2);
|
|
807
807
|
return this;
|
|
808
808
|
}
|
|
809
809
|
get names() {
|
|
@@ -1104,7 +1104,7 @@ var require_codegen = __commonJS({
|
|
|
1104
1104
|
function addExprNames(names, from) {
|
|
1105
1105
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
1106
1106
|
}
|
|
1107
|
-
function optimizeExpr(expr, names,
|
|
1107
|
+
function optimizeExpr(expr, names, constants2) {
|
|
1108
1108
|
if (expr instanceof code_1.Name)
|
|
1109
1109
|
return replaceName(expr);
|
|
1110
1110
|
if (!canOptimize(expr))
|
|
@@ -1119,14 +1119,14 @@ var require_codegen = __commonJS({
|
|
|
1119
1119
|
return items;
|
|
1120
1120
|
}, []));
|
|
1121
1121
|
function replaceName(n) {
|
|
1122
|
-
const c =
|
|
1122
|
+
const c = constants2[n.str];
|
|
1123
1123
|
if (c === void 0 || names[n.str] !== 1)
|
|
1124
1124
|
return n;
|
|
1125
1125
|
delete names[n.str];
|
|
1126
1126
|
return c;
|
|
1127
1127
|
}
|
|
1128
1128
|
function canOptimize(e) {
|
|
1129
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
1129
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants2[c.str] !== void 0);
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
function subtractNames(names, from) {
|
|
@@ -20736,9 +20736,9 @@ function generateBigIntFormatCheck(doc, def, accessor) {
|
|
|
20736
20736
|
}
|
|
20737
20737
|
}
|
|
20738
20738
|
function generateMimeTypeCheck(doc, ctx, def, accessor) {
|
|
20739
|
-
const
|
|
20740
|
-
if (
|
|
20741
|
-
const mimeSet = addConstant(ctx, new Set(
|
|
20739
|
+
const mimeTypes2 = def.mime;
|
|
20740
|
+
if (mimeTypes2 && mimeTypes2.length > 0) {
|
|
20741
|
+
const mimeSet = addConstant(ctx, new Set(mimeTypes2));
|
|
20742
20742
|
doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`);
|
|
20743
20743
|
}
|
|
20744
20744
|
}
|
|
@@ -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.3",
|
|
29433
29433
|
type: "module",
|
|
29434
29434
|
engines: {
|
|
29435
29435
|
node: ">=22.12.0"
|
|
@@ -36608,6 +36608,228 @@ var McpZodTypeKind;
|
|
|
36608
36608
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
36609
36609
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
36610
36610
|
|
|
36611
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
|
|
36612
|
+
var MAX_TEMPLATE_LENGTH = 1e6;
|
|
36613
|
+
var MAX_VARIABLE_LENGTH = 1e6;
|
|
36614
|
+
var MAX_TEMPLATE_EXPRESSIONS = 1e4;
|
|
36615
|
+
var MAX_REGEX_LENGTH = 1e6;
|
|
36616
|
+
var UriTemplate = class _UriTemplate {
|
|
36617
|
+
/**
|
|
36618
|
+
* Returns true if the given string contains any URI template expressions.
|
|
36619
|
+
* A template expression is a sequence of characters enclosed in curly braces,
|
|
36620
|
+
* like {foo} or {?bar}.
|
|
36621
|
+
*/
|
|
36622
|
+
static isTemplate(str) {
|
|
36623
|
+
return /\{[^}\s]+\}/.test(str);
|
|
36624
|
+
}
|
|
36625
|
+
static validateLength(str, max, context) {
|
|
36626
|
+
if (str.length > max) {
|
|
36627
|
+
throw new Error(`${context} exceeds maximum length of ${max} characters (got ${str.length})`);
|
|
36628
|
+
}
|
|
36629
|
+
}
|
|
36630
|
+
get variableNames() {
|
|
36631
|
+
return this.parts.flatMap((part) => typeof part === "string" ? [] : part.names);
|
|
36632
|
+
}
|
|
36633
|
+
constructor(template) {
|
|
36634
|
+
_UriTemplate.validateLength(template, MAX_TEMPLATE_LENGTH, "Template");
|
|
36635
|
+
this.template = template;
|
|
36636
|
+
this.parts = this.parse(template);
|
|
36637
|
+
}
|
|
36638
|
+
toString() {
|
|
36639
|
+
return this.template;
|
|
36640
|
+
}
|
|
36641
|
+
parse(template) {
|
|
36642
|
+
const parts = [];
|
|
36643
|
+
let currentText = "";
|
|
36644
|
+
let i = 0;
|
|
36645
|
+
let expressionCount = 0;
|
|
36646
|
+
while (i < template.length) {
|
|
36647
|
+
if (template[i] === "{") {
|
|
36648
|
+
if (currentText) {
|
|
36649
|
+
parts.push(currentText);
|
|
36650
|
+
currentText = "";
|
|
36651
|
+
}
|
|
36652
|
+
const end = template.indexOf("}", i);
|
|
36653
|
+
if (end === -1)
|
|
36654
|
+
throw new Error("Unclosed template expression");
|
|
36655
|
+
expressionCount++;
|
|
36656
|
+
if (expressionCount > MAX_TEMPLATE_EXPRESSIONS) {
|
|
36657
|
+
throw new Error(`Template contains too many expressions (max ${MAX_TEMPLATE_EXPRESSIONS})`);
|
|
36658
|
+
}
|
|
36659
|
+
const expr = template.slice(i + 1, end);
|
|
36660
|
+
const operator = this.getOperator(expr);
|
|
36661
|
+
const exploded = expr.includes("*");
|
|
36662
|
+
const names = this.getNames(expr);
|
|
36663
|
+
const name = names[0];
|
|
36664
|
+
for (const name2 of names) {
|
|
36665
|
+
_UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
36666
|
+
}
|
|
36667
|
+
parts.push({ name, operator, names, exploded });
|
|
36668
|
+
i = end + 1;
|
|
36669
|
+
} else {
|
|
36670
|
+
currentText += template[i];
|
|
36671
|
+
i++;
|
|
36672
|
+
}
|
|
36673
|
+
}
|
|
36674
|
+
if (currentText) {
|
|
36675
|
+
parts.push(currentText);
|
|
36676
|
+
}
|
|
36677
|
+
return parts;
|
|
36678
|
+
}
|
|
36679
|
+
getOperator(expr) {
|
|
36680
|
+
const operators = ["+", "#", ".", "/", "?", "&"];
|
|
36681
|
+
return operators.find((op) => expr.startsWith(op)) || "";
|
|
36682
|
+
}
|
|
36683
|
+
getNames(expr) {
|
|
36684
|
+
const operator = this.getOperator(expr);
|
|
36685
|
+
return expr.slice(operator.length).split(",").map((name) => name.replace("*", "").trim()).filter((name) => name.length > 0);
|
|
36686
|
+
}
|
|
36687
|
+
encodeValue(value, operator) {
|
|
36688
|
+
_UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, "Variable value");
|
|
36689
|
+
if (operator === "+" || operator === "#") {
|
|
36690
|
+
return encodeURI(value);
|
|
36691
|
+
}
|
|
36692
|
+
return encodeURIComponent(value);
|
|
36693
|
+
}
|
|
36694
|
+
expandPart(part, variables) {
|
|
36695
|
+
if (part.operator === "?" || part.operator === "&") {
|
|
36696
|
+
const pairs = part.names.map((name) => {
|
|
36697
|
+
const value2 = variables[name];
|
|
36698
|
+
if (value2 === void 0)
|
|
36699
|
+
return "";
|
|
36700
|
+
const encoded2 = Array.isArray(value2) ? value2.map((v) => this.encodeValue(v, part.operator)).join(",") : this.encodeValue(value2.toString(), part.operator);
|
|
36701
|
+
return `${name}=${encoded2}`;
|
|
36702
|
+
}).filter((pair) => pair.length > 0);
|
|
36703
|
+
if (pairs.length === 0)
|
|
36704
|
+
return "";
|
|
36705
|
+
const separator = part.operator === "?" ? "?" : "&";
|
|
36706
|
+
return separator + pairs.join("&");
|
|
36707
|
+
}
|
|
36708
|
+
if (part.names.length > 1) {
|
|
36709
|
+
const values2 = part.names.map((name) => variables[name]).filter((v) => v !== void 0);
|
|
36710
|
+
if (values2.length === 0)
|
|
36711
|
+
return "";
|
|
36712
|
+
return values2.map((v) => Array.isArray(v) ? v[0] : v).join(",");
|
|
36713
|
+
}
|
|
36714
|
+
const value = variables[part.name];
|
|
36715
|
+
if (value === void 0)
|
|
36716
|
+
return "";
|
|
36717
|
+
const values = Array.isArray(value) ? value : [value];
|
|
36718
|
+
const encoded = values.map((v) => this.encodeValue(v, part.operator));
|
|
36719
|
+
switch (part.operator) {
|
|
36720
|
+
case "":
|
|
36721
|
+
return encoded.join(",");
|
|
36722
|
+
case "+":
|
|
36723
|
+
return encoded.join(",");
|
|
36724
|
+
case "#":
|
|
36725
|
+
return "#" + encoded.join(",");
|
|
36726
|
+
case ".":
|
|
36727
|
+
return "." + encoded.join(".");
|
|
36728
|
+
case "/":
|
|
36729
|
+
return "/" + encoded.join("/");
|
|
36730
|
+
default:
|
|
36731
|
+
return encoded.join(",");
|
|
36732
|
+
}
|
|
36733
|
+
}
|
|
36734
|
+
expand(variables) {
|
|
36735
|
+
let result = "";
|
|
36736
|
+
let hasQueryParam = false;
|
|
36737
|
+
for (const part of this.parts) {
|
|
36738
|
+
if (typeof part === "string") {
|
|
36739
|
+
result += part;
|
|
36740
|
+
continue;
|
|
36741
|
+
}
|
|
36742
|
+
const expanded = this.expandPart(part, variables);
|
|
36743
|
+
if (!expanded)
|
|
36744
|
+
continue;
|
|
36745
|
+
if ((part.operator === "?" || part.operator === "&") && hasQueryParam) {
|
|
36746
|
+
result += expanded.replace("?", "&");
|
|
36747
|
+
} else {
|
|
36748
|
+
result += expanded;
|
|
36749
|
+
}
|
|
36750
|
+
if (part.operator === "?" || part.operator === "&") {
|
|
36751
|
+
hasQueryParam = true;
|
|
36752
|
+
}
|
|
36753
|
+
}
|
|
36754
|
+
return result;
|
|
36755
|
+
}
|
|
36756
|
+
escapeRegExp(str) {
|
|
36757
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36758
|
+
}
|
|
36759
|
+
partToRegExp(part) {
|
|
36760
|
+
const patterns = [];
|
|
36761
|
+
for (const name2 of part.names) {
|
|
36762
|
+
_UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
36763
|
+
}
|
|
36764
|
+
if (part.operator === "?" || part.operator === "&") {
|
|
36765
|
+
for (let i = 0; i < part.names.length; i++) {
|
|
36766
|
+
const name2 = part.names[i];
|
|
36767
|
+
const prefix = i === 0 ? "\\" + part.operator : "&";
|
|
36768
|
+
patterns.push({
|
|
36769
|
+
pattern: prefix + this.escapeRegExp(name2) + "=([^&]+)",
|
|
36770
|
+
name: name2
|
|
36771
|
+
});
|
|
36772
|
+
}
|
|
36773
|
+
return patterns;
|
|
36774
|
+
}
|
|
36775
|
+
let pattern;
|
|
36776
|
+
const name = part.name;
|
|
36777
|
+
switch (part.operator) {
|
|
36778
|
+
case "":
|
|
36779
|
+
pattern = part.exploded ? "([^/,]+(?:,[^/,]+)*)" : "([^/,]+)";
|
|
36780
|
+
break;
|
|
36781
|
+
case "+":
|
|
36782
|
+
case "#":
|
|
36783
|
+
pattern = "(.+)";
|
|
36784
|
+
break;
|
|
36785
|
+
case ".":
|
|
36786
|
+
pattern = "\\.([^/,]+)";
|
|
36787
|
+
break;
|
|
36788
|
+
case "/":
|
|
36789
|
+
pattern = "/" + (part.exploded ? "([^/,]+(?:,[^/,]+)*)" : "([^/,]+)");
|
|
36790
|
+
break;
|
|
36791
|
+
default:
|
|
36792
|
+
pattern = "([^/]+)";
|
|
36793
|
+
}
|
|
36794
|
+
patterns.push({ pattern, name });
|
|
36795
|
+
return patterns;
|
|
36796
|
+
}
|
|
36797
|
+
match(uri) {
|
|
36798
|
+
_UriTemplate.validateLength(uri, MAX_TEMPLATE_LENGTH, "URI");
|
|
36799
|
+
let pattern = "^";
|
|
36800
|
+
const names = [];
|
|
36801
|
+
for (const part of this.parts) {
|
|
36802
|
+
if (typeof part === "string") {
|
|
36803
|
+
pattern += this.escapeRegExp(part);
|
|
36804
|
+
} else {
|
|
36805
|
+
const patterns = this.partToRegExp(part);
|
|
36806
|
+
for (const { pattern: partPattern2, name } of patterns) {
|
|
36807
|
+
pattern += partPattern2;
|
|
36808
|
+
names.push({ name, exploded: part.exploded });
|
|
36809
|
+
}
|
|
36810
|
+
}
|
|
36811
|
+
}
|
|
36812
|
+
pattern += "$";
|
|
36813
|
+
_UriTemplate.validateLength(pattern, MAX_REGEX_LENGTH, "Generated regex pattern");
|
|
36814
|
+
const regex = new RegExp(pattern);
|
|
36815
|
+
const match = uri.match(regex);
|
|
36816
|
+
if (!match)
|
|
36817
|
+
return null;
|
|
36818
|
+
const result = {};
|
|
36819
|
+
for (let i = 0; i < names.length; i++) {
|
|
36820
|
+
const { name, exploded } = names[i];
|
|
36821
|
+
const value = match[i + 1];
|
|
36822
|
+
const cleanName = name.replace("*", "");
|
|
36823
|
+
if (exploded && value.includes(",")) {
|
|
36824
|
+
result[cleanName] = value.split(",");
|
|
36825
|
+
} else {
|
|
36826
|
+
result[cleanName] = value;
|
|
36827
|
+
}
|
|
36828
|
+
}
|
|
36829
|
+
return result;
|
|
36830
|
+
}
|
|
36831
|
+
};
|
|
36832
|
+
|
|
36611
36833
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
36612
36834
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
36613
36835
|
function validateToolName(name) {
|
|
@@ -37446,6 +37668,30 @@ var McpServer = class {
|
|
|
37446
37668
|
}
|
|
37447
37669
|
}
|
|
37448
37670
|
};
|
|
37671
|
+
var ResourceTemplate = class {
|
|
37672
|
+
constructor(uriTemplate, _callbacks) {
|
|
37673
|
+
this._callbacks = _callbacks;
|
|
37674
|
+
this._uriTemplate = typeof uriTemplate === "string" ? new UriTemplate(uriTemplate) : uriTemplate;
|
|
37675
|
+
}
|
|
37676
|
+
/**
|
|
37677
|
+
* Gets the URI template pattern.
|
|
37678
|
+
*/
|
|
37679
|
+
get uriTemplate() {
|
|
37680
|
+
return this._uriTemplate;
|
|
37681
|
+
}
|
|
37682
|
+
/**
|
|
37683
|
+
* Gets the list callback, if one was provided.
|
|
37684
|
+
*/
|
|
37685
|
+
get listCallback() {
|
|
37686
|
+
return this._callbacks.list;
|
|
37687
|
+
}
|
|
37688
|
+
/**
|
|
37689
|
+
* Gets the callback for completing a specific URI template variable, if one was provided.
|
|
37690
|
+
*/
|
|
37691
|
+
completeCallback(variable) {
|
|
37692
|
+
return this._callbacks.complete?.[variable];
|
|
37693
|
+
}
|
|
37694
|
+
};
|
|
37449
37695
|
var EMPTY_OBJECT_JSON_SCHEMA = {
|
|
37450
37696
|
type: "object",
|
|
37451
37697
|
properties: {}
|
|
@@ -37594,6 +37840,8 @@ function normalizeChat(definition, source, context) {
|
|
|
37594
37840
|
);
|
|
37595
37841
|
if (typeof definition.projectResult !== "function" || !definition.actions || typeof definition.actions !== "object" || Array.isArray(definition.actions))
|
|
37596
37842
|
throw Error("Invalid chat declaration.");
|
|
37843
|
+
if (definition.dynamicActions !== void 0 && typeof definition.dynamicActions !== "function")
|
|
37844
|
+
throw Error("Invalid dynamic chat action resolver.");
|
|
37597
37845
|
const actions = {};
|
|
37598
37846
|
for (const [name, raw] of Object.entries(definition.actions)) {
|
|
37599
37847
|
operationId.parse(name);
|
|
@@ -37623,15 +37871,35 @@ function normalizeChat(definition, source, context) {
|
|
|
37623
37871
|
component: definition.component,
|
|
37624
37872
|
projectResult: definition.projectResult,
|
|
37625
37873
|
actions,
|
|
37874
|
+
dynamicActions: definition.dynamicActions,
|
|
37626
37875
|
description: {
|
|
37627
37876
|
component: definition.component,
|
|
37628
37877
|
actions: Object.fromEntries(
|
|
37629
37878
|
Object.entries(actions).map(([name, binding]) => [name, binding.target])
|
|
37630
37879
|
),
|
|
37631
|
-
messageActions: Object.entries(actions).filter(([, binding]) => binding.prepareMessage).map(([name]) => name)
|
|
37880
|
+
messageActions: Object.entries(actions).filter(([, binding]) => binding.prepareMessage).map(([name]) => name),
|
|
37881
|
+
...definition.dynamicActions && { dynamicActions: true }
|
|
37632
37882
|
}
|
|
37633
37883
|
};
|
|
37634
37884
|
}
|
|
37885
|
+
function actionsFor(chat, source, context) {
|
|
37886
|
+
const actions = { ...chat.actions };
|
|
37887
|
+
const dynamic = chat.dynamicActions?.(context) ?? {};
|
|
37888
|
+
if (!dynamic || typeof dynamic !== "object" || Array.isArray(dynamic))
|
|
37889
|
+
throw Error("Invalid resolved chat actions.");
|
|
37890
|
+
for (const [name, binding] of Object.entries(dynamic)) {
|
|
37891
|
+
operationId.parse(name);
|
|
37892
|
+
if (Object.hasOwn(actions, name) || !binding || typeof binding !== "object" || "prepareMessage" in binding)
|
|
37893
|
+
throw Error("A dynamic action must declare a unique native target.");
|
|
37894
|
+
const target2 = targetSchema.parse(destination(source, binding.target));
|
|
37895
|
+
if ([binding.mapInput, binding.validate, binding.projectResult].some(
|
|
37896
|
+
(fn) => fn !== void 0 && typeof fn !== "function"
|
|
37897
|
+
))
|
|
37898
|
+
throw Error("Invalid dynamic chat action callback.");
|
|
37899
|
+
Object.defineProperty(actions, name, { value: { ...binding, target: target2 }, enumerable: true });
|
|
37900
|
+
}
|
|
37901
|
+
return actions;
|
|
37902
|
+
}
|
|
37635
37903
|
function sourceOperation(runtime, target2) {
|
|
37636
37904
|
const operation = readOperation(runtime, target2);
|
|
37637
37905
|
if (!operation?.chat) unavailable();
|
|
@@ -37650,7 +37918,7 @@ function readyDestination(runtime, target2) {
|
|
|
37650
37918
|
async function actionBindings(runtime, source, chat, context) {
|
|
37651
37919
|
return Object.fromEntries(
|
|
37652
37920
|
await Promise.all(
|
|
37653
|
-
Object.entries(chat
|
|
37921
|
+
Object.entries(actionsFor(chat, source, context)).map(async ([name, binding]) => [
|
|
37654
37922
|
name,
|
|
37655
37923
|
await runtime.bind(binding.target, [source], context)
|
|
37656
37924
|
])
|
|
@@ -37701,15 +37969,33 @@ async function project(runtime, source, chat, result, projector, ui, action, bin
|
|
|
37701
37969
|
} : void 0
|
|
37702
37970
|
};
|
|
37703
37971
|
}
|
|
37704
|
-
function chatTargets(catalog, source) {
|
|
37972
|
+
function chatTargets(catalog, source, context) {
|
|
37705
37973
|
const chat = readOperation(catalog, source)?.chat;
|
|
37706
|
-
return [
|
|
37974
|
+
return [
|
|
37975
|
+
source,
|
|
37976
|
+
...Object.values(chat ? actionsFor(chat, source, context) : {}).map(
|
|
37977
|
+
(binding) => binding.target
|
|
37978
|
+
)
|
|
37979
|
+
];
|
|
37980
|
+
}
|
|
37981
|
+
function readChatBundle(host, scope, target2, digest) {
|
|
37982
|
+
return host.withOperations(
|
|
37983
|
+
scope,
|
|
37984
|
+
() => [target2],
|
|
37985
|
+
async (runtime) => {
|
|
37986
|
+
const source = sourceOperation(runtime, target2);
|
|
37987
|
+
const bundle = await runtime.component(target2, source.chat.component);
|
|
37988
|
+
if (bundle.sha256 !== digest)
|
|
37989
|
+
throw new Error("The original Studio card script is unavailable.");
|
|
37990
|
+
return bundle.javascript;
|
|
37991
|
+
}
|
|
37992
|
+
);
|
|
37707
37993
|
}
|
|
37708
37994
|
async function runChat(host, projectId, raw) {
|
|
37709
37995
|
const request = chatRunSchema.parse(raw);
|
|
37710
37996
|
return host.withOperations(
|
|
37711
37997
|
typeof projectId === "string" ? { kind: "project", id: projectId } : projectId,
|
|
37712
|
-
(catalog) => chatTargets(catalog, request.target),
|
|
37998
|
+
(catalog) => chatTargets(catalog, request.target, request.input),
|
|
37713
37999
|
async (runtime) => {
|
|
37714
38000
|
const source = sourceOperation(runtime, request.target);
|
|
37715
38001
|
const ui = await runtime.component(request.target, source.chat.component);
|
|
@@ -37736,7 +38022,14 @@ async function actionChat(host, projectId, raw) {
|
|
|
37736
38022
|
(catalog) => {
|
|
37737
38023
|
const targets = catalog.bindingTargets(request.binding);
|
|
37738
38024
|
destinationTarget = targets[0];
|
|
37739
|
-
|
|
38025
|
+
try {
|
|
38026
|
+
return [
|
|
38027
|
+
...targets,
|
|
38028
|
+
...chatTargets(catalog, request.target, catalog.bindingContext(request.binding))
|
|
38029
|
+
];
|
|
38030
|
+
} catch {
|
|
38031
|
+
return [...targets, request.target];
|
|
38032
|
+
}
|
|
37740
38033
|
},
|
|
37741
38034
|
async (runtime) => {
|
|
37742
38035
|
const bindingContext = runtime.bindingContext(request.binding);
|
|
@@ -37773,7 +38066,12 @@ async function actionChat(host, projectId, raw) {
|
|
|
37773
38066
|
{ requestKey: request.requestKey, approval: request.approval },
|
|
37774
38067
|
async () => {
|
|
37775
38068
|
const source2 = sourceOperation(runtime, request.target);
|
|
37776
|
-
const binding2 = declaredAction(
|
|
38069
|
+
const binding2 = declaredAction(
|
|
38070
|
+
source2.chat,
|
|
38071
|
+
request.target,
|
|
38072
|
+
request.action,
|
|
38073
|
+
bindingContext
|
|
38074
|
+
);
|
|
37777
38075
|
const target2 = binding2.target;
|
|
37778
38076
|
if (target2.instanceId !== destinationTarget.instanceId || target2.operationId !== destinationTarget.operationId)
|
|
37779
38077
|
throw inputError(
|
|
@@ -37818,7 +38116,7 @@ async function actionChat(host, projectId, raw) {
|
|
|
37818
38116
|
}
|
|
37819
38117
|
};
|
|
37820
38118
|
}
|
|
37821
|
-
const binding = declaredAction(source.chat, request.action);
|
|
38119
|
+
const binding = declaredAction(source.chat, request.target, request.action, bindingContext);
|
|
37822
38120
|
const operation = readyDestination(runtime, invocation.target);
|
|
37823
38121
|
const ui = await runtime.component(request.target, source.chat.component);
|
|
37824
38122
|
return project(
|
|
@@ -37834,8 +38132,9 @@ async function actionChat(host, projectId, raw) {
|
|
|
37834
38132
|
}
|
|
37835
38133
|
);
|
|
37836
38134
|
}
|
|
37837
|
-
function declaredAction(chat, action) {
|
|
37838
|
-
const
|
|
38135
|
+
function declaredAction(chat, source, action, context) {
|
|
38136
|
+
const actions = actionsFor(chat, source, context);
|
|
38137
|
+
const binding = Object.hasOwn(actions, action) ? actions[action] : void 0;
|
|
37839
38138
|
if (!binding)
|
|
37840
38139
|
throw inputError(
|
|
37841
38140
|
"CHAT_ACTION_DENIED",
|
|
@@ -37845,6 +38144,77 @@ function declaredAction(chat, action) {
|
|
|
37845
38144
|
return binding;
|
|
37846
38145
|
}
|
|
37847
38146
|
|
|
38147
|
+
// src/local-media.ts
|
|
38148
|
+
import { constants } from "node:fs";
|
|
38149
|
+
import { open as open2 } from "node:fs/promises";
|
|
38150
|
+
import { extname, isAbsolute } from "node:path";
|
|
38151
|
+
var snapshot = external_exports.object({
|
|
38152
|
+
sizeBytes: external_exports.number().int().positive().max(2147483648),
|
|
38153
|
+
mtimeMs: external_exports.number().finite(),
|
|
38154
|
+
inode: external_exports.number().int().nonnegative(),
|
|
38155
|
+
device: external_exports.number().int().nonnegative()
|
|
38156
|
+
}).strict();
|
|
38157
|
+
var localMediaInput = external_exports.object({
|
|
38158
|
+
path: external_exports.string().min(1).max(32768).refine(
|
|
38159
|
+
(path) => isAbsolute(path) && !path.includes("\0"),
|
|
38160
|
+
"Use an absolute path on this MCP Host."
|
|
38161
|
+
),
|
|
38162
|
+
offset: external_exports.number().int().nonnegative(),
|
|
38163
|
+
expected: snapshot.optional()
|
|
38164
|
+
}).strict();
|
|
38165
|
+
var mimeTypes = {
|
|
38166
|
+
".mp4": "video/mp4",
|
|
38167
|
+
".m4v": "video/mp4",
|
|
38168
|
+
".mov": "video/quicktime",
|
|
38169
|
+
".webm": "video/webm",
|
|
38170
|
+
".ogv": "video/ogg",
|
|
38171
|
+
".mp3": "audio/mpeg",
|
|
38172
|
+
".wav": "audio/wav",
|
|
38173
|
+
".m4a": "audio/mp4",
|
|
38174
|
+
".aac": "audio/aac",
|
|
38175
|
+
".ogg": "audio/ogg",
|
|
38176
|
+
".opus": "audio/ogg",
|
|
38177
|
+
".flac": "audio/flac"
|
|
38178
|
+
};
|
|
38179
|
+
async function readLocalMedia(raw) {
|
|
38180
|
+
const input2 = localMediaInput.parse(raw);
|
|
38181
|
+
const mimeType = mimeTypes[extname(input2.path).toLowerCase()];
|
|
38182
|
+
if (!mimeType) throw Error("Choose a supported local audio or video file.");
|
|
38183
|
+
const file2 = await open2(input2.path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
38184
|
+
try {
|
|
38185
|
+
const before = await file2.stat();
|
|
38186
|
+
if (!before.isFile() || before.size === 0 || before.size > 2147483648)
|
|
38187
|
+
throw Error(
|
|
38188
|
+
"Choose a nonempty regular media file up to 2 GiB. Whole-file preview requires loading all bytes."
|
|
38189
|
+
);
|
|
38190
|
+
const actual = {
|
|
38191
|
+
sizeBytes: before.size,
|
|
38192
|
+
mtimeMs: before.mtimeMs,
|
|
38193
|
+
inode: before.ino,
|
|
38194
|
+
device: before.dev
|
|
38195
|
+
};
|
|
38196
|
+
if (input2.expected && Object.entries(actual).some(
|
|
38197
|
+
([key, value]) => value !== input2.expected[key]
|
|
38198
|
+
))
|
|
38199
|
+
throw Error("The local file changed while loading. Reopen the preview.");
|
|
38200
|
+
if (input2.offset >= before.size) throw Error("The requested media offset is outside the file.");
|
|
38201
|
+
const bytes = Buffer.alloc(Math.min(262144, before.size - input2.offset));
|
|
38202
|
+
const { bytesRead } = await file2.read(bytes, 0, bytes.length, input2.offset);
|
|
38203
|
+
const after = await file2.stat();
|
|
38204
|
+
if (bytesRead !== bytes.length || before.size !== after.size || before.mtimeMs !== after.mtimeMs)
|
|
38205
|
+
throw Error("The local file changed while loading. Reopen the preview.");
|
|
38206
|
+
return {
|
|
38207
|
+
base64: bytes.toString("base64"),
|
|
38208
|
+
nextOffset: input2.offset + bytesRead,
|
|
38209
|
+
totalBytes: before.size,
|
|
38210
|
+
mimeType,
|
|
38211
|
+
snapshot: actual
|
|
38212
|
+
};
|
|
38213
|
+
} finally {
|
|
38214
|
+
await file2.close();
|
|
38215
|
+
}
|
|
38216
|
+
}
|
|
38217
|
+
|
|
37848
38218
|
// src/discovery.ts
|
|
37849
38219
|
import { PluginError as PluginError2 } from "vivix-studio/sdk/shared";
|
|
37850
38220
|
var id = external_exports.string().min(1).refine((value) => value !== "." && value !== "..");
|
|
@@ -37932,8 +38302,34 @@ async function read(host, scope, target2, input2) {
|
|
|
37932
38302
|
(lease) => lease.invoke(target2, input2)
|
|
37933
38303
|
);
|
|
37934
38304
|
}
|
|
37935
|
-
async function listChatCapabilities(host, scope) {
|
|
38305
|
+
async function listChatCapabilities(host, scope, filter) {
|
|
37936
38306
|
const operations = await descriptions(host, scope);
|
|
38307
|
+
if (filter?.kind === "nativeOperation") {
|
|
38308
|
+
const query = (filter.query ?? "").trim().toLowerCase();
|
|
38309
|
+
const matches = operations.filter(
|
|
38310
|
+
(item) => `${item.instanceId} ${item.id} ${item.title} ${item.description}`.toLowerCase().includes(query)
|
|
38311
|
+
).sort((a, b) => `${a.instanceId}/${a.id}`.localeCompare(`${b.instanceId}/${b.id}`));
|
|
38312
|
+
const offset = filter.offset ?? 0;
|
|
38313
|
+
const limit = filter.limit ?? 20;
|
|
38314
|
+
if (!Number.isInteger(offset) || offset < 0 || !Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
38315
|
+
fail("INVALID_DISCOVERY_QUERY", "Use a nonnegative offset and a limit from 1 to 100.");
|
|
38316
|
+
return {
|
|
38317
|
+
scope,
|
|
38318
|
+
total: matches.length,
|
|
38319
|
+
offset,
|
|
38320
|
+
...offset + limit < matches.length && { nextOffset: offset + limit },
|
|
38321
|
+
items: matches.slice(offset, offset + limit).map((item) => ({
|
|
38322
|
+
kind: "nativeOperation",
|
|
38323
|
+
scope,
|
|
38324
|
+
target: route(item),
|
|
38325
|
+
title: item.title,
|
|
38326
|
+
description: item.description,
|
|
38327
|
+
effects: item.effects,
|
|
38328
|
+
confirm: item.confirm,
|
|
38329
|
+
contract: item.contract
|
|
38330
|
+
}))
|
|
38331
|
+
};
|
|
38332
|
+
}
|
|
37937
38333
|
const items = [];
|
|
37938
38334
|
for (const item of operations) {
|
|
37939
38335
|
const target2 = route(item);
|
|
@@ -37982,12 +38378,17 @@ async function listChatCapabilities(host, scope) {
|
|
|
37982
38378
|
}
|
|
37983
38379
|
return { scope, items };
|
|
37984
38380
|
}
|
|
37985
|
-
async function describeChatCapability(host, scope, target2, componentId) {
|
|
38381
|
+
async function describeChatCapability(host, scope, target2, componentId, kind) {
|
|
37986
38382
|
const operations = await descriptions(host, scope);
|
|
37987
38383
|
const item = operations.find(
|
|
37988
38384
|
(item2) => item2.instanceId === target2.instanceId && item2.id === target2.operationId
|
|
37989
38385
|
);
|
|
37990
38386
|
if (!item) fail("CAPABILITY_UNAVAILABLE", "This capability is not ready in the selected scope.");
|
|
38387
|
+
if (kind === "nativeOperation") {
|
|
38388
|
+
if (componentId)
|
|
38389
|
+
fail("INVALID_DISCOVERY_QUERY", "Describe either a native operation or a component.");
|
|
38390
|
+
return { ...item, kind, scope, target: target2 };
|
|
38391
|
+
}
|
|
37991
38392
|
if (componentId) {
|
|
37992
38393
|
if (item.id !== "components.render" || !record2(item.chat))
|
|
37993
38394
|
fail("COMPONENT_UNAVAILABLE", "This operation is not a component renderer.");
|
|
@@ -38057,11 +38458,13 @@ async function resolveChatMedia(host, scope, ref, fileId) {
|
|
|
38057
38458
|
}
|
|
38058
38459
|
|
|
38059
38460
|
// src/chat-server.ts
|
|
38060
|
-
var chatResourceUri = "ui://studio/chat/
|
|
38461
|
+
var chatResourceUri = "ui://studio/chat/v6.html";
|
|
38061
38462
|
var historicalChatResourceUris = [
|
|
38062
38463
|
"ui://studio/chat/v1.html",
|
|
38063
38464
|
"ui://studio/chat/v2.html",
|
|
38064
|
-
"ui://studio/chat/v3.html"
|
|
38465
|
+
"ui://studio/chat/v3.html",
|
|
38466
|
+
"ui://studio/chat/v4.html",
|
|
38467
|
+
"ui://studio/chat/v5.html"
|
|
38065
38468
|
];
|
|
38066
38469
|
var chatMimeType = "text/html;profile=mcp-app";
|
|
38067
38470
|
var defaultResourceDomains = ["https://static.vivi-x.ai"];
|
|
@@ -38095,7 +38498,12 @@ function mapChatResult(result) {
|
|
|
38095
38498
|
structuredContent,
|
|
38096
38499
|
...(result.view || result.message) && {
|
|
38097
38500
|
_meta: {
|
|
38098
|
-
...result.view && {
|
|
38501
|
+
...result.view && {
|
|
38502
|
+
"studio/view": {
|
|
38503
|
+
...result.view,
|
|
38504
|
+
ui: { format: result.view.ui.format, sha256: result.view.ui.sha256 }
|
|
38505
|
+
}
|
|
38506
|
+
},
|
|
38099
38507
|
...result.message && { "studio/message": result.message }
|
|
38100
38508
|
}
|
|
38101
38509
|
}
|
|
@@ -38109,6 +38517,35 @@ function createChatServer(options2) {
|
|
|
38109
38517
|
instructions: "Discover capabilities on this same connection with list_chat_capabilities and describe_chat_capability. General interactions default to user scope and do not need a business project. Use an explicit project scope for saved project operations. Read media through query_studio_media and resolve_chat_media. Preserve requestKey and original arguments for recovery; never automatically resubmit an uncertain action."
|
|
38110
38518
|
}
|
|
38111
38519
|
);
|
|
38520
|
+
server.registerTool(
|
|
38521
|
+
"read_local_media",
|
|
38522
|
+
{
|
|
38523
|
+
title: "Read local media bytes",
|
|
38524
|
+
description: "Read a bounded chunk of a local audio/video path supplied to this card. Bytes are private App metadata, not model context. Does not upload or import files.",
|
|
38525
|
+
inputSchema: localMediaInput,
|
|
38526
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
38527
|
+
_meta: { ui: { visibility: ["app"] } }
|
|
38528
|
+
},
|
|
38529
|
+
async (input2) => {
|
|
38530
|
+
try {
|
|
38531
|
+
return {
|
|
38532
|
+
content: [{ type: "text", text: "Local media chunk read." }],
|
|
38533
|
+
_meta: { "studio/media": await readLocalMedia(input2) }
|
|
38534
|
+
};
|
|
38535
|
+
} catch (error62) {
|
|
38536
|
+
const code = error62 && typeof error62 === "object" && "code" in error62 ? String(error62.code) : void 0;
|
|
38537
|
+
return {
|
|
38538
|
+
isError: true,
|
|
38539
|
+
content: [
|
|
38540
|
+
{
|
|
38541
|
+
type: "text",
|
|
38542
|
+
text: code ? `Local media is unavailable (${code}).` : error62 instanceof Error ? error62.message : "Local media could not be read."
|
|
38543
|
+
}
|
|
38544
|
+
]
|
|
38545
|
+
};
|
|
38546
|
+
}
|
|
38547
|
+
}
|
|
38548
|
+
);
|
|
38112
38549
|
const invoke = async (name, args, signal) => {
|
|
38113
38550
|
const { projectId, scope: requestedScope, ...body } = args;
|
|
38114
38551
|
const scope = requestedScope ?? (projectId ? { kind: "project", id: projectId } : userScope);
|
|
@@ -38167,11 +38604,21 @@ function createChatServer(options2) {
|
|
|
38167
38604
|
"list_chat_capabilities",
|
|
38168
38605
|
{
|
|
38169
38606
|
title: "Discover chat capabilities",
|
|
38170
|
-
description: "Read ready components, project cards and media queries from this connected Host.
|
|
38171
|
-
inputSchema: external_exports.object({
|
|
38607
|
+
description: "Read ready components, project cards and media queries from this connected Host. Set kind=nativeOperation to search paginated operation targets for native card actions, including operations without a chat view. Describe their input schema before binding. Defaults to user scope. This lists capabilities, not saved media.",
|
|
38608
|
+
inputSchema: external_exports.object({
|
|
38609
|
+
scope: scopeSchema.default(userScope),
|
|
38610
|
+
kind: external_exports.literal("nativeOperation").optional(),
|
|
38611
|
+
query: external_exports.string().max(500).optional(),
|
|
38612
|
+
offset: external_exports.number().int().nonnegative().optional(),
|
|
38613
|
+
limit: external_exports.number().int().min(1).max(100).optional()
|
|
38614
|
+
}).strict()
|
|
38172
38615
|
},
|
|
38173
|
-
({ scope }) => readResult("Chat capabilities discovered.", async () => ({
|
|
38174
|
-
...await listChatCapabilities(
|
|
38616
|
+
({ scope, kind, query, offset, limit }) => readResult("Chat capabilities discovered.", async () => ({
|
|
38617
|
+
...await listChatCapabilities(
|
|
38618
|
+
host,
|
|
38619
|
+
scope,
|
|
38620
|
+
kind ? { kind, query, offset, limit } : void 0
|
|
38621
|
+
),
|
|
38175
38622
|
resourceDomains: [...options2.resourceDomains ?? defaultResourceDomains]
|
|
38176
38623
|
}))
|
|
38177
38624
|
);
|
|
@@ -38179,16 +38626,17 @@ function createChatServer(options2) {
|
|
|
38179
38626
|
"describe_chat_capability",
|
|
38180
38627
|
{
|
|
38181
38628
|
title: "Read a chat contract",
|
|
38182
|
-
description: "Read
|
|
38629
|
+
description: "Read exact schemas for a discovered route. Pass componentId for a reusable component, or kind=nativeOperation for an operation to bind using target.mode=native. Native operation schemas do not imply a chat view or execution permission. Default interface text to English and preserve original creative content.",
|
|
38183
38630
|
inputSchema: external_exports.object({
|
|
38184
38631
|
scope: scopeSchema.default(userScope),
|
|
38185
38632
|
target,
|
|
38186
|
-
componentId: identifier.optional()
|
|
38633
|
+
componentId: identifier.optional(),
|
|
38634
|
+
kind: external_exports.literal("nativeOperation").optional()
|
|
38187
38635
|
}).strict()
|
|
38188
38636
|
},
|
|
38189
|
-
({ scope, target: selected, componentId }) => readResult(
|
|
38637
|
+
({ scope, target: selected, componentId, kind }) => readResult(
|
|
38190
38638
|
"Capability contract ready.",
|
|
38191
|
-
() => describeChatCapability(host, scope, selected, componentId)
|
|
38639
|
+
() => describeChatCapability(host, scope, selected, componentId, kind)
|
|
38192
38640
|
)
|
|
38193
38641
|
);
|
|
38194
38642
|
server.registerTool(
|
|
@@ -38233,6 +38681,21 @@ function createChatServer(options2) {
|
|
|
38233
38681
|
},
|
|
38234
38682
|
(args, extra) => invoke("studio_card_action", args, extra.signal)
|
|
38235
38683
|
);
|
|
38684
|
+
server.registerResource(
|
|
38685
|
+
"Registered Studio card script",
|
|
38686
|
+
new ResourceTemplate("studio://chat-bundles/{kind}/{scopeId}/{instance}/{operation}/{digest}", {
|
|
38687
|
+
list: void 0
|
|
38688
|
+
}),
|
|
38689
|
+
{ mimeType: "text/javascript" },
|
|
38690
|
+
async (uri, variables) => {
|
|
38691
|
+
const part = (key) => decodeURIComponent(external_exports.string().parse(variables[key]));
|
|
38692
|
+
const scope = scopeSchema.parse({ kind: part("kind"), id: part("scopeId") });
|
|
38693
|
+
const source = target.parse({ instanceId: part("instance"), operationId: part("operation") });
|
|
38694
|
+
const digest = external_exports.string().regex(/^[a-f0-9]{64}$/).parse(variables.digest);
|
|
38695
|
+
const script = await readChatBundle(host, scope, source, digest);
|
|
38696
|
+
return { contents: [{ uri: uri.href, mimeType: "text/javascript", text: script }] };
|
|
38697
|
+
}
|
|
38698
|
+
);
|
|
38236
38699
|
const metadata = {
|
|
38237
38700
|
// The component's CSP restricts HTTPS media to its declared media origins.
|
|
38238
38701
|
// This outer policy must permit those origins before the component can narrow them.
|