Let task agents suggest discarding their task, with reasoning
This commit is contained in:
@@ -761,6 +761,14 @@ func (s *Store) SetReadyPromptN(ctx context.Context, id string, snapshotN int) e
|
||||
}
|
||||
|
||||
func (s *Store) MarkReady(ctx context.Context, id, overview, actor string) error {
|
||||
return s.emitActive(ctx, id, actor, "task.ready", map[string]any{"id": id, "overview": overview})
|
||||
}
|
||||
|
||||
func (s *Store) SuggestDiscard(ctx context.Context, id, reason, actor string) error {
|
||||
return s.emitActive(ctx, id, actor, "task.discard_suggested", map[string]any{"id": id, "reason": reason})
|
||||
}
|
||||
|
||||
func (s *Store) emitActive(ctx context.Context, id, actor, kind string, payload map[string]any) error {
|
||||
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
|
||||
projectID := ""
|
||||
err := tx.QueryRowContext(ctx, `SELECT project_id FROM tasks WHERE id = ? AND status = ?`, id, string(api.TaskStatusActive)).Scan(&projectID)
|
||||
@@ -770,7 +778,7 @@ func (s *Store) MarkReady(ctx context.Context, id, overview, actor string) error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return emit(api.Event{Kind: "task.ready", ProjectId: &projectID, TaskId: &id, Actor: actor, Payload: map[string]any{"id": id, "overview": overview}})
|
||||
return emit(api.Event{Kind: kind, ProjectId: &projectID, TaskId: &id, Actor: actor, Payload: payload})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user