Skip to content

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

Surface a failed engine start instead of an endless setup spinner

Fei24119640e9c39e7a
diff --git a/app/src/host.mjs b/app/src/host.mjs
index 6b641f94..cf46cd96 100644
--- a/app/src/host.mjs
+++ b/app/src/host.mjs
@@ -58,6 +58,11 @@ async function main() {
const [webServer, connection] = [ctx.get('webServer'), ctx.get('connection')]
// A profile patch can turn these rows off; then the window has nothing to talk to.
if (webServer === undefined || connection === undefined) throw new Error(`The profile in ${profile.dir} does not start the engine's web server and connection.`)
+ // ds-bot waits on these before it registers its API. A Session-store failure
+ // must reach the shell's error box here, not read as an endless
+ // "Setting up your Main Bot…" in a window that looks ready (#516).
+ const missing = ['sessionController', 'workspaceRegistry'].filter(name => ctx.get(name) === undefined)
+ if (missing.length > 0) throw new Error(`The profile in ${profile.dir} did not start ${missing.join(', ')}; the engine log has the cause.`)
const url = connection.authenticatedUrl(`http://127.0.0.1:${String(webServer.port)}`)
await send({ type: 'ready', url, injections: webServer.collectIndexInjections() })
}
diff --git a/ds-bot/client.js b/ds-bot/client.js
index cc54a653..db0d318b 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -96,6 +96,7 @@ var ZH = {
// Sidebar and account menu
"Bot list": "Bot 列表",
"Setting up your Main Bot…": "正在设置你的主 Bot…",
+ "The Bot team could not start. Settings → Feedback has the details.": "Bot 团队启动失败,详情见「设置 → 反馈」。",
"Automation tasks": "自动化任务",
Connectors: "连接器",
"Search connectors": "搜索连接器",
@@ -9700,7 +9701,7 @@ function TeamSidebar(props) {
{ className: "bt-rail-top" },
(0, import_react18.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),
(0, import_react18.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: onToggle }, (0, import_react18.createElement)(SidebarIcon)),
- main ? (0, import_react18.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react18.createElement)("div", { className: "bt-hint" }, t("Setting up your Main Bot…")),
+ main ? (0, import_react18.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react18.createElement)("div", { className: "bt-hint" }, t(uiNow.bootFailed ? "The Bot team could not start. Settings → Feedback has the details." : "Setting up your Main Bot…")),
(0, import_react18.createElement)("span", { className: "bt-rail-sep", "aria-hidden": true })
);
const foot = wideContent ? (0, import_react18.createElement)("div", { className: "bt-leftcol-foot" }, (0, import_react18.createElement)(AccountLauncher, { seat: false, actions })) : (0, import_react18.createElement)(
@@ -9717,7 +9718,7 @@ function TeamSidebar(props) {
(0, import_react18.createElement)(
"div",
{ ref: listRef, className: "bt-list", role: "region", "aria-label": t("Bot list") },
- wideContent ? main ? (0, import_react18.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react18.createElement)("div", { className: "bt-hint" }, t("Setting up your Main Bot…")) : null,
+ wideContent ? main ? (0, import_react18.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react18.createElement)("div", { className: "bt-hint" }, t(uiNow.bootFailed ? "The Bot team could not start. Settings → Feedback has the details." : "Setting up your Main Bot…")) : null,
order.map((entry) => entry.kind === "bot" ? (0, import_react18.createElement)(BotRow, { key: entry.item.id, ...rowProps, bot: entry.item, marked: markedUnread[entry.item.id] === true }) : entry.kind === "room" ? (0, import_react18.createElement)(RoomRow, { key: entry.item.id, ...rowProps, room: entry.item, marked: markedUnread[entry.item.id] === true }) : (0, import_react18.createElement)(AgentRow, { key: entry.item.id, ...rowProps, agent: entry.item, marked: markedUnread[entry.item.id] === true }))
),
foot
@@ -20281,7 +20282,7 @@ function apply(ctx) {
const reactionStore = sharedMap(STORAGE.reactions);
const seenStore = sharedMap(STORAGE.seen);
let seenAt = seenStore.read();
- const ui2 = createSource({ details: null, view: "details", renaming: false, tab: null, side: null, newChat: null, exchange: null, menu: null, voice: null, palette: null, quote: null, settings: null, memory: null, toast: null, signIn: null, renameAgent: null, unread: unreadStore.read(), reactions: reactionStore.read(), visits: {}, panelYield: false, leftDrawer: false });
+ const ui2 = createSource({ details: null, view: "details", renaming: false, tab: null, side: null, newChat: null, exchange: null, menu: null, voice: null, palette: null, quote: null, settings: null, memory: null, toast: null, signIn: null, renameAgent: null, unread: unreadStore.read(), reactions: reactionStore.read(), visits: {}, panelYield: false, leftDrawer: false, bootFailed: false });
let sidebarSaved = readSidebar();
const sidebarPref = createSource(sidebarSaved.pref);
const frame = createSource({ viewport: typeof window === "undefined" ? 0 : window.innerWidth, sidebarWidth: sidebarSaved.width, collapsedWidth: 0, collapsed: false });
@@ -20404,14 +20405,20 @@ function apply(ctx) {
let stopped = false;
let running = false;
let timer;
+ let misses = 0;
const loop = async () => {
clearTimeout(timer);
if (running || stopped) return;
running = true;
try {
await pull();
+ misses = 0;
} catch (error) {
- if (!stopped) console.warn("[ds-bot] state", error);
+ if (!stopped) {
+ console.warn("[ds-bot] state", error);
+ misses += 1;
+ if (misses >= 10 && !roster.getSnapshot().ready) ui2.set((state) => state.bootFailed ? state : { ...state, bootFailed: true });
+ }
} finally {
running = false;
}
diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.js
index 06962367..81086ea9 100644
--- a/ds-bot/src/client/i18n.js
+++ b/ds-bot/src/client/i18n.js
@@ -60,6 +60,7 @@ const ZH = {
// Sidebar and account menu
'Bot list': 'Bot 列表',
'Setting up your Main Bot…': '正在设置你的主 Bot…',
+ 'The Bot team could not start. Settings → Feedback has the details.': 'Bot 团队启动失败,详情见「设置 → 反馈」。',
'Automation tasks': '自动化任务',
Connectors: '连接器',
'Search connectors': '搜索连接器',
diff --git a/ds-bot/src/client/index.js b/ds-bot/src/client/index.js
index 31f66057..70d2396e 100644
--- a/ds-bot/src/client/index.js
+++ b/ds-bot/src/client/index.js
@@ -60,7 +60,7 @@ export function apply(ctx) {
let seenAt = seenStore.read()
// `details` is the panel's subject (a Session id); `view` picks details or the
// subject Bot's browser inside it.
- const ui = createSource({ details: null, view: 'details', renaming: false, tab: null, side: null, newChat: null, exchange: null, menu: null, voice: null, palette: null, quote: null, settings: null, memory: null, toast: null, signIn: null, renameAgent: null, unread: unreadStore.read(), reactions: reactionStore.read(), visits: {}, panelYield: false, leftDrawer: false })
+ const ui = createSource({ details: null, view: 'details', renaming: false, tab: null, side: null, newChat: null, exchange: null, menu: null, voice: null, palette: null, quote: null, settings: null, memory: null, toast: null, signIn: null, renameAgent: null, unread: unreadStore.read(), reactions: reactionStore.read(), visits: {}, panelYield: false, leftDrawer: false, bootFailed: false })
// The left column's kept preference, and the frame geometry the layout rules
// in frame-layout.js read: the window and the shell's collapsed track come from
// installFrameWatch, the open column's width is the user's own.
@@ -197,11 +197,24 @@ export function apply(ctx) {
let stopped = false
let running = false
let timer
+ let misses = 0
const loop = async () => {
clearTimeout(timer)
if (running || stopped) return
running = true
- try { await pull() } catch (error) { if (!stopped) console.warn('[ds-bot] state', error) } finally { running = false }
+ try {
+ await pull()
+ misses = 0
+ } catch (error) {
+ if (!stopped) {
+ console.warn('[ds-bot] state', error)
+ // The Bot API never comes up when the host plugin did not activate
+ // (e.g. the Session store failed); "Setting up your Main Bot…" alone
+ // would spin forever, so the sidebar says the start-up failed (#516).
+ misses += 1
+ if (misses >= 10 && !roster.getSnapshot().ready) ui.set(state => (state.bootFailed ? state : { ...state, bootFailed: true }))
+ }
+ } finally { running = false }
if (!stopped) timer = setTimeout(loop, document.hidden ? 10000 : 1500)
}
const wake = () => { if (!document.hidden) void loop() }
diff --git a/ds-bot/src/client/sidebar.js b/ds-bot/src/client/sidebar.js
index b8f0a61e..00e0bd3a 100644
--- a/ds-bot/src/client/sidebar.js
+++ b/ds-bot/src/client/sidebar.js
@@ -483,7 +483,7 @@ export function TeamSidebar(props) {
: h('div', { className: 'bt-rail-top' },
h(UpdateButton, { useUpdate: props.useUpdate, actions }),
h('button', { type: 'button', className: 'bt-round bt-side-collapse', 'aria-label': t('Collapse sidebar'), title: t('Collapse sidebar'), onClick: onToggle }, h(SidebarIcon)),
- main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, t('Setting up your Main Bot…')),
+ main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, t(uiNow.bootFailed ? 'The Bot team could not start. Settings → Feedback has the details.' : 'Setting up your Main Bot…')),
h('span', { className: 'bt-rail-sep', 'aria-hidden': true }))
// The foot stands in for the shell's hidden footer: the account avatar, and on
// the rail the new-chat button above it.
@@ -496,7 +496,7 @@ export function TeamSidebar(props) {
top,
wideContent && roster.readOnly ? h('div', { className: 'bt-hint bt-read-only', role: 'status' }, hostText(roster.readOnly)) : null,
h('div', { ref: listRef, className: 'bt-list', role: 'region', 'aria-label': t('Bot list') },
- wideContent ? (main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, t('Setting up your Main Bot…'))) : null,
+ wideContent ? (main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, t(uiNow.bootFailed ? 'The Bot team could not start. Settings → Feedback has the details.' : 'Setting up your Main Bot…'))) : null,
order.map(entry => (entry.kind === 'bot'
? h(BotRow, { key: entry.item.id, ...rowProps, bot: entry.item, marked: markedUnread[entry.item.id] === true })
: entry.kind === 'room'