feat: AG-UI 协议对齐与路由导航功能

- 前端: 添加 SSE 流式支持、stateSnapshot 事件、路由导航工具
- 前端: 实现工具调用审批流程,支持 pending 状态展示
- 后端: Agent 状态管理与会话持久化相关重构
- 文档: 新增 agent-agui-full-alignance 设计文档
- 测试: 补充相关单元测试和集成测试
This commit is contained in:
zl-q
2026-03-07 17:30:20 +08:00
parent ec33bb0cee
commit 120df903d2
52 changed files with 4305 additions and 1672 deletions
+27
View File
@@ -1,3 +1,4 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'api_exception.dart';
import 'api_interceptor.dart';
@@ -92,4 +93,30 @@ class ApiClient implements IApiClient {
throw ApiException.fromDioError(e);
}
}
@override
Future<Stream<String>> getSseLines(
String path, {
Map<String, String>? headers,
}) async {
try {
final response = await _dio.get<ResponseBody>(
path,
options: Options(
responseType: ResponseType.stream,
headers: headers,
),
);
final responseBody = response.data;
if (responseBody == null) {
return const Stream<String>.empty();
}
return responseBody.stream
.cast<List<int>>()
.transform(utf8.decoder)
.transform(const LineSplitter());
} on DioException catch (e) {
throw ApiException.fromDioError(e);
}
}
}