This commit is contained in:
Ian Gulliver
2026-10-14 19:50:19 -07:00
parent 1ea055682b
commit a07a697b17
10 changed files with 215 additions and 94 deletions
+31
View File
@@ -190,6 +190,37 @@ func (s *Store) Respond(ctx context.Context, actor string, resolutions []Resolut
})
}
func dismissTaskInbox(ctx context.Context, tx *sql.Tx, emit emitFunc, taskID, actor string) error {
ids := []string{}
rows, err := tx.QueryContext(ctx, `SELECT id FROM inbox_items WHERE task_id = ? AND state = ?`, taskID, string(api.Open))
if err != nil {
return err
}
for rows.Next() {
id := ""
err = rows.Scan(&id)
if err != nil {
rows.Close()
return err
}
ids = append(ids, id)
}
rows.Close()
for _, id := range ids {
_, err = tx.ExecContext(ctx, `UPDATE inbox_items SET state = ?, resolved_by = ?, resolved_at = ?, snoozed_until = NULL WHERE id = ?`,
string(api.Dismissed), actor, now(), id)
if err != nil {
return err
}
err = emitItem(ctx, tx, emit, "inbox.updated", id, actor)
if err != nil {
return err
}
}
return nil
}
func (s *Store) AwaitingHuman(ctx context.Context, sessionID string) (int, error) {
n := 0
err := s.db.QueryRowContext(ctx, `