generated from nhcarrigan/template
3f30997f0e
## Explanation This PR bundles several user-facing improvements and feature additions for the v0.3.0 release, including quality-of-life improvements to the UI, new slash commands, better state persistence, and auto-update checking. ## Included Changes - **Resizable chat input** with drag handle (#58 partial) - **Arrow key navigation fix** - cursor keys now navigate text when user has typed input (#58) - **Scroll position persistence** per conversation tab - **/skill command** for invoking Claude Code skills (#57) - **Stats persistence fix** - stats now persist across session changes, only reset on disconnect (#59) - **Auto-update checker** on startup (#17) - **Resizable character panel** with full-height sprites (#10) - **Font size and zoom settings** with keyboard shortcuts (Ctrl++/Ctrl+-/Ctrl+0) (#19) ## Closes Closes #10, #17, #19, #57, #58, #59 ## Attestations - [x] I have read and agree to the Code of Conduct - [x] I have read and agree to the Community Guidelines - [x] My contribution complies with the Contributor Covenant - [x] I have run the linter and resolved any errors - [x] My pull request uses an appropriate title, matching the conventional commit standards - [x] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request - [x] All new and existing tests pass locally with my changes - [x] Code coverage remains at or above the configured threshold ## Documentation N/A - Internal app features ## Versioning Minor - My pull request introduces new non-breaking features. --- ✨ This PR was created with help from Hikari~ 🌸 Co-authored-by: Hikari <hikari@nhcarrigan.com> Reviewed-on: #61 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
115 lines
4.8 KiB
TypeScript
115 lines
4.8 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,
|
|
|
|
// 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,
|
|
|
|
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();
|
|
// 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)
|
|
);
|
|
}
|
|
);
|