skybridge 0.0.0-dev.6e31b21 → 0.0.0-dev.708154c

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 (62) hide show
  1. package/dist/src/web/data-llm.d.ts +13 -0
  2. package/dist/src/web/data-llm.js +67 -0
  3. package/dist/src/web/data-llm.js.map +1 -0
  4. package/dist/src/web/data-llm.test.d.ts +1 -0
  5. package/dist/src/web/data-llm.test.js +76 -0
  6. package/dist/src/web/data-llm.test.js.map +1 -0
  7. package/dist/src/web/hooks/index.d.ts +2 -3
  8. package/dist/src/web/hooks/index.js +2 -3
  9. package/dist/src/web/hooks/index.js.map +1 -1
  10. package/dist/src/web/hooks/use-call-tool.d.ts +12 -11
  11. package/dist/src/web/hooks/use-call-tool.js +8 -6
  12. package/dist/src/web/hooks/use-call-tool.js.map +1 -1
  13. package/dist/src/web/hooks/use-call-tool.test.js +19 -12
  14. package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
  15. package/dist/src/web/hooks/use-files.d.ts +10 -0
  16. package/dist/src/web/hooks/use-files.js +7 -0
  17. package/dist/src/web/hooks/use-files.js.map +1 -0
  18. package/dist/src/web/hooks/use-files.test.d.ts +1 -0
  19. package/dist/src/web/hooks/use-files.test.js +29 -0
  20. package/dist/src/web/hooks/use-files.test.js.map +1 -0
  21. package/dist/src/web/hooks/use-request-modal.d.ts +3 -2
  22. package/dist/src/web/hooks/use-request-modal.js.map +1 -1
  23. package/dist/src/web/hooks/use-tool-info.d.ts +5 -3
  24. package/dist/src/web/hooks/use-tool-info.js.map +1 -1
  25. package/dist/src/web/hooks/use-tool-info.test-d.d.ts +1 -0
  26. package/dist/src/web/hooks/use-tool-info.test-d.js +74 -0
  27. package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -0
  28. package/dist/src/web/hooks/use-tool-info.test.js +0 -75
  29. package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
  30. package/dist/src/web/hooks/use-widget-state.js +30 -6
  31. package/dist/src/web/hooks/use-widget-state.js.map +1 -1
  32. package/dist/src/web/index.d.ts +2 -1
  33. package/dist/src/web/index.js +2 -1
  34. package/dist/src/web/index.js.map +1 -1
  35. package/dist/src/web/mount-widget.js +5 -0
  36. package/dist/src/web/mount-widget.js.map +1 -1
  37. package/dist/src/web/plugin/data-llm.test.d.ts +1 -0
  38. package/dist/src/web/plugin/data-llm.test.js +81 -0
  39. package/dist/src/web/plugin/data-llm.test.js.map +1 -0
  40. package/dist/src/web/{plugin.js → plugin/plugin.js} +5 -0
  41. package/dist/src/web/plugin/plugin.js.map +1 -0
  42. package/dist/src/web/plugin/transform-data-llm.d.ts +12 -0
  43. package/dist/src/web/plugin/transform-data-llm.js +93 -0
  44. package/dist/src/web/plugin/transform-data-llm.js.map +1 -0
  45. package/dist/src/web/plugin/transform-data-llm.test.d.ts +1 -0
  46. package/dist/src/web/plugin/transform-data-llm.test.js +81 -0
  47. package/dist/src/web/plugin/transform-data-llm.test.js.map +1 -0
  48. package/dist/src/web/proxy.d.ts +1 -0
  49. package/dist/src/web/proxy.js +48 -0
  50. package/dist/src/web/proxy.js.map +1 -0
  51. package/dist/src/web/types.d.ts +31 -22
  52. package/dist/src/web/types.js +1 -0
  53. package/dist/src/web/types.js.map +1 -1
  54. package/package.json +4 -3
  55. package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
  56. package/dist/src/web/hooks/use-tool-output.js +0 -9
  57. package/dist/src/web/hooks/use-tool-output.js.map +0 -1
  58. package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
  59. package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
  60. package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
  61. package/dist/src/web/plugin.js.map +0 -1
  62. /package/dist/src/web/{plugin.d.ts → plugin/plugin.d.ts} +0 -0
@@ -1,17 +1,13 @@
1
+ import "react";
2
+ declare module "react" {
3
+ interface HTMLAttributes<T extends Element = HTMLElement> {
4
+ "data-llm"?: string;
5
+ }
6
+ }
1
7
  export 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 type RequestModal = (options: RequestModalOptions) => Promise<void>;
13
- export type RequestModalOptions = {
14
- title: string;
8
+ type WidgetState = UnknownObject;
9
+ type FileMetadata = {
10
+ fileId: string;
15
11
  };
16
12
  export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
17
13
  export declare class ToolResponseEvent extends CustomEvent<{
@@ -43,8 +39,6 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput exten
43
39
  } | null;
44
40
  toolResponseMetadata: ToolResponseMetadata | null;
45
41
  widgetState: WidgetState | null;
46
- requestDisplayMode: RequestDisplayMode;
47
- requestModal: RequestModal;
48
42
  };
49
43
  export type CallToolArgs = Record<string, unknown> | null;
