huaweicloud-devkit 1.1.10-next.5 → 1.1.10-next.6

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/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.10-next.5",
4
+ "version": "1.1.10-next.6",
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",
@@ -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.10-next.5",
20
+ "version": "1.1.10-next.6",
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.10-next.5",
23
+ "version": "1.1.10-next.6",
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.10-next.5",
20
+ "version": "1.1.10-next.6",
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.10-next.5",
3
+ "version": "1.1.10-next.6",
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.10-next.5",
3
+ "version": "1.1.10-next.6",
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.10-next.5",
5
+ "version": "1.1.10-next.6",
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.",
@@ -111,6 +111,18 @@ export function classifyHcloudProbe(result, requiredVersion = getKooCliVersion()
111
111
  };
112
112
  }
113
113
 
114
+ // Probe timed out / was signal-killed: we can't tell whether hcloud is truly
115
+ // broken or just slow on this box — report unknown instead of unavailable so
116
+ // the caller doesn't falsely conclude "CLI not installed" (#P0-2).
117
+ if (result.signal || result.status === null || result.error?.code === 'ETIMEDOUT') {
118
+ return {
119
+ status: 'unknown',
120
+ installed: false,
121
+ ok: false,
122
+ errorCode: 'HCLOUD_UNKNOWN',
123
+ };
124
+ }
125
+
114
126
  return {
115
127
  status: 'unavailable',
116
128
  installed: false,
@@ -87,17 +87,23 @@ export function getCredentials() {
87
87
  // Data-plane (sandbox exec/upload/tunnel) credentials: prefer AK/SK, else fall
88
88
  // back to X-Auth-Token → temporary AK/SK, so token-auth users can drive the data
89
89
  // plane without a permanent AK/SK (experience-report #3.3/#3.7 dead-loop fix).
90
+ // NOTE: returns `securitytoken` (lowercase t) — the call sites (session-manager,
91
+ // tools.mjs) destructure that exact spelling; returning `securityToken` here
92
+ // silently drops the STS token from the hwlink signature (APIGW.0301).
90
93
  export async function resolveBackendCredentials() {
91
94
  try {
92
95
  const creds = resolveCredentialsWithRuntime({ allowMissing: true });
93
- if (creds && creds.ak && creds.sk) return creds;
96
+ if (creds && creds.ak && creds.sk) {
97
+ return { ak: creds.ak, sk: creds.sk, securitytoken: creds.securityToken || '' };
98
+ }
94
99
  } catch {
95
100
  // no AK/SK — fall through to token
96
101
  }
97
102
  const token = resolveXAuthToken();
98
103
  if (token) {
99
104
  try {
100
- return await getTokenCredentials(token);
105
+ const temp = await getTokenCredentials(token);
106
+ return { ak: temp.ak, sk: temp.sk, securitytoken: temp.securityToken || '' };
101
107
  } catch (error) {
102
108
  // Distinguish "token exchange failed" from "no credential at all" (#3.4).
103
109
  const err = makeError('HDKIT_CRED_MISSING');
@@ -1073,7 +1073,9 @@ function readImportFile() {
1073
1073
  const path = join(dirname(globalCredentialsPath()), 'creds-import.json');
1074
1074
  try {
1075
1075
  if (!existsSync(path)) return null;
1076
- const data = JSON.parse(readFileSync(path, 'utf8'));
1076
+ // Strip a leading UTF-8 BOM: PowerShell `Set-Content -Encoding UTF8` writes
1077
+ // one, which plain JSON.parse rejects (#devkit-体验报告 P1-4).
1078
+ const data = JSON.parse(readFileSync(path, 'utf8').replace(/^\uFEFF/, ''));
1077
1079
  return {
1078
1080
  ak: String(data.ak || ''),
1079
1081
  sk: String(data.sk || ''),
@@ -1295,6 +1297,11 @@ export async function callTool(name, rawArgs = {}, opts = {}) {
1295
1297
  }
1296
1298
 
1297
1299
  if (!ak || !sk) {
1300
+ if (sourceChannel === 'import') {
1301
+ throw new Error(
1302
+ 'ak and sk are required. creds-import.json 缺失或无法解析(可能带 UTF-8 BOM 或非法 JSON),解析失败时文件已被清除。请用无 BOM 的 UTF-8 JSON 重新写入后重试 mode=import(PowerShell 推荐 [IO.File]::WriteAllText 配 UTF8Encoding($false))。',
1303
+ );
1304
+ }
1298
1305
  throw new Error('ak and sk are required (or provide creds-import.json for mode=import).');
1299
1306
  }
1300
1307