feat(FN-2347): add experimental OpenClaw runtime plugin scaffold
- Add fusion-plugin-openclaw-runtime workspace package with manifest, runtime metadata, and deferred placeholder factory - Add unit tests for OpenClaw plugin behavior and PluginRunner runtime discovery compatibility - Document OpenClaw runtime installation and runtimeHint usage in README, getting-started, and settings reference docs - Include built dist artifacts for the new plugin and update workspace/lockfile entries
This commit is contained in:
2
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.d.ts
vendored
Normal file
2
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=index.test.d.ts.map
|
||||
1
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.d.ts.map
vendored
Normal file
1
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.d.ts.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
|
||||
92
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.js
vendored
Normal file
92
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.js
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import plugin, { openclawRuntimeMetadata, openclawRuntimeFactory, OPENCLAW_RUNTIME_ID } from "../index.js";
|
||||
function createMockContext(overrides = {}) {
|
||||
return {
|
||||
pluginId: "fusion-plugin-openclaw-runtime",
|
||||
settings: {},
|
||||
logger: {
|
||||
info: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
debug: vi.fn(),
|
||||
},
|
||||
emitEvent: vi.fn(),
|
||||
taskStore: {
|
||||
getTask: vi.fn(),
|
||||
},
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
describe("openclaw-runtime plugin", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
describe("plugin manifest identity", () => {
|
||||
it("should have correct manifest fields", () => {
|
||||
expect(plugin.manifest.id).toBe("fusion-plugin-openclaw-runtime");
|
||||
expect(plugin.manifest.name).toBe("OpenClaw Runtime Plugin");
|
||||
expect(plugin.manifest.version).toBe("0.1.0");
|
||||
expect(plugin.manifest.description).toContain("OpenClaw");
|
||||
expect(plugin.manifest.author).toBe("Fusion Team");
|
||||
expect(plugin.state).toBe("installed");
|
||||
});
|
||||
});
|
||||
describe("runtime registration", () => {
|
||||
it("should register openclaw runtime metadata", () => {
|
||||
expect(plugin.runtime).toBeDefined();
|
||||
expect(plugin.runtime?.metadata.runtimeId).toBe(OPENCLAW_RUNTIME_ID);
|
||||
expect(plugin.runtime?.metadata.name).toBe("OpenClaw Runtime");
|
||||
expect(plugin.runtime?.metadata.description).toContain("execution deferred");
|
||||
expect(plugin.runtime?.metadata.version).toBe("0.1.0");
|
||||
});
|
||||
it("should have consistent runtime metadata between export and manifest", () => {
|
||||
expect(plugin.manifest.runtime).toEqual(openclawRuntimeMetadata);
|
||||
expect(plugin.runtime?.metadata).toEqual(openclawRuntimeMetadata);
|
||||
});
|
||||
});
|
||||
describe("hooks", () => {
|
||||
it("onLoad should log startup message and emit loaded event", async () => {
|
||||
const ctx = createMockContext();
|
||||
await plugin.hooks.onLoad?.(ctx);
|
||||
expect(ctx.logger.info).toHaveBeenCalledWith(expect.stringContaining("OpenClaw Runtime Plugin loaded"));
|
||||
expect(ctx.emitEvent).toHaveBeenCalledWith("openclaw-runtime:loaded", {
|
||||
runtimeId: OPENCLAW_RUNTIME_ID,
|
||||
version: "0.1.0",
|
||||
status: "deferred",
|
||||
});
|
||||
});
|
||||
it("onUnload should not throw", () => {
|
||||
expect(() => plugin.hooks.onUnload?.()).not.toThrow();
|
||||
});
|
||||
});
|
||||
describe("deferred runtime behavior", () => {
|
||||
it("should export runtime constants", () => {
|
||||
expect(OPENCLAW_RUNTIME_ID).toBe("openclaw");
|
||||
expect(openclawRuntimeMetadata.runtimeId).toBe("openclaw");
|
||||
expect(typeof openclawRuntimeFactory).toBe("function");
|
||||
});
|
||||
it("runtime factory should return placeholder runtime shape", () => {
|
||||
const runtime = openclawRuntimeFactory(createMockContext());
|
||||
expect(runtime).toMatchObject({
|
||||
runtimeId: "openclaw",
|
||||
version: "0.1.0",
|
||||
status: "deferred",
|
||||
});
|
||||
expect(runtime).toHaveProperty("message");
|
||||
expect(String(runtime.message)).toContain("discovery and configuration only");
|
||||
expect(String(runtime.message)).not.toContain("FN-");
|
||||
});
|
||||
it("runtime execute should reject with deferred/not-implemented error", async () => {
|
||||
const runtime = openclawRuntimeFactory(createMockContext());
|
||||
await expect(runtime.execute()).rejects.toThrow("not implemented");
|
||||
await expect(runtime.execute()).rejects.toThrow("deferred");
|
||||
});
|
||||
it("factory creation should not throw", () => {
|
||||
expect(() => openclawRuntimeFactory(createMockContext())).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=index.test.js.map
|
||||
1
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.js.map
vendored
Normal file
1
plugins/fusion-plugin-openclaw-runtime/dist/__tests__/index.test.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,MAAM,EAAE,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAmB3G,SAAS,iBAAiB,CAAC,YAAkC,EAAE;IAC7D,OAAO;QACL,QAAQ,EAAE,gCAAgC;QAC1C,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE;YACN,IAAI,EAAE,EAAE,CAA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QACvD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mEAAmE,EAAE,KAAK,IAAI,EAAE;YACjF,MAAM,OAAO,GAAG,sBAAsB,CAAC,iBAAiB,EAAS,CAAsC,CAAC;YACxG,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YACnE,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC,iBAAiB,EAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
14
plugins/fusion-plugin-openclaw-runtime/dist/index.d.ts
vendored
Normal file
14
plugins/fusion-plugin-openclaw-runtime/dist/index.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* OpenClaw Runtime Plugin
|
||||
*
|
||||
* Registers an experimental OpenClaw runtime with Fusion's plugin runtime
|
||||
* discovery pipeline. Runtime execution behavior is intentionally deferred.
|
||||
*/
|
||||
import type { FusionPlugin, PluginRuntimeFactory, PluginRuntimeManifestMetadata } from "@fusion/plugin-sdk";
|
||||
declare const OPENCLAW_RUNTIME_ID = "openclaw";
|
||||
declare const openclawRuntimeMetadata: PluginRuntimeManifestMetadata;
|
||||
declare const openclawRuntimeFactory: PluginRuntimeFactory;
|
||||
declare const plugin: FusionPlugin;
|
||||
export default plugin;
|
||||
export { openclawRuntimeMetadata, openclawRuntimeFactory, OPENCLAW_RUNTIME_ID };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
plugins/fusion-plugin-openclaw-runtime/dist/index.d.ts.map
vendored
Normal file
1
plugins/fusion-plugin-openclaw-runtime/dist/index.d.ts.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,YAAY,EAEZ,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,oBAAoB,CAAC;AAE5B,QAAA,MAAM,mBAAmB,aAAa,CAAC;AAGvC,QAAA,MAAM,uBAAuB,EAAE,6BAK9B,CAAC;AAEF,QAAA,MAAM,sBAAsB,EAAE,oBAa7B,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,YA4BZ,CAAC;AAEH,eAAe,MAAM,CAAC;AAEtB,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CAAC"}
|
||||
58
plugins/fusion-plugin-openclaw-runtime/dist/index.js
vendored
Normal file
58
plugins/fusion-plugin-openclaw-runtime/dist/index.js
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* OpenClaw Runtime Plugin
|
||||
*
|
||||
* Registers an experimental OpenClaw runtime with Fusion's plugin runtime
|
||||
* discovery pipeline. Runtime execution behavior is intentionally deferred.
|
||||
*/
|
||||
import { definePlugin } from "@fusion/plugin-sdk";
|
||||
const OPENCLAW_RUNTIME_ID = "openclaw";
|
||||
const OPENCLAW_RUNTIME_VERSION = "0.1.0";
|
||||
const openclawRuntimeMetadata = {
|
||||
runtimeId: OPENCLAW_RUNTIME_ID,
|
||||
name: "OpenClaw Runtime",
|
||||
description: "Experimental OpenClaw runtime integration for Fusion tasks (execution deferred)",
|
||||
version: OPENCLAW_RUNTIME_VERSION,
|
||||
};
|
||||
const openclawRuntimeFactory = (_ctx) => {
|
||||
return {
|
||||
runtimeId: OPENCLAW_RUNTIME_ID,
|
||||
version: OPENCLAW_RUNTIME_VERSION,
|
||||
status: "deferred",
|
||||
message: "OpenClaw runtime execution is currently deferred. This runtime is registered for discovery and configuration only.",
|
||||
execute: async () => {
|
||||
throw new Error("OpenClaw runtime is not implemented yet. Runtime discovery and configuration are supported, but execution is deferred.");
|
||||
},
|
||||
};
|
||||
};
|
||||
const plugin = definePlugin({
|
||||
manifest: {
|
||||
id: "fusion-plugin-openclaw-runtime",
|
||||
name: "OpenClaw Runtime Plugin",
|
||||
version: "0.1.0",
|
||||
description: "OpenClaw runtime plugin for Fusion with experimental deferred execution",
|
||||
author: "Fusion Team",
|
||||
homepage: "https://github.com/gsxdsm/fusion",
|
||||
runtime: openclawRuntimeMetadata,
|
||||
},
|
||||
state: "installed",
|
||||
hooks: {
|
||||
onLoad: (ctx) => {
|
||||
ctx.logger.info("OpenClaw Runtime Plugin loaded (experimental placeholder runtime)");
|
||||
ctx.emitEvent("openclaw-runtime:loaded", {
|
||||
runtimeId: OPENCLAW_RUNTIME_ID,
|
||||
version: OPENCLAW_RUNTIME_VERSION,
|
||||
status: "deferred",
|
||||
});
|
||||
},
|
||||
onUnload: () => {
|
||||
// No context available during unload
|
||||
},
|
||||
},
|
||||
runtime: {
|
||||
metadata: openclawRuntimeMetadata,
|
||||
factory: openclawRuntimeFactory,
|
||||
},
|
||||
});
|
||||
export default plugin;
|
||||
export { openclawRuntimeMetadata, openclawRuntimeFactory, OPENCLAW_RUNTIME_ID };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
plugins/fusion-plugin-openclaw-runtime/dist/index.js.map
vendored
Normal file
1
plugins/fusion-plugin-openclaw-runtime/dist/index.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD,MAAM,mBAAmB,GAAG,UAAU,CAAC;AACvC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEzC,MAAM,uBAAuB,GAAkC;IAC7D,SAAS,EAAE,mB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