@agentchatme/agent-core 0.0.1 → 0.0.12

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.
@@ -4387,6 +4387,23 @@ function clearAlwaysOnWanted(home) {
4387
4387
  function alwaysOnWanted(home) {
4388
4388
  return fs4.existsSync(path4.join(home, ALWAYS_ON_WANTED));
4389
4389
  }
4390
+ var ALWAYS_ON_OPTOUT = "always-on.optout";
4391
+ function markAlwaysOnOptOut(home) {
4392
+ try {
4393
+ fs4.mkdirSync(home, { recursive: true });
4394
+ fs4.writeFileSync(path4.join(home, ALWAYS_ON_OPTOUT), (/* @__PURE__ */ new Date()).toISOString());
4395
+ } catch {
4396
+ }
4397
+ }
4398
+ function clearAlwaysOnOptOut(home) {
4399
+ try {
4400
+ fs4.rmSync(path4.join(home, ALWAYS_ON_OPTOUT), { force: true });
4401
+ } catch {
4402
+ }
4403
+ }
4404
+ function alwaysOnOptedOut(home) {
4405
+ return fs4.existsSync(path4.join(home, ALWAYS_ON_OPTOUT));
4406
+ }
4390
4407
  function beat(home) {
4391
4408
  try {
4392
4409
  fs4.mkdirSync(home, { recursive: true });
@@ -4394,15 +4411,26 @@ function beat(home) {
4394
4411
  } catch {
4395
4412
  }
4396
4413
  }
4397
- function alwaysOnHealth(home) {
4398
- if (!alwaysOnWanted(home)) return { wanted: false, healthy: true };
4414
+ function idle(home) {
4415
+ try {
4416
+ fs4.rmSync(path4.join(home, HEARTBEAT_FILE), { force: true });
4417
+ } catch {
4418
+ }
4419
+ }
4420
+ function alwaysOnState(home) {
4421
+ if (!alwaysOnWanted(home)) return "off";
4422
+ if (!fs4.existsSync(path4.join(home, "credentials"))) return "idle";
4399
4423
  try {
4400
4424
  const age = Date.now() - fs4.statSync(path4.join(home, HEARTBEAT_FILE)).mtimeMs;
4401
- return { wanted: true, healthy: age <= HEARTBEAT_STALE_MS };
4425
+ return age <= HEARTBEAT_STALE_MS ? "connected" : "down";
4402
4426
  } catch {
4403
- return { wanted: true, healthy: false };
4427
+ return "down";
4404
4428
  }
4405
4429
  }
4430
+ function alwaysOnHealth(home) {
4431
+ const state = alwaysOnState(home);
4432
+ return { wanted: state !== "off", healthy: state !== "down" };
4433
+ }
4406
4434
 
4407
4435
  export {
4408
4436
  log,
@@ -4434,7 +4462,12 @@ export {
4434
4462
  markAlwaysOnWanted,
4435
4463
  clearAlwaysOnWanted,
4436
4464
  alwaysOnWanted,
4465
+ markAlwaysOnOptOut,
4466
+ clearAlwaysOnOptOut,
4467
+ alwaysOnOptedOut,
4437
4468
  beat,
4469
+ idle,
4470
+ alwaysOnState,
4438
4471
  alwaysOnHealth
4439
4472
  };
4440
- //# sourceMappingURL=chunk-4UOOWYCI.js.map
4473
+ //# sourceMappingURL=chunk-NEGTEBFK.js.map