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
//! # Tape Types
//!
//! Append-only conversation recording types for the Bob Agent Framework.
//!
//! The tape system provides a persistent, searchable log of all interactions:
//!
//! - **Messages**: User and assistant conversation entries
//! - **Events**: Tool calls, LLM calls, and other runtime events
//! - **Anchors**: Semantic markers for task phases and milestones
//! - **Handoffs**: Context window reset points for topic switching
//!
//! ## Design
//!
//! The tape is **append-only** — entries are never modified or deleted.
//! This ensures auditability and allows reliable replay and search.
//!
//! ```text
//! ┌────────┐ ┌────────┐ ┌────────┐ ┌─────────┐ ┌────────┐
//! │ msg:U │→ │ msg:A │→ │ event │→ │ anchor │→ │handoff │→ ...
//! └────────┘ └────────┘ └────────┘ └─────────┘ └────────┘
//! ```
//!
//! ## Handoff
//!
//! When a conversation grows long or the user switches tasks, a **handoff**
//! entry resets the context window. The LLM only sees entries **after** the
//! most recent handoff, while the full history remains in the tape for search.
use ;
use crateRole;
/// Unique identifier for a tape entry.
pub type TapeEntryId = u64;
/// A single record in the append-only tape.
/// Discriminated union of tape entry types.
/// A search hit within the tape.
/// Returns the current time as Unix epoch milliseconds.
///
/// Falls back to `0` if the system clock is before the Unix epoch.