huaweicloud-devkit 1.1.14-next.2 → 1.1.14-next.3

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/README.md CHANGED
@@ -14,7 +14,7 @@ Supports OpenCode, Codex, CodeArts Agent, WorkBuddy, DeepSeek Harness (DSH), Off
14
14
 
15
15
  ## Prerequisites
16
16
 
17
- - Node.js >= 22
17
+ - Node.js >= 22.19 (Node 23 requires 23.4+)
18
18
 
19
19
  > **China mainland users**: If you experience slow downloads or connection issues with the default npm registry, configure the Huawei Cloud npm mirror:
20
20
  >
package/README.zh-CN.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  ## 前置条件
16
16
 
17
- - Node.js >= 22
17
+ - Node.js >= 22.19(Node 23 请使用 23.4+)
18
18
 
19
19
  > **国内用户**:使用默认 npm 镜像时可能遇到下载缓慢或连接失败的问题,建议配置华为云 npm 镜像:
20
20
  >
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
3
  "mcpName": "io.github.huaweicloud/huaweicloud-devkit",
4
- "version": "1.1.14-next.2",
4
+ "version": "1.1.14-next.3",
5
5
  "kooCliVersion": "7.3.12",
6
6
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
7
7
  "type": "module",
@@ -81,6 +81,6 @@
81
81
  ],
82
82
  "license": "Apache-2.0",
83
83
  "engines": {
84
- "node": ">=22"
84
+ "node": "^22.19.0 || >=23.4.0"
85
85
  }
86
86
  }
@@ -17,7 +17,7 @@
17
17
  "mcpServers": "./.mcp.json",
18
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
19
  "skills": "./skills/",
20
- "version": "1.1.14-next.2",
20
+ "version": "1.1.14-next.3",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -20,7 +20,7 @@
20
20
  "mcpServers": "./.mcp.json",
21
21
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
22
22
  "skills": "./skills/",