50
44
  export type CallToolResponse = {
@@ -57,20 +51,15 @@ export type CallToolResponse = {
57
51
  result: string;
58
52
  meta: Record<string, unknown>;
59
53
  };
60
- export type DefaultCallToolResponse = {
61
- structuredContent: Record<string, unknown>;
62
- meta: Record<string, unknown>;
63
- };
64
- export type CallToolResponseConstraint = Partial<Pick<CallToolResponse, "structuredContent" | "meta">>;
65
54
  type API<WidgetState extends UnknownObject> = {
66
55
  /** Calls a tool on your MCP. Returns the full response. */
67
- callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponseConstraint = DefaultCallToolResponse>(name: string, args: ToolArgs) => Promise<CallToolResponse & ToolResponse>;
56
+ callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
68
57
  /** Triggers a followup turn in the ChatGPT conversation */
69
58
  sendFollowUpMessage: (args: {
70
59
  prompt: string;
71
60
  }) => Promise<void>;
72
61
  /** Opens an external link, redirects web page or mobile app */
73
- openExternal(payload: {
62
+ openExternal(args: {
74
63
  href: string;
75
64
  }): void;
76
65
  /** For transitioning an app from inline to fullscreen or pip */
@@ -83,7 +72,27 @@ type API<WidgetState extends UnknownObject> = {
83
72
  */
84
73
  mode: DisplayMode;
85
74
  }>;
75
+ /**
76
+ * Sets the widget state.
77
+ * This state is persisted across widget renders.
78
+ */
86
79
  setWidgetState: (state: WidgetState) => Promise<void>;
80
+ /**
81
+ * Opens a modal portaled outside of the widget iFrame.
82
+ * This ensures the modal is correctly displayed and not limited to the widget's area.
83
+ */
84
+ requestModal: (args: {
85
+ title: string;
86
+ }) => Promise<void>;
87
+ /** Uploads a new file to the host */
88
+ uploadFile: (file: File) => Promise<FileMetadata>;
89
+ /**
90
+ * Downloads a file from the host that was previously uploaded.
91
+ * Only files uploaded by the same connector instance can be downloaded.
92
+ */
93
+ downloadFile: (file: FileMetadata) => Promise<{
94
+ downloadUrl: string;
95
+ }>;
87
96
  };
88
97
  export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
89
98
  export declare class SetGlobalsEvent extends CustomEvent<{
@@ -1,3 +1,4 @@
1
+ import "react";
1
2
  export const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
2
3
  export class ToolResponseEvent extends CustomEvent {
3
4
  type = TOOL_RESPONSE_EVENT_TYPE;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AAsFD,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;AAcf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AA8FD,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.6e31b21",
3
+ "version": "0.0.0-dev.708154c",
4
4
  "description": "Skybridge is a framework for building ChatGPT apps",
5
5
  "type": "module",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "build": "tsc && pnpm run build:templates",
21
21
  "build:templates": "cp -r src/server/templates dist/src/server/",
22
22
  "test": "pnpm run test:unit && pnpm run test:type",
23
- "test:unit": "vitest run --silent",
23
+ "test:unit": "vitest run",
24
24
  "test:type": "tsc --noEmit",
25
25
  "docs:dev": "pnpm --filter @skybridge/docs start",
26
26
  "docs:build": "pnpm --filter @skybridge/docs build",
@@ -39,6 +39,7 @@
39
39
  "react-dom": ">=18.0.0"
40
40
  },
41
41
  "dependencies": {
42
+ "@babel/core": "^7.28.5",
42
43
  "@modelcontextprotocol/sdk": "^1.20.0",
43
44
  "cors": "^2.8.5",
44
45
  "express": "^5.1.0",
@@ -50,6 +51,7 @@
50
51
  "@testing-library/dom": "^10.4.1",
51
52
  "@testing-library/react": "^16.3.0",
52
53
  "@total-typescript/tsconfig": "^1.0.4",
54
+ "@types/babel__core": "^7.20.5",
53
55
  "@types/cors": "^2.8.19",
54
56
  "@types/express": "^5.0.3",
55
57
  "@types/jsdom": "^21.1.6",
@@ -58,7 +60,6 @@
58
60
  "@types/react-dom": "^19.2.2",
59
61
  "@vitest/ui": "^2.1.8",
60
62
  "jsdom": "^25.0.1",
61
- "tsd": "^0.33.0",
62
63
  "typescript": "^5.9.3",
63
64
  "vitest": "^2.1.8"
64
65
  },
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `output` property.
3
- */
4
- export declare function useToolOutput(): import("../types.js").UnknownObject | undefined;
@@ -1,9 +0,0 @@
1
- import { useToolInfo } from "./use-tool-info.js";
2
- /**
3
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `output` property.
4
- */
5
- export function useToolOutput() {
6
- const { output } = useToolInfo();
7
- return output;
8
- }
9
- //# sourceMappingURL=use-tool-output.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-tool-output.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEjC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `responseMetadata` property.
3
- */
4
- export declare function useToolResponseMetadata(): import("../types.js").UnknownObject | null | undefined;
@@ -1,8 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- /**
3
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `responseMetadata` property.
4
- */
5
- export function useToolResponseMetadata() {
6
- return useOpenAiGlobal("toolResponseMetadata");
7
- }
8
- //# sourceMappingURL=use-tool-response-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-tool-response-metadata.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-response-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,eAAe,CAAC,sBAAsB,CAAC,CAAC;AACjD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/web/plugin.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,IAAI,EAAE,WAAW;QAEjB,KAAK,CAAC,MAAM,CAAC,MAAM;YACjB,4EAA4E;YAC5E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;YAC7C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;YAE9C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YACjD,MAAM,cAAc,GAAG,OAAO,CAC5B,WAAW,EACX,oCAAoC,CACrC,CAAC;YAEF,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAC9B,QAAQ,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;gBACrC,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC3C,IAAI;aACL,CAAC,CACH,CAAC;YAEF,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE;oBACL,QAAQ,EAAE,IAAI;oBACd,MAAM,EAAE,IAAI;oBACZ,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE;wBACb,KAAK;qBACN;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}