summaryrefslogtreecommitdiffhomepage
path: root/packages/frontend/src/lib/components/ChatInput.svelte
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-03 15:29:45 +0900
committerAdam Malczewski <[email protected]>2026-06-03 15:30:38 +0900
commit5af9bd021c206b9e4330ab6a549dc8d013d91537 (patch)
tree667dca977d6eb78e09006c5553523230daa2b73f /packages/frontend/src/lib/components/ChatInput.svelte
parentbcc449a5cba183c7358ab48ed4f2140bb1a3238c (diff)
parentbc3ecbe7b72f6da6ed36d0cea5a66de1c440269a (diff)
downloaddispatch-5af9bd021c206b9e4330ab6a549dc8d013d91537.tar.gz
dispatch-5af9bd021c206b9e4330ab6a549dc8d013d91537.zip
Merge branch 'dev' into warm/prompt-cache-warming
# Conflicts: # packages/api/src/agent-manager.ts # packages/api/tests/agent-manager.test.ts # packages/frontend/src/lib/tabs.svelte.ts
Diffstat (limited to 'packages/frontend/src/lib/components/ChatInput.svelte')
-rw-r--r--packages/frontend/src/lib/components/ChatInput.svelte16
1 files changed, 14 insertions, 2 deletions
diff --git a/packages/frontend/src/lib/components/ChatInput.svelte b/packages/frontend/src/lib/components/ChatInput.svelte
index 4067b78..f3eadf7 100644
--- a/packages/frontend/src/lib/components/ChatInput.svelte
+++ b/packages/frontend/src/lib/components/ChatInput.svelte
@@ -46,6 +46,13 @@ const attachments = $derived(tabStore.activeTab?.attachments ?? []);
const cacheStats = $derived(tabStore.activeTab?.cacheStats ?? null);
const isRunning = $derived(agentStatus === "running");
+// Lock input while this tab is mid-compaction: either it's the source
+// conversation being summarized, or it's the transient placeholder tab.
+const compactLocked = $derived(
+ (tabStore.activeTab?.isCompacting ?? false) ||
+ (tabStore.activeTab?.compactingSource ?? null) !== null ||
+ (tabStore.activeTab?.compactionError ?? null) !== null,
+);
const hasText = $derived(inputValue.trim().length > 0);
const hasAttachments = $derived(attachments.length > 0);
// While generating with an empty box, the primary action is "stop". With text
@@ -276,6 +283,8 @@ function handleKeydown(e: KeyboardEvent) {
function submit() {
if (!tabId) return;
+ // Block sending while this tab is mid-compaction (source or placeholder).
+ if (compactLocked) return;
const map = new Map(attachments.map((a) => [a.id, a] as const));
const { displayText, content } = parseDraft(inputValue, map);
const trimmed = displayText.trim();
@@ -314,7 +323,10 @@ function primaryAction() {
bind:this={inputEl}
value={inputValue}
rows="1"
- placeholder="Type a message... (paste an image or PDF to attach)"
+ placeholder={compactLocked
+ ? "Compaction in progress…"
+ : "Type a message... (paste an image or PDF to attach)"}
+ disabled={compactLocked}
class="textarea textarea-ghost flex-1 resize-none leading-normal !min-h-0 h-auto"
onkeydown={handleKeydown}
oninput={handleInput}
@@ -325,7 +337,7 @@ function primaryAction() {
<button
type="button"
class="btn w-20 shrink-0 {showStop ? 'btn-error btn-outline' : 'btn-primary'}"
- disabled={!showStop && !hasText && !hasAttachments || sendBlocked}
+ disabled={compactLocked || (!showStop && !hasText && !hasAttachments) || sendBlocked}
onclick={primaryAction}
title={showStop ? "Stop generation" : sendBlocked ? (attachmentWarning ?? "Cannot send") : "Send message"}
>