huaweicloud-devkit 2.0.0-next.2 → 2.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/package.json +3 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +16 -3
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +16 -3
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +16 -3
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +16 -3
- package/plugins/huaweicloud-core/.mcp.json +55 -1
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +16 -3
- package/plugins/huaweicloud-core/dist/agents/codex-config.js +374 -0
- package/plugins/huaweicloud-core/dist/agents/codex-desktop.js +8 -1
- package/plugins/huaweicloud-core/dist/agents/codex.js +9 -0
- package/plugins/huaweicloud-core/dist/agents/opencode-config.js +157 -31
- package/plugins/huaweicloud-core/dist/agents/opencode.js +129 -1
- package/plugins/huaweicloud-core/dist/approval-gate.js +1185 -0
- package/plugins/huaweicloud-core/dist/approval-ledger.js +2331 -0
- package/plugins/huaweicloud-core/dist/approval-roster.js +89 -0
- package/plugins/huaweicloud-core/dist/approval-types.js +1 -0
- package/plugins/huaweicloud-core/dist/approvals-cli.js +4 -4
- package/plugins/huaweicloud-core/dist/data/icons-manifest.v1.json +23 -5
- package/plugins/huaweicloud-core/dist/dep/receipts.js +65 -5
- package/plugins/huaweicloud-core/dist/hcloud-cli.js +1 -1
- package/plugins/huaweicloud-core/dist/hcloud-plan.js +77 -56
- package/plugins/huaweicloud-core/dist/lib/approval-mode.js +32 -0
- package/plugins/huaweicloud-core/dist/lib/approval-tokens.js +18 -4
- package/plugins/huaweicloud-core/dist/lib/call-trace.js +7 -14
- package/plugins/huaweicloud-core/dist/lib/confirm-language.js +50 -0
- package/plugins/huaweicloud-core/dist/lib/credentials.js +9 -9
- package/plugins/huaweicloud-core/dist/lib/hdkit/hdkit-gate.js +1398 -0
- package/plugins/huaweicloud-core/dist/lib/hdkit/hdkitservice-api.js +362 -32
- package/plugins/huaweicloud-core/dist/lib/hdkit/sandbox-pool.js +6 -16
- package/plugins/huaweicloud-core/dist/lib/opencode-ask-rule.js +262 -0
- package/plugins/huaweicloud-core/dist/lib/opencode-saved-perms.js +282 -0
- package/plugins/huaweicloud-core/dist/lib/supplemental-redaction.js +116 -0
- package/plugins/huaweicloud-core/dist/lib/tool-schema-parts.js +31 -0
- package/plugins/huaweicloud-core/dist/lib/workspace-glob.js +442 -0
- package/plugins/huaweicloud-core/dist/mcp-config-io.js +28 -1
- package/plugins/huaweicloud-core/dist/mcp-protocol.js +75 -4
- package/plugins/huaweicloud-core/dist/mcp-server.js +6560 -898
- package/plugins/huaweicloud-core/dist/mcp-server.js.map +4 -4
- package/plugins/huaweicloud-core/dist/mcp-stdio-transport.js +14 -4
- package/plugins/huaweicloud-core/dist/packs/auth/approval.js +249 -0
- package/plugins/huaweicloud-core/dist/packs/auth/tools.js +44 -44
- package/plugins/huaweicloud-core/dist/packs/huaweicloud-cli/tools.js +119 -112
- package/plugins/huaweicloud-core/dist/packs/obs/approval.js +110 -0
- package/plugins/huaweicloud-core/dist/packs/obs/tools.js +7 -2
- package/plugins/huaweicloud-core/dist/packs/registry.js +19 -1
- package/plugins/huaweicloud-core/dist/packs/sandbox/approval.js +245 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-account.js +156 -23
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-credentials.js +13 -1
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-hwexec.js +136 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-session.js +11 -1
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-tunnel.js +1 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/schemas.js +79 -9
- package/plugins/huaweicloud-core/dist/packs/sandbox/tools.js +28 -9
- package/plugins/huaweicloud-core/dist/packs/secrets/approval.js +46 -0
- package/plugins/huaweicloud-core/dist/packs/secrets/tools.js +4 -1
- package/plugins/huaweicloud-core/dist/packs/update/approval.js +79 -0
- package/plugins/huaweicloud-core/dist/packs/update/tools.js +8 -1
- package/plugins/huaweicloud-core/dist/packs/voucher/tools.js +1 -1
- package/plugins/huaweicloud-core/dist/packs-configure.js +74 -0
- package/plugins/huaweicloud-core/dist/safety/classify-text.js +36 -0
- package/plugins/huaweicloud-core/dist/safety/policy.js +2 -0
- package/plugins/huaweicloud-core/dist/sandbox/deploy-check.js +1 -1
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-auth.js +65 -14
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-cleanup.js +422 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-expose-flow.js +66 -16
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-expose.js +13 -10
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-keepalive.js +42 -2
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-key.js +11 -3
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-tunnel.js +6 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-validation.js +10 -1
- package/plugins/huaweicloud-core/dist/sandbox/hwexec-task.js +244 -0
- package/plugins/huaweicloud-core/dist/setup-cli.js +42 -4
- package/plugins/huaweicloud-core/dist/tool-definitions.js +9 -1
- package/plugins/huaweicloud-core/dist/tool-schemas.js +32 -6
- package/plugins/huaweicloud-core/dist/tools.js +76 -9
- package/plugins/huaweicloud-core/dist/update-registry.js +358 -5
- package/plugins/huaweicloud-core/dist/update-upgrade.js +1083 -14
- package/plugins/huaweicloud-core/dist/vendor-gate.js +2 -2
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.mjs +150 -1
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +53 -3
- package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
- package/plugins/huaweicloud-core/safety/policy.json +18 -11
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +114 -10
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +190 -138
- package/plugins/huaweicloud-core/skills/huawei-sandbox/references/resource-pool.md +36 -12
- package/plugins/huaweicloud-core/skills/huawei-voucher/SKILL.md +2 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +5 -5
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +13 -8
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/references/approvals.md +78 -23
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +21 -19
- package/plugins/huaweicloud-core/src/agents/codex-config.ts +432 -0
- package/plugins/huaweicloud-core/src/agents/codex-desktop.ts +8 -1
- package/plugins/huaweicloud-core/src/agents/codex.ts +10 -0
- package/plugins/huaweicloud-core/src/agents/opencode-config.ts +198 -30
- package/plugins/huaweicloud-core/src/agents/opencode.ts +157 -1
- package/plugins/huaweicloud-core/src/approval-gate.ts +1306 -0
- package/plugins/huaweicloud-core/src/approval-ledger.ts +2446 -0
- package/plugins/huaweicloud-core/src/approval-roster.ts +127 -0
- package/plugins/huaweicloud-core/src/approval-types.ts +237 -0
- package/plugins/huaweicloud-core/src/approvals-cli.ts +4 -4
- package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +23 -5
- package/plugins/huaweicloud-core/src/dep/receipts.ts +84 -5
- package/plugins/huaweicloud-core/src/hcloud-cli.ts +3 -0
- package/plugins/huaweicloud-core/src/hcloud-plan.ts +93 -63
- package/plugins/huaweicloud-core/src/lib/approval-mode.ts +34 -0
- package/plugins/huaweicloud-core/src/lib/approval-tokens.ts +19 -4
- package/plugins/huaweicloud-core/src/lib/call-trace.ts +7 -17
- package/plugins/huaweicloud-core/src/lib/confirm-language.ts +51 -0
- package/plugins/huaweicloud-core/src/lib/credentials.ts +9 -8
- package/plugins/huaweicloud-core/src/lib/hdkit/hdkit-gate.ts +1428 -0
- package/plugins/huaweicloud-core/src/lib/hdkit/hdkitservice-api.ts +377 -30
- package/plugins/huaweicloud-core/src/lib/hdkit/sandbox-pool.ts +8 -15
- package/plugins/huaweicloud-core/src/lib/opencode-ask-rule.ts +350 -0
- package/plugins/huaweicloud-core/src/lib/opencode-saved-perms.ts +354 -0
- package/plugins/huaweicloud-core/src/lib/supplemental-redaction.ts +129 -0
- package/plugins/huaweicloud-core/src/lib/tool-schema-parts.ts +40 -0
- package/plugins/huaweicloud-core/src/lib/workspace-glob.ts +414 -0
- package/plugins/huaweicloud-core/src/mcp-config-io.ts +27 -1
- package/plugins/huaweicloud-core/src/mcp-protocol.ts +88 -5
- package/plugins/huaweicloud-core/src/mcp-server.ts +13 -0
- package/plugins/huaweicloud-core/src/mcp-stdio-transport.ts +14 -4
- package/plugins/huaweicloud-core/src/packs/auth/approval.ts +302 -0
- package/plugins/huaweicloud-core/src/packs/auth/tools.ts +54 -45
- package/plugins/huaweicloud-core/src/packs/huaweicloud-cli/tools.ts +139 -120
- package/plugins/huaweicloud-core/src/packs/obs/approval.ts +122 -0
- package/plugins/huaweicloud-core/src/packs/obs/tools.ts +7 -2
- package/plugins/huaweicloud-core/src/packs/registry.ts +42 -1
- package/plugins/huaweicloud-core/src/packs/sandbox/approval.ts +296 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-account.ts +168 -23
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-credentials.ts +11 -1
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-hwexec.ts +228 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-session.ts +11 -1
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-tunnel.ts +1 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/schemas.ts +100 -8
- package/plugins/huaweicloud-core/src/packs/sandbox/tools.ts +31 -8
- package/plugins/huaweicloud-core/src/packs/secrets/approval.ts +50 -0
- package/plugins/huaweicloud-core/src/packs/secrets/tools.ts +4 -1
- package/plugins/huaweicloud-core/src/packs/update/approval.ts +87 -0
- package/plugins/huaweicloud-core/src/packs/update/tools.ts +8 -1
- package/plugins/huaweicloud-core/src/packs/voucher/tools.ts +1 -1
- package/plugins/huaweicloud-core/src/packs-configure.ts +75 -0
- package/plugins/huaweicloud-core/src/safety/classify-text.ts +40 -0
- package/plugins/huaweicloud-core/src/safety/policy.ts +7 -0
- package/plugins/huaweicloud-core/src/sandbox/deploy-check.ts +1 -1
- package/plugins/huaweicloud-core/src/sandbox/devbridge-auth.ts +74 -14
- package/plugins/huaweicloud-core/src/sandbox/devbridge-cleanup.ts +509 -0
- package/plugins/huaweicloud-core/src/sandbox/devbridge-expose-flow.ts +70 -18
- package/plugins/huaweicloud-core/src/sandbox/devbridge-expose.ts +26 -10
- package/plugins/huaweicloud-core/src/sandbox/devbridge-keepalive.ts +41 -2
- package/plugins/huaweicloud-core/src/sandbox/devbridge-key.ts +9 -3
- package/plugins/huaweicloud-core/src/sandbox/devbridge-tunnel.ts +24 -0
- package/plugins/huaweicloud-core/src/sandbox/devbridge-validation.ts +11 -1
- package/plugins/huaweicloud-core/src/sandbox/hwexec-task.ts +304 -0
- package/plugins/huaweicloud-core/src/setup-cli.ts +45 -3
- package/plugins/huaweicloud-core/src/tool-definitions.ts +9 -1
- package/plugins/huaweicloud-core/src/tool-schemas.ts +39 -6
- package/plugins/huaweicloud-core/src/tools.ts +124 -10
- package/plugins/huaweicloud-core/src/update-registry.ts +340 -5
- package/plugins/huaweicloud-core/src/update-upgrade.ts +1130 -14
- package/plugins/huaweicloud-core/src/vendor-gate.ts +2 -2
|
@@ -15,6 +15,7 @@ import { removeKooCli, removeObsConfig } from "./sandbox/uninstall-cleanup.js";
|
|
|
15
15
|
import { readReceipt, removeReceipt } from "./dep/receipts.js";
|
|
16
16
|
import { runSecretCommand } from "./lib/secret-vault/cli.js";
|
|
17
17
|
import { createProcessApproveIo, runApproveCommand, runPinCommand } from "./approvals-cli.js";
|
|
18
|
+
import { readConsentEvents } from "./approval-ledger.js";
|
|
18
19
|
import { custodyReport } from "./lib/secret-vault/custody.js";
|
|
19
20
|
import { vaultList } from "./lib/secret-vault/store.js";
|
|
20
21
|
import { detectCodeartsSandbox } from "./codearts-sandbox.js";
|
|
@@ -63,9 +64,10 @@ import { deployHermes, hermesDoctorMcpConfigured, hermesStatus, uninstallHermes
|
|
|
63
64
|
import { hermesDoctorSdkCheck } from "./agents/hermes-sdk.js";
|
|
64
65
|
import { codexDesktopStatus, codexSectionStatus, codexStatus, hasCodexCLI, installCodex, uninstallCodex, } from "./agents/codex.js";
|
|
65
66
|
import { codexDesktopDoctorMcpConfigured, deployCodexDesktop, uninstallCodexDesktop } from "./agents/codex-desktop.js";
|
|
67
|
+
import { codexDoctorApprovalRow } from "./agents/codex-config.js";
|
|
66
68
|
import { deployDsh, dshStatus, uninstallDsh } from "./agents/dsh.js";
|
|
67
69
|
import { dshDoctorMcpConfigured, dshPayloadDoctorSection } from "./agents/dsh-patch.js";
|
|
68
|
-
import { deployOpenCode, opencodeDoctorMcpConfigured, opencodeDoctorSeam, opencodeStatus, uninstallOpenCode, } from "./agents/opencode.js";
|
|
70
|
+
import { deployOpenCode, opencodeDoctorAskRule, opencodeDoctorMcpConfigured, opencodeDoctorSeam, opencodeStatus, uninstallOpenCode, } from "./agents/opencode.js";
|
|
69
71
|
import { deployOpenClaw, openclawDoctorMcpConfigured, openclawStatus, uninstallOpenClaw } from "./agents/openclaw.js";
|
|
70
72
|
import { codeartsDoctorMcpConfigured, codeartsStatus, deployCodeArts, uninstallCodeArts } from "./agents/codearts.js";
|
|
71
73
|
import { codeartsWorkDoctorMcpConfigured, codeartsWorkStatus, deployCodeArtsWork, uninstallCodeArtsWork, } from "./agents/codearts-work.js";
|
|
@@ -105,7 +107,7 @@ async function checkForUpdate() {
|
|
|
105
107
|
// target can only be non-null when distTags carried a candidate, so the
|
|
106
108
|
// optional chain never short-circuits a reachable path.
|
|
107
109
|
const tag = distTags?.next && semverCompare(target, distTags.next) === 0 ? 'next' : 'latest';
|
|
108
|
-
console.log(`\n\x1b[33mℹ️ 检测到新版本:${target}(当前 ${pkgVersion},${tag} 频道)。建议运行 \`npx --yes huaweicloud-devkit@${tag} update\` 更新。\x1b[0m`);
|
|
110
|
+
console.log(`\n\x1b[33mℹ️ 检测到新版本:${target}(当前 ${pkgVersion},${tag} 频道)。建议运行 \`npx --yes --foreground-scripts huaweicloud-devkit@${tag} update\` 更新。\x1b[0m`);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
// The .installed marker directory for a target. A lookup over
|
|
@@ -870,10 +872,42 @@ async function cmdDoctor() {
|
|
|
870
872
|
}
|
|
871
873
|
const mcpConfigured = mcpCfgTarget !== null;
|
|
872
874
|
check('MCP configured', mcpConfigured, mcpCfgTarget ? `Found in ${mcpCfgTarget} config` : 'Run: npx huaweicloud-devkit install');
|
|
873
|
-
//
|
|
874
|
-
// agents/opencode.ts owns the per-glob kept/missing
|
|
875
|
+
// OpenCode-only installer seams — the skills-tree permission check (the
|
|
876
|
+
// section in agents/opencode.ts owns the per-glob kept/missing
|
|
877
|
+
// evaluation) and the ASK approval posture check (the same file owns the
|
|
878
|
+
// client-rule/server-env pair evaluation).
|
|
875
879
|
if (installedPayload?.id === 'opencode') {
|
|
876
880
|
opencodeDoctorSeam(ctx);
|
|
881
|
+
opencodeDoctorAskRule(ctx);
|
|
882
|
+
}
|
|
883
|
+
// The codex client yield (PR-5): the per-tool approval_mode blocks the
|
|
884
|
+
// devkit payload's .mcp.json carries (agents/codex-config.ts records why
|
|
885
|
+
// the yield lives there, never in the user's config.toml). The row gates
|
|
886
|
+
// itself on the machine's codex relationship (no payload, no plugin, no
|
|
887
|
+
// desktop registration → silent), so it adds nothing to a codex-less
|
|
888
|
+
// doctor run. The desktop registration bit comes from the candidate the
|
|
889
|
+
// shell already probed above — passed in so the row never probes twice.
|
|
890
|
+
codexDoctorApprovalRow(ctx, codexDesktopDoctorMcpConfigured() !== null);
|
|
891
|
+
// Session standing consents (PR-3a's S3): the "remember for this
|
|
892
|
+
// session" grants the elicitation form's tick recorded in the ask-mode
|
|
893
|
+
// consent ledger. Listing only, zero rows print nothing: a clean home's
|
|
894
|
+
// doctor output stays byte-identical. A row is a RECORD of a grant the
|
|
895
|
+
// user ticked — the grant's operative lifetime is the devkit server
|
|
896
|
+
// process (it forgets on restart, fail-closed), so the line names what
|
|
897
|
+
// was consented and when, never a live permission claim.
|
|
898
|
+
try {
|
|
899
|
+
const standing = readConsentEvents().filter((event) => event.scope === 'session');
|
|
900
|
+
if (standing.length > 0) {
|
|
901
|
+
ctx.info('Session standing consents recorded in the consent ledger (each dies with the devkit server process):');
|
|
902
|
+
for (const grant of standing) {
|
|
903
|
+
console.log(` ${grant.tool} — args hash ${grant.argsHash.slice(0, 16)}, granted ` +
|
|
904
|
+
`${new Date(grant.grantedAt).toISOString()}, evidence ${grant.evidence}`);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
catch {
|
|
909
|
+
// An unreadable ledger is not a health failure: doctor lists state, it
|
|
910
|
+
// never gates on it.
|
|
877
911
|
}
|
|
878
912
|
// Hermes MCP Python SDK (only checked when Hermes config is found).
|
|
879
913
|
hermesDoctorSdkCheck(ctx, mcpCfgTarget);
|
|
@@ -973,6 +1007,9 @@ async function cmdDoctor() {
|
|
|
973
1007
|
}
|
|
974
1008
|
if (fail > 0) {
|
|
975
1009
|
console.log('\x1b[33mFix failures above, then restart your session.\x1b[0m');
|
|
1010
|
+
// A FAIL line is the command's verdict, so CI and scripts can gate on the
|
|
1011
|
+
// exit code: a doctor that prints [FAIL] and exits 0 is not a check.
|
|
1012
|
+
process.exitCode = 1;
|
|
976
1013
|
}
|
|
977
1014
|
if (fail === 0 && mcpConfigured) {
|
|
978
1015
|
console.log('\n\x1b[32mAll checks passed.\x1b[0m You can now describe your Huawei Cloud task');
|
|
@@ -993,6 +1030,7 @@ async function cmdUpdate() {
|
|
|
993
1030
|
console.log(BANNER);
|
|
994
1031
|
resolvePacksFlag(); // fail fast on bogus --packs before any file is copied
|
|
995
1032
|
const target = parseTarget();
|
|
1033
|
+
checkNode();
|
|
996
1034
|
await checkForUpdate();
|
|
997
1035
|
// Reconcile the native dirs only when this run will actually place the new
|
|
998
1036
|
// payload somewhere. A target whose server is absent gets "Not installed"
|
|
@@ -152,6 +152,10 @@ export const TOOL_DEFINITIONS_LITERALS = [
|
|
|
152
152
|
name: 'huaweicloud_sandbox_exec_one_shot',
|
|
153
153
|
description: packDescription('huaweicloud_sandbox_exec_one_shot'),
|
|
154
154
|
},
|
|
155
|
+
{
|
|
156
|
+
name: 'huaweicloud_sandbox_exec_poll',
|
|
157
|
+
description: packDescription('huaweicloud_sandbox_exec_poll'),
|
|
158
|
+
},
|
|
155
159
|
{
|
|
156
160
|
name: 'huaweicloud_sandbox_close_session',
|
|
157
161
|
description: packDescription('huaweicloud_sandbox_close_session'),
|
|
@@ -192,6 +196,10 @@ export const TOOL_DEFINITIONS_LITERALS = [
|
|
|
192
196
|
name: 'huaweicloud_sandbox_credentials',
|
|
193
197
|
description: packDescription('huaweicloud_sandbox_credentials'),
|
|
194
198
|
},
|
|
199
|
+
{
|
|
200
|
+
name: 'huaweicloud_sandbox_shutdown',
|
|
201
|
+
description: packDescription('huaweicloud_sandbox_shutdown'),
|
|
202
|
+
},
|
|
195
203
|
{
|
|
196
204
|
name: 'huaweicloud_voucher_status',
|
|
197
205
|
description: packDescription('huaweicloud_voucher_status'),
|
|
@@ -246,7 +254,7 @@ export const TOOL_DEFINITIONS_LITERALS = [
|
|
|
246
254
|
},
|
|
247
255
|
{
|
|
248
256
|
name: 'huaweicloud_packs_configure',
|
|
249
|
-
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.
|
|
257
|
+
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.',
|
|
250
258
|
},
|
|
251
259
|
{
|
|
252
260
|
name: 'huaweicloud_gateway_list_tools',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PACK_IDS } from "./lib/pack-types.js";
|
|
3
|
-
import { looseObject, vendorConfirmed } from "./lib/tool-schema-parts.js";
|
|
3
|
+
import { looseObject, vendorConfirmed, approvalTokenArg, approvedByUserArg, confirmLanguageArg, } from "./lib/tool-schema-parts.js";
|
|
4
|
+
import { APPROVAL_TOOLS } from "./approval-roster.js";
|
|
4
5
|
import { UPDATE_TOOL_SCHEMAS } from "./packs/update/tools.js";
|
|
5
6
|
import { HUAWEICLOUD_OPEN_MCP_TOOL_SCHEMAS } from "./packs/huaweicloud-open-mcp/tools.js";
|
|
6
7
|
import { HUAWEICLOUD_CLI_TOOL_SCHEMAS } from "./packs/huaweicloud-cli/tools.js";
|
|
@@ -28,7 +29,7 @@ const TOOL_SCHEMAS = {
|
|
|
28
29
|
command: z.string().describe('The exact command text to inspect.'),
|
|
29
30
|
}),
|
|
30
31
|
huaweicloud_hook_check_artifacts: z.looseObject({
|
|
31
|
-
artifacts: z.array(artifactsItem),
|
|
32
|
+
artifacts: z.array(artifactsItem).describe('Artifacts to inspect, each with a path and its full text content.'),
|
|
32
33
|
}),
|
|
33
34
|
huaweicloud_hook_check_deploy_plan: z.looseObject({
|
|
34
35
|
plan: z
|
|
@@ -43,11 +44,17 @@ const TOOL_SCHEMAS = {
|
|
|
43
44
|
.describe('Developer intent to route, such as deploy app, use API, debug error, or inspect resources.'),
|
|
44
45
|
}),
|
|
45
46
|
huaweicloud_explain_error: z.looseObject({
|
|
46
|
-
service: z.string().optional(),
|
|
47
|
-
errorCode: z
|
|
47
|
+
service: z.string().optional().describe('Optional service name (e.g., ECS, VPC, APIG) to route the lookup.'),
|
|
48
|
+
errorCode: z
|
|
49
|
+
.string()
|
|
50
|
+
.optional()
|
|
51
|
+
.describe('The error code to explain, such as APIGW.0301 or Ecs.0038. Extracted from message when omitted.'),
|
|
48
52
|
code: z.string().optional().describe('Alias of errorCode, accepted for compatibility. Prefer errorCode.'),
|
|
49
|
-
message: z
|
|
50
|
-
|
|
53
|
+
message: z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('Optional raw error message; the error code is extracted from it when errorCode is not provided.'),
|
|
57
|
+
requestId: z.string().optional().describe('Optional request ID from the failed response, for support escalation.'),
|
|
51
58
|
}),
|
|
52
59
|
huaweicloud_search_docs: z.looseObject({
|
|
53
60
|
query: z.string().describe('Search query across skill descriptions and documentation.'),
|
|
@@ -134,8 +141,27 @@ const TOOL_SCHEMAS = {
|
|
|
134
141
|
.boolean()
|
|
135
142
|
.optional()
|
|
136
143
|
.describe('Drop the session override and return to the operator DEVKIT_PACKS posture.'),
|
|
144
|
+
approvalToken: approvalTokenArg,
|
|
145
|
+
approvedByUser: approvedByUserArg,
|
|
137
146
|
}),
|
|
138
147
|
};
|
|
148
|
+
// The confirm-language hint rides every roster tool — the approval
|
|
149
|
+
// domain's parameter, injected HERE rather than in any pack's schema
|
|
150
|
+
// (the field belongs to the roster concept, which is cross-pack; the pack
|
|
151
|
+
// files stay untouched and the pack-boundaries guard stays clean). The
|
|
152
|
+
// roster is a zod-free leaf (approval-roster.ts), so this import adds no
|
|
153
|
+
// pack edge. The extend preserves each schema's loose catchall
|
|
154
|
+
// (probe-verified on zod 4.6.7), so the #530 pass-through leniency is
|
|
155
|
+
// unchanged; the field stays optional everywhere (a missing value must
|
|
156
|
+
// reach the gate, same doctrine as the other approval args). The legacy
|
|
157
|
+
// registry snapshot gate consults DELIBERATE_ADDITIONS for this property
|
|
158
|
+
// on every non-exempt roster tool.
|
|
159
|
+
for (const name of APPROVAL_TOOLS) {
|
|
160
|
+
const base = TOOL_SCHEMAS[name];
|
|
161
|
+
TOOL_SCHEMAS[name] = base.extend({
|
|
162
|
+
confirmLanguage: confirmLanguageArg,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
139
165
|
export function getToolSchema(name) {
|
|
140
166
|
return TOOL_SCHEMAS[name];
|
|
141
167
|
}
|
|
@@ -19,7 +19,7 @@ import { explainError } from "./explain-error.js";
|
|
|
19
19
|
import { getRegionalAvailability } from "./services/availability.js";
|
|
20
20
|
// PACK_TOOL_HANDLERS is the central pack dispatch table (its satisfies check
|
|
21
21
|
// pins every PackToolName to a handler).
|
|
22
|
-
import { PACK_TOOL_HANDLERS, isPackToolName } from "./packs/registry.js";
|
|
22
|
+
import { PACK_TOOL_HANDLERS, isPackToolName, APPROVAL_SPECS } from "./packs/registry.js";
|
|
23
23
|
// The skill-dir listing lives in the shared zod-free module
|
|
24
24
|
// (src/lib/skill-tree.ts) so the boot guard, the installer's doctor check,
|
|
25
25
|
// the build-time --check stray scan, and validate-package's skill gate all
|
|
@@ -39,6 +39,12 @@ import { toolArgKeys } from "./tool-schemas.js";
|
|
|
39
39
|
// importers (structure-load-path, e2e/cases/core) and dispatchTool calls
|
|
40
40
|
// enforceVendorGate at dispatch's top.
|
|
41
41
|
import { VENDOR_GATED_TOOLS, enforceVendorGate } from "./vendor-gate.js";
|
|
42
|
+
// The dispatch-layer approval gate (the roster, the per-pack specs it
|
|
43
|
+
// resolves from packs/registry.ts's APPROVAL_SPECS merge, the consent
|
|
44
|
+
// ledger, and the envelope faces) lives in the approval-* family;
|
|
45
|
+
// dispatchTool calls runApprovalGate after the vendor gate and before the
|
|
46
|
+
// pack dispatch.
|
|
47
|
+
import { recordApprovalDispatchOutcome, runApprovalGate, } from "./approval-gate.js";
|
|
42
48
|
// The capability catalog (service_catalog / list_packs / pack_info
|
|
43
49
|
// handlers, the SKILL_OWNER inversion, and the shared pack-refusal
|
|
44
50
|
// helpers) lives in capability-catalog.ts; dispatchTool switches into it.
|
|
@@ -133,15 +139,76 @@ async function dispatchTool(name, args, opts) {
|
|
|
133
139
|
if (VENDOR_GATED_TOOLS.has(name)) {
|
|
134
140
|
enforceVendorGate(args, opts);
|
|
135
141
|
}
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
// The approval gate sits after the vendor gate and before the pack
|
|
143
|
+
// dispatch, spec-driven through the roster (APPROVAL_SPECS keys are
|
|
144
|
+
// exactly the roster names, compile-checked in packs/registry.ts). A
|
|
145
|
+
// non-roster tool pays one table miss here and dispatches unchanged.
|
|
146
|
+
// Envelopes are results, not throws, so a gated refusal reaches the
|
|
147
|
+
// caller as the same JSON the handler would have returned. On a pass
|
|
148
|
+
// the gate's binding rides the handler opts: the call's approved
|
|
149
|
+
// resolution, so credential-consuming handlers execute the snapshot the
|
|
150
|
+
// human confirmed — never a post-consent re-read (PR-3b's TOCTOU
|
|
151
|
+
// finding).
|
|
152
|
+
const approvalSpec = APPROVAL_SPECS[name];
|
|
153
|
+
let arrivalStamp;
|
|
154
|
+
let arrivalSeq;
|
|
155
|
+
let approvedVia;
|
|
156
|
+
let consentScope;
|
|
157
|
+
let handlerOpts = opts;
|
|
158
|
+
if (approvalSpec) {
|
|
159
|
+
const gated = await runApprovalGate(name, approvalSpec, args, opts);
|
|
160
|
+
if (!('pass' in gated))
|
|
161
|
+
return gated.envelope;
|
|
162
|
+
arrivalStamp = gated.pass.arrivalStamp;
|
|
163
|
+
arrivalSeq = gated.pass.arrivalSeq;
|
|
164
|
+
approvedVia = gated.pass.approvedVia;
|
|
165
|
+
consentScope = gated.pass.consentScope;
|
|
166
|
+
if (gated.binding !== undefined)
|
|
167
|
+
handlerOpts = { ...opts, approvedBinding: gated.binding };
|
|
144
168
|
}
|
|
169
|
+
// The delivery-outcome recorder sits at the COMMON dispatch boundary
|
|
170
|
+
// (round 12, finding 3): the gate covers every roster member — pack
|
|
171
|
+
// tools and core tools alike (PR-3c's packs_configure registration is
|
|
172
|
+
// a CORE-tool dispatch through the switch below) — so the recorder must
|
|
173
|
+
// wrap BOTH dispatch legs, or a core-tool registration records its
|
|
174
|
+
// consent arrival but structurally never the delivery outcome the memo
|
|
175
|
+
// keys on. The wrapper hands the gate's spec and the arrival's stamp to
|
|
176
|
+
// the recorder; non-gated tools pay one no-op (the recorder returns
|
|
177
|
+
// without a spec) and dispatch through unchanged.
|
|
178
|
+
try {
|
|
179
|
+
const result = isPackToolName(name)
|
|
180
|
+
? await PACK_TOOL_HANDLERS[name](args, handlerOpts)
|
|
181
|
+
: await dispatchCoreTool(name, args, handlerOpts);
|
|
182
|
+
recordApprovalDispatchOutcome(name, approvalSpec, args, opts, result, undefined, arrivalStamp, arrivalSeq, consentScope);
|
|
183
|
+
// The reuse attribution (PR-3a): a call that rode the retry memo or the
|
|
184
|
+
// session standing grant names it on the response, so the caller can
|
|
185
|
+
// tell a fresh confirmation's execution from a reused consent's. Object
|
|
186
|
+
// results carry the field; every registered tool's handler returns one,
|
|
187
|
+
// and a non-object shape keeps its wire contract untouched.
|
|
188
|
+
if (approvedVia !== undefined && result !== null && typeof result === 'object' && !Array.isArray(result)) {
|
|
189
|
+
result.approvedVia = approvedVia;
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
recordApprovalDispatchOutcome(name, approvalSpec, args, opts, undefined, error, arrivalStamp, arrivalSeq, consentScope);
|
|
195
|
+
// The reuse attribution rides the error path too (interrogate round 2,
|
|
196
|
+
// F11): a memo-reused retry whose handler throws again still names what
|
|
197
|
+
// authorized it — programmatic callers see the marker on the error
|
|
198
|
+
// object; the wire shape of the error itself is unchanged.
|
|
199
|
+
if (approvedVia !== undefined && error instanceof Error) {
|
|
200
|
+
error.approvedVia = approvedVia;
|
|
201
|
+
}
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// The core-tool dispatch leg: the switch over the core remainder, after
|
|
206
|
+
// the pack guard — extracted so the delivery-outcome wrapper above can
|
|
207
|
+
// cover both dispatch paths from one boundary. The compile-time
|
|
208
|
+
// exhaustiveness never-guard moves with it: `name` is narrowed to
|
|
209
|
+
// Exclude<ToolName, PackToolName> by the call site's isPackToolName
|
|
210
|
+
// branch above.
|
|
211
|
+
async function dispatchCoreTool(name, args, opts) {
|
|
145
212
|
switch (name) {
|
|
146
213
|
case 'huaweicloud_hook_check_command':
|
|
147
214
|
return hookResult(withUnknownOperationWarn(String(args.command || ''), evaluateCommandRisk(args.command || '')));
|