skybridge 0.0.0-dev.c90abc6 → 0.0.0-dev.d0367d9

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.
@@ -1,8 +1,9 @@
1
1
  export { useCallTool } from "./use-call-tool.js";
2
2
  export { useDisplayMode } from "./use-display-mode.js";
3
+ export { useFiles } from "./use-files.js";
3
4
  export { useLocale } from "./use-locale.js";
4
- export { useOpenExternal } from "./use-open-external.js";
5
5
  export { useOpenAiGlobal } from "./use-openai-global.js";
6
+ export { useOpenExternal } from "./use-open-external.js";
6
7
  export { useRequestModal } from "./use-request-modal.js";
7
8
  export { useSendFollowUpMessage } from "./use-send-follow-up-message.js";
8
9
  export { useTheme } from "./use-theme.js";
@@ -1,8 +1,9 @@
1
1
  export { useCallTool } from "./use-call-tool.js";
2
2
  export { useDisplayMode } from "./use-display-mode.js";
3
+ export { useFiles } from "./use-files.js";
3
4
  export { useLocale } from "./use-locale.js";
4
- export { useOpenExternal } from "./use-open-external.js";
5
5
  export { useOpenAiGlobal } from "./use-openai-global.js";
6
+ export { useOpenExternal } from "./use-open-external.js";
6
7
  export { useRequestModal } from "./use-request-modal.js";
7
8
  export { useSendFollowUpMessage } from "./use-send-follow-up-message.js";
8
9
  export { useTheme } from "./use-theme.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/web/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/web/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function useFiles(): {
2
+ upload: (file: File) => Promise<{
3
+ fileId: string;
4
+ }>;
5
+ download: (file: {
6
+ fileId: string;
7
+ }) => Promise<{
8
+ downloadUrl: string;
9
+ }>;
10
+ };
@@ -0,0 +1,7 @@
1
+ export function useFiles() {
2
+ return {
3
+ upload: window.openai.uploadFile,
4
+ download: window.openai.downloadFile,
5
+ };
6
+ }
7
+ //# sourceMappingURL=use-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-files.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-files.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;QAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY;KACrC,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
2
+ import { renderHook } from "@testing-library/react";
3
+ import { useFiles } from "./use-files.js";
4
+ describe("useLocale", () => {
5
+ const OpenaiMock = {
6
+ uploadFile: vi.fn(),
7
+ downloadFile: vi.fn(),
8
+ };
9
+ beforeEach(() => {
10
+ vi.stubGlobal("openai", OpenaiMock);
11
+ });
12
+ afterEach(() => {
13
+ vi.unstubAllGlobals();
14
+ vi.resetAllMocks();
15
+ });
16
+ const dummyFile = new File([], "test.txt");
17
+ it("should upload a file to ChatGPT", () => {
18
+ const { result } = renderHook(() => useFiles());
19
+ result.current.upload(dummyFile);
20
+ expect(OpenaiMock.uploadFile).toHaveBeenCalledWith(dummyFile);
21
+ });
22
+ it("should download a file from ChatGPT", () => {
23
+ const fileId = "123";
24
+ const { result } = renderHook(() => useFiles());
25
+ result.current.download({ fileId });
26
+ expect(OpenaiMock.downloadFile).toHaveBeenCalledWith({ fileId });
27
+ });
28
+ });
29
+ //# sourceMappingURL=use-files.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-files.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-files.test.ts"],"names":[],"mappings":"AAAA,OAAO,E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pC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
- import type { RequestModalOptions } from "../types.js";
2
1
  /**
3
2
  * Triggers a modal containing the widget rendered in display mode "modal"
4
3
  */
5
- export declare function useRequestModal(): (options: RequestModalOptions) => void;
4
+ export declare function useRequestModal(): (options: {
5
+ title: string;
6
+ }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"use-request-modal.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-request-modal.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,OAA4B,EAAE,EAAE;QACtC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"use-request-modal.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-request-modal.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,OAA0B,EAAE,EAAE;QACpC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}
@@ -18,22 +18,22 @@ export function installOpenAILoggingProxy() {
18
18
  }
