huaweicloud-devkit 2.0.0-next.6 → 2.0.1-next.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 (36) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
  4. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
  5. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
  6. package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +1 -1
  7. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +1 -1
  8. package/plugins/huaweicloud-core/dist/agents/codex-config.js +5 -3
  9. package/plugins/huaweicloud-core/dist/agents/opencode-config.js +4 -2
  10. package/plugins/huaweicloud-core/dist/agents/opencode.js +11 -4
  11. package/plugins/huaweicloud-core/dist/hcloud-plan.js +3 -3
  12. package/plugins/huaweicloud-core/dist/lib/approval-mode.js +10 -11
  13. package/plugins/huaweicloud-core/dist/mcp-server.js +14 -13
  14. package/plugins/huaweicloud-core/dist/mcp-server.js.map +2 -2
  15. package/plugins/huaweicloud-core/dist/packs/auth/tools.js +2 -2
  16. package/plugins/huaweicloud-core/dist/packs/huaweicloud-cli/tools.js +2 -2
  17. package/plugins/huaweicloud-core/dist/packs/obs/tools.js +2 -2
  18. package/plugins/huaweicloud-core/dist/packs/secrets/tools.js +1 -1
  19. package/plugins/huaweicloud-core/dist/packs/update/tools.js +5 -4
  20. package/plugins/huaweicloud-core/dist/tool-definitions.js +1 -1
  21. package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
  22. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +3 -3
  23. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +6 -6
  24. package/plugins/huaweicloud-core/skills/huaweicloud-safety/references/approvals.md +5 -5
  25. package/plugins/huaweicloud-core/src/agents/codex-config.ts +5 -3
  26. package/plugins/huaweicloud-core/src/agents/opencode-config.ts +6 -3
  27. package/plugins/huaweicloud-core/src/agents/opencode.ts +15 -4
  28. package/plugins/huaweicloud-core/src/hcloud-plan.ts +3 -3
  29. package/plugins/huaweicloud-core/src/lib/approval-mode.ts +10 -11
  30. package/plugins/huaweicloud-core/src/mcp-server.ts +6 -2
  31. package/plugins/huaweicloud-core/src/packs/auth/tools.ts +2 -2
  32. package/plugins/huaweicloud-core/src/packs/huaweicloud-cli/tools.ts +2 -2
  33. package/plugins/huaweicloud-core/src/packs/obs/tools.ts +2 -2
  34. package/plugins/huaweicloud-core/src/packs/secrets/tools.ts +1 -1
  35. package/plugins/huaweicloud-core/src/packs/update/tools.ts +5 -4
  36. package/plugins/huaweicloud-core/src/tool-definitions.ts +1 -1
@@ -233,13 +233,13 @@ export const AUTH_TOOLS = [
233
233
  },
234
234
  {
235
235
  name: 'huaweicloud_auth_init',
236
- description: 'Set or clear runtime Huawei Cloud credentials (AK/SK) for this MCP session. Runtime credentials take highest priority over environment variables and config files for all subsequent API calls. Use when switching accounts within the same Agent session — call with AK/SK to switch, or with clear=true to fall back to env/file credentials. Approval-gated: the account switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint — in the default token mode the first call returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>); under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
236
+ description: 'Set or clear runtime Huawei Cloud credentials (AK/SK) for this MCP session. Runtime credentials take highest priority over environment variables and config files for all subsequent API calls. Use when switching accounts within the same Agent session — call with AK/SK to switch, or with clear=true to fall back to env/file credentials. Approval-gated: the account switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint — the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip); under DEVKIT_APPROVAL_MODE=token (opt-in) the first call instead returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
237
237
  schema: authInitSchema,
238
238
  handler: handleAuthInit,
239
239
  },
240
240
  {
241
241
  name: 'huaweicloud_auth_switch',
242
- description: 'Switch Huawei Cloud credentials within the current session. action=temporary keeps AK/SK in memory only (restart loses them; hcloud commands are unaffected and an A+C warning will be raised). action=persist writes S1 (single source of truth) with configuredBySession flag and propagates to S2 (KooCLI current profile) and S3 (OBS). action=clear resets runtime credentials. mode=import reads AK/SK from ~/.config/huaweicloud/creds-import.json then wipes it (SK never enters conversation). mode=memory passes AK/SK as tool arguments (SK is visible to model - prefer import). mode=mcp-config reads the injected mcp_settings environment. Approval-gated: the switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint and the credential source — in the default token mode the first call returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>); under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
242
+ description: 'Switch Huawei Cloud credentials within the current session. action=temporary keeps AK/SK in memory only (restart loses them; hcloud commands are unaffected and an A+C warning will be raised). action=persist writes S1 (single source of truth) with configuredBySession flag and propagates to S2 (KooCLI current profile) and S3 (OBS). action=clear resets runtime credentials. mode=import reads AK/SK from ~/.config/huaweicloud/creds-import.json then wipes it (SK never enters conversation). mode=memory passes AK/SK as tool arguments (SK is visible to model - prefer import). mode=mcp-config reads the injected mcp_settings environment. Approval-gated: the switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint and the credential source — the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip); under DEVKIT_APPROVAL_MODE=token (opt-in) the first call instead returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
243
243
  schema: authSwitchSchema,
244
244
  handler: handleAuthSwitch,
245
245
  },
@@ -398,7 +398,7 @@ export const HUAWEICLOUD_CLI_TOOLS = [
398
398
  },
399
399
  {
400
400
  name: 'huaweicloud_plan_cli_command',
401
- description: "Classify and plan a Huawei Cloud hcloud command without executing it. When the result's userConfirmation.needed is true, the command waits on user confirmation before huaweicloud_run_approved_command will accept it: in the default token mode the USER runs the userConfirmation.command line (npx huaweicloud-devkit approve <approvalToken>) in their own terminal, and under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself on the run call (an elicitation form, or an ASK_CONFIRMATION_REQUIRED chat round-trip) — no token is needed. Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.",
401
+ description: "Classify and plan a Huawei Cloud hcloud command without executing it. When the result's userConfirmation.needed is true, the command waits on user confirmation before huaweicloud_run_approved_command will accept it: the server raises the confirmation itself on the run call (an elicitation form, or an ASK_CONFIRMATION_REQUIRED chat round-trip) — no token is needed; under DEVKIT_APPROVAL_MODE=token (opt-in, and the forced posture on the remote transport) the USER instead runs the userConfirmation.command line (npx huaweicloud-devkit approve <approvalToken>) in their own terminal. Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.",
402
402
  schema: planCliCommandSchema,
403
403
  handler: handlePlanCliCommand,
404
404
  },
@@ -416,7 +416,7 @@ export const HUAWEICLOUD_CLI_TOOLS = [
416
416
  },
417
417
  {
418
418
  name: 'huaweicloud_run_approved_command',
419
- description: 'Run a write-capable hcloud command only after the exact command has been shown and explicitly approved by the user. In the default token mode the user must also confirm the plan token in their own terminal (npx huaweicloud-devkit approve <token>) — a non-read command without that terminal confirmation is rejected with USER_CONFIRMATION_REQUIRED and the token stays usable. Under DEVKIT_APPROVAL_MODE=ask the confirmation runs on the server: on a client that supports MCP elicitation the devkit raises a form during this call (approve runs it once; dismiss, decline, or the timeout cancels it), and on any other client the call returns ASK_CONFIRMATION_REQUIRED, whose envelope carries the command line — show it to the user in chat, then retry the same call with approvedByUser: true, which is model-relayed posture trust. In both modes always send command: it is the line the user reads, and the server rejects a line that does not match args (COMMAND_ARGS_MISMATCH). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
419
+ description: 'Run a write-capable hcloud command only after the exact command has been shown and explicitly approved by the user. By default the confirmation runs on the server: on a client that supports MCP elicitation the devkit raises a form during this call (approve runs it once; dismiss, decline, or the timeout cancels it), and on any other client the call returns ASK_CONFIRMATION_REQUIRED, whose envelope carries the command line — show it to the user in chat, then retry the same call with approvedByUser: true, which is model-relayed posture trust. Under DEVKIT_APPROVAL_MODE=token (opt-in, and the forced posture on the remote transport) the user must also confirm the plan token in their own terminal (npx huaweicloud-devkit approve <token>) — a non-read command without that terminal confirmation is rejected with USER_CONFIRMATION_REQUIRED and the token stays usable. In both modes always send command: it is the line the user reads, and the server rejects a line that does not match args (COMMAND_ARGS_MISMATCH). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
420
420
  schema: runApprovedCommandSchema,
421
421
  handler: handleRunApprovedCommand,
422
422
  },
