mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 04:31:10 +00:00
fix: align gateway approval typings
This commit is contained in:
@@ -15,7 +15,7 @@ export const APPROVAL_NOT_FOUND_DETAILS = {
|
||||
type PendingApprovalLookupError =
|
||||
| "missing"
|
||||
| {
|
||||
code: ErrorCodes.INVALID_REQUEST;
|
||||
code: (typeof ErrorCodes)["INVALID_REQUEST"];
|
||||
message: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
DEFAULT_EXEC_APPROVAL_TIMEOUT_MS,
|
||||
resolveExecApprovalAllowedDecisions,
|
||||
resolveExecApprovalRequestAllowedDecisions,
|
||||
type ExecApprovalDecision,
|
||||
type ExecApprovalRequest,
|
||||
type ExecApprovalResolved,
|
||||
} from "../../infra/exec-approvals.js";
|
||||
@@ -324,17 +325,18 @@ export function createExecApprovalHandlers(
|
||||
respond(false, undefined, errorShape(ErrorCodes.INVALID_REQUEST, "invalid decision"));
|
||||
return;
|
||||
}
|
||||
const decision: ExecApprovalDecision = p.decision;
|
||||
await handleApprovalResolve({
|
||||
manager,
|
||||
inputId: p.id,
|
||||
decision: p.decision,
|
||||
decision,
|
||||
respond,
|
||||
context,
|
||||
client,
|
||||
exposeAmbiguousPrefixError: true,
|
||||
validateDecision: (snapshot) => {
|
||||
const allowedDecisions = resolveExecApprovalRequestAllowedDecisions(snapshot.request);
|
||||
return allowedDecisions.includes(p.decision)
|
||||
return allowedDecisions.includes(decision)
|
||||
? null
|
||||
: {
|
||||
message:
|
||||
|
||||
@@ -13,7 +13,15 @@ const mocks = vi.hoisted(() => ({
|
||||
resolveOutboundSessionRoute: vi.fn(),
|
||||
ensureOutboundSessionEntry: vi.fn(async () => undefined),
|
||||
resolveMessageChannelSelection: vi.fn(),
|
||||
sendPoll: vi.fn(async () => ({ messageId: "poll-1" })),
|
||||
sendPoll: vi.fn<
|
||||
() => Promise<{
|
||||
messageId: string;
|
||||
toJid?: string;
|
||||
channelId?: string;
|
||||
conversationId?: string;
|
||||
pollId?: string;
|
||||
}>
|
||||
>(async () => ({ messageId: "poll-1" })),
|
||||
getChannelPlugin: vi.fn(),
|
||||
loadOpenClawPlugins: vi.fn(),
|
||||
applyPluginAutoEnable: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user