fix(reply): address CI type errors for cross-run dedupe state
This commit is contained in:
parent
a1b5386693
commit
15dd43f6bc
@ -419,34 +419,35 @@ export async function runReplyAgent(params: {
|
||||
const sentTexts = runResult.messagingToolSentTexts ?? [];
|
||||
const sentMediaUrls = runResult.messagingToolSentMediaUrls ?? [];
|
||||
const sentTargets = runResult.messagingToolSentTargets ?? [];
|
||||
if (activeSessionEntry) {
|
||||
const sessionDedupeEntry = activeSessionEntry;
|
||||
if (sessionDedupeEntry) {
|
||||
const now = Date.now();
|
||||
if (sentTexts.length || sentMediaUrls.length || sentTargets.length) {
|
||||
activeSessionEntry.lastMessagingToolSentAt = now;
|
||||
activeSessionEntry.lastMessagingToolSentTexts = sentTexts;
|
||||
activeSessionEntry.lastMessagingToolSentMediaUrls = sentMediaUrls;
|
||||
activeSessionEntry.lastMessagingToolSentTargets = sentTargets;
|
||||
sessionDedupeEntry.lastMessagingToolSentAt = now;
|
||||
sessionDedupeEntry.lastMessagingToolSentTexts = sentTexts;
|
||||
sessionDedupeEntry.lastMessagingToolSentMediaUrls = sentMediaUrls;
|
||||
sessionDedupeEntry.lastMessagingToolSentTargets = sentTargets;
|
||||
} else if (
|
||||
typeof activeSessionEntry.lastMessagingToolSentAt === "number" &&
|
||||
now - activeSessionEntry.lastMessagingToolSentAt > RECENT_MESSAGING_TOOL_DEDUPE_WINDOW_MS
|
||||
typeof sessionDedupeEntry.lastMessagingToolSentAt === "number" &&
|
||||
now - sessionDedupeEntry.lastMessagingToolSentAt > RECENT_MESSAGING_TOOL_DEDUPE_WINDOW_MS
|
||||
) {
|
||||
delete activeSessionEntry.lastMessagingToolSentAt;
|
||||
delete activeSessionEntry.lastMessagingToolSentTexts;
|
||||
delete activeSessionEntry.lastMessagingToolSentMediaUrls;
|
||||
delete activeSessionEntry.lastMessagingToolSentTargets;
|
||||
delete sessionDedupeEntry.lastMessagingToolSentAt;
|
||||
delete sessionDedupeEntry.lastMessagingToolSentTexts;
|
||||
delete sessionDedupeEntry.lastMessagingToolSentMediaUrls;
|
||||
delete sessionDedupeEntry.lastMessagingToolSentTargets;
|
||||
}
|
||||
if (sessionKey && activeSessionStore) {
|
||||
activeSessionStore[sessionKey] = activeSessionEntry;
|
||||
activeSessionStore[sessionKey] = sessionDedupeEntry;
|
||||
}
|
||||
if (sessionKey && storePath) {
|
||||
await updateSessionStoreEntry({
|
||||
storePath,
|
||||
sessionKey,
|
||||
update: async () => ({
|
||||
lastMessagingToolSentAt: activeSessionEntry.lastMessagingToolSentAt,
|
||||
lastMessagingToolSentTexts: activeSessionEntry.lastMessagingToolSentTexts,
|
||||
lastMessagingToolSentMediaUrls: activeSessionEntry.lastMessagingToolSentMediaUrls,
|
||||
lastMessagingToolSentTargets: activeSessionEntry.lastMessagingToolSentTargets,
|
||||
lastMessagingToolSentAt: sessionDedupeEntry.lastMessagingToolSentAt,
|
||||
lastMessagingToolSentTexts: sessionDedupeEntry.lastMessagingToolSentTexts,
|
||||
lastMessagingToolSentMediaUrls: sessionDedupeEntry.lastMessagingToolSentMediaUrls,
|
||||
lastMessagingToolSentTargets: sessionDedupeEntry.lastMessagingToolSentTargets,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import crypto from "node:crypto";
|
||||
import type { Skill } from "@mariozechner/pi-coding-agent";
|
||||
import type { MessagingToolSend } from "../../agents/pi-embedded-runner.js";
|
||||
import type { ChatType } from "../../channels/chat-type.js";
|
||||
import type { ChannelId } from "../../channels/plugins/types.js";
|
||||
import type { DeliveryContext } from "../../utils/delivery-context.js";
|
||||
@ -80,12 +81,7 @@ export type SessionEntry = {
|
||||
/** Recently sent message-tool media urls for short-window cross-run dedupe. */
|
||||
lastMessagingToolSentMediaUrls?: string[];
|
||||
/** Recently sent message-tool routing targets for short-window cross-run dedupe. */
|
||||
lastMessagingToolSentTargets?: Array<{
|
||||
tool?: string;
|
||||
provider?: string;
|
||||
to?: string;
|
||||
accountId?: string;
|
||||
}>;
|
||||
lastMessagingToolSentTargets?: MessagingToolSend[];
|
||||
sessionId: string;
|
||||
updatedAt: number;
|
||||
sessionFile?: string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user