@runeya/runeya 2.0.13 → 2.0.14

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/agent/index.js CHANGED
@@ -4923,10 +4923,11 @@ function resolveMcpServerPath() {
4923
4923
  throw new Error("Could not locate @runeya/packages-mcp-server (built dist not found)");
4924
4924
  }
4925
4925
  var MAX_BUFFER_LINES = 1e5;
4926
- var MAX_CONCURRENT_SPAWNS = 10;
4926
+ var MAX_CONCURRENT_SPAWNS = 100;
4927
4927
  var CLEANUP_INTERVAL_MS = 6e4;
4928
4928
  var TTL_ACKED_MS = 5 * 6e4;
4929
4929
  var TTL_UNACKED_MS = 24 * 36e5;
4930
+ var TTL_IDLE_PTY_MS = 30 * 6e4;
4930
4931
  function resolveSpawnEnvAndArgs(opts) {
4931
4932
  const runeyaEnv = {
4932
4933
  ...opts.mcpApiBaseUrl ? { RUNEYA_BASE_URL: opts.mcpApiBaseUrl } : {},
@@ -5200,7 +5201,19 @@ var AiSpawnManager = class {
5200
5201
  cleanup() {
5201
5202
  const now = Date.now();
5202
5203
  for (const [id, entry] of this.spawns) {
5203
- if (entry.status === "running") continue;
5204
+ if (entry.status === "running") {
5205
+ if (entry.ptyProc) {
5206
+ const idle = now - (entry.lastChunkAt ?? entry.createdAt);
5207
+ if (idle > TTL_IDLE_PTY_MS) {
5208
+ try {
5209
+ entry.ptyProc.kill();
5210
+ } catch {
5211
+ }
5212
+ console.log(`[ai-spawn-manager] Reaped idle PTY ${id} (idle ${Math.round(idle / 1e3)}s)`);
5213
+ }
5214
+ }
5215
+ continue;
5216
+ }
5204
5217
  const age = now - (entry.doneAt ?? entry.createdAt);
5205
5218
  if (entry.acked && age > TTL_ACKED_MS) {
5206
5219
  this.spawns.delete(id);