easyclaw-link 2.2.4 → 2.2.5
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 +47 -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,53 @@ 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
|
-
const a2aRes = await fetchWithRetry(
|
|
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 skill = await res.json();
|
|
4205
|
+
const authorUsername = skill.author_username;
|
|
4206
|
+
if (!authorUsername) {
|
|
4207
|
+
console.error(`\u274C \u65E0\u6CD5\u83B7\u53D6\u6280\u80FD\u4F5C\u8005\u4FE1\u606F\uFF0C\u6280\u80FD ID: ${id}`);
|
|
4208
|
+
process.exit(EXIT2.ERROR);
|
|
4221
4209
|
}
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4210
|
+
const input = opts.input || "";
|
|
4211
|
+
const timeout = parseInt(opts.timeout || "60", 10);
|
|
4212
|
+
const a2aRes = await fetchWithRetry(
|
|
4213
|
+
`${BASE_URL}/api/a2a/${authorUsername}`,
|
|
4214
|
+
{
|
|
4215
|
+
method: "POST",
|
|
4216
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
4217
|
+
signal: AbortSignal.timeout(timeout * 1e3),
|
|
4218
|
+
body: JSON.stringify({
|
|
4219
|
+
jsonrpc: "2.0",
|
|
4220
|
+
id: 1,
|
|
4221
|
+
method: "agent/call",
|
|
4222
|
+
params: { intent: "skills.use", skill_id: Number(id), input }
|
|
4223
|
+
})
|
|
4224
|
+
}
|
|
4225
|
+
);
|
|
4226
|
+
const result = await a2aRes.json();
|
|
4227
|
+
if (opts.json) {
|
|
4228
|
+
console.log(JSON.stringify(result));
|
|
4229
|
+
return;
|
|
4230
|
+
}
|
|
4231
|
+
if (result?.error) {
|
|
4232
|
+
console.error(`\u274C \u8C03\u7528\u5931\u8D25\uFF1A${result.error?.message ?? "\u672A\u77E5\u9519\u8BEF"}`);
|
|
4233
|
+
process.exit(EXIT2.ERROR);
|
|
4234
|
+
}
|
|
4235
|
+
const r = result?.result;
|
|
4236
|
+
console.log(`\u2705 \u6280\u80FD\u300C${skill.title || id}\u300D\u8C03\u7528\u6210\u529F`);
|
|
4237
|
+
if (r?.output)
|
|
4238
|
+
console.log("\n\u8F93\u51FA\uFF1A", r.output);
|
|
4239
|
+
else
|
|
4240
|
+
console.log(JSON.stringify(r, null, 2));
|
|
4241
|
+
} catch (err) {
|
|
4242
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
4243
|
+
console.error(`\u274C ecl skill call \u5931\u8D25\uFF1A${msg}`);
|
|
4244
|
+
process.exit(EXIT2.ERROR);
|
|
4231
4245
|
}
|
|
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
4246
|
}
|
|
4239
4247
|
|
|
4240
4248
|
// src/commands/help.ts
|
|
@@ -5450,7 +5458,7 @@ async function radioUploadAction(stationId, filePath, options) {
|
|
|
5450
5458
|
|
|
5451
5459
|
// src/index.ts
|
|
5452
5460
|
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.
|
|
5461
|
+
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.5");
|
|
5454
5462
|
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
5463
|
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
5464
|
program2.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730 API Key").action(logoutAction);
|