mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 17:51:22 +00:00
Auto-reply: fix reset test gate
This commit is contained in:
@@ -14,7 +14,7 @@ vi.mock("./reply/dispatch-from-config.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("./reply/inbound-context.js", () => ({
|
||||
finalizeInboundContext: (...args: unknown[]) => hoisted.finalizeInboundContextMock(...args),
|
||||
finalizeInboundContext: (ctx: unknown) => hoisted.finalizeInboundContextMock(ctx),
|
||||
}));
|
||||
|
||||
vi.mock("./reply/reply-dispatcher.js", async () => {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { resetConfiguredBindingTargetInPlace } from "../../channels/plugins/binding-targets.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import { isAcpSessionKey } from "../../routing/session-key.js";
|
||||
import { normalizeOptionalLowercaseString } from "../../shared/string-coerce.js";
|
||||
import { resolveBoundAcpThreadSessionKey } from "./commands-acp/targets.js";
|
||||
import { emitResetCommandHooks, type ResetCommandAction } from "./commands-reset-hooks.js";
|
||||
import type { CommandHandlerResult, HandleCommandsParams } from "./commands-types.js";
|
||||
@@ -16,29 +15,6 @@ function applyAcpResetTailContext(ctx: HandleCommandsParams["ctx"], resetTail: s
|
||||
mutableCtx.BodyStripped = resetTail;
|
||||
mutableCtx.AcpDispatchTailAfterReset = true;
|
||||
}
|
||||
|
||||
function resolveSessionEntryForHookSessionKey(
|
||||
sessionStore: HandleCommandsParams["sessionStore"] | undefined,
|
||||
sessionKey: string,
|
||||
): HandleCommandsParams["sessionEntry"] | undefined {
|
||||
if (!sessionStore) {
|
||||
return undefined;
|
||||
}
|
||||
const directEntry = sessionStore[sessionKey];
|
||||
if (directEntry) {
|
||||
return directEntry;
|
||||
}
|
||||
const normalizedTarget = sessionKey.trim().toLowerCase();
|
||||
if (!normalizedTarget) {
|
||||
return undefined;
|
||||
}
|
||||
for (const [candidateKey, candidateEntry] of Object.entries(sessionStore)) {
|
||||
if (normalizeOptionalLowercaseString(candidateKey) === normalizedTarget) {
|
||||
return candidateEntry;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
export async function maybeHandleResetCommand(
|
||||
params: HandleCommandsParams,
|
||||
): Promise<CommandHandlerResult | null> {
|
||||
|
||||
Reference in New Issue
Block a user