needs-reply: filter by franz.hubert@docfast.dev assignee

This commit is contained in:
Hoid 2026-02-16 20:43:02 +00:00
parent 5dc184a33b
commit edc030e932

View file

@ -147,7 +147,8 @@ async function cmdReply(args) {
} }
async function cmdNeedsReply(args) { async function cmdNeedsReply(args) {
// Show only tickets where the last non-note thread is from a customer (needs agent reply) // Show only tickets assigned to the AI agent (franz.hubert@docfast.dev) where the last non-note thread is from a customer
const AI_AGENT_EMAIL = 'franz.hubert@docfast.dev';
const page = getFlag(args, '--page') || '1'; const page = getFlag(args, '--page') || '1';
let endpoint = `/conversations?page=${page}&status=active`; let endpoint = `/conversations?page=${page}&status=active`;
if (MAILBOX_ID) endpoint += `&mailboxId=${MAILBOX_ID}`; if (MAILBOX_ID) endpoint += `&mailboxId=${MAILBOX_ID}`;
@ -160,6 +161,10 @@ async function cmdNeedsReply(args) {
const needsReply = []; const needsReply = [];
for (const c of conversations) { for (const c of conversations) {
// Only tickets assigned to the AI agent
const assignee = c.assignee?.email || c.user?.email || '';
if (assignee.toLowerCase() !== AI_AGENT_EMAIL.toLowerCase()) continue;
const tRes = await apiRequest('GET', `/conversations/${c.id}/threads`); const tRes = await apiRequest('GET', `/conversations/${c.id}/threads`);
if (tRes.status !== 200) continue; if (tRes.status !== 200) continue;
const threads = (tRes.data._embedded?.threads || []) const threads = (tRes.data._embedded?.threads || [])