skybridge 0.0.0-dev.e4c9359 → 0.0.0-dev.e523cea
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/bin/run.js +9 -0
- package/dist/cli/use-version.d.ts +1 -0
- package/dist/cli/use-version.js +33 -0
- package/dist/cli/use-version.js.map +1 -0
- package/dist/commands/dev.d.ts +7 -0
- package/dist/commands/dev.js +30 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/inferUtilityTypes.d.ts +64 -0
- package/dist/server/inferUtilityTypes.js.map +1 -0
- package/dist/server/server.d.ts +101 -0
- package/dist/server/server.js +132 -0
- package/dist/server/server.js.map +1 -0
- package/dist/{src/server → server}/templateHelper.d.ts +3 -0
- package/dist/{src/server → server}/templateHelper.js +5 -4
- package/dist/server/templateHelper.js.map +1 -0
- package/dist/server/templates/development.hbs +66 -0
- package/dist/{src/server → server}/templates/production.hbs +1 -0
- package/dist/{src/server → server}/widgetsDevServer.d.ts +2 -2
- package/dist/{src/server → server}/widgetsDevServer.js +13 -5
- package/dist/server/widgetsDevServer.js.map +1 -0
- package/dist/{src/test → test}/utils.d.ts +54 -8
- package/dist/{src/test → test}/utils.js +86 -8
- package/dist/test/utils.js.map +1 -0
- package/dist/test/widget.test.js +234 -0
- package/dist/test/widget.test.js.map +1 -0
- package/dist/web/bridges/adaptors/apps-sdk-adaptor.d.ts +13 -0
- package/dist/web/bridges/adaptors/apps-sdk-adaptor.js +33 -0
- package/dist/web/bridges/adaptors/apps-sdk-adaptor.js.map +1 -0
- package/dist/web/bridges/adaptors/mcp-app-adaptor.d.ts +16 -0
- package/dist/web/bridges/adaptors/mcp-app-adaptor.js +115 -0
- package/dist/web/bridges/adaptors/mcp-app-adaptor.js.map +1 -0
- package/dist/web/bridges/apps-sdk-bridge.d.ts +10 -0
- package/dist/web/bridges/apps-sdk-bridge.js +46 -0
- package/dist/web/bridges/apps-sdk-bridge.js.map +1 -0
- package/dist/web/bridges/hooks/use-adaptor.d.ts +2 -0
- package/dist/web/bridges/hooks/use-adaptor.js +8 -0
- package/dist/web/bridges/hooks/use-adaptor.js.map +1 -0
- package/dist/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
- package/dist/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
- package/dist/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
- package/dist/web/bridges/hooks/use-bridge.d.ts +2 -0
- package/dist/web/bridges/hooks/use-bridge.js +8 -0
- package/dist/web/bridges/hooks/use-bridge.js.map +1 -0
- package/dist/web/bridges/hooks/use-mcp-app-bridge.d.ts +5 -0
- package/dist/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
- package/dist/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
- package/dist/web/bridges/hooks/use-mcp-app-bridge.test.js +62 -0
- package/dist/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/web/bridges/index.d.ts +4 -0
- package/dist/web/bridges/index.js +5 -0
- package/dist/web/bridges/index.js.map +1 -0
- package/dist/web/bridges/mcp-app-bridge.d.ts +46 -0
- package/dist/web/bridges/mcp-app-bridge.js +217 -0
- package/dist/web/bridges/mcp-app-bridge.js.map +1 -0
- package/dist/web/bridges/types.d.ts +57 -0
- package/dist/web/bridges/types.js +2 -0
- package/dist/web/bridges/types.js.map +1 -0
- package/dist/web/create-store.d.ts +3 -0
- package/dist/web/create-store.js +25 -0
- package/dist/web/create-store.js.map +1 -0
- package/dist/web/create-store.test.js +70 -0
- package/dist/web/create-store.test.js.map +1 -0
- package/dist/web/data-llm.d.ts +14 -0
- package/dist/web/data-llm.js +70 -0
- package/dist/web/data-llm.js.map +1 -0
- package/dist/web/data-llm.test.js +76 -0
- package/dist/web/data-llm.test.js.map +1 -0
- package/dist/{src/web/typed-hooks.d.ts → web/generate-helpers.d.ts} +23 -20
- package/dist/{src/web/typed-hooks.js → web/generate-helpers.js} +14 -10
- package/dist/web/generate-helpers.js.map +1 -0
- package/dist/web/generate-helpers.test-d.js +209 -0
- package/dist/web/generate-helpers.test-d.js.map +1 -0
- package/dist/{src/web/typed-hooks.test.js → web/generate-helpers.test.js} +5 -5
- package/dist/web/generate-helpers.test.js.map +1 -0
- package/dist/web/helpers/state.d.ts +7 -0
- package/dist/web/helpers/state.js +40 -0
- package/dist/web/helpers/state.js.map +1 -0
- package/dist/web/helpers/state.test.js +53 -0
- package/dist/web/helpers/state.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/index.d.ts +4 -7
- package/dist/{src/web → web}/hooks/index.js +4 -7
- package/dist/web/hooks/index.js.map +1 -0
- package/dist/web/hooks/test/utils.d.ts +10 -0
- package/dist/web/hooks/test/utils.js +40 -0
- package/dist/web/hooks/test/utils.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-call-tool.d.ts +22 -21
- package/dist/{src/web → web}/hooks/use-call-tool.js +19 -19
- package/dist/web/hooks/use-call-tool.js.map +1 -0
- package/dist/web/hooks/use-call-tool.test-d.js +104 -0
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-call-tool.test.js +42 -15
- package/dist/web/hooks/use-call-tool.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-display-mode.d.ts +1 -1
- package/dist/web/hooks/use-display-mode.js +10 -0
- package/dist/web/hooks/use-display-mode.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-display-mode.test.js +3 -2
- package/dist/web/hooks/use-display-mode.test.js.map +1 -0
- package/dist/web/hooks/use-files.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-files.test.js +1 -1
- package/dist/web/hooks/use-files.test.js.map +1 -0
- package/dist/web/hooks/use-layout.d.ts +22 -0
- package/dist/web/hooks/use-layout.js +23 -0
- package/dist/web/hooks/use-layout.js.map +1 -0
- package/dist/web/hooks/use-layout.test.js +95 -0
- package/dist/web/hooks/use-layout.test.js.map +1 -0
- package/dist/web/hooks/use-open-external.js +8 -0
- package/dist/web/hooks/use-open-external.js.map +1 -0
- package/dist/web/hooks/use-open-external.test.js +50 -0
- package/dist/web/hooks/use-open-external.test.js.map +1 -0
- package/dist/web/hooks/use-openai-global.d.ts +3 -0
- package/dist/web/hooks/use-openai-global.js +6 -0
- package/dist/web/hooks/use-openai-global.js.map +1 -0
- package/dist/web/hooks/use-request-modal.d.ts +9 -0
- package/dist/web/hooks/use-request-modal.js +14 -0
- package/dist/web/hooks/use-request-modal.js.map +1 -0
- package/dist/web/hooks/use-request-modal.test.js +57 -0
- package/dist/web/hooks/use-request-modal.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.js +8 -0
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-tool-info.d.ts +13 -2
- package/dist/web/hooks/use-tool-info.js +26 -0
- package/dist/web/hooks/use-tool-info.js.map +1 -0
- package/dist/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-tool-info.test-d.js +40 -5
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/web/hooks/use-tool-info.test.d.ts +1 -0
- package/dist/web/hooks/use-tool-info.test.js +130 -0
- package/dist/web/hooks/use-tool-info.test.js.map +1 -0
- package/dist/web/hooks/use-user.d.ts +18 -0
- package/dist/web/hooks/use-user.js +19 -0
- package/dist/web/hooks/use-user.js.map +1 -0
- package/dist/web/hooks/use-user.test.d.ts +1 -0
- package/dist/web/hooks/use-user.test.js +93 -0
- package/dist/web/hooks/use-user.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-widget-state.js +11 -9
- package/dist/web/hooks/use-widget-state.js.map +1 -0
- package/dist/web/hooks/use-widget-state.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-widget-state.test.js +3 -2
- package/dist/web/hooks/use-widget-state.test.js.map +1 -0
- package/dist/web/index.d.ts +8 -0
- package/dist/web/index.js +9 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/mount-widget.js.map +1 -0
- package/dist/web/plugin/data-llm.test.d.ts +1 -0
- package/dist/web/plugin/data-llm.test.js +81 -0
- package/dist/web/plugin/data-llm.test.js.map +1 -0
- package/dist/web/plugin/plugin.js +39 -0
- package/dist/web/plugin/plugin.js.map +1 -0
- package/dist/web/plugin/transform-data-llm.d.ts +12 -0
- package/dist/web/plugin/transform-data-llm.js +96 -0
- package/dist/web/plugin/transform-data-llm.js.map +1 -0
- package/dist/web/plugin/transform-data-llm.test.d.ts +1 -0
- package/dist/web/plugin/transform-data-llm.test.js +81 -0
- package/dist/web/plugin/transform-data-llm.test.js.map +1 -0
- package/dist/{src/web → web}/proxy.js +6 -1
- package/dist/web/proxy.js.map +1 -0
- package/dist/{src/web → web}/types.d.ts +39 -13
- package/dist/{src/web → web}/types.js +1 -0
- package/dist/web/types.js.map +1 -0
- package/package.json +54 -30
- package/README.md +0 -323
- package/dist/src/server/index.d.ts +0 -4
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/server/inferUtilityTypes.d.ts +0 -48
- package/dist/src/server/inferUtilityTypes.js.map +0 -1
- package/dist/src/server/server.d.ts +0 -35
- package/dist/src/server/server.js +0 -62
- package/dist/src/server/server.js.map +0 -1
- package/dist/src/server/templateHelper.js.map +0 -1
- package/dist/src/server/templates/development.hbs +0 -12
- package/dist/src/server/widgetsDevServer.js.map +0 -1
- package/dist/src/test/utils.js.map +0 -1
- package/dist/src/test/widget.test.js +0 -90
- package/dist/src/test/widget.test.js.map +0 -1
- package/dist/src/web/hooks/index.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.test.js.map +0 -1
- package/dist/src/web/hooks/use-display-mode.js +0 -7
- package/dist/src/web/hooks/use-display-mode.js.map +0 -1
- package/dist/src/web/hooks/use-display-mode.test.js.map +0 -1
- package/dist/src/web/hooks/use-files.js.map +0 -1
- package/dist/src/web/hooks/use-files.test.js.map +0 -1
- package/dist/src/web/hooks/use-locale.d.ts +0 -1
- package/dist/src/web/hooks/use-locale.js +0 -5
- package/dist/src/web/hooks/use-locale.js.map +0 -1
- package/dist/src/web/hooks/use-locale.test.js +0 -21
- package/dist/src/web/hooks/use-locale.test.js.map +0 -1
- package/dist/src/web/hooks/use-open-external.js +0 -6
- package/dist/src/web/hooks/use-open-external.js.map +0 -1
- package/dist/src/web/hooks/use-open-external.test.js +0 -24
- package/dist/src/web/hooks/use-open-external.test.js.map +0 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +0 -2
- package/dist/src/web/hooks/use-openai-global.js +0 -23
- package/dist/src/web/hooks/use-openai-global.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +0 -6
- package/dist/src/web/hooks/use-request-modal.js +0 -9
- package/dist/src/web/hooks/use-request-modal.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.test.js +0 -24
- package/dist/src/web/hooks/use-request-modal.test.js.map +0 -1
- package/dist/src/web/hooks/use-send-follow-up-message.js +0 -11
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +0 -1
- package/dist/src/web/hooks/use-theme.d.ts +0 -1
- package/dist/src/web/hooks/use-theme.js +0 -5
- package/dist/src/web/hooks/use-theme.js.map +0 -1
- package/dist/src/web/hooks/use-theme.test.js +0 -26
- package/dist/src/web/hooks/use-theme.test.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.js +0 -22
- package/dist/src/web/hooks/use-tool-info.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test.js +0 -59
- package/dist/src/web/hooks/use-tool-info.test.js.map +0 -1
- package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-output.js +0 -9
- package/dist/src/web/hooks/use-tool-output.js.map +0 -1
- package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
- package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
- package/dist/src/web/hooks/use-user-agent.js +0 -5
- package/dist/src/web/hooks/use-user-agent.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.test.js +0 -31
- package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/src/web/index.d.ts +0 -5
- package/dist/src/web/index.js +0 -6
- package/dist/src/web/index.js.map +0 -1
- package/dist/src/web/mount-widget.js.map +0 -1
- package/dist/src/web/plugin.js +0 -28
- package/dist/src/web/plugin.js.map +0 -1
- package/dist/src/web/proxy.js.map +0 -1
- package/dist/src/web/typed-hooks.js.map +0 -1
- package/dist/src/web/typed-hooks.test-d.js +0 -90
- package/dist/src/web/typed-hooks.test-d.js.map +0 -1
- package/dist/src/web/typed-hooks.test.js.map +0 -1
- package/dist/src/web/types.js.map +0 -1
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -8
- package/dist/vitest.config.js.map +0 -1
- /package/dist/{src/server → server}/index.js +0 -0
- /package/dist/{src/server → server}/inferUtilityTypes.js +0 -0
- /package/dist/{src/test → test}/widget.test.d.ts +0 -0
- /package/dist/{src/web/hooks/use-call-tool.test.d.ts → web/bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-display-mode.test.d.ts → web/create-store.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-files.test.d.ts → web/data-llm.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-locale.test.d.ts → web/generate-helpers.test-d.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-open-external.test.d.ts → web/generate-helpers.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-request-modal.test.d.ts → web/helpers/state.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-theme.test.d.ts → web/hooks/use-call-tool.test-d.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test-d.d.ts → web/hooks/use-call-tool.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test.d.ts → web/hooks/use-display-mode.test.d.ts} +0 -0
- /package/dist/{src/web → web}/hooks/use-files.d.ts +0 -0
- /package/dist/{src/web → web}/hooks/use-files.js +0 -0
- /package/dist/{src/web/hooks/use-user-agent.test.d.ts → web/hooks/use-files.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-widget-state.test.d.ts → web/hooks/use-layout.test.d.ts} +0 -0
- /package/dist/{src/web → web}/hooks/use-open-external.d.ts +0 -0
- /package/dist/{src/web/typed-hooks.test-d.d.ts → web/hooks/use-open-external.test.d.ts} +0 -0
- /package/dist/{src/web/typed-hooks.test.d.ts → web/hooks/use-request-modal.test.d.ts} +0 -0
- /package/dist/{src/web → web}/hooks/use-send-follow-up-message.d.ts +0 -0
- /package/dist/{src/web → web}/hooks/use-widget-state.d.ts +0 -0
- /package/dist/{src/web → web}/mount-widget.d.ts +0 -0
- /package/dist/{src/web → web}/mount-widget.js +0 -0
- /package/dist/{src/web → web/plugin}/plugin.d.ts +0 -0
- /package/dist/{src/web → web}/proxy.d.ts +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { useSyncExternalStore } from "react";
|
|
3
|
+
export type CallToolArgs = Record<string, unknown> | null;
|
|
4
|
+
export type CallToolResponse = {
|
|
5
|
+
content: CallToolResult["content"];
|
|
6
|
+
structuredContent: NonNullable<CallToolResult["structuredContent"]>;
|
|
7
|
+
isError: NonNullable<CallToolResult["isError"]>;
|
|
8
|
+
result: string;
|
|
9
|
+
_meta?: CallToolResult["_meta"];
|
|
10
|
+
};
|
|
11
|
+
export type DisplayMode = "pip" | "inline" | "fullscreen" | "modal";
|
|
12
|
+
export type DeviceType = "mobile" | "tablet" | "desktop" | "unknown";
|
|
13
|
+
export interface BridgeInterface {
|
|
14
|
+
theme: "light" | "dark";
|
|
15
|
+
locale: string;
|
|
16
|
+
displayMode: DisplayMode;
|
|
17
|
+
safeArea: {
|
|
18
|
+
insets: {
|
|
19
|
+
top: number;
|
|
20
|
+
right: number;
|
|
21
|
+
bottom: number;
|
|
22
|
+
left: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
maxHeight: number;
|
|
26
|
+
userAgent: {
|
|
27
|
+
device: {
|
|
28
|
+
type: DeviceType;
|
|
29
|
+
};
|
|
30
|
+
capabilities: {
|
|
31
|
+
hover: boolean;
|
|
32
|
+
touch: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
toolInput: Record<string, unknown> | null;
|
|
36
|
+
toolOutput: Record<string, unknown> | null;
|
|
37
|
+
toolResponseMetadata: Record<string, unknown> | null;
|
|
38
|
+
}
|
|
39
|
+
export type Subscribe = Parameters<typeof useSyncExternalStore>[0];
|
|
40
|
+
export interface Bridge<Context> {
|
|
41
|
+
subscribe(key: keyof Context): Subscribe;
|
|
42
|
+
subscribe(keys: readonly (keyof Context)[]): Subscribe;
|
|
43
|
+
getSnapshot<K extends keyof Context>(key: K): Context[K] | undefined;
|
|
44
|
+
}
|
|
45
|
+
export type ExternalStore<K extends keyof BridgeInterface> = {
|
|
46
|
+
subscribe: Subscribe;
|
|
47
|
+
getSnapshot: () => BridgeInterface[K];
|
|
48
|
+
};
|
|
49
|
+
export interface Adaptor {
|
|
50
|
+
getExternalStore<K extends keyof BridgeInterface>(key: K): ExternalStore<K>;
|
|
51
|
+
callTool<ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs): Promise<ToolResponse>;
|
|
52
|
+
requestDisplayMode(mode: DisplayMode): Promise<{
|
|
53
|
+
mode: DisplayMode;
|
|
54
|
+
}>;
|
|
55
|
+
sendFollowUpMessage(prompt: string): Promise<void>;
|
|
56
|
+
openExternal(href: string): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/bridges/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type StateCreator } from "zustand";
|
|
2
|
+
import type { UnknownObject } from "./types.js";
|
|
3
|
+
export declare function createStore<State extends UnknownObject>(storeCreator: StateCreator<State, [], [], State>, defaultState?: State | (() => State)): import("zustand").UseBoundStore<import("zustand").StoreApi<State>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { getInitialState, injectWidgetContext, serializeState, } from "./helpers/state.js";
|
|
3
|
+
export function createStore(storeCreator, defaultState) {
|
|
4
|
+
const initialState = getInitialState(defaultState);
|
|
5
|
+
const store = create()((...args) => {
|
|
6
|
+
const baseStore = storeCreator(...args);
|
|
7
|
+
if (initialState !== null) {
|
|
8
|
+
return { ...baseStore, ...initialState };
|
|
9
|
+
}
|
|
10
|
+
return baseStore;
|
|
11
|
+
});
|
|
12
|
+
store.subscribe((state) => {
|
|
13
|
+
if (window.openai) {
|
|
14
|
+
const serializedState = serializeState(state);
|
|
15
|
+
if (serializedState !== null && serializedState !== undefined) {
|
|
16
|
+
const stateToPersist = injectWidgetContext(serializedState);
|
|
17
|
+
if (stateToPersist !== null) {
|
|
18
|
+
window.openai.setWidgetState(stateToPersist);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return store;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=create-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-store.js","sourceRoot":"","sources":["../../src/web/create-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,MAAM,UAAU,WAAW,CACzB,YAAgD,EAChD,YAAoC;IAEpC,MAAM,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAEnD,MAAM,KAAK,GAAG,MAAM,EAAS,CAC3B,CAAC,GAAG,IAAoD,EAAE,EAAE;QAC1D,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;QAExC,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;YAC1B,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,YAAY,EAAE,CAAC;QAC3C,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,CACF,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,CAAC,KAAY,EAAE,EAAE;QAC/B,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;YAC9C,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;gBAC9D,MAAM,cAAc,GAAG,mBAAmB,CAAC,eAAwB,CAAC,CAAC;gBACrE,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;oBAC5B,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi, } from "vitest";
|
|
2
|
+
import { createStore } from "./create-store.js";
|
|
3
|
+
import { WIDGET_CONTEXT_KEY } from "./data-llm.js";
|
|
4
|
+
describe("createStore", () => {
|
|
5
|
+
let OpenaiMock;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
OpenaiMock = {
|
|
8
|
+
widgetState: null,
|
|
9
|
+
setWidgetState: vi.fn().mockResolvedValue(undefined),
|
|
10
|
+
};
|
|
11
|
+
vi.stubGlobal("openai", OpenaiMock);
|
|
12
|
+
});
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
vi.unstubAllGlobals();
|
|
15
|
+
vi.resetAllMocks();
|
|
16
|
+
});
|
|
17
|
+
it("should create a store without default state", () => {
|
|
18
|
+
const storeCreator = () => ({
|
|
19
|
+
count: 0,
|
|
20
|
+
});
|
|
21
|
+
const store = createStore(storeCreator);
|
|
22
|
+
expect(store.getState()).toEqual({ count: 0 });
|
|
23
|
+
});
|
|
24
|
+
it("should create a store with default state", () => {
|
|
25
|
+
const storeCreator = () => ({
|
|
26
|
+
count: 0,
|
|
27
|
+
name: "initial",
|
|
28
|
+
});
|
|
29
|
+
const defaultState = { count: 5, name: "default" };
|
|
30
|
+
const store = createStore(storeCreator, defaultState);
|
|
31
|
+
expect(store.getState()).toEqual({ count: 5, name: "default" });
|
|
32
|
+
});
|
|
33
|
+
it("should initialize from window.openai.widgetState when available", () => {
|
|
34
|
+
const storeCreator = () => ({
|
|
35
|
+
count: 0,
|
|
36
|
+
name: "initial",
|
|
37
|
+
});
|
|
38
|
+
const windowState = { count: 20, name: "window" };
|
|
39
|
+
OpenaiMock.widgetState = windowState;
|
|
40
|
+
const store = createStore(storeCreator);
|
|
41
|
+
expect(store.getState()).toEqual({ count: 20, name: "window" });
|
|
42
|
+
});
|
|
43
|
+
it("should persist state changes to window.openai.setWidgetState", async () => {
|
|
44
|
+
const storeCreator = (set) => ({
|
|
45
|
+
count: 0,
|
|
46
|
+
increment: () => set((state) => ({ count: state.count + 1 })),
|
|
47
|
+
});
|
|
48
|
+
const store = createStore(storeCreator);
|
|
49
|
+
store.getState().increment();
|
|
50
|
+
await vi.waitFor(() => {
|
|
51
|
+
expect(OpenaiMock.setWidgetState).toHaveBeenCalled();
|
|
52
|
+
});
|
|
53
|
+
const callArgs = OpenaiMock.setWidgetState.mock.calls[0]?.[0];
|
|
54
|
+
expect(callArgs).toEqual({ count: 1 });
|
|
55
|
+
});
|
|
56
|
+
it("should filter widget context from initial state", () => {
|
|
57
|
+
const storeCreator = () => ({
|
|
58
|
+
count: 0,
|
|
59
|
+
});
|
|
60
|
+
const windowState = {
|
|
61
|
+
count: 5,
|
|
62
|
+
[WIDGET_CONTEXT_KEY]: "context-value",
|
|
63
|
+
};
|
|
64
|
+
OpenaiMock.widgetState = windowState;
|
|
65
|
+
const store = createStore(storeCreator);
|
|
66
|
+
expect(store.getState()).toEqual({ count: 5 });
|
|
67
|
+
expect(store.getState()[WIDGET_CONTEXT_KEY]).toBeUndefined();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=create-store.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-store.test.js","sourceRoot":"","sources":["../../src/web/create-store.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,EAAE,EAEF,EAAE,GACH,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,UAGH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,WAAW,EAAE,IAAI;YACjB,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;SACrD,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QAErD,MAAM,YAAY,GAA+C,GAAG,EAAE,CAA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Q,EAA8B,CAAC,kBAAkB,CAAC,CAClE,CAAC,aAAa,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type DataLLMContent = string;
|
|
3
|
+
export interface DataLLMNode {
|
|
4
|
+
id: string;
|
|
5
|
+
parentId: string | null;
|
|
6
|
+
content: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const WIDGET_CONTEXT_KEY: "__widget_context";
|
|
9
|
+
interface DataLLMProps {
|
|
10
|
+
content: DataLLMContent | null | undefined;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function DataLLM({ content, children }: DataLLMProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useId, } from "react";
|
|
3
|
+
export const WIDGET_CONTEXT_KEY = "__widget_context";
|
|
4
|
+
const nodes = new Map();
|
|
5
|
+
function setNode(node) {
|
|
6
|
+
nodes.set(node.id, node);
|
|
7
|
+
onChange();
|
|
8
|
+
}
|
|
9
|
+
function removeNode(id) {
|
|
10
|
+
nodes.delete(id);
|
|
11
|
+
onChange();
|
|
12
|
+
}
|
|
13
|
+
function onChange() {
|
|
14
|
+
const description = getLLMDescriptionString();
|
|
15
|
+
window.openai.setWidgetState({
|
|
16
|
+
...window.openai.widgetState,
|
|
17
|
+
[WIDGET_CONTEXT_KEY]: description,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const ParentIdContext = createContext(null);
|
|
21
|
+
export function DataLLM({ content, children }) {
|
|
22
|
+
const parentId = useContext(ParentIdContext);
|
|
23
|
+
const id = useId();
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (content) {
|
|
26
|
+
setNode({
|
|
27
|
+
id,
|
|
28
|
+
parentId,
|
|
29
|
+
content,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
removeNode(id);
|
|
34
|
+
}
|
|
35
|
+
return () => {
|
|
36
|
+
removeNode(id);
|
|
37
|
+
};
|
|
38
|
+
}, [id, parentId, content]);
|
|
39
|
+
return (_jsx(ParentIdContext.Provider, { value: id, children: children }));
|
|
40
|
+
}
|
|
41
|
+
function getLLMDescriptionString() {
|
|
42
|
+
const byParent = new Map();
|
|
43
|
+
for (const node of Array.from(nodes.values())) {
|
|
44
|
+
const key = node.parentId ?? null;
|
|
45
|
+
if (!byParent.has(key)) {
|
|
46
|
+
byParent.set(key, []);
|
|
47
|
+
}
|
|
48
|
+
byParent.get(key)?.push(node);
|
|
49
|
+
}
|
|
50
|
+
for (const list of byParent.values()) {
|
|
51
|
+
list.sort((a, b) => a.id.localeCompare(b.id));
|
|
52
|
+
}
|
|
53
|
+
const lines = [];
|
|
54
|
+
function traverseTree(parentId, depth) {
|
|
55
|
+
const children = byParent.get(parentId);
|
|
56
|
+
if (!children) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
for (const child of children) {
|
|
60
|
+
if (child.content?.trim()) {
|
|
61
|
+
const indent = " ".repeat(depth);
|
|
62
|
+
lines.push(`${indent}- ${child.content.trim()}`);
|
|
63
|
+
}
|
|
64
|
+
traverseTree(child.id, depth + 1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
traverseTree(null, 0);
|
|
68
|
+
return lines.join("\n");
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=data-llm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-llm.js","sourceRoot":"","sources":["../../src/web/data-llm.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAEb,UAAU,EACV,SAAS,EACT,KAAK,GACN,MAAM,OAAO,CAAC;AAUf,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAA2B,CAA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ACpC,CAAC;IACH,CAAC;IAED,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAEtB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi, } from "vitest";
|
|
4
|
+
import { DataLLM } from "./data-llm.js";
|
|
5
|
+
describe("DataLLM", () => {
|
|
6
|
+
let OpenaiMock;
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
OpenaiMock = {
|
|
9
|
+
widgetState: {},
|
|
10
|
+
setWidgetState: vi.fn(),
|
|
11
|
+
};
|
|
12
|
+
// Use Object.defineProperty to ensure it persists
|
|
13
|
+
Object.defineProperty(globalThis, "openai", {
|
|
14
|
+
value: OpenaiMock,
|
|
15
|
+
writable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
});
|
|
18
|
+
// Also set on window for browser-like environment
|
|
19
|
+
if (typeof window !== "undefined") {
|
|
20
|
+
Object.defineProperty(window, "openai", {
|
|
21
|
+
value: OpenaiMock,
|
|
22
|
+
writable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
vi.stubGlobal("openai", OpenaiMock);
|
|
27
|
+
});
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
vi.resetAllMocks();
|
|
30
|
+
// Keep the mock available for React cleanup, but reset it
|
|
31
|
+
if (typeof window !== "undefined" && window.openai) {
|
|
32
|
+
window.openai.setWidgetState = vi.fn();
|
|
33
|
+
window.openai.widgetState = {};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
it("should register a node with content and call setWidgetState", () => {
|
|
37
|
+
render(_jsx(DataLLM, { content: "Test content", children: _jsx("div", { children: "Child" }) }));
|
|
38
|
+
expect(OpenaiMock.setWidgetState).toHaveBeenCalled();
|
|
39
|
+
const callArgs = OpenaiMock.setWidgetState.mock.calls[0]?.[0];
|
|
40
|
+
expect(callArgs).toHaveProperty("__widget_context");
|
|
41
|
+
expect(callArgs?.__widget_context).toContain("- Test content");
|
|
42
|
+
});
|
|
43
|
+
it("should preserve existing widgetState when updating context", () => {
|
|
44
|
+
OpenaiMock.widgetState = { existingKey: "existingValue" };
|
|
45
|
+
render(_jsx(DataLLM, { content: "Test content", children: _jsx("div", { children: "Child" }) }));
|
|
46
|
+
const callArgs = OpenaiMock.setWidgetState.mock.calls[0]?.[0];
|
|
47
|
+
expect(callArgs).toHaveProperty("existingKey", "existingValue");
|
|
48
|
+
expect(callArgs).toHaveProperty("__widget_context");
|
|
49
|
+
});
|
|
50
|
+
it("should handle deeply nested DataLLM components", () => {
|
|
51
|
+
render(_jsxs(DataLLM, { content: "Level 1", children: [_jsx(DataLLM, { content: "Level 2A" }), _jsx(DataLLM, { content: "Level 2B", children: _jsx(DataLLM, { content: "Level 3", children: _jsx("div", { children: "Content" }) }) })] }));
|
|
52
|
+
const callArgs = OpenaiMock.setWidgetState.mock.calls[OpenaiMock.setWidgetState.mock.calls.length - 1]?.[0];
|
|
53
|
+
const context = callArgs?.__widget_context;
|
|
54
|
+
expect(context).toContain("- Level 1");
|
|
55
|
+
expect(context).toContain(" - Level 2A");
|
|
56
|
+
expect(context).toContain(" - Level 2B");
|
|
57
|
+
expect(context).toContain(" - Level 3");
|
|
58
|
+
});
|
|
59
|
+
it("should update context when content changes", () => {
|
|
60
|
+
const { rerender } = render(_jsx(DataLLM, { content: "Initial content", children: _jsx("div", { children: "Child" }) }));
|
|
61
|
+
const initialCalls = OpenaiMock.setWidgetState.mock.calls.length;
|
|
62
|
+
rerender(_jsx(DataLLM, { content: "Updated content", children: _jsx("div", { children: "Child" }) }));
|
|
63
|
+
expect(OpenaiMock.setWidgetState.mock.calls.length).toBeGreaterThan(initialCalls);
|
|
64
|
+
const lastCallArgs = OpenaiMock.setWidgetState.mock.calls[OpenaiMock.setWidgetState.mock.calls.length - 1]?.[0];
|
|
65
|
+
expect(lastCallArgs?.__widget_context).toContain("- Updated content");
|
|
66
|
+
});
|
|
67
|
+
it("should remove node and update context when component unmounts", () => {
|
|
68
|
+
const { unmount } = render(_jsx(DataLLM, { content: "Content to remove", children: _jsx("div", { children: "Child" }) }));
|
|
69
|
+
const callsBeforeUnmount = OpenaiMock.setWidgetState.mock.calls.length;
|
|
70
|
+
unmount();
|
|
71
|
+
expect(OpenaiMock.setWidgetState.mock.calls.length).toBeGreaterThan(callsBeforeUnmount);
|
|
72
|
+
const lastCallArgs = OpenaiMock.setWidgetState.mock.calls[OpenaiMock.setWidgetState.mock.calls.length - 1]?.[0];
|
|
73
|
+
expect(lastCallArgs?.__widget_context).not.toContain("Content to remove");
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=data-llm.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-llm.test.js","sourceRoot":"","sources":["../../src/web/data-llm.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,EAAE,EAEF,EAAE,GACH,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAI,UAA0D,CAAC;IAE/D,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,WAAW,EAAE,EAAE;YACf,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE;SACxB,CAAC;QACF,kDAAkD;QAClD,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE;YAC1C,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;SACnB,CAAC,CA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AC,YAAY,EAAE,gBAAgB,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InferTools, ToolInput, ToolOutput, ToolResponseMetadata } from "../server/index.js";
|
|
2
|
+
import { type CallToolAsyncFn, type CallToolFn, type CallToolState } from "./hooks/use-call-tool.js";
|
|
2
3
|
import { type ToolState } from "./hooks/use-tool-info.js";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
type TypedCallToolReturn<TInput, TOutput> = Prettify<CallToolState<CallToolResponse & {
|
|
4
|
+
import type { CallToolResponse, Objectify, Prettify } from "./types.js";
|
|
5
|
+
type TypedCallToolResponse<TOutput> = CallToolResponse & {
|
|
6
6
|
structuredContent: TOutput;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}>;
|
|
7
|
+
};
|
|
8
|
+
type TypedCallToolReturn<TInput, TOutput> = Prettify<CallToolState<TypedCallToolResponse<TOutput>> & {
|
|
9
|
+
callTool: CallToolFn<TInput, TypedCallToolResponse<TOutput>>;
|
|
10
|
+
callToolAsync: CallToolAsyncFn<TInput, TypedCallToolResponse<TOutput>>;
|
|
12
11
|
}>;
|
|
13
|
-
type TypedToolInfoReturn<TInput, TOutput> = ToolState<Objectify<TInput>, Objectify<TOutput>, Objectify<
|
|
12
|
+
type TypedToolInfoReturn<TInput, TOutput, TResponseMetadata> = ToolState<Objectify<TInput>, Objectify<TOutput>, Objectify<TResponseMetadata>>;
|
|
14
13
|
/**
|
|
15
14
|
* Creates typed versions of skybridge hooks with full type inference
|
|
16
15
|
* for tool names, inputs, and outputs.
|
|
@@ -18,7 +17,9 @@ type TypedToolInfoReturn<TInput, TOutput> = ToolState<Objectify<TInput>, Objecti
|
|
|
18
17
|
* This is the recommended way to use skybridge hooks in your widgets.
|
|
19
18
|
* Set this up once in a dedicated file and export the typed hooks for use across your app.
|
|
20
19
|
*
|
|
21
|
-
* @typeParam
|
|
20
|
+
* @typeParam ServerType - The type of your McpServer instance (use `typeof server`).
|
|
21
|
+
* Must be a server instance created with method chaining.
|
|
22
|
+
* TypeScript will validate that tools can be inferred from this type.
|
|
22
23
|
*
|
|
23
24
|
* @example
|
|
24
25
|
* ```typescript
|
|
@@ -38,9 +39,9 @@ type TypedToolInfoReturn<TInput, TOutput> = ToolState<Objectify<TInput>, Objecti
|
|
|
38
39
|
* ```typescript
|
|
39
40
|
* // web/src/skybridge.ts (one-time setup)
|
|
40
41
|
* import type { AppType } from "../server";
|
|
41
|
-
* import {
|
|
42
|
+
* import { generateHelpers } from "skybridge/web";
|
|
42
43
|
*
|
|
43
|
-
* export const { useCallTool, useToolInfo } =
|
|
44
|
+
* export const { useCallTool, useToolInfo } = generateHelpers<AppType>();
|
|
44
45
|
* ```
|
|
45
46
|
*
|
|
46
47
|
* @example
|
|
@@ -57,11 +58,11 @@ type TypedToolInfoReturn<TInput, TOutput> = ToolState<Objectify<TInput>, Objecti
|
|
|
57
58
|
* const toolInfo = useToolInfo<"search-voyage">();
|
|
58
59
|
* // ^ autocomplete for widget names
|
|
59
60
|
* // toolInfo.input is typed based on widget input schema
|
|
60
|
-
* // toolInfo.output is typed based on widget output schema
|
|
61
|
+
* // toolInfo.output.structuredContent is typed based on widget output schema
|
|
61
62
|
* }
|
|
62
63
|
* ```
|
|
63
64
|
*/
|
|
64
|
-
export declare function
|
|
65
|
+
export declare function generateHelpers<ServerType = never>(): {
|
|
65
66
|
/**
|
|
66
67
|
* Typed version of `useCallTool` that provides autocomplete for tool names
|
|
67
68
|
* and type inference for inputs and outputs.
|
|
@@ -81,7 +82,7 @@ export declare function createTypedHooks<T extends McpServer<AnyToolRegistry>>()
|
|
|
81
82
|
* }
|
|
82
83
|
* ```
|
|
83
84
|
*/
|
|
84
|
-
useCallTool: <
|
|
85
|
+
useCallTool: <ToolName extends keyof InferTools<ServerType> & string>(name: ToolName) => TypedCallToolReturn<ToolInput<ServerType, ToolName>, ToolOutput<ServerType, ToolName>>;
|
|
85
86
|
/**
|
|
86
87
|
* Typed version of `useToolInfo` that provides autocomplete for widget names
|
|
87
88
|
* and type inference for inputs, outputs, and responseMetadata.
|
|
@@ -93,20 +94,22 @@ export declare function createTypedHooks<T extends McpServer<AnyToolRegistry>>()
|
|
|
93
94
|
* ```typescript
|
|
94
95
|
* const toolInfo = useToolInfo<"search-voyage">();
|
|
95
96
|
* // toolInfo.input is typed as { destination: string; ... }
|
|
96
|
-
* // toolInfo.output is typed as { results: Array<...>; ... }
|
|
97
|
+
* // toolInfo.output is typed as { results: Array<...>; ... }
|
|
98
|
+
* // toolInfo.responseMetadata is typed based on _meta in callback return
|
|
97
99
|
* // toolInfo.status narrows correctly: "pending" | "success"
|
|
98
100
|
*
|
|
99
101
|
* if (toolInfo.isPending) {
|
|
100
|
-
* // TypeScript knows output
|
|
102
|
+
* // TypeScript knows output and responseMetadata are undefined here
|
|
101
103
|
* console.log(toolInfo.input.destination);
|
|
102
104
|
* }
|
|
103
105
|
*
|
|
104
106
|
* if (toolInfo.isSuccess) {
|
|
105
|
-
* // TypeScript knows output
|
|
107
|
+
* // TypeScript knows output and responseMetadata are defined here
|
|
106
108
|
* console.log(toolInfo.output.results);
|
|
109
|
+
* console.log(toolInfo.responseMetadata);
|
|
107
110
|
* }
|
|
108
111
|
* ```
|
|
109
112
|
*/
|
|
110
|
-
useToolInfo: <
|
|
113
|
+
useToolInfo: <ToolName extends keyof InferTools<ServerType> & string>() => TypedToolInfoReturn<ToolInput<ServerType, ToolName>, ToolOutput<ServerType, ToolName>, ToolResponseMetadata<ServerType, ToolName>>;
|
|
111
114
|
};
|
|
112
115
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallTool } from "./hooks/use-call-tool.js";
|
|
1
|
+
import { useCallTool, } from "./hooks/use-call-tool.js";
|
|
2
2
|
import { useToolInfo } from "./hooks/use-tool-info.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates typed versions of skybridge hooks with full type inference
|
|
@@ -7,7 +7,9 @@ import { useToolInfo } from "./hooks/use-tool-info.js";
|
|
|
7
7
|
* This is the recommended way to use skybridge hooks in your widgets.
|
|
8
8
|
* Set this up once in a dedicated file and export the typed hooks for use across your app.
|
|
9
9
|
*
|
|
10
|
-
* @typeParam
|
|
10
|
+
* @typeParam ServerType - The type of your McpServer instance (use `typeof server`).
|
|
11
|
+
* Must be a server instance created with method chaining.
|
|
12
|
+
* TypeScript will validate that tools can be inferred from this type.
|
|
11
13
|
*
|
|
12
14
|
* @example
|
|
13
15
|
* ```typescript
|
|
@@ -27,9 +29,9 @@ import { useToolInfo } from "./hooks/use-tool-info.js";
|
|
|
27
29
|
* ```typescript
|
|
28
30
|
* // web/src/skybridge.ts (one-time setup)
|
|
29
31
|
* import type { AppType } from "../server";
|
|
30
|
-
* import {
|
|
32
|
+
* import { generateHelpers } from "skybridge/web";
|
|
31
33
|
*
|
|
32
|
-
* export const { useCallTool, useToolInfo } =
|
|
34
|
+
* export const { useCallTool, useToolInfo } = generateHelpers<AppType>();
|
|
33
35
|
* ```
|
|
34
36
|
*
|
|
35
37
|
* @example
|
|
@@ -46,11 +48,11 @@ import { useToolInfo } from "./hooks/use-tool-info.js";
|
|
|
46
48
|
* const toolInfo = useToolInfo<"search-voyage">();
|
|
47
49
|
* // ^ autocomplete for widget names
|
|
48
50
|
* // toolInfo.input is typed based on widget input schema
|
|
49
|
-
* // toolInfo.output is typed based on widget output schema
|
|
51
|
+
* // toolInfo.output.structuredContent is typed based on widget output schema
|
|
50
52
|
* }
|
|
51
53
|
* ```
|
|
52
54
|
*/
|
|
53
|
-
export function
|
|
55
|
+
export function generateHelpers() {
|
|
54
56
|
return {
|
|
55
57
|
/**
|
|
56
58
|
* Typed version of `useCallTool` that provides autocomplete for tool names
|
|
@@ -85,17 +87,19 @@ export function createTypedHooks() {
|
|
|
85
87
|
* ```typescript
|
|
86
88
|
* const toolInfo = useToolInfo<"search-voyage">();
|
|
87
89
|
* // toolInfo.input is typed as { destination: string; ... }
|
|
88
|
-
* // toolInfo.output is typed as { results: Array<...>; ... }
|
|
90
|
+
* // toolInfo.output is typed as { results: Array<...>; ... }
|
|
91
|
+
* // toolInfo.responseMetadata is typed based on _meta in callback return
|
|
89
92
|
* // toolInfo.status narrows correctly: "pending" | "success"
|
|
90
93
|
*
|
|
91
94
|
* if (toolInfo.isPending) {
|
|
92
|
-
* // TypeScript knows output
|
|
95
|
+
* // TypeScript knows output and responseMetadata are undefined here
|
|
93
96
|
* console.log(toolInfo.input.destination);
|
|
94
97
|
* }
|
|
95
98
|
*
|
|
96
99
|
* if (toolInfo.isSuccess) {
|
|
97
|
-
* // TypeScript knows output
|
|
100
|
+
* // TypeScript knows output and responseMetadata are defined here
|
|
98
101
|
* console.log(toolInfo.output.results);
|
|
102
|
+
* console.log(toolInfo.responseMetadata);
|
|
99
103
|
* }
|
|
100
104
|
* ```
|
|
101
105
|
*/
|
|
@@ -104,4 +108,4 @@ export function createTypedHooks() {
|
|
|
104
108
|
},
|
|
105
109
|
};
|
|
106
110
|
}
|
|
107
|
-
//# sourceMappingURL=
|
|
111
|
+
//# sourceMappingURL=generate-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-helpers.js","sourceRoot":"","sources":["../../src/web/generate-helpers.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAoBvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,eAAe;IAI7B,OAAO;QACL;;;;;;;;;;;;;;;;;;WAkBG;QACH,WAAW,EAAE,CACX,IAAc,EAId,EAAE;YACF,OAAO,WAAW,CAAC,IAAI,CAGtB,CAAC;QACJ,CAAC;QAED;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;QACH,WAAW,EAAE,GAIX,EAAE;YACF,OAAO,WAAW,EAIjB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|