Skip to content

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

Keep the start window wordless unless room runs short or the start fails

AdamPlatin1232c9dac8b520e
diff --git a/app/src/main.mjs b/app/src/main.mjs
index 07a0619f..e2367bf0 100644
--- a/app/src/main.mjs
+++ b/app/src/main.mjs
@@ -169,7 +169,7 @@ if (canonical !== undefined) {
app.once('will-quit', () => { logs.flush() })
console.log(`DeepSeek Bot ${app.getVersion()} (${process.platform} ${process.arch}), Electron ${process.versions.electron}`)
startWindow = new StartWindow({
- electron: { BrowserWindow, ipcMain, screen, shell: electronShell, clipboard, nativeTheme, systemPreferences },
+ electron: { BrowserWindow, ipcMain, screen, shell: electronShell, clipboard, dialog, nativeTheme, systemPreferences },
page: join(here, 'start', 'start.html'), preload: join(here, 'preload.cjs'), icon: iconFile, mica, devTools: !app.isPackaged,
// On Windows the locale is known only once the app is ready.
lang: () => langOf(app.getLocale()), motion: readStartFrame(frameFile).motion,
@@ -405,13 +405,15 @@ function setPlaces(next) {
made = { dataDir: !existsSync(places.dataDir), workspace: places.workspace !== undefined && !existsSync(places.workspace), root: root !== undefined && !existsSync(root) }
}
-// The line on the start page that says where the data goes and how much room is there, and the
-// short drive's note for the first 10 s (start-window §2, §4).
+// The line on the start page that says where the data goes and how much room is left, and the
+// short drive's note for the first 10 s, both only on a short drive (start-window §2, §4).
function tellPlace(dataDir) {
const free = freeSpace(dataDir)
- startWindow.place(placeOf(dataDir, { free }))
const drive = driveOf(dataDir)
- startWindow.hint(drive !== undefined && free !== undefined && free < SHORT_DRIVE_BYTES ? { drive, free: formatBytes(free) } : undefined)
+ const short = drive !== undefined && free !== undefined && free < SHORT_DRIVE_BYTES
+ // The page has no words while the start goes well: the line shows only when room runs short.
+ startWindow.place(short ? placeOf(dataDir, { free }) : undefined)
+ startWindow.hint(short ? { drive, free: formatBytes(free) } : undefined)
}
// A later start shows the line again once the drive is down to a fifth of the free space it had
diff --git a/app/src/start-window.mjs b/app/src/start-window.mjs
index e9fc0564..90ca426c 100644
--- a/app/src/start-window.mjs
+++ b/app/src/start-window.mjs
@@ -4,6 +4,7 @@
// team window's rect, and the hidden team window shows on the same rect. The rect maths, the
// growth, the snapshot and the checks are plain functions, so the tests run without Electron.
import { pathToFileURL } from 'node:url'
+import { writeFile } from 'node:fs/promises'
import { within } from './copy-tree.mjs'
export const START_STATE = 'ds-bot:start-state'
@@ -23,6 +24,8 @@ export const TEAM_VIEW_MS = 20_000
export const GROWTH = { delay: 160, duration: 300, step: 14 }
export const DESTROY_AFTER_MS = 300
export const FAILURE_LINES = 200
+// 〔保存日志…〕 saves this many of the latest log lines, after the same header as the copied details.
+export const SAVED_LINES = 5000
// The DeepSeek theme's --bt-main and --bt-ink (ui-standard 2.1), as in start.css: the window's
// own background and caption symbols, which show before the page paints and where Mica is not.
const COLORS = { light: { main: '#fcfcfc', ink: '#141414' }, dark: { main: '#141414', ink: '#f2f2f2' } }
@@ -44,8 +47,8 @@ const ACT_VIEWS = {
// The failure page's update banner: 〔下载〕 or 〔重试〕 on it, and 「手动下载」.
installUpdate: ['failed'],
manualDownload: ['failed'],
- openLogs: null,
copyDetails: null,
+ saveLog: null,
}
export const START_ACTS = Object.freeze(Object.keys(ACT_VIEWS))
@@ -280,7 +283,7 @@ export class StartWindow {
/**
* @param {{
- * electron: { BrowserWindow: any, ipcMain: any, screen: any, shell: any, clipboard: any, nativeTheme: any, systemPreferences: any },
+ * electron: { BrowserWindow: any, ipcMain: any, screen: any, shell: any, clipboard: any, dialog?: any, nativeTheme: any, systemPreferences: any },
* page: string, preload: string, icon: string, mica: boolean, devTools: boolean,
* lang: () => 'zh' | 'en', motion: string, version: string, program: string[],
* log: { dir: string, tail: (count: number) => string[] },
@@ -697,8 +700,8 @@ export class StartWindow {
else if (name === 'retry') this.#retry()
else if (name === 'wait') this.#wait()
else if (name === 'reloadView') this.#reload()
- else if (name === 'openLogs') this.#openLogs()
else if (name === 'copyDetails') this.#copyDetails()
+ else if (name === 'saveLog') void this.#saveLog()
else if (name === 'pick') this.#o.onPick?.(valueOf(payload))
else if (name === 'answer') this.#o.onAnswer?.(valueOf(payload))
else if (name === 'installUpdate' || name === 'manualDownload') this.#o.onUpdate?.(name)
@@ -731,10 +734,6 @@ export class StartWindow {
this.teamLoading()
}
- #openLogs() {
- void this.#o.electron.shell.openPath(this.#o.log.dir).then((problem) => { if (problem) note(`the logs folder did not open: ${problem}`) })
- }
-
#copyDetails() {
const { version } = this.#o
const reason = this.#state.failure?.reason ?? 'other'
@@ -742,6 +741,21 @@ export class StartWindow {
void Promise.resolve(this.#o.electron.clipboard.writeText(text)).catch((error) => { note(`the details were not copied: ${error instanceof Error ? error.message : String(error)}`) })
}
+ async #saveLog() {
+ const { version, electron } = this.#o
+ if (!electron.dialog) return
+ const reason = this.#state.failure?.reason ?? 'other'
+ const text = detailsText({ version, platform: process.platform, arch: process.arch, reason, lines: this.#o.log.tail(SAVED_LINES) })
+ try {
+ const { canceled, filePath } = await electron.dialog.showSaveDialog(this.#window, { defaultPath: 'DeepSeek-Bot-log.txt', filters: [{ name: 'Text', extensions: ['txt'] }] })
+ if (canceled || !filePath) return
+ await writeFile(filePath, text, 'utf8')
+ note(`the log was saved to ${filePath}`)
+ } catch (error) {
+ note(`the log was not saved: ${error instanceof Error ? error.message : String(error)}`)
+ }
+ }
+
#handoffShow(payload) {
if (this.#handing || this.#state.view !== 'handoff') return
const main = this.#o.mainWindow()
diff --git a/app/src/start/start.css b/app/src/start/start.css
index 28e65baa..75e0e9c5 100644
--- a/app/src/start/start.css
+++ b/app/src/start/start.css
@@ -127,8 +127,6 @@ html[data-up] .caption{opacity:0;pointer-events:none}
.caption-text{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.caption>*{opacity:0;filter:blur(6px);transition:opacity .16s,filter .16s}
.caption>[data-on]{opacity:1;filter:none;transition:opacity .22s ease-out,filter .22s ease-out}
-.caption>.btn[data-on]{transition:opacity .22s ease-out .09s,filter .22s ease-out .09s,scale var(--spring-tap-ms) var(--spring-tap) .09s}
-@starting-style{.caption>.btn[data-on]{scale:.96}}
/* sheet: one surface that every card morphs in and out of */
.sheet{position:absolute;left:48px;top:260px;width:624px;height:calc(100% - 304px)}
diff --git a/app/src/start/start.html b/app/src/start/start.html
index 5df7d57c..43849de1 100644
--- a/app/src/start/start.html
+++ b/app/src/start/start.html
@@ -27,7 +27,7 @@
<li class="station" data-phase="team" data-state="pending"><span data-t="status.phase.team"></span> <span class="sr"></span></li>
</ol>
<p class="voice"><span></span></p>
-<p class="caption"><span class="caption-text"></span><button class="btn" data-look="small" data-act="openLogs" data-t="btn.openLogs" hidden></button></p>
+<p class="caption"><span class="caption-text"></span></p>
<section class="sheet">
<div class="sheet-edge"></div><div class="sheet-fill"></div>
<div class="sheet-body">
@@ -43,10 +43,10 @@
<section class="card" data-kind="inUse" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.inUse"></h2><p class="lead" data-t="card.inUse.lead"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="skip" data-t="btn.skipCopy"></button></div></section>
<section class="card" data-kind="newerUpdating" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.newer"></h2><p class="lead" data-t="card.newerUpdating.lead"></p><p class="small"><span data-t="card.update.slow"></span> <button class="btn" data-look="link" data-act="manualDownload" data-t="btn.manualDownload"></button></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="skip" data-t="btn.skipCopy"></button></div></section>
<section class="card" data-kind="newer" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.newer"></h2><p class="lead" data-t="card.newer.lead"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="startWithout" data-t="btn.startWithout"></button><p class="foot" data-t="note.copyAgain"></p></div></section>
-<section class="card" data-kind="importFailed" hidden><div class="card-scroll"><p class="lead" data-t="card.importFailed.lead"></p><div class="card-actions"><button class="btn" data-look="primary" data-act="retry" data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="answer" data-detail="startWithout" data-t="btn.startWithout"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn disclose" data-look="link" data-act="toggleDetails" aria-expanded="false"><span data-t="btn.details"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2 8 9.7l3.5-3.5"/></svg></button></div><div class="log" hidden><pre></pre></div></div></section>
-<section class="card" data-kind="watchdog" hidden><div class="card-actions"><button class="btn" data-look="primary" data-act="wait" data-t="btn.wait"></button><button class="btn" data-look="soft" data-act="retry" data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="openLogs" data-t="btn.openLogs"></button></div></section>
-<section class="card" data-kind="failed" hidden><div class="card-scroll"><p class="lead" data-t="reason.start.{reason}"></p><div class="banner" hidden><div class="banner-row"><p class="lead" data-t="card.update.available"></p><button class="btn" data-look="primary" data-act="installUpdate" data-u="available" data-t="btn.download"></button></div><div class="banner-down" data-u="downloading"><p class="small banner-line"><span data-t="card.update.downloading"></span><span class="slow"><span data-t="card.update.slow"></span><button class="btn" data-look="link" data-act="manualDownload" data-t="btn.manualDownload"></button></span></p><div class="bar"><span class="bar-fill"></span></div></div><p class="small" data-u="installing" data-t="card.update.installing"></p><div class="banner-fail" data-u="failed"><p class="small danger" data-t="card.update.failed"></p><button class="btn" data-look="small" data-act="installUpdate" data-t="btn.retry"></button><button class="btn" data-look="small" data-act="manualDownload" data-t="btn.manualDownload"></button></div></div><div class="card-actions"><button class="btn" data-look="primary" data-act="retry" data-main data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="pick" data-detail="changePlace" data-places data-t="btn.changePlace" hidden></button><button class="btn" data-look="soft" data-act="freshStart" data-places data-t="btn.freshStart" hidden></button><button class="btn" data-look="soft" data-act="openLogs" data-t="btn.openLogs"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn disclose" data-look="link" data-act="toggleDetails" aria-expanded="false"><span data-t="btn.details"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2 8 9.7l3.5-3.5"/></svg></button></div><div class="log" hidden><pre></pre></div></div></section>
-<section class="card" data-kind="viewFailed" hidden><div class="card-actions"><button class="btn" data-look="primary" data-act="reloadView" data-t="btn.reload"></button><button class="btn" data-look="soft" data-act="openLogs" data-t="btn.openLogs"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button></div></section>
+<section class="card" data-kind="importFailed" hidden><div class="card-scroll"><p class="lead" data-t="card.importFailed.lead"></p><div class="card-actions"><button class="btn" data-look="primary" data-act="retry" data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="answer" data-detail="startWithout" data-t="btn.startWithout"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn" data-look="soft" data-act="saveLog" data-t="btn.saveLog"></button><button class="btn disclose" data-look="link" data-act="toggleDetails" aria-expanded="false"><span data-t="btn.details"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2 8 9.7l3.5-3.5"/></svg></button></div><div class="log" hidden><pre></pre></div></div></section>
+<section class="card" data-kind="watchdog" hidden><div class="card-actions"><button class="btn" data-look="primary" data-act="wait" data-t="btn.wait"></button><button class="btn" data-look="soft" data-act="retry" data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn" data-look="soft" data-act="saveLog" data-t="btn.saveLog"></button></div></section>
+<section class="card" data-kind="failed" hidden><div class="card-scroll"><p class="lead" data-t="reason.start.{reason}"></p><div class="banner" hidden><div class="banner-row"><p class="lead" data-t="card.update.available"></p><button class="btn" data-look="primary" data-act="installUpdate" data-u="available" data-t="btn.download"></button></div><div class="banner-down" data-u="downloading"><p class="small banner-line"><span data-t="card.update.downloading"></span><span class="slow"><span data-t="card.update.slow"></span><button class="btn" data-look="link" data-act="manualDownload" data-t="btn.manualDownload"></button></span></p><div class="bar"><span class="bar-fill"></span></div></div><p class="small" data-u="installing" data-t="card.update.installing"></p><div class="banner-fail" data-u="failed"><p class="small danger" data-t="card.update.failed"></p><button class="btn" data-look="small" data-act="installUpdate" data-t="btn.retry"></button><button class="btn" data-look="small" data-act="manualDownload" data-t="btn.manualDownload"></button></div></div><div class="card-actions"><button class="btn" data-look="primary" data-act="retry" data-main data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="pick" data-detail="changePlace" data-places data-t="btn.changePlace" hidden></button><button class="btn" data-look="soft" data-act="freshStart" data-places data-t="btn.freshStart" hidden></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn" data-look="soft" data-act="saveLog" data-t="btn.saveLog"></button><button class="btn disclose" data-look="link" data-act="toggleDetails" aria-expanded="false"><span data-t="btn.details"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2 8 9.7l3.5-3.5"/></svg></button></div><div class="log" hidden><pre></pre></div></div></section>
+<section class="card" data-kind="viewFailed" hidden><div class="card-actions"><button class="btn" data-look="primary" data-act="reloadView" data-t="btn.reload"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn" data-look="soft" data-act="saveLog" data-t="btn.saveLog"></button></div></section>
</div>
</section>
</main>
diff --git a/app/src/start/start.js b/app/src/start/start.js
index 573f95f8..fb11af2b 100644
--- a/app/src/start/start.js
+++ b/app/src/start/start.js
@@ -20,7 +20,7 @@ root.dataset.sheet = 'none'
const $ = selector => document.querySelector(selector)
const sheet = $('.sheet'), edge = $('.sheet-edge'), fill = $('.sheet-fill'), stage = $('.stage'), pond = $('.pond'), live = $('.live')
const voiceEl = $('.voice'), voiceText = $('.voice>span')
-const captionText = $('.caption-text'), logs = $('.caption .btn')
+const captionText = $('.caption-text')
const placeEl = $('.place'), placeText = $('.place-text')
const CODE = new Set(['path', 'dataDir', 'workspace'])
let lang = 'zh'
@@ -79,22 +79,16 @@ function varsOf(snap) {
function announce(text) { if (text) live.textContent = text }
// ---- the whale's line ----
-// One short line under the ring, and only when the user is needed: a start that runs past 45 s,
-// the 180 s question, a failure. A data move (which the user started, and which takes a while)
-// keeps its line. A card speaks with its own first line, so the whale's line is empty while a
-// card is up (the 180 s question is the exception: its card holds only the buttons). A new line
-// fades in once the old one has faded out.
+// One short line under the ring, and only when something went wrong: the 180 s question or a
+// failure. A slow start is told by the whale's pose alone. A card speaks with its own first line,
+// so the whale's line is empty while a card is up (the 180 s question is the exception: its card
+// holds only the buttons). A new line fades in once the old one has faded out.
const VOICES = { failed: 'voice.failed', viewFailed: 'voice.viewFailed', watchdog: 'voice.watchdog' }
const FADE_MS = 160
// key/text: the line chosen (on screen, or coming in once the old one has faded out).
const v = { key: '', text: '', swap: 0 }
-// Past 45 s with the engine not up yet: the whale says why it takes so long.
-const late = () => ['boot', 'moving'].includes(s.view) && !(s.done ?? []).includes('engine') && bootMs() >= 45000
function voiceWant() {
- if (VOICES[s.view]) return VOICES[s.view]
- if (s.view === 'card') return ''
- if (late()) return first ? 'voice.slow45' : 'voice.slowLater'
- return START === 'moving' ? 'voice.moving' : ''
+ return VOICES[s.view] ?? ''
}
function speak() {
if (!s) return
@@ -117,13 +111,11 @@ function put() {
}
// ---- the hint row ----
-// Empty unless the user is needed: a short drive's one-line note for the first 10 s, and from
-// 45 s 〔打开日志文件夹〕 alone, since the whale's line says why. Nothing shows while a card, the
-// 180 s question or a failure is up.
+// Empty unless room runs short: a short drive's one-line note for the first 10 s. Nothing shows
+// while a card, the 180 s question or a failure is up.
function hintWant() {
- if (s.view !== 'boot' && s.view !== 'moving') return ['', {}, false]
- if (late()) return ['', {}, true]
- return [s.hint && bootMs() < 10000 ? 'hint.space' : '', { ...s.hint }, false]
+ if (s.view !== 'boot' && s.view !== 'moving') return ['', {}]
+ return [s.hint && bootMs() < 10000 ? 'hint.space' : '', { ...s.hint }]
}
let shimmerReady = false
if (!first) setTimeout(() => { shimmerReady = true; if (s) shimmer() }, resume ? 0 : 1000)
@@ -144,10 +136,10 @@ function timeUI() {
if (booting) director.slow(first && engineDone ? 0 : ms >= 45000 ? 2 : ms >= 10000 ? 1 : 0)
if (booting && s.clock?.running) tick = setTimeout(timeUI, (sec + 1) * 1000 - ms + 4)
}
-const hint = () => { const [key, vars, withLogs] = hintWant(); caption(key, vars, withLogs) }
+const hint = () => { const [key, vars] = hintWant(); caption(key, vars) }
let captionKey = ''
let captionTimer = 0
-function caption(key, vars, withLogs) {
+function caption(key, vars) {
const text = key ? say(key, vars) : ''
if (key !== captionKey) {
const had = captionKey
@@ -156,8 +148,6 @@ function caption(key, vars, withLogs) {
const show = () => { captionText.textContent = text; captionText.toggleAttribute('data-on', Boolean(key)) }
if (had) { delete captionText.dataset.on; captionTimer = setTimeout(show, 160) } else show()
} else if (key && captionText.textContent !== text) captionText.textContent = text
- if (withLogs && logs.hidden) { logs.hidden = false; logs.dataset.on = '' }
- if (!withLogs && !logs.hidden) { delete logs.dataset.on; setTimeout(() => { if (!logs.dataset.on) logs.hidden = true }, 160) }
}
// ---- the sheet: one surface that every card morphs in and out of ----
diff --git a/app/src/start/text.mjs b/app/src/start/text.mjs
index 9bbb3820..b331c321 100644
--- a/app/src/start/text.mjs
+++ b/app/src/start/text.mjs
@@ -23,10 +23,7 @@
export const TEXT = {
zh: {
// voice
- 'voice.slow45': '有点久,可能是杀毒软件在查新文件',
- 'voice.slowLater': '比平时慢,请再等一会儿',
'voice.watchdog': '等太久了,要不要重试?',
- 'voice.moving': '正在搬 DeepSeek Bot 的数据…',
'voice.failed': 'DeepSeek Bot 没能启动',
'voice.viewFailed': '团队界面没有加载出来',
// say
@@ -98,7 +95,6 @@ export const TEXT = {
// btn
'btn.retry': '重试',
'btn.wait': '继续等待',
- 'btn.openLogs': '打开日志文件夹',
'btn.freshStart': '用新的空白团队开始…',
'btn.useRec': '放到 {rec} 盘',
'btn.keepDrive': '仍然放在 {drive} 盘',
@@ -117,6 +113,7 @@ export const TEXT = {
'btn.startWithout': '先不带团队开始',
'btn.copyDetails': '复制详细信息',
'btn.copied': '已复制',
+ 'btn.saveLog': '保存日志…',
'btn.details': '详细信息',
'btn.manualDownload': '手动下载',
'btn.reload': '重新载入',
@@ -177,10 +174,7 @@ export const TEXT = {
},
en: {
// voice
- 'voice.slow45': 'Taking a while: antivirus may be checking new files',
- 'voice.slowLater': 'Slower than usual; please wait a little longer',
'voice.watchdog': 'This is taking too long. Try again?',
- 'voice.moving': 'Moving DeepSeek Bot’s data…',
'voice.failed': 'DeepSeek Bot couldn’t start',
'voice.viewFailed': 'The team view didn’t load',
// say
@@ -252,7 +246,6 @@ export const TEXT = {
// btn
'btn.retry': 'Try again',
'btn.wait': 'Keep waiting',
- 'btn.openLogs': 'Open log folder',
'btn.freshStart': 'Start with a new blank team…',
'btn.useRec': 'Put it on drive {rec}',
'btn.keepDrive': 'Keep it on drive {drive}',
@@ -271,6 +264,7 @@ export const TEXT = {
'btn.startWithout': 'Start without the team',
'btn.copyDetails': 'Copy details',
'btn.copied': 'Copied',
+ 'btn.saveLog': 'Save log…',
'btn.details': 'Details',
'btn.manualDownload': 'Download manually',
'btn.reload': 'Reload',
diff --git a/app/test/start-page.test.mjs b/app/test/start-page.test.mjs
index 41f4d8bd..b8c3de5d 100644
--- a/app/test/start-page.test.mjs
+++ b/app/test/start-page.test.mjs
@@ -62,7 +62,7 @@ test('the page sends only the acts of the start window', () => {
...[...code['start.js'].matchAll(/\bact: '(\w+)'|\bact\('(\w+)'/gu)].map(match => match[1] ?? match[2]),
...[...code['whale.js'].matchAll(/\bact\('(\w+)'\)/gu)].map(match => match[1]),
].filter(name => !local.has(name)))
- assert.deepEqual([...sent].sort(), ['answer', 'copyDetails', 'freshStart', 'handoffDone', 'handoffShow', 'importModel', 'importOption', 'installUpdate', 'keepCopying', 'manualDownload', 'openLogs', 'pick', 'reloadView', 'retry', 'stopCopy', 'wait'])
+ assert.deepEqual([...sent].sort(), ['answer', 'copyDetails', 'freshStart', 'handoffDone', 'handoffShow', 'importModel', 'importOption', 'installUpdate', 'keepCopying', 'manualDownload', 'pick', 'reloadView', 'retry', 'saveLog', 'stopCopy', 'wait'])
// Every act the main process takes is one that the page sends, under the same name.
for (const name of START_ACTS) assert.ok(sent.has(name), `the main process takes ${name}, which the page never sends`)
})
@@ -177,13 +177,12 @@ test('every text key starts with one of the ten layers', () => {
for (const key of Object.keys(TEXT.zh)) assert.ok(LAYERS.includes(layerOf(key)), `${key}: unknown layer`)
})
-// The whale speaks only when the user is needed (past 45 s, the 180 s question, a failure, a data
-// move), and the hint row only for a short drive: no greeting, stage lines or clock.
+// The whale speaks only when something went wrong (the 180 s question, a failure), and the hint
+// row only for a short drive: no greeting, stage lines, slow-start lines or clock.
test('the whale and the hint row have only the lines for when the user is needed', () => {
const layer = name => Object.keys(TEXT.zh).filter(key => layerOf(key) === name).sort()
- assert.deepEqual(layer('voice'), ['voice.failed', 'voice.moving', 'voice.slow45', 'voice.slowLater', 'voice.viewFailed', 'voice.watchdog'])
+ assert.deepEqual(layer('voice'), ['voice.failed', 'voice.viewFailed', 'voice.watchdog'])
assert.deepEqual(layer('hint'), ['hint.space'])
- assert.equal(TEXT.zh['voice.slowLater'], '比平时慢,请再等一会儿')
assert.ok(!('status.elapsed' in TEXT.zh), 'the elapsed clock is back')
})
@@ -272,7 +271,7 @@ test('every text key that the page uses exists', () => {
for (const [, prefix] of text.matchAll(/`([\w.]+\.)\$\{/gu)) assert.ok(keys.some(key => key.startsWith(prefix)), `${name}: no text key starts with ${prefix}`)
}
// Keys the page builds from the snapshot's views, the stages and the failure reasons.
- for (const key of ['voice.failed', 'voice.viewFailed', 'voice.watchdog', 'voice.moving', 'voice.slow45', 'voice.slowLater', 'status.phase.data', 'status.phase.engine', 'status.phase.team', 'status.state.pending', 'status.state.active', 'status.state.done', 'status.state.failed']) assert.ok(key in TEXT.zh, key)
+ for (const key of ['voice.failed', 'voice.viewFailed', 'voice.watchdog', 'status.phase.data', 'status.phase.engine', 'status.phase.team', 'status.state.pending', 'status.state.active', 'status.state.done', 'status.state.failed']) assert.ok(key in TEXT.zh, key)
assert.deepEqual(matching('reason.start.{reason}').sort(), ['reason.start.engine', 'reason.start.files', 'reason.start.other', 'reason.start.permission', 'reason.start.space'])
assert.deepEqual(matching('reason.place.{reason}').sort(), ['reason.place.drive', 'reason.place.dsh', 'reason.place.foreign', 'reason.place.nested', 'reason.place.onedrive', 'reason.place.permission', 'reason.place.program', 'reason.place.space', 'reason.place.workspace'])
assert.deepEqual(matching('reason.copy.{reason}').sort(), ['reason.copy.full', 'reason.copy.inUse', 'reason.copy.other', 'reason.copy.permission'])
diff --git a/app/test/start-window.test.mjs b/app/test/start-window.test.mjs
index 9ac0fe9a..5a4d7ae1 100644
--- a/app/test/start-window.test.mjs
+++ b/app/test/start-window.test.mjs
@@ -116,7 +116,7 @@ test('only a missing file of the app\'s own says that the install is incomplete'
})
test('the main process takes only its own acts, each in its own views', () => {
- assert.deepEqual([...START_ACTS].sort(), ['answer', 'copyDetails', 'handoffDone', 'handoffShow', 'installUpdate', 'manualDownload', 'openLogs', 'pick', 'reloadView', 'retry', 'wait'])
+ assert.deepEqual([...START_ACTS].sort(), ['answer', 'copyDetails', 'handoffDone', 'handoffShow', 'installUpdate', 'manualDownload', 'pick', 'reloadView', 'retry', 'saveLog', 'wait'])
assert.equal(acceptsAct('handoffShow', 'handoff'), true)
// 「换个位置…」 while the start boots and 〔重新选〕 on its cards; a card's answer only on a card.
assert.equal(acceptsAct('pick', 'boot'), true)
@@ -142,8 +142,8 @@ test('the main process takes only its own acts, each in its own views', () => {
for (const view of ['boot', 'card', 'viewFailed', 'watchdog', 'handoff', 'moving']) assert.equal(acceptsAct(name, view), false, `${name} in ${view}`)
}
for (const view of ['boot', 'failed', 'viewFailed', 'watchdog', 'handoff', 'moving']) {
- assert.equal(acceptsAct('openLogs', view), true)
assert.equal(acceptsAct('copyDetails', view), true)
+ assert.equal(acceptsAct('saveLog', view), true)
}
// The cards of later pull requests, and names that are not acts at all.
for (const name of ['reload', 'toggleDetails', 'freshStart', 'stopCopy', 'keepCopying', 'importModel', 'importOption', '__proto__', 'constructor', 'toString', '']) {
@@ -344,13 +344,13 @@ test('the start window takes acts only from its own page, each in its own view',
const own = s.win()
const ownFrame = { sender: own.webContents, senderFrame: own.webContents.mainFrame }
const other = s.other()
- assert.equal(s.act('openLogs', undefined, { sender: other.webContents, senderFrame: other.webContents.mainFrame }), false)
- assert.equal(s.act('openLogs', undefined, { sender: own.webContents, senderFrame: { url: own.webContents.mainFrame.url } }), false)
+ assert.equal(s.act('saveLog', undefined, { sender: other.webContents, senderFrame: other.webContents.mainFrame }), false)
+ assert.equal(s.act('saveLog', undefined, { sender: own.webContents, senderFrame: { url: own.webContents.mainFrame.url } }), false)
const loaded = own.webContents.mainFrame.url
own.webContents.mainFrame.url = loaded.replace('first', 'later')
- assert.equal(s.act('openLogs', undefined, ownFrame), false)
+ assert.equal(s.act('saveLog', undefined, ownFrame), false)
own.webContents.mainFrame.url = loaded
- assert.equal(s.act('openLogs', undefined, ownFrame), true)
+ assert.equal(s.act('saveLog', undefined, ownFrame), true)
assert.equal(s.act('retry', undefined, ownFrame), false)
assert.equal(s.act('freshStart', undefined, ownFrame), false)
assert.equal(s.calls.retry, 0)
@@ -738,7 +738,7 @@ test('a move from a later start turns the start window into the move\'s and drop
assert.equal('place' in m.state(), false)
assert.match(m.win().webContents.mainFrame.url, /\?start=moving$/u)
assert.equal(m.act('pick', { value: 'changePlace' }), false)
- assert.equal(m.act('openLogs'), true)
+ assert.equal(m.act('saveLog'), true)
m.tick(WATCHDOG_MS)
assert.equal(m.state().view, 'moving')
// A move that does not go through asks on a card of the moving page; the clock stands still