@@ -1735,7 +1735,7 @@ diff --git a/src/client/index.js b/src/client/index.js
17351735 migrateStorage()
17361736 const UNREAD_KEY = STORAGE.unread
17371737 let savedUnread = {}
1738- @@ -50,9 +87 ,12 @@
1738+ @@ -50,9 +50 ,12 @@ export function apply(ctx) {
17391739 const SEEN_KEY = STORAGE.seen
17401740 let seenAt = {}
17411741 try { seenAt = JSON.parse(localStorage.getItem(SEEN_KEY) ?? '{}') ?? {} } catch { seenAt = {} }
@@ -1749,7 +1749,7 @@ diff --git a/src/client/index.js b/src/client/index.js
17491749 // Bot mode paints the whole team surface; Agent mode withdraws every slot and
17501750 // style so the shell's own interface returns. `plain` stays false until a Bot-mode
17511751 // view hosts a plain session, which drops only the conversation replacements.
1752- @@ -90,6 +130 ,8 @@
1752+ @@ -90,6 +90 ,8 @@ export function apply(ctx) {
17531753 return () => window.removeEventListener('pagehide', onPageHide)
17541754 }, 'ds-bot: remember visits on page hide')
17551755 const activity = createSource({})
@@ -1758,7 +1758,7 @@ diff --git a/src/client/index.js b/src/client/index.js
17581758 // Per Bot, the turn it runs and its tool; and the approvals waiting for the user.
17591759 const work = createSource({ bots: {}, approvals: [] })
17601760 let workKey = ''
1761- @@ -125,18 +167 ,40 @@
1761+ @@ -125,18 +125 ,40 @@ export function apply(ctx) {
17621762 try { localStorage.setItem(UNREAD_KEY, JSON.stringify(unread)) } catch { /* storage unavailable */ }
17631763 return { ...state, unread }
17641764 })
@@ -1801,7 +1801,7 @@ diff --git a/src/client/index.js b/src/client/index.js
18011801 const nextWork = JSON.stringify(value.work ?? null)
18021802 if (nextWork !== workKey) { workKey = nextWork; work.set(value.work ?? { bots: {}, approvals: [] }) }
18031803 noteMemoryNews(value.memoryNews ?? {})
1804- @@ -145,11 +209 ,18 @@
1804+ @@ -145,11 +145 ,18 @@ export function apply(ctx) {
18051805 const live = {}
18061806 if (value.connectors !== undefined && JSON.stringify(value.connectors) !== JSON.stringify(current.connectors ?? [])) live.connectors = value.connectors
18071807 if (value.capabilityStatuses !== undefined && JSON.stringify(value.capabilityStatuses) !== JSON.stringify(current.capabilityStatuses ?? {})) live.capabilityStatuses = value.capabilityStatuses
@@ -1821,15 +1821,15 @@ diff --git a/src/client/index.js b/src/client/index.js
18211821 try {
18221822 const ids = (value.agents ?? []).flatMap(agent => agent.sessions ?? [])
18231823 localStorage.setItem(STORAGE.agentSessions, JSON.stringify(ids))
1824- @@ -174,6 +245 ,7 @@
1824+ @@ -174,6 +174 ,7 @@ export function apply(ctx) {
18251825 const loop = async () => {
18261826 clearTimeout(timer)
18271827 if (running || stopped) return
18281828+ if (reloading > 0) { timer = setTimeout(loop, 200); return }
18291829 running = true
18301830 try { await pull() } catch (error) { if (!stopped) console.warn('[ds-bot] state', error) } finally { running = false }
18311831 if (!stopped) timer = setTimeout(loop, document.hidden ? 10000 : 1500)
1832- @@ -252,17 +324 ,7 @@
1832+ @@ -252,17 +252 ,7 @@ export function apply(ctx) {
18331833 const style = installStyles('', 'mentions')
18341834 let last = ''
18351835 const render = () => {
@@ -1848,7 +1848,7 @@ diff --git a/src/client/index.js b/src/client/index.js
18481848 if (next !== last) style.textContent = last = next
18491849 }
18501850 render()
1851- @@ -325,7 +387 ,7 @@
1851+ @@ -325,7 +325 ,7 @@ export function apply(ctx) {
18521852
18531853 ctx.inject(['shortcuts'], scope => { scope.effect(() => holdShellShortcuts(scope.shortcuts), 'ds-bot: settings shortcut') })
18541854
@@ -1857,15 +1857,15 @@ diff --git a/src/client/index.js b/src/client/index.js
18571857 // A Bot id, or any part of its chat, opens the Bot's current part.
18581858 const partFor = (id) => {
18591859 const bot = roster.getSnapshot().byId[id]
1860- @@ -342,6 +404 ,7 @@
1860+ @@ -342,6 +342 ,7 @@ export function apply(ctx) {
18611861 // or the click appears to do nothing.
18621862 isAgentSession: id => isAgentSessionId(id),
18631863 openSession: (id) => {
18641864+ noteNavigation('openSession', id)
18651865 // A DSH Agent Session id lands on the plain surface, not the Bot skin.
18661866 if (isAgentSessionId(id)) return actions.openAgentSession(id)
18671867 ui.set(state => (state.newChat || state.exchange || state.menu || state.palette ? { ...state, newChat: null, exchange: null, menu: null, palette: null } : state))
1868- @@ -409,15 +472 ,24 @@
1868+ @@ -409,15 +409 ,24 @@ export function apply(ctx) {
18691869 },
18701870 // `last` is the Bot conversation the view held before it cleared: when that part
18711871 // was archived for a fresh one, the view goes on in the fresh one.
@@ -1894,7 +1894,7 @@ diff --git a/src/client/index.js b/src/client/index.js
18941894 openNewChat: (mode) => { ui.set(state => ({ ...state, newChat: mode, menu: null, palette: null })) },
18951895 openPalette: (query = '') => { ui.set(state => ({ ...state, palette: { query, token: Date.now() }, newChat: null, menu: null })) },
18961896 // The token keeps a late exit timer from closing a palette opened again since.
1897- @@ -443,11 +515 ,24 @@
1897+ @@ -443,11 +443 ,24 @@ export function apply(ctx) {
18981898 showDetails: (id, tab = null) => { ui.set(state => ({ ...state, details: id, view: 'details', renaming: false, tab })) },
18991899 // Opening the conversation would move focus to its composer and blur the name field.
19001900 renameBot: (id) => { ui.set(state => ({ ...state, details: id, view: 'details', renaming: true, tab: null })) },
@@ -1922,7 +1922,7 @@ diff --git a/src/client/index.js b/src/client/index.js
19221922 openConnectors: () => { ui.set(state => ({ ...state, settings: { page: 'connectors', id: null }, menu: null, palette: null, newChat: null })) },
19231923 // Agent mode hands the surface back to the shell; everything open on the Bot
19241924 // surface closes first so nothing stale reopens on the way back.
1925- @@ -455,7 +540 ,7 @@
1925+ @@ -455,7 +455 ,7 @@ export function apply(ctx) {
19261926 if (mode !== 'bot' && mode !== 'agent') return
19271927 if (surface.getSnapshot().mode === mode) return
19281928 if (mode === 'agent') {
@@ -1931,7 +1931,7 @@ diff --git a/src/client/index.js b/src/client/index.js
19311931 }
19321932 writeMode(mode)
19331933 surface.set(state => ({ ...state, mode }))
1934- @@ -487,6 +572 ,12 @@
1934+ @@ -487,6 +487 ,12 @@ export function apply(ctx) {
19351935 const seen = seenAt[seenKey(id)] ?? (made?.createdBy && Number.isFinite(made.createdAt) ? made.createdAt : null)
19361936 ui.set(state => ({ ...state, visits: { ...state.visits, [id]: { seen, entered: Date.now() } } }))
19371937 },
@@ -1944,7 +1944,7 @@ diff --git a/src/client/index.js b/src/client/index.js
19441944 endVisit: (id) => {
19451945 leaveVisits([id])
19461946 ui.set((state) => {
1947- @@ -530,8 +621 ,14 @@
1947+ @@ -530,8 +530 ,14 @@ export function apply(ctx) {
19481948 updateRoom: (id, patch) => after(call('update-room', { id, ...patch })),
19491949 send: (sessionId, text) => after(call('send', { sessionId: partFor(sessionId), text })),
19501950 answerQuestion: (sessionId, questionId, answer) => after(call('answer-question', { sessionId: partFor(sessionId), questionId, answer })),
@@ -1959,7 +1959,7 @@ diff --git a/src/client/index.js b/src/client/index.js
19591959 stopMemberWork: (roomId, botId) => after(call('stop-member-work', { roomId, botId })),
19601960 // Values go out in these requests and never come back in a response.
19611961 secretSet: payload => after(call('secret-set', payload)),
1962- @@ -539,15 +636 ,33 @@
1962+ @@ -539,15 +539 ,33 @@ export function apply(ctx) {
19631963 secretCancel: requestId => after(call('secret-cancel', { requestId })),
19641964 secretUpdate: (name, scope) => after(call('secret-update', { name, scope })),
19651965 secretDelete: name => after(call('secret-delete', { name })),
@@ -1994,7 +1994,7 @@ diff --git a/src/client/index.js b/src/client/index.js
19941994 scheduleDelete: (sessionId, id) => call('schedule-delete', { sessionId, id }),
19951995 exchange: (a, b) => call('exchange', { a, b }).catch(() => []),
19961996 roomProgress: roomId => call('room-progress', { roomId }).catch(() => []),
1997- @@ -564,8 +679 ,13 @@
1997+ @@ -564,8 +564 ,13 @@ export function apply(ctx) {
19981998 // A failed action away from any form (a menu, the palette) shows as a toast.
19991999 reportError: (error, where = 'action') => {
20002000 noteClientError(where, error)
@@ -2009,15 +2009,15 @@ diff --git a/src/client/index.js b/src/client/index.js
20092009 dismissToast: token => ui.set(state => (state.toast && (token === undefined || state.toast.token === token) ? { ...state, toast: null } : state)),
20102010 }
20112011 // Without the Desktop bridge these stay undefined, and no browser control renders.
2012- @@ -610,6 +730 ,7 @@
2012+ @@ -610,6 +610 ,7 @@ export function apply(ctx) {
20132013 }
20142014 actions.closePanel = () => { ui.set(state => (state.details ? { ...state, details: null, view: 'details', renaming: false, tab: null } : state)) }
20152015 // Whether AccountLauncher holds the shell's settings seat; FooterAccount steps aside if so.
20162016+ actions.flybotSlotEntries = name => ctx.slots.entries?.(name) ?? []
20172017 actions.signInEntry = () => ctx.slots.entries?.('settings.models.sign-in')?.[0] ?? null
20182018 actions.canSignIn = () => Boolean(actions.signInEntry())
20192019 actions.signIn = () => ui.set(state => ({ ...state, signIn: (state.signIn ?? 0) + 1 }))
2020- @@ -647,6 +768 ,13 @@
2020+ @@ -647,6 +647 ,13 @@ export function apply(ctx) {
20212021 wakeUpdate()
20222022 }
20232023 actions.repoStars = () => call('repo-stars')
@@ -2031,7 +2031,7 @@ diff --git a/src/client/index.js b/src/client/index.js
20312031 actions.noteTurnTime = (sessionId, turn, key, time) => {
20322032 if (sessionId === undefined || !Number.isFinite(turn) || !Number.isFinite(time)) return
20332033 turnClock.set((state) => {
2034- @@ -689,7 +817 ,18 @@
2034+ @@ -689,7 +689 ,18 @@ export function apply(ctx) {
20352035 })
20362036 const browserPages = browsers?.pages ?? createSource({})
20372037 const browserTabs = browsers?.tabs ?? createSource({})
@@ -2051,7 +2051,7 @@ diff --git a/src/client/index.js b/src/client/index.js
20512051 ctx.effect(() => noticeApprovals({
20522052 work,
20532053 roster,
2054- @@ -715,10 +854 ,23 @@
2054+ @@ -715,10 +715 ,23 @@ export function apply(ctx) {
20552055 }
20562056
20572057 const shadow = (name, options, component) => ctx.slots.inject(name, () => ctx.slots.register({ name, ...options }, component))
@@ -2075,7 +2075,7 @@ diff --git a/src/client/index.js b/src/client/index.js
20752075 const installAtMenu = () => {
20762076 const fiber = ctx.inject(['inputTriggers'], (scope) => {
20772077 scope.effect(() => {
2078- @@ -730,7 +882 ,12 @@
2078+ @@ -730,7 +730 ,12 @@ export function apply(ctx) {
20792079 const launched = sessionId => controllerOf(sessionId)?.launcher.getSnapshot() === CHATS_SOURCE
20802080 const offs = atSources({ roster, sessions: ctx.sessions, launched, iconFor: menuIcons(roster) }).map(source => triggers.registerSource(source))
20812081 atMenu = { controllerOf }
@@ -2088,7 +2088,7 @@ diff --git a/src/client/index.js b/src/client/index.js
20882088 atMenu = null
20892089 for (const off of offs) off()
20902090 }
2091- @@ -739,6 +896 ,14 @@
2091+ @@ -739,6 +739 ,14 @@ export function apply(ctx) {
20922092 return () => fiber.dispose()
20932093 }
20942094 actions.canReferenceChat = () => atMenu !== null
@@ -2103,7 +2103,7 @@ diff --git a/src/client/index.js b/src/client/index.js
21032103 actions.referenceChat = (sessionId, span) => {
21042104 const controller = atMenu?.controllerOf(sessionId)
21052105 if (controller === undefined || span === undefined) return
2106- @@ -752,33 +917 ,50 @@
2106+ @@ -752,33 +752 ,50 @@ export function apply(ctx) {
21072107 installCompiledStyles(SHELL_CSS, 'shell'),
21082108 installCompiledStyles(SIDEBAR_CSS, 'sidebar'),
21092109 installCompiledStyles(SECRET_CSS, 'secrets'),
@@ -2157,7 +2157,7 @@ diff --git a/src/client/index.js b/src/client/index.js
21572157 shadow('conversation.chat.node', { key: 'assistant-step', priority: -10, locale: 'chat', inject: assistantFace }, AssistantCell),
21582158 shadow('conversation.chat.node', { key: 'turn-trigger', priority: -10, locale: 'chat', inject: face }, TriggerCell),
21592159 shadow('conversation.chat.node', { key: 'tool-call', priority: -10, locale: 'chat', inject: face }, ToolCell),
2160- @@ -790,15 +972 ,24 @@
2160+ @@ -790,15 +790 ,24 @@ export function apply(ctx) {
21612161 // every message.
21622162 shadow('conversation.chat.node', { key: 'question-reply', priority: -10, locale: 'chat' }, AnsweredCell),
21632163 shadow('conversation.chat.node', { key: 'compaction', priority: -10, locale: 'chat' }, Nothing),
@@ -2185,7 +2185,7 @@ diff --git a/src/client/index.js b/src/client/index.js
21852185 shadow('conversation.input.right', { id: 'bot-voice', order: 100, inject: face }, ComposerVoice),
21862186 shadow('conversation.composer', {
21872187 priority: -10,
2188- @@ -808,7 +999 ,14 @@
2188+ @@ -808,7 +808 ,14 @@ export function apply(ctx) {
21892189 shadow('conversation.input.dock', { id: 'bot-model', order: -110, inject: face }, ModelChoiceDock),
21902190 shadow('conversation.input.dock', { id: 'bot-question', order: -100, inject: face }, QuestionDock),
21912191 shadow('conversation.input.dock', { id: 'bot-secret', order: -90, inject: face }, SecretDock),
0 commit comments