diff --git a/apps/differ/src-tauri/Cargo.toml b/apps/differ/src-tauri/Cargo.toml index bd1e5ade3..2d9e86c1f 100644 --- a/apps/differ/src-tauri/Cargo.toml +++ b/apps/differ/src-tauri/Cargo.toml @@ -28,3 +28,5 @@ git-diff = { path = "../../../crates/git-diff" } # macOS font enumeration [target.'cfg(target_os = "macos")'.dependencies] core-text = "20" + +[workspace] diff --git a/apps/staged/src-tauri/Cargo.toml b/apps/staged/src-tauri/Cargo.toml index 0bb91c178..5284e0072 100644 --- a/apps/staged/src-tauri/Cargo.toml +++ b/apps/staged/src-tauri/Cargo.toml @@ -66,3 +66,5 @@ axum = { version = "0.8" } # [[bin]] # name = "debug_diff" # path = "src/bin/debug_diff.rs" + +[workspace] diff --git a/apps/staged/src/lib/features/sessions/SessionModal.svelte b/apps/staged/src/lib/features/sessions/SessionModal.svelte index fa6160df8..ed73069e4 100644 --- a/apps/staged/src/lib/features/sessions/SessionModal.svelte +++ b/apps/staged/src/lib/features/sessions/SessionModal.svelte @@ -75,6 +75,7 @@ hasXmlBlocks, stripCodeFences, stripXmlTags, + type VerbGroup, } from './sessionModalHelpers'; import InContentSearch from '../../shared/InContentSearch.svelte'; import { highlightMatches, clearHighlights, scrollToMatch } from '../../shared/textHighlight'; @@ -926,6 +927,30 @@ return arr; }); + /** + * Pre-compute verb groups for every tools group in both tenses. + * `groupByVerb` is expensive (JSON.parse + string replace per tool call) so we + * cache both the past-tense and present-tense variants here. The template then + * picks the right variant with a cheap boolean lookup instead of re-running the + * heavy computation on every render. + */ + let verbGroupCache = $derived.by(() => { + const cache: { past: VerbGroup[]; present: VerbGroup[] }[] = []; + for (const group of grouped) { + if (group.type === 'tools') { + cache.push({ + past: groupByVerb(group.pairs, repoDir, true), + present: groupByVerb(group.pairs, repoDir, false), + }); + } else { + // Placeholder — tool-group index won't line up otherwise. + // We use a separate counter in the template instead. + cache.push({ past: [], present: [] }); + } + } + return cache; + }); + /** Stable key for a message group — used to key the {#each} block for transitions. * For tools groups, keys off the first pair — safe because the grouping logic * in `grouped` always pushes at least one pair before creating a tools group. */ @@ -1124,8 +1149,9 @@ {:else} + {@const forcePastTense = !isLive || sending || hasUserAfter[groupIdx]}