generated from nhcarrigan/template
852a4d6661
## Summary - Adds Tauri clipboard-manager plugin to read images from native clipboard - Falls back to native clipboard when WebView clipboard API returns empty (fixes screenshot paste) - Allows sending messages with just attachments (no text required) - Logs attached files to output with 📎 emoji ## Test plan - [ ] Build and run the app natively on Windows - [ ] Copy a screenshot (Win+Shift+S) and paste in the chat input - [ ] Verify the screenshot appears as an attachment preview - [ ] Send the attachment and verify Claude receives the file path - [ ] Test sending a message with only an attachment (no text) - [ ] Verify the 📎 log line shows the attached filename **Note:** Paste will not work in WSLg dev environment due to clipboard isolation - needs native Windows build to test. ✨ This PR was created with help from Hikari~ 🌸 Co-authored-by: Hikari <hikari@nhcarrigan.com> Reviewed-on: #67 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
123 lines
5.1 KiB
TypeScript
123 lines
5.1 KiB
TypeScript
import { derived } from "svelte/store";
|
|
import { conversationsStore } from "./conversations";
|
|
import type { TerminalLine } from "$lib/types/messages";
|
|
import { characterState } from "$lib/stores/character";
|
|
import {
|
|
setShouldRestoreHistory,
|
|
setSavedHistory,
|
|
getShouldRestoreHistory,
|
|
getSavedHistory,
|
|
clearHistoryRestore,
|
|
} from "./historyRestore";
|
|
|
|
// Re-export TerminalLine type for backwards compatibility
|
|
export type { TerminalLine };
|
|
|
|
// Re-export from conversations store for backwards compatibility
|
|
export const claudeStore = {
|
|
// Existing subscriptions
|
|
connectionStatus: conversationsStore.connectionStatus,
|
|
sessionId: conversationsStore.sessionId,
|
|
currentWorkingDirectory: conversationsStore.currentWorkingDirectory,
|
|
terminalLines: conversationsStore.terminalLines,
|
|
pendingPermission: conversationsStore.pendingPermission,
|
|
pendingQuestion: conversationsStore.pendingQuestion,
|
|
isProcessing: conversationsStore.isProcessing,
|
|
grantedTools: conversationsStore.grantedTools,
|
|
pendingRetryMessage: conversationsStore.pendingRetryMessage,
|
|
attachments: conversationsStore.attachments,
|
|
|
|
// New conversation-aware subscriptions
|
|
conversations: conversationsStore.conversations,
|
|
activeConversationId: conversationsStore.activeConversationId,
|
|
activeConversation: conversationsStore.activeConversation,
|
|
|
|
// Methods
|
|
setConnectionStatus: conversationsStore.setConnectionStatus,
|
|
setConnectionStatusForConversation: conversationsStore.setConnectionStatusForConversation,
|
|
setCharacterStateForConversation: conversationsStore.setCharacterStateForConversation,
|
|
setSessionId: conversationsStore.setSessionId,
|
|
setSessionIdForConversation: conversationsStore.setSessionIdForConversation,
|
|
setWorkingDirectory: conversationsStore.setWorkingDirectory,
|
|
setWorkingDirectoryForConversation: conversationsStore.setWorkingDirectoryForConversation,
|
|
setProcessing: conversationsStore.setProcessing,
|
|
addLine: conversationsStore.addLine,
|
|
addLineToConversation: conversationsStore.addLineToConversation,
|
|
updateLine: conversationsStore.updateLine,
|
|
appendToLine: conversationsStore.appendToLine,
|
|
clearTerminal: conversationsStore.clearTerminal,
|
|
getConversationHistory: conversationsStore.getConversationHistory,
|
|
requestPermission: conversationsStore.requestPermission,
|
|
clearPermission: conversationsStore.clearPermission,
|
|
requestPermissionForConversation: conversationsStore.requestPermissionForConversation,
|
|
clearPermissionForConversation: conversationsStore.clearPermissionForConversation,
|
|
requestQuestion: conversationsStore.requestQuestion,
|
|
clearQuestion: conversationsStore.clearQuestion,
|
|
requestQuestionForConversation: conversationsStore.requestQuestionForConversation,
|
|
clearQuestionForConversation: conversationsStore.clearQuestionForConversation,
|
|
grantTool: conversationsStore.grantTool,
|
|
revokeAllTools: conversationsStore.revokeAllTools,
|
|
isToolGranted: conversationsStore.isToolGranted,
|
|
setPendingRetryMessage: conversationsStore.setPendingRetryMessage,
|
|
|
|
// Conversation management
|
|
createConversation: conversationsStore.createConversation,
|
|
deleteConversation: conversationsStore.deleteConversation,
|
|
switchConversation: conversationsStore.switchConversation,
|
|
renameConversation: conversationsStore.renameConversation,
|
|
saveScrollPosition: conversationsStore.saveScrollPosition,
|
|
getScrollPosition: conversationsStore.getScrollPosition,
|
|
|
|
// Attachment management
|
|
addAttachment: conversationsStore.addAttachment,
|
|
removeAttachment: conversationsStore.removeAttachment,
|
|
clearAttachments: conversationsStore.clearAttachments,
|
|
getAttachments: conversationsStore.getAttachments,
|
|
|
|
getGrantedTools: (): string[] => {
|
|
let tools: string[] = [];
|
|
conversationsStore.grantedTools.subscribe((t) => (tools = Array.from(t)))();
|
|
return tools;
|
|
},
|
|
|
|
// History restoration methods from main branch
|
|
setShouldRestoreHistory: setShouldRestoreHistory,
|
|
setSavedConversationHistory: setSavedHistory,
|
|
getShouldRestoreHistory: getShouldRestoreHistory,
|
|
getSavedConversationHistory: getSavedHistory,
|
|
|
|
reset: () => {
|
|
// Reset only the active conversation
|
|
conversationsStore.clearTerminal();
|
|
conversationsStore.setSessionId(null);
|
|
conversationsStore.setWorkingDirectory("");
|
|
conversationsStore.setProcessing(false);
|
|
conversationsStore.revokeAllTools();
|
|
conversationsStore.clearAttachments();
|
|
// Also clear history restoration
|
|
clearHistoryRestore();
|
|
},
|
|
};
|
|
|
|
export const hasPermissionPending = derived(
|
|
claudeStore.activeConversation,
|
|
($conversation) => $conversation?.pendingPermission !== null
|
|
);
|
|
|
|
export const hasQuestionPending = derived(
|
|
claudeStore.activeConversation,
|
|
($conversation) => $conversation?.pendingQuestion !== null
|
|
);
|
|
|
|
// Derived store to check if Claude is currently processing (can be interrupted)
|
|
export const isClaudeProcessing = derived(
|
|
[claudeStore.connectionStatus, characterState],
|
|
([$connectionStatus, $characterState]) => {
|
|
// Must be connected and in one of the processing states
|
|
return (
|
|
$connectionStatus === "connected" &&
|
|
["thinking", "typing", "searching", "coding", "mcp"].includes($characterState)
|
|
);
|
|
}
|
|
);
|