Add session bootstrap client path
This commit is contained in:
1 parent
82c6d27075
commit
0c7aefee42
4 files changed
+48
No files matched your search
+16
@@ -530,6 +530,22 @@ class RemoteOpenClawRepository(
|
|||||||
updateSessionPreview(sessionId, previewMessage(merged))
|
updateSessionPreview(sessionId, previewMessage(merged))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun fetchSessionBootstrap(sessionId: String): SessionDetailState {
|
||||||
|
val bootstrap = api.getSessionBootstrap(sessionId)
|
||||||
|
val timeline = bootstrap.messages.map { dto ->
|
||||||
|
MessageTimelineItem.RemoteMessage(dto.toDomainMessage())
|
||||||
|
}
|
||||||
|
return reduceSessionDetailState(
|
||||||
|
SessionDetailState(sessionId = bootstrap.sessionId),
|
||||||
|
SessionDetailEvent.BootstrapLoaded(
|
||||||
|
sessionId = bootstrap.sessionId,
|
||||||
|
timeline = timeline,
|
||||||
|
operations = emptyList(),
|
||||||
|
loadedAtMs = bootstrap.serverTs,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun retryAutoRecoverableMessages(sessionId: String): Boolean {
|
suspend fun retryAutoRecoverableMessages(sessionId: String): Boolean {
|
||||||
val candidates = messageStore[sessionId].orEmpty()
|
val candidates = messageStore[sessionId].orEmpty()
|
||||||
.filter { it.id in autoRetryMessageIds && it.isAutoRetryCandidate() }
|
.filter { it.id in autoRetryMessageIds && it.isAutoRetryCandidate() }
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ class MobileGatewayApi(
|
|||||||
}.body()
|
}.body()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getSessionBootstrap(sessionId: String): SessionBootstrapResponseDto {
|
||||||
|
val encodedId = sessionId.encodeURLPathPart()
|
||||||
|
return client.get("${baseUrl.trimEnd('/')}/api/sessions/$encodedId/bootstrap") {
|
||||||
|
authHeader()
|
||||||
|
}.body()
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun sendMessage(sessionId: String, message: String): SendMessageResponseDto {
|
suspend fun sendMessage(sessionId: String, message: String): SendMessageResponseDto {
|
||||||
val encodedId = sessionId.encodeURLPathPart()
|
val encodedId = sessionId.encodeURLPathPart()
|
||||||
return client.post("${baseUrl.trimEnd('/')}/api/sessions/$encodedId/messages") {
|
return client.post("${baseUrl.trimEnd('/')}/api/sessions/$encodedId/messages") {
|
||||||
|
|||||||
@@ -74,6 +74,30 @@ data class UpdateDefaultAgentResponseDto(
|
|||||||
val updatedAt: String,
|
val updatedAt: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SessionBootstrapResponseDto(
|
||||||
|
val sessionId: String,
|
||||||
|
val messages: List<ChatMessageDto> = emptyList(),
|
||||||
|
val operations: List<SessionBootstrapOperationDto> = emptyList(),
|
||||||
|
val streamState: String = "idle",
|
||||||
|
val serverTs: Long = 0,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SessionBootstrapOperationDto(
|
||||||
|
val opId: String,
|
||||||
|
val sessionId: String,
|
||||||
|
val type: String,
|
||||||
|
val state: String,
|
||||||
|
val createdAtMs: Long,
|
||||||
|
val clientRequestId: String,
|
||||||
|
val payloadSummary: String,
|
||||||
|
val attemptCount: Int = 0,
|
||||||
|
val lastError: String? = null,
|
||||||
|
val correlationToken: String? = null,
|
||||||
|
val materializedMessageIds: List<String> = emptyList(),
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class UploadAttachmentResponseDto(
|
data class UploadAttachmentResponseDto(
|
||||||
@JsonNames("accepted", "accept")
|
@JsonNames("accepted", "accept")
|
||||||
|
|||||||
@@ -463,3 +463,4 @@ Android/iOS App
|
|||||||
- 2026-03-07:同步反馈开始区分触发来源:把远端同步拆成 `Initial / Manual / Background` 三种触发语义,用户主动刷新成功时会明确提示“已同步最新状态”,后台静默刷新则尽量不打扰,避免轮询也频繁弹反馈,同时让手动操作的结果更可感知。
|
- 2026-03-07:同步反馈开始区分触发来源:把远端同步拆成 `Initial / Manual / Background` 三种触发语义,用户主动刷新成功时会明确提示“已同步最新状态”,后台静默刷新则尽量不打扰,避免轮询也频繁弹反馈,同时让手动操作的结果更可感知。
|
||||||
- 2026-03-07:开始统一发送反馈语言:聊天时间线里把文本/附件/工具的状态从泛化的“处理中 / 失败”细化成用户更能理解的产品文案,如“发送中 / 上传中 / 发送队列中 / 自动重试中 / 执行中 / 发送失败 / 上传失败 / 生成失败”,让用户更清楚当前到底卡在哪一环。
|
- 2026-03-07:开始统一发送反馈语言:聊天时间线里把文本/附件/工具的状态从泛化的“处理中 / 失败”细化成用户更能理解的产品文案,如“发送中 / 上传中 / 发送队列中 / 自动重试中 / 执行中 / 发送失败 / 上传失败 / 生成失败”,让用户更清楚当前到底卡在哪一环。
|
||||||
- 2026-03-07:正式启动“统一机制”重构 Phase 1:新增 `docs/UNIFIED_DELIVERY_ARCHITECTURE.md` 作为设计稿;App 新增 `UnifiedDeliveryModels.kt`,定义 `DeliveryOperation / SessionDetailState / SessionDetailEvent / reducer` 骨架;BFF 新增 `unified_models.py` 并预留 `/api/sessions/{session_id}/bootstrap` 响应模型与空接口,先把新主干立起来,后续再逐步把旧 pending/SSE/refresh 逻辑迁过去。
|
- 2026-03-07:正式启动“统一机制”重构 Phase 1:新增 `docs/UNIFIED_DELIVERY_ARCHITECTURE.md` 作为设计稿;App 新增 `UnifiedDeliveryModels.kt`,定义 `DeliveryOperation / SessionDetailState / SessionDetailEvent / reducer` 骨架;BFF 新增 `unified_models.py` 并预留 `/api/sessions/{session_id}/bootstrap` 响应模型与空接口,先把新主干立起来,后续再逐步把旧 pending/SSE/refresh 逻辑迁过去。
|
||||||
|
- 2026-03-07:继续推进 Phase 1:BFF 已把 `/api/sessions/{session_id}/bootstrap` 接成真实数据骨架(当前返回 canonical messages + 空 operations + streamState/serverTs);App 已补上 `SessionBootstrapResponseDto`、`getSessionBootstrap()` 和 `fetchSessionBootstrap()` 入口,开始具备并行验证新 bootstrap 流程的能力,但尚未切换 UI 到新模型。
|
||||||
Reference in new issue
Block a user