A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Offer DSH's own settings only where a window has them
Fei24116a14541c5122
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 24d8d1c0..6146e85c 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -6949,11 +6949,11 @@ function ModelMenu({ bot, roster, actions, run, wide = false, onPick, onPickEffo{ ref: menu, className: `bt-menu bt-model-menu${shownPlace.bottom !== void 0 ? " bt-menu-up" : ""}`, role: "menu", "aria-label": t("Model for {name}", { name: bot.name }), style: shownPlace, "data-leaving": leaving || void 0 },models.length > 0 ? (0, import_react14.createElement)(ModelRows, { roster, current, onPick: pick2 }) : (0, import_react14.createElement)("div", { className: "bt-model-none" }, t("No models are set up in DeepSeek Harness yet.")),effortRows(reasoning).length > 0 ? (0, import_react14.createElement)(EffortRows, { reasoning, current: picked, onPick: pickEffort }) : null,- (0, import_react14.createElement)("div", { className: "bt-menu-sep", role: "separator" }),- (0, import_react14.createElement)("button", { type: "button", role: "menuitem", onClick: () => {+ actions.openHarnessSettings ? (0, import_react14.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,+ actions.openHarnessSettings ? (0, import_react14.createElement)("button", { type: "button", role: "menuitem", onClick: () => {close();- openHarnessSettings();- } }, (0, import_react14.createElement)(SlidersIcon), (0, import_react14.createElement)("span", { className: "bt-menu-label" }, t("Models and providers…")))+ actions.openHarnessSettings();+ } }, (0, import_react14.createElement)(SlidersIcon), (0, import_react14.createElement)("span", { className: "bt-menu-label" }, t("Models and providers…"))) : null), document.body) : null);}@@ -6995,7 +6995,7 @@ function ModelChoiceDock({ sessionId, useRoster, actions }) {onClick: () => pick2(model.ref)}, model.name, busy === model.ref ? (0, import_react14.createElement)("span", { className: "bt-model-spin", "aria-label": t("Saving…") }) : null))))),- (0, import_react14.createElement)("button", { key: "manage", type: "button", className: "bt-model-chip bt-model-chip-quiet", onClick: openHarnessSettings }, (0, import_react14.createElement)(SlidersIcon), t("Manage models"))+ actions.openHarnessSettings ? (0, import_react14.createElement)("button", { key: "manage", type: "button", className: "bt-model-chip bt-model-chip-quiet", onClick: actions.openHarnessSettings }, (0, import_react14.createElement)(SlidersIcon), t("Manage models")) : null];return (0, import_react14.createElement)("div",@@ -7021,8 +7021,8 @@ function ModelChoiceDock({ sessionId, useRoster, actions }) {function setupChoices(actions) {return [actions.canSignIn?.() ? [t("Sign in to DeepSeek"), () => actions.signIn()] : null,- [t("Enter a DeepSeek API key"), () => openHarnessOnboarding("deepseek-official")],- [t("Open settings to set up a custom model"), openHarnessSettings]+ actions.openHarnessOnboarding ? [t("Enter a DeepSeek API key"), () => actions.openHarnessOnboarding("deepseek-official")] : null,+ actions.openHarnessSettings ? [t("Open settings to set up a custom model"), actions.openHarnessSettings] : null].filter(Boolean);}function DeepSeekSignIn({ useUi, actions }) {@@ -7043,7 +7043,7 @@ function SignInHost({ entry, actions }) {complete: close,useApiKey: () => {close();- openHarnessOnboarding("deepseek-official");+ actions.openHarnessOnboarding("deepseek-official");}});}@@ -7455,21 +7455,21 @@ function TaskForm({ roster, actions, start, onDone, onCancel }) {));}-function AutomationOff() {+function AutomationOff({ actions }) {return (0, import_react16.createElement)("div",{ className: "bt-set-card bt-task-off" },(0, import_react16.createElement)("span", { className: "bt-task-off-mark" }, (0, import_react16.createElement)(ClockIcon)),(0, import_react16.createElement)("span", { className: "bt-task-off-title" }, t("Turn on Automation tasks in DSH")),(0, import_react16.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings.")),- (0, import_react16.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: openHarnessSettings }, t("Open Harness settings"))+ actions.openHarnessSettings ? (0, import_react16.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null);}function SchedulesPage({ roster, actions, start }) {const view = useSchedules(actions);const [adding, setAdding] = (0, import_react16.useState)(Boolean(start));if (view === null) return (0, import_react16.createElement)("div", { className: "bt-set-hint" }, t("Loading…"));- if (!view.available) return (0, import_react16.createElement)(AutomationOff);+ if (!view.available) return (0, import_react16.createElement)(AutomationOff, { actions });const shown = (next) => {publish(next);setAdding(false);@@ -7503,7 +7503,7 @@ function BotSchedules({ bot, roster, actions }) {"div",{ className: "bt-set-row bt-bs-row" },(0, import_react16.createElement)("span", { className: "bt-set-copy" }, (0, import_react16.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings."))),- (0, import_react16.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: openHarnessSettings }, t("Open Harness settings"))+ actions.openHarnessSettings ? (0, import_react16.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null) : [...tasks.map((task) => (0, import_react16.createElement)(TaskRow, { key: task.id, task, actions, roster, onView: publish })),(0, import_react16.createElement)("button", { key: "new", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => actions.openSettings("schedules", bot.id) }, (0, import_react16.createElement)(PlusIcon), t("New task"))@@ -11107,7 +11107,7 @@ function GeneralPage({ roster, actions, run }) {))),- (0, import_react30.createElement)(+ actions.setSurface ? (0, import_react30.createElement)(SetSection,{ key: "mode", title: t("Mode") },(0, import_react30.createElement)(@@ -11115,7 +11115,7 @@ function GeneralPage({ roster, actions, run }) {{ label: t("Classic Agent mode") },(0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch")))- )+ ) : null];}function MainBotsSection({ roster, actions, run }) {@@ -11284,15 +11284,15 @@ function SettingsDialog({ page, id, roster, actions, useUpdate, leaving = false"aria-current": shown === key ? "page" : void 0,onClick: () => actions.openSettings(key)}, (0, import_react30.createElement)(PAGE_ICONS[key]), t(text))),- (0, import_react30.createElement)("button", {+ actions.openHarnessSettings ? (0, import_react30.createElement)("button", {type: "button",className: "bt-settings-item bt-settings-shell",title: t("Models, providers, and the rest of DeepSeek Harness"),onClick: () => {close();- openHarnessSettings();+ actions.openHarnessSettings();}- }, (0, import_react30.createElement)(SlidersIcon), t("Harness settings"))+ }, (0, import_react30.createElement)(SlidersIcon), t("Harness settings")) : null),(0, import_react30.createElement)("div",@@ -14282,6 +14282,8 @@ function apply(ctx) {actions.closeSignIn = () => ui2.set((state) => ({ ...state, signIn: null }));actions.accountT = () => ctx.get("locale").bind("settings.account");actions.speech = () => ctx.get("remote.speech") ?? void 0;+ actions.openHarnessSettings = openHarnessSettings;+ actions.openHarnessOnboarding = openHarnessOnboarding;actions.voiceSetup = () => {const navigation = ctx.get("pluginNavigation");return navigation ? () => navigation.openBundle(VOICE_BUNDLE) : null;diff --git a/ds-bot/src/client/index.js b/ds-bot/src/client/index.jsindex 8e3d404d..68081c62 100644--- a/ds-bot/src/client/index.js+++ b/ds-bot/src/client/index.js@@ -7,7 +7,7 @@ import { themeCss, shellTokens, registry, registerShape, registerTheme, allThemeimport { MENTION_ORIGIN, currentPart } from './text.js'import { SHELL_CSS, CONVERSATION_CSS, installStyles, installCompiledStyles } from './styles.js'import { lookOf } from './mark.js'-import { TeamSidebar, ConnectPlugins, YouAvatar, AccountLauncher, FooterAccount, BrandMark, BrandName, BotReturn, SIDEBAR_CSS, RETURN_CSS, holdShellShortcuts } from './sidebar.js'+import { TeamSidebar, ConnectPlugins, YouAvatar, AccountLauncher, FooterAccount, BrandMark, BrandName, BotReturn, SIDEBAR_CSS, RETURN_CSS, holdShellShortcuts, openHarnessOnboarding, openHarnessSettings } from './sidebar.js'import { HeaderPill } from './header.js'import { ComposerPlus, ComposerVoice, menuIcons } from './composer.js'import { CHATS_SOURCE, atSources } from './at-menu.js'@@ -529,6 +529,9 @@ export function apply(ctx) {actions.accountT = () => ctx.get('locale').bind('settings.account')// The Voice Input plugin's speech Remote; absent while that plugin is off.actions.speech = () => ctx.get('remote.speech') ?? undefined+ // DSH's own settings: models, providers, keys and its plugins.+ actions.openHarnessSettings = openHarnessSettings+ actions.openHarnessOnboarding = openHarnessOnboardingactions.voiceSetup = () => {const navigation = ctx.get('pluginNavigation')return navigation ? () => navigation.openBundle(VOICE_BUNDLE) : nulldiff --git a/ds-bot/src/client/model-menu.js b/ds-bot/src/client/model-menu.jsindex e2e149a0..642b5324 100644--- a/ds-bot/src/client/model-menu.js+++ b/ds-bot/src/client/model-menu.js@@ -3,7 +3,6 @@ import { createPortal } from 'react-dom'import { currentPart } from './text.js'import { CheckIcon, SlidersIcon } from './icons.js'import { BotMark } from './mark.js'-import { openHarnessOnboarding, openHarnessSettings } from './sidebar.js'import { SPRING_POP, SPRING_SHAPE, spring, useLinger } from './motion.js'import { t } from './i18n.js'@@ -183,8 +182,8 @@ export function ModelMenu({ bot, roster, actions, run, wide = false, onPick, onPmodels.length > 0 ? h(ModelRows, { roster, current, onPick: pick }): h('div', { className: 'bt-model-none' }, t('No models are set up in DeepSeek Harness yet.')),effortRows(reasoning).length > 0 ? h(EffortRows, { reasoning, current: picked, onPick: pickEffort }) : null,- h('div', { className: 'bt-menu-sep', role: 'separator' }),- h('button', { type: 'button', role: 'menuitem', onClick: () => { close(); openHarnessSettings() } }, h(SlidersIcon), h('span', { className: 'bt-menu-label' }, t('Models and providers…')))), document.body) : null)+ actions.openHarnessSettings ? h('div', { className: 'bt-menu-sep', role: 'separator' }) : null,+ actions.openHarnessSettings ? h('button', { type: 'button', role: 'menuitem', onClick: () => { close(); actions.openHarnessSettings() } }, h(SlidersIcon), h('span', { className: 'bt-menu-label' }, t('Models and providers…'))) : null), document.body) : null)}// The card a Bot's chat opens on while the Bot has no model, or has one that is no@@ -225,7 +224,7 @@ export function ModelChoiceDock({ sessionId, useRoster, actions }) {title: model.ref === roster.defaultModel ? `${model.ref} · ${t('Harness default')}` : model.ref,onClick: () => pick(model.ref),}, model.name, busy === model.ref ? h('span', { className: 'bt-model-spin', 'aria-label': t('Saving…') }) : null))))),- h('button', { key: 'manage', type: 'button', className: 'bt-model-chip bt-model-chip-quiet', onClick: openHarnessSettings }, h(SlidersIcon), t('Manage models')),+ actions.openHarnessSettings ? h('button', { key: 'manage', type: 'button', className: 'bt-model-chip bt-model-chip-quiet', onClick: actions.openHarnessSettings }, h(SlidersIcon), t('Manage models')) : null,]return h('div', { className: 'bt-model-dock' },h('div', { className: 'bt-astack', 'data-lead': '' },@@ -243,8 +242,8 @@ export function ModelChoiceDock({ sessionId, useRoster, actions }) {function setupChoices(actions) {return [actions.canSignIn?.() ? [t('Sign in to DeepSeek'), () => actions.signIn()] : null,- [t('Enter a DeepSeek API key'), () => openHarnessOnboarding('deepseek-official')],- [t('Open settings to set up a custom model'), openHarnessSettings],+ actions.openHarnessOnboarding ? [t('Enter a DeepSeek API key'), () => actions.openHarnessOnboarding('deepseek-official')] : null,+ actions.openHarnessSettings ? [t('Open settings to set up a custom model'), actions.openHarnessSettings] : null,].filter(Boolean)}@@ -267,7 +266,7 @@ function SignInHost({ entry, actions }) {...hooks,t: actions.accountT(),complete: close,- useApiKey: () => { close(); openHarnessOnboarding('deepseek-official') },+ useApiKey: () => { close(); actions.openHarnessOnboarding('deepseek-official') },})}diff --git a/ds-bot/src/client/schedules.js b/ds-bot/src/client/schedules.jsindex c35a7929..7d0770f4 100644--- a/ds-bot/src/client/schedules.js+++ b/ds-bot/src/client/schedules.js@@ -4,7 +4,6 @@import { createElement as h, Fragment, useEffect, useState } from 'react'import { BotAvatar, RoomAvatar } from './mark.js'import { ClockIcon, PlusIcon, TrashIcon } from './icons.js'-import { openHarnessSettings } from './sidebar.js'import { Segmented } from './motion.js'import { dateLocale, hostText, t } from './i18n.js'@@ -170,19 +169,19 @@ function TaskForm({ roster, actions, start, onDone, onCancel }) {}// Settings has no schedule service to show: Automation tasks are off in DSH.-function AutomationOff() {+function AutomationOff({ actions }) {return h('div', { className: 'bt-set-card bt-task-off' },h('span', { className: 'bt-task-off-mark' }, h(ClockIcon)),h('span', { className: 'bt-task-off-title' }, t('Turn on Automation tasks in DSH')),h('span', { className: 'bt-set-hint' }, t('Switch on Automation tasks on the Plugins page in Harness settings.')),- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: openHarnessSettings }, t('Open Harness settings')))+ actions.openHarnessSettings ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: actions.openHarnessSettings }, t('Open Harness settings')) : null)}export function SchedulesPage({ roster, actions, start }) {const view = useSchedules(actions)const [adding, setAdding] = useState(Boolean(start))if (view === null) return h('div', { className: 'bt-set-hint' }, t('Loading…'))- if (!view.available) return h(AutomationOff)+ if (!view.available) return h(AutomationOff, { actions })const shown = next => { publish(next); setAdding(false) }const byChat = [...roster.bots.map(bot => [bot.id, h(BotAvatar, { bot, size: 18, badge: false, live: false }), bot.name, view.tasks.filter(task => task.botId === bot.id)]),@@ -211,7 +210,7 @@ export function BotSchedules({ bot, roster, actions }) {!view.available? h('div', { className: 'bt-set-row bt-bs-row' },h('span', { className: 'bt-set-copy' }, h('span', { className: 'bt-set-hint' }, t('Switch on Automation tasks on the Plugins page in Harness settings.'))),- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: openHarnessSettings }, t('Open Harness settings')))+ actions.openHarnessSettings ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: actions.openHarnessSettings }, t('Open Harness settings')) : null): [...tasks.map(task => h(TaskRow, { key: task.id, task, actions, roster, onView: publish })),h('button', { key: 'new', type: 'button', className: 'bt-set-row bt-bs-row bt-gs-add', onClick: () => actions.openSettings('schedules', bot.id) }, h(PlusIcon), t('New task')),diff --git a/ds-bot/src/client/settings.js b/ds-bot/src/client/settings.jsindex 23d803e3..9a7e5dac 100644--- a/ds-bot/src/client/settings.js+++ b/ds-bot/src/client/settings.js@@ -4,7 +4,6 @@ import { isMainOf } from './sources.js'import { allThemes } from './themes.js'import { CloseIcon, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConnectorIcon, InfoIcon, PlugIcon, PlusIcon, SlidersIcon, SETTINGS_ICONS } from './icons.js'import { AdminStar, BotAvatar, RoomAvatar } from './mark.js'-import { openHarnessSettings } from './sidebar.js'import { useEscape } from './overlay-hooks.js'import { BotSettingsForm } from './bot-settings.js'import { Segmented, useGlide } from './motion.js'@@ -61,9 +60,9 @@ function GeneralPage({ roster, actions, run }) {})),h('label', { className: 'bt-swatch bt-swatch-custom', title: t('Custom accent'), 'data-on': Boolean(prefs.accent) && !ACCENT_INKS.some(ink => INKS[ink][0] === prefs.accent) },h('input', { type: 'color', value: custom, 'aria-label': t('Custom accent'), onChange: event => pickCustom(event.target.value) }))))),- h(SetSection, { key: 'mode', title: t('Mode') },+ actions.setSurface ? h(SetSection, { key: 'mode', title: t('Mode') },h(SetRow, { label: t('Classic Agent mode') },- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => actions.setSurface('agent') }, t('Switch')))),+ h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => actions.setSurface('agent') }, t('Switch')))) : null,]}@@ -187,10 +186,10 @@ export function SettingsDialog({ page, id, roster, actions, useUpdate, leaving =SETTINGS_PAGES.map(([key, text]) => h('button', {key, type: 'button', className: 'bt-settings-item', 'aria-current': shown === key ? 'page' : undefined, onClick: () => actions.openSettings(key),}, h(PAGE_ICONS[key]), t(text))),- h('button', {+ actions.openHarnessSettings ? h('button', {type: 'button', className: 'bt-settings-item bt-settings-shell', title: t('Models, providers, and the rest of DeepSeek Harness'),- onClick: () => { close(); openHarnessSettings() },- }, h(SlidersIcon), t('Harness settings'))),+ onClick: () => { close(); actions.openHarnessSettings() },+ }, h(SlidersIcon), t('Harness settings')) : null),h('div', { className: 'bt-settings-main' },h('div', { className: 'bt-settings-head' },back ? h('button', { type: 'button', className: 'bt-icon-btn', 'aria-label': back, title: back, onClick: () => actions.openSettings(shown) }, h(ChevronLeftIcon)) : null,diff --git a/ds-bot/test/model-menu.test.js b/ds-bot/test/model-menu.test.jsindex 5fc9e627..f8f4df59 100644--- a/ds-bot/test/model-menu.test.js+++ b/ds-bot/test/model-menu.test.js@@ -33,13 +33,17 @@ function nodes(tree, match) {return [...(match(tree) ? [tree] : []), ...(tree.children ?? []).flatMap(child => nodes(child, match))]}-function dock(models, { model, ready = true } = {}) {+// `harness`: the window has DSH's own settings to send the user to, as the plugin does.+function dock(models, { model, ready = true, harness = true } = {}) {const picked = []const bot = { id: 'chief', name: 'Chief', model }const roster = { ready, byId: { chief: bot }, models, defaultModel: models[0]?.ref }const tree = ModelChoiceDock({sessionId: bot.id, useRoster: select => select(roster),- actions: { updateBot: (id, patch) => { picked.push([id, patch.model]); return Promise.resolve() } },+ actions: {+ updateBot: (id, patch) => { picked.push([id, patch.model]); return Promise.resolve() },+ ...(harness ? { openHarnessSettings: () => {}, openHarnessOnboarding: () => {} } : {}),+ },})return { tree, picked }}@@ -93,6 +97,12 @@ test('an empty catalog offers setup choices, and a ready model needs no choice dassert.equal(dock(models, { ready: false }).tree, null)})+test('without DSH\'s own settings, the choice offers no way into them', () => {+ const buttons = tree => nodes(tree, node => node.type === 'button').map(button => button.children[0])+ assert.deepEqual(buttons(dock(models, { harness: false }).tree), ['DeepSeek Flash', 'DeepSeek Pro', 'DeepSeek Flash'])+ assert.deepEqual(buttons(dock([], { harness: false }).tree), [])+})+test('the Thinking section always offers Default, so a picked level can be cleared', () => {const efforts = [{ id: 'low', name: 'Low' }, { id: 'high', name: 'High' }]assert.deepEqual([...effortRows({ efforts, defaultEffort: 'high' }).map(row => row.effort)], [undefined, 'low', 'high'])