Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Restart the activity phrase on fresh user input

FeiZhuLulu2fdfaf320960
diff --git a/ds-bot/client.js b/ds-bot/client.js
index acc2892d..2da51e21 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -4303,10 +4303,11 @@ function useRowEntrances(replacing) {
};
}, []);
}
-function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, actions }) {
+function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, useSession, actions }) {
const roster = useRoster((value) => value);
const running = useSessionStatus((map) => map.get(sessionId)?.running === true);
const liveKey = useLive((state) => JSON.stringify(state[sessionId] ?? {}));
+ const pendingInput = useSession((snapshot) => Math.max(0, ...(snapshot?.pendingSubmissions ?? []).filter((sub) => sub.placement !== "queued").map((sub) => sub.time)));
const bot = roster.byId[sessionId];
const room2 = roster.roomsById[sessionId];
const entries2 = (0, import_react7.useMemo)(() => Object.values(JSON.parse(liveKey)), [liveKey]);
@@ -4315,7 +4316,10 @@ function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, ac
const relaying = tools.some((entry) => entry.relay);
const visible = running && !streaming && !relaying && (bot !== void 0 || room2 !== void 0);
const tool = tools.at(-1);
- const want = !visible ? null : tool ? { key: tool.label ? `tool:${tool.label}` : "working", label: tool.label, pool: PHRASES.working, state: tool.state ?? "working" } : { key: "thinking", pool: PHRASES.thinking, state: "thinking" };
+ const inputRef = (0, import_react7.useRef)(0);
+ const inputAt = Math.max(inputRef.current, pendingInput);
+ inputRef.current = inputAt;
+ const want = !visible ? null : inputAt > (tool?.at ?? 0) ? { key: `input:${inputAt}`, pool: PHRASES.thinking, state: "thinking" } : tool ? { key: tool.label ? `tool:${tool.label}` : "working", label: tool.label, pool: PHRASES.working, state: tool.state ?? "working" } : { key: "thinking", pool: PHRASES.thinking, state: "thinking" };
const [shown, setShown] = (0, import_react7.useState)(null);
const wantKey = want?.key ?? null;
const markState = (0, import_react7.useRef)("thinking");
@@ -5176,7 +5180,7 @@ function MemoryNotice({ shown }) {
(0, import_react9.createElement)("span", { className: "bt-pill-mem-in", ref: inner }, (0, import_react9.createElement)("span", { className: "bt-pill-mem-ico" }, (0, import_react9.createElement)(MemoryIcon)), label)
);
}
-function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useActivity, useMemoryNews, useTurnClock, useUi, useLive, actions }) {
+function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSession, useActivity, useMemoryNews, useTurnClock, useUi, useLive, actions }) {
const roster = useRoster((value) => value);
const title = useSessions((list) => list.byId[sessionId]?.displayTitle ?? list.byId[sessionId]?.title ?? "");
const firstTurns = useSessions((list) => {
@@ -5240,7 +5244,7 @@ function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useAc
),
(0, import_react9.createElement)("span", { className: "bt-sr", role: "status" }, memoryNotice ? t("Memory updated") : ""),
(0, import_react9.createElement)(NewMessagePills, { key: sessionId, sessionId, useSessions, useUi, useTurnClock }),
- (0, import_react9.createElement)(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useLive, actions })
+ (0, import_react9.createElement)(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, actions })
);
}
function useTranscriptView() {
diff --git a/ds-bot/src/client/activity-row.js b/ds-bot/src/client/activity-row.js
index 1dc09a9c..7b281f04 100644
--- a/ds-bot/src/client/activity-row.js
+++ b/ds-bot/src/client/activity-row.js
@@ -81,10 +81,14 @@ function useRowEntrances(replacing) {
}, [])
}
-export function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, actions }) {
+export function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, useSession, actions }) {
const roster = useRoster(value => value)
const running = useSessionStatus(map => map.get(sessionId)?.running === true)
const liveKey = useLive(state => JSON.stringify(state[sessionId] ?? {}))
+ // A queued message waits for the next turn, so only a transcript or steering
+ // send counts as fresh input.
+ const pendingInput = useSession(snapshot => Math.max(0, ...(snapshot?.pendingSubmissions ?? [])
+ .filter(sub => sub.placement !== 'queued').map(sub => sub.time)))
const bot = roster.byId[sessionId]
const room = roster.roomsById[sessionId]
const entries = useMemo(() => Object.values(JSON.parse(liveKey)), [liveKey])
@@ -94,9 +98,16 @@ export function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useL
const relaying = tools.some(entry => entry.relay)
const visible = running && !streaming && !relaying && (bot !== undefined || room !== undefined)
const tool = tools.at(-1)
+ const inputRef = useRef(0)
+ // A steer keeps the run going, so nothing else resets the row: fresh input is
+ // the newest activity, and the phrase and the clock restart from the send.
+ const inputAt = Math.max(inputRef.current, pendingInput)
+ inputRef.current = inputAt
const want = !visible ? null
- : tool ? { key: tool.label ? `tool:${tool.label}` : 'working', label: tool.label, pool: PHRASES.working, state: tool.state ?? 'working' }
- : { key: 'thinking', pool: PHRASES.thinking, state: 'thinking' }
+ : inputAt > (tool?.at ?? 0)
+ ? { key: `input:${inputAt}`, pool: PHRASES.thinking, state: 'thinking' }
+ : tool ? { key: tool.label ? `tool:${tool.label}` : 'working', label: tool.label, pool: PHRASES.working, state: tool.state ?? 'working' }
+ : { key: 'thinking', pool: PHRASES.thinking, state: 'thinking' }
const [shown, setShown] = useState(null)
const wantKey = want?.key ?? null
const markState = useRef('thinking')
diff --git a/ds-bot/src/client/header.js b/ds-bot/src/client/header.js
index ff15e613..7544124c 100644
--- a/ds-bot/src/client/header.js
+++ b/ds-bot/src/client/header.js
@@ -42,7 +42,7 @@ function MemoryNotice({ shown }) {
h('span', { className: 'bt-pill-mem-in', ref: inner }, h('span', { className: 'bt-pill-mem-ico' }, h(MemoryIcon)), label))
}
-export function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useActivity, useMemoryNews, useTurnClock, useUi, useLive, actions }) {
+export function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSession, useActivity, useMemoryNews, useTurnClock, useUi, useLive, actions }) {
const roster = useRoster(value => value)
const title = useSessions(list => list.byId[sessionId]?.displayTitle ?? list.byId[sessionId]?.title ?? '')
const firstTurns = useSessions((list) => {
@@ -102,7 +102,7 @@ export function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus
h('span', { className: 'bt-pill-go', 'aria-hidden': true }, h(GoArrow))),
h('span', { className: 'bt-sr', role: 'status' }, memoryNotice ? t('Memory updated') : ''),
h(NewMessagePills, { key: sessionId, sessionId, useSessions, useUi, useTurnClock }),
- h(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useLive, actions }))
+ h(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, actions }))
}
// New-message pills. "N new messages ↓" takes Back to bottom's place when