Files
Davide Silvestri 9e93fb8e36 chore(agent): keep agent tool approvals visible and show failure details to builders (#6883)
* fix: keep agent approval controls visible on every pending call

* fix: show private tool failure details to agent builders

* fix: align approval buttons and wrap them as a group

* fix: highlight failed tool calls and show the reason on demand

* fix: preserve native disclosure buttons in tool history

* fix: label the batch action Always approve all

* fix: simplify approval rows and open tool errors in a context

* fix: give the always approve action more room

* fix: show failed tool calls once in approval cards

* feat: show live tool execution status in agent conversations

* fix: align tool status icons across approval rows

* fix: shorten batch button to Always approve

* fix: explain future tool access in approval tooltips

* fix: right-align tool statuses with trailing icons

* fix: match the tool spinner to the status icons

* fix: give approval buttons equal widths

* fix: explain email failures at the agent boundary

* fix: map known integration failures to safe agent messages

* fix: wrap tool statuses and refresh private diagnostics on demand

* fix: order the agent diagnostics migration and verify finish payloads
2026-11-27 10:20:12 +01:00

169 lines
5.9 KiB
Vue

<template>
<div
class="chat-step-group"
:class="{ 'chat-step-group--running': status === STEP_STATUS.RUNNING }"
:aria-busy="status === STEP_STATUS.RUNNING"
>
<div class="chat-step-group__heading">
<button
v-if="hasDetails"
type="button"
class="chat-step-group__header chat-step-group__header--toggle"
:aria-expanded="expanded"
:aria-controls="detailsId"
@click="expanded = !expanded"
>
<span
v-if="status !== STEP_STATUS.FAILED"
:class="headerIcon"
class="chat-step-group__icon"
aria-hidden="true"
/>
<span class="chat-step-group__title">{{ title }}</span>
<span
v-if="status !== STEP_STATUS.FAILED"
class="chat-step-group__status"
:class="statusClass({ status, changesData })"
>
{{ stepStatusLabel({ status, changesData, partial }, $t) }}
</span>
<i
class="chat-step-group__chevron"
:class="
expanded ? 'iconoir-nav-arrow-down' : 'iconoir-nav-arrow-right'
"
aria-hidden="true"
/>
</button>
<div v-else class="chat-step-group__header">
<span
v-if="status !== STEP_STATUS.FAILED"
:class="headerIcon"
class="chat-step-group__icon"
aria-hidden="true"
/>
<span class="chat-step-group__title">{{ title }}</span>
<span
v-if="status !== STEP_STATUS.FAILED"
class="chat-step-group__status"
:class="statusClass({ status, changesData })"
>
{{ stepStatusLabel({ status, changesData, partial }, $t) }}
</span>
</div>
<ChatToolFailure
v-if="status === STEP_STATUS.FAILED"
:reason="failureHint || $t('toolPresentation.failureFailed')"
/>
</div>
<p v-if="description" class="chat-step-group__description">
{{ description }}
</p>
<div v-if="links.length" class="chat-step-group__links">
<NuxtLink v-for="link in links" :key="link.id" :to="link.to">{{
link.label
}}</NuxtLink>
</div>
<div v-if="hasDetails && expanded" :id="detailsId">
<ul v-if="lines.length" class="chat-step-group__lines">
<li v-for="line in lines" :key="line.id" class="chat-step-group__line">
<span
v-if="line.status !== STEP_STATUS.FAILED"
:class="
line.status === STEP_STATUS.RUNNING
? 'chat-step-group__spinner'
: statusIcons[line.status]
"
class="chat-step-group__icon chat-step-group__line-icon"
aria-hidden="true"
/>
<span class="chat-step-group__line-title">{{ line.title }}</span>
<ChatToolFailure
v-if="line.status === STEP_STATUS.FAILED"
:reason="line.failureHint || $t('toolPresentation.failureFailed')"
/>
<span
v-else
class="chat-step-group__status"
:class="statusClass(line)"
>
{{ stepStatusLabel(line, $t) }}
</span>
</li>
</ul>
<div v-if="itemErrors.length" class="chat-step-group__item-errors">
<div class="chat-step-group__input-label">
{{ $t('toolPresentation.itemErrors') }}
</div>
<ul class="chat-step-group__item-error-list">
<li
v-for="(error, index) in itemErrors"
:key="index"
class="chat-step-group__item-error"
>
<span v-if="error.item" class="chat-step-group__item-error-name">{{
error.item
}}</span>
{{ error.message }}
</li>
</ul>
</div>
<div v-if="input" class="chat-step-group__input">
<div class="chat-step-group__input-label">
{{ $t('toolPresentation.input') }}
</div>
<ChatToolInput :input="input" />
</div>
</div>
</div>
</template>
<script setup>
import { computed, ref, useId } from 'vue'
import { STEP_STATUS } from '@baserow/modules/core/chatRuns/constants'
import { stepStatusLabel } from '@baserow/modules/core/toolPresentationTypes'
import ChatToolFailure from '@baserow/modules/core/components/chat/ChatToolFailure'
import ChatToolInput from '@baserow/modules/core/components/chat/ChatToolInput'
const props = defineProps({
title: { type: String, required: true },
status: { type: String, required: true },
description: { type: String, default: '' },
links: { type: Array, default: () => [] },
changesData: { type: Boolean, default: false },
lines: { type: Array, default: () => [] },
input: { type: Object, default: null },
failureHint: { type: String, default: '' },
itemErrors: { type: Array, default: () => [] },
})
const detailsId = useId()
// Workspace activity starts open; action inputs are available on demand.
const expanded = ref(props.lines.length > 0)
const hasDetails = computed(
() => props.lines.length > 0 || !!props.input || props.itemErrors.length > 0
)
const partial = computed(
() => props.status === STEP_STATUS.DONE && props.itemErrors.length > 0
)
const statusClass = ({ status, changesData }) => ({
'chat-step-group__status--visible':
status === STEP_STATUS.RUNNING ||
status === STEP_STATUS.DONE ||
(status === STEP_STATUS.STOPPED && changesData),
'chat-step-group__status--running': status === STEP_STATUS.RUNNING,
})
const statusIcons = {
[STEP_STATUS.WAITING]: 'iconoir-clock chat-step-group__icon--waiting',
[STEP_STATUS.DONE]: 'iconoir-check-circle chat-step-group__icon--done',
[STEP_STATUS.REJECTED]: 'iconoir-prohibition chat-step-group__icon--rejected',
[STEP_STATUS.STOPPED]: 'iconoir-minus-circle chat-step-group__icon--stopped',
}
const headerIcon = computed(() => {
if (props.status === STEP_STATUS.RUNNING) return 'chat-step-group__spinner'
if (partial.value)
return 'iconoir-warning-circle chat-step-group__icon--partial'
return statusIcons[props.status]
})
</script>