huaweicloud-devkit 1.0.2-next.3 → 1.0.3-dev.0

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 (97) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +139 -163
  4. package/README.zh-CN.md +139 -161
  5. package/bin/setup.cjs +8 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +14 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +44 -47
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -44
  13. package/plugins/huaweicloud-core/.mcp.json +15 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -44
  15. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  16. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
  17. package/plugins/huaweicloud-core/safety/policy.json +99 -99
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +199 -199
  19. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
  20. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  21. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  22. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
  23. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
  24. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -124
  26. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  27. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  28. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +185 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +133 -133
  34. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  35. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +55 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +131 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
  40. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  41. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  42. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
  44. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  45. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -122
  46. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
  47. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  48. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +127 -133
  49. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
  50. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -100
  52. package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
  53. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  54. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +224 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +134 -139
  56. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  57. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
  58. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
  60. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
  61. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  62. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
  63. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  64. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -51
  65. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  66. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +128 -128
  67. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  68. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +95 -110
  69. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  70. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +60 -60
  73. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  74. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  75. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  76. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +87 -105
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  80. package/plugins/huaweicloud-core/src/mcp-server.mjs +129 -129
  81. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
  82. package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
  83. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +87 -91
  84. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +153 -162
  85. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +105 -112
  86. package/plugins/huaweicloud-core/src/search-market.mjs +169 -174
  87. package/plugins/huaweicloud-core/src/setup-cli.mjs +1594 -2017
  88. package/plugins/huaweicloud-core/src/tools.mjs +993 -1008
  89. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
  90. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
  91. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
  92. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
  94. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  95. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
  96. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +0 -155
  97. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +0 -87
