ucode-agent 1.42.0 → 1.43.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.
package/README.md CHANGED
@@ -27,7 +27,7 @@ corner:
27
27
  add a dark mode toggle that remembers the choice
28
28
 
29
29
 
30
- v1.42.0
30
+ v1.43.0
31
31
  ```
32
32
 
33
33
  A light crosses the wordmark once as it opens, and the three lines under the box
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ucode-agent",
3
- "version": "1.42.0",
3
+ "version": "1.43.0",
4
4
  "description": "ucode - a terminal coding agent that reads, edits and runs your code, on NVIDIA and Cohere models.",
5
5
  "type": "module",
6
6
  "main": "ucode.js",
@@ -183,6 +183,25 @@ export function serversReadySince(since = 0) {
183
183
  return readyServers.filter((s) => s.at >= since);
184
184
  }
185
185
 
186
+ /**
187
+ * Shut down every dev server this session started.
188
+ *
189
+ * killTree existed and nothing ever called it, so a server outlived the
190
+ * session that started it — every build left one behind. Twenty-four builds
191
+ * in one afternoon left seventy-three node processes running, the oldest for
192
+ * three and a half hours, holding ports the next run then could not use.
193
+ *
194
+ * Best effort and never throws: a process that has already gone is the
195
+ * outcome we wanted anyway.
196
+ */
197
+ export function stopServers() {
198
+ const stopped = readyServers.splice(0, readyServers.length);
199
+ for (const s of stopped) {
200
+ try { killTree(s.pid); } catch { /* already gone */ }
201
+ }
202
+ return stopped.length;
203
+ }
204
+
186
205
  /** Every server started this session, for reading what they have logged. */
187
206
  export function runningServers() {
188
207
  return readyServers.slice();
package/ucode.js CHANGED
@@ -145,6 +145,16 @@ async function main() {
145
145
  await agent.persist().catch(() => {});
146
146
  agent.ui.close();
147
147
  process.exitCode = 1;
148
+ } finally {
149
+ // Take the dev servers down with the session that started them, however it
150
+ // ended. killTree was written for this and nothing ever called it, so every
151
+ // build left its server running: twenty-four builds in an afternoon left
152
+ // seventy-three node processes alive, the oldest for three and a half
153
+ // hours, holding the ports the next run wanted.
154
+ try {
155
+ const { stopServers } = await import('./src/tools/shell.js');
156
+ stopServers();
157
+ } catch { /* nothing started, or already gone */ }
148
158
  }
149
159
  }
150
160