@ubean/devtools 0.1.13 → 0.2.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.
@@ -3,9 +3,9 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <link rel="icon" href="https://r2.soybeanjs.tech/soybeanjs/logo-ubean.svg" type="image/svg+xml" />
6
+ <link rel="icon" href="https://r2.soybeanjs.tech/soybeanjs/logo-ubean.svg?v=202608192144" type="image/svg+xml" />
7
7
  <title>Ubean DevTools</title>
8
- <script type="module" crossorigin src="/_devtools/assets/index-BQPJzkxy.js"></script>
8
+ <script type="module" crossorigin src="/_devtools/assets/index-D33iO1jJ.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/_devtools/assets/index-BlZj1Onv.css">
10
10
  </head>
11
11
 
package/dist/index.js CHANGED
@@ -583,7 +583,18 @@ You can also ask me questions in natural language, or configure a DeepSeek/OpenA
583
583
  }
584
584
  async function callLlmApi(options) {
585
585
  const { messages, apiKey, apiBase, model, requestId } = options;
586
- const [{ streamText, stepCountIs }, { createOpenAICompatible }] = await Promise.all([import("ai"), import("@ai-sdk/openai-compatible")]);
586
+ let streamText;
587
+ let stepCountIs;
588
+ let createOpenAICompatible;
589
+ try {
590
+ const [aiMod, compatMod] = await Promise.all([import("ai"), import("@ai-sdk/openai-compatible")]);
591
+ streamText = aiMod.streamText;
592
+ stepCountIs = aiMod.stepCountIs;
593
+ createOpenAICompatible = compatMod.createOpenAICompatible;
594
+ } catch (err) {
595
+ const msg = err instanceof Error ? err.message : String(err);
596
+ throw new Error(`AI SDK packages are not installed. The DevTools AI assistant requires \`ai\` and \`@ai-sdk/openai-compatible\` to be installed. Install them with: pnpm add ai @ai-sdk/openai-compatible (or npm/yarn/bun equivalent). Original error: ${msg}`, { cause: err });
597
+ }
587
598
  const aiModel = createOpenAICompatible({
588
599
  baseURL: apiBase,
589
600
  name: apiBase.includes("deepseek") ? DEEPSEEK_PROVIDER_NAME : "ubean-ai",
@@ -639,9 +650,7 @@ You can also ask me questions in natural language, or configure a DeepSeek/OpenA
639
650
  toolResults: [...streamToolResults]
640
651
  });
641
652
  break;
642
- case "error":
643
- streamError = part.error instanceof Error ? part.error.message : String(part.error);
644
- break;
653
+ case "error": streamError = part.error instanceof Error ? part.error.message : String(part.error);
645
654
  }
