@waniwani/sdk 0.16.0 → 0.17.0
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/chat/embed.js +54 -54
- package/dist/chat/embed.js.map +1 -1
- package/dist/chat/index.d.ts +46 -0
- package/dist/chat/index.js +7 -7
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/styles.css +1 -1
- package/dist/legacy/index.d.ts +44 -0
- package/dist/legacy/index.js +12 -12
- package/dist/legacy/index.js.map +1 -1
- package/dist/legacy/mcp/react.js.map +1 -1
- package/dist/mcp/react/skybridge.d.ts +355 -0
- package/dist/mcp/react/skybridge.js +3 -0
- package/dist/mcp/react/skybridge.js.map +1 -0
- package/dist/mcp/react.d.ts +24 -10
- package/dist/mcp/react.js +7 -7
- package/dist/mcp/react.js.map +1 -1
- package/package.json +11 -2
- package/dist/chunk-GYLVCP7M.js +0 -3
- package/dist/chunk-GYLVCP7M.js.map +0 -1
- package/dist/widget-client-4MBLDRHD.js +0 -3
- package/dist/widget-client-4MBLDRHD.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waniwani/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "MCP distribution SDK. Build sales funnels, lead generation, booking, and quote apps on top of your MCP server. Event tracking, flows, widgets, knowledge base.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"import": "./dist/mcp/react.js",
|
|
20
20
|
"default": "./dist/mcp/react.js"
|
|
21
21
|
},
|
|
22
|
+
"./mcp/react/skybridge": {
|
|
23
|
+
"types": "./dist/mcp/react/skybridge.d.ts",
|
|
24
|
+
"import": "./dist/mcp/react/skybridge.js",
|
|
25
|
+
"default": "./dist/mcp/react/skybridge.js"
|
|
26
|
+
},
|
|
22
27
|
"./chat": {
|
|
23
28
|
"types": "./dist/chat/index.d.ts",
|
|
24
29
|
"import": "./dist/chat/index.js",
|
|
@@ -102,9 +107,13 @@
|
|
|
102
107
|
"zod": ">=4.0.0",
|
|
103
108
|
"@ai-sdk/react": ">=1.0.0",
|
|
104
109
|
"ai": ">=6.0.141",
|
|
105
|
-
"@ai-sdk/mcp": ">=1.0.0"
|
|
110
|
+
"@ai-sdk/mcp": ">=1.0.0",
|
|
111
|
+
"skybridge": ">=0.35.0"
|
|
106
112
|
},
|
|
107
113
|
"peerDependenciesMeta": {
|
|
114
|
+
"skybridge": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
108
117
|
"@modelcontextprotocol/sdk": {
|
|
109
118
|
"optional": true
|
|
110
119
|
},
|
package/dist/chunk-GYLVCP7M.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
async function l(){let{detectPlatform:o}=await import("./platform-LKQFC3AJ.js");if(o()==="openai"){let{OpenAIWidgetClient:e}=await import("./openai-client-PUBKF5TI.js");return new e}else{let{MCPAppsWidgetClient:e}=await import("./mcp-apps-client-WEXKWHUI.js");return new e}}export{l as a};
|
|
3
|
-
//# sourceMappingURL=chunk-GYLVCP7M.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/legacy/mcp/react/widgets/widget-client.ts"],"sourcesContent":["import type { CallToolResult as McpCallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport type { ModelContextUpdate } from \"../../../../shared/model-context\";\nimport type {\n\tDisplayMode,\n\tSafeArea,\n\tTheme,\n\tUnknownObject,\n} from \"../hooks/@types\";\n\n/**\n * Result from calling a tool\n */\nexport type ToolCallResult = McpCallToolResult;\n\n/**\n * Tool result notification (what the host pushes to the widget)\n */\nexport type ToolResult = McpCallToolResult;\n\n/**\n * Host context - all values available from the host.\n */\nexport type HostContext = {\n\ttheme: Theme;\n\tlocale: string;\n\tdisplayMode: DisplayMode;\n\tmaxHeight: number | null;\n\tsafeArea: SafeArea | null;\n\ttoolOutput: UnknownObject | null;\n\ttoolResponseMetadata: UnknownObject | null;\n\twidgetState: UnknownObject | null;\n};\n\n/**\n * Store interface for useSyncExternalStore compatibility.\n */\nexport type HostContextStore<K extends keyof HostContext> = {\n\tsubscribe: (onStoreChange: () => void) => () => void;\n\tgetSnapshot: () => HostContext[K];\n};\n\n/**\n * Unified widget client interface that works on both OpenAI and MCP Apps.\n *\n * Platform-specific behavior:\n * - Display mode: OpenAI-only. MCP Apps returns \"inline\" and requestDisplayMode is a no-op.\n * - Follow-up messages: Unified API, different underlying implementations.\n */\nexport interface UnifiedWidgetClient {\n\t/**\n\t * Connect to the host. Must be called before using other methods.\n\t * On OpenAI, this is a no-op (already connected via window.openai).\n\t * On MCP Apps, this establishes the postMessage connection.\n\t */\n\tconnect(): Promise<void>;\n\n\t/**\n\t * Close the connection to the host and clean up resources.\n\t * On OpenAI, this is a no-op.\n\t * On MCP Apps, this closes the transport and removes event listeners.\n\t */\n\tclose(): Promise<void>;\n\n\t/**\n\t * Get the tool output (structured content returned by the tool handler).\n\t * This is the main data source for widget rendering.\n\t */\n\tgetToolOutput<T = Record<string, unknown>>(): T | null;\n\n\t/**\n\t * Register a callback for when tool results are received.\n\t * On OpenAI, this subscribes to toolOutput changes.\n\t * On MCP Apps, this sets app.ontoolresult.\n\t */\n\tonToolResult(callback: (result: ToolResult) => void): () => void;\n\n\t/**\n\t * Call another tool on the server.\n\t */\n\tcallTool(\n\t\tname: string,\n\t\targs: Record<string, unknown>,\n\t): Promise<ToolCallResult>;\n\n\t/**\n\t * Open an external URL.\n\t * On OpenAI: openai.openExternal({ href })\n\t * On MCP Apps: app.sendOpenLink(url)\n\t */\n\topenExternal(url: string): void;\n\n\t/**\n\t * Send a follow-up message to the AI.\n\t * On OpenAI: openai.sendFollowUpMessage({ prompt })\n\t * On MCP Apps: app.sendMessages([{ role: 'user', content: { type: 'text', text: prompt } }])\n\t */\n\tsendFollowUp(prompt: string): void | Promise<void>;\n\n\t/**\n\t * Update hidden model context for the next assistant turn.\n\t * On MCP Apps this uses the standard `ui/update-model-context` request.\n\t * On other hosts this may fall back to best-effort behavior.\n\t */\n\tupdateModelContext(context: ModelContextUpdate): Promise<void> | void;\n\n\t/**\n\t * Get the current theme.\n\t */\n\tgetTheme(): Theme;\n\n\t/**\n\t * Subscribe to theme changes.\n\t */\n\tonThemeChange(callback: (theme: Theme) => void): () => void;\n\n\t/**\n\t * Get the current locale.\n\t */\n\tgetLocale(): string;\n\n\t/**\n\t * Get the current display mode.\n\t * OpenAI-only: returns \"pip\" | \"inline\" | \"fullscreen\"\n\t * MCP Apps: always returns \"inline\"\n\t */\n\tgetDisplayMode(): DisplayMode;\n\n\t/**\n\t * Request a display mode change.\n\t * OpenAI-only: requests the mode from the host.\n\t * MCP Apps: no-op (returns current mode).\n\t */\n\trequestDisplayMode(mode: DisplayMode): Promise<DisplayMode>;\n\n\t/**\n\t * Subscribe to display mode changes.\n\t * OpenAI-only: subscribes to displayMode changes.\n\t * MCP Apps: callback is never called.\n\t */\n\tonDisplayModeChange(callback: (mode: DisplayMode) => void): () => void;\n\n\t/**\n\t * Get the safe area insets.\n\t * OpenAI-only: returns insets from window.openai.safeArea.\n\t * MCP Apps: returns null.\n\t */\n\tgetSafeArea(): SafeArea | null;\n\n\t/**\n\t * Subscribe to safe area changes.\n\t * OpenAI-only: subscribes to safeArea changes.\n\t * MCP Apps: callback is never called.\n\t */\n\tonSafeAreaChange(callback: (safeArea: SafeArea | null) => void): () => void;\n\n\t/**\n\t * Get the max height constraint.\n\t * OpenAI-only: returns maxHeight from window.openai.maxHeight.\n\t * MCP Apps: returns null.\n\t */\n\tgetMaxHeight(): number | null;\n\n\t/**\n\t * Subscribe to max height changes.\n\t * OpenAI-only: subscribes to maxHeight changes.\n\t * MCP Apps: callback is never called.\n\t */\n\tonMaxHeightChange(callback: (maxHeight: number | null) => void): () => void;\n\n\t/**\n\t * Get the tool response metadata.\n\t * OpenAI: returns metadata from window.openai.toolResponseMetadata.\n\t * MCP Apps: returns `_meta` from the latest `ui/notifications/tool-result`, if provided by host.\n\t */\n\tgetToolResponseMetadata(): UnknownObject | null;\n\n\t/**\n\t * Subscribe to tool response metadata changes.\n\t * OpenAI: subscribes to toolResponseMetadata changes.\n\t * MCP Apps: fires when tool result `_meta` changes.\n\t */\n\tonToolResponseMetadataChange(\n\t\tcallback: (metadata: UnknownObject | null) => void,\n\t): () => void;\n\n\t/**\n\t * Get the widget state.\n\t * OpenAI-only: returns state from window.openai.widgetState.\n\t * MCP Apps: returns null.\n\t */\n\tgetWidgetState(): UnknownObject | null;\n\n\t/**\n\t * Subscribe to widget state changes.\n\t * OpenAI-only: subscribes to widgetState changes.\n\t * MCP Apps: callback is never called.\n\t */\n\tonWidgetStateChange(\n\t\tcallback: (state: UnknownObject | null) => void,\n\t): () => void;\n}\n\n/**\n * Creates a unified widget client for the current platform.\n */\nexport async function createWidgetClient(): Promise<UnifiedWidgetClient> {\n\tconst { detectPlatform } = await import(\"./platform\");\n\tconst platform = detectPlatform();\n\n\tif (platform === \"openai\") {\n\t\tconst { OpenAIWidgetClient } = await import(\"./openai-client\");\n\t\treturn new OpenAIWidgetClient();\n\t} else {\n\t\tconst { MCPAppsWidgetClient } = await import(\"./mcp-apps-client\");\n\t\treturn new MCPAppsWidgetClient();\n\t}\n}\n"],"mappings":";AA6MA,eAAsBA,GAAmD,CACxE,GAAM,CAAE,eAAAC,CAAe,EAAI,KAAM,QAAO,wBAAY,EAGpD,GAFiBA,EAAe,IAEf,SAAU,CAC1B,GAAM,CAAE,mBAAAC,CAAmB,EAAI,KAAM,QAAO,6BAAiB,EAC7D,OAAO,IAAIA,CACZ,KAAO,CACN,GAAM,CAAE,oBAAAC,CAAoB,EAAI,KAAM,QAAO,+BAAmB,EAChE,OAAO,IAAIA,CACZ,CACD","names":["createWidgetClient","detectPlatform","OpenAIWidgetClient","MCPAppsWidgetClient"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|