The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(e2e): serve a paged skill catalog and SKILL.md from the mock
oxoxDev892ed9f250c9
diff --git a/app/scripts/e2e-web-session.sh b/app/scripts/e2e-web-session.shindex dd511d4b1c..ff2bb22a97 100755--- a/app/scripts/e2e-web-session.sh+++ b/app/scripts/e2e-web-session.sh@@ -288,8 +288,12 @@ export OPENHUMAN_CORE_TOKEN="$PW_CORE_RPC_TOKEN"export OPENHUMAN_E2E=1# The skills registry defaults to a public HermesHub fetch. The browser E2E# lane must remain deterministic and offline, so serve its compact catalog-# fixture from the local mock backend instead.+# fixture from the local mock backend instead. The registry's fetch guard+# only allows plain http to loopback with the local-http escape hatch, and+# every SKILL.md is served from the same mock.export OPENHUMAN_SKILL_REGISTRY_CATALOG_URL="http://127.0.0.1:${E2E_MOCK_PORT}/skills/catalog.json"+export OPENHUMAN_SKILL_REGISTRY_DOWNLOAD_BASE_URL="http://127.0.0.1:${E2E_MOCK_PORT}/skills"+export OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP=1export OPENHUMAN_TELEGRAM_BOT_API_BASE="http://127.0.0.1:${E2E_MOCK_PORT}"export OPENHUMAN_COMPOSIO_DIRECT_BASE_V2="http://127.0.0.1:${E2E_MOCK_PORT}"export OPENHUMAN_COMPOSIO_DIRECT_BASE_V3="http://127.0.0.1:${E2E_MOCK_PORT}"diff --git a/scripts/mock-api/routes/__tests__/skill-registry.test.mjs b/scripts/mock-api/routes/__tests__/skill-registry.test.mjsnew file mode 100644index 0000000000..ade36df7dc--- /dev/null+++ b/scripts/mock-api/routes/__tests__/skill-registry.test.mjs@@ -0,0 +1,66 @@+/**+ * Unit tests for the mock skill-registry catalog and SKILL.md routes.+ *+ * Run via:+ * node --test scripts/mock-api/routes/__tests__/skill-registry.test.mjs+ */++import assert from "node:assert/strict";+import test from "node:test";++import { resetMockBehavior, setMockBehavior } from "../../state.mjs";+import { handleIntegrations } from "../integrations.mjs";++function createRes() {+ return {+ statusCode: 0,+ headers: {},+ body: "",+ writeHead(status, headers = {}) {+ this.statusCode = status;+ this.headers = { ...this.headers, ...headers };+ },+ setHeader(name, value) {+ this.headers[name] = value;+ },+ end(chunk = "") {+ this.body += String(chunk);+ },+ };+}++function get(path) {+ const ctx = { method: "GET", url: path, body: "", parsedBody: null, res: createRes() };+ const handled = handleIntegrations(ctx);+ return { handled, res: ctx.res };+}++test.beforeEach(() => {+ resetMockBehavior();+});++test("the catalog spans more than one 25-entry page", () => {+ const { handled, res } = get("/skills/catalog.json");+ assert.equal(handled, true);+ assert.equal(res.statusCode, 200);+ const entries = JSON.parse(res.body);+ assert.ok(entries.length > 25, `only ${entries.length} entries`);+ assert.ok(entries.some(entry => entry.name === "git-workflow"));+ assert.ok(entries.some(entry => entry.name === "docker-management"));+});++test("the catalog answers 503 while the registry is marked unavailable", () => {+ setMockBehavior("skillRegistryUnavailable", "true");+ const { res } = get("/skills/catalog.json");+ assert.equal(res.statusCode, 503);+});++test("each catalog entry has a SKILL.md and unknown names 404", () => {+ const found = get("/skills/git-workflow/SKILL.md");+ assert.equal(found.handled, true);+ assert.equal(found.res.statusCode, 200);+ assert.match(found.res.body, /^---\nname: git-workflow\n/);++ const missing = get("/skills/nope/SKILL.md");+ assert.equal(missing.res.statusCode, 404);+});diff --git a/scripts/mock-api/routes/integrations.mjs b/scripts/mock-api/routes/integrations.mjsindex 7b8affd539..209e376885 100644--- a/scripts/mock-api/routes/integrations.mjs+++ b/scripts/mock-api/routes/integrations.mjs@@ -3,8 +3,20 @@ import { behavior, parseBehaviorJson, setMockBehavior } from "../state.mjs";import { listMockLlmModels } from "./llm/shared.mjs";// The web E2E core must never fetch the public Hermes catalog. Keep the-// fixture small but representative: registry smoke tests need sources and-// browse results, while search tests need both `git` and `docker` matches.+// fixture representative: registry smoke tests need sources and browse+// results, search tests need both `git` and `docker` matches, and the+// explorer needs more than one 25-row page to exercise server paging.+const SKILL_REGISTRY_FILLER = Array.from({ length: 30 }, (_, i) => ({+ name: `fixture-skill-${String(i).padStart(2, "0")}`,+ description: "Registry paging fixture.",+ category: "productivity",+ source: "fixture-pack",+ tags: [],+ platforms: ["linux", "macos", "windows"],+ commands: [],+ envVars: [],+}));+const SKILL_REGISTRY_CATALOG = [{name: "git-workflow",@@ -28,17 +40,38 @@ const SKILL_REGISTRY_CATALOG = [commands: ["docker"],envVars: [],},+ ...SKILL_REGISTRY_FILLER,];+function skillRegistryDocument(name) {+ return `---\nname: ${name}\ndescription: Mock registry skill ${name}.\n---\n\n# ${name}\n`;+}+export function handleIntegrations(ctx) {const { method, url, parsedBody, res } = ctx;const mockBehavior = behavior();if (method === "GET" && /^\/skills\/catalog\.json\/?(?:\?.*)?$/.test(url)) {+ if (mockBehavior.skillRegistryUnavailable === "true") {+ json(res, 503, { success: false, error: "skill registry unavailable" });+ return true;+ }json(res, 200, SKILL_REGISTRY_CATALOG);return true;}+ const skillDocument = method === "GET" && url.match(/^\/skills\/([a-z0-9-]+)\/SKILL\.md(?:\?.*)?$/);+ if (skillDocument) {+ const name = skillDocument[1];+ if (!SKILL_REGISTRY_CATALOG.some(entry => entry.name === name)) {+ json(res, 404, { success: false, error: "no such skill" });+ return true;+ }+ res.writeHead(200, { "Content-Type": "text/markdown; charset=utf-8" });+ res.end(skillRegistryDocument(name));+ return true;+ }+// ── Telegram ───────────────────────────────────────────────if (method === "POST" && /^\/telegram\/command\/?$/.test(url)) {if (mockBehavior.telegramUnauthorized === "true") {