diff --git a/ui/src/chat/ChatComposer.vue b/ui/src/chat/ChatComposer.vue
index 4bc20724c..d8945817e 100644
--- a/ui/src/chat/ChatComposer.vue
+++ b/ui/src/chat/ChatComposer.vue
@@ -249,7 +249,7 @@ function onKeydown(event: KeyboardEvent): void {
aria-controls="slash-palette"
:aria-expanded="isCommandMenuOpen ? 'true' : 'false'"
:aria-activedescendant="isCommandMenuOpen && commandMatches.length ? `slash-palette-option-${commandSelection}` : undefined"
- class="max-h-40 min-h-11 flex-1 resize-none rounded-none border-0 bg-transparent! px-0 py-1 text-label shadow-none focus-visible:ring-0"
+ class="max-h-40 min-h-11 flex-1 resize-none rounded-none border-0 bg-transparent! px-0 py-1 text-label pointer-coarse:text-base shadow-none focus-visible:ring-0"
@input="onInput"
@keydown="onKeydown"
/>
diff --git a/ui/src/chat/ChatDock.vue b/ui/src/chat/ChatDock.vue
index c7b2fbbb6..1cc9f9d1a 100644
--- a/ui/src/chat/ChatDock.vue
+++ b/ui/src/chat/ChatDock.vue
@@ -1,15 +1,18 @@
+
+
+
+
+ {{ label }}
+ Scroll to end
+
+
diff --git a/ui/src/chat/ChatTranscript.vue b/ui/src/chat/ChatTranscript.vue
index 2b8e4629f..3687ca70c 100644
--- a/ui/src/chat/ChatTranscript.vue
+++ b/ui/src/chat/ChatTranscript.vue
@@ -4,18 +4,17 @@ import { computed } from "vue";
import { Button } from "@/components/ui/button";
import {
MessageScroller,
- MessageScrollerButton,
MessageScrollerContent,
MessageScrollerItem,
MessageScrollerProvider,
MessageScrollerViewport,
} from "@/components/ui/message-scroller";
-import { useLiveResource } from "@/stores/session";
import ChatAskCard from "./ChatAskCard.vue";
import ChatBubble from "./ChatBubble.vue";
import ChatChooseCard from "./ChatChooseCard.vue";
import ChatUpdateCard from "./ChatUpdateCard.vue";
import ChatEmptyState from "./ChatEmptyState.vue";
+import ChatJumpButton from "./ChatJumpButton.vue";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Skeleton } from "@/components/ui/skeleton";
import {
@@ -27,7 +26,6 @@ import {
sessionError,
streamingTurn,
type ChatMessage,
- reloadTranscript,
} from "./state";
/**
@@ -78,9 +76,6 @@ const rows = computed(() => {
},
];
});
-
-// A task this conversation started reports its outcome into it.
-useLiveResource("chat", () => void reloadTranscript());
@@ -141,7 +136,7 @@ useLiveResource("chat", () => void reloadTranscript());
-
+
diff --git a/ui/src/chat/unseen.ts b/ui/src/chat/unseen.ts
new file mode 100644
index 000000000..8005f62da
--- /dev/null
+++ b/ui/src/chat/unseen.ts
@@ -0,0 +1,47 @@
+import { computed, ref, watch } from "vue";
+
+import { isLoadingSession, messages, type ChatMessage } from "./state";
+
+/**
+ * Counts the replies the operator has not seen. A reply is seen once the
+ * conversation is open and scrolled to its end; one that lands before that,
+ * such as a finished task's outcome while the dock is collapsed or the reader
+ * is scrolled up, adds to the count until then.
+ *
+ * It counts replies by position, not by id: a streamed reply is appended
+ * locally without an id and a later reload returns it with one, and that must
+ * not count twice.
+ */
+const dockOpen = ref(false);
+const atEnd = ref(false);
+const seen = ref(0);
+
+function isReply(message: ChatMessage): boolean {
+ // Cards the operator's own command produced are not something Archie said.
+ return (message.from ?? message.From ?? "") !== "web" && !message.update && !message.choose;
+}
+
+const total = computed(() => messages.value.filter(isReply).length);
+const viewing = computed(() => dockOpen.value && atEnd.value);
+
+export const unseenCount = computed(() => Math.max(0, total.value - seen.value));
+
+// Opening or switching a conversation loads it, which is not news; a reload
+// that drops a message must also lower the mark so the next reply still counts.
+watch(
+ [total, viewing, isLoadingSession],
+ ([count, watching, loading], [, , wasLoading]) => {
+ if (watching || loading || wasLoading || count < seen.value) seen.value = count;
+ },
+ { immediate: true },
+);
+
+/** The dock reports whether the conversation is open above the composer. */
+export function setDockOpen(open: boolean): void {
+ dockOpen.value = open;
+}
+
+/** The scroller's jump button reports whether the reader is at the end. */
+export function setAtEnd(end: boolean): void {
+ atEnd.value = end;
+}
diff --git a/ui/src/style.css b/ui/src/style.css
index 476f2b2d3..f2b4f3175 100644
--- a/ui/src/style.css
+++ b/ui/src/style.css
@@ -351,3 +351,19 @@
transition-duration: 0.01ms !important;
}
}
+
+/* Widens a control's tap area to 44px on a phone without changing how it looks
+ or what space it takes. Apply it to a container of buttons. */
+@utility touch-hit {
+ @media (max-width: 767px) {
+ & button:not(.absolute) {
+ position: relative;
+ }
+ & button::after {
+ content: "";
+ position: absolute;
+ inset-block: min(0px, calc((100% - 44px) / 2));
+ inset-inline: min(0px, calc((100% - 44px) / 2));
+ }
+ }
+}