本卡屬 FR-196(母卡 CM-3875(已建)),卡 M-3,第二期批 6。只改 BE(主 repo,Repo 欄空著)。依賴:P-3、S-2、M-2。
主系統把套件的外送接起來:外送紀錄寫進擴欄後的 FR-137 表(既有的「同物件同收件人只寄一次」去重沿用);第一期四處「照舊寄」的 Email 改由中心決定(把既有寄信呼叫拿掉,只留 notify);三個排程:每小時寄到時的摘要、每日 03:00 清過期已讀、每分鐘判 Agent 離線。做完後 Email 是否寄完全看使用者設定。
extend:_notification_center_ports.py 加 OutboundStore(包 task_alert_notification_domain_service.claim/mark,address 用既有 recipient_email,新四欄一起寫);第一期 M-2 加的四處 notify 旁邊的既有寄信呼叫拿掉(改由中心寄);排程照 core/scheduler_update.py 形狀新檔;清理用 system_configs 的兩個天數,批次 delete 每批 5000
repo:~/Projects/Billows/Audit-Manager/compliance-manager-be
改既有:core/plugins/_notification_center_ports.py
改既有:core/plugins/notification_center.py(adapters 加 outbound_store)
改既有:core/app_factory.py(註冊 scheduler_notification,照 scheduler_update 那一行)
改既有:app/flow_engine/service/workflow_execution_service.py(1246 附近:拿掉既有寄信,只留 notify)
改既有:app/flow_engine/service/stage_entered_notify_service.py(同)
改既有:app/task_alert/service/scan_alert_app_service.py(同)
新開:core/scheduler_notification.py
新開:test/test_notification_center_scheduler.py(清理只刪已讀逾期;離線 tick 對 last_seen_at 超過分鐘數的 agent 發一次且不重發)
_notification_center_ports.py 加 OutboundStore:enqueue 包 task_alert_notification_domain_service.claim(TaskAlertNotificationEntity(... object_type=event_code, object_uid=subject_uid, recipient_email=address, inbox_id=..., channel=..., scheduled_at=..., digest_batch=..., result='pending'))(claim 回 None=去重命中→不寄);claim_due 走 repo 新 query scheduled_at<=now and result='pending'(repo 加 method,infra 層);mark 包既有 mark。entity/model/mapper 補四欄(infra/task_alert/)。core/plugins/notification_center.py adapters 加 outbound_store。workflow_execution_service.py 1246 那段 _send_notification/send_mail_notification 呼叫刪,只留 M-2 加的 notify;stage_entered_notify_service.py 的 _send_after_commit 整段改成只 notify;scan_alert_app_service.py 同;公告本來沒寄信不動。core/scheduler_notification.py 照 core/scheduler_update.py:_digest_tick(每小時 :05,呼叫套件 digest_sender.run)、_cleanup_tick(每日 03:00;刪 inbox read_at or archived_at 早於 retention 的,每批 5000;刪 task_alert_notifications sent_at 早於 delivery_retention 的)、_agent_offline_tick(每分鐘;remote_agents.last_seen_at 早於 now-agent_offline_minutes 且上次未發過 → notify agent.offline Role('tenant_admin');恢復(last_seen 回來)→ agent.reconnected;「發過沒」靠 inbox merge_key+未讀判,不另加欄);core/app_factory.py 照 scheduler_update 那一行註冊。read_root_config_value('NOTIFICATION_CENTER', key)。DEV:指派任務給自己(Email 設定開)→ 收到一封且 task_alert_notifications 多一列帶 inbox_id/channel=email;關掉 Email 再指派 → 沒信、inbox 有;設 daily → 列的 scheduled_at 是明早 09:00;把 retention 設 1、造一筆兩天前已讀 → 跑 tick 消失、未讀不消失;停一台 Agent 容器 16 分鐘 → 管理員 inbox 多一列 agent.offline,再等一分鐘不重發;三條測試綠;BE 重啟無錯
~/Projects/Billows/Audit-Manager/compliance-manager-be/docs/features/FR-196-2611-notification-center/design.md §3 決策定案、§5 詳細設計(§5.1 套件職責與 port、§5.2 資料表、§5.3 API、§5.5 前端)、§6 拆卡表本卡那列、§8 風險;討論稿(Artifact,連結在 README)只在想知道「為什麼這樣裁」時看~/Projects/Billows/Audit-Manager/compliance-manager-be/docs/features/FR-196-2611-notification-center/prototype/index.html(四個分頁:鈴鐺、通知中心、通知設定、系統橫幅;純畫面,只取結構與資訊順序;文案依 i18n 重寫)infra/task_alert/(entity/model/mapper/repo+domain/task_alert/service/task_alert_notification_domain_service.py claim/mark);排程先例 core/scheduler_update.py;SocketIO 登記 config/socketio_namespaces.py(檔頭紅線)與 handler 先例 jedi-survey app/handler/fill_survey_socketio_handler.py;橫幅先例 FE src/components/ai-quota/AiQuotaBanner.vue、掛點 src/layout/AppLayout.vue 124;iam 通知接口 common/iam_ports.py;十個寄信點行號在 design.md 表 4-1jedi-bulletin/jedi_bulletin/plugin/(contract/assembly/migrations)、jedi-notification/README.md;主系統接線 core/plugins/bulletin.py、core/plugins/_host.py::host_defaults、core/plugins/license.py::TenantAdminDirectory;寄信點 app/flow_engine/service/workflow_execution_service.py:1246、stage_entered_notify_service.py:117、app/task_alert/service/scan_alert_app_service.py:74;既有投遞紀錄表 infra/task_alert/model/task_alert_notification.py;鈴鐺 FE src/layout/AppTopbar.vue 484~540、TopbarStageQueue.vue;seed 先例 scripts/sql/2026-05-22-seed-oscal-ssp-roles.sql、2026-11-10-fr194-ui-routes-entry-gates.sql