mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
Targeting & Acquisition OS (16 modules) — نظام الاستهداف الذكي - account_finder: account-first targeting; 12 buying signals; deterministic 10-25 accounts per (sector, city) - buyer_role_mapper: 14 buyer roles + sector-specific buying-committee maps + role-based Arabic angles - contact_source_policy: 12 sources (crm_customer→opt_out) with risk_score, channels-allowed, retention guidance, lawful_basis - contactability_matrix: 5 action modes (suggest_only/draft_only/approval_required/approved_execute/blocked); opt-out always blocked - linkedin_strategy: Lead Forms + Ads + manual ONLY; linkedin_do_not_do() locks scrape/auto-DM/auto-connect/extensions - email_strategy: drafts + unsubscribe footer + domain-pacing (fresh/warmed/trusted/damaged) + spam-trigger risk - whatsapp_strategy: opt-in only; rejects cold + risky phrases; opt-in template requires explicit purpose+company+unsubscribe - social_strategy: official APIs only; listening + drafts; no auto-publish - outreach_scheduler: day-by-day plans + daily limits + opt-out enforcement - reputation_guard: bounce/complaint/opt-out thresholds → healthy/watch/pause + recovery actions per channel - daily_autopilot: Arabic brief + 7 today actions + EOD report - acquisition_scorecard: pipeline + meetings + risks + productivity_score - self_growth_mode: 5 ICP focuses for Dealix; daily brief + monthly targets - free_diagnostic: Free Growth Diagnostic (3 ops + msg + risk + plan) → paid pilot recommendation - contract_drafts: Pilot/DPA/Referral/Agency/SOW outlines (legal_review_required, PDPL-aware) - service_offers: 7 targeting-tier offers + recommend by customer-type Service Tower (8 modules) — برج الخدمات الذاتية (12 productized services) - service_catalog: 12 services with target_customer/outcome/inputs/workflow/deliverables/pricing/risk/proof/upgrade - service_wizard: deterministic recommend (agency→partner; list→list_intelligence; founder→self_growth; CEO→exec_brief; budget≥2999→growth_os; default→first_10) - mission_templates: workflow steps with approval gates + linked growth missions - pricing_engine: SAR quotes scaled by company_size×urgency×channels_count + setup_fee + monthly_offer - deliverables: client report outline + proof pack template + operator checklist (no live actions) - service_scorecard: 0..100 score from drafts/replies/meetings/pipeline/CSAT - whatsapp_ceo_control: daily brief, approval cards (≤3 buttons), risk alerts, EOD reports - upgrade_paths: deterministic next-service recommendation + Arabic upsell messages Service Excellence OS (8 modules) — مصنع الخدمات الممتازة - feature_matrix: 12 must-have features per service + advanced/premium/future tiers - service_scoring: 10-dimension excellence score (clarity, speed_to_value, automation, compliance, proof, upsell, uniqueness, scalability, ops_daily, proof_data) → launch_ready/beta_only/needs_work - quality_review: 4 gates (proof / approval / pricing / channels) + status verdict; review_service_before_launch and review/all - competitor_gap: 7 competitor categories (CRM, WhatsApp tools, email assistants, LinkedIn tools, agencies, revenue intelligence, generic AI) + Dealix advantages + do-not-copy - proof_metrics: required metrics + ROI estimate (pipeline_x + closed_won_x) + Arabic summary - research_lab: monthly brief + feature hypotheses + top-3 experiments + monthly review - service_improvement_backlog: feedback→backlog conversion + impact/effort prioritization + weekly improvements - launch_package: landing outline + sales script + 12-min demo script + 5-day onboarding checklist Routers (3 new) — 62 endpoints - /api/v1/targeting/* — 20 endpoints (accounts, buying-committee, contacts, uploaded-list, outreach, daily-autopilot, self-growth, reputation, linkedin, drafts, free-diagnostic, services, contracts) - /api/v1/services/* — 20 endpoints (catalog, recommend, intake, start, workflow, deliverables, proof-pack, quote, setup-fee, monthly-offer, scorecard, upgrade-path, ceo daily-brief/approval-card/risk-alert/EOD) - /api/v1/service-excellence/* — 22 endpoints (feature-matrix, score, quality-review, review/all, proof-metrics, roi-estimate, gap-analysis, research-brief, hypotheses, experiments, monthly-review, backlog, weekly-improvements, launch-package, landing/sales/demo/onboarding) Tests (3 new files, 105 tests) - test_targeting_os: 47 tests (Arabic accounts, buying committees, opt-out blocked, cold WA blocked, LinkedIn no-scraping, email unsubscribe, WA risk, outreach plan, reputation guard, self-growth, contracts, scorecard) - test_service_tower: 38 tests (12+ services, all have pricing/proof/deliverables/approval, wizard recommendations, workflow includes approval, quote scales, CEO cards ≤3 buttons, no live send) - test_service_excellence: 33 tests (feature matrix, score returns status, ALL services pass quality gates, ROI x-multiples, 7 competitor categories, hypotheses+experiments, backlog conversion, launch package complete, demo=12min) Docs (3 new + 1 updated) - TARGETING_ACQUISITION_OS.md (Arabic) - SERVICE_TOWER_STRATEGY.md (Arabic) - SERVICE_EXCELLENCE_OS.md (Arabic) - DEALIX_100_PERCENT_LAUNCH_PLAN.md — added §36 Targeting OS + §37 Service Tower + §38 Service Excellence + §39 Landing Pages Landing pages (4 new, RTL Arabic) - services.html — 3 doors + 12 productized services - free-diagnostic.html — free growth diagnostic - first-10-opportunities.html — kill feature - agency-partner.html — agency partner program Test results - 105/105 new tests pass - Full suite: 768 passed, 2 skipped - 0 existing tests broken Safety + integration with previous layers - Targeting OS uses contactability_matrix → ALL contacts gated before any send - Service Tower's workflow includes approval gate; ALL services live_send_allowed=False - Service Excellence quality_review BLOCKS launch on missing proof/approval/pricing/unsafe channels - linkedin_do_not_do() encodes 8 explicit prohibitions (scraping/auto-DM/auto-connect/extensions) - whatsapp_do_not_do() blocks cold sends + group scraping - Contracts always: legal_review_required=True, not_legal_advice=True, PDPL sections present - Self-Growth Mode lets Dealix target its OWN ICP using the same approval-first pipeline Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
242 lines
8.6 KiB
Python
242 lines
8.6 KiB
Python
"""Unit tests for Service Tower."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from auto_client_acquisition.service_tower import (
|
|
ALL_SERVICES,
|
|
build_ceo_daily_service_brief,
|
|
build_client_report_outline,
|
|
build_deliverables,
|
|
build_intake_questions,
|
|
build_internal_operator_checklist,
|
|
build_proof_pack_template,
|
|
build_risk_alert_card,
|
|
build_service_approval_card,
|
|
build_service_scorecard,
|
|
build_service_workflow,
|
|
build_upsell_message_ar,
|
|
calculate_monthly_offer,
|
|
calculate_setup_fee,
|
|
catalog_summary,
|
|
get_service,
|
|
list_all_services,
|
|
map_service_to_growth_mission,
|
|
map_service_to_subscription,
|
|
quote_service,
|
|
recommend_next_step,
|
|
recommend_plan_after_service,
|
|
recommend_service,
|
|
recommend_upgrade,
|
|
summarize_recommendation_ar,
|
|
summarize_scorecard_ar,
|
|
validate_service_inputs,
|
|
)
|
|
|
|
|
|
# ── Catalog ──────────────────────────────────────────────────
|
|
def test_catalog_has_at_least_12_services():
|
|
out = list_all_services()
|
|
assert out["total"] >= 12
|
|
|
|
|
|
def test_catalog_includes_critical_services():
|
|
ids = {s.id for s in ALL_SERVICES}
|
|
for required in (
|
|
"free_growth_diagnostic", "list_intelligence",
|
|
"first_10_opportunities_sprint", "self_growth_operator",
|
|
"growth_os_monthly", "email_revenue_rescue",
|
|
"meeting_booking_sprint", "partner_sprint",
|
|
"agency_partner_program", "whatsapp_compliance_setup",
|
|
"linkedin_lead_gen_setup", "executive_growth_brief",
|
|
):
|
|
assert required in ids
|
|
|
|
|
|
def test_every_service_has_pricing():
|
|
for s in ALL_SERVICES:
|
|
assert s.pricing_min_sar >= 0
|
|
assert s.pricing_max_sar >= s.pricing_min_sar
|
|
|
|
|
|
def test_every_service_has_proof_metrics():
|
|
for s in ALL_SERVICES:
|
|
assert s.proof_metrics, f"{s.id} missing proof_metrics"
|
|
|
|
|
|
def test_every_service_has_deliverables():
|
|
for s in ALL_SERVICES:
|
|
assert s.deliverables_ar, f"{s.id} missing deliverables"
|
|
|
|
|
|
def test_every_service_has_approval_policy():
|
|
for s in ALL_SERVICES:
|
|
assert s.approval_policy
|
|
|
|
|
|
def test_summary_aggregates_pricing_models():
|
|
s = catalog_summary()
|
|
assert s["total"] == len(ALL_SERVICES)
|
|
assert "by_pricing_model" in s
|
|
assert "free_growth_diagnostic" in s["free_offers"]
|
|
|
|
|
|
# ── Wizard ───────────────────────────────────────────────────
|
|
def test_wizard_recommends_partner_sprint_for_agency():
|
|
out = recommend_service(company_type="agency", goal="expand_partners")
|
|
assert out["recommended_service_id"] in ("partner_sprint",
|
|
"agency_partner_program")
|
|
|
|
|
|
def test_wizard_recommends_list_intelligence_when_has_list():
|
|
out = recommend_service(company_type="b2b", has_contact_list=True)
|
|
assert out["recommended_service_id"] == "list_intelligence"
|
|
|
|
|
|
def test_wizard_recommends_growth_os_for_monthly_budget():
|
|
out = recommend_service(company_type="b2b saas", budget_sar=3500)
|
|
assert out["recommended_service_id"] == "growth_os_monthly"
|
|
|
|
|
|
def test_wizard_default_falls_back_to_kill_feature():
|
|
out = recommend_service(company_type="random", budget_sar=500)
|
|
assert out["recommended_service_id"] == "first_10_opportunities_sprint"
|
|
|
|
|
|
def test_intake_questions_for_known_service():
|
|
out = build_intake_questions("first_10_opportunities_sprint")
|
|
assert len(out["questions"]) >= 5
|
|
|
|
|
|
def test_intake_questions_unknown_service():
|
|
out = build_intake_questions("totally_made_up")
|
|
assert "error" in out
|
|
|
|
|
|
def test_validate_service_inputs_missing_field():
|
|
out = validate_service_inputs("list_intelligence", {"sector": "training"})
|
|
assert out["valid"] is False
|
|
|
|
|
|
def test_summarize_recommendation_arabic():
|
|
out = recommend_service(company_type="b2b saas", budget_sar=3500)
|
|
summary = summarize_recommendation_ar(out)
|
|
assert any("" <= ch <= "ۿ" for ch in summary)
|
|
|
|
|
|
# ── Mission templates ────────────────────────────────────────
|
|
def test_workflow_includes_approval():
|
|
w = build_service_workflow("first_10_opportunities_sprint")
|
|
step_ids = [s["step_id"] for s in w["workflow_steps"]]
|
|
assert "approval" in step_ids
|
|
|
|
|
|
def test_workflow_links_to_growth_mission():
|
|
w = build_service_workflow("first_10_opportunities_sprint")
|
|
assert w["linked_growth_mission"] == "first_10_opportunities"
|
|
|
|
|
|
def test_map_service_to_subscription():
|
|
sub = map_service_to_subscription("free_growth_diagnostic")
|
|
assert sub # always returns something
|
|
|
|
|
|
# ── Pricing engine ───────────────────────────────────────────
|
|
def test_quote_free_service_returns_zero():
|
|
q = quote_service("free_growth_diagnostic")
|
|
assert q.get("is_free") is True
|
|
assert q["estimated_min_sar"] == 0
|
|
|
|
|
|
def test_quote_paid_service_scales_with_size():
|
|
q_small = quote_service("first_10_opportunities_sprint", company_size="small")
|
|
q_large = quote_service("first_10_opportunities_sprint", company_size="large")
|
|
assert q_large["estimated_max_sar"] > q_small["estimated_max_sar"]
|
|
|
|
|
|
def test_quote_unknown_service_errors():
|
|
q = quote_service("bogus_service")
|
|
assert "error" in q
|
|
|
|
|
|
def test_setup_fee_only_for_monthly():
|
|
fee_monthly = calculate_setup_fee("growth_os_monthly")
|
|
fee_sprint = calculate_setup_fee("first_10_opportunities_sprint")
|
|
assert fee_monthly["setup_fee_sar"] > 0
|
|
assert fee_sprint["setup_fee_sar"] == 0
|
|
|
|
|
|
def test_monthly_offer_only_for_monthly_services():
|
|
out_m = calculate_monthly_offer("growth_os_monthly")
|
|
out_s = calculate_monthly_offer("first_10_opportunities_sprint")
|
|
assert out_m["is_monthly"] is True
|
|
assert out_s["is_monthly"] is False
|
|
|
|
|
|
# ── Deliverables ─────────────────────────────────────────────
|
|
def test_deliverables_returns_arabic_list():
|
|
out = build_deliverables("first_10_opportunities_sprint")
|
|
assert out["deliverables_ar"]
|
|
|
|
|
|
def test_proof_pack_template_lists_metrics():
|
|
out = build_proof_pack_template("first_10_opportunities_sprint")
|
|
assert out["metrics_to_track"]
|
|
|
|
|
|
def test_client_report_outline_includes_executive_summary():
|
|
out = build_client_report_outline("growth_os_monthly")
|
|
assert "ملخص تنفيذي (10 أسطر)" in out["sections_ar"]
|
|
|
|
|
|
def test_operator_checklist_blocks_live_actions():
|
|
out = build_internal_operator_checklist("growth_os_monthly")
|
|
assert any("live" in s.lower() for s in out["do_not_do_ar"])
|
|
|
|
|
|
# ── Scorecard ────────────────────────────────────────────────
|
|
def test_scorecard_strong_outcome():
|
|
out = build_service_scorecard("first_10_opportunities_sprint", {
|
|
"drafts_approved": 5, "positive_replies": 3,
|
|
"meetings": 2, "pipeline_sar": 25000,
|
|
"risks_blocked": 4, "customer_satisfaction": 9,
|
|
})
|
|
assert out["score"] >= 50
|
|
|
|
|
|
def test_scorecard_summarize_arabic():
|
|
out = build_service_scorecard("first_10_opportunities_sprint",
|
|
{"meetings": 3, "pipeline_sar": 30000})
|
|
summary = summarize_scorecard_ar(out)
|
|
assert any("" <= ch <= "ۿ" for ch in summary)
|
|
|
|
|
|
# ── CEO control ──────────────────────────────────────────────
|
|
def test_ceo_daily_brief_buttons_capped_at_three():
|
|
out = build_ceo_daily_service_brief()
|
|
assert len(out["buttons_ar"]) <= 3
|
|
|
|
|
|
def test_approval_card_blocks_live_send():
|
|
out = build_service_approval_card("first_10_opportunities_sprint",
|
|
"send_email")
|
|
assert out["live_send_allowed"] is False
|
|
assert len(out["buttons_ar"]) <= 3
|
|
|
|
|
|
def test_risk_alert_card_marks_high_risk():
|
|
out = build_risk_alert_card()
|
|
assert out["risk_level"] == "high"
|
|
|
|
|
|
# ── Upgrade paths ────────────────────────────────────────────
|
|
def test_upgrade_recommends_next_service():
|
|
out = recommend_upgrade("first_10_opportunities_sprint")
|
|
assert out["recommended_service_id"] in ("growth_os_monthly",
|
|
"self_growth_operator")
|
|
|
|
|
|
def test_upsell_message_arabic():
|
|
msg = build_upsell_message_ar("first_10_opportunities_sprint",
|
|
"growth_os_monthly")
|
|
assert any("" <= ch <= "ۿ" for ch in msg)
|