feat(FN-2701): route OpenClaw runtime sessions through gateway client
- Add a dedicated gateway client seam and wire runtime adapter sessions through the new request path - Remove legacy engine-guard/pi seam exports and align runtime types with gateway-facing behavior - Fix gateway request/stream handling by preventing duplicate user turns, stabilizing tool-call callbacks, and adding a no-op session dispose hook - Expand plugin test coverage for gateway client, adapter, and index behavior and document runtime gateway behavior in the README
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
|
||||
import { definePlugin } from "@fusion/plugin-sdk";
|
||||
import { OpenClawRuntimeAdapter } from "./runtime-adapter.js";
|
||||
import { probeGateway, resolveGatewayConfig } from "./pi-module.js";
|
||||
import type {
|
||||
FusionPlugin,
|
||||
PluginContext,
|
||||
PluginRuntimeFactory,
|
||||
PluginRuntimeManifestMetadata,
|
||||
} from "@fusion/plugin-sdk";
|
||||
@@ -19,12 +21,13 @@ const OPENCLAW_RUNTIME_VERSION = "0.1.0";
|
||||
const openclawRuntimeMetadata: PluginRuntimeManifestMetadata = {
|
||||
runtimeId: OPENCLAW_RUNTIME_ID,
|
||||
name: "OpenClaw Runtime",
|
||||
description: "OpenClaw-backed AI session using the user's configured pi provider and model",
|
||||
description: "OpenClaw-backed AI session using the local OpenClaw gateway",
|
||||
version: OPENCLAW_RUNTIME_VERSION,
|
||||
};
|
||||
|
||||
const openclawRuntimeFactory: PluginRuntimeFactory = async () => {
|
||||
return new OpenClawRuntimeAdapter();
|
||||
const openclawRuntimeFactory: PluginRuntimeFactory = async (ctx?: PluginContext) => {
|
||||
const config = resolveGatewayConfig(ctx?.settings);
|
||||
return new OpenClawRuntimeAdapter(config);
|
||||
};
|
||||
|
||||
const plugin: FusionPlugin = definePlugin({
|
||||
@@ -39,11 +42,18 @@ const plugin: FusionPlugin = definePlugin({
|
||||
},
|
||||
state: "installed",
|
||||
hooks: {
|
||||
onLoad: (ctx) => {
|
||||
ctx.logger.info("OpenClaw Runtime Plugin loaded");
|
||||
onLoad: async (ctx) => {
|
||||
const config = resolveGatewayConfig(ctx.settings);
|
||||
const gatewayReachable = await probeGateway(config.gatewayUrl);
|
||||
|
||||
ctx.logger.info(
|
||||
`OpenClaw Runtime Plugin loaded (gateway: ${config.gatewayUrl}, reachable: ${gatewayReachable ? "yes" : "no"})`,
|
||||
);
|
||||
ctx.emitEvent("openclaw-runtime:loaded", {
|
||||
runtimeId: OPENCLAW_RUNTIME_ID,
|
||||
version: OPENCLAW_RUNTIME_VERSION,
|
||||
gatewayUrl: config.gatewayUrl,
|
||||
gatewayReachable,
|
||||
});
|
||||
},
|
||||
onUnload: () => {
|
||||
|
||||
Reference in New Issue
Block a user