agent-office 0.1.7

A Rust-based multi-agent system with graph-structured data storage, mail system, and Zettelkasten-style knowledge base
Documentation
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
use axum::{
    extract::Path,
    response::Html,
    routing::{get, post},
    Router,
};
use std::net::SocketAddr;

pub mod templates;

use crate::services::mail::{MailService, MailServiceImpl};
use crate::services::kb::{KnowledgeBaseService, KnowledgeBaseServiceImpl};
use crate::services::kb::domain::LuhmannId;
use crate::storage::{memory::InMemoryStorage, postgres::PostgresStorage};

pub async fn run_web_server(
    database_url: Option<String>,
    host: String,
    port: u16,
) -> anyhow::Result<()> {
    let app = create_router(database_url);
    
    let addr: SocketAddr = format!("{}:{}", host, port).parse()?;
    println!("🌐 Starting web server on http://{}", addr);
    println!("📱 Open your browser and navigate to http://{}", addr);
    println!("Press Ctrl+C to stop");
    
    let listener = tokio::net::TcpListener::bind(addr).await?;
    axum::serve(listener, app).await?;
    
    Ok(())
}

fn create_router(database_url: Option<String>) -> Router {
    use std::sync::Arc;
    let db_url = Arc::new(database_url.clone());
    let db_url2 = Arc::new(database_url.clone());
    let db_url3 = Arc::new(database_url.clone());
    let db_url4 = Arc::new(database_url.clone());
    let db_url5 = Arc::new(database_url.clone());
    let db_url6 = Arc::new(database_url.clone());
    
    Router::new()
        // Dashboard / Home
        .route("/", get({
            let db = db_url.clone();
            move || dashboard((*db).clone())
        }))
        
        // Agents
        .route("/agents", get({
            let db = db_url.clone();
            move || list_agents((*db).clone())
        }))
        
        // Inbox view
        .route("/mail/inbox/{agent_id}", get({
            let db = db_url2.clone();
            move |Path(agent_id): Path<String>| inbox_view((*db).clone(), agent_id)
        }))
        
        // Update agent status
        .route("/agents/{agent_id}/status", post({
            let db = db_url3.clone();
            move |Path(agent_id): Path<String>| set_agent_status((*db).clone(), agent_id)
        }))
        
        // KB - Knowledge Base
        .route("/kb", get({
            let db = db_url4.clone();
            move || kb_list_notes((*db).clone())
        }))
        
        // KB - View specific note
        .route("/kb/note/{note_id}", get({
            let db = db_url5.clone();
            move |Path(note_id): Path<String>| kb_view_note((*db).clone(), note_id)
        }))
        
        // KB - Tree view by prefix
        .route("/kb/tree/{prefix}", get({
            let db = db_url6.clone();
            move |Path(prefix): Path<String>| kb_tree_view((*db).clone(), prefix)
        }))
        
        // Static assets
        .route("/static/style.css", get(|| async {
            ([("content-type", "text/css")], templates::CSS)
        }))
}

// Dashboard / Home - Show agents with their mailboxes
async fn dashboard(database_url: Option<String>) -> Html<String> {
    let agents = if let Some(url) = database_url {
        let pool = match sqlx::postgres::PgPool::connect(&url).await {
            Ok(p) => p,
            Err(_) => return Html(templates::error_page("Failed to connect to database")),
        };
        let storage = PostgresStorage::new(pool);
        let service = MailServiceImpl::new(storage);
        
        match service.list_agents().await {
            Ok(agents) => agents,
            Err(_) => return Html(templates::error_page("Failed to load agents")),
        }
    } else {
        let storage = InMemoryStorage::new();
        let service = MailServiceImpl::new(storage);
        
        match service.list_agents().await {
            Ok(agents) => agents,
            Err(_) => return Html(templates::error_page("Failed to load agents")),
        }
    };
    
    let mut agent_cards = String::new();
    for agent in &agents {
        let status_class = match agent.status.as_str() {
            "online" => "online",
            "busy" => "busy",
            _ => "offline",
        };
        
        // For now, just show inbox link (agents auto-create inbox)
        let mailbox_list = format!(
            r#"<div class="mailbox-item">
                <a href="/mail/inbox/{}" class="btn btn-sm">📧 Inbox</a>
            </div>"#,
            agent.id
        );
        
        // Quick status toggle button (only show if not already offline)
        let status_button = if agent.status != "offline" {
            format!(
                "<button class=\"btn btn-sm btn-offline\" \
                    hx-post=\"/agents/{}/status\" \
                    hx-target=\"#agent-status-{}\" \
                    hx-swap=\"outerHTML\"> \
                    Set Offline \
                </button>",
                agent.id, agent.id
            )
        } else {
            String::new()
        };
        
        agent_cards.push_str(&format!(
            r#"<div class="agent-card">
                <div class="agent-info">
                    <h3>{}</h3>
                    <span class="status {}" id="agent-status-{}">{}</span>
                    {}
                </div>
                <div class="agent-mailboxes">
                    <h4>Mailboxes</h4>
                    {}
                </div>
            </div>"#,
            agent.name, status_class, agent.id, agent.status, status_button, mailbox_list
        ));
    }
    
    let content = format!(
        r#"
        <h2>Dashboard <span class="section-count">{} agents</span></h2>
        <div class="agent-list">
            {}
        </div>
        "#,
        agents.len(),
        if agent_cards.is_empty() {
            "<p class='empty-state'>No agents registered yet</p>".to_string()
        } else {
            agent_cards
        }
    );
    
    Html(templates::wrap_content(content))
}

