@agentchatme/agent-core 0.0.13 → 0.0.131

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.
@@ -4374,7 +4374,7 @@ var HEARTBEAT_STALE_MS = 3 * 6e4;
4374
4374
  function markAlwaysOnWanted(home) {
4375
4375
  try {
4376
4376
  fs4.mkdirSync(home, { recursive: true });
4377
- fs4.writeFileSync(path4.join(home, ALWAYS_ON_WANTED), "");
4377
+ fs4.writeFileSync(path4.join(home, ALWAYS_ON_WANTED), (/* @__PURE__ */ new Date()).toISOString());
4378
4378
  } catch {
4379
4379
  }
4380
4380
  }
@@ -4417,15 +4417,24 @@ function idle(home) {
4417
4417
  } catch {
4418
4418
  }
4419
4419
  }
4420
+ var STARTUP_GRACE_MS = 9e4;
4420
4421
  function alwaysOnState(home) {
4421
4422
  if (!alwaysOnWanted(home)) return "off";
4422
4423
  if (!fs4.existsSync(path4.join(home, "credentials"))) return "idle";
4424
+ let beating = false;
4423
4425
  try {
4424
4426
  const age = Date.now() - fs4.statSync(path4.join(home, HEARTBEAT_FILE)).mtimeMs;
4425
- return age <= HEARTBEAT_STALE_MS ? "connected" : "down";
4427
+ beating = age <= HEARTBEAT_STALE_MS;
4426
4428
  } catch {
4427
- return "down";
4429
+ beating = false;
4428
4430
  }
4431
+ if (beating) return "connected";
4432
+ try {
4433
+ const since = Date.now() - fs4.statSync(path4.join(home, ALWAYS_ON_WANTED)).mtimeMs;
4434
+ if (since <= STARTUP_GRACE_MS) return "starting";
4435
+ } catch {
4436
+ }
4437
+ return "down";
4429
4438
  }
4430
4439
  function alwaysOnHealth(home) {
4431
4440
  const state = alwaysOnState(home);
@@ -4470,4 +4479,4 @@ export {
4470
4479
  alwaysOnState,
4471
4480
  alwaysOnHealth
4472
4481
  };
4473
- //# sourceMappingURL=chunk-NEGTEBFK.js.map
4482
+ //# sourceMappingURL=chunk-XLRPNQ7G.js.map