{{define "region:chat-composer"}}
{{end}} {{define "region:conversation-feed"}}
{{if .Conversation.NextURL}}{{copy "conversation.more"}}{{end}}
    {{$day := ""}}{{range .Conversation.Feed}} {{if or (not .Message) (ne .Message.AuthorKind "system") (ne .Message.Body (copy "isolation.owner_mode"))}} {{if .Message}}{{$date := .Message.CreatedAt.Format "2006-01-02"}}{{if ne $date $day}}
  1. {{$day = $date}}{{end}}{{end}} {{if .Message}}{{with .Message}}
  2. {{icon .AuthorIcon}}{{.AuthorName}}
    {{if or (eq .AuthorKind "coordinator") (eq .AuthorKind "specialist")}}
    {{chatMarkdown .Body}}
    {{else}}

    {{.Body}}

    {{end}} {{if .ThreadURL}}{{copy "conversation.thread_link"}}{{end}} {{if and (not $.Conversation.ThreadID) (eq .AuthorKind "person")}} {{if $.Conversation.HasTaskCards}}
    {{icon "kebab"}}
    {{end}} {{end}}
  3. {{end}}{{else}}{{with .Card}}
  4. {{template "conversation-card" .}}
  5. {{end}}{{end}} {{end}} {{else}}
  6. {{copy "conversation.empty"}}
  7. {{end}}
{{end}} {{define "conversation-card"}} {{if .Thinking}}
{{icon "message-circle"}}{{copy "conversation.coordinator"}}
{{if .ConnectionLabel}}{{printf (copy "coordinator.waiting_connection_label") .ConnectionLabel}}{{else if .PartialText}}
{{chatDraft .PartialText}}
{{else}}{{copy "conversation.thinking"}}{{end}}
{{else}}
{{with .ProjectProposal}}

{{printf (copy "project_setup.heading") .Name .Repository}}

{{.Why}}

{{if $.CanAnswer}}
{{else}}

{{copy (printf "project_setup.%s" .State)}}

{{if .ProjectID}}{{.Name}}{{end}}{{end}} {{end}} {{if eq .Kind "task"}}{{with .Work}}{{template "chat-task" .}}{{end}} {{with .Plan}}{{if and .CanEdit (ne .Task.ApprovalRevision .Plan.Revision)}}
{{end}}{{end}}{{end}} {{with .NativeQuestion}} {{if not .Fields}}
{{.Text}}
{{else if eq (len .Fields) 1}}

{{(index .Fields 0).Prompt}}

{{end}} {{if ne .State "pending"}}{{copy (printf "question.%s" .State)}}{{end}} {{if and .CanAnswer (eq (len .Fields) 1)}}{{$q := .}}{{range (index .Fields 0).Options}}
{{end}}{{end}} {{if .CanAnswer}}
{{range $i,$field:=.Fields}}{{end}}
{{if .Fields}}{{else if .CanAllow}}{{end}}
{{end}} {{end}} {{with .Question}}

{{.Prompt}}

{{if ne .State "pending"}}{{copy (printf "question.%s" .State)}}{{end}} {{if $.CanAnswer}}
{{range .Options}}{{end}}
{{end}} {{end}} {{if eq .Kind "coordinator"}} {{if .WaitingTaskURL}}

{{copy "coordinator.waiting_label"}} {{.WaitingLabel}}

{{else}}

{{copy .CopyKey}}

{{end}} {{if or (eq .CopyKey "coordinator.budget_needed") (eq .CopyKey "coordinator.waiting_connection")}}{{copy "coordinator.settings"}}{{end}} {{if .ActionKeys}}
{{end}} {{end}} {{if eq .Kind "suggest_playbook"}}{{copy "playbooks.save_suggestion"}}{{end}} {{if eq .Kind "suggest_preference"}}{{copy "preferences.title"}}{{end}}
{{end}} {{end}} {{define "chat-task"}}

{{.Task.Description}}

{{.Project.Name}} · {{copy (printf "task.kind.%s" .Task.Kind)}} {{if .ChatAge}}· {{end}}{{copy .StateKey}}

    {{range .Steps}}
  1. {{icon .CategoryIcon}}{{if .CategoryName}}{{.CategoryName}}{{else}}{{copy (printf "nav.%s" .Category)}}{{end}}{{copy (printf "plan.action.%s" .Action)}}{{copy (printf "step.%s" .State)}}{{.Model}}{{if and .Model .Account}} · {{end}}{{.Account}}{{.Person}}{{template "trial-label" .Isolation}}
  2. {{end}}
{{copy "plan.edit"}}
{{copy "conversation.why_models"}}
    {{range .Steps}}{{if .Reason}}
  • {{copy (printf "plan.action.%s" .Action)}}: {{.Reason}}
  • {{end}}{{end}}
{{copy "plan.edit"}} {{copy "plan.correct_project"}}
{{range .Evidence}}{{if eq .Role "candidate"}}

{{copy "task.evidence"}}: {{.Hash}}

{{end}}{{end}} {{if .Evidence}}
{{copy "task.evidence"}}{{copy "task.evidence"}}{{copy "plan.correct_project"}}
{{end}} {{if .CanMerge}}{{copy "task.merge"}}{{end}} {{if eq .Task.Kind "rendered_change"}}{{copy "evidence.render_approval"}}{{end}} {{template "trial-label" .Isolation}}
{{end}}