From d33a0685e05045a1a361044fab146a4e7a4106a0 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 20:52:25 -0500 Subject: [PATCH 1/2] fix(window): live events are asked for only after the window holds its key --- frontend/HASHOUT_LOG.md | 7 +++++++ frontend/src/engine/events.ts | 11 +++++++++-- frontend/src/engine/window-key.ts | 14 +++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index 22d15c8..6b9b5f2 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -2,6 +2,13 @@ Living context for the window. What would be comments in `frontend/` lives here, newest first. Read before editing. +## v0.29.1 · 2026-11-20 + +### Live events are asked for only once the window holds its key + +- `workspace/offline.ts` and `workspace/viz/api.ts` call `onEngineLink` when their modules load, which is before `main.ts` has claimed the window key, so `engine/events.ts` opened `GET /api/events` without the key, was refused (403) and retried 1.5 s later. `window-key.ts` now has `keySettled()`, a promise that settles when `claimWindowKey` has finished (with or without a key), and `events.ts` opens its stream only after it. The dock's own stream (`agent/link.ts`) already started inside `startApp`, after the claim. +- Seen with the real engine and the built window, 10 starts in a row at normal speed and 10 under 4x CPU throttle: 0 refused requests on the events route in the page's network record and in the engine's access log (before: 1 per start); a page without the key is still refused (403). + ## v0.29.0 · 2026-11-20 ### A sentence when the agent choice was changed outside the app diff --git a/frontend/src/engine/events.ts b/frontend/src/engine/events.ts index deb0f05..d8129c1 100644 --- a/frontend/src/engine/events.ts +++ b/frontend/src/engine/events.ts @@ -1,4 +1,5 @@ import { openStream, type Stream } from '../agent/sse'; +import { keySettled } from './window-key'; export interface EngineChanged { type: 'engine.changed'; epoch: number; name: string } export type Link = 'connecting' | 'up' | 'down'; @@ -11,6 +12,7 @@ const linkListeners = new Set(); let source: Stream | null = null; let link: Link = 'connecting'; let seen = false; +let asked = false; function eventsUrl(): string { const injected = (window as unknown as { __FFB_ENGINE__?: string }).__FFB_ENGINE__; @@ -24,8 +26,13 @@ function setLink(next: Link): void { } function open(): void { - if (source || !(listeners.size || linkListeners.size)) return; - source = openStream(eventsUrl(), { + if (asked || !(listeners.size || linkListeners.size)) return; + asked = true; + void keySettled().then(() => { source = source ?? stream(); }); +} + +function stream(): Stream { + return openStream(eventsUrl(), { open: () => { seen = true; setLink('up'); }, error: (refused) => setLink(refused || seen ? 'down' : 'connecting'), message: (text) => { diff --git a/frontend/src/engine/window-key.ts b/frontend/src/engine/window-key.ts index 3ce4bd8..e6b187a 100644 --- a/frontend/src/engine/window-key.ts +++ b/frontend/src/engine/window-key.ts @@ -8,6 +8,12 @@ function take(): string { } let key = take(); +let settle: () => void = () => undefined; +const settled = new Promise((resolve) => { settle = resolve; }); + +export function keySettled(): Promise { + return settled; +} export function windowKey(): string { return key; @@ -28,7 +34,13 @@ async function accepted(base: string, value: string): Promise { } catch { return false; } } -export async function claimWindowKey(base: string): Promise { +export function claimWindowKey(base: string): Promise { + const claim = claimOnce(base); + claim.then(settle, settle); + return claim; +} + +async function claimOnce(base: string): Promise { if (key) return key; const kept = stored(); if (kept && await accepted(base, kept)) { From c4229d7b1a05f5c945bb0c3b346e73900273d9fd Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 21:39:47 -0500 Subject: [PATCH 2/2] chore(release): 0.29.1, the window asks for live events only once it holds its key --- .agents/skills/formfabric-modeling/SKILL.md | 2 +- .claude/skills/formfabric-modeling/SKILL.md | 2 +- CHANGELOG.md | 6 +++++ README.md | 2 +- VERSION | 2 +- backend/app/__init__.py | 2 +- frontend/package-lock.json | 4 +-- frontend/package.json | 2 +- frontend/src/version.ts | 2 +- native/Cargo.lock | 28 ++++++++++----------- native/Cargo.toml | 2 +- python/formfabric/__init__.py | 2 +- python/formfabric/catalogue.json | 2 +- python/pyproject.toml | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 17 files changed, 36 insertions(+), 30 deletions(-) diff --git a/.agents/skills/formfabric-modeling/SKILL.md b/.agents/skills/formfabric-modeling/SKILL.md index cdf48d6..c47f4be 100644 --- a/.agents/skills/formfabric-modeling/SKILL.md +++ b/.agents/skills/formfabric-modeling/SKILL.md @@ -61,7 +61,7 @@ The tool reference below is generated from the engine's command registry by `./f ## Tool reference [ffb-tools:begin] -Generated from the engine's command registry (formfabric 0.29.0) by `./formfabric agents sync`; do not edit between the markers by hand. +Generated from the engine's command registry (formfabric 0.29.1) by `./formfabric agents sync`; do not edit between the markers by hand. - Engine: `system_info`, `system_capabilities` - Files: `file_new`, `file_save`, `file_open`, `sample_list`, `sample_load`, `exchange_import_dxf`, `exchange_export_dxf`, `snapshot_save`, `snapshot_list`, `snapshot_restore`, `snapshot_remove`, `library_list`, `library_add`, `library_insert`, `library_remove`, `library_roots`, `library_set_roots`, `component_save` diff --git a/.claude/skills/formfabric-modeling/SKILL.md b/.claude/skills/formfabric-modeling/SKILL.md index cdf48d6..c47f4be 100644 --- a/.claude/skills/formfabric-modeling/SKILL.md +++ b/.claude/skills/formfabric-modeling/SKILL.md @@ -61,7 +61,7 @@ The tool reference below is generated from the engine's command registry by `./f ## Tool reference [ffb-tools:begin] -Generated from the engine's command registry (formfabric 0.29.0) by `./formfabric agents sync`; do not edit between the markers by hand. +Generated from the engine's command registry (formfabric 0.29.1) by `./formfabric agents sync`; do not edit between the markers by hand. - Engine: `system_info`, `system_capabilities` - Files: `file_new`, `file_save`, `file_open`, `sample_list`, `sample_load`, `exchange_import_dxf`, `exchange_export_dxf`, `snapshot_save`, `snapshot_list`, `snapshot_restore`, `snapshot_remove`, `library_list`, `library_add`, `library_insert`, `library_remove`, `library_roots`, `library_set_roots`, `component_save` diff --git a/CHANGELOG.md b/CHANGELOG.md index dc675df..709e740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v0.29.1 · 2026-11-20 + +The window no longer asks for live events before it has its key. + +- At each start the window asked the engine for its live events a moment before it held its key, was refused once and asked again 1.5 seconds later. It now waits for its key first, so a normal start shows no refused request, and the events reach the window from the first try. + ## v0.29.0 · 2026-11-20 The window's key comes from the engine alone, FormFabric uses the family's design names, and Preferences says when the agent choice was changed outside the app. diff --git a/README.md b/README.md index b4c02a7..2376f25 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