646
655
  } catch (err) {
647
656
  streamError = err instanceof Error ? err.message : String(err);
@@ -738,7 +747,8 @@ function createCrudServer(options) {
738
747
  const dir = config.dir ?? {};
739
748
  const rawSrcDir = config.srcDir || "src";
740
749
  const srcDir = isAbsolute(rawSrcDir) ? rawSrcDir : resolve(cwd, rawSrcDir);
741
- const primaryDir = join(srcDir, dir.routes || "routes");
750
+ const routesDir = dir.routes || "routes";
751
+ const primaryDir = join(srcDir, routesDir);
742
752
  if (existsSync(primaryDir)) return primaryDir;
743
753
  const fallbackDir = join(srcDir, "routes");
744
754
  if (existsSync(fallbackDir)) return fallbackDir;
@@ -782,7 +792,8 @@ function createCrudServer(options) {
782
792
  } else if (type === "cron") {
783
793
  const cronDir = "src/server/crons";
784
794
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
785
- const filePath = join(cronDir, normalizedPath.endsWith(".ts") ? normalizedPath : `${normalizedPath}.ts`);
795
+ const fileName = normalizedPath.endsWith(".ts") ? normalizedPath : `${normalizedPath}.ts`;
796
+ const filePath = join(cronDir, fileName);
786
797
  if (await fs.exists(filePath) && !force) result = {
787
798
  success: false,
788
799
  skipped: [filePath],
@@ -919,43 +930,45 @@ export default definePlugin({
919
930
  });
920
931
  try {
921
932
  let result;
922
- if (type === "env") if (!key) result = {
923
- success: false,
924
- errors: ["Key is required for env update"]
925
- };
926
- else if (!setEnv || !getEnv) result = {
927
- success: false,
928
- errors: ["Env not available"]
929
- };
930
- else {
931
- const env = { ...getEnv() };
932
- if (value !== void 0) env[key] = value;
933
- else delete env[key];
934
- setEnv(env);
935
- result = {
936
- success: true,
937
- updated: [`env:${key}`]
933
+ if (type === "env") {
934
+ if (!key) result = {
935
+ success: false,
936
+ errors: ["Key is required for env update"]
938
937
  };
939
- }
940
- else if (type === "config") if (!path) result = {
941
- success: false,
942
- errors: ["Path is required for config file update"]
943
- };
944
- else {
945
- const resolved = resolveFilePath(path);
946
- if (!await fs.exists(resolved)) result = {
938
+ else if (!setEnv || !getEnv) result = {
947
939
  success: false,
948
- errors: [`File not found: ${path}`]
940
+ errors: ["Env not available"]
949
941
  };
950
942
  else {
951
- await fs.writeFile(resolved, content || "");
943
+ const env = { ...getEnv() };
944
+ if (value !== void 0) env[key] = value;
945
+ else delete env[key];
946
+ setEnv(env);
952
947
  result = {
953
948
  success: true,
954
- updated: [path]
949
+ updated: [`env:${key}`]
955
950
  };
956
951
  }
957
- }
958
- else if (!path) result = {
952
+ } else if (type === "config") {
953
+ if (!path) result = {
954
+ success: false,
955
+ errors: ["Path is required for config file update"]
956
+ };
957
+ else {
958
+ const resolved = resolveFilePath(path);
959
+ if (!await fs.exists(resolved)) result = {
960
+ success: false,
961
+ errors: [`File not found: ${path}`]
962
+ };
963
+ else {
964
+ await fs.writeFile(resolved, content || "");
965
+ result = {
966
+ success: true,
967
+ updated: [path]
968
+ };
969
+ }
970
+ }
971
+ } else if (!path) result = {
959
972
  success: false,
960
973
  errors: ["Path is required for file update"]
961
974
  };
@@ -1001,24 +1014,25 @@ export default definePlugin({
1001
1014
  });
1002
1015
  try {
1003
1016
  let result;
1004
- if (type === "env") if (!key) result = {
1005
- success: false,
1006
- errors: ["Key is required for env delete"]
1007
- };
1008
- else if (!setEnv || !getEnv) result = {
1009
- success: false,
1010
- errors: ["Env not available"]
1011
- };
1012
- else {
1013
- const env = { ...getEnv() };
1014
- delete env[key];
1015
- setEnv(env);
1016
- result = {
1017
- success: true,
1018
- deleted: [`env:${key}`]
1017
+ if (type === "env") {
1018
+ if (!key) result = {
1019
+ success: false,
1020
+ errors: ["Key is required for env delete"]
1019
1021
  };
1020
- }
1021
- else if (!path) result = {
1022
+ else if (!setEnv || !getEnv) result = {
1023
+ success: false,
1024
+ errors: ["Env not available"]
1025
+ };
1026
+ else {
1027
+ const env = { ...getEnv() };
1028
+ delete env[key];
1029
+ setEnv(env);
1030
+ result = {
1031
+ success: true,
1032
+ deleted: [`env:${key}`]
1033
+ };
1034
+ }
1035
+ } else if (!path) result = {
1022
1036
  success: false,
1023
1037
  errors: ["Path is required for file delete"]
1024
1038
  };
@@ -1301,14 +1315,14 @@ function createTerminalServer() {
1301
1315
  };
1302
1316
  }
1303
1317
  //#endregion
1304
- //#region ../../node_modules/.pnpm/devframe@0.7.15_cac@7.0.0_srvx@0.12.4_typescript@6.0.3/node_modules/devframe/dist/define-BLWPsH6y.mjs
1318
+ //#region ../../node_modules/.pnpm/devframe@0.8.2_cac@7.0.0_srvx@0.12.5/node_modules/devframe/dist/define-BLWPsH6y.mjs
1305
1319
  function createDefineWrapperWithContext() {
1306
1320
  return function defineRpcFunctionWithContext(definition) {
1307
1321
  return definition;
1308
1322
  };
1309
1323
  }
1310
1324
  //#endregion
1311
- //#region ../../node_modules/.pnpm/@vitejs+devtools-kit@0.4.10_@voidzero-dev+vite-plus-core@0.2.6_cac@7.0.0_srvx@0.12.4_typescript@6.0.3/node_modules/@vitejs/devtools-kit/dist/index.js
1325
+ //#region ../../node_modules/.pnpm/@vitejs+devtools-kit@0.4.12_@voidzero-dev+vite-plus-core@0.2.9_cac@7.0.0_srvx@0.12.5/node_modules/@vitejs/devtools-kit/dist/index.js
1312
1326
  const defineRpcFunction = createDefineWrapperWithContext();
1313
1327
  //#endregion
1314
1328
  //#region src/node/rpc/ai.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/devtools",
3
- "version": "0.1.13",
3
+ "version": "0.2.0",
4
4
  "description": "DevTools for the ubean framework — server middleware, RPC, and the iframe SPA client",
5
5
  "files": [
6
6
  "dist"
@@ -16,40 +16,38 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@ai-sdk/openai-compatible": "3.0.16",
20
- "ai": "7.0.40",
21
19
  "hookable": "^6.1.1",
22
20
  "pathe": "^2.0.3"
23
21
  },
24
22
  "devDependencies": {
25
- "@codemirror/commands": "^6.10.4",
23
+ "@codemirror/commands": "^6.11.0",
26
24
  "@codemirror/lang-javascript": "6.2.5",
27
25
  "@codemirror/lang-json": "6.0.2",
28
26
  "@codemirror/lang-vue": "^0.1.3",
29
27
  "@codemirror/language": "6.12.4",
30
28
  "@codemirror/state": "6.7.1",
31
29
  "@codemirror/theme-one-dark": "6.1.3",
32
- "@codemirror/view": "6.43.7",
30
+ "@codemirror/view": "6.43.9",
33
31
  "@soybeanjs/ui": "^0.29.3",
34
32
  "@soybeanjs/unocss-preset": "^0.2.0",
35
33
  "@soybeanjs/unocss-shadcn": "^0.29.3",
36
- "@types/node": "^26.1.2",
37
- "@vitejs/devtools": "^0.4.9",
38
- "@vitejs/devtools-kit": "^0.4.9",
34
+ "@types/node": "^26.2.0",
35
+ "@vitejs/devtools": "^0.4.12",
36
+ "@vitejs/devtools-kit": "^0.4.12",
39
37
  "@vitejs/plugin-vue": "^6.0.8",
40
38
  "@xterm/addon-fit": "^0.11.0",
41
39
  "@xterm/xterm": "^6.0.0",
42
- "hono": "4.12.32",
40
+ "hono": "4.13.2",
43
41
  "typescript": "7.0.2",
44
42
  "unocss": "^66.7.5",
45
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.6",
46
- "vite-plus": "0.2.6",
47
- "vue": "^3.5.40"
43
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.2.9",
44
+ "vite-plus": "0.2.9",
45
+ "vue": "^3.5.41"
48
46
  },
49
47
  "peerDependencies": {
50
48
  "hono": "^4.0.0",
51
49
  "vue": "^3.0.0",
52
- "ubean": "0.1.13"
50
+ "ubean": "0.2.0"
53
51
  },
54
52
  "peerDependenciesMeta": {
55
53
  "hono": {
@@ -59,7 +57,10 @@
59
57
  "optional": true
60
58
  }
61
59
  },
62
- "optionalDependencies": {},
60
+ "optionalDependencies": {
61
+ "@ai-sdk/openai-compatible": "3.0.30",
62
+ "ai": "7.0.66"
63
+ },
63
64
  "scripts": {
64
65
  "build": "pnpm run build:server && pnpm run build:client",
65
66
  "build:client": "node scripts/build-client.mjs",