huaweicloud-devkit 1.1.0-next.9 → 1.1.0

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.
Files changed (35) hide show
  1. package/README.md +27 -1
  2. package/README.zh-CN.md +26 -1
  3. package/package.json +3 -1
  4. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
  5. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
  6. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
  7. package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +1 -1
  8. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +1 -1
  9. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +29 -12
  10. package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
  11. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +136 -24
  12. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +15 -14
  13. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +1 -1
  14. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +5 -1
  15. package/plugins/huaweicloud-core/skills/huawei-ecs/references/hc-activity.md +27 -0
  16. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +11 -11
  17. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +6 -5
  18. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +71 -7
  19. package/plugins/huaweicloud-core/skills/huawei-sandbox/references/nginx-templates.md +4 -0
  20. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +19 -12
  21. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +26 -26
  22. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +12 -6
  23. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +7 -4
  24. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +7 -7
  25. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +14 -0
  26. package/plugins/huaweicloud-core/src/auth/credentials.mjs +30 -1
  27. package/plugins/huaweicloud-core/src/auth/service.mjs +33 -0
  28. package/plugins/huaweicloud-core/src/detect-framework.mjs +25 -3
  29. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +67 -5
  30. package/plugins/huaweicloud-core/src/mcp-server.mjs +23 -0
  31. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +11 -3
  32. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +118 -23
  33. package/plugins/huaweicloud-core/src/search-market.mjs +1 -0
  34. package/plugins/huaweicloud-core/src/setup-cli.mjs +491 -64
  35. package/plugins/huaweicloud-core/src/tools.mjs +37 -15
@@ -6,7 +6,7 @@ import { spawnSync } from 'node:child_process';
6
6
 
7
7
  import { evaluateArtifacts, evaluateCommandRisk, evaluateDeployPlan } from './risk-rule-engine.mjs';
8
8
  import { classifyTextCommand, redactSecrets } from './safety-policy.mjs';
9
- import { planHcloudCommand, runHcloud } from './hcloud-cli.mjs';
9
+ import { planHcloudCommand, runHcloud, consumeApprovalToken } from './hcloud-cli.mjs';
10
10
  import { searchMarketplace } from './search-market.mjs';
11
11
  import { getServiceIcon } from './icon-library.mjs';
12
12
  import { detectFramework } from './detect-framework.mjs';
@@ -48,6 +48,10 @@ function codeartsSkillsDir() {
48
48
  const home = homedir();
49
49
  return join(home, '.codeartsdoer', 'skills');
50
50
  }
51
+ function codeartsWorkSkillsDir() {
52
+ const home = homedir();
53
+ return join(home, '.codeartswork', 'skills');
54
+ }
51
55
  function workbuddySkillsDir() {
52
56
  const home = homedir();
53
57
  return join(home, '.workbuddy', 'skills');
@@ -102,6 +106,15 @@ function hermesSkillsDir() {
102
106
  return join(home, '.hermes', 'skills');
103
107
  }
104
108
 
109
+ function atomcodeSkillsDir() {
110
+ const home = process.env.ATOMCODE_HOME || homedir();
111
+ return join(home, '.atomcode', 'skills');
112
+ }
113
+
114
+ function codexDesktopSkillsDir() {
115
+ return join(homedir(), '.agents', 'skills');
116
+ }
117
+
105
118
  export function listSkillDirs(root) {
106
119
  if (!existsSync(root)) return [];
107
120
  try {
@@ -126,10 +139,13 @@ function resolveSkillsRoot() {
126
139
  SKILLS_ROOT_DEV,
127
140
  dshSkillsDir(),
128
141
  codeartsSkillsDir(),
142
+ codeartsWorkSkillsDir(),
129
143
  opencodeSkillsDir(),
130
144
  workbuddySkillsDir(),
131
145
  officeaceSkillsRoot(),
132
146
  hermesSkillsDir(),
147
+ atomcodeSkillsDir(),
148
+ codexDesktopSkillsDir(),
133
149
  ]) || SKILLS_ROOT_DEV
134
150
  );
135
151
  }
