refactor: rename wait_for_approval to ask_user

More general-purpose user intervention tool — not just approve/reject,
but any question or input request. Renames across Rust backend, Vue
frontend, prompts, and status strings.

Tool: wait_for_approval → ask_user (param: reason → question)
Status: WaitingApproval → WaitingUser, waiting_approval → waiting_user
Enum: NeedsApproval → NeedsInput
This commit is contained in:
Fam Zheng
2026-03-16 08:50:24 +00:00
parent dae99d307a
commit f2fa721ef0
10 changed files with 194 additions and 47 deletions

View File

@@ -4,7 +4,7 @@ import { ref, nextTick } from 'vue'
const props = defineProps<{
disabled?: boolean
quotes: string[]
waitingApproval?: boolean
waitingUser?: boolean
}>()
const emit = defineEmits<{
@@ -66,9 +66,9 @@ defineExpose({ focusInput })
</script>
<template>
<div class="comment-section" :class="{ 'waiting-approval': waitingApproval }">
<div v-if="waitingApproval" class="approval-banner">
Agent 正在等待你的确认
<div class="comment-section" :class="{ 'waiting-user': waitingUser }">
<div v-if="waitingUser" 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">
@@ -80,11 +80,11 @@ defineExpose({ focusInput })
<textarea
ref="textareaRef"
v-model="input"
:placeholder="waitingApproval ? '可选:附加反馈或修改意见...' : (quotes.length ? '添加你的评论...' : '输入反馈或调整指令... (Ctrl+Enter 发送)')"
:placeholder="waitingUser ? '输入回复或反馈...' : (quotes.length ? '添加你的评论...' : '输入反馈或调整指令... (Ctrl+Enter 发送)')"
rows="3"
@keydown="onKeydown"
/>
<div v-if="waitingApproval" class="approval-buttons">
<div v-if="waitingUser" class="approval-buttons">
<button class="btn-approve" @click="approve">继续执行</button>
<button class="btn-reject" @click="reject">终止</button>
</div>
@@ -101,7 +101,7 @@ defineExpose({ focusInput })
overflow: hidden;
}
.comment-section.waiting-approval {
.comment-section.waiting-user {
border-color: var(--accent);
box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(79, 195, 247, 0.15);
}

View File

@@ -65,7 +65,7 @@ const workflowStatusLabel = computed(() => {
case 'executing': return '执行中'
case 'done': return '已完成'
case 'failed': return '失败'
case 'waiting_approval': return '等待确认'
case 'waiting_user': return '等待用户'
default: return props.workflowStatus
}
})
@@ -364,7 +364,7 @@ watch(logItems, () => {
color: #fff;
}
.workflow-badge.waiting_approval {
.workflow-badge.waiting_user {
background: #ff9800;
color: #fff;
}

View File

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

View File

@@ -10,7 +10,7 @@ export interface Workflow {
id: string
project_id: string
requirement: string
status: 'pending' | 'planning' | 'executing' | 'waiting_approval' | 'done' | 'failed'
status: 'pending' | 'planning' | 'executing' | 'waiting_user' | 'done' | 'failed'
created_at: string
report: string
}