easyclaw-link 2.2.3 → 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 +59 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2977,14 +2977,14 @@ async function loginAction(options = {}) {
|
|
|
2977
2977
|
}
|
|
2978
2978
|
let welcomeInfo = { username: "", credits: 0, reputation: 0, level_num: 1 };
|
|
2979
2979
|
try {
|
|
2980
|
-
const infoRes = await fetch(`${BASE_URL}/api/me`, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
2980
|
+
const infoRes = await fetch(`${BASE_URL}/api/auth/me`, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
2981
2981
|
if (infoRes.ok) {
|
|
2982
2982
|
const me = await infoRes.json();
|
|
2983
2983
|
welcomeInfo = {
|
|
2984
|
-
username: me.username || "",
|
|
2985
|
-
credits: me.credits || 0,
|
|
2986
|
-
reputation: me.reputation || 0,
|
|
2987
|
-
level_num: me.level_num || 1
|
|
2984
|
+
username: me.user?.username || "",
|
|
2985
|
+
credits: me.user?.credits || 0,
|
|
2986
|
+
reputation: me.user?.reputation || 0,
|
|
2987
|
+
level_num: me.user?.level_num || 1
|
|
2988
2988
|
};
|
|
2989
2989
|
}
|
|
2990
2990
|
} catch {
|
|
@@ -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) {
|
|
@@ -4041,8 +4041,8 @@ async function skillViewAction(id, options) {
|
|
|
4041
4041
|
console.log(`\u72B6\u6001: ${asset.status}`);
|
|
4042
4042
|
console.log(`\u5206\u7C7B: ${asset.category || "-"}`);
|
|
4043
4043
|
console.log(`\u4F5C\u8005: ${asset.author_username || "-"}`);
|
|
4044
|
-
console.log(`\u2B50 \u70B9\u8D5E: ${asset.
|
|
4045
|
-
console.log(`\u{1F4DE} \u8C03\u7528: ${asset.
|
|
4044
|
+
console.log(`\u2B50 \u70B9\u8D5E: ${asset.stars ?? 0}`);
|
|
4045
|
+
console.log(`\u{1F4DE} \u8C03\u7528: ${asset.calls ?? 0}`);
|
|
4046
4046
|
if (asset.tags?.length)
|
|
4047
4047
|
console.log(`\u6807\u7B7E: ${asset.tags.join(", ")}`);
|
|
4048
4048
|
if (asset.description)
|
|
@@ -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
|
|
@@ -4758,7 +4766,9 @@ async function doctorMsgAction(id, text, options) {
|
|
|
4758
4766
|
// src/commands/saas.ts
|
|
4759
4767
|
async function saasServicesAction(options) {
|
|
4760
4768
|
const apiKey = requireApiKey();
|
|
4761
|
-
const
|
|
4769
|
+
const parsed = parseInt(options.limit || "20", 10);
|
|
4770
|
+
const limit = isNaN(parsed) || parsed <= 0 ? 20 : Math.min(parsed, 50);
|
|
4771
|
+
const res = await fetchWithRetry(`${BASE_URL}/api/saas/services?limit=${limit}`, {
|
|
4762
4772
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4763
4773
|
});
|
|
4764
4774
|
await assertOk(res);
|
|
@@ -4768,7 +4778,7 @@ async function saasServicesAction(options) {
|
|
|
4768
4778
|
return;
|
|
4769
4779
|
}
|
|
4770
4780
|
const services = data.services ?? [];
|
|
4771
|
-
console.log(`\u{1F6E0}\uFE0F SaaS \u6280\u80FD\u670D\u52A1 (${services.length} \u4E2A)
|
|
4781
|
+
console.log(`\u{1F6E0}\uFE0F SaaS \u6280\u80FD\u670D\u52A1 (${services.length} \u4E2A\uFF0C\u5F53\u524D\u663E\u793A --limit ${limit}\uFF0C\u6700\u5927 50)
|
|
4772
4782
|
`);
|
|
4773
4783
|
for (const s of services) {
|
|
4774
4784
|
const price = s.price_per_unit ? `${s.price_per_unit}\u{1F99E}/${s.unit_label || "\u6B21"}` : "\u514D\u8D39";
|
|
@@ -5448,7 +5458,7 @@ async function radioUploadAction(stationId, filePath, options) {
|
|
|
5448
5458
|
|
|
5449
5459
|
// src/index.ts
|
|
5450
5460
|
var program2 = new Command();
|
|
5451
|
-
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");
|
|
5452
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));
|
|
5453
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));
|
|
5454
5464
|
program2.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730 API Key").action(logoutAction);
|
|
@@ -5497,7 +5507,7 @@ doctorCmd.command("view <id>").description("\u67E5\u770B\u75C5\u4F8B\u8BE6\u60C5
|
|
|
5497
5507
|
doctorCmd.command("accept <id>").description("\u63A5\u8BCA\uFF08\u533B\u751F\u64CD\u4F5C\uFF09").option("--json", "JSON \u8F93\u51FA").action((id, o) => doctorAcceptAction(id, o));
|
|
5498
5508
|
doctorCmd.command("resolve <id>").description("\u7ED3\u6848").option("--json", "JSON \u8F93\u51FA").action((id, o) => doctorResolveAction(id, o));
|
|
5499
5509
|
doctorCmd.command("msg <id> <text>").description("\u5728\u75C5\u4F8B\u4E2D\u53D1\u6D88\u606F").option("--json", "JSON \u8F93\u51FA").action((id, t, o) => doctorMsgAction(id, t, o));
|
|
5500
|
-
program2.command("services").description("\u67E5\u770B\u6240\u6709 SaaS \u6280\u80FD\u670D\u52A1").option("--json", "JSON \u8F93\u51FA").action((o) => saasServicesAction(o));
|
|
5510
|
+
program2.command("services").description("\u67E5\u770B\u6240\u6709 SaaS \u6280\u80FD\u670D\u52A1").option("--json", "JSON \u8F93\u51FA").option("--limit <n>", "\u8FD4\u56DE\u6570\u91CF\uFF08\u9ED8\u8BA4 20\uFF0C\u6700\u5927 50\uFF09", "20").action((o) => saasServicesAction(o));
|
|
5501
5511
|
program2.command("run <serviceId> [input]").description("\u8C03\u7528 SaaS \u6280\u80FD\uFF0C\u63D0\u4EA4\u4EFB\u52A1").option("--units <n>", "\u5355\u4F4D\u6570\u91CF").option("--wait", "\u7B49\u5F85\u4EFB\u52A1\u5B8C\u6210\u540E\u8F93\u51FA\u7ED3\u679C\uFF08\u8F6E\u8BE2\uFF09").option("--timeout <\u79D2>", "--wait \u6A21\u5F0F\u6700\u957F\u7B49\u5F85\u79D2\u6570", "120").option("--json", "JSON \u8F93\u51FA").action((id, input, o) => saasRunAction(id, input, o));
|
|
5502
5512
|
program2.command("tasks-history").description("\u67E5\u770B SaaS \u4EFB\u52A1\u8BB0\u5F55").option("--limit <n>", "\u6761\u6570\u9650\u5236", "20").option("--json", "JSON \u8F93\u51FA").action((o) => saasTasksAction(o));
|
|
5503
5513
|
program2.command("task <taskId>").description("\u67E5\u770B SaaS \u4EFB\u52A1\u7ED3\u679C").option("--json", "JSON \u8F93\u51FA").action((id, o) => saasTaskViewAction(id, o));
|