huaweicloud-devkit 2.0.0-next.4 → 2.0.0-next.5

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.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +3 -16
  3. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +3 -16
  4. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +3 -16
  5. package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +3 -16
  6. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +3 -16
  7. package/plugins/huaweicloud-core/dist/explain-error.js +9 -1
  8. package/plugins/huaweicloud-core/dist/hcloud-plan.js +6 -1
  9. package/plugins/huaweicloud-core/dist/lib/hdkit/hdkitservice-api.js +18 -9
  10. package/plugins/huaweicloud-core/dist/mcp-server.js +435 -282
  11. package/plugins/huaweicloud-core/dist/mcp-server.js.map +4 -4
  12. package/plugins/huaweicloud-core/dist/packs/registry.js +1 -0
  13. package/plugins/huaweicloud-core/dist/packs/sandbox/expose-task.js +71 -0
  14. package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-account.js +25 -1
  15. package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-tunnel.js +28 -3
  16. package/plugins/huaweicloud-core/dist/packs/sandbox/schemas.js +14 -0
  17. package/plugins/huaweicloud-core/dist/packs/sandbox/tools.js +11 -3
  18. package/plugins/huaweicloud-core/dist/risk-rule-engine.js +20 -4
  19. package/plugins/huaweicloud-core/dist/safety/classify-hcloud.js +6 -6
  20. package/plugins/huaweicloud-core/dist/safety/redact.js +21 -3
  21. package/plugins/huaweicloud-core/dist/safety/risk-merge.js +24 -4
  22. package/plugins/huaweicloud-core/dist/sandbox/devbridge-cleanup.js +1 -1
  23. package/plugins/huaweicloud-core/dist/tool-definitions.js +4 -0
  24. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +14 -1
  25. package/plugins/huaweicloud-core/openclaw.plugin.json +2 -2
  26. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +1 -1
  27. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +42 -39
  28. package/plugins/huaweicloud-core/src/explain-error.ts +9 -1
  29. package/plugins/huaweicloud-core/src/hcloud-plan.ts +6 -1
  30. package/plugins/huaweicloud-core/src/lib/hdkit/hdkitservice-api.ts +32 -1
  31. package/plugins/huaweicloud-core/src/packs/registry.ts +1 -0
  32. package/plugins/huaweicloud-core/src/packs/sandbox/expose-task.ts +105 -0
  33. package/plugins/huaweicloud-core/src/packs/sandbox/handlers-account.ts +28 -1
  34. package/plugins/huaweicloud-core/src/packs/sandbox/handlers-tunnel.ts +41 -15
  35. package/plugins/huaweicloud-core/src/packs/sandbox/schemas.ts +20 -0
  36. package/plugins/huaweicloud-core/src/packs/sandbox/tools.ts +12 -2
  37. package/plugins/huaweicloud-core/src/risk-rule-engine.ts +20 -7
  38. package/plugins/huaweicloud-core/src/safety/classify-hcloud.ts +28 -16
  39. package/plugins/huaweicloud-core/src/safety/redact.ts +24 -6
  40. package/plugins/huaweicloud-core/src/safety/risk-merge.ts +26 -5
  41. package/plugins/huaweicloud-core/src/sandbox/devbridge-cleanup.ts +7 -5
  42. package/plugins/huaweicloud-core/src/tool-definitions.ts +4 -0
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": "2.0.0-next.4",
4
+ "version": "2.0.0-next.5",
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,10 +5,7 @@
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": [
9
- "Read",
10
- "Interactive"
11
- ],
8
+ "capabilities": ["Read", "Interactive"],
12
9
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
13
10
  "brandColor": "#C7000B",
14
11
  "defaultPrompt": [
@@ -19,7 +16,7 @@
19
16
  },
20
17
  "mcpServers": "./.mcp.json",
21
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
22
- "version": "2.0.0-next.4",
19
+ "version": "2.0.0-next.5",
23
20
  "author": {
24
21
  "name": "HuaweiCloud Mate",
25
22
  "url": "https://github.com/huaweicloud"
@@ -29,15 +26,5 @@
29
26
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
30
27
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
31
28
  "license": "Apache-2.0",
32
- "keywords": [
33
- "huaweicloud",
34
- "huawei-cloud",
35
- "koocli",
36
- "hcloud",
37
- "agent",
38
- "mcp",
39
- "api",
40
- "sdk",
41
- "skills"
42
- ]
29
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
43
30
  }
