huaweicloud-devkit 1.0.2-next.3 → 1.0.3-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -20
- package/LICENSE +201 -201
- package/README.md +139 -163
- package/README.zh-CN.md +139 -161
- package/bin/setup.cjs +8 -8
- package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
- package/integrations/opencode/opencode.json +14 -14
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
- package/package.json +44 -47
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -44
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -44
- package/plugins/huaweicloud-core/.mcp.json +15 -15
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -44
- package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
- package/plugins/huaweicloud-core/safety/policy.json +99 -99
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +199 -199
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
- package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -190
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -124
- package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
- package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +185 -185
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +133 -133
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +55 -55
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +131 -131
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
- package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
- package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -122
- package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +127 -133
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
- package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -100
- package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
- package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +224 -224
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +134 -139
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -51
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +128 -128
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +95 -110
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +60 -60
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +87 -105
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -95
- package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
- package/plugins/huaweicloud-core/src/mcp-server.mjs +129 -129
- package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
- package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +87 -91
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +153 -162
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +105 -112
- package/plugins/huaweicloud-core/src/search-market.mjs +169 -174
- package/plugins/huaweicloud-core/src/setup-cli.mjs +1594 -2017
- package/plugins/huaweicloud-core/src/tools.mjs +993 -1008
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
- package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
- package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
- package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +0 -155
- package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +0 -87
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
const DEFAULT_HIGH_WATERMARK = 8 * 1024 * 1024;
|
|
2
|
-
const DEFAULT_LOW_WATERMARK = 2 * 1024 * 1024;
|
|
3
|
-
|
|
4
|
-
class FairQueue {
|
|
5
|
-
constructor(onSend, opts = {}) {
|
|
6
|
-
this.onSend = onSend;
|
|
7
|
-
this.channels = new Map();
|
|
8
|
-
this.readyChannels = new Set();
|
|
9
|
-
this.channelOrder = [];
|
|
10
|
-
this.cursor = 0;
|
|
11
|
-
this.normalQueue = [];
|
|
12
|
-
this.highPriorityQueue = [];
|
|
13
|
-
this.draining = false;
|
|
14
|
-
this.totalBytes = 0;
|
|
15
|
-
this.backpressureQueue = [];
|
|
16
|
-
this.highWatermark = opts.highWatermark || DEFAULT_HIGH_WATERMARK;
|
|
17
|
-
this.lowWatermark = opts.lowWatermark || DEFAULT_LOW_WATERMARK;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
register(ch) {
|
|
21
|
-
this.channels.set(ch.identifier, []);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
unregister(ch) {
|
|
25
|
-
this.channels.delete(ch.identifier);
|
|
26
|
-
this.readyChannels.delete(ch.identifier);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async sendFairly(ch, data) {
|
|
30
|
-
if (this.totalBytes >= this.highWatermark) {
|
|
31
|
-
await new Promise((resolve) => {
|
|
32
|
-
this.backpressureQueue.push(resolve);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const buffer = this.channels.get(ch.identifier);
|
|
37
|
-
if (!buffer) return;
|
|
38
|
-
|
|
39
|
-
buffer.push(data);
|
|
40
|
-
this.totalBytes += data.byteLength;
|
|
41
|
-
if (!this.readyChannels.has(ch.identifier)) {
|
|
42
|
-
this.readyChannels.add(ch.identifier);
|
|
43
|
-
this.channelOrder.push(ch.identifier);
|
|
44
|
-
}
|
|
45
|
-
this.startDrain();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
sendImmediately(data) {
|
|
49
|
-
this.highPriorityQueue.push(data);
|
|
50
|
-
this.totalBytes += data.byteLength;
|
|
51
|
-
this.startDrain();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
startDrain() {
|
|
55
|
-
if (this.draining) return;
|
|
56
|
-
this.draining = true;
|
|
57
|
-
this.drain().catch(() => {});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async drain() {
|
|
61
|
-
try {
|
|
62
|
-
while (true) {
|
|
63
|
-
if (this.highPriorityQueue.length > 0) {
|
|
64
|
-
const data = this.highPriorityQueue.shift();
|
|
65
|
-
this.totalBytes -= data.byteLength;
|
|
66
|
-
await this.onSend(data);
|
|
67
|
-
this.checkBackpressure();
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (this.normalQueue.length > 0) {
|
|
72
|
-
const data = this.normalQueue.shift();
|
|
73
|
-
this.totalBytes -= data.byteLength;
|
|
74
|
-
await this.onSend(data);
|
|
75
|
-
this.checkBackpressure();
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.collectRound();
|
|
80
|
-
|
|
81
|
-
if (this.highPriorityQueue.length === 0 && this.normalQueue.length === 0) {
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} finally {
|
|
86
|
-
this.draining = false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
collectRound() {
|
|
91
|
-
if (this.readyChannels.size === 0) return;
|
|
92
|
-
const len = this.channelOrder.length;
|
|
93
|
-
if (len === 0) return;
|
|
94
|
-
|
|
95
|
-
this.cursor %= len;
|
|
96
|
-
const start = this.cursor;
|
|
97
|
-
|
|
98
|
-
for (let i = 0; i < len; i += 1) {
|
|
99
|
-
const idx = (start + i) % len;
|
|
100
|
-
const id = this.channelOrder[idx];
|
|
101
|
-
if (!this.readyChannels.has(id)) continue;
|
|
102
|
-
|
|
103
|
-
const buffer = this.channels.get(id);
|
|
104
|
-
if (!buffer || buffer.length === 0) {
|
|
105
|
-
this.readyChannels.delete(id);
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const data = buffer.shift();
|
|
110
|
-
this.normalQueue.push(data);
|
|
111
|
-
if (buffer.length === 0) {
|
|
112
|
-
this.readyChannels.delete(id);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
this.cursor = (start + len) % len;
|
|
117
|
-
this.channelOrder = Array.from(new Set(this.channelOrder.filter((id) => this.readyChannels.has(id))));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
checkBackpressure() {
|
|
121
|
-
while (this.totalBytes < this.lowWatermark && this.backpressureQueue.length > 0) {
|
|
122
|
-
const resolve = this.backpressureQueue.shift();
|
|
123
|
-
resolve();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export {
|
|
129
|
-
DEFAULT_HIGH_WATERMARK,
|
|
130
|
-
DEFAULT_LOW_WATERMARK,
|
|
131
|
-
FairQueue,
|
|
132
|
-
};
|
|
1
|
+
const DEFAULT_HIGH_WATERMARK = 8 * 1024 * 1024;
|
|
2
|
+
const DEFAULT_LOW_WATERMARK = 2 * 1024 * 1024;
|
|
3
|
+
|
|
4
|
+
class FairQueue {
|
|
5
|
+
constructor(onSend, opts = {}) {
|
|
6
|
+
this.onSend = onSend;
|
|
7
|
+
this.channels = new Map();
|
|
8
|
+
this.readyChannels = new Set();
|
|
9
|
+
this.channelOrder = [];
|
|
10
|
+
this.cursor = 0;
|
|
11
|
+
this.normalQueue = [];
|
|
12
|
+
this.highPriorityQueue = [];
|
|
13
|
+
this.draining = false;
|
|
14
|
+
this.totalBytes = 0;
|
|
15
|
+
this.backpressureQueue = [];
|
|
16
|
+
this.highWatermark = opts.highWatermark || DEFAULT_HIGH_WATERMARK;
|
|
17
|
+
this.lowWatermark = opts.lowWatermark || DEFAULT_LOW_WATERMARK;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
register(ch) {
|
|
21
|
+
this.channels.set(ch.identifier, []);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
unregister(ch) {
|
|
25
|
+
this.channels.delete(ch.identifier);
|
|
26
|
+
this.readyChannels.delete(ch.identifier);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async sendFairly(ch, data) {
|
|
30
|
+
if (this.totalBytes >= this.highWatermark) {
|
|
31
|
+
await new Promise((resolve) => {
|
|
32
|
+
this.backpressureQueue.push(resolve);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const buffer = this.channels.get(ch.identifier);
|
|
37
|
+
if (!buffer) return;
|
|
38
|
+
|
|
39
|
+
buffer.push(data);
|
|
40
|
+
this.totalBytes += data.byteLength;
|
|
41
|
+
if (!this.readyChannels.has(ch.identifier)) {
|
|
42
|
+
this.readyChannels.add(ch.identifier);
|
|
43
|
+
this.channelOrder.push(ch.identifier);
|
|
44
|
+
}
|
|
45
|
+
this.startDrain();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
sendImmediately(data) {
|
|
49
|
+
this.highPriorityQueue.push(data);
|
|
50
|
+
this.totalBytes += data.byteLength;
|
|
51
|
+
this.startDrain();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
startDrain() {
|
|
55
|
+
if (this.draining) return;
|
|
56
|
+
this.draining = true;
|
|
57
|
+
this.drain().catch(() => {});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async drain() {
|
|
61
|
+
try {
|
|
62
|
+
while (true) {
|
|
63
|
+
if (this.highPriorityQueue.length > 0) {
|
|
64
|
+
const data = this.highPriorityQueue.shift();
|
|
65
|
+
this.totalBytes -= data.byteLength;
|
|
66
|
+
await this.onSend(data);
|
|
67
|
+
this.checkBackpressure();
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (this.normalQueue.length > 0) {
|
|
72
|
+
const data = this.normalQueue.shift();
|
|
73
|
+
this.totalBytes -= data.byteLength;
|
|
74
|
+
await this.onSend(data);
|
|
75
|
+
this.checkBackpressure();
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.collectRound();
|
|
80
|
+
|
|
81
|
+
if (this.highPriorityQueue.length === 0 && this.normalQueue.length === 0) {
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} finally {
|
|
86
|
+
this.draining = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
collectRound() {
|
|
91
|
+
if (this.readyChannels.size === 0) return;
|
|
92
|
+
const len = this.channelOrder.length;
|
|
93
|
+
if (len === 0) return;
|
|
94
|
+
|
|
95
|
+
this.cursor %= len;
|
|
96
|
+
const start = this.cursor;
|
|
97
|
+
|
|
98
|
+
for (let i = 0; i < len; i += 1) {
|
|
99
|
+
const idx = (start + i) % len;
|
|
100
|
+
const id = this.channelOrder[idx];
|
|
101
|
+
if (!this.readyChannels.has(id)) continue;
|
|
102
|
+
|
|
103
|
+
const buffer = this.channels.get(id);
|
|
104
|
+
if (!buffer || buffer.length === 0) {
|
|
105
|
+
this.readyChannels.delete(id);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const data = buffer.shift();
|
|
110
|
+
this.normalQueue.push(data);
|
|
111
|
+
if (buffer.length === 0) {
|
|
112
|
+
this.readyChannels.delete(id);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.cursor = (start + len) % len;
|
|
117
|
+
this.channelOrder = Array.from(new Set(this.channelOrder.filter((id) => this.readyChannels.has(id))));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
checkBackpressure() {
|
|
121
|
+
while (this.totalBytes < this.lowWatermark && this.backpressureQueue.length > 0) {
|
|
122
|
+
const resolve = this.backpressureQueue.shift();
|
|
123
|
+
resolve();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
DEFAULT_HIGH_WATERMARK,
|
|
130
|
+
DEFAULT_LOW_WATERMARK,
|
|
131
|
+
FairQueue,
|
|
132
|
+
};
|