@@ -214,16 +230,16 @@ export const TOOL_DEFINITIONS = [
214
230
  'Run a write-capable hcloud command only after the exact command has been shown and explicitly approved by the user.',
215
231
  inputSchema: {
216
232
  type: 'object',
217
- required: ['args', 'approvedCommand', 'approvedByUser'],
233
+ required: ['args', 'approvalToken', 'approvedByUser'],
218
234
  properties: {
219
235
  args: {
220
236
  type: 'array',
221
237
  items: { type: 'string' },
222
238
  description: 'hcloud arguments, excluding the hcloud executable.',
223
239
  },
224
- approvedCommand: {
240
+ approvalToken: {
225
241
  type: 'string',
226
- description: 'The exact command string previously shown to the user.',
242
+ description: 'The approvalToken returned by huaweicloud_plan_cli_command.',
227
243
  },
228
244
  approvedByUser: {
229
245
  type: 'boolean',
@@ -449,7 +465,7 @@ export const TOOL_DEFINITIONS = [
449
465
  target: {
450
466
  type: 'string',
451
467
  description:
452
- 'Agent target to check: opencode, codex, codex-desktop, codearts, workbuddy, dsh, officeace, hermes, openclaw, atomcode, or all (default).',
468
+ 'Agent target to check: opencode, codex, codex-desktop, codearts, codearts-work, workbuddy, dsh, officeace, hermes, openclaw, atomcode, or all (default).',
453
469
  },
454
470
  },
455
471
  },
@@ -464,7 +480,7 @@ export const TOOL_DEFINITIONS = [
464
480
  target: {
465
481
  type: 'string',
466
482
  description:
467
- 'Agent target to report after sync: opencode, codex, codex-desktop, codearts, workbuddy, dsh, officeace, hermes, or all (default).',
483
+ 'Agent target to report after sync: opencode, codex, codex-desktop, codearts, codearts-work, workbuddy, dsh, officeace, hermes, or all (default).',
468
484
  },
469
485
  },
470
486
  },
@@ -552,7 +568,7 @@ export const TOOL_DEFINITIONS = [
552
568
  'Workspace ID from huaweicloud_sandbox_connect return value. Required - must be passed explicitly when HW_WORKSPACE_ID is not set.',
553
569
  },
554
570
  username: { type: 'string', description: 'Login username (default: root)' },
555
- timeout_ms: { type: 'number', description: 'Per-command execution timeout in milliseconds (default: 120000)' },
571
+ timeout_ms: { type: 'number', description: 'Execution timeout in milliseconds (default: 60000)' },
556
572
  },
557
573
  },
558
574
  },
@@ -614,7 +630,7 @@ export const TOOL_DEFINITIONS = [
614
630
  config_name: {
615
631
  type: 'string',
616
632
  description:
617
- 'Config file name (without .conf suffix). Defaults to app. Use distinct names (e.g. admin, docs) for multi-app deployments to avoid config overwrites.',
633
+ 'Config file name (without .conf suffix). Defaults to the project name, ensuring each project gets its own config. Override with distinct names (e.g. admin, docs) for sub-app deployments.',
618
634
  },
619
635
  workspace_id: {
620
636
  type: 'string',
@@ -905,7 +921,7 @@ export async function callTool(name, args = {}) {
905
921
  );
906
922
  }
907
923
  const sandboxUser7 = args.username || 'root';
908
- const sandboxTimeout7 = args.timeout_ms || 30000;
924
+ const sandboxTimeout7 = args.timeout_ms || 60000;
909
925
  return await deployNginx(
910
926
  sandboxWsId7,
911
927
  {
@@ -962,7 +978,8 @@ export async function callTool(name, args = {}) {
962
978
  return connectResult;
963
979
  }
964
980
  case 'huaweicloud_sandbox_credentials': {
965
- const credResult = await hdkitCredentials(args.session_id, args.dev_stage_id, args.enable_sts !== false);
981
+ const devStageId = args.dev_stage_id || getCurrentWorkspaceId();
982
+ const credResult = await hdkitCredentials(args.session_id, devStageId, args.enable_sts !== false);
966
983
  const sandboxWsIdCred = args.dev_stage_id || getCurrentWorkspaceId();
967
984
  if (sandboxWsIdCred) {
968
985
  try {
@@ -1220,12 +1237,17 @@ async function runApprovedCommand(args = {}) {
1220
1237
  if (args.approvedByUser !== true) {
1221
1238
  throw new Error('approvedByUser must be true after explicit user approval for this exact command.');
1222
1239
  }
1223
- const strictPlan = planHcloudCommand(args.args || [], { allowWrites: false });
1224
- const plan = planHcloudCommand(args.args || [], { allowWrites: true });
1225
- if (String(args.approvedCommand || '') !== plan.command) {
1226
- throw new Error('approvedCommand must exactly match the planned hcloud command.');
1240
+ const token = String(args.approvalToken || '');
1241
+ const storedArgs = consumeApprovalToken(token);
1242
+ if (!storedArgs || storedArgs.length === 0) {
1243
+ throw new Error('Invalid or expired approval token. Please re-plan the command.');
1244
+ }
1245
+ const providedArgs = Array.isArray(args.args) ? args.args.map(String) : [];
1246
+ if (JSON.stringify(storedArgs) !== JSON.stringify(providedArgs)) {
1247
+ throw new Error('Provided args do not match the approved plan. Use the exact args from the plan.');
1227
1248
  }
1228
- const result = await runHcloud(args.args || [], {
1249
+ const strictPlan = planHcloudCommand(providedArgs, { allowWrites: false });
1250
+ const result = await runHcloud(providedArgs, {
1229
1251
  allowWrites: true,
1230
1252
  timeoutMs: args.timeoutMs,
1231
1253
  maxRetries: args.maxRetries,