huaweicloud-devkit 1.0.2-next.20 → 1.0.2-next.22
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 +1 -1
- package/README.md +19 -3
- package/README.zh-CN.md +19 -3
- package/package.json +1 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +2 -2
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +2 -2
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +2 -2
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +2 -2
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +2 -2
- package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +13 -2
- package/plugins/huaweicloud-core/src/setup-cli.mjs +2 -2
- package/plugins/huaweicloud-core/src/tools.mjs +71 -14
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
Help AI coding agents use Huawei Cloud safely and accurately — a single integration that gives agents cloud knowledge, CLI tooling, and safety guardrails.
|
|
10
10
|
|
|
11
|
-
Supports OpenCode, CodeArts Agent, WorkBuddy, DeepSeek Harness (DSH), and
|
|
11
|
+
Supports OpenCode, CodeArts Agent, WorkBuddy, DeepSeek Harness (DSH), OfficeAce, and OpenClaw.
|
|
12
12
|
|
|
13
13
|
## Prerequisites
|
|
14
14
|
|
|
@@ -31,7 +31,7 @@ npx --yes huaweicloud-devkit doctor --target opencode
|
|
|
31
31
|
npx --yes huaweicloud-devkit status --target opencode
|
|
32
32
|
npx --yes huaweicloud-devkit update --target opencode
|
|
33
33
|
npx --yes huaweicloud-devkit uninstall --target opencode
|
|
34
|
-
rm -rf ~/.npm/_npx/ # Linux/macOS
|
|
34
|
+
rm -rf ~/.npm/_npx/ # Linux/macOS only; Windows path TBD
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### CodeArts Agent
|
|
@@ -98,6 +98,22 @@ npx --yes huaweicloud-devkit update --target officeace
|
|
|
98
98
|
npx --yes huaweicloud-devkit uninstall --target officeace
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### OpenClaw
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx --yes huaweicloud-devkit install --target openclaw
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Restart OpenClaw** after installation.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx --yes huaweicloud-devkit doctor --target openclaw
|
|
111
|
+
npx --yes huaweicloud-devkit status --target openclaw
|
|
112
|
+
npx --yes huaweicloud-devkit update --target openclaw
|
|
113
|
+
npx --yes huaweicloud-devkit uninstall --target openclaw
|
|
114
|
+
rm -rf ~/.npm/_npx/ # Linux/macOS only; Windows path TBD
|
|
115
|
+
```
|
|
116
|
+
|
|
101
117
|
### Other Agents
|
|
102
118
|
|
|
103
119
|
Any agent that supports MCP can use the standard config:
|
|
@@ -107,7 +123,7 @@ Any agent that supports MCP can use the standard config:
|
|
|
107
123
|
"mcpServers": {
|
|
108
124
|
"huaweicloud-devkit": {
|
|
109
125
|
"command": "npx",
|
|
110
|
-
"args": ["-y", "-p", "huaweicloud-devkit
|
|
126
|
+
"args": ["-y", "-p", "huaweicloud-devkit", "huaweicloud-devkit-mcp"]
|
|
111
127
|
}
|
|
112
128
|
}
|
|
113
129
|
}
|
package/README.zh-CN.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
帮助 AI 编码助手安全、准确地使用华为云——一站式集成云知识、CLI 工具和安全护栏。
|
|
10
10
|
|
|
11
|
-
支持 OpenCode、码道(CodeArts Agent)、WorkBuddy、DeepSeek Harness(DSH)、OfficeAce。
|
|
11
|
+
支持 OpenCode、码道(CodeArts Agent)、WorkBuddy、DeepSeek Harness(DSH)、OfficeAce、OpenClaw。
|
|
12
12
|
|
|
13
13
|
## 前置条件
|
|
14
14
|
|
|
@@ -31,7 +31,7 @@ npx --yes huaweicloud-devkit doctor --target opencode
|
|
|
31
31
|
npx --yes huaweicloud-devkit status --target opencode
|
|
32
32
|
npx --yes huaweicloud-devkit update --target opencode
|
|
33
33
|
npx --yes huaweicloud-devkit uninstall --target opencode
|
|
34
|
-
rm -rf ~/.npm/_npx/ # Linux/macOS
|
|
34
|
+
rm -rf ~/.npm/_npx/ # 仅 Linux/macOS;Windows 路径待确认
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### CodeArts Agent(码道)
|
|
@@ -98,6 +98,22 @@ npx --yes huaweicloud-devkit update --target officeace
|
|
|
98
98
|
npx --yes huaweicloud-devkit uninstall --target officeace
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### OpenClaw
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx --yes huaweicloud-devkit install --target openclaw
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
安装后**重启 OpenClaw**。
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx --yes huaweicloud-devkit doctor --target openclaw
|
|
111
|
+
npx --yes huaweicloud-devkit status --target openclaw
|
|
112
|
+
npx --yes huaweicloud-devkit update --target openclaw
|
|
113
|
+
npx --yes huaweicloud-devkit uninstall --target openclaw
|
|
114
|
+
rm -rf ~/.npm/_npx/ # 仅 Linux/macOS;Windows 路径待确认
|
|
115
|
+
```
|
|
116
|
+
|
|
101
117
|
### 其他 Agent
|
|
102
118
|
|
|
103
119
|
任何支持 MCP 协议的 Agent,直接使用标准 MCP 配置:
|
|
@@ -107,7 +123,7 @@ npx --yes huaweicloud-devkit uninstall --target officeace
|
|
|
107
123
|
"mcpServers": {
|
|
108
124
|
"huaweicloud-devkit": {
|
|
109
125
|
"command": "npx",
|
|
110
|
-
"args": ["-y", "-p", "huaweicloud-devkit
|
|
126
|
+
"args": ["-y", "-p", "huaweicloud-devkit", "huaweicloud-devkit-mcp"]
|
|
111
127
|
}
|
|
112
128
|
}
|
|
113
129
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "1.0.2-next.
|
|
3
|
+
"version": "1.0.2-next.22",
|
|
4
4
|
"description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"mcpServers": "./.mcp.json",
|
|
18
18
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
19
19
|
"skills": "./skills/",
|
|
20
|
-
"version": "1.0.2-next.
|
|
20
|
+
"version": "1.0.2-next.22",
|
|
21
21
|
"author": {
|
|
22
22
|
"name": "HuaweiCloud Mate",
|
|
23
23
|
"url": "https://github.com/huaweicloud"
|
|
24
24
|
},
|
|
25
25
|
"hooks": "./hooks/",
|
|
26
|
-
"name": "huaweicloud-
|
|
26
|
+
"name": "huaweicloud-devkit",
|
|
27
27
|
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
28
28
|
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
29
29
|
"license": "Apache-2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "huaweicloud-
|
|
3
|
-
"version": "1.0.2-next.
|
|
2
|
+
"name": "huaweicloud-devkit",
|
|
3
|
+
"version": "1.0.2-next.22",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"mcpServers": "./.mcp.json",
|
|
18
18
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
19
19
|
"skills": "./skills/",
|
|
20
|
-
"version": "1.0.2-next.
|
|
20
|
+
"version": "1.0.2-next.22",
|
|
21
21
|
"author": {
|
|
22
22
|
"name": "HuaweiCloud Mate",
|
|
23
23
|
"url": "https://github.com/huaweicloud"
|
|
24
24
|
},
|
|
25
25
|
"hooks": "./hooks/",
|
|
26
|
-
"name": "huaweicloud-
|
|
26
|
+
"name": "huaweicloud-devkit",
|
|
27
27
|
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
28
28
|
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
29
29
|
"license": "Apache-2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "huaweicloud-
|
|
3
|
-
"version": "1.0.2-next.
|
|
2
|
+
"name": "huaweicloud-devkit",
|
|
3
|
+
"version": "1.0.2-next.22",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "huaweicloud-
|
|
3
|
-
"version": "1.0.2-next.
|
|
2
|
+
"name": "huaweicloud-devkit",
|
|
3
|
+
"version": "1.0.2-next.22",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
3
|
"id": "huaweicloud-devkit",
|
|
4
4
|
"displayName": "HuaweiCloud DevKit",
|
|
5
|
-
"version": "1.0.2-next.
|
|
5
|
+
"version": "1.0.2-next.22",
|
|
6
6
|
"family": "bundle-plugin",
|
|
7
7
|
"bundleFormat": "codex",
|
|
8
8
|
"description": "Guide coding agents to use Huawei Cloud safely — KooCLI, APIs, SDKs, 28 MCP tools, skills, and safety guardrails.",
|
|
@@ -14,7 +14,12 @@ const execFileAsync = promisify(execFile);
|
|
|
14
14
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
15
|
export const WS_EXEC_INDEX_URL = pathToFileURL(join(__dirname, '..', 'ws-exec', 'index.js')).href;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
let currentWorkspaceId = process.env.HW_WORKSPACE_ID || null;
|
|
18
|
+
|
|
19
|
+
function setWorkspaceId(id) {
|
|
20
|
+
currentWorkspaceId = id;
|
|
21
|
+
process.env.HW_WORKSPACE_ID = id;
|
|
22
|
+
}
|
|
18
23
|
|
|
19
24
|
function resolveEnv() {
|
|
20
25
|
const env = { ...process.env };
|
|
@@ -522,6 +527,12 @@ export async function uploadProjectWithSession(
|
|
|
522
527
|
timeoutMs = 300000,
|
|
523
528
|
options = {},
|
|
524
529
|
) {
|
|
530
|
+
if (!workspaceId) {
|
|
531
|
+
throw new Error(
|
|
532
|
+
'sandbox upload project: workspace_id is required. ' +
|
|
533
|
+
'Set HW_WORKSPACE_ID env var or ensure huaweicloud_sandbox_connect was called first.',
|
|
534
|
+
);
|
|
535
|
+
}
|
|
525
536
|
if (!existsSync(localDir)) {
|
|
526
537
|
throw new Error(`sandbox upload project: local directory not found: ${localDir}`);
|
|
527
538
|
}
|
|
@@ -604,4 +615,4 @@ export async function closeAllSessions() {
|
|
|
604
615
|
}
|
|
605
616
|
}
|
|
606
617
|
|
|
607
|
-
export {
|
|
618
|
+
export { currentWorkspaceId, setWorkspaceId, runNodeExec };
|
|
@@ -3046,7 +3046,7 @@ async function main() {
|
|
|
3046
3046
|
default:
|
|
3047
3047
|
console.log(BANNER);
|
|
3048
3048
|
console.log(
|
|
3049
|
-
'Usage: npx huaweicloud-devkit <command> [--target <opencode|codex|codearts|workbuddy|dsh|officeace|hermes|all>]\n',
|
|
3049
|
+
'Usage: npx huaweicloud-devkit <command> [--target <opencode|codex|codearts|workbuddy|dsh|officeace|hermes|openclaw|all>]\n',
|
|
3050
3050
|
);
|
|
3051
3051
|
console.log('Commands:');
|
|
3052
3052
|
console.log(' install Install skills, MCP server, safety policy');
|
|
@@ -3061,7 +3061,7 @@ async function main() {
|
|
|
3061
3061
|
console.log(' help Show this help');
|
|
3062
3062
|
console.log('\nOptions:');
|
|
3063
3063
|
console.log(
|
|
3064
|
-
' --target Target agent: opencode (default), codex, codearts, workbuddy, dsh, officeace, hermes, all',
|
|
3064
|
+
' --target Target agent: opencode (default), codex, codearts, workbuddy, dsh, officeace, hermes, openclaw, all',
|
|
3065
3065
|
);
|
|
3066
3066
|
console.log('\nExamples:');
|
|
3067
3067
|
console.log(' npx huaweicloud-devkit install');
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
closeSession,
|
|
15
15
|
uploadFileWithSession,
|
|
16
16
|
uploadProjectWithSession,
|
|
17
|
-
|
|
17
|
+
currentWorkspaceId,
|
|
18
|
+
setWorkspaceId,
|
|
18
19
|
} from './sandbox/session-manager.mjs';
|
|
19
20
|
import { hdkitCheckUser, hdkitSignAgreement, hdkitConnect, hdkitCredentials } from './sandbox/hdkitservice-api.mjs';
|
|
20
21
|
import { getAuthStatus, syncAuth } from './auth/service.mjs';
|
|
@@ -424,7 +425,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
424
425
|
target: {
|
|
425
426
|
type: 'string',
|
|
426
427
|
description:
|
|
427
|
-
'Agent target to check: opencode, codex, codex-desktop, codearts, workbuddy, dsh, officeace, hermes, or all (default).',
|
|
428
|
+
'Agent target to check: opencode, codex, codex-desktop, codearts, workbuddy, dsh, officeace, hermes, openclaw, or all (default).',
|
|
428
429
|
},
|
|
429
430
|
},
|
|
430
431
|
},
|
|
@@ -467,7 +468,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
467
468
|
required: ['command'],
|
|
468
469
|
properties: {
|
|
469
470
|
command: { type: 'string', description: 'The shell command to execute on the remote workspace' },
|
|
470
|
-
workspace_id: {
|
|
471
|
+
workspace_id: {
|
|
472
|
+
type: 'string',
|
|
473
|
+
description:
|
|
474
|
+
'Workspace ID from huaweicloud_sandbox_connect return value. Required - must be passed explicitly when HW_WORKSPACE_ID is not set.',
|
|
475
|
+
},
|
|
471
476
|
username: { type: 'string', description: 'Login username for the remote terminal (default: root)' },
|
|
472
477
|
timeout_ms: { type: 'number', description: 'Execution timeout in milliseconds (default: 120000)' },
|
|
473
478
|
},
|
|
@@ -482,7 +487,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
482
487
|
required: ['command'],
|
|
483
488
|
properties: {
|
|
484
489
|
command: { type: 'string', description: 'The shell command to execute on the remote workspace' },
|
|
485
|
-
workspace_id: {
|
|
490
|
+
workspace_id: {
|
|
491
|
+
type: 'string',
|
|
492
|
+
description:
|
|
493
|
+
'Workspace ID from huaweicloud_sandbox_connect return value. Required - must be passed explicitly when HW_WORKSPACE_ID is not set.',
|
|
494
|
+
},
|
|
486
495
|
username: { type: 'string', description: 'Login username for the remote terminal (default: root)' },
|
|
487
496
|
timeout_ms: { type: 'number', description: 'Execution timeout in milliseconds (default: 120000)' },
|
|
488
497
|
},
|
|
@@ -494,7 +503,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
494
503
|
inputSchema: {
|
|
495
504
|
type: 'object',
|
|
496
505
|
properties: {
|
|
497
|
-
workspace_id: {
|
|
506
|
+
workspace_id: {
|
|
507
|
+
type: 'string',
|
|
508
|
+
description:
|
|
509
|
+
'Workspace ID from huaweicloud_sandbox_connect return value. Required - must be passed explicitly when HW_WORKSPACE_ID is not set.',
|
|
510
|
+
},
|
|
498
511
|
username: { type: 'string', description: 'Login username (default: root)' },
|
|
499
512
|
},
|
|
500
513
|
},
|
|
@@ -509,7 +522,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
509
522
|
properties: {
|
|
510
523
|
local_path: { type: 'string', description: 'Absolute path to the local file to upload.' },
|
|
511
524
|
remote_path: { type: 'string', description: 'Target path in the sandbox, e.g. /workspace/<repo>/index.html.' },
|
|
512
|
-
workspace_id: {
|
|
525
|
+
workspace_id: {
|
|
526
|
+
type: 'string',
|
|
527
|
+
description:
|
|
528
|
+
'Workspace ID from huaweicloud_sandbox_connect return value. Required - must be passed explicitly when HW_WORKSPACE_ID is not set.',
|
|
529
|
+
},
|
|
513
530
|
username: { type: 'string', description: 'Login username (default: root)' },
|
|
514
531
|
timeout_ms: { type: 'number', description: 'Per-command execution timeout in milliseconds (default: 120000)' },
|
|
515
532
|
},
|
|
@@ -529,7 +546,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
529
546
|
description:
|
|
530
547
|
'Remote parent directory where project will be extracted (default: /workspace). Final layout: <remote_dir>/<dirname>/',
|
|
531
548
|
},
|
|
532
|
-
workspace_id: {
|
|
549
|
+
workspace_id: {
|
|
550
|
+
type: 'string',
|
|
551
|
+
description:
|
|
552
|
+
'Workspace ID from huaweicloud_sandbox_connect return value. Required - must be passed explicitly when HW_WORKSPACE_ID is not set.',
|
|
553
|
+
},
|
|
533
554
|
username: { type: 'string', description: 'Login username (default: root)' },
|
|
534
555
|
exclude: {
|
|
535
556
|
type: 'array',
|
|
@@ -664,21 +685,39 @@ export async function callTool(name, args = {}) {
|
|
|
664
685
|
setRuntimeCredentials(args.ak, args.sk, undefined, args.region);
|
|
665
686
|
return { status: 'ok', message: 'Runtime credentials set for this MCP session.' };
|
|
666
687
|
case 'huaweicloud_sandbox_exec_with_session': {
|
|
667
|
-
const sandboxWsId2 = args.workspace_id ||
|
|
688
|
+
const sandboxWsId2 = args.workspace_id || currentWorkspaceId;
|
|
689
|
+
if (!sandboxWsId2) {
|
|
690
|
+
throw new Error(
|
|
691
|
+
'workspace_id is required. No sandbox connected — call huaweicloud_sandbox_connect first, ' +
|
|
692
|
+
'or set HW_WORKSPACE_ID environment variable before starting the agent.',
|
|
693
|
+
);
|
|
694
|
+
}
|
|
668
695
|
const sandboxUser2 = args.username || 'root';
|
|
669
696
|
const sandboxTimeout2 = args.timeout_ms || 120000;
|
|
670
697
|
const sandboxResult2 = await execWithSession(sandboxWsId2, args.command, sandboxUser2, sandboxTimeout2);
|
|
671
698
|
return { stdout: sandboxResult2.stdout, exitCode: sandboxResult2.exitCode };
|
|
672
699
|
}
|
|
673
700
|
case 'huaweicloud_sandbox_exec_one_shot': {
|
|
674
|
-
const sandboxWsId3 = args.workspace_id ||
|
|
701
|
+
const sandboxWsId3 = args.workspace_id || currentWorkspaceId;
|
|
702
|
+
if (!sandboxWsId3) {
|
|
703
|
+
throw new Error(
|
|
704
|
+
'workspace_id is required. No sandbox connected — call huaweicloud_sandbox_connect first, ' +
|
|
705
|
+
'or set HW_WORKSPACE_ID environment variable before starting the agent.',
|
|
706
|
+
);
|
|
707
|
+
}
|
|
675
708
|
const sandboxUser3 = args.username || 'root';
|
|
676
709
|
const sandboxTimeout3 = args.timeout_ms || 120000;
|
|
677
710
|
const sandboxResult3 = await execOneShot(sandboxWsId3, args.command, sandboxUser3, sandboxTimeout3);
|
|
678
711
|
return { stdout: sandboxResult3.stdout, exitCode: sandboxResult3.exitCode };
|
|
679
712
|
}
|
|
680
713
|
case 'huaweicloud_sandbox_close_session': {
|
|
681
|
-
const sandboxWsId4 = args.workspace_id ||
|
|
714
|
+
const sandboxWsId4 = args.workspace_id || currentWorkspaceId;
|
|
715
|
+
if (!sandboxWsId4) {
|
|
716
|
+
throw new Error(
|
|
717
|
+
'workspace_id is required. No sandbox connected — call huaweicloud_sandbox_connect first, ' +
|
|
718
|
+
'or set HW_WORKSPACE_ID environment variable before starting the agent.',
|
|
719
|
+
);
|
|
720
|
+
}
|
|
682
721
|
const sandboxUser4 = args.username || 'root';
|
|
683
722
|
const closed = await closeSession(sandboxWsId4, sandboxUser4);
|
|
684
723
|
return closed ? 'ok' : 'not_connected';
|
|
@@ -687,7 +726,13 @@ export async function callTool(name, args = {}) {
|
|
|
687
726
|
if (!args.local_path || !args.remote_path) {
|
|
688
727
|
throw new Error('local_path and remote_path are required.');
|
|
689
728
|
}
|
|
690
|
-
const sandboxWsId5 = args.workspace_id ||
|
|
729
|
+
const sandboxWsId5 = args.workspace_id || currentWorkspaceId;
|
|
730
|
+
if (!sandboxWsId5) {
|
|
731
|
+
throw new Error(
|
|
732
|
+
'workspace_id is required. No sandbox connected — call huaweicloud_sandbox_connect first, ' +
|
|
733
|
+
'or set HW_WORKSPACE_ID environment variable before starting the agent.',
|
|
734
|
+
);
|
|
735
|
+
}
|
|
691
736
|
const sandboxUser5 = args.username || 'root';
|
|
692
737
|
const sandboxTimeout5 = args.timeout_ms || 120000;
|
|
693
738
|
return await uploadFileWithSession(
|
|
@@ -702,7 +747,13 @@ export async function callTool(name, args = {}) {
|
|
|
702
747
|
if (!args.local_dir) {
|
|
703
748
|
throw new Error('local_dir is required.');
|
|
704
749
|
}
|
|
705
|
-
const sandboxWsId6 = args.workspace_id ||
|
|
750
|
+
const sandboxWsId6 = args.workspace_id || currentWorkspaceId;
|
|
751
|
+
if (!sandboxWsId6) {
|
|
752
|
+
throw new Error(
|
|
753
|
+
'workspace_id is required. No sandbox connected — call huaweicloud_sandbox_connect first, ' +
|
|
754
|
+
'or set HW_WORKSPACE_ID environment variable before starting the agent.',
|
|
755
|
+
);
|
|
756
|
+
}
|
|
706
757
|
const sandboxUser6 = args.username || 'root';
|
|
707
758
|
const sandboxTimeout6 = args.timeout_ms || 120000;
|
|
708
759
|
return await uploadProjectWithSession(
|
|
@@ -721,8 +772,14 @@ export async function callTool(name, args = {}) {
|
|
|
721
772
|
return await hdkitCheckUser();
|
|
722
773
|
case 'huaweicloud_sandbox_sign_agreement':
|
|
723
774
|
return await hdkitSignAgreement();
|
|
724
|
-
case 'huaweicloud_sandbox_connect':
|
|
725
|
-
|
|
775
|
+
case 'huaweicloud_sandbox_connect': {
|
|
776
|
+
const connectResult = await hdkitConnect(args);
|
|
777
|
+
const devStageId = connectResult?.dev_stage_id || connectResult?.devStageId;
|
|
778
|
+
if (devStageId) {
|
|
779
|
+
setWorkspaceId(devStageId);
|
|
780
|
+
}
|
|
781
|
+
return connectResult;
|
|
782
|
+
}
|
|
726
783
|
case 'huaweicloud_sandbox_credentials':
|
|
727
784
|
return await hdkitCredentials(args.session_id, args.dev_stage_id, args.enable_sts !== false);
|
|
728
785
|
default:
|