Inline question choices, compact one-click inbox cards, drop snooze
This commit is contained in:
@@ -417,7 +417,7 @@ func (e *env) respond(m *agents.Manager, item api.InboxItem, typ api.InboxRespon
|
||||
CreatedAt: time.Now().UTC(),
|
||||
}
|
||||
if option != "" {
|
||||
resp.Option = &option
|
||||
resp.Options = &[]string{option}
|
||||
}
|
||||
if text != "" {
|
||||
resp.Text = &text
|
||||
@@ -449,9 +449,17 @@ func TestAskHumanRoundTrip(t *testing.T) {
|
||||
t.Fatalf("want one open question, got %+v", questions)
|
||||
}
|
||||
q := questions[0]
|
||||
if !q.Blocking || q.Priority != api.Blocked || q.Payload["recommended_option"] != "red" {
|
||||
options, _ := q.Payload["options"].([]any)
|
||||
recommended, _ := q.Payload["recommended"].([]any)
|
||||
if !q.Blocking || q.Priority != api.Blocked || len(options) != 2 || len(recommended) != 1 || !strings.Contains(fmt.Sprint(recommended[0]), "red") {
|
||||
t.Fatalf("unexpected question %+v", q)
|
||||
}
|
||||
blue := ""
|
||||
for _, o := range options {
|
||||
if strings.Contains(fmt.Sprint(o), "blue") {
|
||||
blue = fmt.Sprint(o)
|
||||
}
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(e.task.WorktreePath, "color.txt")); err == nil {
|
||||
t.Fatalf("agent wrote color.txt before getting an answer")
|
||||
}
|
||||
@@ -461,12 +469,12 @@ func TestAskHumanRoundTrip(t *testing.T) {
|
||||
t.Fatalf("awaiting human: %d %v", waiting, err)
|
||||
}
|
||||
|
||||
e.respond(m, q, api.Option, "blue", "", api.Answered)
|
||||
e.respond(m, q, api.Option, blue, "", api.Answered)
|
||||
events := e.waitIdle()
|
||||
|
||||
delivered := false
|
||||
for _, ev := range events {
|
||||
if ev.Kind == "user.message" && strings.Contains(ev.Payload["text"].(string), "chose: blue") {
|
||||
if ev.Kind == "user.message" && strings.Contains(ev.Payload["text"].(string), "chose: "+blue) {
|
||||
delivered = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user