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

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 (99) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +178 -138
  4. package/README.zh-CN.md +176 -138
  5. package/bin/setup.cjs +10 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +11 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +60 -44
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +31 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +30 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +31 -44
  13. package/plugins/huaweicloud-core/.mcp.json +13 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +31 -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 +76 -100
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +227 -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 +103 -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 +191 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +171 -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 +57 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +106 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +36 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +29 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +188 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +144 -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 +57 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +60 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +72 -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 +69 -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 +148 -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 +134 -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 +31 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +101 -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 +229 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +173 -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 +77 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +60 -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 +56 -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 +138 -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 +111 -96
  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 +20 -20
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +30 -28
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +59 -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 +54 -1
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +103 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
  80. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +283 -265
  81. package/plugins/huaweicloud-core/src/icon-library.mjs +171 -0
  82. package/plugins/huaweicloud-core/src/mcp-server.mjs +130 -129
  83. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +68 -0
  84. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +94 -0
  85. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +140 -137
  86. package/plugins/huaweicloud-core/src/safety-policy.mjs +356 -302
  87. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +86 -87
  88. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +150 -153
  89. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +196 -105
  90. package/plugins/huaweicloud-core/src/search-market.mjs +208 -169
  91. package/plugins/huaweicloud-core/src/setup-cli.mjs +2622 -1594
  92. package/plugins/huaweicloud-core/src/tools.mjs +463 -111
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +447 -427
  94. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +128 -132
  95. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +215 -227
  96. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +189 -202
  97. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +164 -158
  98. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  99. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
