mirror of
https://github.com/delibae/claude-prism.git
synced 2026-08-28 05:14:59 +00:00
fix(chat): interrupt active runs for guided follow-ups
Terminate the current Claude process on Windows when a guided follow-up is selected so queued guidance can take effect immediately instead of waiting for the active run to finish naturally. Handle forced queued guidance before snapshot and file refresh work in the completion event, then resume the same tab with the preserved provider context.
This commit is contained in:
parent
717c572b41
commit
04a18f6cc5
2 changed files with 26 additions and 14 deletions
|
|
@ -320,11 +320,13 @@ async fn interrupt_or_terminate(child: &mut Child) -> bool {
|
|||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
async fn interrupt_or_terminate(_child: &mut Child) -> bool {
|
||||
async fn interrupt_or_terminate(child: &mut Child) -> bool {
|
||||
// Windows GUI processes do not have a reliable console-control path from
|
||||
// Tauri without a PTY/ConPTY session. Keep this fallback isolated so the
|
||||
// future long-lived session driver can replace it cleanly.
|
||||
false
|
||||
// Tauri without a PTY/ConPTY session. For guided follow-ups, fall back to
|
||||
// terminating the current run so the frontend can immediately continue the
|
||||
// same tab with the queued guidance.
|
||||
let _ = child.start_kill();
|
||||
true
|
||||
}
|
||||
|
||||
/// Kill all Claude processes associated with a specific window label.
|
||||
|
|
|
|||
|
|
@ -389,6 +389,23 @@ export function useClaudeEvents() {
|
|||
const completedSessionId = tab.sessionId;
|
||||
chatStore._setStreaming(tabId, false);
|
||||
|
||||
const forceQueuedGuidance = tab.forceQueuedGuidanceOnComplete === true;
|
||||
if (forceQueuedGuidance) {
|
||||
const queuedGuidance = useClaudeChatStore
|
||||
.getState()
|
||||
.consumeQueuedGuidance(tabId, tab.forcedQueuedGuidanceId);
|
||||
if (queuedGuidance) {
|
||||
log.info(`[${tabId}] interrupting current run with queued guidance`);
|
||||
void useClaudeChatStore
|
||||
.getState()
|
||||
.sendPrompt(queuedGuidance.prompt, queuedGuidance.contextOverride, {
|
||||
tabId,
|
||||
preserveTabProvider: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Snapshot after Claude edit
|
||||
const projectPath = useDocumentStore.getState().projectRoot;
|
||||
if (projectPath && completedSessionId) {
|
||||
|
|
@ -427,16 +444,9 @@ export function useClaudeEvents() {
|
|||
const docStore = useDocumentStore.getState();
|
||||
await docStore.refreshFiles();
|
||||
|
||||
const forceQueuedGuidance = tab.forceQueuedGuidanceOnComplete === true;
|
||||
const queuedGuidance =
|
||||
success || forceQueuedGuidance
|
||||
? useClaudeChatStore
|
||||
.getState()
|
||||
.consumeQueuedGuidance(
|
||||
tabId,
|
||||
forceQueuedGuidance ? tab.forcedQueuedGuidanceId : null,
|
||||
)
|
||||
: null;
|
||||
const queuedGuidance = success
|
||||
? useClaudeChatStore.getState().consumeQueuedGuidance(tabId)
|
||||
: null;
|
||||
if (queuedGuidance) {
|
||||
log.info(`[${tabId}] continuing with queued guidance`);
|
||||
void useClaudeChatStore
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue