openspecui 0.7.5 → 0.7.6

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/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as __commonJS, o as __toESM, t as startServer } from "./src-DGh92Bnw.mjs";
2
+ import { a as __commonJS, o as __toESM, t as startServer } from "./src-BTqFItR8.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { fileURLToPath } from "url";
5
5
  import { basename, dirname, extname, join, normalize, relative, resolve } from "path";
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { i as ACPAgents, n as createServer, r as ProviderManager, t as startServer } from "./src-DGh92Bnw.mjs";
1
+ import { i as ACPAgents, n as createServer, r as ProviderManager, t as startServer } from "./src-BTqFItR8.mjs";
2
2
 
3
3
  export { ACPAgents, ProviderManager, createServer, startServer };
@@ -13057,6 +13057,8 @@ var ProjectWatcher = class {
13057
13057
  lastEventTime = 0;
13058
13058
  healthCheckPending = false;
13059
13059
  enableHealthCheck;
13060
+ reinitializeTimer = null;
13061
+ reinitializePending = false;
13060
13062
  constructor(projectDir, options = {}) {
13061
13063
  this.projectDir = getRealPath$1(projectDir);
13062
13064
  this.debounceMs = options.debounceMs ?? DEBOUNCE_MS$1;
@@ -13076,7 +13078,7 @@ var ProjectWatcher = class {
13076
13078
  async doInit() {
13077
13079
  this.subscription = await (await import("@parcel/watcher")).subscribe(this.projectDir, (err, events) => {
13078
13080
  if (err) {
13079
- console.error("[ProjectWatcher] Error:", err);
13081
+ this.handleWatcherError(err);
13080
13082
  return;
13081
13083
  }
13082
13084
  this.handleEvents(events);
@@ -13086,6 +13088,34 @@ var ProjectWatcher = class {
13086
13088
  if (this.enableHealthCheck) this.startHealthCheck();
13087
13089
  }
13088
13090
  /**
13091
+ * 处理 watcher 错误
13092
+ * 对于 FSEvents dropped 错误,触发延迟重建
13093
+ */
13094
+ handleWatcherError(err) {
13095
+ if ((err.message || String(err)).includes("Events were dropped")) {
13096
+ if (!this.reinitializePending) {
13097
+ console.warn("[ProjectWatcher] FSEvents dropped events, scheduling reinitialize...");
13098
+ this.scheduleReinitialize();
13099
+ }
13100
+ return;
13101
+ }
13102
+ console.error("[ProjectWatcher] Error:", err);
13103
+ }
13104
+ /**
13105
+ * 延迟重建 watcher(防抖,避免频繁重建)
13106
+ */
13107
+ scheduleReinitialize() {
13108
+ if (this.reinitializePending) return;
13109
+ this.reinitializePending = true;
13110
+ if (this.reinitializeTimer) clearTimeout(this.reinitializeTimer);
13111
+ this.reinitializeTimer = setTimeout(() => {
13112
+ this.reinitializeTimer = null;
13113
+ this.reinitializePending = false;
13114
+ console.log("[ProjectWatcher] Reinitializing due to FSEvents error...");
13115
+ this.reinitialize();
13116
+ }, 1e3);
13117
+ }
13118
+ /**
13089
13119
  * 处理原始事件
13090
13120
  */
13091
13121
  handleEvents(events) {
@@ -13276,6 +13306,11 @@ var ProjectWatcher = class {
13276
13306
  clearTimeout(this.debounceTimer);
13277
13307
  this.debounceTimer = null;
13278
13308
  }
13309
+ if (this.reinitializeTimer) {
13310
+ clearTimeout(this.reinitializeTimer);
13311
+ this.reinitializeTimer = null;
13312
+ }
13313
+ this.reinitializePending = false;
13279
13314
  if (this.subscription) {
13280
13315
  await this.subscription.unsubscribe();
13281
13316
  this.subscription = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openspecui",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "OpenSpec UI - Visual interface for spec-driven development",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",