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
refactor(openclaw-plugin): remove client-facade duplicates left by the seam refactor (#4720)
ralf0031cbc94824370
diff --git a/examples/openclaw-plugin/client.ts b/examples/openclaw-plugin/client.tsindex bfc99af2a..3ff7f1dd4 100644--- a/examples/openclaw-plugin/client.ts+++ b/examples/openclaw-plugin/client.ts@@ -1,12 +1,3 @@-import { randomUUID } from "node:crypto";-import { once } from "node:events";-import { createWriteStream } from "node:fs";-import { mkdtemp, readdir, readFile, rm, stat } from "node:fs/promises";-import { tmpdir } from "node:os";-import { basename, dirname, join, relative } from "node:path";--import { Zip, ZipDeflate } from "fflate";-import { defaultHttpTransport, type HttpTransport } from "./adapters/http-transport.js";import {defaultResourcePackager,@@ -255,23 +246,6 @@ function sleep(ms: number): Promise<void> {return new Promise((resolve) => setTimeout(resolve, ms));}-const MEMORY_URI_PATTERNS = [- /^viking:\/\/user\/(?:[^/]+\/)?memories(?:\/|$)/,-];-const REMOTE_RESOURCE_PREFIXES = ["http://", "https://", "git@", "ssh://", "git://"];--export function isMemoryUri(uri: string): boolean {- return MEMORY_URI_PATTERNS.some((pattern) => pattern.test(uri));-}--function isRemoteResourceSource(source: string): boolean {- return REMOTE_RESOURCE_PREFIXES.some((prefix) => source.startsWith(prefix));-}--function toBlobPart(value: Buffer): ArrayBuffer {- return value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength) as ArrayBuffer;-}-function resolveWaitRequestTimeoutMs(defaultTimeoutMs: number, waitTimeoutSeconds?: number): number {const requestedMs =typeof waitTimeoutSeconds === "number" && Number.isFinite(waitTimeoutSeconds) && waitTimeoutSeconds > 0@@ -280,14 +254,6 @@ function resolveWaitRequestTimeoutMs(defaultTimeoutMs: number, waitTimeoutSecondreturn Math.max(defaultTimeoutMs, requestedMs);}-async function cleanupUploadTempPath(path?: string): Promise<void> {- if (!path) {- return;- }- await rm(path, { force: true }).catch(() => undefined);- await rm(dirname(path), { recursive: true, force: true }).catch(() => undefined);-}-export class OpenVikingClient {private readonly transport: HttpTransport;private readonly configuredHeaders: Record<string, string>;@@ -685,63 +651,6 @@ export class OpenVikingClient {return result.temp_file_id;}- async zipDirectoryForUpload(dirPath: string): Promise<string> {- const rootStats = await stat(dirPath);- if (!rootStats.isDirectory()) {- throw new Error(`Not a directory: ${dirPath}`);- }-- const zipDir = await mkdtemp(join(tmpdir(), "openviking-openclaw-upload-"));- const zipPath = join(zipDir, `${basename(dirPath).replace(/[^a-zA-Z0-9._-]/g, "_")}-${randomUUID()}.zip`);- const output = createWriteStream(zipPath);- const outputClosed = once(output, "close");- const outputErrored = once(output, "error").then(([err]) => Promise.reject(err));- const zip = new Zip((err, chunk, final) => {- if (err) {- output.destroy(err);- return;- }- if (chunk?.length) {- output.write(Buffer.from(chunk));- }- if (final) {- output.end();- }- });-- const walk = async (currentDir: string) => {- const entries = await readdir(currentDir, { withFileTypes: true });- for (const entry of entries) {- const fullPath = join(currentDir, entry.name);- if (entry.isDirectory()) {- await walk(fullPath);- continue;- }- if (!entry.isFile()) {- continue;- }- const relPath = relative(dirPath, fullPath).replace(/\\/g, "/");- if (!relPath || relPath.startsWith("../") || relPath.includes("/../")) {- throw new Error(`Unsafe relative path while zipping: ${relPath}`);- }- const file = new ZipDeflate(relPath);- zip.add(file);- file.push(new Uint8Array(await readFile(fullPath)), true);- }- };- try {- await walk(dirPath);- zip.end();- await Promise.race([outputClosed, outputErrored]);- } catch (err) {- zip.terminate();- output.destroy(err as Error);- await cleanupUploadTempPath(zipPath);- throw err;- }- return zipPath;- }-async addResource(input: AddResourceInput, actorPeerId?: string): Promise<AddResourceResult> {const pathOrUrl = input.pathOrUrl.trim();if (!pathOrUrl) {diff --git a/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.ts b/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.tsindex 2194a9a59..6143efafe 100644--- a/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.ts+++ b/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.ts@@ -73,7 +73,7 @@ describe("architecture boundaries", () => {const violations = collectSourceFiles(join(rootDir, "tests"), [".ts", ".tsx", ".js", ".mjs", ".cjs"]).flatMap((file) => {const source = readFileSync(file, "utf8");- const relativePath = relative(rootDir, file);+ const relativePath = relative(rootDir, file).replace(/\\/g, "/");if (relativePath === "tests/ut/architecture-boundaries.test.ts") {return [];}