feat: add wait_for_approval tool for agent workflow pausing

Allow agent to pause execution at critical decision points and wait
for user confirmation via comments before continuing.
This commit is contained in:
Fam Zheng
2026-03-07 16:37:17 +00:00
parent 07f1f285b6
commit 3500659e06
4 changed files with 93 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import { ref, nextTick } from 'vue'
const props = defineProps<{
disabled?: boolean
quotes: string[]
waitingApproval?: boolean
}>()
const emit = defineEmits<{
@@ -50,7 +51,10 @@ defineExpose({ focusInput })
</script>
<template>
<div class="comment-section">
<div class="comment-section" :class="{ 'waiting-approval': waitingApproval }">
<div v-if="waitingApproval" class="approval-banner">
Agent 正在等待你的确认请在下方输入反馈后发送
</div>
<div v-if="quotes.length" class="quotes-bar">
<div v-for="(q, i) in quotes" :key="i" class="quote-chip">
<span class="quote-text">{{ q.length > 60 ? q.slice(0, 60) + '...' : q }}</span>
@@ -78,6 +82,20 @@ defineExpose({ focusInput })
overflow: hidden;
}
.comment-section.waiting-approval {
border-color: var(--accent);
box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(79, 195, 247, 0.15);
}
.approval-banner {
padding: 8px 12px;
background: rgba(79, 195, 247, 0.1);
color: var(--accent);
font-size: 13px;
font-weight: 500;
border-bottom: 1px solid rgba(79, 195, 247, 0.2);
}
.quotes-bar {
display: flex;
flex-wrap: wrap;

View File

@@ -198,6 +198,7 @@ async function onSubmitComment(text: string) {
ref="commentRef"
:disabled="!workflow"
:quotes="quotes"
:waitingApproval="workflow?.status === 'waiting_approval'"
@submit="onSubmitComment"
@removeQuote="removeQuote"
/>