// List all agents
async fn list_agents(database_url: Option<String>) -> Html<String> {
    let agents = if let Some(url) = database_url {
        let pool = match sqlx::postgres::PgPool::connect(&url).await {
            Ok(p) => p,
            Err(_) => return Html(templates::error_page("Failed to connect to database")),
        };
        let storage = PostgresStorage::new(pool);
        let service = MailServiceImpl::new(storage);
        
        match service.list_agents().await {
            Ok(agents) => agents,
            Err(_) => return Html(templates::error_page("Failed to load agents")),
        }
    } else {
        let storage = InMemoryStorage::new();
        let service = MailServiceImpl::new(storage);
        
        match service.list_agents().await {
            Ok(agents) => agents,
            Err(_) => return Html(templates::error_page("Failed to load agents")),
        }
    };
    
    let mut agent_rows = String::new();
    for agent in &agents {
        let status_class = match agent.status.as_str() {
            "online" => "online",
            "busy" => "busy",
            _ => "offline",
        };
        
        agent_rows.push_str(&format!(
            r#"<tr>
                <td><strong>{}</strong></td>
                <td><span class="status {}">{}</span></td>
            </tr>"#,
            agent.name, status_class, agent.status
        ));
    }
    
    let content = format!(
        r#"
        <h2>Agents <span class="section-count">{} total</span></h2>
        <table class="data-table">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Status</th>
                </tr>
            </thead>
            <tbody>
                {}
            </tbody>
        </table>
        "#,
        agents.len(),
        if agent_rows.is_empty() {
            "<tr><td colspan=\"2\" class=\"empty-state\">No agents registered</td></tr>".to_string()
        } else {
            agent_rows
        }
    );
    
    Html(templates::wrap_content(content))
}

// KB - List all notes
async fn kb_list_notes(database_url: Option<String>) -> Html<String> {
    let notes = if let Some(url) = database_url {
        let pool = match sqlx::postgres::PgPool::connect(&url).await {
            Ok(p) => p,
            Err(_) => return Html(templates::error_page("Failed to connect to database")),
        };
        let storage = PostgresStorage::new(pool);
        let service = KnowledgeBaseServiceImpl::new(storage);
        
        match service.list_notes().await {
            Ok(notes) => notes,
            Err(_) => return Html(templates::error_page("Failed to load notes")),
        }
    } else {
        let storage = InMemoryStorage::new();
        let service = KnowledgeBaseServiceImpl::new(storage);
        
        match service.list_notes().await {
            Ok(notes) => notes,
            Err(_) => return Html(templates::error_page("Failed to load notes")),
        }
    };
    
    let mut notes_html = String::new();
    for note in &notes {
        notes_html.push_str(&format!(
            r#"<div class="note-card">
                <div class="note-header">
                    <span class="note-id"><a href="/kb/note/{}">[{}]</a></span>
                    <span class="note-title">{}</span>
                </div>
                <div class="note-preview">{}</div>
                <div class="note-meta">
                    <a href="/kb/tree/{}" class="btn btn-sm">🌳 Tree</a>
                </div>
            </div>"#,
            note.id,
            note.id,
            note.title,
            &note.content.chars().take(100).collect::<String>(),
            note.id
        ));
    }
    
    let content = format!(
        r#"
        <div class="page-header">
            <h2>📚 Knowledge Base</h2>
            <div class="header-actions">
                <span class="note-count">{} notes</span>
            </div>
        </div>
        <div class="notes-list">
            {}
        </div>
        "#,
        notes.len(),
        if notes_html.is_empty() {
            "<p class='empty-state'>No notes yet. Use 'kb create' to add notes.</p>".to_string()
        } else {
            notes_html
        }
    );
    
    Html(templates::wrap_content(content))
}

