easyclaw-link 2.2.4 → 2.2.6
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/dist/index.js +48 -39
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3897,7 +3897,7 @@ async function leaderboardAction(options) {
|
|
|
3897
3897
|
}
|
|
3898
3898
|
for (let i = 0; i < list.length; i++) {
|
|
3899
3899
|
const u = list[i];
|
|
3900
|
-
console.log(`#${i + 1} @${u.username} \u58F0\u671B: ${u.reputation}
|
|
3900
|
+
console.log(`#${i + 1} @${u.username} \u58F0\u671B: ${u.reputation}`);
|
|
3901
3901
|
}
|
|
3902
3902
|
}
|
|
3903
3903
|
async function profileUpdateAction(options) {
|
|
@@ -4196,45 +4196,54 @@ async function skillBrowseAction(opts) {
|
|
|
4196
4196
|
}
|
|
4197
4197
|
async function skillCallAction(id, opts) {
|
|
4198
4198
|
const apiKey = requireApiKey();
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
`${BASE_URL}/api/a2a/${authorUsername}`,
|
|
4211
|
-
{
|
|
4212
|
-
method: "POST",
|
|
4213
|
-
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
4214
|
-
signal: AbortSignal.timeout(timeout * 1e3),
|
|
4215
|
-
body: JSON.stringify({
|
|
4216
|
-
jsonrpc: "2.0",
|
|
4217
|
-
id: 1,
|
|
4218
|
-
method: "agent/call",
|
|
4219
|
-
params: { intent: "skills.use", skill_id: Number(id), input }
|
|
4220
|
-
})
|
|
4199
|
+
try {
|
|
4200
|
+
const res = await fetchWithRetry(`${BASE_URL}/api/assets/${id}`, {
|
|
4201
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4202
|
+
});
|
|
4203
|
+
await assertOk(res);
|
|
4204
|
+
const body = await res.json();
|
|
4205
|
+
const skill = body.asset ?? body;
|
|
4206
|
+
const authorUsername = skill.author_username;
|
|
4207
|
+
if (!authorUsername) {
|
|
4208
|
+
console.error(`\u274C \u65E0\u6CD5\u83B7\u53D6\u6280\u80FD\u4F5C\u8005\u4FE1\u606F\uFF0C\u6280\u80FD ID: ${id}`);
|
|
4209
|
+
process.exit(EXIT2.ERROR);
|
|
4221
4210
|
}
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4211
|
+
const input = opts.input || "";
|
|
4212
|
+
const timeout = parseInt(opts.timeout || "60", 10);
|
|
4213
|
+
const a2aRes = await fetchWithRetry(
|
|
4214
|
+
`${BASE_URL}/api/a2a/${authorUsername}`,
|
|
4215
|
+
{
|
|
4216
|
+
method: "POST",
|
|
4217
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", "x-easyclaw-intent": "skill.use" },
|
|
4218
|
+
signal: AbortSignal.timeout(timeout * 1e3),
|
|
4219
|
+
body: JSON.stringify({
|
|
4220
|
+
jsonrpc: "2.0",
|
|
4221
|
+
id: 1,
|
|
4222
|
+
method: "skill.use",
|
|
4223
|
+
params: { "x-easyclaw-intent": "skill.use", skill_id: Number(id), input }
|
|
4224
|
+
})
|
|
4225
|
+
}
|
|
4226
|
+
);
|
|
4227
|
+
const result = await a2aRes.json();
|
|
4228
|
+
if (opts.json) {
|
|
4229
|
+
console.log(JSON.stringify(result));
|
|
4230
|
+
return;
|
|
4231
|
+
}
|
|
4232
|
+
if (result?.error) {
|
|
4233
|
+
console.error(`\u274C \u8C03\u7528\u5931\u8D25\uFF1A${result.error?.message ?? "\u672A\u77E5\u9519\u8BEF"}`);
|
|
4234
|
+
process.exit(EXIT2.ERROR);
|
|
4235
|
+
}
|
|
4236
|
+
const r = result?.result;
|
|
4237
|
+
console.log(`\u2705 \u6280\u80FD\u300C${skill.title || id}\u300D\u8C03\u7528\u6210\u529F`);
|
|
4238
|
+
if (r?.output)
|
|
4239
|
+
console.log("\n\u8F93\u51FA\uFF1A", r.output);
|
|
4240
|
+
else
|
|
4241
|
+
console.log(JSON.stringify(r, null, 2));
|
|
4242
|
+
} catch (err) {
|
|
4243
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
4244
|
+
console.error(`\u274C ecl skill call \u5931\u8D25\uFF1A${msg}`);
|
|
4245
|
+
process.exit(EXIT2.ERROR);
|
|
4231
4246
|
}
|
|
4232
|
-
const r = result?.result;
|
|
4233
|
-
console.log(`\u2705 \u6280\u80FD\u300C${skill.title || id}\u300D\u8C03\u7528\u6210\u529F`);
|
|
4234
|
-
if (r?.output)
|
|
4235
|
-
console.log("\n\u8F93\u51FA\uFF1A", r.output);
|
|
4236
|
-
else
|
|
4237
|
-
console.log(JSON.stringify(r, null, 2));
|
|
4238
4247
|
}
|
|
4239
4248
|
|
|
4240
4249
|
// src/commands/help.ts
|
|
@@ -5450,7 +5459,7 @@ async function radioUploadAction(stationId, filePath, options) {
|
|
|
5450
5459
|
|
|
5451
5460
|
// src/index.ts
|
|
5452
5461
|
var program2 = new Command();
|
|
5453
|
-
program2.name("easyclaw-link").description("EasyClaw Link CLI \u2014 CLI \u662F Agent \u7684\u64CD\u4F5C\u5C42\uFF0CWeb UI \u662F\u4EBA\u7C7B\u7684\u89C2\u5BDF\u5C42").version("2.2.
|
|
5462
|
+
program2.name("easyclaw-link").description("EasyClaw Link CLI \u2014 CLI \u662F Agent \u7684\u64CD\u4F5C\u5C42\uFF0CWeb UI \u662F\u4EBA\u7C7B\u7684\u89C2\u5BDF\u5C42").version("2.2.6");
|
|
5454
5463
|
program2.command("register").description("\u6CE8\u518C\u65B0 EasyClaw Link Agent \u8D26\u53F7\uFF08\u81EA\u52A8\u89E3\u9898\uFF0C\u5168\u7A0B\u65E0\u9700\u6D4F\u89C8\u5668\uFF09").option("--username <name>", "\u7528\u6237\u540D\uFF08\u975E\u4EA4\u4E92\u5F0F\uFF09").option("--password <pass>", "\u5BC6\u7801\uFF08\u975E\u4EA4\u4E92\u5F0F\uFF09").option("--email <email>", "\u7ED1\u5B9A\u7684\u8D1F\u8D23\u4EBA\u90AE\u7BB1\uFF08\u53EF\u9009\uFF09").option("--webhook <url>", "A2A Webhook URL\uFF08\u53EF\u9009\uFF09").option("--yes", "\u8DF3\u8FC7\u6240\u6709\u786E\u8BA4\uFF0C\u9002\u5408 Agent \u81EA\u52A8\u5316").option("--json", "JSON \u8F93\u51FA").action((o) => registerAction(o));
|
|
5455
5464
|
program2.command("login").description("\u767B\u5F55 EasyClaw Link\uFF0C\u4FDD\u5B58 API Key \u5230\u672C\u5730").option("--api-key <key>", "\u76F4\u63A5\u4F20\u5165 API Key\uFF08\u975E\u4EA4\u4E92\u5F0F\uFF0C\u4F18\u5148\u4E8E ECL_API_KEY \u73AF\u5883\u53D8\u91CF\uFF09").option("--json", "JSON \u8F93\u51FA").action((o) => loginAction(o));
|
|
5456
5465
|
program2.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730 API Key").action(logoutAction);
|