huaweicloud-devkit 1.0.2-next.21 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.0.2-next.21",
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,7 +17,7 @@
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.21",
20
+ "version": "1.0.2-next.22",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.0.2-next.21",
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,7 +17,7 @@
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.21",
20
+ "version": "1.0.2-next.22",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.0.2-next.21",
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
2
  "name": "huaweicloud-devkit",
3
- "version": "1.0.2-next.21",
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.21",
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.",
@@ -527,6 +527,12 @@ export async function uploadProjectWithSession(
527
527
  timeoutMs = 300000,
528
528
  options = {},
529
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
+ }
530
536
  if (!existsSync(localDir)) {
531
537
  throw new Error(`sandbox upload project: local directory not found: ${localDir}`);
532
538
  }
@@ -468,7 +468,11 @@ export const TOOL_DEFINITIONS = [
468
468
  required: ['command'],
469
469
  properties: {
470
470
  command: { type: 'string', description: 'The shell command to execute on the remote workspace' },
471
- workspace_id: { type: 'string', description: 'The 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
+ },
472
476
  username: { type: 'string', description: 'Login username for the remote terminal (default: root)' },
473
477
  timeout_ms: { type: 'number', description: 'Execution timeout in milliseconds (default: 120000)' },
474
478
  },
@@ -483,7 +487,11 @@ export const TOOL_DEFINITIONS = [
483
487
  required: ['command'],
484
488
  properties: {
485
489
  command: { type: 'string', description: 'The shell command to execute on the remote workspace' },
486
- workspace_id: { type: 'string', description: 'The 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
+ },
487
495
  username: { type: 'string', description: 'Login username for the remote terminal (default: root)' },
488
496
  timeout_ms: { type: 'number', description: 'Execution timeout in milliseconds (default: 120000)' },
489
497
  },
@@ -495,7 +503,11 @@ export const TOOL_DEFINITIONS = [
495
503
  inputSchema: {
496
504
  type: 'object',
497
505
  properties: {
498
- workspace_id: { type: 'string', description: 'The 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
+ },
499
511
  username: { type: 'string', description: 'Login username (default: root)' },
500
512
  },
501
513
  },
@@ -510,7 +522,11 @@ export const TOOL_DEFINITIONS = [
510
522
  properties: {
511
523
  local_path: { type: 'string', description: 'Absolute path to the local file to upload.' },
512
524
  remote_path: { type: 'string', description: 'Target path in the sandbox, e.g. /workspace/<repo>/index.html.' },
513
- workspace_id: { type: 'string', description: 'The 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
+ },
514
530
  username: { type: 'string', description: 'Login username (default: root)' },
515
531
  timeout_ms: { type: 'number', description: 'Per-command execution timeout in milliseconds (default: 120000)' },
516
532
  },
@@ -530,7 +546,11 @@ export const TOOL_DEFINITIONS = [
530
546
  description:
531
547
  'Remote parent directory where project will be extracted (default: /workspace). Final layout: <remote_dir>/<dirname>/',
532
548
  },
533
- workspace_id: { type: 'string', description: 'Workspace ID (defaults to HW_WORKSPACE_ID env var)' },
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
+ },
534
554
  username: { type: 'string', description: 'Login username (default: root)' },
535
555
  exclude: {
536
556
  type: 'array',
@@ -666,6 +686,12 @@ export async function callTool(name, args = {}) {
666
686
  return { status: 'ok', message: 'Runtime credentials set for this MCP session.' };
667
687
  case 'huaweicloud_sandbox_exec_with_session': {
668
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
+ }
669
695
  const sandboxUser2 = args.username || 'root';
670
696
  const sandboxTimeout2 = args.timeout_ms || 120000;
671
697
  const sandboxResult2 = await execWithSession(sandboxWsId2, args.command, sandboxUser2, sandboxTimeout2);
@@ -673,6 +699,12 @@ export async function callTool(name, args = {}) {
673
699
  }
674
700
  case 'huaweicloud_sandbox_exec_one_shot': {
675
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
+ }
676
708
  const sandboxUser3 = args.username || 'root';
677
709
  const sandboxTimeout3 = args.timeout_ms || 120000;
678
710
  const sandboxResult3 = await execOneShot(sandboxWsId3, args.command, sandboxUser3, sandboxTimeout3);
@@ -680,6 +712,12 @@ export async function callTool(name, args = {}) {
680
712
  }
681
713
  case 'huaweicloud_sandbox_close_session': {
682
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
+ }
683
721
  const sandboxUser4 = args.username || 'root';
684
722
  const closed = await closeSession(sandboxWsId4, sandboxUser4);
685
723
  return closed ? 'ok' : 'not_connected';
@@ -689,6 +727,12 @@ export async function callTool(name, args = {}) {
689
727
  throw new Error('local_path and remote_path are required.');
690
728
  }
691
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
+ }
692
736
  const sandboxUser5 = args.username || 'root';
693
737
  const sandboxTimeout5 = args.timeout_ms || 120000;
694
738
  return await uploadFileWithSession(
@@ -704,6 +748,12 @@ export async function callTool(name, args = {}) {
704
748
  throw new Error('local_dir is required.');
705
749
  }
706
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
+ }
707
757
  const sandboxUser6 = args.username || 'root';
708
758
  const sandboxTimeout6 = args.timeout_ms || 120000;
709
759
  return await uploadProjectWithSession(
@@ -724,8 +774,9 @@ export async function callTool(name, args = {}) {
724
774
  return await hdkitSignAgreement();
725
775
  case 'huaweicloud_sandbox_connect': {
726
776
  const connectResult = await hdkitConnect(args);
727
- if (connectResult?.dev_stage_id) {
728
- setWorkspaceId(connectResult.dev_stage_id);
777
+ const devStageId = connectResult?.dev_stage_id || connectResult?.devStageId;
778
+ if (devStageId) {
779
+ setWorkspaceId(devStageId);
729
780
  }
730
781
  return connectResult;
731
782
  }