mirror of
https://fastgit.cc/github.com/openclaw/openclaw
synced 2026-04-30 22:12:32 +08:00
fix(types): align setup helper contracts
This commit is contained in:
@@ -118,6 +118,13 @@ vi.mock("../monitor/agent-components.runtime.js", () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("../interactive-dispatch.js", () => {
|
||||
return {
|
||||
dispatchDiscordPluginInteractiveHandler: (...args: unknown[]) =>
|
||||
dispatchPluginInteractiveHandlerMock(...args),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("../monitor/agent-components.deps.runtime.js", () => {
|
||||
return {
|
||||
enqueueSystemEvent: (...args: unknown[]) => enqueueSystemEventMock(...args),
|
||||
|
||||
@@ -32,13 +32,13 @@ function resolveMatrixExecApprovalConfig(params: {
|
||||
}) {
|
||||
const account = resolveMatrixAccount(params);
|
||||
const config = account.config.execApprovals;
|
||||
if (!config) {
|
||||
return undefined;
|
||||
if (!config || !account.enabled || !account.configured || config.enabled !== true) {
|
||||
return { enabled: false } as const;
|
||||
}
|
||||
return {
|
||||
...config,
|
||||
enabled: account.enabled && account.configured ? config.enabled : false,
|
||||
};
|
||||
enabled: true as const,
|
||||
} as const;
|
||||
}
|
||||
|
||||
function countMatrixExecApprovalEligibleAccounts(params: {
|
||||
@@ -54,7 +54,7 @@ function countMatrixExecApprovalEligibleAccounts(params: {
|
||||
cfg: params.cfg,
|
||||
accountId,
|
||||
});
|
||||
if (!config?.enabled) {
|
||||
if (!config.enabled) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
|
||||
@@ -1372,8 +1372,8 @@ export function createNestedChannelParsedAllowFromPrompt(params: {
|
||||
section: params.section,
|
||||
...(params.enabled ? { enabled: true } : {}),
|
||||
});
|
||||
return createPromptParsedAllowFromForAccount({
|
||||
defaultAccountId: params.defaultAccountId,
|
||||
const defaultAccountId = params.defaultAccountId;
|
||||
const sharedParams = {
|
||||
...(params.noteTitle ? { noteTitle: params.noteTitle } : {}),
|
||||
...(params.noteLines ? { noteLines: params.noteLines } : {}),
|
||||
message: params.message,
|
||||
@@ -1390,6 +1390,18 @@ export function createNestedChannelParsedAllowFromPrompt(params: {
|
||||
...(params.mergeEntries ? { mergeEntries: params.mergeEntries } : {}),
|
||||
applyAllowFrom: ({ cfg, allowFrom }: { cfg: OpenClawConfig; allowFrom: string[] }) =>
|
||||
setAllowFrom(cfg, allowFrom),
|
||||
};
|
||||
|
||||
if (typeof defaultAccountId === "function") {
|
||||
return createPromptParsedAllowFromForAccount({
|
||||
defaultAccountId,
|
||||
...sharedParams,
|
||||
});
|
||||
}
|
||||
|
||||
return createPromptParsedAllowFromForAccount({
|
||||
defaultAccountId,
|
||||
...sharedParams,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user