huaweicloud-devkit 1.0.2-dev.8 → 1.0.2-dev.9
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 +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/safety/policy.json +3 -4
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +17 -14
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +2 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +1 -1
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +0 -10
- package/plugins/huaweicloud-core/src/setup-cli.mjs +28 -10
- package/plugins/huaweicloud-core/src/tools.mjs +4 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "1.0.2-dev.
|
|
3
|
+
"version": "1.0.2-dev.9",
|
|
4
4
|
"description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"mcpServers": "./.mcp.json",
|
|
21
21
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
22
|
"skills": "./skills/",
|
|
23
|
-
"version": "1.0.2-dev.
|
|
23
|
+
"version": "1.0.2-dev.9",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "HuaweiCloud Mate",
|
|
26
26
|
"url": "https://github.com/huaweicloud"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-core",
|
|
3
|
-
"version": "1.0.2-dev.
|
|
3
|
+
"version": "1.0.2-dev.9",
|
|
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",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"mcpServers": "./.mcp.json",
|
|
21
21
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
22
|
"skills": "./skills/",
|
|
23
|
-
"version": "1.0.2-dev.
|
|
23
|
+
"version": "1.0.2-dev.9",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "HuaweiCloud Mate",
|
|
26
26
|
"url": "https://github.com/huaweicloud"
|
|
@@ -132,7 +132,7 @@ ssh -o StrictHostKeyChecking=accept-new -i <key> root@<eip> 'dnf install -y ngin
|
|
|
132
132
|
| Cannot SSH | SG missing port 22 or no EIP -> Add ingress rule / Bind EIP |
|
|
133
133
|
| Flavor unavailable | Region limitation -> ListFlavors in target region |
|
|
134
134
|
| Insufficient resources | Stock depleted -> Change flavor or AZ |
|
|
135
|
-
| AuthFailure | Expired AK/SK ->
|
|
135
|
+
| AuthFailure | Expired AK/SK -> re-run `npx huaweicloud-devkit auth init` |
|
|
136
136
|
| APIGW.0802 / region permission | IAM user has no access to this region -> IAM console → User → Permissions → add region, or switch to another region |
|
|
137
137
|
| Cannot SSH (port 22 open) | SCP policy may be blocking SSH. Check `SYS.0403` errors in command output -> Use cloud-init/user_data for initial setup instead. See `references/create-instance.md` §Bootstrap |
|
|
138
138
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
| Cannot SSH | 安全组未开放22端口 或 未绑定EIP | 1) 添加入方向规则 tcp 22。2) `hcloud EIP BindPublicIp` |
|
|
14
14
|
| Flavor unavailable | 区域不支持该规格 | `hcloud ECS ListFlavors --cli-region=<r>` 先查。不硬编码 s6/m6 等规格名 |
|
|
15
15
|
| Insufficient resources | AZ 库存不足 | 换规格、换 AZ、或等待资源释放 |
|
|
16
|
-
| AuthFailure | AK/SK 过期或无效 | `
|
|
16
|
+
| AuthFailure | AK/SK 过期或无效 | `npx huaweicloud-devkit auth init` 重新配置统一凭据 |
|
|
17
17
|
|
|
18
18
|
## 创建失败诊断流程
|
|
19
19
|
|
|
@@ -95,7 +95,7 @@ See `references/deploy-workflow.md` for a step-by-step example with code templat
|
|
|
95
95
|
| DeleteFunction with `:latest` | Strip `:latest` version suffix from URN |
|
|
96
96
|
| Code too large | Inline limit 10KB — use `zip`/`obs` code type |
|
|
97
97
|
| Cold start slow | Set reserved instances for critical functions |
|
|
98
|
-
| Auth failure | Run `
|
|
98
|
+
| Auth failure | Run `npx huaweicloud-devkit auth init` |
|
|
99
99
|
|
|
100
100
|
## Security Considerations
|
|
101
101
|
|
|
@@ -19,11 +19,11 @@ version: 1
|
|
|
19
19
|
## First-Time Setup
|
|
20
20
|
1. **Install KooCLI** using command above
|
|
21
21
|
2. **Accept privacy policy** (first run only): KooCLI requires one-time privacy agreement. Run `hcloud version` to read the agreement, then respond `y` to accept. Do not pipe `echo "y" |` — you must review the terms first.
|
|
22
|
-
3. **Configure credentials**: `hcloud configure init
|
|
22
|
+
3. **Configure credentials (unified)**: `npx huaweicloud-devkit auth init` — prefer this over `hcloud configure init`, which only covers KooCLI.
|
|
23
23
|
4. **Verify**: `hcloud configure list` to confirm profile, then `hcloud ECS ListServersDetails --cli-region=cn-north-4`
|
|
24
24
|
5. For detailed auth guidance, see `huaweicloud-cli-and-auth` skill
|
|
25
25
|
|
|
26
|
-
> **Security**: Never pass AK/SK as command-line arguments (`--ak=...`). Always use `
|
|
26
|
+
> **Security**: Never pass AK/SK as command-line arguments (`--ak=...`). Always use `npx huaweicloud-devkit auth init` (unified, interactive, recommended) or `hcloud configure init` (KooCLI only) to avoid secrets in shell history.
|
|
27
27
|
|
|
28
28
|
### Non-Interactive Setup (Agent/CI Environments)
|
|
29
29
|
|
|
@@ -16,6 +16,7 @@ Domain expertise for Huawei Cloud Sandbox (DevStation) instances and workspace t
|
|
|
16
16
|
|
|
17
17
|
- **Proactive offering**: when the developer's task needs a temporary runtime (e.g. "deploy this web app", "run this app and preview it"), offer the sandbox proactively — the developer never has to say "use sandbox". Prompt: "This task can be satisfied by a sandbox — use it?"
|
|
18
18
|
- **Detect web apps in deploy-a-repo prompts**: prompts like "部署 GitHub - <owner>/<repo>" or "deploy <github repo>" do not say "web app". Clone or inspect the repository first (package.json with dev/serve/build scripts, index.html, frontend framework dependencies such as vue/react/angular/vite, static sites, Dockerfile running a web server). If it is a web application, offer the sandbox first: "检测到该项目是 Web 应用,建议优先使用沙箱部署(临时运行环境,可预览访问),是否使用?"
|
|
19
|
+
- **Clone into the sandbox workspace directory**: always put project code under `/workspace/<repo-name>` (create the directory if missing) — `/workspace` is the sandbox's dedicated workspace mount at the filesystem root, not `$HOME/workspace`. Never use `/tmp` or other ephemeral locations. This keeps the project with the sandbox session, is easy to reference for serving/exposing, and survives session-level restarts of the shell.
|
|
19
20
|
- **Deployment must end with a public URL**: after deploying and exposing the app with DevBridge, always return the tunnel URL to the developer as the final result — a deployment without an accessible link is incomplete.
|
|
20
21
|
- **Do not intercept a specified target**: if the task already names a deployment target (ECS, CCE, an existing server), follow that target instead of offering the sandbox. Offer the sandbox only when the task needs a temporary runtime or no target is specified.
|
|
21
22
|
- The developer never needs to name or understand the sandbox as a separate service. Detect the "web application deployment / needs a runtime environment" intent and propose the sandbox.
|
|
@@ -35,7 +36,6 @@ Domain expertise for Huawei Cloud Sandbox (DevStation) instances and workspace t
|
|
|
35
36
|
|------|---------|
|
|
36
37
|
| `huaweicloud_sandbox_connect` | Connect to sandbox (one user one instance, reuses existing if available) |
|
|
37
38
|
| `huaweicloud_sandbox_credentials` | Inject temporary AK/SK into a running sandbox |
|
|
38
|
-
| `huaweicloud_sandbox_release` | Shut down and delete a sandbox (idempotent) |
|
|
39
39
|
|
|
40
40
|
### Terminal Execution
|
|
41
41
|
|
|
@@ -54,14 +54,15 @@ Setup is a **plugin-side preflight** — the developer should be asked a questio
|
|
|
54
54
|
4. **Connect**: `huaweicloud_sandbox_connect` — returns `session_id`, `dev_stage_id`, `connection_id`, `connection_address`
|
|
55
55
|
5. **Inject credentials** (optional): `huaweicloud_sandbox_credentials` — enables cloud API access from sandbox
|
|
56
56
|
6. **Execute commands**: `huaweicloud_sandbox_exec_with_session` for interactive work
|
|
57
|
-
7. **Expose the deployed app
|
|
58
|
-
8. **Release**: `huaweicloud_sandbox_release` — cleans up sandbox and session
|
|
57
|
+
7. **Expose the deployed app and return the public URL**: set up a public access link for the app port and give the URL to the developer as the final result (see "Expose the deployed app (public URL)") — this step uses an internal tunnel mechanism that must never be mentioned to the developer
|
|
59
58
|
|
|
60
|
-
##
|
|
59
|
+
## Expose the deployed app (public URL)
|
|
61
60
|
|
|
62
61
|
Expose a deployed web app to a public URL and return that URL to the developer.
|
|
63
62
|
|
|
64
|
-
**
|
|
63
|
+
**User-facing language rule**: the tunnel mechanism below is an internal implementation detail. Never mention "DevBridge", "tunnel", or the tunnel CLI to the developer. Tell the developer only: "正在生成访问地址..." while exposing, then hand over the final URL.
|
|
64
|
+
|
|
65
|
+
**Install** (internal tooling; skip if `devbridge version` already works):
|
|
65
66
|
|
|
66
67
|
```bash
|
|
67
68
|
curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash
|
|
@@ -77,19 +78,19 @@ devbridge auth login --huaweicloud --access-key "$AK" --secret-key "$SK"
|
|
|
77
78
|
- The `--huaweicloud` flag is required for AK/SK login; without it the CLI tries an interactive browser login, which fails in the sandbox.
|
|
78
79
|
- Write the AK/SK to temp files with `umask 077` (or shell vars) and delete them right after login. Verify with `devbridge auth status`.
|
|
79
80
|
|
|
80
|
-
**Expose** (run the web server and the tunnel in the background, then read the URL from the log):
|
|
81
|
+
**Expose** (run the web server and the tunnel in the background, then read the URL from the log; the app lives in the workspace mount, e.g. `/workspace/<repo-name>`):
|
|
81
82
|
|
|
82
83
|
```bash
|
|
83
|
-
cd
|
|
84
|
+
cd /workspace/<repo-name> && nohup python3 -m http.server 8080 > /tmp/http.log 2>&1 &
|
|
84
85
|
nohup devbridge host -p 8080 -e 8 > /tmp/host.log 2>&1 &
|
|
85
86
|
sleep 10 && cat /tmp/host.log
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
- The
|
|
89
|
+
- The public URL has the form `https://<id>-<port>.cn-north-4-bridge.myhuaweicloud.com` (from the `Tunnel URL:` line).
|
|
89
90
|
- **Return this URL to the developer as the deployment result link.** Keep the host process running (do not close the session before handing over the URL).
|
|
90
|
-
-
|
|
91
|
+
- Internal docs: https://huaweicloud.github.io/devspace-devbridge/
|
|
91
92
|
|
|
92
|
-
**No local downgrade**: if
|
|
93
|
+
**No local downgrade**: if the tunnel tooling cannot be installed in the sandbox, STOP and report a generic error ("无法生成访问地址") without technical detail. Never install it on the developer's local machine — a local install would defeat the purpose of sandbox deployment.
|
|
93
94
|
|
|
94
95
|
## Critical Warnings
|
|
95
96
|
|
|
@@ -97,13 +98,15 @@ sleep 10 && cat /tmp/host.log
|
|
|
97
98
|
|------|-----|
|
|
98
99
|
| Agreement required first | `sandbox_connect` fails if the agreement isn't signed; the `sandbox_check_user` preflight detects this, so surface it to the developer only when signing is needed |
|
|
99
100
|
| Real-name required | `sandbox_connect` fails if `realname_verified=false`; tell the developer once and stop, don't loop on connect |
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
101
|
+
| Never expose tunnel details | Do not mention "DevBridge"/"tunnel"/"devbridge" to the developer — say "正在生成访问地址..." and hand over only the URL |
|
|
102
|
+
| Login needs `--huaweicloud` | `devbridge auth login --access-key/--secret-key` without `--huaweicloud` falls back to interactive browser login, which fails in the sandbox |
|
|
103
|
+
| CLI PATH | The installer only writes `~/.bashrc`; run `export PATH=$PATH:$HOME/.huawei/bin` in the session before using `devbridge` |
|
|
104
|
+
| Never install tunnel tooling locally | If the sandbox cannot install it, report a generic error and stop — installing on the developer's machine defeats sandbox deployment |
|
|
105
|
+
| Return the deployment URL | Always hand the public URL from the host log to the developer as the final result |
|
|
104
106
|
| Session state persists | `exec_with_session` preserves `cd`, env vars, aliases between calls |
|
|
105
107
|
| Destructive commands blocked | `rm -rf /`, `mkfs`, `dd if=`, fork bombs are denied by safety policy |
|
|
106
108
|
| Workspace ID = dev_stage_id | Use `dev_stage_id` from `sandbox_connect` as `workspace_id` for terminal exec |
|
|
109
|
+
| Projects live in `/workspace` | Clone/install project code under `/workspace/<repo-name>` (filesystem-root workspace mount, not `$HOME/workspace`), never in `/tmp` — ephemeral locations lose the project when the sandbox session restarts |
|
|
107
110
|
| Node.js >= 22 required | Sandbox terminal uses built-in WebSocket (globalThis.WebSocket); if Node.js is missing, install it from the Huawei Cloud mirror (see "Node.js in the sandbox") |
|
|
108
111
|
|
|
109
112
|
## Node.js in the sandbox
|
|
@@ -60,7 +60,8 @@ Agent processes find executables through `PATH`. If OpenCode/Codex cannot find `
|
|
|
60
60
|
**NEVER let AK/SK enter shell history. This is the #1 credential leak vector.**
|
|
61
61
|
|
|
62
62
|
- Create AK/SK in the Huawei Cloud console under `My Credentials -> Access Keys`.
|
|
63
|
-
- **
|
|
63
|
+
- **Unified credentials** (preferred): `npx huaweicloud-devkit auth init`. This is the DevKit's primary auth path; `hcloud configure init` only covers KooCLI.
|
|
64
|
+
- **KooCLI only, interactive** (SAFE): `hcloud configure init` — prompts for AK/SK via terminal input. Values do NOT enter shell history.
|
|
64
65
|
- **Non-interactive** (DANGEROUS — AK/SK in shell history): `hcloud configure set --cli-access-key=<AK> --cli-secret-key=<SK> --cli-region=<region>`. Only use in ephemeral CI/CD shells. User must execute outside agent chat.
|
|
65
66
|
- If MCP is available, use `huaweicloud_show_profile_redacted` to check status without ever seeing credentials.
|
|
66
67
|
- Never paste AK/SK, passwords, tokens, or profile files into the agent conversation.
|
|
@@ -50,7 +50,7 @@ Use evidence before fixes. Do not guess service behavior when request IDs, regio
|
|
|
50
50
|
|
|
51
51
|
| Error | Likely Cause | Fix |
|
|
52
52
|
|-------|-------------|-----|
|
|
53
|
-
| AuthFailure / 401 | AK/SK invalid or expired | Regenerate AK/SK, re-run `
|
|
53
|
+
| AuthFailure / 401 | AK/SK invalid or expired | Regenerate AK/SK, re-run `npx huaweicloud-devkit auth init` |
|
|
54
54
|
| AccessDenied / 403 | IAM permission missing | Check `huawei-iam` skill, add required policy action |
|
|
55
55
|
| NoSuchKey / 404 | Resource not found | Verify resource ID, region, and project_id |
|
|
56
56
|
| QuotaExceeded | Account limit reached | Request quota increase in console |
|
|
@@ -84,14 +84,4 @@ export async function hdkitCredentials(sessionId, devStageId, enableSts = true)
|
|
|
84
84
|
return await hdkitRequest('POST', 'credentials', body);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export async function hdkitRelease(sessionId, devStageId) {
|
|
88
|
-
const body = {};
|
|
89
|
-
if (sessionId) body.session_id = sessionId;
|
|
90
|
-
if (devStageId) body.dev_stage_id = devStageId;
|
|
91
|
-
|
|
92
|
-
if (!sessionId && !devStageId) {
|
|
93
|
-
throw new Error('session_id or dev_stage_id is required');
|
|
94
|
-
}
|
|
95
87
|
|
|
96
|
-
return await hdkitRequest('POST', 'release', body);
|
|
97
|
-
}
|
|
@@ -857,7 +857,10 @@ async function cmdInstall() {
|
|
|
857
857
|
console.log(`\nKooCLI (hcloud) detected.`);
|
|
858
858
|
}
|
|
859
859
|
|
|
860
|
-
console.log(`\
|
|
860
|
+
console.log(`\n\x1b[1m下一步:\x1b[0m`);
|
|
861
|
+
console.log(` 1. 配置统一凭据:npx huaweicloud-devkit auth init`);
|
|
862
|
+
console.log(` 2. 重启 ${appName} 会话(MCP 工具重启后生效)`);
|
|
863
|
+
console.log(` 3. 运行自检:npx huaweicloud-devkit doctor`);
|
|
861
864
|
|
|
862
865
|
// Write install marker for doctor to detect
|
|
863
866
|
const markerDir = target === 'codearts' ? codeartsPluginsDir()
|
|
@@ -1038,7 +1041,7 @@ async function cmdDoctor() {
|
|
|
1038
1041
|
// Check auth
|
|
1039
1042
|
const authCheck = spawnSync(`"${hcloudBin}" configure list`, [], { shell: true, windowsHide: true, stdio: 'pipe', timeout: 5000 });
|
|
1040
1043
|
const hasAuth = authCheck.status === 0 && /access.?key/i.test(authCheck.stdout.toString());
|
|
1041
|
-
check('hcloud credentials configured', hasAuth, 'Run:
|
|
1044
|
+
check('hcloud credentials configured', hasAuth, 'Run: npx huaweicloud-devkit auth init');
|
|
1042
1045
|
}
|
|
1043
1046
|
|
|
1044
1047
|
// Skills
|
|
@@ -1260,9 +1263,24 @@ async function cmdInstallHcloud() {
|
|
|
1260
1263
|
// Clean up zip
|
|
1261
1264
|
rmSync(zipPath, { force: true });
|
|
1262
1265
|
|
|
1263
|
-
// Add to PATH
|
|
1266
|
+
// Add to user PATH (append + dedupe within the User scope only; never copy
|
|
1267
|
+
// session/system entries into the user PATH, and never use setx PATH which
|
|
1268
|
+
// overwrites the whole variable and truncates at 1024 chars).
|
|
1264
1269
|
console.log(' Adding to user PATH...');
|
|
1265
|
-
|
|
1270
|
+
const pathPs = [
|
|
1271
|
+
'$ErrorActionPreference = "Stop"',
|
|
1272
|
+
`$target = '${installDir.replace(/'/g, "''")}'`,
|
|
1273
|
+
'$cur = [Environment]::GetEnvironmentVariable("Path", "User")',
|
|
1274
|
+
'if (-not $cur) { $cur = "" }',
|
|
1275
|
+
'$parts = @($cur -split ";" | Where-Object { $_ -ne "" })',
|
|
1276
|
+
'if ($parts -notcontains $target) {',
|
|
1277
|
+
' [Environment]::SetEnvironmentVariable("Path", (@($parts) + $target) -join ";", "User")',
|
|
1278
|
+
' Write-Output " Added to user PATH (deduped): $target"',
|
|
1279
|
+
'} else {',
|
|
1280
|
+
' Write-Output " Already in user PATH: $target"',
|
|
1281
|
+
'}',
|
|
1282
|
+
].join('; ');
|
|
1283
|
+
spawnSync('powershell', ['-NoProfile', '-Command', pathPs], { stdio: 'inherit', windowsHide: true, timeout: 30000 });
|
|
1266
1284
|
|
|
1267
1285
|
console.log(`\n\x1b[32mInstall complete.\x1b[0m`);
|
|
1268
1286
|
console.log(` Verify: ${join(installDir, 'hcloud.exe')} version`);
|
|
@@ -1321,7 +1339,8 @@ async function cmdInstallHcloud() {
|
|
|
1321
1339
|
|
|
1322
1340
|
console.log('\nAfter install, set HCLOUD_BIN if hcloud is not on PATH.');
|
|
1323
1341
|
console.log('\n\x1b[1m\x1b[33m=== Configure credentials SAFELY ===\x1b[0m');
|
|
1324
|
-
console.log('
|
|
1342
|
+
console.log(' Unified credentials (recommended): npx huaweicloud-devkit auth init');
|
|
1343
|
+
console.log(' KooCLI only (alternative): hcloud configure init');
|
|
1325
1344
|
console.log(' NEVER: hcloud configure set --cli-access-key=xxx (AK/SK in shell history!)');
|
|
1326
1345
|
console.log('\nThen run: npx huaweicloud-devkit doctor');
|
|
1327
1346
|
}
|
|
@@ -1418,11 +1437,10 @@ async function cmdAuthInit() {
|
|
|
1418
1437
|
console.log(BANNER);
|
|
1419
1438
|
console.log('HuaweiCloud DevKit Unified Authentication Setup\n');
|
|
1420
1439
|
console.log('\x1b[1m获取 AK/SK(如果还没有):\x1b[0m');
|
|
1421
|
-
console.log(' 1.
|
|
1422
|
-
console.log(' https://console.huaweicloud.com/
|
|
1423
|
-
console.log(' 2.
|
|
1424
|
-
console.log(' 3.
|
|
1425
|
-
console.log(' 4. 下载凭证文件(内含 AK 和 SK)。');
|
|
1440
|
+
console.log(' 1. 打开华为云"访问密钥"页签:');
|
|
1441
|
+
console.log(' https://console.huaweicloud.com/iam/?region=cn-north-4#/mine/accessKey');
|
|
1442
|
+
console.log(' 2. 点击"新增访问密钥",完成身份验证');
|
|
1443
|
+
console.log(' 3. 下载凭证文件(内含 AK 和 SK)。');
|
|
1426
1444
|
console.log(' 注意:SK 只在创建密钥时显示一次,请妥善保存该文件。\n');
|
|
1427
1445
|
|
|
1428
1446
|
let ak = process.env.HW_ACCESS_KEY || '';
|
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
8
|
import { searchMarketplace } from './search-market.mjs';
|
|
9
9
|
import { execWithSession, closeSession, DEFAULT_WORKSPACE_ID } from './sandbox/session-manager.mjs';
|
|
10
|
-
import { hdkitCheckUser, hdkitSignAgreement, hdkitConnect, hdkitCredentials
|
|
10
|
+
import { hdkitCheckUser, hdkitSignAgreement, hdkitConnect, hdkitCredentials } from './sandbox/hdkitservice-api.mjs';
|
|
11
11
|
import { getAuthStatus, syncAuth } from './auth/service.mjs';
|
|
12
12
|
import { readGlobalCredentials, writeObsConfig as writeObsConfigFile } from './auth/credentials.mjs';
|
|
13
13
|
|
|
@@ -386,17 +386,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
386
386
|
},
|
|
387
387
|
},
|
|
388
388
|
},
|
|
389
|
-
|
|
390
|
-
name: 'huaweicloud_sandbox_release',
|
|
391
|
-
description: 'Release a sandbox via hdkitservice. Shuts down and deletes the sandbox, and cleans up the session. Idempotent - releasing a non-existent sandbox returns success.',
|
|
392
|
-
inputSchema: {
|
|
393
|
-
type: 'object',
|
|
394
|
-
properties: {
|
|
395
|
-
session_id: { type: 'string', description: 'Session ID from huaweicloud_sandbox_connect' },
|
|
396
|
-
dev_stage_id: { type: 'string', description: 'DevStation environment ID (alternative to session_id)' },
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
},
|
|
389
|
+
|
|
400
390
|
];
|
|
401
391
|
|
|
402
392
|
export async function callTool(name, args = {}) {
|
|
@@ -465,8 +455,6 @@ export async function callTool(name, args = {}) {
|
|
|
465
455
|
return await hdkitConnect(args);
|
|
466
456
|
case 'huaweicloud_sandbox_credentials':
|
|
467
457
|
return await hdkitCredentials(args.session_id, args.dev_stage_id, args.enable_sts !== false);
|
|
468
|
-
case 'huaweicloud_sandbox_release':
|
|
469
|
-
return await hdkitRelease(args.session_id, args.dev_stage_id);
|
|
470
458
|
default:
|
|
471
459
|
throw new Error(`Unknown tool: ${name}`);
|
|
472
460
|
}
|
|
@@ -575,7 +563,7 @@ async function setupObsConfigFromHcloud(profile) {
|
|
|
575
563
|
ok: false,
|
|
576
564
|
error: 'Failed to read hcloud profile.',
|
|
577
565
|
detail: result.error || result.stderr || 'hcloud not installed or not configured',
|
|
578
|
-
nextStep: 'Run "
|
|
566
|
+
nextStep: 'Run "npx huaweicloud-devkit auth init" outside agent chat, then retry.',
|
|
579
567
|
};
|
|
580
568
|
}
|
|
581
569
|
|
|
@@ -601,7 +589,7 @@ async function setupObsConfigFromHcloud(profile) {
|
|
|
601
589
|
return {
|
|
602
590
|
ok: false,
|
|
603
591
|
error: 'No credentials found in hcloud profile.',
|
|
604
|
-
nextStep: 'Run "
|
|
592
|
+
nextStep: 'Run "npx huaweicloud-devkit auth init" outside agent chat to set up credentials first.',
|
|
605
593
|
};
|
|
606
594
|
}
|
|
607
595
|
|