mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 13:10:42 +00:00
Summary: - add manifest-backed platform-specific default enablement for bundled plugins - auto-start Bonjour LAN discovery on macOS hosts only - keep Linux, Windows, and containerized Gateway deployments opt-in while preserving explicit enablement Verification: - pnpm test extensions/bonjour/src/advertiser.test.ts src/plugins/bundled-plugin-metadata.test.ts src/plugins/manifest-registry.test.ts src/plugins/channel-plugin-ids.test.ts - pnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/gateway/bonjour.md docs/gateway/configuration-reference.md docs/gateway/discovery.md docs/gateway/security/index.md docs/plugins/manifest.md extensions/bonjour/openclaw.plugin.json src/plugin-sdk/facade-activation-check.runtime.ts src/plugins/bundled-manifest-contract-plugins.ts src/plugins/bundled-plugin-metadata.test.ts src/plugins/channel-presence-policy.ts src/plugins/default-enablement.ts src/plugins/gateway-startup-plugin-ids.ts src/plugins/installed-plugin-index-record-builder.ts src/plugins/installed-plugin-index-store.ts src/plugins/installed-plugin-index-types.ts src/plugins/installed-plugin-index.ts src/plugins/loader.ts src/plugins/manifest-contract-eligibility.ts src/plugins/manifest-owner-policy.ts src/plugins/manifest-registry-installed.ts src/plugins/manifest-registry.test.ts src/plugins/manifest-registry.ts src/plugins/manifest.ts src/plugins/providers.ts - git diff --check - Testbox: pnpm check:changed via Blacksmith Testbox tbx_01kqqf3f8rbrt8afjtcg0ck7qs Refs #74209
140 lines
4.4 KiB
TypeScript
140 lines
4.4 KiB
TypeScript
import type { OpenClawConfig } from "../config/types.js";
|
|
import type { PluginInstallRecord } from "../config/types.plugins.js";
|
|
import type { PluginCompatCode } from "./compat/registry.js";
|
|
import type { PluginCandidate } from "./discovery.js";
|
|
import type { PluginInstallSourceInfo } from "./install-source-info.js";
|
|
import type { InstalledPluginFileSignature } from "./installed-plugin-index-hash.js";
|
|
import type { PluginManifestRecord } from "./manifest-registry.js";
|
|
import type { PluginDiagnostic } from "./manifest-types.js";
|
|
import type { PluginPackageChannel } from "./manifest.js";
|
|
|
|
export const INSTALLED_PLUGIN_INDEX_VERSION = 1;
|
|
export const INSTALLED_PLUGIN_INDEX_MIGRATION_VERSION = 1;
|
|
export const INSTALLED_PLUGIN_INDEX_WARNING =
|
|
"DO NOT EDIT. This file is generated by OpenClaw from plugin manifests, install records, and config policy. Use `openclaw plugins registry --refresh`, `openclaw plugins install/update/uninstall`, or `openclaw plugins enable/disable` instead.";
|
|
|
|
export type InstalledPluginIndexRefreshReason =
|
|
| "missing"
|
|
| "stale-manifest"
|
|
| "stale-package"
|
|
| "source-changed"
|
|
| "policy-changed"
|
|
| "migration"
|
|
| "host-contract-changed"
|
|
| "compat-registry-changed"
|
|
| "manual";
|
|
|
|
export type InstalledPluginStartupInfo = {
|
|
sidecar: boolean;
|
|
memory: boolean;
|
|
deferConfiguredChannelFullLoadUntilAfterListen: boolean;
|
|
agentHarnesses: readonly string[];
|
|
};
|
|
|
|
export type InstalledPluginInstallRecordInfo = Pick<
|
|
PluginInstallRecord,
|
|
| "source"
|
|
| "spec"
|
|
| "sourcePath"
|
|
| "installPath"
|
|
| "version"
|
|
| "resolvedName"
|
|
| "resolvedVersion"
|
|
| "resolvedSpec"
|
|
| "integrity"
|
|
| "shasum"
|
|
| "resolvedAt"
|
|
| "installedAt"
|
|
| "clawhubUrl"
|
|
| "clawhubPackage"
|
|
| "clawhubFamily"
|
|
| "clawhubChannel"
|
|
| "artifactKind"
|
|
| "artifactFormat"
|
|
| "npmIntegrity"
|
|
| "npmShasum"
|
|
| "npmTarballName"
|
|
| "clawpackSha256"
|
|
| "clawpackSpecVersion"
|
|
| "clawpackManifestSha256"
|
|
| "clawpackSize"
|
|
| "gitUrl"
|
|
| "gitRef"
|
|
| "gitCommit"
|
|
| "marketplaceName"
|
|
| "marketplaceSource"
|
|
| "marketplacePlugin"
|
|
>;
|
|
|
|
export type InstalledPluginPackageChannelInfo = PluginPackageChannel;
|
|
|
|
export type InstalledPluginIndexRecord = {
|
|
pluginId: string;
|
|
packageName?: string;
|
|
packageVersion?: string;
|
|
/**
|
|
* Legacy embedded install record accepted when reading earlier index files.
|
|
* New index writes keep install records in InstalledPluginIndex.installRecords.
|
|
*/
|
|
installRecord?: InstalledPluginInstallRecordInfo;
|
|
/** Hash of the top-level installRecords entry; used to detect source-changed invalidation. */
|
|
installRecordHash?: string;
|
|
/**
|
|
* Package-authored openclaw.install metadata. This describes catalog/package
|
|
* install intent and must not be treated as the durable install record.
|
|
*/
|
|
packageInstall?: PluginInstallSourceInfo;
|
|
packageChannel?: InstalledPluginPackageChannelInfo;
|
|
manifestPath: string;
|
|
manifestHash: string;
|
|
manifestFile?: InstalledPluginFileSignature;
|
|
format?: PluginManifestRecord["format"];
|
|
bundleFormat?: PluginManifestRecord["bundleFormat"];
|
|
source?: string;
|
|
setupSource?: string;
|
|
packageJson?: {
|
|
path: string;
|
|
hash: string;
|
|
fileSignature?: InstalledPluginFileSignature;
|
|
};
|
|
rootDir: string;
|
|
origin: PluginManifestRecord["origin"];
|
|
enabled: boolean;
|
|
enabledByDefault?: boolean;
|
|
enabledByDefaultOnPlatforms?: readonly string[];
|
|
syntheticAuthRefs?: readonly string[];
|
|
startup: InstalledPluginStartupInfo;
|
|
compat: readonly PluginCompatCode[];
|
|
};
|
|
|
|
export type InstalledPluginIndex = {
|
|
version: typeof INSTALLED_PLUGIN_INDEX_VERSION;
|
|
warning?: string;
|
|
hostContractVersion: string;
|
|
compatRegistryVersion: string;
|
|
migrationVersion: typeof INSTALLED_PLUGIN_INDEX_MIGRATION_VERSION;
|
|
policyHash: string;
|
|
generatedAtMs: number;
|
|
refreshReason?: InstalledPluginIndexRefreshReason;
|
|
installRecords: Readonly<Record<string, InstalledPluginInstallRecordInfo>>;
|
|
plugins: readonly InstalledPluginIndexRecord[];
|
|
diagnostics: readonly PluginDiagnostic[];
|
|
};
|
|
|
|
export type LoadInstalledPluginIndexParams = {
|
|
config?: OpenClawConfig;
|
|
workspaceDir?: string;
|
|
env?: NodeJS.ProcessEnv;
|
|
stateDir?: string;
|
|
pluginIndexFilePath?: string;
|
|
installRecords?: Record<string, PluginInstallRecord>;
|
|
candidates?: PluginCandidate[];
|
|
diagnostics?: PluginDiagnostic[];
|
|
now?: () => Date;
|
|
};
|
|
|
|
export type RefreshInstalledPluginIndexParams = LoadInstalledPluginIndexParams & {
|
|
reason: InstalledPluginIndexRefreshReason;
|
|
policyPluginIds?: readonly string[];
|
|
};
|