mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 05:31:30 +00:00
fix(cycles): bulk extract leaf type surfaces
This commit is contained in:
@@ -6,7 +6,7 @@ import { matchBoundaryFileOpenFailure, openBoundaryFileSync } from "../infra/bou
|
||||
import { isRecord } from "../utils.js";
|
||||
import { normalizePluginsConfig, resolveEffectivePluginActivationState } from "./config-state.js";
|
||||
import { loadPluginManifestRegistry } from "./manifest-registry.js";
|
||||
import type { PluginBundleFormat } from "./types.js";
|
||||
import type { PluginBundleFormat } from "./manifest-types.js";
|
||||
|
||||
type ReadBundleJsonResult =
|
||||
| { ok: true; raw: Record<string, unknown> }
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
mergeBundlePathLists,
|
||||
normalizeBundlePathList,
|
||||
} from "./bundle-manifest.js";
|
||||
import type { PluginBundleFormat } from "./types.js";
|
||||
import type { PluginBundleFormat } from "./manifest-types.js";
|
||||
|
||||
export type BundleLspServerConfig = Record<string, unknown>;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
normalizeOptionalString,
|
||||
} from "../shared/string-coerce.js";
|
||||
import { isRecord } from "../utils.js";
|
||||
import type { PluginBundleFormat } from "./manifest-types.js";
|
||||
import { DEFAULT_PLUGIN_ENTRY_CANDIDATES, PLUGIN_MANIFEST_FILENAME } from "./manifest.js";
|
||||
import type { PluginBundleFormat } from "./types.js";
|
||||
|
||||
export const CODEX_BUNDLE_MANIFEST_RELATIVE_PATH = ".codex-plugin/plugin.json";
|
||||
export const CLAUDE_BUNDLE_MANIFEST_RELATIVE_PATH = ".claude-plugin/plugin.json";
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
mergeBundlePathLists,
|
||||
normalizeBundlePathList,
|
||||
} from "./bundle-manifest.js";
|
||||
import type { PluginBundleFormat } from "./types.js";
|
||||
import type { PluginBundleFormat } from "./manifest-types.js";
|
||||
|
||||
export type BundleMcpServerConfig = Record<string, unknown>;
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { createJiti } from "jiti";
|
||||
import { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
||||
import type { ChannelConfigRuntimeSchema } from "../channels/plugins/types.plugin.js";
|
||||
import type { ChannelConfigRuntimeSchema } from "../channels/plugins/types.config.js";
|
||||
import {
|
||||
normalizeBundledPluginStringList,
|
||||
trimBundledPluginString,
|
||||
} from "./bundled-plugin-scan.js";
|
||||
import type { PluginConfigUiHint } from "./manifest-types.js";
|
||||
import type {
|
||||
OpenClawPackageManifest,
|
||||
PluginManifest,
|
||||
PluginManifestChannelConfig,
|
||||
} from "./manifest.js";
|
||||
import { buildPluginLoaderJitiOptions, resolvePluginLoaderJitiConfig } from "./sdk-alias.js";
|
||||
import type { PluginConfigUiHint } from "./types.js";
|
||||
|
||||
const PUBLIC_SURFACE_SOURCE_EXTENSIONS = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"] as const;
|
||||
const SOURCE_CONFIG_SCHEMA_CANDIDATES = [
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import type { PluginEntryConfig } from "../config/types.plugins.js";
|
||||
import { hasExplicitPluginConfig } from "./config-policy.js";
|
||||
import type { PluginLoadOptions } from "./loader.js";
|
||||
|
||||
export function withBundledPluginAllowlistCompat(params: {
|
||||
config: PluginLoadOptions["config"];
|
||||
config: OpenClawConfig | undefined;
|
||||
pluginIds: readonly string[];
|
||||
}): PluginLoadOptions["config"] {
|
||||
}): OpenClawConfig | undefined {
|
||||
const allow = params.config?.plugins?.allow;
|
||||
if (!Array.isArray(allow) || allow.length === 0) {
|
||||
return params.config;
|
||||
@@ -34,9 +34,9 @@ export function withBundledPluginAllowlistCompat(params: {
|
||||
}
|
||||
|
||||
export function withBundledPluginEnablementCompat(params: {
|
||||
config: PluginLoadOptions["config"];
|
||||
config: OpenClawConfig | undefined;
|
||||
pluginIds: readonly string[];
|
||||
}): PluginLoadOptions["config"] {
|
||||
}): OpenClawConfig | undefined {
|
||||
const existingEntries = params.config?.plugins?.entries ?? {};
|
||||
const forcePluginsEnabled = params.config?.plugins?.enabled === false;
|
||||
let changed = false;
|
||||
@@ -70,10 +70,10 @@ export function withBundledPluginEnablementCompat(params: {
|
||||
}
|
||||
|
||||
export function withBundledPluginVitestCompat(params: {
|
||||
config: PluginLoadOptions["config"];
|
||||
config: OpenClawConfig | undefined;
|
||||
pluginIds: readonly string[];
|
||||
env?: PluginLoadOptions["env"];
|
||||
}): PluginLoadOptions["config"] {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}): OpenClawConfig | undefined {
|
||||
const env = params.env ?? process.env;
|
||||
const isVitest = Boolean(env.VITEST);
|
||||
if (
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
type PluginPackageChannel,
|
||||
type PluginPackageInstall,
|
||||
} from "./manifest.js";
|
||||
import type { PluginOrigin } from "./types.js";
|
||||
import type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
|
||||
export type PluginChannelCatalogEntry = {
|
||||
pluginId: string;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Command } from "commander";
|
||||
import { loadConfig, readConfigFileSnapshot, type OpenClawConfig } from "../config/config.js";
|
||||
import { loadConfig, readConfigFileSnapshot } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import {
|
||||
createPluginCliLogger,
|
||||
loadPluginCliDescriptors,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { isRecord } from "../utils.js";
|
||||
import { findBundledPluginMetadataById } from "./bundled-plugin-metadata.js";
|
||||
import { loadPluginManifestRegistry } from "./manifest-registry.js";
|
||||
import type { PluginManifestConfigContracts } from "./manifest.js";
|
||||
import type { PluginOrigin } from "./types.js";
|
||||
import type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
|
||||
export type PluginConfigContractMatch = {
|
||||
path: string;
|
||||
|
||||
@@ -12,7 +12,8 @@ import {
|
||||
type NormalizePluginId,
|
||||
type NormalizedPluginsConfig as SharedNormalizedPluginsConfig,
|
||||
} from "./config-normalization-shared.js";
|
||||
import type { PluginKind, PluginOrigin } from "./types.js";
|
||||
import type { PluginKind } from "./plugin-kind.types.js";
|
||||
import type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
|
||||
export type PluginActivationSource = "disabled" | "explicit" | "auto" | "default";
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { z, type ZodTypeAny } from "zod";
|
||||
import type { PluginConfigUiHint, OpenClawPluginConfigSchema } from "./types.js";
|
||||
import type { PluginConfigUiHint } from "./manifest-types.js";
|
||||
import type { OpenClawPluginConfigSchema } from "./types.js";
|
||||
|
||||
type Issue = { path: Array<string | number>; message: string };
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from "../shared/string-coerce.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
import { detectBundleManifestFormat, loadBundleManifest } from "./bundle-manifest.js";
|
||||
import type { PluginBundleFormat, PluginDiagnostic, PluginFormat } from "./manifest-types.js";
|
||||
import {
|
||||
DEFAULT_PLUGIN_ENTRY_CANDIDATES,
|
||||
getPackageManifestMetadata,
|
||||
@@ -17,8 +18,8 @@ import {
|
||||
type PackageManifest,
|
||||
} from "./manifest.js";
|
||||
import { formatPosixMode, isPathInside, safeRealpathSync, safeStatSync } from "./path-safety.js";
|
||||
import type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
import { resolvePluginCacheInputs, resolvePluginSourceRoots } from "./roots.js";
|
||||
import type { PluginBundleFormat, PluginDiagnostic, PluginFormat, PluginOrigin } from "./types.js";
|
||||
|
||||
const EXTENSION_EXTS = new Set([".ts", ".js", ".mts", ".cts", ".mjs", ".cjs"]);
|
||||
const SCANNED_DIRECTORY_IGNORE_NAMES = new Set([
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
listRegisteredAgentHarnesses,
|
||||
restoreRegisteredAgentHarnesses,
|
||||
} from "../agents/harness/registry.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
import { isChannelConfigured } from "../config/channel-configured.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import type { PluginInstallRecord } from "../config/types.plugins.js";
|
||||
@@ -39,6 +39,7 @@ import { discoverOpenClawPlugins } from "./discovery.js";
|
||||
import { initializeGlobalHookRunner } from "./hook-runner-global.js";
|
||||
import { clearPluginInteractiveHandlers } from "./interactive-registry.js";
|
||||
import { loadPluginManifestRegistry } from "./manifest-registry.js";
|
||||
import type { PluginBundleFormat, PluginDiagnostic, PluginFormat } from "./manifest-types.js";
|
||||
import type { PluginManifestContracts } from "./manifest.js";
|
||||
import {
|
||||
clearMemoryEmbeddingProviders,
|
||||
@@ -81,14 +82,7 @@ import {
|
||||
shouldPreferNativeJiti,
|
||||
} from "./sdk-alias.js";
|
||||
import { hasKind, kindsEqual } from "./slots.js";
|
||||
import type {
|
||||
OpenClawPluginDefinition,
|
||||
OpenClawPluginModule,
|
||||
PluginDiagnostic,
|
||||
PluginBundleFormat,
|
||||
PluginFormat,
|
||||
PluginLogger,
|
||||
} from "./types.js";
|
||||
import type { OpenClawPluginDefinition, OpenClawPluginModule, PluginLogger } from "./types.js";
|
||||
|
||||
export type PluginLoadResult = PluginRegistry;
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@ import {
|
||||
} from "./config-policy.js";
|
||||
import { discoverOpenClawPlugins, type PluginCandidate } from "./discovery.js";
|
||||
import type { PluginManifestCommandAlias } from "./manifest-command-aliases.js";
|
||||
import type {
|
||||
PluginBundleFormat,
|
||||
PluginConfigUiHint,
|
||||
PluginDiagnostic,
|
||||
PluginFormat,
|
||||
} from "./manifest-types.js";
|
||||
import {
|
||||
loadPluginManifest,
|
||||
type OpenClawPackageManifest,
|
||||
@@ -28,15 +34,9 @@ import {
|
||||
} from "./manifest.js";
|
||||
import { checkMinHostVersion } from "./min-host-version.js";
|
||||
import { isPathInside, safeRealpathSync } from "./path-safety.js";
|
||||
import type { PluginKind } from "./plugin-kind.types.js";
|
||||
import type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
import { resolvePluginCacheInputs } from "./roots.js";
|
||||
import type {
|
||||
PluginBundleFormat,
|
||||
PluginConfigUiHint,
|
||||
PluginDiagnostic,
|
||||
PluginFormat,
|
||||
PluginKind,
|
||||
} from "./types.js";
|
||||
|
||||
type PluginManifestContractListKey =
|
||||
| "speechProviders"
|
||||
|
||||
19
src/plugins/manifest-types.ts
Normal file
19
src/plugins/manifest-types.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export type PluginConfigUiHint = {
|
||||
label?: string;
|
||||
help?: string;
|
||||
tags?: string[];
|
||||
advanced?: boolean;
|
||||
sensitive?: boolean;
|
||||
placeholder?: string;
|
||||
};
|
||||
|
||||
export type PluginFormat = "openclaw" | "bundle";
|
||||
|
||||
export type PluginBundleFormat = "codex" | "claude" | "cursor";
|
||||
|
||||
export type PluginDiagnostic = {
|
||||
level: "warn" | "error";
|
||||
message: string;
|
||||
pluginId?: string;
|
||||
source?: string;
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import JSON5 from "json5";
|
||||
import type { ChannelConfigRuntimeSchema } from "../channels/plugins/types.plugin.js";
|
||||
import type { ChannelConfigRuntimeSchema } from "../channels/plugins/types.config.js";
|
||||
import { MANIFEST_KEY } from "../compat/legacy-names.js";
|
||||
import { matchBoundaryFileOpenFailure, openBoundaryFileSync } from "../infra/boundary-file-read.js";
|
||||
import { normalizeOptionalString } from "../shared/string-coerce.js";
|
||||
@@ -11,7 +11,8 @@ import {
|
||||
normalizeManifestCommandAliases,
|
||||
type PluginManifestCommandAlias,
|
||||
} from "./manifest-command-aliases.js";
|
||||
import type { PluginConfigUiHint, PluginKind } from "./types.js";
|
||||
import type { PluginConfigUiHint } from "./manifest-types.js";
|
||||
import type { PluginKind } from "./plugin-kind.types.js";
|
||||
|
||||
export const PLUGIN_MANIFEST_FILENAME = "openclaw.plugin.json";
|
||||
export const PLUGIN_MANIFEST_FILENAMES = [PLUGIN_MANIFEST_FILENAME] as const;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { resolveProviderIdForAuth } from "../agents/provider-auth-aliases.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { normalizePluginsConfig, resolveEffectiveEnableState } from "./config-state.js";
|
||||
import { loadPluginManifestRegistry, type PluginManifestRecord } from "./manifest-registry.js";
|
||||
import type { PluginOrigin } from "./types.js";
|
||||
import type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
|
||||
export type ProviderAuthChoiceMetadata = {
|
||||
pluginId: string;
|
||||
|
||||
@@ -3,7 +3,6 @@ import type {
|
||||
ProviderDefaultThinkingPolicyContext,
|
||||
ProviderThinkingPolicyContext,
|
||||
} from "./provider-thinking.types.js";
|
||||
import { getActivePluginRegistry } from "./runtime.js";
|
||||
|
||||
type ThinkingProviderPlugin = {
|
||||
id: string;
|
||||
@@ -15,6 +14,16 @@ type ThinkingProviderPlugin = {
|
||||
) => "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "adaptive" | null | undefined;
|
||||
};
|
||||
|
||||
const PLUGIN_REGISTRY_STATE = Symbol.for("openclaw.pluginRegistryState");
|
||||
|
||||
type ThinkingRegistryState = {
|
||||
activeRegistry?: {
|
||||
providers?: Array<{
|
||||
provider: ThinkingProviderPlugin;
|
||||
}>;
|
||||
} | null;
|
||||
};
|
||||
|
||||
function matchesProviderId(provider: ThinkingProviderPlugin, providerId: string): boolean {
|
||||
const normalized = normalizeProviderId(providerId);
|
||||
if (!normalized) {
|
||||
@@ -27,7 +36,10 @@ function matchesProviderId(provider: ThinkingProviderPlugin, providerId: string)
|
||||
}
|
||||
|
||||
function resolveActiveThinkingProvider(providerId: string): ThinkingProviderPlugin | undefined {
|
||||
return getActivePluginRegistry()?.providers.find((entry) => {
|
||||
const state = (
|
||||
globalThis as typeof globalThis & { [PLUGIN_REGISTRY_STATE]?: ThinkingRegistryState }
|
||||
)[PLUGIN_REGISTRY_STATE];
|
||||
return state?.activeRegistry?.providers?.find((entry) => {
|
||||
return matchesProviderId(entry.provider, providerId);
|
||||
})?.provider;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { normalizeOptionalString } from "../shared/string-coerce.js";
|
||||
import { normalizeTrimmedStringList } from "../shared/string-normalization.js";
|
||||
import type { PluginDiagnostic, ProviderAuthMethod, ProviderPlugin } from "./types.js";
|
||||
import type { PluginDiagnostic } from "./manifest-types.js";
|
||||
import type { ProviderAuthMethod, ProviderPlugin } from "./types.js";
|
||||
|
||||
type ProviderWizardSetup = NonNullable<NonNullable<ProviderPlugin["wizard"]>["setup"]>;
|
||||
type ProviderWizardModelPicker = NonNullable<NonNullable<ProviderPlugin["wizard"]>["modelPicker"]>;
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import type { AgentHarness } from "../agents/harness/types.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
import type { OperatorScope } from "../gateway/operator-scopes.js";
|
||||
import type { GatewayRequestHandlers } from "../gateway/server-methods/types.js";
|
||||
import type { HookEntry } from "../hooks/types.js";
|
||||
import type { PluginActivationSource } from "./config-state.js";
|
||||
import type {
|
||||
PluginBundleFormat,
|
||||
PluginConfigUiHint,
|
||||
PluginDiagnostic,
|
||||
PluginFormat,
|
||||
} from "./manifest-types.js";
|
||||
import type { PluginManifestContracts } from "./manifest.js";
|
||||
import type { MemoryEmbeddingProviderAdapter } from "./memory-embedding-providers.js";
|
||||
import type { PluginKind } from "./plugin-kind.types.js";
|
||||
import type { PluginRuntime } from "./runtime/types.js";
|
||||
import type {
|
||||
CliBackendPlugin,
|
||||
@@ -24,13 +31,8 @@ import type {
|
||||
OpenClawPluginSecurityAuditCollector,
|
||||
OpenClawPluginService,
|
||||
OpenClawPluginToolFactory,
|
||||
PluginBundleFormat,
|
||||
PluginConfigUiHint,
|
||||
PluginConversationBindingResolvedEvent,
|
||||
PluginDiagnostic,
|
||||
PluginFormat,
|
||||
PluginHookRegistration as TypedPluginHookRegistration,
|
||||
PluginKind,
|
||||
PluginLogger,
|
||||
PluginOrigin,
|
||||
PluginTextTransformRegistration,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from "../agents/harness/registry.js";
|
||||
import type { AgentHarness } from "../agents/harness/types.js";
|
||||
import type { AnyAgentTool } from "../agents/tools/common.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
import { registerContextEngineForOwner } from "../context-engine/registry.js";
|
||||
import type { OperatorScope } from "../gateway/operator-scopes.js";
|
||||
import type { GatewayRequestHandler } from "../gateway/server-methods/types.js";
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
import { normalizePluginHttpPath } from "./http-path.js";
|
||||
import { findOverlappingPluginHttpRoute } from "./http-route-overlap.js";
|
||||
import { registerPluginInteractiveHandler } from "./interactive-registry.js";
|
||||
import type { PluginDiagnostic } from "./manifest-types.js";
|
||||
import {
|
||||
getRegisteredMemoryEmbeddingProvider,
|
||||
registerMemoryEmbeddingProvider,
|
||||
@@ -93,7 +94,6 @@ import type {
|
||||
OpenClawPluginService,
|
||||
OpenClawPluginToolContext,
|
||||
OpenClawPluginToolFactory,
|
||||
PluginDiagnostic,
|
||||
PluginHookHandlerMap,
|
||||
PluginHookName,
|
||||
PluginHookRegistration as TypedPluginHookRegistration,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agents/agent-scope.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import { applyPluginAutoEnable } from "../../config/plugin-auto-enable.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import { createSubsystemLogger } from "../../logging.js";
|
||||
import type { PluginLoadOptions } from "../loader.js";
|
||||
import type { PluginLogger } from "../types.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import { loadOpenClawPlugins } from "../loader.js";
|
||||
import type { PluginRegistry } from "../registry.js";
|
||||
import { buildPluginRuntimeLoadOptions, resolvePluginRuntimeLoadContext } from "./load-context.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Api, Model } from "@mariozechner/pi-ai";
|
||||
import { getApiKeyForModel, resolveApiKeyForProvider } from "../../agents/model-auth.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import { prepareProviderRuntimeAuth } from "../provider-runtime.runtime.js";
|
||||
import type { ResolvedProviderRuntimeAuth } from "./model-auth-types.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import {
|
||||
resolveChannelPluginIds,
|
||||
resolveConfiguredChannelPluginIds,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import {
|
||||
cancelFlowByIdForOwner,
|
||||
getFlowTaskSummary,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import { cancelTaskById, listTasksForFlowId } from "../../tasks/runtime-internal.js";
|
||||
import {
|
||||
mapTaskFlowDetail,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||
import { createJiti } from "jiti";
|
||||
import type { ChannelAgentTool } from "../../channels/plugins/types.core.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import {
|
||||
getDefaultLocalRoots as getDefaultLocalRootsImpl,
|
||||
loadWebMedia as loadWebMediaImpl,
|
||||
|
||||
@@ -3,6 +3,12 @@ import type { LogLevel } from "../../logging/levels.js";
|
||||
|
||||
export type { HeartbeatRunResult };
|
||||
|
||||
type RuntimeWriteConfigOptions = {
|
||||
envSnapshotForRestore?: Record<string, string | undefined>;
|
||||
expectedConfigPath?: string;
|
||||
unsetPaths?: string[][];
|
||||
};
|
||||
|
||||
/** Structured logger surface injected into runtime-backed plugin helpers. */
|
||||
export type RuntimeLogger = {
|
||||
debug?: (message: string, meta?: Record<string, unknown>) => void;
|
||||
@@ -23,8 +29,11 @@ export type RunHeartbeatOnceOptions = {
|
||||
export type PluginRuntimeCore = {
|
||||
version: string;
|
||||
config: {
|
||||
loadConfig: typeof import("../../config/config.js").loadConfig;
|
||||
writeConfigFile: typeof import("../../config/config.js").writeConfigFile;
|
||||
loadConfig: () => import("../../config/types.openclaw.js").OpenClawConfig;
|
||||
writeConfigFile: (
|
||||
cfg: import("../../config/types.openclaw.js").OpenClawConfig,
|
||||
options?: RuntimeWriteConfigOptions,
|
||||
) => Promise<void>;
|
||||
};
|
||||
agent: {
|
||||
defaults: {
|
||||
@@ -145,18 +154,18 @@ export type PluginRuntimeCore = {
|
||||
/** Resolve auth for a model. Only provider/model and optional cfg are used. */
|
||||
getApiKeyForModel: (params: {
|
||||
model: import("@mariozechner/pi-ai").Model<import("@mariozechner/pi-ai").Api>;
|
||||
cfg?: import("../../config/config.js").OpenClawConfig;
|
||||
cfg?: import("../../config/types.openclaw.js").OpenClawConfig;
|
||||
}) => Promise<import("../../agents/model-auth-runtime-shared.js").ResolvedProviderAuth>;
|
||||
/** Resolve request-ready auth for a model, including provider runtime exchanges. */
|
||||
getRuntimeAuthForModel: (params: {
|
||||
model: import("@mariozechner/pi-ai").Model<import("@mariozechner/pi-ai").Api>;
|
||||
cfg?: import("../../config/config.js").OpenClawConfig;
|
||||
cfg?: import("../../config/types.openclaw.js").OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
}) => Promise<import("./model-auth-types.js").ResolvedProviderRuntimeAuth>;
|
||||
/** Resolve auth for a provider by name. Only provider and optional cfg are used. */
|
||||
resolveApiKeyForProvider: (params: {
|
||||
provider: string;
|
||||
cfg?: import("../../config/config.js").OpenClawConfig;
|
||||
cfg?: import("../../config/types.openclaw.js").OpenClawConfig;
|
||||
}) => Promise<import("../../agents/model-auth-runtime-shared.js").ResolvedProviderAuth>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { resolveDefaultAgentWorkspaceDir } from "../agents/workspace.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { normalizeOpenClawVersionBase } from "../config/version.js";
|
||||
import { listImportedBundledPluginFacadeIds } from "../plugin-sdk/facade-runtime.js";
|
||||
import { resolveCompatibilityHostVersion } from "../version.js";
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
} from "./bundled-compat.js";
|
||||
import { normalizePluginsConfig } from "./config-state.js";
|
||||
import { loadOpenClawPlugins } from "./loader.js";
|
||||
import type { PluginDiagnostic } from "./manifest-types.js";
|
||||
import { resolveBundledProviderCompatPluginIds } from "./providers.js";
|
||||
import type { PluginRegistry } from "./registry.js";
|
||||
import { listImportedRuntimePluginIds } from "./runtime.js";
|
||||
@@ -19,7 +21,7 @@ import {
|
||||
resolvePluginRuntimeLoadContext,
|
||||
} from "./runtime/load-context.js";
|
||||
import { loadPluginMetadataRegistrySnapshot } from "./runtime/metadata-registry-loader.js";
|
||||
import type { PluginDiagnostic, PluginHookName } from "./types.js";
|
||||
import type { PluginHookName } from "./types.js";
|
||||
|
||||
export type PluginStatusReport = PluginRegistry & {
|
||||
workspaceDir?: string;
|
||||
@@ -142,7 +144,7 @@ function resolveReportedPluginVersion(
|
||||
}
|
||||
|
||||
type PluginReportParams = {
|
||||
config?: ReturnType<typeof loadConfig>;
|
||||
config?: OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
/** Use an explicit env when plugin roots should resolve independently from process.env. */
|
||||
env?: NodeJS.ProcessEnv;
|
||||
@@ -284,7 +286,7 @@ function deriveInspectShape(params: {
|
||||
|
||||
export function buildPluginInspectReport(params: {
|
||||
id: string;
|
||||
config?: ReturnType<typeof loadConfig>;
|
||||
config?: OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
report?: PluginStatusReport;
|
||||
@@ -422,7 +424,7 @@ export function buildPluginInspectReport(params: {
|
||||
}
|
||||
|
||||
export function buildAllPluginInspectReports(params?: {
|
||||
config?: ReturnType<typeof loadConfig>;
|
||||
config?: OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
report?: PluginStatusReport;
|
||||
@@ -448,7 +450,7 @@ export function buildAllPluginInspectReports(params?: {
|
||||
}
|
||||
|
||||
export function buildPluginCompatibilityWarnings(params?: {
|
||||
config?: ReturnType<typeof loadConfig>;
|
||||
config?: OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
report?: PluginStatusReport;
|
||||
@@ -457,7 +459,7 @@ export function buildPluginCompatibilityWarnings(params?: {
|
||||
}
|
||||
|
||||
export function buildPluginCompatibilityNotices(params?: {
|
||||
config?: ReturnType<typeof loadConfig>;
|
||||
config?: OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
report?: PluginStatusReport;
|
||||
|
||||
@@ -15,13 +15,14 @@ import type { ModelCatalogEntry } from "../agents/model-catalog.types.js";
|
||||
import type { FailoverReason } from "../agents/pi-embedded-helpers/types.js";
|
||||
import type { ModelProviderRequestTransportOverrides } from "../agents/provider-request-config.js";
|
||||
import type { ProviderSystemPromptContribution } from "../agents/system-prompt-contribution.js";
|
||||
import type { PromptMode } from "../agents/system-prompt.js";
|
||||
import type { PromptMode } from "../agents/system-prompt.types.js";
|
||||
import type { AnyAgentTool } from "../agents/tools/common.js";
|
||||
import type { ReplyDispatchKind, ReplyDispatcher } from "../auto-reply/reply/reply-dispatcher.js";
|
||||
import type { FinalizedMsgContext } from "../auto-reply/templating.js";
|
||||
import type { ThinkLevel } from "../auto-reply/thinking.js";
|
||||
import type { ThinkLevel } from "../auto-reply/thinking.shared.js";
|
||||
import type { ReplyPayload } from "../auto-reply/types.js";
|
||||
import type { ChannelId, ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
import type { ChannelId } from "../channels/plugins/types.public.js";
|
||||
import type { CliBackendConfig, ModelProviderConfig } from "../config/types.js";
|
||||
import type { ModelCompatConfig } from "../config/types.models.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
@@ -97,6 +98,12 @@ import type {
|
||||
PluginHookMessageSendingResult,
|
||||
PluginHookMessageSentEvent,
|
||||
} from "./hook-message.types.js";
|
||||
import type {
|
||||
PluginBundleFormat,
|
||||
PluginConfigUiHint,
|
||||
PluginDiagnostic,
|
||||
PluginFormat,
|
||||
} from "./manifest-types.js";
|
||||
import type { PluginKind } from "./plugin-kind.types.js";
|
||||
import type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
import type { SecretInputMode } from "./provider-auth-types.js";
|
||||
@@ -124,6 +131,12 @@ import type { WebFetchProviderPlugin, WebSearchProviderPlugin } from "./web-prov
|
||||
|
||||
export type { PluginRuntime } from "./runtime/types.js";
|
||||
export type { PluginOrigin } from "./plugin-origin.types.js";
|
||||
export type {
|
||||
PluginBundleFormat,
|
||||
PluginConfigUiHint,
|
||||
PluginDiagnostic,
|
||||
PluginFormat,
|
||||
} from "./manifest-types.js";
|
||||
export type {
|
||||
OpenClawPluginHookOptions,
|
||||
OpenClawPluginToolContext,
|
||||
@@ -168,15 +181,6 @@ export type PluginLogger = {
|
||||
error: (message: string) => void;
|
||||
};
|
||||
|
||||
export type PluginConfigUiHint = {
|
||||
label?: string;
|
||||
help?: string;
|
||||
tags?: string[];
|
||||
advanced?: boolean;
|
||||
sensitive?: boolean;
|
||||
placeholder?: string;
|
||||
};
|
||||
|
||||
export type { PluginKind } from "./plugin-kind.types.js";
|
||||
export type {
|
||||
PluginHookInboundClaimContext,
|
||||
@@ -2162,17 +2166,6 @@ export type OpenClawPluginApi = {
|
||||
) => void;
|
||||
};
|
||||
|
||||
export type PluginFormat = "openclaw" | "bundle";
|
||||
|
||||
export type PluginBundleFormat = "codex" | "claude" | "cursor";
|
||||
|
||||
export type PluginDiagnostic = {
|
||||
level: "warn" | "error";
|
||||
message: string;
|
||||
pluginId?: string;
|
||||
source?: string;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// Plugin Hooks
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user