Implement inbox read cursors for unread threads

This commit is contained in:
2026-03-19 03:43:10 +08:00
parent 02d98a78dd
commit 1927930570
19 changed files with 240 additions and 38 deletions
+3 -2
View File
@@ -4,7 +4,6 @@ import (
"fmt"
"time"
"ai-workflow-skill/internal/db"
"ai-workflow-skill/internal/protocol"
"ai-workflow-skill/internal/store"
@@ -28,18 +27,20 @@ func newWaitReplyCmd(root *rootOptions) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
sqlDB, err := db.Open(ctx, root.dbPath)
sqlDB, err := openInboxDB(ctx, root.dbPath)
if err != nil {
return err
}
defer sqlDB.Close()
s := store.NewInboxStore(sqlDB)
agent := root.agent
result, err := s.WaitReply(ctx, store.WaitReplyInput{
ThreadID: opts.threadID,
AfterMessageID: opts.afterMessageID,
AfterEventID: opts.afterEventID,
Kinds: parseCSV(opts.kinds),
Agent: agent,
Timeout: time.Duration(opts.timeoutSeconds) * time.Second,
})
if err != nil {