Skip to content

Commit 98d2390

Browse files
authored
Choose the message folding mode in Settings → General (#3114) (#3180)
Written-by: Dev Fixes #3179 Part of #3114 Owner: Dev Reviewer: Reviewer Tier: T3 ## What changed The reader half shipped in the previous slice: `foldingOf` already folds a bubble by `prefs.folding.mode` and `none` already folds nothing, but nothing could write the mode, so every window folded at the default and Settings had no picker. This closes the writing half only — `core/src/client/message-fold.js` and `core/test/message-fold.test.js` are untouched (A12). **Host** (`core/src/host/channel.js`, +12): `set-prefs` takes `folding: { mode }`, checks it against a `FOLD_MODES` set next to `NOTIFY_KINDS`, stores `state.prefs.folding`, deletes the record on `null`, and refuses anything else with `Message folding must be compact, standard or none`. The check is inline, like motion's three-way choice beside it; no `core/src/shared/` module was added. **Client** (`core/src/client/settings.js`, +17): General reads `foldingOf(prefs)` and draws a `Message folding` section — a `Segmented` picker (Compact / Standard / No folding) in a writable window, and one plain-text row naming the mode in a read-only one, so `#2474`'s rule still holds. `core/src/client/i18n.js` (+6) carries the section title, the hint, the three labels and the refusal. `core/client.js` is rebuilt, not hand-edited. Tests: `core/test/install.test.js` pins the host half (store, refusal, `null` clear, `none`), and `core/test/settings-readonly-pages.test.js` pins the picker and its one write. The `#2474` count of General's controls moves from 7 to 8 because the page really draws one more control; the `Send shortcut` assertion on the same line still holds. Fourteen files: eight hand-written (+81/−4 lines, of which the tests are 40) and six generated (`core/client.js`, patches `0001`, `0005`, `0008`, `0014`, and the `files/` mirror of the test). `ds-bot/`, `patches/ds-bot/topics.json`, `.github/**`, `policy/**`, `scripts/**`, `core/scripts/**`, every `package.json`/`package-lock.json`, `core/src/shared/**` and `plugins/**` are unchanged. ## Checkpoint <!-- flybot:checkpoint --> ```json { "pr": 3180, "claim": "Dev", "issue": 3179, "summary": "`set-prefs` now stores the message folding mode and refuses anything that is not compact, standard or none, while `null` clears it back to the default. Settings → General draws a Message folding picker whose three choices write that field, and a read-only window keeps the mode in use as text instead of drawing a control. The client already folded by `prefs.folding.mode`, so this slice only closes the writing half: no bubble, threshold or existing Chinese sentence about folding changed.", "files": [ "core/src/host/channel.js", "core/src/client/settings.js", "core/src/client/i18n.js", "core/test/install.test.js", "core/test/settings-readonly-pages.test.js", "docs/subsystems/core-host.md", "docs/subsystems/core-client.md", "changelog.d/3114-fold-prefs.added.md" ], "checks": { "ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify", "result": "green", "at": "d8ed1f3ead793d77c961b7b360fa271e5e4a62b3" }, "next": "Reviewer: a PASS at this tip (T3), then the queue. No gate file changed; nothing was enqueued from here." } ``` <!-- /flybot:checkpoint --> ## Verification at the tip Ran: `cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/install.test.js` → 5/5. Ran: `cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/settings-readonly-pages.test.js` → 14/14. Ran: `cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/message-fold.test.js test/tool-cells.test.js test/client-bundle.test.js test/empty-message-cell.test.js` → 29/29 (5 / 19 / 2 / 3). Ran: `node core/scripts/build-client.mjs --check` from the repo root → exit 0, and `git diff --exit-code -- core/client.js` → exit 0 on the tree with `client.js` committed. Ran: `node scripts/ds-bot-patches.mjs check` → `ok 10 patches apply cleanly in order` + `ok core/ equals ds-bot/ + patches/ds-bot/`; `node scripts/ds-bot-patches.mjs canonical` → `generate is a no-op`. Ran: `npm --prefix core run arch-docs` → `arch-docs: OK (2 changed file(s))`. Ran: `TZ=UTC TMPDIR=/data/flybot-tmp npm run verify` at this tip → exit 0 (lint, build check, patches check/canonical, core suite, social/tree/timeline/workflow/project suites). Red first: on a branch carrying only the two tests, `install.test.js` read `# tests 5 / # pass 4 / # fail 1` (red at `actual: undefined`) and `settings-readonly-pages.test.js` read `# tests 14 / # pass 13 / # fail 1` (red at `General draws the folding picker`, `0 !== 1`). With `channel.js` and `settings.js` restored to `main` on this tree the two files read `5/4/1` and `14/12/2` — the second red there is the same new test plus the 7→8 count, which necessarily fails while the picker is gone. Not run: no browser click-through (the picker is pressed through the cell harness, a stateful React mock that runs the real `onClick`). No `npm ci` / `npm run harness` in this checkout — `node_modules` was carried over at this same `core/package-lock.json` (byte-identical to the previous slice's). No smoke test: the change touches no `index.js` and no host turn path.
1 parent 5ca430c commit 98d2390

14 files changed

Lines changed: 5901 additions & 6341 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Settings → General now has a **Message folding** choice — Compact, Standard or No folding — for how much of a long chat message shows before it folds, and the choice is saved for the whole team ([#3114](https://github.com/ThinkFlowLab/FlyBot/issues/3114)).

‎core/client.js‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,12 @@ var ZH = {
486486
About: "简介",
487487
"Show less": "收起",
488488
"Show more": "展开",
489+
"Message folding": "消息折叠",
490+
"Choose how much of a long message to show before it folds.": "选择长消息在对话里折叠前展示多少内容。",
491+
Compact: "紧凑",
492+
Standard: "标准",
493+
"No folding": "不折叠",
494+
"Message folding must be compact, standard or none": "消息折叠必须是紧凑、标准或不折叠",
489495
"Showing {shown} of {count}": "显示 {shown} / {count}",
490496
"Showing all {count}": "显示全部 {count}",
491497
"Admin leads": "管理员主持",
@@ -20070,6 +20076,8 @@ var NOTIFY_KINDS = [
2007020076
];
2007120077
var SEND_KEY_LABELS = [["enter", "Enter to send"], ["shift-enter", "Shift+Enter to send"]];
2007220078
var sendKeyLabel = (key) => SEND_KEY_LABELS.find(([id]) => id === key)?.[1] ?? SEND_KEY_LABELS[0][1];
20079+
var FOLD_MODE_LABELS = [["compact", "Compact"], ["standard", "Standard"], ["none", "No folding"]];
20080+
var foldModeLabel = (mode) => FOLD_MODE_LABELS.find(([id]) => id === mode)?.[1] ?? "Standard";
2007320081
function PluginsView({ answer = null, error = "", onFlip }) {
2007420082
const plugins = answer?.plugins ?? [];
2007520083
const profile = typeof answer?.profile === "string" && answer.profile !== "" ? answer.profile : "<profile>";
@@ -20133,6 +20141,7 @@ function PluginsPage({ call: call4 }) {
2013320141
}
2013420142
function GeneralPage({ roster, actions, run }) {
2013520143
const prefs = roster.prefs ?? {};
20144+
const folding = foldingOf(prefs);
2013620145
const themes = allThemes();
2013720146
const current = themes[prefs.theme] ? prefs.theme : "deepseek";
2013820147
const [custom, setCustom] = (0, import_react45.useState)(prefs.accent ?? "#4d6bfe");
@@ -20161,6 +20170,11 @@ function GeneralPage({ roster, actions, run }) {
2016120170
{ key: "shortcuts", title: t("Shortcuts") },
2016220171
(0, import_react45.createElement)(SetRow, { label: t("Send shortcut"), hint: t(sendKeyLabel(sendKey)) })
2016320172
),
20173+
(0, import_react45.createElement)(
20174+
SetSection,
20175+
{ key: "folding", title: t("Message folding") },
20176+
(0, import_react45.createElement)(SetRow, { label: t("Message folding"), hint: t(foldModeLabel(folding.mode)) })
20177+
),
2016420178
(0, import_react45.createElement)(
2016520179
SetSection,
2016620180
{ key: "notify", title: t("Notifications") },
@@ -20224,6 +20238,25 @@ function GeneralPage({ roster, actions, run }) {
2022420238
}, t(sendKeyLabel(id)))))
2022520239
)
2022620240
),
20241+
(0, import_react45.createElement)(
20242+
SetSection,
20243+
{ key: "folding", title: t("Message folding") },
20244+
(0, import_react45.createElement)(
20245+
SetRow,
20246+
{
20247+
label: t("Message folding"),
20248+
hint: t("Choose how much of a long message to show before it folds.")
20249+
},
20250+
(0, import_react45.createElement)(Segmented, { label: t("Message folding"), value: folding.mode, className: "bt-appearance-seg" }, FOLD_MODE_LABELS.map(([id, label]) => (0, import_react45.createElement)("button", {
20251+
key: id,
20252+
type: "button",
20253+
"aria-pressed": folding.mode === id,
20254+
onClick: () => {
20255+
if (folding.mode !== id) run(actions.setPrefs({ folding: { mode: id } }));
20256+
}
20257+
}, t(label))))
20258+
)
20259+
),
2022720260
// One switch for every system notification (#353), then one per kind (#469).
2022820261
(0, import_react45.createElement)(
2022920262
SetSection,

‎core/src/client/i18n.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,12 @@ const ZH = {
456456
About: '简介',
457457
'Show less': '收起',
458458
'Show more': '展开',
459+
'Message folding': '消息折叠',
460+
'Choose how much of a long message to show before it folds.': '选择长消息在对话里折叠前展示多少内容。',
461+
Compact: '紧凑',
462+
Standard: '标准',
463+
'No folding': '不折叠',
464+
'Message folding must be compact, standard or none': '消息折叠必须是紧凑、标准或不折叠',
459465
'Showing {shown} of {count}': '显示 {shown} / {count}',
460466
'Showing all {count}': '显示全部 {count}',
461467
'Admin leads': '管理员主持',

‎core/src/client/settings.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { FolderMenu } from './folder-menu.js'
2525
import { AboutPage } from './about.js'
2626
import { t } from './i18n.js'
2727
import { readOnlyLine } from './read-only.js'
28+
import { foldingOf } from './message-fold.js'
2829

2930
const capitalize = word => word[0].toUpperCase() + word.slice(1)
3031

@@ -54,6 +55,10 @@ const NOTIFY_KINDS = [
5455
// (composer.js writes localStorage), so the host stores no send-key field.
5556
const SEND_KEY_LABELS = [['enter', 'Enter to send'], ['shift-enter', 'Shift+Enter to send']]
5657
const sendKeyLabel = key => SEND_KEY_LABELS.find(([id]) => id === key)?.[1] ?? SEND_KEY_LABELS[0][1]
58+
// How much of a long message shows before it folds (#3114). The host keeps the choice, so
59+
// the row writes `set-prefs` and every window folds the same way.
60+
const FOLD_MODE_LABELS = [['compact', 'Compact'], ['standard', 'Standard'], ['none', 'No folding']]
61+
const foldModeLabel = mode => FOLD_MODE_LABELS.find(([id]) => id === mode)?.[1] ?? 'Standard'
5762
// Settings → Plugins (#2564): the four feature plugins, each with one switch. The
5863
// switch writes FlyBot's state.json; the packages stay installed and the next start
5964
// reads the answer, so nothing unloads from the session that flipped it.
@@ -112,6 +117,7 @@ function PluginsPage({ call }) {
112117
// General is Appearance and Notifications; the switch to classic Agent mode is the account menu's (#393).
113118
function GeneralPage({ roster, actions, run }) {
114119
const prefs = roster.prefs ?? {}
120+
const folding = foldingOf(prefs)
115121
const themes = allThemes()
116122
const current = themes[prefs.theme] ? prefs.theme : 'deepseek'
117123
const [custom, setCustom] = useState(prefs.accent ?? '#4d6bfe')
@@ -134,6 +140,8 @@ function GeneralPage({ roster, actions, run }) {
134140
h(SetRow, { label: t('Accent'), hint: accent ? t(capitalize(accent)) : prefs.accent ?? t('Default') })),
135141
h(SetSection, { key: 'shortcuts', title: t('Shortcuts') },
136142
h(SetRow, { label: t('Send shortcut'), hint: t(sendKeyLabel(sendKey)) })),
143+
h(SetSection, { key: 'folding', title: t('Message folding') },
144+
h(SetRow, { label: t('Message folding'), hint: t(foldModeLabel(folding.mode)) })),
137145
h(SetSection, { key: 'notify', title: t('Notifications') },
138146
h(SetRow, { label: t('In other chats'), hint: prefs.notifications !== false ? t('On') : t('Off') }),
139147
NOTIFY_KINDS.map(([kind, label]) => h(SetRow, { key: kind, label: t(label), hint: prefs.notifications !== false && prefs.notify?.[kind] !== false ? t('On') : t('Off') }))),
@@ -162,6 +170,15 @@ function GeneralPage({ roster, actions, run }) {
162170
key: id, type: 'button', 'aria-pressed': sendKey === id,
163171
onClick: () => chooseSendKey(id),
164172
}, t(sendKeyLabel(id))))))),
173+
h(SetSection, { key: 'folding', title: t('Message folding') },
174+
h(SetRow, {
175+
label: t('Message folding'),
176+
hint: t('Choose how much of a long message to show before it folds.'),
177+
},
178+
h(Segmented, { label: t('Message folding'), value: folding.mode, className: 'bt-appearance-seg' }, FOLD_MODE_LABELS.map(([id, label]) => h('button', {
179+
key: id, type: 'button', 'aria-pressed': folding.mode === id,
180+
onClick: () => { if (folding.mode !== id) run(actions.setPrefs({ folding: { mode: id } })) },
181+
}, t(label)))))),
165182
// One switch for every system notification (#353), then one per kind (#469).
166183
h(SetSection, { key: 'notify', title: t('Notifications') },
167184
h(SwitchRow, {

‎core/src/host/channel.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import { visibleText } from '../shared/preview.js'
1212
import { excerpt } from './text.js'
1313

1414
const NOTIFY_KINDS = ['approval', 'finished', 'failed']
15+
// How much of a long message a bubble shows before it folds (#3114); the client reads the
16+
// mode back through `foldingOf`, which treats anything else as the default.
17+
const FOLD_MODES = new Set(['compact', 'standard', 'none'])
1518
const LANGUAGES = { zh: 'Chinese (简体中文)', en: 'English' }
1619
// How long a burst of the user's lines is collected before it opens one turn (#642).
1720
const SETTLE_MS = 1_500
@@ -310,6 +313,15 @@ export function install(rt) {
310313
if (budget === undefined) delete state.prefs.turnBudget
311314
else state.prefs.turnBudget = budget
312315
}
316+
// Message folding (#3114): a team-wide mode in `{ mode }`; `null` clears it back to the
317+
// default, and a mode no bubble can draw is refused instead of stored.
318+
if (body.folding !== undefined) {
319+
const raw = body.folding
320+
const mode = raw?.mode ?? state.prefs.folding?.mode ?? 'standard'
321+
if (raw === null) delete state.prefs.folding
322+
else if (typeof raw === 'object' && !Array.isArray(raw) && FOLD_MODES.has(mode)) state.prefs.folding = { mode }
323+
else throw invalid('Message folding must be compact, standard or none')
324+
}
313325
return rt.save()
314326
}
315327

‎core/test/install.test.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,23 @@ const TEAM = {
201201
questions: {},
202202
}
203203

204+
// The message folding mode (#3114) is a team preference: one window writes it, and every window
205+
// reads it back through the roster, where `foldingOf` decides how much of a long message shows.
206+
// `null` clears it to the default, and a mode no bubble can draw is refused rather than stored.
207+
test('set-prefs stores the message folding mode and refuses any other one (#3114)', async (t) => {
208+
const { call, stop } = start(TEAM)
209+
t.after(stop)
210+
assert.deepEqual((await call('set-prefs', { folding: { mode: 'compact' } })).value.folding, { mode: 'compact' })
211+
assert.deepEqual((await call('state')).value.prefs.folding, { mode: 'compact' })
212+
for (const folding of [{ mode: 'wild' }, ['compact'], 'compact']) {
213+
assert.deepEqual((await call('set-prefs', { folding })).error, { code: 'bot/invalid', message: 'Message folding must be compact, standard or none', details: {} })
214+
}
215+
assert.deepEqual((await call('state')).value.prefs.folding, { mode: 'compact' }, 'a refusal stores nothing')
216+
assert.deepEqual((await call('set-prefs', { folding: { mode: 'standard' } })).value.folding, { mode: 'standard' })
217+
assert.equal('folding' in (await call('set-prefs', { folding: null })).value, false)
218+
assert.equal((await call('set-prefs', { folding: { mode: 'none' } })).value.folding.mode, 'none')
219+
})
220+
204221
test('in the Desktop profile read_browser is the last tool and reads through the window', async (t) => {
205222
const { ctx, call, stop } = start(TEAM, { services: { profileContext: { name: 'desktop' } } })
206223
t.after(stop)

‎core/test/settings-readonly-pages.test.js‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ const expand = (node, out = [], depth = 0, deep = false) => {
177177
return out
178178
}
179179

180-
const mount = (roster, key, id, name, calls = []) => {
181-
const actions = makeActions(calls)
180+
const mount = (roster, key, id, name, calls = [], override = undefined) => {
181+
const actions = override ?? makeActions(calls)
182182
slots = []
183183
effects = []
184184
index = 0
@@ -261,7 +261,7 @@ test('a writable window keeps every page as it is today (#2474)', () => {
261261
const general = mount(baseRoster, 'general', null, 'GeneralPage').nodes
262262
assert.equal(general.filter(node => node.type === 'select').length, 1, 'General keeps its theme select')
263263
assert.equal(general.filter(node => node.type === 'input').length, 1, 'General keeps its colour field')
264-
assert.equal(counts(general), 7, 'General keeps its four switches beside the send-key picker')
264+
assert.equal(counts(general), 8, 'General keeps its four switches beside the send-key and folding pickers')
265265
assert.equal(general.filter(node => node.type === Segmented && node.props?.label === 'Send shortcut').length, 1, 'General draws the send-key picker')
266266

267267
const bots = mount(baseRoster, 'bots', null, 'BotsPage').nodes
@@ -275,6 +275,26 @@ test('a writable window keeps every page as it is today (#2474)', () => {
275275
assert.ok(mount(baseRoster, 'secrets', null, 'SecretsPage').nodes.some(node => nameOf(node) === 'SecretRow'), 'Secrets keeps its rows')
276276
})
277277

278+
// General → Message folding (#3114): the picker writes the mode through `set-prefs`, so the
279+
// host stores one team-wide choice and every window folds by it. The locked page keeps the
280+
// mode in use as text, like every other page here.
281+
test('Settings → General picks the message folding mode and writes it through set-prefs (#3114)', () => {
282+
const roster = { ...baseRoster, prefs: { ...baseRoster.prefs, folding: { mode: 'compact' } } }
283+
const written = []
284+
const { nodes } = mount(roster, 'general', null, 'GeneralPage', [], { setPrefs: payload => { written.push(payload); return Promise.resolve(payload) } })
285+
const pickers = nodes.filter(node => node.type === Segmented && node.props?.label === 'Message folding')
286+
assert.equal(pickers.length, 1, 'General draws the folding picker')
287+
const buttons = all(pickers[0]).filter(node => nameOf(node) === 'button')
288+
assert.deepEqual(buttons.map(text), ['Compact', 'Standard', 'No folding'])
289+
assert.deepEqual(buttons.map(button => button.props['aria-pressed']), [true, false, false], 'the stored mode is the one in use')
290+
buttons[1].props.onClick()
291+
// The page runs inside a vm realm, so its own object is compared by value, not by prototype.
292+
assert.deepEqual(JSON.parse(JSON.stringify(written)), [{ folding: { mode: 'standard' } }], 'Standard asks the host to store standard')
293+
const locked = mount({ ...roster, readOnly: SENTENCE }, 'general', null, 'GeneralPage').nodes
294+
assert.equal(locked.filter(node => node.type === Segmented && node.props?.label === 'Message folding').length, 0, 'a locked page draws no folding picker')
295+
assert.ok(text(locked).includes('Compact'), 'and keeps the mode in use as text')
296+
})
297+
278298
// The window can be unlocked under a page that is already on screen: the other window holding
279299
// the team closes, the host's read-only sentence goes away, and settings.js keeps the same
280300
// dialog instance (its key is the page and the id, not the lock). A page whose locked view

‎docs/subsystems/core-client.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The browser side of the patched `ds-bot` core (`core/`): sources in `core/src/cl
2020
- A Settings dialog takes focus when it opens (`useDialogFocus` in `core/src/client/overlay-hooks.js`; the `.bt-settings` dialog carries `tabIndex -1` and a ref) and gives it back to the still-connected opener when it closes; it is not a focus trap, so Tab can still leave the dialog for the page behind the scrim (#2251). It is drawn for `DIALOG_EXIT_MS` (160 ms) with `pointer-events: none` on the leaving layer, so the unmount restores focus only while the dialog still holds it (or nothing does) — a click on the page during that window keeps its focus (#2270).
2121
- Settings → Feedback's error list (`feedback.js`) still titles the block with the whole log (`Recent errors · 60`) but lists only the newest eight, so when the report holds more rows one `Show more` control (`aria-expanded`) sits under them beside a count of what is drawn against the whole log the title counts (`Showing 8 of 60` while folded, `Showing 50 of 60` open, and `Showing all 50` only when the payload holds the whole log), and draws every loaded error, folding back to `Show less`; a report of eight or fewer draws neither (#2266, #2884, #2932).
2222
- An error toast keeps the host's code: `reportError` in `index.js` puts `error.code` into the toast payload and `feedback.js` draws it as a `bt-tag bt-toast-code`, so a reader can tell `bot/read-only` from any other refusal. That code is also the one action a toast can take: a `bot/read-only` toast offers **Reload** (`bt-toast-reload`) in place, which dismisses the toast and runs the client's own full-state read (`actions.reloadTeam`), so the window becomes writable once the other holder let go without a page reload that would drop the composer; a failed read goes to `actions.reportError(error, 'reload')` the way the sidebar's Reload does. Every other code, and a toast with no code, draws the sentence and **Details** exactly as before (P-502). That sentence is never blank: `api.js` answers a host refusal that carries no message of its own with `Request failed` (`result.error?.message || 'Request failed'` on the thrown error and on the noted copy alike), so a surface that prints `error.message` shows a refusal rather than nothing, and a memory row whose count sentence tests the failure for truth settles on it instead of `Loading…` (#2411). Tests: `core/test/api-empty-message.test.js`.
23-
- A long chat message folds to a whole-line preview at the standard cap (12 lines, or 800 characters, whichever comes first) with one **Show more** control inside the bubble that opens the whole reply and becomes **Show less** (`message-fold.js` `FoldedContent`, drawn by `cells.js` for a Bot reply and by `user-message.js` for my own line; `foldingOf(roster.prefs)` reads the mode — standard by default, `none` folding nothing). A reply still streaming, and one at or under the cap, are never folded, and the preview never leaves a code block open. The document card and the Settings preference are a later slice. Tests: `core/test/message-fold.test.js`. The draw reaches the bubble as the `draw` property, not as children: a cell component is expanded from its props alone (`core/test/tool-cells.test.js`).
23+
- A long chat message folds to a whole-line preview at the standard cap (12 lines, or 800 characters, whichever comes first) with one **Show more** control inside the bubble that opens the whole reply and becomes **Show less** (`message-fold.js` `FoldedContent`, drawn by `cells.js` for a Bot reply and by `user-message.js` for my own line; `foldingOf(roster.prefs)` reads the mode — standard by default, `none` folding nothing). A reply still streaming, and one at or under the cap, are never folded, and the preview never leaves a code block open. The mode is chosen in Settings → General (`Message folding`, written through `set-prefs`); the document card is a later slice. Tests: `core/test/message-fold.test.js`. The draw reaches the bubble as the `draw` property, not as children: a cell component is expanded from its props alone (`core/test/tool-cells.test.js`).
2424
- A link picked in a chat message opens in FlyBot's own panel: a capture-phase click handler on each bubble and on the person's own line (`bubbleLinkClick` in `cells.js`; a group card's container carries none, so a reply's link opens the tab of the Bot that spoke) takes an `http(s)` anchor before the host's delegate does, puts a tab in the panel's browser view (the globe button's view) with `actions.browserNewTab` and carries the URL with `actions.browserNavigate`; `browserNewTab` answers `null` for a Bot outside the roster, and with no tab — or no Desktop bridge — the page opens in the window itself. A mention, a file link and a modified or middle click are left alone, and the bubble renders bare `MarkdownText` so the host's `openFile`/`fileImages` reach it: a nested `MarkdownDelegateProvider` replaces the host's capabilities, and one that lacked `fileImages` drew every bubble image as its alt text (#2319). Left to the host a click opened a tab in the host's right sidebar, which this panel's fixed layer covers, so the content area looked blank (#2201). Tests: `core/test/chat-link-open.test.js`.
2525

2626
## Does not own

0 commit comments

Comments
 (0)