19
19
  return function (...args) {
20
20
  const methodName = String(prop);
21
- console.log(`%c[openai] %cmethod %c${methodName}`, `color: ${colors.brand}`, `color: ${colors.info}`, `color: ${colors.success}; font-weight: bold`, "←", args);
22
- console.trace("%cCall stack:", `color: ${colors.info}`);
21
+ console.group(`%c[openai] %cmethod %c${methodName}`, `color: ${colors.brand}; font-weight: normal`, `color: ${colors.info}; font-weight: normal`, `color: ${colors.success}`);
22
+ console.log("%c← args:", `color: ${colors.info}`, args);
23
23
  const result = value.apply(target, args);
24
- if (result instanceof Promise) {
24
+ if (result && typeof result.then === "function") {
25
25
  return result.then((resolved) => {
26
- console.groupCollapsed(`%c[openai] %c${methodName} resolved`, `color: ${colors.brand}`, `color: ${colors.success}`);
27
- console.log("%cResult:", `color: ${colors.success}`, resolved);
26
+ console.log("%c resolved:", `color: ${colors.success}`, resolved);
28
27
  console.groupEnd();
29
28
  return resolved;
30
29
  }, (error) => {
31
- console.groupCollapsed(`%c[openai] %c${methodName} rejected`, `color: ${colors.brand}`, `color: ${colors.error}`);
32
- console.error("%cError:", `color: ${colors.error}`, error);
30
+ console.error("%c rejected:", `color: ${colors.error}`, error);
33
31
  console.groupEnd();
34
32
  throw error;
35
33
  });
36
34
  }
35
+ console.log("%c→ returned:", `color: ${colors.success}`, result);
36
+ console.groupEnd();
37
37
  return result;
38
38
  };
39
39
  },
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/web/proxy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;CACR,CAAC;AAEX,MAAM,UAAU,yBAAyB;IACvC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,CAAC,IAAI,CACV,qEAAqE,CACtE,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAErC,MAAM,OAAO,GAAwC;QACnD,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAElD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC;YACf,CAAC;YAED,OAAO,UAAU,GAAG,IAAe;gBACjC,MAAM,UAAU,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MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ;YAC/B,OAAO,CAAC,GAAG,CACT,yBAAyB,MAAM,CAAC,IAAI,CAAC,EAAE,EACvC,UAAU,MAAM,CAAC,KAAK,EAAE,EACxB,UAAU,MAAM,CAAC,IAAI,EAAE,EACvB,UAAU,MAAM,CAAC,OAAO,qBAAqB,EAC7C,GAAG,EACH,KAAK,CACN,CAAC;YAEF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;IAEF,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CACT,8DAA8D,EAC9D,UAAU,MAAM,CAAC,KAAK,EAAE,EACxB,UAAU,MAAM,CAAC,IAAI,EAAE,CACxB,CAAC;AACJ,CAAC"}
@@ -1,17 +1,7 @@
1
1
  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;
2
+ type WidgetState = UnknownObject;
3
+ type FileMetadata = {
4
+ fileId: string;
15
5
  };
16
6
  export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
17
7
  export declare class ToolResponseEvent extends CustomEvent<{
@@ -43,8 +33,6 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput exten
43
33
  } | null;
44
34
  toolResponseMetadata: ToolResponseMetadata | null;
45
35
  widgetState: WidgetState | null;
46
- requestDisplayMode: RequestDisplayMode;
47
- requestModal: RequestModal;
48
36
  };
49
37
  export type CallToolArgs = Record<string, unknown> | null;
50
38
  export type CallToolResponse = {
@@ -65,7 +53,7 @@ type API<WidgetState extends UnknownObject> = {
65
53
  prompt: string;
66
54
  }) => Promise<void>;
67
55
  /** Opens an external link, redirects web page or mobile app */
68
- openExternal(payload: {
56
+ openExternal(args: {
69
57
  href: string;
70
58
  }): void;
71
59
  /** For transitioning an app from inline to fullscreen or pip */
@@ -78,7 +66,27 @@ type API<WidgetState extends UnknownObject> = {
78
66
  */
79
67
  mode: DisplayMode;
80
68
  }>;
69
+ /**
70
+ * Sets the widget state.
71
+ * This state is persisted across widget renders.
72
+ */
81
73
  setWidgetState: (state: WidgetState) => Promise<void>;
74
+ /**
75
+ * Opens a modal portaled outside of the widget iFrame.
76
+ * This ensures the modal is correctly displayed and not limited to the widget's area.
77
+ */
78
+ requestModal: (args: {
79
+ title: string;
80
+ }) => Promise<void>;
81
+ /** Uploads a new file to the host */
82
+ uploadFile: (file: File) => Promise<FileMetadata>;
83
+ /**
84
+ * Downloads a file from the host that was previously uploaded.
85
+ * Only files uploaded by the same connector instance can be downloaded.
86
+ */
87
+ downloadFile: (file: FileMetadata) => Promise<{
88
+ downloadUrl: string;
89
+ }>;
82
90
  };
83
91
  export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
84
92
  export declare class SetGlobalsEvent extends CustomEvent<{
@@ -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;AA6ED,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":"AAMA,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.c90abc6",
3
+ "version": "0.0.0-dev.d0367d9",
4
4
  "description": "Skybridge is a framework for building ChatGPT apps",
5
5
  "type": "module",
6
6
  "files": [