mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
430d2caa56
* fix(openshell): unregister sandbox backend on plugin stop Bind the explicit backend disposer to the plugin service lifetime so disabling or reloading OpenShell retires its factory, manager, and workdir hooks together. Preserve the core registry's stale and repeated disposer semantics. * fix(sandbox): retire plugin backends with registry lifecycle
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
// Openshell plugin entrypoint registers its OpenClaw integration.
|
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
import { registerSandboxBackend } from "openclaw/plugin-sdk/sandbox";
|
|
import {
|
|
createOpenShellSandboxBackendFactory,
|
|
createOpenShellSandboxBackendManager,
|
|
} from "./src/backend.js";
|
|
import { createOpenShellPluginConfigSchema, resolveOpenShellPluginConfig } from "./src/config.js";
|
|
|
|
export default definePluginEntry({
|
|
id: "openshell",
|
|
name: "OpenShell Sandbox",
|
|
description: "OpenShell-backed sandbox runtime for agent exec and file tools.",
|
|
configSchema: createOpenShellPluginConfigSchema(),
|
|
register(api) {
|
|
if (api.registrationMode !== "full") {
|
|
return;
|
|
}
|
|
const pluginConfig = resolveOpenShellPluginConfig(api.pluginConfig);
|
|
const unregister = registerSandboxBackend("openshell", {
|
|
factory: createOpenShellSandboxBackendFactory({
|
|
pluginConfig,
|
|
}),
|
|
manager: createOpenShellSandboxBackendManager({
|
|
pluginConfig,
|
|
}),
|
|
resolveWorkdir: () => pluginConfig.remoteWorkspaceDir,
|
|
});
|
|
// Eager CLI registrations must retire even if Gateway services never start.
|
|
api.lifecycle.registerRuntimeLifecycle({
|
|
id: "openshell-sandbox-cleanup",
|
|
cleanup: ({ reason, sessionKey, runId }) => {
|
|
if (sessionKey !== undefined || runId !== undefined) {
|
|
return;
|
|
}
|
|
if (reason === "disable" || reason === "restart") {
|
|
unregister();
|
|
}
|
|
},
|
|
});
|
|
},
|
|
});
|