Skip to content

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

Merge feat/windows-onboarding-m5-05-wordless-props into feat/windows-onboarding-m5-06-in-page-cards

AdamPlatin12354620ada3b34
diff --cc app/src/import.mjs
index e43db970,fc7525c3..0d9ac773
--- a/app/src/import.mjs
+++ b/app/src/import.mjs
@@@ -152,52 -141,9 +162,54 @@@ export async function copySessions(from
return found.map(({ id }) => id)
}
+// Thrown when measuring runs out of time.
+const OVER = Symbol('over budget')
+
+// The bytes under `path` into `tally`, links counted as themselves and what cannot be read as
+// nothing; `tally.regen` takes the bytes inside the folders that REGENERABLE names.
+async function measure(path, clock, tally, regen = false) {
+ if (clock.now() > clock.until) throw OVER
+ const entry = await lstat(path).catch(() => undefined)
+ if (entry === undefined) return
+ if (!entry.isDirectory()) {
+ tally.bytes += entry.size
+ if (regen) tally.regen += entry.size
+ return
+ }
+ for (const name of await readdir(path).catch(() => [])) await measure(join(path, name), clock, tally, regen || REGENERABLE.has(name))
+}
+
+/**
+ * What the import card says about the team (windows-onboarding §4): how many of its Sessions are
+ * there, the bytes of its chats (the team's own files but its workspace, its Sessions and the
+ * attachments), of its work files (the team workspace) and of the regenerable folders among
+ * them. The sizes are left out when measuring takes longer than `budget` ms: a team workspace can
+ * hold many a node_modules.
+ * @returns {Promise<{ sessions: number, chats?: number, work?: number, regen?: number }>}
+ */
+export async function teamSizes(from, team, { budget = 2000, now = Date.now } = {}) {
+ const { found } = sessionDirs(from, sessionIdsOf(team))
+ const clock = { until: now() + budget, now }
+ const chats = { bytes: 0, regen: 0 }
+ const work = { bytes: 0, regen: 0 }
+ try {
+ const bot = join(from, 'bot')
+ for (const name of await readdir(bot).catch(() => [])) {
+ if (!LEFT_BEHIND.has(name)) await measure(join(bot, name), clock, chats)
+ }
+ for (const { id, group } of found) await measure(join(from, 'sessions', group, id), clock, chats)
+ await measure(join(from, 'attachments'), clock, chats)
+ await measure(join(bot, 'workspace'), clock, work)
+ } catch (error) {
+ if (error === OVER) return { sessions: found.length }
+ throw error
+ }
+ return { sessions: found.length, chats: chats.bytes, work: work.bytes, regen: work.regen }
+}
+
const logVersion = name => parseSessionFormatLogFilename(name.replace(/\.(zstd|zst|gz|br)$/u, ''))
+ const isNewer = (from, { id, group }) => readdirSync(join(from, 'sessions', group, id))
+ .some(name => (logVersion(name) ?? 0) > sessionFormatCatalog.currentVersion)
/** The Sessions whose log is in a newer format than the pinned DSH reads. */
export function newerSessions(from, team) {
@@@ -300,11 -271,10 +342,11 @@@ async function copyThroughStage({ found
signal?.throwIfAborted()
await mkdir(workspace, { recursive: true })
- if (existsSync(join(oldBot, 'workspace'))) {
+ if (!skipWork && existsSync(join(oldBot, 'workspace'))) {
+ const leave = leaveRegenerable ? path => path.split(/[\\/]/u).some(name => REGENERABLE.has(name)) : undefined
// Bots that ran npm or pnpm there leave links, some of them to nothing.
- const skipped = await copyTree(join(oldBot, 'workspace'), workspace, { force: false, skip: true, signal })
+ const skipped = await copyTree(join(oldBot, 'workspace'), workspace, { force: false, skip: true, signal, leave, seen })
- if (skipped.length > 0) console.warn('DeepSeek Bot: the import skipped what it could not read in the old team workspace:', skipped)
+ if (skipped.length > 0) console.warn('DS Bot: the import skipped what it could not read in the old team workspace:', skipped)
}
signal?.throwIfAborted()
const keys = []
diff --cc app/src/main.mjs
index b7380f3d,fc125269..60144af1
--- a/app/src/main.mjs
+++ b/app/src/main.mjs
@@@ -67,8 -67,8 +69,8 @@@ const frameFile = join(app.getPath('use
// Loaded once the start window is up (loadModules).
let BotBrowserGuests, partitionOf, BotViews, isBotId, importFromBrowser, listSources, applyCookies, CookieImports, parseCookieFile
-let downloadSaver, chooseLocations, defaultPlaces, pickRoot, programFolder, saveLocations, teamIn, teamsAt, tx, HostProcess
-let copySessions, findTeam, importTeam, restoreSessions, teamInUse, userDshHome, copyData, copyReason, moveProblem, CHECK_PROFILE, PROFILE
+let downloadSaver, chooseLocations, defaultPlaces, lang, pickRoot, programFolder, saveLocations, teamIn, teamsAt, tx, HostProcess
- let copySessions, findTeam, importTeam, teamInUse, teamSizes, userDshHome, copyData, copyReason, moveProblem, CHECK_PROFILE, PROFILE, ImportFlow
++let copySessions, findTeam, importTeam, restoreSessions, teamInUse, teamSizes, userDshHome, copyData, copyReason, moveProblem, CHECK_PROFILE, PROFILE, ImportFlow
let watchReleases, watchUpdates, RELEASE_PAGE, getDshRuntimeVersion, electronUpdater
let mainWindow
@@@ -273,10 -274,9 +275,10 @@@ async function loadModules()
;({ applyCookies, CookieImports } = cookies)
;({ parseCookieFile } = cookieFiles)
;({ downloadSaver } = downloads)
- ;({ chooseLocations, defaultPlaces, pickRoot, programFolder, saveLocations, teamIn, teamsAt, tx } = firstRun)
+ ;({ chooseLocations, defaultPlaces, lang, pickRoot, programFolder, saveLocations, teamIn, teamsAt, tx } = firstRun)
;({ HostProcess } = hostProcess)
- ;({ copySessions, findTeam, importTeam, teamInUse, teamSizes, userDshHome } = imports)
- ;({ copySessions, findTeam, importTeam, restoreSessions, teamInUse, userDshHome } = imports)
++ ;({ copySessions, findTeam, importTeam, restoreSessions, teamInUse, teamSizes, userDshHome } = imports)
+ ;({ ImportFlow } = flows)
;({ copyData, copyReason, moveProblem } = moves)
;({ CHECK_PROFILE, PROFILE } = profile)
;({ watchReleases, watchUpdates, RELEASE_PAGE } = updatesModule)
@@@ -576,8 -581,14 +578,17 @@@ async function startEngine(mine)
updatesStarted = true
updates = startUpdates()
updates?.subscribe((state) => { mainWindow?.webContents.send(IPC.appUpdateChanged, state) })
+
+ }
- // Before the Host, which reads the Sessions.
- await restoreSessions(places.dataDir).then(({ copied, newer }) => {
- if (copied.length > 0) console.log(`DS Bot: copied ${copied.join(', ')}, which the import left out`)
- if (newer.length > 0) console.warn(`DS Bot: this DSH cannot read ${newer.join(', ')}, which the import left out`)
- }, (error) => { console.error('DS Bot: the Sessions the import left out were not copied:', error) })
- host = newHost()
++ // Before a new Host, which reads the Sessions; the engine warmed on an import that was not
++ // taken has nothing left out.
++ if (warm === undefined) {
++ await restoreSessions(places.dataDir).then(({ copied, newer }) => {
++ if (copied.length > 0) console.log(`DS Bot: copied ${copied.join(', ')}, which the import left out`)
++ if (newer.length > 0) console.warn(`DS Bot: this DSH cannot read ${newer.join(', ')}, which the import left out`)
++ }, (error) => { console.error('DS Bot: the Sessions the import left out were not copied:', error) })
+ }
+ host = warm?.host ?? newHost()
host.onMessage(message => {
if (message?.type !== 'ds-bot:browser-endpoint' || typeof message.id !== 'string' || !isBotId(message.botId)) return
const downloadRoots = message.downloadRoots
@@@ -589,104 -600,7 +600,104 @@@
host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, url })
}).catch(() => host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, error: 'Could not create the browser endpoint.' }))
})
- return host.start()
+ const engine = await (warm?.up ?? host.start())
+ // The copying card stays on 「启动团队」 until the engine of the copied team is up.
+ if (mine === attempt) startWindow.card(undefined)
+ return engine
+}
+
+// The import card while the engine warms up on the new data location (windows-onboarding §4,
+// start-window §6). The places are saved once the card has its answer. Undefined when this start
+// gives way (a quit, another place, the failure page); else the engine that warmed up, when the
+// start goes on with it: 〔先不复制〕 takes it as it is, without a restart.
+async function importStep(mine) {
+ const offer = importOffer
+ const where = { ...places }
+ const signal = AbortSignal.any([copyAbort.signal, bootAbort.signal])
+ const warm = newHost()
+ host = warm
+ let warmStopped = false
+ const up = warm.start()
+ // The engine's arc fills once it is up; the team's waits for the answer.
+ up.then(() => { if (mine === attempt && !warmStopped) startWindow.done('engine') }, () => {})
+ const sizes = await teamSizes(offer.from, offer.team).catch((error) => { console.error(error); return { sessions: 0 } })
+ let result
+ for (;;) {
+ if (signal.aborted || mine !== attempt) return undefined
+ const flow = new ImportFlow({
+ offer: { from: offer.from, bots: offer.bots, rooms: offer.rooms, names: botNames(offer.team), sessions: sizes.sessions, sizes, profiles: offer.profiles },
+ ask: (card, options) => askCard(card, { signal, ...options }),
+ show: (card) => { startWindow.card(card) },
+ room: () => ({ free: freeSpace(where.dataDir), drive: driveOf(where.dataDir) }),
+ inUse: () => teamInUse(offer.from),
+ until,
+ check: (checkSignal, onProgress) => checkTeam(where, checkSignal, onProgress),
+ // The copy goes into the data location that the engine has started on once, and with the
+ // engine stopped.
+ warmed: async () => {
+ await up
+ warmStopped = true
+ await warm.stop()
+ if (host === warm) host = undefined
+ },
+ copy: options => importTeam({ from: offer.from, to: where.dataDir, workspace: where.workspace, dsh: getDshRuntimeVersion(), ...options }),
+ reasonOf: copyReason,
+ progress: setProgress,
+ lang: lang(),
+ signal,
+ })
+ importFlow = flow
+ // The card's and the copy's time is not the engine's: the start's clock stands still, and
+ // the 180 s question with it.
+ copying = startWindow.asking(flow.run())
+ try {
+ result = await copying
+ } finally {
+ copying = undefined
+ importFlow = undefined
+ }
+ if (result.outcome !== 'pick') break
+ if (await importElsewhere(signal)) return undefined
+ }
+ if (result.outcome === 'gone' || signal.aborted || mine !== attempt) return undefined
+ importOffer = undefined
+ saveLocations(where)
+ if (result.outcome === 'copied') {
+ const { summary } = result
- console.log(`DeepSeek Bot: copied ${String(summary.bots)} Bots and ${String(summary.sessions)} Sessions from ${summary.from}`)
++ console.log(`DS Bot: copied ${String(summary.bots)} Bots and ${String(summary.sessions)} Sessions from ${summary.from}`)
+ // The team lives here now; moving it is Settings' job (the data move).
+ startWindow.place(undefined)
+ return {}
+ }
+ startWindow.card(undefined)
+ return { warm: warmStopped ? undefined : { host: warm, up } }
+}
+
+const botNames = team => Object.values(team.bots ?? {}).map(bot => bot?.name).filter(name => typeof name === 'string' && name !== '')
+
+// 〔选择其他位置…〕 on the import's space card, or 「换个位置…」 while the import card is up: the
+// picker and the root rule as for 「换个位置…」 (changePlace), asked on cards that this import
+// waits for. True once the start begins again in the new root; false to go back to the import
+// card.
+async function importElsewhere(signal) {
+ for (;;) {
+ const picked = await pickRoot(pickFrom(places.dataDir), signal, ui())
+ if (signal.aborted || picked === undefined) return false
+ const root = rootOf(picked, { dshHome: userDshHome(), program: app.isPackaged ? programFolder() : undefined, current: places })
+ if (root.same) return false
+ if (root.reason !== undefined) {
- console.log(`DeepSeek Bot: the place ${root.at} cannot be used (${root.reason})`)
++ console.log(`DS Bot: the place ${root.at} cannot be used (${root.reason})`)
+ if (await askCard({ kind: 'rejected', reason: root.reason, path: root.at }, { signal }) === 'pick') continue
+ return false
+ }
+ if (root.added) {
+ const answer = await askCard({ kind: 'picked', path: root.root }, { signal })
+ if (answer === 'pick') continue
+ if (answer !== 'use') return false
+ }
+ await startOver(root)
+ return true
+ }
}
function handleIpc() {
@@@ -860,9 -812,10 +872,9 @@@ async function checkTeam(where, signal
await check.stop()
}
} catch (error) {
- if (!signal.aborted) console.error('DeepSeek Bot: the chats were not checked before the copy:', error)
+ if (!signal.aborted) console.error('DS Bot: the chats were not checked before the copy:', error)
return 0
} finally {
- setProgress(-1)
await rm(home, { recursive: true, force: true, maxRetries: 5 }).catch((error) => { console.error(error) })
}
}
diff --cc app/src/page-card.css
index f58ac1b9,00000000..dabcddfc
mode 100644,000000..100644
--- a/app/src/page-card.css
+++ b/app/src/page-card.css
@@@ -1,48 -1,0 +1,48 @@@
- /* DeepSeek Bot's own questions in the team window: one card over the page in place of a message
++/* DS Bot's own questions in the team window: one card over the page in place of a message
+ box (main.mjs askInWindow, preload.cjs showCard). The main process inserts this sheet; the
+ colors and springs are the start window's, scoped to the card's layer so that the page's own
+ stay as they are. */
+/* tokens */
+/* Generated from the DeepSeek theme in ds-bot/src/client/themes.js, inks.js and styles.js by scripts/start-assets.mjs; do not edit. */
+.dsb-card-layer{color-scheme:light dark;--bt-main:#fcfcfc;--bt-card:#ffffff;--bt-ink:#141414;--bt-ink-2:rgba(20,20,20,0.6);--bt-line:rgba(20,20,20,0.08);--bt-line-2:rgba(20,20,20,0.15);--bt-hover:rgba(119,119,119,.09);--bt-accent:#4d6bfe;--bt-accent-ink:#ffffff;--bt-ink-deepseek:#4D6BFE;--bt-green:#00c972;--bt-danger:#e02135}
+@media (prefers-color-scheme:dark){.dsb-card-layer{--bt-main:#141414;--bt-card:#1f1f1f;--bt-ink:#f2f2f2;--bt-ink-2:rgba(242,242,242,0.6);--bt-line:rgba(242,242,242,0.08);--bt-line-2:rgba(242,242,242,0.15);--bt-hover:rgba(160,160,160,.12);--bt-accent:#5b7bff;--bt-accent-ink:#141414;--bt-ink-deepseek:#6A84FF}}
+/* /tokens */
+/* springs */
+/* Generated from ds-bot/src/client/motion.js by scripts/start-assets.mjs; do not edit. */
+.dsb-card-layer {
+ --spring-shape: linear(0.0000,0.0510,0.1692,0.3153,0.4639,0.6001,0.7163,0.8102,0.8823,0.9350,0.9717,0.9955,1.0098,1.0171,1.0198,1.0195,1.0175,1.0147,1.0117,1.0089,1.0064,1.0044,1.0028,1.0016,1.0000);
+ --spring-shape-ms: 420ms;
+ --spring-tap: linear(0.0000,0.0541,0.1776,0.3279,0.4784,0.6141,0.7281,0.8187,0.8874,0.9369,0.9709,0.9928,1.0057,1.0124,1.0150,1.0149,1.0134,1.0112,1.0089,1.0067,1.0048,1.0033,1.0021,1.0013,1.0000);
+ --spring-tap-ms: 290ms;
+ --spring-pop: linear(0.0000,0.0698,0.2385,0.4520,0.6677,0.8566,1.0027,1.1009,1.1539,1.1695,1.1578,1.1293,1.0931,1.0566,1.0245,0.9997,0.9830,0.9740,0.9713,0.9732,0.9781,0.9842,0.9904,0.9958,1.0000);
+ --spring-pop-ms: 430ms;
+ --spring-stretch: linear(0.0000,0.0740,0.2474,0.4594,0.6666,0.8422,0.9740,1.0602,1.1060,1.1202,1.1126,1.0924,1.0670,1.0419,1.0204,1.0042,0.9934,0.9875,0.9856,0.9863,0.9887,0.9917,0.9947,0.9974,1.0000);
+ --spring-stretch-ms: 560ms;
+ --spring-list: linear(0.0000,0.0138,0.0503,0.1030,0.1666,0.2367,0.3099,0.3836,0.4556,0.5244,0.5891,0.6489,0.7034,0.7525,0.7962,0.8347,0.8681,0.8969,0.9215,0.9421,0.9592,0.9733,0.9846,0.9936,1.0000);
+ --spring-list-ms: 190ms;
+}
+/* /springs */
+
+.dsb-card-layer{position:fixed;inset:0;z-index:2147483646;display:grid;place-items:center;padding:16px;box-sizing:border-box;background:rgba(0,0,0,.28);font:14px/22px -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei UI",system-ui,sans-serif;color:var(--bt-ink);-webkit-app-region:no-drag;app-region:no-drag;opacity:0;transition:opacity .16s ease-in}
+@media (prefers-color-scheme:dark){.dsb-card-layer{background:rgba(0,0,0,.5)}}
+.dsb-card-layer[data-open]{opacity:1;transition:opacity .22s ease-out}
+.dsb-card-layer *{box-sizing:border-box}
+.dsb-card{width:min(440px,100%);max-height:calc(100vh - 32px);overflow:auto;padding:20px 24px;border:1px solid var(--bt-line-2);border-radius:12px;background:var(--bt-card);box-shadow:0 12px 40px rgba(0,0,0,.18);text-align:left;translate:0 8px;scale:.98;transition:translate .16s ease-in,scale .16s ease-in,filter .16s ease-in}
+.dsb-card-layer[data-open] .dsb-card{translate:0 0;scale:1;transition:translate var(--spring-shape-ms) var(--spring-shape),scale var(--spring-shape-ms) var(--spring-shape)}
+/* The way out is the start window's card exit: down 6 px, to .975, blurred 3 px. */
+.dsb-card-layer[data-leaving] .dsb-card{translate:0 6px;scale:.975;filter:blur(3px)}
+.dsb-card-title{margin:0;font-size:15px;line-height:22px;font-weight:600;color:var(--bt-ink);white-space:pre-line;overflow-wrap:anywhere}
+.dsb-card-detail{margin:6px 0 0;font-size:14px;line-height:22px;color:var(--bt-ink-2);white-space:pre-line;overflow-wrap:anywhere}
+.dsb-card-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-top:18px}
+.dsb-card-btn{all:unset;display:inline-flex;align-items:center;justify-content:center;flex:none;height:36px;padding:0 16px;border-radius:999px;background:var(--bt-hover);color:var(--bt-ink);font:inherit;font-size:14px;line-height:20px;white-space:nowrap;cursor:pointer;transition:background-color .12s,color .12s,scale var(--spring-tap-ms) var(--spring-tap)}
+.dsb-card-btn:hover{background:color-mix(in srgb,var(--bt-hover),var(--bt-ink) 6%)}
+.dsb-card-btn:active{scale:.96}
+.dsb-card-btn:focus-visible{outline:2px solid var(--bt-accent);outline-offset:2px}
+.dsb-card-btn[data-look=primary]{background:var(--bt-accent);color:var(--bt-accent-ink)}
+.dsb-card-btn[data-look=primary]:hover{background:color-mix(in srgb,var(--bt-accent),var(--bt-ink) 10%)}
+/* start-window §9: fades only, .12 s in and .16 s out, without movement, scale or blur. */
+@media (prefers-reduced-motion:reduce){
+ .dsb-card-layer[data-open]{transition:opacity .12s ease-out}
+ .dsb-card,.dsb-card-layer[data-open] .dsb-card,.dsb-card-layer[data-leaving] .dsb-card{translate:none;scale:none;filter:none;transition:none}
+ .dsb-card-btn,.dsb-card-btn:active{transition:background-color .12s,color .12s;scale:none}
+}
diff --cc app/src/start-window.mjs
index b7b1a5a2,7c9bd12e..c0ce563f
--- a/app/src/start-window.mjs
+++ b/app/src/start-window.mjs
@@@ -251,13 -246,11 +251,13 @@@ export function startSnapshot(state, no
return snapshot
}
- export const detailsText = ({ version, platform, arch, reason, lines }) => [`DeepSeek Bot ${version} (${platform} ${arch})`, `reason: ${reason}`, '', ...lines].join('\n')
+ export const detailsText = ({ version, platform, arch, reason, lines }) => [`DS Bot ${version} (${platform} ${arch})`, `reason: ${reason}`, '', ...lines].join('\n')
- const note = message => { console.log(`DeepSeek Bot: start window: ${message}`) }
+ const note = message => { console.log(`DS Bot: start window: ${message}`) }
// The page sends a button's detail as { value }; anything else counts as none.
const valueOf = payload => (payload !== null && typeof payload === 'object' && typeof payload.value === 'string' ? payload.value.slice(0, 40) : undefined)
+// An option of the import card: its name and whether it is ticked.
+const optionOf = payload => (payload !== null && typeof payload === 'object' && typeof payload.option === 'string' ? { option: payload.option.slice(0, 40), value: payload.value === true } : undefined)
export class StartWindow {
#o
diff --cc app/src/start/text.mjs
index 326ac1fb,e900fc07..d7405561
--- a/app/src/start/text.mjs
+++ b/app/src/start/text.mjs
@@@ -157,16 -155,22 +157,16 @@@ export const TEXT =
'dialog.move.nested': '请选择现在的数据文件夹以外的位置。',
'dialog.move.workspace': '数据文件夹和总工作区不能互相包含。',
'dialog.move.notEmpty': '请选择一个空文件夹,或者新建一个。',
- 'dialog.move.confirm': '把 DeepSeek Bot 的数据移到 {to} 吗?',
- 'dialog.move.detail': 'DeepSeek Bot 会把数据复制过去,然后重新启动。{from} 会原样保留,确认一切正常后可以自己删掉。',
+ 'dialog.move.confirm': '把 DS Bot 的数据移到 {to} 吗?',
+ 'dialog.move.detail': 'DS Bot 会把数据复制过去,然后重新启动。{from} 会原样保留,确认一切正常后可以自己删掉。',
'dialog.move.inUse': '另一个 DeepSeek Harness 正在使用这份数据,所以没有移动。请先关掉它,再重试。',
- 'dialog.move.failed': '数据没有复制成功:{message}\n\nDeepSeek Bot 会继续使用原来位置的数据。',
- 'dialog.update.ready': 'DeepSeek Bot {version} 已经下载好。',
+ 'dialog.move.failed': '数据没有复制成功:{message}\n\nDS Bot 会继续使用原来位置的数据。',
- 'dialog.import.found': 'DeepSeek Harness 里有 {bots} 个 Bot 和 {groups} 个群聊。要复制到 DS Bot 吗?',
- 'dialog.import.foundDetail': '会复制 Bot、群聊、记忆、对话、附件、模型设置和 API Key。{home} 里的内容不会改变,复制以后两边各用各的。',
- 'dialog.import.inUse': 'DeepSeek Harness 正在使用这个团队。请先关掉它,再重试。',
- 'dialog.import.newer': '有 {n} 段对话是更新版本的 DeepSeek Harness 写的,这个版本的 DS Bot 读不了。请先更新 DS Bot,再打开它来复制团队。',
- 'dialog.import.whichModels': 'DS Bot 用哪一份模型设置?',
- 'dialog.import.failed': '团队没有复制完:{message}\n\nDS Bot 会用一个新团队开始。DeepSeek Harness 里的团队没有变化。',
+ 'dialog.update.ready': 'DS Bot {version} 已经下载好。',
'dialog.update.readyDetail': '现在重启就能更新;不重启的话,下次退出时安装。',
- 'dialog.update.available': 'DeepSeek Bot {version} 已经发布。',
- 'dialog.update.availableDetail': '这个版本不能自己更新。请到发布页下载新版,再用它替换「应用程序」里的 DeepSeek Bot。',
- 'dialog.update.onFailure': 'DeepSeek Bot {version} 下载完会自动安装,然后重新打开。',
- 'dialog.update.onFailurePage': 'DeepSeek Bot {version} 已经发布。关掉这个对话框后,会打开它的下载页面。',
+ 'dialog.update.available': 'DS Bot {version} 已经发布。',
+ 'dialog.update.availableDetail': '这个版本不能自己更新。请到发布页下载新版,再用它替换「应用程序」里的 DS Bot。',
+ 'dialog.update.onFailure': 'DS Bot {version} 下载完会自动安装,然后重新打开。',
+ 'dialog.update.onFailurePage': 'DS Bot {version} 已经发布。关掉这个对话框后,会打开它的下载页面。',
},
en: {
// voice
@@@ -304,16 -306,22 +304,16 @@@
'dialog.move.nested': 'Choose a place outside the current data folder.',
'dialog.move.workspace': 'The data folder and the team workspace cannot hold each other.',
'dialog.move.notEmpty': 'Choose an empty folder or make a new one.',
- 'dialog.move.confirm': 'Move DeepSeek Bot’s data to {to}?',
- 'dialog.move.detail': 'DeepSeek Bot copies its data there and starts again. {from} stays as it is; you can delete it yourself once everything works.',
+ 'dialog.move.confirm': 'Move DS Bot’s data to {to}?',
+ 'dialog.move.detail': 'DS Bot copies its data there and starts again. {from} stays as it is; you can delete it yourself once everything works.',
'dialog.move.inUse': 'Another DeepSeek Harness is using this data, so it was not moved. Close it, then try again.',
- 'dialog.move.failed': 'The data was not copied: {message}\n\nDeepSeek Bot goes on with its data where it was.',
- 'dialog.update.ready': 'DeepSeek Bot {version} has finished downloading.',
+ 'dialog.move.failed': 'The data was not copied: {message}\n\nDS Bot goes on with its data where it was.',
- 'dialog.import.found': 'DeepSeek Harness has {bots|Bot|Bots} and {groups|group chat|group chats}. Copy them into DS Bot?',
- 'dialog.import.foundDetail': 'Copied: Bots, group chats, memory, chats, attachments, model settings and API Keys. Nothing in {home} changes; after the copy each side goes its own way.',
- 'dialog.import.inUse': 'DeepSeek Harness is using this team. Close it, then try again.',
- 'dialog.import.newer': '{n|chat was|chats were} written by a newer DeepSeek Harness than this version of DS Bot can read. Update DS Bot first, then open it to copy the team.',
- 'dialog.import.whichModels': 'Which model settings should DS Bot use?',
- 'dialog.import.failed': 'The team wasn’t fully copied: {message}\n\nDS Bot starts with a new team. The team in DeepSeek Harness is unchanged.',
+ 'dialog.update.ready': 'DS Bot {version} has finished downloading.',
'dialog.update.readyDetail': 'Restart now to update; if you don’t, it installs the next time you quit.',
- 'dialog.update.available': 'DeepSeek Bot {version} is out.',
- 'dialog.update.availableDetail': 'This version can’t update itself. Download the new version from its release page, then replace DeepSeek Bot in Applications with it.',
- 'dialog.update.onFailure': 'DeepSeek Bot {version} installs itself when its download is done, and then opens again.',
- 'dialog.update.onFailurePage': 'DeepSeek Bot {version} is out. Once this box is closed, its download page opens.',
+ 'dialog.update.available': 'DS Bot {version} is out.',
+ 'dialog.update.availableDetail': 'This version can’t update itself. Download the new version from its release page, then replace DS Bot in Applications with it.',
+ 'dialog.update.onFailure': 'DS Bot {version} installs itself when its download is done, and then opens again.',
+ 'dialog.update.onFailurePage': 'DS Bot {version} is out. Once this box is closed, its download page opens.',
},
}
diff --cc app/test/helpers/app-harness.mjs
index 8730d9f9,1fba076e..4239fe3e
--- a/app/test/helpers/app-harness.mjs
+++ b/app/test/helpers/app-harness.mjs
@@@ -20,17 -20,17 +20,18 @@@ export const waitFor = async (check, wh
/**
* Start the app on throwaway folders: the places are chosen already and the one-time notice
* is answered, so that the app asks nothing. The Host answers when the test lets it.
- * @param {{ packaged?: boolean, saved?: object, acknowledged?: boolean }} options whether the app
- * is a packaged one, with an updater; what else locations.json keeps beside the places; whether
- * the tray notice was answered already
- * @param {{ packaged?: boolean, saved?: object, firstRun?: boolean }} options whether the app is a packaged
- * one, with an updater; what else locations.json keeps beside the places; a first run keeps
- * its places unchosen, so that it asks
++ * @param {{ packaged?: boolean, saved?: object, acknowledged?: boolean, firstRun?: boolean }} options
++ * whether the app is a packaged one, with an updater; what else locations.json keeps beside the
++ * places; whether the tray notice was answered already; a first run keeps its places unchosen,
++ * so that it asks
*/
- export const startApp = async ({ packaged = true, saved = {}, acknowledged = true } = {}) => {
-export const startApp = async ({ packaged = true, saved = {}, firstRun = false } = {}) => {
++export const startApp = async ({ packaged = true, saved = {}, acknowledged = true, firstRun = false } = {}) => {
const home = mkdtempSync(join(tmpdir(), 'ds-bot-main-home-'))
const workspace = join(home, 'workspace')
mkdirSync(workspace, { recursive: true })
mkdirSync(paths.userData, { recursive: true })
- writeFileSync(join(paths.userData, 'locations.json'), JSON.stringify({ dataDir: home, workspace, ...saved }))
+ if (!firstRun) writeFileSync(join(paths.userData, 'locations.json'), JSON.stringify({ dataDir: home, workspace, ...saved }))
- writeFileSync(join(paths.userData, 'tray-close-acknowledged'), '')
+ if (acknowledged) writeFileSync(join(paths.userData, 'tray-close-acknowledged'), '')
hold()
await import('../../src/main.mjs')
// The app is a packaged one, so that it has an updater. The flag comes after the start,
diff --cc app/test/helpers/fake-electron.mjs
index 198d36ea,46790565..ade38eba
--- a/app/test/helpers/fake-electron.mjs
+++ b/app/test/helpers/fake-electron.mjs
@@@ -112,8 -112,7 +112,8 @@@ class FakeWebContents extends EventEmit
this.mainFrame = {}
this.isDestroyed = () => this.win.destroyed
this.getURL = () => this.win.url
+ this.isLoading = () => false
- this.getTitle = () => 'DeepSeek Bot'
+ this.getTitle = () => 'DS Bot'
this.sent = []
this.send = (...args) => { this.sent.push(args) }
this.setWindowOpenHandler = () => {}
diff --cc app/test/import-flow.test.mjs
index b85d1703,00000000..fd4e8229
mode 100644,000000..100644
--- a/app/test/import-flow.test.mjs
+++ b/app/test/import-flow.test.mjs
@@@ -1,261 -1,0 +1,261 @@@
+// The first run's import on the start page's cards: what each card says, the order of the cards,
+// and what the copy does with the answers. The disk, the engine and the window are test doubles.
+import assert from 'node:assert/strict'
+import { test } from 'node:test'
+import { copySize, defaultOptions, etaMinutes, ImportFlow, modelChoices } from '../src/import-flow.mjs'
+
+const GB = 2 ** 30
+const tick = () => new Promise((resolve) => { setImmediate(resolve) })
+
+// An import of six Bots with 1.2 GB of chats and 3.4 GB of work files, 0.4 GB of them regenerable.
+function harness({ inUse = () => false, free = 100 * GB, check = async () => 0, copy, sizes, profiles } = {}) {
+ const cards = []
+ const shown = []
+ const answers = []
+ let respond
+ const io = {
+ offer: {
- from: '/home/u/.dsh', bots: 6, rooms: 2, names: ['Chief', 'Writer', 'Coder', 'Tester'], sessions: 3,
++ from: '/home/user/.dsh', bots: 6, rooms: 2, names: ['Chief', 'Writer', 'Coder', 'Tester'], sessions: 3,
+ sizes: sizes ?? { sessions: 3, chats: 1.2 * GB, work: 3.4 * GB, regen: 0.4 * GB },
+ profiles: profiles ?? [{ name: 'web', rows: [{ id: 'llm-deepseek' }] }, { name: 'desktop', rows: [{ id: 'agent-default-model', config: { model: 'deepseek/v4' } }] }],
+ },
+ ask: (card, options) => {
+ cards.push(card)
+ return new Promise((resolve) => {
+ respond = resolve
+ void options?.settle?.then(() => { resolve('settled') })
+ if (answers.length > 0) resolve(answers.shift())
+ })
+ },
+ show: (card) => { shown.push(card) },
+ room: () => ({ free, drive: 'C' }),
+ inUse,
+ until: async (check, signal) => { while (!signal.aborted && !check()) await tick() },
+ check: async (signal, onProgress) => { onProgress(3, 3); return check(signal) },
+ warmed: async () => {},
- copy: copy ?? (async ({ onProgress }) => { onProgress(2.6 * GB); return { bots: 6, sessions: 3, from: '/home/u/.dsh' } }),
++ copy: copy ?? (async ({ onProgress }) => { onProgress(2.6 * GB); return { bots: 6, sessions: 3, from: '/home/user/.dsh' } }),
+ reasonOf: () => 'other',
+ lang: 'zh',
+ signal: new AbortController().signal,
+ }
+ return { io, cards, shown, answer: (value) => { if (respond) { const r = respond; respond = undefined; r(value) } else answers.push(value) } }
+}
+
+test('the model settings of DSH Desktop come first, then DSH Web, then the profile with most rows', () => {
+ const choices = modelChoices([
+ { name: 'other', rows: [{}, {}, {}] },
+ { name: 'web', rows: [{}] },
+ { name: 'spare', rows: [{}] },
+ { name: 'desktop', rows: [{ id: 'agent-default-model', config: { model: 'deepseek/v4' } }] },
+ ])
+ assert.deepEqual(choices.map(choice => choice.id), ['desktop', 'web', 'other', 'spare'])
+ assert.equal(choices[0].label, 'DSH Desktop · deepseek/v4')
+ assert.equal(choices[1].label, 'DSH Web')
+})
+
+test('the regenerable folders stay behind by default from 200 MB on, and the sizes follow the options', () => {
+ const sizes = { chats: 1.2 * GB, work: 3.4 * GB, regen: 0.4 * GB }
+ assert.deepEqual(defaultOptions(sizes), { regen: true, skipWork: false })
+ assert.deepEqual(defaultOptions({ ...sizes, regen: 0.1 * GB }), { regen: false, skipWork: false })
+ assert.equal(copySize(sizes, { regen: true, skipWork: false }).work, 3 * GB)
+ assert.equal(copySize(sizes, { regen: false, skipWork: false }).total, 4.6 * GB)
+ assert.equal(copySize(sizes, { regen: true, skipWork: true }).total, 1.2 * GB)
+ assert.equal(copySize({ chats: 1 }, { regen: false, skipWork: false }), undefined, 'sizes that ran out of time are not guessed')
+})
+
+test('the time left is in whole minutes, moves a full minute at a time and never counts down to 0', () => {
+ assert.equal(etaMinutes(null, { done: 1, total: 10, elapsedMs: 1000 }), null, 'no rate in the first 3 s')
+ assert.equal(etaMinutes(null, { done: 1, total: 10, elapsedMs: 60_000 }), 9)
+ assert.equal(etaMinutes(9, { done: 1.05, total: 10, elapsedMs: 60_000 }), 9, 'under a minute of change keeps the number')
+ assert.equal(etaMinutes(9, { done: 2, total: 10, elapsedMs: 60_000 }), 4)
+ assert.equal(etaMinutes(4, { done: 99, total: 100, elapsedMs: 600_000 }), 0, 'under a minute is 「不到 1 分钟」')
+})
+
+test('the import card says what it found, what the copy takes and which model settings go along', async () => {
+ const { io, cards, answer } = harness()
+ const flow = new ImportFlow(io)
+ const run = flow.run()
+ await tick()
+ const card = cards[0]
+ assert.equal(card.kind, 'import')
- assert.deepEqual([card.bots, card.groups, card.sessions, card.path], [6, 2, 3, '/home/u/.dsh'])
++ assert.deepEqual([card.bots, card.groups, card.sessions, card.path], [6, 2, 3, '/home/user/.dsh'])
+ assert.equal(card.names, 'Chief、Writer、Coder')
+ assert.deepEqual([card.chats, card.work, card.total, card.bare], ['1.2 GB', '3.0 GB', '4.2 GB', ''])
+ assert.equal(card.model, 'DSH Desktop · deepseek/v4')
+ assert.deepEqual(card.models.map(model => model.id), ['desktop', 'web'])
+ assert.deepEqual(card.options, { regen: true, skipWork: false })
+ answer('skip')
+ assert.deepEqual(await run, { outcome: 'skipped' })
+})
+
+test('the card follows a changed model and options, and the copy takes them', async () => {
+ let taken
+ const { io, shown, answer } = harness({ copy: async (options) => { taken = options; return { bots: 6, sessions: 3 } } })
+ const flow = new ImportFlow(io)
+ const run = flow.run()
+ await tick()
+ flow.act('importModel', 'web')
+ flow.act('importOption', { option: 'skipWork', value: true })
+ flow.act('importOption', { option: 'elsewhere', value: true })
+ flow.act('importModel', 'nowhere')
+ assert.equal(shown.length, 2, 'unknown models and options change nothing')
+ assert.equal(shown.at(-1).model, 'DSH Web')
+ assert.equal(shown.at(-1).total, '1.2 GB')
+ answer('copy')
+ const result = await run
+ assert.equal(result.outcome, 'copied')
+ assert.equal(taken.profile, 'web')
+ assert.equal(taken.skipWork, true)
+ assert.equal(taken.leaveRegenerable, true)
+})
+
+test('sizes that took too long leave the numbers out of the card instead of guessing', async () => {
+ const { io, cards, answer } = harness({ sizes: { sessions: 3 } })
+ const run = new ImportFlow(io).run()
+ await tick()
+ assert.equal(cards[0].bare, 'Bare')
+ assert.equal(cards[0].total, undefined)
+ answer('copy')
+ assert.equal((await run).outcome, 'copied', 'no space check without sizes')
+})
+
+test('a drive without room for the copy and 500 MB says how much is missing', async () => {
+ const { io, cards, answer } = harness({ free: 4 * GB })
+ const run = new ImportFlow(io).run()
+ await tick()
+ answer('copy')
+ await tick()
+ assert.equal(cards[1].kind, 'importSpace')
+ assert.deepEqual([cards[1].need, cards[1].free, cards[1].short, cards[1].drive], ['4.6 GB', '4.0 GB', '681 MB', 'C'])
+ answer('pick')
+ assert.deepEqual(await run, { outcome: 'pick' })
+})
+
+test('「换个位置…」 on the import card picks another place for the import', async () => {
+ const { io, answer } = harness()
+ const run = new ImportFlow(io).run()
+ await tick()
+ answer('pick')
+ assert.deepEqual(await run, { outcome: 'pick' })
+})
+
+test('a team that DSH holds waits on its card and the copy goes on by itself once DSH lets go', async () => {
+ let held = true
+ let checks = 0
+ const { io, cards, answer } = harness({ inUse: () => held, check: async () => { checks += 1; return 0 } })
+ const run = new ImportFlow(io).run()
+ await tick()
+ assert.equal(checks, 0, 'chats that DSH is writing are not checked')
+ answer('copy')
+ while (cards.length < 2) await tick()
+ assert.equal(cards[1].kind, 'inUse')
+ held = false
+ assert.equal((await run).outcome, 'copied')
+ assert.equal(checks, 1, 'the chats are checked once DSH let go')
+})
+
+test('a holder that comes while the card checks the chats makes that check count for nothing', async () => {
+ let held = false
+ let checks = 0
+ const { io, cards, answer } = harness({
+ inUse: () => held,
+ check: async (signal) => {
+ checks += 1
+ if (checks === 1) await new Promise((resolve) => { signal.addEventListener('abort', resolve) })
+ return 0
+ },
+ })
+ const run = new ImportFlow(io).run()
+ await tick()
+ held = true
+ await tick()
+ await tick()
+ answer('copy')
+ while (cards.length < 2) await tick()
+ assert.equal(cards[1].kind, 'inUse')
+ held = false
+ assert.equal((await run).outcome, 'copied')
+ assert.equal(checks, 2)
+})
+
+test('the copying card counts the checked chats, then the bytes, then starts the team', async () => {
+ const { io, shown, answer } = harness()
+ const run = new ImportFlow(io).run()
+ await tick()
+ answer('copy')
+ const result = await run
+ assert.equal(result.outcome, 'copied')
+ const copying = shown.filter(card => card.kind === 'copying')
+ assert.deepEqual(copying[0].steps[0], { a: 3, b: 3 })
+ assert.equal(copying.at(-1).step, 3)
+ assert.equal(copying.at(-1).steps[1].b, '4.2 GB')
+ assert.ok(copying.some(card => card.step === 2), 'the copy shows its own step')
+})
+
+test('〔停止复制〕 asks on the card, 〔继续复制〕 goes back, and the confirmed stop leaves no team', async () => {
+ let release
+ let stopped = false
+ const { io, shown, answer } = harness({
+ copy: ({ signal }) => new Promise((resolve, reject) => {
+ release = () => { resolve({ bots: 6, sessions: 3 }) }
+ signal.addEventListener('abort', () => { stopped = true; reject(new Error('stopped')) })
+ }),
+ })
+ const flow = new ImportFlow(io)
+ const run = flow.run()
+ await tick()
+ answer('copy')
+ while (release === undefined) await tick()
+ flow.act('stopCopy')
+ assert.equal(shown.at(-1).kind, 'stopCopy')
+ flow.act('keepCopying')
+ assert.equal(shown.at(-1).kind, 'copying')
+ flow.act('stopCopy')
+ flow.act('stopCopy', 'confirm')
+ assert.deepEqual(await run, { outcome: 'skipped' })
+ assert.equal(stopped, true)
+})
+
+test('chats newer than this DSH reads say so, and the start goes on without the team', async () => {
+ let copied = false
+ const { io, cards, answer } = harness({ check: async () => 2, copy: async () => { copied = true } })
+ const run = new ImportFlow(io).run()
+ await tick()
+ answer('copy')
+ while (cards.length < 2) await tick()
+ assert.deepEqual(cards[1], { kind: 'newer', n: 2 })
+ answer('startWithout')
+ assert.deepEqual(await run, { outcome: 'skipped', newer: true })
+ assert.equal(copied, false)
+})
+
+test('a failed copy offers to try again, and the second copy can go through', async () => {
+ let tries = 0
+ const { io, cards, answer } = harness({
+ copy: async () => {
+ tries += 1
+ if (tries === 1) throw new Error('EBUSY: resource busy\nmore')
+ return { bots: 6, sessions: 3 }
+ },
+ })
+ io.reasonOf = () => 'inUse'
+ const run = new ImportFlow(io).run()
+ await tick()
+ answer('copy')
+ while (cards.length < 2) await tick()
+ assert.deepEqual(cards[1], { kind: 'importFailed', reason: 'inUse', log: ['EBUSY: resource busy', 'more'] })
+ answer('retry')
+ assert.equal((await run).outcome, 'copied')
+ assert.equal(tries, 2)
+})
+
+test('a quit or another start while a card waits ends the import without an answer', async () => {
+ const quit = new AbortController()
+ const { io } = harness()
+ io.signal = quit.signal
+ io.ask = (card, options) => new Promise((resolve) => { quit.signal.addEventListener('abort', () => { resolve(undefined) }); void options })
+ const run = new ImportFlow(io).run()
+ await tick()
+ quit.abort()
+ assert.deepEqual(await run, { outcome: 'gone' })
+})
diff --cc app/test/main-import.test.mjs
index ae748913,00000000..bb7a8c5a
mode 100644,000000..100644
--- a/app/test/main-import.test.mjs
+++ b/app/test/main-import.test.mjs
@@@ -1,68 -1,0 +1,68 @@@
+// The first start of an app whose user has a team in their own DSH: the start page offers it on
+// the import card instead of message boxes, the copy shows its steps on the copying card, and the
+// engine starts on the copied team. The home and the DSH home are throwaway folders, so the test
+// never sees the user's own; the Electron parts and the Host are test doubles.
+import assert from 'node:assert/strict'
+import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { dirname, join } from 'node:path'
+import { test } from 'node:test'
+import { app, paths, state } from './helpers/fake-electron.mjs'
+import { hold, state as hostState } from './helpers/fake-host-process.mjs'
+import { handOff, messageBoxes, startAct, startState, startWindows, waitFor, window } from './helpers/app-harness.mjs'
+import { installHooks } from './helpers/register.mjs'
+
+const home = mkdtempSync(join(tmpdir(), 'ds-bot-import-home-'))
+process.env.HOME = home
+process.env.USERPROFILE = home
+process.env.DSH_HOME = join(home, 'dsh')
+delete process.env.DS_BOT_HOME
+delete process.env.DS_BOT_WORKSPACE
+
+const write = (path, text) => { mkdirSync(dirname(path), { recursive: true }); writeFileSync(path, text) }
+const dsh = process.env.DSH_HOME
+write(join(dsh, 'bot', 'state.json'), JSON.stringify({ bots: { b1: { id: 'b1', name: 'Chief', sessionId: 's1' }, b2: { id: 'b2', name: 'Writer', sessionId: 's2' } }, rooms: {} }))
+write(join(dsh, 'sessions', 'g', 's1', 'notes.txt'), 'one')
+write(join(dsh, 'sessions', 'g', 's2', 'notes.txt'), 'two')
+write(join(dsh, 'bot', 'workspace', 'draft.md'), 'work')
+write(join(dsh, 'bot', 'workspace', 'node_modules', 'x', 'index.js'), 'regenerable')
+
+await installHooks()
+
+const cards = () => startWindows()[0].webContents.sent.filter(([channel, snapshot]) => channel === 'ds-bot:start-state' && snapshot.card).map(([, snapshot]) => snapshot.card)
+
+test('the first start offers the DSH team on the import card, copies it on cards and starts on it', async () => {
+ mkdirSync(paths.userData, { recursive: true })
+ writeFileSync(join(paths.userData, 'tray-close-acknowledged'), '')
+ hold()
+ await import('../src/main.mjs')
+ await waitFor(() => startState()?.card?.kind === 'import', 'offer the team on the import card')
+ const offer = startState().card
+ assert.deepEqual([offer.bots, offer.groups, offer.sessions, offer.names], [2, 0, 2, 'Chief, Writer'])
+ assert.equal(offer.path, dsh)
+ assert.equal(existsSync(join(paths.userData, 'locations.json')), false, 'the places wait for the answer')
+ // The engine warms up on the new data location while the card is up.
+ hostState.release()
+ await waitFor(() => startState().done.includes('engine'), 'warm the engine up')
+ assert.equal(startState().view, 'card', 'the card stays up')
+
+ // 「不复制可以重新生成的文件夹」, ticked on the card.
+ const start = startWindows()[0]
+ start.webContents.mainFrame.url = start.url
+ state.ipc.get('ds-bot:start-act')({ sender: start.webContents, senderFrame: start.webContents.mainFrame }, 'importOption', { option: 'regen', value: true })
+ await waitFor(() => startState().card.options.regen === true, 'tick the option on the card')
+ await startAct('answer', 'copy')
+ await waitFor(() => existsSync(join(home, '.ds-bot', 'bot', 'imported.json')), 'copy the team')
+ await waitFor(() => window()?.loaded.some(url => url.includes('token=')), 'start the copied team')
+ const steps = cards().filter(card => card.kind === 'copying').map(card => card.step)
+ assert.ok(steps.includes(1) && steps.includes(2) && steps.at(-1) === 3, `the copy shows its three steps (${steps.join(',')})`)
+ assert.equal(startState().card, undefined, 'the copying card goes once the team\'s engine is up')
- assert.ok(existsSync(join(home, 'DeepSeek Bot', 'draft.md')), 'the work files came along')
- assert.equal(existsSync(join(home, 'DeepSeek Bot', 'node_modules')), false, 'the regenerable folders did not')
++ assert.ok(existsSync(join(home, 'DS Bot', 'draft.md')), 'the work files came along')
++ assert.equal(existsSync(join(home, 'DS Bot', 'node_modules')), false, 'the regenerable folders did not')
+ assert.equal(JSON.parse(readFileSync(join(paths.userData, 'locations.json'), 'utf8')).dataDir, join(home, '.ds-bot'))
+ assert.deepEqual(messageBoxes(), [], 'no message box on the way')
+ assert.equal(hostState.starts, 3, 'the warm engine, the chats\' check and the team\'s engine')
+ await handOff()
+ app.quit()
+ await waitFor(() => state.tray?.destroyed === true, 'end the app')
+})
diff --cc docs/plans/2026-10-16-desktop-app.md
index 55d2374a,d0947d7a..1d84a7ce
--- a/docs/plans/2026-10-16-desktop-app.md
+++ b/docs/plans/2026-10-16-desktop-app.md
@@@ -99,14 -99,14 +99,14 @@@
### 安装和更新
- - 应用标识(appId)是 `io.github.fei2411.deepseekbot`,以后不改:Windows 靠它认出这个应用和它的更新,macOS 用它当应用标识。
- - Windows(x64):安装向导,可以改程序位置,装完可以直接运行。只给当前用户安装:不问「为所有用户还是只为我」,不要管理员权限,默认装在 `%LOCALAPPDATA%\Programs\DeepSeek Bot`。卸载不删数据位置。
+ - 应用标识(appId)是 `io.github.fei2411.dsbot`。Windows 安装器的 GUID 保持已发布版本的值,改程序名后仍覆盖原安装,并更新快捷方式和卸载入口。
+ - Windows(x64):安装向导,可以改程序位置,装完可以直接运行。只给当前用户安装:不问「为所有用户还是只为我」,不要管理员权限,默认装在 `%LOCALAPPDATA%\Programs\DS Bot`。卸载不删数据位置。
- Windows 自动更新:后台下载,校验 sha512,下载完在窗口里提示重启以更新;不重启的话,下次退出时装上。
- 启动时查一次 GitHub 上最新的 Release,之后每 4 小时查一次。Release 里的 `latest.yml` 写着安装包的文件名和 sha512。
- - 提示是窗口上的系统对话框:「立即重启」先停掉引擎再装;「先不重启」等下次退出([启动页文案](2026-10-29-start-copy.md))。
+ - 提示是窗口里的卡片(2026-11-01 前是系统对话框):「立即重启」先停掉引擎再装;「先不重启」等下次退出,卡片画不出来也算「先不重启」([启动页文案](2026-10-29-start-copy.md))。
- 引擎起不来时也能更新:检查在引擎启动前开始(首次启动的导入之后)。启动失败时,错误框里说有新版本,关掉错误框后等下载完,装上并重新打开。
- - 应用里的 ds-bot 和 DSH 随应用一起更新:插件不自己查这两项的更新,关于页写「随 DeepSeek Bot 应用一起更新」。
- - 发版:发布 Release 时,工作流打 Windows 安装包,把它、它的 `.blockmap` 和 `latest.yml` 传到 Release。应用和 ds-bot 用同一个版本号,Release 的标签就是这个版本号。各平台的包都传完后,工作流再传 `SHA256SUMS.txt` 和不带版本号的安装包(如 `DeepSeek-Bot-win-x64.exe`),在说明开头加「下载 / Download」表,最后才把 Release 标为最新;所以发布时不勾「Set as the latest release」。
+ - 应用里的 ds-bot 和 DSH 随应用一起更新:插件不自己查这两项的更新,关于页写「随 DS Bot 应用一起更新」。
+ - 发版:发布 Release 时,工作流打 Windows 安装包,把它、它的 `.blockmap` 和 `latest.yml` 传到 Release。应用和 ds-bot 用同一个版本号,Release 的标签就是这个版本号。各平台的包都传完后,工作流再传 `SHA256SUMS.txt` 和不带版本号的安装包(如 `DS-Bot-win-x64.exe`),在说明开头加「下载 / Download」表,最后才把 Release 标为最新;所以发布时不勾「Set as the latest release」。
- macOS(Apple 芯片和 Intel):zip;不能自动更新,有新版时提示下载。不用 dmg:macOS 26 上下载的未签名 dmg 显示「已损坏」,打不开。
- 安装包带着锁定的 DSH 装上的全部文件,不按 profile 删减。
- 不用开发者证书签名,也不公证;macOS 包只做 ad-hoc 签名。macOS 第一次打开会被拦下,要到「系统设置 → 隐私与安全性」点「仍要打开」。
@@@ -155,4 -156,4 +156,5 @@@
- 2026-10-23:应用里接上 Bot 浏览器:应用自己提供 webview 桥,每个 Bot 的登录存在壳自己的数据里,删掉 Bot 时一起清掉,Issue #449。
- 2026-10-25:关掉窗口只是藏起来,应用留在系统托盘;托盘的「打开」找回窗口,「退出」是唯一的正常退出入口,Issue #500。
- 2026-10-26:关掉 DSH 网页版的自动凭据引导,模型在 DS Bot 自己的模型页和 key 卡片里配;导入时判断团队「正在用」加上锁的刷新时间,不覆盖已有的 key,总会删掉暂存文件夹;建窗口不再依赖「下载」文件夹;启动失败后再双击也能把窗口叫到前面;Release 最后才标为最新,并附 `SHA256SUMS.txt`、不带版本号的安装包和下载表([Windows 上手流程](2026-10-26-windows-onboarding.md) M1)。
+ - 2026-11-01:程序、可执行文件和安装包统一使用 DS Bot / dsbot;保留已有安装、数据、浏览器加密身份和旧客户端更新入口的兼容。
+- 2026-11-01(待维护者确认):用户要求「其他界面全部避免弹出 Windows 的框」。第一次关窗口的托盘说明、没有托盘时的「要不要结束它」、更新的两个提示、设置里搬数据的确认和「这里放不了」都改成团队窗口里的卡片:应用自己的预载在页面上盖一层,样式表由主进程插入,颜色和弹簧和启动窗口同源(`app/src/page-card.css`,由 `scripts/start-assets.mjs` 生成)。只剩系统选择框(选文件夹、选 cookie 文件、下载另存为)是系统窗口,用户同意保留。
diff --cc docs/plans/2026-10-26-start-window.md
index d6a066c1,606c12c0..b0eb797b
--- a/docs/plans/2026-10-26-start-window.md
+++ b/docs/plans/2026-10-26-start-window.md
@@@ -400,11 -399,10 +399,11 @@@
- 2026-10-28 张望:第 3 节第二张表加第 9 条,第 2 站工作时每 5 到 9 秒随机向一边看 600 ms,安静档和减少动态效果没有;维护者问「小鱼的摇晃改为摇晃-张望随机是否可行」,可行,叠在上下晃上。依据:原型 `alive.cjs` 的 wander 用例(正常档 30 秒内三次、间隔 7.8 到 8.5 秒,安静档和指针在页面上时零次)。
- 2026-10-29 先打招呼再出发:第 4 节第 2 拍,数据阶段已完成时鲸鱼也等问候读满才离开第 1 站,等的时候晃着。维护者试用落地的启动窗口时「小鲸鱼看到的时候就在第二个位置」:那次首次启动里主进程 2.9 秒就建好了数据文件夹,页面 8.6 秒才画出来(冷启动;之后两次启动 2 秒),鲸鱼浮上来 560 ms 就游到了第 2 站。依据:原型 `alive.cjs` 的 greet 用例(数据阶段在入场结束前完成时,鲸鱼入场后 1.66 秒离开第 1 站、再 0.6 秒说「热身中,等我一下」;搜索到一半完成的也一样,且不说「先找个地方放东西」)、试用副本上的实测(窗口 1.1 秒出现、数据 1.9 秒完成、页面 2.1 秒画出来;鲸鱼入场后 1.68 秒离开第 1 站;`main.mjs` 标记数据完成后紧接着就启动引擎,日志里「engine took」从那一刻起算,和问候无关)。
- 2026-10-29 文案分层:启动页的字按页面位置分层、一张表,见 [启动页文案](2026-10-29-start-copy.md);第 11 节 `text.mjs` 一条改成指向它;按各层规则改四处:45 秒的提示和「团队界面没有加载出来」去句号,「会放在 …」加句号、〔重新选〕加 …,OneDrive 的原因里「聊天记录」改成「对话」(第 5、6、7 节)。
- - 2026-10-30 圆环:维护者转来一段讨论,说启动窗口太吵(「现在这版有点噪了」「是不是可以简约一点」「其实我觉得可能就放一个鲸鱼就够,然后可以做交互动画,文字什么的不太需要」),提议只留一只浮在水上、点一下会喷水的鲸鱼,进度做成横条或圆环;比较三份草稿(水线分三段的进度条、圆环、只有鲸鱼)后选了圆环。「为什么」、第 2 到 11 节按圆环改写:三站和留下的圈换成围着鲸鱼的三段弧,每种启动都是 112 px 的鲸鱼、圆环和水线,出卡片时水塘缩到 .62 倍、上移 60 px;顺利时不说话(去掉问候、各阶段的话、「进去吧」、接模型、预览版说明和重装的提示、已用秒数,以后的启动去掉「正在打开你的团队…」),只留盘不够的提示、45 秒、180 秒、失败、卡片和搬数据;以后的启动和搬数据时 45 秒那句由鲸鱼说;点鲸鱼喷水代替转一圈;交接时剩下的弧画满、圆环合上,庆祝的那次喷水、560 ms 潜下去、0.72 秒发 `handoffShow`,不庆祝的 0.22 秒。「待定」去掉问候用哪个名字,水线那一行按圆环改写;「不做什么」和「已知限制」跟着改。依据:原型的圆环布局(82 个状态的截图都过了布局探针,探针也查圆环不碰鲸鱼的话、提示行和卡片:没有问题);`ring-live.cjs`:首次启动 `handoffShow` 在就绪后 0.72 秒(原来的布局 1.09 到 1.17 秒),以后的启动 0.23 到 0.33 秒,都在原型兜底的 1.5 秒和 0.8 秒以内,45 秒的〔打开日志文件夹〕用指针点得到,搬数据那一行在,喷水的「^ ^」眼给失败的姿势让路,〔重试〕清掉红的那段弧;一次独立评审的 10 条意见都已改正(空纸面让点击穿过、卡片在时提示行隐藏、112 px 鲸鱼入场的深度 96 / 84 px、沉下去 84 px、喷水的「^ ^」眼不盖过失败的姿势、就绪以后不喷、强制颜色覆盖弧、光、水柱和水滴、弧 0.5 s 画出来等)。桌面应用里的检查(离屏 Electron、替身桥,15 项都过):首次启动 `handoffShow` 在就绪后 0.73 秒,以后的启动 0.24 秒(引擎在就绪前 0.5 秒才起来);数据阶段在页面画出来以前完成时,第一段弧 820 ms 画满,700 ms 时完成的,565 ms 进行中、999 ms 画满。真机上的首次启动(这条分支的一次性副本,装着锁定的 DSH 0.2.1-rc.4):窗口 1.5 秒出现、页面 2.9 秒画出来,第一段弧在页面时间 2.6 秒画满;引擎 17.1 秒后第二段画满,团队 4.4 秒后就绪;`handoffShow` 在就绪后 738 ms,窗口 173 ms 后开始长大,团队窗口在就绪后 1.31 秒露面,页面上没有留下的圈和已用秒数。和原型有意不同的两处:第一段弧等的时候鲸鱼不换循环(原型先换成工作的循环,循环自己要停满的 400 ms 把弧再推迟);就绪时正在走的那一拍不再走完,剩下的弧一起画满(原型让它走完;照原型写的桌面应用里,引擎在就绪前 0.5 秒起来的以后的启动 0.46 秒才发 `handoffShow`)。评审后补正:第一段弧等的时候鲸鱼不换循环(第 4 节);以后的启动前 1 秒有第一段弧画满的那一下(第 5 节);一拍走完点一下头(第 3 节);安静档点鲸鱼时照样压扁、甩尾和「^ ^」眼;浮上来的那圈涟漪 .56 s 淡完;盘不够的那句按启动的时钟算前 10 秒,入场时就在。
+ - 2026-10-30 圆环:维护者转来一段讨论,说启动窗口太吵(「现在这版有点噪了」「是不是可以简约一点」「其实我觉得可能就放一个鲸鱼就够,然后可以做交互动画,文字什么的不太需要」),提议只留一只浮在水上、点一下会喷水的鲸鱼,进度做成横条或圆环;比较三份方案(水线分三段的进度条、圆环、只有鲸鱼)后选了圆环。「为什么」、第 2 到 11 节按圆环改写:三站和留下的圈换成围着鲸鱼的三段弧,每种启动都是 112 px 的鲸鱼、圆环和水线,出卡片时水塘缩到 .62 倍、上移 60 px;顺利时不说话(去掉问候、各阶段的话、「进去吧」、接模型、预览版说明和重装的提示、已用秒数,以后的启动去掉「正在打开你的团队…」),只留盘不够的提示、45 秒、180 秒、失败、卡片和搬数据;以后的启动和搬数据时 45 秒那句由鲸鱼说;点鲸鱼喷水代替转一圈;交接时剩下的弧画满、圆环合上,庆祝的那次喷水、560 ms 潜下去、0.72 秒发 `handoffShow`,不庆祝的 0.22 秒。「待定」去掉问候用哪个名字,水线那一行按圆环改写;「不做什么」和「已知限制」跟着改。依据:原型的圆环布局(82 个状态的截图都过了布局探针,探针也查圆环不碰鲸鱼的话、提示行和卡片:没有问题);`ring-live.cjs`:首次启动 `handoffShow` 在就绪后 0.72 秒(原来的布局 1.09 到 1.17 秒),以后的启动 0.23 到 0.33 秒,都在原型兜底的 1.5 秒和 0.8 秒以内,45 秒的〔打开日志文件夹〕用指针点得到,搬数据那一行在,喷水的「^ ^」眼给失败的姿势让路,〔重试〕清掉红的那段弧;一次独立评审的 10 条意见都已改正(空纸面让点击穿过、卡片在时提示行隐藏、112 px 鲸鱼入场的深度 96 / 84 px、沉下去 84 px、喷水的「^ ^」眼不盖过失败的姿势、就绪以后不喷、强制颜色覆盖弧、光、水柱和水滴、弧 0.5 s 画出来等)。桌面应用里的检查(离屏 Electron、替身桥,15 项都过):首次启动 `handoffShow` 在就绪后 0.73 秒,以后的启动 0.24 秒(引擎在就绪前 0.5 秒才起来);数据阶段在页面画出来以前完成时,第一段弧 820 ms 画满,700 ms 时完成的,565 ms 进行中、999 ms 画满。真机上的首次启动(这条分支的一次性副本,装着锁定的 DSH 0.2.1-rc.4):窗口 1.5 秒出现、页面 2.9 秒画出来,第一段弧在页面时间 2.6 秒画满;引擎 17.1 秒后第二段画满,团队 4.4 秒后就绪;`handoffShow` 在就绪后 738 ms,窗口 173 ms 后开始长大,团队窗口在就绪后 1.31 秒露面,页面上没有留下的圈和已用秒数。和原型有意不同的两处:第一段弧等的时候鲸鱼不换循环(原型先换成工作的循环,循环自己要停满的 400 ms 把弧再推迟);就绪时正在走的那一拍不再走完,剩下的弧一起画满(原型让它走完;照原型写的桌面应用里,引擎在就绪前 0.5 秒起来的以后的启动 0.46 秒才发 `handoffShow`)。评审后补正:第一段弧等的时候鲸鱼不换循环(第 4 节);以后的启动前 1 秒有第一段弧画满的那一下(第 5 节);一拍走完点一下头(第 3 节);安静档点鲸鱼时照样压扁、甩尾和「^ ^」眼;浮上来的那圈涟漪 .56 s 淡完;盘不够的那句按启动的时钟算前 10 秒,入场时就在。
- 2026-10-30 跳到 Chief:维护者问「要不要加个正在做的事情的简单描述,位置上调一些,启动之后流畅变形为主页面,Chief跳到主页左侧的Chief位置」,然后「三点都做」,紧接着又说「文案保持取消状态」:所以没有加描述正在做什么的字,顺利时页面上仍然没有字(第 3 节),只做了另外两点。一是位置上调:没有卡片时整组低 45 px(原来 80 px),圆环上移 35 px,出卡片时整组上移 45 px,有卡片时不变(第 2、6 节)。二是交接时鲸鱼不再潜下去,而是跳出水面,在长大的启动窗口里飞到 Main Bot 的头像会在的位置,缩到头像的大小落下,主窗口在同一个矩形上露面(第 3、4、5、7、8、9、11 节):插件的侧栏在 `dsBotApp.ready()` 里带上 Main Bot 头像的位置(只在默认的鲸鱼、头像在团队列里看得见时),主进程用 `landingOf` 换成启动页的坐标放进交接的快照,启动页的 `leap` 飞 590 ms(不庆祝的 550 ms),比主窗口露面早 30 ms 落下,`handoffDone` 改在落下时发(庆祝的 1150 ms,不庆祝的 650 ms);没有地方落时照旧潜下去。磁贴上的鲸鱼浮上来和 `dsBotApp` 的露面事件都不做了,「待定」里那一行随之去掉:团队界面里的头像不用自己动,鲸鱼落下的地方就是它;「预览版说明」盖着侧栏时鲸鱼照样落在头像的位置上,头像在遮罩下面(第 8 节)。「长大时页面上除了 Mica 什么都不能有」改成只留飞着的鲸鱼;长大时鲸鱼可能一顿一顿地动、落点在 `ready()` 之后团队列还在动时会差几个像素,记进「已知限制」;「不做什么」跟着改。依据:应用的测试(`start-window.test.mjs`:`landingOf` 在两个窗口边框相同、团队页面缩放到 125 %、只有启动窗口有系统标题栏时都算对,不像样的报告都不落;`ready()` 带着位置时交接的快照里有 `landing`,不带时没有;`start-page.test.mjs` 查 `.flight` 层),插件的侧栏测试(`app-ready.test.js`:默认的鲸鱼报告它的位置,别的样子或照片不报)。真机上的首次启动(一次性副本,装着锁定的 DSH 0.2.1-rc.4,团队页面缩放 125%):主进程记下「the whale lands at 105, 116 (60 px)」,团队窗口露面后侧栏里 Main Bot 的头像在 (104, 116)、60 px,差 1 px;`handoffShow` 在就绪后 738 ms,窗口在它之后 171 ms 开始长大,`handoffDone` 在它之后 442 ms,团队窗口在就绪后 1.32 秒露面:这台机器上长大比 300 ms 慢,鲸鱼先落下,再跟着窗口一起长到位(两次运行,落点都一样);首次启动时「预览版说明」的遮罩盖着侧栏,头像在遮罩下面
- 2026-10-31 位置行:维护者「替换之前的3点式,移除左下角的社区非官方声明,右下角的换个位置」。追问以后:「3点式」就是原来的三站,圆环已经代替了它,这次不改;维护者问「要不要显示圆环显示对应3个正在启动的阶段?」:三段弧本来就各是一个阶段(第 2 节),不加字(2026-10-30「文案保持取消状态」)。底注去掉;位置行挪到底部正中,〔换个位置…〕改成灰色的小按钮(28 px,`small`),整行在纸面下面 4 px(第 2 节);首次启动照旧有,以后的启动只在数据所在的盘剩下的不到开始时的 20% 时有:开始时的剩余空间在数据放进一个文件夹时记进 `locations.json`(`freeAtStart`;盘满时记不到,下一次再记),以前存下的位置下一次启动补记;以后的启动点〔换个位置…〕当场搬数据(第 5 节)。试的时候搬数据被拒绝弹了系统对话框,维护者:「让我们尽可能避免系统中出现任何这样的默认弹窗」。所以以后的启动搬数据时,除了系统选择框都在卡片上问:「这里放不了」用第 6 节被拒绝的那张卡(原因多「整块磁盘」和「和总工作区互相包含」两句,读不了的文件夹按没有权限),确认是新的一张「搬到这个文件夹?」〔移动并重启〕〔重新选…〕〔取消〕;确认以后启动窗口当场变成搬数据的页面,这次启动让位,等着的交接作废。还剩下的系统对话框记进「已知限制」。第 2、3、4、6、8 节和「改动的已定设计」跟着改。依据:应用的测试(`place.test.mjs`:20% 的界线;`start-window.test.mjs`:变成搬数据的页面并丢掉等着的交接;`main-low-space.test.mjs`:盘快满时以后的启动有位置行,选进数据文件夹里出「这里放不了」,读不了的 `C:\System Volume Information` 按没有权限,取消以后引擎照常起来、团队界面照常加载,〔移动并重启〕以后页面载入 `?start=moving`、引擎在复制之前停下、数据复制到新文件夹、`locations.json` 换成新文件夹和它自己的剩余空间、应用重新启动,一路没有系统对话框;`main-room-left.test.mjs`:剩余空间还多时没有位置行,换总工作区不动记下的剩余空间,设置里搬数据照旧;`main.test.mjs`:没有记过的位置这次补记;`start-page.test.mjs`:页脚只有位置行和灰色按钮、搬数据的卡);故意改坏 20% 的判断、复制前停引擎、取消时丢掉启动这三处,测试都会失败。离屏渲染的检查 17 项都过(位置行居中、指针点得到、离底边 12 px、有卡片时在纸面下面 4 px、以后的启动和失败页、英文长路径省略、深色、两张卡)。一次独立评审(四个方面,每条意见一个复核)确认 7 条,都已改正:读不了的文件夹不再把正常的启动变成失败页,盘满时记下的 0 不算数,start-copy 第 3 节、本节第 5 节、「改动的已定设计」和上手流程的说法。真机上的以后的启动(这条分支的一次性副本,G 盘剩 4.0 GB,记下的开始空间 10^15 字节):位置行「数据放在 G 盘(剩 4.0 GB)」,指针点得到;先取消选择框,启动照常走;再点、选了文件夹,团队界面在卡片开着时就绪,交接等着;卡片「搬到这个文件夹?」写着真实的路径,没有系统对话框;点〔移动并重启〕后启动窗口变成搬数据的页面,等着的交接作废(等了 13 秒),6 秒后应用在新文件夹上重新启动并交接,`locations.json` 是新文件夹和 3.99 GB。
- - 2026-11-01 不写字,加道具:用户要求「启动窗口轻易不写文字,除非出现空间不足或者报错,后者并提供一键复制/下载日志的选项」,并且「加载的时候应当有相关组件,例如放在鲸鱼面前一个正在翻动的文件夹,脉冲转动的两个齿轮」。所以去掉 45 秒的两句(「有点久,可能是杀毒软件在查新文件」「比平时慢,请再等一会儿」)、搬数据时的「正在搬 DeepSeek Bot 的数据…」和 45 秒的〔打开日志文件夹〕,慢只靠鲸鱼的姿势;位置行在首次启动也只在盘不够时有(推翻 2026-10-31「首次启动照旧显示」那一条,首次启动在盘够时就没有选位置的入口了);出错的每一页都有〔复制详细信息〕和新的〔保存日志…〕(`saveLog`,系统保存框,最后 5000 行),代替〔打开日志文件夹〕(`openLogs` 不再是启动页的动作);鲸鱼面前加每个阶段的道具:翻纸的文件夹、咬合的齿轮、跳的小成员(第 2、3、4、5、6、7、9、11 节)。另外加了开发用的三种进度画法(`DS_BOT_START_PROGRESS`,第 11 节),只为比较,不给用户。依据:启动页和启动窗口的单元测试;无头 Chrome 加替身桥录的整次启动(浅色、深色)和各阶段、失败页、180 秒、盘不够的截图;减少动态效果时道具和三种画法都没有循环动画。还没有在桌面应用里真机跑,〔保存日志…〕也还没有真点过。这次改的是已定的设计,要维护者确认。
+ - 2026-11-01 不写字,加道具:用户要求「启动窗口轻易不写文字,除非出现空间不足或者报错,后者并提供一键复制/下载日志的选项」,并且「加载的时候应当有相关组件,例如放在鲸鱼面前一个正在翻动的文件夹,脉冲转动的两个齿轮」。所以去掉 45 秒的两句(「有点久,可能是杀毒软件在查新文件」「比平时慢,请再等一会儿」)、搬数据时的「正在搬 DS Bot 的数据…」和 45 秒的〔打开日志文件夹〕,慢只靠鲸鱼的姿势;位置行在首次启动也只在盘不够时有(推翻 2026-10-31「首次启动照旧显示」那一条,首次启动在盘够时就没有选位置的入口了);出错的每一页都有〔复制详细信息〕和新的〔保存日志…〕(`saveLog`,系统保存框,最后 5000 行),代替〔打开日志文件夹〕(`openLogs` 不再是启动页的动作);鲸鱼面前加每个阶段的道具:翻纸的文件夹、咬合的齿轮、跳的小成员(第 2、3、4、5、6、7、9、11 节)。依据:启动页和启动窗口的单元测试;无头 Chrome 加替身桥录的整次启动(浅色、深色)和各阶段、失败页、180 秒、盘不够的截图;减少动态效果时道具没有循环动画。还没有在桌面应用里真机跑,〔保存日志…〕也还没有真点过。这次改的是已定的设计,要维护者确认。
+- 2026-11-01(待维护者确认):动画只有一个来源。启动窗口的卡片和团队窗口里代替系统对话框的卡片(`app/src/page-card.css`)用同一组颜色和弹簧,都由 `scripts/start-assets.mjs` 从插件的 `themes.js` 和 `motion.js` 生成:卡片出现走 `SPRING_SHAPE`,收起用启动窗口卡片的退场(下沉 6 px、缩到 .975、模糊 3px,.16 s),减少动态效果时只淡入 .12 s、淡出 .16 s(第 9 节)。导入的几张卡(第 6 节)由主进程的 `import-flow.mjs` 发快照,页面照旧只按快照画。
## 待定