huaweicloud-devkit 2.0.0-next.3 → 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 +141 -86
- package/plugins/huaweicloud-core/dist/agents/opencode.js +106 -39
- 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 +62 -61
- package/plugins/huaweicloud-core/dist/lib/approval-mode.js +7 -5
- 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 +224 -78
- 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 +68 -16
- package/plugins/huaweicloud-core/dist/mcp-server.js +6506 -912
- 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 +85 -130
- 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 +36 -1
- 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 +2 -2
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +11 -7
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/references/approvals.md +74 -29
- 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 +176 -88
- package/plugins/huaweicloud-core/src/agents/opencode.ts +125 -54
- 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 +68 -70
- package/plugins/huaweicloud-core/src/lib/approval-mode.ts +7 -5
- 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 +302 -83
- 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 +81 -17
- package/plugins/huaweicloud-core/src/mcp-server.ts +7 -7
- 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 +99 -137
- 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 +39 -1
- 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
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { runHcloud, planHcloudCommand, stripLeadingHcloudBinArgs, firstPlaceholderSecretArg, pinViewArgs, } from "../../hcloud-cli.js";
|
|
2
|
+
import { runHcloud, planHcloudCommand, stripLeadingHcloudBinArgs, firstPlaceholderSecretArg, pinViewArgs, needsUserConfirmation, quoteShellArg, hcloudExecutableLines, } from "../../hcloud-cli.js";
|
|
3
3
|
import { hcloudProbeNextStep, hcloudProbeRaw, probeHcloud } from "../../hcloud-probe.js";
|
|
4
4
|
import { redactSecrets } from "../../safety-policy.js";
|
|
5
5
|
import { asText } from "../../lib/as-text.js";
|
|
6
6
|
import { approvalModeFromEnv } from "../../lib/approval-mode.js";
|
|
7
|
-
import {
|
|
8
|
-
import { booleanArg, numericArg, stringArrayArg, vendorConfirmed } from "../../lib/tool-schema-parts.js";
|
|
7
|
+
import { hashArgs } from "../../lib/approval-tokens.js";
|
|
8
|
+
import { approvalTokenArg, approvedByUserArg, booleanArg, numericArg, stringArrayArg, vendorConfirmed, } from "../../lib/tool-schema-parts.js";
|
|
9
9
|
import { asRecord } from "../../lib/as-record.js";
|
|
10
10
|
// The seven KooCLI-coupled execution tools sunk from core (src/tools.ts):
|
|
11
|
-
// version/profile inspection, plan/
|
|
12
|
-
// operation discovery, and region listing. The consent layer
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
11
|
+
// version/profile inspection, plan/readonly/approved command execution,
|
|
12
|
+
// operation discovery, and region listing. The consent layer lives in the
|
|
13
|
+
// dispatch-layer approval gate (src/approval-gate.ts) plus the token store
|
|
14
|
+
// (src/lib/approval-tokens.ts): the gate, driven by this pack's
|
|
15
|
+
// HUAWEICLOUD_CLI_APPROVAL_SPECS entry, owns the attestation check, the
|
|
16
|
+
// token lifecycle envelopes, the placeholder floor, and the args binding;
|
|
17
|
+
// the handler keeps the pure runHcloud execution. The approval posture
|
|
18
|
+
// resolves from DEVKIT_APPROVAL_MODE (src/lib/approval-mode.ts): 'token'
|
|
19
|
+
// (default) keeps the out-of-band terminal gate; 'ask' moves the
|
|
20
|
+
// confirmation onto the server-run gate (an elicitation form, or the T3
|
|
21
|
+
// chat round-trip), so the plan mints nothing and the run needs no token. The only allowWrites:true call
|
|
22
|
+
// sites in the codebase (the approved-run execution) live here, so trimming this pack
|
|
20
23
|
// removes the CLI execution face and its approval tools together: a
|
|
21
24
|
// configuration trimmed of this pack has no devkit-side hcloud CLI write
|
|
22
25
|
// path, and the gateway face, when enabled, is a separate delegated write
|
|
@@ -205,125 +208,39 @@ function approvedRunOptions(args) {
|
|
|
205
208
|
stdin: args.stdin,
|
|
206
209
|
};
|
|
207
210
|
}
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
211
|
+
// The wire form of the args the approval binds and the engine executes:
|
|
212
|
+
// hcloud ARGUMENTS ("excluding the hcloud executable" per the schema),
|
|
213
|
+
// which agents routinely paste anyway — one derivation shared by the
|
|
214
|
+
// handler and the pack's approval spec.
|
|
215
|
+
function providedStringArgs(args) {
|
|
216
|
+
return Array.isArray(args.args) ? args.args.map(String) : [];
|
|
217
|
+
}
|
|
218
|
+
// Both approval modes end in the same execution: derive the effective
|
|
219
|
+
// args, plan strictly (never minting — ask mode has no token face, and in
|
|
220
|
+
// token mode the gate has already consumed it), execute, and embed the
|
|
221
|
+
// plan. The dispatch-layer approval gate (src/approval-gate.ts) owns
|
|
222
|
+
// everything consent-shaped ahead of this point; runHcloud's assertAllowed
|
|
223
|
+
// re-assertion of the strict classification stays the execution floor
|
|
224
|
+
// (secret/credential/invalid denies still throw; allowWrites:true stays
|
|
225
|
+
// scoped to the approved-run call sites, the only ones in the codebase).
|
|
226
|
+
async function executeApproved(args) {
|
|
227
|
+
const { args: effectiveArgs } = stripLeadingHcloudBinArgs(providedStringArgs(args));
|
|
221
228
|
const strictPlan = planHcloudCommand(effectiveArgs, {
|
|
222
229
|
allowWrites: false,
|
|
223
230
|
mintApprovalToken: false,
|
|
224
|
-
approvalMode:
|
|
231
|
+
approvalMode: approvalModeFromEnv(process.env),
|
|
225
232
|
});
|
|
226
233
|
const result = await runHcloud(effectiveArgs, approvedRunOptions(args));
|
|
227
|
-
// Spread instead of in-place mutation
|
|
228
|
-
//
|
|
234
|
+
// Spread instead of in-place mutation: the HcloudRunResult shape stays
|
|
235
|
+
// owned by hcloud-cli.ts.
|
|
229
236
|
return { ...result, approved: true, plan: strictPlan };
|
|
230
237
|
}
|
|
231
238
|
async function runApprovedCommand(args = {}) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return runApprovedCommandAskMode(args);
|
|
238
|
-
}
|
|
239
|
-
const token = String(args.approvalToken || '');
|
|
240
|
-
// D4-24 precise JSON contract (#745): expired and already-consumed tokens
|
|
241
|
-
// return a structured result instead of throwing a generic Error string, so
|
|
242
|
-
// clients can machine-assert the two non-success states.
|
|
243
|
-
const inspection = inspectApprovalToken(token);
|
|
244
|
-
if (inspection.state === 'already_consumed') {
|
|
245
|
-
return { status: 'ok', outcome: 'already_processed' };
|
|
246
|
-
}
|
|
247
|
-
if (inspection.state === 'expired') {
|
|
248
|
-
return { status: 'rejected', code: 'CONFIRM_TOKEN_EXPIRED' };
|
|
249
|
-
}
|
|
250
|
-
if (inspection.state === 'not_found') {
|
|
251
|
-
// A token that was never created (typo / unknown / pruned beyond the
|
|
252
|
-
// tombstone window) is still a rejection, but carries no expired/already
|
|
253
|
-
// semantics — surface a distinct code so clients can tell the cases apart.
|
|
254
|
-
return { status: 'rejected', code: 'CONFIRM_TOKEN_NOT_FOUND' };
|
|
255
|
-
}
|
|
256
|
-
const providedArgs = Array.isArray(args.args) ? args.args.map(String) : [];
|
|
257
|
-
// The token binds the plan's EFFECTIVE args (the plan strips a leading bin
|
|
258
|
-
// token before minting), so the verify side normalizes the same way: a run
|
|
259
|
-
// call that echoes the plan verbatim and one that sends the cleaned args
|
|
260
|
-
// both hash to the stored value, while any real argument change still
|
|
261
|
-
// rejects. Without this, a prefixed plan followed by a self-corrected run
|
|
262
|
-
// burned the single-use token on a mismatch (2026-11-05 UX report #6, the
|
|
263
|
-
// approval-trap probe).
|
|
264
|
-
const { args: effectiveArgs } = stripLeadingHcloudBinArgs(providedArgs);
|
|
265
|
-
// Placeholder guard before the consume: the shared helper's token-mode
|
|
266
|
-
// wording keeps the guidance followable on the same approval.
|
|
267
|
-
assertNoPlaceholderSecret(effectiveArgs, 'token');
|
|
268
|
-
// The strict plan is pure, so it is computed before the token is consumed:
|
|
269
|
-
// its userConfirmation.needed decides whether the consume requires a grant,
|
|
270
|
-
// and the result still embeds it.
|
|
271
|
-
const strictPlan = planHcloudCommand(effectiveArgs, { allowWrites: false, mintApprovalToken: false });
|
|
272
|
-
// One snapshot: the confirmation gate, the args-hash binding, the pinView
|
|
273
|
-
// fallback, and the single-use claim all read the SAME entry — the one
|
|
274
|
-
// consumeApprovalToken returns. The pre-consume inspect-gate this replaces
|
|
275
|
-
// verified the grant on one read while execution consumed another, which
|
|
276
|
-
// a same-user store swap between the two reads laundered (the review's
|
|
277
|
-
// TOCTOU repro).
|
|
278
|
-
const consumed = consumeApprovalToken(token, { requireGrant: strictPlan.userConfirmation.needed });
|
|
279
|
-
if (consumed.status === 'grant_required') {
|
|
280
|
-
return {
|
|
281
|
-
status: 'rejected',
|
|
282
|
-
code: 'USER_CONFIRMATION_REQUIRED',
|
|
283
|
-
nextStep: 'Ask the user to run "npx huaweicloud-devkit approve <this approvalToken>" in their own terminal, then retry this exact call.',
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
if (consumed.status === 'gone') {
|
|
287
|
-
// Defensive: inspectApprovalToken said 'valid' but consume returned gone.
|
|
288
|
-
// The paths are the O_EXCL claim losing a race (another consumer is
|
|
289
|
-
// spending this exact token right now) or a store swap removing the
|
|
290
|
-
// entry between the two reads — classify via re-inspect, never a
|
|
291
|
-
// misleading success and never a false not_found.
|
|
292
|
-
const recheck = inspectApprovalToken(token);
|
|
293
|
-
if (recheck.state === 'expired')
|
|
294
|
-
return { status: 'rejected', code: 'CONFIRM_TOKEN_EXPIRED' };
|
|
295
|
-
return { status: 'ok', outcome: 'already_processed' };
|
|
296
|
-
}
|
|
297
|
-
const stored = consumed.entry;
|
|
298
|
-
if (hashArgs(effectiveArgs) !== stored.argsHash) {
|
|
299
|
-
// The pin view is the canonical fold for the substitution comparison
|
|
300
|
-
// (loop round 4, seat-1 B2): it folds the two-token/glued secret forms
|
|
301
|
-
// the redactor never did, so following the placeholder guidance on a
|
|
302
|
-
// two-token plan no longer dead-ends in a mismatch. Pre-schema entries
|
|
303
|
-
// (no argsPinView) fall back to the redactor comparison.
|
|
304
|
-
const storedView = JSON.stringify(stored.argsPinView ?? stored.argsRedacted);
|
|
305
|
-
const providedView = JSON.stringify(pinViewArgs(effectiveArgs));
|
|
306
|
-
if (storedView !== providedView) {
|
|
307
|
-
throw new Error('Provided args do not match the approved plan. Use the exact args from the plan. ' +
|
|
308
|
-
'If the plan shows <redacted> for passwords or secrets, replace <redacted> with the actual values.');
|
|
309
|
-
}
|
|
310
|
-
// Views equal means ONLY secret values differ. The plan carried real
|
|
311
|
-
// (non-placeholder) secrets → they are pinned: a different real secret
|
|
312
|
-
// rejects (loop round 2, the seat-2 A3 probe — a changed password used
|
|
313
|
-
// to execute). A placeholder-bearing plan (secretsSubstitutable) keeps
|
|
314
|
-
// the documented substitution flow.
|
|
315
|
-
if (stored.secretsSubstitutable !== true) {
|
|
316
|
-
// The message deliberately does not assert WHY the plan pinned: the
|
|
317
|
-
// detector is key-shape heuristic, so the plan may have carried real
|
|
318
|
-
// secrets, placeholder-adjacent values, or JSON-body forms where the
|
|
319
|
-
// substitution contract is not reliable (loop round 9, seat-1 B1/B2).
|
|
320
|
-
throw new Error('Secret values are pinned to the approved plan: re-run huaweicloud_plan_cli_command with the final values and re-approve.');
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
const result = await runHcloud(effectiveArgs, approvedRunOptions(args));
|
|
324
|
-
// Spread instead of in-place mutation: identical serialized content, minus a
|
|
325
|
-
// write to the HcloudRunResult shape owned by hcloud-cli.ts.
|
|
326
|
-
return { ...result, approved: true, plan: strictPlan };
|
|
239
|
+
// The gate has already verified the approvedByUser attestation,
|
|
240
|
+
// classified the token lifecycle (an ask-mode call routes here with no
|
|
241
|
+
// token), enforced the placeholder-secret floor before any consume, and
|
|
242
|
+
// bound the provided args to the consumed entry's hash and pin view.
|
|
243
|
+
return executeApproved(args);
|
|
327
244
|
}
|
|
328
245
|
async function listRegions() {
|
|
329
246
|
const result = await runHcloud(['IAM', 'KeystoneListRegions'], { timeoutMs: 30000, maxRetries: 0 }).catch((error) => ({
|
|
@@ -407,7 +324,7 @@ const planCliCommandSchema = z.looseObject({
|
|
|
407
324
|
});
|
|
408
325
|
const runReadonlyCommandSchema = z.looseObject({
|
|
409
326
|
vendorConfirmed,
|
|
410
|
-
args: stringArrayArg,
|
|
327
|
+
args: stringArrayArg.describe('hcloud arguments, excluding the hcloud executable.'),
|
|
411
328
|
timeoutMs: numericArg.optional().describe('Optional timeout in milliseconds. Defaults to 60000.'),
|
|
412
329
|
maxRetries: numericArg.optional().describe('Optional retry count for transient network errors. Defaults to 1.'),
|
|
413
330
|
cwd: z.string().optional().describe('Optional working directory for the hcloud process.'),
|
|
@@ -419,12 +336,13 @@ const listOperationsSchema = z.looseObject({
|
|
|
419
336
|
});
|
|
420
337
|
const runApprovedCommandSchema = z.looseObject({
|
|
421
338
|
vendorConfirmed,
|
|
422
|
-
|
|
423
|
-
approvalToken: z
|
|
339
|
+
command: z
|
|
424
340
|
.string()
|
|
425
341
|
.optional()
|
|
426
|
-
.describe('
|
|
427
|
-
|
|
342
|
+
.describe('Always send this: the exact full hcloud command line this call executes, for example "hcloud ECS DeleteServer --server_id=i-123". The plan result\'s command field (huaweicloud_plan_cli_command) is the display line: copy it and substitute the real values wherever it shows <redacted>, or send the args array spelled out as one line. The confirmation body shows it as the first thing the user reads, and the server checks it equals the line the args array spells: a mismatch is rejected without executing anything. Only a legacy caller that predates this field omits it, and the field is optional in the schema so such a call still reaches the gate instead of dying in validation.'),
|
|
343
|
+
args: stringArrayArg.describe('hcloud arguments, excluding the hcloud executable.'),
|
|
344
|
+
approvalToken: approvalTokenArg.describe('Required in token-approval mode (from huaweicloud_plan_cli_command); omit in ask mode, where the server-run gate confirms at run time.'),
|
|
345
|
+
approvedByUser: approvedByUserArg,
|
|
428
346
|
timeoutMs: numericArg.optional().describe('Optional timeout in milliseconds. Defaults to 60000.'),
|
|
429
347
|
maxRetries: numericArg.optional().describe('Optional retry count for transient network errors. Defaults to 1.'),
|
|
430
348
|
cwd: z.string().optional().describe('Optional working directory for the hcloud process.'),
|
|
@@ -434,6 +352,43 @@ const showProfileRedactedSchema = z.looseObject({
|
|
|
434
352
|
profile: z.string().optional().describe('Optional KooCLI profile name.'),
|
|
435
353
|
});
|
|
436
354
|
const listRegionsSchema = z.looseObject({ vendorConfirmed });
|
|
355
|
+
// The pack's approval registration: the run face is plan-face tokenSource
|
|
356
|
+
// (the plan tool mints, the gate never does). normalizeArgs returns the
|
|
357
|
+
// binding value — the effective args after the leading-bin strip — so the
|
|
358
|
+
// gate's hash, pin view, and ledger record equal what the plan minted
|
|
359
|
+
// over. classify answers the consume's grant requirement with the same
|
|
360
|
+
// pure strict view the trunk's embedded plan computed (a read-classified
|
|
361
|
+
// command still executes on an unconfirmed token). The summarize view
|
|
362
|
+
// never leaks raw args: the plan face redacts, and the summary names the
|
|
363
|
+
// tool plus the redacted command echo.
|
|
364
|
+
export const HUAWEICLOUD_CLI_APPROVAL_SPECS = {
|
|
365
|
+
huaweicloud_run_approved_command: {
|
|
366
|
+
domain: 'cli',
|
|
367
|
+
flavor: 'always',
|
|
368
|
+
tokenSource: 'plan-face',
|
|
369
|
+
normalizeArgs: (args) => stripLeadingHcloudBinArgs(providedStringArgs(args)).args,
|
|
370
|
+
commandAnchor: (bindingValue) => hcloudExecutableLines(bindingValue),
|
|
371
|
+
classify: (bindingValue) => (needsUserConfirmation(bindingValue) ? 'required' : 'none'),
|
|
372
|
+
assertArgsExecutable: (bindingValue, mode) => assertNoPlaceholderSecret(bindingValue, mode),
|
|
373
|
+
summarize: (bindingValue) => {
|
|
374
|
+
const effective = bindingValue;
|
|
375
|
+
// Round 10, G1: the summary is built from the REDACTED pin view, not
|
|
376
|
+
// the raw argument stream — the ApprovalSpec contract ("never the raw
|
|
377
|
+
// argument stream — a popup must not leak secrets") must hold for the
|
|
378
|
+
// one field PR-3's USER_CONFIRMATION_REQUIRED envelope and PR-4's
|
|
379
|
+
// elicitation form spread verbatim. pinViewArgs is the same redaction
|
|
380
|
+
// vocabulary the pin view uses; an unredactable summary would leak
|
|
381
|
+
// exactly what the pin view hides.
|
|
382
|
+
const redactedLine = ['hcloud', ...pinViewArgs(effective)].map((arg) => quoteShellArg(arg)).join(' ');
|
|
383
|
+
return {
|
|
384
|
+
summary: `huaweicloud_run_approved_command: ${redactedLine.slice(0, 200)}`,
|
|
385
|
+
argsHash: hashArgs(effective),
|
|
386
|
+
pinView: pinViewArgs(effective),
|
|
387
|
+
command: redactedLine,
|
|
388
|
+
};
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
};
|
|
437
392
|
export const HUAWEICLOUD_CLI_TOOLS = [
|
|
438
393
|
{
|
|
439
394
|
name: 'huaweicloud_check_cli',
|
|
@@ -443,7 +398,7 @@ export const HUAWEICLOUD_CLI_TOOLS = [
|
|
|
443
398
|
},
|
|
444
399
|
{
|
|
445
400
|
name: 'huaweicloud_plan_cli_command',
|
|
446
|
-
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
|
|
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.",
|
|
447
402
|
schema: planCliCommandSchema,
|
|
448
403
|
handler: handlePlanCliCommand,
|
|
449
404
|
},
|
|
@@ -461,7 +416,7 @@ export const HUAWEICLOUD_CLI_TOOLS = [
|
|
|
461
416
|
},
|
|
462
417
|
{
|
|
463
418
|
name: 'huaweicloud_run_approved_command',
|
|
464
|
-
description:
|
|
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.',
|
|
465
420
|
schema: runApprovedCommandSchema,
|
|
466
421
|
handler: handleRunApprovedCommand,
|
|
467
422
|
},
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { hashArgs } from "../../lib/approval-tokens.js";
|
|
2
|
+
import { redactSecrets } from "../../safety-policy.js";
|
|
3
|
+
// The obs pack's approval registrations (PR-3c): both bucket-config tools
|
|
4
|
+
// are CLASSIFIED on their `action` argument — `get` is a signed read that
|
|
5
|
+
// must never confirm, while `set` and `delete` are signed PUT/DELETE on
|
|
6
|
+
// live buckets (the most exposed cloud writes in the inventory) and elicit
|
|
7
|
+
// or prompt-ask every call. classify-before-mint holds at the gate face:
|
|
8
|
+
// a read never mints, and a write never executes without the human.
|
|
9
|
+
// The binding value is the CONTENT projection of the args — action,
|
|
10
|
+
// bucket, region, and the config payload — never the gate fields
|
|
11
|
+
// (approvalToken/approvedByUser), so the hash the token binds is stable
|
|
12
|
+
// across the mint → approve → retry cycle. No commandAnchor and no
|
|
13
|
+
// summarize command: these tools sign REST calls internally, so there is
|
|
14
|
+
// no executable line to pin or display — the summarize view is the
|
|
15
|
+
// confirmation content, per the ApprovalSpec contract for tools whose
|
|
16
|
+
// args carry no command.
|
|
17
|
+
//
|
|
18
|
+
// setup_obs_config stays unregistered (the flagged boundary item): it
|
|
19
|
+
// syncs credentials the user just configured through the auth face, so
|
|
20
|
+
// the human is present by construction.
|
|
21
|
+
// The content fields of the website-config call, in the shape the handler
|
|
22
|
+
// reads. Undefined optional fields ride as undefined (dropped by the
|
|
23
|
+
// hash/pin-view serializations both times, so the projection is stable).
|
|
24
|
+
function websiteBinding(args) {
|
|
25
|
+
return {
|
|
26
|
+
action: args.action,
|
|
27
|
+
bucket: args.bucket,
|
|
28
|
+
region: args.region,
|
|
29
|
+
indexDocument: args.indexDocument,
|
|
30
|
+
errorDocument: args.errorDocument,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function corsBinding(args) {
|
|
34
|
+
return {
|
|
35
|
+
action: args.action,
|
|
36
|
+
bucket: args.bucket,
|
|
37
|
+
region: args.region,
|
|
38
|
+
rules: args.rules,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Pure classification over the binding value: `get` is a signed read
|
|
42
|
+
// (none — no consent, no mint), everything else requires the human.
|
|
43
|
+
// An unknown action fails closed onto `required`; zod's enum rejects it
|
|
44
|
+
// before dispatch, so the branch is defensive only.
|
|
45
|
+
function classifyObsAction(value) {
|
|
46
|
+
return value.action === 'get' ? 'none' : 'required';
|
|
47
|
+
}
|
|
48
|
+
// The set-preconditions the handlers themselves enforce, moved before the
|
|
49
|
+
// mint (NoDoomedToken: a malformed set call must not mint an approval it
|
|
50
|
+
// could never spend — the retry would need new args, hence a new hash,
|
|
51
|
+
// hence a fresh approval). Mirrors the handlers' own throw text.
|
|
52
|
+
function assertWebsiteExecutable(value) {
|
|
53
|
+
const { action, indexDocument } = value;
|
|
54
|
+
if (action === 'set' && (typeof indexDocument !== 'string' || indexDocument === '')) {
|
|
55
|
+
throw new Error('indexDocument is required for action=set.');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function assertCorsExecutable(value) {
|
|
59
|
+
const { action, rules } = value;
|
|
60
|
+
if (action === 'set' && (!Array.isArray(rules) || rules.length === 0)) {
|
|
61
|
+
throw new Error('rules array is required for action=set (allowedOrigin + allowedMethod, HEAD included).');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// The summarize contract (approval-types.ts): the view is the REDACTED
|
|
65
|
+
// popup projection — never the raw argument stream. The whole binding
|
|
66
|
+
// folds through the shared redaction vocabulary (safety/redact.ts via the
|
|
67
|
+
// safety-policy face) before any field reaches the summary or the pin
|
|
68
|
+
// view, so a secret-shaped value riding any field is folded to
|
|
69
|
+
// <redacted>. The argsHash still binds the RAW content projection: the
|
|
70
|
+
// token pins what will actually execute, the view shows what the human
|
|
71
|
+
// may read.
|
|
72
|
+
function safeView(value) {
|
|
73
|
+
return redactSecrets(value);
|
|
74
|
+
}
|
|
75
|
+
export const OBS_APPROVAL_SPECS = {
|
|
76
|
+
huaweicloud_obs_set_website_config: {
|
|
77
|
+
domain: 'obs',
|
|
78
|
+
flavor: 'classified',
|
|
79
|
+
tokenSource: 'gate',
|
|
80
|
+
normalizeArgs: websiteBinding,
|
|
81
|
+
classify: classifyObsAction,
|
|
82
|
+
assertArgsExecutable: assertWebsiteExecutable,
|
|
83
|
+
summarize: (value) => {
|
|
84
|
+
const safe = safeView(value);
|
|
85
|
+
const index = safe.action === 'set' ? `, index ${String(safe.indexDocument)}` : '';
|
|
86
|
+
return {
|
|
87
|
+
summary: `huaweicloud_obs_set_website_config: ${String(safe.action)} website config on bucket ${String(safe.bucket)} (region ${String(safe.region)})${index}`,
|
|
88
|
+
argsHash: hashArgs(value),
|
|
89
|
+
pinView: safe,
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
huaweicloud_obs_set_cors: {
|
|
94
|
+
domain: 'obs',
|
|
95
|
+
flavor: 'classified',
|
|
96
|
+
tokenSource: 'gate',
|
|
97
|
+
normalizeArgs: corsBinding,
|
|
98
|
+
classify: classifyObsAction,
|
|
99
|
+
assertArgsExecutable: assertCorsExecutable,
|
|
100
|
+
summarize: (value) => {
|
|
101
|
+
const safe = safeView(value);
|
|
102
|
+
const count = safe.action === 'set' ? ` (${Array.isArray(safe.rules) ? safe.rules.length : 0} rule(s))` : '';
|
|
103
|
+
return {
|
|
104
|
+
summary: `huaweicloud_obs_set_cors: ${String(safe.action)} CORS rules${count} on bucket ${String(safe.bucket)} (region ${String(safe.region)})`,
|
|
105
|
+
argsHash: hashArgs(value),
|
|
106
|
+
pinView: safe,
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
@@ -7,6 +7,7 @@ import { readGlobalCredentialsStrict, writeObsConfig, resolveCredentialsWithRunt
|
|
|
7
7
|
import { runHcloud } from "../../hcloud-cli.js";
|
|
8
8
|
import { fetchWithProxy } from "../../proxy/proxy-agent.js";
|
|
9
9
|
import { asCredentialRecord } from "../../lib/credentials.js";
|
|
10
|
+
import { approvalTokenArg, approvedByUserArg } from "../../lib/tool-schema-parts.js";
|
|
10
11
|
import { asRecord } from "../../lib/as-record.js";
|
|
11
12
|
// Handlers migrated verbatim from src/tools.ts. setupObsConfig syncs the
|
|
12
13
|
// global credential vault (or the hcloud profile) into ~/.obsutilconfig;
|
|
@@ -361,11 +362,15 @@ const obsWebsiteConfigSchema = z.looseObject({
|
|
|
361
362
|
region: z.string().describe('OBS 桶所在区域,如 cn-north-4'),
|
|
362
363
|
indexDocument: z.string().optional().describe('首页文件名(action=set 时必填),如 index.html'),
|
|
363
364
|
errorDocument: z.string().optional().describe('错误页面文件名(action=set 时可选),如 404.html 或 error.html'),
|
|
365
|
+
approvalToken: approvalTokenArg,
|
|
366
|
+
approvedByUser: approvedByUserArg,
|
|
364
367
|
});
|
|
365
368
|
const obsCorsConfigSchema = z.looseObject({
|
|
366
369
|
action: z.enum(['set', 'get', 'delete']).describe('操作类型:set=配置 CORS 规则,get=查询当前规则,delete=删除规则'),
|
|
367
370
|
bucket: z.string().describe('OBS 桶名称'),
|
|
368
371
|
region: z.string().describe('OBS 桶所在区域,如 cn-north-4'),
|
|
372
|
+
approvalToken: approvalTokenArg,
|
|
373
|
+
approvedByUser: approvedByUserArg,
|
|
369
374
|
rules: z
|
|
370
375
|
.array(z.looseObject({
|
|
371
376
|
allowedOrigin: z.string().describe('允许的来源,如 https://your-app.example.com 或 *'),
|
|
@@ -390,7 +395,7 @@ export const OBS_TOOLS = [
|
|
|
390
395
|
},
|
|
391
396
|
{
|
|
392
397
|
name: 'huaweicloud_obs_set_website_config',
|
|
393
|
-
description: '配置 OBS 桶的静态网站托管(推荐路径:无需手写 XML,此工具内部实现 AWS4 签名调用 OBS REST API,屏蔽签名细节)。支持 set(配置)、get(查询)、delete
|
|
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。',
|
|
394
399
|
schema: obsWebsiteConfigSchema,
|
|
395
400
|
handler: handleObsWebsiteConfig,
|
|
396
401
|
},
|
|
@@ -402,7 +407,7 @@ export const OBS_TOOLS = [
|
|
|
402
407
|
// claimed the CLI lacks it, measured on its 7.2.x sandbox. The tool stays
|
|
403
408
|
// the recommended path (no XML file, no --noproxy traps); the CLI is the
|
|
404
409
|
// scripted alternative for 7.3.12+ environments.
|
|
405
|
-
description: '配置 OBS 桶的 CORS 规则(浏览器直传前置条件;推荐路径:此工具内部实现 AWS4 签名调用 OBS REST API(PUT/GET/DELETE /?cors),无需手写 XML,屏蔽签名细节)。支持 set(配置)、get(查询)、delete
|
|
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 才算成功)。',
|
|
406
411
|
schema: obsCorsConfigSchema,
|
|
407
412
|
handler: handleObsCorsConfig,
|
|
408
413
|
},
|
|
@@ -14,8 +14,15 @@ import { OBS_TOOL_HANDLERS } from "./obs/tools.js";
|
|
|
14
14
|
import { VOUCHER_TOOL_HANDLERS } from "./voucher/tools.js";
|
|
15
15
|
import { DISCOVERY_TOOL_HANDLERS } from "./discovery/tools.js";
|
|
16
16
|
import { HUAWEICLOUD_OPEN_MCP_TOOL_HANDLERS } from "./huaweicloud-open-mcp/tools.js";
|
|
17
|
-
import { HUAWEICLOUD_CLI_TOOL_HANDLERS } from "./huaweicloud-cli/tools.js";
|
|
17
|
+
import { HUAWEICLOUD_CLI_TOOL_HANDLERS, HUAWEICLOUD_CLI_APPROVAL_SPECS } from "./huaweicloud-cli/tools.js";
|
|
18
|
+
import { SANDBOX_APPROVAL_SPECS } from "./sandbox/approval.js";
|
|
18
19
|
import { SECRETS_TOOL_HANDLERS } from "./secrets/tools.js";
|
|
20
|
+
import { AUTH_APPROVAL_SPECS } from "./auth/approval.js";
|
|
21
|
+
import { OBS_APPROVAL_SPECS } from "./obs/approval.js";
|
|
22
|
+
import { UPDATE_APPROVAL_SPECS } from "./update/approval.js";
|
|
23
|
+
import { SECRETS_APPROVAL_SPECS } from "./secrets/approval.js";
|
|
24
|
+
import { PACKS_CONFIGURE_APPROVAL_SPEC } from "../packs-configure.js";
|
|
25
|
+
import { APPROVAL_TOOLS } from "../approval-roster.js";
|
|
19
26
|
// PackId and the Pack interface live in src/lib/pack-types.ts alongside
|
|
20
27
|
// PackToolDefinition, so packs and the registry share one vocabulary module.
|
|
21
28
|
// PACK_OF is the single source of truth for tool → pack ownership. The
|
|
@@ -55,6 +62,7 @@ export const PACK_OF = {
|
|
|
55
62
|
huaweicloud_check_account_type: 'auth',
|
|
56
63
|
huaweicloud_sandbox_exec_with_session: 'sandbox',
|
|
57
64
|
huaweicloud_sandbox_exec_one_shot: 'sandbox',
|
|
65
|
+
huaweicloud_sandbox_exec_poll: 'sandbox',
|
|
58
66
|
huaweicloud_sandbox_close_session: 'sandbox',
|
|
59
67
|
huaweicloud_sandbox_upload_file: 'sandbox',
|
|
60
68
|
huaweicloud_sandbox_upload_project: 'sandbox',
|
|
@@ -67,6 +75,7 @@ export const PACK_OF = {
|
|
|
67
75
|
huaweicloud_sandbox_sign_agreement: 'sandbox',
|
|
68
76
|
huaweicloud_sandbox_connect: 'sandbox',
|
|
69
77
|
huaweicloud_sandbox_credentials: 'sandbox',
|
|
78
|
+
huaweicloud_sandbox_shutdown: 'sandbox',
|
|
70
79
|
huaweicloud_voucher_status: 'voucher',
|
|
71
80
|
huaweicloud_voucher_claim: 'voucher',
|
|
72
81
|
huaweicloud_competition_voucher_claim: 'voucher',
|
|
@@ -105,6 +114,15 @@ export const PACK_TOOL_HANDLERS = {
|
|
|
105
114
|
export function isPackToolName(name) {
|
|
106
115
|
return Object.hasOwn(PACK_TOOL_HANDLERS, name);
|
|
107
116
|
}
|
|
117
|
+
export const APPROVAL_SPECS = {
|
|
118
|
+
...HUAWEICLOUD_CLI_APPROVAL_SPECS,
|
|
119
|
+
...SANDBOX_APPROVAL_SPECS,
|
|
120
|
+
...AUTH_APPROVAL_SPECS,
|
|
121
|
+
...OBS_APPROVAL_SPECS,
|
|
122
|
+
...UPDATE_APPROVAL_SPECS,
|
|
123
|
+
...SECRETS_APPROVAL_SPECS,
|
|
124
|
+
huaweicloud_packs_configure: PACKS_CONFIGURE_APPROVAL_SPEC,
|
|
125
|
+
};
|
|
108
126
|
// Per-pack tool lists invert PACK_OF instead of hand-writing name lists, so a
|
|
109
127
|
// pack can never claim an unassigned or non-existent tool.
|
|
110
128
|
function toolsFor(id) {
|