@1agh/maude 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/apps/studio/fs-watch.ts
CHANGED
|
@@ -43,7 +43,11 @@ function isUnderRuntimeDir(rel: string): boolean {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function createFsWatch(
|
|
46
|
+
export function createFsWatch(
|
|
47
|
+
ctx: Context,
|
|
48
|
+
/** Test seam: the `fs.watch` to use. */
|
|
49
|
+
watchImpl: typeof watch = watch
|
|
50
|
+
): FsWatch {
|
|
47
51
|
let watcher: ReturnType<typeof watch> | null = null;
|
|
48
52
|
const seen = new Map<string, number>();
|
|
49
53
|
|
|
@@ -73,7 +77,7 @@ export function createFsWatch(ctx: Context): FsWatch {
|
|
|
73
77
|
// filter layers per frame — not the watcher; this guard is belt-and-braces.)
|
|
74
78
|
if (process.env.MAUDE_NO_WATCH === '1') return;
|
|
75
79
|
try {
|
|
76
|
-
watcher =
|
|
80
|
+
watcher = watchImpl(ctx.paths.designRoot, { recursive: true }, (_event, filename) => {
|
|
77
81
|
if (!filename) return;
|
|
78
82
|
// Skip our own runtime artifacts.
|
|
79
83
|
//
|
|
@@ -98,13 +102,48 @@ export function createFsWatch(ctx: Context): FsWatch {
|
|
|
98
102
|
if (isUnderRuntimeDir(filename)) return;
|
|
99
103
|
emit(filename);
|
|
100
104
|
});
|
|
105
|
+
// A WATCHER ERROR MUST NOT KILL THE STUDIO. An fs.watch handle is an
|
|
106
|
+
// EventEmitter: an 'error' with no listener is thrown, and the process
|
|
107
|
+
// exits. Bun's recursive watcher on Linux emits ENOENT while walking a
|
|
108
|
+
// tenant tree (a directory under system/<ds>/assets on Brno Alligators,
|
|
109
|
+
// 2026-10-02): the cell's studio child crash-looped — 9 restarts in a few
|
|
110
|
+
// minutes — and every request in flight died with it, so the file tree
|
|
111
|
+
// read `/_index-data` as a dropped connection and showed 0 canvases. The
|
|
112
|
+
// watcher only speeds up hot-reload; losing it for a few seconds is
|
|
113
|
+
// nothing. Log, close, and come back with a backoff.
|
|
114
|
+
watcher.on('error', (err) => {
|
|
115
|
+
console.warn(
|
|
116
|
+
`[fs-watch] watcher error — restarting it in ${Math.round(restartDelay / 1000)} s: ${err instanceof Error ? err.message : err}`
|
|
117
|
+
);
|
|
118
|
+
stop();
|
|
119
|
+
scheduleRestart();
|
|
120
|
+
});
|
|
121
|
+
restartDelay = RESTART_MIN_MS;
|
|
101
122
|
} catch (err) {
|
|
102
123
|
console.warn('[fs-watch] failed to start:', err instanceof Error ? err.message : err);
|
|
124
|
+
scheduleRestart();
|
|
103
125
|
}
|
|
104
126
|
}
|
|
105
127
|
|
|
128
|
+
/** Watcher restart backoff — doubles per failure, capped, reset on success. */
|
|
129
|
+
const RESTART_MIN_MS = 2_000;
|
|
130
|
+
const RESTART_MAX_MS = 60_000;
|
|
131
|
+
let restartDelay = RESTART_MIN_MS;
|
|
132
|
+
let restartTimer: ReturnType<typeof setTimeout> | null = null;
|
|
133
|
+
function scheduleRestart() {
|
|
134
|
+
if (restartTimer || process.env.MAUDE_NO_WATCH === '1') return;
|
|
135
|
+
const wait = restartDelay;
|
|
136
|
+
restartDelay = Math.min(restartDelay * 2, RESTART_MAX_MS);
|
|
137
|
+
restartTimer = setTimeout(() => {
|
|
138
|
+
restartTimer = null;
|
|
139
|
+
start();
|
|
140
|
+
}, wait);
|
|
141
|
+
(restartTimer as { unref?: () => void }).unref?.();
|
|
142
|
+
}
|
|
143
|
+
|
|
106
144
|
function stop() {
|
|
107
145
|
if (!watcher) return;
|
|
146
|
+
watcher.removeAllListeners?.('error');
|
|
108
147
|
try {
|
|
109
148
|
watcher.close();
|
|
110
149
|
} catch {
|
package/apps/studio/http.ts
CHANGED
|
@@ -1225,6 +1225,13 @@ export function createHttp(
|
|
|
1225
1225
|
err instanceof Error ? err.message : err
|
|
1226
1226
|
);
|
|
1227
1227
|
}
|
|
1228
|
+
// An fs.watch 'error' with no listener is THROWN and exits the process
|
|
1229
|
+
// (Bun's Linux recursive watcher emits ENOENT — the 2026-10-02 cell studio
|
|
1230
|
+
// crash loop). These two only bust the canvas cache; losing one is harmless.
|
|
1231
|
+
libWatcher?.on('error', (err) => {
|
|
1232
|
+
console.warn('[canvas-lib] watcher error — stopped:', err instanceof Error ? err.message : err);
|
|
1233
|
+
libWatcher?.close();
|
|
1234
|
+
});
|
|
1228
1235
|
void libWatcher;
|
|
1229
1236
|
|
|
1230
1237
|
// G7v2 — canvas-lib.tsx transitively imports many dev-server siblings
|
|
@@ -1258,6 +1265,13 @@ export function createHttp(
|
|
|
1258
1265
|
err instanceof Error ? err.message : err
|
|
1259
1266
|
);
|
|
1260
1267
|
}
|
|
1268
|
+
devSrcWatcher?.on('error', (err) => {
|
|
1269
|
+
console.warn(
|
|
1270
|
+
'[dev-server-src] watcher error — stopped:',
|
|
1271
|
+
err instanceof Error ? err.message : err
|
|
1272
|
+
);
|
|
1273
|
+
devSrcWatcher?.close();
|
|
1274
|
+
});
|
|
1261
1275
|
void devSrcWatcher;
|
|
1262
1276
|
|
|
1263
1277
|
async function readJson<T = unknown>(req: Request, max = 256 * 1024): Promise<T | null> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1agh/maude",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@1agh/maude-darwin-arm64": "1.6.
|
|
62
|
-
"@1agh/maude-darwin-x64": "1.6.
|
|
63
|
-
"@1agh/maude-linux-arm64": "1.6.
|
|
64
|
-
"@1agh/maude-linux-arm64-musl": "1.6.
|
|
65
|
-
"@1agh/maude-linux-x64": "1.6.
|
|
66
|
-
"@1agh/maude-linux-x64-musl": "1.6.
|
|
67
|
-
"@1agh/maude-win32-x64": "1.6.
|
|
61
|
+
"@1agh/maude-darwin-arm64": "1.6.3",
|
|
62
|
+
"@1agh/maude-darwin-x64": "1.6.3",
|
|
63
|
+
"@1agh/maude-linux-arm64": "1.6.3",
|
|
64
|
+
"@1agh/maude-linux-arm64-musl": "1.6.3",
|
|
65
|
+
"@1agh/maude-linux-x64": "1.6.3",
|
|
66
|
+
"@1agh/maude-linux-x64-musl": "1.6.3",
|
|
67
|
+
"@1agh/maude-win32-x64": "1.6.3"
|
|
68
68
|
},
|
|
69
69
|
"files": [
|
|
70
70
|
"cli",
|