feat(remote-control): 优化 Web 展示、状态同步与桥接控制流程 (#288)

Co-authored-by: chengzifeng <chengzifeng@meituan.com>
This commit is contained in:
Cheng Zi Feng
2026-04-17 16:21:27 +08:00
committed by GitHub
parent b5c299f5d2
commit 72a2093cd6
64 changed files with 4138 additions and 312 deletions

View File

@@ -4,12 +4,14 @@
*/
import { feature } from 'bun:bundle'
import { randomUUID, type UUID } from 'crypto'
import { getReplBridgeHandle } from '../../bridge/replBridgeHandle.js'
import {
getLastMainRequestId,
getOriginalCwd,
getSessionId,
regenerateSessionId,
} from '../../bootstrap/state.js'
import type { SDKStatusMessage } from '../../entrypoints/sdk/coreTypes.js'
import {
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
logEvent,
@@ -46,6 +48,21 @@ import {
import { getCurrentWorktreeSession } from '../../utils/worktree.js'
import { clearSessionCaches } from './caches.js'
function notifyRemoteConversationCleared(): void {
const handle = getReplBridgeHandle()
if (!handle) return
handle.markTranscriptReset?.()
const message: SDKStatusMessage = {
type: 'status',
subtype: 'status',
status: 'conversation_cleared',
message: 'conversation_cleared',
uuid: randomUUID(),
}
handle.writeSdkMessages([message])
}
export async function clearConversation({
setMessages,
readFileState,
@@ -107,6 +124,7 @@ export async function clearConversation({
}
setMessages(() => [])
notifyRemoteConversationCleared()
// Clear context-blocked flag so proactive ticks resume after /clear
if (feature('PROACTIVE') || feature('KAIROS')) {