skybridge 0.0.0-dev.e2cf49b → 0.0.0-dev.e3e0986
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/README.md +122 -0
- package/dist/src/server/index.d.ts +2 -0
- package/dist/src/server/inferUtilityTypes.d.ts +33 -0
- package/dist/src/server/inferUtilityTypes.js +2 -0
- package/dist/src/server/inferUtilityTypes.js.map +1 -0
- package/dist/src/server/server.d.ts +13 -7
- package/dist/src/server/server.js +5 -1
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/test/utils.js +1 -1
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/web/hooks/index.d.ts +2 -1
- package/dist/src/web/hooks/index.js +2 -1
- package/dist/src/web/hooks/index.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.d.ts +16 -16
- package/dist/src/web/hooks/use-call-tool.js +12 -10
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test.js +61 -2
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-files.d.ts +10 -0
- package/dist/src/web/hooks/use-files.js +7 -0
- package/dist/src/web/hooks/use-files.js.map +1 -0
- package/dist/src/web/hooks/use-files.test.js +29 -0
- package/dist/src/web/hooks/use-files.test.js.map +1 -0
- package/dist/src/web/hooks/use-openai-global.js +3 -1
- package/dist/src/web/hooks/use-openai-global.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +3 -2
- package/dist/src/web/hooks/use-request-modal.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +24 -4
- package/dist/src/web/hooks/use-tool-info.js +17 -4
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js +74 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test.js +36 -15
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-tool-output.d.ts +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +0 -1
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/src/web/index.d.ts +1 -0
- package/dist/src/web/index.js +1 -0
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/mount-widget.js +5 -0
- package/dist/src/web/mount-widget.js.map +1 -1
- package/dist/src/web/proxy.d.ts +1 -0
- package/dist/src/web/proxy.js +48 -0
- package/dist/src/web/proxy.js.map +1 -0
- package/dist/src/web/typed-hooks.d.ts +61 -0
- package/dist/src/web/typed-hooks.js +61 -0
- package/dist/src/web/typed-hooks.js.map +1 -0
- package/dist/src/web/typed-hooks.test-d.d.ts +1 -0
- package/dist/src/web/typed-hooks.test-d.js +72 -0
- package/dist/src/web/typed-hooks.test-d.js.map +1 -0
- package/dist/src/web/typed-hooks.test.d.ts +1 -0
- package/dist/src/web/typed-hooks.test.js +10 -0
- package/dist/src/web/typed-hooks.test.js.map +1 -0
- package/dist/src/web/types.d.ts +29 -20
- package/dist/src/web/types.js.map +1 -1
- package/dist/vitest.config.js +0 -1
- package/dist/vitest.config.js.map +1 -1
- package/package.json +4 -2
- package/dist/src/test/setup.js +0 -9
- package/dist/src/test/setup.js.map +0 -1
- /package/dist/src/{test/setup.d.ts → web/hooks/use-files.test.d.ts} +0 -0
package/dist/src/web/types.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
export type UnknownObject = Record<string, unknown>;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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<{
|
|
@@ -30,7 +20,7 @@ declare global {
|
|
|
30
20
|
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
31
21
|
}
|
|
32
22
|
}
|
|
33
|
-
export type OpenAiGlobals<ToolInput extends UnknownObject =
|
|
23
|
+
export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
34
24
|
theme: Theme;
|
|
35
25
|
userAgent: UserAgent;
|
|
36
26
|
locale: string;
|
|
@@ -38,11 +28,11 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolO
|
|
|
38
28
|
displayMode: DisplayMode;
|
|
39
29
|
safeArea: SafeArea;
|
|
40
30
|
toolInput: ToolInput;
|
|
41
|
-
toolOutput: ToolOutput |
|
|
31
|
+
toolOutput: ToolOutput | {
|
|
32
|
+
text: string;
|
|
33
|
+
} | null;
|
|
42
34
|
toolResponseMetadata: ToolResponseMetadata | null;
|
|
43
35
|
widgetState: WidgetState | null;
|
|
44
|
-
requestDisplayMode: RequestDisplayMode;
|
|
45
|
-
requestModal: RequestModal;
|
|
46
36
|
};
|
|
47
37
|
export type CallToolArgs = Record<string, unknown> | null;
|
|
48
38
|
export type CallToolResponse = {
|
|
@@ -55,16 +45,15 @@ export type CallToolResponse = {
|
|
|
55
45
|
result: string;
|
|
56
46
|
meta: Record<string, unknown>;
|
|
57
47
|
};
|
|
58
|
-
export type CallToolResponseConstraint = Partial<Pick<CallToolResponse, "structuredContent" | "meta">>;
|
|
59
48
|
type API<WidgetState extends UnknownObject> = {
|
|
60
49
|
/** Calls a tool on your MCP. Returns the full response. */
|
|
61
|
-
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends
|
|
50
|
+
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
62
51
|
/** Triggers a followup turn in the ChatGPT conversation */
|
|
63
52
|
sendFollowUpMessage: (args: {
|
|
64
53
|
prompt: string;
|
|
65
54
|
}) => Promise<void>;
|
|
66
55
|
/** Opens an external link, redirects web page or mobile app */
|
|
67
|
-
openExternal(
|
|
56
|
+
openExternal(args: {
|
|
68
57
|
href: string;
|
|
69
58
|
}): void;
|
|
70
59
|
/** For transitioning an app from inline to fullscreen or pip */
|
|
@@ -77,7 +66,27 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
77
66
|
*/
|
|
78
67
|
mode: DisplayMode;
|
|
79
68
|
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the widget state.
|
|
71
|
+
* This state is persisted across widget renders.
|
|
72
|
+
*/
|
|
80
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
|
+
}>;
|
|
81
90
|
};
|
|
82
91
|
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
83
92
|
export declare class SetGlobalsEvent extends CustomEvent<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"
|
|
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/dist/vitest.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE;QACJ,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE;QACJ,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,IAAI;KACd;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.e3e0986",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc && pnpm run build:templates",
|
|
21
21
|
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
22
|
-
"test": "
|
|
22
|
+
"test": "pnpm run test:unit && pnpm run test:type",
|
|
23
|
+
"test:unit": "vitest run --silent",
|
|
24
|
+
"test:type": "tsc --noEmit",
|
|
23
25
|
"docs:dev": "pnpm --filter @skybridge/docs start",
|
|
24
26
|
"docs:build": "pnpm --filter @skybridge/docs build",
|
|
25
27
|
"docs:serve": "pnpm --filter @skybridge/docs serve"
|
package/dist/src/test/setup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,+CAA+C;AAC/C,MAAM,CAAC,OAAO,GAAG;IACf,GAAG,OAAO;IACV,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;IACd,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;IACb,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;CACb,CAAC"}
|
|
File without changes
|