@@ -395,7 +395,7 @@ export const OBS_TOOLS = [
395
395
  },
396
396
  {
397
397
  name: 'huaweicloud_obs_set_website_config',
398
- description: '配置 OBS 桶的静态网站托管(推荐路径:无需手写 XML,此工具内部实现 AWS4 签名调用 OBS REST API,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认,DEVKIT_APPROVAL_MODE=ask 时由服务器弹出确认;get 是签名只读,从不确认、直接执行。KooCLI 7.3.12+ 另有 `hcloud OBS website -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。操作前需确保桶已创建且已设置 public-read ACL。',
398
+ description: '配置 OBS 桶的静态网站托管(推荐路径:无需手写 XML,此工具内部实现 AWS4 签名调用 OBS REST API,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,默认由服务器弹出确认(表单或聊天往返);DEVKIT_APPROVAL_MODE=token(opt-in)时无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认;get 是签名只读,从不确认、直接执行。KooCLI 7.3.12+ 另有 `hcloud OBS website -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。操作前需确保桶已创建且已设置 public-read ACL。',
399
399
  schema: obsWebsiteConfigSchema,
400
400
  handler: handleObsWebsiteConfig,
401
401
  },
@@ -407,7 +407,7 @@ export const OBS_TOOLS = [
407
407
  // claimed the CLI lacks it, measured on its 7.2.x sandbox. The tool stays
408
408
  // the recommended path (no XML file, no --noproxy traps); the CLI is the
409
409
  // scripted alternative for 7.3.12+ environments.
410
- description: '配置 OBS 桶的 CORS 规则(浏览器直传前置条件;推荐路径:此工具内部实现 AWS4 签名调用 OBS REST API(PUT/GET/DELETE /?cors),无需手写 XML,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认,DEVKIT_APPROVAL_MODE=ask 时由服务器弹出确认;get 是签名只读,从不确认、直接执行。allowedMethod 必须含 HEAD(BrowserJS SDK 每次操作前发 HEAD ?apiversion 探测,缺 HEAD 时浏览器吞掉探测请求报 Network Error)。KooCLI 7.3.12+ 另有 `hcloud OBS cors obs://<bucket> -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。配置成功后用返回体中的 verify 命令做 OPTIONS 预检验证(200 + Access-Control-Allow-Origin 才算成功)。',
410
+ description: '配置 OBS 桶的 CORS 规则(浏览器直传前置条件;推荐路径:此工具内部实现 AWS4 签名调用 OBS REST API(PUT/GET/DELETE /?cors),无需手写 XML,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,默认由服务器弹出确认(表单或聊天往返);DEVKIT_APPROVAL_MODE=token(opt-in)时无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认;get 是签名只读,从不确认、直接执行。allowedMethod 必须含 HEAD(BrowserJS SDK 每次操作前发 HEAD ?apiversion 探测,缺 HEAD 时浏览器吞掉探测请求报 Network Error)。KooCLI 7.3.12+ 另有 `hcloud OBS cors obs://<bucket> -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。配置成功后用返回体中的 verify 命令做 OPTIONS 预检验证(200 + Access-Control-Allow-Origin 才算成功)。',
411
411
  schema: obsCorsConfigSchema,
412
412
  handler: handleObsCorsConfig,
413
413
  },
@@ -112,7 +112,7 @@ export const SECRETS_TOOLS = [
112
112
  },
113
113
  {
114
114
  name: 'huaweicloud_secret_delete',
115
- description: 'Delete one secret from the local vault by ref. Destructive with no version history, so the approval gate mediates every call: in the default token mode a no-token call returns USER_CONFIRMATION_REQUIRED with the approve command line for the user\u2019s own terminal, and under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (form, or an ASK_CONFIRMATION_REQUIRED chat round-trip). Deleting a ref that S1 credentials.json points at breaks those credential reads until the operator re-stores it (the strict vault seam fails closed on the unresolvable ref). Idempotent: removed=1 when a secret was deleted, removed=0 when the ref was not stored (usually a typo in the ref — check with huaweicloud_secret_list).',
115
+ description: 'Delete one secret from the local vault by ref. Destructive with no version history, so the approval gate mediates every call: the server raises the confirmation itself (form, or an ASK_CONFIRMATION_REQUIRED chat round-trip); under DEVKIT_APPROVAL_MODE=token (opt-in) a no-token call instead returns USER_CONFIRMATION_REQUIRED with the approve command line for the user\u2019s own terminal. Deleting a ref that S1 credentials.json points at breaks those credential reads until the operator re-stores it (the strict vault seam fails closed on the unresolvable ref). Idempotent: removed=1 when a secret was deleted, removed=0 when the ref was not stored (usually a typo in the ref — check with huaweicloud_secret_list).',
116
116
  schema: secretDeleteSchema,
117
117
  handler: handleSecretDelete,
118
118
  },
