ability-cli 0.3.3 → 0.3.4

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/README.md CHANGED
@@ -130,7 +130,6 @@ ability-cli doctor
130
130
  | `--trace-id <id>` | `traceId`;未指定时自动生成 |
131
131
  | `--timeout <ms>` | 超时(毫秒);不传则用配置文件 `defaults.timeout`,再默认 `30000` |
132
132
  | `--response-type <type>` | `NONE` / `MCP` / `CONVERT`(可选) |
133
- | `--mock-token <token>` | 模拟调用 token(可选,测试) |
134
133
  | `--json` | 以 JSON 展示返回 `data` |
135
134
 
136
135
  ### 下层命令:`raw`
package/dist/index.js CHANGED
@@ -362,7 +362,7 @@ function registerExecCommand(program2) {
362
362
  program2.command("exec").description("\u6267\u884C\u80FD\u529B").addHelpText(
363
363
  "after",
364
364
  "\n\u63D0\u793A\uFF1A\u5FC5\u987B\u63D0\u4F9B --ability-id \u4E0E --tool-name \u4E8C\u8005\u4E4B\u4E00\uFF1B\u5176\u4F59\u9009\u9879\u8BF4\u660E\u4E2D\u5E26\u300C\u3010\u5FC5\u586B\u3011\u300D\u7684\u4E5F\u5FC5\u987B\u63D0\u4F9B\u3002\n"
365
- ).option("--ability-id <id>", "\u3010\u6761\u4EF6\u5FC5\u586B\u3011\u80FD\u529B ID\uFF1B\u4E0E --tool-name \u81F3\u5C11\u586B\u5176\u4E00").option("--tool-name <name>", "\u3010\u6761\u4EF6\u5FC5\u586B\u3011\u5DE5\u5177\u540D\uFF1B\u4E0E --ability-id \u81F3\u5C11\u586B\u5176\u4E00").option("--params <json>", "\u53C2\u6570 JSON \u5B57\u7B26\u4E32\u6216\u6587\u4EF6\u8DEF\u5F84").option("--device-id <id>", "\u8BBE\u5907ID").option("--message-id <id>", "messageId").option("--trace-id <id>", "traceId").option("--timeout <ms>", "\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\uFF1B\u4E0D\u4F20\u5219\u7528\u914D\u7F6E\u6587\u4EF6 defaults.timeout\uFF0C\u9ED8\u8BA4 30000").option("--response-type <type>", "\u8FD4\u56DE\u503C\u5904\u7406\u65B9\u5F0F: NONE | MCP | CONVERT").option("--json", "JSON \u8F93\u51FA").action(async (opts) => {
365
+ ).option("--ability-id <id>", "\u3010\u6761\u4EF6\u5FC5\u586B\u3011\u80FD\u529B ID\uFF1B\u4E0E --tool-name \u81F3\u5C11\u586B\u5176\u4E00").option("--tool-name <name>", "\u3010\u6761\u4EF6\u5FC5\u586B\u3011\u5DE5\u5177\u540D\uFF1B\u4E0E --ability-id \u81F3\u5C11\u586B\u5176\u4E00").option("--params <json>", "\u80FD\u529B\u5165\u53C2 params\uFF1AJSON \u5B57\u7B26\u4E32\u6216\u6587\u4EF6\u8DEF\u5F84").option("--device-id <id>", "\u8BF7\u6C42\u4F53 deviceId\uFF1B\u672A\u6307\u5B9A\u65F6\u7528\u5168\u5C40/\u73AF\u5883\u53D8\u91CF/\u914D\u7F6E\u89E3\u6790\u7ED3\u679C").option("--session-id <id>", "sessionId").option("--tool-call-id <id>", "toolCallId").option("--task-id <id>", "taskId").option("--message-id <id>", "messageId").option("--trace-id <id>", "traceId\uFF1B\u672A\u6307\u5B9A\u65F6\u81EA\u52A8\u751F\u6210").option("--timeout <ms>", "timeoutMillis\uFF08\u6BEB\u79D2\uFF09\uFF1B\u4E0D\u4F20\u5219\u7528 defaults.timeout\uFF0C\u9ED8\u8BA4 30000").option("--response-type <type>", "responseType\uFF1ANONE | MCP | CONVERT").option("--json", "JSON \u8F93\u51FA").action(async (opts) => {
366
366
  const merged = { ...program2.opts(), ...opts };
367
367
  const ctx = buildAgentRequestContext(merged);
368
368
  const cliCfg = loadConfig();
@@ -377,18 +377,17 @@ function registerExecCommand(program2) {
377
377
  }
378
378
  }
379
379
  const body = {
380
- traceId: opts.traceId ?? randomUUID().replace(/-/g, ""),
381
- sessionId: opts.sessionId ?? "",
382
- toolCallId: opts.toolCallId ?? "",
383
- taskId: opts.taskId ?? "",
384
- messageId: opts.messageId ?? "",
380
+ traceId: opts.traceId !== void 0 && String(opts.traceId).trim() !== "" ? String(opts.traceId).trim() : randomUUID().replace(/-/g, ""),
381
+ sessionId: opts.sessionId !== void 0 ? String(opts.sessionId) : "",
382
+ toolCallId: opts.toolCallId !== void 0 ? String(opts.toolCallId) : "",
383
+ taskId: opts.taskId !== void 0 ? String(opts.taskId) : "",
384
+ messageId: opts.messageId !== void 0 ? String(opts.messageId) : "",
385
385
  deviceId: ctx.deviceId ?? "",
386
386
  timeoutMillis,
387
387
  params
388
388
  };
389
389
  applyAbilityOrToolToPayload(opts, body);
390
390
  if (opts.responseType) body.responseType = opts.responseType;
391
- if (opts.mockToken) body.mockToken = opts.mockToken;
392
391
  const res = await apiPost(ctx, agentPath.abilityCall, body);
393
392
  handleApiResponse(res, opts.json, (data) => {
394
393
  printSuccess("\u80FD\u529B\u6267\u884C\u5B8C\u6210");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ability-cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "原子能力平台 CLI 工具",
5
5
  "repository": {
6
6
  "type": "git",