lody 0.70.2 → 0.71.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.
@@ -0,0 +1,99 @@
1
+ import { watch } from "node:fs";
2
+ import { a as parseWorkspaceWatchParentMessage, n as normalizeWorkspaceWatchFilename, s as shouldIgnoreWorkspaceWatchFilename } from "./chunks/workspace-watch-protocol-CSO-IQeE.js";
3
+ import "node:path";
4
+ function startWorkspaceWatchWorker(options) {
5
+ const watchers = /* @__PURE__ */ new Map();
6
+ const watchFactory = options.watchFactory ?? watch;
7
+ const startedAtMs = Date.now();
8
+ let generation = 0;
9
+ let reconfigurationCount = 0;
10
+ let closed = false;
11
+ const close = () => {
12
+ if (closed) return;
13
+ closed = true;
14
+ for (const watcher of watchers.values()) watcher.close();
15
+ watchers.clear();
16
+ clearInterval(statsTimer);
17
+ };
18
+ const statsTimer = setInterval(() => {
19
+ options.send({
20
+ type: "code-collab-watch/stats",
21
+ generation,
22
+ watcherCount: watchers.size,
23
+ rssBytes: process.memoryUsage().rss,
24
+ reconfigurationCount,
25
+ uptimeMs: Date.now() - startedAtMs
26
+ });
27
+ }, options.statsIntervalMs ?? 3e4);
28
+ statsTimer.unref?.();
29
+ options.onMessage((raw) => {
30
+ const message = parseWorkspaceWatchParentMessage(raw);
31
+ if (!message || closed) return;
32
+ if (message.type === "code-collab-watch/shutdown") {
33
+ if (message.generation !== generation) return;
34
+ close();
35
+ options.exit();
36
+ return;
37
+ }
38
+ if (message.generation < generation) return;
39
+ generation = message.generation;
40
+ reconfigurationCount += 1;
41
+ const desired = new Set(message.roots);
42
+ for (const [root, watcher] of watchers) {
43
+ if (!desired.has(root)) {
44
+ watcher.close();
45
+ watchers.delete(root);
46
+ }
47
+ }
48
+ for (const root of desired) {
49
+ if (watchers.has(root)) continue;
50
+ try {
51
+ const watcher = watchFactory(root, { recursive: true, persistent: false }, (_, filename) => {
52
+ if (filename !== null) {
53
+ const normalized = normalizeWorkspaceWatchFilename(filename);
54
+ if (normalized !== null && shouldIgnoreWorkspaceWatchFilename(normalized)) return;
55
+ }
56
+ options.send({ type: "code-collab-watch/dirty", generation, root });
57
+ });
58
+ watcher.on("error", (error) => {
59
+ watcher.close();
60
+ watchers.delete(root);
61
+ options.send({
62
+ type: "code-collab-watch/error",
63
+ generation,
64
+ root,
65
+ code: error.code ?? "UNKNOWN"
66
+ });
67
+ });
68
+ watchers.set(root, watcher);
69
+ } catch (error) {
70
+ options.send({
71
+ type: "code-collab-watch/error",
72
+ generation,
73
+ root,
74
+ code: error instanceof Error && "code" in error ? String(error.code) : "UNKNOWN"
75
+ });
76
+ }
77
+ }
78
+ options.send({
79
+ type: "code-collab-watch/ready",
80
+ generation,
81
+ revision: message.revision,
82
+ watchedRoots: Array.from(watchers.keys())
83
+ });
84
+ });
85
+ options.onDisconnect(() => {
86
+ close();
87
+ options.exit();
88
+ });
89
+ return { close };
90
+ }
91
+ startWorkspaceWatchWorker({
92
+ send: (message) => process.send?.(message),
93
+ onMessage: (handler) => process.on("message", handler),
94
+ onDisconnect: (handler) => process.on("disconnect", handler),
95
+ exit: () => {
96
+ process.exitCode = 0;
97
+ if (process.connected) process.disconnect?.();
98
+ }
99
+ });
package/dist/codex-acp.js CHANGED
@@ -3,5 +3,5 @@
3
3
  console.error("CODEX_PATH is required for the bundled Codex ACP adapter.");
4
4
  process.exit(1);
5
5
  }
6
- await import("./chunks/index-BKfeSFHN.js");
6
+ await import("./chunks/index-Cbwwpq6s.js");
7
7
  })();
@@ -1,7 +1,7 @@
1
1
  import { opendir } from "node:fs/promises";
2
2
  import path__default from "node:path";
3
- import { w as buildCodeCollabFileIndexState, y as scanGitDirectoryEntries, B as joinWorkspacePath, D as isInsideGitWorktree, v as computeAllChanges, E as pathSegmentComparisonKey, z as closeDirectoryQuietly } from "./chunks/directory-handle-Ydn6ZTye.js";
4
- import "./chunks/schemas-Dq_X20sw.js";
3
+ import { u as buildCodeCollabFileIndexState, z as scanGitDirectoryEntries, F as joinWorkspacePath, G as isInsideGitWorktree, x as computeAllChanges, H as pathSegmentComparisonKey, A as closeDirectoryQuietly } from "./chunks/directory-handle-BzxIVnuO.js";
4
+ import "./chunks/schemas-CRNtikkJ.js";
5
5
  import "node:child_process";
6
6
  import "node:util";
7
7
  import "./chunks/diff-line-counts-BLxwWP6r.js";