Files
openclaw/src/plugin-sdk/plugin-state-runtime.ts
T
Peter Steinberger 9809375fda refactor(plugins)!: remove the plugin state lease API (#121140)
* refactor(plugins)!: remove plugin state lease API

* docs(plugins): document state lease removal
2026-08-09 11:16:07 -07:00

40 lines
1.2 KiB
TypeScript

/**
* Runtime SDK type surface for plugin-scoped keyed state stores.
*/
import type { PluginRuntime } from "../plugins/runtime/types.js";
export function createPluginStateErrorReporter(
getRuntime: () => Pick<PluginRuntime, "logging"> | null | undefined,
plugin: string,
feature: string,
message: string,
formatError = (error: unknown): Record<string, unknown> => ({ error: String(error) }),
) {
return (error: unknown): void => {
try {
getRuntime()?.logging.getChildLogger({ plugin, feature }).warn(message, formatError(error));
} catch {
// State fallback must remain available even when logger setup or formatting fails.
}
};
}
export { configureSqliteConnectionPragmas } from "../infra/sqlite-wal.js";
export {
migrateSqliteSchemaToStrict,
type SqliteStrictMigrationOptions,
type SqliteStrictMigrationResult,
} from "../infra/sqlite-strict.js";
export type {
OpenKeyedStoreOptions,
PluginStateEntry,
PluginStateKeyedStore,
PluginStateSyncKeyedStore,
} from "../plugin-state/plugin-state-store.js";
export type {
OpenBlobStoreOptions,
PluginBlobEntry,
PluginBlobEntryInfo,
PluginBlobStore,
} from "../plugin-state/plugin-blob-store.js";