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.
- package/.agents/plugins/marketplace.json +20 -20
- package/LICENSE +201 -201
- package/README.md +178 -138
- package/README.zh-CN.md +176 -138
- package/bin/setup.cjs +10 -8
- package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
- package/integrations/opencode/opencode.json +11 -14
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
- package/package.json +60 -44
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +30 -43
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/.mcp.json +13 -15
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +31 -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 +76 -100
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +227 -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 +103 -101
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +191 -190
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +171 -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 +57 -56
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +106 -97
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +36 -29
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +29 -23
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +188 -185
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +144 -133
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +57 -55
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -131
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +60 -58
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +72 -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 +69 -65
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
- package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +148 -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 +134 -127
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +31 -26
- package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +101 -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 +229 -224
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +173 -134
- 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 +77 -76
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +60 -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 +56 -47
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +138 -128
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +111 -96
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +20 -20
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +30 -28
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +59 -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 +54 -1
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +103 -95
- package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
- package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +283 -265
- package/plugins/huaweicloud-core/src/icon-library.mjs +171 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +130 -129
- package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +68 -0
- package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +94 -0
- package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +140 -137
- package/plugins/huaweicloud-core/src/safety-policy.mjs +356 -302
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +86 -87
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +150 -153
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +196 -105
- package/plugins/huaweicloud-core/src/search-market.mjs +208 -169
- package/plugins/huaweicloud-core/src/setup-cli.mjs +2622 -1594
- package/plugins/huaweicloud-core/src/tools.mjs +463 -111
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +447 -427
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +128 -132
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +215 -227
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +189 -202
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +164 -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
|
@@ -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(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (this.
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (this.closed) return;
|
|
150
|
-
this.closed = true;
|
|
151
|
-
if (this.mux) this.mux.unregister(this);
|
|
152
|
-
if (this.
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
+
};
|