A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Merge pull request #576 from Fei2411/fix/557-group-relay-blank
Fei24117f2994c9f936
diff --cc ds-bot/client.jsindex 610d73af,4bc0ac5e..e14b29f8--- a/ds-bot/client.js+++ b/ds-bot/client.js@@@ -8006,9 -7809,58 +8007,58 @@@ function useLiveNote(actions, sessionIdreturn () => actions.noteLive(sessionId, id, null);}, [sessionId, id, key]);}+ var RELAY_LIST = /"replies"\s*:\s*\[/;+ var PRUNE_MARKER = /\[\.\.\. tool result middle pruned \.\.\.\]/;+ function parseReplies(text) {+ try {+ return { replies: JSON.parse(text).replies ?? [], broken: false };+ } catch {+ }+ const replies = [];+ const head = RELAY_LIST.exec(text);+ if (head) {+ for (const piece of text.slice(head.index + head[0].length).split(PRUNE_MARKER)) {+ const first = piece.indexOf('{"');+ if (first !== -1) scanReplies(piece, first, replies);+ }+ }+ return { replies, broken: true };+ }+ function scanReplies(text, start, replies) {+ let depth = 0;+ let from = -1;+ let inString = false;+ let escaped = false;+ for (let i = start; i < text.length; i += 1) {+ const ch = text[i];+ if (inString) {+ if (escaped) escaped = false;+ else if (ch === "\\") escaped = true;+ else if (ch === '"') inString = false;+ continue;+ }+ if (ch === '"') {+ inString = true;+ continue;+ }+ if (ch === "{") {+ if (depth === 0) from = i;+ depth += 1;+ } else if (ch === "}") {+ depth -= 1;+ if (depth === 0 && from >= 0) {+ try {+ replies.push(JSON.parse(text.slice(from, i + 1)));+ } catch {+ }+ from = -1;+ }+ } else if (ch === "]" && depth === 0) break;+ }+ }function GroupReplies({ sessionId, callId, done, content, roster, actions, useUi, useWork }) {- const [live, setLive] = (0, import_react12.useState)({ replies: [], speaking: null });- (0, import_react12.useEffect)(() => {+ const [live, setLive] = (0, import_react13.useState)({ replies: [], speaking: null });+ (0, import_react13.useEffect)(() => {if (done) return void 0;let stop = false;let timer;@@@ -8041,9 -7892,11 +8090,11 @@@const pending = done || !live.speaking ? [] : [live.speaking];const speakerTool = useWork?.((work) => work.bots?.[live.speaking]?.tool) ?? void 0;const speakerDoing = useWork?.((work) => work.bots?.[live.speaking]?.tool ? workPhrase(work.bots[live.speaking]) : void 0) ?? void 0;- if (replies.length === 0 && pending.length === 0) return null;+ if (replies.length === 0 && pending.length === 0) {+ return broken ? (0, import_react12.createElement)("div", { className: "bt-group-replies" }, (0, import_react12.createElement)("div", { className: "bt-event" }, t("The group replies could not be shown"))) : null;+ }const room2 = roster.roomsById[sessionId];- return (0, import_react12.createElement)(+ return (0, import_react13.createElement)("div",{ className: "bt-group-replies" },stackReplies(replies).map(({ reply, index, texts: texts2, time, duration }) => {