mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-20 09:31:54 -06:00
dde90a345a
* refactor(plugin-sdk): narrow wildcard barrels to explicit used exports * refactor(tools): delete dead tool-planning module exposed by barrel narrowing * fix(plugin-sdk): restore deprecation tag on OpenClawSchemaType alias * test(agents): drop test for deleted runtime proxy module * refactor(tools): trim descriptor types to cache consumers * refactor(deadcode): harvest exports orphaned by barrel narrowing * refactor(deadcode): harvest exports orphaned by barrel narrowing (rest) * fix(agents): restore sdk imports and test markers via public predicate * fix(plugin-sdk): named type re-exports in plugin-entry; trim types barrel precisely * chore(plugin-sdk): account unmasked deprecated provider types in budgets * fix(plugins): name star-only type rows for dts bundling * fix(plugins): restore host-hook surface; unexport internal api compositions * fix(plugins): named type imports for api composition; restore needed source exports * fix(plugins): knip-visible type imports for registry surfaces * test: adapt tests to privatized media and command internals * fix(qa-lab): re-export snapshot conversation type * style: format sessions sdk imports * fix(plugins): restore smoke entry export; pin budgets to exact actuals * fix(plugins): canonical smoke-entry import; drop orphaned root shims * fix(plugins): allowlist manifest probe, repoint qa web import, drop dead browser barrels * fix(plugin-sdk): pin codex auth marker and scaffold provider type * fix(qa-lab): keep web-facing model-selection shim within boundary rules * fix(plugin-sdk): preserve merged contracts through narrowed barrels * chore(plugin-sdk): pin post-rebase surface budgets
132 lines
3.4 KiB
TypeScript
132 lines
3.4 KiB
TypeScript
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import type { PluginLogger } from "./logger-types.js";
|
|
import type { PluginRuntime } from "./runtime/types.js";
|
|
|
|
export type PluginConfigMigration = (config: OpenClawConfig) =>
|
|
| {
|
|
config: OpenClawConfig;
|
|
changes: string[];
|
|
}
|
|
| null
|
|
| undefined;
|
|
|
|
type MigrationItemStatus = "planned" | "migrated" | "skipped" | "warning" | "conflict" | "error";
|
|
type MigrationItemKind =
|
|
| "auth"
|
|
| "config"
|
|
| "secret"
|
|
| "memory"
|
|
| "skill"
|
|
| "workspace"
|
|
| "session"
|
|
| "file"
|
|
| "archive"
|
|
| "manual";
|
|
type MigrationItemAction =
|
|
| "copy"
|
|
| "create"
|
|
| "update"
|
|
| "merge"
|
|
| "append"
|
|
| "archive"
|
|
| "skip"
|
|
| "manual";
|
|
|
|
export type MigrationItem = {
|
|
id: string;
|
|
kind: MigrationItemKind | (string & {});
|
|
action: MigrationItemAction | (string & {});
|
|
status: MigrationItemStatus;
|
|
source?: string;
|
|
target?: string;
|
|
message?: string;
|
|
reason?: string;
|
|
sensitive?: boolean;
|
|
/** Core-owned source revision bound by reviewed embedded migration flows. */
|
|
sourceRevision?: { algorithm: "sha256"; digest: string };
|
|
details?: Record<string, unknown>;
|
|
};
|
|
|
|
export type MigrationSummary = {
|
|
total: number;
|
|
planned: number;
|
|
migrated: number;
|
|
skipped: number;
|
|
conflicts: number;
|
|
errors: number;
|
|
sensitive: number;
|
|
};
|
|
|
|
export type MigrationDetection = {
|
|
found: boolean;
|
|
source?: string;
|
|
label?: string;
|
|
confidence?: "low" | "medium" | "high";
|
|
message?: string;
|
|
};
|
|
|
|
export type MigrationPlan = {
|
|
providerId: string;
|
|
source: string;
|
|
target?: string;
|
|
summary: MigrationSummary;
|
|
items: MigrationItem[];
|
|
warnings?: string[];
|
|
nextSteps?: string[];
|
|
metadata?: Record<string, unknown>;
|
|
};
|
|
|
|
export type MigrationApplyResult = MigrationPlan & {
|
|
backupPath?: string;
|
|
reportDir?: string;
|
|
};
|
|
|
|
type MigrationProviderPreparation = {
|
|
dispose?: () => void | Promise<void>;
|
|
};
|
|
|
|
export type MigrationProviderContext = {
|
|
config: OpenClawConfig;
|
|
runtime?: PluginRuntime;
|
|
logger: PluginLogger;
|
|
stateDir: string;
|
|
/** Explicit destination agent for embedded migration surfaces such as Control UI. */
|
|
targetAgentId?: string;
|
|
/** Optional item-kind scope used by embedded migration surfaces to avoid unrelated discovery. */
|
|
itemKinds?: readonly string[];
|
|
source?: string;
|
|
includeSecrets?: boolean;
|
|
overwrite?: boolean;
|
|
providerOptions?: Record<string, unknown>;
|
|
backupPath?: string;
|
|
reportDir?: string;
|
|
signal?: AbortSignal;
|
|
};
|
|
|
|
/** Migration source implemented by a plugin and orchestrated by `openclaw migrate`. */
|
|
export type MigrationProviderPlugin = {
|
|
id: string;
|
|
label: string;
|
|
description?: string;
|
|
/** Item kinds this provider can expose without requiring a full plan. */
|
|
supportedItemKinds?: readonly string[];
|
|
detect?: (ctx: MigrationProviderContext) => MigrationDetection | Promise<MigrationDetection>;
|
|
prepareApply?: (
|
|
ctx: MigrationProviderContext,
|
|
) => MigrationProviderPreparation | Promise<MigrationProviderPreparation | undefined> | undefined;
|
|
plan: (ctx: MigrationProviderContext) => MigrationPlan | Promise<MigrationPlan>;
|
|
apply: (
|
|
ctx: MigrationProviderContext,
|
|
plan?: MigrationPlan,
|
|
) => MigrationApplyResult | Promise<MigrationApplyResult>;
|
|
};
|
|
|
|
type PluginSetupAutoEnableContext = {
|
|
config: OpenClawConfig;
|
|
env: NodeJS.ProcessEnv;
|
|
};
|
|
|
|
export type PluginSetupAutoEnableProbe = (
|
|
ctx: PluginSetupAutoEnableContext,
|
|
) => string | string[] | null | undefined;
|