@whykusanagi/corrupted-theme 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/ROUTING.md DELETED
@@ -1,324 +0,0 @@
1
- # Celeste ↔ NIKKE Sub-Agent Routing Architecture
2
-
3
- ## Overview
4
-
5
- Celeste uses intelligent intent detection to route queries:
6
- - **NIKKE queries** → NIKKE sub-agent (dedicated for game-specific data)
7
- - **General queries** → Main Celeste agent (personality + streaming + general chat)
8
-
9
- This separation reduces context window bloat and improves response accuracy for both contexts.
10
-
11
- ---
12
-
13
- ## How Routing Works
14
-
15
- ```
16
- User Input
17
-
18
- [celeste-widget.js: Fetch routing rules]
19
-
20
- [Detect Intent: NIKKE keywords/patterns?]
21
- ├─ YES (NIKKE detected)
22
- │ └─ Route to NIKKE sub-agent
23
- │ └─ Return formatted response
24
- └─ NO (General query)
25
- └─ Send to Main Celeste agent
26
- └─ Celeste responds
27
- ```
28
-
29
- ---
30
-
31
- ## Intent Detection
32
-
33
- ### Keywords Trigger NIKKE Routing
34
- ```
35
- "nikke", "union raid", "ur", "intercept",
36
- "character", "tier", "tier list", "meta", "best squad",
37
- "farm", "build", "equipment", "weapon",
38
- "chapter", "raid", "boss", "strategy", "guide"
39
- ```
40
-
41
- ### Pattern Matching
42
- ```regex
43
- ^(who|which).*(nikke|character).*(best|good|tier)
44
- ^(how|tips).*(farm|clear|beat)
45
- ^(what).*(meta|tier|build)
46
- ^(nikke).*(tier|rank|list)
47
- union.*raid|ur.*guide|nikke.*build
48
- ```
49
-
50
- ### Examples
51
-
52
- **Triggers NIKKE Routing:**
53
- - "Who's the best NIKKE character?"
54
- - "How do I farm efficiently?"
55
- - "What's the current meta?"
56
- - "Union Raid tier list"
57
- - "Build guide for Rapture"
58
- - "Best squad for tower?"
59
-
60
- **Does NOT Trigger NIKKE Routing:**
61
- - "Hi Celeste, how are you?"
62
- - "Tell me about yourself"
63
- - "What's your favorite outfit?"
64
- - "Stream recommendations?"
65
- - "Tell me some lore"
66
-
67
- ---
68
-
69
- ## Configuration Files
70
-
71
- ### `routing/routing_rules.json`
72
- **Contains:** Intent detection patterns, NIKKE keywords, fallback messages
73
-
74
- **Key Section:**
75
- ```json
76
- {
77
- "nikke_detection": {
78
- "keywords": ["nikke", "union raid", ...],
79
- "patterns": [
80
- "^(who|which).*(nikke|character).*(best|good|tier)",
81
- ...
82
- ]
83
- },
84
- "routing_rules": [
85
- {
86
- "condition": "query_matches(nikke_detection)",
87
- "action": "route_to_sub_agent",
88
- "sub_agent": "nikke_agent",
89
- "fallback_message": "The NIKKE archives are temporarily sealed..."
90
- }
91
- ]
92
- }
93
- ```
94
-
95
- ### `routing/nikke_agent_config.json`
96
- **Contains:** Sub-agent endpoint, auth, timeouts, OpenSearch indices
97
-
98
- **Key Section:**
99
- ```json
100
- {
101
- "nikke_agent": {
102
- "endpoint": "${NIKKE_AGENT_ENDPOINT}",
103
- "auth": {
104
- "scheme": "bearer",
105
- "key": "${NIKKE_AGENT_KEY}"
106
- },
107
- "timeouts": {
108
- "connect_ms": 5000,
109
- "read_ms": 10000,
110
- "total_ms": 10000
111
- }
112
- }
113
- }
114
- ```
115
-
116
- ---
117
-
118
- ## Environment Variables
119
-
120
- Set these in your `.env` or deployment configuration:
121
-
122
- ```bash
123
- # Main Celeste Agent (Digital Ocean)
124
- AGENT_ENDPOINT=https://svzuwvds2ipgf4ysetvzxvai.agents.do-ai.run
125
- AGENT_KEY=sk-xxxxx
126
-
127
- # NIKKE Sub-Agent
128
- NIKKE_AGENT_ENDPOINT=https://nikke-agent.whykusanagi.xyz/v1/nikke/query
129
- NIKKE_AGENT_KEY=sk-nikke-xxxxx
130
- ```
131
-
132
- ---
133
-
134
- ## Web Widget Integration
135
-
136
- The `celeste-widget.js` loads routing rules from celesteCLI repo:
137
-
138
- ```javascript
139
- const CELESTE_CONFIG = {
140
- routingRulesUrl: 'https://raw.githubusercontent.com/whykusanagi/celesteCLI/main/routing/routing_rules.json'
141
- };
142
-
143
- async function sendToCeleste(message) {
144
- // Fetch routing rules
145
- const routingRules = await fetch(CELESTE_CONFIG.routingRulesUrl).then(r => r.json());
146
-
147
- // Detect intent
148
- const intent = detectIntent(message, routingRules);
149
-
150
- // Route accordingly
151
- if (intent === 'nikke') {
152
- // Call NIKKE sub-agent
153
- } else {
154
- // Call main Celeste agent
155
- }
156
- }
157
- ```
158
-
159
- ---
160
-
161
- ## Fallback Behavior
162
-
163
- If the NIKKE sub-agent is unavailable:
164
-
165
- ```
166
- User Query (NIKKE detected)
167
-
168
- [Attempt NIKKE sub-agent]
169
- ├─ Timeout after 10 seconds
170
- └─ Return fallback message:
171
- "The NIKKE archives are temporarily sealed. Ask again in a moment, onii-chan."
172
- ```
173
-
174
- The widget gracefully degrades instead of hanging or throwing an error.
175
-
176
- ---
177
-
178
- ## OpenSearch Integration
179
-
180
- ### Celeste Indices
181
- - `celeste_capabilities` - What Celeste can do
182
- - `celeste_emotes` - Emote recommendations
183
- - `celeste_user_profiles` - User behavior data
184
- - `celeste_chat_logs` - Sample interactions
185
-
186
- ### NIKKE Sub-Agent Indices
187
- - `nikke_characters` - Character database
188
- - `nikke_tiers` - Tier lists
189
- - `nikke_guides` - Build guides
190
- - `nikke_union_data` - Protected union data
191
-
192
- Each agent queries its own indices only. No cross-contamination.
193
-
194
- ---
195
-
196
- ## Response Handling
197
-
198
- ### NIKKE Sub-Agent Response
199
- The sub-agent returns structured data:
200
- ```json
201
- {
202
- "characters": [...],
203
- "tiers": [...],
204
- "builds": [...],
205
- "recommendations": [...],
206
- "source_indices": [...]
207
- }
208
- ```
209
-
210
- Main Celeste agent formats this with personality:
211
- ```
212
- "Based on the archives, here's what I found:
213
- • Top DPS: Rapi, Viper, Privaty
214
- • Support Meta: Modernia, Ether, Helm
215
-
216
- Want me to explain any builds, onii-chan? 💜"
217
- ```
218
-
219
- ### Celeste Direct Response
220
- Main agent responds directly with personality:
221
- ```
222
- "Hi there! I'm Celeste, your demon noble co-host.
223
- I can chat, moderate chat, play games... or tease you about your questionable taste. 😈
224
- What'll it be?"
225
- ```
226
-
227
- ---
228
-
229
- ## Monitoring
230
-
231
- ### Log Entry Example
232
- ```
233
- [2025-11-21 14:32:10] User: "best nikke characters?"
234
- [2025-11-21 14:32:10] Intent Detection: MATCHED (keyword="nikke")
235
- [2025-11-21 14:32:10] Routing: NIKKE_AGENT
236
- [2025-11-21 14:32:10] Sub-agent latency: 342ms
237
- [2025-11-21 14:32:10] Response: [formatted with Celeste personality]
238
- ```
239
-
240
- ### Health Checks
241
- ```bash
242
- # Check main Celeste agent
243
- curl ${AGENT_ENDPOINT}/health
244
-
245
- # Check NIKKE sub-agent
246
- curl ${NIKKE_AGENT_ENDPOINT}/v1/health
247
- ```
248
-
249
- ---
250
-
251
- ## Troubleshooting
252
-
253
- ### Symptom: NIKKE query routed to Celeste instead of sub-agent
254
- **Possible Causes:**
255
- - Routing rules not loaded correctly
256
- - Intent detection pattern doesn't match query
257
- - Widget JavaScript error
258
-
259
- **Fix:**
260
- 1. Verify routing rules fetch succeeds
261
- 2. Check browser console for JavaScript errors
262
- 3. Manually test intent detection regex
263
-
264
- ### Symptom: NIKKE queries timeout
265
- **Possible Causes:**
266
- - Sub-agent endpoint unreachable
267
- - Timeout too short (10s default)
268
- - OpenSearch query is slow
269
-
270
- **Fix:**
271
- 1. Check `nikke_agent_config.json` endpoint
272
- 2. Verify NIKKE_AGENT_ENDPOINT env var is set
273
- 3. Test sub-agent health endpoint
274
-
275
- ### Symptom: Fallback message appears frequently
276
- **Possible Causes:**
277
- - NIKKE sub-agent is down
278
- - Network connectivity issue
279
- - Timeout threshold too low
280
-
281
- **Fix:**
282
- 1. Check NIKKE sub-agent deployment status
283
- 2. Increase timeout in `nikke_agent_config.json` if needed
284
- 3. Review error logs for specific failures
285
-
286
- ---
287
-
288
- ## Adding New Routing Rules
289
-
290
- To route a new query type (e.g., art questions to art agent):
291
-
292
- 1. **Edit `routing/routing_rules.json`:**
293
- ```json
294
- {
295
- "condition": "query_intent == 'art'",
296
- "action": "route_to_sub_agent",
297
- "sub_agent": "art_agent",
298
- "endpoint_env_var": "ART_AGENT_ENDPOINT"
299
- }
300
- ```
301
-
302
- 2. **Edit `routing/nikke_agent_config.json`** to add the new agent config
303
-
304
- 3. **Update detection keywords/patterns** in `routing_rules.json`
305
-
306
- 4. **Deploy** the updated files
307
-
308
- ---
309
-
310
- ## Performance Targets
311
-
312
- - **Intent detection:** <10ms
313
- - **NIKKE sub-agent call:** <10 seconds (timeout)
314
- - **Fallback response:** <100ms
315
- - **General Celeste response:** <5 seconds
316
-
317
- ---
318
-
319
- ## Related Documentation
320
-
321
- - `../celeste_essence.json` - System prompt with routing logic
322
- - `../Celeste_Capabilities.json` - What Celeste can do
323
- - `../opensearch/README.md` - Index management
324
- - `../../nikke-agent/docs/` - NIKKE sub-agent documentation