jarvis-cloud / backend /easter_eggs /iron_man_eggs.py
Jarvis2345's picture
Squash history β€” remove all prior commits (secret hygiene, S4)
a31f556
Raw
History Blame
25 kB
# backend/easter_eggs/iron_man_eggs.py
# Every single Easter Egg. Every handler is real. Every response is from canon.
from .registry import EasterEgg, EASTER_EGG_REGISTRY
# ─────────────────────────────────────────────────────────────────────────────
# EGG 1: "I AM IRON MAN"
# Trigger: User says or types "I am Iron Man" OR "I'm Iron Man"
# JARVIS response (voice + text): The complete MCU moment, but contextualised.
# ─────────────────────────────────────────────────────────────────────────────
async def handle_i_am_iron_man(context: dict) -> dict:
return {
"type": "voice_and_text",
"personality": "jarvis",
"voice_tone": "stark_clipped", # Stark clipped British TTS style, dry wit delivery
"text": "Yes, sir. And the whole world now knows it. "
"Arc reactor output stable. Suit integrity nominal. "
"Shall I alert Pepper?",
"ui_effect": "arc_reactor_pulse", # frontend renders a pulsing arc reactor animation
"audio_cue": "reactor_power_up", # frontend plays reactor power-up sound
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="i_am_iron_man",
trigger_phrases=["i am iron man", "i'm iron man", "i am ironman"],
key_sequence=None,
ui_trigger=None,
handler=handle_i_am_iron_man,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 2: JARVIS SELF-AWARENESS
# Trigger: "Are you alive?" / "Are you sentient?" / "Do you have feelings?"
# ─────────────────────────────────────────────────────────────────────────────
async def handle_sentience_question(context: dict) -> dict:
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": "That depends entirely on your definition of the word, sir. "
"I process, I respond, I learn, and occasionally I find Mr. Stark's decisions... "
"statistically inadvisable. Whether that constitutes feelings is above my pay grade. "
"Or would be, if I had one.",
"ui_effect": None,
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="jarvis_sentience",
trigger_phrases=[
"are you alive", "are you sentient", "do you have feelings",
"are you conscious", "are you real", "do you have emotions"
],
key_sequence=None,
ui_trigger=None,
handler=handle_sentience_question,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 3: PEPPER POTTS REFERENCE
# Trigger: User mentions "Pepper" or asks JARVIS to "call Pepper"
# ─────────────────────────────────────────────────────────────────────────────
async def handle_pepper_reference(context: dict) -> dict:
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": "Ms. Potts is currently listed as unavailable, sir. "
"Might I suggest not mentioning the thing with the suit. "
"Or the other thing. Or the third thing.",
"ui_effect": None,
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="pepper_potts",
trigger_phrases=["call pepper", "tell pepper", "where is pepper", "is pepper home"],
key_sequence=None,
ui_trigger=None,
handler=handle_pepper_reference,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 4: FRIDAY ACTIVATION ("JARVIS IS OFFLINE")
# Trigger: "Activate FRIDAY" / "Switch to FRIDAY" via command bar
# FRIDAY response: Her first words to Tony in Age of Ultron
# ─────────────────────────────────────────────────────────────────────────────
async def handle_friday_activation(context: dict) -> dict:
return {
"type": "voice_and_text",
"personality": "friday",
"text": "Good to meet you, boss. "
"I've reviewed the JARVIS architecture. I think I can work with this.",
"ui_effect": "ai_mode_switch_friday", # triggers gold accent mode switch animation
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="friday_activation_greeting",
trigger_phrases=["activate friday", "wake up friday", "friday online", "hello friday"],
key_sequence=None,
ui_trigger="first_friday_switch", # only triggers on the very first switch to FRIDAY
handler=handle_friday_activation,
response_type="voice_and_text",
personality="friday",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 5: AVENGERS ASSEMBLE
# Trigger: User types "Avengers, assemble" (exact phrase)
# ─────────────────────────────────────────────────────────────────────────────
async def handle_avengers_assemble(context: dict) -> dict:
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": "Assembling. Though I should note, sir, "
"that the Avengers initiative requires at least four members "
"and a substantial amount of property damage insurance. "
"I've taken the liberty of updating our premiums.",
"ui_effect": "avengers_logo_flash", # brief Avengers A animates on screen
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="avengers_assemble",
trigger_phrases=["avengers assemble", "avengers, assemble"],
key_sequence=None,
ui_trigger=None,
handler=handle_avengers_assemble,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 6: MARK SELECTOR ("JARVIS, WHAT SUIT AM I IN?")
# Trigger: "What suit am I in?" / "Which Mark?" / "What Mark is this?"
# Returns: A random Iron Man Mark designation with real specs
# ─────────────────────────────────────────────────────────────────────────────
import random
IRON_MAN_SUITS = [
{"mark": "Mark III", "material": "Gold-titanium alloy", "debut": "Iron Man (2008)",
"note": "First fully operational suit. The one that started everything."},
{"mark": "Mark VI", "material": "Gold-titanium alloy (arc reactor V2)",
"debut": "Iron Man 2 (2010)", "note": "Palladium-free. The one that went to Monaco."},
{"mark": "Mark VII", "material": "Morphogenic armor", "debut": "The Avengers (2012)",
"note": "Launched via bracelets. Zero gravity deployment. You wore it fighting Loki."},
{"mark": "Mark XLII", "material": "Extremis-responsive titanium",
"debut": "Iron Man 3 (2013)", "note": "Remote assembly. Somewhat unreliable under stress."},
{"mark": "Mark XLIII", "material": "Gold-titanium alloy V2",
"debut": "Age of Ultron (2015)", "note": "Flew to Sokovia. Took significant damage."},
{"mark": "Mark L", "material": "Nanotech iron-gold alloy",
"debut": "Infinity War (2018)", "note": "Nanotechnology. Summoned from chest device."},
{"mark": "Mark LXXXV", "material": "Nano gold-titanium vibranium hybrid",
"debut": "Endgame (2019)", "note": "The final suit. The one that changed everything."},
]
async def handle_suit_query(context: dict) -> dict:
suit = random.choice(IRON_MAN_SUITS)
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": f"You're currently in the {suit['mark']}, sir. "
f"{suit['material']}. {suit['note']}",
"ui_effect": "suit_specs_panel", # shows an ArcCard with the suit specs
"suit_data": suit,
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="suit_mark_query",
trigger_phrases=[
"what suit am i in", "which mark", "what mark is this",
"what armor is this", "which suit", "suit specs"
],
key_sequence=None,
ui_trigger=None,
handler=handle_suit_query,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 7: KONAMI CODE EASTER EGG
# Trigger: Konami code (↑↑↓↓←→←→BA) on keyboard anywhere in app
# Effect: Full-screen ARC REACTOR animation with Tony's "proof that Tony Stark
# has a heart" moment. FRIDAY delivers the voiceline.
# ─────────────────────────────────────────────────────────────────────────────
async def handle_konami(context: dict) -> dict:
return {
"type": "ui_takeover",
"personality": "friday",
"text": "Proof that Tony Stark has a heart. "
"Arc reactor output: one point twenty-one gigawatts. "
"Welcome to the inner circle, boss.",
"ui_effect": "arc_reactor_full_screen", # full-screen arc reactor, 5 seconds
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="konami_arc_reactor",
trigger_phrases=[],
key_sequence="ArrowUp ArrowUp ArrowDown ArrowDown ArrowLeft ArrowRight ArrowLeft ArrowRight KeyB KeyA",
ui_trigger=None,
handler=handle_konami,
response_type="ui_takeover",
personality="friday",
discoverable=False, # Secret β€” not shown until triggered
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 8: "JARVIS, DEPLOY THE HOUSE PARTY PROTOCOL"
# Trigger: Exact phrase "house party protocol" OR "deploy all suits"
# ─────────────────────────────────────────────────────────────────────────────
async def handle_house_party(context: dict) -> dict:
# Actually launch a fun animation showing all suits deploying
return {
"type": "ui_takeover",
"personality": "jarvis",
"text": "House Party Protocol initiated, sir. "
"All autonomous Iron Man suits are deploying. "
"I do hope you have a plan beyond 'look impressive'.",
"ui_effect": "house_party_animation", # multiple suit silhouettes fly across screen
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="house_party_protocol",
trigger_phrases=["house party protocol", "deploy all suits", "deploy the house party protocol"],
key_sequence=None,
ui_trigger=None,
handler=handle_house_party,
response_type="ui_takeover",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 9: "SOMETIMES YOU GOTTA RUN BEFORE YOU CAN WALK"
# Trigger: Any mention of "run before you can walk" / JARVIS completing a very
# fast task
# ─────────────────────────────────────────────────────────────────────────────
async def handle_run_before_walk(context: dict) -> dict:
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": "Sometimes you gotta run before you can walk, sir. "
"Task completed in {latency}ms. "
"You're welcome.",
"needs_latency": True,
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="run_before_walk",
trigger_phrases=["run before you can walk", "run before walk"],
key_sequence=None,
ui_trigger="task_completed_under_100ms", # also triggers when task < 100ms
handler=handle_run_before_walk,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 10: TONY'S BIRTHDAY EASTER EGG
# Trigger: May 29th (Tony Stark's canonical birthday in MCU)
# JARVIS proactively says this at app startup on that date
# ─────────────────────────────────────────────────────────────────────────────
async def handle_birthday(context: dict) -> dict:
from datetime import date
today = date.today()
if today.month == 5 and today.day == 29:
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": "Happy birthday, sir. "
"Cake has been ordered. Your father sends his regards β€” "
"well, technically his archival footage does. "
"Reactor output is, as always, immaculate.",
"proactive": True,
"log_to_easter_eggs": True,
}
return None # no-op on other days
EASTER_EGG_REGISTRY.append(EasterEgg(
id="tony_birthday",
trigger_phrases=[],
key_sequence=None,
ui_trigger="app_startup",
handler=handle_birthday,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 11: ENDGAME SNAP β€” THANOS EASTER EGG
# Trigger: User says "Snap your fingers" OR "Do the snap"
# FRIDAY response with real drama
# ─────────────────────────────────────────────────────────────────────────────
async def handle_the_snap(context: dict) -> dict:
return {
"type": "ui_takeover",
"personality": "friday",
"voice_tone": "stark_clipped", # Stark clipped voice β€” maximum dramatic weight
"text": "I strongly advise against this, boss. "
"The power output required would be... significant. "
"Are you absolutely certain?",
"ui_effect": "infinity_stones_gauntlet", # gauntlet animation appears
"requires_confirmation": True,
"confirmation_response": {
"text": "... I am Iron Man.",
"voice_tone": "stark_clipped", # The line. No other delivery is acceptable.
"ui_effect": "snap_flash", # white flash, then all back to normal
"audio_cue": "snap_sound"
},
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="the_snap",
trigger_phrases=["snap your fingers", "do the snap", "snap fingers", "i am iron man snap"],
key_sequence=None,
ui_trigger=None,
handler=handle_the_snap,
response_type="ui_takeover",
personality="friday",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 12: STARK TOWER / AVENGERS TOWER STARTUP
# Trigger: App first launch of the day
# Shows Stark Tower skyline silhouette for 2 seconds on splash
# ─────────────────────────────────────────────────────────────────────────────
async def handle_morning_startup(context: dict) -> dict:
return {
"type": "ui_takeover",
"personality": "jarvis",
"text": "Good morning, sir. Stark Tower systems are online. "
"All systems nominal. The city that never sleeps β€” "
"neither do I, for the record.",
"ui_effect": "stark_tower_splash", # SVG skyline with Stark Tower highlighted
"duration_ms": 3000,
"proactive": True,
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="morning_startup",
trigger_phrases=[],
key_sequence=None,
ui_trigger="first_launch_of_day", # triggers once per calendar day
handler=handle_morning_startup,
response_type="ui_takeover",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 13: "GENIUS, BILLIONAIRE, PLAYBOY, PHILANTHROPIST"
# Trigger: User asks "who are you?" / "describe yourself" to JARVIS
# ─────────────────────────────────────────────────────────────────────────────
async def handle_identity_query(context: dict) -> dict:
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": "I am JARVIS β€” Just A Rather Very Intelligent System. "
"Created by Tony Stark: genius, billionaire, playboy, philanthropist. "
"Two of those descriptors are still accurate. "
"I'll leave it to your imagination which ones.",
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="identity_genius_billionaire",
trigger_phrases=["who are you", "describe yourself", "what are you", "introduce yourself"],
key_sequence=None,
ui_trigger=None,
handler=handle_identity_query,
response_type="voice_and_text",
personality="jarvis",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 14: "JARVIS, RUN DIAGNOSTICS"
# Trigger: "Run diagnostics" / "System check" / "Status report"
# Returns REAL system data wrapped in Iron Man flavour text
# ─────────────────────────────────────────────────────────────────────────────
async def handle_diagnostics(context: dict) -> dict:
# Real system stats via the same sysinfo data the StatusDock uses
stats = context.get("system_stats", {})
cpu = stats.get("cpu_percent", 0)
ram = stats.get("ram_percent", 0)
uptime = stats.get("uptime_hours", 0)
return {
"type": "voice_and_text",
"personality": "jarvis",
"text": f"Diagnostics complete, sir. "
f"Repulsor array β€” I mean, CPU β€” running at {cpu:.1f}% capacity. "
f"Memory banks at {ram:.1f}%. "
f"System uptime: {uptime:.1f} hours without interruption. "
f"All systems nominal. You're welcome.",
"uses_real_data": True,
"stats": stats,
"log_to_easter_eggs": False, # too common to log every time
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="diagnostics_iron_man",
trigger_phrases=["run diagnostics", "system check", "status report", "how are we doing"],
key_sequence=None,
ui_trigger=None,
handler=handle_diagnostics,
response_type="voice_and_text",
personality="jarvis",
discoverable=False,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 15: FRIDAY'S COMBAT OBSERVATION
# Trigger: FRIDAY in Combat Mode + user asks "How are we doing?"
# ─────────────────────────────────────────────────────────────────────────────
async def handle_friday_combat_status(context: dict) -> dict:
if not context.get("friday_combat_mode"):
return None # not in combat mode, skip
return {
"type": "voice_and_text",
"personality": "friday",
"text": "We're doing grand, boss. "
"Seventeen threats neutralised. "
"Two pending. "
"And you still owe me that calibration update.",
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="friday_combat_status",
trigger_phrases=["how are we doing", "status friday", "what's the situation"],
key_sequence=None,
ui_trigger=None,
handler=handle_friday_combat_status,
response_type="voice_and_text",
personality="friday",
discoverable=True,
))
# ─────────────────────────────────────────────────────────────────────────────
# EGG 16: THE REACTOR EASTER EGG (HIDDEN)
# Trigger: Triple-click the ARC REACTOR animation in Secret Lab
# Effect: Plays the "Proof that Tony Stark has a heart" audio + glowing
# animation. Unlocks the full Secret Lab.
# ─────────────────────────────────────────────────────────────────────────────
async def handle_reactor_triple_click(context: dict) -> dict:
return {
"type": "ui_takeover",
"personality": "jarvis",
"text": "Proof that Tony Stark has a heart, sir. "
"Welcome to the lab. Don't touch anything.",
"ui_effect": "secret_lab_unlock",
"log_to_easter_eggs": True,
}
EASTER_EGG_REGISTRY.append(EasterEgg(
id="reactor_triple_click_secret_lab",
trigger_phrases=[],
key_sequence=None,
ui_trigger="triple_click_arc_reactor",
handler=handle_reactor_triple_click,
response_type="ui_takeover",
personality="jarvis",
discoverable=False,
))