]> git.giacomolli.uk - onechat/commitdiff
Name the reply kind for its role
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 14:33:01 +0000 (11:33 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 14:33:01 +0000 (11:33 -0300)
The agent's own replies have the kind reply. Every agent in the tree
uses the same kinds, so a kind cannot carry the name of one agent.

Issue: beb9a70

log.go
log_test.go
tree_test.go

diff --git a/log.go b/log.go
index 22012e28eebd31ca4695b0e714960d7396f5e685..7b8d5126ec2659db6b9598d245a86b1f5acb5b9b 100644 (file)
--- a/log.go
+++ b/log.go
@@ -17,12 +17,12 @@ var errLocked = errors.New("another process owns the chat")
 
 // 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
index 83e2aca3c9a60c943ba05ff1f36b1d6ea1fe4488..f3218a9b399e678c78ba9eb351ee655eb7326910 100644 (file)
@@ -16,7 +16,7 @@ func TestLogReopenLoadsTheSameMessages(t *testing.T) {
        require.NoError(t, err)
 
        var written []Message
-       for _, kind := range []string{"user", "unii", "tool", "echo", "work", "note"} {
+       for _, kind := range []string{"user", "reply", "tool", "echo", "work", "note"} {
                message, err := log.Append(kind, kind+" text ✓")
                require.NoError(t, err)
 
index 3188f10e36da7a5fae8955635c39f35b0a8989cc..2e7ff3a90a91c0c41b77c6ae1f0dcb083a22de8c 100644 (file)
@@ -55,7 +55,7 @@ func TestTreeBuildsEachNodeOnce(t *testing.T) {
        require.ErrorContains(t, tree.Add(testNode(0, 0, "user: b")), "already built")
        require.ErrorContains(t, tree.Add(testNode(1, 0, "a b")), "child that is not built")
 
-       require.NoError(t, tree.Add(testNode(0, 1, "unii: b")))
+       require.NoError(t, tree.Add(testNode(0, 1, "reply: b")))
        require.NoError(t, tree.Add(testNode(1, 0, "a b")))
 
        node, built := tree.Node(0, 0)
@@ -70,9 +70,9 @@ func TestTreeReopenLoadsTheSameNodes(t *testing.T) {
        require.NoError(t, err)
 
        nodes := []Node{
-               testNode(0, 1, "unii: b"),
+               testNode(0, 1, "reply: b"),
                testNode(0, 0, "user: a"),
-               testNode(1, 0, "user: a\nunii: b"),
+               testNode(1, 0, "user: a\nreply: b"),
        }
        for _, node := range nodes {
                require.NoError(t, tree.Add(node))
@@ -82,7 +82,7 @@ func TestTreeReopenLoadsTheSameNodes(t *testing.T) {
 
        data, err := os.ReadFile(filepath.Join(root, "tree", "2026-01-01.jsonl"))
        require.NoError(t, err)
-       require.Equal(t, `{"l":0,"i":1,"text":"unii: b","size":7}`+"\n", strings.SplitAfter(string(data), "\n")[0])
+       require.Equal(t, `{"l":0,"i":1,"text":"reply: b","size":8}`+"\n", strings.SplitAfter(string(data), "\n")[0])
 
        tree, err = openTree(t.Context(), root, 2, clock.Now)
        require.NoError(t, err)