Compare commits

..

5 Commits

Author SHA1 Message Date
49be50aa99 chore: ignore local .gstack/ tooling dir 2026-10-23 05:14:12 +03:00
0b8a3a505e fix: ignore the project watcher's spurious self-notification on macOS
fs.watch's recursive FSEvents backend fires an extra "change" event whose
filename is just the watched project folder's own basename, both alongside
real file changes and once more asynchronously after the folder is removed
and the watcher closed. watchProject had no filter for it, so that bogus
event reached the renderer as a PROJECTS_CHANGED notification naming a path
that was never a real project file.

Reproduced deterministically outside vitest (plain fs.watch), then fixed by
skipping any event whose filename equals the watched directory's own name.
3 previously-flaky tests in projects.watch.test.ts (expecting an empty
`changed` array) now pass consistently across repeated runs; full desktop
suite is 111/111 green, tsc clean.
2026-10-21 04:00:58 +03:00
Konstantin Paulus
af570c164a
Merge pull request #104 from diffusionstudio/fix/auto-updater
feat: update version to 0.216.0 across all modules and implement auto…
2026-10-19 00:13:14 +02:00
konstantin-paulus
98ea0c986b feat: update version to 0.216.0 across all modules and implement auto-update notifications 2026-10-19 00:11:57 +02:00
Konstantin Paulus
68b633db3c
Merge pull request #102 from diffusionstudio/feat/alpha-mask
Feat/alpha mask
2026-10-17 17:40:32 +02:00
11 changed files with 54 additions and 18 deletions

3
.gitignore vendored
View File

@ -39,4 +39,5 @@ out/
# AI
skills-lock.json
.agents
.claude
.claude
.gstack/

View File

