skybridge 0.0.0-dev.c269e58 → 0.0.0-dev.c367eac

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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/dist/src/server/devtoolsStaticServer.d.ts +4 -0
  3. package/dist/src/server/devtoolsStaticServer.js +23 -12
  4. package/dist/src/server/devtoolsStaticServer.js.map +1 -1
  5. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +12 -0
  6. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +30 -0
  7. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js.map +1 -0
  8. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.d.ts +15 -0
  9. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +108 -0
  10. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js.map +1 -0
  11. package/dist/src/web/bridges/apps-sdk-bridge.d.ts +4 -2
  12. package/dist/src/web/bridges/apps-sdk-bridge.js +19 -14
  13. package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -1
  14. package/dist/src/web/bridges/hooks/use-adaptor.d.ts +2 -0
  15. package/dist/src/web/bridges/hooks/use-adaptor.js +8 -0
  16. package/dist/src/web/bridges/hooks/use-adaptor.js.map +1 -0
  17. package/dist/src/web/bridges/hooks/use-bridge.js +3 -14
  18. package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -1
  19. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +3 -2
  20. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -1
  21. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +9 -26
  22. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -1
  23. package/dist/src/web/bridges/index.d.ts +1 -1
  24. package/dist/src/web/bridges/index.js +1 -1
  25. package/dist/src/web/bridges/index.js.map +1 -1
  26. package/dist/src/web/bridges/mcp-app-bridge.d.ts +15 -7
  27. package/dist/src/web/bridges/mcp-app-bridge.js +44 -21
  28. package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -1
  29. package/dist/src/web/bridges/types.d.ts +30 -6
  30. package/dist/src/web/data-llm.js +4 -2
  31. package/dist/src/web/data-llm.js.map +1 -1
  32. package/dist/src/web/generate-helpers.test-d.js +4 -1
  33. package/dist/src/web/generate-helpers.test-d.js.map +1 -1
  34. package/dist/src/web/hooks/test/utils.d.ts +10 -0
  35. package/dist/src/web/hooks/test/utils.js +40 -0
  36. package/dist/src/web/hooks/test/utils.js.map +1 -0
  37. package/dist/src/web/hooks/use-call-tool.js +12 -4
  38. package/dist/src/web/hooks/use-call-tool.js.map +1 -1
  39. package/dist/src/web/hooks/use-call-tool.test.js +26 -0
  40. package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
  41. package/dist/src/web/hooks/use-display-mode.d.ts +3 -3
  42. package/dist/src/web/hooks/use-display-mode.js +3 -3
  43. package/dist/src/web/hooks/use-display-mode.js.map +1 -1
  44. package/dist/src/web/hooks/use-layout.test.js +87 -38
  45. package/dist/src/web/hooks/use-layout.test.js.map +1 -1
  46. package/dist/src/web/hooks/use-send-follow-up-message.js +3 -6
  47. package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
  48. package/dist/src/web/hooks/use-tool-info.d.ts +12 -1
  49. package/dist/src/web/hooks/use-tool-info.js +15 -9
  50. package/dist/src/web/hooks/use-tool-info.js.map +1 -1
  51. package/dist/src/web/hooks/use-tool-info.test-d.js +40 -4
  52. package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
  53. package/dist/src/web/hooks/use-tool-info.test.js +117 -47
  54. package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
  55. package/dist/src/web/hooks/use-user.test.js +83 -34
  56. package/dist/src/web/hooks/use-user.test.js.map +1 -1
  57. package/dist/src/web/plugin/transform-data-llm.js +6 -3
  58. package/dist/src/web/plugin/transform-data-llm.js.map +1 -1
  59. package/dist/src/web/types.d.ts +2 -4
  60. package/dist/src/web/types.js.map +1 -1
  61. package/package.json +12 -12
  62. package/dist/src/web/bridges/apps-sdk-adapter.d.ts +0 -2
  63. package/dist/src/web/bridges/apps-sdk-adapter.js +0 -4
  64. package/dist/src/web/bridges/apps-sdk-adapter.js.map +0 -1
  65. package/dist/src/web/bridges/get-bridge-methods.d.ts +0 -2
  66. package/dist/src/web/bridges/get-bridge-methods.js +0 -8
  67. package/dist/src/web/bridges/get-bridge-methods.js.map +0 -1
  68. package/dist/src/web/bridges/hooks/types.d.ts +0 -6
  69. package/dist/src/web/bridges/hooks/types.js +0 -2
  70. package/dist/src/web/bridges/hooks/types.js.map +0 -1
  71. package/dist/src/web/bridges/mcp-app-adapter.d.ts +0 -4
  72. package/dist/src/web/bridges/mcp-app-adapter.js +0 -44
  73. package/dist/src/web/bridges/mcp-app-adapter.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import "react";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
