Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ export type {
UserSuggestion,
} from "./types";

// Plugin types
export type {
LoadedPlugin,
OpenClawMemoryDef,
OpenClawMemoryResult,
OpenClawToolDef,
PluginConfig,
PluginManifest,
PluginRegistrations,
PluginSlot,
PluginsConfig,
} from "./plugin-types";

// Utilities
export * from "./utils/encryption";
export * from "./utils/env";
Expand Down
108 changes: 108 additions & 0 deletions packages/core/src/plugin-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* OpenClaw Plugin System Types
*
* Defines the interfaces for loading, configuring, and bridging OpenClaw plugins
* into Lobu's architecture. Supports two plugin slot types:
* - tool: Agent capabilities (tools available during turns)
* - memory: Context recall/save backends (exclusive slot - one active at a time)
*/

// ============================================================================
// Plugin Configuration (stored in AgentSettings)
// ============================================================================

/** Slot types supported by OpenClaw plugins */
export type PluginSlot = "tool" | "memory";

/** Individual plugin configuration in agent settings */
export interface PluginConfig {
/** npm package name or local path (e.g., "@openclaw/tool-websearch", "./extensions/memory-rag") */
source: string;
/** Whether this plugin is currently enabled */
enabled: boolean;
/** Plugin-specific configuration values (validated against plugin's configSchema) */
config?: Record<string, unknown>;
}

/** Plugins configuration for agent settings */
export interface PluginsConfig {
/** Installed plugins keyed by plugin ID */
plugins: Record<string, PluginConfig>;
/** Exclusive slot assignments (e.g., { memory: "memory-core" }) */
slots?: Record<string, string>;
}

// ============================================================================
// Plugin Manifest (read from plugin package)
// ============================================================================

/** Plugin manifest from openclaw.plugin.json or package.json */
export interface PluginManifest {
id: string;
name?: string;
description?: string;
kind?: PluginSlot;
configSchema?: Record<string, unknown>;
skills?: string[];
}

// ============================================================================
// Plugin API (shim provided to plugins during registration)
// ============================================================================

/** Tool definition as registered by OpenClaw plugins */
export interface OpenClawToolDef {
name: string;
description: string;
parameters: unknown; // TypeBox schema
execute: (
toolCallId: string,
params: unknown,
signal?: AbortSignal
) => Promise<{
content: Array<{ type: string; text: string }>;
details?: unknown;
}>;
}

/** Memory plugin interface */
export interface OpenClawMemoryDef {
indexChunk?: (
path: string,
content: string,
metadata?: unknown
) => Promise<void>;
search?: (
query: string,
options?: unknown
) => Promise<OpenClawMemoryResult[]>;
recall?: (query: string) => Promise<string>;
save?: (content: string, metadata?: unknown) => Promise<void>;
}

export interface OpenClawMemoryResult {
text: string;
path?: string;
score?: number;
metadata?: unknown;
}

/**
* Collected registrations from an OpenClaw plugin.
* The plugin loader calls register(api) and captures all registrations here.
*/
export interface PluginRegistrations {
id: string;
slot?: PluginSlot;
tools: OpenClawToolDef[];
memory: OpenClawMemoryDef | null;
}

/**
* A fully loaded plugin with its manifest and registrations.
*/
export interface LoadedPlugin {
manifest: PluginManifest;
config: PluginConfig;
registrations: PluginRegistrations;
}
3 changes: 3 additions & 0 deletions packages/gateway/src/auth/settings/agent-settings-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type McpServerConfig,
type NetworkConfig,
type NixConfig,
type PluginsConfig,
type SkillsConfig,
type ToolsConfig,
} from "@lobu/core";
Expand Down Expand Up @@ -36,6 +37,8 @@ export interface AgentSettings {
skillsConfig?: SkillsConfig;
/** Tool permission configuration - allowed/denied tools */
toolsConfig?: ToolsConfig;
/** OpenClaw plugins configuration */
pluginsConfig?: PluginsConfig;
/** Enable verbose logging (show tool calls, reasoning, etc.) */
verboseLogging?: boolean;
/** Connected GitHub user info */
Expand Down
Loading
Loading