@ -1,7 +1,7 @@
{
"name": "@diffusionstudio/cli",
"private": true,
"version": "0.215.0",
"version": "0.216.0",
"license": "MPL-2.0",
"bin": {
"diffusion": "./dist/index.js",

View File

@ -1,7 +1,7 @@
{
"name": "@diffusionstudio/desktop",
"private": true,
"version": "0.215.0",
"version": "0.216.0",
"license": "MPL-2.0",
"repository": {
"type": "git",

View File

@ -8,6 +8,7 @@ import { existsSync } from "node:fs";
import { mkdir, open, rename, unlink } from "node:fs/promises";
import { randomUUID } from "node:crypto";
import type { FileHandle } from "node:fs/promises";
import type { IUpdateInfo } from "update-electron-app";
import { makeUserNotifier, updateElectronApp } from "update-electron-app";
import { tempPathFor } from "./atomic";
import { DapiServer } from "./dapi/server";
@ -111,14 +112,25 @@ function setColorMode(mode: "dark" | "light") {
mainWindow.setTitleBarOverlay({ ...WINDOWS_OVERLAY_COLORS[mode], height: WINDOWS_OVERLAY_HEIGHT });
}
// A downloaded update is offered while the user has the window out; one that
// lands while the app runs in the background waits for the next show, since
// the app rarely quits on its own to apply it.
const notifyUser = makeUserNotifier();
let pendingUpdate: IUpdateInfo | null = null;
function offerUpdate() {
if (!pendingUpdate || !windows.visible()) return;
const info = pendingUpdate;
pendingUpdate = null;
notifyUser(info);
}
if (app.isPackaged && !squirrelLaunch) {
const notifyUser = makeUserNotifier();
updateElectronApp({
repo: "diffusionstudio/editor",
onNotifyUser: function (info) {
if (windows.visible()) {
notifyUser(info);
}
pendingUpdate = info;
offerUpdate();
},
});
}
@ -131,7 +143,10 @@ let lastProject: string | null = null;
const windows = new WindowHost({
create: createWindow,
idleMs: WINDOW_IDLE_MS,
onChange: () => tray.refresh(),
onChange: () => {
tray.refresh();
offerUpdate();
},
});
const tray = new AppTray({

View File

@ -1404,6 +1404,11 @@ export function watchProject(window: BrowserWindow | null, dir: string): void {
const watcher = watch(dir, { recursive: true }, (_event, filename) => {
if (!filename) return;
// macOS's recursive FSEvents watch fires an extra notification for the
// watched folder itself alongside the real one for whatever changed
// inside it — and again once more, asynchronously, after the folder is
// removed and the watcher closed. Neither names an actual project file.
if (filename === basename(dir)) return;
// Project-relative and `/`-separated; installs churn node_modules constantly.
const path = filename.split(sep).join("/");
if (path.startsWith("node_modules/") || path === "node_modules") return;

View File

@ -6,10 +6,12 @@ import { EventEmitter } from "node:events";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
const appEvents = new EventEmitter();
const updaterEvents = new EventEmitter();
const dock = { show: vi.fn(async () => { }), hide: vi.fn() };
vi.mock("electron", () => ({
app: { on: (event: string, listener: () => void) => appEvents.on(event, listener), dock, focus: () => { } },
autoUpdater: { on: (event: string, listener: () => void) => updaterEvents.on(event, listener) },
}));
const { WindowHost } = await import("./window-host");
@ -45,6 +47,7 @@ let host: InstanceType<typeof WindowHost>;
beforeEach(() => {
vi.useFakeTimers();
appEvents.removeAllListeners();
updaterEvents.removeAllListeners();
created = [];
host = new WindowHost({
create: () => {
@ -132,4 +135,11 @@ describe("WindowHost", () => {
expect(created[0]!.isDestroyed()).toBe(true);
expect(host.current()).toBeNull();
});
it("lets the window close when an update quits the app to install", async () => {
await host.show();
updaterEvents.emit("before-quit-for-update");
created[0]!.close();
expect(created[0]!.isDestroyed()).toBe(true);
});
});

View File

@ -12,7 +12,7 @@
// the Dock icon (macOS) follows whether the window is showing, and closing
// the window hides it rather than ending what the renderer is doing.
import { app } from "electron";
import { app, autoUpdater } from "electron";
import type { BrowserWindow } from "electron";
@ -47,6 +47,11 @@ export class WindowHost {
app.on("before-quit", () => {
this.quitting = true;
});
// quitAndInstall closes the windows before `before-quit`; a close turned
// into a hide there would leave the app running and the update unapplied.
autoUpdater.on("before-quit-for-update", () => {
this.quitting = true;
});
}
/** The window, if there is one. */

View File

@ -1,7 +1,7 @@
{
"name": "@diffusionstudio/web",
"private": true,
"version": "0.215.0",
"version": "0.216.0",
"license": "MPL-2.0",
"type": "module",
"scripts": {

12
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@diffusionstudio/editor",
"version": "0.215.0",
"version": "0.216.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@diffusionstudio/editor",
"version": "0.215.0",
"version": "0.216.0",
"hasInstallScript": true,
"license": "MPL-2.0",
"workspaces": [
@ -19,7 +19,7 @@
},
"apps/cli": {
"name": "@diffusionstudio/cli",
"version": "0.215.0",
"version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"@diffusionstudio/dapi": "*",
@ -39,7 +39,7 @@
},
"apps/desktop": {
"name": "@diffusionstudio/desktop",
"version": "0.215.0",
"version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"@babel/core": "^7.29.7",
@ -88,7 +88,7 @@
},
"apps/web": {
"name": "@diffusionstudio/web",
"version": "0.215.0",
"version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"@diffusionstudio/agent-chat": "*",
@ -14210,7 +14210,7 @@
},
"packages/jsx": {
"name": "@diffusionstudio/jsx",
"version": "0.215.0",
"version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"koota": "^0.6.6"

View File

@ -1,6 +1,6 @@
{
"name": "@diffusionstudio/editor",
"version": "0.215.0",
"version": "0.216.0",
"private": true,
"license": "MPL-2.0",
"type": "module",

View File

@ -1,6 +1,6 @@
{
"name": "@diffusionstudio/jsx",
"version": "0.215.0",
"version": "0.216.0",
"description": "Types and authoring API for Diffusion Studio compositions: the JSX element vocabulary and the hooks the editor implements when it mounts a project.",
"license": "MPL-2.0",
"type": "module",