feat: 完善 Agent 标准交互与安全运行时

- 接入 AG-UI 运行投影、Turn 时间线和审批隔离

- 增加 Agent Skill 冻结绑定与运行时消费闭环

- 增加受控工作区、内置工具和私有 Artifact 生命周期
This commit is contained in:
2026-08-19 22:13:41 +08:00
parent 91d66e636d
commit 4e8640dcaf
241 changed files with 24382 additions and 2777 deletions

View File

@@ -9,6 +9,7 @@ import type {
import type {
AgentInfo,
AgentKnowledgeBinding,
AgentSkillBinding,
AgentToolBinding,
} from '../types';
@@ -26,6 +27,7 @@ import { ElButton, ElMessage } from 'element-plus';
import AiChatPanel from '#/components/ai-chat/AiChatPanel.vue';
import {
createAgentArtifactLoader,
loadAgentChatDocument,
loadAgentChatImage,
} from '#/components/ai-chat/mediaApi';
@@ -41,6 +43,7 @@ const props = defineProps<{
agent: AgentInfo;
imageEnabled?: boolean;
knowledgeBindings: AgentKnowledgeBinding[];
skillBindings: AgentSkillBinding[];
toolBindings: AgentToolBinding[];
}>();
@@ -61,6 +64,11 @@ const {
} = useAgentTryoutStream();
const approvalLoading = ref(false);
const composer = useAgentComposerDraft('DRAFT');
const loadDraftAgentArtifact = createAgentArtifactLoader(() => ({
agentId: String(props.agent.id || ''),
mode: 'DRAFT',
runtimeSessionId: composer.sessionId.value,
}));
const interactionDisplay = computed(() =>
resolveInteractionDisplay(props.agent),
);
@@ -68,6 +76,7 @@ const interactionDisplay = computed(() =>
function getDraftContext() {
return {
agent: props.agent,
skillBindings: props.skillBindings,
toolBindings: props.toolBindings,
knowledgeBindings: props.knowledgeBindings,
};
@@ -101,7 +110,12 @@ watch(
);
watch(
() => [props.agent, props.knowledgeBindings, props.toolBindings],
() => [
props.agent,
props.knowledgeBindings,
props.skillBindings,
props.toolBindings,
],
() => {
syncCurrentDraftContext();
},
@@ -312,7 +326,7 @@ async function handleApprove(payload: ChatTimelineToolApprovalPayload) {
approvalLoading.value = true;
markToolApproving(payload);
try {
const res = await approveAgentRun(payload.requestId, payload.resumeToken);
const res = await approveAgentRun(payload.approvalId);
if (res.errorCode === 0) {
ElMessage.success('已批准');
}
@@ -334,11 +348,7 @@ async function handleReject(payload: ChatTimelineToolApprovalPayload) {
reason: '用户拒绝执行',
});
try {
await rejectAgentRun(
payload.requestId,
payload.resumeToken,
'用户拒绝执行',
);
await rejectAgentRun(payload.approvalId, '用户拒绝执行');
} finally {
approvalLoading.value = false;
}
@@ -397,6 +407,7 @@ async function handleReject(payload: ChatTimelineToolApprovalPayload) {
<ChatTimeline
v-else
:assistant-avatar="agent.avatar || defaultAssistantAvatar"
:artifact-loader="loadDraftAgentArtifact"
:items="timelineItems"
:document-loader="loadAgentChatDocument"
:image-loader="loadAgentChatImage"