vskill 0.5.142 → 0.5.143
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/agents.json +1 -1
- package/dist/eval-server/api-routes.d.ts +18 -0
- package/dist/eval-server/api-routes.js +86 -0
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-ui/assets/{CommandPalette-D42KauW9.js → CommandPalette-CEp1wNr0.js} +1 -1
- package/dist/eval-ui/assets/{CreateSkillPage-BWoyQQ0n.js → CreateSkillPage-DZSf85Db.js} +1 -1
- package/dist/eval-ui/assets/{FindSkillsPalette-BtyebylE.js → FindSkillsPalette-CvN0J9-i.js} +2 -2
- package/dist/eval-ui/assets/{SearchPaletteCore-9ObzwMtM.js → SearchPaletteCore-BLRubqQS.js} +1 -1
- package/dist/eval-ui/assets/{SkillDetailPanel-8XS9hdR_.js → SkillDetailPanel-Bb0NxXCs.js} +1 -1
- package/dist/eval-ui/assets/UpdateDropdown-Bl3VyBRb.js +1 -0
- package/dist/eval-ui/assets/index-5lXKRaDO.js +122 -0
- package/dist/eval-ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/eval-ui/assets/UpdateDropdown-D0dHy9y-.js +0 -1
- package/dist/eval-ui/assets/index-DUUmBJUa.js +0 -120
package/agents.json
CHANGED
|
@@ -43,6 +43,24 @@ export interface AgentsResponse {
|
|
|
43
43
|
consumers: string[];
|
|
44
44
|
}>;
|
|
45
45
|
}
|
|
46
|
+
export interface PlatformHealth {
|
|
47
|
+
degraded: boolean;
|
|
48
|
+
reason: string | null;
|
|
49
|
+
statsAgeMs: number;
|
|
50
|
+
oldestActiveAgeMs: number;
|
|
51
|
+
}
|
|
52
|
+
/** Test hook — clear the 60 s cache so the next computePlatformHealth re-fetches. */
|
|
53
|
+
export declare function resetPlatformHealthCache(): void;
|
|
54
|
+
/**
|
|
55
|
+
* 0778 — Compute platform health by probing two upstream verified-skill.com
|
|
56
|
+
* endpoints. Bounded by a 1500 ms timeout. Errors of any kind return the
|
|
57
|
+
* safe fallback so the studio never amber-flashes on user wifi blips.
|
|
58
|
+
*/
|
|
59
|
+
export declare function computePlatformHealth(opts?: {
|
|
60
|
+
fetchImpl?: typeof fetch;
|
|
61
|
+
/** Test-only: bypass the in-memory cache. */
|
|
62
|
+
skipCache?: boolean;
|
|
63
|
+
}): Promise<PlatformHealth>;
|
|
46
64
|
/** Test hook — clear the 30 s cache so the next buildAgentsResponse() re-scans. */
|
|
47
65
|
export declare function resetAgentPresenceCache(): void;
|
|
48
66
|
interface BuildAgentsOptions {
|
|
@@ -66,6 +66,81 @@ export function buildInstalledAgentsResponse(detectedAgents) {
|
|
|
66
66
|
}
|
|
67
67
|
let agentPresenceCache = null;
|
|
68
68
|
const AGENT_PRESENCE_CACHE_TTL = 30_000;
|
|
69
|
+
const PLATFORM_HEALTH_CACHE_TTL = 60_000;
|
|
70
|
+
const PLATFORM_HEALTH_TIMEOUT_MS = 1500;
|
|
71
|
+
const PLATFORM_HEARTBEAT_STALE_MS = 30 * 60 * 1000;
|
|
72
|
+
const PLATFORM_OLDEST_ACTIVE_STALE_MS = 24 * 60 * 60 * 1000;
|
|
73
|
+
let platformHealthCache = null;
|
|
74
|
+
/** Test hook — clear the 60 s cache so the next computePlatformHealth re-fetches. */
|
|
75
|
+
export function resetPlatformHealthCache() {
|
|
76
|
+
platformHealthCache = null;
|
|
77
|
+
}
|
|
78
|
+
function formatDuration(ms) {
|
|
79
|
+
if (ms < 60_000)
|
|
80
|
+
return `${Math.round(ms / 1000)}s`;
|
|
81
|
+
if (ms < 3_600_000)
|
|
82
|
+
return `${Math.round(ms / 60_000)}m`;
|
|
83
|
+
if (ms < 86_400_000) {
|
|
84
|
+
const h = Math.floor(ms / 3_600_000);
|
|
85
|
+
const m = Math.round((ms % 3_600_000) / 60_000);
|
|
86
|
+
return m > 0 ? `${h}h ${m}m` : `${h}h`;
|
|
87
|
+
}
|
|
88
|
+
return `${Math.round(ms / 86_400_000)}d`;
|
|
89
|
+
}
|
|
90
|
+
const SAFE_FALLBACK = {
|
|
91
|
+
degraded: false,
|
|
92
|
+
reason: "platform-unreachable",
|
|
93
|
+
statsAgeMs: 0,
|
|
94
|
+
oldestActiveAgeMs: 0,
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* 0778 — Compute platform health by probing two upstream verified-skill.com
|
|
98
|
+
* endpoints. Bounded by a 1500 ms timeout. Errors of any kind return the
|
|
99
|
+
* safe fallback so the studio never amber-flashes on user wifi blips.
|
|
100
|
+
*/
|
|
101
|
+
export async function computePlatformHealth(opts = {}) {
|
|
102
|
+
const f = opts.fetchImpl ?? fetch;
|
|
103
|
+
const now = Date.now();
|
|
104
|
+
if (!opts.skipCache &&
|
|
105
|
+
platformHealthCache &&
|
|
106
|
+
now - platformHealthCache.ts < PLATFORM_HEALTH_CACHE_TTL) {
|
|
107
|
+
return platformHealthCache.data;
|
|
108
|
+
}
|
|
109
|
+
let result;
|
|
110
|
+
try {
|
|
111
|
+
const signal = AbortSignal.timeout(PLATFORM_HEALTH_TIMEOUT_MS);
|
|
112
|
+
const [statsRes, queueRes] = await Promise.all([
|
|
113
|
+
f("https://verified-skill.com/api/v1/submissions/stats", { signal }),
|
|
114
|
+
f("https://verified-skill.com/api/v1/queue/health", { signal }),
|
|
115
|
+
]);
|
|
116
|
+
if (!statsRes.ok || !queueRes.ok)
|
|
117
|
+
throw new Error("upstream non-2xx");
|
|
118
|
+
const stats = (await statsRes.json());
|
|
119
|
+
const queue = (await queueRes.json());
|
|
120
|
+
const statsAgeMs = Number(queue.statsAge?.ageMs ?? 0);
|
|
121
|
+
const oldestActiveAgeMs = Number(queue.oldestActive?.ageMs ?? 0);
|
|
122
|
+
const reasons = [];
|
|
123
|
+
if (stats.degraded === true)
|
|
124
|
+
reasons.push("platform reports degraded");
|
|
125
|
+
if (statsAgeMs > PLATFORM_HEARTBEAT_STALE_MS) {
|
|
126
|
+
reasons.push(`heartbeat stale ${formatDuration(statsAgeMs)}`);
|
|
127
|
+
}
|
|
128
|
+
if (oldestActiveAgeMs > PLATFORM_OLDEST_ACTIVE_STALE_MS) {
|
|
129
|
+
reasons.push(`oldest active submission ${formatDuration(oldestActiveAgeMs)}`);
|
|
130
|
+
}
|
|
131
|
+
result = {
|
|
132
|
+
degraded: reasons.length > 0,
|
|
133
|
+
reason: reasons.length > 0 ? reasons.join("; ") : null,
|
|
134
|
+
statsAgeMs,
|
|
135
|
+
oldestActiveAgeMs,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
result = { ...SAFE_FALLBACK };
|
|
140
|
+
}
|
|
141
|
+
platformHealthCache = { data: result, ts: now };
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
69
144
|
/** Test hook — clear the 30 s cache so the next buildAgentsResponse() re-scans. */
|
|
70
145
|
export function resetAgentPresenceCache() {
|
|
71
146
|
agentPresenceCache = null;
|
|
@@ -1654,6 +1729,17 @@ export function registerRoutes(router, root, projectName) {
|
|
|
1654
1729
|
// `localSkill` so the Studio's bell dropdown can render tooltips and route
|
|
1655
1730
|
// smart clicks via `revealSkill` instead of guessing local fs identifiers
|
|
1656
1731
|
// from the canonical platform name.
|
|
1732
|
+
// 0778 — Platform health proxy. Returns a small JSON shape the bell uses
|
|
1733
|
+
// to surface upstream-degraded state. NEVER throws; failure → safe fallback.
|
|
1734
|
+
router.get("/api/platform/health", async (req, res) => {
|
|
1735
|
+
try {
|
|
1736
|
+
const data = await computePlatformHealth();
|
|
1737
|
+
sendJson(res, data, 200, req);
|
|
1738
|
+
}
|
|
1739
|
+
catch {
|
|
1740
|
+
sendJson(res, { ...SAFE_FALLBACK }, 200, req);
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1657
1743
|
router.get("/api/skills/updates", async (req, res) => {
|
|
1658
1744
|
try {
|
|
1659
1745
|
const { getOutdatedJson } = await import("../commands/outdated.js");
|