huaweicloud-devkit 1.0.2-dev.9 → 1.0.2-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +163 -138
  4. package/README.zh-CN.md +161 -138
  5. package/bin/setup.cjs +8 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +14 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +46 -44
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -44
  13. package/plugins/huaweicloud-core/.mcp.json +15 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -44
  15. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  16. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
  17. package/plugins/huaweicloud-core/safety/policy.json +99 -99
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +199 -199
  19. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
  20. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  21. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  22. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
  23. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
  24. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -124
  26. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  27. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  28. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +185 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +133 -133
  34. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  35. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +55 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +131 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
  40. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  41. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  42. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
  44. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  45. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -122
  46. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
  47. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  48. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +133 -127
  49. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
  50. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -100
  52. package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
  53. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  54. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +224 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +135 -134
  56. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  57. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
  58. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
  60. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
  61. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  62. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
  63. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  64. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +51 -47
  65. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  66. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +128 -128
  67. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  68. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +110 -95
  69. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  70. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +60 -60
  73. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  74. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  75. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  76. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +105 -87
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  80. package/plugins/huaweicloud-core/src/mcp-server.mjs +129 -129
  81. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +155 -0
  82. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +87 -0
  83. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
  84. package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
  85. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +91 -87
  86. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +162 -153
  87. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +112 -105
  88. package/plugins/huaweicloud-core/src/search-market.mjs +174 -169
  89. package/plugins/huaweicloud-core/src/setup-cli.mjs +2017 -1594
  90. package/plugins/huaweicloud-core/src/tools.mjs +1008 -993
  91. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
  92. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
  94. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
  95. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
  96. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  97. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
@@ -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
+ };