skybridge 0.0.0-dev.f431826 → 0.0.0-dev.f49389e
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 +74 -2
- package/dist/src/server/server.d.ts +1 -0
- package/dist/src/server/server.js +15 -6
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +9 -8
- package/dist/src/server/templateHelper.js +0 -8
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +1 -0
- package/dist/src/server/templates/production.hbs +3 -2
- package/dist/src/test/widget.test.js +23 -2
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/hooks/index.d.ts +13 -0
- package/dist/src/web/hooks/index.js +14 -0
- package/dist/src/web/hooks/index.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.d.ts +62 -0
- package/dist/src/web/hooks/use-call-tool.js +66 -0
- package/dist/src/web/hooks/use-call-tool.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test.js +164 -0
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -0
- package/dist/src/web/hooks/use-display-mode.d.ts +4 -0
- package/dist/src/web/hooks/use-display-mode.js +7 -0
- package/dist/src/web/hooks/use-display-mode.js.map +1 -0
- package/dist/src/web/hooks/use-display-mode.test.d.ts +1 -0
- package/dist/src/web/hooks/use-display-mode.test.js +40 -0
- package/dist/src/web/hooks/use-display-mode.test.js.map +1 -0
- package/dist/src/web/hooks/use-locale.d.ts +1 -0
- package/dist/src/web/hooks/use-locale.js +5 -0
- package/dist/src/web/hooks/use-locale.js.map +1 -0
- package/dist/src/web/hooks/use-locale.test.d.ts +1 -0
- package/dist/src/web/hooks/use-locale.test.js +21 -0
- package/dist/src/web/hooks/use-locale.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.d.ts +1 -0
- package/dist/src/web/hooks/use-open-external.js +6 -0
- package/dist/src/web/hooks/use-open-external.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.test.d.ts +1 -0
- package/dist/src/web/hooks/use-open-external.test.js +24 -0
- package/dist/src/web/hooks/use-open-external.test.js.map +1 -0
- package/dist/src/web/{use-openai-global.d.ts → hooks/use-openai-global.d.ts} +1 -1
- package/dist/src/web/{use-openai-global.js → hooks/use-openai-global.js} +1 -1
- package/dist/src/web/hooks/use-openai-global.js.map +1 -0
- package/dist/src/web/hooks/use-request-modal.d.ts +5 -0
- package/dist/src/web/hooks/use-request-modal.js +9 -0
- package/dist/src/web/hooks/use-request-modal.js.map +1 -0
- package/dist/src/web/hooks/use-request-modal.test.d.ts +1 -0
- package/dist/src/web/hooks/use-request-modal.test.js +24 -0
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -0
- package/dist/src/web/hooks/use-send-follow-up-message.d.ts +1 -0
- package/dist/src/web/hooks/use-send-follow-up-message.js +11 -0
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -0
- package/dist/src/web/hooks/use-theme.d.ts +1 -0
- package/dist/src/web/hooks/use-theme.js +5 -0
- package/dist/src/web/hooks/use-theme.js.map +1 -0
- package/dist/src/web/hooks/use-theme.test.d.ts +1 -0
- package/dist/src/web/hooks/use-theme.test.js +26 -0
- package/dist/src/web/hooks/use-theme.test.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.d.ts +5 -0
- package/dist/src/web/hooks/use-tool-info.js +9 -0
- package/dist/src/web/hooks/use-tool-info.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test.js +38 -0
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -0
- package/dist/src/web/hooks/use-tool-output.d.ts +4 -0
- package/dist/src/web/hooks/use-tool-output.js +9 -0
- package/dist/src/web/hooks/use-tool-output.js.map +1 -0
- package/dist/src/web/hooks/use-tool-response-metadata.d.ts +4 -0
- package/dist/src/web/hooks/use-tool-response-metadata.js +8 -0
- package/dist/src/web/hooks/use-tool-response-metadata.js.map +1 -0
- package/dist/src/web/hooks/use-user-agent.d.ts +1 -0
- package/dist/src/web/hooks/use-user-agent.js +5 -0
- package/dist/src/web/hooks/use-user-agent.js.map +1 -0
- package/dist/src/web/hooks/use-user-agent.test.d.ts +1 -0
- package/dist/src/web/hooks/use-user-agent.test.js +31 -0
- package/dist/src/web/hooks/use-user-agent.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.d.ts +4 -0
- package/dist/src/web/hooks/use-widget-state.js +30 -0
- package/dist/src/web/hooks/use-widget-state.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.test.d.ts +1 -0
- package/dist/src/web/hooks/use-widget-state.test.js +61 -0
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -0
- package/dist/src/web/index.d.ts +2 -2
- package/dist/src/web/index.js +2 -2
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/plugin.d.ts +2 -0
- package/dist/src/web/plugin.js +28 -0
- package/dist/src/web/plugin.js.map +1 -0
- package/dist/src/web/types.d.ts +21 -2
- package/dist/src/web/types.js.map +1 -1
- package/package.json +9 -3
- package/dist/src/web/use-openai-global.js.map +0 -1
- package/dist/src/web/use-tool-output.d.ts +0 -3
- package/dist/src/web/use-tool-output.js +0 -5
- package/dist/src/web/use-tool-output.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function skybridge() {
|
|
2
|
+
return {
|
|
3
|
+
name: "skybridge",
|
|
4
|
+
async config(config) {
|
|
5
|
+
// Dynamic imports to ensure Node modules are only loaded in Node.js context
|
|
6
|
+
const { globSync } = await import("node:fs");
|
|
7
|
+
const { resolve } = await import("node:path");
|
|
8
|
+
const projectRoot = config.root || process.cwd();
|
|
9
|
+
const widgetsPattern = resolve(projectRoot, "src/widgets/*.{js,ts,jsx,tsx,html}");
|
|
10
|
+
const input = Object.fromEntries(globSync(widgetsPattern).map((file) => [
|
|
11
|
+
file.match(/src\/widgets\/(.+)\.tsx$/)?.[1],
|
|
12
|
+
file,
|
|
13
|
+
]));
|
|
14
|
+
return {
|
|
15
|
+
base: "/assets",
|
|
16
|
+
build: {
|
|
17
|
+
manifest: true,
|
|
18
|
+
minify: true,
|
|
19
|
+
cssCodeSplit: false,
|
|
20
|
+
rollupOptions: {
|
|
21
|
+
input,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/src/web/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type UnknownObject = Record<string, unknown>;
|
|
1
|
+
export type UnknownObject = Record<string, unknown>;
|
|
2
2
|
export type WidgetState = UnknownObject;
|
|
3
3
|
export type SetWidgetState = (state: WidgetState) => Promise<void>;
|
|
4
4
|
export type SendFollowUpMessage = (args: {
|
|
@@ -9,6 +9,10 @@ export type RequestDisplayMode = (args: {
|
|
|
9
9
|
}) => Promise<{
|
|
10
10
|
mode: DisplayMode;
|
|
11
11
|
}>;
|
|
12
|
+
export type RequestModal = (options: RequestModalOptions) => Promise<void>;
|
|
13
|
+
export type RequestModalOptions = {
|
|
14
|
+
title: string;
|
|
15
|
+
};
|
|
12
16
|
export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
|
|
13
17
|
export declare class ToolResponseEvent extends CustomEvent<{
|
|
14
18
|
tool: {
|
|
@@ -37,13 +41,28 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolO
|
|
|
37
41
|
toolOutput: ToolOutput | null;
|
|
38
42
|
toolResponseMetadata: ToolResponseMetadata | null;
|
|
39
43
|
widgetState: WidgetState | null;
|
|
44
|
+
requestDisplayMode: RequestDisplayMode;
|
|
45
|
+
requestModal: RequestModal;
|
|
40
46
|
};
|
|
47
|
+
export type CallToolArgs = Record<string, unknown> | null;
|
|
41
48
|
export type CallToolResponse = {
|
|
49
|
+
content: {
|
|
50
|
+
type: "text";
|
|
51
|
+
text: string;
|
|
52
|
+
}[];
|
|
53
|
+
structuredContent: Record<string, unknown>;
|
|
54
|
+
isError: boolean;
|
|
42
55
|
result: string;
|
|
56
|
+
meta: Record<string, unknown>;
|
|
57
|
+
};
|
|
58
|
+
export type DefaultCallToolResponse = {
|
|
59
|
+
structuredContent: Record<string, unknown>;
|
|
60
|
+
meta: Record<string, unknown>;
|
|
43
61
|
};
|
|
62
|
+
export type CallToolResponseConstraint = Partial<Pick<CallToolResponse, "structuredContent" | "meta">>;
|
|
44
63
|
type API<WidgetState extends UnknownObject> = {
|
|
45
64
|
/** Calls a tool on your MCP. Returns the full response. */
|
|
46
|
-
callTool: (name: string, args:
|
|
65
|
+
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponseConstraint = DefaultCallToolResponse>(name: string, args: ToolArgs) => Promise<CallToolResponse & ToolResponse>;
|
|
47
66
|
/** Triggers a followup turn in the ChatGPT conversation */
|
|
48
67
|
sendFollowUpMessage: (args: {
|
|
49
68
|
prompt: string;
|
|
@@ -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":"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"}
|
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.f49389e",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -19,7 +19,10 @@
|
|
|
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": "vitest run --silent"
|
|
22
|
+
"test": "vitest run --silent",
|
|
23
|
+
"docs:dev": "pnpm --filter @skybridge/docs start",
|
|
24
|
+
"docs:build": "pnpm --filter @skybridge/docs build",
|
|
25
|
+
"docs:serve": "pnpm --filter @skybridge/docs serve"
|
|
23
26
|
},
|
|
24
27
|
"keywords": [
|
|
25
28
|
"chatgpt",
|
|
@@ -42,15 +45,18 @@
|
|
|
42
45
|
"zod": "^3.25.51"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
48
|
+
"@testing-library/dom": "^10.4.1",
|
|
49
|
+
"@testing-library/react": "^16.3.0",
|
|
45
50
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
46
51
|
"@types/cors": "^2.8.19",
|
|
47
52
|
"@types/express": "^5.0.3",
|
|
53
|
+
"@types/jsdom": "^21.1.6",
|
|
48
54
|
"@types/node": "^22.15.30",
|
|
49
55
|
"@types/react": "^19.2.2",
|
|
50
56
|
"@types/react-dom": "^19.2.2",
|
|
51
|
-
"@types/jsdom": "^21.1.6",
|
|
52
57
|
"@vitest/ui": "^2.1.8",
|
|
53
58
|
"jsdom": "^25.0.1",
|
|
59
|
+
"tsd": "^0.33.0",
|
|
54
60
|
"typescript": "^5.9.3",
|
|
55
61
|
"vitest": "^2.1.8"
|
|
56
62
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-openai-global.js","sourceRoot":"","sources":["../../../src/web/use-openai-global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAsB,MAAM,YAAY,CAAC;AAEzF,MAAM,UAAU,eAAe,CAAgC,GAAM;IACnE,OAAO,oBAAoB,CACzB,CAAC,QAAQ,EAAE,EAAE;QACX,MAAM,eAAe,GAAG,CAAC,KAAsB,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO;YACT,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YACvD,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,eAAe,EAAE;YAC/D,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EACD,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-tool-output.js","sourceRoot":"","sources":["../../../src/web/use-tool-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,aAAa;IAC3B,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC"}
|