@@ -65,10 +65,11 @@ export const UPDATE_TOOLS = [
65
65
  {
66
66
  name: 'huaweicloud_upgrade',
67
67
  // The mechanical approval gate enforces the consent this line used to
68
- // only ask for (PR-3c): token mode runs the approve command from the
69
- // gate's rejection envelope in the user's own terminal, ask mode lets
70
- // the server raise the confirmation itself.
71
- description: '升级 huaweicloud-devkit 到最新版本。升级会改写磁盘上的插件本体,因此由审批门机械把关:默认 token 模式下,无 token 调用会返回 USER_CONFIRMATION_REQUIRED 与 approve 命令行,用户在自己的终端确认后才可重试;DEVKIT_APPROVAL_MODE=ask 时由服务器在调用内弹出确认(表单或聊天往返)。version 仅支持 "latest"。完成后需重启会话生效。',
68
+ // only ask for (PR-3c): ask mode (the default) lets the server raise
69
+ // the confirmation itself, token mode (opt-in) runs the approve
70
+ // command from the gate's rejection envelope in the user's own
71
+ // terminal.
72
+ description: '升级 huaweicloud-devkit 到最新版本。升级会改写磁盘上的插件本体,因此由审批门机械把关:默认由服务器在调用内弹出确认(表单或聊天往返);DEVKIT_APPROVAL_MODE=token(opt-in)时,无 token 调用会返回 USER_CONFIRMATION_REQUIRED 与 approve 命令行,用户在自己的终端确认后才可重试。version 仅支持 "latest"。完成后需重启会话生效。',
72
73
  schema: upgradeSchema,
73
74
  handler: handleUpgrade,
74
75
  },
@@ -258,7 +258,7 @@ export const TOOL_DEFINITIONS_LITERALS = [
258
258
  },
259
259
  {
260
260
  name: 'huaweicloud_packs_configure',
261
- description: 'Enable or disable capability packs for THIS session, or reset to the operator posture. Session-scoped: the change lives in this server process only and the next session restart restores the DEVKIT_PACKS posture the operator configured. Takes enable (pack ids to add), disable (pack ids to remove; core cannot be disabled), and reset (drop the session override). The refreshed tool list is pushed to the agent immediately. Approval-gated in every mode because widening the disclosure face is the consequence: the no-token call returns USER_CONFIRMATION_REQUIRED naming the pack ids with the approve line for the user\u2019s own terminal (token mode), and under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (a form on a capable client, else an ASK_CONFIRMATION_REQUIRED chat round-trip). Stdio agent sessions only — surfaces with no session state are refused outright. The persistent equivalent is the operator CLI (npx huaweicloud-devkit packs enable <ids> --target <agent>); ask the operator to run it and restart the agent.',
261
+ description: 'Enable or disable capability packs for THIS session, or reset to the operator posture. Session-scoped: the change lives in this server process only and the next session restart restores the DEVKIT_PACKS posture the operator configured. Takes enable (pack ids to add), disable (pack ids to remove; core cannot be disabled), and reset (drop the session override). The refreshed tool list is pushed to the agent immediately. Approval-gated in every mode because widening the disclosure face is the consequence: the server raises the confirmation itself (a form on a capable client, else an ASK_CONFIRMATION_REQUIRED chat round-trip), and under DEVKIT_APPROVAL_MODE=token (opt-in) the no-token call instead returns USER_CONFIRMATION_REQUIRED naming the pack ids with the approve line for the user\u2019s own terminal. Stdio agent sessions only — surfaces with no session state are refused outright. The persistent equivalent is the operator CLI (npx huaweicloud-devkit packs enable <ids> --target <agent>); ask the operator to run it and restart the agent.',
262
262
  },
263
263
  {
264
264
  name: 'huaweicloud_gateway_list_tools',
@@ -2,7 +2,7 @@
2
2
  "name": "huaweicloud-devkit",
3
3
  "id": "huaweicloud-devkit",
4
4
  "displayName": "HuaweiCloud DevKit",
5
- "version": "2.0.0-next.6",
5
+ "version": "2.0.1-next.0",
6
6
  "family": "bundle-plugin",
7
7
  "bundleFormat": "codex",
8
8
  "description": "Guide coding agents to use Huawei Cloud safely �?KooCLI, APIs, SDKs, 40 MCP tools, skills, and safety guardrails.",
@@ -101,8 +101,8 @@ curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/lat
101
101
  - Secret: any operation returning secret string, binary secret, token, or password.
102
102
  9. For write operations, follow the approval contract:
103
103
  - Call `huaweicloud_plan_cli_command` and read `userConfirmation`. When `needed` is true, show the user the command echo.
104
- - Token mode (the default): show the `userConfirmation.command` line; the user runs `npx huaweicloud-devkit approve <approvalToken>` in their own terminal. Never run it yourself. First use: the user runs `npx huaweicloud-devkit pin` once in their own terminal to enroll the approvals PIN. Then call `huaweicloud_run_approved_command` with that token; an unconfirmed non-read command is rejected with `USER_CONFIRMATION_REQUIRED`, and the token stays usable, so retry the same call after the user confirms.
105
- - Ask mode (`userConfirmation.mode` is `ask`): no terminal line and no token — call `huaweicloud_run_approved_command` with the same args (the `command` display field is recommended but optional: without it the confirmation shows the derived redacted line). The server runs the confirmation for every call shape: an elicitation-capable client renders a form during the call, and any other client answers with `ASK_CONFIRMATION_REQUIRED` (show the command in chat, then retry with `approvedByUser: true`).
104
+ - Ask mode (the default; `userConfirmation.mode` is `ask`): no terminal line and no token — call `huaweicloud_run_approved_command` with the same args (the `command` display field is recommended but optional: without it the confirmation shows the derived redacted line). The server runs the confirmation for every call shape: an elicitation-capable client renders a form during the call, and any other client answers with `ASK_CONFIRMATION_REQUIRED` (show the command in chat, then retry with `approvedByUser: true`).
105
+ - Token mode (opt-in, `DEVKIT_APPROVAL_MODE=token`; the forced posture on the remote transport): show the `userConfirmation.command` line; the user runs `npx huaweicloud-devkit approve <approvalToken>` in their own terminal. Never run it yourself. First use: the user runs `npx huaweicloud-devkit pin` once in their own terminal to enroll the approvals PIN. Then call `huaweicloud_run_approved_command` with that token; an unconfirmed non-read command is rejected with `USER_CONFIRMATION_REQUIRED`, and the token stays usable, so retry the same call after the user confirms.
106
106
 
107
107
  ## KooCLI Syntax Notes
108
108
 
@@ -153,7 +153,7 @@ Credentials are resolved in this order (highest priority first):
153
153
  | 5 | S1 global file (no session flag) | `auth init` permanent credentials | Permanent (S1) |
154
154
  | 6 | KooCLI profile | `~/.hcloud/config.json` (KooCLI commands only) | Permanent |
155
155
 
156
- When switching accounts within the same Agent session, use `huaweicloud_auth_init` to set runtime credentials (overrides all sources for the current MCP process), or `huaweicloud_auth_switch action=persist`, which writes S1 with `configuredBySession: true` so the session-configured account outranks `HW_ACCESS_KEY` / `HW_SECRET_KEY`. Note: running `auth init` clears the configuredBySession flag. Both calls are approval-gated: the user must confirm the switch, and the confirmation view names the target account fingerprint and the credential source — in the default token mode confirm the returned approvalToken in your own terminal (`npx huaweicloud-devkit approve <token>`), and under `DEVKIT_APPROVAL_MODE=ask` the server raises the confirmation itself (an elicitation form, or the `ASK_CONFIRMATION_REQUIRED` chat round-trip whose retry carries `approvedByUser: true`).
156
+ When switching accounts within the same Agent session, use `huaweicloud_auth_init` to set runtime credentials (overrides all sources for the current MCP process), or `huaweicloud_auth_switch action=persist`, which writes S1 with `configuredBySession: true` so the session-configured account outranks `HW_ACCESS_KEY` / `HW_SECRET_KEY`. Note: running `auth init` clears the configuredBySession flag. Both calls are approval-gated: the user must confirm the switch, and the confirmation view names the target account fingerprint and the credential source — by default the server raises the confirmation itself (an elicitation form, or the `ASK_CONFIRMATION_REQUIRED` chat round-trip whose retry carries `approvedByUser: true`); under `DEVKIT_APPROVAL_MODE=token` (opt-in) confirm the returned approvalToken in your own terminal (`npx huaweicloud-devkit approve <token>`).
157
157
 
158
158
  ## Global Services & domain-id
159
159
 
@@ -23,7 +23,7 @@ Use this skill before any Huawei Cloud action that may expose secrets, change re
23
23
  - IAM/security
24
24
  - cost/payment
25
25
  - public exposure
26
- 5. For any non-read-only operation, follow the plan, confirm, run contract: plan with `huaweicloud_plan_cli_command`, show the user the command, then run with `huaweicloud_run_approved_command`. The confirm step follows the plan's `userConfirmation`: by default (token mode) show the terminal confirmation line and wait for the user to run it in their own terminal; when `userConfirmation.mode` is `ask`, call the run tool and let the SERVER ask the user — a capable client raises a form during the call, and any other client answers with `ASK_CONFIRMATION_REQUIRED` so you can show the command in chat and retry with `approvedByUser: true`. See `references/approvals.md`. The same gate covers the registered non-CLI mutators (`huaweicloud_obs_set_website_config`, `huaweicloud_obs_set_cors`, `huaweicloud_upgrade`, `huaweicloud_secret_delete`, `huaweicloud_packs_configure`): call the tool and let the gate confirm — obs `action=get` runs unconfirmed as a signed read; the shell CLI twins (`update`/`upgrade`, `secret rm`, `packs enable/disable`) are hook-denied on the Bash face.
26
+ 5. For any non-read-only operation, follow the plan, confirm, run contract: plan with `huaweicloud_plan_cli_command`, show the user the command, then run with `huaweicloud_run_approved_command`. The confirm step follows the plan's `userConfirmation`: by default (`userConfirmation.mode` is `ask`) call the run tool and let the SERVER ask the user — a capable client raises a form during the call, and any other client answers with `ASK_CONFIRMATION_REQUIRED` so you can show the command in chat and retry with `approvedByUser: true`; in token mode (opt-in, `DEVKIT_APPROVAL_MODE=token`) show the terminal confirmation line and wait for the user to run it in their own terminal. See `references/approvals.md`. The same gate covers the registered non-CLI mutators (`huaweicloud_obs_set_website_config`, `huaweicloud_obs_set_cors`, `huaweicloud_upgrade`, `huaweicloud_secret_delete`, `huaweicloud_packs_configure`): call the tool and let the gate confirm — obs `action=get` runs unconfirmed as a signed read; the shell CLI twins (`update`/`upgrade`, `secret rm`, `packs enable/disable`) are hook-denied on the Bash face.
27
27
  6. Redact secrets from command output, errors, JSON, logs, and generated reports.
28
28
  7. If a command contains `adminPass`, `password`, token, or any secret-like field, warn that plaintext can remain in shell history. Prefer local-only input, runtime injection, or user-side execution.
29
29
 
@@ -35,10 +35,10 @@ Use this skill before any Huawei Cloud action that may expose secrets, change re
35
35
 
36
36
  ## Write Execution Boundary
37
37
 
38
- 1. Plan: call `huaweicloud_plan_cli_command`. The result echoes the exact command and carries `userConfirmation: { needed, command }` in the default token mode, or `userConfirmation: { needed, mode: "ask", note }` when the plan ran under `DEVKIT_APPROVAL_MODE=ask`.
39
- 2. Confirm (token mode, the default): when `needed` is true, show the user the plan echo and the `userConfirmation.command` line (`npx huaweicloud-devkit approve <approvalToken>`), then wait. The USER runs that line in their own terminal, where a TTY check and a PIN gate the confirmation. First use: the user runs `npx huaweicloud-devkit pin` once in their own terminal to enroll the PIN.
40
- 3. Confirm (ask mode): when `userConfirmation.mode` is `ask`, there is no terminal line and no token. The FIRST unattested call to `huaweicloud_run_approved_command` (same args, no `approvedByUser`; the `command` display field is recommended but optional) makes the server ask: an elicitation-capable client renders a form, and any other client returns `ASK_CONFIRMATION_REQUIRED`, whose envelope carries the command — show it to the user in chat, then retry that same call with `approvedByUser: true`. That retry is model-relayed posture trust, labeled as such, and its envelope stays live for the session's TTL, so further identical retries of the SAME command execute without re-asking. Different args get their own envelope first.
41
- 4. Run: in token mode call `huaweicloud_run_approved_command` with the same `args`, the `command` field, the plan's `approvalToken`, and `approvedByUser: true`. In ask mode the run call IS the confirmation (step 3): withhold `approvedByUser: true` on the FIRST call so the server asks, and send it only on the retry after the user answered in chat.
38
+ 1. Plan: call `huaweicloud_plan_cli_command`. The result echoes the exact command and carries `userConfirmation: { needed, mode: "ask", note }` by default, or `userConfirmation: { needed, command }` when the plan ran under `DEVKIT_APPROVAL_MODE=token` (opt-in).
39
+ 2. Confirm (ask mode, the default): when `userConfirmation.mode` is `ask`, there is no terminal line and no token. The FIRST unattested call to `huaweicloud_run_approved_command` (same args, no `approvedByUser`; the `command` display field is recommended but optional) makes the server ask: an elicitation-capable client renders a form, and any other client returns `ASK_CONFIRMATION_REQUIRED`, whose envelope carries the command — show it to the user in chat, then retry that same call with `approvedByUser: true`. That retry is model-relayed posture trust, labeled as such, and its envelope stays live for the session's TTL, so further identical retries of the SAME command execute without re-asking. Different args get their own envelope first.
40
+ 3. Confirm (token mode, opt-in): when `needed` is true, show the user the plan echo and the `userConfirmation.command` line (`npx huaweicloud-devkit approve <approvalToken>`), then wait. The USER runs that line in their own terminal, where a TTY check and a PIN gate the confirmation. First use: the user runs `npx huaweicloud-devkit pin` once in their own terminal to enroll the PIN.
41
+ 4. Run: in ask mode the run call IS the confirmation (step 2): withhold `approvedByUser: true` on the FIRST call so the server asks, and send it only on the retry after the user answered in chat. In token mode call `huaweicloud_run_approved_command` with the same `args`, the `command` field, the plan's `approvalToken`, and `approvedByUser: true`.
42
42
 
43
43
  In token mode, a non-read command without that terminal confirmation is rejected with `USER_CONFIRMATION_REQUIRED`. The refusal does not consume the token, so retry the same call after the user confirms. Re-running a write needs a fresh plan and a fresh confirmation. In ask mode there is no token to refuse or consume: a new command line asks the user first, and a declined, dismissed, or timed-out form refuses fail-closed. Once the user has approved a line, its envelope stays live for the session's TTL, so retrying that same line does not ask again.
44
44
 
@@ -48,7 +48,7 @@ Without the devkit tools, show the reviewed command and let the user execute it
48
48
 
49
49
  ## Gate-source roster tools (no plan face)
50
50
 
51
- Beyond the hcloud plan/run pair, other registered tools carry the same gate with NO plan step — the gate itself mints the approval token. Today that is the account-switch pair, `huaweicloud_auth_init` and `huaweicloud_auth_switch`: every call confirms, and the confirmation view names the target account fingerprint and the credential source, because switching accounts is the step that can redirect every later approved write. In the default token mode the first call returns `USER_CONFIRMATION_REQUIRED` with a minted `approvalToken`; the user confirms it in their own terminal (`npx huaweicloud-devkit approve <token>`) and you retry the same call with the token. Under ask mode the ladder is the same as for hcloud writes: the form on a capable client, the `ASK_CONFIRMATION_REQUIRED` chat round-trip on the rest. Never switch accounts through the devkit CLI instead (`npx huaweicloud-devkit auth init` from Bash is hook-denied); the gate's confirmation is the only agent-side path, and the account the user confirmed is the account that switches.
51
+ Beyond the hcloud plan/run pair, other registered tools carry the same gate with NO plan step — the gate itself mints the approval token in token mode. Today that is the account-switch pair, `huaweicloud_auth_init` and `huaweicloud_auth_switch`: every call confirms, and the confirmation view names the target account fingerprint and the credential source, because switching accounts is the step that can redirect every later approved write. By default (ask mode) the first call makes the server ask: the form on a capable client, the `ASK_CONFIRMATION_REQUIRED` chat round-trip on the rest. In token mode (opt-in) the first call returns `USER_CONFIRMATION_REQUIRED` with a minted `approvalToken`; the user confirms it in their own terminal (`npx huaweicloud-devkit approve <token>`) and you retry the same call with the token. Never switch accounts through the devkit CLI instead (`npx huaweicloud-devkit auth init` from Bash is hook-denied); the gate's confirmation is the only agent-side path, and the account the user confirmed is the account that switches.
52
52
 
53
53
  ## Proactive Hook Checks
54
54
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The Approval Gate For Registered Tools
4
4
 
5
- A registered tool's mutating call runs only after the user confirms it. The confirmation channel is the server-run ladder: an elicitation form on a capable client, a chat round-trip envelope on the rest, or the terminal token in token mode. The agent never confirms anything itself; `approvedByUser: true` is only ever a statement or a retry marker, never the confirmation.
5
+ A registered tool's mutating call runs only after the user confirms it. The confirmation channel is the server-run ladder (the default): an elicitation form on a capable client, a chat round-trip envelope on the rest, or the terminal token in opt-in token mode. The agent never confirms anything itself; `approvedByUser: true` is only ever a statement or a retry marker, never the confirmation.
6
6
 
7
7
  ## The registered tools today
8
8
 
@@ -28,7 +28,7 @@ One per line, append-shaped: a sibling registration adds its tools here without
28
28
 
29
29
  The same destructive rows also deny on the agent's own Bash face through the safety hook (the operator-approved widening): unanchored recursive rm — any combined-flag spelling, including `rm -rf node_modules` and the quoted/glob/`$VAR` forms — and `find … -delete` now refuse there too. The operator chose the safe direction: a false deny on the agent face costs one rephrased command, a miss costs the workspace. A human's own terminal is unaffected — the hook gates the agent face only.
30
30
 
31
- ## Token mode (the default)
31
+ ## Token mode (opt-in: DEVKIT_APPROVAL_MODE=token; the forced posture on the remote transport)
32
32
 
33
33
  1. Call the tool. A first no-token call returns `status: "rejected"`, `code: "USER_CONFIRMATION_REQUIRED"`, a minted `approvalToken`, and `userConfirmation.command` — the exact line the user must run in their own terminal: `npx huaweicloud-devkit approve <approvalToken>`. Nothing executed.
34
34
  2. The user confirms in their own interactive terminal (PIN-checked; first use enrolls the PIN via `npx huaweicloud-devkit pin`). The terminal prints the redacted request and states that this authorizes one execution.
@@ -42,11 +42,11 @@ For the hcloud run face, `command` is the display anchor: the full hcloud comman
42
42
 
43
43
  ## Registered tools beyond the hcloud pair
44
44
 
45
- The same gate covers every tool on the approval roster, not only the hcloud plan/run pair. A roster tool with no plan face mints its own token at the gate: the first call in the default token mode returns `USER_CONFIRMATION_REQUIRED` with a fresh `approvalToken` and a `userConfirmation` summary naming what the call does — the user confirms that token the same way (`npx huaweicloud-devkit approve <token>`), and the retry carries the token. In ask mode the same ladder as above applies: the form, or the `ASK_CONFIRMATION_REQUIRED` chat round-trip.
45
+ The same gate covers every tool on the approval roster, not only the hcloud plan/run pair. A roster tool with no plan face mints its own token at the gate: the first call in token mode (opt-in) returns `USER_CONFIRMATION_REQUIRED` with a fresh `approvalToken` and a `userConfirmation` summary naming what the call does — the user confirms that token the same way (`npx huaweicloud-devkit approve <token>`), and the retry carries the token. In ask mode (the default) the same ladder as above applies: the form, or the `ASK_CONFIRMATION_REQUIRED` chat round-trip.
46
46
 
47
47
  The account-switch pair is registered (PR-3b): `huaweicloud_auth_init` and `huaweicloud_auth_switch` confirm on every call, and their confirmation views name the target account fingerprint and the credential source, because the account switch is the step that can redirect every later approved write to a different account. The confirmation binds the resolved snapshot — the account, region, and session token of the switch — so the account the user confirmed is the account that switches; a changed file or a changed region re-asks instead of executing. The devkit CLI verbs (`npx huaweicloud-devkit auth init`, `auth sync`) are the operator's own terminal surface: the hook denies them on the agent Bash face, so an agent cannot use the CLI to bypass the gate the MCP tools carry. `auth_confirm` (the persist-conflict reconciliation) and the read faces (`auth_status`, `check_account_type`, `auth_sync` on the MCP surface) stay ungated by this chain.
48
48
 
49
- ## Ask mode (DEVKIT_APPROVAL_MODE=ask): the server-run confirmation
49
+ ## Ask mode (the default): the server-run confirmation
50
50
 
51
51
  The confirmation happens on the server, in one of two tiers.
52
52
 
@@ -61,7 +61,7 @@ When an approved call's delivery was uncertain — the call threw and whether it
61
61
 
62
62
  The consent ledger records which tier answered: `evidence: "elicitation"` for a form answer, `evidence: "posture"` for a chat-round-trip retry. A ledger row that says posture means a model reported the user's approval, not that a human was mechanically verified. A memo reuse inherits the original event's tier and never upgrades it.
63
63
 
64
- On OpenCode the installer writes one exact `allow` rule per roster tool ahead of the server's own confirmation. That rule is yield-only: it suppresses the redundant client popup and never confirms anything — the form does on a form-capable client (opencode 2.x), and on 1.19–1.x the chat round-trip does, recorded as posture trust. A saved "always allow" row from a pre-yield install is likewise inert, because the server's confirmation is raised inside the tool call and never routes through the client's permission evaluation, and the yield rules mean the popup no longer appears to recreate one. `npx huaweicloud-devkit doctor` lists such rows as a stale-grant WARNING, with the `opencode api GET /api/permission/saved` and `opencode api DELETE /api/permission/saved/<id>` commands that remove them. Doctor also lists recorded session standing consents. A `deny` rule on a roster tool still blocks the call in the client, and doctor fails it. The remote transport refuses ask mode outright and forces token mode. Token mode remains the default and the fallback for harnesses without a per-call confirmation surface.
64
+ On OpenCode the installer writes one exact `allow` rule per roster tool ahead of the server's own confirmation. That rule is yield-only: it suppresses the redundant client popup and never confirms anything — the form does on a form-capable client (opencode 2.x), and on 1.19–1.x the chat round-trip does, recorded as posture trust. A saved "always allow" row from a pre-yield install is likewise inert, because the server's confirmation is raised inside the tool call and never routes through the client's permission evaluation, and the yield rules mean the popup no longer appears to recreate one. `npx huaweicloud-devkit doctor` lists such rows as a stale-grant WARNING, with the `opencode api GET /api/permission/saved` and `opencode api DELETE /api/permission/saved/<id>` commands that remove them. Doctor also lists recorded session standing consents. A `deny` rule on a roster tool still blocks the call in the client, and doctor fails it. Ask mode is the default everywhere a session lives; token mode is the operator's opt-in (`DEVKIT_APPROVAL_MODE=token`) and the remote transport's forced posture — the stateless remote face carries no session for either ask tier (no capability record, no shown-envelope memory), while the token state lives on disk where the terminal approve finds it, so the remote gate has exactly one channel and it is token.
65
65
 
66
66
  ## The PIN and the TTY check
67
67
 
@@ -302,14 +302,16 @@ function payloadDriftWarns(payloadPaths: readonly string[]): string[] {
302
302
  continue;
303
303
  }
304
304
  // The env half: a copy that carries our server entry but not the ask env
305
- // runs the devkit in token mode (a stale pre-ask payload) — drift,
306
- // healable by the same re-run.
305
+ // is a stale pre-ask payload — drift, healable by the same re-run. The
306
+ // default mode is ask, so a stale copy degrades to the env-unset default
307
+ // (still the server-run gate), but the drift itself stays WARN-worthy:
308
+ // the payload no longer matches what this install would write.
307
309
  if (
308
310
  asRecord(asRecord(asRecord(config.mcpServers)[APPROVAL_MCP_SERVER]).env).DEVKIT_APPROVAL_MODE !==
309
311
  CODEX_APPROVAL_MODE_ENV
310
312
  ) {
311
313
  warns.push(
312
- `${path} does not set DEVKIT_APPROVAL_MODE="${CODEX_APPROVAL_MODE_ENV}" in the server env, so the devkit runs its default token mode under codex (${RERUN})`,
314
+ `${path} does not set DEVKIT_APPROVAL_MODE="${CODEX_APPROVAL_MODE_ENV}" in the server env (a stale pre-ask payload; the env-unset default is ask, but the drift means this copy no longer matches the current install) (${RERUN})`,
313
315
  );
314
316
  }
315
317
  if (states.every((state) => state === 'approve')) continue;
@@ -115,7 +115,8 @@ export function openCodeSeamGate(): 'on' | 'off' {
115
115
  // HUAWEICLOUD_OPENCODE_ASK_RULE is the deterministic override for the
116
116
  // installer test suite (e2e strips it — the runner's install relies on
117
117
  // the natural probe); unset runs the probe. Polarity:
118
- // 'off' — neither half of the posture is written (token mode stays);
118
+ // 'off' — neither half of the posture is written (the env-unset
119
+ // ask default governs the server; no client yield rules);
119
120
  // the legacy ask rules are still migrated away.
120
121
  // 'v1'/'v2' — force the rule SHAPE (the deterministic test matrix; the
121
122
  // env halves are identical across shapes).
@@ -293,7 +294,9 @@ export function updateOpenCodeConfig(pluginDir: string): void {
293
294
  // install wrote are removed value-exact, both shapes independently (a
294
295
  // config can carry both). Without this, the doctor's mixed-state WARN
295
296
  // could never heal — re-running install would reproduce it forever.
296
- // After the removal the user's posture (token mode) is fully mechanical.
297
+ // After the removal the user's posture is fully mechanical — their own
298
+ // env value (token, or an explicit ask) owns the gate with no client
299
+ // rules layered on top.
297
300
  const removedV2 = removeAllowPermissionRules(config);
298
301
  const removedV1 = removeAllowPermissionRulesV1(config);
299
302
  clientRemoved = removedV2 || removedV1;
@@ -316,7 +319,7 @@ export function updateOpenCodeConfig(pluginDir: string): void {
316
319
  }
317
320
  } else if (!askOn) {
318
321
  console.log(
319
- ' \x1b[33m[INFO]\x1b[0m opencode not verifiably at or above 1.19.0 — keeping the terminal token approval gate; no client allow rules or DEVKIT_APPROVAL_MODE is written.',
322
+ ' \x1b[33m[INFO]\x1b[0m opencode not verifiably at or above 1.19.0 — writing neither half of the ASK pair; the server still runs the env-unset ask default (the chat round-trip), and no client allow rules are written.',
320
323
  );
321
324
  }
322
325
  if (rebuilt || entryChanged) {
@@ -74,8 +74,10 @@ export function opencodeDoctorMcpConfigured(): string | null {
74
74
  // WARN is honest, not a FAIL);
75
75
  // - a user-owned rule on a roster action is surfaced by name with the skip
76
76
  // recorded, never silently dropped.
77
- // A gate-off opencode is a SKIP — token mode is that install's legitimate
78
- // posture, and the migration still removes the legacy ask rules.
77
+ // A gate-off opencode is a SKIP — an env-less install below the floor runs
78
+ // the default ask posture with no client yield rules, which is that
79
+ // install's legitimate state, and the migration still removes the legacy
80
+ // ask rules.
79
81
  export function opencodeDoctorAskRule(ctx: DoctorReporter): void {
80
82
  const gate = openCodeAskGate();
81
83
  if (gate === 'off') {
@@ -121,9 +123,18 @@ function askPostureCheck(ctx: DoctorReporter, gate: 'v2-array' | 'v1-object'): v
121
123
  const userOther = actionsIn('user-other');
122
124
  const residue = reading.rules.filter((rule) => rule.askResidue).map((rule) => rule.action);
123
125
 
124
- // Token mode with no client rules at all is the legitimate default posture.
126
+ // No client rules and a non-ask env is the legitimate env-owned posture:
127
+ // unset means the ask default (server-run gate, no yield rules), an
128
+ // explicit 'token' means the operator's opt-in terminal gate. The label
129
+ // names which one it is.
125
130
  if (!gateOn && absent.length === reading.rules.length) {
126
- ctx.check('ASK approval posture (token mode)', true, '');
131
+ ctx.check(
132
+ env.DEVKIT_APPROVAL_MODE === 'token'
133
+ ? 'ASK approval posture (token mode)'
134
+ : 'ASK approval posture (env-unset ask default; no client yield rules)',
135
+ true,
136
+ '',
137
+ );
127
138
  return;
128
139
  }
129
140
 
@@ -6,12 +6,12 @@
6
6
  // src/lib/approval-tokens.ts.
7
7
  //
8
8
  // The plan's approval posture is mode-dependent (HcloudPlanOptions.
9
- // approvalMode): 'ask' (DEVKIT_APPROVAL_MODE=ask) plans for the SERVER-run
9
+ // approvalMode): 'ask' (the default) plans for the SERVER-run
10
10
  // confirmation — the approval gate raises an elicitation form, or the T3
11
11
  // chat round-trip on a client that cannot render one — so no token is
12
12
  // minted and userConfirmation carries the ask note instead of a terminal
13
- // approve line; 'token' (the default) keeps the mint + approve line
14
- // contract above.
13
+ // approve line; 'token' (opt-in, and forced on the remote transport)
14
+ // keeps the mint + approve line contract above.
15
15
 
16
16
  import { classifyHcloudArgs, redactSecrets, stripExecutable, type ClassifyOptions } from './safety-policy.ts';
17
17
  import { isHcloudToken } from './safety/tokens.ts';
@@ -1,22 +1,21 @@
1
1
  // The hcloud write-approval posture, resolved from DEVKIT_APPROVAL_MODE.
2
2
  //
3
- // 'token' (the default) is the out-of-band terminal gate: the plan mints
4
- // an approval token, the user confirms it in their own terminal
5
- // (`npx huaweicloud-devkit approve <uuid>`), and run_approved_command
6
- // consumes the token before executing. 'ask' moves the confirmation onto
7
- // the SERVER (PR-1.5): the operator opts in via the env var (normally
8
- // written by the installer together with the client's ask rule), and the
9
- // approval gate runs the confirmation itself inside the run call — an
10
- // elicitation form on a client that declared the form capability, or the
3
+ // 'ask' (the default) is the server-run confirmation: the approval gate
4
+ // runs the confirmation itself inside the run call — an elicitation form
5
+ // on a client that declared the form capability, or the
11
6
  // ASK_CONFIRMATION_REQUIRED chat round-trip whose retry carries
12
7
  // approvedByUser. No terminal trip and no UUID in the model's context; the
13
- // plan mints nothing.
8
+ // plan mints nothing. 'token' is the opt-in out-of-band terminal gate
9
+ // (and the only channel on the stateless remote transport, which forces
10
+ // it back): the plan mints an approval token, the user confirms it in
11
+ // their own terminal (`npx huaweicloud-devkit approve <uuid>`), and
12
+ // run_approved_command consumes the token before executing.
14
13
  //
15
14
  // Resolution is exact-match and fail-loud, mirroring the DEVKIT_PACKS
16
15
  // unknown-id doctrine: a typo'd mode must not silently fall back to the
17
16
  // weaker gate, so anything but 'ask' or 'token' throws with the env name
18
17
  // and the bad value (case included — 'ASK' throws). Unset or empty keeps
19
- // 'token'. The resolver is pure and takes the env as a parameter; every
18
+ // 'ask'. The resolver is pure and takes the env as a parameter; every
20
19
  // reader re-resolves from process.env (the mode is process-stable for the
21
20
  // life of the process), so there is deliberately no cached module state
22
21
  // to disagree with a fresh read. The module imports nothing: it feeds
@@ -28,7 +27,7 @@ export const APPROVAL_MODE_ENV = 'DEVKIT_APPROVAL_MODE';
28
27
 
29
28
  export function approvalModeFromEnv(env: Record<string, string | undefined>): ApprovalMode {
30
29
  const raw = env[APPROVAL_MODE_ENV];
31
- if (raw === undefined || raw === '') return 'token';
30
+ if (raw === undefined || raw === '') return 'ask';
32
31
  if (raw === 'ask' || raw === 'token') return raw;
33
32
  throw new Error(`DEVKIT_APPROVAL_MODE must be "ask" or "token" (got "${raw}")`);
34
33
  }
@@ -62,8 +62,12 @@ if (transport === 'remote') {
62
62
  // gate's elicitation form (or the T3 chat round-trip), and this stateless
63
63
  // remote face carries no session to ask in — no client capability record
64
64
  // and no in-band round-trip — so the env is forced back to the token gate,
65
- // loudly, before any request handler resolves it. This is the only
66
- // production entry to the remote surface.
65
+ // loudly, before any request handler resolves it. The token terminal gate
66
+ // is the remote transport's ONLY channel: ask's session state (the
67
+ // capability record, the shown-envelope memory) dies with the
68
+ // per-request server instance, while token state lives on disk and the
69
+ // terminal approve runs in another process against the same file. This
70
+ // is the only production entry to the remote surface.
67
71
  if (approvalModeFromEnv(process.env) === 'ask') {
68
72
  process.env.DEVKIT_APPROVAL_MODE = 'token';
69
73
  process.stderr.write(
@@ -288,14 +288,14 @@ export const AUTH_TOOLS = [
288
288
  {
289
289
  name: 'huaweicloud_auth_init',
290
290
  description:
291
- 'Set or clear runtime Huawei Cloud credentials (AK/SK) for this MCP session. Runtime credentials take highest priority over environment variables and config files for all subsequent API calls. Use when switching accounts within the same Agent session — call with AK/SK to switch, or with clear=true to fall back to env/file credentials. Approval-gated: the account switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint — in the default token mode the first call returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>); under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
291
+ 'Set or clear runtime Huawei Cloud credentials (AK/SK) for this MCP session. Runtime credentials take highest priority over environment variables and config files for all subsequent API calls. Use when switching accounts within the same Agent session — call with AK/SK to switch, or with clear=true to fall back to env/file credentials. Approval-gated: the account switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint — the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip); under DEVKIT_APPROVAL_MODE=token (opt-in) the first call instead returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
292
292
  schema: authInitSchema,
293
293
  handler: handleAuthInit,
294
294
  },
295
295
  {
296
296
  name: 'huaweicloud_auth_switch',
297
297
  description:
298
- 'Switch Huawei Cloud credentials within the current session. action=temporary keeps AK/SK in memory only (restart loses them; hcloud commands are unaffected and an A+C warning will be raised). action=persist writes S1 (single source of truth) with configuredBySession flag and propagates to S2 (KooCLI current profile) and S3 (OBS). action=clear resets runtime credentials. mode=import reads AK/SK from ~/.config/huaweicloud/creds-import.json then wipes it (SK never enters conversation). mode=memory passes AK/SK as tool arguments (SK is visible to model - prefer import). mode=mcp-config reads the injected mcp_settings environment. Approval-gated: the switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint and the credential source — in the default token mode the first call returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>); under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
298
+ 'Switch Huawei Cloud credentials within the current session. action=temporary keeps AK/SK in memory only (restart loses them; hcloud commands are unaffected and an A+C warning will be raised). action=persist writes S1 (single source of truth) with configuredBySession flag and propagates to S2 (KooCLI current profile) and S3 (OBS). action=clear resets runtime credentials. mode=import reads AK/SK from ~/.config/huaweicloud/creds-import.json then wipes it (SK never enters conversation). mode=memory passes AK/SK as tool arguments (SK is visible to model - prefer import). mode=mcp-config reads the injected mcp_settings environment. Approval-gated: the switch requires the user\u2019s explicit confirmation, and the confirmation view names the target account fingerprint and the credential source — the server raises the confirmation itself (an elicitation form, or the ASK_CONFIRMATION_REQUIRED chat round-trip); under DEVKIT_APPROVAL_MODE=token (opt-in) the first call instead returns USER_CONFIRMATION_REQUIRED with an approvalToken the user confirms in their own terminal (npx huaweicloud-devkit approve <token>). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
299
299
  schema: authSwitchSchema,
300
300
  handler: handleAuthSwitch,
301
301
  },
@@ -461,7 +461,7 @@ export const HUAWEICLOUD_CLI_TOOLS = [
461
461
  {
462
462
  name: 'huaweicloud_plan_cli_command',
463
463
  description:
464
- "Classify and plan a Huawei Cloud hcloud command without executing it. When the result's userConfirmation.needed is true, the command waits on user confirmation before huaweicloud_run_approved_command will accept it: in the default token mode the USER runs the userConfirmation.command line (npx huaweicloud-devkit approve <approvalToken>) in their own terminal, and under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself on the run call (an elicitation form, or an ASK_CONFIRMATION_REQUIRED chat round-trip) — no token is needed. Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.",
464
+ "Classify and plan a Huawei Cloud hcloud command without executing it. When the result's userConfirmation.needed is true, the command waits on user confirmation before huaweicloud_run_approved_command will accept it: the server raises the confirmation itself on the run call (an elicitation form, or an ASK_CONFIRMATION_REQUIRED chat round-trip) — no token is needed; under DEVKIT_APPROVAL_MODE=token (opt-in, and the forced posture on the remote transport) the USER instead runs the userConfirmation.command line (npx huaweicloud-devkit approve <approvalToken>) in their own terminal. Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.",
465
465
  schema: planCliCommandSchema,
466
466
  handler: handlePlanCliCommand,
467
467
  },
@@ -482,7 +482,7 @@ export const HUAWEICLOUD_CLI_TOOLS = [
482
482
  {
483
483
  name: 'huaweicloud_run_approved_command',
484
484
  description:
485
- 'Run a write-capable hcloud command only after the exact command has been shown and explicitly approved by the user. In the default token mode the user must also confirm the plan token in their own terminal (npx huaweicloud-devkit approve <token>) — a non-read command without that terminal confirmation is rejected with USER_CONFIRMATION_REQUIRED and the token stays usable. Under DEVKIT_APPROVAL_MODE=ask the confirmation runs on the server: on a client that supports MCP elicitation the devkit raises a form during this call (approve runs it once; dismiss, decline, or the timeout cancels it), and on any other client the call returns ASK_CONFIRMATION_REQUIRED, whose envelope carries the command line — show it to the user in chat, then retry the same call with approvedByUser: true, which is model-relayed posture trust. In both modes always send command: it is the line the user reads, and the server rejects a line that does not match args (COMMAND_ARGS_MISMATCH). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
485
+ 'Run a write-capable hcloud command only after the exact command has been shown and explicitly approved by the user. By default the confirmation runs on the server: on a client that supports MCP elicitation the devkit raises a form during this call (approve runs it once; dismiss, decline, or the timeout cancels it), and on any other client the call returns ASK_CONFIRMATION_REQUIRED, whose envelope carries the command line — show it to the user in chat, then retry the same call with approvedByUser: true, which is model-relayed posture trust. Under DEVKIT_APPROVAL_MODE=token (opt-in, and the forced posture on the remote transport) the user must also confirm the plan token in their own terminal (npx huaweicloud-devkit approve <token>) — a non-read command without that terminal confirmation is rejected with USER_CONFIRMATION_REQUIRED and the token stays usable. In both modes always send command: it is the line the user reads, and the server rejects a line that does not match args (COMMAND_ARGS_MISMATCH). Vendor-gated (vendorConfirmed): call only when the vendor is established — see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.',
486
486
  schema: runApprovedCommandSchema,
487
487
  handler: handleRunApprovedCommand,
488
488
  },
@@ -452,7 +452,7 @@ export const OBS_TOOLS = [
452
452
  {
453
453
  name: 'huaweicloud_obs_set_website_config',
454
454
  description:
455
- '配置 OBS 桶的静态网站托管(推荐路径:无需手写 XML,此工具内部实现 AWS4 签名调用 OBS REST API,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认,DEVKIT_APPROVAL_MODE=ask 时由服务器弹出确认;get 是签名只读,从不确认、直接执行。KooCLI 7.3.12+ 另有 `hcloud OBS website -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。操作前需确保桶已创建且已设置 public-read ACL。',
455
+ '配置 OBS 桶的静态网站托管(推荐路径:无需手写 XML,此工具内部实现 AWS4 签名调用 OBS REST API,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,默认由服务器弹出确认(表单或聊天往返);DEVKIT_APPROVAL_MODE=token(opt-in)时无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认;get 是签名只读,从不确认、直接执行。KooCLI 7.3.12+ 另有 `hcloud OBS website -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。操作前需确保桶已创建且已设置 public-read ACL。',
456
456
  schema: obsWebsiteConfigSchema,
457
457
  handler: handleObsWebsiteConfig,
458
458
  },
@@ -465,7 +465,7 @@ export const OBS_TOOLS = [
465
465
  // the recommended path (no XML file, no --noproxy traps); the CLI is the
466
466
  // scripted alternative for 7.3.12+ environments.
467
467
  description:
468
- '配置 OBS 桶的 CORS 规则(浏览器直传前置条件;推荐路径:此工具内部实现 AWS4 签名调用 OBS REST API(PUT/GET/DELETE /?cors),无需手写 XML,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认,DEVKIT_APPROVAL_MODE=ask 时由服务器弹出确认;get 是签名只读,从不确认、直接执行。allowedMethod 必须含 HEAD(BrowserJS SDK 每次操作前发 HEAD ?apiversion 探测,缺 HEAD 时浏览器吞掉探测请求报 Network Error)。KooCLI 7.3.12+ 另有 `hcloud OBS cors obs://<bucket> -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。配置成功后用返回体中的 verify 命令做 OPTIONS 预检验证(200 + Access-Control-Allow-Origin 才算成功)。',
468
+ '配置 OBS 桶的 CORS 规则(浏览器直传前置条件;推荐路径:此工具内部实现 AWS4 签名调用 OBS REST API(PUT/GET/DELETE /?cors),无需手写 XML,屏蔽签名细节)。支持 set(配置)、get(查询)、delete(删除)三种操作。审批门把关(PR-3c):set 与 delete 是对线上桶的签名 PUT/DELETE,默认由服务器弹出确认(表单或聊天往返);DEVKIT_APPROVAL_MODE=token(opt-in)时无 token 调用返回 USER_CONFIRMATION_REQUIRED 供用户在终端确认;get 是签名只读,从不确认、直接执行。allowedMethod 必须含 HEAD(BrowserJS SDK 每次操作前发 HEAD ?apiversion 探测,缺 HEAD 时浏览器吞掉探测请求报 Network Error)。KooCLI 7.3.12+ 另有 `hcloud OBS cors obs://<bucket> -method=put -localfile=<xml>`(XML 文件方式;7.2.x 无此 CLI 命令)。配置成功后用返回体中的 verify 命令做 OPTIONS 预检验证(200 + Access-Control-Allow-Origin 才算成功)。',
469
469
  schema: obsCorsConfigSchema,
470
470
  handler: handleObsCorsConfig,
471
471
  },
@@ -128,7 +128,7 @@ export const SECRETS_TOOLS = [
128
128
  {
129
129
  name: 'huaweicloud_secret_delete',
130
130
  description:
131
- 'Delete one secret from the local vault by ref. Destructive with no version history, so the approval gate mediates every call: in the default token mode a no-token call returns USER_CONFIRMATION_REQUIRED with the approve command line for the user\u2019s own terminal, and under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (form, or an ASK_CONFIRMATION_REQUIRED chat round-trip). Deleting a ref that S1 credentials.json points at breaks those credential reads until the operator re-stores it (the strict vault seam fails closed on the unresolvable ref). Idempotent: removed=1 when a secret was deleted, removed=0 when the ref was not stored (usually a typo in the ref — check with huaweicloud_secret_list).',
131
+ 'Delete one secret from the local vault by ref. Destructive with no version history, so the approval gate mediates every call: the server raises the confirmation itself (form, or an ASK_CONFIRMATION_REQUIRED chat round-trip); under DEVKIT_APPROVAL_MODE=token (opt-in) a no-token call instead returns USER_CONFIRMATION_REQUIRED with the approve command line for the user\u2019s own terminal. Deleting a ref that S1 credentials.json points at breaks those credential reads until the operator re-stores it (the strict vault seam fails closed on the unresolvable ref). Idempotent: removed=1 when a secret was deleted, removed=0 when the ref was not stored (usually a typo in the ref — check with huaweicloud_secret_list).',
132
132
  schema: secretDeleteSchema,
133
133
  handler: handleSecretDelete,
134
134
  },
@@ -85,11 +85,12 @@ export const UPDATE_TOOLS = [
85
85
  {
86
86
  name: 'huaweicloud_upgrade',
87
87
  // The mechanical approval gate enforces the consent this line used to
88
- // only ask for (PR-3c): token mode runs the approve command from the
89
- // gate's rejection envelope in the user's own terminal, ask mode lets
90
- // the server raise the confirmation itself.
88
+ // only ask for (PR-3c): ask mode (the default) lets the server raise
89
+ // the confirmation itself, token mode (opt-in) runs the approve
90
+ // command from the gate's rejection envelope in the user's own
91
+ // terminal.
91
92
  description:
92
- '升级 huaweicloud-devkit 到最新版本。升级会改写磁盘上的插件本体,因此由审批门机械把关:默认 token 模式下,无 token 调用会返回 USER_CONFIRMATION_REQUIRED 与 approve 命令行,用户在自己的终端确认后才可重试;DEVKIT_APPROVAL_MODE=ask 时由服务器在调用内弹出确认(表单或聊天往返)。version 仅支持 "latest"。完成后需重启会话生效。',
93
+ '升级 huaweicloud-devkit 到最新版本。升级会改写磁盘上的插件本体,因此由审批门机械把关:默认由服务器在调用内弹出确认(表单或聊天往返);DEVKIT_APPROVAL_MODE=token(opt-in)时,无 token 调用会返回 USER_CONFIRMATION_REQUIRED 与 approve 命令行,用户在自己的终端确认后才可重试。version 仅支持 "latest"。完成后需重启会话生效。',
93
94
  schema: upgradeSchema,
94
95
  handler: handleUpgrade,
95
96
  },
@@ -268,7 +268,7 @@ export const TOOL_DEFINITIONS_LITERALS = [
268
268
  {
269
269
  name: 'huaweicloud_packs_configure',
270
270
  description:
271
- 'Enable or disable capability packs for THIS session, or reset to the operator posture. Session-scoped: the change lives in this server process only and the next session restart restores the DEVKIT_PACKS posture the operator configured. Takes enable (pack ids to add), disable (pack ids to remove; core cannot be disabled), and reset (drop the session override). The refreshed tool list is pushed to the agent immediately. Approval-gated in every mode because widening the disclosure face is the consequence: the no-token call returns USER_CONFIRMATION_REQUIRED naming the pack ids with the approve line for the user\u2019s own terminal (token mode), and under DEVKIT_APPROVAL_MODE=ask the server raises the confirmation itself (a form on a capable client, else an ASK_CONFIRMATION_REQUIRED chat round-trip). Stdio agent sessions only — surfaces with no session state are refused outright. The persistent equivalent is the operator CLI (npx huaweicloud-devkit packs enable <ids> --target <agent>); ask the operator to run it and restart the agent.',
271
+ 'Enable or disable capability packs for THIS session, or reset to the operator posture. Session-scoped: the change lives in this server process only and the next session restart restores the DEVKIT_PACKS posture the operator configured. Takes enable (pack ids to add), disable (pack ids to remove; core cannot be disabled), and reset (drop the session override). The refreshed tool list is pushed to the agent immediately. Approval-gated in every mode because widening the disclosure face is the consequence: the server raises the confirmation itself (a form on a capable client, else an ASK_CONFIRMATION_REQUIRED chat round-trip), and under DEVKIT_APPROVAL_MODE=token (opt-in) the no-token call instead returns USER_CONFIRMATION_REQUIRED naming the pack ids with the approve line for the user\u2019s own terminal. Stdio agent sessions only — surfaces with no session state are refused outright. The persistent equivalent is the operator CLI (npx huaweicloud-devkit packs enable <ids> --target <agent>); ask the operator to run it and restart the agent.',
272
272
  },
273
273
  {
274
274
  name: 'huaweicloud_gateway_list_tools',