@@ -1,158 +1,164 @@
1
- import {
2
- OpCode,
3
- ReserveSource,
4
- FIXED_HEADER_LEN,
5
- MAX_SEND_CHUNK_SIZE,
6
- createPacket,
7
- isOpCmdTerminalData,
8
- isOpFailed,
9
- isSubStreamPing,
10
- nextIdentifier,
11
- } from './hwlink-packet.js';
12
-
13
- const encoder = new TextEncoder();
14
- const MAX_TERMINAL_PAYLOAD_SIZE = MAX_SEND_CHUNK_SIZE - FIXED_HEADER_LEN;
15
-
16
- class HwlinkTerminalChannel {
17
- constructor(username = 'root') {
18
- this.username = username;
19
- this.identifier = nextIdentifier();
20
- this.mux = null;
21
- this.closed = false;
22
- this.opened = false;
23
- this.onDataCb = null;
24
- this.onCloseCb = null;
25
- this.onErrorCb = null;
26
- this.onReadyCb = null;
27
- }
28
-
29
- onData(cb) {
30
- this.onDataCb = cb;
31
- }
32
-
33
- onClose(cb) {
34
- this.onCloseCb = cb;
35
- }
36
-
37
- onError(cb) {
38
- this.onErrorCb = cb;
39
- }
40
-
41
- onReady(cb) {
42
- this.onReadyCb = cb;
43
- }
44
-
45
- get isClosed() {
46
- return this.closed;
47
- }
48
-
49
- attach(mux) {
50
- this.mux = mux;
51
- mux.register(this);
52
- }
53
-
54
- onopen() {
55
- if (this.closed || this.opened) return;
56
- this.opened = true;
57
- this.sendRaw(createPacket({
58
- operation: OpCode.OpNewCmdTerminal,
59
- reserve: ReserveSource.Web,
60
- identifier: this.identifier,
61
- source: this.mux ? this.mux.source : 0,
62
- payload: encoder.encode(this.username),
63
- }));
64
- if (this.onReadyCb) this.onReadyCb();
65
- }
66
-
67
- onmessage(packet) {
68
- if (this.closed) return;
69
-
70
- if (isOpFailed(packet.operation)) {
71
- this.handleError(new Error(`hwlink terminal failed: 0x${packet.operation.toString(16)}`));
72
- return;
73
- }
74
-
75
- if (isSubStreamPing(packet.operation)) {
76
- this.sendRaw(createPacket({
77
- operation: OpCode.OpCmdTerminalData | OpCode.OpSubStreamPong,
78
- reserve: ReserveSource.Web,
79
- identifier: this.identifier,
80
- source: this.mux ? this.mux.source : 0,
81
- payload: new Uint8Array(0),
82
- }));
83
- return;
84
- }
85
-
86
- if (isOpCmdTerminalData(packet.operation) && packet.data) {
87
- if (this.onDataCb) this.onDataCb(packet.data);
88
- }
89
- }
90
-
91
- onerror(error) {
92
- if (this.onErrorCb) this.onErrorCb(error);
93
- }
94
-
95
- onclose() {
96
- this.close();
97
- }
98
-
99
- sendInput(data) {
100
- if (this.closed) return;
101
- for (let offset = 0; offset < data.byteLength; offset += MAX_TERMINAL_PAYLOAD_SIZE) {
102
- const payload = data.subarray(offset, offset + MAX_TERMINAL_PAYLOAD_SIZE);
103
- this.sendTerminalData(payload);
104
- }
105
- }
106
-
107
- sendTerminalData(payload) {
108
- this.sendRaw(createPacket({
109
- operation: OpCode.OpCmdTerminalData | OpCode.OpSubStreamPong,
110
- reserve: ReserveSource.Web,
111
- identifier: this.identifier,
112
- source: this.mux ? this.mux.source : 0,
113
- payload,
114
- }));
115
- }
116
-
117
- sendText(text) {
118
- this.sendInput(encoder.encode(text));
119
- }
120
-
121
- resize(cols, rows) {
122
- if (this.closed) return;
123
- const payload = new Uint8Array(4);
124
- const view = new DataView(payload.buffer);
125
- view.setUint16(0, rows, false);
126
- view.setUint16(2, cols, false);
127
- this.sendRaw(createPacket({
128
- operation: OpCode.OpCmdTerminalResize,
129
- reserve: ReserveSource.Web,
130
- identifier: this.identifier,
131
- source: this.mux ? this.mux.source : 0,
132
- payload,
133
- }));
134
- }
135
-
136
- sendRaw(data) {
137
- if (this.mux) this.mux.sendFairly(this, data);
138
- }
139
-
140
- handleError(error) {
141
- if (this.closed) return;
142
- this.closed = true;
143
- if (this.mux) this.mux.unregister(this);
144
- if (this.onErrorCb) this.onErrorCb(error);
145
- if (this.onCloseCb) this.onCloseCb();
146
- }
147
-
148
- close() {
149
- if (this.closed) return;
150
- this.closed = true;
151
- if (this.mux) this.mux.unregister(this);
152
- if (this.onCloseCb) this.onCloseCb();
153
- }
154
- }
155
-
156
- export {
157
- HwlinkTerminalChannel,
158
- };
1
+ import {
2
+ OpCode,
3
+ ReserveSource,
4
+ FIXED_HEADER_LEN,
5
+ MAX_SEND_CHUNK_SIZE,
6
+ createPacket,
7
+ isOpCmdTerminalData,
8
+ isOpFailed,
9
+ isSubStreamPing,
10
+ nextIdentifier,
11
+ } from './hwlink-packet.js';
12
+
13
+ const encoder = new TextEncoder();
14
+ const MAX_TERMINAL_PAYLOAD_SIZE = MAX_SEND_CHUNK_SIZE - FIXED_HEADER_LEN;
15
+
16
+ class HwlinkTerminalChannel {
17
+ constructor(username = 'root') {
18
+ this.username = username;
19
+ this.identifier = nextIdentifier();
20
+ this.mux = null;
21
+ this.closed = false;
22
+ this.opened = false;
23
+ this.onDataCb = null;
24
+ this.onCloseCb = null;
25
+ this.onErrorCb = null;
26
+ this.onReadyCb = null;
27
+ }
28
+
29
+ onData(cb) {
30
+ this.onDataCb = cb;
31
+ }
32
+
33
+ onClose(cb) {
34
+ this.onCloseCb = cb;
35
+ }
36
+
37
+ onError(cb) {
38
+ this.onErrorCb = cb;
39
+ }
40
+
41
+ onReady(cb) {
42
+ this.onReadyCb = cb;
43
+ }
44
+
45
+ get isClosed() {
46
+ return this.closed;
47
+ }
48
+
49
+ attach(mux) {
50
+ this.mux = mux;
51
+ mux.register(this);
52
+ }
53
+
54
+ onopen() {
55
+ if (this.closed || this.opened) return;
56
+ this.opened = true;
57
+ this.sendRaw(
58
+ createPacket({
59
+ operation: OpCode.OpNewCmdTerminal,
60
+ reserve: ReserveSource.Web,
61
+ identifier: this.identifier,
62
+ source: this.mux ? this.mux.source : 0,
63
+ payload: encoder.encode(this.username),
64
+ }),
65
+ );
66
+ if (this.onReadyCb) this.onReadyCb();
67
+ }
68
+
69
+ onmessage(packet) {
70
+ if (this.closed) return;
71
+
72
+ if (isOpFailed(packet.operation)) {
73
+ this.handleError(new Error(`hwlink terminal failed: 0x${packet.operation.toString(16)}`));
74
+ return;
75
+ }
76
+
77
+ if (isSubStreamPing(packet.operation)) {
78
+ this.sendRaw(
79
+ createPacket({
80
+ operation: OpCode.OpCmdTerminalData | OpCode.OpSubStreamPong,
81
+ reserve: ReserveSource.Web,
82
+ identifier: this.identifier,
83
+ source: this.mux ? this.mux.source : 0,
84
+ payload: new Uint8Array(0),
85
+ }),
86
+ );
87
+ return;
88
+ }
89
+
90
+ if (isOpCmdTerminalData(packet.operation) && packet.data) {
91
+ if (this.onDataCb) this.onDataCb(packet.data);
92
+ }
93
+ }
94
+
95
+ onerror(error) {
96
+ if (this.onErrorCb) this.onErrorCb(error);
97
+ }
98
+
99
+ onclose() {
100
+ this.close();
101
+ }
102
+
103
+ sendInput(data) {
104
+ if (this.closed) return;
105
+ for (let offset = 0; offset < data.byteLength; offset += MAX_TERMINAL_PAYLOAD_SIZE) {
106
+ const payload = data.subarray(offset, offset + MAX_TERMINAL_PAYLOAD_SIZE);
107
+ this.sendTerminalData(payload);
108
+ }
109
+ }
110
+
111
+ sendTerminalData(payload) {
112
+ this.sendRaw(
113
+ createPacket({
114
+ operation: OpCode.OpCmdTerminalData | OpCode.OpSubStreamPong,
115
+ reserve: ReserveSource.Web,
116
+ identifier: this.identifier,
117
+ source: this.mux ? this.mux.source : 0,
118
+ payload,
119
+ }),
120
+ );
121
+ }
122
+
123
+ sendText(text) {
124
+ this.sendInput(encoder.encode(text));
125
+ }
126
+
127
+ resize(cols, rows) {
128
+ if (this.closed) return;
129
+ const payload = new Uint8Array(4);
130
+ const view = new DataView(payload.buffer);
131
+ view.setUint16(0, rows, false);
132
+ view.setUint16(2, cols, false);
133
+ this.sendRaw(
134
+ createPacket({
135
+ operation: OpCode.OpCmdTerminalResize,
136
+ reserve: ReserveSource.Web,
137
+ identifier: this.identifier,
138
+ source: this.mux ? this.mux.source : 0,
139
+ payload,
140
+ }),
141
+ );
142
+ }
143
+
144
+ sendRaw(data) {
145
+ if (this.mux) this.mux.sendFairly(this, data);
146
+ }
147
+
148
+ handleError(error) {
149
+ if (this.closed) return;
150
+ this.closed = true;
151
+ if (this.mux) this.mux.unregister(this);
152
+ if (this.onErrorCb) this.onErrorCb(error);
153
+ if (this.onCloseCb) this.onCloseCb();
154
+ }
155
+
156
+ close() {
157
+ if (this.closed) return;
158
+ this.closed = true;
159
+ if (this.mux) this.mux.unregister(this);
160
+ if (this.onCloseCb) this.onCloseCb();
161
+ }
162
+ }
163
+
164
+ export { HwlinkTerminalChannel };
@@ -1,19 +1,19 @@
1
- import * as hwlinkExec from './hwlink-exec-client.js';
2
- import * as hwlinkPacket from './hwlink-packet.js';
3
- import * as wsExec from './ws-exec-client.js';
4
- import { HwlinkWebSocketMultiplexer } from './hwlink-multiplexer.js';
5
- import { HwlinkTerminalChannel } from './hwlink-terminal-channel.js';
6
-
7
- export * from './ws-exec-client.js';
8
- export * from './hwlink-exec-client.js';
9
- export { HwlinkTerminalChannel } from './hwlink-terminal-channel.js';
10
- export { HwlinkWebSocketMultiplexer } from './hwlink-multiplexer.js';
11
- export { hwlinkPacket };
12
-
13
- export default {
14
- ...wsExec,
15
- ...hwlinkExec,
16
- HwlinkTerminalChannel,
17
- HwlinkWebSocketMultiplexer,
18
- hwlinkPacket,
19
- };
1
+ import * as hwlinkExec from './hwlink-exec-client.js';
2
+ import * as hwlinkPacket from './hwlink-packet.js';
3
+ import * as wsExec from './ws-exec-client.js';
4
+ import { HwlinkWebSocketMultiplexer } from './hwlink-multiplexer.js';
5
+ import { HwlinkTerminalChannel } from './hwlink-terminal-channel.js';
6
+
7
+ export * from './ws-exec-client.js';
8
+ export * from './hwlink-exec-client.js';
9
+ export { HwlinkTerminalChannel } from './hwlink-terminal-channel.js';
10
+ export { HwlinkWebSocketMultiplexer } from './hwlink-multiplexer.js';
11
+ export { hwlinkPacket };
12
+
13
+ export default {
14
+ ...wsExec,
15
+ ...hwlinkExec,
16
+ HwlinkTerminalChannel,
17
+ HwlinkWebSocketMultiplexer,
18
+ hwlinkPacket,
19
+ };