🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat: notify user when a long agent run completes (#17331)
Tsuki22fa48a13fde
diff --git a/apps/server/src/services/agentRuntime/CompletionLifecycle.ts b/apps/server/src/services/agentRuntime/CompletionLifecycle.tsindex cd24fab9831..335dc606605 100644--- a/apps/server/src/services/agentRuntime/CompletionLifecycle.ts+++ b/apps/server/src/services/agentRuntime/CompletionLifecycle.ts@@ -4,6 +4,7 @@ import { deserializeParts } from '@lobechat/utils';import { isRecord } from '@lobechat/utils/object';import debug from 'debug';+import { notifyAgentRunCompleted } from '@/business/server/agent-run/notifyAgentRunCompleted';import {AgentOperationModel,type ChildUsageRollup,@@ -569,6 +570,28 @@ export class CompletionLifecycle {// plan against the deliverable. Fire-and-forget and self-guarded — a run// without an opted-in plan is a no-op, and failures never affect the run.if (reason === 'done') {+ // Recall the user when a long run finishes cleanly while they may be+ // away (push / inbox). Fire-and-forget through the `@/business` slot —+ // the default implementation is a no-op. Sub-agent / group member+ // completions are internal steps of a parent run, never a user-facing+ // recall — in-group members carry `orchestrationRole: 'member'`+ // WITHOUT `isSubAgent` (see execAgentMember), so guard both.+ if (metadata?.isSubAgent !== true && metadata?.orchestrationRole !== 'member') {+ void notifyAgentRunCompleted({+ agentId: event.agentId || undefined,+ duration: event.duration,+ lastAssistantContent: event.lastAssistantContent,+ operationId,+ topicId: event.topicId,+ userId: metadata?.userId || this.userId,+ // Personal runs leave this undefined ⇒ bare deep link; workspace+ // runs carry the id so the business slot can slug-prefix the URL.+ workspaceId: this.workspaceId,+ }).catch((error) =>+ log('[%s] Completion notification failed (non-fatal): %O', operationId, error),+ );+ }+// The task's verify plan is instantiated fire-and-forget at run start; a// fast or no-op run can reach completion before it settles. Await the// in-flight instantiation (if any) so the gate sees the confirmed plandiff --git a/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.ts b/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.tsindex 5a89d01f9d3..94e285decbc 100644--- a/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.ts+++ b/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.ts@@ -9,6 +9,18 @@ import * as verifyServices from '@/server/services/verify';import { CompletionLifecycle } from '../CompletionLifecycle';import { hookDispatcher } from '../hooks';+// Default async no-op implementation: the production code chains `.catch` on+// the returned promise, so a bare vi.fn() (returning undefined) would throw+// inside every unrelated `done`-path test. mockRestore/mockReset fall back to+// this original implementation.+const { mockNotifyAgentRunCompleted } = vi.hoisted(() => ({+ mockNotifyAgentRunCompleted: vi.fn(async () => {}),+}));++vi.mock('@/business/server/agent-run/notifyAgentRunCompleted', () => ({+ notifyAgentRunCompleted: mockNotifyAgentRunCompleted,+}));+const flushMicrotasks = () => new Promise((resolve) => setTimeout(resolve, 0));const buildLifecycle = () => new CompletionLifecycle({} as any, 'user-1');@@ -587,6 +599,128 @@ describe('CompletionLifecycle.dispatchHooks — async-tool park', () => {});});+describe('CompletionLifecycle.dispatchHooks — completion notification', () => {+ afterEach(() => {+ vi.restoreAllMocks();+ mockNotifyAgentRunCompleted.mockClear();+ });++ const stubSideEffects = (lifecycle: CompletionLifecycle) => {+ vi.spyOn(lifecycle as any, 'persistCompletion').mockResolvedValue(undefined);+ vi.spyOn(lifecycle as any, 'createVerifyMessage').mockResolvedValue(undefined);+ vi.spyOn(hookDispatcher, 'dispatch').mockResolvedValue(undefined as any);+ vi.spyOn(hookDispatcher, 'unregister').mockImplementation(() => {});+ vi.spyOn(verifyServices, 'runVerifyOnCompletion').mockResolvedValue(undefined);+ };++ it('notifies with fields mapped from the lifecycle event on a done completion', async () => {+ const lifecycle = buildLifecycle();+ stubSideEffects(lifecycle);++ const createdAt = new Date(Date.now() - 90_000).toISOString();+ const doneState = {+ createdAt,+ messages: [{ content: 'final reply', role: 'assistant' }],+ metadata: { _hooks: [], agentId: 'agt_1', topicId: 'tpc_1', userId: 'user-2' },+ status: 'done',+ };+ await lifecycle.dispatchHooks('op-1', doneState, 'done');++ expect(mockNotifyAgentRunCompleted).toHaveBeenCalledTimes(1);+ expect(mockNotifyAgentRunCompleted).toHaveBeenCalledWith(+ expect.objectContaining({+ agentId: 'agt_1',+ duration: expect.any(Number),+ lastAssistantContent: 'final reply',+ operationId: 'op-1',+ topicId: 'tpc_1',+ userId: 'user-2',+ // Personal lifecycle (no workspaceId) forwards undefined ⇒ bare link.+ workspaceId: undefined,+ }),+ );+ });++ it('forwards the workspace id so a team run gets a workspace-scoped deep link', async () => {+ const lifecycle = new CompletionLifecycle({} as any, 'user-1', 'ws_1');+ stubSideEffects(lifecycle);++ const doneState = {+ createdAt: new Date(Date.now() - 90_000).toISOString(),+ messages: [{ content: 'final reply', role: 'assistant' }],+ metadata: { _hooks: [], agentId: 'agt_1', topicId: 'tpc_1', userId: 'user-2' },+ status: 'done',+ };+ await lifecycle.dispatchHooks('op-1', doneState, 'done');++ expect(mockNotifyAgentRunCompleted).toHaveBeenCalledWith(+ expect.objectContaining({ workspaceId: 'ws_1' }),+ );+ });++ it('does not notify for sub-agent completions', async () => {+ const lifecycle = buildLifecycle();+ stubSideEffects(lifecycle);++ const doneState = {+ metadata: { _hooks: [], agentId: 'agt_1', isSubAgent: true, topicId: 'tpc_1' },+ status: 'done',+ };+ await lifecycle.dispatchHooks('op-1', doneState, 'done');++ expect(mockNotifyAgentRunCompleted).not.toHaveBeenCalled();+ });++ it('does not notify for in-group member completions (orchestrationRole without isSubAgent)', async () => {+ const lifecycle = buildLifecycle();+ stubSideEffects(lifecycle);++ // execAgentMember stamps in-group members with orchestrationRole: 'member'+ // but NOT isSubAgent — they are internal steps of the supervisor run.+ const doneState = {+ metadata: { _hooks: [], agentId: 'agt_1', orchestrationRole: 'member', topicId: 'tpc_1' },+ status: 'done',+ };+ await lifecycle.dispatchHooks('op-1', doneState, 'done');++ expect(mockNotifyAgentRunCompleted).not.toHaveBeenCalled();+ });++ it('does not notify on non-done terminals', async () => {+ const lifecycle = buildLifecycle();+ stubSideEffects(lifecycle);++ await lifecycle.dispatchHooks(+ 'op-1',+ { metadata: { _hooks: [], agentId: 'agt_1' }, status: 'error' },+ 'error',+ );++ expect(mockNotifyAgentRunCompleted).not.toHaveBeenCalled();+ });++ it('a notification rejection never breaks the dispatch pipeline', async () => {+ const lifecycle = buildLifecycle();+ stubSideEffects(lifecycle);+ // Once-only: a persistent mockRejectedValue would survive afterEach+ // (restoreAllMocks skips plain vi.fn, mockClear keeps implementations)+ // and leak into later dispatchHooks('done') tests in this file.+ mockNotifyAgentRunCompleted.mockRejectedValueOnce(new Error('push provider down'));++ const doneState = { metadata: { _hooks: [], agentId: 'agt_1' }, status: 'done' };+ await expect(lifecycle.dispatchHooks('op-1', doneState, 'done')).resolves.toBeUndefined();+ await flushMicrotasks();++ expect(hookDispatcher.dispatch).toHaveBeenCalledWith(+ 'op-1',+ 'onComplete',+ expect.anything(),+ [],+ );+ expect(hookDispatcher.unregister).toHaveBeenCalledWith('op-1');+ });+});+describe('CompletionLifecycle.dispatchHooks — lastAssistantContent DB recovery (LOBE-11632)', () => {afterEach(() => {vi.restoreAllMocks();diff --git a/locales/ar/notification.json b/locales/ar/notification.jsonindex 3126924c1b3..ed8ffc29981 100644--- a/locales/ar/notification.json+++ b/locales/ar/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "تعذّر تشغيل مهمتك المجدولة \"{{jobName}}\" بسبب نفاد رصيد الحساب. يُرجى شحن الرصيد أو ترقية خطتك لاستئناف التشغيل المستقبلي.","agent_cron_job_failed_insufficient_budget_title": "إيقاف المهمة المجدولة: رصيد غير كافٍ","agent_cron_job_failed_title": "فشل المهمة المجدولة",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "اكتملت مهمة الوكيل","billboard.learnMore": "معرفة المزيد","billboard.menuLabel": "الإعلانات","category.billing": "الفواتير",diff --git a/locales/ar/setting.json b/locales/ar/setting.jsonindex 305d7866e87..01ecf62ef72 100644--- a/locales/ar/setting.json+++ b/locales/ar/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "منشور","myAgents.status.unpublished": "غير منشور","myAgents.title": "وكلائي المنشورون",+ "notification.category.agent.title": "وكيل","notification.category.billing.title": "الفواتير","notification.category.generation.title": "الإنشاء","notification.category.schedule.title": "المهام المجدولة",@@ -554,6 +555,7 @@"notification.inbox.desc": "عرض الإشعارات في صندوق الوارد داخل التطبيق","notification.inbox.title": "إشعارات صندوق الوارد","notification.item.agent_cron_job_failed": "فشل المهمة المجدولة",+ "notification.item.agent_run_completed": "تم إكمال مهمة الوكيل","notification.item.credit_balance_low": "رصيد الائتمان منخفض","notification.item.image_generation_completed": "اكتمل إنشاء الصورة","notification.item.storage_overage_cap_reached": "تم الوصول إلى الحد الأقصى للدفع حسب الاستخدام للتخزين",diff --git a/locales/bg-BG/notification.json b/locales/bg-BG/notification.jsonindex 0379ee47659..ba9f7ab2e4d 100644--- a/locales/bg-BG/notification.json+++ b/locales/bg-BG/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Планираната ви задача \"{{jobName}}\" не можа да се изпълни, защото кредитите по акаунта ви са изчерпани. Заредете кредити или надградете плана си, за да възобновите бъдещите изпълнения.","agent_cron_job_failed_insufficient_budget_title": "Планираната задача е поставена на пауза: недостатъчно кредити","agent_cron_job_failed_title": "Планираната задача се провали",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Задачата на агента е завършена","billboard.learnMore": "Научете повече","billboard.menuLabel": "Съобщения","category.billing": "Фактуриране",diff --git a/locales/bg-BG/setting.json b/locales/bg-BG/setting.jsonindex c0680f5177c..aafe09e466e 100644--- a/locales/bg-BG/setting.json+++ b/locales/bg-BG/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Публикуван","myAgents.status.unpublished": "Скрит","myAgents.title": "Моите публикувани агенти",+ "notification.category.agent.title": "Агент","notification.category.billing.title": "Фактуриране","notification.category.generation.title": "Генериране","notification.category.schedule.title": "Планирани задачи",@@ -554,6 +555,7 @@"notification.inbox.desc": "Показване на известия в приложението","notification.inbox.title": "Известия в пощенската кутия","notification.item.agent_cron_job_failed": "Планираната задача не успя",+ "notification.item.agent_run_completed": "Задачата на агента е завършена","notification.item.credit_balance_low": "Кредитният баланс е на изчерпване","notification.item.image_generation_completed": "Генерирането на изображение завърши","notification.item.storage_overage_cap_reached": "Достигнат лимит за допълнително съхранение",diff --git a/locales/de-DE/notification.json b/locales/de-DE/notification.jsonindex 8d08f5f9a0c..54007fe1e8b 100644--- a/locales/de-DE/notification.json+++ b/locales/de-DE/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Ihre geplante Aufgabe „{{jobName}}“ konnte nicht ausgeführt werden, da Ihr Guthaben aufgebraucht ist. Laden Sie Ihr Konto auf oder upgraden Sie Ihren Tarif, um zukünftige Ausführungen fortzusetzen.","agent_cron_job_failed_insufficient_budget_title": "Geplante Aufgabe pausiert: unzureichendes Guthaben","agent_cron_job_failed_title": "Geplante Aufgabe fehlgeschlagen",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Agentenaufgabe abgeschlossen","billboard.learnMore": "Mehr erfahren","billboard.menuLabel": "Ankündigungen","category.billing": "Abrechnung",diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.jsonindex 2f06e17705a..de1f6faccb5 100644--- a/locales/de-DE/setting.json+++ b/locales/de-DE/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Veröffentlicht","myAgents.status.unpublished": "Zurückgezogen","myAgents.title": "Meine veröffentlichten Agenten",+ "notification.category.agent.title": "Agent","notification.category.billing.title": "Abrechnung","notification.category.generation.title": "Erstellung","notification.category.schedule.title": "Geplante Aufgaben",@@ -554,6 +555,7 @@"notification.inbox.desc": "Zeigen Sie Benachrichtigungen im In-App-Posteingang an","notification.inbox.title": "Posteingangs-Benachrichtigungen","notification.item.agent_cron_job_failed": "Geplanter Task fehlgeschlagen",+ "notification.item.agent_run_completed": "Agent-Aufgabe abgeschlossen","notification.item.credit_balance_low": "Guthabenstand niedrig","notification.item.image_generation_completed": "Bilderstellung abgeschlossen","notification.item.storage_overage_cap_reached": "Speicher-Pay-as-you-go-Limit erreicht",diff --git a/locales/en-US/notification.json b/locales/en-US/notification.jsonindex 2bba2b0444d..b1f365d3875 100644--- a/locales/en-US/notification.json+++ b/locales/en-US/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Your scheduled task \"{{jobName}}\" couldn't run because your account is out of credits. Top up or upgrade your plan to resume future runs.","agent_cron_job_failed_insufficient_budget_title": "Scheduled task paused: insufficient credits","agent_cron_job_failed_title": "Scheduled task failed",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Agent task completed","billboard.learnMore": "Learn more","billboard.menuLabel": "Announcements","category.billing": "Billing",diff --git a/locales/en-US/setting.json b/locales/en-US/setting.jsonindex 9072499e2ed..c9f671e10f6 100644--- a/locales/en-US/setting.json+++ b/locales/en-US/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Published","myAgents.status.unpublished": "Unpublished","myAgents.title": "My Published Agents",+ "notification.category.agent.title": "Agent","notification.category.billing.title": "Billing","notification.category.generation.title": "Generation","notification.category.schedule.title": "Scheduled tasks",@@ -554,6 +555,7 @@"notification.inbox.desc": "Show notifications in the in-app inbox","notification.inbox.title": "Inbox Notifications","notification.item.agent_cron_job_failed": "Scheduled task failed",+ "notification.item.agent_run_completed": "Agent task completed","notification.item.credit_balance_low": "Credit balance running low","notification.item.image_generation_completed": "Image generation completed","notification.item.storage_overage_cap_reached": "Storage pay-as-you-go cap reached",diff --git a/locales/es-ES/notification.json b/locales/es-ES/notification.jsonindex 11f05091b73..7ec2e69ca3c 100644--- a/locales/es-ES/notification.json+++ b/locales/es-ES/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Tu tarea programada \"{{jobName}}\" no pudo ejecutarse porque tu cuenta no tiene créditos suficientes. Recarga o actualiza tu plan para reanudar las próximas ejecuciones.","agent_cron_job_failed_insufficient_budget_title": "Tarea programada en pausa: créditos insuficientes","agent_cron_job_failed_title": "Fallo en la tarea programada",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Tarea del agente completada","billboard.learnMore": "Más información","billboard.menuLabel": "Anuncios","category.billing": "Facturación",diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.jsonindex f3a62a9f696..c2ad16a07b5 100644--- a/locales/es-ES/setting.json+++ b/locales/es-ES/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Publicado","myAgents.status.unpublished": "No Publicado","myAgents.title": "Mis Agentes Publicados",+ "notification.category.agent.title": "Agente","notification.category.billing.title": "Facturación","notification.category.generation.title": "Generación","notification.category.schedule.title": "Tareas programadas",@@ -554,6 +555,7 @@"notification.inbox.desc": "Muestra notificaciones en la bandeja de entrada de la aplicación","notification.inbox.title": "Notificaciones en la Bandeja de Entrada","notification.item.agent_cron_job_failed": "La tarea programada falló",+ "notification.item.agent_run_completed": "Tarea del agente completada","notification.item.credit_balance_low": "El saldo de crédito está bajo","notification.item.image_generation_completed": "Generación de imagen completada","notification.item.storage_overage_cap_reached": "Se alcanzó el límite de almacenamiento por uso adicional",diff --git a/locales/fa-IR/notification.json b/locales/fa-IR/notification.jsonindex 4e8b36bf701..9939ada527c 100644--- a/locales/fa-IR/notification.json+++ b/locales/fa-IR/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "وظیفه زمانبندیشده شما «{{jobName}}» اجرا نشد زیرا اعتبار حساب شما کافی نیست. برای ادامه اجرای وظایف، حساب خود را شارژ یا پلن خود را ارتقا دهید.","agent_cron_job_failed_insufficient_budget_title": "توقف وظیفه زمانبندیشده: اعتبار ناکافی","agent_cron_job_failed_title": "خطا در وظیفه زمانبندیشده",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "وظیفه عامل به پایان رسید","billboard.learnMore": "بیشتر بدانید","billboard.menuLabel": "اطلاعیهها","category.billing": "صورتحساب",diff --git a/locales/fa-IR/setting.json b/locales/fa-IR/setting.jsonindex a383f1019a9..881bb11b323 100644--- a/locales/fa-IR/setting.json+++ b/locales/fa-IR/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "منتشرشده","myAgents.status.unpublished": "لغو انتشار","myAgents.title": "عاملهای منتشرشده من",+ "notification.category.agent.title": "نماینده","notification.category.billing.title": "صورتحساب","notification.category.generation.title": "تولید","notification.category.schedule.title": "وظایف زمانبندیشده",@@ -554,6 +555,7 @@"notification.inbox.desc": "نمایش اعلانها در صندوق پیامهای درونبرنامهای","notification.inbox.title": "اعلانهای صندوق پیام","notification.item.agent_cron_job_failed": "وظیفه زمانبندیشده شکست خورد",+ "notification.item.agent_run_completed": "وظیفه نماینده تکمیل شد","notification.item.credit_balance_low": "موجودی اعتبار در حال کاهش است","notification.item.image_generation_completed": "تولید تصویر با موفقیت انجام شد","notification.item.storage_overage_cap_reached": "حد پرداخت اضافی ذخیرهسازی رسید",diff --git a/locales/fr-FR/notification.json b/locales/fr-FR/notification.jsonindex 1f33e141fe7..44bacfde638 100644--- a/locales/fr-FR/notification.json+++ b/locales/fr-FR/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Votre tâche planifiée « {{jobName}} » n’a pas pu s’exécuter, car votre compte n’a plus de crédits. Rechargez votre solde ou mettez à niveau votre abonnement pour reprendre les prochaines exécutions.","agent_cron_job_failed_insufficient_budget_title": "Tâche planifiée en pause : crédits insuffisants","agent_cron_job_failed_title": "Échec de la tâche planifiée",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Tâche de l'agent terminée","billboard.learnMore": "En savoir plus","billboard.menuLabel": "Annonces","category.billing": "Facturation",diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.jsonindex 1108b967efd..4e10e72f282 100644--- a/locales/fr-FR/setting.json+++ b/locales/fr-FR/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Publié","myAgents.status.unpublished": "Non publié","myAgents.title": "Mes agents publiés",+ "notification.category.agent.title": "Agent","notification.category.billing.title": "Facturation","notification.category.generation.title": "Génération","notification.category.schedule.title": "Tâches planifiées",@@ -554,6 +555,7 @@"notification.inbox.desc": "Afficher les notifications dans la boîte de réception de l'application","notification.inbox.title": "Notifications de la boîte de réception","notification.item.agent_cron_job_failed": "La tâche planifiée a échoué",+ "notification.item.agent_run_completed": "Tâche de l'agent terminée","notification.item.credit_balance_low": "Le solde de crédit est faible","notification.item.image_generation_completed": "Génération d’image terminée","notification.item.storage_overage_cap_reached": "Plafond de dépassement de stockage atteint",diff --git a/locales/it-IT/notification.json b/locales/it-IT/notification.jsonindex 173d892e8b9..81ee1470ab4 100644--- a/locales/it-IT/notification.json+++ b/locales/it-IT/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "L'attività programmata \"{{jobName}}\" non è stata eseguita perché il tuo account non ha abbastanza crediti. Ricarica o aggiorna il tuo piano per riprendere le esecuzioni future.","agent_cron_job_failed_insufficient_budget_title": "Attività programmata in pausa: crediti insufficienti","agent_cron_job_failed_title": "Attività programmata non riuscita",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Attività dell'agente completata","billboard.learnMore": "Scopri di più","billboard.menuLabel": "Annunci","category.billing": "Fatturazione",diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.jsonindex 127223b215d..48645896cc5 100644--- a/locales/it-IT/setting.json+++ b/locales/it-IT/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Pubblicato","myAgents.status.unpublished": "Non Pubblicato","myAgents.title": "I Miei Agenti Pubblicati",+ "notification.category.agent.title": "Agente","notification.category.billing.title": "Fatturazione","notification.category.generation.title": "Generazione","notification.category.schedule.title": "Attività pianificate",@@ -554,6 +555,7 @@"notification.inbox.desc": "Mostra le notifiche nella casella di posta in-app","notification.inbox.title": "Notifiche Casella di Posta","notification.item.agent_cron_job_failed": "Attività pianificata non riuscita",+ "notification.item.agent_run_completed": "Attività dell'agente completata","notification.item.credit_balance_low": "Saldo crediti in esaurimento","notification.item.image_generation_completed": "Generazione immagine completata","notification.item.storage_overage_cap_reached": "Raggiunto il limite di spesa per l'archiviazione",diff --git a/locales/ja-JP/notification.json b/locales/ja-JP/notification.jsonindex a36aa379a77..2447ba122bf 100644--- a/locales/ja-JP/notification.json+++ b/locales/ja-JP/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "スケジュールされたタスク「{{jobName}}」は、クレジット残高が不足しているため実行できませんでした。今後の実行を再開するには、クレジットを追加するかプランをアップグレードしてください。","agent_cron_job_failed_insufficient_budget_title": "スケジュールされたタスクを一時停止:クレジット不足","agent_cron_job_failed_title": "スケジュールされたタスクが失敗しました",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "エージェントのタスクが完了しました","billboard.learnMore": "詳細はこちら","billboard.menuLabel": "お知らせ","category.billing": "請求",diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.jsonindex 730e394658b..3326e1e6cc4 100644--- a/locales/ja-JP/setting.json+++ b/locales/ja-JP/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "公開中","myAgents.status.unpublished": "非公開","myAgents.title": "自分の公開アシスタント",+ "notification.category.agent.title": "エージェント","notification.category.billing.title": "請求","notification.category.generation.title": "生成","notification.category.schedule.title": "スケジュールされたタスク",@@ -554,6 +555,7 @@"notification.inbox.desc": "アプリ内の受信ボックスに通知を表示する","notification.inbox.title": "受信ボックス通知","notification.item.agent_cron_job_failed": "スケジュールされたタスクが失敗しました",+ "notification.item.agent_run_completed": "エージェントのタスクが完了しました","notification.item.credit_balance_low": "クレジット残高が少なくなっています","notification.item.image_generation_completed": "画像生成が完了しました","notification.item.storage_overage_cap_reached": "ストレージの従量課金上限に到達しました",diff --git a/locales/ko-KR/notification.json b/locales/ko-KR/notification.jsonindex 32dd468db43..29909a0c4b6 100644--- a/locales/ko-KR/notification.json+++ b/locales/ko-KR/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "계정 크레딧이 부족하여 예약된 작업 \"{{jobName}}\"을(를) 실행할 수 없습니다. 크레딧을 충전하거나 요금제를 업그레이드하면 이후 작업이 재개됩니다.","agent_cron_job_failed_insufficient_budget_title": "예약된 작업 일시 중지: 크레딧 부족","agent_cron_job_failed_title": "예약된 작업 실패",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "에이전트 작업 완료","billboard.learnMore": "자세히 알아보기","billboard.menuLabel": "공지 사항","category.billing": "청구",diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.jsonindex 69650f84d0d..56224e1fb37 100644--- a/locales/ko-KR/setting.json+++ b/locales/ko-KR/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "등록됨","myAgents.status.unpublished": "미등록","myAgents.title": "내가 등록한 도우미",+ "notification.category.agent.title": "에이전트","notification.category.billing.title": "청구","notification.category.generation.title": "생성","notification.category.schedule.title": "예약 작업",@@ -554,6 +555,7 @@"notification.inbox.desc": "앱 내 받은편지함에 알림을 표시합니다","notification.inbox.title": "받은편지함 알림","notification.item.agent_cron_job_failed": "예약된 작업이 실패했습니다",+ "notification.item.agent_run_completed": "에이전트 작업 완료","notification.item.credit_balance_low": "크레딧 잔액이 부족합니다","notification.item.image_generation_completed": "이미지 생성 완료","notification.item.storage_overage_cap_reached": "스토리지 초과 사용 한도 도달",diff --git a/locales/nl-NL/notification.json b/locales/nl-NL/notification.jsonindex 918ef57f356..50c28ed60ab 100644--- a/locales/nl-NL/notification.json+++ b/locales/nl-NL/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Uw geplande taak \"{{jobName}}\" kon niet worden uitgevoerd omdat uw account geen credits meer heeft. Vul aan of upgrade uw abonnement om toekomstige taken te hervatten.","agent_cron_job_failed_insufficient_budget_title": "Geplande taak gepauzeerd: onvoldoende credits","agent_cron_job_failed_title": "Geplande taak mislukt",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Agenttaak voltooid","billboard.learnMore": "Meer informatie","billboard.menuLabel": "Aankondigingen","category.billing": "Facturering",diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.jsonindex 6c4b513e62c..9246ceb12c4 100644--- a/locales/nl-NL/setting.json+++ b/locales/nl-NL/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Gepubliceerd","myAgents.status.unpublished": "Niet gepubliceerd","myAgents.title": "Mijn gepubliceerde agents",+ "notification.category.agent.title": "Agent","notification.category.billing.title": "Facturering","notification.category.generation.title": "Generatie","notification.category.schedule.title": "Geplande taken",@@ -554,6 +555,7 @@"notification.inbox.desc": "Toon meldingen in de in-app inbox","notification.inbox.title": "Inboxmeldingen","notification.item.agent_cron_job_failed": "Geplande taak mislukt",+ "notification.item.agent_run_completed": "Agenttaak voltooid","notification.item.credit_balance_low": "Kredietsaldo raakt bijna op","notification.item.image_generation_completed": "Afbeeldingsgeneratie voltooid","notification.item.storage_overage_cap_reached": "Opslaglimiet bereikt",diff --git a/locales/pl-PL/notification.json b/locales/pl-PL/notification.jsonindex 5e56ff45a1c..c2c4cd2c250 100644--- a/locales/pl-PL/notification.json+++ b/locales/pl-PL/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Twoje zaplanowane zadanie \"{{jobName}}\" nie mogło zostać uruchomione, ponieważ na Twoim koncie zabrakło środków. Doładuj je lub ulepsz swój plan, aby wznowić przyszłe uruchomienia.","agent_cron_job_failed_insufficient_budget_title": "Wstrzymano zaplanowane zadanie: niewystarczające środki","agent_cron_job_failed_title": "Błąd zaplanowanego zadania",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Zadanie agenta zakończone","billboard.learnMore": "Dowiedz się więcej","billboard.menuLabel": "Ogłoszenia","category.billing": "Rozliczenia",diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.jsonindex fe826585ee1..f546767c8f4 100644--- a/locales/pl-PL/setting.json+++ b/locales/pl-PL/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Opublikowany","myAgents.status.unpublished": "Nieopublikowany","myAgents.title": "Moi opublikowani Agenci",+ "notification.category.agent.title": "Agent","notification.category.billing.title": "Rozliczenia","notification.category.generation.title": "Generowanie","notification.category.schedule.title": "Zadania zaplanowane",@@ -554,6 +555,7 @@"notification.inbox.desc": "Wyświetlaj powiadomienia w skrzynce odbiorczej w aplikacji","notification.inbox.title": "Powiadomienia w skrzynce odbiorczej","notification.item.agent_cron_job_failed": "Zadanie zaplanowane nie powiodło się",+ "notification.item.agent_run_completed": "Zadanie agenta zakończone","notification.item.credit_balance_low": "Saldo kredytowe jest niskie","notification.item.image_generation_completed": "Generowanie obrazu zakończone","notification.item.storage_overage_cap_reached": "Osiągnięto limit płatności za nadmiarowe przechowywanie",diff --git a/locales/pt-BR/notification.json b/locales/pt-BR/notification.jsonindex c15b111301b..1d63c39025e 100644--- a/locales/pt-BR/notification.json+++ b/locales/pt-BR/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Sua tarefa agendada \"{{jobName}}\" não pôde ser executada porque sua conta está sem créditos. Recarregue ou faça um upgrade do seu plano para retomar futuras execuções.","agent_cron_job_failed_insufficient_budget_title": "Tarefa agendada pausada: créditos insuficientes","agent_cron_job_failed_title": "Falha na tarefa agendada",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Tarefa do agente concluída","billboard.learnMore": "Saiba mais","billboard.menuLabel": "Comunicados","category.billing": "Faturamento",diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.jsonindex 7fedc08786e..636643f6b97 100644--- a/locales/pt-BR/setting.json+++ b/locales/pt-BR/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Publicado","myAgents.status.unpublished": "Não Publicado","myAgents.title": "Meus Agentes Publicados",+ "notification.category.agent.title": "Agente","notification.category.billing.title": "Faturamento","notification.category.generation.title": "Geração","notification.category.schedule.title": "Tarefas agendadas",@@ -554,6 +555,7 @@"notification.inbox.desc": "Exibir notificações na caixa de entrada do aplicativo","notification.inbox.title": "Notificações na Caixa de Entrada","notification.item.agent_cron_job_failed": "Tarefa agendada falhou",+ "notification.item.agent_run_completed": "Tarefa do agente concluída","notification.item.credit_balance_low": "Saldo de crédito está baixo","notification.item.image_generation_completed": "Geração de imagem concluída","notification.item.storage_overage_cap_reached": "Limite de armazenamento excedido",diff --git a/locales/ru-RU/notification.json b/locales/ru-RU/notification.jsonindex 77ed97e008a..a09d2f3b083 100644--- a/locales/ru-RU/notification.json+++ b/locales/ru-RU/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Запланированная задача «{{jobName}}» не была выполнена, так как на вашем счёте недостаточно средств. Пополните баланс или обновите тариф, чтобы возобновить будущие запуски.","agent_cron_job_failed_insufficient_budget_title": "Задача приостановлена: недостаточно средств","agent_cron_job_failed_title": "Сбой запланированной задачи",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Задача агента выполнена","billboard.learnMore": "Подробнее","billboard.menuLabel": "Объявления","category.billing": "Оплата",diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.jsonindex 19f4dcfb820..f412103f361 100644--- a/locales/ru-RU/setting.json+++ b/locales/ru-RU/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Опубликован","myAgents.status.unpublished": "Не опубликован","myAgents.title": "Мои опубликованные агенты",+ "notification.category.agent.title": "Агент","notification.category.billing.title": "Оплата","notification.category.generation.title": "Генерация","notification.category.schedule.title": "Запланированные задачи",@@ -554,6 +555,7 @@"notification.inbox.desc": "Показывать уведомления во встроенном почтовом ящике","notification.inbox.title": "Уведомления в почтовом ящике","notification.item.agent_cron_job_failed": "Запланированная задача не выполнена",+ "notification.item.agent_run_completed": "Задача агента завершена","notification.item.credit_balance_low": "Кредитный баланс на исходе","notification.item.image_generation_completed": "Генерация изображения завершена","notification.item.storage_overage_cap_reached": "Достигнут лимит оплаты за превышение хранилища",diff --git a/locales/tr-TR/notification.json b/locales/tr-TR/notification.jsonindex a52a0ef909d..fd8c6e13c98 100644--- a/locales/tr-TR/notification.json+++ b/locales/tr-TR/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "\"{{jobName}}\" adlı zamanlanmış göreviniz çalıştırılamadı çünkü hesabınızda yeterli kredi yok. Gelecek çalışmaları sürdürebilmek için bakiye ekleyin veya planınızı yükseltin.","agent_cron_job_failed_insufficient_budget_title": "Zamanlanmış görev durduruldu: yetersiz kredi","agent_cron_job_failed_title": "Zamanlanmış görev başarısız oldu",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Ajans görevi tamamlandı","billboard.learnMore": "Daha fazla bilgi al","billboard.menuLabel": "Duyurular","category.billing": "Faturalandırma",diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.jsonindex c1a40d0f57b..92d095e137e 100644--- a/locales/tr-TR/setting.json+++ b/locales/tr-TR/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Yayınlandı","myAgents.status.unpublished": "Yayından Kaldırıldı","myAgents.title": "Yayınladığım Aracılar",+ "notification.category.agent.title": "Temsilci","notification.category.billing.title": "Faturalandırma","notification.category.generation.title": "Üretim","notification.category.schedule.title": "Zamanlanmış görevler",@@ -554,6 +555,7 @@"notification.inbox.desc": "Uygulama içi gelen kutusunda bildirimleri göster","notification.inbox.title": "Gelen Kutusu Bildirimleri","notification.item.agent_cron_job_failed": "Zamanlanmış görev başarısız oldu",+ "notification.item.agent_run_completed": "Temsilci görevi tamamlandı","notification.item.credit_balance_low": "Kredi bakiyesi azalıyor","notification.item.image_generation_completed": "Görüntü oluşturma tamamlandı","notification.item.storage_overage_cap_reached": "Depolama aşım sınırı aşıldı",diff --git a/locales/vi-VN/notification.json b/locales/vi-VN/notification.jsonindex 526333e379c..49092a5b598 100644--- a/locales/vi-VN/notification.json+++ b/locales/vi-VN/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "Tác vụ đã lên lịch \"{{jobName}}\" không thể chạy vì tài khoản của bạn đã hết tín dụng. Vui lòng nạp thêm hoặc nâng cấp gói để tiếp tục các lần chạy sau.","agent_cron_job_failed_insufficient_budget_title": "Tác vụ tạm dừng: không đủ tín dụng","agent_cron_job_failed_title": "Tác vụ đã lên lịch thất bại",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Nhiệm vụ của tác nhân đã hoàn thành","billboard.learnMore": "Tìm hiểu thêm","billboard.menuLabel": "Thông báo","category.billing": "Thanh toán",diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.jsonindex 2266f3ec6a8..8d1d96edd66 100644--- a/locales/vi-VN/setting.json+++ b/locales/vi-VN/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "Đã xuất bản","myAgents.status.unpublished": "Chưa xuất bản","myAgents.title": "Agent đã xuất bản của tôi",+ "notification.category.agent.title": "Đại lý","notification.category.billing.title": "Thanh toán","notification.category.generation.title": "Tạo nội dung","notification.category.schedule.title": "Tác vụ đã lên lịch",@@ -554,6 +555,7 @@"notification.inbox.desc": "Hiển thị thông báo trong hộp thư trong ứng dụng","notification.inbox.title": "Thông Báo Hộp Thư","notification.item.agent_cron_job_failed": "Tác vụ theo lịch đã thất bại",+ "notification.item.agent_run_completed": "Nhiệm vụ đại lý đã hoàn thành","notification.item.credit_balance_low": "Số dư tín dụng sắp hết","notification.item.image_generation_completed": "Tạo ảnh hoàn tất","notification.item.storage_overage_cap_reached": "Đã đạt giới hạn chi tiêu lưu trữ",diff --git a/locales/zh-CN/notification.json b/locales/zh-CN/notification.jsonindex 00a9662fb1c..5b186fed671 100644--- a/locales/zh-CN/notification.json+++ b/locales/zh-CN/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "定时任务「{{jobName}}」因账户额度不足未能执行。请充值或升级套餐以恢复后续运行。","agent_cron_job_failed_insufficient_budget_title": "定时任务已暂停:额度不足","agent_cron_job_failed_title": "定时任务执行失败",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "Agent 任务已完成","billboard.learnMore": "了解更多","billboard.menuLabel": "公告","category.billing": "账单",diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.jsonindex dbc3abdd28c..a672015371a 100644--- a/locales/zh-CN/setting.json+++ b/locales/zh-CN/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "已上架","myAgents.status.unpublished": "未上架","myAgents.title": "我发布的助理",+ "notification.category.agent.title": "Agent","notification.category.billing.title": "账单","notification.category.generation.title": "生成","notification.category.schedule.title": "定时任务",@@ -554,6 +555,7 @@"notification.inbox.desc": "在应用内收件箱中显示通知","notification.inbox.title": "站内通知","notification.item.agent_cron_job_failed": "计划任务失败",+ "notification.item.agent_run_completed": "Agent 任务完成","notification.item.credit_balance_low": "积分余额即将用尽","notification.item.image_generation_completed": "图片生成完成","notification.item.storage_overage_cap_reached": "存储按量付费上限已触达",diff --git a/locales/zh-TW/notification.json b/locales/zh-TW/notification.jsonindex d3e50349331..50d5c77e5dd 100644--- a/locales/zh-TW/notification.json+++ b/locales/zh-TW/notification.json@@ -3,6 +3,8 @@"agent_cron_job_failed_insufficient_budget": "您的排程任務「{{jobName}}」無法執行,因為您的帳戶點數不足。請儲值或升級方案以恢復後續執行。","agent_cron_job_failed_insufficient_budget_title": "排程任務已暫停:點數不足","agent_cron_job_failed_title": "排程任務失敗",+ "agent_run_completed": "{{preview}}",+ "agent_run_completed_title": "代理任務已完成","billboard.learnMore": "了解更多","billboard.menuLabel": "公告","category.billing": "帳單",diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.jsonindex 56284b3263d..dffd001d969 100644--- a/locales/zh-TW/setting.json+++ b/locales/zh-TW/setting.json@@ -544,6 +544,7 @@"myAgents.status.published": "已上架","myAgents.status.unpublished": "未上架","myAgents.title": "我發布的助手",+ "notification.category.agent.title": "代理","notification.category.billing.title": "帳單","notification.category.generation.title": "生成","notification.category.schedule.title": "排程任務",@@ -554,6 +555,7 @@"notification.inbox.desc": "在應用程式內的收件匣中顯示通知","notification.inbox.title": "收件匣通知","notification.item.agent_cron_job_failed": "排程任務失敗",+ "notification.item.agent_run_completed": "代理任務已完成","notification.item.credit_balance_low": "信用餘額即將不足","notification.item.image_generation_completed": "圖片生成完成","notification.item.storage_overage_cap_reached": "已達到存儲按需付費上限",diff --git a/packages/business-server/src/agent-run/notifyAgentRunCompleted.ts b/packages/business-server/src/agent-run/notifyAgentRunCompleted.tsnew file mode 100644index 00000000000..ef570beac59--- /dev/null+++ b/packages/business-server/src/agent-run/notifyAgentRunCompleted.ts@@ -0,0 +1,13 @@+export interface NotifyAgentRunCompletedParams {+ agentId?: string;+ duration?: number;+ lastAssistantContent?: string;+ operationId: string;+ topicId?: string;+ userId: string;+ workspaceId?: string;+}++export async function notifyAgentRunCompleted(+ _params: NotifyAgentRunCompletedParams,+): Promise<void> {}diff --git a/packages/locales/src/default/notification.ts b/packages/locales/src/default/notification.tsindex 0a80f0e46da..a33e9fce9b4 100644--- a/packages/locales/src/default/notification.ts+++ b/packages/locales/src/default/notification.ts@@ -5,6 +5,8 @@ export default {'Your scheduled task "{{jobName}}" couldn\'t run because your account is out of credits. Top up or upgrade your plan to resume future runs.','agent_cron_job_failed_insufficient_budget_title': 'Scheduled task paused: insufficient credits','agent_cron_job_failed_title': 'Scheduled task failed',+ 'agent_run_completed': '{{preview}}',+ 'agent_run_completed_title': 'Agent task completed','billboard.learnMore': 'Learn more','billboard.menuLabel': 'Announcements','category.billing': 'Billing',diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.tsindex 18f24de60f5..82276e2fcbd 100644--- a/packages/locales/src/default/setting.ts+++ b/packages/locales/src/default/setting.ts@@ -630,11 +630,13 @@ export default {'notification.push.desc':'Send push notifications to your mobile devices (LobeHub mobile app required)','notification.push.title': 'Mobile Push Notifications',+ 'notification.category.agent.title': 'Agent','notification.category.billing.title': 'Billing','notification.category.generation.title': 'Generation','notification.category.schedule.title': 'Scheduled tasks','notification.category.workspace.title': 'Workspace','notification.item.agent_cron_job_failed': 'Scheduled task failed',+ 'notification.item.agent_run_completed': 'Agent task completed','notification.item.credit_balance_low': 'Credit balance running low','notification.item.image_generation_completed': 'Image generation completed','notification.item.storage_overage_cap_reached': 'Storage pay-as-you-go cap reached',