skybridge 0.11.1 → 0.13.0
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 +111 -14
- 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 +2 -1
- 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 +31 -15
- package/dist/src/server/server.js +44 -32
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.js +3 -2
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +2 -2
- package/dist/src/server/widgetsDevServer.js +1 -1
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +53 -7
- package/dist/src/test/utils.js +78 -0
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +56 -11
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/data-llm.test.js.map +1 -1
- package/dist/src/web/generate-helpers.d.ts +7 -5
- package/dist/src/web/generate-helpers.js +4 -2
- package/dist/src/web/generate-helpers.js.map +1 -1
- package/dist/src/web/generate-helpers.test-d.js +53 -1
- package/dist/src/web/generate-helpers.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.d.ts +1 -1
- package/dist/src/web/hooks/use-call-tool.test.js +8 -14
- 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-locale.js.map +1 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +1 -1
- package/dist/src/web/hooks/use-openai-global.js +6 -4
- package/dist/src/web/hooks/use-openai-global.js.map +1 -1
- package/dist/src/web/hooks/use-theme.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +1 -1
- package/dist/src/web/hooks/use-tool-info.js +3 -5
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-user-agent.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/types.d.ts +2 -2
- package/package.json +3 -3
|
@@ -3,12 +3,10 @@ import { useOpenAiGlobal } from "./use-openai-global.js";
|
|
|
3
3
|
export function useToolInfo() {
|
|
4
4
|
const [status, setStatus] = useState("pending");
|
|
5
5
|
const input = useOpenAiGlobal("toolInput");
|
|
6
|
-
const output = useOpenAiGlobal("toolOutput")
|
|
7
|
-
const responseMetadata = useOpenAiGlobal("toolResponseMetadata")
|
|
6
|
+
const output = useOpenAiGlobal("toolOutput");
|
|
7
|
+
const responseMetadata = useOpenAiGlobal("toolResponseMetadata");
|
|
8
8
|
useEffect(() => {
|
|
9
|
-
setStatus(output ===
|
|
10
|
-
? "pending"
|
|
11
|
-
: "success");
|
|
9
|
+
setStatus(output === null && responseMetadata === null ? "pending" : "success");
|
|
12
10
|
}, [output, responseMetadata]);
|
|
13
11
|
return {
|
|
14
12
|
input,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tool-info.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAsCzD,MAAM,UAAU,WAAW;
|
|
1
|
+
{"version":3,"file":"use-tool-info.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAsCzD,MAAM,UAAU,WAAW;IAGzB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAwB,SAAS,CAAC,CAAC;IACvE,MAAM,KAAK,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,gBAAgB,GAAG,eAAe,CAAC,sBAAsB,CAAC,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CACP,MAAM,KAAK,IAAI,IAAI,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CACrE,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAM/B,OAAO;QACL,KAAK;QACL,MAAM;QACN,SAAS,EAAE,MAAM,KAAK,SAAS;QAC/B,SAAS,EAAE,MAAM,KAAK,SAAS;QAC/B,MAAM;QACN,gBAAgB;KACqB,CAAC;AAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAAC,CAAC;AACtC,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;YAE9C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YACjD,MAAM,
|
|
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,OAA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gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/src/web/types.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type Prettify<T> = {
|
|
|
10
10
|
} & {};
|
|
11
11
|
export type Objectify<T> = T & UnknownObject;
|
|
12
12
|
type RequiredKeys<T> = {
|
|
13
|
-
[K in keyof T]-?:
|
|
13
|
+
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
14
14
|
}[keyof T];
|
|
15
15
|
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
16
16
|
type WidgetState = UnknownObject;
|
|
@@ -34,7 +34,7 @@ declare global {
|
|
|
34
34
|
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
export type OpenAiProperties<ToolInput extends UnknownObject =
|
|
37
|
+
export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unknown>, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
38
38
|
theme: Theme;
|
|
39
39
|
userAgent: UserAgent;
|
|
40
40
|
locale: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -19,11 +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
|
-
"format": "biome check --write",
|
|
22
|
+
"format": "biome check --write --error-on-warnings",
|
|
23
23
|
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
24
24
|
"test:unit": "vitest run",
|
|
25
25
|
"test:type": "tsc --noEmit",
|
|
26
|
-
"test:format": "biome
|
|
26
|
+
"test:format": "biome ci",
|
|
27
27
|
"docs:dev": "pnpm --filter @skybridge/docs start",
|
|
28
28
|
"docs:build": "pnpm --filter @skybridge/docs build",
|
|
29
29
|
"docs:serve": "pnpm --filter @skybridge/docs serve"
|