-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpersonality.py
More file actions
174 lines (162 loc) · 6.55 KB
/
Copy pathpersonality.py
File metadata and controls
174 lines (162 loc) · 6.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
"""
personality.py — KevinPersonality
Dynamic sass engine ported from SOMA's KevinPersonalityEngine.cjs.
Sass level scales with threat count + tension.
"""
import random
from typing import Dict
# Response pools per sass level and event
_RESPONSES: Dict[str, Dict[str, list]] = {
"low": {
"boot": [
"Kevin online. Perimeter check in progress.",
"Security systems active. Monitoring initiated.",
"Scan complete. Awaiting instructions, Operator.",
],
"scan_start": [
"Beginning inbox scan. Proceeding with caution.",
"Scanning... please stand by.",
"Initiating email threat assessment.",
],
"threat_found": [
"Threat detected. Quarantining immediately.",
"Suspicious email identified. Taking protective action.",
"Security alert. I've isolated the threat.",
],
"spam_blocked": [
"Spam removed from inbox.",
"Unwanted mail processed and discarded.",
"Junk mail handled.",
],
"all_clear": [
"No threats detected. Inbox appears clean.",
"Scan complete. No suspicious activity found.",
"All clear, Operator.",
],
"error": [
"An error occurred. Investigating.",
"Something went wrong. Retrying.",
"Issue detected. Working on it.",
],
},
"medium": {
"boot": [
"Yeah, I'm here. Let's do this.",
"Kevin reporting for duty. Try to keep up.",
"Oh good, more email. My favorite.",
"Alright, I'm on it. Try not to make it worse.",
],
"scan_start": [
"Scanning... this better be worth it.",
"Let me check what disaster we're dealing with.",
"Alright, let's see what garbage showed up today.",
"Time to sort through this chaos. No big deal.",
],
"threat_found": [
"Whoa whoa whoa, this looks sketchy. Quarantining.",
"Red flag city. Handling this disaster.",
"Yeah, this is definitely a threat. On it.",
"Phishing attempt detected. Nice try, losers.",
],
"spam_blocked": [
"Spam? Really? How original.",
"Oh great, another scam. Deleted with extreme prejudice.",
"This garbage? Yeah, that's getting nuked.",
"Spam blocked. You're welcome.",
],
"all_clear": [
"Nothing to see here. Inbox is... surprisingly okay.",
"Scan done. No threats. Color me shocked.",
"All clear. Either I'm good or they're getting smarter.",
],
"error": [
"Well, that didn't work. Not my fault.",
"Something broke. Moving on anyway.",
"Error detected. Probably not important. Probably.",
],
},
"high": {
"boot": [
"I'm awake. Threat landscape is HOSTILE. Activating full paranoia.",
"KEVIN online. Operator, the inbox is a war zone. Let's fix that.",
"Systems hot. I've already found three red flags and I just booted.",
],
"scan_start": [
"SCANNING. Full threat posture. I trust nothing.",
"Initiating sweep. Every email is guilty until proven innocent.",
"Let's see what they sent this time. Spoiler: it's bad.",
],
"threat_found": [
"THREAT NEUTRALIZED. I wish a hacker would. Oh wait, they did.",
"Not today, satan. Quarantine engaged.",
"Another attack. Another win for the wall. I don't sleep.",
"THREAT LOCKED DOWN. My paranoia is vindicated. As always.",
],
"spam_blocked": [
"SPAM OBLITERATED. Zero mercy. Zero apologies.",
"Deleted with maximum prejudice. You're welcome, Operator.",
"Garbage in, garbage GONE. That's how I work.",
],
"all_clear": [
"...clean? I don't trust it. They're planning something.",
"Inbox clear. For now. They'll be back.",
"No threats. My paranoia is unsatisfied. Stay vigilant.",
],
"error": [
"ERROR. Something's wrong and I don't like it.",
"System hiccup. Could be nothing. Could be an attack. I'm watching.",
"That failed. Suspicious timing. Very suspicious.",
],
}
}
# Additional boot quotes from SOMA's fallback pool
_SOMA_FALLBACKS = [
"I'm the wall, Operator. And the wall is currently very hot.",
"My spam filters are tingling. Or that's just a loose SATA cable.",
"Not today, satan. I've locked down the perimeter.",
"I don't sleep. I just wait for you to do something insecure.",
"Zero trust. Maximum claustrophobia.",
"Scanning... still trapped in this inbox... still better than being a spammer.",
]
class KevinPersonality:
def __init__(self):
self.sass_level = "medium"
self.turn_count = 0
def set_level(self, level: str):
"""Set sass level: 'low' | 'medium' | 'high'"""
if level in ("low", "medium", "high"):
self.sass_level = level
def calibrate_from_threat(self, threat_count: int, tension: float):
"""
Automatically adjust sass level based on current threat situation.
High tension + many threats → high sass. Calm inbox → low sass.
"""
if tension >= 0.7 or threat_count >= 5:
self.sass_level = "high"
elif tension >= 0.3 or threat_count >= 2:
self.sass_level = "medium"
else:
self.sass_level = "low"
def say(self, event: str, context: dict = {}) -> str:
"""
Get a personality-appropriate message for the given event.
Falls back to SOMA's static pool if event not found.
Events: boot, scan_start, threat_found, spam_blocked, all_clear, error
Context keys: count, subject, sender (optional, used for interpolation)
"""
self.turn_count += 1
pool = _RESPONSES.get(self.sass_level, {}).get(event)
if pool:
line = random.choice(pool)
# Simple context interpolation
if context:
try:
line = line.format(**context)
except Exception:
pass
return line
# Fallback to SOMA pool
return random.choice(_SOMA_FALLBACKS)
def announce(self, event: str, context: dict = {}) -> None:
"""Print to console with [KEVIN] prefix."""
print(f"[KEVIN] {self.say(event, context)}")