@@ -1,139 +1,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_close_session` | Close a persistent terminal session |
47
-
48
- ## Workflow
49
-
50
- Setup is a **plugin-side preflight** — the developer should be asked a question only once, when the agreement actually needs signing:
51
-
52
- 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:
53
- - `HDKIT_NOT_REALNAME` — real-name missing only go to step 2
54
- - `HDKIT_NOT_AGREEMENT` — latest agreement not signed only → go to step 3
55
- - `HDKIT_NOT_REALNAME_AND_AGREEMENT` — both missing go to step 4
56
- 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
57
- 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
58
- 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
59
- 5. **Connect**: `huaweicloud_sandbox_connect` returns `session_id`, `dev_stage_id`, `connection_id`, `connection_address`
60
- 6. **Inject credentials** (optional): `huaweicloud_sandbox_credentials` — enables cloud API access from sandbox
61
- 7. **Execute commands**: `huaweicloud_sandbox_exec_with_session` for interactive work
62
- 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
63
-
64
- ## Expose the deployed app (public URL)
65
-
66
- Expose a deployed web app to a public URL and return that URL to the developer.
67
-
68
- **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.
69
-
70
- **Install** (internal tooling; skip if `devbridge version` already works):
71
-
72
- ```bash
73
- curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash
74
- export PATH=$PATH:$HOME/.huawei/bin # installer only writes ~/.bashrc; session shells do not re-source it
75
- ```
76
-
77
- **Login** (non-interactive, credentials come from the developer's local agent — the vault or HW_ACCESS_KEY/HW_SECRET_KEY; never echo them):
78
-
79
- ```bash
80
- devbridge auth login --huaweicloud --access-key "$AK" --secret-key "$SK"
81
- ```
82
-
83
- - The `--huaweicloud` flag is required for AK/SK login; without it the CLI tries an interactive browser login, which fails in the sandbox.
84
- - Write the AK/SK to temp files with `umask 077` (or shell vars) and delete them right after login. Verify with `devbridge auth status`.
85
-
86
- **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>`):
87
-
88
- ```bash
89
- cd /workspace/<repo-name> && nohup python3 -m http.server 8080 > /tmp/http.log 2>&1 &
90
- nohup devbridge host -p 8080 -e 8 > /tmp/host.log 2>&1 &
91
- sleep 10 && cat /tmp/host.log
92
- ```
93
-
94
- - The public URL has the form `https://<id>-<port>.cn-north-4-bridge.myhuaweicloud.com` (from the `Tunnel URL:` line).
95
- - **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).
96
- - Internal docs: https://huaweicloud.github.io/devspace-devbridge/
97
-
98
- **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.
99
-
100
- ## Critical Warnings
101
-
102
- | Trap | Why |
103
- |------|-----|
104
- | 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 |
105
- | Real-name required | `sandbox_connect` fails if `realnameVerified=false`; tell the developer once and stop, don't loop on connect |
106
- | Never expose tunnel details | Do not mention "DevBridge"/"tunnel"/"devbridge" to the developer say "正在生成访问地址..." and hand over only the URL |
107
- | Login needs `--huaweicloud` | `devbridge auth login --access-key/--secret-key` without `--huaweicloud` falls back to interactive browser login, which fails in the sandbox |
108
- | CLI PATH | The installer only writes `~/.bashrc`; run `export PATH=$PATH:$HOME/.huawei/bin` in the session before using `devbridge` |
109
- | 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 |
110
- | Return the deployment URL | Always hand the public URL from the host log to the developer as the final result |
111
- | Session state persists | `exec_with_session` preserves `cd`, env vars, aliases between calls |
112
- | Destructive commands blocked | `rm -rf /`, `mkfs`, `dd if=`, fork bombs are denied by safety policy |
113
- | Workspace ID = dev_stage_id | Use `dev_stage_id` from `sandbox_connect` as `workspace_id` for terminal exec |
114
- | 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 |
115
- | 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") |
116
-
117
- ## Node.js in the sandbox
118
-
119
- 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):
120
-
121
- ```bash
122
- # aarch64 sandbox:
123
- curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-arm64.tar.gz -o node.tar.gz
124
- # x86_64 sandbox:
125
- curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-x64.tar.gz -o node.tar.gz
126
- sudo tar -xzf node.tar.gz -C /usr/local --strip-components=1
127
- node --version
128
- ```
129
-
130
- ## Environment Variables
131
-
132
- | Variable | Required | Description |
133
- |----------|----------|-------------|
134
- | `HW_ACCESS_KEY` | Yes | Huawei Cloud AK |
135
- | `HW_SECRET_KEY` | Yes | Huawei Cloud SK |
136
- | `HW_SECURITY_TOKEN` | No | STS security token |
137
- | `HW_WORKSPACE_ID` | No | Default workspace ID |
138
- | `HDKITSERVICE_ENDPOINT` | No | hdkitservice API endpoint |
139
- | `HWLINK_ENDPOINT` | No | DevStation API endpoint |
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
+ - **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.
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.
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.
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.
23
+
24
+ ## MCP Tools
25
+
26
+ ### User Verification (Prerequisites)
27
+
28
+ | Tool | Purpose |
29
+ |------|---------|
30
+ | `huaweicloud_sandbox_check_user` | Check real-name verification and agreement signing status |
31
+ | `huaweicloud_sandbox_sign_agreement` | Sign unsigned/outdated agreements (required before connect) |
32
+
33
+ ### Sandbox Lifecycle
34
+
35
+ | Tool | Purpose |
36
+ |------|---------|
37
+ | `huaweicloud_sandbox_connect` | Connect to sandbox (one user one instance, reuses existing if available) |
38
+ | `huaweicloud_sandbox_credentials` | Inject temporary AK/SK into a running sandbox |
39
+
40
+ ### Terminal Execution
41
+
42
+ | Tool | Purpose |
43
+ |------|---------|
44
+ | `huaweicloud_sandbox_exec_with_session` | Session-based execution (state persists) |
45
+ | `huaweicloud_sandbox_close_session` | Close a persistent terminal session |
46
+
47
+ ## Workflow
48
+
49
+ Setup is a **plugin-side preflight** — the developer should be asked a question only once, when the agreement actually needs signing:
50
+
51
+ 1. **Check user** (transparent): `huaweicloud_sandbox_check_user` — verify `realname_verified` and `agreement_signed`
52
+ 2. **Real-name verification** (only if `realname_verified=false`): tell the developer once, "Huawei Cloud requires real-name verification before using the sandbox." and stop do not retry `connect` in a loop
53
+ 3. **Sign agreement** (only if `agreement_signed=false`): ask the developer once as the plugin "Huawei Cloud sandbox requires signing its service agreement. May I sign it on your behalf?" — then call `huaweicloud_sandbox_sign_agreement`. Do not expose the underlying sandbox/DevBridge service as a separate entity the developer must understand or sign up for
54
+ 4. **Connect**: `huaweicloud_sandbox_connect` — returns `session_id`, `dev_stage_id`, `connection_id`, `connection_address`
55
+ 5. **Inject credentials** (optional): `huaweicloud_sandbox_credentials` — enables cloud API access from sandbox
56
+ 6. **Execute commands**: `huaweicloud_sandbox_exec_with_session` for interactive work
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
58
+
59
+ ## Expose the deployed app (public URL)
60
+
61
+ Expose a deployed web app to a public URL and return that URL to the developer.
62
+
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):
66
+
67
+ ```bash
68
+ curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash
69
+ export PATH=$PATH:$HOME/.huawei/bin # installer only writes ~/.bashrc; session shells do not re-source it
70
+ ```
71
+
72
+ **Login** (non-interactive, credentials come from the developer's local agent — the vault or HW_ACCESS_KEY/HW_SECRET_KEY; never echo them):
73
+
74
+ ```bash
75
+ devbridge auth login --huaweicloud --access-key "$AK" --secret-key "$SK"
76
+ ```
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.
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`.
80
+
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>`):
82
+
83
+ ```bash
84
+ cd /workspace/<repo-name> && nohup python3 -m http.server 8080 > /tmp/http.log 2>&1 &
85
+ nohup devbridge host -p 8080 -e 8 > /tmp/host.log 2>&1 &
86
+ sleep 10 && cat /tmp/host.log
87
+ ```
88
+
89
+ - The public URL has the form `https://<id>-<port>.cn-north-4-bridge.myhuaweicloud.com` (from the `Tunnel URL:` line).
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).
91
+ - Internal docs: https://huaweicloud.github.io/devspace-devbridge/
92
+
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.
94
+
95
+ ## Critical Warnings
96
+
97
+ | Trap | Why |
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 |
100
+ | Real-name required | `sandbox_connect` fails if `realname_verified=false`; tell the developer once and stop, don't loop on connect |
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 |
106
+ | Session state persists | `exec_with_session` preserves `cd`, env vars, aliases between calls |
107
+ | Destructive commands blocked | `rm -rf /`, `mkfs`, `dd if=`, fork bombs are denied by safety policy |
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 |
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") |
111
+
112
+ ## Node.js in the sandbox
113
+
114
+ 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):
115
+
116
+ ```bash
117
+ # aarch64 sandbox:
118
+ curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-arm64.tar.gz -o node.tar.gz
119
+ # x86_64 sandbox:
120
+ curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-x64.tar.gz -o node.tar.gz
121
+ sudo tar -xzf node.tar.gz -C /usr/local --strip-components=1
122
+ node --version
123
+ ```
124
+
125
+ ## Environment Variables
126
+
127
+ | Variable | Required | Description |
128
+ |----------|----------|-------------|
129
+ | `HW_ACCESS_KEY` | Yes | Huawei Cloud AK |
130
+ | `HW_SECRET_KEY` | Yes | Huawei Cloud SK |
131
+ | `HW_SECURITY_TOKEN` | No | STS security token |
132
+ | `HW_WORKSPACE_ID` | No | Default workspace ID |
133
+ | `HDKITSERVICE_ENDPOINT` | No | hdkitservice API endpoint |
134
+ | `HWLINK_ENDPOINT` | No | DevStation API endpoint |
@@ -1,69 +1,69 @@
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
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