Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
test(opencode): make plugin path assertions portable (#5562)
LIb35c3f2aae5a
diff --git a/examples/opencode-plugin/tests/mcp-config.test.mjs b/examples/opencode-plugin/tests/mcp-config.test.mjsindex f4a9f111e..e2592d1fa 100644--- a/examples/opencode-plugin/tests/mcp-config.test.mjs+++ b/examples/opencode-plugin/tests/mcp-config.test.mjs@@ -2,7 +2,7 @@ import test from "node:test"import assert from "node:assert/strict"import { readFile } from "node:fs/promises"import { fileURLToPath } from "node:url"-import { dirname, join } from "node:path"+import { dirname, join, resolve } from "node:path"import { createOpenVikingMcpConfig, createOpenVikingV2McpConfig, injectOpenVikingMcpConfig, injectOpenVikingSkillPaths } from "../lib/mcp-config.mjs"const testDir = dirname(fileURLToPath(import.meta.url))@@ -13,7 +13,7 @@ test("injectOpenVikingMcpConfig registers a local stdio MCP server", () => {assert.equal(injectOpenVikingMcpConfig(config, "/tmp/openviking-plugin"), true)assert.deepEqual(config.mcp.openviking, {type: "local",- command: ["node", "/tmp/openviking-plugin/servers/mcp-proxy.mjs"],+ command: ["node", resolve("/tmp/openviking-plugin", "servers", "mcp-proxy.mjs")],enabled: true,timeout: 15000,})@@ -40,7 +40,7 @@ test("injectOpenVikingSkillPaths appends the bundled skills directory once", ()assert.equal(injectOpenVikingSkillPaths(config, "/tmp/openviking-plugin"), true)injectOpenVikingSkillPaths(config, "/tmp/openviking-plugin")- assert.deepEqual(config.skills.paths, [".opencode/skills", "/tmp/openviking-plugin/skills"])+ assert.deepEqual(config.skills.paths, [".opencode/skills", resolve("/tmp/openviking-plugin", "skills")])})test("OpenCode plugin adds its skills only after registering the MCP server", async () => {@@ -72,7 +72,7 @@ test("OpenCode MCP config points to the proxy entrypoint", () => {assert.equal(entry.type, "local")assert.equal(entry.command[0], "node")- assert.match(entry.command[1], /servers\/mcp-proxy\.mjs$/)+ assert.match(entry.command[1], /servers[\\/]mcp-proxy\.mjs$/)})test("OpenCode v2 MCP config uses the local server schema", () => {@@ -80,7 +80,7 @@ test("OpenCode v2 MCP config uses the local server schema", () => {assert.equal(entry.type, "local")assert.equal(entry.command[0], "node")- assert.match(entry.command[1], /servers\/mcp-proxy\.mjs$/)+ assert.match(entry.command[1], /servers[\\/]mcp-proxy\.mjs$/)assert.equal(entry.enabled, undefined)assert.equal(entry.codemode, false)assert.deepEqual(entry.timeout, { startup: 15000, catalog: 15000, execution: 15000 })diff --git a/examples/opencode-plugin/tests/v2-plugin.test.mjs b/examples/opencode-plugin/tests/v2-plugin.test.mjsindex 6c384c10a..23b93714d 100644--- a/examples/opencode-plugin/tests/v2-plugin.test.mjs+++ b/examples/opencode-plugin/tests/v2-plugin.test.mjs@@ -1,5 +1,6 @@import test from "node:test"import assert from "node:assert/strict"+import { resolve } from "node:path"import { captureV2Context, injectV2Context, prepareV2Prompt, startV2Plugin } from "../lib/v2-plugin.mjs"import { createVikingUriNotice } from "../lib/viking-uri-guard.mjs"@@ -62,7 +63,7 @@ test("startV2Plugin registers direct MCP tools and all v2 hooks", async () => {const { ctx, hooks, registered, skillSources } = contextFixture()const cleanup = await startV2Plugin(ctx, runtime, { pluginRoot: "/tmp/ov" })- assert.deepEqual(skillSources, [{ type: "directory", path: "/tmp/ov/skills" }])+ assert.deepEqual(skillSources, [{ type: "directory", path: resolve("/tmp/ov", "skills") }])assert.equal(registered[0][0], "openviking")assert.equal(registered[0][1].type, "local")assert.equal(registered[0][1].codemode, false)