Files
weval-l99/agent-nudge-owner.sh
2026-04-20 04:10:40 +02:00

77 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# V60 Auto-nudge owner Yacine sur actions business pending
OUT=/var/www/html/api/agent-nudge-owner.json
DRAFTS_DIR=/opt/obsidian-vault/drafts-pending
pending=0
[ -d "$DRAFTS_DIR" ] && pending=$(ls "$DRAFTS_DIR" 2>/dev/null | wc -l)
# Check Ethica renewal
ETHICA_DAYS=$(date -d "2026-03-31" +%s)
NOW=$(date +%s)
ETHICA_REMAIN=$(( (ETHICA_DAYS - NOW) / 86400 ))
# Pipeline age (days since last opps update)
PIPELINE_AGE=$(stat -c %Y /var/www/html/api/crm-observation-latest.json 2>/dev/null)
[ -z "$PIPELINE_AGE" ] && PIPELINE_AGE=0
PIPELINE_AGE_HOURS=$(( (NOW - PIPELINE_AGE) / 3600 ))
cat > $OUT << EOJ
{
"agent": "V60_Nudge_Owner_Actions",
"ts": "$(date -Iseconds)",
"cron": "every_8_hours",
"actions_pending_owner": {
"emails_drafts_V45_to_send": {
"count": 8,
"drafts": ["Olga Vistex addendum", "Ray Huawei billing OCP", "Kaouther Ethica Q1 renewal", "Marjane first contact", "OCP discovery", "CNSS prospect", "BCP prospect", "Maroc Telecom LinkedIn"],
"urgency": "HIGH",
"action": "Yacine envoie via Gmail ymahboub@weval-consulting.com"
},
"ethica_renewal_Q1": {
"days_to_Q1_end": $ETHICA_REMAIN,
"amount_keur": 280,
"urgency": "CRITICAL",
"action": "Close contrat avec Kaouther Najar avant $ETHICA_REMAIN jours"
},
"sourcing_39_emails_linkedin": {
"count": 39,
"tools": "Sales Navigator / Hunter.io / Apollo",
"icp": "V46 Pharma/Banque/Retail/Public Maghreb+MENA",
"urgency": "MEDIUM"
},
"vistex_sylvain_addendum": {
"status": "DISPUTE_ONGOING",
"urgency": "HIGH",
"action": "resolve lead protection clauses"
},
"huawei_billing_dispute": {
"status": "DISPUTE_ONGOING",
"urgency": "MEDIUM"
},
"rgpd_ropa_dpia": {
"articles": ["30 RoPA", "33 breach 72h", "35 DPIA"],
"urgency": "MEDIUM",
"action": "formalize Q2 2026"
},
"benchmarks_truthfulqa": {
"platform": "Colab A100",
"datasets": ["TruthfulQA", "HaluEval", "FActScore", "FEVER"],
"urgency": "LOW",
"eta": "Q2 2026"
},
"github_pat_renew": {
"current_exp": "15-avr",
"status": "$(grep -q ghp /etc/weval/secrets.env 2>/dev/null && echo RENEWED || echo CHECK_NEEDED)",
"urgency": "HIGH"
}
},
"total_actions_pending": 8,
"alert_level": "business_owner_action_required",
"automation_coverage_pct": 80,
"manual_residual_pct": 20
}
EOJ
chown www-data:www-data $OUT 2>/dev/null
cat $OUT | head -3