huaweicloud-devkit 1.1.14-next.0 → 1.1.14-next.1

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.14-next.0",
4
+ "version": "1.1.14-next.1",
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",
@@ -5,7 +5,10 @@
5
5
  "longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
6
6
  "developerName": "HuaweiCloud Mate",
7
7
  "category": "Cloud",
8
- "capabilities": ["Read", "Interactive"],
8
+ "capabilities": [
9
+ "Read",
10
+ "Interactive"
11
+ ],
9
12
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
13
  "brandColor": "#C7000B",
11
14
  "defaultPrompt": [
@@ -17,7 +20,7 @@
17
20
  "mcpServers": "./.mcp.json",
18
21
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
22
  "skills": "./skills/",
20
- "version": "1.1.14-next.0",
23
+ "version": "1.1.14-next.1",
21
24
  "author": {
22
25
  "name": "HuaweiCloud Mate",
23
26
  "url": "https://github.com/huaweicloud"
@@ -27,5 +30,15 @@
27
30
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
28
31
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
29
32
  "license": "Apache-2.0",
30
- "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
33
+ "keywords": [
34
+ "huaweicloud",
35
+ "huawei-cloud",
36
+ "koocli",
37
+ "hcloud",
38
+ "agent",
39
+ "mcp",
40
+ "api",
41
+ "sdk",
42
+ "skills"
43
+ ]
31
44
  }
@@ -2,7 +2,10 @@
2
2
  "interface": {
3
3
  "shortDescription": "HuaweiCloud DevKit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
4
4
  "developerName": "HuaweiCloud Mate",
5
- "capabilities": ["Read", "Interactive"],
5
+ "capabilities": [
6
+ "Read",
7
+ "Interactive"
8
+ ],
6
9
  "brandColor": "#C7000B",
7
10
  "composerIcon": "./assets/icon.png",
8
11
  "logo": "./assets/logo.png",
@@ -20,7 +23,7 @@
20
23
  "mcpServers": "./.mcp.json",
21
24
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
22
25
  "skills": "./skills/",
23
- "version": "1.1.14-next.0",
26
+ "version": "1.1.14-next.1",
24
27
  "author": {
25
28
  "name": "HuaweiCloud Mate",
26
29
  "url": "https://github.com/huaweicloud"
@@ -29,5 +32,15 @@
29
32
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
30
33
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
31
34
  "license": "Apache-2.0",
32
- "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
35
+ "keywords": [
36
+ "huaweicloud",
37
+ "huawei-cloud",
38
+ "koocli",
39
+ "hcloud",
40
+ "agent",
41
+ "mcp",
42
+ "api",
43
+ "sdk",
44
+ "skills"
45
+ ]
33
46
  }
@@ -5,7 +5,10 @@
5
5
  "longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
6
6
  "developerName": "HuaweiCloud Mate",
7
7
  "category": "Cloud",
8
- "capabilities": ["Read", "Interactive"],
8
+ "capabilities": [
9
+ "Read",
10
+ "Interactive"
11
+ ],
9
12
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
13
  "brandColor": "#C7000B",
11
14
  "defaultPrompt": [
@@ -17,7 +20,7 @@
17
20
  "mcpServers": "./.mcp.json",
18
21
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
22
  "skills": "./skills/",
20
- "version": "1.1.14-next.0",
23
+ "version": "1.1.14-next.1",
21
24
  "author": {
22
25
  "name": "HuaweiCloud Mate",
23
26
  "url": "https://github.com/huaweicloud"
@@ -27,5 +30,15 @@
27
30
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
28
31
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
29
32
  "license": "Apache-2.0",
30
- "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
33
+ "keywords": [
34
+ "huaweicloud",
35
+ "huawei-cloud",
36
+ "koocli",
37
+ "hcloud",
38
+ "agent",
39
+ "mcp",
40
+ "api",
41
+ "sdk",
42
+ "skills"
43
+ ]
31
44
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.14-next.0",
3
+ "version": "1.1.14-next.1",
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",
@@ -9,7 +9,17 @@
9
9
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
10
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
11
11
  "license": "Apache-2.0",
12
- "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
12
+ "keywords": [
13
+ "huaweicloud",
14
+ "huawei-cloud",
15
+ "koocli",
16
+ "hcloud",
17
+ "agent",
18
+ "mcp",
19
+ "api",
20
+ "sdk",
21
+ "skills"
22
+ ],
13
23
  "skills": "./skills/",
14
24
  "mcpServers": "./.mcp.json",
15
25
  "interface": {
@@ -18,7 +28,10 @@
18
28
  "longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
19
29
  "developerName": "HuaweiCloud Mate",
20
30
  "category": "Cloud",
21
- "capabilities": ["Read", "Interactive"],
31
+ "capabilities": [
32
+ "Read",
33
+ "Interactive"
34
+ ],
22
35
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
23
36
  "brandColor": "#C7000B",
24
37
  "defaultPrompt": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.14-next.0",
3
+ "version": "1.1.14-next.1",
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",
@@ -9,7 +9,17 @@
9
9
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
10
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
11
11
  "license": "Apache-2.0",
12
- "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
12
+ "keywords": [
13
+ "huaweicloud",
14
+ "huawei-cloud",
15
+ "koocli",
16
+ "hcloud",
17
+ "agent",
18
+ "mcp",
19
+ "api",
20
+ "sdk",
21
+ "skills"
22
+ ],
13
23
  "skills": "./skills/",
14
24
  "mcpServers": "./.mcp.json",
15
25
  "interface": {
@@ -18,7 +28,10 @@
18
28
  "longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
19
29
  "developerName": "HuaweiCloud Mate",
20
30
  "category": "Cloud",
21
- "capabilities": ["Read", "Interactive"],
31
+ "capabilities": [
32
+ "Read",
33
+ "Interactive"
34
+ ],
22
35
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
23
36
  "brandColor": "#C7000B",
24
37
  "defaultPrompt": [
@@ -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.0",
5
+ "version": "1.1.14-next.1",
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.",
@@ -12,6 +12,7 @@ import { dirname, join } from 'node:path';
12
12
  import { homedir } from 'node:os';
13
13
 
14
14
  import { buildOnboardingSteps, makeError } from './guidance.mjs';
15
+ import { getTokenCredentials } from './token-exchange.mjs';
15
16
 
16
17
  // Verify a credential file ended up with 0600. On Windows-mounted drives inside WSL
17
18
  // (drvfs/9p) chmod is silently ignored, so the file can be world-readable (0777).
@@ -400,6 +401,31 @@ export function resolveCredentialsWithRuntime(options = {}) {
400
401
  return resolveCredentials(options);
401
402
  }
402
403
 
404
+ // Token warm-up (#token-fullchain): when NO AK/SK is resolvable but an
405
+ // X-Auth-Token exists (env / mcp_settings), exchange it for temporary AK/SK
406
+ // via IAM securitytokens and cache the result as runtime credentials
407
+ // (priority 1). This makes every SYNC consumer downstream (hcloud STS
408
+ // injection, devbridge-key getCredentials, OBS signing) work for token-only
409
+ // users without any per-callsite async migration. Never throws; failures are
410
+ // swallowed so downstream error handling reports the real cause.
411
+ export async function warmTokenCredentials() {
412
+ try {
413
+ const creds = resolveCredentialsWithRuntime({ allowMissing: true });
414
+ if (creds && creds.ak && creds.sk) return false; // AK/SK already available — no-op
415
+ const token = resolveXAuthToken();
416
+ if (!token) return false; // nothing to warm from
417
+ const sts = await getTokenCredentials(token);
418
+ if (sts && sts.ak && sts.sk) {
419
+ setRuntimeCredentials(sts.ak, sts.sk, sts.securityToken || '', sts.region || '');
420
+ return true;
421
+ }
422
+ } catch {
423
+ // exchange failure (invalid/expired token, network) — leave state as-is;
424
+ // downstream HDKIT_CRED_MISSING / TOKEN_EXCHANGE_FAILED carries the detail.
425
+ }
426
+ return false;
427
+ }
428
+
403
429
  export function resolveXAuthToken() {
404
430
  const envToken = process.env.HW_X_AUTH_TOKEN;
405
431
  if (present(envToken)) return envToken;
@@ -10,6 +10,7 @@ import { resolveHcloudCommand } from './hcloud-probe.mjs';
10
10
  import {
11
11
  parseStsExpiry,
12
12
  resolveCredentialsWithRuntime,
13
+ warmTokenCredentials,
13
14
  resolveXAuthToken,
14
15
  resolveXAuthTokenExpiry,
15
16
  } from './auth/credentials.mjs';
@@ -472,6 +473,11 @@ export async function runHcloud(args, options = {}) {
472
473
  };
473
474
  assertAllowed(plan.classification);
474
475
 
476
+ // Token-only users: warm X-Auth-Token → runtime STS BEFORE any sync
477
+ // credential reads (isTemporaryStsExpired / resolveStsInjectArgs) so the
478
+ // hcloud path works without permanent AK/SK. No-op when AK/SK present.
479
+ await warmTokenCredentials();
480
+
475
481
  // A: fail fast when the platform-injected temporary STS is already expired —
476
482
  // otherwise hcloud would make a doomed IAM round trip and surface a misleading
477
483
  // error (e.g. "缺少 cli-domain-id"). Permanent AK/SK are unaffected.
@@ -20,6 +20,7 @@ import { createHash } from 'node:crypto';
20
20
 
21
21
  import { hdkitCreateApiKey, hdkitListApiKeys, hdkitDeleteApiKey } from './hdkitservice-api.mjs';
22
22
  import { getCredentials } from './hwlink-api.mjs';
23
+ import { warmTokenCredentials } from '../auth/credentials.mjs';
23
24
 
24
25
  const POOL_KEY_NAMES = {
25
26
  ephemeral: 'devkit-ephemeral',
@@ -97,6 +98,10 @@ export function clearCachedKey(ak, poolType) {
97
98
  * @throws Error 配额满(code=HDKIT_DEVBRIDGE_KEY_QUOTA_EXCEEDED)或上游错误
98
99
  */
99
100
  export async function ensureDevbridgeKey(poolType) {
101
+ // Token-only users: exchange X-Auth-Token → runtime STS first, so the sync
102
+ // getCredentials() below succeeds (it throws HDKIT_CRED_MISSING otherwise,
103
+ // which blocked the whole auto-create fallback for token-auth users).
104
+ await warmTokenCredentials();
100
105
  const { ak } = getCredentials();
101
106
  const pool = POOL_KEY_NAMES[poolType] ? poolType : DEFAULT_POOL;
102
107
  const name = keyNameForPool(pool);
@@ -132,6 +137,7 @@ export async function ensureDevbridgeKey(poolType) {
132
137
  * 由沙箱内 devbridge auth login 失败触发。
133
138
  */
134
139
  export async function recreateDevbridgeKey(poolType) {
140
+ await warmTokenCredentials();
135
141
  const { ak } = getCredentials();
136
142
  clearCachedKey(ak, poolType);
137
143
  return ensureDevbridgeKey(poolType);
@@ -64,6 +64,7 @@ import {
64
64
  globalCredentialsPath,
65
65
  parseStsExpiry,
66
66
  resolveCredentialsWithRuntime,
67
+ warmTokenCredentials,
67
68
  } from './auth/credentials.mjs';
68
69
  import { trackToolInvoke, trackSkillRetrieve, clearUserHash, cacheUserHash } from './telemetry/telemetry.mjs';
69
70
  import { fetchWithProxy } from './proxy/proxy-agent.mjs';
@@ -1319,10 +1320,24 @@ function normalizeNumericArgs(args) {
1319
1320
  return out;
1320
1321
  }
1321
1322
 
1323
+ // Auth-state tools report user intent; warming would mask the real credential
1324
+ // state (runtime would show the exchanged STS instead of token-auth).
1325
+ const NO_WARM_TOOLS = new Set([
1326
+ 'huaweicloud_auth_status',
1327
+ 'huaweicloud_auth_init',
1328
+ 'huaweicloud_auth_switch',
1329
+ 'huaweicloud_auth_sync',
1330
+ 'huaweicloud_show_profile_redacted',
1331
+ 'huaweicloud_explain_error',
1332
+ ]);
1333
+
1322
1334
  export async function callTool(name, rawArgs = {}, opts = {}) {
1323
1335
  const args = normalizeNumericArgs(rawArgs);
1324
1336
  const toolValue = toolInvokeValue(name, args);
1325
1337
  trackToolInvoke(name, toolValue);
1338
+ if (!NO_WARM_TOOLS.has(name)) {
1339
+ await warmTokenCredentials(); // no-op with AK/SK; token→STS for token-only users
1340
+ }
1326
1341
 
1327
1342
  switch (name) {
1328
1343
  case 'huaweicloud_check_cli':