skybridge 0.0.0-dev.d4986ac → 0.0.0-dev.d6a0040
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 +73 -148
- 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 +61 -9
- package/dist/src/server/server.js +50 -34
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.js +5 -4
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +2 -2
- package/dist/src/server/widgetsDevServer.js +3 -3
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +97 -1
- package/dist/src/test/utils.js +182 -3
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +43 -21
- package/dist/src/test/widget.test.js.map +1 -1
- 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.d.ts +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 +14 -0
- package/dist/src/web/data-llm.js +68 -0
- package/dist/src/web/data-llm.js.map +1 -0
- package/dist/src/web/data-llm.test.d.ts +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 +180 -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 +2 -4
- package/dist/src/web/hooks/index.js +2 -4
- 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 +14 -12
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.test.js +2 -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-locale.js.map +1 -1
- package/dist/src/web/hooks/use-locale.test.js +2 -2
- package/dist/src/web/hooks/use-locale.test.js.map +1 -1
- 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 +2 -2
- package/dist/src/web/hooks/use-openai-global.js +7 -5
- package/dist/src/web/hooks/use-openai-global.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-theme.js.map +1 -1
- package/dist/src/web/hooks/use-theme.test.js +2 -2
- package/dist/src/web/hooks/use-theme.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 +4 -6
- 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 +2 -2
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-user-agent.js.map +1 -1
- package/dist/src/web/hooks/use-user-agent.test.js +2 -2
- package/dist/src/web/hooks/use-user-agent.test.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.js +9 -7
- package/dist/src/web/hooks/use-widget-state.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +2 -2
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/src/web/index.d.ts +6 -3
- package/dist/src/web/index.js +6 -3
- package/dist/src/web/index.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.js +1 -1
- package/dist/src/web/proxy.js.map +1 -1
- package/dist/src/web/types.d.ts +18 -4
- package/dist/src/web/types.js +1 -0
- package/dist/src/web/types.js.map +1 -1
- package/package.json +14 -6
- 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/plugin.js +0 -28
- package/dist/src/web/plugin.js.map +0 -1
- /package/dist/src/web/{plugin.d.ts → plugin/plugin.d.ts} +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { transform } from "./transform-data-llm.js";
|
|
3
|
+
describe("data-llm plugin", () => {
|
|
4
|
+
it("should transform JSX element with data-llm string attribute", async () => {
|
|
5
|
+
const code = `
|
|
6
|
+
function Component() {
|
|
7
|
+
return <div data-llm="Test description">Content</div>;
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
const result = await transform(code, "test.tsx");
|
|
11
|
+
expect(result).not.toBeNull();
|
|
12
|
+
expect(result?.code).toContain("DataLLM");
|
|
13
|
+
expect(result?.code).toContain('content="Test description"');
|
|
14
|
+
expect(result?.code).not.toContain("data-llm");
|
|
15
|
+
});
|
|
16
|
+
it("should transform JSX element with data-llm expression attribute", async () => {
|
|
17
|
+
const code = `
|
|
18
|
+
function Component() {
|
|
19
|
+
const desc = "Dynamic description";
|
|
20
|
+
return <div data-llm={desc}>Content</div>;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const result = await transform(code, "test.tsx");
|
|
24
|
+
expect(result).not.toBeNull();
|
|
25
|
+
expect(result?.code).toContain("DataLLM");
|
|
26
|
+
expect(result?.code).toContain("content={desc}");
|
|
27
|
+
expect(result?.code).not.toContain("data-llm");
|
|
28
|
+
});
|
|
29
|
+
it("should add import for DataLLM when not present", async () => {
|
|
30
|
+
const code = `
|
|
31
|
+
function Component() {
|
|
32
|
+
return <div data-llm="Test">Content</div>;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const result = await transform(code, "test.tsx");
|
|
36
|
+
expect(result).not.toBeNull();
|
|
37
|
+
expect(result?.code).toContain('import { DataLLM } from "skybridge/web"');
|
|
38
|
+
});
|
|
39
|
+
it("should handle DataLLM imports correctly", async () => {
|
|
40
|
+
// No duplicate import
|
|
41
|
+
const codeWithImport = `
|
|
42
|
+
import { DataLLM } from "skybridge/web";
|
|
43
|
+
function Component() {
|
|
44
|
+
return <div data-llm="Test">Content</div>;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
const result1 = await transform(codeWithImport, "test.tsx");
|
|
48
|
+
expect(result1?.code.match(/import.*DataLLM.*from.*skybridge\/web/g)).toHaveLength(1);
|
|
49
|
+
// Preserve other imports and add missing DataLLM
|
|
50
|
+
const codeWithOthers = `
|
|
51
|
+
import React from "react";
|
|
52
|
+
import { useState } from "react";
|
|
53
|
+
function Component() {
|
|
54
|
+
return <div data-llm="Test">Content</div>;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
const result2 = await transform(codeWithOthers, "test.tsx");
|
|
58
|
+
expect(result2?.code).toContain('import React from "react"');
|
|
59
|
+
expect(result2?.code).toContain('import { useState } from "react"');
|
|
60
|
+
expect(result2?.code).toContain('import { DataLLM } from "skybridge/web"');
|
|
61
|
+
});
|
|
62
|
+
it("should handle complex JSX with multiple data-llm attributes", async () => {
|
|
63
|
+
const code = `
|
|
64
|
+
function Component() {
|
|
65
|
+
return (
|
|
66
|
+
<div>
|
|
67
|
+
<section data-llm="Section 1">
|
|
68
|
+
<p>Content 1</p>
|
|
69
|
+
</section>
|
|
70
|
+
<section data-llm="Section 2">
|
|
71
|
+
<p>Content 2</p>
|
|
72
|
+
</section>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
const result = await transform(code, "test.tsx");
|
|
78
|
+
expect(result).toMatchSnapshot();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=transform-data-llm.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-data-llm.test.js","sourceRoot":"","sources":["../../../../src/web/plugin/transform-data-llm.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,6DAA6D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,IAAI,GAAG;;;;KAIZ,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC9B,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;QAC7D,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QAC/E,MAAM,IAAI,GAAG;;;;;KAKZ,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC9B,MAAM,CAAC,MAAM,EAA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CAAyC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,IAAI,GAAG;;;;;;;;;;;;;KAaZ,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/src/web/proxy.js
CHANGED
|
@@ -16,7 +16,7 @@ export function installOpenAILoggingProxy() {
|
|
|
16
16
|
if (typeof value !== "function") {
|
|
17
17
|
return value;
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return (...args) => {
|
|
20
20
|
const methodName = String(prop);
|
|
21
21
|
console.group(`%c[openai] %cmethod %c${methodName}`, `color: ${colors.brand}; font-weight: normal`, `color: ${colors.info}; font-weight: normal`, `color: ${colors.success}`);
|
|
22
22
|
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,GAA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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,4 +1,18 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
declare module "react" {
|
|
3
|
+
interface HTMLAttributes<T> {
|
|
4
|
+
"data-llm"?: string;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
1
7
|
export type UnknownObject = Record<string, unknown>;
|
|
8
|
+
export type Prettify<T> = {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
} & {};
|
|
11
|
+
export type Objectify<T> = T & UnknownObject;
|
|
12
|
+
type RequiredKeys<T> = {
|
|
13
|
+
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
2
16
|
type WidgetState = UnknownObject;
|
|
3
17
|
type FileMetadata = {
|
|
4
18
|
fileId: string;
|
|
@@ -14,13 +28,13 @@ export declare class ToolResponseEvent extends CustomEvent<{
|
|
|
14
28
|
}
|
|
15
29
|
declare global {
|
|
16
30
|
interface Window {
|
|
17
|
-
openai:
|
|
31
|
+
openai: OpenAiMethods<WidgetState> & OpenAiProperties;
|
|
18
32
|
}
|
|
19
33
|
interface WindowEventMap {
|
|
20
34
|
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
21
35
|
}
|
|
22
36
|
}
|
|
23
|
-
export type
|
|
37
|
+
export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unknown>, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
24
38
|
theme: Theme;
|
|
25
39
|
userAgent: UserAgent;
|
|
26
40
|
locale: string;
|
|
@@ -45,7 +59,7 @@ export type CallToolResponse = {
|
|
|
45
59
|
result: string;
|
|
46
60
|
meta: Record<string, unknown>;
|
|
47
61
|
};
|
|
48
|
-
type
|
|
62
|
+
export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
|
|
49
63
|
/** Calls a tool on your MCP. Returns the full response. */
|
|
50
64
|
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
51
65
|
/** Triggers a followup turn in the ChatGPT conversation */
|
|
@@ -90,7 +104,7 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
90
104
|
};
|
|
91
105
|
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
92
106
|
export declare class SetGlobalsEvent extends CustomEvent<{
|
|
93
|
-
globals: Partial<
|
|
107
|
+
globals: Partial<OpenAiProperties>;
|
|
94
108
|
}> {
|
|
95
109
|
readonly type = "openai:set_globals";
|
|
96
110
|
}
|
package/dist/src/web/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;AAuBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AA8FD,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACkB,IAAI,GAAG,sBAAsB,CAAC;CACjD"}
|
package/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.d6a0040",
|
|
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
|
-
"
|
|
23
|
-
"test
|
|
22
|
+
"format": "biome check --write --error-on-warnings",
|
|
23
|
+
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
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,21 +37,26 @@
|
|
|
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
46
|
"cors": "^2.8.5",
|
|
44
47
|
"express": "^5.1.0",
|
|
45
48
|
"handlebars": "^4.7.8",
|
|
49
|
+
"superjson": "^2.2.6",
|
|
46
50
|
"vite": "^7.1.11",
|
|
47
|
-
"
|
|
51
|
+
"zustand": "^5.0.9"
|
|
48
52
|
},
|
|
49
53
|
"devDependencies": {
|
|
54
|
+
"@biomejs/biome": "2.3.8",
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
50
56
|
"@testing-library/dom": "^10.4.1",
|
|
51
57
|
"@testing-library/react": "^16.3.0",
|
|
52
58
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
59
|
+
"@types/babel__core": "^7.20.5",
|
|
53
60
|
"@types/cors": "^2.8.19",
|
|
54
61
|
"@types/express": "^5.0.3",
|
|
55
62
|
"@types/jsdom": "^21.1.6",
|
|
@@ -59,7 +66,8 @@
|
|
|
59
66
|
"@vitest/ui": "^2.1.8",
|
|
60
67
|
"jsdom": "^25.0.1",
|
|
61
68
|
"typescript": "^5.9.3",
|
|
62
|
-
"vitest": "^2.1.8"
|
|
69
|
+
"vitest": "^2.1.8",
|
|
70
|
+
"zod": "^4.1.13"
|
|
63
71
|
},
|
|
64
72
|
"packageManager": "pnpm@10.17.1"
|
|
65
73
|
}
|
|
@@ -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"}
|
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"}
|
|
File without changes
|