3
  import type { WidgetHostType } from "../server/index.js";
3
4
  declare module "react" {
4
5
  interface HTMLAttributes<T> {
@@ -56,10 +57,7 @@ export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unk
56
57
  };
57
58
  export type CallToolArgs = Record<string, unknown> | null;
58
59
  export type CallToolResponse = {
59
- content: {
60
- type: "text";
61
- text: string;
62
- }[];
60
+ content: CallToolResult["content"];
63
61
  structuredContent: Record<string, unknown>;
64
62
  isError: boolean;
65
63
  result: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;AAwBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AA0GD,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACkB,IAAI,GAAG,sBAAsB,CAAC;CACjD"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;AAyBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AAuGD,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACkB,IAAI,GAAG,sBAAsB,CAAC;CACjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skybridge",
3
- "version": "0.0.0-dev.c269e58",
3
+ "version": "0.0.0-dev.c367eac",
4
4
  "description": "Skybridge is a framework for building ChatGPT apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,15 +20,6 @@
20
20
  "default": "./dist/src/web/index.js"
21
21
  }
22
22
  },
23
- "scripts": {
24
- "build": "tsc && pnpm run build:templates",
25
- "build:templates": "cp -r src/server/templates dist/src/server/",
26
- "format": "biome check --write --error-on-warnings",
27
- "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
28
- "test:unit": "vitest run",
29
- "test:type": "tsc --noEmit",
30
- "test:format": "biome ci"
31
- },
32
23
  "keywords": [
33
24
  "chatgpt",
34
25
  "app",
@@ -45,6 +36,7 @@
45
36
  "dependencies": {
46
37
  "@babel/core": "^7.28.5",
47
38
  "cors": "^2.8.5",
39
+ "dequal": "^2.0.3",
48
40
  "express": "^5.1.0",
49
41
  "handlebars": "^4.7.8",
50
42
  "superjson": "^2.2.6",
@@ -71,5 +63,13 @@
71
63
  "vitest": "^2.1.8",
72
64
  "zod": "^4.1.13"
73
65
  },
74
- "packageManager": "pnpm@10.17.1"
75
- }
66
+ "scripts": {
67
+ "build": "tsc && pnpm run build:templates",
68
+ "build:templates": "cp -r src/server/templates dist/src/server/",
69
+ "format": "biome check --write --error-on-warnings",
70
+ "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
71
+ "test:unit": "vitest run",
72
+ "test:type": "tsc --noEmit",
73
+ "test:format": "biome ci"
74
+ }
75
+ }
@@ -1,2 +0,0 @@
1
- import type { Methods } from "./types.js";
2
- export declare const requestDisplayMode: Methods["requestDisplayMode"];
@@ -1,4 +0,0 @@
1
- export const requestDisplayMode = ({ mode }) => {
2
- return window.openai.requestDisplayMode({ mode });
3
- };
4
- //# sourceMappingURL=apps-sdk-adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apps-sdk-adapter.js","sourceRoot":"","sources":["../../../../src/web/bridges/apps-sdk-adapter.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAkC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC5E,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { Methods } from "./types.js";
2
- export declare const getBridgeMethods: () => Methods;
@@ -1,8 +0,0 @@
1
- import * as AppsSdkAdapter from "./apps-sdk-adapter.js";
2
- import * as McpAppAdapter from "./mcp-app-adapter.js";
3
- export const getBridgeMethods = () => {
4
- return window.skybridge.hostType === "apps-sdk"
5
- ? AppsSdkAdapter
6
- : McpAppAdapter;
7
- };
8
- //# sourceMappingURL=get-bridge-methods.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-bridge-methods.js","sourceRoot":"","sources":["../../../../src/web/bridges/get-bridge-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAGtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAY,EAAE;IAC5C,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU;QAC7C,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,aAAa,CAAC;AACpB,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { BridgeInterface } from "../types.js";
2
- export type BridgeSubscribe = (onChange: () => void) => () => void;
3
- export type BridgeExternalStore<K extends keyof BridgeInterface> = {
4
- subscribe: BridgeSubscribe;
5
- getSnapshot: () => BridgeInterface[K];
6
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/web/bridges/hooks/types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import type { BridgeExternalStore } from "./hooks/types.js";
2
- import type { BridgeInterface, Methods } from "./types.js";
3
- export declare const requestDisplayMode: Methods["requestDisplayMode"];
4
- export declare const getMcpAppExternalStore: <K extends keyof BridgeInterface>(key: K) => BridgeExternalStore<K>;
@@ -1,44 +0,0 @@
1
- import { McpAppBridge } from "./mcp-app-bridge.js";
2
- export const requestDisplayMode = ({ mode }) => {
3
- const bridge = McpAppBridge.getInstance();
4
- if (mode !== "modal") {
5
- return bridge.request({
6
- method: "ui/request-display-mode",
7
- params: { mode },
8
- });
9
- }
10
- throw new Error("Modal display mode is not accessible in MCP App.");
11
- };
12
- const createExternalStore = (keys, getSnapshot) => {
13
- const bridge = McpAppBridge.getInstance();
14
- return {
15
- subscribe: bridge.subscribe(keys),
16
- getSnapshot: () => {
17
- const context = Object.fromEntries(keys.map((k) => [k, bridge.getSnapshot(k)]));
18
- return getSnapshot(context);
19
- },
20
- };
21
- };
22
- export const getMcpAppExternalStore = (key) => {
23
- const adapters = {
24
- theme: () => createExternalStore(["theme"], ({ theme }) => theme ?? "light"),
25
- locale: () => createExternalStore(["locale"], ({ locale }) => locale ?? "en-US"),
26
- safeArea: () => createExternalStore(["safeAreaInsets"], ({ safeAreaInsets }) => ({
27
- insets: safeAreaInsets ?? { top: 0, right: 0, bottom: 0, left: 0 },
28
- })),
29
- displayMode: () => createExternalStore(["displayMode"], ({ displayMode }) => displayMode ?? "inline"),
30
- maxHeight: () => createExternalStore(["viewport"], ({ viewport }) => viewport?.maxHeight ?? window.innerHeight),
31
- userAgent: () => createExternalStore(["platform", "deviceCapabilities"], ({ platform, deviceCapabilities }) => ({
32
- device: {
33
- type: platform === "web" ? "desktop" : platform ?? "unknown",
34
- },
35
- capabilities: {
36
- hover: true,
37
- touch: true,
38
- ...deviceCapabilities,
39
- },
40
- })),
41
- };
42
- return adapters[key]();
43
- };
44
- //# sourceMappingURL=mcp-app-adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-app-adapter.js","sourceRoot":"","sources":["../../../../src/web/bridges/mcp-app-adapter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,CAAC,MAAM,kBAAkB,GAAkC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC5E,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;IAC1C,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,MAAM,CAAC,OAAO,CAGnB;YACA,MAAM,EAAE,yBAAyB;YACjC,MAAM,EAAE,EAAE,IAAI,EAAE;SACjB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACtE,CAAC,CAAC;AAMF,MAAM,mBAAmB,GAAG,CAI1B,IAAU,EACV,WAA8C,EAI9C,EAAE;IACF,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;IAE1C,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;QACjC,WAAW,EAAE,GAAG,EAAE;YAChB,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CACh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