refactor: extract session summary utilities to shared module

This commit is contained in:
weishu
2026-01-05 13:00:48 +08:00
parent f7d161e6cf
commit 21a64dfb49
5 changed files with 68 additions and 82 deletions
+11 -23
View File
@@ -1,12 +1,21 @@
import type {
DecryptedMessage as ProtocolDecryptedMessage,
ModelMode,
Session,
SessionSummary,
SyncEvent as ProtocolSyncEvent,
WorktreeMetadata
} from '@hapi/protocol/types'
export type { AgentState, ModelMode, PermissionMode, Session, TodoItem, WorktreeMetadata } from '@hapi/protocol/types'
export type {
AgentState,
ModelMode,
PermissionMode,
Session,
SessionSummary,
SessionSummaryMetadata,
TodoItem,
WorktreeMetadata
} from '@hapi/protocol/types'
export type SessionMetadataSummary = {
path: string
@@ -21,27 +30,6 @@ export type SessionMetadataSummary = {
worktree?: WorktreeMetadata
}
export type SessionSummaryMetadata = {
name?: string
path: string
machineId?: string
summary?: { text: string }
flavor?: string | null
worktree?: WorktreeMetadata
}
export type SessionSummary = {
id: string
active: boolean
thinking: boolean
activeAt: number
updatedAt: number
metadata: SessionSummaryMetadata | null
todoProgress: { completed: number; total: number } | null
pendingRequestsCount: number
modelMode?: ModelMode
}
export type MessageStatus = 'sending' | 'sent' | 'failed'
export type DecryptedMessage = ProtocolDecryptedMessage & {