Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to DreamCoder will be documented in this file.

### Changed

- **New app icon.** The app, Dock, taskbar and tray icons and the logo inside the app are redrawn: a warm-white crescent prompt and an amber star on an ink-blue tile. On macOS the menu bar icon is now a template image, so it follows the light or dark menu bar. The interface colors are unchanged. (#292)
- Thinking text in a streaming reply is batched like the reply text, so a long thinking block updates the conversation once per 50 ms instead of on every chunk (#258). Thanks @iruzen-dono.
- **Providers in OpenAI format reuse their prompt cache.** Later turns of a session now hit the cache for about 99% of the input (measured on OpenRouter with GPT-4.1 mini and GLM-4.6), and cache hits that DeepSeek and Moonshot report are counted as cache reads (#262).
- Providers in OpenAI format can run several tool calls in one step and get tool definitions without schema fields they do not use, and replies show the model you chose instead of the dated version the provider reports (#262).
Expand Down
7 changes: 5 additions & 2 deletions desktop/electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
"to": "web-clone"
},
{
"from": "electron/build/icons/tray.png",
"to": "icons/tray.png"
"from": "electron/build/icons",
"to": "icons",
"filter": [
"tray*.png"
]
},
{
"from": "../THIRD_PARTY_NOTICES.md",
Expand Down
3 changes: 0 additions & 3 deletions desktop/electron/build/app-icon-macos.svg

This file was deleted.

43 changes: 43 additions & 0 deletions desktop/electron/build/app-icon-small.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions desktop/electron/build/app-icon-tile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/electron/build/app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 47 additions & 6 deletions desktop/electron/build/app-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/electron/build/icons/icon.icns
Binary file not shown.
Binary file modified desktop/electron/build/icons/icon.ico
Binary file not shown.
Binary file modified desktop/electron/build/icons/tray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/electron/build/icons/tray@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/electron/build/icons/trayTemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/electron/build/icons/trayTemplate@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions desktop/electron/build/tray-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions desktop/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const CONTENT_SECURITY_POLICY = [
const WINDOW_STATE_SAVE_DELAY_MS = 300
const IS_MAC = process.platform === 'darwin'
const IS_WINDOWS = process.platform === 'win32'
const TRAY_ICON = IS_MAC ? 'trayTemplate.png' : 'tray.png'

protocol.registerSchemesAsPrivileged([
{ scheme: APP_SCHEME, privileges: { standard: true, secure: true, supportFetchAPI: true, corsEnabled: true } },
Expand Down Expand Up @@ -136,7 +137,7 @@ function resolvePaths(): AppPaths {
h5DistDir: dist,
webDist: dist,
artifactShellDir: path.join(dist, ARTIFACT_SHELL_DIRNAME),
trayIcon: path.join(process.resourcesPath, 'icons', 'tray.png'),
trayIcon: path.join(process.resourcesPath, 'icons', TRAY_ICON),
}
}
const desktopRoot = path.resolve(app.getAppPath(), '..')
Expand All @@ -146,7 +147,7 @@ function resolvePaths(): AppPaths {
h5DistDir: dist,
webDist: dist,
artifactShellDir: path.join(desktopRoot, 'public', ARTIFACT_SHELL_DIRNAME),
trayIcon: path.join(desktopRoot, 'electron', 'build', 'icons', 'tray.png'),
trayIcon: path.join(desktopRoot, 'electron', 'build', 'icons', TRAY_ICON),
}
}

Expand Down Expand Up @@ -574,7 +575,7 @@ function installTray(iconPath: string) {
console.error(`[electron] tray icon not found at ${iconPath}`)
return
}
tray = new Tray(image.resize({ width: IS_MAC ? 18 : 16, height: IS_MAC ? 18 : 16 }))
tray = new Tray(image)
tray.setToolTip('DreamCoder')
const menu = Menu.buildFromTemplate([
{ label: 'Show DreamCoder', click: showMainWindow },
Expand Down
1 change: 1 addition & 0 deletions desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"build:showai-reader": "bun ../vendor/showai/build-reader.ts dist/showai-reader",
"build:sidecars": "bun run ./scripts/build-sidecars.ts",
"build:electron": "bun run ./scripts/build-electron.ts",
"build:icons": "bun run ./scripts/generate-icons.ts",
"electron:install": "node node_modules/electron/install.js",
"electron:dev": "bun run ./scripts/electron-dev.ts",
"electron:start": "bun run build:electron && electron electron-dist",
Expand Down
Binary file modified desktop/public/app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions desktop/public/app-icon.svg

This file was deleted.

76 changes: 76 additions & 0 deletions desktop/scripts/generate-icons.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { existsSync, readFileSync } from 'node:fs'
import path from 'node:path'

import { Resvg } from '@resvg/resvg-js'
import { describe, expect, it } from 'vitest'

import { onMacGrid, packIco, pixelTile, render, tileOnly } from './generate-icons'

const buildDir = path.resolve(import.meta.dirname, '..', 'electron', 'build')
const master = (name: string) => readFileSync(path.join(buildDir, name), 'utf8')

function pngSize(png: Uint8Array) {
const view = new DataView(png.buffer, png.byteOffset, png.byteLength)
return [view.getUint32(16), view.getUint32(20)]
}

function alphaAt(svg: string, size: number, x: number, y: number) {
const pixels = new Uint8Array(new Resvg(svg, { fitTo: { mode: 'width', value: size }, font: { loadSystemFonts: false } }).render().pixels)
return pixels[(y * size + x) * 4 + 3]
}

describe('generate-icons', () => {
it('packs PNG images into an ICO directory with 256 stored as 0', () => {
const images = [16, 256].map((size) => ({ size, png: render(master('app-icon-small.svg'), size) }))
const ico = packIco(images)
const view = new DataView(ico.buffer)
expect(view.getUint16(2, true)).toBe(1)
expect(view.getUint16(4, true)).toBe(2)
expect(view.getUint8(6)).toBe(16)
expect(view.getUint8(22)).toBe(0)
images.forEach((image, index) => {
const entry = 6 + index * 16
const length = view.getUint32(entry + 8, true)
const offset = view.getUint32(entry + 12, true)
expect(length).toBe(image.png.length)
expect(ico.slice(offset, offset + length)).toEqual(new Uint8Array(image.png))
})
})

it('sizes the macOS grid tile to the nearest whole pixels that keep it centred', () => {
expect(pixelTile(16)).toEqual({ tile: 12, offset: 2 })
expect(pixelTile(32)).toEqual({ tile: 26, offset: 3 })
expect(pixelTile(64)).toEqual({ tile: 52, offset: 6 })
})

it('places the simplified master inside the macOS icon grid with sharp tile edges', () => {
for (const pixels of [16, 32, 64]) {
const grid = onMacGrid(master('app-icon-small.svg'), pixels)
const { tile, offset } = pixelTile(pixels)
const middle = Math.floor(pixels / 2)
expect(pngSize(render(grid, pixels))).toEqual([pixels, pixels])
expect(alphaAt(grid, pixels, offset - 1, middle)).toBe(0)
expect(alphaAt(grid, pixels, offset, middle)).toBe(255)
expect(alphaAt(grid, pixels, offset + tile - 1, middle)).toBe(255)
expect(alphaAt(grid, pixels, offset + tile, middle)).toBe(0)
expect(alphaAt(grid, pixels, middle, offset - 1)).toBe(0)
expect(alphaAt(grid, pixels, middle, offset)).toBe(255)
}
})

it('crops the finished master to its tile without the drop shadow', () => {
const tile = tileOnly(master('app-icon.svg'))
expect(alphaAt(tile, 103, 51, 51)).toBe(255)
expect(alphaAt(tile, 103, 0, 102)).toBe(0)
})

it('keeps the in-app tile in step with the finished master', () => {
expect(master('app-icon-tile.svg')).toBe(`${tileOnly(master('app-icon.svg'))}\n`)
})

it('ships every tray image the app loads', () => {
for (const name of ['tray.png', 'tray@2x.png', 'trayTemplate.png', 'trayTemplate@2x.png']) {
expect(existsSync(path.join(buildDir, 'icons', name))).toBe(true)
}
})
})
Loading
Loading