huaweicloud-devkit 2.0.0-next.4 → 2.0.0-next.5
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/package.json +1 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/dist/explain-error.js +9 -1
- package/plugins/huaweicloud-core/dist/hcloud-plan.js +6 -1
- package/plugins/huaweicloud-core/dist/lib/hdkit/hdkitservice-api.js +18 -9
- package/plugins/huaweicloud-core/dist/mcp-server.js +435 -282
- package/plugins/huaweicloud-core/dist/mcp-server.js.map +4 -4
- package/plugins/huaweicloud-core/dist/packs/registry.js +1 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/expose-task.js +71 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-account.js +25 -1
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-tunnel.js +28 -3
- package/plugins/huaweicloud-core/dist/packs/sandbox/schemas.js +14 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/tools.js +11 -3
- package/plugins/huaweicloud-core/dist/risk-rule-engine.js +20 -4
- package/plugins/huaweicloud-core/dist/safety/classify-hcloud.js +6 -6
- package/plugins/huaweicloud-core/dist/safety/redact.js +21 -3
- package/plugins/huaweicloud-core/dist/safety/risk-merge.js +24 -4
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-cleanup.js +1 -1
- package/plugins/huaweicloud-core/dist/tool-definitions.js +4 -0
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +14 -1
- package/plugins/huaweicloud-core/openclaw.plugin.json +2 -2
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +1 -1
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +42 -39
- package/plugins/huaweicloud-core/src/explain-error.ts +9 -1
- package/plugins/huaweicloud-core/src/hcloud-plan.ts +6 -1
- package/plugins/huaweicloud-core/src/lib/hdkit/hdkitservice-api.ts +32 -1
- package/plugins/huaweicloud-core/src/packs/registry.ts +1 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/expose-task.ts +105 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-account.ts +28 -1
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-tunnel.ts +41 -15
- package/plugins/huaweicloud-core/src/packs/sandbox/schemas.ts +20 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/tools.ts +12 -2
- package/plugins/huaweicloud-core/src/risk-rule-engine.ts +20 -7
- package/plugins/huaweicloud-core/src/safety/classify-hcloud.ts +28 -16
- package/plugins/huaweicloud-core/src/safety/redact.ts +24 -6
- package/plugins/huaweicloud-core/src/safety/risk-merge.ts +26 -5
- package/plugins/huaweicloud-core/src/sandbox/devbridge-cleanup.ts +7 -5
- package/plugins/huaweicloud-core/src/tool-definitions.ts +4 -0
|
@@ -27993,9 +27993,9 @@ var init_protocol = __esm({
|
|
|
27993
27993
|
});
|
|
27994
27994
|
this.setRequestHandler(ListTasksRequestSchema, async (request, extra) => {
|
|
27995
27995
|
try {
|
|
27996
|
-
const { tasks, nextCursor } = await this._taskStore.listTasks(request.params?.cursor, extra.sessionId);
|
|
27996
|
+
const { tasks: tasks2, nextCursor } = await this._taskStore.listTasks(request.params?.cursor, extra.sessionId);
|
|
27997
27997
|
return {
|
|
27998
|
-
tasks,
|
|
27998
|
+
tasks: tasks2,
|
|
27999
27999
|
nextCursor,
|
|
28000
28000
|
_meta: {}
|
|
28001
28001
|
};
|
|
@@ -43477,228 +43477,6 @@ var init_as_record = __esm({
|
|
|
43477
43477
|
}
|
|
43478
43478
|
});
|
|
43479
43479
|
|
|
43480
|
-
// plugins/huaweicloud-core/dist.new/risk-rule-engine.js
|
|
43481
|
-
import { readFileSync } from "node:fs";
|
|
43482
|
-
import { dirname, join } from "node:path";
|
|
43483
|
-
import { fileURLToPath } from "node:url";
|
|
43484
|
-
function toSeverity(value) {
|
|
43485
|
-
return value === "deny" || value === "warn" || value === "info" ? value : "info";
|
|
43486
|
-
}
|
|
43487
|
-
function toCondition(value) {
|
|
43488
|
-
const raw = asRecord(value);
|
|
43489
|
-
return {
|
|
43490
|
-
field: typeof raw.field === "string" ? raw.field : void 0,
|
|
43491
|
-
regex: typeof raw.regex === "string" ? raw.regex : ""
|
|
43492
|
-
};
|
|
43493
|
-
}
|
|
43494
|
-
function toConditionList(value) {
|
|
43495
|
-
return Array.isArray(value) ? value.map((condition) => toCondition(condition)) : void 0;
|
|
43496
|
-
}
|
|
43497
|
-
function toMatch(value) {
|
|
43498
|
-
const raw = asRecord(value);
|
|
43499
|
-
return {
|
|
43500
|
-
all: toConditionList(raw.all),
|
|
43501
|
-
any: toConditionList(raw.any),
|
|
43502
|
-
none: toConditionList(raw.none)
|
|
43503
|
-
};
|
|
43504
|
-
}
|
|
43505
|
-
function toRule(value) {
|
|
43506
|
-
const raw = asRecord(value);
|
|
43507
|
-
return {
|
|
43508
|
-
id: typeof raw.id === "string" ? raw.id : "",
|
|
43509
|
-
title: typeof raw.title === "string" ? raw.title : "",
|
|
43510
|
-
category: typeof raw.category === "string" ? raw.category : "",
|
|
43511
|
-
severity: toSeverity(raw.severity),
|
|
43512
|
-
stages: Array.isArray(raw.stages) ? raw.stages.filter((stage) => typeof stage === "string") : [],
|
|
43513
|
-
match: toMatch(raw.match),
|
|
43514
|
-
message: typeof raw.message === "string" ? raw.message : "",
|
|
43515
|
-
remediation: typeof raw.remediation === "string" ? raw.remediation : ""
|
|
43516
|
-
};
|
|
43517
|
-
}
|
|
43518
|
-
function toCatalog(value) {
|
|
43519
|
-
const raw = asRecord(value);
|
|
43520
|
-
return {
|
|
43521
|
-
version: typeof raw.version === "string" ? raw.version : void 0,
|
|
43522
|
-
rules: Array.isArray(raw.rules) ? raw.rules.map((rule) => toRule(rule)) : []
|
|
43523
|
-
};
|
|
43524
|
-
}
|
|
43525
|
-
function loadRiskRules(options = {}) {
|
|
43526
|
-
const path = options.path || defaultRulesPath;
|
|
43527
|
-
return toCatalog(JSON.parse(readFileSync(path, "utf8")));
|
|
43528
|
-
}
|
|
43529
|
-
function redactEvidence(text) {
|
|
43530
|
-
return String(text).replace(/((?:access[_-]?key(?:[_-]?(?:id|secret))?|secret[_-]?key|secret[_-]?string|secret[_-]?binary|secret(?!:\/)|security[_-]?token|x[_-]?auth[_-]?token|token|authorization|password|passwd|admin[_-]?pass|credential)\\*["']?\s*[:=]\s*[\\"'\\]*\s*)("[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1<redacted>").replace(/\b(AK|SK)\\*["']?\s*[:=]\s*("[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1=<redacted>");
|
|
43531
|
-
}
|
|
43532
|
-
function normalizeText(value) {
|
|
43533
|
-
if (typeof value === "string")
|
|
43534
|
-
return value;
|
|
43535
|
-
return JSON.stringify(value, null, 2);
|
|
43536
|
-
}
|
|
43537
|
-
function evaluationContext(stage, input2) {
|
|
43538
|
-
const record2 = asRecord(input2);
|
|
43539
|
-
if (stage === "command") {
|
|
43540
|
-
const command = normalizeText(record2.command || record2.text || "");
|
|
43541
|
-
return { text: command, command };
|
|
43542
|
-
}
|
|
43543
|
-
if (stage === "artifact") {
|
|
43544
|
-
const path = asText(record2.path || "");
|
|
43545
|
-
const content = normalizeText(record2.content || "");
|
|
43546
|
-
return { text: `${path}
|
|
43547
|
-
${content}`, path, content };
|
|
43548
|
-
}
|
|
43549
|
-
if (stage === "deploy_plan") {
|
|
43550
|
-
const plan = normalizeText(record2.plan || record2.text || input2);
|
|
43551
|
-
return { text: plan, plan };
|
|
43552
|
-
}
|
|
43553
|
-
return { text: normalizeText(input2) };
|
|
43554
|
-
}
|
|
43555
|
-
function conditionMatches(condition, context) {
|
|
43556
|
-
const field = condition.field || "text";
|
|
43557
|
-
const value = Object.hasOwn(context, field) ? context[field] : context.text;
|
|
43558
|
-
return new RegExp(condition.regex, "ims").test(String(value || ""));
|
|
43559
|
-
}
|
|
43560
|
-
function ruleMatches(rule, context) {
|
|
43561
|
-
const match = rule.match || {};
|
|
43562
|
-
const all = match.all;
|
|
43563
|
-
const any2 = match.any;
|
|
43564
|
-
const none = match.none;
|
|
43565
|
-
if (Array.isArray(all) && !all.every((condition) => conditionMatches(condition, context))) {
|
|
43566
|
-
return false;
|
|
43567
|
-
}
|
|
43568
|
-
if (Array.isArray(any2) && !any2.some((condition) => conditionMatches(condition, context))) {
|
|
43569
|
-
return false;
|
|
43570
|
-
}
|
|
43571
|
-
if (Array.isArray(none) && none.some((condition) => conditionMatches(condition, context))) {
|
|
43572
|
-
return false;
|
|
43573
|
-
}
|
|
43574
|
-
return Array.isArray(all) || Array.isArray(any2);
|
|
43575
|
-
}
|
|
43576
|
-
function excerpt(text) {
|
|
43577
|
-
const compact = redactEvidence(String(text).replace(/\s+/g, " ").trim());
|
|
43578
|
-
if (compact.length <= 240)
|
|
43579
|
-
return compact;
|
|
43580
|
-
return `${compact.slice(0, 237)}...`;
|
|
43581
|
-
}
|
|
43582
|
-
function inputPath(input2) {
|
|
43583
|
-
if (input2 === null || typeof input2 !== "object")
|
|
43584
|
-
return void 0;
|
|
43585
|
-
const path = input2.path;
|
|
43586
|
-
return typeof path === "string" ? path : void 0;
|
|
43587
|
-
}
|
|
43588
|
-
function evaluate(stage, inputs, options = {}) {
|
|
43589
|
-
const catalog = options.catalog || loadRiskRules(options);
|
|
43590
|
-
const items = Array.isArray(inputs) ? inputs : [inputs];
|
|
43591
|
-
const findings = [];
|
|
43592
|
-
for (const input2 of items) {
|
|
43593
|
-
const context = evaluationContext(stage, input2 || {});
|
|
43594
|
-
for (const rule of catalog.rules) {
|
|
43595
|
-
if (!rule.stages.includes(stage))
|
|
43596
|
-
continue;
|
|
43597
|
-
if (!ruleMatches(rule, context))
|
|
43598
|
-
continue;
|
|
43599
|
-
findings.push({
|
|
43600
|
-
ruleId: rule.id,
|
|
43601
|
-
title: rule.title,
|
|
43602
|
-
category: rule.category,
|
|
43603
|
-
severity: rule.severity,
|
|
43604
|
-
message: rule.message,
|
|
43605
|
-
remediation: rule.remediation,
|
|
43606
|
-
source: inputPath(input2) || stage,
|
|
43607
|
-
evidence: excerpt(context.text)
|
|
43608
|
-
});
|
|
43609
|
-
}
|
|
43610
|
-
}
|
|
43611
|
-
findings.sort((a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity]);
|
|
43612
|
-
const hasDeny = findings.some((finding) => finding.severity === "deny");
|
|
43613
|
-
const hasWarn = findings.some((finding) => finding.severity === "warn");
|
|
43614
|
-
return {
|
|
43615
|
-
decision: hasDeny ? "deny" : hasWarn ? "warn" : "allow",
|
|
43616
|
-
findings
|
|
43617
|
-
};
|
|
43618
|
-
}
|
|
43619
|
-
function isNonEmptyString(value) {
|
|
43620
|
-
return typeof value === "string" && value.trim().length > 0;
|
|
43621
|
-
}
|
|
43622
|
-
function isNonEmptyContainer(value) {
|
|
43623
|
-
if (Array.isArray(value))
|
|
43624
|
-
return value.length > 0;
|
|
43625
|
-
if (value && typeof value === "object")
|
|
43626
|
-
return Object.keys(value).length > 0;
|
|
43627
|
-
return false;
|
|
43628
|
-
}
|
|
43629
|
-
function invalidRiskResult(stage, reason) {
|
|
43630
|
-
return {
|
|
43631
|
-
decision: "deny",
|
|
43632
|
-
risk: "invalid",
|
|
43633
|
-
findings: [
|
|
43634
|
-
{
|
|
43635
|
-
ruleId: "invalid-input",
|
|
43636
|
-
title: "Invalid input for risk check",
|
|
43637
|
-
category: "invalid",
|
|
43638
|
-
severity: "deny",
|
|
43639
|
-
message: reason,
|
|
43640
|
-
remediation: "Provide a valid, non-empty input before re-running the check.",
|
|
43641
|
-
source: stage,
|
|
43642
|
-
evidence: ""
|
|
43643
|
-
}
|
|
43644
|
-
]
|
|
43645
|
-
};
|
|
43646
|
-
}
|
|
43647
|
-
function evaluateCommandRisk(command, options = {}) {
|
|
43648
|
-
if (!isNonEmptyString(command)) {
|
|
43649
|
-
return invalidRiskResult("command", "command must be a non-empty string.");
|
|
43650
|
-
}
|
|
43651
|
-
return evaluate("command", { command }, options);
|
|
43652
|
-
}
|
|
43653
|
-
function evaluateArtifacts(artifacts, options = {}) {
|
|
43654
|
-
if (!Array.isArray(artifacts) || artifacts.length === 0) {
|
|
43655
|
-
return invalidRiskResult("artifact", "artifacts must be a non-empty array.");
|
|
43656
|
-
}
|
|
43657
|
-
return evaluate("artifact", artifacts, options);
|
|
43658
|
-
}
|
|
43659
|
-
function evaluateDeployPlan(plan, options = {}) {
|
|
43660
|
-
const valid = isNonEmptyString(plan) || plan != null && typeof plan === "object" && isNonEmptyContainer(plan);
|
|
43661
|
-
if (!valid) {
|
|
43662
|
-
return invalidRiskResult("deploy_plan", "plan must be a non-empty object, array, or string.");
|
|
43663
|
-
}
|
|
43664
|
-
return evaluate("deploy_plan", { plan }, options);
|
|
43665
|
-
}
|
|
43666
|
-
function mergeRiskDecision(base, risk) {
|
|
43667
|
-
if (!risk || !risk.findings?.length)
|
|
43668
|
-
return base;
|
|
43669
|
-
if (risk.decision === "deny") {
|
|
43670
|
-
const topFinding = risk.findings[0];
|
|
43671
|
-
const reason = topFinding.remediation ? `${topFinding.message} Remediation: ${topFinding.remediation}` : topFinding.message;
|
|
43672
|
-
return {
|
|
43673
|
-
...base,
|
|
43674
|
-
decision: "deny",
|
|
43675
|
-
risk: topFinding.category,
|
|
43676
|
-
reason,
|
|
43677
|
-
blockedByRiskRule: true,
|
|
43678
|
-
findings: risk.findings
|
|
43679
|
-
};
|
|
43680
|
-
}
|
|
43681
|
-
return {
|
|
43682
|
-
...base,
|
|
43683
|
-
warnings: [...base.warnings || [], ...risk.findings]
|
|
43684
|
-
};
|
|
43685
|
-
}
|
|
43686
|
-
var __dirname, defaultRulesPath, SEVERITY_RANK;
|
|
43687
|
-
var init_risk_rule_engine = __esm({
|
|
43688
|
-
"plugins/huaweicloud-core/dist.new/risk-rule-engine.js"() {
|
|
43689
|
-
"use strict";
|
|
43690
|
-
init_as_text();
|
|
43691
|
-
init_as_record();
|
|
43692
|
-
__dirname = dirname(fileURLToPath(import.meta.url));
|
|
43693
|
-
defaultRulesPath = join(__dirname, "..", "safety", "rules", "cloud-risk-rules.json");
|
|
43694
|
-
SEVERITY_RANK = {
|
|
43695
|
-
deny: 3,
|
|
43696
|
-
warn: 2,
|
|
43697
|
-
info: 1
|
|
43698
|
-
};
|
|
43699
|
-
}
|
|
43700
|
-
});
|
|
43701
|
-
|
|
43702
43480
|
// plugins/huaweicloud-core/dist.new/safety/heredoc.js
|
|
43703
43481
|
function scanHeredocStart(text, i, separators) {
|
|
43704
43482
|
const prev = i === 0 ? "" : text[i - 1];
|
|
@@ -44082,7 +43860,7 @@ var init_shell_text = __esm({
|
|
|
44082
43860
|
});
|
|
44083
43861
|
|
|
44084
43862
|
// plugins/huaweicloud-core/dist.new/safety/policy.js
|
|
44085
|
-
import { readFileSync
|
|
43863
|
+
import { readFileSync } from "node:fs";
|
|
44086
43864
|
function toStringArray(value, field) {
|
|
44087
43865
|
if (value === void 0)
|
|
44088
43866
|
return [];
|
|
@@ -44092,7 +43870,7 @@ function toStringArray(value, field) {
|
|
|
44092
43870
|
return value.filter((item) => typeof item === "string");
|
|
44093
43871
|
}
|
|
44094
43872
|
function loadPolicy(path) {
|
|
44095
|
-
const parsed = JSON.parse(
|
|
43873
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
44096
43874
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
44097
43875
|
throw new TypeError("safety policy must be a JSON object");
|
|
44098
43876
|
}
|
|
@@ -44138,17 +43916,17 @@ var init_policy = __esm({
|
|
|
44138
43916
|
|
|
44139
43917
|
// plugins/huaweicloud-core/dist.new/safety/default-policy.js
|
|
44140
43918
|
import { existsSync } from "node:fs";
|
|
44141
|
-
import { dirname
|
|
44142
|
-
import { fileURLToPath
|
|
43919
|
+
import { dirname, join } from "node:path";
|
|
43920
|
+
import { fileURLToPath } from "node:url";
|
|
44143
43921
|
function pluginRootDir(startDir) {
|
|
44144
|
-
for (const candidate of [
|
|
44145
|
-
if (existsSync(
|
|
43922
|
+
for (const candidate of [join(startDir, ".."), join(startDir, "..", "..")]) {
|
|
43923
|
+
if (existsSync(join(candidate, "safety", "policy.json")))
|
|
44146
43924
|
return candidate;
|
|
44147
43925
|
}
|
|
44148
|
-
return
|
|
43926
|
+
return join(startDir, "..", "..");
|
|
44149
43927
|
}
|
|
44150
43928
|
function defaultPolicyPath() {
|
|
44151
|
-
return
|
|
43929
|
+
return join(pluginRootDir(dirname(fileURLToPath(import.meta.url))), "safety", "policy.json");
|
|
44152
43930
|
}
|
|
44153
43931
|
function loadPolicy2(path = defaultPolicyPath()) {
|
|
44154
43932
|
return loadPolicy(path);
|
|
@@ -44162,40 +43940,19 @@ var init_default_policy = __esm({
|
|
|
44162
43940
|
}
|
|
44163
43941
|
});
|
|
44164
43942
|
|
|
44165
|
-
// plugins/huaweicloud-core/dist.new/safety/vocabulary.js
|
|
44166
|
-
function deriveSecretOperationAlternation(ops) {
|
|
44167
|
-
const entries = ops.filter((op) => op !== "");
|
|
44168
|
-
if (entries.length === 0)
|
|
44169
|
-
return "(?!)";
|
|
44170
|
-
return entries.map((op) => {
|
|
44171
|
-
const l = op.toLowerCase();
|
|
44172
|
-
const isStem = entries.some((other) => other !== op && other.toLowerCase().startsWith(l));
|
|
44173
|
-
const escaped = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
44174
|
-
return isStem ? `(?<![A-Za-z0-9._/-])${escaped}(?![A-Za-z0-9._/-])` : escaped;
|
|
44175
|
-
}).join("|");
|
|
44176
|
-
}
|
|
44177
|
-
var SECRET_OP_ALTERNATION, SECRET_ARGS_RE, SECRET_TEXT_RE, SECRET_SHADOW_RE;
|
|
44178
|
-
var init_vocabulary = __esm({
|
|
44179
|
-
"plugins/huaweicloud-core/dist.new/safety/vocabulary.js"() {
|
|
44180
|
-
"use strict";
|
|
44181
|
-
init_default_policy();
|
|
44182
|
-
SECRET_OP_ALTERNATION = deriveSecretOperationAlternation(DEFAULT_POLICY.blockedSecretOperations);
|
|
44183
|
-
SECRET_ARGS_RE = new RegExp(`secret[_-]?string|secret[_-]?binary|${SECRET_OP_ALTERNATION}`, "i");
|
|
44184
|
-
SECRET_TEXT_RE = new RegExp(`${SECRET_OP_ALTERNATION}|secret_string|secret_binary`, "i");
|
|
44185
|
-
SECRET_SHADOW_RE = new RegExp(SECRET_OP_ALTERNATION, "i");
|
|
44186
|
-
}
|
|
44187
|
-
});
|
|
44188
|
-
|
|
44189
43943
|
// plugins/huaweicloud-core/dist.new/safety/redact.js
|
|
44190
43944
|
function isSecretKeyName(key, policy = DEFAULT_POLICY) {
|
|
44191
43945
|
const normalized = String(key).toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
44192
|
-
if (/access.*key|secret.*key|security.*token|xauth.*token|authorization|password|passwd|adminpass|credential|private.*key|userdata|metadata|inputvalue/.test(normalized)) {
|
|
43946
|
+
if (/access.*key|secret.*key|secret.*string|secret.*binary|secret.*text|api.*key|security.*token|xauth.*token|authorization|password|passwd|adminpass|credential|private.*key|userdata|metadata|inputvalue/.test(normalized)) {
|
|
44193
43947
|
return true;
|
|
44194
43948
|
}
|
|
44195
43949
|
return policy.secretKeyNamePatterns.some((pattern) => regexFrom(`^(${pattern})$`).test(String(key)));
|
|
44196
43950
|
}
|
|
44197
43951
|
function redactString(text) {
|
|
44198
|
-
return String(text).replace(/(["']?(?:user[_-]?data|metadata|private[_-]?key|authorization|x[_-]?auth[_-]?token)["']?\s*[:=]\s*).*/gi, "$1<redacted>").replace(
|
|
43952
|
+
return String(text).replace(/(["']?(?:user[_-]?data|metadata|private[_-]?key|authorization|x[_-]?auth[_-]?token)["']?\s*[:=]\s*).*/gi, "$1<redacted>").replace(SECRET_KEY_VALUE_RE, "$1<redacted>").replace(/<(password|passwd|pwd)>[^<]*<\/\1>/gi, "<$1><redacted></$1>").replace(/\b(["']?(?:AK|SK)\\*["']?\s*[:=]\s*[\\"']*\s*)("[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1<redacted>");
|
|
43953
|
+
}
|
|
43954
|
+
function redactEvidenceText(text) {
|
|
43955
|
+
return redactString(text);
|
|
44199
43956
|
}
|
|
44200
43957
|
function redactSecrets(value, policy = DEFAULT_POLICY) {
|
|
44201
43958
|
if (Array.isArray(value)) {
|
|
@@ -44212,11 +43969,268 @@ function redactSecrets(value, policy = DEFAULT_POLICY) {
|
|
|
44212
43969
|
}
|
|
44213
43970
|
return value;
|
|
44214
43971
|
}
|
|
43972
|
+
var SECRET_KEY_VALUE_RE;
|
|
44215
43973
|
var init_redact = __esm({
|
|
44216
43974
|
"plugins/huaweicloud-core/dist.new/safety/redact.js"() {
|
|
44217
43975
|
"use strict";
|
|
44218
43976
|
init_default_policy();
|
|
44219
43977
|
init_policy();
|
|
43978
|
+
SECRET_KEY_VALUE_RE = /((?:access[_-]?key(?:[_-]?(?:id|secret))?|secret[_-]?key|secret[_-]?string|secret[_-]?binary|secret[_-]?text|api[_-]?key|secret(?!:\/)|security[_-]?token|x[_-]?auth[_-]?token|token|authorization|password|passwd|admin[_-]?pass|credential|input[_-]?value)\\*["']?\s*[:=]\s*[\\"']*\s*)("[^"]*"|'[^']*'|[^\s,;]+)/gi;
|
|
43979
|
+
}
|
|
43980
|
+
});
|
|
43981
|
+
|
|
43982
|
+
// plugins/huaweicloud-core/dist.new/risk-rule-engine.js
|
|
43983
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
43984
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
43985
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
43986
|
+
function toSeverity(value) {
|
|
43987
|
+
return value === "deny" || value === "warn" || value === "info" ? value : "info";
|
|
43988
|
+
}
|
|
43989
|
+
function toCondition(value) {
|
|
43990
|
+
const raw = asRecord(value);
|
|
43991
|
+
return {
|
|
43992
|
+
field: typeof raw.field === "string" ? raw.field : void 0,
|
|
43993
|
+
regex: typeof raw.regex === "string" ? raw.regex : ""
|
|
43994
|
+
};
|
|
43995
|
+
}
|
|
43996
|
+
function toConditionList(value) {
|
|
43997
|
+
return Array.isArray(value) ? value.map((condition) => toCondition(condition)) : void 0;
|
|
43998
|
+
}
|
|
43999
|
+
function toMatch(value) {
|
|
44000
|
+
const raw = asRecord(value);
|
|
44001
|
+
return {
|
|
44002
|
+
all: toConditionList(raw.all),
|
|
44003
|
+
any: toConditionList(raw.any),
|
|
44004
|
+
none: toConditionList(raw.none)
|
|
44005
|
+
};
|
|
44006
|
+
}
|
|
44007
|
+
function toRule(value) {
|
|
44008
|
+
const raw = asRecord(value);
|
|
44009
|
+
return {
|
|
44010
|
+
id: typeof raw.id === "string" ? raw.id : "",
|
|
44011
|
+
title: typeof raw.title === "string" ? raw.title : "",
|
|
44012
|
+
category: typeof raw.category === "string" ? raw.category : "",
|
|
44013
|
+
severity: toSeverity(raw.severity),
|
|
44014
|
+
stages: Array.isArray(raw.stages) ? raw.stages.filter((stage) => typeof stage === "string") : [],
|
|
44015
|
+
match: toMatch(raw.match),
|
|
44016
|
+
message: typeof raw.message === "string" ? raw.message : "",
|
|
44017
|
+
remediation: typeof raw.remediation === "string" ? raw.remediation : ""
|
|
44018
|
+
};
|
|
44019
|
+
}
|
|
44020
|
+
function toCatalog(value) {
|
|
44021
|
+
const raw = asRecord(value);
|
|
44022
|
+
return {
|
|
44023
|
+
version: typeof raw.version === "string" ? raw.version : void 0,
|
|
44024
|
+
rules: Array.isArray(raw.rules) ? raw.rules.map((rule) => toRule(rule)) : []
|
|
44025
|
+
};
|
|
44026
|
+
}
|
|
44027
|
+
function loadRiskRules(options = {}) {
|
|
44028
|
+
const path = options.path || defaultRulesPath;
|
|
44029
|
+
return toCatalog(JSON.parse(readFileSync2(path, "utf8")));
|
|
44030
|
+
}
|
|
44031
|
+
function redactEvidence(text) {
|
|
44032
|
+
return redactEvidenceText(text);
|
|
44033
|
+
}
|
|
44034
|
+
function normalizeText(value) {
|
|
44035
|
+
if (typeof value === "string")
|
|
44036
|
+
return value;
|
|
44037
|
+
return JSON.stringify(value, null, 2);
|
|
44038
|
+
}
|
|
44039
|
+
function evaluationContext(stage, input2) {
|
|
44040
|
+
const record2 = asRecord(input2);
|
|
44041
|
+
if (stage === "command") {
|
|
44042
|
+
const command = normalizeText(record2.command || record2.text || "");
|
|
44043
|
+
return { text: command, command };
|
|
44044
|
+
}
|
|
44045
|
+
if (stage === "artifact") {
|
|
44046
|
+
const path = asText(record2.path || "");
|
|
44047
|
+
const content = normalizeText(record2.content || "");
|
|
44048
|
+
return { text: `${path}
|
|
44049
|
+
${content}`, path, content };
|
|
44050
|
+
}
|
|
44051
|
+
if (stage === "deploy_plan") {
|
|
44052
|
+
const plan = normalizeText(record2.plan || record2.text || input2);
|
|
44053
|
+
return { text: plan, plan };
|
|
44054
|
+
}
|
|
44055
|
+
return { text: normalizeText(input2) };
|
|
44056
|
+
}
|
|
44057
|
+
function normalizeRuleText(text) {
|
|
44058
|
+
return text.replace(/\\+(["'])/g, "$1");
|
|
44059
|
+
}
|
|
44060
|
+
function conditionMatches(condition, context) {
|
|
44061
|
+
const field = condition.field || "text";
|
|
44062
|
+
const value = Object.hasOwn(context, field) ? context[field] : context.text;
|
|
44063
|
+
const raw = String(value || "");
|
|
44064
|
+
const regex = new RegExp(condition.regex, "ims");
|
|
44065
|
+
if (regex.test(raw))
|
|
44066
|
+
return true;
|
|
44067
|
+
const normalized = normalizeRuleText(raw);
|
|
44068
|
+
return normalized !== raw && regex.test(normalized);
|
|
44069
|
+
}
|
|
44070
|
+
function ruleMatches(rule, context) {
|
|
44071
|
+
const match = rule.match || {};
|
|
44072
|
+
const all = match.all;
|
|
44073
|
+
const any2 = match.any;
|
|
44074
|
+
const none = match.none;
|
|
44075
|
+
if (Array.isArray(all) && !all.every((condition) => conditionMatches(condition, context))) {
|
|
44076
|
+
return false;
|
|
44077
|
+
}
|
|
44078
|
+
if (Array.isArray(any2) && !any2.some((condition) => conditionMatches(condition, context))) {
|
|
44079
|
+
return false;
|
|
44080
|
+
}
|
|
44081
|
+
if (Array.isArray(none) && none.some((condition) => conditionMatches(condition, context))) {
|
|
44082
|
+
return false;
|
|
44083
|
+
}
|
|
44084
|
+
return Array.isArray(all) || Array.isArray(any2);
|
|
44085
|
+
}
|
|
44086
|
+
function excerpt(text) {
|
|
44087
|
+
const compact = redactEvidence(String(text).replace(/\s+/g, " ").trim());
|
|
44088
|
+
if (compact.length <= 240)
|
|
44089
|
+
return compact;
|
|
44090
|
+
return `${compact.slice(0, 237)}...`;
|
|
44091
|
+
}
|
|
44092
|
+
function inputPath(input2) {
|
|
44093
|
+
if (input2 === null || typeof input2 !== "object")
|
|
44094
|
+
return void 0;
|
|
44095
|
+
const path = input2.path;
|
|
44096
|
+
return typeof path === "string" ? path : void 0;
|
|
44097
|
+
}
|
|
44098
|
+
function evaluate(stage, inputs, options = {}) {
|
|
44099
|
+
const catalog = options.catalog || loadRiskRules(options);
|
|
44100
|
+
const items = Array.isArray(inputs) ? inputs : [inputs];
|
|
44101
|
+
const findings = [];
|
|
44102
|
+
for (const input2 of items) {
|
|
44103
|
+
const context = evaluationContext(stage, input2 || {});
|
|
44104
|
+
for (const rule of catalog.rules) {
|
|
44105
|
+
if (!rule.stages.includes(stage))
|
|
44106
|
+
continue;
|
|
44107
|
+
if (!ruleMatches(rule, context))
|
|
44108
|
+
continue;
|
|
44109
|
+
findings.push({
|
|
44110
|
+
ruleId: rule.id,
|
|
44111
|
+
title: rule.title,
|
|
44112
|
+
category: rule.category,
|
|
44113
|
+
severity: rule.severity,
|
|
44114
|
+
message: rule.message,
|
|
44115
|
+
remediation: rule.remediation,
|
|
44116
|
+
source: inputPath(input2) || stage,
|
|
44117
|
+
evidence: excerpt(context.text)
|
|
44118
|
+
});
|
|
44119
|
+
}
|
|
44120
|
+
}
|
|
44121
|
+
findings.sort((a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity]);
|
|
44122
|
+
const hasDeny = findings.some((finding) => finding.severity === "deny");
|
|
44123
|
+
const hasWarn = findings.some((finding) => finding.severity === "warn");
|
|
44124
|
+
return {
|
|
44125
|
+
decision: hasDeny ? "deny" : hasWarn ? "warn" : "allow",
|
|
44126
|
+
findings
|
|
44127
|
+
};
|
|
44128
|
+
}
|
|
44129
|
+
function isNonEmptyString(value) {
|
|
44130
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
44131
|
+
}
|
|
44132
|
+
function isNonEmptyContainer(value) {
|
|
44133
|
+
if (Array.isArray(value))
|
|
44134
|
+
return value.length > 0;
|
|
44135
|
+
if (value && typeof value === "object")
|
|
44136
|
+
return Object.keys(value).length > 0;
|
|
44137
|
+
return false;
|
|
44138
|
+
}
|
|
44139
|
+
function invalidRiskResult(stage, reason) {
|
|
44140
|
+
return {
|
|
44141
|
+
decision: "deny",
|
|
44142
|
+
risk: "invalid",
|
|
44143
|
+
findings: [
|
|
44144
|
+
{
|
|
44145
|
+
ruleId: "invalid-input",
|
|
44146
|
+
title: "Invalid input for risk check",
|
|
44147
|
+
category: "invalid",
|
|
44148
|
+
severity: "deny",
|
|
44149
|
+
message: reason,
|
|
44150
|
+
remediation: "Provide a valid, non-empty input before re-running the check.",
|
|
44151
|
+
source: stage,
|
|
44152
|
+
evidence: ""
|
|
44153
|
+
}
|
|
44154
|
+
]
|
|
44155
|
+
};
|
|
44156
|
+
}
|
|
44157
|
+
function evaluateCommandRisk(command, options = {}) {
|
|
44158
|
+
if (!isNonEmptyString(command)) {
|
|
44159
|
+
return invalidRiskResult("command", "command must be a non-empty string.");
|
|
44160
|
+
}
|
|
44161
|
+
return evaluate("command", { command }, options);
|
|
44162
|
+
}
|
|
44163
|
+
function evaluateArtifacts(artifacts, options = {}) {
|
|
44164
|
+
if (!Array.isArray(artifacts) || artifacts.length === 0) {
|
|
44165
|
+
return invalidRiskResult("artifact", "artifacts must be a non-empty array.");
|
|
44166
|
+
}
|
|
44167
|
+
return evaluate("artifact", artifacts, options);
|
|
44168
|
+
}
|
|
44169
|
+
function evaluateDeployPlan(plan, options = {}) {
|
|
44170
|
+
const valid = isNonEmptyString(plan) || plan != null && typeof plan === "object" && isNonEmptyContainer(plan);
|
|
44171
|
+
if (!valid) {
|
|
44172
|
+
return invalidRiskResult("deploy_plan", "plan must be a non-empty object, array, or string.");
|
|
44173
|
+
}
|
|
44174
|
+
return evaluate("deploy_plan", { plan }, options);
|
|
44175
|
+
}
|
|
44176
|
+
function mergeRiskDecision(base, risk) {
|
|
44177
|
+
if (!risk || !risk.findings?.length)
|
|
44178
|
+
return base;
|
|
44179
|
+
if (risk.decision === "deny") {
|
|
44180
|
+
const topFinding = risk.findings[0];
|
|
44181
|
+
const reason = topFinding.remediation ? `${topFinding.message} Remediation: ${topFinding.remediation}` : topFinding.message;
|
|
44182
|
+
return {
|
|
44183
|
+
...base,
|
|
44184
|
+
decision: "deny",
|
|
44185
|
+
risk: topFinding.category,
|
|
44186
|
+
reason,
|
|
44187
|
+
blockedByRiskRule: true,
|
|
44188
|
+
findings: risk.findings
|
|
44189
|
+
};
|
|
44190
|
+
}
|
|
44191
|
+
return {
|
|
44192
|
+
...base,
|
|
44193
|
+
warnings: [...base.warnings || [], ...risk.findings]
|
|
44194
|
+
};
|
|
44195
|
+
}
|
|
44196
|
+
var __dirname, defaultRulesPath, SEVERITY_RANK;
|
|
44197
|
+
var init_risk_rule_engine = __esm({
|
|
44198
|
+
"plugins/huaweicloud-core/dist.new/risk-rule-engine.js"() {
|
|
44199
|
+
"use strict";
|
|
44200
|
+
init_as_text();
|
|
44201
|
+
init_as_record();
|
|
44202
|
+
init_redact();
|
|
44203
|
+
__dirname = dirname2(fileURLToPath2(import.meta.url));
|
|
44204
|
+
defaultRulesPath = join2(__dirname, "..", "safety", "rules", "cloud-risk-rules.json");
|
|
44205
|
+
SEVERITY_RANK = {
|
|
44206
|
+
deny: 3,
|
|
44207
|
+
warn: 2,
|
|
44208
|
+
info: 1
|
|
44209
|
+
};
|
|
44210
|
+
}
|
|
44211
|
+
});
|
|
44212
|
+
|
|
44213
|
+
// plugins/huaweicloud-core/dist.new/safety/vocabulary.js
|
|
44214
|
+
function deriveSecretOperationAlternation(ops) {
|
|
44215
|
+
const entries = ops.filter((op) => op !== "");
|
|
44216
|
+
if (entries.length === 0)
|
|
44217
|
+
return "(?!)";
|
|
44218
|
+
return entries.map((op) => {
|
|
44219
|
+
const l = op.toLowerCase();
|
|
44220
|
+
const isStem = entries.some((other) => other !== op && other.toLowerCase().startsWith(l));
|
|
44221
|
+
const escaped = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
44222
|
+
return isStem ? `(?<![A-Za-z0-9._/-])${escaped}(?![A-Za-z0-9._/-])` : escaped;
|
|
44223
|
+
}).join("|");
|
|
44224
|
+
}
|
|
44225
|
+
var SECRET_OP_ALTERNATION, SECRET_ARGS_RE, SECRET_TEXT_RE, SECRET_SHADOW_RE;
|
|
44226
|
+
var init_vocabulary = __esm({
|
|
44227
|
+
"plugins/huaweicloud-core/dist.new/safety/vocabulary.js"() {
|
|
44228
|
+
"use strict";
|
|
44229
|
+
init_default_policy();
|
|
44230
|
+
SECRET_OP_ALTERNATION = deriveSecretOperationAlternation(DEFAULT_POLICY.blockedSecretOperations);
|
|
44231
|
+
SECRET_ARGS_RE = new RegExp(`secret[_-]?string|secret[_-]?binary|${SECRET_OP_ALTERNATION}`, "i");
|
|
44232
|
+
SECRET_TEXT_RE = new RegExp(`${SECRET_OP_ALTERNATION}|secret_string|secret_binary`, "i");
|
|
44233
|
+
SECRET_SHADOW_RE = new RegExp(SECRET_OP_ALTERNATION, "i");
|
|
44220
44234
|
}
|
|
44221
44235
|
});
|
|
44222
44236
|
|
|
@@ -44928,19 +44942,32 @@ var init_command_operation = __esm({
|
|
|
44928
44942
|
function commandRiskText(normalizedArgs, options) {
|
|
44929
44943
|
return options.rawCommand || ["hcloud", ...normalizedArgs].join(" ");
|
|
44930
44944
|
}
|
|
44945
|
+
function attachRiskFindings(base, risk) {
|
|
44946
|
+
if (!risk.findings || risk.findings.length === 0)
|
|
44947
|
+
return base;
|
|
44948
|
+
const warnFindings = risk.findings.filter((finding) => finding.severity !== "deny");
|
|
44949
|
+
return {
|
|
44950
|
+
...base,
|
|
44951
|
+
findings: [...base.findings || [], ...risk.findings],
|
|
44952
|
+
...warnFindings.length > 0 ? { warnings: [...base.warnings || [], ...warnFindings] } : {}
|
|
44953
|
+
};
|
|
44954
|
+
}
|
|
44955
|
+
function mergeRisk(base, risk) {
|
|
44956
|
+
return base.decision === "deny" ? attachRiskFindings(base, risk) : mergeRiskDecision(base, risk);
|
|
44957
|
+
}
|
|
44931
44958
|
function applyCommandRiskRules(base, normalizedArgs, options) {
|
|
44932
|
-
if (
|
|
44959
|
+
if (options.skipRiskRules === true) {
|
|
44933
44960
|
return base;
|
|
44934
44961
|
}
|
|
44935
44962
|
const risk = evaluateCommandRisk(commandRiskText(normalizedArgs, options));
|
|
44936
|
-
return
|
|
44963
|
+
return mergeRisk(base, risk);
|
|
44937
44964
|
}
|
|
44938
44965
|
function applyRawCommandRiskRules(base, command, options) {
|
|
44939
|
-
if (
|
|
44966
|
+
if (options.skipRiskRules === true) {
|
|
44940
44967
|
return base;
|
|
44941
44968
|
}
|
|
44942
44969
|
const risk = evaluateCommandRisk(command);
|
|
44943
|
-
return
|
|
44970
|
+
return mergeRisk(base, risk);
|
|
44944
44971
|
}
|
|
44945
44972
|
var init_risk_merge = __esm({
|
|
44946
44973
|
"plugins/huaweicloud-core/dist.new/safety/risk-merge.js"() {
|
|
@@ -45232,18 +45259,18 @@ function classifyHcloudArgs(args, options = {}) {
|
|
|
45232
45259
|
const isExecution = executionOps.test(operation) && !readOnly;
|
|
45233
45260
|
const isWrite = !readOnly && hasWritePrefix(operation, policy);
|
|
45234
45261
|
if (isExecution && !options.allowWrites) {
|
|
45235
|
-
return {
|
|
45262
|
+
return applyCommandRiskRules({
|
|
45236
45263
|
decision: "deny",
|
|
45237
45264
|
risk: "execution",
|
|
45238
45265
|
reason: "Huawei Cloud execution/trigger operation blocked until approved."
|
|
45239
|
-
};
|
|
45266
|
+
}, normalizedArgs, options);
|
|
45240
45267
|
}
|
|
45241
45268
|
if (isWrite && !options.allowWrites) {
|
|
45242
|
-
return {
|
|
45269
|
+
return applyCommandRiskRules({
|
|
45243
45270
|
decision: "deny",
|
|
45244
45271
|
risk: "write",
|
|
45245
45272
|
reason: "Huawei Cloud write operation blocked until the agent presents a plan and receives explicit user approval."
|
|
45246
|
-
};
|
|
45273
|
+
}, normalizedArgs, options);
|
|
45247
45274
|
}
|
|
45248
45275
|
const obsutilWrites = OBSUTIL_WRITES;
|
|
45249
45276
|
const obsutilReads = ["ls", "stat", "cat", "help", "version"];
|
|
@@ -45251,11 +45278,11 @@ function classifyHcloudArgs(args, options = {}) {
|
|
|
45251
45278
|
const isObsWrite = isObs && obsutilWrites.has(operation.toLowerCase());
|
|
45252
45279
|
const isObsRead = isObs && obsutilReads.includes(operation.toLowerCase());
|
|
45253
45280
|
if (isObsWrite && !options.allowWrites) {
|
|
45254
|
-
return {
|
|
45281
|
+
return applyCommandRiskRules({
|
|
45255
45282
|
decision: "deny",
|
|
45256
45283
|
risk: "write",
|
|
45257
45284
|
reason: "OBS write operation blocked until the agent presents a plan and receives explicit user approval."
|
|
45258
|
-
};
|
|
45285
|
+
}, normalizedArgs, options);
|
|
45259
45286
|
}
|
|
45260
45287
|
if (isObsRead) {
|
|
45261
45288
|
return applyCommandRiskRules({
|
|
@@ -49287,8 +49314,10 @@ function explainError({ service = "unknown", errorCode = "", code = "", message
|
|
|
49287
49314
|
const uniqueSuggestions = suggestions.filter((s, i, arr) => {
|
|
49288
49315
|
return !arr.slice(0, i).some((prev) => prev.substring(0, 50).toLowerCase() === s.substring(0, 50).toLowerCase());
|
|
49289
49316
|
});
|
|
49317
|
+
const providedKnown = Boolean(service) && svc !== "unknown";
|
|
49318
|
+
const responseService = !providedKnown || !hwErrorPatterns[patternKey] ? effectiveKey : service;
|
|
49290
49319
|
return {
|
|
49291
|
-
service,
|
|
49320
|
+
service: responseService,
|
|
49292
49321
|
errorCode: resolvedCode,
|
|
49293
49322
|
requestId,
|
|
49294
49323
|
suggestions: uniqueSuggestions
|
|
@@ -52063,14 +52092,72 @@ var init_hwexec_task = __esm({
|
|
|
52063
52092
|
}
|
|
52064
52093
|
});
|
|
52065
52094
|
|
|
52095
|
+
// plugins/huaweicloud-core/dist.new/packs/sandbox/expose-task.js
|
|
52096
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
52097
|
+
function sweep(now) {
|
|
52098
|
+
for (const [taskId, task] of tasks) {
|
|
52099
|
+
if (now - task.startedAt > EXPOSE_TASK_TTL_MS)
|
|
52100
|
+
tasks.delete(taskId);
|
|
52101
|
+
}
|
|
52102
|
+
}
|
|
52103
|
+
function startExposeTask(workspaceId2, port, run) {
|
|
52104
|
+
const now = Date.now();
|
|
52105
|
+
sweep(now);
|
|
52106
|
+
const taskId = `exp-${randomUUID2()}`;
|
|
52107
|
+
const snapshot = { startedAt: now, workspaceId: workspaceId2, port };
|
|
52108
|
+
tasks.set(taskId, { ...snapshot, state: "running" });
|
|
52109
|
+
void run().then((result) => {
|
|
52110
|
+
tasks.set(taskId, { ...snapshot, state: "done", result });
|
|
52111
|
+
}, (error62) => {
|
|
52112
|
+
tasks.set(taskId, {
|
|
52113
|
+
...snapshot,
|
|
52114
|
+
state: "failed",
|
|
52115
|
+
error: error62 instanceof Error ? error62.message : String(error62)
|
|
52116
|
+
});
|
|
52117
|
+
});
|
|
52118
|
+
return { taskId, startedAt: now };
|
|
52119
|
+
}
|
|
52120
|
+
function pollExposeTask(taskId) {
|
|
52121
|
+
const now = Date.now();
|
|
52122
|
+
sweep(now);
|
|
52123
|
+
const task = tasks.get(taskId);
|
|
52124
|
+
if (!task) {
|
|
52125
|
+
return {
|
|
52126
|
+
state: "unknown",
|
|
52127
|
+
hint: "No task with this id is known to this MCP server process (it never started here, the session restarted, or the 30-minute receipt expired). The tunnel may already exist: run huaweicloud_sandbox_deploy_check to read it, or re-run huaweicloud_sandbox_expose_tunnel (same port) \u2014 do not assume success without a URL."
|
|
52128
|
+
};
|
|
52129
|
+
}
|
|
52130
|
+
if (task.state === "running") {
|
|
52131
|
+
return {
|
|
52132
|
+
state: "running",
|
|
52133
|
+
elapsedMs: now - task.startedAt,
|
|
52134
|
+
hint: "The expose chain is running in the background (auth, cleanup, host start, health check, keepalive). Call again."
|
|
52135
|
+
};
|
|
52136
|
+
}
|
|
52137
|
+
if (task.state === "done") {
|
|
52138
|
+
return { state: "done", result: task.result };
|
|
52139
|
+
}
|
|
52140
|
+
return { state: "failed", error: task.error };
|
|
52141
|
+
}
|
|
52142
|
+
var EXPOSE_TASK_ID_PATTERN, EXPOSE_TASK_TTL_MS, tasks;
|
|
52143
|
+
var init_expose_task = __esm({
|
|
52144
|
+
"plugins/huaweicloud-core/dist.new/packs/sandbox/expose-task.js"() {
|
|
52145
|
+
"use strict";
|
|
52146
|
+
EXPOSE_TASK_ID_PATTERN = /^exp-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
52147
|
+
EXPOSE_TASK_TTL_MS = 30 * 6e4;
|
|
52148
|
+
tasks = /* @__PURE__ */ new Map();
|
|
52149
|
+
}
|
|
52150
|
+
});
|
|
52151
|
+
|
|
52066
52152
|
// plugins/huaweicloud-core/dist.new/packs/sandbox/schemas.js
|
|
52067
|
-
var SANDBOX_TIMEOUT_MS, execWithSessionSchema, execOneShotSchema, execPollSchema, closeSessionSchema, uploadFileSchema, uploadProjectSchema, deployNginxSchema, deployCheckSchema, checkUserSchema, exposeTunnelSchema, renewTunnelSchema, keepaliveWatchdogSchema, signAgreementSchema, connectSchema, credentialsSchema, shutdownSchema;
|
|
52153
|
+
var SANDBOX_TIMEOUT_MS, execWithSessionSchema, execOneShotSchema, execPollSchema, closeSessionSchema, uploadFileSchema, uploadProjectSchema, deployNginxSchema, deployCheckSchema, checkUserSchema, exposeTunnelSchema, exposePollSchema, renewTunnelSchema, keepaliveWatchdogSchema, signAgreementSchema, connectSchema, credentialsSchema, shutdownSchema;
|
|
52068
52154
|
var init_schemas4 = __esm({
|
|
52069
52155
|
"plugins/huaweicloud-core/dist.new/packs/sandbox/schemas.js"() {
|
|
52070
52156
|
"use strict";
|
|
52071
52157
|
init_zod();
|
|
52072
52158
|
init_hwexec_task();
|
|
52073
52159
|
init_tool_schema_parts();
|
|
52160
|
+
init_expose_task();
|
|
52074
52161
|
SANDBOX_TIMEOUT_MS = {
|
|
52075
52162
|
exec_with_session: 12e4,
|
|
52076
52163
|
exec_one_shot: 12e4,
|
|
@@ -52174,12 +52261,16 @@ var init_schemas4 = __esm({
|
|
|
52174
52261
|
expiry_hours: numericArg.optional().describe("Tunnel lifetime in hours, 1-720 (default 72). 720 = the devbridge 30-day maximum; the keepalive watchdog renews to 720h daily."),
|
|
52175
52262
|
keepalive: external_exports.boolean().optional().describe("Enroll the tunnel into the keepalive watchdog (default true \u2014 pass false to opt out). Returns keepalive.enrolled/tunnelCount/watchdogPid."),
|
|
52176
52263
|
cleanup_mode: external_exports.enum(["stale", "all", "none"]).optional().describe("Tunnel cleanup before exposing. stale (default): delete same-port tunnels + orphan records/hosts; preserve other ports, other sessions and keepalive-protected tunnels \u2014 except a tunnel bound to THIS port, which is always replaced. all: wipe every tunnel/host (manual full reset only \u2014 a shared sandbox loses every session's tunnels). none: no cleanup (a stale same-port host can then conflict)."),
|
|
52264
|
+
mode: external_exports.enum(["sync", "async"]).optional().describe("sync (default): run the whole expose chain and return its result. async: start the chain in the background and return {started:true, taskId, hint} immediately \u2014 use it on MCP hosts whose per-request timeout is shorter than the expose chain (auth + selective cleanup + up to four ~63s expose attempts + re-verify + keepalive enrollment), then poll huaweicloud_sandbox_expose_poll with taskId. The task receipt lives in this MCP server process (30 min)."),
|
|
52177
52265
|
workspace_id: workspaceId,
|
|
52178
52266
|
username,
|
|
52179
52267
|
timeout_ms: numericArg.optional().describe(`Execution timeout in milliseconds (default: ${SANDBOX_TIMEOUT_MS.expose_tunnel})`),
|
|
52180
52268
|
approvalToken: approvalTokenArg,
|
|
52181
52269
|
approvedByUser: approvedByUserArg
|
|
52182
52270
|
});
|
|
52271
|
+
exposePollSchema = external_exports.looseObject({
|
|
52272
|
+
task_id: external_exports.string().regex(EXPOSE_TASK_ID_PATTERN, 'task_id must be the exp-<uuid> from huaweicloud_sandbox_expose_tunnel mode:"async".').describe('The taskId returned by huaweicloud_sandbox_expose_tunnel with mode:"async".')
|
|
52273
|
+
});
|
|
52183
52274
|
renewTunnelSchema = external_exports.looseObject({
|
|
52184
52275
|
tunnel_id: external_exports.string().describe("DevBridge tunnel ID to renew (from expose_tunnel's tunnelId field, or extract from the URL https://<tunnel_id>-<port>.devbridge-s2.hwtunnel.com)."),
|
|
52185
52276
|
expiry_hours: numericArg.optional().describe("New lifetime in hours, 1-720 (default 720 = the 30-day maximum). Renewal is a rolling window \u2014 the same URL stays alive."),
|
|
@@ -56445,8 +56536,10 @@ async function hdkitConnect(options = {}) {
|
|
|
56445
56536
|
}
|
|
56446
56537
|
return asRecord(await hdkitRequest("POST", "connect", body));
|
|
56447
56538
|
}
|
|
56448
|
-
async function hdkitConnectWithRetry(options = {}) {
|
|
56539
|
+
async function hdkitConnectWithRetry(options = {}, retryOptions = {}) {
|
|
56449
56540
|
const delays = connectRetryDelaysMs();
|
|
56541
|
+
const inlineRetry = retryOptions.inlineRetry !== false;
|
|
56542
|
+
const maxInlineDelayMs = retryOptions.maxInlineDelayMs ?? Number.POSITIVE_INFINITY;
|
|
56450
56543
|
let retries = 0;
|
|
56451
56544
|
for (; ; ) {
|
|
56452
56545
|
try {
|
|
@@ -56465,6 +56558,16 @@ async function hdkitConnectWithRetry(options = {}) {
|
|
|
56465
56558
|
throw decorateExhaustedConnect(error62, retries);
|
|
56466
56559
|
throw error62;
|
|
56467
56560
|
}
|
|
56561
|
+
if (!inlineRetry || (delays[retries] ?? Number.POSITIVE_INFINITY) > maxInlineDelayMs) {
|
|
56562
|
+
const pendingCode = asString(safeReadField(error62, "code"));
|
|
56563
|
+
return {
|
|
56564
|
+
pending: true,
|
|
56565
|
+
connectRetries: retries,
|
|
56566
|
+
retryAfterMs: delays[retries] ?? delays[0] ?? 0,
|
|
56567
|
+
...pendingCode ? { code: pendingCode } : {},
|
|
56568
|
+
message: safeMessageText(error62)
|
|
56569
|
+
};
|
|
56570
|
+
}
|
|
56468
56571
|
await new Promise((resolve11) => setTimeout(resolve11, delays[retries]));
|
|
56469
56572
|
retries += 1;
|
|
56470
56573
|
}
|
|
@@ -56719,8 +56822,8 @@ async function handleExposeTunnel(args = {}, _opts = {}) {
|
|
|
56719
56822
|
const sandboxUser9 = args.username || "root";
|
|
56720
56823
|
const sandboxTimeout9 = args.timeout_ms || SANDBOX_TIMEOUT_MS.expose_tunnel;
|
|
56721
56824
|
const exposePoolContext = poolContextFor(sandboxWsId9);
|
|
56722
|
-
|
|
56723
|
-
port: args.port,
|
|
56825
|
+
const exposeArgs = {
|
|
56826
|
+
port: validateTunnelPort(args.port),
|
|
56724
56827
|
expiryHours: typeof args.expiry_hours === "number" ? args.expiry_hours : void 0,
|
|
56725
56828
|
keepalive: typeof args.keepalive === "boolean" ? args.keepalive : void 0,
|
|
56726
56829
|
cleanupMode: args.cleanup_mode,
|
|
@@ -56728,7 +56831,24 @@ async function handleExposeTunnel(args = {}, _opts = {}) {
|
|
|
56728
56831
|
poolType: exposePoolContext?.poolMode || "ephemeral",
|
|
56729
56832
|
poolContext: exposePoolContext,
|
|
56730
56833
|
keyUpgrade: { ensureDevbridgeKey, recreateDevbridgeKey, buildKeyringInjectScript, listKeysForQuotaHint }
|
|
56731
|
-
}
|
|
56834
|
+
};
|
|
56835
|
+
if (args.mode === "async") {
|
|
56836
|
+
const { taskId } = startExposeTask(sandboxWsId9, exposeArgs.port, () => exposeTunnel(sandboxWsId9, exposeArgs, sandboxUser9, sandboxTimeout9));
|
|
56837
|
+
return {
|
|
56838
|
+
started: true,
|
|
56839
|
+
mode: "async",
|
|
56840
|
+
taskId,
|
|
56841
|
+
hint: "The expose chain is running in the background. Poll huaweicloud_sandbox_expose_poll with this taskId until state is done \u2014 the publicUrl and urlLifetimeHint are delivered there (the task receipt lives 30 minutes in this MCP server process)."
|
|
56842
|
+
};
|
|
56843
|
+
}
|
|
56844
|
+
return await exposeTunnel(sandboxWsId9, exposeArgs, sandboxUser9, sandboxTimeout9);
|
|
56845
|
+
}
|
|
56846
|
+
async function handleExposePoll(args = {}, _opts = {}) {
|
|
56847
|
+
const taskId = args.task_id;
|
|
56848
|
+
if (typeof taskId !== "string" || taskId === "") {
|
|
56849
|
+
throw new Error('task_id is required \u2014 pass the taskId returned by huaweicloud_sandbox_expose_tunnel mode:"async".');
|
|
56850
|
+
}
|
|
56851
|
+
return pollExposeTask(taskId);
|
|
56732
56852
|
}
|
|
56733
56853
|
async function handleRenewTunnel(args = {}, _opts = {}) {
|
|
56734
56854
|
if (!args.tunnel_id) {
|
|
@@ -56760,7 +56880,9 @@ var init_handlers_tunnel = __esm({
|
|
|
56760
56880
|
"use strict";
|
|
56761
56881
|
init_devbridge_tunnel();
|
|
56762
56882
|
init_session_manager();
|
|
56883
|
+
init_devbridge_validation();
|
|
56763
56884
|
init_sandbox_pool();
|
|
56885
|
+
init_expose_task();
|
|
56764
56886
|
init_devbridge_key();
|
|
56765
56887
|
init_schemas4();
|
|
56766
56888
|
}
|
|
@@ -56873,7 +56995,7 @@ async function handleConnect(args = {}, _opts = {}) {
|
|
|
56873
56995
|
}
|
|
56874
56996
|
let connectResult;
|
|
56875
56997
|
try {
|
|
56876
|
-
connectResult = await hdkitConnectWithRetry(connectArgs);
|
|
56998
|
+
connectResult = await hdkitConnectWithRetry(connectArgs, { maxInlineDelayMs: 1e3 });
|
|
56877
56999
|
} catch (error62) {
|
|
56878
57000
|
const err = error62;
|
|
56879
57001
|
const gate = versionGateResult(err);
|
|
@@ -56913,6 +57035,19 @@ async function handleConnect(args = {}, _opts = {}) {
|
|
|
56913
57035
|
}
|
|
56914
57036
|
throw error62;
|
|
56915
57037
|
}
|
|
57038
|
+
if (connectResult?.pending === true) {
|
|
57039
|
+
const retryAfterMs = typeof connectResult.retryAfterMs === "number" && Number.isFinite(connectResult.retryAfterMs) ? connectResult.retryAfterMs : 3e4;
|
|
57040
|
+
const retryAfter = `${Math.max(1, Math.ceil(retryAfterMs / 1e3))}s`;
|
|
57041
|
+
return {
|
|
57042
|
+
ok: false,
|
|
57043
|
+
pending: true,
|
|
57044
|
+
retryAfter,
|
|
57045
|
+
retryAfterMs,
|
|
57046
|
+
...typeof connectResult.code === "string" ? { code: connectResult.code } : {},
|
|
57047
|
+
message: typeof connectResult.message === "string" && connectResult.message ? connectResult.message : "the hdkitservice gateway timed out during orchestration.",
|
|
57048
|
+
hint: `The sandbox instance may already exist on the server. Re-call huaweicloud_sandbox_connect with the SAME parameters after ~${retryAfter} \u2014 a created instance is reused. Do not start a second sandbox and do not debug this as a credential failure.`
|
|
57049
|
+
};
|
|
57050
|
+
}
|
|
56916
57051
|
const rawDevStageId = connectResult?.dev_stage_id || connectResult?.devStageId;
|
|
56917
57052
|
const devStageId = typeof rawDevStageId === "string" ? rawDevStageId : void 0;
|
|
56918
57053
|
let announceConnect = true;
|
|
@@ -57956,6 +58091,12 @@ var init_tools2 = __esm({
|
|
|
57956
58091
|
schema: exposeTunnelSchema,
|
|
57957
58092
|
handler: handleExposeTunnel
|
|
57958
58093
|
},
|
|
58094
|
+
{
|
|
58095
|
+
name: "huaweicloud_sandbox_expose_poll",
|
|
58096
|
+
description: 'Poll an async expose task started by huaweicloud_sandbox_expose_tunnel with mode: "async". Returns state: running (the chain is still working \u2014 call again), done (result carries the full expose envelope: ok, publicUrl, port, tunnelId, expiresAt, urlLifetimeHint, keepalive, warnings), failed (an unexpected throw escaped the chain, with error), or unknown (no receipt in this MCP server process \u2014 it never started here, the session restarted, or the 30-minute receipt expired; the tunnel may already exist, so check huaweicloud_sandbox_deploy_check or re-expose \u2014 never assume success without a URL). The urlLifetimeHint MUST be relayed with the URL: the tunnel expiry is not the sandbox lifetime.',
|
|
58097
|
+
schema: exposePollSchema,
|
|
58098
|
+
handler: handleExposePoll
|
|
58099
|
+
},
|
|
57959
58100
|
{
|
|
57960
58101
|
name: "huaweicloud_sandbox_renew_tunnel",
|
|
57961
58102
|
description: "Renew a DevBridge tunnel's lifetime (devbridge update <id> -e <hours>) \u2014 a ROLLING window: expiration = now + hours regardless of remaining time, so renewing before expiry keeps the SAME public URL alive indefinitely (the URL is bound to the tunnel ID and never changes). Default 720h = the 30-day maximum. Returns ok, tunnelId, expiresAt (absolute ISO timestamp read back via show -v \u2014 a management-plane loss (10002 tunnel not found) is NOT misread as success), renewedForHours. Use the tunnelId from huaweicloud_sandbox_expose_tunnel or extract it from the URL. The keepalive watchdog renews automatically; this tool is the manual/one-off path.",
|
|
@@ -57982,7 +58123,7 @@ var init_tools2 = __esm({
|
|
|
57982
58123
|
},
|
|
57983
58124
|
{
|
|
57984
58125
|
name: "huaweicloud_sandbox_connect",
|
|
57985
|
-
description: "Connect to a sandbox via hdkitservice. One instance per user per pool \u2014 reuses the same-pool sandbox if available, otherwise creates a new one. Quota: 1 instance per pool type (a user may hold 1 ephemeral AND 1 persistent simultaneously; same-type requests reuse the existing instance). On quota exhaustion the API returns HTTP 429 with one of three codes: HDKIT_QUOTA_EXCEEDED (retry useless \u2014 release or reuse the existing instance; Retry-After 60), HDKIT_TEMPLATE_QUOTA_EXCEEDED (the running instances of this account for this sandbox type are at the limit \u2014 shut down or release an instance of the same type and retry; no Retry-After), or HDKIT_CAPACITY_INSUFFICIENT (pool capacity; retry later / off-peak; Retry-After 60). Gateway 502/504 timeouts during orchestration
|
|
58126
|
+
description: "Connect to a sandbox via hdkitservice. One instance per user per pool \u2014 reuses the same-pool sandbox if available, otherwise creates a new one. Quota: 1 instance per pool type (a user may hold 1 ephemeral AND 1 persistent simultaneously; same-type requests reuse the existing instance). On quota exhaustion the API returns HTTP 429 with one of three codes: HDKIT_QUOTA_EXCEEDED (retry useless \u2014 release or reuse the existing instance; Retry-After 60), HDKIT_TEMPLATE_QUOTA_EXCEEDED (the running instances of this account for this sandbox type are at the limit \u2014 shut down or release an instance of the same type and retry; no Retry-After), or HDKIT_CAPACITY_INSUFFICIENT (pool capacity; retry later / off-peak; Retry-After 60). Gateway 502/504 timeouts during orchestration return a pending receipt (ok:false, pending:true, retryAfter, hint) instead of holding the call through the backoff \u2014 the server may already have created the instance; re-call this tool with the SAME parameters after retryAfter and a created instance is reused. An outdated plugin version is rejected by the 409 HDKIT_VERSION_TOO_OLD version gate, surfaced by the sandbox tools (connect/check_user/sign_agreement/credentials) as ok:false and by the voucher trio as claimed:false, always carrying code, message, and remediation naming the upgrade act (npx --yes huaweicloud-devkit@latest update --target <agent>, restart the agent session, or huaweicloud_upgrade), with clientVersion and minVersion present when the service sends them. Returns session_id, dev_stage_id, connection_id, connection_address, expiresAt (STS credential expiry), pool_type/resolved template_id echo, server-configured lifecycle numbers (pool_idle_shutdown_minutes / pool_idle_delete_minutes / pool_reclaim_minutes) and started (true when a reused instance was woken from shutdown). Lifecycle hints are announced only on the first connect of a session or when started=true. Ephemeral pool (default): idle auto-shutdown after 30min, auto-delete after 1h \u2014 do not keep important data there. Persistent pool: data disk retained (EVS 32G), idle shutdown after 1h, idle reclaim capped at 7 days. Numbers are configured by hdkitservice; the text follows the server echo and falls back to these defaults. Vendor-gated (vendorConfirmed): call only when the vendor is established \u2014 see the vendorConfirmed parameter description; when unknown, ask which cloud the user means first.",
|
|
57986
58127
|
schema: connectSchema,
|
|
57987
58128
|
handler: handleConnect
|
|
57988
58129
|
},
|
|
@@ -58009,6 +58150,7 @@ var init_tools2 = __esm({
|
|
|
58009
58150
|
huaweicloud_sandbox_deploy_nginx: deployNginxSchema,
|
|
58010
58151
|
huaweicloud_sandbox_deploy_check: deployCheckSchema,
|
|
58011
58152
|
huaweicloud_sandbox_expose_tunnel: exposeTunnelSchema,
|
|
58153
|
+
huaweicloud_sandbox_expose_poll: exposePollSchema,
|
|
58012
58154
|
huaweicloud_sandbox_renew_tunnel: renewTunnelSchema,
|
|
58013
58155
|
huaweicloud_sandbox_keepalive_watchdog: keepaliveWatchdogSchema,
|
|
58014
58156
|
huaweicloud_sandbox_check_user: checkUserSchema,
|
|
@@ -58027,6 +58169,7 @@ var init_tools2 = __esm({
|
|
|
58027
58169
|
huaweicloud_sandbox_deploy_nginx: handleDeployNginx,
|
|
58028
58170
|
huaweicloud_sandbox_deploy_check: handleDeployCheck,
|
|
58029
58171
|
huaweicloud_sandbox_expose_tunnel: handleExposeTunnel,
|
|
58172
|
+
huaweicloud_sandbox_expose_poll: handleExposePoll,
|
|
58030
58173
|
huaweicloud_sandbox_renew_tunnel: handleRenewTunnel,
|
|
58031
58174
|
huaweicloud_sandbox_keepalive_watchdog: handleKeepaliveWatchdog,
|
|
58032
58175
|
huaweicloud_sandbox_check_user: handleCheckUser,
|
|
@@ -58438,7 +58581,7 @@ var init_supplemental_redaction = __esm({
|
|
|
58438
58581
|
});
|
|
58439
58582
|
|
|
58440
58583
|
// plugins/huaweicloud-core/dist.new/lib/approval-tokens.js
|
|
58441
|
-
import { createHash as createHash7, createHmac as createHmac3, randomUUID as
|
|
58584
|
+
import { createHash as createHash7, createHmac as createHmac3, randomUUID as randomUUID3, timingSafeEqual } from "node:crypto";
|
|
58442
58585
|
import { existsSync as existsSync28, mkdirSync as mkdirSync14, readdirSync as readdirSync4, readFileSync as readFileSync28, renameSync as renameSync7, statSync as statSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync12 } from "node:fs";
|
|
58443
58586
|
import { dirname as dirname24, join as join35 } from "node:path";
|
|
58444
58587
|
function approvalFilePath() {
|
|
@@ -58568,7 +58711,7 @@ function pruneConsumedMarkers(now = Date.now()) {
|
|
|
58568
58711
|
}
|
|
58569
58712
|
}
|
|
58570
58713
|
function createApprovalToken(rawArgs, opts = {}) {
|
|
58571
|
-
const token =
|
|
58714
|
+
const token = randomUUID3();
|
|
58572
58715
|
const map2 = readApprovals();
|
|
58573
58716
|
map2[token] = {
|
|
58574
58717
|
argsHash: hashArgs(rawArgs),
|
|
@@ -59133,7 +59276,12 @@ function planHcloudCommand(args, options = {}) {
|
|
|
59133
59276
|
needed: true,
|
|
59134
59277
|
...approvalToken !== void 0 ? { command: `npx huaweicloud-devkit approve ${approvalToken}` } : {}
|
|
59135
59278
|
} : { needed: false },
|
|
59136
|
-
|
|
59279
|
+
// "Safe to run NOW": a caller-supplied allowWrites:true only unlocks the
|
|
59280
|
+
// classification — the strict view still demands the user's confirmation
|
|
59281
|
+
// (the approval token/form), so a plan showing decision:"allow" must not
|
|
59282
|
+
// also read as runnable while userConfirmation.needed is true (AX D-02
|
|
59283
|
+
// display-layer alignment).
|
|
59284
|
+
safeToRun: effectiveClassification.decision === "allow" && !needsConfirmation
|
|
59137
59285
|
};
|
|
59138
59286
|
}
|
|
59139
59287
|
var REQUIRED_PARAMS, PARAM_VALUE_HINTS, PLACEHOLDER_SECRET_VALUE_RE;
|
|
@@ -63273,6 +63421,7 @@ var init_registry = __esm({
|
|
|
63273
63421
|
huaweicloud_sandbox_deploy_nginx: "sandbox",
|
|
63274
63422
|
huaweicloud_sandbox_deploy_check: "sandbox",
|
|
63275
63423
|
huaweicloud_sandbox_expose_tunnel: "sandbox",
|
|
63424
|
+
huaweicloud_sandbox_expose_poll: "sandbox",
|
|
63276
63425
|
huaweicloud_sandbox_renew_tunnel: "sandbox",
|
|
63277
63426
|
huaweicloud_sandbox_keepalive_watchdog: "sandbox",
|
|
63278
63427
|
huaweicloud_sandbox_check_user: "sandbox",
|
|
@@ -63674,6 +63823,10 @@ var init_tool_definitions = __esm({
|
|
|
63674
63823
|
name: "huaweicloud_sandbox_expose_tunnel",
|
|
63675
63824
|
description: packDescription("huaweicloud_sandbox_expose_tunnel")
|
|
63676
63825
|
},
|
|
63826
|
+
{
|
|
63827
|
+
name: "huaweicloud_sandbox_expose_poll",
|
|
63828
|
+
description: packDescription("huaweicloud_sandbox_expose_poll")
|
|
63829
|
+
},
|
|
63677
63830
|
{
|
|
63678
63831
|
name: "huaweicloud_sandbox_check_user",
|
|
63679
63832
|
description: packDescription("huaweicloud_sandbox_check_user")
|
|
@@ -63969,7 +64122,7 @@ var init_vendor_gate = __esm({
|
|
|
63969
64122
|
|
|
63970
64123
|
// plugins/huaweicloud-core/dist.new/approval-ledger.js
|
|
63971
64124
|
import { closeSync, constants, existsSync as existsSync35, fstatSync, mkdirSync as mkdirSync16, openSync, readFileSync as readFileSync33, readSync, readdirSync as readdirSync7, renameSync as renameSync8, rmSync as rmSync10, statSync as statSync10, writeFileSync as writeFileSync16, writeSync } from "node:fs";
|
|
63972
|
-
import { createHash as createHash9, randomUUID as
|
|
64125
|
+
import { createHash as createHash9, randomUUID as randomUUID4 } from "node:crypto";
|
|
63973
64126
|
import { dirname as dirname26, join as join45 } from "node:path";
|
|
63974
64127
|
function ledgerFilePath() {
|
|
63975
64128
|
return join45(devkitStateBase(), "approval-consents.json");
|
|
@@ -64425,7 +64578,7 @@ function parseSpoolLine(line) {
|
|
|
64425
64578
|
}
|
|
64426
64579
|
}
|
|
64427
64580
|
function quarantineSidecarName(path) {
|
|
64428
|
-
return `${path}.corrupt-${process.pid}-${
|
|
64581
|
+
return `${path}.corrupt-${process.pid}-${randomUUID4()}`;
|
|
64429
64582
|
}
|
|
64430
64583
|
function appendLineAdditively(path, line) {
|
|
64431
64584
|
try {
|
|
@@ -64481,7 +64634,7 @@ function takeSpool() {
|
|
|
64481
64634
|
};
|
|
64482
64635
|
try {
|
|
64483
64636
|
if (existsSync35(spool)) {
|
|
64484
|
-
const takenFile = `${spool}.taken-${process.pid}-${
|
|
64637
|
+
const takenFile = `${spool}.taken-${process.pid}-${randomUUID4()}`;
|
|
64485
64638
|
renameSync8(spool, takenFile);
|
|
64486
64639
|
fold(takenFile);
|
|
64487
64640
|
}
|