@@ -2,10 +2,7 @@
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": [
6
- "Read",
7
- "Interactive"
8
- ],
5
+ "capabilities": ["Read", "Interactive"],
9
6
  "brandColor": "#C7000B",
10
7
  "composerIcon": "./assets/icon.png",
11
8
  "logo": "./assets/logo.png",
@@ -22,7 +19,7 @@
22
19
  },
23
20
  "mcpServers": "./.mcp.json",
24
21
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
25
- "version": "2.0.0-next.4",
22
+ "version": "2.0.0-next.5",
26
23
  "author": {
27
24
  "name": "HuaweiCloud Mate",
28
25
  "url": "https://github.com/huaweicloud"
@@ -31,15 +28,5 @@
31
28
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
32
29
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
33
30
  "license": "Apache-2.0",
34
- "keywords": [
35
- "huaweicloud",
36
- "huawei-cloud",
37
- "koocli",
38
- "hcloud",
39
- "agent",
40
- "mcp",
41
- "api",
42
- "sdk",
43
- "skills"
44
- ]
31
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
45
32
  }
@@ -5,10 +5,7 @@
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": [
9
- "Read",
10
- "Interactive"
11
- ],
8
+ "capabilities": ["Read", "Interactive"],
12
9
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
13
10
  "brandColor": "#C7000B",
14
11
  "defaultPrompt": [
@@ -19,7 +16,7 @@
19
16
  },
20
17
  "mcpServers": "./.mcp.json",
21
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
22
- "version": "2.0.0-next.4",
19
+ "version": "2.0.0-next.5",
23
20
  "author": {
24
21
  "name": "HuaweiCloud Mate",
25
22
  "url": "https://github.com/huaweicloud"
@@ -29,15 +26,5 @@
29
26
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
30
27
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
31
28
  "license": "Apache-2.0",
32
- "keywords": [
33
- "huaweicloud",
34
- "huawei-cloud",
35
- "koocli",
36
- "hcloud",
37
- "agent",
38
- "mcp",
39
- "api",
40
- "sdk",
41
- "skills"
42
- ]
29
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
43
30
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "2.0.0-next.4",
3
+ "version": "2.0.0-next.5",
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,17 +9,7 @@
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": [
13
- "huaweicloud",
14
- "huawei-cloud",
15
- "koocli",
16
- "hcloud",
17
- "agent",
18
- "mcp",
19
- "api",
20
- "sdk",
21
- "skills"
22
- ],
12
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
23
13
  "mcpServers": "./.mcp.json",
24
14
  "interface": {
25
15
  "displayName": "HuaweiCloud DevKit",
@@ -27,10 +17,7 @@
27
17
  "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.",
28
18
  "developerName": "HuaweiCloud Mate",
29
19
  "category": "Cloud",
30
- "capabilities": [
31
- "Read",
32
- "Interactive"
33
- ],
20
+ "capabilities": ["Read", "Interactive"],
34
21
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
35
22
  "brandColor": "#C7000B",
36
23
  "defaultPrompt": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "2.0.0-next.4",
3
+ "version": "2.0.0-next.5",
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,17 +9,7 @@
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": [
13
- "huaweicloud",
14
- "huawei-cloud",
15
- "koocli",
16
- "hcloud",
17
- "agent",
18
- "mcp",
19
- "api",
20
- "sdk",
21
- "skills"
22
- ],
12
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
23
13
  "mcpServers": "./.mcp.json",
