huaweicloud-devkit 2.0.1-next.3 → 2.0.1-next.4
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 +2 -2
- package/package.json +1 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.mcp.json +3 -0
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/dist/approval-roster.js +2 -0
- package/plugins/huaweicloud-core/dist/lib/hdkit/hdkit-gate.js +7 -0
- package/plugins/huaweicloud-core/dist/lib/hdkit/hdkitservice-api.js +30 -1
- package/plugins/huaweicloud-core/dist/lib/hdkit/sandbox-pool.js +21 -0
- package/plugins/huaweicloud-core/dist/mcp-server.js +5019 -3879
- package/plugins/huaweicloud-core/dist/mcp-server.js.map +4 -4
- package/plugins/huaweicloud-core/dist/packs/registry.js +1 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/approval.js +13 -2
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-account.js +198 -10
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-credentials.js +11 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-session.js +22 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-tunnel.js +46 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-upload.js +11 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/schemas.js +20 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/tools.js +26 -18
- package/plugins/huaweicloud-core/dist/sandbox/deploy-check.js +97 -0
- package/plugins/huaweicloud-core/dist/sandbox/deploy-nginx.js +30 -14
- package/plugins/huaweicloud-core/dist/sandbox/devbox/devbox-backend.js +37 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbox/devbox-connections.js +84 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbox/devbox-envd-client.js +229 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbox/devbox-envd-protocol.js +151 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbox/devbox-envd-transport.js +121 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbox/devbox-service-api.js +80 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbox/devbox-upload.js +106 -0
- package/plugins/huaweicloud-core/dist/sandbox/hwlink-connection.js +12 -0
- package/plugins/huaweicloud-core/dist/sandbox/upload-project.js +5 -2
- package/plugins/huaweicloud-core/dist/tool-definitions.js +4 -0
- package/plugins/huaweicloud-core/dist/tools.js +1 -0
- package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
- package/plugins/huaweicloud-core/safety/policy.json +2 -1
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +67 -16
- package/plugins/huaweicloud-core/skills/huawei-sandbox/references/devbox-backend.md +78 -0
- package/plugins/huaweicloud-core/skills/huawei-sandbox/references/resource-pool.md +14 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/references/approvals.md +2 -1
- package/plugins/huaweicloud-core/src/approval-roster.ts +2 -0
- package/plugins/huaweicloud-core/src/lib/hdkit/hdkit-gate.ts +7 -0
- package/plugins/huaweicloud-core/src/lib/hdkit/hdkitservice-api.ts +30 -1
- package/plugins/huaweicloud-core/src/lib/hdkit/sandbox-pool.ts +22 -0
- package/plugins/huaweicloud-core/src/packs/registry.ts +1 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/approval.ts +15 -2
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-account.ts +206 -11
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-credentials.ts +12 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-session.ts +23 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-tunnel.ts +49 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-upload.ts +11 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/schemas.ts +23 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/tools.ts +27 -17
- package/plugins/huaweicloud-core/src/sandbox/deploy-check.ts +105 -0
- package/plugins/huaweicloud-core/src/sandbox/deploy-nginx.ts +36 -18
- package/plugins/huaweicloud-core/src/sandbox/devbox/devbox-backend.ts +44 -0
- package/plugins/huaweicloud-core/src/sandbox/devbox/devbox-connections.ts +115 -0
- package/plugins/huaweicloud-core/src/sandbox/devbox/devbox-envd-client.ts +281 -0
- package/plugins/huaweicloud-core/src/sandbox/devbox/devbox-envd-protocol.ts +180 -0
- package/plugins/huaweicloud-core/src/sandbox/devbox/devbox-envd-transport.ts +142 -0
- package/plugins/huaweicloud-core/src/sandbox/devbox/devbox-service-api.ts +102 -0
- package/plugins/huaweicloud-core/src/sandbox/devbox/devbox-upload.ts +167 -0
- package/plugins/huaweicloud-core/src/sandbox/hwlink-connection.ts +12 -0
- package/plugins/huaweicloud-core/src/sandbox/upload-project.ts +5 -2
- package/plugins/huaweicloud-core/src/tool-definitions.ts +4 -0
- package/plugins/huaweicloud-core/src/tools.ts +3 -0
package/README.md
CHANGED
|
@@ -424,8 +424,8 @@ Debug logs are written to the plugin's `telemetry/telemetry-debug.log` file.
|
|
|
424
424
|
- **Safety-first execution** — all write operations require explicit user approval; credentials and secrets are automatically redacted from output
|
|
425
425
|
- **Pre-execution risk checks** — public exposure, credential leaks, and destructive operations are caught before they run
|
|
426
426
|
- **Regional awareness** — auto-discovers available regions and checks service availability before creating resources
|
|
427
|
-
- **Sandbox (DevStation)** — temporary cloud runtime for web app deployment with instant public URL preview
|
|
428
|
-
- **Capability packs (
|
|
427
|
+
- **Sandbox (DevStation legacy / DevBox platform pool)** — temporary cloud runtime for web app deployment with instant public URL preview; `HW_SANDBOX_BACKEND=devbox` selects the platform resource pool (per-IAM-user ephemeral sandbox, one-shot exec/files, app-port preview)
|
|
428
|
+
- **Capability packs (57 MCP tools)** — the devkit ships ten packs (core 12 tools; huaweicloud-cli carries the 20 service skills plus the 7 KooCLI execution tools; sandbox, auth, obs, voucher, update, discovery, secrets, huaweicloud-open-mcp for the rest). The huaweicloud-open-mcp pack proxies Huawei Cloud's full OpenAPI catalog through the local huaweicloud-open-mcp gateway with one generic call tool (`huaweicloud_gateway_call`: search_apis → list_apis → get_api discovery, execute_api with gateway-engine-gated consent; install the gateway with pip or uv, or just have `uvx` on PATH — no persistent install needed). Discover packs with `huaweicloud_list_packs` → `huaweicloud_pack_info`, browse the effective skill catalog with `huaweicloud_list_skills` (every enabled pack's skills with name, description, version, and reference filenames in one call, plus `skillRoot` — the tree's absolute location; which skills are ENABLED is pack-gated and can change at runtime, so a `huawei-*` service skill absent from the catalog belongs to a trimmed pack — the six `huaweicloud-*` meta-skills never appear in it and are always available), read the skill files directly under `skillRoot` on a same-machine install (the stdio server instructions state the location at initialize, so no catalog call is needed just to start reading; the taught policy is action-first — attempt the direct read, the attempt itself is the reachability check), and fall back to `huaweicloud_retrieve_skill` only when the attempted read fails or is denied — the taught reaction is falling back (the loader needs no file access), never repeatedly requesting. (the gated, telemetry-bearing, portable fallback, whose stdio payload also carries `skillRoot`; the six core meta-skills are additionally installed as native skill copies on directory-loading agents for system-prompt visibility). Trim the surface with `DEVKIT_PACKS` (comma-separated pack ids, e.g. `DEVKIT_PACKS=core,sandbox`); unset means all packs, unknown ids fail fast at startup, and core (pack meta, safety and discovery surface) is always included — trimming huaweicloud-cli removes the CLI execution face and its approval tools together. In a live stdio agent session, `huaweicloud_packs_configure` enables or disables packs on the spot (session-scoped; the refreshed tool list is pushed to the agent, and restarting the session restores the operator posture; the stateless remote surface does not carry it). Manage the surface persistently after install with `npx huaweicloud-devkit packs status | enable <ids> | disable <ids> | all [--target <agent>]`: the command rewrites `DEVKIT_PACKS` inside every installed agent's MCP config (the install-time `--packs` flag never overwrites an existing value), and the change takes effect on the agent's next session restart.
|
|
429
429
|
|
|
430
430
|
Harness permission notes (skill-tree reads outside the workspace): the taught reaction above is universal — when a direct read fails or is denied, fall back to `huaweicloud_retrieve_skill`, never repeatedly request. The OpenCode installer writes a persistent permission seam (external_directory allow + edit deny over the tree globs, plus an edit-only deny over the plugin payload root so the edit tools cannot rewrite the deployed classifier the in-process gate imports); on other harnesses the operator can pre-allow the tree in the harness's own config if prompts bother them. Honest semantics for the seam: the allow covers every path-taking tool including bash (an allowed external directory inherits workspace defaults), so shell-mediated writes to the tree stop asking too — the edit deny governs only the edit tools; the tree is regenerated on every install/update, and the devkit's PreToolUse hook still denies hcloud writes. On opencode at or above 1.19.0 the installer additionally writes the ASK approval posture as a pair — one exact `allow` entry per roster tool on the `huaweicloud-devkit_<tool>` action (a top-level `permissions` array entry on 2.0+, a `permission`-object key on 1.19–1.x; the two generations name the rule identically) plus `DEVKIT_APPROVAL_MODE=ask` in the mcp entry's environment. Ask mode is the devkit-wide default (an env-less install runs it too); the explicit env half pins the posture and anchors doctor's drift check, and the client `allow` rule only yields the client's own redundant popup to the server-run gate. On opencode 2.x the gate raises an elicitation form, so the form is the single confirmation; on 1.19–1.x the client cannot render forms, so the yield hands the confirmation to the chat round-trip — the envelope answered in chat and retried with `approvedByUser: true`, which the consent ledger records as posture trust (the user's word as the agent reports it, no mechanical proof a human answered). No terminal approve trip, no token UUID (`DEVKIT_APPROVAL_MODE=token` opts back into the PIN-checked terminal gate); below the floor neither half is written — the server still runs its env-unset ask default, just without the client yield — and an install or update still removes the legacy ask rules. The allow rules are written only when the server half is present or established this run; a user-set `DEVKIT_APPROVAL_MODE` value wins, no client rules are kept, and rules a past install wrote are removed value-exact so the user's mechanical posture stays clean. A client `allow` rule can no longer fail anything open, while a `deny` rule still blocks the call in the client — which is why `npx huaweicloud-devkit doctor` fails one, fails a leftover devkit-written ask rule (the migration missed it), and warns when allow rules are present without the server env or the client half is unverifiable. Ownership follows the skills-tree seam's doctrine — add-only-if-absent per rule and value-exact removal — including its accepted edge: a user-authored rule of the identical shape that predates the install is removed together with the devkit's own. Residual from pre-yield installs: a saved "Always allow" row in OpenCode's permission store is a stale grant — the gate never consults it, and the yield rules mean the popup no longer appears to recreate it. `npx huaweicloud-devkit doctor` reports it as a `[WARN]` naming the row and the store; clean it up with `opencode api GET /api/permission/saved` (list) and `opencode api DELETE /api/permission/saved/<id>` (remove). See the huaweicloud-safety skill's approvals reference.
|
|
431
431
|
|
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.1-next.
|
|
4
|
+
"version": "2.0.1-next.4",
|
|
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",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
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
|
-
"version": "2.0.1-next.
|
|
19
|
+
"version": "2.0.1-next.4",
|
|
20
20
|
"author": {
|
|
21
21
|
"name": "HuaweiCloud Mate",
|
|
22
22
|
"url": "https://github.com/huaweicloud"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
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
|
-
"version": "2.0.1-next.
|
|
22
|
+
"version": "2.0.1-next.4",
|
|
23
23
|
"author": {
|
|
24
24
|
"name": "HuaweiCloud Mate",
|
|
25
25
|
"url": "https://github.com/huaweicloud"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
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
|
-
"version": "2.0.1-next.
|
|
19
|
+
"version": "2.0.1-next.4",
|
|
20
20
|
"author": {
|
|
21
21
|
"name": "HuaweiCloud Mate",
|
|
22
22
|
"url": "https://github.com/huaweicloud"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "2.0.1-next.
|
|
3
|
+
"version": "2.0.1-next.4",
|
|
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": "2.0.1-next.
|
|
3
|
+
"version": "2.0.1-next.4",
|
|
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",
|
|
@@ -39,6 +39,7 @@ export const APPROVAL_TOOLS = [
|
|
|
39
39
|
'huaweicloud_sandbox_sign_agreement',
|
|
40
40
|
'huaweicloud_sandbox_credentials',
|
|
41
41
|
'huaweicloud_sandbox_shutdown',
|
|
42
|
+
'huaweicloud_sandbox_kill',
|
|
42
43
|
'huaweicloud_auth_init',
|
|
43
44
|
'huaweicloud_auth_switch',
|
|
44
45
|
'huaweicloud_obs_set_website_config',
|
|
@@ -69,6 +70,7 @@ export const APPROVAL_TOOL_INPUT_SHAPES = {
|
|
|
69
70
|
huaweicloud_sandbox_sign_agreement: 'structured',
|
|
70
71
|
huaweicloud_sandbox_credentials: 'structured',
|
|
71
72
|
huaweicloud_sandbox_shutdown: 'structured',
|
|
73
|
+
huaweicloud_sandbox_kill: 'structured',
|
|
72
74
|
huaweicloud_auth_init: 'structured',
|
|
73
75
|
huaweicloud_auth_switch: 'structured',
|
|
74
76
|
huaweicloud_obs_set_website_config: 'structured',
|
|
@@ -320,6 +320,13 @@ const NON_RETRYABLE_CLIENT_CODES = new Set([
|
|
|
320
320
|
'HDKIT_NOT_REALNAME',
|
|
321
321
|
'HDKIT_NOT_AGREEMENT',
|
|
322
322
|
'HDKIT_NOT_REALNAME_AND_AGREEMENT',
|
|
323
|
+
// DevBox control-plane verdicts: re-authentication / IAM authorization /
|
|
324
|
+
// backend-scope rejections cannot be advanced by retrying the same call.
|
|
325
|
+
'HDKIT_CREDENTIAL_INVALID',
|
|
326
|
+
'HDKIT_CREDENTIAL_EXPIRED',
|
|
327
|
+
'HDKIT_CREDENTIAL_FORBIDDEN',
|
|
328
|
+
'HDKIT_IDENTITY_UNSUPPORTED',
|
|
329
|
+
'HDKIT_BACKEND_UNSUPPORTED',
|
|
323
330
|
]);
|
|
324
331
|
export function isNonRetryableBusinessError(error) {
|
|
325
332
|
// 烧核裁决不重试(round 29/MUST 2):请求层在重试判定前落 coreHoursExhausted
|
|
@@ -100,7 +100,9 @@ function transportReason(error, fallback) {
|
|
|
100
100
|
}
|
|
101
101
|
return Object.assign(new Error(cleanMessage(reason) || fallback), { bodyUnreadable: true });
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
// Devbox control plane reuses the exact same credential/token/retry envelope;
|
|
104
|
+
// exported for devbox-service-api.ts (the design keeps one request seam).
|
|
105
|
+
export async function hdkitRequest(method, path, body, timeoutMs = 300000) {
|
|
104
106
|
const { ak, sk, securitytoken } = getCredentials();
|
|
105
107
|
if (!ak || !sk) {
|
|
106
108
|
throw new Error('Huawei Cloud credentials are not configured. ' +
|
|
@@ -256,6 +258,33 @@ async function hdkitRequest(method, path, body, timeoutMs = 300000) {
|
|
|
256
258
|
],
|
|
257
259
|
};
|
|
258
260
|
}
|
|
261
|
+
// Devbox 控制面凭证码(A:每次 AK/SK,无 sandbox key):401 重新认证、
|
|
262
|
+
// 403 修 IAM 授权、identity 不支持 agency/临时凭证——都不是重试能推进的。
|
|
263
|
+
if (canonCode(code) === 'HDKIT_CREDENTIAL_INVALID' || canonCode(code) === 'HDKIT_CREDENTIAL_EXPIRED') {
|
|
264
|
+
err.remediation = {
|
|
265
|
+
hint: 'DevBox 控制面凭证无效或已失效(devbox 没有 sandbox key,每次调用都用 AK/SK):',
|
|
266
|
+
steps: [
|
|
267
|
+
'运行 npx huaweicloud-devkit auth init 重新配置有效 AK/SK(或 huaweicloud_auth_switch)',
|
|
268
|
+
'临时凭证已过期时先刷新 STS 凭证再重试',
|
|
269
|
+
'重新认证后 connect 会复用原 sandbox(running/paused),不会新建',
|
|
270
|
+
],
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
if (canonCode(code) === 'HDKIT_CREDENTIAL_FORBIDDEN') {
|
|
274
|
+
err.remediation = {
|
|
275
|
+
hint: '当前账号无权限执行 DevBox 控制面操作:',
|
|
276
|
+
steps: ['检查 IAM 授权是否包含所需沙箱/DevBox 权限', '不要当作凭证过期反复重登;授权修正后重试'],
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
if (canonCode(code) === 'HDKIT_IDENTITY_UNSUPPORTED') {
|
|
280
|
+
err.remediation = {
|
|
281
|
+
hint: 'devbox v1 只接受 IAM 用户(principal_urn 为 :user:)的凭证:',
|
|
282
|
+
steps: [
|
|
283
|
+
'改用 IAM 用户的永久 AK/SK(临时/agency 凭证不在 v1 范围)',
|
|
284
|
+
'不要降级成 account 级租户;每个 IAM 子账号独立 sandbox',
|
|
285
|
+
],
|
|
286
|
+
};
|
|
287
|
+
}
|
|
259
288
|
// 429 三错误码(两池配额契约 + 用户级模板 running 上限,dev dff5df91 + 45dd4f99):
|
|
260
289
|
// 配额满与模板上限给出各自的引导;池容量不足只透传服务端最终文案
|
|
261
290
|
// (“DevKit 免费资源当前使用人数较多,建议您错峰使用,感谢理解!”),不再附加
|
|
@@ -233,6 +233,27 @@ export function enrichConnectResult(result, options = {}) {
|
|
|
233
233
|
const rec = result;
|
|
234
234
|
const poolType = asString(rec.pool_type || rec.poolType);
|
|
235
235
|
const announce = options.announce !== false;
|
|
236
|
+
// Devbox lifecycle is server-authoritative (end_at / token_expiration /
|
|
237
|
+
// pause_retention_hours), NOT the DevStation idle policy numbers. Never fall
|
|
238
|
+
// through to the legacy idle shutdown/delete broadcast on this backend.
|
|
239
|
+
if (asString(rec.backend) === 'devbox') {
|
|
240
|
+
if (!announce) {
|
|
241
|
+
delete rec.pool;
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
const endAt = asString(rec.end_at || rec.endAt);
|
|
245
|
+
const tokenExpiration = asString(rec.token_expiration || rec.tokenExpiration);
|
|
246
|
+
const retentionRaw = rec.pause_retention_hours ?? rec.pauseRetentionHours;
|
|
247
|
+
const retention = typeof retentionRaw === 'number' && retentionRaw > 0 ? retentionRaw : 168;
|
|
248
|
+
rec.pool = {
|
|
249
|
+
pool_type: 'ephemeral',
|
|
250
|
+
lifecycle: `devbox ephemeral sandbox${endAt ? `; TTL ends ${endAt}` : ''}; pause retention ${retention}h`,
|
|
251
|
+
ttl_hint: `DevBox 沙箱${endAt ? `到期时间 ${endAt}` : '按平台 TTL 到期'};` +
|
|
252
|
+
`shutdown 暂停后保留 ${retention} 小时,超期由平台回收。重要数据请及时保存或迁出。` +
|
|
253
|
+
(tokenExpiration ? ` EnvD 数据面 token 到期时间 ${tokenExpiration},devkit 会自动刷新一次。` : ''),
|
|
254
|
+
};
|
|
255
|
+
return result;
|
|
256
|
+
}
|
|
236
257
|
if (!announce || !poolType || !isPoolType(poolType)) {
|
|
237
258
|
delete rec.pool;
|
|
238
259
|
return result;
|