A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Give the desktop app its own icon
Fei24112d46892f04c2
diff --git a/app/README.md b/app/README.mdindex 24b09232..78f28600 100644--- a/app/README.md+++ b/app/README.md@@ -43,6 +43,7 @@ Never point `DS_BOT_HOME` at `~/.dsh` or at the data of an app that you use.| `src/host.mjs` | The Host: creates the profile `ds-bot` (`dsh-base`, `dsh-web-app`, `ds-bot`), boots it with `runProfile()` on a loopback port and reports the launch URL || `src/web.mjs` | The window's files, the launch-token cookie exchange and the request forwarding || `ui/` | The window: React, built with Vite (`vite.config.js`) into `ui/dist`. It draws the plugin's own Bot views from `../ds-bot/src/client/` (sidebar, chat rows, docks, dialogs and their stylesheets) and puts its own Markdown in place of DSH's. It uses ds-bot's `api/bot` channel and its live feed `api/bot/feed` |+| `assets/` | The app icon: `icon.svg`, `icon.png` (1024 px) and `icon.ico` (Windows, 16 to 256 px). `npm run icon` (`scripts/icon.mjs`) draws them again from the Main Bot's whale in `../ds-bot` |The Host installs plugins with the app's own pnpm (`node_modules/pnpm`).diff --git a/app/assets/icon.ico b/app/assets/icon.iconew file mode 100644index 00000000..913aaddeBinary files /dev/null and b/app/assets/icon.ico differdiff --git a/app/assets/icon.png b/app/assets/icon.pngnew file mode 100644index 00000000..f6d4205aBinary files /dev/null and b/app/assets/icon.png differdiff --git a/app/assets/icon.svg b/app/assets/icon.svgnew file mode 100644index 00000000..d5833952--- /dev/null+++ b/app/assets/icon.svg@@ -0,0 +1,9 @@+<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">+<defs>+<linearGradient id="plate" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#eef1f7"/></linearGradient>+<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="12.288" stdDeviation="12.288" flood-color="#000" flood-opacity=".22"/></filter>+</defs>+<path d="M924.16 512.00L923.96 635.42L923.36 674.77L922.37 703.28L920.97 726.37L919.17 746.04L916.97 763.30L914.35 778.72L911.31 792.67L907.85 805.40L903.96 817.08L899.62 827.85L894.83 837.81L889.57 847.02L883.83 855.57L877.58 863.48L870.81 870.81L863.48 877.58L855.57 883.83L847.02 889.57L837.81 894.83L827.85 899.62L817.08 903.96L805.40 907.85L792.67 911.31L778.72 914.35L763.30 916.97L746.04 919.17L726.37 920.97L703.28 922.37L674.77 923.36L635.42 923.96L512.00 924.16L388.58 923.96L349.23 923.36L320.72 922.37L297.63 920.97L277.96 919.17L260.70 916.97L245.28 914.35L231.33 911.31L218.60 907.85L206.92 903.96L196.15 899.62L186.19 894.83L176.98 889.57L168.43 883.83L160.52 877.58L153.19 870.81L146.42 863.48L140.17 855.57L134.43 847.02L129.17 837.81L124.38 827.85L120.04 817.08L116.15 805.40L112.69 792.67L109.65 778.72L107.03 763.30L104.83 746.04L103.03 726.37L101.63 703.28L100.64 674.77L100.04 635.42L99.84 512.00L100.04 388.58L100.64 349.23L101.63 320.72L103.03 297.63L104.83 277.96L107.03 260.70L109.65 245.28L112.69 231.33L116.15 218.60L120.04 206.92L124.38 196.15L129.17 186.19L134.43 176.98L140.17 168.43L146.42 160.52L153.19 153.19L160.52 146.42L168.43 140.17L176.98 134.43L186.19 129.17L196.15 124.38L206.92 120.04L218.60 116.15L231.33 112.69L245.28 109.65L260.70 107.03L277.96 104.83L297.63 103.03L320.72 101.63L349.23 100.64L388.58 100.04L512.00 99.84L635.42 100.04L674.77 100.64L703.28 101.63L726.37 103.03L746.04 104.83L763.30 107.03L778.72 109.65L792.67 112.69L805.40 116.15L817.08 120.04L827.85 124.38L837.81 129.17L847.02 134.43L855.57 140.17L863.48 146.42L870.81 153.19L877.58 160.52L883.83 168.43L889.57 176.98L894.83 186.19L899.62 196.15L903.96 206.92L907.85 218.60L911.31 231.33L914.35 245.28L916.97 260.70L919.17 277.96L920.97 297.63L922.37 320.72L923.36 349.23L923.96 388.58Z" fill="url(#plate)" filter="url(#shadow)"/>+<path d="M924.16 512.00L923.96 635.42L923.36 674.77L922.37 703.28L920.97 726.37L919.17 746.04L916.97 763.30L914.35 778.72L911.31 792.67L907.85 805.40L903.96 817.08L899.62 827.85L894.83 837.81L889.57 847.02L883.83 855.57L877.58 863.48L870.81 870.81L863.48 877.58L855.57 883.83L847.02 889.57L837.81 894.83L827.85 899.62L817.08 903.96L805.40 907.85L792.67 911.31L778.72 914.35L763.30 916.97L746.04 919.17L726.37 920.97L703.28 922.37L674.77 923.36L635.42 923.96L512.00 924.16L388.58 923.96L349.23 923.36L320.72 922.37L297.63 920.97L277.96 919.17L260.70 916.97L245.28 914.35L231.33 911.31L218.60 907.85L206.92 903.96L196.15 899.62L186.19 894.83L176.98 889.57L168.43 883.83L160.52 877.58L153.19 870.81L146.42 863.48L140.17 855.57L134.43 847.02L129.17 837.81L124.38 827.85L120.04 817.08L116.15 805.40L112.69 792.67L109.65 778.72L107.03 763.30L104.83 746.04L103.03 726.37L101.63 703.28L100.64 674.77L100.04 635.42L99.84 512.00L100.04 388.58L100.64 349.23L101.63 320.72L103.03 297.63L104.83 277.96L107.03 260.70L109.65 245.28L112.69 231.33L116.15 218.60L120.04 206.92L124.38 196.15L129.17 186.19L134.43 176.98L140.17 168.43L146.42 160.52L153.19 153.19L160.52 146.42L168.43 140.17L176.98 134.43L186.19 129.17L196.15 124.38L206.92 120.04L218.60 116.15L231.33 112.69L245.28 109.65L260.70 107.03L277.96 104.83L297.63 103.03L320.72 101.63L349.23 100.64L388.58 100.04L512.00 99.84L635.42 100.04L674.77 100.64L703.28 101.63L726.37 103.03L746.04 104.83L763.30 107.03L778.72 109.65L792.67 112.69L805.40 116.15L817.08 120.04L827.85 124.38L837.81 129.17L847.02 134.43L855.57 140.17L863.48 146.42L870.81 153.19L877.58 160.52L883.83 168.43L889.57 176.98L894.83 186.19L899.62 196.15L903.96 206.92L907.85 218.60L911.31 231.33L914.35 245.28L916.97 260.70L919.17 277.96L920.97 297.63L922.37 320.72L923.36 349.23L923.96 388.58Z" fill="none" stroke="rgba(20,20,40,.1)" stroke-width="4.096"/>+<g transform="translate(143.68 141.70) scale(7.1758)"><defs><mask id="eyes" maskUnits="userSpaceOnUse" x="-100" y="-100" width="300" height="300"><rect x="-100" y="-100" width="300" height="300" fill="#fff"/><g class="bt-gaze"><g class="bt-eyes" fill="#000"><g transform="translate(72.5 48.4) rotate(-15.8)"><rect class="bt-eye" x="-4.65" y="-11.5" width="9.3" height="23" rx="4.65"/></g><g transform="translate(85.6 43.4) rotate(-21.2)"><rect class="bt-eye" x="-3.5" y="-11.45" width="7" height="22.9" rx="3.5"/></g><g transform="translate(72.5 48.4) rotate(-15.8)"><path class="bt-eye-happy" opacity="0" d="M-5.766 3.22Q0 -9.66 5.766 3.22" fill="none" stroke="#000" stroke-width="4.65" stroke-linecap="round"/></g><g transform="translate(85.6 43.4) rotate(-21.2)"><path class="bt-eye-happy" opacity="0" d="M-4.34 3.206Q0 -9.617999999999999 4.34 3.206" fill="none" stroke="#000" stroke-width="3.5" stroke-linecap="round"/></g></g></g></mask></defs><g class="bt-b"><g mask="url(#eyes)"><g fill-rule="evenodd"><path d="M65.3 20.9l5.1 .1 4.8 .9 4.8 1.7 4.3 2.3 3.8 3.1 3 3.4 2.3 3.8 1.6 4.3 .9 4.3 0 4.8-.8 4.8-1.4 4.3-2.3 4.3-3.2 4.3-3.4 3.3-4.3 3.1-7.2 3.5-7.6 1.7-7.2 .1-9.6-1.6-3.3-1-2.9-1.7-8.8-8.9-6-4.7-3.3-.5-7.7 1.1-4.8-.1-4.7-1.2-1.9-1.2-1-1-.5-1.5 .4-1.4 1.1-1.3 1.9-1.3 4.7-1.5 7.7-.6 1.1-.5 .7-1 0-1.4-2.8-7.2-1.2-5.3-.1-4.3 .4-1.4 .9-1.2 1.9-.2 2 1 2.2 2.3 2.2 3.4 3.2 7.6 1.9 9.7 .5-.1 1.1-7.2 1.8-4.8 3.2-5.2 3.9-4.3 4.9-3.9 5.6-2.9 5.8-1.9z" fill="#4D6BFE"/><path d="M93.3 55.8l1-.3 .1 1.2-2.4 5.3-3.4 4.8-3.8 3.8-4.8 3.4-5.7 2.8-4.8 1.5-4.8 .4 20.1-17.4 5.2-3.7z" fill="#fff" fill-opacity="1"/><path d="M88.6 29.5l2.4 2.9 1.9 2.8 2.4 6.3 .5 3.3 .1 5.3-1.5 6.6-1.9 4.3-2 3.3-4.8 5.4-5.7 4.3-7.2 3.3-6.2 1.5-6.7 .1-3.3-.2-9.6-1.8-3.3-1.5-2.4-1.9-8.6-8.9-5.3-3.9-3.3-.1-2.9 .2-3.3 .8-5.8 0-4.3-1-2.9-1.9 .6-.6 3.8-1.3 10.5-2.5 4.3 .9 1.4-.1 2.2-1.7 .5-1.4-.3-1.5-1.2-1.4-2.2-1.4-1.2-1.9-.6-12 .4-3.3 .5-.5 2.9 3.8 2.4 4.8 1.9 5.7 .7 5.8 .7 2.8 2.1 2.4 2.7 5.5 3.8 4.3 2.9 2.2 3.3 1 3.4-.4 6.2-3 7.1-4.5 7.3-5.6 6.6-5.9 5.9-6.5 3.7-5.3 1.7-4.2 .1-2.9z" fill="#000" fill-opacity=".14"/><path d="M55.6 22.8l1.9-.3 1.5 .3 .6 1 .1 .9-2 4.3-3.8 5.3-5.8 6.2-5.4 4.4-4.8 2.3-1.4 0-1.2-.5-.8-1.9 .5-3.3 2.5-4.8 3.3-4.3 2.4-2.4 5.3-3.9zM19.3 28.1l-1.4 2 .3-1.1zM21.7 49.1l.6 .5-.3 .5-.8 0zM35.8 52l1.2-.4 .9 .7 .7 1.6-.4 .9-1.2 .1-2.6-.5zM7.2 52.9l-2.9 2.9 1.2-1.6z" fill="#fff" fill-opacity=".16"/></g></g></g></g>+</svg>diff --git a/app/package.json b/app/package.jsonindex 72625d7c..ef4803c3 100644--- a/app/package.json+++ b/app/package.json@@ -10,7 +10,8 @@"scripts": {"build": "vite build","start": "vite build && electron .",- "shot": "node scripts/shot.mjs"+ "shot": "node scripts/shot.mjs",+ "icon": "node scripts/icon.mjs"},"dependencies": {"@deepseek-ai/dsh": "0.2.0-rc.2",diff --git a/app/scripts/icon.mjs b/app/scripts/icon.mjsnew file mode 100644index 00000000..b8453ac7--- /dev/null+++ b/app/scripts/icon.mjs@@ -0,0 +1,115 @@+// Draws the app icon from the Main Bot's whale in ../ds-bot and writes assets/icon.svg,+// assets/icon.png (1024 px) and assets/icon.ico (Windows, 16 to 256 px).+// Usage: npm run icon. It runs itself again inside Electron, which turns the SVG into PNGs.+import { spawnSync } from 'node:child_process'+import { mkdirSync, writeFileSync } from 'node:fs'+import { createRequire } from 'node:module'+import { dirname, join } from 'node:path'+import { fileURLToPath } from 'node:url'+import { characterMarkup, MASK_ID } from '../../ds-bot/src/client/characters.js'++const here = fileURLToPath(import.meta.url)+const assets = join(dirname(here), '..', 'assets')+const ICO_SIZES = [16, 20, 24, 32, 36, 40, 48, 64, 72, 96, 128, 256]++// The whale's body spans x 4..95.9 and y 20.9..79 of its 100 box.+const WHALE = { cx: 49.95, cy: 49.95, width: 91.9 }++// A superellipse close to the system's rounded-square app tile.+function tile(size, inset) {+ const radius = (size - 2 * inset) / 2+ const center = size / 2+ const points = []+ for (let i = 0; i < 128; i += 1) {+ const angle = (i / 128) * Math.PI * 2+ const at = value => Math.sign(value) * Math.abs(value) ** 0.4+ points.push(`${(center + radius * at(Math.cos(angle))).toFixed(2)} ${(center + radius * at(Math.sin(angle))).toFixed(2)}`)+ }+ return `M${points.join('L')}Z`+}++// `plate`: the tile's share of the canvas. macOS wants a margin around the tile; Windows+// draws its icons nearly edge to edge, so its sizes use a fuller tile.+function iconSvg(plate, size = 1024) {+ const inset = (size * (1 - plate)) / 2+ const whaleWidth = (size - 2 * inset) * 0.8+ const scale = whaleWidth / WHALE.width+ // The head carries the weight, so the whale sits a little left of and above center.+ const x = size / 2 - WHALE.cx * scale - whaleWidth * 0.015+ const y = size / 2 - WHALE.cy * scale - whaleWidth * 0.018+ const path = tile(size, inset)+ const whale = characterMarkup('whale', 'deepseek').replaceAll(MASK_ID, 'eyes').replaceAll('var(--bt-ink-deepseek)', '#4D6BFE')+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">+<defs>+<linearGradient id="plate" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#eef1f7"/></linearGradient>+<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="${size * 0.012}" stdDeviation="${size * 0.012}" flood-color="#000" flood-opacity=".22"/></filter>+</defs>+<path d="${path}" fill="url(#plate)" filter="url(#shadow)"/>+<path d="${path}" fill="none" stroke="rgba(20,20,40,.1)" stroke-width="${size * 0.004}"/>+<g transform="translate(${x.toFixed(2)} ${y.toFixed(2)}) scale(${scale.toFixed(4)})">${whale}</g>+</svg>+`+}++// PNG entries in an .ico file, which Windows reads since Vista.+function icoFile(images) {+ const head = Buffer.alloc(6 + 16 * images.length)+ head.writeUInt16LE(1, 2)+ head.writeUInt16LE(images.length, 4)+ let offset = head.length+ images.forEach(({ size, png }, index) => {+ const at = 6 + 16 * index+ head.writeUInt8(size >= 256 ? 0 : size, at)+ head.writeUInt8(size >= 256 ? 0 : size, at + 1)+ head.writeUInt16LE(1, at + 4)+ head.writeUInt16LE(32, at + 6)+ head.writeUInt32LE(png.length, at + 8)+ head.writeUInt32LE(offset, at + 12)+ offset += png.length+ })+ return Buffer.concat([head, ...images.map(image => image.png)])+}++// Inside Electron: a page draws each SVG on a canvas of its exact size, so every size is+// drawn from the vectors rather than scaled down from a large bitmap.+async function renderInElectron(jobs) {+ const { BrowserWindow } = await import('electron')+ const page = new BrowserWindow({ show: false })+ await page.loadURL('data:text/html,<!doctype html><title>icon</title>')+ const draw = async (list) => Promise.all(list.map(async ({ svg, size }) => {+ const image = new Image()+ image.src = `data:image/svg+xml,${encodeURIComponent(svg)}`+ await image.decode()+ const canvas = document.createElement('canvas')+ canvas.width = size+ canvas.height = size+ canvas.getContext('2d').drawImage(image, 0, 0, size, size)+ return canvas.toDataURL('image/png').slice('data:image/png;base64,'.length)+ }))+ const pngs = await page.webContents.executeJavaScript(`(${draw.toString()})(${JSON.stringify(jobs)})`)+ page.destroy()+ return pngs.map(data => Buffer.from(data, 'base64'))+}++if (process.versions.electron) {+ const jobs = [{ svg: iconSvg(0.805), size: 1024 }, ...ICO_SIZES.map(size => ({ svg: iconSvg(0.92, size), size }))]+ // Not awaited at the top: Electron is ready only after the main module has run.+ const { app } = await import('electron')+ app.whenReady().then(() => renderInElectron(jobs)).then(([large, ...small]) => {+ writeFileSync(join(assets, 'icon.png'), large)+ writeFileSync(join(assets, 'icon.ico'), icoFile(ICO_SIZES.map((size, index) => ({ size, png: small[index] }))))+ app.exit(0)+ }).catch((error) => {+ console.error(error)+ app.exit(1)+ })+} else {+ mkdirSync(assets, { recursive: true })+ writeFileSync(join(assets, 'icon.svg'), iconSvg(0.805))+ // A terminal inside an Electron-based editor may set ELECTRON_RUN_AS_NODE, which would keep Electron plain Node.+ const { ELECTRON_RUN_AS_NODE: _runAsNode, ...env } = process.env+ const electron = createRequire(import.meta.url)('electron')+ const run = spawnSync(electron, [here], { stdio: 'inherit', env })+ if (run.status !== 0) process.exit(run.status ?? 1)+ console.log('icon: wrote assets/icon.svg, assets/icon.png and assets/icon.ico')+}diff --git a/app/src/main.mjs b/app/src/main.mjsindex bff5d8e8..bb5390dd 100644--- a/app/src/main.mjs+++ b/app/src/main.mjs@@ -18,6 +18,8 @@ const BAND = 48const here = dirname(fileURLToPath(import.meta.url))// The window is the app's own build (ui/, `npm run build`); everything under /api/ goes to the Host.const uiDist = join(here, '..', 'ui', 'dist')+// Drawn by scripts/icon.mjs. Windows takes the .ico for its several sizes.+const iconFile = join(here, '..', 'assets', process.platform === 'win32' ? 'icon.ico' : 'icon.png')const dataDir = process.env.DS_BOT_HOME || join(homedir(), '.ds-bot')if (process.env.DS_BOT_SHELL_DATA) app.setPath('userData', process.env.DS_BOT_SHELL_DATA)@@ -76,6 +78,8 @@ function start() {})setMenu()+ // A packaged app has the icon in its bundle; Electron's own run shows Electron's.+ if (process.platform === 'darwin' && !app.isPackaged) app.dock?.setIcon(iconFile)createWindow()nativeTheme.on('updated', () => {if (mainWindow === undefined) return@@ -93,7 +97,7 @@ function createWindow() {mainWindow = new BrowserWindow({width: Math.min(1320, Math.round(area.width * 0.9)), height: Math.min(860, Math.round(area.height * 0.9)),minWidth: 720, minHeight: 480,- title: 'DeepSeek Bot', show: false,+ title: 'DeepSeek Bot', show: false, icon: iconFile,titleBarStyle: 'hidden',// macOS keeps its traffic lights, centered in the band; Windows and Linux draw their// buttons over the band's right end.