skybridge 0.0.0-dev.fc2f516 → 0.0.0-dev.fcc9898
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/dist/src/server/devtoolsStaticServer.d.ts +19 -0
- package/dist/src/server/devtoolsStaticServer.js +48 -0
- package/dist/src/server/devtoolsStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +3 -2
- package/dist/src/server/index.js +1 -0
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/inferUtilityTypes.d.ts +10 -0
- package/dist/src/server/server.d.ts +43 -17
- package/dist/src/server/server.js +54 -34
- 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 +4 -3
- package/dist/src/server/templates/production.hbs +1 -0
- package/dist/src/server/widgetsDevServer.js +2 -3
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +54 -8
- package/dist/src/test/utils.js +86 -8
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +82 -29
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +13 -0
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +33 -0
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js.map +1 -0
- package/dist/src/web/bridges/adaptors/mcp-app-adaptor.d.ts +16 -0
- package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +115 -0
- package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js.map +1 -0
- package/dist/src/web/bridges/apps-sdk-bridge.d.ts +10 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js +46 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-adaptor.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-adaptor.js +8 -0
- package/dist/src/web/bridges/hooks/use-adaptor.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 +2 -0
- package/dist/src/web/bridges/hooks/use-bridge.js +8 -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 +5 -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 +41 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/src/web/bridges/index.d.ts +4 -0
- package/dist/src/web/bridges/index.js +5 -0
- package/dist/src/web/bridges/index.js.map +1 -0
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +38 -0
- package/dist/src/web/bridges/mcp-app-bridge.js +162 -0
- package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/types.d.ts +57 -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 +3 -0
- package/dist/src/web/create-store.js +25 -0
- package/dist/src/web/create-store.js.map +1 -0
- 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 +1 -0
- package/dist/src/web/data-llm.js +8 -5
- package/dist/src/web/data-llm.js.map +1 -1
- package/dist/src/web/data-llm.test.js.map +1 -1
- package/dist/src/web/generate-helpers.d.ts +11 -11
- package/dist/src/web/generate-helpers.js +6 -4
- package/dist/src/web/generate-helpers.js.map +1 -1
- package/dist/src/web/generate-helpers.test-d.js +62 -4
- package/dist/src/web/generate-helpers.test-d.js.map +1 -1
- package/dist/src/web/generate-helpers.test.js +1 -1
- package/dist/src/web/generate-helpers.test.js.map +1 -1
- 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.js +53 -0
- package/dist/src/web/helpers/state.test.js.map +1 -0
- package/dist/src/web/hooks/index.d.ts +4 -5
- package/dist/src/web/hooks/index.js +3 -4
- package/dist/src/web/hooks/index.js.map +1 -1
- package/dist/src/web/hooks/test/utils.d.ts +10 -0
- package/dist/src/web/hooks/test/utils.js +40 -0
- package/dist/src/web/hooks/test/utils.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.d.ts +1 -1
- package/dist/src/web/hooks/use-call-tool.js +12 -4
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test.js +35 -15
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +1 -1
- 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.test.js +1 -1
- package/dist/src/web/hooks/use-files.test.js.map +1 -1
- 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 +95 -0
- package/dist/src/web/hooks/use-layout.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.js +5 -3
- package/dist/src/web/hooks/use-open-external.js.map +1 -1
- package/dist/src/web/hooks/use-open-external.test.js +43 -17
- 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 +6 -3
- package/dist/src/web/hooks/use-request-modal.js +6 -1
- package/dist/src/web/hooks/use-request-modal.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.test.js +37 -4
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/src/web/hooks/use-send-follow-up-message.js +3 -6
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +13 -2
- package/dist/src/web/hooks/use-tool-info.js +15 -11
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js +40 -5
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test.js +119 -48
- 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 +93 -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 +5 -3
- package/dist/src/web/index.js +5 -3
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/plugin/plugin.js +10 -4
- package/dist/src/web/plugin/plugin.js.map +1 -1
- package/dist/src/web/plugin/transform-data-llm.js +6 -3
- package/dist/src/web/plugin/transform-data-llm.js.map +1 -1
- package/dist/src/web/proxy.js +6 -1
- package/dist/src/web/proxy.js.map +1 -1
- package/dist/src/web/types.d.ts +30 -14
- package/dist/src/web/types.js.map +1 -1
- package/package.json +33 -26
- package/README.md +0 -371
- 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-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/{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 → helpers/state.test.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { act, renderHook } from "@testing-library/react";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi, } from "vitest";
|
|
1
3
|
import { useWidgetState } from "./use-widget-state.js";
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, afterEach, } from "vitest";
|
|
3
|
-
import { renderHook, act } from "@testing-library/react";
|
|
4
4
|
describe("useWidgetState", () => {
|
|
5
5
|
let OpenaiMock;
|
|
6
6
|
beforeEach(() => {
|
|
@@ -9,6 +9,7 @@ describe("useWidgetState", () => {
|
|
|
9
9
|
setWidgetState: vi.fn().mockResolvedValue(undefined),
|
|
10
10
|
};
|
|
11
11
|
vi.stubGlobal("openai", OpenaiMock);
|
|
12
|
+
vi.stubGlobal("skybridge", { hostType: "apps-sdk" });
|
|
12
13
|
});
|
|
13
14
|
afterEach(() => {
|
|
14
15
|
vi.unstubAllGlobals();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-widget-state.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-widget-state.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-widget-state.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-widget-state.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,EAAE,EAEF,EAAE,GACH,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,UAA0D,CAAC;IAE/D,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,WAAW,EAAE,IAAI;YACjB,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;SACrD,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACpC,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IACvD,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,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE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C,WAAW,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/src/web/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./bridges/index.js";
|
|
2
|
+
export { createStore } from "./create-store.js";
|
|
2
3
|
export * from "./data-llm.js";
|
|
4
|
+
export { generateHelpers } from "./generate-helpers.js";
|
|
5
|
+
export * from "./hooks/index.js";
|
|
3
6
|
export { mountWidget } from "./mount-widget.js";
|
|
4
7
|
export { skybridge } from "./plugin/plugin.js";
|
|
5
|
-
export * from "./
|
|
6
|
-
export { generateHelpers } from "./generate-helpers.js";
|
|
8
|
+
export * from "./types.js";
|
package/dist/src/web/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./bridges/index.js";
|
|
2
|
+
export { createStore } from "./create-store.js";
|
|
2
3
|
export * from "./data-llm.js";
|
|
4
|
+
export { generateHelpers } from "./generate-helpers.js";
|
|
5
|
+
export * from "./hooks/index.js";
|
|
3
6
|
export { mountWidget } from "./mount-widget.js";
|
|
4
7
|
export { skybridge } from "./plugin/plugin.js";
|
|
5
|
-
export * from "./
|
|
6
|
-
export { generateHelpers } from "./generate-helpers.js";
|
|
8
|
+
export * from "./types.js";
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,YAAY,CAAC"}
|
|
@@ -7,11 +7,17 @@ export function skybridge() {
|
|
|
7
7
|
const { globSync } = await import("node:fs");
|
|
8
8
|
const { resolve } = await import("node:path");
|
|
9
9
|
const projectRoot = config.root || process.cwd();
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
const flatWidgetPattern = resolve(projectRoot, "src/widgets/*.{js,ts,jsx,tsx,html}");
|
|
11
|
+
const dirWidgetPattern = resolve(projectRoot, "src/widgets/*/index.tsx");
|
|
12
|
+
const flatWidgets = globSync(flatWidgetPattern).map((file) => [
|
|
13
|
+
file.match(/src\/widgets\/([^/]+)\.tsx$/)?.[1],
|
|
13
14
|
file,
|
|
14
|
-
])
|
|
15
|
+
]);
|
|
16
|
+
const dirWidgets = globSync(dirWidgetPattern).map((file) => [
|
|
17
|
+
file.match(/src\/widgets\/([^/]+)\/index\.tsx$/)?.[1],
|
|
18
|
+
file,
|
|
19
|
+
]);
|
|
20
|
+
const input = Object.fromEntries([...flatWidgets, ...dirWidgets]);
|
|
15
21
|
return {
|
|
16
22
|
base: "/assets",
|
|
17
23
|
build: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/web/plugin/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExE,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;Y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O;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;QACD,OAAO,EAAE,KAAK;QACd,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE;YACtB,OAAO,MAAM,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -8,10 +8,12 @@ function createBabelPlugin(t) {
|
|
|
8
8
|
state.hasDataLLMImport = false;
|
|
9
9
|
state.needsDataLLMImport = false;
|
|
10
10
|
for (const node of path.node.body) {
|
|
11
|
-
if (!t.isImportDeclaration(node))
|
|
11
|
+
if (!t.isImportDeclaration(node)) {
|
|
12
12
|
continue;
|
|
13
|
-
|
|
13
|
+
}
|
|
14
|
+
if (node.source.value !== LLM_IMPORT_SOURCE) {
|
|
14
15
|
continue;
|
|
16
|
+
}
|
|
15
17
|
const hasSpecifier = node.specifiers.some((s) => t.isImportSpecifier(s) &&
|
|
16
18
|
t.isIdentifier(s.imported, { name: "DataLLM" }));
|
|
17
19
|
if (hasSpecifier) {
|
|
@@ -34,8 +36,9 @@ function createBabelPlugin(t) {
|
|
|
34
36
|
const attributes = opening.attributes;
|
|
35
37
|
const llmAttributeIndex = attributes.findIndex((attribute) => t.isJSXAttribute(attribute) &&
|
|
36
38
|
t.isJSXIdentifier(attribute.name, { name: "data-llm" }));
|
|
37
|
-
if (llmAttributeIndex === -1)
|
|
39
|
+
if (llmAttributeIndex === -1) {
|
|
38
40
|
return;
|
|
41
|
+
}
|
|
39
42
|
const llmAttribute = attributes[llmAttributeIndex];
|
|
40
43
|
let contentExpression;
|
|
41
44
|
if (t.isStringLiteral(llmAttribute.value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-data-llm.js","sourceRoot":"","sources":["../../../../src/web/plugin/transform-data-llm.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAO1C,SAAS,iBAAiB,CAAC,CAAe;IACxC,OAAO;QACL,IAAI,EAAE,gBAAgB;QAEtB,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,CAAC,IAAI,EAAE,KAAK;oBACf,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC;oBAC/B,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC;oBAEjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBAClC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"transform-data-llm.js","sourceRoot":"","sources":["../../../../src/web/plugin/transform-data-llm.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAO1C,SAAS,iBAAiB,CAAC,CAAe;IACxC,OAAO;QACL,IAAI,EAAE,gBAAgB;QAEtB,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,CAAC,IAAI,EAAE,KAAK;oBACf,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC;oBAC/B,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC;oBAEjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBAClC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;4BACjC,SAAS;wBACX,CAAC;wBACD,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,iBAAiB,EAAE,CAAC;4BAC5C,SAAS;wBACX,CAAC;wBAED,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CACvC,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;4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U,EACV,UAAU,EACV,CAAC,iBAAiB,CAAC,EACnB,KAAK,CACN,CAAC;gBAEF,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAChC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAE,EAAU,EAAE,EAAE;IAC1D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yEAAyE;IACzE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAEhE,MAAM,YAAY,GAAqB;QACrC,OAAO,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC/B,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC;SAC/B;QACD,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,EAAE;KACnB,CAAC;IAEF,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAEjD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI;KACxB,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/src/web/proxy.js
CHANGED
|
@@ -9,6 +9,11 @@ export function installOpenAILoggingProxy() {
|
|
|
9
9
|
console.warn("[openai-proxy] window.openai not found, skipping proxy installation");
|
|
10
10
|
return;
|
|
11
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
|
+
}
|
|
12
17
|
const originalOpenAI = window.openai;
|
|
13
18
|
const handler = {
|
|
14
19
|
get(target, prop, receiver) {
|
|
@@ -16,7 +21,7 @@ export function installOpenAILoggingProxy() {
|
|
|
16
21
|
if (typeof value !== "function") {
|
|
17
22
|
return value;
|
|
18
23
|
}
|
|
19
|
-
return
|
|
24
|
+
return (...args) => {
|
|
20
25
|
const methodName = String(prop);
|
|
21
26
|
console.group(`%c[openai] %cmethod %c${methodName}`, `color: ${colors.brand}; font-weight: normal`, `color: ${colors.info}; font-weight: normal`, `color: ${colors.success}`);
|
|
22
27
|
console.log("%c← args:", `color: ${colors.info}`, args);
|
|
@@ -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,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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,6 +1,8 @@
|
|
|
1
1
|
import "react";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { WidgetHostType } from "../server/index.js";
|
|
2
4
|
declare module "react" {
|
|
3
|
-
interface HTMLAttributes<T
|
|
5
|
+
interface HTMLAttributes<T> {
|
|
4
6
|
"data-llm"?: string;
|
|
5
7
|
}
|
|
6
8
|
}
|
|
@@ -10,7 +12,7 @@ export type Prettify<T> = {
|
|
|
10
12
|
} & {};
|
|
11
13
|
export type Objectify<T> = T & UnknownObject;
|
|
12
14
|
type RequiredKeys<T> = {
|
|
13
|
-
[K in keyof T]-?:
|
|
15
|
+
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
14
16
|
}[keyof T];
|
|
15
17
|
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
16
18
|
type WidgetState = UnknownObject;
|
|
@@ -28,19 +30,24 @@ export declare class ToolResponseEvent extends CustomEvent<{
|
|
|
28
30
|
}
|
|
29
31
|
declare global {
|
|
30
32
|
interface Window {
|
|
31
|
-
|
|
33
|
+
skybridge: SkybridgeProperties;
|
|
34
|
+
openai: OpenAiMethods<WidgetState> & OpenAiProperties;
|
|
32
35
|
}
|
|
33
36
|
interface WindowEventMap {
|
|
34
37
|
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
export type
|
|
40
|
+
export type SkybridgeProperties = {
|
|
41
|
+
hostType: WidgetHostType;
|
|
42
|
+
};
|
|
43
|
+
export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unknown>, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
38
44
|
theme: Theme;
|
|
39
45
|
userAgent: UserAgent;
|
|
40
46
|
locale: string;
|
|
41
47
|
maxHeight: number;
|
|
42
48
|
displayMode: DisplayMode;
|
|
43
49
|
safeArea: SafeArea;
|
|
50
|
+
view: View;
|
|
44
51
|
toolInput: ToolInput;
|
|
45
52
|
toolOutput: ToolOutput | {
|
|
46
53
|
text: string;
|
|
@@ -50,16 +57,23 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput exten
|
|
|
50
57
|
};
|
|
51
58
|
export type CallToolArgs = Record<string, unknown> | null;
|
|
52
59
|
export type CallToolResponse = {
|
|
53
|
-
content:
|
|
54
|
-
type: "text";
|
|
55
|
-
text: string;
|
|
56
|
-
}[];
|
|
60
|
+
content: CallToolResult["content"];
|
|
57
61
|
structuredContent: Record<string, unknown>;
|
|
58
62
|
isError: boolean;
|
|
59
63
|
result: string;
|
|
60
64
|
meta: Record<string, unknown>;
|
|
61
65
|
};
|
|
62
|
-
type
|
|
66
|
+
export type RequestModalOptions = {
|
|
67
|
+
title?: string;
|
|
68
|
+
params?: Record<string, unknown>;
|
|
69
|
+
anchor?: {
|
|
70
|
+
top?: number;
|
|
71
|
+
left?: number;
|
|
72
|
+
width?: number;
|
|
73
|
+
height?: number;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
|
|
63
77
|
/** Calls a tool on your MCP. Returns the full response. */
|
|
64
78
|
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
65
79
|
/** Triggers a followup turn in the ChatGPT conversation */
|
|
@@ -89,9 +103,7 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
89
103
|
* Opens a modal portaled outside of the widget iFrame.
|
|
90
104
|
* This ensures the modal is correctly displayed and not limited to the widget's area.
|
|
91
105
|
*/
|
|
92
|
-
requestModal: (args:
|
|
93
|
-
title: string;
|
|
94
|
-
}) => Promise<void>;
|
|
106
|
+
requestModal: (args: RequestModalOptions) => Promise<void>;
|
|
95
107
|
/** Uploads a new file to the host */
|
|
96
108
|
uploadFile: (file: File) => Promise<FileMetadata>;
|
|
97
109
|
/**
|
|
@@ -104,12 +116,16 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
104
116
|
};
|
|
105
117
|
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
106
118
|
export declare class SetGlobalsEvent extends CustomEvent<{
|
|
107
|
-
globals: Partial<
|
|
119
|
+
globals: Partial<OpenAiProperties>;
|
|
108
120
|
}> {
|
|
109
121
|
readonly type = "openai:set_globals";
|
|
110
122
|
}
|
|
111
123
|
export type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
|
|
112
|
-
export type DisplayMode = "pip" | "inline" | "fullscreen";
|
|
124
|
+
export type DisplayMode = "pip" | "inline" | "fullscreen" | "modal";
|
|
125
|
+
export type View = {
|
|
126
|
+
mode: DisplayMode;
|
|
127
|
+
params?: Record<string, unknown>;
|
|
128
|
+
};
|
|
113
129
|
export type Theme = "light" | "dark";
|
|
114
130
|
export type SafeAreaInsets = {
|
|
115
131
|
top: number;
|
|
@@ -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;AAyBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AAuGD,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,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.fcc9898",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/alpic-ai/skybridge.git"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
6
10
|
"files": [
|
|
7
11
|
"dist"
|
|
@@ -16,16 +20,6 @@
|
|
|
16
20
|
"default": "./dist/src/web/index.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc && pnpm run build:templates",
|
|
21
|
-
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
22
|
-
"test": "pnpm run test:unit && pnpm run test:type",
|
|
23
|
-
"test:unit": "vitest run",
|
|
24
|
-
"test:type": "tsc --noEmit",
|
|
25
|
-
"docs:dev": "pnpm --filter @skybridge/docs start",
|
|
26
|
-
"docs:build": "pnpm --filter @skybridge/docs build",
|
|
27
|
-
"docs:serve": "pnpm --filter @skybridge/docs serve"
|
|
28
|
-
},
|
|
29
23
|
"keywords": [
|
|
30
24
|
"chatgpt",
|
|
31
25
|
"app",
|
|
@@ -35,33 +29,46 @@
|
|
|
35
29
|
"author": "Frédéric Barthelet",
|
|
36
30
|
"license": "ISC",
|
|
37
31
|
"peerDependencies": {
|
|
32
|
+
"@modelcontextprotocol/sdk": ">=1.0.0",
|
|
38
33
|
"react": ">=18.0.0",
|
|
39
34
|
"react-dom": ">=18.0.0"
|
|
40
35
|
},
|
|
41
36
|
"dependencies": {
|
|
42
37
|
"@babel/core": "^7.28.5",
|
|
43
|
-
"@modelcontextprotocol/sdk": "^1.20.0",
|
|
44
38
|
"cors": "^2.8.5",
|
|
45
|
-
"
|
|
39
|
+
"dequal": "^2.0.3",
|
|
40
|
+
"express": "^5.2.1",
|
|
46
41
|
"handlebars": "^4.7.8",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
42
|
+
"superjson": "^2.2.6",
|
|
43
|
+
"vite": "^7.3.0",
|
|
44
|
+
"zustand": "^5.0.9"
|
|
49
45
|
},
|
|
50
46
|
"devDependencies": {
|
|
47
|
+
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
51
49
|
"@testing-library/dom": "^10.4.1",
|
|
52
|
-
"@testing-library/react": "^16.3.
|
|
50
|
+
"@testing-library/react": "^16.3.1",
|
|
53
51
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
54
52
|
"@types/babel__core": "^7.20.5",
|
|
55
53
|
"@types/cors": "^2.8.19",
|
|
56
|
-
"@types/express": "^5.0.
|
|
57
|
-
"@types/jsdom": "^
|
|
58
|
-
"@types/node": "^
|
|
59
|
-
"@types/react": "^19.2.
|
|
60
|
-
"@types/react-dom": "^19.2.
|
|
61
|
-
"@vitest/ui": "^
|
|
62
|
-
"jsdom": "^
|
|
54
|
+
"@types/express": "^5.0.6",
|
|
55
|
+
"@types/jsdom": "^27.0.0",
|
|
56
|
+
"@types/node": "^24.10.4",
|
|
57
|
+
"@types/react": "^19.2.7",
|
|
58
|
+
"@types/react-dom": "^19.2.3",
|
|
59
|
+
"@vitest/ui": "^4.0.16",
|
|
60
|
+
"jsdom": "^27.4.0",
|
|
63
61
|
"typescript": "^5.9.3",
|
|
64
|
-
"vitest": "^
|
|
62
|
+
"vitest": "^4.0.16",
|
|
63
|
+
"zod": "^4.3.5"
|
|
65
64
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsc && pnpm run build:templates",
|
|
67
|
+
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
68
|
+
"format": "biome check --write --error-on-warnings",
|
|
69
|
+
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
70
|
+
"test:unit": "vitest run",
|
|
71
|
+
"test:type": "tsc --noEmit",
|
|
72
|
+
"test:format": "biome ci"
|
|
73
|
+
}
|
|
74
|
+
}
|