mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 22:14:34 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -4,10 +4,10 @@ import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { MoltbotPluginApi, MoltbotPluginToolContext } from "../../../src/plugins/types.js";
|
||||
import type { OpenClawPluginApi, OpenClawPluginToolContext } from "../../../src/plugins/types.js";
|
||||
import { createLobsterTool } from "./lobster-tool.js";
|
||||
|
||||
async function writeFakeLobsterScript(scriptBody: string, prefix = "moltbot-lobster-plugin-") {
|
||||
async function writeFakeLobsterScript(scriptBody: string, prefix = "openclaw-lobster-plugin-") {
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), prefix));
|
||||
const isWindows = process.platform === "win32";
|
||||
|
||||
@@ -33,7 +33,7 @@ async function writeFakeLobster(params: { payload: unknown }) {
|
||||
return await writeFakeLobsterScript(scriptBody);
|
||||
}
|
||||
|
||||
function fakeApi(): MoltbotPluginApi {
|
||||
function fakeApi(): OpenClawPluginApi {
|
||||
return {
|
||||
id: "lobster",
|
||||
name: "lobster",
|
||||
@@ -52,7 +52,7 @@ function fakeApi(): MoltbotPluginApi {
|
||||
};
|
||||
}
|
||||
|
||||
function fakeCtx(overrides: Partial<MoltbotPluginToolContext> = {}): MoltbotPluginToolContext {
|
||||
function fakeCtx(overrides: Partial<OpenClawPluginToolContext> = {}): OpenClawPluginToolContext {
|
||||
return {
|
||||
config: {} as any,
|
||||
workspaceDir: "/tmp",
|
||||
@@ -89,7 +89,7 @@ describe("lobster plugin tool", () => {
|
||||
`const payload = ${JSON.stringify(payload)};\n` +
|
||||
`console.log("noise before json");\n` +
|
||||
`process.stdout.write(JSON.stringify(payload));\n`,
|
||||
"moltbot-lobster-plugin-noisy-",
|
||||
"openclaw-lobster-plugin-noisy-",
|
||||
);
|
||||
|
||||
const tool = createLobsterTool(fakeApi());
|
||||
@@ -117,7 +117,7 @@ describe("lobster plugin tool", () => {
|
||||
it("rejects invalid JSON from lobster", async () => {
|
||||
const { binPath } = await writeFakeLobsterScript(
|
||||
`process.stdout.write("nope");\n`,
|
||||
"moltbot-lobster-plugin-bad-",
|
||||
"openclaw-lobster-plugin-bad-",
|
||||
);
|
||||
|
||||
const tool = createLobsterTool(fakeApi());
|
||||
@@ -132,7 +132,7 @@ describe("lobster plugin tool", () => {
|
||||
|
||||
it("can be gated off in sandboxed contexts", async () => {
|
||||
const api = fakeApi();
|
||||
const factoryTool = (ctx: MoltbotPluginToolContext) => {
|
||||
const factoryTool = (ctx: OpenClawPluginToolContext) => {
|
||||
if (ctx.sandboxed) return null;
|
||||
return createLobsterTool(api);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user