- version v0.29.0 + version v0.29.1 Rust 1.99 TypeScript and Vite macOS, Linux, Windows diff --git a/VERSION b/VERSION index ae6dd4e..25939d3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.29.0 +0.29.1 diff --git a/backend/app/__init__.py b/backend/app/__init__.py index f634f5b..d1d9f95 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -1 +1 @@ -__version__ = "0.29.0" +__version__ = "0.29.1" diff --git a/frontend/package-lock.json b/frontend/package-lock.json index dd8581d..2cd0a8b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "formfabric", - "version": "0.29.0", + "version": "0.29.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "formfabric", - "version": "0.29.0", + "version": "0.29.1", "license": "Apache-2.0", "dependencies": { "@fontsource/inter": "5.3.0", diff --git a/frontend/package.json b/frontend/package.json index f89685f..3176efb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "formfabric", "private": true, - "version": "0.29.0", + "version": "0.29.1", "description": "formfabric · garment pattern and cloth simulation in the NodeMode style", "license": "Apache-2.0", "type": "module", diff --git a/frontend/src/version.ts b/frontend/src/version.ts index b85c1f9..db01f93 100644 --- a/frontend/src/version.ts +++ b/frontend/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.29.0'; +export const VERSION = '0.29.1'; diff --git a/native/Cargo.lock b/native/Cargo.lock index efa8ffc..0fa52bf 100644 --- a/native/Cargo.lock +++ b/native/Cargo.lock @@ -323,7 +323,7 @@ dependencies = [ [[package]] name = "ffb-anim" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-body", "ffb-core", @@ -337,7 +337,7 @@ dependencies = [ [[package]] name = "ffb-body" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-core", "ffb-sim", @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "ffb-commands" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-anim", "ffb-body", @@ -368,7 +368,7 @@ dependencies = [ [[package]] name = "ffb-core" -version = "0.29.0" +version = "0.29.1" dependencies = [ "glam", "serde", @@ -376,7 +376,7 @@ dependencies = [ [[package]] name = "ffb-fabric" -version = "0.29.0" +version = "0.29.1" dependencies = [ "serde", "serde_json", @@ -385,7 +385,7 @@ dependencies = [ [[package]] name = "ffb-gpu" -version = "0.29.0" +version = "0.29.1" dependencies = [ "bytemuck", "ffb-fabric", @@ -397,7 +397,7 @@ dependencies = [ [[package]] name = "ffb-io" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-body", "ffb-pattern", @@ -408,7 +408,7 @@ dependencies = [ [[package]] name = "ffb-mesh" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-pattern", "serde", @@ -418,7 +418,7 @@ dependencies = [ [[package]] name = "ffb-pattern" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-core", "ffb-fabric", @@ -428,7 +428,7 @@ dependencies = [ [[package]] name = "ffb-py" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-commands", "ffb-core", @@ -439,7 +439,7 @@ dependencies = [ [[package]] name = "ffb-remesh" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-core", "ffb-mesh", @@ -450,7 +450,7 @@ dependencies = [ [[package]] name = "ffb-sim" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-body", "ffb-core", @@ -463,7 +463,7 @@ dependencies = [ [[package]] name = "ffb-stream" -version = "0.29.0" +version = "0.29.1" dependencies = [ "getrandom", "tungstenite", @@ -471,7 +471,7 @@ dependencies = [ [[package]] name = "ffb-wasm" -version = "0.29.0" +version = "0.29.1" dependencies = [ "ffb-commands", "ffb-pattern", diff --git a/native/Cargo.toml b/native/Cargo.toml index ee0527e..56fc74c 100644 --- a/native/Cargo.toml +++ b/native/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["crates/*"] [workspace.package] -version = "0.29.0" +version = "0.29.1" edition = "2021" license = "Apache-2.0" authors = ["nodemode-ai"] diff --git a/python/formfabric/__init__.py b/python/formfabric/__init__.py index b0127bd..edff4d8 100644 --- a/python/formfabric/__init__.py +++ b/python/formfabric/__init__.py @@ -6,7 +6,7 @@ from .errors import ArgumentError, BackendError, CommandError, FormfabricError from .model import Garment, Link, Panel, Sim, sample_drape -__version__ = "0.29.0" +__version__ = "0.29.1" __all__ = [ "ArgumentError", diff --git a/python/formfabric/catalogue.json b/python/formfabric/catalogue.json index 339a2bc..b310e4c 100644 --- a/python/formfabric/catalogue.json +++ b/python/formfabric/catalogue.json @@ -13806,5 +13806,5 @@ } ], "engine": "formfabric", - "version": "0.29.0" + "version": "0.29.1" } diff --git a/python/pyproject.toml b/python/pyproject.toml index b06a88b..202cb42 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "formfabric" -version = "0.29.0" +version = "0.29.1" description = "Python API for formfabric, the garment pattern and cloth simulation app" readme = "README.md" requires-python = ">=3.10" diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index ece779f..94d1d04 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1073,7 +1073,7 @@ dependencies = [ [[package]] name = "formfabric" -version = "0.29.0" +version = "0.29.1" dependencies = [ "objc2", "objc2-app-kit", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 49be072..1a6342c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "formfabric" -version = "0.29.0" +version = "0.29.1" description = "formfabric desktop shell" authors = ["nodemode-ai"] license = "Apache-2.0" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 8d7d7c0..78ecbb1 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "FormFabric", - "version": "0.29.0", + "version": "0.29.1", "identifier": "ai.nodemode.formfabric", "build": { "frontendDist": "../frontend/dist"