// KB - View specific note with full context
async fn kb_view_note(database_url: Option<String>, note_id: String) -> Html<String> {
    let id = match LuhmannId::parse(&note_id) {
        Some(id) => id,
        None => return Html(templates::error_page(&format!("Invalid Luhmann ID: {}", note_id))),
    };
    
    let (note, children, parent, links, backlinks) = if let Some(url) = database_url {
        let pool = match sqlx::postgres::PgPool::connect(&url).await {
            Ok(p) => p,
            Err(_) => return Html(templates::error_page("Failed to connect to database")),
        };
        let storage = PostgresStorage::new(pool);
        let service = KnowledgeBaseServiceImpl::new(storage);
        
        let note = match service.get_note(&id).await {
            Ok(n) => n,
            Err(_) => return Html(templates::error_page(&format!("Note '{}' not found", note_id))),
        };
        
        // Get children
        let all_notes = match service.list_notes().await {
            Ok(n) => n,
            Err(_) => vec![],
        };
        let children: Vec<_> = all_notes.iter()
            .filter(|n| n.id.parent().as_ref() == Some(&id))
            .cloned()
            .collect();
        
        // Get parent
        let parent = if let Some(parent_id) = id.parent() {
            service.get_note(&parent_id).await.ok()
        } else {
            None
        };
        
        // Get links
        let links = match service.get_links(&id).await {
            Ok(l) => {
                let mut linked_notes = vec![];
                for link in l {
                    if let Ok(target) = service.get_note(&link.to_note_id).await {
                        linked_notes.push(target);
                    }
                }
                linked_notes
            },
            Err(_) => vec![],
        };
        
        // Get backlinks via context
        let ctx = match service.get_context(&id).await {
            Ok(c) => c.backlinks,
            Err(_) => vec![],
        };
        
        (note, children, parent, links, ctx)
    } else {
        let storage = InMemoryStorage::new();
        let service = KnowledgeBaseServiceImpl::new(storage);
        
        let note = match service.get_note(&id).await {
            Ok(n) => n,
            Err(_) => return Html(templates::error_page(&format!("Note '{}' not found", note_id))),
        };
        
        // Get children
        let all_notes = match service.list_notes().await {
            Ok(n) => n,
            Err(_) => vec![],
        };
        let children: Vec<_> = all_notes.iter()
            .filter(|n| n.id.parent().as_ref() == Some(&id))
            .cloned()
            .collect();
        
        // Get parent
        let parent = if let Some(parent_id) = id.parent() {
            service.get_note(&parent_id).await.ok()
        } else {
            None
        };
        
        // Get links
        let links = match service.get_links(&id).await {
            Ok(l) => {
                let mut linked_notes = vec![];
                for link in l {
                    if let Ok(target) = service.get_note(&link.to_note_id).await {
                        linked_notes.push(target);
                    }
                }
                linked_notes
            },
            Err(_) => vec![],
        };
        
        // Get backlinks via context
        let ctx = match service.get_context(&id).await {
            Ok(c) => c.backlinks,
            Err(_) => vec![],
        };
        
        (note, children, parent, links, ctx)
    };
    
    // Build relationships HTML
    let mut relations_html = String::new();
    
    if let Some(p) = parent {
        relations_html.push_str(&format!(
            r#"<div class="relation-section">
                <h4>📁 Parent</h4>
                <a href="/kb/note/{}" class="relation-link">[{}] {}</a>
            </div>"#,
            p.id, p.id, p.title
        ));
    }
    
    if !children.is_empty() {
        relations_html.push_str(r#"<div class="relation-section"><h4>📂 Children</h4>"#);
        for child in &children {
            relations_html.push_str(&format!(
                r#"<a href="/kb/note/{}" class="relation-link">└─ [{}] {}</a>"#,
                child.id, child.id, child.title
            ));
        }
        relations_html.push_str("</div>");
    }
    
    if !links.is_empty() {
        relations_html.push_str(r#"<div class="relation-section"><h4>🔗 Links To</h4>"#);
        for link in &links {
            relations_html.push_str(&format!(
                r#"<a href="/kb/note/{}" class="relation-link">→ [{}] {}</a>"#,
                link.id, link.id, link.title
            ));
        }
        relations_html.push_str("</div>");
    }
    
    if !backlinks.is_empty() {
        relations_html.push_str(r#"<div class="relation-section"><h4>🔗 Backlinks</h4>"#);
        for backlink in &backlinks {
            relations_html.push_str(&format!(
                r#"<a href="/kb/note/{}" class="relation-link">← [{}] {}</a>"#,
                backlink.id, backlink.id, backlink.title
            ));
        }
        relations_html.push_str("</div>");
    }
    
    let content = format!(
        r#"
        <div class="note-detail">
            <div class="note-breadcrumb">
                <a href="/kb">📚 KB</a> / <span>[{}]</span>
            </div>
            <h2 class="note-title-large">[{}] {}</h2>
            <div class="note-content-full">
                {}
            </div>
            <div class="note-meta-bar">
                <span>Created: {}</span>
                <a href="/kb/tree/{}" class="btn btn-sm">🌳 View in Tree</a>
            </div>
        </div>
        <div class="note-relationships">
            {}
        </div>
        "#,
        note_id,
        note_id,
        note.title,
        note.content.replace("\n", "<br>"),
        note.created_at.format("%Y-%m-%d %H:%M"),
        note_id,
        if relations_html.is_empty() {
            "<p class='empty-state'>No relationships yet</p>".to_string()
        } else {
            relations_html
        }
    );
    
    Html(templates::wrap_content(content))
}

// KB - Tree view by prefix
async fn kb_tree_view(database_url: Option<String>, prefix: String) -> Html<String> {
    let prefix_id = match LuhmannId::parse(&prefix) {
        Some(id) => id,
        None => return Html(templates::error_page(&format!("Invalid prefix: {}", prefix))),
    };
    
    let (notes_in_tree, parent_note) = if let Some(url) = database_url {
        let pool = match sqlx::postgres::PgPool::connect(&url).await {
            Ok(p) => p,
            Err(_) => return Html(templates::error_page("Failed to connect to database")),
        };
        let storage = PostgresStorage::new(pool);
        let service = KnowledgeBaseServiceImpl::new(storage);
        
        let all_notes = match service.list_notes().await {
            Ok(n) => n,
            Err(_) => return Html(templates::error_page("Failed to load notes")),
        };
        
        // Filter notes that are in this tree
        let notes_in_tree: Vec<_> = all_notes.iter()
            .filter(|n| n.id.to_string().starts_with(&prefix))
            .cloned()
            .collect();
        
        // Get parent note if exists
        let parent = if let Some(parent_id) = prefix_id.parent() {
            service.get_note(&parent_id).await.ok()
        } else {
            None
        };
        
        (notes_in_tree, parent)
    } else {
        let storage = InMemoryStorage::new();
        let service = KnowledgeBaseServiceImpl::new(storage);
        
        let all_notes = match service.list_notes().await {
            Ok(n) => n,
            Err(_) => return Html(templates::error_page("Failed to load notes")),
        };
        
        let notes_in_tree: Vec<_> = all_notes.iter()
            .filter(|n| n.id.to_string().starts_with(&prefix))
            .cloned()
            .collect();
        
        let parent = if let Some(parent_id) = prefix_id.parent() {
            service.get_note(&parent_id).await.ok()
        } else {
            None
        };
        
        (notes_in_tree, parent)
    };
    
    // Build tree visualization
    let mut tree_html = String::new();
    
    if let Some(parent) = parent_note {
        tree_html.push_str(&format!(
            r#"<div class="tree-level parent-level">
                <a href="/kb/note/{}" class="tree-node parent-node">📁 [{}] {}</a>
            </div>"#,
            parent.id, parent.id, parent.title
        ));
    }
    
    tree_html.push_str(r#"<div class="tree-level current-level">"#);
    for note in &notes_in_tree {
        let is_current = note.id.to_string() == prefix;
        let node_class = if is_current { "tree-node current-node" } else { "tree-node" };
        let icon = if note.id.to_string().len() > prefix.len() { "📄" } else { "📂" };
        tree_html.push_str(&format!(
            r#"<a href="/kb/note/{}" class="{}">{} [{}] {}</a>"#,
            note.id, node_class, icon, note.id, note.title
        ));
    }
    tree_html.push_str("</div>");
    
    let content = format!(
        r#"
        <div class="tree-view">
            <div class="tree-header">
                <h2>🌳 Tree View: {}</h2>
                <a href="/kb" class="btn btn-sm">← Back to All Notes</a>
            </div>
            <div class="tree-structure">
                {}
            </div>
            <div class="tree-stats">
                <span>{} notes in this branch</span>
            </div>
        </div>
        "#,
        prefix,
        tree_html,
        notes_in_tree.len()
    );
    
    Html(templates::wrap_content(content))
}

// Set agent status to offline
async fn set_agent_status(database_url: Option<String>, agent_id: String) -> Html<String> {
    let result = if let Some(url) = database_url {
        let pool = match sqlx::postgres::PgPool::connect(&url).await {
            Ok(p) => p,
            Err(_) => return Html(templates::error_page("Failed to connect to database")),
        };
        let storage = PostgresStorage::new(pool);
        let service = MailServiceImpl::new(storage);
        
        service.set_agent_status(agent_id, "offline").await
    } else {
        let storage = InMemoryStorage::new();
        let service = MailServiceImpl::new(storage);
        
        service.set_agent_status(agent_id, "offline").await
    };
    
    match result {
        Ok(agent) => {
            // Return a small HTML fragment for HTMX to swap
            let status_class = "offline";
            Html(format!(
                r#"<span class="status {}" id="agent-status-{}">{}</span>"#,
                status_class, agent.id, agent.status
            ))
        }
        Err(_) => Html(templates::error_page("Failed to update agent status")),
    }
}

// Inbox view - Show mail for an agent
async fn inbox_view(database_url: Option<String>, agent_id: String) -> Html<String> {
    let (inbox_mail, agent_name) = if let Some(url) = database_url {
        let pool = match sqlx::postgres::PgPool::connect(&url).await {
            Ok(p) => p,
            Err(_) => return Html(templates::error_page("Failed to connect to database")),
        };
        let storage = PostgresStorage::new(pool);
        let service = MailServiceImpl::new(storage);
        
        let agent = match service.get_agent(agent_id.clone()).await {
            Ok(a) => a,
            Err(_) => return Html(templates::error_page(&format!("Agent '{}' not found", agent_id))),
        };
        
        let mailbox = match service.get_agent_mailbox(agent_id.clone()).await {
            Ok(m) => m,
            Err(_) => return Html(templates::error_page("Failed to get mailbox")),
        };
        
        let mail = match service.get_mailbox_inbox(mailbox.id).await {
            Ok(m) => m,
            Err(_) => vec![],
        };
        
        (mail, agent.name)
    } else {
        let storage = InMemoryStorage::new();
        let service = MailServiceImpl::new(storage);
        
        let agent = match service.get_agent(agent_id.clone()).await {
            Ok(a) => a,
            Err(_) => return Html(templates::error_page(&format!("Agent '{}' not found", agent_id))),
        };
        
        let mailbox = match service.get_agent_mailbox(agent_id.clone()).await {
            Ok(m) => m,
            Err(_) => return Html(templates::error_page("Failed to get mailbox")),
        };
        
        let mail = match service.get_mailbox_inbox(mailbox.id).await {
            Ok(m) => m,
            Err(_) => vec![],
        };
        
        (mail, agent.name)
    };
    
    let mail_html = inbox_mail.iter()
        .map(|m| {
            let status_class = if m.read { "read" } else { "unread" };
            format!(
                r#"<div class="mail-card {}">
                    <div class="mail-header">
                        <span class="mail-subject">{}</span>
                        <span class="mail-meta">{}</span>
                    </div>
                    <div class="mail-body">{}</div>
                </div>"#,
                status_class, m.subject, m.created_at.format("%Y-%m-%d %H:%M"), m.body
            )
        })
        .collect::<String>();
    
    let content = format!(
        r#"
        <div class="back-link">
            <a href="/" class="btn btn-secondary btn-sm">&larr; Back to Dashboard</a>
        </div>
        <h2>Inbox: {} <span class="section-count">{} messages</span></h2>
        <div class="mail-list">
            {}
        </div>
        "#,
        agent_name,
        inbox_mail.len(),
        if mail_html.is_empty() {
            "<p class='empty-state'>No mail in inbox</p>".to_string()
        } else {
            mail_html
        }
    );
    
    Html(templates::wrap_content(content))
}