Skip to content

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

Merge remote-tracking branch 'origin/dev' into feat/791-group-goal

Fei241185a5b5ab9731
diff --cc ds-bot/client.js
index af70fbce,60a460f4..1dcae995
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@@ -4526,15 -4005,30 +4527,30 @@@ function CellEmpty({ className })
sync(marker);
};
}, []);
- return (0, import_react4.createElement)("span", { ref, className, hidden: true, "data-bt-empty": true });
+ return (0, import_react6.createElement)("span", { ref, className, hidden: true, "data-bt-empty": true });
}
+ // src/client/enter-key.js
+ var sendsOnEnter = (prefs) => prefs?.enterToSend !== false;
+ function insertComposerNewline(event, inputActions) {
+ if (event.key !== "Enter" || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey || event.isComposing || event.keyCode === 229 || event.getModifierState?.("AltGraph")) return false;
+ const target = event.target;
+ if (typeof target?.closest !== "function" || !target.closest('[data-composer-card] [role="textbox"]')) return false;
+ if (target.closest("[data-composer-composing]")) return false;
+ if (target.ownerDocument?.querySelector('[role="listbox"]')) return false;
+ if (typeof inputActions?.captureInsertion !== "function" || typeof inputActions?.insertText !== "function") return false;
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ inputActions.insertText("\n", inputActions.captureInsertion());
+ return true;
+ }
+
// src/client/card-hold.js
-var import_react5 = require("react");
+var import_react7 = require("react");
function useDockHold(sessionId, kind, requestId, actions, inline) {
- const release = (0, import_react5.useRef)(null);
+ const release = (0, import_react7.useRef)(null);
const note = actions.noteHeldCard;
- (0, import_react5.useLayoutEffect)(() => () => {
+ (0, import_react7.useLayoutEffect)(() => () => {
const stop = release.current;
release.current = null;
stop?.();
@@@ -4581,11 -4075,11 +4597,11 @@@ function useOptionKeys(count, onPick, o
}, [count, ownRef]);
return count > 0 && listening <= 1;
}
- function QuestionView({ question, onAnswer, onDismiss, onInteract, busy = false, ownAnswer = false, raised = false }) {
+ function QuestionView({ question, onAnswer, onDismiss, onInteract, busy = false, ownAnswer = false, raised = false, enterToSend = true }) {
- const [own, setOwn] = (0, import_react6.useState)("");
- const [picked, setPicked] = (0, import_react6.useState)([]);
- const ownRef = (0, import_react6.useRef)(null);
- const titleId = (0, import_react6.useId)();
+ const [own, setOwn] = (0, import_react8.useState)("");
+ const [picked, setPicked] = (0, import_react8.useState)([]);
+ const ownRef = (0, import_react8.useRef)(null);
+ const titleId = (0, import_react8.useId)();
const options = optionsOf(question);
const multi = question.multiSelect === true;
const custom = own.trim();
@@@ -4754,14 -4248,14 +4770,14 @@@ function QuestionCard({ matched })
}
pending.answer({ answers: next });
};
- return (0, import_react6.createElement)(QuestionView, { key: index, question, onAnswer, onDismiss: () => pending.dismiss(), ownAnswer: true, raised: true });
+ return (0, import_react8.createElement)(QuestionView, { key: index, question, onAnswer, onDismiss: () => pending.dismiss(), ownAnswer: true, raised: true });
}
- function PendingQuestion({ sessionId, question, actions, inline }) {
+ function PendingQuestion({ sessionId, question, actions, inline, enterToSend = true }) {
- const [answered, setAnswered] = (0, import_react6.useState)(null);
- const [busy, setBusy] = (0, import_react6.useState)(false);
- const busyRef = (0, import_react6.useRef)(false);
+ const [answered, setAnswered] = (0, import_react8.useState)(null);
+ const [busy, setBusy] = (0, import_react8.useState)(false);
+ const busyRef = (0, import_react8.useRef)(false);
const hold = useDockHold(sessionId, "question", question.id, actions, inline);
- if (answered === question.id) return (0, import_react6.createElement)(CellEmpty);
+ if (answered === question.id) return (0, import_react8.createElement)(CellEmpty);
const run2 = (make) => {
if (busyRef.current) return;
hold();
@@@ -4774,10 -4268,10 +4790,10 @@@
};
const onAnswer = (answer) => run2(() => actions.answerQuestion(sessionId, question.id, { selected: answer.selected ?? [], custom: answer.custom ?? "" }));
const onDismiss = () => run2(() => actions.dismissQuestion(sessionId));
- return (0, import_react6.createElement)(
+ return (0, import_react8.createElement)(
"div",
{ className: inline ? "bt-q-inline" : "bt-q-dock" },
- (0, import_react8.createElement)(QuestionView, { key: question.id, question, onAnswer, onDismiss, onInteract: hold, busy, ownAnswer: question.allowCustom === true, raised: !inline })
- (0, import_react6.createElement)(QuestionView, { key: question.id, question, onAnswer, onDismiss, onInteract: hold, busy, ownAnswer: question.allowCustom === true, raised: !inline, enterToSend })
++ (0, import_react8.createElement)(QuestionView, { key: question.id, question, onAnswer, onDismiss, onInteract: hold, busy, ownAnswer: question.allowCustom === true, raised: !inline, enterToSend })
);
}
function QuestionDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {
@@@ -4785,7 -4280,7 +4802,7 @@@
const drawn = useCards?.((state) => state[sessionId]?.[question?.callId] > 0) === true;
const held = useHeldCards?.((state) => state[sessionId]?.[heldCardKey("question", question?.id)] > 0) === true;
if (question === void 0 || question.callId && drawn && !held) return null;
- return (0, import_react8.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false });
- return (0, import_react6.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false, enterToSend });
++ return (0, import_react8.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false, enterToSend });
}
function AnsweredCell({ node }) {
const data = node.data ?? {};
@@@ -9474,18 -8961,18 +9491,18 @@@ function renderCall(call2, { sessionId
}
case "ask_user": {
const question = roster.questions?.[sessionId];
- if (!question || question.callId !== call2.callId) return (0, import_react17.createElement)(CellEmpty, { className: "bt-q-gone" });
- if (heldCards?.[heldCardKey("question", question.id)] > 0) return (0, import_react17.createElement)(CellEmpty);
- return (0, import_react17.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: true, enterToSend: sendsOnEnter(roster.prefs) });
+ if (!question || question.callId !== call2.callId) return (0, import_react19.createElement)(CellEmpty, { className: "bt-q-gone" });
+ if (heldCards?.[heldCardKey("question", question.id)] > 0) return (0, import_react19.createElement)(CellEmpty);
- return (0, import_react19.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: true });
++ return (0, import_react19.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: true, enterToSend: sendsOnEnter(roster.prefs) });
}
case "show_view":
- return (0, import_react17.createElement)(WidgetCell, { sessionId, callId: call2.callId, args: { text: arg, value: argValue }, done, isError: call2.isError, roster, actions, heldCards });
+ return (0, import_react19.createElement)(WidgetCell, { sessionId, callId: call2.callId, args: { text: arg, value: argValue }, done, isError: call2.isError, roster, actions, heldCards });
case "request_secret":
- return (0, import_react17.createElement)(SecretToolCell, { sessionId, callId: call2.callId, name: arg("name"), done, content: call2.content, roster, actions, heldCards });
+ return (0, import_react19.createElement)(SecretToolCell, { sessionId, callId: call2.callId, name: arg("name"), done, content: call2.content, roster, actions, heldCards });
case "browser_handoff":
- return (0, import_react17.createElement)(HandoffCall, { sessionId, callId: call2.callId, roster, actions, heldCards, hooks });
+ return (0, import_react19.createElement)(HandoffCall, { sessionId, callId: call2.callId, roster, actions, heldCards, hooks });
case "ask_user_question": {
- if (!done) return (0, import_react17.createElement)(CellEmpty);
+ if (!done) return (0, import_react19.createElement)(CellEmpty);
let parsed = null;
try {
parsed = JSON.parse(contentText(call2.content));
@@@ -11310,7 -10775,16 +11327,16 @@@ function useDictation(onText)
const stop = () => recognition.current?.stop();
return { listening, note, start, stop };
}
- function ComposerVoice({ sessionId, inputActions, actions, useUi }) {
+ function ComposerVoice({ sessionId, inputActions, actions, useUi, useRoster }) {
+ const enterToSend = useRoster((state) => sendsOnEnter(state.prefs));
- const composerRoot = (0, import_react21.useRef)(null);
- (0, import_react21.useEffect)(() => {
++ const composerRoot = (0, import_react23.useRef)(null);
++ (0, import_react23.useEffect)(() => {
+ const root = composerRoot.current?.closest("[data-composer-card]");
+ if (enterToSend || !inputActions || !root) return void 0;
+ const onKey = (event) => insertComposerNewline(event, inputActions);
+ root.addEventListener("keydown", onKey, true);
+ return () => root.removeEventListener("keydown", onKey, true);
+ }, [enterToSend, inputActions]);
const dictation = useDictation((text, final) => {
if (final && inputActions) inputActions.insertText(text, inputActions.captureInsertion());
});
@@@ -11344,8 -10818,9 +11370,9 @@@
title: dictation.listening ? t("Stop dictation") : t("Dictate"),
onMouseDown: keepComposerFocus,
onClick: () => dictation.listening ? dictation.stop() : dictation.start()
- }, (0, import_react21.createElement)(MicIcon)),
- (0, import_react21.createElement)("button", {
+ }, (0, import_react23.createElement)(MicIcon)),
+ (0, import_react23.createElement)("button", {
+ ref: composerRoot,
type: "button",
className: "bt-voice",
"aria-label": t("Start voice chat"),
@@@ -11712,10 -11181,10 +11739,10 @@@ function SideEntry({ chatId, entry, act
)
);
}
- function SideChatView({ subject, chat, actions }) {
+ function SideChatView({ subject, chat, roster, actions }) {
- const scroll = (0, import_react22.useRef)(null);
- const [draft, setDraft] = (0, import_react22.useState)("");
- const [fail2, setFail] = (0, import_react22.useState)(null);
+ const scroll = (0, import_react24.useRef)(null);
+ const [draft, setDraft] = (0, import_react24.useState)("");
+ const [fail2, setFail] = (0, import_react24.useState)(null);
const entries2 = Array.isArray(chat?.entries) ? chat.entries : [];
const busy = entries2.some((entry) => entry?.status === "answering");
const last = entries2.at(-1);
@@@ -11763,7 -11232,15 +11790,15 @@@
ask();
}
}),
+ // With Enter sending off this is the only way to ask; on, it sends the same.
- (0, import_react22.createElement)("button", {
++ (0, import_react24.createElement)("button", {
+ type: "button",
+ className: "bt-side-send",
+ "aria-label": t("Send message"),
+ disabled: busy || draft.trim() === "" || typeof actions?.askSide !== "function",
+ onClick: ask
- }, (0, import_react22.createElement)(ArrowUpIcon)),
- fail2 !== null ? (0, import_react22.createElement)("p", { className: "bt-side-fail" }, fail2) : null
++ }, (0, import_react24.createElement)(ArrowUpIcon)),
+ fail2 !== null ? (0, import_react24.createElement)("p", { className: "bt-side-fail" }, fail2) : null
)
);
}
@@@ -17601,19 -17108,28 +17639,28 @@@ function GeneralPage({ roster, actions
withEfforts: false,
onPick: (ref) => run2(actions.setPrefs({ defaultBotModel: ref }))
}),
- prefs.defaultBotModel ? (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setPrefs({ defaultBotModel: null })) }, t("Reset")) : null
+ prefs.defaultBotModel ? (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setPrefs({ defaultBotModel: null })) }, t("Reset")) : null
)
),
- (0, import_react45.createElement)(
++ (0, import_react46.createElement)(
+ SetSection,
+ { key: "input", title: t("Input") },
- (0, import_react45.createElement)(
++ (0, import_react46.createElement)(
+ SetRow,
+ { label: t("Enter sends message") },
- (0, import_react45.createElement)(Switch, { label: t("Enter sends message"), on: prefs.enterToSend !== false, onChange: (enterToSend) => run2(actions.setPrefs({ enterToSend })) })
++ (0, import_react46.createElement)(Switch, { label: t("Enter sends message"), on: prefs.enterToSend !== false, onChange: (enterToSend) => run2(actions.setPrefs({ enterToSend })) })
+ )
+ ),
- actions.setSurface ? (0, import_react45.createElement)(
+ actions.setSurface ? (0, import_react46.createElement)(
SetSection,
{ key: "mode", title: t("Mode") },
- (0, import_react45.createElement)(
+ (0, import_react46.createElement)(
SetRow,
{ label: t("Classic Agent mode") },
- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))
+ (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))
)
) : null,
- (0, import_react45.createElement)(LocationsSection, { key: "places", actions, run: run2 })
+ (0, import_react46.createElement)(LocationsSection, { key: "places", actions, run: run2 })
];
}
function LocationsSection({ actions, run: run2 }) {
@@@ -19498,15 -18987,15 +19545,15 @@@ function BotPanel({ pane, leaving, room
if (event.target === event.currentTarget) setLanded(true);
}
},
- leaving || overlay ? null : (0, import_react49.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),
+ leaving || overlay ? null : (0, import_react50.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),
// Over the whole window while dragging: the cursor stays a resize cursor and the
// pages underneath (the chat, the guest) see no pointer.
- dragging ? (0, import_react_dom8.createPortal)((0, import_react49.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,
- hasStrip ? (0, import_react49.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,
- view === "browser" && bot ? (0, import_react49.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react49.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react49.createElement)(SideChatView, { subject: pane.id, chat: sideChat, roster, actions: panelActions })) : (0, import_react49.createElement)(
+ dragging ? (0, import_react_dom8.createPortal)((0, import_react50.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,
+ hasStrip ? (0, import_react50.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,
- view === "browser" && bot ? (0, import_react50.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react50.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react50.createElement)(SideChatView, { subject: pane.id, chat: sideChat, actions: panelActions })) : (0, import_react50.createElement)(
++ view === "browser" && bot ? (0, import_react50.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react50.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react50.createElement)(SideChatView, { subject: pane.id, chat: sideChat, roster, actions: panelActions })) : (0, import_react50.createElement)(
"div",
{ key: `details:${pane.id}:${pane.renaming ? "rename" : ""}:${pane.tab ?? ""}`, className: "bt-panel-view" },
- (0, import_react49.createElement)(DetailsDrawer, {
+ (0, import_react50.createElement)(DetailsDrawer, {
sessionId: pane.id,
startRenaming: pane.renaming,
startTab: pane.tab,
diff --cc ds-bot/src/client/cells.js
index 7dace00e,84c288a0..24c037b4
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@@ -3,10 -3,10 +3,11 @@@ import { createPortal } from 'react-dom
import { MarkdownText, writeClipboard } from './dsh-primitives.js'
import { inkText } from './inks.js'
import { linkMentions, mentionTarget, dayLabel, contentText, stripHeader, isHiddenTurn, isRelayContext, relaysBefore, relayPart, commRunOf, toolName, toolArgs, reminderPrompts, elapsedLabel, clockLabel, messageClock } from './text.js'
-import { SmileIcon, ReplyIcon, DotsIcon, CheckIcon, DownloadIcon, CopyIcon, MemoryIcon } from './icons.js'
+import { SmileIcon, ReplyIcon, DotsIcon, CheckIcon, DownloadIcon, CopyIcon, GoalIcon, MemoryIcon } from './icons.js'
+import { goalEventText } from './goal.js'
import { colorOf, toolState, BotMark, RoomAvatar } from './mark.js'
import { CellEmpty } from './cell-empty.js'
+ import { sendsOnEnter } from './enter-key.js'
import { SettledQuestion, PendingQuestion } from './questions.js'
import { AnsweredReply, WidgetCell } from './widget-cell.js'
import { SecretToolCell } from './secret-card.js'