Files
openclaw/src/plugins/plugin-metadata-snapshot.types.ts
T
Vincent Koc e4aab26d01 fix(cli): avoid repeated migration scans during local agent turns (#119051)
* fix(cli): avoid repeated state migration scans

* fix(build): preserve source runtime provenance

* fix(cli): persist state checkpoint before plugin convergence

* fix(cli): invalidate migration checkpoints on input changes

* fix(plugins): refresh changed doctor contracts

* fix(plugins): preserve warm Doctor contract indexes

* test(plugins): align manifest registry fixtures

* test(cli): isolate ACP process state

* fix(doctor): persist refreshed plugin indexes

* fix(doctor): verify persisted plugin index from disk

* fix(doctor): fence plugin index persistence

* fix(doctor): retain validated migration lease

* fix(plugins): canonicalize persisted build metadata

* fix(plugins): preserve config policy during install repair
2026-08-04 20:28:16 +08:00

88 lines
3.1 KiB
TypeScript

import type { OpenClawConfig } from "../config/types.openclaw.js";
import type { PluginDiscoveryResult } from "./discovery.js";
import type { InstalledPluginIndex } from "./installed-plugin-index-types.js";
import type { PluginManifestRecord, PluginManifestRegistry } from "./manifest-registry.js";
import type { PluginDiagnostic } from "./manifest-types.js";
import type {
PluginManifestProviderEndpoint,
PluginManifestProviderRequestProvider,
} from "./manifest.js";
import type { PluginRegistrySnapshotSource } from "./plugin-registry-snapshot.types.js";
export type PluginMetadataSnapshotPluginIdScope = {
key: string;
resolve: (params: { index: InstalledPluginIndex }) => readonly string[] | undefined;
};
export type PluginMetadataSnapshotOwnerMaps = {
channels: ReadonlyMap<string, readonly string[]>;
channelConfigs: ReadonlyMap<string, readonly string[]>;
providers: ReadonlyMap<string, readonly string[]>;
modelCatalogProviders: ReadonlyMap<string, readonly string[]>;
cliBackends: ReadonlyMap<string, readonly string[]>;
setupProviders: ReadonlyMap<string, readonly string[]>;
commandAliases: ReadonlyMap<string, readonly string[]>;
contracts: ReadonlyMap<string, readonly string[]>;
providerEndpoints?: readonly PluginManifestProviderEndpoint[];
providerRequests?: ReadonlyMap<string, PluginManifestProviderRequestProvider>;
};
type PluginMetadataSnapshotMetrics = {
registrySnapshotMs: number;
manifestRegistryMs: number;
ownerMapsMs: number;
totalMs: number;
indexPluginCount: number;
manifestPluginCount: number;
};
type PluginMetadataSnapshotRegistryDiagnostic = {
level: "info" | "warn";
code:
| "persisted-registry-missing"
| "persisted-registry-stale-policy"
| "persisted-registry-stale-source";
message: string;
};
export type PluginMetadataSnapshot = {
policyHash: string;
configFingerprint?: string;
pluginIds?: readonly string[];
registrySource?: PluginRegistrySnapshotSource;
workspaceDir?: string;
index: InstalledPluginIndex;
registryDiagnostics: readonly PluginMetadataSnapshotRegistryDiagnostic[];
manifestRegistry: PluginManifestRegistry;
plugins: readonly PluginManifestRecord[];
diagnostics: readonly PluginDiagnostic[];
byPluginId: ReadonlyMap<string, PluginManifestRecord>;
normalizePluginId: (pluginId: string) => string;
owners: PluginMetadataSnapshotOwnerMaps;
metrics: PluginMetadataSnapshotMetrics;
discovery?: PluginDiscoveryResult;
};
export type PluginMetadataRegistryView = Pick<
PluginMetadataSnapshot,
"index" | "manifestRegistry" | "discovery"
>;
export type PluginMetadataManifestView = Pick<PluginMetadataSnapshot, "index" | "plugins">;
export type LoadPluginMetadataSnapshotParams = {
config?: OpenClawConfig;
workspaceDir?: string;
stateDir?: string;
env?: NodeJS.ProcessEnv;
index?: InstalledPluginIndex;
pluginIds?: readonly string[];
pluginIdScope?: PluginMetadataSnapshotPluginIdScope;
preferPersisted?: boolean;
allowCurrent?: boolean;
};
export type ResolvePluginMetadataSnapshotParams = LoadPluginMetadataSnapshotParams & {
allowWorkspaceScopedCurrent?: boolean;
};