23
- "version": "1.1.14-next.2",
23
+ "version": "1.1.14-next.3",
24
24
  "author": {
25
25
  "name": "HuaweiCloud Mate",
26
26
  "url": "https://github.com/huaweicloud"
@@ -17,7 +17,7 @@
17
17
  "mcpServers": "./.mcp.json",
18
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
19
  "skills": "./skills/",
20
- "version": "1.1.14-next.2",
20
+ "version": "1.1.14-next.3",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.14-next.2",
3
+ "version": "1.1.14-next.3",
4
4
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
5
5
  "author": {
6
6
  "name": "HuaweiCloud Mate",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.14-next.2",
3
+ "version": "1.1.14-next.3",
4
4
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
5
5
  "author": {
6
6
  "name": "HuaweiCloud Mate",
@@ -2,7 +2,7 @@
2
2
  "name": "huaweicloud-devkit",
3
3
  "id": "huaweicloud-devkit",
4
4
  "displayName": "HuaweiCloud DevKit",
5
- "version": "1.1.14-next.2",
5
+ "version": "1.1.14-next.3",
6
6
  "family": "bundle-plugin",
7
7
  "bundleFormat": "codex",
8
8
  "description": "Guide coding agents to use Huawei Cloud safely — KooCLI, APIs, SDKs, 28 MCP tools, skills, and safety guardrails.",
@@ -0,0 +1,54 @@
1
+ import { createRequire } from 'node:module';
2
+
3
+ const NODE_FLOORS = [
4
+ { major: 22, minor: 19 },
5
+ { major: 23, minor: 4 },
6
+ ];
7
+
8
+ export function parseNodeVersion(version = process.versions.node) {
9
+ const [major, minor] = String(version).replace(/^v/, '').split('.').map(Number);
10
+ return { major, minor };
11
+ }
12
+
13
+ export function isSupportedNode(version = process.versions.node) {
14
+ const { major, minor } = parseNodeVersion(version);
15
+ if (major > NODE_FLOORS[NODE_FLOORS.length - 1].major) return true;
16
+ const floor = NODE_FLOORS.find((entry) => entry.major === major);
17
+ return floor ? minor >= floor.minor : false;
18
+ }
19
+
20
+ function displayVersion(version) {
21
+ return String(version).startsWith('v') ? String(version) : `v${version}`;
22
+ }
23
+
24
+ export function sqliteGuidance(version = process.versions.node) {
25
+ const current = displayVersion(version);
26
+ if (!isSupportedNode(version)) {
27
+ return `Node.js >= 22.19 (or >= 23.4.0) is required for the OfficeAce integration (current: ${current}).`;
28
+ }
29
+ return `node:sqlite failed to load on Node ${current}. Please upgrade Node.js or report this issue.`;
30
+ }
31
+
32
+ function sqliteUnavailable() {
33
+ const error = new Error(sqliteGuidance());
34
+ error.code = 'HCDEVKIT_SQLITE_UNAVAILABLE';
35
+ return error;
36
+ }
37
+
38
+ let sqliteModule;
39
+
40
+ export function loadSqliteModule() {
41
+ if (sqliteModule) return sqliteModule;
42
+ try {
43
+ const candidate = createRequire(import.meta.url)('node:sqlite');
44
+ if (!candidate || typeof candidate.DatabaseSync !== 'function') {
45
+ throw sqliteUnavailable();
46
+ }
47
+ sqliteModule = candidate;
48
+ return candidate;
49
+ } catch (error) {
50
+ if (error?.code === 'HCDEVKIT_SQLITE_UNAVAILABLE') throw error;
51
+ if (error?.code === 'ERR_UNKNOWN_BUILTIN_MODULE') throw sqliteUnavailable();
52
+ throw error;
53
+ }
54
+ }
@@ -15,7 +15,6 @@ import { homedir, platform, tmpdir } from 'node:os';
15
15
  import { createInterface } from 'node:readline';
16
16
  import { spawnSync } from 'node:child_process';
17
17
  import { randomUUID } from 'node:crypto';
18
- import { createRequire } from 'node:module';
19
18
 
20
19
  import { getAuthStatus, syncAuth } from './auth/service.mjs';
21
20
  import { resolveAndApplyProjectId } from './auth/project-id.mjs';
@@ -48,12 +47,11 @@ import {
48
47
  } from './mcp-config-merge.mjs';
49
48
  import { readAgentDelta, saveAgentDelta, takeAgentDelta, purgeBackup } from './mcp-config-backup.mjs';
50
49
  import { isUsableOfficeaceRoot, readOfficeaceRootMarker, writeOfficeaceRootMarker } from './officeace-paths.mjs';
50
+ import { isSupportedNode, loadSqliteModule } from './node-runtime.mjs';
51
51
  import { queryDistTagsFetch, determineTarget, semverCompare } from './update-check.mjs';
52
52
  import { getKooCliVersion, compareVersion, kooCliDownloadBase, KOO_CLI_BASE } from './koocli-version.mjs';
53
53
  import { findHcloudBin, hcloudProbeNextStep, probeHcloud } from './hcloud-probe.mjs';
54
54
 
55
- const { DatabaseSync } = createRequire(import.meta.url)('node:sqlite');
56
-
57
55
  const __dirname = dirname(fileURLToPath(import.meta.url));
58
56
  const PLUGIN_ROOT = resolve(__dirname, '..');
59
57
  const PACKAGE_ROOT = resolve(PLUGIN_ROOT, '..', '..');
@@ -250,11 +248,13 @@ function officeaceSqlitePath() {
250
248
  }
251
249
 
252
250
  function openOfficeaceDb() {
251
+ const { DatabaseSync } = loadSqliteModule();
253
252
  return new DatabaseSync(officeaceSqlitePath());
254
253
  }
255
254
 
256
255
  function officeaceGetOwnerUserId() {
257
256
  if (!existsSync(officeaceSqlitePath())) return null;
257
+ loadSqliteModule();
258
258
  try {
259
259
  const db = openOfficeaceDb();
260
260
  const row = db.prepare('SELECT owner_user_id FROM mcp_connectors WHERE owner_user_id IS NOT NULL LIMIT 1').get();
@@ -394,7 +394,11 @@ function removeOfficeaceMcpFromSqlite() {
394
394
  db.close();
395
395
  } catch {}
396
396
  }
397
- console.log(` \x1b[31mFailed to remove MCP config: ${error.message}\x1b[0m`);
397
+ if (error?.code === 'HCDEVKIT_SQLITE_UNAVAILABLE') {
398
+ console.log(` \x1b[33mOfficeAce connector row not removed: ${error.message}\x1b[0m`);
399
+ } else {
400
+ console.log(` \x1b[31mFailed to remove MCP config: ${error.message}\x1b[0m`);
401
+ }
398
402
  }
399
403
  }
400
404
 
@@ -505,9 +509,8 @@ function printSandboxWarning(reason) {
505
509
  }
506
510
 
507
511
  function checkNode() {
508
- const v = process.versions.node.split('.').map(Number);
509
- if (v[0] < 22) {
510
- console.error(`\x1b[31mNode.js >= 22 required (current: ${process.version})\x1b[0m`);
512
+ if (!isSupportedNode(process.versions.node)) {
513
+ console.error(`\x1b[31mNode.js >= 22.19 required (Node 23 requires 23.4+) (current: ${process.version})\x1b[0m`);
511
514
  process.exit(1);
512
515
  }
513
516
  console.log(` Node.js ${process.version} \x1b[32mOK\x1b[0m`);
@@ -2526,6 +2529,7 @@ async function installOfficeAce() {
2526
2529
  return;
2527
2530
  }
2528
2531
  }
2532
+ if (existsSync(officeaceSqlitePath())) loadSqliteModule();
2529
2533
  const skillsSrc = join(PLUGIN_ROOT, 'skills');
2530
2534
  const srcDir = join(PLUGIN_ROOT, 'src');
2531
2535
  const safetyDir = join(PLUGIN_ROOT, 'safety');
@@ -2555,6 +2559,7 @@ async function installOfficeAce() {
2555
2559
  }
2556
2560
 
2557
2561
  async function updateOfficeAce() {
2562
+ if (existsSync(officeaceSqlitePath())) loadSqliteModule();
2558
2563
  const skillsSrc = join(PLUGIN_ROOT, 'skills');
2559
2564
  const srcDir = join(PLUGIN_ROOT, 'src');
2560
2565
  const safetyDir = join(PLUGIN_ROOT, 'safety');
@@ -2637,8 +2642,12 @@ function officeaceStatus() {
2637
2642
  } else {
2638
2643
  console.log(` MCP config: \x1b[31mNot configured\x1b[0m`);
2639
2644
  }
2640
- } catch {
2641
- console.log(` MCP config: \x1b[31mInvalid\x1b[0m`);
2645
+ } catch (error) {
2646
+ if (error?.code === 'HCDEVKIT_SQLITE_UNAVAILABLE') {
2647
+ console.log(` MCP config: \x1b[33mUnavailable\x1b[0m — ${error.message}`);
2648
+ } else {
2649
+ console.log(` MCP config: \x1b[31mInvalid\x1b[0m`);
2650
+ }
2642
2651
  }
2643
2652
  } else {
2644
2653
  console.log(` MCP config: \x1b[31mDatabase not found\x1b[0m`);
@@ -4010,7 +4019,11 @@ async function cmdDoctor() {
4010
4019
  }
4011
4020
 
4012
4021
  // Node.js
4013
- check('Node.js >= 22', process.versions.node.split('.')[0] >= 22, 'Run: nvm install 22 && nvm use 22');
4022
+ check(
4023
+ 'Node.js >= 22.19',
4024
+ isSupportedNode(process.versions.node),
4025
+ 'Install Node.js >= 22.19 (Node 23 requires 23.4+)',
4026
+ );
4014
4027
 
4015
4028
  // MCP server — check OpenCode, Codex Desktop, CodeArts, WorkBuddy, and DSH paths
4016
4029
  const opencodePluginDir = opencodePluginsDir();
@@ -4347,6 +4360,7 @@ async function cmdDoctor() {
4347
4360
  async function cmdUpdate() {
4348
4361
  console.log(BANNER);
4349
4362
  const target = parseTarget();
4363
+ checkNode();
4350
4364
  await checkForUpdate();
4351
4365
 
4352
4366
  if (target === 'opencode') {