tesseract-agent 0.4.16 → 0.4.17

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.
Files changed (2) hide show
  1. package/dist-bundle/cli.js +146 -51
  2. package/package.json +1 -1
@@ -21802,7 +21802,7 @@ ${input.command}
21802
21802
  }
21803
21803
  return blocks;
21804
21804
  }
21805
- var SEARCH_SCAN_LIMIT, SEARCH_RESULT_LIMIT, SEARCH_MAX_FILE_BYTES, SessionStore;
21805
+ var SEARCH_SCAN_LIMIT, SEARCH_RESULT_LIMIT, SEARCH_MAX_FILE_BYTES, FORK_RETRY_ATTEMPTS, FORK_RETRY_DELAY_MS, delay, SessionStore;
21806
21806
  var init_session_store = __esm({
21807
21807
  "../../packages/agent-core/dist/session-store.js"() {
21808
21808
  "use strict";
@@ -21810,6 +21810,9 @@ var init_session_store = __esm({
21810
21810
  SEARCH_SCAN_LIMIT = 200;
21811
21811
  SEARCH_RESULT_LIMIT = 50;
21812
21812
  SEARCH_MAX_FILE_BYTES = 8 * 1024 * 1024;
21813
+ FORK_RETRY_ATTEMPTS = 2;
21814
+ FORK_RETRY_DELAY_MS = 300;
21815
+ delay = (ms) => new Promise((resolve10) => setTimeout(resolve10, ms));
21813
21816
  SessionStore = class {
21814
21817
  /** List resumable sessions. When `projectDir` is given, only sessions whose
21815
21818
  * cwd matches that project are returned, so each window's Resume list is
@@ -21890,16 +21893,20 @@ var init_session_store = __esm({
21890
21893
  * Returns the new session id, or null on failure. NOTE: forked sessions start
21891
21894
  * WITHOUT file-history/undo snapshots (SDK behavior). */
21892
21895
  async forkSession(sessionId, opts) {
21893
- try {
21894
- const upToMessageId = opts?.upToMessageId ?? await this.lastResumableMessageId(sessionId, opts?.projectDir);
21895
- const result = await forkSession(sessionId, {
21896
- ...opts?.projectDir ? { dir: opts.projectDir } : {},
21897
- ...upToMessageId ? { upToMessageId } : {},
21898
- ...opts?.title ? { title: opts.title } : {}
21899
- });
21900
- return result.sessionId;
21901
- } catch {
21902
- return null;
21896
+ for (let attempt = 0; ; attempt++) {
21897
+ try {
21898
+ const upToMessageId = opts?.upToMessageId ?? await this.lastResumableMessageId(sessionId, opts?.projectDir);
21899
+ const result = await forkSession(sessionId, {
21900
+ ...opts?.projectDir ? { dir: opts.projectDir } : {},
21901
+ ...upToMessageId ? { upToMessageId } : {},
21902
+ ...opts?.title ? { title: opts.title } : {}
21903
+ });
21904
+ return result.sessionId;
21905
+ } catch {
21906
+ if (attempt >= FORK_RETRY_ATTEMPTS)
21907
+ return null;
21908
+ await delay(FORK_RETRY_DELAY_MS);
21909
+ }
21903
21910
  }
21904
21911
  }
21905
21912
  /** The uuid of the last transcript message after which NO tool_use is left without
@@ -22111,6 +22118,34 @@ var init_session_usage = __esm({
22111
22118
  }
22112
22119
  });
22113
22120
 
22121
+ // ../../packages/agent-core/dist/kill-tree.js
22122
+ import { spawn } from "node:child_process";
22123
+ function killProcessTree(child, signal = "SIGKILL") {
22124
+ if (!child || child.pid == null || child.exitCode !== null)
22125
+ return;
22126
+ const pid = child.pid;
22127
+ if (process.platform === "win32") {
22128
+ try {
22129
+ spawn("taskkill", ["/pid", String(pid), "/T", "/F"], { stdio: "ignore" });
22130
+ } catch {
22131
+ }
22132
+ return;
22133
+ }
22134
+ try {
22135
+ process.kill(-pid, signal);
22136
+ } catch {
22137
+ try {
22138
+ child.kill(signal);
22139
+ } catch {
22140
+ }
22141
+ }
22142
+ }
22143
+ var init_kill_tree = __esm({
22144
+ "../../packages/agent-core/dist/kill-tree.js"() {
22145
+ "use strict";
22146
+ }
22147
+ });
22148
+
22114
22149
  // ../../packages/agent-core/dist/agent-manager.js
22115
22150
  import { query, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
22116
22151
  import { writeFile as writeFile4, mkdir as mkdir4, readFile as readFile6 } from "node:fs/promises";
@@ -22121,7 +22156,7 @@ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:f
22121
22156
  import { fileURLToPath } from "node:url";
22122
22157
  import { createRequire } from "node:module";
22123
22158
  import { createServer } from "node:net";
22124
- import { spawn, execSync } from "node:child_process";
22159
+ import { spawn as spawn2, execSync } from "node:child_process";
22125
22160
  function findClaudeCliJs() {
22126
22161
  const require2 = createRequire(import.meta.url);
22127
22162
  const sdkMain = require2.resolve("@anthropic-ai/claude-agent-sdk");
@@ -22328,7 +22363,7 @@ MOBILE (${fw}):
22328
22363
  return "";
22329
22364
  }
22330
22365
  }
22331
- var cachedNodeExe, HUMAN_READABLE_FIELDS, TOOL_RESULT_CAP, MAX_RESULT_IMAGES, MAX_IMAGE_BASE64, PERMISSION_MODES, EDIT_PREVIEW_CAP, AsyncMessagePump, IDLE_REAP_MS, MODERATE_IDLE_MS, STEER_COALESCE_MS, AgentManager;
22366
+ var cachedNodeExe, HUMAN_READABLE_FIELDS, TOOL_RESULT_CAP, MAX_RESULT_IMAGES, MAX_IMAGE_BASE64, PERMISSION_MODES, EDIT_PREVIEW_CAP, AsyncMessagePump, IDLE_REAP_MS, MODERATE_IDLE_MS, STEER_COALESCE_MS, STOP_HARD_KILL_AFTER_MS, AgentManager;
22332
22367
  var init_agent_manager = __esm({
22333
22368
  "../../packages/agent-core/dist/agent-manager.js"() {
22334
22369
  "use strict";
@@ -22344,6 +22379,7 @@ var init_agent_manager = __esm({
22344
22379
  init_trace_store();
22345
22380
  init_session_store();
22346
22381
  init_session_usage();
22382
+ init_kill_tree();
22347
22383
  init_log();
22348
22384
  HUMAN_READABLE_FIELDS = ["message", "text", "content", "summary", "description", "output", "stdout", "error", "reason", "name"];
22349
22385
  TOOL_RESULT_CAP = 16e3;
@@ -22393,6 +22429,7 @@ var init_agent_manager = __esm({
22393
22429
  IDLE_REAP_MS = 5 * 60 * 1e3;
22394
22430
  MODERATE_IDLE_MS = 60 * 1e3;
22395
22431
  STEER_COALESCE_MS = 500;
22432
+ STOP_HARD_KILL_AFTER_MS = 1200;
22396
22433
  AgentManager = class {
22397
22434
  send;
22398
22435
  onBrowserRequest;
@@ -23298,12 +23335,18 @@ CRITICAL RULES:
23298
23335
  const exe = nodeExe2 ?? process.execPath;
23299
23336
  const runAsNode = exe === process.execPath && !!process.versions.electron;
23300
23337
  const spawnEnv = { ...options.env, ...params.env ?? {}, ...params.engineEnv ?? {}, CCB_IPC_PORT: String(live.ipcPort), ...runAsNode ? { ELECTRON_RUN_AS_NODE: "1" } : {} };
23301
- const child = spawn(exe, [cliJs, ...options.args], {
23338
+ const child = spawn2(exe, [cliJs, ...options.args], {
23302
23339
  cwd: options.cwd,
23303
23340
  env: spawnEnv,
23304
23341
  signal: options.signal,
23305
- stdio: ["pipe", "pipe", "pipe"]
23342
+ stdio: ["pipe", "pipe", "pipe"],
23343
+ // Own process group (POSIX) so Stop can SIGKILL the WHOLE tree — the
23344
+ // CLI re-execs node and its Bash tool spawns grandchildren (builds,
23345
+ // dev servers, sleeps) that a single-PID kill would orphan. Pipes keep
23346
+ // it attached; we never unref, so the parent still tracks it.
23347
+ detached: process.platform !== "win32"
23306
23348
  });
23349
+ live.child = child;
23307
23350
  return child;
23308
23351
  },
23309
23352
  // Claude Code preset + our browser instructions appended. The preset
@@ -23556,6 +23599,7 @@ CRITICAL RULES:
23556
23599
  refreshSessionUsage(turnSid);
23557
23600
  } else if (live.interrupted) {
23558
23601
  live.interrupted = false;
23602
+ this.clearStopWatchdog(live);
23559
23603
  log("Session interrupted by user:", turnSid);
23560
23604
  emit({ type: "chat:error", sessionId: turnSid, error: "Interrupted." });
23561
23605
  emit({ type: "agent:status", sessionId: turnSid, status: "idle" });
@@ -23779,6 +23823,7 @@ ${text3}` : header;
23779
23823
  const sid = live.sessionId;
23780
23824
  if (live.interrupted || live.abort.signal.aborted) {
23781
23825
  live.interrupted = false;
23826
+ this.clearStopWatchdog(live);
23782
23827
  log("Session interrupted by user (caught from iterator):", sid);
23783
23828
  emit({ type: "chat:error", sessionId: sid, error: "Interrupted." });
23784
23829
  emit({ type: "agent:status", sessionId: sid, status: "idle" });
@@ -23798,6 +23843,7 @@ ${err.stack}` : ""}` : String(err);
23798
23843
  clearTimeout(live.steerFlushTimer);
23799
23844
  live.steerFlushTimer = void 0;
23800
23845
  }
23846
+ this.clearStopWatchdog(live);
23801
23847
  if (live.sessionId)
23802
23848
  this.liveSessions.delete(live.sessionId);
23803
23849
  this.pendingLiveSessions.delete(live);
@@ -23805,6 +23851,8 @@ ${err.stack}` : ""}` : String(err);
23805
23851
  live.query.close();
23806
23852
  } catch {
23807
23853
  }
23854
+ if (live.abort.signal.aborted)
23855
+ killProcessTree(live.child, "SIGKILL");
23808
23856
  for (const s of live.ipcSockets) {
23809
23857
  try {
23810
23858
  s.destroy();
@@ -23832,28 +23880,54 @@ ${err.stack}` : ""}` : String(err);
23832
23880
  live.pendingSteer = void 0;
23833
23881
  live.interrupted = true;
23834
23882
  live.query.interrupt().catch((err) => {
23835
- log("interrupt() failed, falling back to abort:", err instanceof Error ? err.message : String(err));
23836
- try {
23837
- live.abort.abort();
23838
- } catch {
23839
- }
23883
+ log("interrupt() failed, force-killing process tree:", err instanceof Error ? err.message : String(err));
23884
+ this.hardKillSession(live);
23840
23885
  });
23886
+ this.armStopWatchdog(live);
23841
23887
  return true;
23842
23888
  }
23843
23889
  for (const pending of this.pendingLiveSessions) {
23844
23890
  log("Interrupting pending session (no canonical id yet)");
23845
23891
  pending.interrupted = true;
23846
- pending.query.interrupt().catch(() => {
23847
- try {
23848
- pending.abort.abort();
23849
- } catch {
23850
- }
23851
- });
23892
+ pending.query.interrupt().catch(() => this.hardKillSession(pending));
23893
+ this.armStopWatchdog(pending);
23852
23894
  return true;
23853
23895
  }
23854
23896
  log("No active session to interrupt for:", sessionId);
23855
23897
  return false;
23856
23898
  }
23899
+ /** Arm the Stop watchdog: if the graceful interrupt hasn't ended the turn
23900
+ * within STOP_HARD_KILL_AFTER_MS, force-kill the whole process tree. The
23901
+ * `interrupted` flag is reset to false when the interrupt is acknowledged
23902
+ * (result frame / caught iterator), so a timely graceful stop self-cancels. */
23903
+ armStopWatchdog(live) {
23904
+ if (live.killTimer)
23905
+ clearTimeout(live.killTimer);
23906
+ live.killTimer = setTimeout(() => {
23907
+ live.killTimer = void 0;
23908
+ if (live.interrupted && !live.reaped) {
23909
+ log("Stop watchdog: graceful interrupt stalled \u2014 force-killing process tree for", live.sessionId);
23910
+ this.hardKillSession(live);
23911
+ }
23912
+ }, STOP_HARD_KILL_AFTER_MS);
23913
+ }
23914
+ /** Cancel a pending Stop watchdog (graceful interrupt landed / session torn down). */
23915
+ clearStopWatchdog(live) {
23916
+ if (live.killTimer) {
23917
+ clearTimeout(live.killTimer);
23918
+ live.killTimer = void 0;
23919
+ }
23920
+ }
23921
+ /** Force-stop a session NOW: abort the SDK (so the consumer treats it as an
23922
+ * interrupt) and SIGKILL the CLI's entire process group, reaping any Bash /
23923
+ * tool / MCP grandchildren that a graceful stop left running. */
23924
+ hardKillSession(live) {
23925
+ try {
23926
+ live.abort.abort();
23927
+ } catch {
23928
+ }
23929
+ killProcessTree(live.child, "SIGKILL");
23930
+ }
23857
23931
  /** M7 — stop ONE background task (vs interruptSession which aborts the whole
23858
23932
  * turn). Driver-only, same origin guard. No-op if the session/task is gone. */
23859
23933
  async stopTask(sessionId, taskId, callerOrigin) {
@@ -24042,6 +24116,7 @@ ${err.stack}` : ""}` : String(err);
24042
24116
  clearTimeout(live.steerFlushTimer);
24043
24117
  live.steerFlushTimer = void 0;
24044
24118
  }
24119
+ this.clearStopWatchdog(live);
24045
24120
  if (live.sessionId)
24046
24121
  this.liveSessions.delete(live.sessionId);
24047
24122
  this.pendingLiveSessions.delete(live);
@@ -24049,6 +24124,7 @@ ${err.stack}` : ""}` : String(err);
24049
24124
  live.abort.abort();
24050
24125
  } catch {
24051
24126
  }
24127
+ killProcessTree(live.child, "SIGKILL");
24052
24128
  live.pump.end();
24053
24129
  }
24054
24130
  }
@@ -24109,6 +24185,7 @@ __export(dist_exports, {
24109
24185
  getTokenSegments: () => getTokenSegments,
24110
24186
  importSession: () => importSession,
24111
24187
  isToken: () => isToken,
24188
+ killProcessTree: () => killProcessTree,
24112
24189
  log: () => log,
24113
24190
  normalizeTokens: () => normalizeTokens,
24114
24191
  parseColorToRgb: () => parseColorToRgb,
@@ -24137,6 +24214,7 @@ var init_dist4 = __esm({
24137
24214
  init_session_usage();
24138
24215
  init_session_transfer();
24139
24216
  init_log();
24217
+ init_kill_tree();
24140
24218
  init_session_artifacts();
24141
24219
  init_imagegen_tools();
24142
24220
  init_design_tokens2();
@@ -36978,13 +37056,13 @@ var require_lazy_helpers = __commonJS({
36978
37056
  }
36979
37057
  };
36980
37058
  exports.DelayedConstructor = DelayedConstructor;
36981
- function delay2(wrappedConstructor) {
37059
+ function delay3(wrappedConstructor) {
36982
37060
  if (typeof wrappedConstructor === "undefined") {
36983
37061
  throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");
36984
37062
  }
36985
37063
  return new DelayedConstructor(wrappedConstructor);
36986
37064
  }
36987
- exports.delay = delay2;
37065
+ exports.delay = delay3;
36988
37066
  }
36989
37067
  });
36990
37068
 
@@ -43936,7 +44014,7 @@ var require_main = __commonJS({
43936
44014
  // src/cli.ts
43937
44015
  import { readFileSync as readFileSync14 } from "node:fs";
43938
44016
  import { createHash as createHash5 } from "node:crypto";
43939
- import { spawn as spawn7 } from "node:child_process";
44017
+ import { spawn as spawn8 } from "node:child_process";
43940
44018
  import { fileURLToPath as fileURLToPath2 } from "node:url";
43941
44019
  import { homedir as homedir17 } from "node:os";
43942
44020
  import { dirname as dirname18, join as join36, resolve as resolve9 } from "node:path";
@@ -44056,7 +44134,8 @@ async function createClaudeCodeBackend(send2, onBrowserRequest, loadPluginRuntim
44056
44134
  }
44057
44135
 
44058
44136
  // ../../packages/host-core/dist/engines/cli-backend-base.js
44059
- import { spawn as spawn2 } from "node:child_process";
44137
+ init_dist4();
44138
+ import { spawn as spawn3 } from "node:child_process";
44060
44139
  import { randomUUID as randomUUID3 } from "node:crypto";
44061
44140
  var MAX_LIVE = 8;
44062
44141
  var CliAgentBackend = class {
@@ -44098,12 +44177,15 @@ var CliAgentBackend = class {
44098
44177
  emitMsg({ type: "session:created", sessionId, clientRequestId: params.clientRequestId });
44099
44178
  emitMsg({ type: "agent:status", sessionId, clientRequestId: params.clientRequestId, status: "running" });
44100
44179
  const args = this.adapter.buildArgs(params, ctx);
44101
- const child = spawn2(spawnCfg.command, args, {
44180
+ const child = spawn3(spawnCfg.command, args, {
44102
44181
  cwd: params.projectDir,
44103
44182
  // engineEnv carries the resolved runner env + enabled-skill secrets (the desktop
44104
44183
  // resolves them into the 0600 snapshot); merge so CLI engines get them too.
44105
44184
  env: { ...process.env, ...spawnCfg.env, ...params.engineEnv ?? {} },
44106
- stdio: ["ignore", "pipe", "pipe"]
44185
+ stdio: ["ignore", "pipe", "pipe"],
44186
+ // Own process group (POSIX) so Stop can SIGKILL the whole tree, not just the
44187
+ // CLI's PID — these engines spawn their own tool subprocesses too.
44188
+ detached: process.platform !== "win32"
44107
44189
  });
44108
44190
  const turn = { child, sessionId, clientRequestId: params.clientRequestId, messageId: ctx.messageId, acc: "", buf: "", errored: false, interrupted: false };
44109
44191
  this.live.set(sessionId, turn);
@@ -44151,6 +44233,10 @@ var CliAgentBackend = class {
44151
44233
  emitMsg({ type: "agent:status", sessionId, clientRequestId: turn.clientRequestId, status: "error" });
44152
44234
  });
44153
44235
  child.on("close", (code) => {
44236
+ if (turn.killTimer) {
44237
+ clearTimeout(turn.killTimer);
44238
+ turn.killTimer = void 0;
44239
+ }
44154
44240
  if (this.adapter.streaming) {
44155
44241
  if (turn.buf.trim())
44156
44242
  handleLine(turn.buf);
@@ -44180,10 +44266,14 @@ var CliAgentBackend = class {
44180
44266
  if (!turn)
44181
44267
  return false;
44182
44268
  turn.interrupted = true;
44183
- try {
44184
- turn.child.kill("SIGTERM");
44185
- } catch {
44186
- }
44269
+ killProcessTree(turn.child, "SIGTERM");
44270
+ if (turn.killTimer)
44271
+ clearTimeout(turn.killTimer);
44272
+ turn.killTimer = setTimeout(() => {
44273
+ turn.killTimer = void 0;
44274
+ if (this.live.has(sessionId))
44275
+ killProcessTree(turn.child, "SIGKILL");
44276
+ }, 1200);
44187
44277
  return true;
44188
44278
  }
44189
44279
  // CLI engines don't expose a resumable on-disk session list to us in v1, so the
@@ -44200,10 +44290,11 @@ var CliAgentBackend = class {
44200
44290
  if (level !== "critical")
44201
44291
  return;
44202
44292
  for (const [id, turn] of this.live) {
44203
- try {
44204
- turn.child.kill("SIGTERM");
44205
- } catch {
44293
+ if (turn.killTimer) {
44294
+ clearTimeout(turn.killTimer);
44295
+ turn.killTimer = void 0;
44206
44296
  }
44297
+ killProcessTree(turn.child, "SIGKILL");
44207
44298
  this.live.delete(id);
44208
44299
  }
44209
44300
  }
@@ -44807,7 +44898,7 @@ import { createHash as createHash2 } from "node:crypto";
44807
44898
 
44808
44899
  // ../../packages/host-core/dist/runners/proxy-router.js
44809
44900
  init_dist2();
44810
- import { spawn as spawn3, execFile as execFile2, execSync as execSync2 } from "node:child_process";
44901
+ import { spawn as spawn4, execFile as execFile2, execSync as execSync2 } from "node:child_process";
44811
44902
  import { createRequire as createRequire2 } from "node:module";
44812
44903
  import { randomUUID as randomUUID4, createHash } from "node:crypto";
44813
44904
  import { existsSync as existsSync4, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
@@ -44963,7 +45054,7 @@ async function restart() {
44963
45054
  await ccr(["stop"]).catch(() => void 0);
44964
45055
  try {
44965
45056
  const { exe, asNode } = nodeExe();
44966
- const child = spawn3(exe, [ccrCliPath(), "start"], { env: ccrEnv(asNode), detached: true, stdio: "ignore" });
45057
+ const child = spawn4(exe, [ccrCliPath(), "start"], { env: ccrEnv(asNode), detached: true, stdio: "ignore" });
44967
45058
  child.unref();
44968
45059
  } catch {
44969
45060
  running = false;
@@ -46780,7 +46871,7 @@ function toNdcIceServers(configs) {
46780
46871
  return out;
46781
46872
  }
46782
46873
  var peers = /* @__PURE__ */ new Map();
46783
- var delay = (ms) => new Promise((r) => setTimeout(r, ms));
46874
+ var delay2 = (ms) => new Promise((r) => setTimeout(r, ms));
46784
46875
  var CHUNK = 64 * 1024;
46785
46876
  var MAX_MSG = 256 * 1024;
46786
46877
  var HIGH_WATER = 8 * 1024 * 1024;
@@ -46802,7 +46893,7 @@ async function serveGet(dc, id, path5, root) {
46802
46893
  } catch {
46803
46894
  return;
46804
46895
  }
46805
- const waitDrain = drainers.get(dc) ?? (() => delay(15));
46896
+ const waitDrain = drainers.get(dc) ?? (() => delay2(15));
46806
46897
  for (let off = 0, seq = 0; off < bytes.length; off += CHUNK, seq++) {
46807
46898
  while (dc.isOpen() && dc.bufferedAmount() > HIGH_WATER)
46808
46899
  await waitDrain();
@@ -53387,6 +53478,8 @@ async function handleInboundAgent(msg, driverClientId) {
53387
53478
  const newId = await b.forkSession?.(msg.sessionId, { projectDir: msg.projectDir, upToMessageId: msg.upToMessageId, title: msg.title }).catch(() => null);
53388
53479
  if (newId)
53389
53480
  send("agent", { type: "session:forked", clientRequestId: msg.clientRequestId, sessionId: newId, sourceSessionId: msg.sessionId, title: msg.title }, route2);
53481
+ else
53482
+ send("agent", { type: "session:forkFailed", clientRequestId: msg.clientRequestId, sourceSessionId: msg.sessionId }, route2);
53390
53483
  break;
53391
53484
  }
53392
53485
  case "agent:context_usage":
@@ -54060,6 +54153,8 @@ async function startLocalServer(opts) {
54060
54153
  const newId = await b.forkSession?.(msg.sessionId, { projectDir: msg.projectDir, upToMessageId: msg.upToMessageId, title: msg.title }).catch(() => null);
54061
54154
  if (newId)
54062
54155
  send2("agent", { type: "session:forked", clientRequestId: msg.clientRequestId, sessionId: newId, sourceSessionId: msg.sessionId, title: msg.title });
54156
+ else
54157
+ send2("agent", { type: "session:forkFailed", clientRequestId: msg.clientRequestId, sourceSessionId: msg.sessionId });
54063
54158
  break;
54064
54159
  }
54065
54160
  case "agent:context_usage":
@@ -54200,7 +54295,7 @@ import { homedir as homedir14 } from "node:os";
54200
54295
  import { randomBytes as randomBytes3 } from "node:crypto";
54201
54296
 
54202
54297
  // ../../packages/host-core/dist/power-node.js
54203
- import { spawn as spawn4 } from "node:child_process";
54298
+ import { spawn as spawn5 } from "node:child_process";
54204
54299
  import { platform } from "node:os";
54205
54300
  function createNodePowerController() {
54206
54301
  const active = /* @__PURE__ */ new Set();
@@ -54208,9 +54303,9 @@ function createNodePowerController() {
54208
54303
  function spawnInhibitor() {
54209
54304
  try {
54210
54305
  if (platform() === "darwin")
54211
- return spawn4("caffeinate", ["-i"], { stdio: "ignore" });
54306
+ return spawn5("caffeinate", ["-i"], { stdio: "ignore" });
54212
54307
  if (platform() === "linux") {
54213
- return spawn4("systemd-inhibit", ["--what=sleep", "--why=tesseract agent running", "--mode=block", "sleep", "infinity"], { stdio: "ignore" });
54308
+ return spawn5("systemd-inhibit", ["--what=sleep", "--why=tesseract agent running", "--mode=block", "sleep", "infinity"], { stdio: "ignore" });
54214
54309
  }
54215
54310
  } catch {
54216
54311
  }
@@ -54413,12 +54508,12 @@ import { dirname as dirname15, join as join31 } from "node:path";
54413
54508
  import { homedir as homedir15, userInfo } from "node:os";
54414
54509
 
54415
54510
  // ../../packages/host-core/dist/service/exec.js
54416
- import { execFile as execFile5, spawn as spawn5 } from "node:child_process";
54511
+ import { execFile as execFile5, spawn as spawn6 } from "node:child_process";
54417
54512
  import { promisify as promisify4 } from "node:util";
54418
54513
  var run = promisify4(execFile5);
54419
54514
  function runInherit(cmd, args) {
54420
54515
  return new Promise((resolve10) => {
54421
- const p = spawn5(cmd, args, { stdio: "inherit" });
54516
+ const p = spawn6(cmd, args, { stdio: "inherit" });
54422
54517
  p.on("error", () => resolve10());
54423
54518
  p.on("close", () => resolve10());
54424
54519
  });
@@ -54890,7 +54985,7 @@ function whoami() {
54890
54985
  }
54891
54986
 
54892
54987
  // src/self-update.ts
54893
- import { spawn as spawn6 } from "node:child_process";
54988
+ import { spawn as spawn7 } from "node:child_process";
54894
54989
  var RESTART_EXIT_CODE = 75;
54895
54990
  var REGISTRY_URL = "https://registry.npmjs.org/tesseract-agent/latest";
54896
54991
  var FIRST_CHECK_MS = Number(process.env.CCB_UPDATE_FIRST_MS) || 3 * 6e4;
@@ -54936,7 +55031,7 @@ function installVersion(target) {
54936
55031
  log2(`installing tesseract-agent@${target} \u2026`);
54937
55032
  let child;
54938
55033
  try {
54939
- child = spawn6(npm, ["install", "-g", `tesseract-agent@${target}`], { stdio: ["ignore", "inherit", "inherit"] });
55034
+ child = spawn7(npm, ["install", "-g", `tesseract-agent@${target}`], { stdio: ["ignore", "inherit", "inherit"] });
54940
55035
  } catch (e) {
54941
55036
  log2("npm spawn threw:", e instanceof Error ? e.message : String(e));
54942
55037
  resolve10(false);
@@ -55116,7 +55211,7 @@ async function superviseDaemon(cliEntry) {
55116
55211
  let stopping = false;
55117
55212
  let child = null;
55118
55213
  const spawnWorker = () => {
55119
- const c = spawn7(process.execPath, [cliEntry, "__worker"], { stdio: "inherit", env: process.env });
55214
+ const c = spawn8(process.execPath, [cliEntry, "__worker"], { stdio: "inherit", env: process.env });
55120
55215
  child = c;
55121
55216
  let settled = false;
55122
55217
  const settle = (fn) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tesseract-agent",
3
- "version": "0.4.16",
3
+ "version": "0.4.17",
4
4
  "license": "UNLICENSED",
5
5
  "publishConfig": {
6
6
  "access": "public"