// kinds holds the kinds that a message can have.
var kinds = map[string]bool{
- "user": true,
- "unii": true,
- "tool": true,
- "echo": true,
- "work": true,
- "note": true,
+ "user": true,
+ "reply": true,
+ "tool": true,
+ "echo": true,
+ "work": true,
+ "note": true,
}
// Message is one entry of the chat log. ID is the permanent position of the
// Log is the append-only message log of one chat. It writes one JSON line for
// each message to main/YYYY-MM-DD.jsonl, named for the local day of the write.
-// It never edits or deletes a line. Each write goes to the file and to the disk
-// before Append returns. An exclusive lock on the lock file makes sure that
-// only one process writes the log. After a failed write, the end of the file is
-// not known, so the log refuses all writes until it is opened again. The caller
-// serializes all calls.
+// It never edits or deletes a line. Each line goes to the operating system
+// before Append returns, so a crash of the process loses no message. An
+// exclusive lock on the lock file makes sure that only one process writes the
+// log. After a failed write, the end of the file is not known, so the log
+// refuses all writes until it is opened again. The caller serializes all calls.
type Log struct {
clock func() time.Time
lock *os.File