huaweicloud-devkit 1.1.0-next.1 → 1.1.0-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.0-next.1",
3
+ "version": "1.1.0-next.2",
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.1.0-next.1",
20
+ "version": "1.1.0-next.2",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -20,7 +20,7 @@
20
20
  "mcpServers": "./.mcp.json",
21
21
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
22
22
  "skills": "./skills/",
23
- "version": "1.1.0-next.1",
23
+ "version": "1.1.0-next.2",
24
24
  "author": {
25
25
  "name": "HuaweiCloud Mate",
26
26
  "url": "https://github.com/huaweicloud"
@@ -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.1.0-next.1",
20
+ "version": "1.1.0-next.2",
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.1.0-next.1",
3
+ "version": "1.1.0-next.2",
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.1.0-next.1",
3
+ "version": "1.1.0-next.2",
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.1.0-next.1",
5
+ "version": "1.1.0-next.2",
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.",
@@ -1,4 +1,4 @@
1
- import { chmodSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
1
+ import { chmodSync, existsSync, mkdirSync, readFileSync, readlinkSync, statSync, writeFileSync } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { homedir } from 'node:os';
4
4
 
@@ -109,17 +109,30 @@ export function resolveCredentials(options = {}) {
109
109
  return { ak, sk, securityToken, region };
110
110
  }
111
111
 
112
+ let _parentCwd = undefined;
113
+
114
+ export function getParentCwd() {
115
+ if (_parentCwd !== undefined) return _parentCwd;
116
+ try {
117
+ _parentCwd = readlinkSync(`/proc/${process.ppid}/cwd`);
118
+ return _parentCwd;
119
+ } catch {
120
+ _parentCwd = null;
121
+ return null;
122
+ }
123
+ }
124
+
112
125
  function isCodeArtsContext() {
113
126
  return existsSync(join(process.cwd(), '.codeartsdoer')) || existsSync(join(homedir(), '.codeartsdoer'));
114
127
  }
115
128
 
116
129
  function readCodeArtsCredentials() {
117
- const searchPaths = [
118
- join(process.cwd(), '.codeartsdoer', 'mcp', 'mcp_settings.json'),
119
- join(homedir(), '.codeartsdoer', 'mcp', 'mcp_settings.json'),
120
- ];
130
+ const parentCwd = getParentCwd();
131
+ const searchDirs = [process.env.CODEARTS_PROJECT_DIR, parentCwd, process.cwd(), homedir()];
121
132
 
122
- for (const path of searchPaths) {
133
+ for (const dir of searchDirs) {
134
+ if (!dir) continue;
135
+ const path = join(dir, '.codeartsdoer', 'mcp', 'mcp_settings.json');
123
136
  try {
124
137
  if (!existsSync(path)) continue;
125
138
  const config = JSON.parse(readFileSync(path, 'utf8'));
@@ -6,6 +6,11 @@ import { fileURLToPath } from 'node:url';
6
6
 
7
7
  import { TOOL_DEFINITIONS, callTool } from './tools.mjs';
8
8
 
9
+ const projectDirIdx = process.argv.indexOf('--codearts-project-dir');
10
+ if (projectDirIdx > -1 && process.argv[projectDirIdx + 1]) {
11
+ process.env.CODEARTS_PROJECT_DIR = process.argv[projectDirIdx + 1];
12
+ }
13
+
9
14
  try {
10
15
  const { readProxyConfig } = await import('./proxy/proxy-config.mjs');
11
16
  const proxyConfig = readProxyConfig();
@@ -90,17 +90,19 @@ export async function hdkitCredentials(sessionId, devStageId, enableSts = true)
90
90
  return await hdkitRequest('POST', 'credentials', body);
91
91
  }
92
92
 
93
- export async function hdkitVoucherStatus() {
93
+ export async function hdkitVoucherStatus(domainId) {
94
94
  try {
95
- return await hdkitRequest('GET', 'voucher/status', undefined, 30000);
95
+ const path = domainId ? `voucher/status?domain_id=${encodeURIComponent(domainId)}` : 'voucher/status';
96
+ return await hdkitRequest('GET', path, undefined, 30000);
96
97
  } catch (error) {
97
98
  return { claimed: false, message: 'Incentive service unavailable, please try again later' };
98
99
  }
99
100
  }
100
101
 
101
- export async function hdkitVoucherClaim() {
102
+ export async function hdkitVoucherClaim(domainId) {
102
103
  try {
103
- return await hdkitRequest('POST', 'voucher/claim', {});
104
+ const body = domainId ? { domain_id: domainId } : {};
105
+ return await hdkitRequest('POST', 'voucher/claim', body);
104
106
  } catch (error) {
105
107
  return { claimed: false, message: 'Incentive service unavailable, please try again later' };
106
108
  }
@@ -651,7 +651,9 @@ export const TOOL_DEFINITIONS = [
651
651
  description: '查询激励金代金券领取状态。',
652
652
  inputSchema: {
653
653
  type: 'object',
654
- properties: {},
654
+ properties: {
655
+ domain_id: { type: 'string' },
656
+ },
655
657
  },
656
658
  },
657
659
  {
@@ -659,7 +661,9 @@ export const TOOL_DEFINITIONS = [
659
661
  description: '领取激励金代金券。领取前会自动检查是否已领取。',
660
662
  inputSchema: {
661
663
  type: 'object',
662
- properties: {},
664
+ properties: {
665
+ domain_id: { type: 'string' },
666
+ },
663
667
  },
664
668
  },
665
669
  ];
@@ -829,9 +833,9 @@ export async function callTool(name, args = {}) {
829
833
  case 'huaweicloud_sandbox_credentials':
830
834
  return await hdkitCredentials(args.session_id, args.dev_stage_id, args.enable_sts !== false);
831
835
  case 'huaweicloud_voucher_status':
832
- return await hdkitVoucherStatus();
836
+ return await hdkitVoucherStatus(args.domain_id);
833
837
  case 'huaweicloud_voucher_claim':
834
- return await hdkitVoucherClaim();
838
+ return await hdkitVoucherClaim(args.domain_id);
835
839
  default:
836
840
  throw new Error(`Unknown tool: ${name}`);
837
841
  }