✨ feat(vscode): 会话 tab 可交接对话给同事
This commit is contained in:
1 parent
5ee8226167
commit
77037924ef
20 files changed
+938
-26
No files matched your search
@@ -96,10 +96,16 @@ export function App() {
|
||||
importNamedSession,
|
||||
importableSessions,
|
||||
importableLoading,
|
||||
pendingHandoffs,
|
||||
sessionHandoffUsers,
|
||||
startSessionHandoff,
|
||||
submitSessionHandoff,
|
||||
acceptSessionHandoff,
|
||||
} = useManagedSessions()
|
||||
const [showNewIssueModal, setShowNewIssueModal] = useState(false)
|
||||
const [showLogs, setShowLogs] = useState(false)
|
||||
const [handoffIssue, setHandoffIssue] = useState<number | null>(null)
|
||||
const [handoffSession, setHandoffSession] = useState<{ id: string, name: string } | null>(null)
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null)
|
||||
// 程序化设置的选中(反向选中 / pendingSelectId)记在这里,让下面的自动聚焦
|
||||
// effect 跳过它——否则 选中→聚焦→终端激活→反向选中 会死循环、CPU 飙升。
|
||||
@@ -182,6 +188,8 @@ export function App() {
|
||||
return
|
||||
if (settingsOpen)
|
||||
return
|
||||
if (handoffIssue !== null || handoffSession !== null)
|
||||
return
|
||||
|
||||
function onKeyDown(e: KeyboardEvent): void {
|
||||
// Skip when typing in form fields.
|
||||
@@ -403,6 +411,13 @@ export function App() {
|
||||
importableLoading={importableLoading}
|
||||
onListImportableSessions={listImportableNamedSessions}
|
||||
onImportNamedSession={importNamedSession}
|
||||
pendingHandoffs={pendingHandoffs}
|
||||
onSessionHandoff={(id) => {
|
||||
const s = managedSessions.sessions.find(x => x.id === id)
|
||||
setHandoffSession({ id, name: s?.name ?? id.slice(0, 8) })
|
||||
startSessionHandoff(id)
|
||||
}}
|
||||
onAcceptSessionHandoff={acceptSessionHandoff}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -465,14 +480,29 @@ export function App() {
|
||||
/>
|
||||
<HandoffModal
|
||||
open={handoffIssue !== null}
|
||||
issueNumber={handoffIssue}
|
||||
title={handoffIssue !== null ? `移交 #${handoffIssue}` : '移交'}
|
||||
description="会把本机的 worktree 删除、会话记录打包挂到工单附件,并把工单指派给对方。移交前分支必须已全部 push。"
|
||||
users={handoffUsers && handoffUsers.issueNumber === handoffIssue ? handoffUsers.users : null}
|
||||
onCancel={() => setHandoffIssue(null)}
|
||||
onSubmit={(n, to) => {
|
||||
startHandoff(n, to)
|
||||
onSubmit={(to) => {
|
||||
if (handoffIssue !== null)
|
||||
startHandoff(handoffIssue, to)
|
||||
setHandoffIssue(null)
|
||||
}}
|
||||
/>
|
||||
<HandoffModal
|
||||
open={handoffSession !== null}
|
||||
title={handoffSession ? `交接「${handoffSession.name}」` : '交接'}
|
||||
description="把这段对话打包发给同事。不改 git、不上看板。对方在会话 tab 点接收后即可 resume。双方都能继续聊,对话会分叉。"
|
||||
confirmLabel="交接"
|
||||
users={handoffSession ? sessionHandoffUsers : null}
|
||||
onCancel={() => setHandoffSession(null)}
|
||||
onSubmit={(to) => {
|
||||
if (handoffSession)
|
||||
submitSessionHandoff(handoffSession.id, to)
|
||||
setHandoffSession(null)
|
||||
}}
|
||||
/>
|
||||
<LogModal
|
||||
open={showLogs}
|
||||
entries={logs}
|
||||
|
||||
Reference in new issue
Block a user