@optiaxiom/proteus 0.1.24 → 0.1.26
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/esm/_virtual/_openai-shim-script.js +81 -0
- package/dist/esm/assets/src/proteus-chart/{ProteusChart.css.ts.vanilla-BCN2MOqI.css → ProteusChart.css.ts.vanilla-B-FJ2e1F.css} +2 -2
- package/dist/esm/assets/src/proteus-chart/{ProteusChartTooltipContent.css.ts.vanilla-DmqHa3bY.css → ProteusChartTooltipContent.css.ts.vanilla-B7GlVdiy.css} +2 -2
- package/dist/esm/assets/src/proteus-document/{ProteusDocumentShell.css.ts.vanilla-DxHEfy0L.css → ProteusDocumentShell.css.ts.vanilla-GbLC1fdW.css} +2 -2
- package/dist/esm/assets/src/proteus-image-carousel/{ProteusImageCarousel.css.ts.vanilla-Bbo2TbLv.css → ProteusImageCarousel.css.ts.vanilla-B21Y_xyv.css} +2 -2
- package/dist/esm/assets/src/proteus-question/{ProteusQuestion.css.ts.vanilla-DRvLrb5J.css → ProteusQuestion.css.ts.vanilla--FkursVc.css} +2 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/proteus-bridge/ProteusBridge.js +90 -0
- package/dist/esm/proteus-chart/ProteusChart-css.js +1 -1
- package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +1 -1
- package/dist/esm/proteus-document/ProteusDocumentShell-css.js +1 -1
- package/dist/esm/proteus-document/ProteusDocumentShell.js +7 -4
- package/dist/esm/proteus-element/ProteusElement.js +8 -0
- package/dist/esm/proteus-image-carousel/ProteusImageCarousel-css.js +1 -1
- package/dist/esm/proteus-question/ProteusQuestion-css.js +1 -1
- package/dist/esm/proteus-question/ProteusQuestion.js +5 -5
- package/dist/esm/schema/public-schema.json.js +41 -0
- package/dist/esm/schema/runtime-schema.json.js +40 -0
- package/dist/index.d.ts +35 -3
- package/dist/spec.d.ts +2882 -2834
- package/package.json +5 -3
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ProteusAction } from './proteus-action/ProteusAction.js';
|
|
2
|
+
export { ProteusBridge } from './proteus-bridge/ProteusBridge.js';
|
|
2
3
|
export { ProteusChart } from './proteus-chart/ProteusChart.js';
|
|
3
4
|
export { ProteusDataTable } from './proteus-data-table/ProteusDataTable.js';
|
|
4
5
|
export { ProteusDocumentRenderer } from './proteus-document/ProteusDocumentRenderer.js';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { AppBridge, PostMessageTransport } from '@modelcontextprotocol/ext-apps/app-bridge';
|
|
4
|
+
import { useState, useRef, useEffect } from 'react';
|
|
5
|
+
import { OPENAI_SHIM_SCRIPT } from '../_virtual/_openai-shim-script.js';
|
|
6
|
+
import { useProteusDocumentContext } from '../proteus-document/ProteusDocumentContext.js';
|
|
7
|
+
|
|
8
|
+
function ProteusBridge({ height = 400, resource }) {
|
|
9
|
+
const { data, onEvent, useResource } = useProteusDocumentContext(
|
|
10
|
+
"@optiaxiom/proteus/ProteusBridge"
|
|
11
|
+
);
|
|
12
|
+
const result = useResource?.(resource);
|
|
13
|
+
const html = result?.data?.text ?? "";
|
|
14
|
+
const mimeType = result?.data?.mimeType;
|
|
15
|
+
const [iframe, setIframe] = useState(null);
|
|
16
|
+
const dataRef = useRef(data);
|
|
17
|
+
dataRef.current = data;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!iframe?.contentWindow) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const bridge = new AppBridge(
|
|
23
|
+
null,
|
|
24
|
+
{ name: "Opal", version: "1.0.0" },
|
|
25
|
+
{ logging: {}, openLinks: {}, serverTools: {} },
|
|
26
|
+
{
|
|
27
|
+
hostContext: {
|
|
28
|
+
containerDimensions: { maxHeight: iframe.clientHeight },
|
|
29
|
+
displayMode: "inline"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
bridge.oncalltool = async (params) => {
|
|
34
|
+
const result2 = await onEvent({
|
|
35
|
+
interaction: params.name,
|
|
36
|
+
params: params.arguments ?? {}
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{ text: JSON.stringify(result2 ?? ""), type: "text" }
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
bridge.onmessage = async (params) => {
|
|
45
|
+
const message = params.content?.filter((content) => content.type === "text").map((content) => content.text).join("\n\n") ?? "";
|
|
46
|
+
await onEvent({ message });
|
|
47
|
+
return {};
|
|
48
|
+
};
|
|
49
|
+
bridge.onopenlink = async ({ url }) => {
|
|
50
|
+
window.open(url, "_blank", "noopener");
|
|
51
|
+
return {};
|
|
52
|
+
};
|
|
53
|
+
bridge.addEventListener("sizechange", ({ height: height2 }) => {
|
|
54
|
+
if (height2 != null) {
|
|
55
|
+
iframe.style.height = `${height2}px`;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
bridge.addEventListener("initialized", () => {
|
|
59
|
+
void bridge.sendToolResult({
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
text: JSON.stringify(dataRef.current),
|
|
63
|
+
type: "text"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
const transport = new PostMessageTransport(
|
|
69
|
+
iframe.contentWindow,
|
|
70
|
+
iframe.contentWindow
|
|
71
|
+
);
|
|
72
|
+
void bridge.connect(transport);
|
|
73
|
+
return () => {
|
|
74
|
+
void bridge.close();
|
|
75
|
+
};
|
|
76
|
+
}, [iframe, onEvent]);
|
|
77
|
+
return result?.isError || !html ? null : /* @__PURE__ */ jsx(
|
|
78
|
+
"iframe",
|
|
79
|
+
{
|
|
80
|
+
ref: setIframe,
|
|
81
|
+
sandbox: "allow-scripts allow-popups allow-popups-to-escape-sandbox allow-forms",
|
|
82
|
+
srcDoc: mimeType === "text/html;profile=openai-app" ? OPENAI_SHIM_SCRIPT + html : html,
|
|
83
|
+
style: { border: "none", height, width: "100%" },
|
|
84
|
+
title: "Opal Widget"
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
ProteusBridge.displayName = "@optiaxiom/proteus/ProteusBridge";
|
|
89
|
+
|
|
90
|
+
export { ProteusBridge };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-B-FJ2e1F.css';
|
|
2
2
|
import { recipe } from '@optiaxiom/react/css-runtime';
|
|
3
3
|
|
|
4
4
|
var chart = recipe({base:[{border:'1',borderColor:'border.tertiary',fontSize:'sm',p:'16'},'ProteusChart__jmlqij1','ProteusChart__jmlqij0']});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-B7GlVdiy.css';
|
|
2
2
|
import { recipe } from '@optiaxiom/react/css-runtime';
|
|
3
3
|
|
|
4
4
|
var tooltip = recipe({base:[{bg:'bg.default',border:'1',borderColor:'border.secondary',display:'grid',fontSize:'sm',gap:'6',px:'8',py:'10',rounded:'lg',shadow:'lg'},'ProteusChartTooltipContent__1gsvq810']});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-GbLC1fdW.css';
|
|
2
2
|
import { recipe } from '@optiaxiom/react/css-runtime';
|
|
3
3
|
|
|
4
4
|
var body = recipe({base:[{flexDirection:'column',gap:'16'},'ProteusDocumentShell__vpuvfj0'],variants:{truncate:{false:{},true:[{maxH:'sm',overflow:'auto',p:'4'},'ProteusDocumentShell__vpuvfj1']}}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { IconArrowDown } from '@optiaxiom/icons';
|
|
4
4
|
import { Disclosure, DisclosureTrigger, Box, Group, Text, DisclosureContent, Heading, Tooltip } from '@optiaxiom/react';
|
|
5
5
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
6
6
|
import { set } from 'jsonpointer';
|
|
@@ -22,7 +22,8 @@ function ProteusDocumentShell({
|
|
|
22
22
|
onOpenChange,
|
|
23
23
|
open: openProp,
|
|
24
24
|
readOnly = false,
|
|
25
|
-
strict
|
|
25
|
+
strict,
|
|
26
|
+
useResource
|
|
26
27
|
}) {
|
|
27
28
|
const [valid, setValid] = useState(false);
|
|
28
29
|
const formRef = useRef(null);
|
|
@@ -69,7 +70,7 @@ function ProteusDocumentShell({
|
|
|
69
70
|
}),
|
|
70
71
|
onEvent: useEffectEvent(async (event) => {
|
|
71
72
|
if ("interaction" in event) {
|
|
72
|
-
await onInteraction?.(event.interaction);
|
|
73
|
+
return await onInteraction?.(event.interaction, event.params);
|
|
73
74
|
} else if ("message" in event) {
|
|
74
75
|
await onMessage?.(event.message);
|
|
75
76
|
} else if (event.action === "download") {
|
|
@@ -92,9 +93,11 @@ function ProteusDocumentShell({
|
|
|
92
93
|
await Promise.all(urls.map((u) => downloadFile(u)));
|
|
93
94
|
}
|
|
94
95
|
}
|
|
96
|
+
return;
|
|
95
97
|
}),
|
|
96
98
|
readOnly,
|
|
97
99
|
strict,
|
|
100
|
+
useResource,
|
|
98
101
|
valid,
|
|
99
102
|
children: /* @__PURE__ */ jsxs(
|
|
100
103
|
Disclosure,
|
|
@@ -180,7 +183,7 @@ function ProteusDocumentShell({
|
|
|
180
183
|
...body({ truncate: element.compact }),
|
|
181
184
|
children: [
|
|
182
185
|
element.body,
|
|
183
|
-
element.compact && /* @__PURE__ */ jsx(Box, { ...scrollIndicator(), children: /* @__PURE__ */ jsx(
|
|
186
|
+
element.compact && /* @__PURE__ */ jsx(Box, { ...scrollIndicator(), children: /* @__PURE__ */ jsx(IconArrowDown, {}) })
|
|
184
187
|
]
|
|
185
188
|
}
|
|
186
189
|
),
|
|
@@ -5,6 +5,7 @@ import { Time, Range } from '@optiaxiom/react/unstable';
|
|
|
5
5
|
import { lazy, Suspense } from 'react';
|
|
6
6
|
import { IconCalendar } from '../icons/IconCalendar.js';
|
|
7
7
|
import { ProteusAction } from '../proteus-action/ProteusAction.js';
|
|
8
|
+
import { ProteusBridge } from '../proteus-bridge/ProteusBridge.js';
|
|
8
9
|
import { ProteusDataTable } from '../proteus-data-table/ProteusDataTable.js';
|
|
9
10
|
import { useProteusDocumentContext } from '../proteus-document/ProteusDocumentContext.js';
|
|
10
11
|
import { useProteusDocumentPathContext } from '../proteus-document/ProteusDocumentPathContext.js';
|
|
@@ -65,6 +66,13 @@ const ProteusElement = ({
|
|
|
65
66
|
return /* @__PURE__ */ jsx(Avatar, { ...resolve(element) });
|
|
66
67
|
case "Badge":
|
|
67
68
|
return /* @__PURE__ */ jsx(Badge, { ...resolve(element) });
|
|
69
|
+
case "Bridge":
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
ProteusBridge,
|
|
72
|
+
{
|
|
73
|
+
...resolve(element)
|
|
74
|
+
}
|
|
75
|
+
);
|
|
68
76
|
case "Button":
|
|
69
77
|
return /* @__PURE__ */ jsx(ProteusAction, { ...resolve(element) });
|
|
70
78
|
case "Card":
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-B21Y_xyv.css';
|
|
2
2
|
import { recipe } from '@optiaxiom/react/css-runtime';
|
|
3
3
|
|
|
4
4
|
var carousel = recipe({base:[{flexDirection:'column',gap:'12'},'ProteusImageCarousel__1t6qej70']});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla
|
|
1
|
+
import './../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla--FkursVc.css';
|
|
2
2
|
import { recipe } from '@optiaxiom/react/css-runtime';
|
|
3
3
|
|
|
4
4
|
var addon = recipe({base:[{display:'grid',fontWeight:'500',placeItems:'center',rounded:'lg',size:'md',transition:'colors'},'ProteusQuestion__8f590p3'],variants:{cursor:{pointer:{cursor:'pointer'}}}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { IconArrowRight, IconPen } from '@optiaxiom/icons';
|
|
4
4
|
import { Group, Text, Button, Box, Checkbox } from '@optiaxiom/react';
|
|
5
5
|
import { InlineInput } from '@optiaxiom/react/unstable';
|
|
6
6
|
import * as RovingFocus from '@radix-ui/react-roving-focus';
|
|
@@ -226,7 +226,7 @@ A: ${value2 || "[Not specified]"}`
|
|
|
226
226
|
h: "24",
|
|
227
227
|
ml: "auto",
|
|
228
228
|
w: "24",
|
|
229
|
-
children: /* @__PURE__ */ jsx(
|
|
229
|
+
children: /* @__PURE__ */ jsx(IconArrowRight, {})
|
|
230
230
|
}
|
|
231
231
|
)
|
|
232
232
|
] })
|
|
@@ -241,7 +241,7 @@ A: ${value2 || "[Not specified]"}`
|
|
|
241
241
|
role: "group",
|
|
242
242
|
...choice({ cursor: "text" }),
|
|
243
243
|
children: /* @__PURE__ */ jsxs(Group, { gap: "12", children: [
|
|
244
|
-
type === "single_select" ? /* @__PURE__ */ jsx(Box, { ...addon({ cursor: "pointer" }), children: /* @__PURE__ */ jsx(
|
|
244
|
+
type === "single_select" ? /* @__PURE__ */ jsx(Box, { ...addon({ cursor: "pointer" }), children: /* @__PURE__ */ jsx(IconPen, {}) }) : /* @__PURE__ */ jsx(
|
|
245
245
|
Checkbox,
|
|
246
246
|
{
|
|
247
247
|
checked: otherChecked,
|
|
@@ -303,7 +303,7 @@ A: ${value2 || "[Not specified]"}`
|
|
|
303
303
|
{
|
|
304
304
|
appearance: otherValue ? "primary-opal" : "default",
|
|
305
305
|
"aria-label": otherValue && (isLast ? "Submit" : "Next"),
|
|
306
|
-
icon: otherValue && /* @__PURE__ */ jsx(
|
|
306
|
+
icon: otherValue && /* @__PURE__ */ jsx(IconArrowRight, {}),
|
|
307
307
|
ml: "auto",
|
|
308
308
|
onClick: (event) => {
|
|
309
309
|
event.preventDefault();
|
|
@@ -354,7 +354,7 @@ A: ${value2 || "[Not specified]"}`
|
|
|
354
354
|
appearance: valid ? "primary-opal" : "default",
|
|
355
355
|
"aria-label": isLast ? "Submit" : "Next",
|
|
356
356
|
disabled: !valid,
|
|
357
|
-
icon: /* @__PURE__ */ jsx(
|
|
357
|
+
icon: /* @__PURE__ */ jsx(IconArrowRight, {}),
|
|
358
358
|
onClick: (event) => {
|
|
359
359
|
event.preventDefault();
|
|
360
360
|
onSubmit();
|
|
@@ -2707,6 +2707,9 @@ var definitions = {
|
|
|
2707
2707
|
{
|
|
2708
2708
|
$ref: "#/definitions/ProteusBadge"
|
|
2709
2709
|
},
|
|
2710
|
+
{
|
|
2711
|
+
$ref: "#/definitions/ProteusBridge"
|
|
2712
|
+
},
|
|
2710
2713
|
{
|
|
2711
2714
|
$ref: "#/definitions/ProteusButton"
|
|
2712
2715
|
},
|
|
@@ -2806,6 +2809,12 @@ var definitions = {
|
|
|
2806
2809
|
interaction: {
|
|
2807
2810
|
description: "Name of registered interaction to call",
|
|
2808
2811
|
type: "string"
|
|
2812
|
+
},
|
|
2813
|
+
params: {
|
|
2814
|
+
additionalProperties: {
|
|
2815
|
+
},
|
|
2816
|
+
description: "Parameters to pass to the interaction handler",
|
|
2817
|
+
type: "object"
|
|
2809
2818
|
}
|
|
2810
2819
|
},
|
|
2811
2820
|
required: [
|
|
@@ -3707,6 +3716,38 @@ var definitions = {
|
|
|
3707
3716
|
],
|
|
3708
3717
|
type: "object"
|
|
3709
3718
|
},
|
|
3719
|
+
ProteusBridge: {
|
|
3720
|
+
additionalProperties: false,
|
|
3721
|
+
examples: [
|
|
3722
|
+
{
|
|
3723
|
+
$type: "Bridge",
|
|
3724
|
+
height: 400,
|
|
3725
|
+
resource: "ui://sample-widget"
|
|
3726
|
+
}
|
|
3727
|
+
],
|
|
3728
|
+
properties: {
|
|
3729
|
+
$type: {
|
|
3730
|
+
"const": "Bridge"
|
|
3731
|
+
},
|
|
3732
|
+
fallback: {
|
|
3733
|
+
$ref: "#/definitions/ProteusNode",
|
|
3734
|
+
description: "Content rendered on platforms without iframe support (Teams, Slack, mobile). If omitted, a default 'View in Opal web' message is shown."
|
|
3735
|
+
},
|
|
3736
|
+
height: {
|
|
3737
|
+
description: "Height of the iframe in pixels",
|
|
3738
|
+
type: "number"
|
|
3739
|
+
},
|
|
3740
|
+
resource: {
|
|
3741
|
+
description: "Resource URI identifying the MCP app to render (e.g., 'ui://sample-widget')",
|
|
3742
|
+
type: "string"
|
|
3743
|
+
}
|
|
3744
|
+
},
|
|
3745
|
+
required: [
|
|
3746
|
+
"$type",
|
|
3747
|
+
"resource"
|
|
3748
|
+
],
|
|
3749
|
+
type: "object"
|
|
3750
|
+
},
|
|
3710
3751
|
ProteusButton: {
|
|
3711
3752
|
additionalProperties: false,
|
|
3712
3753
|
examples: [
|
|
@@ -2695,6 +2695,9 @@ var definitions = {
|
|
|
2695
2695
|
{
|
|
2696
2696
|
$ref: "#/definitions/ProteusBadge"
|
|
2697
2697
|
},
|
|
2698
|
+
{
|
|
2699
|
+
$ref: "#/definitions/ProteusBridge"
|
|
2700
|
+
},
|
|
2698
2701
|
{
|
|
2699
2702
|
$ref: "#/definitions/ProteusButton"
|
|
2700
2703
|
},
|
|
@@ -2793,6 +2796,12 @@ var definitions = {
|
|
|
2793
2796
|
interaction: {
|
|
2794
2797
|
description: "Name of registered interaction to call",
|
|
2795
2798
|
type: "string"
|
|
2799
|
+
},
|
|
2800
|
+
params: {
|
|
2801
|
+
additionalProperties: {
|
|
2802
|
+
},
|
|
2803
|
+
description: "Parameters to pass to the interaction handler",
|
|
2804
|
+
type: "object"
|
|
2796
2805
|
}
|
|
2797
2806
|
},
|
|
2798
2807
|
required: [
|
|
@@ -3687,6 +3696,37 @@ var definitions = {
|
|
|
3687
3696
|
],
|
|
3688
3697
|
type: "object"
|
|
3689
3698
|
},
|
|
3699
|
+
ProteusBridge: {
|
|
3700
|
+
examples: [
|
|
3701
|
+
{
|
|
3702
|
+
$type: "Bridge",
|
|
3703
|
+
height: 400,
|
|
3704
|
+
resource: "ui://sample-widget"
|
|
3705
|
+
}
|
|
3706
|
+
],
|
|
3707
|
+
properties: {
|
|
3708
|
+
$type: {
|
|
3709
|
+
"const": "Bridge"
|
|
3710
|
+
},
|
|
3711
|
+
fallback: {
|
|
3712
|
+
$ref: "#/definitions/ProteusNode",
|
|
3713
|
+
description: "Content rendered on platforms without iframe support (Teams, Slack, mobile). If omitted, a default 'View in Opal web' message is shown."
|
|
3714
|
+
},
|
|
3715
|
+
height: {
|
|
3716
|
+
description: "Height of the iframe in pixels",
|
|
3717
|
+
type: "number"
|
|
3718
|
+
},
|
|
3719
|
+
resource: {
|
|
3720
|
+
description: "Resource URI identifying the MCP app to render (e.g., 'ui://sample-widget')",
|
|
3721
|
+
type: "string"
|
|
3722
|
+
}
|
|
3723
|
+
},
|
|
3724
|
+
required: [
|
|
3725
|
+
"$type",
|
|
3726
|
+
"resource"
|
|
3727
|
+
],
|
|
3728
|
+
type: "object"
|
|
3729
|
+
},
|
|
3690
3730
|
ProteusButton: {
|
|
3691
3731
|
examples: [
|
|
3692
3732
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,25 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { BoxProps, SelectProps, Disclosure, ButtonProps, InputProps, TextareaProps } from '@optiaxiom/react';
|
|
3
3
|
import { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
4
4
|
|
|
5
|
+
type ProteusBridgeProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Content rendered on platforms without iframe support
|
|
8
|
+
*/
|
|
9
|
+
fallback?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Height of the iframe in pixels
|
|
12
|
+
*/
|
|
13
|
+
height?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Resource URI identifying the MCP app to render
|
|
16
|
+
*/
|
|
17
|
+
resource: string;
|
|
18
|
+
};
|
|
19
|
+
declare function ProteusBridge({ height, resource }: ProteusBridgeProps): react_jsx_runtime.JSX.Element | null;
|
|
20
|
+
declare namespace ProteusBridge {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
5
24
|
type Series = {
|
|
6
25
|
dataKey: string;
|
|
7
26
|
name?: string;
|
|
@@ -194,6 +213,14 @@ type ProteusValueProps = {
|
|
|
194
213
|
path: string;
|
|
195
214
|
};
|
|
196
215
|
|
|
216
|
+
type UseResource = (resource: string) => {
|
|
217
|
+
data: undefined | {
|
|
218
|
+
mimeType: string;
|
|
219
|
+
text: string;
|
|
220
|
+
};
|
|
221
|
+
isError: boolean;
|
|
222
|
+
};
|
|
223
|
+
|
|
197
224
|
type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure>, "defaultOpen" | "onOpenChange" | "open"> & {
|
|
198
225
|
/**
|
|
199
226
|
* Whether block is collapsible
|
|
@@ -220,7 +247,7 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
|
|
|
220
247
|
/**
|
|
221
248
|
* Callback when user clicks a Action button with interaction handler
|
|
222
249
|
*/
|
|
223
|
-
onInteraction?: (name: string) => Promise<
|
|
250
|
+
onInteraction?: (name: string, params?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
224
251
|
/**
|
|
225
252
|
* Callback when user sends a message action
|
|
226
253
|
*/
|
|
@@ -233,6 +260,10 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
|
|
|
233
260
|
* If true, the renderer will throw an error if the provided document is invalid. Otherwise, it will fail silently and render nothing.
|
|
234
261
|
*/
|
|
235
262
|
strict?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Hook to resolve a resource URI to HTML content for Bridge elements
|
|
265
|
+
*/
|
|
266
|
+
useResource?: UseResource;
|
|
236
267
|
};
|
|
237
268
|
type ProteusDocument$2 = {
|
|
238
269
|
actions?: ReactNode;
|
|
@@ -245,7 +276,7 @@ type ProteusDocument$2 = {
|
|
|
245
276
|
title?: ReactNode;
|
|
246
277
|
titleIcon?: string;
|
|
247
278
|
};
|
|
248
|
-
declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onDownload, onInteraction, onMessage, onOpenChange, open: openProp, readOnly, strict, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
|
|
279
|
+
declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onDownload, onInteraction, onMessage, onOpenChange, open: openProp, readOnly, strict, useResource, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
|
|
249
280
|
declare namespace ProteusDocumentShell {
|
|
250
281
|
var displayName: string;
|
|
251
282
|
}
|
|
@@ -257,6 +288,7 @@ type ProteusEventHandler = {
|
|
|
257
288
|
}) | string | string[];
|
|
258
289
|
} | {
|
|
259
290
|
interaction: string;
|
|
291
|
+
params?: Record<string, unknown>;
|
|
260
292
|
} | {
|
|
261
293
|
message: string;
|
|
262
294
|
};
|
|
@@ -322,5 +354,5 @@ declare namespace ProteusTextarea {
|
|
|
322
354
|
|
|
323
355
|
declare function useProteusValue(element: ProteusValueProps): any;
|
|
324
356
|
|
|
325
|
-
export { ProteusAction, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
|
|
357
|
+
export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
|
|
326
358
|
export type { ProteusDocumentRendererProps, ProteusDocumentShellProps };
|