mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-16 19:51:11 +00:00
* fix: address issue * docs(changelog): add feishu workspace-only docx entry --------- Co-authored-by: Devin Robison <drobison@nvidia.com>
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import type { OpenClawConfig } from "../config/config.js";
|
|
import { resolvePluginTools } from "../plugins/tools.js";
|
|
import { getActiveSecretsRuntimeSnapshot } from "../secrets/runtime.js";
|
|
import { normalizeDeliveryContext } from "../utils/delivery-context.js";
|
|
import {
|
|
resolveOpenClawPluginToolInputs,
|
|
type OpenClawPluginToolOptions,
|
|
} from "./openclaw-tools.plugin-context.js";
|
|
import { applyPluginToolDeliveryDefaults } from "./plugin-tool-delivery-defaults.js";
|
|
import type { AnyAgentTool } from "./tools/common.js";
|
|
|
|
type ResolveOpenClawPluginToolsOptions = OpenClawPluginToolOptions & {
|
|
pluginToolAllowlist?: string[];
|
|
currentChannelId?: string;
|
|
currentThreadTs?: string;
|
|
currentMessageId?: string | number;
|
|
sandboxRoot?: string;
|
|
modelHasVision?: boolean;
|
|
modelProvider?: string;
|
|
allowMediaInvokeCommands?: boolean;
|
|
requesterAgentIdOverride?: string;
|
|
requireExplicitMessageTarget?: boolean;
|
|
disableMessageTool?: boolean;
|
|
disablePluginTools?: boolean;
|
|
};
|
|
|
|
export function resolveOpenClawPluginToolsForOptions(params: {
|
|
options?: ResolveOpenClawPluginToolsOptions;
|
|
resolvedConfig?: OpenClawConfig;
|
|
existingToolNames?: Set<string>;
|
|
}): AnyAgentTool[] {
|
|
if (params.options?.disablePluginTools) {
|
|
return [];
|
|
}
|
|
|
|
const runtimeSnapshot = getActiveSecretsRuntimeSnapshot();
|
|
const deliveryContext = normalizeDeliveryContext({
|
|
channel: params.options?.agentChannel,
|
|
to: params.options?.agentTo,
|
|
accountId: params.options?.agentAccountId,
|
|
threadId: params.options?.agentThreadId,
|
|
});
|
|
|
|
const pluginTools = resolvePluginTools({
|
|
...resolveOpenClawPluginToolInputs({
|
|
options: params.options,
|
|
resolvedConfig: params.resolvedConfig,
|
|
runtimeConfig: runtimeSnapshot?.config,
|
|
}),
|
|
existingToolNames: params.existingToolNames ?? new Set<string>(),
|
|
toolAllowlist: params.options?.pluginToolAllowlist,
|
|
});
|
|
|
|
return applyPluginToolDeliveryDefaults({
|
|
tools: pluginTools,
|
|
deliveryContext,
|
|
});
|
|
}
|