generated from nhcarrigan/template
fix: stats persistence
This commit is contained in:
@@ -107,6 +107,12 @@ async function startNewConversation(): Promise<void> {
|
||||
conversationId,
|
||||
});
|
||||
|
||||
// Get granted tools before interrupting
|
||||
const activeConversation = get(conversationsStore.activeConversation);
|
||||
const grantedTools = activeConversation ? Array.from(activeConversation.grantedTools) : [];
|
||||
const config = configStore.getConfig();
|
||||
const allAllowedTools = [...new Set([...grantedTools, ...config.auto_granted_tools])];
|
||||
|
||||
claudeStore.addLine("system", "Starting new conversation...");
|
||||
characterState.setState("thinking");
|
||||
|
||||
@@ -120,6 +126,7 @@ async function startNewConversation(): Promise<void> {
|
||||
conversationId,
|
||||
options: {
|
||||
working_dir: workingDir,
|
||||
allowed_tools: allAllowedTools,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { characterState, characterInfo } from "$lib/stores/character";
|
||||
import { isStreamerMode } from "$lib/stores/config";
|
||||
import { handleNewUserMessage } from "$lib/notifications/rules";
|
||||
import { setSkipNextGreeting } from "$lib/tauri";
|
||||
import type { CharacterState, CharacterStateInfo } from "$lib/types/states";
|
||||
|
||||
interface Props {
|
||||
@@ -127,6 +128,9 @@
|
||||
const conversationId = get(claudeStore.activeConversationId);
|
||||
if (!conversationId) return;
|
||||
|
||||
// Set flag to preserve stats/permissions (don't treat next connect as new session)
|
||||
setSkipNextGreeting(true);
|
||||
|
||||
await invoke("interrupt_claude", { conversationId });
|
||||
claudeStore.addLine("system", "Interrupted");
|
||||
characterState.setState("idle");
|
||||
|
||||
@@ -338,17 +338,22 @@ User: ${formattedMessage}`;
|
||||
throw new Error("No active conversation");
|
||||
}
|
||||
|
||||
// Get current working directory before reconnecting
|
||||
// Get current working directory and granted tools before reconnecting
|
||||
const workingDir = await invoke<string>("get_working_directory", { conversationId });
|
||||
const activeConversation = get(conversationsStore.activeConversation);
|
||||
const grantedTools = activeConversation ? Array.from(activeConversation.grantedTools) : [];
|
||||
const config = configStore.getConfig();
|
||||
const allAllowedTools = [...new Set([...grantedTools, ...config.auto_granted_tools])];
|
||||
|
||||
// Set the flag to skip greeting on next connection
|
||||
setSkipNextGreeting(true);
|
||||
|
||||
// Reconnect to Claude
|
||||
// Reconnect to Claude with preserved permissions
|
||||
await invoke("start_claude", {
|
||||
conversationId,
|
||||
options: {
|
||||
working_dir: workingDir,
|
||||
allowed_tools: allAllowedTools,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user