@worca/ui 0.32.0 → 0.34.0

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.
@@ -3,14 +3,9 @@
3
3
  * Owns refresh scheduling, lastPipelineStatus tracking, and the status/runsDirWatcher FSWatchers.
4
4
  */
5
5
 
6
- import {
7
- existsSync,
8
- mkdirSync,
9
- readdirSync,
10
- readFileSync,
11
- watch,
12
- } from 'node:fs';
6
+ import { existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
13
7
  import { join } from 'node:path';
8
+ import { safeWatch } from './safe-watch.js';
14
9
  import { readSettings } from './settings-reader.js';
15
10
  import { discoverRunsAsync } from './watcher.js';
16
11
 
@@ -225,7 +220,7 @@ export function createStatusWatcher({
225
220
  const wtRunsDir = join(reg.worktree_path, '.worca', 'runs');
226
221
  if (!existsSync(wtRunsDir)) continue;
227
222
  try {
228
- const w = watch(
223
+ const w = safeWatch(
229
224
  wtRunsDir,
230
225
  { recursive: true },
231
226
  (_eventType, filename) => {
@@ -322,7 +317,7 @@ export function createStatusWatcher({
322
317
  // rename-over) replace the inode. After one 'rename' event the
323
318
  // watcher goes dead because it tracked the old inode. We
324
319
  // re-establish the watcher on the new file after a short delay.
325
- statusWatcher = watch(statusFile, (eventType) => {
320
+ statusWatcher = safeWatch(statusFile, (eventType) => {
326
321
  scheduleRefresh();
327
322
  if (eventType === 'rename') {
328
323
  // File replaced (atomic write) — re-watch the new inode
@@ -338,7 +333,7 @@ export function createStatusWatcher({
338
333
  } else if (existsSync(runDir)) {
339
334
  // status.json doesn't exist yet — watch the directory for its creation,
340
335
  // then switch to watching the file once it appears.
341
- statusWatcher = watch(
336
+ statusWatcher = safeWatch(
342
337
  runDir,
343
338
  { recursive: false },
344
339
  (_eventType, filename) => {
@@ -373,7 +368,7 @@ export function createStatusWatcher({
373
368
  // Watch worcaDir for legacy status.json changes
374
369
  try {
375
370
  if (existsSync(worcaDir)) {
376
- activeRunWatcher = watch(
371
+ activeRunWatcher = safeWatch(
377
372
  worcaDir,
378
373
  { recursive: false },
379
374
  (_eventType, filename) => {
@@ -395,7 +390,7 @@ export function createStatusWatcher({
395
390
  const runsDir = join(worcaDir, 'runs');
396
391
  try {
397
392
  if (existsSync(runsDir)) {
398
- runsDirWatcher = watch(
393
+ runsDirWatcher = safeWatch(
399
394
  runsDir,
400
395
  { recursive: true },
401
396
  (_eventType, filename) => {
@@ -414,7 +409,7 @@ export function createStatusWatcher({
414
409
  const pipelinesDirPath = join(worcaDir, 'multi', 'pipelines.d');
415
410
  try {
416
411
  mkdirSync(pipelinesDirPath, { recursive: true });
417
- pipelinesDirWatcher = watch(
412
+ pipelinesDirWatcher = safeWatch(
418
413
  pipelinesDirPath,
419
414
  { recursive: false },
420
415
  (_eventType, filename) => {
@@ -6,9 +6,10 @@
6
6
  * Separate from fleet-update per W-040 §13.5 — never multiplexed.
7
7
  */
8
8
 
9
- import { existsSync, readFileSync, watch } from 'node:fs';
9
+ import { existsSync, readFileSync } from 'node:fs';
10
10
  import { join } from 'node:path';
11
11
  import { workspaceRunsDir as resolveWorkspaceRunsDir } from './paths.js';
12
+ import { safeWatch } from './safe-watch.js';
12
13
 
13
14
  const WS_DEBOUNCE_MS = 200;
14
15
 
@@ -102,7 +103,7 @@ export function createWorkspaceManifestWatcher({
102
103
 
103
104
  try {
104
105
  if (existsSync(workspaceRunsDir)) {
105
- fsWatcher = watch(
106
+ fsWatcher = safeWatch(
106
107
  workspaceRunsDir,
107
108
  { persistent: false },
108
109
  (_event, filename) => {