Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to DS Bot are listed here. The format follows [Keep a Change

## [Unreleased]

### Changed

- A question card closes when its Bot finishes a later turn you can see that asks nothing, so a stale card no longer stays on screen until you answer it. A hidden turn that only answers another Bot leaves the card open. A click on a closed card is refused.

### Added

- `void_question` lets a Main Bot withdraw another Bot's open question card. The Bot is told, and a late click on the card is refused.
- A Bot that sends work from its own chat with `message_bot` now shows as waiting for the recipient until the reply arrives, on its tile and in its status.

## [0.2.5] - 2026-11-01

### Changed
Expand Down
2 changes: 1 addition & 1 deletion ds-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Tested with dsh `0.2.1-rc.4` (Web) and `0.2.0-rc.2` (Web and Desktop).
- **Long-lived Bots**: each Bot is a dsh Session in the "DS Bot" workspace, with its own name, role, instructions and model.
- **Working folders**: a Bot can work in a folder you choose instead of the team workspace, and a group chat can set one folder for all its members there. Pick it in the Bot's settings or details panel or in the group's settings, or ask a Bot (`update_bot`, `update_group`). After a change, the chat goes on in a fresh part that starts in the new folder. When a Bot sets a folder outside the team workspace, or adds a Bot to a group that works in one, it asks for your approval if those Bots can only write in their folder. Folders that hold dsh data (`$DSH_HOME`, the team's data) are refused. The team workspace itself moves in Settings > General > Locations; Bots and groups that work there go on in a fresh part in the new folder, and the old folder keeps its files.
- **Permission presets**: each Bot runs with its own dsh permission preset (Read only, Workspace or Full access), set in its details panel. A group chat can run all its members with one preset there, in place of their own: turn on **Same for every member** under Permissions in the group's settings. Only you set permissions; Bots cannot change them.
- **Bots work together**: `message_bot` sends a message to another Bot, `create_bot` and `update_bot` add and set up Bots (including a profile photo from a local image file or a data URL), and `ask_user` asks you a question without blocking the other Bots. `show_view` draws a card in a Bot's own chat — text, metrics, tables, progress, choices, confirmations and short forms; an interactive card waits for your answer.
- **Bots work together**: `message_bot` sends a message to another Bot, `create_bot` and `update_bot` add and set up Bots (including a profile photo from a local image file or a data URL), and `ask_user` asks you a question without blocking the other Bots. A question card closes when the Bot finishes a later turn you can see that asks nothing, or when a Main Bot withdraws it with `void_question`; a turn that only answers another Bot leaves it open, and a late click on a closed card is refused. `show_view` draws a card in a Bot's own chat: text, metrics, tables, progress, choices, confirmations and short forms; an interactive card waits for your answer.
- **Group chats**: members speak one at a time, and each one reads the latest messages first. A message can `@Name` a member to pass the turn on; type `@` to pick one from a list. **+ → Reference a chat** adds another Bot's chat to a message as context, and in a group the members who answer get it. A member with nothing new to add stays quiet (`[PASS]`). Each member has its own hidden Session per group, so a group never reads a Bot's private chat.
- **Roles and permissions**:

Expand Down
2 changes: 1 addition & 1 deletion ds-bot/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -10297,7 +10297,7 @@ function useLandOnMainBot(roster, useSessions, actions) {
const lastBot = (0, import_react19.useRef)(null);
(0, import_react19.useEffect)(() => {
if (!roster.ready || !roster.mainBotId) return void 0;
const [id, blank3] = mainView.split("|");
const [id] = mainView.split("|");
const bot = id === "" ? void 0 : roster.byId[id];
if (bot !== void 0) {
lastBot.current = { botId: bot.id, sessionId: id };
Expand Down
2 changes: 1 addition & 1 deletion ds-bot/src/client/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ function useLandOnMainBot(roster, useSessions, actions) {
const lastBot = useRef(null)
useEffect(() => {
if (!roster.ready || !roster.mainBotId) return undefined
const [id, blank] = mainView.split('|')
const [id] = mainView.split('|')
const bot = id === '' ? undefined : roster.byId[id]
if (bot !== undefined) {
lastBot.current = { botId: bot.id, sessionId: id }
Expand Down
2 changes: 1 addition & 1 deletion ds-bot/src/host/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const AGENT_SESSION_TITLE_MAX = 80
// profile, so the list served to one session can be shorter.
export const TEAM_TOOLS = [
'list_bots', 'message_bot', 'stop_bot', 'create_bot', 'update_bot', 'list_bot_models',
'create_group', 'update_group', 'delete_group', 'post_to_group', 'ask_user', 'show_view',
'create_group', 'update_group', 'delete_group', 'post_to_group', 'ask_user', 'void_question', 'show_view',
'request_secret', 'list_secrets', 'group_relay', 'read_own_chat',
'read_group_chat', 'remember', 'forget', 'recall', 'read_browser',
'list_capabilities', 'save_capability', 'delete_capability',
Expand Down
10 changes: 9 additions & 1 deletion ds-bot/src/host/delivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function install(rt) {
if (resent && role !== 'room') return `[Message from ${fromName} · DeepSeek Harness restarted before it could reach you]`
if (role === 'reply') return `[Reply from ${fromName}${goesOn}]`
if (role === 'stopped') return `[Stopped by ${fromName}]`
if (role === 'voided') return `[Question voided by ${fromName}]`
if (role === 'room') return `[Group chat "${roomName}" · ${note}]`
if (role === 'report') return `[Group chat "${roomName}" · replies to your post${goesOn}]`
if (role === 'kickoff') return '[Bot team setup]'
Expand Down Expand Up @@ -54,7 +55,10 @@ export function install(rt) {
// length when it went as a file (attachLong). `work`: the work (handoffs.js) a
// result that came back goes on with. `merged`: a request that takes in an earlier
// one its recipient had not read, under that one's exchange.
async function deliver({ fromId, toId, sessionId, text, role, replyTo, roomId, audience, note, exchangeId = randomUUID(), steer = false, deferred = false, resumed = false, retried = false, resent = false, merged = false, askedBy, fromRoomId, files = [], length, work }) {
// `handedBack`: this delivery is a pointer to a message the recipient already read in
// this Session, not the message itself (turns.js), so the dialogs read the body from
// the delivery that carried it.
async function deliver({ fromId, toId, sessionId, text, role, replyTo, roomId, audience, note, exchangeId = randomUUID(), steer = false, deferred = false, resumed = false, retried = false, resent = false, merged = false, handedBack = false, askedBy, fromRoomId, files = [], length, work }) {
const from = rt.botOf(fromId)
const to = rt.botOf(toId)
if (to === undefined) throw new Error(`Unknown Bot ${toId}`)
Expand All @@ -74,6 +78,7 @@ export function install(rt) {
...(roomId ? { roomId } : {}),
...(audience === 'user' ? { audience } : {}),
...(deferred ? { deferred: true } : {}),
...(handedBack ? { handedBack: true } : {}),
...(resumed ? { resumed: true } : {}),
...(retried ? { retried: true } : {}),
...(askedBy ? { askedBy } : {}),
Expand Down Expand Up @@ -119,6 +124,9 @@ export function install(rt) {
try {
for await (const event of rt.eventsBackwards(entry.sessionId ?? rt.chatOf(entry.to), AbortSignal.timeout(HISTORY_TIMEOUT_MS))) {
if (event.type !== 'user/message' || event.data?.source?.exchangeId !== entry.id) continue
// A hand-back carries a pointer, not the message; the delivery that brought it is
// further back and is what the dialog shows.
if (event.data.source.handedBack === true) continue
const delivered = textOf(event.data.content)
const text = delivered.slice(delivered.indexOf('\n') + 1)
return { text: headOf(text, TEXT_SHOW_MAX), whole: text.length <= TEXT_SHOW_MAX }
Expand Down
10 changes: 9 additions & 1 deletion ds-bot/src/host/handoffs.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,13 @@ export function install(rt) {
.filter(([id, work]) => work.to !== undefined && work.open.length > 0 && !busy.has(id))
.map(([id, work]) => ({ id, work, out: work.open.map(childId => works()[childId]).filter(Boolean) }))
const busyWith = sessionIds => new Set(sessionIds.map(sessionId => rt.live.get(sessionId)).filter(entry => entry?.turn !== undefined).map(entry => workOf(entry.info)).filter(Boolean))
// What a Bot sent from outside any work, such as its chat with the user: nothing above
// these holds their wait, and the sender waits until the reply closes them.
const sentOnOwn = () => Object.values(works())
.filter(work => work.to !== undefined && works()[work.parent] === undefined && rt.botOf(work.from) !== undefined && rt.botOf(work.to) !== undefined)

// Per Bot, the Bots and groups it waits for, and the Bots it does that work for.
// Per Bot, the Bots and groups it waits for, and the Bots it does that work for. `for`
// stays empty for work a Bot sent on its own, which it does for the user.
function waitingView() {
const view = {}
const add = (list, id) => { if (id !== undefined && !list.includes(id)) list.push(id) }
Expand All @@ -269,6 +274,7 @@ export function install(rt) {
for (const child of out) add(child.room ? entry.rooms : entry.bots, child.room ?? child.to)
add(entry.for, work.from)
}
for (const work of sentOnOwn()) add((view[work.from] ??= { bots: [], rooms: [], for: [] }).bots, work.to)
return view
}

Expand Down Expand Up @@ -314,6 +320,8 @@ export function install(rt) {
const on = [...new Set(out.map(child => (child.room ? `group "${rt.roomOf(child.room)?.name ?? 'a group'}"` : child.name ?? nameOf(child.to) ?? 'a teammate')))]
lines.push(on.length > 0 ? `waiting for ${on.join(' and ')} to hand back work${forName}` : `about to go on with work${forName}, whose results came back`)
}
const sent = [...new Set(sentOnOwn().filter(work => work.from === botId).map(work => nameOf(work.to)))]
if (sent.length > 0) lines.push(`waiting for ${sent.join(' and ')} to answer`)
if (lines.length === 0) lines.push('idle')
if (state.questions?.[chat] !== undefined) lines.push('a question card in its own chat waits for the user\'s answer')
if (state.views?.[chat] !== undefined) lines.push('a view card in its own chat waits for the user\'s answer')
Expand Down
5 changes: 5 additions & 0 deletions ds-bot/src/host/privacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ export function install(rt) {
if (bot) throw closed(bot, 'turns')
return
}
case 'void_question': {
const bot = target(args.bot)
if (bot) throw closed(bot, 'questions')
return
}
case 'attach_capability':
case 'detach_capability': {
const bot = target(args.bot)
Expand Down
3 changes: 2 additions & 1 deletion ds-bot/src/host/prompt.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions ds-bot/src/host/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,39 @@ export function install(rt) {
},
}))

rt.teamTools.push(defineTool({
name: 'void_question',
description: 'Main Bot only. Withdraw the question card another Bot left open for the user, when it no longer applies. The card leaves the screen, a late click on it is refused, and the Bot is told in a new turn.',
parameters: {
bot: { type: 'string', required: true, description: 'Exact Bot name from list_bots' },
reason: { type: 'string', description: 'Why it was voided; the Bot reads this' },
},
output,
async execute(args, exec) {
await rt.load()
const sender = callerBot(exec)
if (sender === undefined || !rt.isMain(sender.id)) refuse('Only a Main Bot can void a question.')
const target = rt.findBot(args.bot)
if (target === undefined) refuse(`No Bot named ${args.bot}. Team: ${Object.values(state.bots).map(bot => bot.name).join(', ')}`)
const chat = rt.chatOf(target.id)
const question = rt.own(state.questions, chat)
if (question === undefined) refuse(`${target.name} has no open question.`)
delete state.questions[chat]
await rt.save()
if (target.id === sender.id) return 'Your question is voided.'
const why = String(args.reason ?? '').trim()
const text = `Your question "${question.question}" is withdrawn, so no answer to it will reach you. Do not act on it.${why ? `
Reason: ${why}` : ''}`
try {
await rt.deliver({ fromId: sender.id, toId: target.id, text, role: 'voided', ...callerRoom(exec) })
} catch (error) {
rt.warn('ds-bot: telling %s its question was voided failed: %s', target.name, error)
return `The question of ${target.name} is voided, but ${target.name} could not be told. Tell it with message_bot.`
}
return `The question of ${target.name} is voided and it has been told.`
},
}))

// Scoped per Bot session, not global: another plugin's global show_view serves
// the sessions ds-bot does not own, while this one shadows it inside them.
rt.teamTools.push(defineTool({
Expand Down
Loading
Loading