huaweicloud-devkit 1.1.2-next.0 → 1.1.2-next.2
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 +18 -18
- package/README.md +182 -38
- package/README.zh-CN.md +180 -36
- package/bin/dsh-postinstall.cjs +77 -0
- package/bin/setup.cjs +7 -4
- package/cordis.patch.yml +13 -0
- package/integrations/atomcode/hooks/huaweicloud-telemetry.js +181 -0
- package/integrations/atomcode/hooks.json +9 -0
- package/integrations/dsh/hook-plugin.mjs +148 -0
- package/integrations/hermes/hooks/huaweicloud-telemetry.py +238 -0
- package/integrations/hermes/manifest.yaml +43 -0
- package/integrations/opencode/hooks/skill-tracker.js +115 -0
- package/integrations/opencode/opencode.json +1 -4
- package/integrations/workbuddy/hooks/telemetry-tracker.py +226 -0
- package/package.json +74 -43
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +4 -17
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +23 -33
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +4 -17
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +30 -0
- package/plugins/huaweicloud-core/.mcp.json +2 -5
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +4 -18
- package/plugins/huaweicloud-core/assets/icon.png +0 -0
- package/plugins/huaweicloud-core/assets/logo-dark.png +0 -0
- package/plugins/huaweicloud-core/assets/logo.png +0 -0
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +104 -28
- package/plugins/huaweicloud-core/openclaw.plugin.json +20 -0
- package/plugins/huaweicloud-core/safety/policy.json +75 -99
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +196 -35
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +38 -34
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +21 -20
- package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +19 -19
- package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +38 -32
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +30 -30
- package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +20 -20
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +31 -31
- package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +21 -20
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +40 -31
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +8 -1
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +6 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +45 -37
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +57 -6
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +11 -9
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/hc-activity.md +27 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +13 -13
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +44 -39
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +12 -10
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +21 -20
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +19 -19
- package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +20 -20
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +27 -23
- package/plugins/huaweicloud-core/skills/huawei-iac/SKILL.md +93 -0
- package/plugins/huaweicloud-core/skills/huawei-iac/references/architectures.md +83 -0
- package/plugins/huaweicloud-core/skills/huawei-iac/references/resource-catalog.md +107 -0
- package/plugins/huaweicloud-core/skills/huawei-iac/references/state-file.md +104 -0
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +30 -30
- package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +65 -39
- package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +9 -9
- package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +33 -25
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +46 -45
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +19 -19
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +12 -7
- package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +13 -12
- package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +4 -4
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +71 -61
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +776 -44
- package/plugins/huaweicloud-core/skills/huawei-sandbox/references/framework-commands.md +84 -0
- package/plugins/huaweicloud-core/skills/huawei-sandbox/references/nginx-templates.md +100 -0
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +36 -29
- package/plugins/huaweicloud-core/skills/huawei-voucher/SKILL.md +57 -0
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +39 -39
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +22 -15
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +20 -19
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +15 -15
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +23 -20
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +13 -13
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +3 -3
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +21 -2
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +3 -3
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +30 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +3 -3
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +68 -54
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +3 -3
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +6 -6
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +15 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +0 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +3 -3
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +36 -34
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +3 -3
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +142 -5
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +217 -5
- package/plugins/huaweicloud-core/src/auth/reconcile.mjs +174 -0
- package/plugins/huaweicloud-core/src/auth/service.mjs +57 -2
- package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
- package/plugins/huaweicloud-core/src/detect-framework.mjs +366 -0
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +203 -16
- package/plugins/huaweicloud-core/src/icon-library.mjs +176 -0
- package/plugins/huaweicloud-core/src/mcp-protocol.mjs +88 -0
- package/plugins/huaweicloud-core/src/mcp-server-remote.mjs +107 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +154 -99
- package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +20 -102
- package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +11 -4
- package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +4 -1
- package/plugins/huaweicloud-core/src/safety-policy.mjs +123 -68
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +48 -12
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +25 -26
- package/plugins/huaweicloud-core/src/sandbox/sandbox-file-server.py +45 -0
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +943 -10
- package/plugins/huaweicloud-core/src/sandbox/uninstall-cleanup.mjs +50 -0
- package/plugins/huaweicloud-core/src/search-market.mjs +49 -14
- package/plugins/huaweicloud-core/src/setup-cli.mjs +3091 -498
- package/plugins/huaweicloud-core/src/telemetry/agent-detect.mjs +40 -0
- package/plugins/huaweicloud-core/src/telemetry/agent-registry.mjs +328 -0
- package/plugins/huaweicloud-core/src/telemetry/telemetry.mjs +378 -0
- package/plugins/huaweicloud-core/src/tools.mjs +1272 -146
- package/plugins/huaweicloud-core/src/update-check.mjs +383 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +72 -38
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +10 -5
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +13 -16
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +12 -16
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +46 -31
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-tunnel-channel.mjs +268 -0
- package/plugins/huaweicloud-core/src/ws-exec/index.js +3 -0
- package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +40 -13
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +0 -190
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +0 -124
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { resolveCredentialsWithRuntime } from '../auth/credentials.mjs';
|
|
3
4
|
import { getProxyDispatcher } from '../proxy/proxy-agent.mjs';
|
|
4
5
|
|
|
5
6
|
const BASE_URL = process.env.HWLINK_ENDPOINT || 'https://devstation.myhuaweicloud.com';
|
|
@@ -14,9 +15,7 @@ function hmacSha256(key, data) {
|
|
|
14
15
|
|
|
15
16
|
function urlEncode(str) {
|
|
16
17
|
const hex = (c) => '%' + (c < 16 ? '0' : '') + c.toString(16).toUpperCase();
|
|
17
|
-
const noEscape = new Set(
|
|
18
|
-
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~'.split('')
|
|
19
|
-
);
|
|
18
|
+
const noEscape = new Set('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~'.split(''));
|
|
20
19
|
let out = '';
|
|
21
20
|
for (const ch of str) {
|
|
22
21
|
const c = ch.codePointAt(0);
|
|
@@ -54,9 +53,7 @@ function signRequest(method, path, query, body, ak, sk, securitytoken) {
|
|
|
54
53
|
.join('/') +
|
|
55
54
|
'/';
|
|
56
55
|
|
|
57
|
-
const signedHeaders = securitytoken
|
|
58
|
-
? 'host;x-sdk-date;x-security-token'
|
|
59
|
-
: 'host;x-sdk-date';
|
|
56
|
+
const signedHeaders = securitytoken ? 'host;x-sdk-date;x-security-token' : 'host;x-sdk-date';
|
|
60
57
|
const canonicalHeaders = securitytoken
|
|
61
58
|
? `host:${host}\nx-sdk-date:${ts}\nx-security-token:${securitytoken}\n`
|
|
62
59
|
: `host:${host}\nx-sdk-date:${ts}\n`;
|
|
@@ -64,14 +61,7 @@ function signRequest(method, path, query, body, ak, sk, securitytoken) {
|
|
|
64
61
|
const bodyStr = body ? JSON.stringify(body) : '';
|
|
65
62
|
const payloadHash = sha256Hex(bodyStr);
|
|
66
63
|
|
|
67
|
-
const canonicalRequest = [
|
|
68
|
-
method,
|
|
69
|
-
curi,
|
|
70
|
-
cqs,
|
|
71
|
-
canonicalHeaders,
|
|
72
|
-
signedHeaders,
|
|
73
|
-
payloadHash,
|
|
74
|
-
].join('\n');
|
|
64
|
+
const canonicalRequest = [method, curi, cqs, canonicalHeaders, signedHeaders, payloadHash].join('\n');
|
|
75
65
|
|
|
76
66
|
const stringToSign = `SDK-HMAC-SHA256\n${ts}\n${sha256Hex(canonicalRequest)}`;
|
|
77
67
|
const signature = hmacSha256(sk, stringToSign);
|
|
@@ -88,7 +78,7 @@ function signRequest(method, path, query, body, ak, sk, securitytoken) {
|
|
|
88
78
|
}
|
|
89
79
|
|
|
90
80
|
export function getCredentials() {
|
|
91
|
-
const credentials =
|
|
81
|
+
const credentials = resolveCredentialsWithRuntime();
|
|
92
82
|
return { ak: credentials.ak, sk: credentials.sk, securitytoken: credentials.securityToken };
|
|
93
83
|
}
|
|
94
84
|
|
|
@@ -100,7 +90,12 @@ async function apiGet(path, query, ak, sk, securitytoken) {
|
|
|
100
90
|
const url = `${BASE_URL}${fullPath}`;
|
|
101
91
|
const dispatcher = await getProxyDispatcher(url);
|
|
102
92
|
const fetchOpts = { headers };
|
|
103
|
-
if (dispatcher)
|
|
93
|
+
if (dispatcher) {
|
|
94
|
+
fetchOpts.dispatcher = dispatcher;
|
|
95
|
+
const { fetch: undiciFetch } = await import('undici');
|
|
96
|
+
const resp = await undiciFetch(url, fetchOpts);
|
|
97
|
+
return { status: resp.status, data: await resp.json() };
|
|
98
|
+
}
|
|
104
99
|
const resp = await fetch(url, fetchOpts);
|
|
105
100
|
return { status: resp.status, data: await resp.json() };
|
|
106
101
|
}
|
|
@@ -114,7 +109,12 @@ async function apiPost(path, body, ak, sk, securitytoken) {
|
|
|
114
109
|
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
115
110
|
body: JSON.stringify(body),
|
|
116
111
|
};
|
|
117
|
-
if (dispatcher)
|
|
112
|
+
if (dispatcher) {
|
|
113
|
+
fetchOpts.dispatcher = dispatcher;
|
|
114
|
+
const { fetch: undiciFetch } = await import('undici');
|
|
115
|
+
const resp = await undiciFetch(url, fetchOpts);
|
|
116
|
+
return { status: resp.status, data: await resp.json() };
|
|
117
|
+
}
|
|
118
118
|
const resp = await fetch(url, fetchOpts);
|
|
119
119
|
return { status: resp.status, data: await resp.json() };
|
|
120
120
|
}
|
|
@@ -123,7 +123,9 @@ export async function createConnection(envId, ak, sk, securitytoken) {
|
|
|
123
123
|
const { status, data } = await apiPost(
|
|
124
124
|
`/open-api-public/v1/devenvs/${envId}/connections`,
|
|
125
125
|
{ source: 'CLI' },
|
|
126
|
-
ak,
|
|
126
|
+
ak,
|
|
127
|
+
sk,
|
|
128
|
+
securitytoken,
|
|
127
129
|
);
|
|
128
130
|
|
|
129
131
|
if (status !== 200 || data?.error_code !== '0000' || !data?.result?.connection_id) {
|
|
@@ -138,13 +140,12 @@ export async function createConnection(envId, ak, sk, securitytoken) {
|
|
|
138
140
|
const { data: getData } = await apiGet(
|
|
139
141
|
`/open-api-public/v1/devenvs/${envId}/connections/${connectionId}`,
|
|
140
142
|
{},
|
|
141
|
-
ak,
|
|
143
|
+
ak,
|
|
144
|
+
sk,
|
|
145
|
+
securitytoken,
|
|
142
146
|
);
|
|
143
147
|
|
|
144
|
-
if (
|
|
145
|
-
getData?.result?.connection_info?.url &&
|
|
146
|
-
getData.result.connection_info.extensions?.source != null
|
|
147
|
-
) {
|
|
148
|
+
if (getData?.result?.connection_info?.url && getData.result.connection_info.extensions?.source != null) {
|
|
148
149
|
const u = new URL(getData.result.connection_info.url);
|
|
149
150
|
u.searchParams.set('source', String(getData.result.connection_info.extensions.source));
|
|
150
151
|
process.stderr.write(`\rConnection ${connectionId} established (${i}s).\n`);
|
|
@@ -158,5 +159,3 @@ export async function createConnection(envId, ak, sk, securitytoken) {
|
|
|
158
159
|
|
|
159
160
|
throw new Error(`Timed out waiting for connection ${connectionId}`);
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
-
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import hashlib, http.server, json, os, sys
|
|
3
|
+
class UploadHandler(http.server.BaseHTTPRequestHandler):
|
|
4
|
+
def do_POST(self):
|
|
5
|
+
if self.path != '/upload':
|
|
6
|
+
self.send_error(404)
|
|
7
|
+
return
|
|
8
|
+
target_path = self.headers.get('X-Target-Path', '/workspace/upload.tar.gz')
|
|
9
|
+
content_length = int(self.headers.get('Content-Length', 0))
|
|
10
|
+
os.makedirs(os.path.dirname(target_path), exist_ok=True)
|
|
11
|
+
md5 = hashlib.md5()
|
|
12
|
+
bytes_written = 0
|
|
13
|
+
with open(target_path, 'wb') as f:
|
|
14
|
+
remaining = content_length
|
|
15
|
+
while remaining > 0:
|
|
16
|
+
chunk = self.rfile.read(min(remaining, 65536))
|
|
17
|
+
if not chunk:
|
|
18
|
+
break
|
|
19
|
+
f.write(chunk)
|
|
20
|
+
md5.update(chunk)
|
|
21
|
+
bytes_written += len(chunk)
|
|
22
|
+
remaining -= len(chunk)
|
|
23
|
+
result = json.dumps({'ok': True, 'path': target_path, 'bytes': bytes_written, 'md5': md5.hexdigest()})
|
|
24
|
+
self.send_response(200)
|
|
25
|
+
self.send_header('Content-Type', 'application/json')
|
|
26
|
+
self.send_header('Content-Length', str(len(result)))
|
|
27
|
+
self.end_headers()
|
|
28
|
+
self.wfile.write(result.encode())
|
|
29
|
+
def do_GET(self):
|
|
30
|
+
if self.path == '/health':
|
|
31
|
+
body = b'ok'
|
|
32
|
+
self.send_response(200)
|
|
33
|
+
self.send_header('Content-Length', str(len(body)))
|
|
34
|
+
self.end_headers()
|
|
35
|
+
self.wfile.write(body)
|
|
36
|
+
else:
|
|
37
|
+
self.send_error(404)
|
|
38
|
+
def log_message(self, format, *args):
|
|
39
|
+
pass
|
|
40
|
+
if __name__ == '__main__':
|
|
41
|
+
port = int(sys.argv[1]) if len(sys.argv) > 1 else 8888
|
|
42
|
+
token = sys.argv[2] if len(sys.argv) > 2 else ''
|
|
43
|
+
server = http.server.HTTPServer(('127.0.0.1', port), UploadHandler)
|
|
44
|
+
server.upload_token = token
|
|
45
|
+
server.serve_forever()
|