skybridge 0.0.0-dev.6554f40 → 0.0.0-dev.6b57ab9

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.
Files changed (125) hide show
  1. package/README.md +125 -0
  2. package/dist/src/server/index.d.ts +2 -0
  3. package/dist/src/server/inferUtilityTypes.d.ts +46 -0
  4. package/dist/src/server/inferUtilityTypes.js +2 -0
  5. package/dist/src/server/inferUtilityTypes.js.map +1 -0
  6. package/dist/src/server/server.d.ts +31 -7
  7. package/dist/src/server/server.js +9 -1
  8. package/dist/src/server/server.js.map +1 -1
  9. package/dist/src/test/utils.d.ts +41 -0
  10. package/dist/src/test/utils.js +94 -1
  11. package/dist/src/test/utils.js.map +1 -1
  12. package/dist/src/web/hooks/index.d.ts +14 -0
  13. package/dist/src/web/hooks/index.js +15 -0
  14. package/dist/src/web/hooks/index.js.map +1 -0
  15. package/dist/src/web/hooks/use-call-tool.d.ts +62 -0
  16. package/dist/src/web/{use-call-tool.js → hooks/use-call-tool.js} +28 -4
  17. package/dist/src/web/hooks/use-call-tool.js.map +1 -0
  18. package/dist/src/web/hooks/use-call-tool.test.js +163 -0
  19. package/dist/src/web/hooks/use-call-tool.test.js.map +1 -0
  20. package/dist/src/web/hooks/use-display-mode.d.ts +4 -0
  21. package/dist/src/web/hooks/use-display-mode.js +7 -0
  22. package/dist/src/web/hooks/use-display-mode.js.map +1 -0
  23. package/dist/src/web/hooks/use-display-mode.test.js +40 -0
  24. package/dist/src/web/hooks/use-display-mode.test.js.map +1 -0
  25. package/dist/src/web/hooks/use-files.d.ts +10 -0
  26. package/dist/src/web/hooks/use-files.js +7 -0
  27. package/dist/src/web/hooks/use-files.js.map +1 -0
  28. package/dist/src/web/hooks/use-files.test.d.ts +1 -0
  29. package/dist/src/web/hooks/use-files.test.js +29 -0
  30. package/dist/src/web/hooks/use-files.test.js.map +1 -0
  31. package/dist/src/web/hooks/use-locale.d.ts +1 -0
  32. package/dist/src/web/hooks/use-locale.js +5 -0
  33. package/dist/src/web/hooks/use-locale.js.map +1 -0
  34. package/dist/src/web/hooks/use-locale.test.d.ts +1 -0
  35. package/dist/src/web/hooks/use-locale.test.js +21 -0
  36. package/dist/src/web/hooks/use-locale.test.js.map +1 -0
  37. package/dist/src/web/hooks/use-open-external.d.ts +1 -0
  38. package/dist/src/web/hooks/use-open-external.js +6 -0
  39. package/dist/src/web/hooks/use-open-external.js.map +1 -0
  40. package/dist/src/web/hooks/use-open-external.test.d.ts +1 -0
  41. package/dist/src/web/hooks/use-open-external.test.js +24 -0
  42. package/dist/src/web/hooks/use-open-external.test.js.map +1 -0
  43. package/dist/src/web/{use-openai-global.d.ts → hooks/use-openai-global.d.ts} +1 -1
  44. package/dist/src/web/{use-openai-global.js → hooks/use-openai-global.js} +4 -2
  45. package/dist/src/web/hooks/use-openai-global.js.map +1 -0
  46. package/dist/src/web/hooks/use-request-modal.d.ts +6 -0
  47. package/dist/src/web/hooks/use-request-modal.js +9 -0
  48. package/dist/src/web/hooks/use-request-modal.js.map +1 -0
  49. package/dist/src/web/hooks/use-request-modal.test.d.ts +1 -0
  50. package/dist/src/web/hooks/use-request-modal.test.js +24 -0
  51. package/dist/src/web/hooks/use-request-modal.test.js.map +1 -0
  52. package/dist/src/web/hooks/use-send-follow-up-message.d.ts +1 -0
  53. package/dist/src/web/hooks/use-send-follow-up-message.js +11 -0
  54. package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -0
  55. package/dist/src/web/hooks/use-theme.d.ts +1 -0
  56. package/dist/src/web/hooks/use-theme.js +5 -0
  57. package/dist/src/web/hooks/use-theme.js.map +1 -0
  58. package/dist/src/web/hooks/use-theme.test.d.ts +1 -0
  59. package/dist/src/web/hooks/use-theme.test.js +26 -0
  60. package/dist/src/web/hooks/use-theme.test.js.map +1 -0
  61. package/dist/src/web/hooks/use-tool-info.d.ts +25 -0
  62. package/dist/src/web/hooks/use-tool-info.js +22 -0
  63. package/dist/src/web/hooks/use-tool-info.js.map +1 -0
  64. package/dist/src/web/hooks/use-tool-info.test-d.d.ts +1 -0
  65. package/dist/src/web/hooks/use-tool-info.test-d.js +74 -0
  66. package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -0
  67. package/dist/src/web/hooks/use-tool-info.test.d.ts +1 -0
  68. package/dist/src/web/hooks/use-tool-info.test.js +59 -0
  69. package/dist/src/web/hooks/use-tool-info.test.js.map +1 -0
  70. package/dist/src/web/hooks/use-tool-output.d.ts +4 -0
  71. package/dist/src/web/hooks/use-tool-output.js +9 -0
  72. package/dist/src/web/hooks/use-tool-output.js.map +1 -0
  73. package/dist/src/web/hooks/use-tool-response-metadata.d.ts +4 -0
  74. package/dist/src/web/hooks/use-tool-response-metadata.js +8 -0
  75. package/dist/src/web/hooks/use-tool-response-metadata.js.map +1 -0
  76. package/dist/src/web/hooks/use-user-agent.d.ts +1 -0
  77. package/dist/src/web/hooks/use-user-agent.js +5 -0
  78. package/dist/src/web/hooks/use-user-agent.js.map +1 -0
  79. package/dist/src/web/hooks/use-user-agent.test.d.ts +1 -0
  80. package/dist/src/web/hooks/use-user-agent.test.js +31 -0
  81. package/dist/src/web/hooks/use-user-agent.test.js.map +1 -0
  82. package/dist/src/web/{use-widget-state.d.ts → hooks/use-widget-state.d.ts} +1 -2
  83. package/dist/src/web/{use-widget-state.js → hooks/use-widget-state.js} +3 -3
  84. package/dist/src/web/hooks/use-widget-state.js.map +1 -0
  85. package/dist/src/web/hooks/use-widget-state.test.d.ts +1 -0
  86. package/dist/src/web/hooks/use-widget-state.test.js +60 -0
  87. package/dist/src/web/hooks/use-widget-state.test.js.map +1 -0
  88. package/dist/src/web/index.d.ts +2 -5
  89. package/dist/src/web/index.js +2 -5
  90. package/dist/src/web/index.js.map +1 -1
  91. package/dist/src/web/mount-widget.js +5 -0
  92. package/dist/src/web/mount-widget.js.map +1 -1
  93. package/dist/src/web/proxy.d.ts +1 -0
  94. package/dist/src/web/proxy.js +48 -0
  95. package/dist/src/web/proxy.js.map +1 -0
  96. package/dist/src/web/typed-hooks.d.ts +107 -0
  97. package/dist/src/web/typed-hooks.js +111 -0
  98. package/dist/src/web/typed-hooks.js.map +1 -0
  99. package/dist/src/web/typed-hooks.test-d.d.ts +1 -0
  100. package/dist/src/web/typed-hooks.test-d.js +87 -0
  101. package/dist/src/web/typed-hooks.test-d.js.map +1 -0
  102. package/dist/src/web/typed-hooks.test.d.ts +1 -0
  103. package/dist/src/web/typed-hooks.test.js +17 -0
  104. package/dist/src/web/typed-hooks.test.js.map +1 -0
  105. package/dist/src/web/types.d.ts +30 -14
  106. package/dist/src/web/types.js.map +1 -1
  107. package/dist/vitest.config.js +0 -1
  108. package/dist/vitest.config.js.map +1 -1
  109. package/package.json +4 -2
  110. package/dist/src/test/setup.js +0 -9
  111. package/dist/src/test/setup.js.map +0 -1
  112. package/dist/src/web/use-call-tool.d.ts +0 -54
  113. package/dist/src/web/use-call-tool.js.map +0 -1
  114. package/dist/src/web/use-call-tool.test.js +0 -66
  115. package/dist/src/web/use-call-tool.test.js.map +0 -1
  116. package/dist/src/web/use-openai-global.js.map +0 -1
  117. package/dist/src/web/use-tool-output.d.ts +0 -3
  118. package/dist/src/web/use-tool-output.js +0 -5
  119. package/dist/src/web/use-tool-output.js.map +0 -1
  120. package/dist/src/web/use-tool-response-metadata.d.ts +0 -3
  121. package/dist/src/web/use-tool-response-metadata.js +0 -5
  122. package/dist/src/web/use-tool-response-metadata.js.map +0 -1
  123. package/dist/src/web/use-widget-state.js.map +0 -1
  124. /package/dist/src/web/{use-call-tool.test.d.ts → hooks/use-call-tool.test.d.ts} +0 -0
  125. /package/dist/src/{test/setup.d.ts → web/hooks/use-display-mode.test.d.ts} +0 -0
@@ -0,0 +1,111 @@
1
+ import { useCallTool } from "./hooks/use-call-tool.js";
2
+ import { useToolInfo } from "./hooks/use-tool-info.js";
3
+ /**
4
+ * Creates typed versions of skybridge hooks with full type inference
5
+ * for tool names, inputs, and outputs.
6
+ *
7
+ * This is the recommended way to use skybridge hooks in your widgets.
8
+ * Set this up once in a dedicated file and export the typed hooks for use across your app.
9
+ *
10
+ * @typeParam T - The type of your McpServer instance. Use `typeof server`.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // server/src/index.ts
15
+ * const server = new McpServer({ name: "my-app", version: "1.0" }, {})
16
+ * .widget("search-voyage", {}, {
17
+ * inputSchema: { destination: z.string() },
18
+ * outputSchema: { results: z.array(z.string()) },
19
+ * }, async ({ destination }) => {
20
+ * return { content: [{ type: "text", text: `Found trips to ${destination}` }] };
21
+ * });
22
+ *
23
+ * export type AppType = typeof server;
24
+ * ```
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // web/src/skybridge.ts (one-time setup)
29
+ * import type { AppType } from "../server";
30
+ * import { createTypedHooks } from "skybridge/web";
31
+ *
32
+ * export const { useCallTool, useToolInfo } = createTypedHooks<AppType>();
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * // web/src/widgets/search.tsx (usage)
38
+ * import { useCallTool, useToolInfo } from "../skybridge";
39
+ *
40
+ * export function SearchWidget() {
41
+ * const { callTool, data } = useCallTool("search-voyage");
42
+ * // ^ autocomplete for tool names
43
+ * callTool({ destination: "Spain" });
44
+ * // ^ autocomplete for input fields
45
+ *
46
+ * const toolInfo = useToolInfo<"search-voyage">();
47
+ * // ^ autocomplete for widget names
48
+ * // toolInfo.input is typed based on widget input schema
49
+ * // toolInfo.output is typed based on widget output schema
50
+ * }
51
+ * ```
52
+ */
53
+ export function createTypedHooks() {
54
+ return {
55
+ /**
56
+ * Typed version of `useCallTool` that provides autocomplete for tool names
57
+ * and type inference for inputs and outputs.
58
+ *
59
+ * @param name - The name of the widget to call. Autocompletes based on your server's widget registry.
60
+ * @returns A hook with typed `callTool` function and `data` property.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const { callTool, data, isPending } = useCallTool("search-voyage");
65
+ * // TypeScript knows callTool expects { destination: string }
66
+ * callTool({ destination: "Spain" });
67
+ *
68
+ * // data.structuredContent is typed based on your outputSchema
69
+ * if (data) {
70
+ * console.log(data.structuredContent.results);
71
+ * }
72
+ * ```
73
+ */
74
+ useCallTool: (name) => {
75
+ // Type assertion is safe here because the runtime types are compatible.
76
+ // The underlying hook accepts broader types, but we expose narrower, more specific types.
77
+ return useCallTool(name);
78
+ },
79
+ /**
80
+ * Typed version of `useToolInfo` that provides autocomplete for widget names
81
+ * and type inference for inputs, outputs, and responseMetadata.
82
+ *
83
+ * @typeParam K - The name of the widget. Autocompletes based on your server's widget registry.
84
+ * @returns A discriminated union with `status: "pending" | "success"` that narrows correctly.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const toolInfo = useToolInfo<"search-voyage">();
89
+ * // toolInfo.input is typed as { destination: string; ... }
90
+ * // toolInfo.output is typed as { results: Array<...>; ... } | undefined
91
+ * // toolInfo.status narrows correctly: "pending" | "success"
92
+ *
93
+ * if (toolInfo.isPending) {
94
+ * // TypeScript knows output is undefined here
95
+ * console.log(toolInfo.input.destination);
96
+ * }
97
+ *
98
+ * if (toolInfo.isSuccess) {
99
+ * // TypeScript knows output is defined here
100
+ * console.log(toolInfo.output.results);
101
+ * }
102
+ * ```
103
+ */
104
+ useToolInfo: () => {
105
+ // Type assertion is safe here because the runtime types are compatible.
106
+ // The underlying hook accepts broader types, but we expose narrower, more specific types.
107
+ return useToolInfo();
108
+ },
109
+ };
110
+ }
111
+ //# sourceMappingURL=typed-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-hooks.js","sourceRoot":"","sources":["../../../src/web/typed-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAgCvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,UAAU,gBAAgB;IAI9B,OAAO;QACL;;;;;;;;;;;;;;;;;;WAkBG;QACH,WAAW,EAAE,CACX,IAAO,EAIP,EAAE;YACF,wEAAwE;YACxE,0FAA0F;YAC1F,OAAO,WAAW,CAGhB,IAAI,CAGL,CAAC;QACJ,CAAC;QACD;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;QACH,WAAW,EAAE,GAIX,EAAE;YACF,wEAAwE;YACxE,0FAA0F;YAC1F,OAAO,WAAW,EAQjB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,87 @@
1
+ import { expectTypeOf, test } from "vitest";
2
+ import { createTypedHooks } from "./typed-hooks.js";
3
+ import { createTestServer } from "../test/utils.js";
4
+ const server = createTestServer();
5
+ test("InferTools extracts the tool registry type (widgets + registerTool)", () => {
6
+ expectTypeOf().toHaveProperty("search-voyage");
7
+ expectTypeOf().toHaveProperty("get-trip-details");
8
+ expectTypeOf().toHaveProperty("no-input-widget");
9
+ expectTypeOf().toHaveProperty("calculate-price");
10
+ });
11
+ test("ToolNames returns a union of tool name literals (widgets + registerTool)", () => {
12
+ expectTypeOf().toEqualTypeOf();
13
+ });
14
+ test("ToolInput extracts the correct input type from Zod schema", () => {
15
+ expectTypeOf().toEqualTypeOf();
16
+ expectTypeOf().toEqualTypeOf();
17
+ expectTypeOf().toEqualTypeOf();
18
+ });
19
+ test("ToolOutput extracts the correct output type from Zod schema", () => {
20
+ expectTypeOf().toEqualTypeOf();
21
+ expectTypeOf().toEqualTypeOf();
22
+ expectTypeOf().toEqualTypeOf();
23
+ });
24
+ test("createTypedHooks provides autocomplete for tool names (widgets + registerTool)", () => {
25
+ const { useCallTool } = createTypedHooks();
26
+ useCallTool("search-voyage");
27
+ useCallTool("get-trip-details");
28
+ useCallTool("no-input-widget");
29
+ useCallTool("calculate-price");
30
+ // @ts-expect-error - "invalid-name" is not a valid tool name
31
+ useCallTool("invalid-name");
32
+ });
33
+ test("useCallTool returns correctly typed callTool function", () => {
34
+ const { useCallTool } = createTypedHooks();
35
+ const { callTool } = useCallTool("search-voyage");
36
+ callTool({ destination: "Spain" });
37
+ callTool({ destination: "France", departureDate: "2024-06-01" });
38
+ callTool({ destination: "Italy", maxPrice: 1000 });
39
+ const { callTool: calculateTool } = useCallTool("calculate-price");
40
+ calculateTool({ tripId: "123", passengers: 2 });
41
+ });
42
+ test("useCallTool returns correctly typed data", () => {
43
+ const { useCallTool } = createTypedHooks();
44
+ const { data } = useCallTool("search-voyage");
45
+ if (data) {
46
+ expectTypeOf(data.structuredContent).toExtend();
47
+ expectTypeOf(data.structuredContent.results).toBeArray();
48
+ expectTypeOf(data.structuredContent.totalCount).toBeNumber();
49
+ }
50
+ });
51
+ test("tools with no outputSchema have empty object output type", () => {
52
+ expectTypeOf().toEqualTypeOf();
53
+ });
54
+ test("createTypedHooks provides autocomplete for tool names in useToolInfo (widgets + registerTool)", () => {
55
+ const { useToolInfo } = createTypedHooks();
56
+ useToolInfo();
57
+ useToolInfo();
58
+ useToolInfo();
59
+ useToolInfo();
60
+ // @ts-expect-error - "invalid-name" is not a valid tool name
61
+ useToolInfo();
62
+ });
63
+ test("useToolInfo infers input types from ToolInput utility", () => {
64
+ const { useToolInfo } = createTypedHooks();
65
+ const toolInfo = useToolInfo();
66
+ expectTypeOf(toolInfo.input).toExtend();
67
+ const detailsInfo = useToolInfo();
68
+ expectTypeOf(detailsInfo.input).toExtend();
69
+ const calculateInfo = useToolInfo();
70
+ expectTypeOf(calculateInfo.input).toExtend();
71
+ });
72
+ test("useToolInfo infers output types from ToolOutput utility", () => {
73
+ const { useToolInfo } = createTypedHooks();
74
+ const toolInfo = useToolInfo();
75
+ if (toolInfo.status === "success") {
76
+ expectTypeOf(toolInfo.output).toExtend();
77
+ }
78
+ const detailsInfo = useToolInfo();
79
+ if (detailsInfo.status === "success") {
80
+ expectTypeOf(detailsInfo.output).toExtend();
81
+ }
82
+ const calculateInfo = useToolInfo();
83
+ if (calculateInfo.status === "success") {
84
+ expectTypeOf(calculateInfo.output).toExtend();
85
+ }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IAC3D,CAAC;IAED,MAAM,WAAW,GAAG,WAAW,EAAsB,CAAC;IAEtD,IAAI,WAAW,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACrC,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAyB,CAAC;IACrE,CAAC;IAED,MAAM,aAAa,GAAG,WAAW,EAAqB,CAAC;IAEvD,IAAI,aAAa,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACvC,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,EAA2B,CAAC;IACzE,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { createTypedHooks } from "./typed-hooks.js";
3
+ import { createMinimalTestServer } from "../test/utils.js";
4
+ const server = createMinimalTestServer();
5
+ describe("createTypedHooks", () => {
6
+ it("should return an object with useCallTool hook", () => {
7
+ const hooks = createTypedHooks();
8
+ expect(hooks).toHaveProperty("useCallTool");
9
+ expect(typeof hooks.useCallTool).toBe("function");
10
+ });
11
+ it("should return an object with useToolInfo hook", () => {
12
+ const hooks = createTypedHooks();
13
+ expect(hooks).toHaveProperty("useToolInfo");
14
+ expect(typeof hooks.useToolInfo).toBe("function");
15
+ });
16
+ });
17
+ //# sourceMappingURL=typed-hooks.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-hooks.test.js","sourceRoot":"","sources":["../../../src/web/typed-hooks.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;AAGzC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,KAAK,GAAG,gBAAgB,EAAc,CAAC;QAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAC5C,MAAM,CAAC,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,KAAK,GAAG,gBAAgB,EAAc,CAAC;QAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAC5C,MAAM,CAAC,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,14 +1,8 @@
1
- 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
- }>;
1
+ export type UnknownObject = Record<string, unknown>;
2
+ type WidgetState = UnknownObject;
3
+ type FileMetadata = {
4
+ fileId: string;
5
+ };
12
6
  export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
13
7
  export declare class ToolResponseEvent extends CustomEvent<{
14
8
  tool: {
@@ -26,7 +20,7 @@ declare global {
26
20
  [SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
27
21
  }
28
22
  }
29
- export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
23
+ export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
30
24
  theme: Theme;
31
25
  userAgent: UserAgent;
32
26
  locale: string;
@@ -34,7 +28,9 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolO
34
28
  displayMode: DisplayMode;
35
29
  safeArea: SafeArea;
36
30
  toolInput: ToolInput;
37
- toolOutput: ToolOutput | null;
31
+ toolOutput: ToolOutput | {
32
+ text: string;
33
+ } | null;
38
34
  toolResponseMetadata: ToolResponseMetadata | null;
39
35
  widgetState: WidgetState | null;
40
36
  };
@@ -57,7 +53,7 @@ type API<WidgetState extends UnknownObject> = {
57
53
  prompt: string;
58
54
  }) => Promise<void>;
59
55
  /** Opens an external link, redirects web page or mobile app */
60
- openExternal(payload: {
56
+ openExternal(args: {
61
57
  href: string;
62
58
  }): void;
63
59
  /** For transitioning an app from inline to fullscreen or pip */
@@ -70,7 +66,27 @@ type API<WidgetState extends UnknownObject> = {
70
66
  */
71
67
  mode: DisplayMode;
72
68
  }>;
69
+ /**
70
+ * Sets the widget state.
71
+ * This state is persisted across widget renders.
72
+ */
73
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
+ }>;
74
90
  };
75
91
  export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
76
92
  export declare class SetGlobalsEvent extends CustomEvent<{
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AA2ED,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"}
@@ -3,7 +3,6 @@ export default defineConfig({
3
3
  test: {
4
4
  environment: "jsdom",
5
5
  globals: true,
6
- setupFiles: ["./src/test/setup.ts"],
7
6
  },
8
7
  });
9
8
  //# sourceMappingURL=vitest.config.js.map
@@ -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;QACb,UAAU,EAAE,CAAC,qBAAqB,CAAC;KACpC;CACF,CAAC,CAAC"}
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.6554f40",
3
+ "version": "0.0.0-dev.6b57ab9",
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": "vitest run --silent",
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"
@@ -1,9 +0,0 @@
1
- import { vi } from "vitest";
2
- // Mock console methods to avoid noise in tests
3
- global.console = {
4
- ...console,
5
- error: vi.fn(),
6
- warn: vi.fn(),
7
- log: vi.fn(),
8
- };
9
- //# sourceMappingURL=setup.js.map
@@ -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"}
@@ -1,54 +0,0 @@
1
- import type { CallToolArgs, CallToolResponse } from "./types.js";
2
- export declare const useCallTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string) => {
3
- callTool: (toolArgs: ToolArgs, sideEffects?: {
4
- onSuccess?: (data: ToolResponse, toolArgs: ToolArgs) => void;
5
- onError?: (error: unknown, toolArgs: ToolArgs) => void;
6
- }) => void;
7
- callToolAsync: (toolArgs: ToolArgs) => Promise<ToolResponse>;
8
- status: "idle";
9
- isIdle: true;
10
- isPending: false;
11
- isSuccess: false;
12
- isError: false;
13
- data: undefined;
14
- error: undefined;
15
- } | {
16
- callTool: (toolArgs: ToolArgs, sideEffects?: {
17
- onSuccess?: (data: ToolResponse, toolArgs: ToolArgs) => void;
18
- onError?: (error: unknown, toolArgs: ToolArgs) => void;
19
- }) => void;
20
- callToolAsync: (toolArgs: ToolArgs) => Promise<ToolResponse>;
21
- status: "pending";
22
- isIdle: false;
23
- isPending: true;
24
- isSuccess: false;
25
- isError: false;
26
- data: undefined;
27
- error: undefined;
28
- } | {
29
- callTool: (toolArgs: ToolArgs, sideEffects?: {
30
- onSuccess?: (data: ToolResponse, toolArgs: ToolArgs) => void;
31
- onError?: (error: unknown, toolArgs: ToolArgs) => void;
32
- }) => void;
33
- callToolAsync: (toolArgs: ToolArgs) => Promise<ToolResponse>;
34
- status: "error";
35
- isIdle: false;
36
- isPending: false;
37
- isSuccess: false;
38
- isError: true;
39
- data: undefined;
40
- error: unknown;
41
- } | {
42
- callTool: (toolArgs: ToolArgs, sideEffects?: {
43
- onSuccess?: (data: ToolResponse, toolArgs: ToolArgs) => void;
44
- onError?: (error: unknown, toolArgs: ToolArgs) => void;
45
- }) => void;
46
- callToolAsync: (toolArgs: ToolArgs) => Promise<ToolResponse>;
47
- status: "success";
48
- isIdle: false;
49
- isPending: false;
50
- isSuccess: true;
51
- isError: false;
52
- data: ToolResponse;
53
- error: undefined;
54
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-call-tool.js","sourceRoot":"","sources":["../../../src/web/use-call-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA4BjC,MAAM,CAAC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AC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG;QACpB,MAAM;QACN,IAAI;QACJ,KAAK;QACL,MAAM,EAAE,MAAM,KAAK,MAAM;QACzB,SAAS,EAAE,MAAM,KAAK,SAAS;QAC/B,SAAS,EAAE,MAAM,KAAK,SAAS;QAC/B,OAAO,EAAE,MAAM,KAAK,OAAO;KACG,CAAC;IAEjC,OAAO;QACL,GAAG,aAAa;QAChB,QAAQ;QACR,aAAa;KACd,CAAC;AACJ,CAAC,CAAC"}
@@ -1,66 +0,0 @@
1
- import { useCallTool } from "./use-call-tool.js";
2
- import { describe, it, expect, vi, beforeEach, afterEach, } from "vitest";
3
- import { renderHook, act, waitFor } from "@testing-library/react";
4
- describe("useCallTool - onSuccess callback", () => {
5
- let OpenaiMock;
6
- beforeEach(() => {
7
- OpenaiMock = {
8
- callTool: vi.fn(),
9
- };
10
- vi.stubGlobal("openai", OpenaiMock);
11
- });
12
- afterEach(() => {
13
- vi.unstubAllGlobals();
14
- vi.resetAllMocks();
15
- });
16
- const toolName = "test-tool";
17
- const args = { input: "test input" };
18
- const data = {
19
- content: [{ type: "text", text: "test result" }],
20
- structuredContent: { result: "test" },
21
- isError: false,
22
- result: "test result",
23
- meta: {},
24
- };
25
- const error = new Error("test error");
26
- it("should call window.openai.callTool with correct arguments", async () => {
27
- const { result } = renderHook(() => useCallTool(toolName));
28
- act(() => {
29
- result.current.callTool(args);
30
- });
31
- expect(OpenaiMock.callTool).toHaveBeenCalledWith(toolName, args);
32
- });
33
- it("should call onSuccess callback with correct data and toolArgs on successful execution", async () => {
34
- const onSuccess = vi.fn();
35
- const onError = vi.fn();
36
- OpenaiMock.callTool.mockResolvedValueOnce(data);
37
- const { result } = renderHook(() => useCallTool(toolName));
38
- act(() => {
39
- result.current.callTool(args, {
40
- onSuccess,
41
- onError,
42
- });
43
- });
44
- await waitFor(() => {
45
- expect(onSuccess).toHaveBeenCalledWith(data, args);
46
- expect(onError).not.toHaveBeenCalled();
47
- });
48
- });
49
- it("should call onError callback with error and toolArgs on failed execution", async () => {
50
- const onSuccess = vi.fn();
51
- const onError = vi.fn();
52
- OpenaiMock.callTool.mockRejectedValueOnce(error);
53
- const { result } = renderHook(() => useCallTool(toolName));
54
- act(() => {
55
- result.current.callTool(args, {
56
- onSuccess,
57
- onError,
58
- });
59
- });
60
- await waitFor(() => {
61
- expect(onSuccess).not.toHaveBeenCalled();
62
- expect(onError).toHaveBeenCalledWith(error, args);
63
- });
64
- });
65
- });
66
- //# sourceMappingURL=use-call-tool.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-call-tool.test.js","sourceRoot":"","sources":["../../../src/web/use-call-tool.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,QAAQ,EACR,EAAE,EACF,MAAM,EACN,EAAE,EACF,UAAU,EACV,SAAS,GAEV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAElE,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,IAAI,UAA8B,CAAC;IAEnC,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE;SAClB,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,MAAM,QAAQ,GAAG,WAAW,CAAC;IAC7B,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG;QACX,OAAO,EAAE,C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AAK,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,3 +0,0 @@
1
- export declare function useToolOutput(): {
2
- [x: string]: unknown;
3
- } | null | undefined;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useToolOutput() {
3
- return useOpenAiGlobal("toolOutput");
4
- }
5
- //# sourceMappingURL=use-tool-output.js.map
@@ -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"}
@@ -1,3 +0,0 @@
1
- export declare function useToolResponseMetadata(): {
2
- [x: string]: unknown;
3
- } | null | undefined;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useToolResponseMetadata() {
3
- return useOpenAiGlobal("toolResponseMetadata");
4
- }
5
- //# sourceMappingURL=use-tool-response-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-tool-response-metadata.js","sourceRoot":"","sources":["../../../src/web/use-tool-response-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,uBAAuB;IACrC,OAAO,eAAe,CAAC,sBAAsB,CAAC,CAAC;AACjD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-widget-state.js","sourceRoot":"","sources":["../../../src/web/use-widget-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AASzD,MAAM,UAAU,cAAc,CAC5B,YAA0C;IAE1C,MAAM,qBAAqB,GAAG,eAAe,CAAC,aAAa,CAAM,CAAC;IAElE,MAAM,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAW,GAAG,EAAE;QAC7D,IAAI,qBAAqB,IAAI,IAAI,EAAE,CAAC;YAClC,OAAO,qBAAqB,CAAC;QAC/B,CAAC;QAED,OAAO,OAAO,YAAY,KAAK,UAAU;YACvC,CAAC,CAAC,YAAY,EAAE;YAChB,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,kCAAkC;QAClC,IAAI,qBAAqB,IAAI,IAAI,EAAE,CAAC;YAClC,eAAe,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAE5B,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,KAA+B,EAAE,EAAE;QAClC,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,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