skybridge 0.0.0-dev.87acdcf → 0.0.0-dev.87bec0f
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/LICENSE +21 -674
- package/README.md +74 -147
- package/dist/src/server/devtoolsStaticServer.d.ts +15 -0
- package/dist/src/server/devtoolsStaticServer.js +38 -0
- package/dist/src/server/devtoolsStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +3 -0
- package/dist/src/server/index.js +1 -0
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/inferUtilityTypes.d.ts +64 -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 +70 -9
- package/dist/src/server/server.js +55 -30
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +3 -0
- package/dist/src/server/templateHelper.js +5 -4
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +3 -2
- package/dist/src/server/templates/production.hbs +1 -0
- package/dist/src/server/widgetsDevServer.js +3 -5
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +108 -1
- package/dist/src/test/utils.js +202 -3
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +83 -27
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/bridges/apps-sdk-bridge.d.ts +14 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js +44 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/get-bridge.d.ts +2 -0
- package/dist/src/web/bridges/get-bridge.js +8 -0
- package/dist/src/web/bridges/get-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-bridge.d.ts +8 -0
- package/dist/src/web/bridges/hooks/use-bridge.js +57 -0
- package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +4 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +58 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/src/web/bridges/index.d.ts +3 -0
- package/dist/src/web/bridges/index.js +4 -0
- package/dist/src/web/bridges/index.js.map +1 -0
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +30 -0
- package/dist/src/web/bridges/mcp-app-bridge.js +136 -0
- package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/types.d.ts +8 -0
- package/dist/src/web/bridges/types.js +2 -0
- package/dist/src/web/bridges/types.js.map +1 -0
- package/dist/src/web/create-store.d.ts +1 -1
- package/dist/src/web/create-store.js +3 -81
- package/dist/src/web/create-store.js.map +1 -1
- package/dist/src/web/create-store.test.js +70 -0
- package/dist/src/web/create-store.test.js.map +1 -0
- package/dist/src/web/data-llm.d.ts +14 -0
- package/dist/src/web/{llm-describe.js → data-llm.js} +16 -10
- package/dist/src/web/data-llm.js.map +1 -0
- package/dist/src/web/data-llm.test.js +76 -0
- package/dist/src/web/data-llm.test.js.map +1 -0
- package/dist/src/web/generate-helpers.d.ts +115 -0
- package/dist/src/web/generate-helpers.js +111 -0
- package/dist/src/web/generate-helpers.js.map +1 -0
- package/dist/src/web/generate-helpers.test-d.d.ts +1 -0
- package/dist/src/web/generate-helpers.test-d.js +206 -0
- package/dist/src/web/generate-helpers.test-d.js.map +1 -0
- package/dist/src/web/generate-helpers.test.d.ts +1 -0
- package/dist/src/web/generate-helpers.test.js +17 -0
- package/dist/src/web/generate-helpers.test.js.map +1 -0
- package/dist/src/web/helpers/state.d.ts +7 -0
- package/dist/src/web/helpers/state.js +40 -0
- package/dist/src/web/helpers/state.js.map +1 -0
- package/dist/src/web/helpers/state.test.d.ts +1 -0
- package/dist/src/web/helpers/state.test.js +53 -0
- package/dist/src/web/helpers/state.test.js.map +1 -0
- package/dist/src/web/hooks/index.d.ts +4 -6
- package/dist/src/web/hooks/index.js +4 -6
- package/dist/src/web/hooks/index.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.d.ts +58 -20
- package/dist/src/web/hooks/use-call-tool.js +7 -15
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js +104 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test.js +9 -15
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +2 -2
- package/dist/src/web/hooks/use-display-mode.js +6 -3
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.test.js +3 -2
- package/dist/src/web/hooks/use-display-mode.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.d.ts +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-layout.d.ts +22 -0
- package/dist/src/web/hooks/use-layout.js +23 -0
- package/dist/src/web/hooks/use-layout.js.map +1 -0
- package/dist/src/web/hooks/use-layout.test.d.ts +1 -0
- package/dist/src/web/hooks/use-layout.test.js +46 -0
- package/dist/src/web/hooks/use-layout.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.test.js +2 -2
- package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +3 -2
- package/dist/src/web/hooks/use-openai-global.js +3 -20
- 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-request-modal.test.js +2 -2
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +4 -4
- package/dist/src/web/hooks/use-tool-info.js +5 -7
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js +0 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test.js +3 -2
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-user.d.ts +18 -0
- package/dist/src/web/hooks/use-user.js +19 -0
- package/dist/src/web/hooks/use-user.js.map +1 -0
- package/dist/src/web/hooks/use-user.test.d.ts +1 -0
- package/dist/src/web/hooks/use-user.test.js +44 -0
- package/dist/src/web/hooks/use-user.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.js +5 -27
- package/dist/src/web/hooks/use-widget-state.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +3 -2
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/src/web/index.d.ts +6 -4
- package/dist/src/web/index.js +6 -4
- 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/plugin/data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/data-llm.test.js +81 -0
- package/dist/src/web/plugin/data-llm.test.js.map +1 -0
- package/dist/src/web/plugin/plugin.js +39 -0
- package/dist/src/web/plugin/plugin.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.d.ts +12 -0
- package/dist/src/web/plugin/transform-data-llm.js +93 -0
- package/dist/src/web/plugin/transform-data-llm.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.js +81 -0
- package/dist/src/web/plugin/transform-data-llm.test.js.map +1 -0
- package/dist/src/web/proxy.d.ts +1 -0
- package/dist/src/web/proxy.js +53 -0
- package/dist/src/web/proxy.js.map +1 -0
- package/dist/src/web/types.d.ts +43 -22
- package/dist/src/web/types.js.map +1 -1
- package/package.json +11 -5
- package/dist/src/server/describe-plugin.d.ts +0 -2
- package/dist/src/server/describe-plugin.js +0 -101
- package/dist/src/server/describe-plugin.js.map +0 -1
- package/dist/src/web/hooks/use-locale.d.ts +0 -1
- package/dist/src/web/hooks/use-locale.js +0 -5
- package/dist/src/web/hooks/use-locale.js.map +0 -1
- package/dist/src/web/hooks/use-locale.test.js +0 -21
- package/dist/src/web/hooks/use-locale.test.js.map +0 -1
- package/dist/src/web/hooks/use-theme.d.ts +0 -1
- package/dist/src/web/hooks/use-theme.js +0 -5
- package/dist/src/web/hooks/use-theme.js.map +0 -1
- package/dist/src/web/hooks/use-theme.test.js +0 -26
- package/dist/src/web/hooks/use-theme.test.js.map +0 -1
- package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-output.js +0 -9
- package/dist/src/web/hooks/use-tool-output.js.map +0 -1
- package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
- package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
- package/dist/src/web/hooks/use-user-agent.js +0 -5
- package/dist/src/web/hooks/use-user-agent.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.test.js +0 -31
- package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
- package/dist/src/web/llm-describe.d.ts +0 -13
- package/dist/src/web/llm-describe.js.map +0 -1
- package/dist/src/web/plugin.js +0 -28
- package/dist/src/web/plugin.js.map +0 -1
- /package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
- /package/dist/src/web/{hooks/use-theme.test.d.ts → create-store.test.d.ts} +0 -0
- /package/dist/src/web/{hooks/use-user-agent.test.d.ts → data-llm.test.d.ts} +0 -0
- /package/dist/src/web/{plugin.d.ts → plugin/plugin.d.ts} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const colors = {
|
|
2
|
+
brand: "#6366f1",
|
|
3
|
+
info: "#22223b",
|
|
4
|
+
success: "#22c55e",
|
|
5
|
+
error: "#ef4444",
|
|
6
|
+
};
|
|
7
|
+
export function installOpenAILoggingProxy() {
|
|
8
|
+
if (typeof window === "undefined" || !window.openai) {
|
|
9
|
+
console.warn("[openai-proxy] window.openai not found, skipping proxy installation");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const descriptor = Object.getOwnPropertyDescriptor(window, "openai");
|
|
13
|
+
if (descriptor?.configurable === false || descriptor?.writable === false) {
|
|
14
|
+
console.warn("[openai-proxy] window.openai is not configurable or writable, skipping proxy installation");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const originalOpenAI = window.openai;
|
|
18
|
+
const handler = {
|
|
19
|
+
get(target, prop, receiver) {
|
|
20
|
+
const value = Reflect.get(target, prop, receiver);
|
|
21
|
+
if (typeof value !== "function") {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
return (...args) => {
|
|
25
|
+
const methodName = String(prop);
|
|
26
|
+
console.group(`%c[openai] %cmethod %c${methodName}`, `color: ${colors.brand}; font-weight: normal`, `color: ${colors.info}; font-weight: normal`, `color: ${colors.success}`);
|
|
27
|
+
console.log("%c← args:", `color: ${colors.info}`, args);
|
|
28
|
+
const result = value.apply(target, args);
|
|
29
|
+
if (result && typeof result.then === "function") {
|
|
30
|
+
return result.then((resolved) => {
|
|
31
|
+
console.log("%c→ resolved:", `color: ${colors.success}`, resolved);
|
|
32
|
+
console.groupEnd();
|
|
33
|
+
return resolved;
|
|
34
|
+
}, (error) => {
|
|
35
|
+
console.error("%c→ rejected:", `color: ${colors.error}`, error);
|
|
36
|
+
console.groupEnd();
|
|
37
|
+
throw error;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
console.log("%c→ returned:", `color: ${colors.success}`, result);
|
|
41
|
+
console.groupEnd();
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
set(target, prop, value, receiver) {
|
|
46
|
+
console.log(`%c[openai] %cupdate %c${String(prop)}`, `color: ${colors.brand}`, `color: ${colors.info}`, `color: ${colors.success}; font-weight: bold`, "←", value);
|
|
47
|
+
return Reflect.set(target, prop, value, receiver);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
window.openai = new Proxy(originalOpenAI, handler);
|
|
51
|
+
console.log("%c[openai-proxy] %cInstalled logging proxy for window.openai", `color: ${colors.brand}`, `color: ${colors.info}`);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -0,0 +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,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrE,IAAI,UAAU,EAAE,YAAY,KAAK,KAAK,IAAI,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AAC,eAAe,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;wBAChE,OAAO,CAAC,QAAQ,EAAE,CAAC;wBACnB,MAAM,KAAK,CAAC;oBACd,CAAC,CACF,CAAC;gBACJ,CAAC;gBAED,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;gBACjE,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAEnB,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;QACJ,CAAC;QAED,GAAG,CAAC,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"}
|
package/dist/src/web/types.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import "react";
|
|
2
|
+
import type { WidgetHostType } from "../server/index.js";
|
|
2
3
|
declare module "react" {
|
|
3
|
-
interface HTMLAttributes<T
|
|
4
|
-
"llm
|
|
4
|
+
interface HTMLAttributes<T> {
|
|
5
|
+
"data-llm"?: string;
|
|
5
6
|
}
|
|
6
7
|
}
|
|
7
8
|
export type UnknownObject = Record<string, unknown>;
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type RequestModalOptions = {
|
|
20
|
-
title: string;
|
|
9
|
+
export type Prettify<T> = {
|
|
10
|
+
[K in keyof T]: T[K];
|
|
11
|
+
} & {};
|
|
12
|
+
export type Objectify<T> = T & UnknownObject;
|
|
13
|
+
type RequiredKeys<T> = {
|
|
14
|
+
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
15
|
+
}[keyof T];
|
|
16
|
+
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
17
|
+
type WidgetState = UnknownObject;
|
|
18
|
+
type FileMetadata = {
|
|
19
|
+
fileId: string;
|
|
21
20
|
};
|
|
22
21
|
export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
|
|
23
22
|
export declare class ToolResponseEvent extends CustomEvent<{
|
|
@@ -30,13 +29,17 @@ export declare class ToolResponseEvent extends CustomEvent<{
|
|
|
30
29
|
}
|
|
31
30
|
declare global {
|
|
32
31
|
interface Window {
|
|
33
|
-
|
|
32
|
+
skybridge: SkybridgeProperties;
|
|
33
|
+
openai: OpenAiMethods<WidgetState> & OpenAiProperties;
|
|
34
34
|
}
|
|
35
35
|
interface WindowEventMap {
|
|
36
36
|
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
export type
|
|
39
|
+
export type SkybridgeProperties = {
|
|
40
|
+
hostType: WidgetHostType;
|
|
41
|
+
};
|
|
42
|
+
export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unknown>, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
40
43
|
theme: Theme;
|
|
41
44
|
userAgent: UserAgent;
|
|
42
45
|
locale: string;
|
|
@@ -49,8 +52,6 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput exten
|
|
|
49
52
|
} | null;
|
|
50
53
|
toolResponseMetadata: ToolResponseMetadata | null;
|
|
51
54
|
widgetState: WidgetState | null;
|
|
52
|
-
requestDisplayMode: RequestDisplayMode;
|
|
53
|
-
requestModal: RequestModal;
|
|
54
55
|
};
|
|
55
56
|
export type CallToolArgs = Record<string, unknown> | null;
|
|
56
57
|
export type CallToolResponse = {
|
|
@@ -63,7 +64,7 @@ export type CallToolResponse = {
|
|
|
63
64
|
result: string;
|
|
64
65
|
meta: Record<string, unknown>;
|
|
65
66
|
};
|
|
66
|
-
type
|
|
67
|
+
export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
|
|
67
68
|
/** Calls a tool on your MCP. Returns the full response. */
|
|
68
69
|
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
69
70
|
/** Triggers a followup turn in the ChatGPT conversation */
|
|
@@ -71,7 +72,7 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
71
72
|
prompt: string;
|
|
72
73
|
}) => Promise<void>;
|
|
73
74
|
/** Opens an external link, redirects web page or mobile app */
|
|
74
|
-
openExternal(
|
|
75
|
+
openExternal(args: {
|
|
75
76
|
href: string;
|
|
76
77
|
}): void;
|
|
77
78
|
/** For transitioning an app from inline to fullscreen or pip */
|
|
@@ -84,11 +85,31 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
84
85
|
*/
|
|
85
86
|
mode: DisplayMode;
|
|
86
87
|
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the widget state.
|
|
90
|
+
* This state is persisted across widget renders.
|
|
91
|
+
*/
|
|
87
92
|
setWidgetState: (state: WidgetState) => Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Opens a modal portaled outside of the widget iFrame.
|
|
95
|
+
* This ensures the modal is correctly displayed and not limited to the widget's area.
|
|
96
|
+
*/
|
|
97
|
+
requestModal: (args: {
|
|
98
|
+
title: string;
|
|
99
|
+
}) => Promise<void>;
|
|
100
|
+
/** Uploads a new file to the host */
|
|
101
|
+
uploadFile: (file: File) => Promise<FileMetadata>;
|
|
102
|
+
/**
|
|
103
|
+
* Downloads a file from the host that was previously uploaded.
|
|
104
|
+
* Only files uploaded by the same connector instance can be downloaded.
|
|
105
|
+
*/
|
|
106
|
+
downloadFile: (file: FileMetadata) => Promise<{
|
|
107
|
+
downloadUrl: string;
|
|
108
|
+
}>;
|
|
88
109
|
};
|
|
89
110
|
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
90
111
|
export declare class SetGlobalsEvent extends CustomEvent<{
|
|
91
|
-
globals: Partial<
|
|
112
|
+
globals: Partial<OpenAiProperties>;
|
|
92
113
|
}> {
|
|
93
114
|
readonly type = "openai:set_globals";
|
|
94
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;
|
|
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;AAmGD,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.87bec0f",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -19,9 +19,11 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc && pnpm run build:templates",
|
|
21
21
|
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
22
|
-
"
|
|
22
|
+
"format": "biome check --write --error-on-warnings",
|
|
23
|
+
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
23
24
|
"test:unit": "vitest run",
|
|
24
25
|
"test:type": "tsc --noEmit",
|
|
26
|
+
"test:format": "biome ci",
|
|
25
27
|
"docs:dev": "pnpm --filter @skybridge/docs start",
|
|
26
28
|
"docs:build": "pnpm --filter @skybridge/docs build",
|
|
27
29
|
"docs:serve": "pnpm --filter @skybridge/docs serve"
|
|
@@ -35,20 +37,23 @@
|
|
|
35
37
|
"author": "Frédéric Barthelet",
|
|
36
38
|
"license": "ISC",
|
|
37
39
|
"peerDependencies": {
|
|
40
|
+
"@modelcontextprotocol/sdk": ">=1.0.0",
|
|
38
41
|
"react": ">=18.0.0",
|
|
39
42
|
"react-dom": ">=18.0.0"
|
|
40
43
|
},
|
|
41
44
|
"dependencies": {
|
|
42
45
|
"@babel/core": "^7.28.5",
|
|
43
|
-
"@modelcontextprotocol/sdk": "^1.20.0",
|
|
44
46
|
"cors": "^2.8.5",
|
|
45
47
|
"express": "^5.1.0",
|
|
46
48
|
"handlebars": "^4.7.8",
|
|
49
|
+
"superjson": "^2.2.6",
|
|
47
50
|
"vite": "^7.1.11",
|
|
48
|
-
"zod": "^3.25.51",
|
|
49
51
|
"zustand": "^5.0.9"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
54
|
+
"@biomejs/biome": "2.3.8",
|
|
55
|
+
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
56
|
+
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
52
57
|
"@testing-library/dom": "^10.4.1",
|
|
53
58
|
"@testing-library/react": "^16.3.0",
|
|
54
59
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
@@ -62,7 +67,8 @@
|
|
|
62
67
|
"@vitest/ui": "^2.1.8",
|
|
63
68
|
"jsdom": "^25.0.1",
|
|
64
69
|
"typescript": "^5.9.3",
|
|
65
|
-
"vitest": "^2.1.8"
|
|
70
|
+
"vitest": "^2.1.8",
|
|
71
|
+
"zod": "^4.1.13"
|
|
66
72
|
},
|
|
67
73
|
"packageManager": "pnpm@10.17.1"
|
|
68
74
|
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { transformSync, types as t } from "@babel/core";
|
|
2
|
-
const LLM_IMPORT_SOURCE = "skybridge/web";
|
|
3
|
-
function createBabelPlugin() {
|
|
4
|
-
return {
|
|
5
|
-
name: "llm-describe-babel",
|
|
6
|
-
visitor: {
|
|
7
|
-
Program: {
|
|
8
|
-
enter(path, state) {
|
|
9
|
-
state.hasLLMDescribeImport = false;
|
|
10
|
-
state.needsLLMDescribeImport = false;
|
|
11
|
-
for (const node of path.node.body) {
|
|
12
|
-
if (!t.isImportDeclaration(node))
|
|
13
|
-
continue;
|
|
14
|
-
if (node.source.value !== LLM_IMPORT_SOURCE)
|
|
15
|
-
continue;
|
|
16
|
-
const hasSpecifier = node.specifiers.some((s) => t.isImportSpecifier(s) &&
|
|
17
|
-
t.isIdentifier(s.imported, { name: "LLMDescribe" }));
|
|
18
|
-
if (hasSpecifier) {
|
|
19
|
-
state.hasLLMDescribeImport = true;
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
exit(path, state) {
|
|
25
|
-
if (state.needsLLMDescribeImport && !state.hasLLMDescribeImport) {
|
|
26
|
-
const importDecl = t.importDeclaration([
|
|
27
|
-
t.importSpecifier(t.identifier("LLMDescribe"), t.identifier("LLMDescribe")),
|
|
28
|
-
], t.stringLiteral(LLM_IMPORT_SOURCE));
|
|
29
|
-
path.node.body.unshift(importDecl);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
JSXElement(path, state) {
|
|
34
|
-
const opening = path.node.openingElement;
|
|
35
|
-
const attrs = opening.attributes;
|
|
36
|
-
const llmAttrIndex = attrs.findIndex((attr) => t.isJSXAttribute(attr) &&
|
|
37
|
-
t.isJSXIdentifier(attr.name, { name: "llm-describe" }));
|
|
38
|
-
if (llmAttrIndex === -1)
|
|
39
|
-
return;
|
|
40
|
-
const llmAttr = attrs[llmAttrIndex];
|
|
41
|
-
const newAttrs = [...attrs];
|
|
42
|
-
newAttrs.splice(llmAttrIndex, 1);
|
|
43
|
-
opening.attributes = newAttrs;
|
|
44
|
-
let contentExpression;
|
|
45
|
-
if (!llmAttr.value) {
|
|
46
|
-
contentExpression = t.stringLiteral("");
|
|
47
|
-
}
|
|
48
|
-
else if (t.isStringLiteral(llmAttr.value)) {
|
|
49
|
-
contentExpression = llmAttr.value;
|
|
50
|
-
}
|
|
51
|
-
else if (t.isJSXExpressionContainer(llmAttr.value)) {
|
|
52
|
-
contentExpression = llmAttr.value.expression;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const contentAttr = t.jsxAttribute(t.jsxIdentifier("content"), t.isStringLiteral(contentExpression)
|
|
58
|
-
? contentExpression
|
|
59
|
-
: t.jsxExpressionContainer(contentExpression));
|
|
60
|
-
const llmOpening = t.jsxOpeningElement(t.jsxIdentifier("LLMDescribe"), [
|
|
61
|
-
contentAttr,
|
|
62
|
-
]);
|
|
63
|
-
const llmClosing = t.jsxClosingElement(t.jsxIdentifier("LLMDescribe"));
|
|
64
|
-
const wrapped = t.jsxElement(llmOpening, llmClosing, [path.node], false);
|
|
65
|
-
state.needsLLMDescribeImport = true;
|
|
66
|
-
path.replaceWith(wrapped);
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export default function describePlugin() {
|
|
72
|
-
return {
|
|
73
|
-
name: "llm-describe-vite",
|
|
74
|
-
enforce: "pre",
|
|
75
|
-
transform(code, id) {
|
|
76
|
-
if (!/\.(jsx|tsx)$/.test(id)) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
if (id.includes("node_modules")) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
const babelOptions = {
|
|
83
|
-
plugins: [createBabelPlugin()],
|
|
84
|
-
parserOpts: {
|
|
85
|
-
plugins: ["jsx", "typescript"],
|
|
86
|
-
},
|
|
87
|
-
filename: id,
|
|
88
|
-
sourceFileName: id,
|
|
89
|
-
};
|
|
90
|
-
const result = transformSync(code, babelOptions);
|
|
91
|
-
if (!result || !result.code) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
code: result.code,
|
|
96
|
-
map: result.map || null,
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=describe-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe-plugin.js","sourceRoot":"","sources":["../../../src/server/describe-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC,EAAE,MAAM,aAAa,CAAC;AAGxD,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAO1C,SAAS,iBAAiB;IACxB,OAAO;QACL,IAAI,EAAE,oBAAoB;QAE1B,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,CAAC,IAAI,EAAE,KAAK;oBACf,KAAK,CAAC,oBAAoB,GAAG,KAAK,CAAC;oBACnC,KAAK,CAAC,sBAAsB,GAAG,KAAK,CAAC;oBAErC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBAClC,IAAI,CAAC,CAAC,CAAC,mBAA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":3,"file":"use-locale.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,SAAS;IACvB,OAAO,eAAe,CAAC,QAAQ,CAAE,CAAC;AACpC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useLocale } from "./use-locale.js";
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
3
|
-
import { renderHook } from "@testing-library/react";
|
|
4
|
-
describe("useLocale", () => {
|
|
5
|
-
let OpenaiMock;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
OpenaiMock = {
|
|
8
|
-
locale: "en-US",
|
|
9
|
-
};
|
|
10
|
-
vi.stubGlobal("openai", OpenaiMock);
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
vi.unstubAllGlobals();
|
|
14
|
-
vi.resetAllMocks();
|
|
15
|
-
});
|
|
16
|
-
it("should return the current locale from window.openai.locale", () => {
|
|
17
|
-
const { result } = renderHook(() => useLocale());
|
|
18
|
-
expect(result.current).toBe("en-US");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
//# sourceMappingURL=use-locale.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-locale.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,MAAM,EAAE,OAAO;SAChB,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useTheme(): import("../types.js").Theme;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,QAAQ;IACtB,OAAO,eAAe,CAAC,OAAO,CAAE,CAAC;AACnC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useTheme } from "./use-theme.js";
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
3
|
-
import { renderHook } from "@testing-library/react";
|
|
4
|
-
describe("useTheme", () => {
|
|
5
|
-
let OpenaiMock;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
OpenaiMock = {
|
|
8
|
-
theme: "light",
|
|
9
|
-
};
|
|
10
|
-
vi.stubGlobal("openai", OpenaiMock);
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
vi.unstubAllGlobals();
|
|
14
|
-
vi.resetAllMocks();
|
|
15
|
-
});
|
|
16
|
-
it("should return the current theme from window.openai.theme", () => {
|
|
17
|
-
const { result } = renderHook(() => useTheme());
|
|
18
|
-
expect(result.current).toBe("light");
|
|
19
|
-
});
|
|
20
|
-
it("should return dark theme when set to dark", () => {
|
|
21
|
-
OpenaiMock.theme = "dark";
|
|
22
|
-
const { result } = renderHook(() => useTheme());
|
|
23
|
-
expect(result.current).toBe("dark");
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=use-theme.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,KAAK,EAAE,OAAO;SACf,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC;QAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -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,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
|
-
export declare function useUserAgent(): import("../types.js").UserAgent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-user-agent.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,YAAY;IAC1B,OAAO,eAAe,CAAC,WAAW,CAAE,CAAC;AACvC,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useUserAgent } from "./use-user-agent.js";
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, afterEach, } from "vitest";
|
|
3
|
-
import { renderHook } from "@testing-library/react";
|
|
4
|
-
describe("useUserAgent", () => {
|
|
5
|
-
let OpenaiMock;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
OpenaiMock = {
|
|
8
|
-
userAgent: {
|
|
9
|
-
device: { type: "mobile" },
|
|
10
|
-
capabilities: { hover: false, touch: true },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
vi.stubGlobal("openai", OpenaiMock);
|
|
14
|
-
});
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
vi.unstubAllGlobals();
|
|
17
|
-
vi.resetAllMocks();
|
|
18
|
-
});
|
|
19
|
-
it("should return the current user agent from window.openai.userAgent", () => {
|
|
20
|
-
OpenaiMock.userAgent = {
|
|
21
|
-
device: { type: "mobile" },
|
|
22
|
-
capabilities: { hover: false, touch: true },
|
|
23
|
-
};
|
|
24
|
-
const { result } = renderHook(() => useUserAgent());
|
|
25
|
-
expect(result.current).toEqual({
|
|
26
|
-
device: { type: "mobile" },
|
|
27
|
-
capabilities: { hover: false, touch: true },
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=use-user-agent.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-user-agent.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,QAAQ,EACR,EAAE,EACF,MAAM,EACN,EAAE,EACF,UAAU,EACV,SAAS,GAEV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,SAAS,EAAE;gBACT,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;aAC5C;SACF,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,UAAU,CAAC,SAAS,GAAG;YACrB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC;QACF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;YAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
export type LLMDescribeContent = string;
|
|
3
|
-
export interface LLMDescribeNode {
|
|
4
|
-
id: string;
|
|
5
|
-
parentId: string | null;
|
|
6
|
-
content: string | null;
|
|
7
|
-
}
|
|
8
|
-
interface LLMDescribeProps {
|
|
9
|
-
content: LLMDescribeContent | null | undefined;
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export declare function LLMDescribe({ content, children }: LLMDescribeProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-describe.js","sourceRoot":"","sources":["../../../src/web/llm-describe.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,GAEN,MAAM,OAAO,CAAC;AAUf,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;AAEjD,SAAS,OAAO,CAAC,IAAqB;IACpC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACzB,QAAQ,EAAE,CAAC;AACb,CAAC;AAED,SAAS,UAAU,CAAC,EAAU;IAC5B,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjB,QAAQ,EAAE,CAAC;AACb,CAAC;AAED,SAAS,QAAQ;IACf,MAAM,WAAW,GAAG,uBAAu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QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,SAAS,YAAY,CAAC,QAAuB,EAAE,KAAa;QAC1D,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,KAAK,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACnD,CAAC;YACD,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAEtB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/src/web/plugin.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -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"}
|
/package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|