htmlgraph 0.24.2__py3-none-any.whl → 0.26.1__py3-none-any.whl

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.
Files changed (112) hide show
  1. htmlgraph/__init__.py +20 -1
  2. htmlgraph/agent_detection.py +26 -10
  3. htmlgraph/analytics/cross_session.py +4 -3
  4. htmlgraph/analytics/work_type.py +52 -16
  5. htmlgraph/analytics_index.py +51 -19
  6. htmlgraph/api/__init__.py +3 -0
  7. htmlgraph/api/main.py +2263 -0
  8. htmlgraph/api/static/htmx.min.js +1 -0
  9. htmlgraph/api/static/style-redesign.css +1344 -0
  10. htmlgraph/api/static/style.css +1079 -0
  11. htmlgraph/api/templates/dashboard-redesign.html +812 -0
  12. htmlgraph/api/templates/dashboard.html +794 -0
  13. htmlgraph/api/templates/partials/activity-feed-hierarchical.html +326 -0
  14. htmlgraph/api/templates/partials/activity-feed.html +1020 -0
  15. htmlgraph/api/templates/partials/agents-redesign.html +317 -0
  16. htmlgraph/api/templates/partials/agents.html +317 -0
  17. htmlgraph/api/templates/partials/event-traces.html +373 -0
  18. htmlgraph/api/templates/partials/features-kanban-redesign.html +509 -0
  19. htmlgraph/api/templates/partials/features.html +509 -0
  20. htmlgraph/api/templates/partials/metrics-redesign.html +346 -0
  21. htmlgraph/api/templates/partials/metrics.html +346 -0
  22. htmlgraph/api/templates/partials/orchestration-redesign.html +443 -0
  23. htmlgraph/api/templates/partials/orchestration.html +163 -0
  24. htmlgraph/api/templates/partials/spawners.html +375 -0
  25. htmlgraph/atomic_ops.py +560 -0
  26. htmlgraph/builders/base.py +55 -1
  27. htmlgraph/builders/bug.py +17 -2
  28. htmlgraph/builders/chore.py +17 -2
  29. htmlgraph/builders/epic.py +17 -2
  30. htmlgraph/builders/feature.py +25 -2
  31. htmlgraph/builders/phase.py +17 -2
  32. htmlgraph/builders/spike.py +27 -2
  33. htmlgraph/builders/track.py +14 -0
  34. htmlgraph/cigs/__init__.py +4 -0
  35. htmlgraph/cigs/reporter.py +818 -0
  36. htmlgraph/cli.py +1427 -401
  37. htmlgraph/cli_commands/__init__.py +1 -0
  38. htmlgraph/cli_commands/feature.py +195 -0
  39. htmlgraph/cli_framework.py +115 -0
  40. htmlgraph/collections/__init__.py +2 -0
  41. htmlgraph/collections/base.py +21 -0
  42. htmlgraph/collections/session.py +189 -0
  43. htmlgraph/collections/spike.py +7 -1
  44. htmlgraph/collections/task_delegation.py +236 -0
  45. htmlgraph/collections/traces.py +482 -0
  46. htmlgraph/config.py +113 -0
  47. htmlgraph/converter.py +41 -0
  48. htmlgraph/cost_analysis/__init__.py +5 -0
  49. htmlgraph/cost_analysis/analyzer.py +438 -0
  50. htmlgraph/dashboard.html +3356 -492
  51. htmlgraph-0.24.2.data/data/htmlgraph/dashboard.html → htmlgraph/dashboard.html.backup +2246 -248
  52. htmlgraph/dashboard.html.bak +7181 -0
  53. htmlgraph/dashboard.html.bak2 +7231 -0
  54. htmlgraph/dashboard.html.bak3 +7232 -0
  55. htmlgraph/db/__init__.py +38 -0
  56. htmlgraph/db/queries.py +790 -0
  57. htmlgraph/db/schema.py +1584 -0
  58. htmlgraph/deploy.py +26 -27
  59. htmlgraph/docs/API_REFERENCE.md +841 -0
  60. htmlgraph/docs/HTTP_API.md +750 -0
  61. htmlgraph/docs/INTEGRATION_GUIDE.md +752 -0
  62. htmlgraph/docs/ORCHESTRATION_PATTERNS.md +710 -0
  63. htmlgraph/docs/README.md +533 -0
  64. htmlgraph/docs/version_check.py +3 -1
  65. htmlgraph/error_handler.py +544 -0
  66. htmlgraph/event_log.py +2 -0
  67. htmlgraph/hooks/.htmlgraph/.session-warning-state.json +6 -0
  68. htmlgraph/hooks/.htmlgraph/agents.json +72 -0
  69. htmlgraph/hooks/.htmlgraph/index.sqlite +0 -0
  70. htmlgraph/hooks/__init__.py +8 -0
  71. htmlgraph/hooks/bootstrap.py +169 -0
  72. htmlgraph/hooks/cigs_pretool_enforcer.py +2 -2
  73. htmlgraph/hooks/concurrent_sessions.py +208 -0
  74. htmlgraph/hooks/context.py +318 -0
  75. htmlgraph/hooks/drift_handler.py +525 -0
  76. htmlgraph/hooks/event_tracker.py +496 -79
  77. htmlgraph/hooks/orchestrator.py +6 -4
  78. htmlgraph/hooks/orchestrator_reflector.py +4 -4
  79. htmlgraph/hooks/post_tool_use_handler.py +257 -0
  80. htmlgraph/hooks/pretooluse.py +473 -6
  81. htmlgraph/hooks/prompt_analyzer.py +637 -0
  82. htmlgraph/hooks/session_handler.py +637 -0
  83. htmlgraph/hooks/state_manager.py +504 -0
  84. htmlgraph/hooks/subagent_stop.py +309 -0
  85. htmlgraph/hooks/task_enforcer.py +39 -0
  86. htmlgraph/hooks/validator.py +15 -11
  87. htmlgraph/models.py +111 -15
  88. htmlgraph/operations/fastapi_server.py +230 -0
  89. htmlgraph/orchestration/headless_spawner.py +344 -29
  90. htmlgraph/orchestration/live_events.py +377 -0
  91. htmlgraph/pydantic_models.py +476 -0
  92. htmlgraph/quality_gates.py +350 -0
  93. htmlgraph/repo_hash.py +511 -0
  94. htmlgraph/sdk.py +348 -10
  95. htmlgraph/server.py +194 -0
  96. htmlgraph/session_hooks.py +300 -0
  97. htmlgraph/session_manager.py +131 -1
  98. htmlgraph/session_registry.py +587 -0
  99. htmlgraph/session_state.py +436 -0
  100. htmlgraph/system_prompts.py +449 -0
  101. htmlgraph/templates/orchestration-view.html +350 -0
  102. htmlgraph/track_builder.py +19 -0
  103. htmlgraph/validation.py +115 -0
  104. htmlgraph-0.26.1.data/data/htmlgraph/dashboard.html +7458 -0
  105. {htmlgraph-0.24.2.dist-info → htmlgraph-0.26.1.dist-info}/METADATA +91 -64
  106. {htmlgraph-0.24.2.dist-info → htmlgraph-0.26.1.dist-info}/RECORD +112 -46
  107. {htmlgraph-0.24.2.data → htmlgraph-0.26.1.data}/data/htmlgraph/styles.css +0 -0
  108. {htmlgraph-0.24.2.data → htmlgraph-0.26.1.data}/data/htmlgraph/templates/AGENTS.md.template +0 -0
  109. {htmlgraph-0.24.2.data → htmlgraph-0.26.1.data}/data/htmlgraph/templates/CLAUDE.md.template +0 -0
  110. {htmlgraph-0.24.2.data → htmlgraph-0.26.1.data}/data/htmlgraph/templates/GEMINI.md.template +0 -0
  111. {htmlgraph-0.24.2.dist-info → htmlgraph-0.26.1.dist-info}/WHEEL +0 -0
  112. {htmlgraph-0.24.2.dist-info → htmlgraph-0.26.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,1020 @@
1
+ <!-- Grouped Activity Feed - Display events organized by conversation turn (user prompt) -->
2
+ <div class="view-container activity-feed-view">
3
+ <div class="view-header">
4
+ <h2>Agent Activity Feed</h2>
5
+ <div class="view-info">
6
+ <small>Events grouped by conversation turn. Click to expand/collapse child events.</small>
7
+ </div>
8
+ <div class="view-filters">
9
+ <div class="trace-controls">
10
+ <button type="button" class="btn-small" onclick="expandAllConversationTurns()" title="Expand all conversation turns">Expand All</button>
11
+ <button type="button" class="btn-small" onclick="collapseAllConversationTurns()" title="Collapse all conversation turns">Collapse All</button>
12
+ </div>
13
+ </div>
14
+ </div>
15
+
16
+ <!-- Spawner Activity Filter -->
17
+ <div class="spawner-filter">
18
+ <label for="agent-type-filter">Filter:</label>
19
+ <select id="agent-type-filter" onchange="filterByAgentType(this.value)">
20
+ <option value="all">All Activity</option>
21
+ <option value="direct">Direct Actions Only</option>
22
+ <option value="spawner">Spawner Delegations Only</option>
23
+ <optgroup label="Specific Spawners">
24
+ <option value="gemini">Gemini (FREE)</option>
25
+ <option value="codex">Codex (Paid)</option>
26
+ <option value="copilot">Copilot (GitHub)</option>
27
+ </optgroup>
28
+ </select>
29
+ </div>
30
+
31
+ <div class="conversation-feed">
32
+ {% if conversation_turns %}
33
+ <div class="conversation-turns-list">
34
+ {% for turn in conversation_turns %}
35
+ <!-- Conversation Turn Container -->
36
+ <div class="conversation-turn"
37
+ data-turn-id="{{ turn.userQuery.event_id }}"
38
+ data-spawner-type="{% if turn.has_spawner %}spawner{% else %}direct{% endif %}"
39
+ data-agent="{{ turn.userQuery.agent_id }}">
40
+ <!-- User Query Parent Row (Clickable) -->
41
+ <div class="userquery-parent"
42
+ onclick="toggleConversationTurn('{{ turn.userQuery.event_id }}')"
43
+ data-turn-id="{{ turn.userQuery.event_id }}">
44
+
45
+ <!-- Expand/Collapse Toggle -->
46
+ <span class="expand-toggle-turn" id="toggle-{{ turn.userQuery.event_id }}">▶</span>
47
+
48
+ <!-- User Prompt Text -->
49
+ <div class="prompt-section">
50
+ <span class="prompt-text" title="{{ turn.userQuery.prompt }}">
51
+ {{ turn.userQuery.prompt[:100] }}{% if turn.userQuery.prompt|length > 100 %}...{% endif %}
52
+ </span>
53
+ </div>
54
+
55
+ <!-- Stats Badges -->
56
+ <div class="turn-stats">
57
+ {% if turn.stats.tool_count > 0 %}
58
+ <span class="stat-badge tool-count" title="Tool calls">
59
+ {{ turn.stats.tool_count }}
60
+ </span>
61
+ {% endif %}
62
+
63
+ <span class="stat-badge duration" title="Total duration">
64
+ {{ "%.2f"|format(turn.stats.total_duration) }}s
65
+ </span>
66
+
67
+ {% if turn.stats.success_count > 0 %}
68
+ <span class="stat-badge success" title="Successful operations">
69
+ ✓ {{ turn.stats.success_count }}
70
+ </span>
71
+ {% endif %}
72
+
73
+ {% if turn.stats.error_count > 0 %}
74
+ <span class="stat-badge error" title="Errors">
75
+ ✗ {{ turn.stats.error_count }}
76
+ </span>
77
+ {% endif %}
78
+ </div>
79
+
80
+ <!-- Timestamp -->
81
+ <div class="turn-timestamp">
82
+ {{ turn.userQuery.timestamp }}
83
+ </div>
84
+ </div>
85
+
86
+ <!-- Child Events Container (Hidden by default) -->
87
+ <div class="turn-children collapsed" id="children-{{ turn.userQuery.event_id }}">
88
+ {% if turn.children %}
89
+ {% for child in turn.children recursive %}
90
+ <!-- Child Event Row -->
91
+ <div class="child-event-row depth-{{ child.depth|default(0) }}"
92
+ data-event-id="{{ child.event_id }}"
93
+ style="margin-left: {{ (child.depth|default(0)) * 20 }}px;">
94
+ <!-- Tree Connector -->
95
+ <span class="tree-connector">
96
+ {% if loop.last and not child.children %}└─{% else %}├─{% endif %}
97
+ </span>
98
+
99
+ <!-- Tool Name -->
100
+ <span class="child-tool-name">{{ child.tool_name }}</span>
101
+
102
+ <!-- Summary/Input -->
103
+ <span class="child-summary" title="{{ child.summary }}">
104
+ {{ child.summary[:80] }}{% if child.summary|length > 80 %}...{% endif %}
105
+ </span>
106
+
107
+ <!-- Agent Badge with Spawner Support -->
108
+ {% if child.spawner_type %}
109
+ <!-- Spawner delegation: show orchestrator → spawned AI -->
110
+ <span class="child-agent-badge agent-{{ child.agent|lower|replace(' ', '-') }}">
111
+ {{ child.agent }}
112
+ {% if child.model %}
113
+ <span class="model-indicator">{{ child.model }}</span>
114
+ {% endif %}
115
+ </span>
116
+ <span class="delegation-arrow">→</span>
117
+ <span class="spawner-badge spawner-{{ child.spawner_type|lower }}">
118
+ {{ child.spawned_agent or child.subagent_type or child.spawner_type }}
119
+ {% if child.cost_usd %}
120
+ <span class="cost-badge">${{ "%.2f"|format(child.cost_usd) }}</span>
121
+ {% endif %}
122
+ </span>
123
+ {% else %}
124
+ <!-- Regular agent: just show agent name + model if available -->
125
+ <span class="child-agent-badge agent-{{ child.agent|lower|replace(' ', '-') }}">
126
+ {{ child.agent }}
127
+ {% if child.model %}
128
+ <span class="model-indicator">{{ child.model }}</span>
129
+ {% endif %}
130
+ </span>
131
+ {% endif %}
132
+
133
+ <!-- Duration -->
134
+ <span class="child-duration">
135
+ {{ "%.2f"|format(child.duration_seconds) }}s
136
+ </span>
137
+
138
+ <!-- Timestamp -->
139
+ <span class="child-timestamp">
140
+ {{ child.timestamp }}
141
+ </span>
142
+ </div>
143
+ <!-- Recursively render nested children -->
144
+ {% if child.children %}
145
+ {{ loop(child.children) }}
146
+ {% endif %}
147
+ {% endfor %}
148
+ {% else %}
149
+ <div class="no-children-message">
150
+ <span class="tree-connector">└─</span>
151
+ <span class="text-muted">No child events</span>
152
+ </div>
153
+ {% endif %}
154
+ </div>
155
+ </div>
156
+ {% endfor %}
157
+ </div>
158
+ {% else %}
159
+ <div class="empty-state">
160
+ <p>No conversation turns found</p>
161
+ <small>Agent activity will appear here as tasks are executed</small>
162
+ </div>
163
+ {% endif %}
164
+ </div>
165
+
166
+ <!-- Auto-refresh indicator -->
167
+ <div class="auto-refresh-indicator">
168
+ <span class="refresh-dot"></span>
169
+ Live updates enabled (via WebSocket)
170
+ </div>
171
+ </div>
172
+
173
+ <style>
174
+ /* ============================================
175
+ Grouped Activity Feed - Conversation Turns
176
+ ============================================ */
177
+
178
+ .conversation-feed {
179
+ display: flex;
180
+ flex-direction: column;
181
+ font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;
182
+ font-size: 0.8rem;
183
+ }
184
+
185
+ /* Conversation Turns List Container */
186
+ .conversation-turns-list {
187
+ display: flex;
188
+ flex-direction: column;
189
+ gap: 0.5rem;
190
+ padding: 0.5rem;
191
+ }
192
+
193
+ /* Individual Conversation Turn */
194
+ .conversation-turn {
195
+ border-radius: 4px;
196
+ overflow: hidden;
197
+ background: var(--bg-base);
198
+ border: 1px solid var(--border-subtle);
199
+ }
200
+
201
+ /* User Query Parent Row - Clickable Header */
202
+ .userquery-parent {
203
+ display: flex;
204
+ align-items: center;
205
+ gap: 0.75rem;
206
+ padding: 1rem;
207
+ background: rgba(200, 255, 0, 0.08);
208
+ border-left: 3px solid var(--accent, #c8ff00);
209
+ cursor: pointer;
210
+ transition: all 0.15s ease;
211
+ user-select: none;
212
+ }
213
+
214
+ .userquery-parent:hover {
215
+ background: rgba(200, 255, 0, 0.12);
216
+ border-left-color: #a3e635;
217
+ }
218
+
219
+ /* Expand/Collapse Toggle */
220
+ .expand-toggle-turn {
221
+ display: inline-flex;
222
+ align-items: center;
223
+ justify-content: center;
224
+ width: 24px;
225
+ height: 24px;
226
+ font-size: 0.8rem;
227
+ color: var(--accent-lime, #a3e635);
228
+ transition: transform 0.2s ease;
229
+ flex-shrink: 0;
230
+ }
231
+
232
+ .expand-toggle-turn.expanded {
233
+ transform: rotate(90deg);
234
+ }
235
+
236
+ /* Prompt Section */
237
+ .prompt-section {
238
+ display: flex;
239
+ align-items: center;
240
+ gap: 0.5rem;
241
+ flex: 1;
242
+ min-width: 0;
243
+ }
244
+
245
+ .prompt-icon {
246
+ font-size: 1.1rem;
247
+ flex-shrink: 0;
248
+ }
249
+
250
+ .prompt-text {
251
+ color: var(--text-primary);
252
+ font-weight: 500;
253
+ overflow: hidden;
254
+ text-overflow: ellipsis;
255
+ white-space: nowrap;
256
+ }
257
+
258
+ /* Turn Stats Container */
259
+ .turn-stats {
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 0.4rem;
263
+ flex-shrink: 0;
264
+ }
265
+
266
+ /* Stat Badges */
267
+ .stat-badge {
268
+ display: inline-block;
269
+ padding: 0.25rem 0.5rem;
270
+ font-size: 0.65rem;
271
+ font-weight: 600;
272
+ text-transform: uppercase;
273
+ letter-spacing: 0.05em;
274
+ border-radius: 3px;
275
+ background: rgba(255, 255, 255, 0.1);
276
+ color: var(--text-secondary);
277
+ white-space: nowrap;
278
+ }
279
+
280
+ .stat-badge.tool-count {
281
+ background: rgba(163, 230, 53, 0.2);
282
+ color: #a3e635;
283
+ }
284
+
285
+ .stat-badge.duration {
286
+ background: rgba(100, 200, 255, 0.2);
287
+ color: #64c8ff;
288
+ }
289
+
290
+ .stat-badge.success {
291
+ background: rgba(34, 197, 94, 0.2);
292
+ color: #22c55e;
293
+ }
294
+
295
+ .stat-badge.error {
296
+ background: rgba(239, 68, 68, 0.2);
297
+ color: #ef4444;
298
+ }
299
+
300
+ /* Turn Timestamp */
301
+ .turn-timestamp {
302
+ font-size: 0.65rem;
303
+ color: var(--text-muted);
304
+ flex-shrink: 0;
305
+ min-width: 140px;
306
+ text-align: right;
307
+ }
308
+
309
+ /* Child Events Container */
310
+ .turn-children {
311
+ display: flex;
312
+ flex-direction: column;
313
+ background: rgba(163, 230, 53, 0.02);
314
+ border-top: 1px solid var(--border-subtle);
315
+ padding: 0.5rem 1rem 0.5rem 2.5rem; /* Indent children under parent prompt */
316
+ }
317
+
318
+ .turn-children.collapsed {
319
+ display: none;
320
+ }
321
+
322
+ /* Child Event Row */
323
+ .child-event-row {
324
+ display: flex;
325
+ align-items: center;
326
+ gap: 0.2rem;
327
+ padding: 0.5rem 0;
328
+ border-bottom: 1px solid rgba(163, 230, 53, 0.1);
329
+ font-size: 0.75rem;
330
+ margin-left: 0;
331
+ }
332
+
333
+ .child-event-row:last-child {
334
+ border-bottom: none;
335
+ }
336
+
337
+ /* Tree Connector */
338
+ .tree-connector {
339
+ color: var(--accent-lime, #a3e635);
340
+ font-size: 0.9rem;
341
+ font-weight: bold;
342
+ font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;
343
+ white-space: nowrap; /* Changed from 'pre' to collapse template whitespace */
344
+ flex-shrink: 0;
345
+ width: 24px; /* Fixed width for consistent alignment */
346
+ }
347
+
348
+ /* Child Tool Name */
349
+ .child-tool-name {
350
+ display: inline-block;
351
+ padding: 0.1rem 0.3rem;
352
+ background: rgba(255, 255, 255, 0.05);
353
+ color: var(--text-primary);
354
+ border-radius: 2px;
355
+ font-weight: 500;
356
+ flex-shrink: 0;
357
+ }
358
+
359
+ /* Child Summary */
360
+ .child-summary {
361
+ color: var(--text-secondary);
362
+ flex: 1;
363
+ min-width: 0;
364
+ overflow: hidden;
365
+ text-overflow: ellipsis;
366
+ white-space: nowrap;
367
+ }
368
+
369
+ /* Child Agent Badge */
370
+ .child-agent-badge {
371
+ display: inline-flex;
372
+ align-items: center;
373
+ gap: 0.25rem;
374
+ padding: 0.1rem 0.35rem;
375
+ font-size: 0.6rem;
376
+ font-weight: 600;
377
+ text-transform: uppercase;
378
+ letter-spacing: 0.05em;
379
+ border-radius: 2px;
380
+ background: rgba(255, 255, 255, 0.08);
381
+ color: var(--text-secondary);
382
+ flex-shrink: 0;
383
+ }
384
+
385
+ /* Model Indicator Badge */
386
+ .model-indicator {
387
+ display: inline-block;
388
+ padding: 0.05rem 0.2rem;
389
+ font-size: 0.55rem;
390
+ background: rgba(100, 200, 255, 0.15);
391
+ color: #64c8ff;
392
+ border-radius: 1px;
393
+ font-weight: 700;
394
+ letter-spacing: 0.02em;
395
+ text-transform: capitalize;
396
+ }
397
+
398
+ .child-agent-badge.agent-claude-code,
399
+ .child-agent-badge.agent-claude {
400
+ background: rgba(200, 255, 0, 0.15);
401
+ color: #c8ff00;
402
+ }
403
+
404
+ .child-agent-badge.agent-gemini,
405
+ .child-agent-badge.agent-gemini-2-0-flash-exp {
406
+ background: rgba(74, 222, 128, 0.15);
407
+ color: #4ade80;
408
+ }
409
+
410
+ /* Child Duration */
411
+ .child-duration {
412
+ display: inline-block;
413
+ padding: 0.1rem 0.3rem;
414
+ background: rgba(100, 200, 255, 0.1);
415
+ color: #64c8ff;
416
+ border-radius: 2px;
417
+ font-size: 0.65rem;
418
+ flex-shrink: 0;
419
+ }
420
+
421
+ /* Child Timestamp */
422
+ .child-timestamp {
423
+ color: var(--text-muted);
424
+ font-size: 0.65rem;
425
+ flex-shrink: 0;
426
+ min-width: 140px;
427
+ text-align: right;
428
+ }
429
+
430
+ /* No Children Message */
431
+ .no-children-message {
432
+ display: flex;
433
+ align-items: center;
434
+ gap: 0.5rem;
435
+ padding: 0.6rem 0;
436
+ color: var(--text-muted);
437
+ font-size: 0.75rem;
438
+ }
439
+
440
+ /* ============================================
441
+ Control Buttons
442
+ ============================================ */
443
+
444
+ .trace-controls {
445
+ display: flex;
446
+ gap: 0.5rem;
447
+ }
448
+
449
+ .btn-small {
450
+ padding: 0.3rem 0.6rem;
451
+ font-size: 0.65rem;
452
+ background: var(--bg-darker);
453
+ border: 1px solid var(--border-subtle);
454
+ color: var(--text-secondary);
455
+ cursor: pointer;
456
+ border-radius: 2px;
457
+ transition: all 0.15s ease;
458
+ text-transform: uppercase;
459
+ letter-spacing: 0.05em;
460
+ font-family: inherit;
461
+ }
462
+
463
+ .btn-small:hover {
464
+ background: rgba(163, 230, 53, 0.1);
465
+ border-color: var(--accent-lime, #a3e635);
466
+ color: var(--accent-lime, #a3e635);
467
+ }
468
+
469
+ /* ============================================
470
+ Empty State
471
+ ============================================ */
472
+
473
+ .empty-state {
474
+ padding: 3rem;
475
+ text-align: center;
476
+ color: var(--text-muted);
477
+ }
478
+
479
+ .empty-state p {
480
+ font-size: 1rem;
481
+ margin-bottom: 0.5rem;
482
+ }
483
+
484
+ /* ============================================
485
+ Auto-refresh Indicator
486
+ ============================================ */
487
+
488
+ .auto-refresh-indicator {
489
+ display: flex;
490
+ align-items: center;
491
+ gap: 0.5rem;
492
+ padding: 0.5rem 1rem;
493
+ font-size: 0.65rem;
494
+ color: var(--text-muted);
495
+ background: var(--bg-darker);
496
+ border-top: 1px solid var(--border-subtle);
497
+ }
498
+
499
+ .refresh-dot {
500
+ width: 6px;
501
+ height: 6px;
502
+ background: var(--accent-lime, #a3e635);
503
+ border-radius: 50%;
504
+ animation: pulse 2s ease-in-out infinite;
505
+ }
506
+
507
+ @keyframes pulse {
508
+ 0%, 100% { opacity: 1; }
509
+ 50% { opacity: 0.4; }
510
+ }
511
+
512
+ /* ============================================
513
+ Responsive Adjustments
514
+ ============================================ */
515
+
516
+ @media (max-width: 1200px) {
517
+ .turn-timestamp,
518
+ .child-timestamp {
519
+ display: none;
520
+ }
521
+ }
522
+
523
+ @media (max-width: 900px) {
524
+ .turn-stats {
525
+ flex-wrap: wrap;
526
+ }
527
+
528
+ .child-summary {
529
+ max-width: 150px;
530
+ }
531
+ }
532
+
533
+ @media (max-width: 700px) {
534
+ .userquery-parent {
535
+ flex-wrap: wrap;
536
+ gap: 0.5rem;
537
+ }
538
+
539
+ .prompt-section {
540
+ width: 100%;
541
+ order: 2;
542
+ }
543
+
544
+ .turn-stats {
545
+ order: 3;
546
+ }
547
+
548
+ .child-event-row {
549
+ flex-wrap: wrap;
550
+ }
551
+
552
+ .child-summary {
553
+ width: 100%;
554
+ }
555
+ }
556
+
557
+ /* ============================================
558
+ Live Spawner Indicator Styles
559
+ ============================================ */
560
+
561
+ .live-spawner-indicator {
562
+ display: none;
563
+ align-items: center;
564
+ gap: 0.75rem;
565
+ padding: 0.75rem 1rem;
566
+ margin: 0.5rem;
567
+ background: linear-gradient(135deg, rgba(163, 230, 53, 0.1) 0%, rgba(100, 200, 255, 0.1) 100%);
568
+ border: 1px solid rgba(163, 230, 53, 0.3);
569
+ border-radius: 6px;
570
+ font-size: 0.8rem;
571
+ transition: all 0.3s ease;
572
+ overflow: hidden;
573
+ }
574
+
575
+ .live-spawner-indicator.active {
576
+ display: flex;
577
+ border-color: rgba(163, 230, 53, 0.6);
578
+ box-shadow: 0 0 20px rgba(163, 230, 53, 0.2);
579
+ }
580
+
581
+ .live-spawner-indicator.completed {
582
+ display: flex;
583
+ background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
584
+ border-color: rgba(34, 197, 94, 0.5);
585
+ }
586
+
587
+ .live-spawner-indicator.failed {
588
+ display: flex;
589
+ background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
590
+ border-color: rgba(239, 68, 68, 0.5);
591
+ }
592
+
593
+ .live-spawner-indicator.fade-out {
594
+ opacity: 0;
595
+ transform: translateY(-10px);
596
+ }
597
+
598
+ /* Spawner Icons */
599
+ .live-spawner-icon {
600
+ width: 24px;
601
+ height: 24px;
602
+ border-radius: 50%;
603
+ display: flex;
604
+ align-items: center;
605
+ justify-content: center;
606
+ flex-shrink: 0;
607
+ position: relative;
608
+ }
609
+
610
+ .live-spawner-icon::before {
611
+ content: '';
612
+ width: 12px;
613
+ height: 12px;
614
+ border-radius: 50%;
615
+ }
616
+
617
+ .live-spawner-icon.spawner-gemini {
618
+ background: rgba(74, 222, 128, 0.2);
619
+ }
620
+ .live-spawner-icon.spawner-gemini::before {
621
+ background: #4ade80;
622
+ }
623
+
624
+ .live-spawner-icon.spawner-codex {
625
+ background: rgba(100, 200, 255, 0.2);
626
+ }
627
+ .live-spawner-icon.spawner-codex::before {
628
+ background: #64c8ff;
629
+ }
630
+
631
+ .live-spawner-icon.spawner-copilot {
632
+ background: rgba(168, 85, 247, 0.2);
633
+ }
634
+ .live-spawner-icon.spawner-copilot::before {
635
+ background: #a855f7;
636
+ }
637
+
638
+ /* Pulsing animation for active spawners */
639
+ .live-spawner-icon.pulsing::after {
640
+ content: '';
641
+ position: absolute;
642
+ width: 100%;
643
+ height: 100%;
644
+ border-radius: 50%;
645
+ border: 2px solid currentColor;
646
+ animation: spawner-pulse 1.5s ease-out infinite;
647
+ }
648
+
649
+ .live-spawner-icon.spawner-gemini.pulsing::after { border-color: #4ade80; }
650
+ .live-spawner-icon.spawner-codex.pulsing::after { border-color: #64c8ff; }
651
+ .live-spawner-icon.spawner-copilot.pulsing::after { border-color: #a855f7; }
652
+
653
+ @keyframes spawner-pulse {
654
+ 0% {
655
+ transform: scale(1);
656
+ opacity: 1;
657
+ }
658
+ 100% {
659
+ transform: scale(2);
660
+ opacity: 0;
661
+ }
662
+ }
663
+
664
+ /* Streaming animation */
665
+ .live-spawner-icon.streaming::after {
666
+ content: '';
667
+ position: absolute;
668
+ width: 6px;
669
+ height: 6px;
670
+ background: currentColor;
671
+ border-radius: 50%;
672
+ animation: spawner-stream 0.6s ease-in-out infinite;
673
+ }
674
+
675
+ @keyframes spawner-stream {
676
+ 0%, 100% { opacity: 0.3; transform: translateX(-8px); }
677
+ 50% { opacity: 1; transform: translateX(8px); }
678
+ }
679
+
680
+ /* Done state */
681
+ .live-spawner-icon.done::after {
682
+ content: '';
683
+ position: absolute;
684
+ width: 8px;
685
+ height: 4px;
686
+ border-left: 2px solid #22c55e;
687
+ border-bottom: 2px solid #22c55e;
688
+ transform: rotate(-45deg);
689
+ top: 8px;
690
+ }
691
+
692
+ /* Error state */
693
+ .live-spawner-icon.error::before {
694
+ background: #ef4444;
695
+ }
696
+ .live-spawner-icon.error::after {
697
+ content: '!';
698
+ position: absolute;
699
+ color: white;
700
+ font-size: 10px;
701
+ font-weight: bold;
702
+ }
703
+
704
+ /* Text elements */
705
+ .live-spawner-text {
706
+ color: var(--text-primary);
707
+ white-space: nowrap;
708
+ }
709
+
710
+ .live-spawner-text strong {
711
+ color: var(--accent-lime, #a3e635);
712
+ letter-spacing: 0.05em;
713
+ }
714
+
715
+ .live-spawner-prompt,
716
+ .live-spawner-message {
717
+ flex: 1;
718
+ color: var(--text-secondary);
719
+ overflow: hidden;
720
+ text-overflow: ellipsis;
721
+ white-space: nowrap;
722
+ font-style: italic;
723
+ opacity: 0.8;
724
+ }
725
+
726
+ .live-spawner-progress {
727
+ padding: 0.15rem 0.4rem;
728
+ background: rgba(100, 200, 255, 0.2);
729
+ color: #64c8ff;
730
+ border-radius: 3px;
731
+ font-weight: 600;
732
+ font-size: 0.7rem;
733
+ }
734
+
735
+ .live-spawner-duration {
736
+ padding: 0.15rem 0.4rem;
737
+ background: rgba(34, 197, 94, 0.2);
738
+ color: #22c55e;
739
+ border-radius: 3px;
740
+ font-weight: 600;
741
+ font-size: 0.7rem;
742
+ }
743
+
744
+ .live-spawner-tokens {
745
+ padding: 0.15rem 0.4rem;
746
+ background: rgba(163, 230, 53, 0.2);
747
+ color: #a3e635;
748
+ border-radius: 3px;
749
+ font-size: 0.65rem;
750
+ }
751
+
752
+ .live-spawner-details {
753
+ color: var(--text-muted);
754
+ font-size: 0.7rem;
755
+ }
756
+
757
+ .live-spawner-error {
758
+ color: #ef4444;
759
+ font-size: 0.7rem;
760
+ overflow: hidden;
761
+ text-overflow: ellipsis;
762
+ white-space: nowrap;
763
+ max-width: 300px;
764
+ }
765
+ </style>
766
+
767
+ <script>
768
+ // JavaScript functions for expand/collapse functionality
769
+ // Called from onclick handlers in the template
770
+
771
+ function toggleConversationTurn(turnId) {
772
+ const childrenContainer = document.getElementById(`children-${turnId}`);
773
+ const toggleButton = document.getElementById(`toggle-${turnId}`);
774
+
775
+ if (childrenContainer) {
776
+ childrenContainer.classList.toggle('collapsed');
777
+ if (toggleButton) {
778
+ toggleButton.classList.toggle('expanded');
779
+ }
780
+ }
781
+ }
782
+
783
+ function expandAllConversationTurns() {
784
+ // Get all child containers and remove the 'collapsed' class
785
+ document.querySelectorAll('.turn-children').forEach(container => {
786
+ container.classList.remove('collapsed');
787
+ });
788
+
789
+ // Rotate all toggle buttons
790
+ document.querySelectorAll('.expand-toggle-turn').forEach(toggle => {
791
+ toggle.classList.add('expanded');
792
+ });
793
+ }
794
+
795
+ function collapseAllConversationTurns() {
796
+ // Get all child containers and add the 'collapsed' class
797
+ document.querySelectorAll('.turn-children').forEach(container => {
798
+ container.classList.add('collapsed');
799
+ });
800
+
801
+ // Rotate all toggle buttons back
802
+ document.querySelectorAll('.expand-toggle-turn').forEach(toggle => {
803
+ toggle.classList.remove('expanded');
804
+ });
805
+ }
806
+
807
+ // ============================================
808
+ // Live Spawner Event Handling via WebSocket
809
+ // ============================================
810
+
811
+ // Track active spawner sessions by parent_event_id
812
+ const activeSpawners = new Map();
813
+
814
+ /**
815
+ * Handle incoming spawner events from WebSocket
816
+ * Called from the main WebSocket handler in dashboard
817
+ */
818
+ function handleSpawnerEvent(event) {
819
+ const { event_type, spawner_type, parent_event_id, data, timestamp } = event;
820
+
821
+ console.log('[SpawnerEvent]', event_type, spawner_type, data);
822
+
823
+ switch (event_type) {
824
+ case 'spawner_start':
825
+ showSpawnerStarted(spawner_type, parent_event_id, data, timestamp);
826
+ break;
827
+ case 'spawner_phase':
828
+ updateSpawnerPhase(spawner_type, parent_event_id, data);
829
+ break;
830
+ case 'spawner_complete':
831
+ showSpawnerCompleted(spawner_type, parent_event_id, data, timestamp);
832
+ break;
833
+ case 'spawner_tool_use':
834
+ showSpawnerToolUse(spawner_type, parent_event_id, data);
835
+ break;
836
+ case 'spawner_message':
837
+ showSpawnerMessage(spawner_type, parent_event_id, data);
838
+ break;
839
+ default:
840
+ console.log('[SpawnerEvent] Unknown event type:', event_type);
841
+ }
842
+ }
843
+
844
+ /**
845
+ * Show spawner started indicator
846
+ */
847
+ function showSpawnerStarted(spawnerType, parentEventId, data, timestamp) {
848
+ // Store in active spawners
849
+ activeSpawners.set(parentEventId || `spawner-${Date.now()}`, {
850
+ spawnerType,
851
+ startTime: new Date(timestamp),
852
+ phase: 'initializing',
853
+ data
854
+ });
855
+
856
+ // Create or update the live activity indicator
857
+ const indicator = getOrCreateLiveIndicator();
858
+ indicator.innerHTML = `
859
+ <span class="live-spawner-icon spawner-${spawnerType}"></span>
860
+ <span class="live-spawner-text">
861
+ <strong>${spawnerType.toUpperCase()}</strong> starting...
862
+ </span>
863
+ <span class="live-spawner-prompt">${(data.prompt_preview || '').substring(0, 60)}...</span>
864
+ `;
865
+ indicator.classList.add('active');
866
+ indicator.classList.remove('completed', 'failed');
867
+ }
868
+
869
+ /**
870
+ * Update spawner phase/progress
871
+ */
872
+ function updateSpawnerPhase(spawnerType, parentEventId, data) {
873
+ const indicator = getOrCreateLiveIndicator();
874
+ const phaseText = data.phase || 'processing';
875
+ const progress = data.progress;
876
+
877
+ let progressHtml = '';
878
+ if (progress !== undefined && progress !== null) {
879
+ progressHtml = `<span class="live-spawner-progress">${progress}%</span>`;
880
+ }
881
+
882
+ indicator.innerHTML = `
883
+ <span class="live-spawner-icon spawner-${spawnerType} pulsing"></span>
884
+ <span class="live-spawner-text">
885
+ <strong>${spawnerType.toUpperCase()}</strong> ${phaseText}
886
+ </span>
887
+ ${progressHtml}
888
+ ${data.details ? `<span class="live-spawner-details">${data.details}</span>` : ''}
889
+ `;
890
+ }
891
+
892
+ /**
893
+ * Show spawner completed
894
+ */
895
+ function showSpawnerCompleted(spawnerType, parentEventId, data, timestamp) {
896
+ const indicator = getOrCreateLiveIndicator();
897
+ const success = data.success;
898
+ const duration = data.duration_seconds ? `${data.duration_seconds.toFixed(1)}s` : '';
899
+
900
+ indicator.classList.remove('active');
901
+ indicator.classList.add(success ? 'completed' : 'failed');
902
+
903
+ if (success) {
904
+ indicator.innerHTML = `
905
+ <span class="live-spawner-icon spawner-${spawnerType} done"></span>
906
+ <span class="live-spawner-text">
907
+ <strong>${spawnerType.toUpperCase()}</strong> completed
908
+ </span>
909
+ <span class="live-spawner-duration">${duration}</span>
910
+ ${data.tokens_used ? `<span class="live-spawner-tokens">${data.tokens_used} tokens</span>` : ''}
911
+ `;
912
+ } else {
913
+ indicator.innerHTML = `
914
+ <span class="live-spawner-icon spawner-${spawnerType} error"></span>
915
+ <span class="live-spawner-text">
916
+ <strong>${spawnerType.toUpperCase()}</strong> failed
917
+ </span>
918
+ <span class="live-spawner-error">${data.error || 'Unknown error'}</span>
919
+ `;
920
+ }
921
+
922
+ // Remove from active spawners
923
+ if (parentEventId) {
924
+ activeSpawners.delete(parentEventId);
925
+ }
926
+
927
+ // Auto-hide after 5 seconds
928
+ setTimeout(() => {
929
+ if (!indicator.classList.contains('active')) {
930
+ indicator.classList.add('fade-out');
931
+ setTimeout(() => {
932
+ indicator.classList.remove('fade-out', 'completed', 'failed');
933
+ indicator.innerHTML = '';
934
+ }, 500);
935
+ }
936
+ }, 5000);
937
+ }
938
+
939
+ /**
940
+ * Show spawner tool use (brief flash)
941
+ */
942
+ function showSpawnerToolUse(spawnerType, parentEventId, data) {
943
+ const indicator = getOrCreateLiveIndicator();
944
+ const toolName = data.tool_name || 'unknown';
945
+
946
+ // Quick update showing tool use
947
+ const currentHtml = indicator.innerHTML;
948
+ indicator.innerHTML = `
949
+ <span class="live-spawner-icon spawner-${spawnerType} tool-use"></span>
950
+ <span class="live-spawner-text">
951
+ <strong>${spawnerType.toUpperCase()}</strong> using ${toolName}
952
+ </span>
953
+ `;
954
+
955
+ // Revert after brief display (if still active)
956
+ setTimeout(() => {
957
+ if (activeSpawners.has(parentEventId)) {
958
+ // Still active, show executing state
959
+ indicator.innerHTML = `
960
+ <span class="live-spawner-icon spawner-${spawnerType} pulsing"></span>
961
+ <span class="live-spawner-text">
962
+ <strong>${spawnerType.toUpperCase()}</strong> executing
963
+ </span>
964
+ `;
965
+ }
966
+ }, 1500);
967
+ }
968
+
969
+ /**
970
+ * Show spawner message (streaming text)
971
+ */
972
+ function showSpawnerMessage(spawnerType, parentEventId, data) {
973
+ // Just update the indicator with message preview
974
+ const indicator = getOrCreateLiveIndicator();
975
+ const preview = (data.message_preview || '').substring(0, 80);
976
+
977
+ indicator.innerHTML = `
978
+ <span class="live-spawner-icon spawner-${spawnerType} streaming"></span>
979
+ <span class="live-spawner-text">
980
+ <strong>${spawnerType.toUpperCase()}</strong> responding
981
+ </span>
982
+ <span class="live-spawner-message">${preview}...</span>
983
+ `;
984
+ }
985
+
986
+ /**
987
+ * Get or create the live activity indicator element
988
+ */
989
+ function getOrCreateLiveIndicator() {
990
+ let indicator = document.getElementById('live-spawner-indicator');
991
+ if (!indicator) {
992
+ indicator = document.createElement('div');
993
+ indicator.id = 'live-spawner-indicator';
994
+ indicator.className = 'live-spawner-indicator';
995
+
996
+ // Insert at top of conversation feed
997
+ const feed = document.querySelector('.conversation-feed');
998
+ if (feed) {
999
+ feed.insertBefore(indicator, feed.firstChild);
1000
+ } else {
1001
+ // Fallback: insert in activity feed view
1002
+ const view = document.querySelector('.activity-feed-view');
1003
+ if (view) {
1004
+ const header = view.querySelector('.view-header');
1005
+ if (header && header.nextSibling) {
1006
+ view.insertBefore(indicator, header.nextSibling);
1007
+ } else {
1008
+ view.appendChild(indicator);
1009
+ }
1010
+ }
1011
+ }
1012
+ }
1013
+ return indicator;
1014
+ }
1015
+
1016
+ // Export for use by main WebSocket handler
1017
+ if (typeof window !== 'undefined') {
1018
+ window.handleSpawnerEvent = handleSpawnerEvent;
1019
+ }
1020
+ </script>