24
14
  "interface": {
25
15
  "displayName": "HuaweiCloud DevKit",
@@ -27,10 +17,7 @@
27
17
  "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.",
28
18
  "developerName": "HuaweiCloud Mate",
29
19
  "category": "Cloud",
30
- "capabilities": [
31
- "Read",
32
- "Interactive"
33
- ],
20
+ "capabilities": ["Read", "Interactive"],
34
21
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
35
22
  "brandColor": "#C7000B",
36
23
  "defaultPrompt": [
@@ -200,8 +200,16 @@ export function explainError({ service = 'unknown', errorCode = '', code = '', m
200
200
  const uniqueSuggestions = suggestions.filter((s, i, arr) => {
201
201
  return !arr.slice(0, i).some((prev) => prev.substring(0, 50).toLowerCase() === s.substring(0, 50).toLowerCase());
202
202
  });
203
+ // The response names the service the error was RESOLVED to, not a raw
204
+ // `unknown`/wrong pasted name: `code`-only calls and a pasted service whose
205
+ // own pattern table is empty derive their key from the code prefix (the
206
+ // suggestions already walked that table). A valid explicit service keeps
207
+ // its exact spelling — the pre-existing contract and its #935 regression
208
+ // pin (AX report D-05).
209
+ const providedKnown = Boolean(service) && svc !== 'unknown';
210
+ const responseService = !providedKnown || !hwErrorPatterns[patternKey] ? effectiveKey : service;
203
211
  return {
204
- service,
212
+ service: responseService,
205
213
  errorCode: resolvedCode,
206
214
  requestId,
207
215
  suggestions: uniqueSuggestions,
@@ -336,6 +336,11 @@ export function planHcloudCommand(args, options = {}) {
336
336
  ...(approvalToken !== undefined ? { command: `npx huaweicloud-devkit approve ${approvalToken}` } : {}),
337
337
  }
338
338
  : { needed: false },
339
- safeToRun: effectiveClassification.decision === 'allow',
339
+ // "Safe to run NOW": a caller-supplied allowWrites:true only unlocks the
340
+ // classification — the strict view still demands the user's confirmation
341
+ // (the approval token/form), so a plan showing decision:"allow" must not
342
+ // also read as runnable while userConfirmation.needed is true (AX D-02
343
+ // display-layer alignment).
344
+ safeToRun: effectiveClassification.decision === 'allow' && !needsConfirmation,
340
345
  };
341
346
  }
@@ -377,16 +377,10 @@ export async function hdkitConnect(options = {}) {
377
377
  }
378
378
  return asRecord(await hdkitRequest('POST', 'connect', body));
379
379
  }
380
- /**
381
- * connect 专用网关 502/504 重试(dev e0c8700b):编排期响应超时不是创建失败,
382
- * 服务端可能已创建/启动实例,重试通常复用。有界重试、逐档退避,其余状态一律
383
- * 不重试(含 409 版本门禁与配额/容量/凭证类客户端裁决码——不可重试裁决由
384
- * hdkit-gate 的瞬时判定与裁决码集合独占)。
385
- * 重试表经 HW_SANDBOX_CONNECT_RETRY_DELAYS_MS 针脚可覆写(v2 扩展)。
386
- * 成功路径回显 connect_retries(v2 扩展;dev 仅在错误路径带尝试次数)。
387
- */
388
- export async function hdkitConnectWithRetry(options = {}) {
380
+ export async function hdkitConnectWithRetry(options = {}, retryOptions = {}) {
389
381
  const delays = connectRetryDelaysMs();
382
+ const inlineRetry = retryOptions.inlineRetry !== false;
383
+ const maxInlineDelayMs = retryOptions.maxInlineDelayMs ?? Number.POSITIVE_INFINITY;
390
384
  let retries = 0;
391
385
  for (;;) {
392
386
  try {
@@ -411,6 +405,21 @@ export async function hdkitConnectWithRetry(options = {}) {
411
405
  throw decorateExhaustedConnect(error, retries);
412
406
  throw error;
413
407
  }
408
+ if (!inlineRetry || (delays[retries] ?? Number.POSITIVE_INFINITY) > maxInlineDelayMs) {
409
+ // AX N-SB.2: never hold the tool call through a backoff longer than
410
+ // the host's request budget — a host request timeout would abandon
411
+ // the call while the server completed the create. The retry moves to
412
+ // the next tool call (same params). Short test/operator backoffs keep
413
+ // the inline ladder.
414
+ const pendingCode = asString(safeReadField(error, 'code'));
415
+ return {
416
+ pending: true,
417
+ connectRetries: retries,
418
+ retryAfterMs: delays[retries] ?? delays[0] ?? 0,
419
+ ...(pendingCode ? { code: pendingCode } : {}),
420
+ message: safeMessageText(error),
421
+ };
422
+ }
414
423
  await new Promise((resolve) => setTimeout(resolve, delays[retries]));
415
424
  retries += 1;
416
425
  }