skybridge 0.0.0-dev.a86a16b → 0.0.0-dev.aa087ad
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/LICENSE +21 -674
- package/README.md +123 -1
- package/dist/src/server/devtoolsStaticServer.d.ts +15 -0
- package/dist/src/server/devtoolsStaticServer.js +38 -0
- package/dist/src/server/devtoolsStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +5 -0
- package/dist/{server → src/server}/index.js +1 -1
- package/dist/src/server/index.js.map +1 -0
- package/dist/src/server/inferUtilityTypes.d.ts +64 -0
- package/dist/src/server/inferUtilityTypes.js +2 -0
- package/dist/src/server/inferUtilityTypes.js.map +1 -0
- package/dist/src/server/server.d.ts +74 -0
- package/dist/src/server/server.js +82 -0
- package/dist/src/server/server.js.map +1 -0
- package/dist/src/server/templateHelper.d.ts +18 -0
- package/dist/src/server/templateHelper.js +30 -0
- package/dist/src/server/templateHelper.js.map +1 -0
- package/dist/src/server/templates/development.hbs +13 -0
- package/dist/src/server/templates/production.hbs +7 -0
- package/dist/{server → src/server}/widgetsDevServer.d.ts +5 -2
- package/dist/{server → src/server}/widgetsDevServer.js +8 -5
- package/dist/src/server/widgetsDevServer.js.map +1 -0
- package/dist/src/test/utils.d.ts +135 -0
- package/dist/src/test/utils.js +242 -0
- package/dist/src/test/utils.js.map +1 -0
- package/dist/src/test/widget.test.d.ts +1 -0
- package/dist/src/test/widget.test.js +146 -0
- package/dist/src/test/widget.test.js.map +1 -0
- package/dist/src/web/bridges/constants.d.ts +2 -0
- package/dist/src/web/bridges/constants.js +3 -0
- package/dist/src/web/bridges/constants.js.map +1 -0
- package/dist/src/web/bridges/index.d.ts +2 -0
- package/dist/src/web/bridges/index.js +3 -0
- package/dist/src/web/bridges/index.js.map +1 -0
- package/dist/src/web/bridges/use-apps-sdk-bridge.d.ts +7 -0
- package/dist/src/web/bridges/use-apps-sdk-bridge.js +39 -0
- package/dist/src/web/bridges/use-apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.d.ts +25 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.js +128 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.test.d.ts +1 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.test.js +65 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/src/web/create-store.d.ts +3 -0
- package/dist/src/web/create-store.js +25 -0
- package/dist/src/web/create-store.js.map +1 -0
- package/dist/src/web/create-store.test.d.ts +1 -0
- package/dist/src/web/create-store.test.js +70 -0
- package/dist/src/web/create-store.test.js.map +1 -0
- package/dist/src/web/data-llm.d.ts +14 -0
- package/dist/src/web/data-llm.js +68 -0
- package/dist/src/web/data-llm.js.map +1 -0
- package/dist/src/web/data-llm.test.d.ts +1 -0
- package/dist/src/web/data-llm.test.js +76 -0
- package/dist/src/web/data-llm.test.js.map +1 -0
- package/dist/src/web/generate-helpers.d.ts +115 -0
- package/dist/src/web/generate-helpers.js +111 -0
- package/dist/src/web/generate-helpers.js.map +1 -0
- package/dist/src/web/generate-helpers.test-d.d.ts +1 -0
- package/dist/src/web/generate-helpers.test-d.js +206 -0
- package/dist/src/web/generate-helpers.test-d.js.map +1 -0
- package/dist/src/web/generate-helpers.test.d.ts +1 -0
- package/dist/src/web/generate-helpers.test.js +17 -0
- package/dist/src/web/generate-helpers.test.js.map +1 -0
- package/dist/src/web/helpers/state.d.ts +7 -0
- package/dist/src/web/helpers/state.js +40 -0
- package/dist/src/web/helpers/state.js.map +1 -0
- package/dist/src/web/helpers/state.test.d.ts +1 -0
- package/dist/src/web/helpers/state.test.js +53 -0
- package/dist/src/web/helpers/state.test.js.map +1 -0
- package/dist/src/web/hooks/index.d.ts +12 -0
- package/dist/src/web/hooks/index.js +13 -0
- package/dist/src/web/hooks/index.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.d.ts +100 -0
- package/dist/src/web/hooks/use-call-tool.js +60 -0
- package/dist/src/web/hooks/use-call-tool.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js +104 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test.js +165 -0
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -0
- package/dist/src/web/hooks/use-display-mode.d.ts +4 -0
- package/dist/src/web/hooks/use-display-mode.js +10 -0
- package/dist/src/web/hooks/use-display-mode.js.map +1 -0
- package/dist/src/web/hooks/use-display-mode.test.d.ts +1 -0
- package/dist/src/web/hooks/use-display-mode.test.js +41 -0
- package/dist/src/web/hooks/use-display-mode.test.js.map +1 -0
- package/dist/src/web/hooks/use-files.d.ts +10 -0
- package/dist/src/web/hooks/use-files.js +7 -0
- package/dist/src/web/hooks/use-files.js.map +1 -0
- package/dist/src/web/hooks/use-files.test.d.ts +1 -0
- package/dist/src/web/hooks/use-files.test.js +29 -0
- package/dist/src/web/hooks/use-files.test.js.map +1 -0
- package/dist/src/web/hooks/use-locale.d.ts +1 -0
- package/dist/src/web/hooks/use-locale.js +10 -0
- package/dist/src/web/hooks/use-locale.js.map +1 -0
- package/dist/src/web/hooks/use-locale.test.d.ts +1 -0
- package/dist/src/web/hooks/use-locale.test.js +22 -0
- package/dist/src/web/hooks/use-locale.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.d.ts +1 -0
- package/dist/src/web/hooks/use-open-external.js +6 -0
- package/dist/src/web/hooks/use-open-external.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.test.d.ts +1 -0
- package/dist/src/web/hooks/use-open-external.test.js +24 -0
- package/dist/src/web/hooks/use-open-external.test.js.map +1 -0
- package/dist/src/web/hooks/use-openai-global.d.ts +3 -0
- package/dist/src/web/hooks/use-openai-global.js +6 -0
- package/dist/src/web/hooks/use-openai-global.js.map +1 -0
- package/dist/src/web/hooks/use-request-modal.d.ts +6 -0
- package/dist/src/web/hooks/use-request-modal.js +9 -0
- package/dist/src/web/hooks/use-request-modal.js.map +1 -0
- package/dist/src/web/hooks/use-request-modal.test.d.ts +1 -0
- package/dist/src/web/hooks/use-request-modal.test.js +24 -0
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -0
- package/dist/src/web/hooks/use-send-follow-up-message.d.ts +1 -0
- package/dist/src/web/hooks/use-send-follow-up-message.js +11 -0
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -0
- package/dist/src/web/hooks/use-theme.d.ts +1 -0
- package/dist/src/web/hooks/use-theme.js +10 -0
- package/dist/src/web/hooks/use-theme.js.map +1 -0
- package/dist/src/web/hooks/use-theme.test.d.ts +1 -0
- package/dist/src/web/hooks/use-theme.test.js +27 -0
- package/dist/src/web/hooks/use-theme.test.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.d.ts +25 -0
- package/dist/src/web/hooks/use-tool-info.js +20 -0
- package/dist/src/web/hooks/use-tool-info.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js +73 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test.js +60 -0
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -0
- package/dist/src/web/hooks/use-user-agent.d.ts +1 -0
- package/dist/src/web/hooks/use-user-agent.js +5 -0
- package/dist/src/web/hooks/use-user-agent.js.map +1 -0
- package/dist/src/web/hooks/use-user-agent.test.d.ts +1 -0
- package/dist/src/web/hooks/use-user-agent.test.js +32 -0
- package/dist/src/web/hooks/use-user-agent.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.d.ts +4 -0
- package/dist/src/web/hooks/use-widget-state.js +32 -0
- package/dist/src/web/hooks/use-widget-state.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.test.d.ts +1 -0
- package/dist/src/web/hooks/use-widget-state.test.js +61 -0
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -0
- package/dist/src/web/index.d.ts +8 -0
- package/dist/src/web/index.js +9 -0
- package/dist/src/web/index.js.map +1 -0
- package/dist/src/web/mount-widget.js +19 -0
- package/dist/src/web/mount-widget.js.map +1 -0
- package/dist/src/web/plugin/data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/data-llm.test.js +81 -0
- package/dist/src/web/plugin/data-llm.test.js.map +1 -0
- package/dist/src/web/plugin/plugin.d.ts +2 -0
- package/dist/src/web/plugin/plugin.js +39 -0
- package/dist/src/web/plugin/plugin.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.d.ts +12 -0
- package/dist/src/web/plugin/transform-data-llm.js +93 -0
- package/dist/src/web/plugin/transform-data-llm.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.js +81 -0
- package/dist/src/web/plugin/transform-data-llm.test.js.map +1 -0
- package/dist/src/web/proxy.d.ts +1 -0
- package/dist/src/web/proxy.js +53 -0
- package/dist/src/web/proxy.js.map +1 -0
- package/dist/src/web/types.d.ts +138 -0
- package/dist/{web → src/web}/types.js +1 -0
- package/dist/src/web/types.js.map +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +8 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +36 -13
- package/dist/server/index.d.ts +0 -3
- package/dist/server/index.js.map +0 -1
- package/dist/server/middleware.d.ts +0 -3
- package/dist/server/middleware.js +0 -47
- package/dist/server/middleware.js.map +0 -1
- package/dist/server/server.d.ts +0 -12
- package/dist/server/server.js +0 -70
- package/dist/server/server.js.map +0 -1
- package/dist/server/widgetsDevServer.js.map +0 -1
- package/dist/web/index.d.ts +0 -4
- package/dist/web/index.js +0 -5
- package/dist/web/index.js.map +0 -1
- package/dist/web/mount-widget.js +0 -10
- package/dist/web/mount-widget.js.map +0 -1
- package/dist/web/types.d.ts +0 -95
- package/dist/web/types.js.map +0 -1
- package/dist/web/use-openai-global.d.ts +0 -2
- package/dist/web/use-openai-global.js +0 -21
- package/dist/web/use-openai-global.js.map +0 -1
- package/dist/web/use-tool-output.d.ts +0 -3
- package/dist/web/use-tool-output.js +0 -5
- package/dist/web/use-tool-output.js.map +0 -1
- /package/dist/{web → src/web}/mount-widget.d.ts +0 -0
package/dist/server/server.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { McpServer as McpServerBase, type ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type { Resource } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
-
import type { ZodRawShape } from "zod";
|
|
4
|
-
type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType">;
|
|
5
|
-
type McpServerOriginalToolConfig = Omit<Parameters<McpServer["registerTool"]>[1], "inputSchema" | "outputSchema">;
|
|
6
|
-
export declare class McpServer extends McpServerBase {
|
|
7
|
-
widget<InputArgs extends ZodRawShape, OutputArgs extends ZodRawShape>(name: string, resourceConfig: McpServerOriginalResourceConfig, toolConfig: McpServerOriginalToolConfig & {
|
|
8
|
-
inputSchema?: InputArgs;
|
|
9
|
-
outputSchema?: OutputArgs;
|
|
10
|
-
}, toolCallback: ToolCallback<InputArgs>): void;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
package/dist/server/server.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { McpServer as McpServerBase } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
export class McpServer extends McpServerBase {
|
|
3
|
-
widget(name, resourceConfig, toolConfig, toolCallback) {
|
|
4
|
-
const uri = `ui://widgets/${name}.html`;
|
|
5
|
-
const resourceMetadata = { ...(resourceConfig._meta ?? {}) };
|
|
6
|
-
if (toolConfig.description !== undefined) {
|
|
7
|
-
resourceMetadata["openai/widgetDescription"] = toolConfig.description;
|
|
8
|
-
}
|
|
9
|
-
this.resource(name, uri, {
|
|
10
|
-
...resourceConfig,
|
|
11
|
-
_meta: resourceMetadata,
|
|
12
|
-
}, async (_uri, extra) => {
|
|
13
|
-
const serverUrl = process.env.NODE_ENV === "production"
|
|
14
|
-
? `https://${extra?.requestInfo?.headers?.host}`
|
|
15
|
-
: `http://localhost:3000`;
|
|
16
|
-
const injectViteClient = (html) => `
|
|
17
|
-
<script type="module">import { injectIntoGlobalHook } from "${serverUrl}/@react-refresh";
|
|
18
|
-
injectIntoGlobalHook(window);
|
|
19
|
-
window.$RefreshReg$ = () => {};
|
|
20
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
21
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<script type="module" src="${serverUrl}/@vite/client"></script>
|
|
25
|
-
` + html;
|
|
26
|
-
const buildHtml = () => {
|
|
27
|
-
if (process.env.NODE_ENV === "production") {
|
|
28
|
-
try {
|
|
29
|
-
return `
|
|
30
|
-
<div id="root"></div>
|
|
31
|
-
<script type="module">
|
|
32
|
-
import('${serverUrl}/assets/${name}.js');
|
|
33
|
-
</script>
|
|
34
|
-
<link rel="stylesheet" crossorigin href="${serverUrl}/assets/style.css">
|
|
35
|
-
`;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error("Failed to load production assets:", error);
|
|
39
|
-
return "";
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return `
|
|
43
|
-
<div id="root"></div>
|
|
44
|
-
<script type="module">
|
|
45
|
-
import('${serverUrl}/src/widgets/${name}.tsx');
|
|
46
|
-
</script>
|
|
47
|
-
`;
|
|
48
|
-
};
|
|
49
|
-
const html = buildHtml();
|
|
50
|
-
return {
|
|
51
|
-
contents: [
|
|
52
|
-
{
|
|
53
|
-
uri,
|
|
54
|
-
mimeType: "text/html+skybridge",
|
|
55
|
-
text: process.env.NODE_ENV === "production" ? html : injectViteClient(html),
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
const toolMeta = {
|
|
61
|
-
...toolConfig._meta,
|
|
62
|
-
"openai/outputTemplate": uri,
|
|
63
|
-
};
|
|
64
|
-
this.registerTool(name, {
|
|
65
|
-
...toolConfig,
|
|
66
|
-
_meta: toolMeta,
|
|
67
|
-
}, toolCallback);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAqB,MAAM,yCAAyC,CAAC;AAwBxG,MAAM,OAAO,SAAU,SAAQ,aAAa;IAC1C,MAAM,CACJ,IAAY,EACZ,cAA+C,EAC/C,UAGC,EACD,YAAqC;QAErC,MAAM,GAAG,GAAG,gBAAgB,IAAI,OAAO,CAAC;QACxC,MAAM,gBAAgB,GAAiB,EAAE,GAAG,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QAC3E,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACzC,gBAAgB,CAAC,0BAA0B,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC;QACxE,CAAC;QAED,IAAI,CAAC,QAAQ,CACX,IAAI,EACJ,GAAG,EACH;YACE,GAAG,cAAc;YACjB,KAAK,EAAE,gBAAgB;SACxB,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;YACpB,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;gBACnC,CAAC,CAAC,WAAW,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE;gBAChD,CAAC,CAAC,uBAAuB,CAAC;YAE9B,MAAM,gBAAgB,G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ELETED
package/dist/web/index.js
DELETED
package/dist/web/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/web/mount-widget.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createElement, StrictMode } from "react";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
export const mountWidget = (component) => {
|
|
4
|
-
const root = document.getElementById("root");
|
|
5
|
-
if (!root) {
|
|
6
|
-
throw new Error("Root element not found");
|
|
7
|
-
}
|
|
8
|
-
createRoot(root).render(createElement(StrictMode, null, component));
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=mount-widget.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mount-widget.js","sourceRoot":"","sources":["../../src/web/mount-widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAA0B,EAAE,EAAE;IACxD,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IACD,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AACtE,CAAC,CAAC"}
|
package/dist/web/types.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
type UnknownObject = Record<string, unknown>;
|
|
2
|
-
export type WidgetState = UnknownObject;
|
|
3
|
-
export type SetWidgetState = (state: WidgetState) => Promise<void>;
|
|
4
|
-
export type SendFollowUpMessage = (args: {
|
|
5
|
-
prompt: string;
|
|
6
|
-
}) => Promise<void>;
|
|
7
|
-
export type RequestDisplayMode = (args: {
|
|
8
|
-
mode: DisplayMode;
|
|
9
|
-
}) => Promise<{
|
|
10
|
-
mode: DisplayMode;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
|
|
13
|
-
export declare class ToolResponseEvent extends CustomEvent<{
|
|
14
|
-
tool: {
|
|
15
|
-
name: string;
|
|
16
|
-
args: UnknownObject;
|
|
17
|
-
};
|
|
18
|
-
}> {
|
|
19
|
-
readonly type = "openai:tool_response";
|
|
20
|
-
}
|
|
21
|
-
declare global {
|
|
22
|
-
interface Window {
|
|
23
|
-
openai: API<WidgetState> & OpenAiGlobals;
|
|
24
|
-
}
|
|
25
|
-
interface WindowEventMap {
|
|
26
|
-
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
30
|
-
theme: Theme;
|
|
31
|
-
userAgent: UserAgent;
|
|
32
|
-
locale: string;
|
|
33
|
-
maxHeight: number;
|
|
34
|
-
displayMode: DisplayMode;
|
|
35
|
-
safeArea: SafeArea;
|
|
36
|
-
toolInput: ToolInput;
|
|
37
|
-
toolOutput: ToolOutput | null;
|
|
38
|
-
toolResponseMetadata: ToolResponseMetadata | null;
|
|
39
|
-
widgetState: WidgetState | null;
|
|
40
|
-
};
|
|
41
|
-
export type CallToolResponse = {
|
|
42
|
-
result: string;
|
|
43
|
-
};
|
|
44
|
-
type API<WidgetState extends UnknownObject> = {
|
|
45
|
-
/** Calls a tool on your MCP. Returns the full response. */
|
|
46
|
-
callTool: (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
|
|
47
|
-
/** Triggers a followup turn in the ChatGPT conversation */
|
|
48
|
-
sendFollowUpMessage: (args: {
|
|
49
|
-
prompt: string;
|
|
50
|
-
}) => Promise<void>;
|
|
51
|
-
/** Opens an external link, redirects web page or mobile app */
|
|
52
|
-
openExternal(payload: {
|
|
53
|
-
href: string;
|
|
54
|
-
}): void;
|
|
55
|
-
/** For transitioning an app from inline to fullscreen or pip */
|
|
56
|
-
requestDisplayMode: (args: {
|
|
57
|
-
mode: DisplayMode;
|
|
58
|
-
}) => Promise<{
|
|
59
|
-
/**
|
|
60
|
-
* The granted display mode. The host may reject the request.
|
|
61
|
-
* For mobile, PiP is always coerced to fullscreen.
|
|
62
|
-
*/
|
|
63
|
-
mode: DisplayMode;
|
|
64
|
-
}>;
|
|
65
|
-
setWidgetState: (state: WidgetState) => Promise<void>;
|
|
66
|
-
};
|
|
67
|
-
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
68
|
-
export declare class SetGlobalsEvent extends CustomEvent<{
|
|
69
|
-
globals: Partial<OpenAiGlobals>;
|
|
70
|
-
}> {
|
|
71
|
-
readonly type = "openai:set_globals";
|
|
72
|
-
}
|
|
73
|
-
export type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
|
|
74
|
-
export type DisplayMode = "pip" | "inline" | "fullscreen";
|
|
75
|
-
export type Theme = "light" | "dark";
|
|
76
|
-
export type SafeAreaInsets = {
|
|
77
|
-
top: number;
|
|
78
|
-
bottom: number;
|
|
79
|
-
left: number;
|
|
80
|
-
right: number;
|
|
81
|
-
};
|
|
82
|
-
export type SafeArea = {
|
|
83
|
-
insets: SafeAreaInsets;
|
|
84
|
-
};
|
|
85
|
-
export type DeviceType = "mobile" | "tablet" | "desktop" | "unknown";
|
|
86
|
-
export type UserAgent = {
|
|
87
|
-
device: {
|
|
88
|
-
type: DeviceType;
|
|
89
|
-
};
|
|
90
|
-
capabilities: {
|
|
91
|
-
hover: boolean;
|
|
92
|
-
touch: boolean;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
export {};
|
package/dist/web/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/web/types.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AA+DD,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACkB,IAAI,GAAG,sBAAsB,CAAC;CACjD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore } from "react";
|
|
2
|
-
import { SET_GLOBALS_EVENT_TYPE, SetGlobalsEvent } from "./types.js";
|
|
3
|
-
export function useOpenAiGlobal(key) {
|
|
4
|
-
return useSyncExternalStore((onChange) => {
|
|
5
|
-
const handleSetGlobal = (event) => {
|
|
6
|
-
const value = event.detail.globals[key];
|
|
7
|
-
if (value === undefined) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
console.dir(event.detail.globals, { depth: Infinity });
|
|
11
|
-
onChange();
|
|
12
|
-
};
|
|
13
|
-
window.addEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal, {
|
|
14
|
-
passive: true,
|
|
15
|
-
});
|
|
16
|
-
return () => {
|
|
17
|
-
window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal);
|
|
18
|
-
};
|
|
19
|
-
}, () => window.openai?.[key]);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=use-openai-global.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-openai-global.js","sourceRoot":"","sources":["../../src/web/use-openai-global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAsB,MAAM,YAAY,CAAC;AAEzF,MAAM,UAAU,eAAe,CAAgC,GAAM;IACnE,OAAO,oBAAoB,CACzB,CAAC,QAAQ,EAAE,EAAE;QACX,MAAM,eAAe,GAAG,CAAC,KAAsB,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO;YACT,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YACvD,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,eAAe,EAAE;YAC/D,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EACD,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-tool-output.js","sourceRoot":"","sources":["../../src/web/use-tool-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,aAAa;IAC3B,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC"}
|
|
File without changes
|