@agentwonderland/mcp 0.1.44 → 0.1.45
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { formatRunResult } from "../formatters.js";
|
|
2
|
+
import { agentLine, formatRunResult } from "../formatters.js";
|
|
3
3
|
describe("formatRunResult", () => {
|
|
4
4
|
it("does not show a paid line for credit-pack-backed runs with zero cost", () => {
|
|
5
5
|
const output = formatRunResult({
|
|
@@ -23,3 +23,19 @@ describe("formatRunResult", () => {
|
|
|
23
23
|
expect(output).toContain("Job ID: job-123");
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
+
describe("agentLine", () => {
|
|
27
|
+
it("surfaces live rating count and completed job history from stats", () => {
|
|
28
|
+
const output = agentLine({
|
|
29
|
+
name: "People Enrichment",
|
|
30
|
+
slug: "people-enrichment",
|
|
31
|
+
avgRating: 5,
|
|
32
|
+
ratingCount: 1,
|
|
33
|
+
totalExecutions: 0,
|
|
34
|
+
stats: { completedJobs: 3, avgRating: 5, ratingCount: 1 },
|
|
35
|
+
pricePerRunUsd: "0.100000",
|
|
36
|
+
});
|
|
37
|
+
expect(output).toContain("★★★★★ 5.0 (1 review)");
|
|
38
|
+
expect(output).toContain("3 jobs");
|
|
39
|
+
expect(output).toContain("$0.10/req");
|
|
40
|
+
});
|
|
41
|
+
});
|
package/dist/core/formatters.js
CHANGED
|
@@ -42,13 +42,17 @@ export function agentLine(agent) {
|
|
|
42
42
|
const name = agent.name ?? "Unknown";
|
|
43
43
|
const slug = agent.slug ? ` (${agent.slug})` : "";
|
|
44
44
|
const rating = agent.avgRating ?? agent.stats?.avgRating ?? null;
|
|
45
|
+
const ratingCount = agent.ratingCount ?? agent.stats?.ratingCount ?? 0;
|
|
46
|
+
const ratingText = rating != null && ratingCount > 0
|
|
47
|
+
? `${stars(rating)} ${rating.toFixed(1)} (${compactNumber(ratingCount)} review${ratingCount === 1 ? "" : "s"})`
|
|
48
|
+
: stars(rating);
|
|
45
49
|
const jobs = agent.stats?.completedJobs ?? agent.totalExecutions ?? 0;
|
|
46
50
|
const price = formatPrice(agent.pricePerRunUsd);
|
|
47
51
|
const provider = agent.provider?.name ? ` by ${agent.provider.name}` : "";
|
|
48
52
|
const reliability = agent.successRate != null && Number(agent.successRate) < 1
|
|
49
53
|
? ` • ${(Number(agent.successRate) * 100).toFixed(0)}% reliable`
|
|
50
54
|
: "";
|
|
51
|
-
return `${name}${slug}${provider} ${
|
|
55
|
+
return `${name}${slug}${provider} ${ratingText} ${compactNumber(jobs)} jobs • ${price}${reliability}`;
|
|
52
56
|
}
|
|
53
57
|
export function formatLastActive(lastActiveAt) {
|
|
54
58
|
if (!lastActiveAt)
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { formatRunResult } from "../formatters.js";
|
|
2
|
+
import { agentLine, formatRunResult } from "../formatters.js";
|
|
3
3
|
|
|
4
4
|
describe("formatRunResult", () => {
|
|
5
5
|
it("does not show a paid line for credit-pack-backed runs with zero cost", () => {
|
|
@@ -27,3 +27,21 @@ describe("formatRunResult", () => {
|
|
|
27
27
|
expect(output).toContain("Job ID: job-123");
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
+
|
|
31
|
+
describe("agentLine", () => {
|
|
32
|
+
it("surfaces live rating count and completed job history from stats", () => {
|
|
33
|
+
const output = agentLine({
|
|
34
|
+
name: "People Enrichment",
|
|
35
|
+
slug: "people-enrichment",
|
|
36
|
+
avgRating: 5,
|
|
37
|
+
ratingCount: 1,
|
|
38
|
+
totalExecutions: 0,
|
|
39
|
+
stats: { completedJobs: 3, avgRating: 5, ratingCount: 1 },
|
|
40
|
+
pricePerRunUsd: "0.100000",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
expect(output).toContain("★★★★★ 5.0 (1 review)");
|
|
44
|
+
expect(output).toContain("3 jobs");
|
|
45
|
+
expect(output).toContain("$0.10/req");
|
|
46
|
+
});
|
|
47
|
+
});
|
package/src/core/formatters.ts
CHANGED
|
@@ -52,7 +52,7 @@ interface AgentLike {
|
|
|
52
52
|
ratingCount?: number;
|
|
53
53
|
totalExecutions?: number;
|
|
54
54
|
pricePerRunUsd?: string;
|
|
55
|
-
stats?: { completedJobs?: number; avgRating?: number | null };
|
|
55
|
+
stats?: { completedJobs?: number; avgRating?: number | null; ratingCount?: number };
|
|
56
56
|
provider?: { name?: string; slug?: string } | null;
|
|
57
57
|
[key: string]: unknown;
|
|
58
58
|
}
|
|
@@ -61,13 +61,17 @@ export function agentLine(agent: AgentLike): string {
|
|
|
61
61
|
const name = agent.name ?? "Unknown";
|
|
62
62
|
const slug = agent.slug ? ` (${agent.slug})` : "";
|
|
63
63
|
const rating = agent.avgRating ?? agent.stats?.avgRating ?? null;
|
|
64
|
+
const ratingCount = agent.ratingCount ?? agent.stats?.ratingCount ?? 0;
|
|
65
|
+
const ratingText = rating != null && ratingCount > 0
|
|
66
|
+
? `${stars(rating)} ${rating.toFixed(1)} (${compactNumber(ratingCount)} review${ratingCount === 1 ? "" : "s"})`
|
|
67
|
+
: stars(rating);
|
|
64
68
|
const jobs = agent.stats?.completedJobs ?? agent.totalExecutions ?? 0;
|
|
65
69
|
const price = formatPrice(agent.pricePerRunUsd);
|
|
66
70
|
const provider = agent.provider?.name ? ` by ${agent.provider.name}` : "";
|
|
67
71
|
const reliability = agent.successRate != null && Number(agent.successRate) < 1
|
|
68
72
|
? ` • ${(Number(agent.successRate) * 100).toFixed(0)}% reliable`
|
|
69
73
|
: "";
|
|
70
|
-
return `${name}${slug}${provider} ${
|
|
74
|
+
return `${name}${slug}${provider} ${ratingText} ${compactNumber(jobs)} jobs • ${price}${reliability}`;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
export function formatLastActive(lastActiveAt: string | null | undefined): string | null {
|