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,169 +1,208 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1
|
+
import { getProxyDispatcher } from './proxy/proxy-agent.mjs';
|
|
2
|
+
|
|
3
|
+
const INDEX_URL =
|
|
4
|
+
'https://gitcode.com/api/v5/repos/2501_91318609/skills-for-index/contents/skills-index/index.json?ref=main';
|
|
5
|
+
const CN_EN_MAP_URL =
|
|
6
|
+
'https://gitcode.com/api/v5/repos/2501_91318609/skills-for-index/contents/skills-index/cn-en-map.json?ref=main';
|
|
7
|
+
const HTTP_TIMEOUT_MS = 10000;
|
|
8
|
+
|
|
9
|
+
const GENERIC_KEYWORDS = new Set([
|
|
10
|
+
'华为云',
|
|
11
|
+
'huawei',
|
|
12
|
+
'huawei cloud',
|
|
13
|
+
'云',
|
|
14
|
+
'cloud',
|
|
15
|
+
'技能',
|
|
16
|
+
'skill',
|
|
17
|
+
'skills',
|
|
18
|
+
'所有',
|
|
19
|
+
'all',
|
|
20
|
+
'全部',
|
|
21
|
+
'有什么',
|
|
22
|
+
'有哪些',
|
|
23
|
+
'相关',
|
|
24
|
+
'列表',
|
|
25
|
+
'list',
|
|
26
|
+
'查找',
|
|
27
|
+
'搜索',
|
|
28
|
+
'发现',
|
|
29
|
+
'浏览',
|
|
30
|
+
'find',
|
|
31
|
+
'search',
|
|
32
|
+
'discover',
|
|
33
|
+
'browse',
|
|
34
|
+
'show',
|
|
35
|
+
'explore',
|
|
36
|
+
'agent',
|
|
37
|
+
'市场',
|
|
38
|
+
'market',
|
|
39
|
+
'类目',
|
|
40
|
+
'category',
|
|
41
|
+
'安装',
|
|
42
|
+
'install',
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
let cachedIndex = null;
|
|
46
|
+
let cachedCnEnMap = null;
|
|
47
|
+
|
|
48
|
+
async function fetchJson(url, label = '') {
|
|
49
|
+
const controller = new AbortController();
|
|
50
|
+
const timer = setTimeout(() => controller.abort(), HTTP_TIMEOUT_MS);
|
|
51
|
+
try {
|
|
52
|
+
const dispatcher = await getProxyDispatcher(url);
|
|
53
|
+
const fetchOpts = {
|
|
54
|
+
headers: { 'User-Agent': 'huaweicloud-devkit/1.0' },
|
|
55
|
+
signal: controller.signal,
|
|
56
|
+
};
|
|
57
|
+
if (dispatcher) fetchOpts.dispatcher = dispatcher;
|
|
58
|
+
const resp = await fetch(url, fetchOpts);
|
|
59
|
+
const data = await resp.json();
|
|
60
|
+
if (data && data.encoding === 'base64' && data.content) {
|
|
61
|
+
const decoded = Buffer.from(data.content, 'base64').toString('utf8');
|
|
62
|
+
return JSON.parse(decoded);
|
|
63
|
+
}
|
|
64
|
+
return data;
|
|
65
|
+
} catch (e) {
|
|
66
|
+
throw new Error(`Failed to fetch ${label}: ${e.message}`, { cause: e });
|
|
67
|
+
} finally {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function loadIndex() {
|
|
73
|
+
if (!cachedIndex) cachedIndex = await fetchJson(INDEX_URL, 'index.json');
|
|
74
|
+
return cachedIndex;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function loadCnEnMap() {
|
|
78
|
+
if (!cachedCnEnMap) cachedCnEnMap = await fetchJson(CN_EN_MAP_URL, 'cn-en-map.json');
|
|
79
|
+
return cachedCnEnMap;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function clearMarketCache() {
|
|
83
|
+
cachedIndex = null;
|
|
84
|
+
cachedCnEnMap = null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function isGeneric(kw) {
|
|
88
|
+
const k = kw.toLowerCase().trim();
|
|
89
|
+
return GENERIC_KEYWORDS.has(k) || /华为云|huawei/i.test(k);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function expandKeywords(rawKeyword, cnEnMap) {
|
|
93
|
+
if (!rawKeyword) return [[], []];
|
|
94
|
+
const parts = rawKeyword.replace(/[,;]/g, ' ').split(/\s+/).filter(Boolean);
|
|
95
|
+
const expanded = [...parts];
|
|
96
|
+
for (const p of parts) {
|
|
97
|
+
const lower = p.toLowerCase();
|
|
98
|
+
if (cnEnMap[p]) expanded.push(cnEnMap[p]);
|
|
99
|
+
for (const [cn, en] of Object.entries(cnEnMap)) {
|
|
100
|
+
if (en === lower) expanded.push(cn);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const unique = [...new Set(expanded)].sort();
|
|
104
|
+
const specific = unique.filter((kw) => !isGeneric(kw));
|
|
105
|
+
const generic = unique.filter((kw) => isGeneric(kw));
|
|
106
|
+
return [specific, generic];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function scoreSkill(skill, specificKws, genericKws) {
|
|
110
|
+
if (!specificKws.length && !genericKws.length) return [1, []];
|
|
111
|
+
let total = 0;
|
|
112
|
+
const matched = [];
|
|
113
|
+
const nameLower = (skill.name || '').toLowerCase();
|
|
114
|
+
const descLower = (skill.description || '').toLowerCase();
|
|
115
|
+
const serviceLower = (skill.service || '').toLowerCase();
|
|
116
|
+
const triggers = (skill.triggers || []).map((t) => (t || '').toLowerCase());
|
|
117
|
+
|
|
118
|
+
for (const kw of specificKws) {
|
|
119
|
+
const k = kw.toLowerCase();
|
|
120
|
+
let s = 0;
|
|
121
|
+
if (nameLower.includes(k)) s += 10;
|
|
122
|
+
else if (triggers.some((t) => t.includes(k))) s += 8;
|
|
123
|
+
else if (descLower.includes(k)) s += 5;
|
|
124
|
+
else if (serviceLower.includes(k)) s += 3;
|
|
125
|
+
if (s > 0) {
|
|
126
|
+
total += s;
|
|
127
|
+
matched.push(kw);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
for (const kw of genericKws) {
|
|
131
|
+
const k = kw.toLowerCase();
|
|
132
|
+
let s = 0;
|
|
133
|
+
if (nameLower.includes(k)) s += 10;
|
|
134
|
+
else if (triggers.some((t) => t.includes(k))) s += 4;
|
|
135
|
+
else if (descLower.includes(k)) s += 2;
|
|
136
|
+
else if (serviceLower.includes(k)) s += 1;
|
|
137
|
+
if (s > 0) {
|
|
138
|
+
total += s;
|
|
139
|
+
matched.push(kw);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (!specificKws.length && total === 0) {
|
|
143
|
+
total = 1;
|
|
144
|
+
if (descLower.length > 20) total += 1;
|
|
145
|
+
if (triggers.length) total += 1;
|
|
146
|
+
}
|
|
147
|
+
return [total, matched];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function truncate(desc, limit = 150) {
|
|
151
|
+
if (!desc) return '';
|
|
152
|
+
return desc.length > limit ? desc.slice(0, limit) + '...' : desc;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export async function searchMarketplace(query = '', category = '') {
|
|
156
|
+
const idx = await loadIndex();
|
|
157
|
+
const cnEnMap = await loadCnEnMap();
|
|
158
|
+
const [specificKws, genericKws] = expandKeywords(query, cnEnMap);
|
|
159
|
+
const hasSpecific = specificKws.length > 0;
|
|
160
|
+
|
|
161
|
+
const results = [];
|
|
162
|
+
for (const skill of idx.skills || []) {
|
|
163
|
+
if (category && skill.category !== category) continue;
|
|
164
|
+
const [score, matched] = scoreSkill(skill, specificKws, genericKws);
|
|
165
|
+
if (hasSpecific && score === 0) continue;
|
|
166
|
+
results.push({
|
|
167
|
+
score,
|
|
168
|
+
name: skill.name || '',
|
|
169
|
+
category: skill.category || '',
|
|
170
|
+
service: skill.service || '',
|
|
171
|
+
description: truncate(skill.description),
|
|
172
|
+
triggers: (skill.triggers || []).slice(0, 5),
|
|
173
|
+
matched,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
results.sort((a, b) => b.score - a.score);
|
|
177
|
+
|
|
178
|
+
if (!results.length) {
|
|
179
|
+
return {
|
|
180
|
+
ok: true,
|
|
181
|
+
query,
|
|
182
|
+
category,
|
|
183
|
+
count: 0,
|
|
184
|
+
results: [],
|
|
185
|
+
fallback: [
|
|
186
|
+
'Try broader or alternative keywords',
|
|
187
|
+
'Remove category filter',
|
|
188
|
+
'Switch CN<->EN (e.g., obs <-> object storage)',
|
|
189
|
+
'List all: search with empty keyword and a category',
|
|
190
|
+
],
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const allKws = [...new Set([...specificKws, ...genericKws])];
|
|
195
|
+
return {
|
|
196
|
+
ok: true,
|
|
197
|
+
query,
|
|
198
|
+
category,
|
|
199
|
+
count: results.length,
|
|
200
|
+
expandedKeywords: allKws.length > 1 ? allKws : undefined,
|
|
201
|
+
results,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export async function getMarketplaceCategories() {
|
|
206
|
+
const idx = await loadIndex();
|
|
207
|
+
return { ok: true, categories: idx.categories || [] };
|
|
208
|
+
}
|