huaweicloud-devkit 1.0.2-dev.9 → 1.0.2-next.10
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/.agents/plugins/marketplace.json +20 -20
- package/LICENSE +201 -201
- package/README.md +178 -138
- package/README.zh-CN.md +176 -138
- package/bin/setup.cjs +10 -8
- package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
- package/integrations/opencode/opencode.json +11 -14
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
- package/package.json +60 -44
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +30 -43
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/.mcp.json +13 -15
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
- package/plugins/huaweicloud-core/safety/policy.json +76 -100
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +227 -199
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
- package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +103 -101
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +191 -190
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +171 -124
- package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
- package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +57 -56
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +106 -97
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +36 -29
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +29 -23
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +188 -185
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +144 -133
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +57 -55
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -131
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +60 -58
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +72 -71
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
- package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +69 -65
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
- package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +148 -122
- package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +134 -127
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +31 -26
- package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +101 -100
- package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
- package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +229 -224
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +173 -134
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +77 -76
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +60 -59
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +56 -47
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +138 -128
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +111 -96
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +20 -20
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +30 -28
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +59 -60
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +54 -1
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +103 -95
- package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
- package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +283 -265
- package/plugins/huaweicloud-core/src/icon-library.mjs +171 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +130 -129
- package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +68 -0
- package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +94 -0
- package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +140 -137
- package/plugins/huaweicloud-core/src/safety-policy.mjs +356 -302
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +86 -87
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +150 -153
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +196 -105
- package/plugins/huaweicloud-core/src/search-market.mjs +208 -169
- package/plugins/huaweicloud-core/src/setup-cli.mjs +2622 -1594
- package/plugins/huaweicloud-core/src/tools.mjs +463 -111
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +447 -427
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +128 -132
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +215 -227
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +189 -202
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +164 -158
- package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
- package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
|
@@ -1,134 +1,173 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: huawei-sandbox
|
|
3
|
-
description:
|
|
4
|
-
version: 1
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Huawei Cloud Sandbox
|
|
8
|
-
|
|
9
|
-
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
Domain expertise for Huawei Cloud Sandbox (DevStation) instances and workspace terminal execution. Covers sandbox lifecycle via hdkitservice API and remote terminal command execution via hwlink protocol.
|
|
14
|
-
|
|
15
|
-
## Activation
|
|
16
|
-
|
|
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
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
|
31
|
-
| `
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
|
38
|
-
| `
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
|
45
|
-
| `
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
1
|
+
---
|
|
2
|
+
name: huawei-sandbox
|
|
3
|
+
description: 'Use when creating, connecting, or managing Huawei Cloud Sandbox instances and workspace terminals, or when a task needs a temporary runtime to deploy, run, or preview a web application. Covers sandbox lifecycle (check-user, sign-agreement, connect, release), session-based terminal execution, and credential injection. Triggers on: sandbox, workspace, terminal, web app deployment, deploy web app, preview app, deploy github, github repo, deploy repo, website, static site, web application, hwlink, devstation, hdkitservice, remote exec. NOT for: ECS instances (use huawei-ecs), CCE clusters (use huawei-cce).'
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud Sandbox
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Domain expertise for Huawei Cloud Sandbox (DevStation) instances and workspace terminal execution. Covers sandbox lifecycle via hdkitservice API and remote terminal command execution via hwlink protocol.
|
|
14
|
+
|
|
15
|
+
## Activation
|
|
16
|
+
|
|
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
|
+
- **Static website hosting — present options, sandbox first**: when the developer asks to deploy/host/publish a static website or web app without naming a target, do NOT silently pick a service. Present the target options in this order: ① 沙箱 (recommended — temporary runtime, instant preview URL) ② OBS 静态托管 (long-term static hosting/CDN) ③ ECS ④ CCE, then follow the developer's choice. Recommended prompt: "建议优先部署到沙箱(临时运行环境,可预览访问),也可选择 OBS 静态托管、ECS 或 CCE,你想部署到哪里?" If the developer has no preference, proceed with the sandbox.
|
|
19
|
+
- **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 应用,建议优先使用沙箱部署(临时运行环境,可预览访问),是否使用?"
|
|
20
|
+
- **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.
|
|
21
|
+
- **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.
|
|
22
|
+
- **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.
|
|
23
|
+
- 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.
|
|
24
|
+
|
|
25
|
+
## MCP Tools
|
|
26
|
+
|
|
27
|
+
### User Verification (Prerequisites)
|
|
28
|
+
|
|
29
|
+
| Tool | Purpose |
|
|
30
|
+
| ------------------------------------ | ----------------------------------------------------------- |
|
|
31
|
+
| `huaweicloud_sandbox_check_user` | Check real-name verification and agreement signing status |
|
|
32
|
+
| `huaweicloud_sandbox_sign_agreement` | Sign unsigned/outdated agreements (required before connect) |
|
|
33
|
+
|
|
34
|
+
### Sandbox Lifecycle
|
|
35
|
+
|
|
36
|
+
| Tool | Purpose |
|
|
37
|
+
| --------------------------------- | ------------------------------------------------------------------------ |
|
|
38
|
+
| `huaweicloud_sandbox_connect` | Connect to sandbox (one user one instance, reuses existing if available) |
|
|
39
|
+
| `huaweicloud_sandbox_credentials` | Inject temporary AK/SK into a running sandbox |
|
|
40
|
+
|
|
41
|
+
### Terminal Execution
|
|
42
|
+
|
|
43
|
+
| Tool | Purpose |
|
|
44
|
+
| --------------------------------------- | ------------------------------------------------------------------------ |
|
|
45
|
+
| `huaweicloud_sandbox_exec_with_session` | Session-based execution (state persists) |
|
|
46
|
+
| `huaweicloud_sandbox_upload_file` | Upload a local file into the sandbox (chunked base64 write + md5 verify) |
|
|
47
|
+
| `huaweicloud_sandbox_close_session` | Close a persistent terminal session |
|
|
48
|
+
|
|
49
|
+
## Workflow
|
|
50
|
+
|
|
51
|
+
Setup is a **plugin-side preflight** — the developer should be asked a question only once, when the agreement actually needs signing:
|
|
52
|
+
|
|
53
|
+
1. **Check user** (transparent): `huaweicloud_sandbox_check_user` — returns `realnameVerified`/`agreementSigned` (200) when all good, OR throws a 403 error with one of these codes:
|
|
54
|
+
- `HDKIT_NOT_REALNAME` — real-name missing only → go to step 2
|
|
55
|
+
- `HDKIT_NOT_AGREEMENT` — latest agreement not signed only → go to step 3
|
|
56
|
+
- `HDKIT_NOT_REALNAME_AND_AGREEMENT` — both missing → go to step 4
|
|
57
|
+
2. **Real-name verification only** (`HDKIT_NOT_REALNAME`): tell the developer once, "Huawei Cloud requires real-name verification before using the sandbox — please complete it in the Huawei Cloud console (实名认证)." and stop — do not retry `connect` in a loop
|
|
58
|
+
3. **Sign agreement only** (`HDKIT_NOT_AGREEMENT`): **STOP and do NOT sign on your own.** Ask the developer: "Huawei Cloud sandbox requires signing the latest developer service agreement. May I sign it for you?" Then **wait for the developer to explicitly agree** (e.g. "签署" / "确认" / "sign it"). Only after explicit consent call `huaweicloud_sandbox_sign_agreement` and return its result (`signed`/`signedCount`) to the developer. **Never sign a legal agreement on the developer's behalf without their explicit, unambiguous consent.** Do not expose the underlying sandbox/DevBridge service as a separate entity the developer must understand or sign up for
|
|
59
|
+
4. **Both missing** (`HDKIT_NOT_REALNAME_AND_AGREEMENT`): present **both** requirements together in one message — the real-name verification steps (console, step 2) **and** the agreement-signing request (step 3, wait for explicit consent) — so the developer can complete both at once
|
|
60
|
+
5. **Connect**: `huaweicloud_sandbox_connect` — returns `session_id`, `dev_stage_id`, `connection_id`, `connection_address`
|
|
61
|
+
6. **Inject credentials** (optional): `huaweicloud_sandbox_credentials` — enables cloud API access from sandbox
|
|
62
|
+
7. **Execute commands**: `huaweicloud_sandbox_exec_with_session` for interactive work
|
|
63
|
+
8. **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
|
|
64
|
+
|
|
65
|
+
## File Transfer (local → sandbox)
|
|
66
|
+
|
|
67
|
+
There is no general file-upload primitive on the sandbox service itself. Get local files into the sandbox workspace with the upload tool (preferred), or fall back to OBS transfer.
|
|
68
|
+
|
|
69
|
+
### Upload tool (preferred)
|
|
70
|
+
|
|
71
|
+
`huaweicloud_sandbox_upload_file` (local_path → remote_path) uploads a local file by base64-encoding it and writing it in small chunks through the terminal session, then decoding and verifying the md5 checksum. Use it for any file too large to inline into a single command.
|
|
72
|
+
|
|
73
|
+
### Exec channel size limit
|
|
74
|
+
|
|
75
|
+
`huaweicloud_sandbox_exec_with_session` is fragile for long commands and large inline content. Do NOT paste a file's base64 directly into a single command:
|
|
76
|
+
|
|
77
|
+
| Payload | Result |
|
|
78
|
+
| --------------------------- | -------------------------------------- |
|
|
79
|
+
| ~30KB base64 in one command | exec timeout |
|
|
80
|
+
| ~12KB base64 in one command | session crash (`session is not ready`) |
|
|
81
|
+
| ~4–5KB normal command | OK |
|
|
82
|
+
|
|
83
|
+
Keep individual exec commands small (≤ ~4KB). For larger content, use `huaweicloud_sandbox_upload_file` instead.
|
|
84
|
+
|
|
85
|
+
### OBS transfer fallback
|
|
86
|
+
|
|
87
|
+
When the upload tool is unavailable, transfer through OBS: upload to a public-read object locally, then pull it into the sandbox.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Local: upload to OBS (public read)
|
|
91
|
+
hcloud OBS cp <local-file> obs://<bucket>/<key> -f -acl=public-read
|
|
92
|
+
# Sandbox: pull it down
|
|
93
|
+
curl -s -o /workspace/<repo>/<file> https://<bucket>.obs.<region>.myhuaweicloud.com/<key>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
> Requires OBS credentials (`huaweicloud_setup_obs_config`). Bucket ACL does not cascade to objects — set object-level `-acl=public-read` for anonymous reads.
|
|
97
|
+
|
|
98
|
+
## Expose the deployed app (public URL)
|
|
99
|
+
|
|
100
|
+
Expose a deployed web app to a public URL and return that URL to the developer.
|
|
101
|
+
|
|
102
|
+
**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.
|
|
103
|
+
|
|
104
|
+
**Install** (internal tooling; skip if `devbridge version` already works):
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash
|
|
108
|
+
export PATH=$PATH:$HOME/.huawei/bin # installer only writes ~/.bashrc; session shells do not re-source it
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Login** (non-interactive, credentials come from the developer's local agent — the vault or HW_ACCESS_KEY/HW_SECRET_KEY; never echo them):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
devbridge auth login --huaweicloud --access-key "$AK" --secret-key "$SK"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- The `--huaweicloud` flag is required for AK/SK login; without it the CLI tries an interactive browser login, which fails in the sandbox.
|
|
118
|
+
- Write the AK/SK to temp files with `umask 077` (or shell vars) and delete them right after login. Verify with `devbridge auth status`.
|
|
119
|
+
|
|
120
|
+
**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>`):
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cd /workspace/<repo-name> && nohup python3 -m http.server 8080 > /tmp/http.log 2>&1 &
|
|
124
|
+
nohup devbridge host -p 8080 -e 8 > /tmp/host.log 2>&1 &
|
|
125
|
+
sleep 10 && cat /tmp/host.log
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- The public URL has the form `https://<id>-<port>.cn-north-4-bridge.myhuaweicloud.com` (from the `Tunnel URL:` line).
|
|
129
|
+
- **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).
|
|
130
|
+
- Internal docs: https://huaweicloud.github.io/devspace-devbridge/
|
|
131
|
+
|
|
132
|
+
**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.
|
|
133
|
+
|
|
134
|
+
## Critical Warnings
|
|
135
|
+
|
|
136
|
+
| Trap | Why |
|
|
137
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
138
|
+
| 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 |
|
|
139
|
+
| Real-name required | `sandbox_connect` fails if `realnameVerified=false`; tell the developer once and stop, don't loop on connect |
|
|
140
|
+
| Never expose tunnel details | Do not mention "DevBridge"/"tunnel"/"devbridge" to the developer — say "正在生成访问地址..." and hand over only the URL |
|
|
141
|
+
| Login needs `--huaweicloud` | `devbridge auth login --access-key/--secret-key` without `--huaweicloud` falls back to interactive browser login, which fails in the sandbox |
|
|
142
|
+
| CLI PATH | The installer only writes `~/.bashrc`; run `export PATH=$PATH:$HOME/.huawei/bin` in the session before using `devbridge` |
|
|
143
|
+
| 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 |
|
|
144
|
+
| Return the deployment URL | Always hand the public URL from the host log to the developer as the final result |
|
|
145
|
+
| Session state persists | `exec_with_session` preserves `cd`, env vars, aliases between calls |
|
|
146
|
+
| Destructive commands blocked | `rm -rf /`, `mkfs`, `dd if=`, fork bombs are denied by safety policy |
|
|
147
|
+
| Workspace ID = dev_stage_id | Use `dev_stage_id` from `sandbox_connect` as `workspace_id` for terminal exec |
|
|
148
|
+
| 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 |
|
|
149
|
+
| 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") |
|
|
150
|
+
|
|
151
|
+
## Node.js in the sandbox
|
|
152
|
+
|
|
153
|
+
If the sandbox has no Node.js, download it from the Huawei Cloud mirror. Pick the tarball matching the sandbox arch (`uname -m`: `aarch64` -> arm64, `x86_64` -> x64):
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# aarch64 sandbox:
|
|
157
|
+
curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-arm64.tar.gz -o node.tar.gz
|
|
158
|
+
# x86_64 sandbox:
|
|
159
|
+
curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-x64.tar.gz -o node.tar.gz
|
|
160
|
+
sudo tar -xzf node.tar.gz -C /usr/local --strip-components=1
|
|
161
|
+
node --version
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Environment Variables
|
|
165
|
+
|
|
166
|
+
| Variable | Required | Description |
|
|
167
|
+
| ----------------------- | -------- | ------------------------- |
|
|
168
|
+
| `HW_ACCESS_KEY` | Yes | Huawei Cloud AK |
|
|
169
|
+
| `HW_SECRET_KEY` | Yes | Huawei Cloud SK |
|
|
170
|
+
| `HW_SECURITY_TOKEN` | No | STS security token |
|
|
171
|
+
| `HW_WORKSPACE_ID` | No | Default workspace ID |
|
|
172
|
+
| `HDKITSERVICE_ENDPOINT` | No | hdkitservice API endpoint |
|
|
173
|
+
| `HWLINK_ENDPOINT` | No | DevStation API endpoint |
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: huawei-smn-dms
|
|
3
|
-
description:
|
|
4
|
-
version: 1
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Huawei Cloud SMN / DMS
|
|
8
|
-
|
|
9
|
-
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
-
|
|
11
|
-
Always run `hcloud SMN <Operation> --help` or `hcloud DMS <Operation> --help` before constructing commands.
|
|
12
|
-
|
|
13
|
-
## Overview
|
|
14
|
-
|
|
15
|
-
Domain expertise for SMN (Simple Message Notification) and DMS (Distributed Message Service). SMN is used for notifications and alerts. DMS covers Kafka, RabbitMQ, and RocketMQ instances.
|
|
16
|
-
|
|
17
|
-
## SMN
|
|
18
|
-
|
|
19
|
-
## Critical Warnings
|
|
20
|
-
|
|
21
|
-
| Trap
|
|
22
|
-
|
|
23
|
-
| Subscription confirmation | HTTP/HTTPS subscriptions need endpoint ping-back confirmation |
|
|
24
|
-
| Email subscription delay
|
|
25
|
-
| SMS charge per message
|
|
26
|
-
|
|
27
|
-
### Common Workflows
|
|
28
|
-
|
|
29
|
-
| Task
|
|
30
|
-
|
|
31
|
-
| List topics
|
|
32
|
-
| Create topic
|
|
33
|
-
| Add subscription
|
|
34
|
-
| List subscriptions
|
|
35
|
-
| Create message template | `CreateMessageTemplate --cli-region=<r> --project_id=<p>` |
|
|
36
|
-
| Publish message
|
|
37
|
-
| Delete topic
|
|
38
|
-
|
|
39
|
-
## DMS
|
|
40
|
-
|
|
41
|
-
### Service Types
|
|
42
|
-
|
|
43
|
-
| Type
|
|
44
|
-
|
|
45
|
-
| Kafka
|
|
46
|
-
| RabbitMQ | `hcloud DMS`
|
|
47
|
-
| RocketMQ | `hcloud DMS`
|
|
48
|
-
|
|
49
|
-
### Common Workflows
|
|
50
|
-
|
|
51
|
-
| Task
|
|
52
|
-
|
|
53
|
-
| List instances
|
|
54
|
-
| Create Kafka instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
|
|
55
|
-
| List Kafka topics
|
|
56
|
-
|
|
57
|
-
Discover exact parameters with `--help` before executing any command.
|
|
58
|
-
|
|
59
|
-
## Troubleshooting
|
|
60
|
-
|
|
61
|
-
| Error
|
|
62
|
-
|
|
63
|
-
| Subscription not confirmed
|
|
64
|
-
| DMS instance creation fails | Check VPC/subnet availability and engine version
|
|
65
|
-
|
|
66
|
-
## Cross-Skill References
|
|
67
|
-
|
|
68
|
-
- **CES alarms**: See `huawei-cloud-eye` for SMN-based alarm notifications
|
|
69
|
-
- **VPC**: See `huawei-vpc` for DMS instance networking
|
|
1
|
+
---
|
|
2
|
+
name: huawei-smn-dms
|
|
3
|
+
description: 'Use when creating or managing SMN topics/subscriptions/messages or DMS Kafka/RabbitMQ/RocketMQ queues on Huawei Cloud. Triggers: SMN, DMS, notification, message queue, Kafka, RabbitMQ, RocketMQ, topic, subscription. NOT for: APIG (use huawei-apig), FunctionGraph triggers (use huawei-functiongraph).'
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud SMN / DMS
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
Always run `hcloud SMN <Operation> --help` or `hcloud DMS <Operation> --help` before constructing commands.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Domain expertise for SMN (Simple Message Notification) and DMS (Distributed Message Service). SMN is used for notifications and alerts. DMS covers Kafka, RabbitMQ, and RocketMQ instances.
|
|
16
|
+
|
|
17
|
+
## SMN
|
|
18
|
+
|
|
19
|
+
## Critical Warnings
|
|
20
|
+
|
|
21
|
+
| Trap | Why |
|
|
22
|
+
| ------------------------- | ------------------------------------------------------------- |
|
|
23
|
+
| Subscription confirmation | HTTP/HTTPS subscriptions need endpoint ping-back confirmation |
|
|
24
|
+
| Email subscription delay | Email subscriptions require user to click confirmation link |
|
|
25
|
+
| SMS charge per message | Template SMS incurs per-delivery charges |
|
|
26
|
+
|
|
27
|
+
### Common Workflows
|
|
28
|
+
|
|
29
|
+
| Task | Operation |
|
|
30
|
+
| ----------------------- | --------------------------------------------------------- |
|
|
31
|
+
| List topics | `ListTopics --cli-region=<r> --project_id=<p>` |
|
|
32
|
+
| Create topic | `CreateTopic --cli-region=<r> --project_id=<p>` |
|
|
33
|
+
| Add subscription | `AddSubscription --cli-region=<r> --project_id=<p>` |
|
|
34
|
+
| List subscriptions | `ListSubscriptions --cli-region=<r> --project_id=<p>` |
|
|
35
|
+
| Create message template | `CreateMessageTemplate --cli-region=<r> --project_id=<p>` |
|
|
36
|
+
| Publish message | `PublishMessage --cli-region=<r> --project_id=<p>` |
|
|
37
|
+
| Delete topic | `DeleteTopic --cli-region=<r> --project_id=<p>` |
|
|
38
|
+
|
|
39
|
+
## DMS
|
|
40
|
+
|
|
41
|
+
### Service Types
|
|
42
|
+
|
|
43
|
+
| Type | KooCLI Service |
|
|
44
|
+
| -------- | -------------- |
|
|
45
|
+
| Kafka | `hcloud DMS` |
|
|
46
|
+
| RabbitMQ | `hcloud DMS` |
|
|
47
|
+
| RocketMQ | `hcloud DMS` |
|
|
48
|
+
|
|
49
|
+
### Common Workflows
|
|
50
|
+
|
|
51
|
+
| Task | Operation |
|
|
52
|
+
| --------------------- | -------------------------------------------------- |
|
|
53
|
+
| List instances | `ListInstances --cli-region=<r> --project_id=<p>` |
|
|
54
|
+
| Create Kafka instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
|
|
55
|
+
| List Kafka topics | `ListTopics --cli-region=<r> --project_id=<p>` |
|
|
56
|
+
|
|
57
|
+
Discover exact parameters with `--help` before executing any command.
|
|
58
|
+
|
|
59
|
+
## Troubleshooting
|
|
60
|
+
|
|
61
|
+
| Error | Fix |
|
|
62
|
+
| --------------------------- | ------------------------------------------------- |
|
|
63
|
+
| Subscription not confirmed | SMN subscriptions need endpoint/user confirmation |
|
|
64
|
+
| DMS instance creation fails | Check VPC/subnet availability and engine version |
|
|
65
|
+
|
|
66
|
+
## Cross-Skill References
|
|
67
|
+
|
|
68
|
+
- **CES alarms**: See `huawei-cloud-eye` for SMN-based alarm notifications
|
|
69
|
+
- **VPC**: See `huawei-vpc` for DMS instance networking
|