@ycodium-ai/plugin-resource-telemetry 0.2.2167 → 0.2.2510

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/index.js +5 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -493,7 +493,7 @@ var buildHistory = (input) => {
493
493
  // src/sidecar.ts
494
494
  import * as NodeCrypto from "node:crypto";
495
495
  var SAMPLE_INTERVAL_MS = 1e3;
496
- var UNKNOWN_BACKGROUND_SAMPLE_INTERVAL_MS = 5e3;
496
+ var BACKGROUND_SAMPLE_INTERVAL_MS = 5e3;
497
497
  var BATTERY_SAMPLE_INTERVAL_MS = 5e3;
498
498
  var CONSTRAINED_SAMPLE_INTERVAL_MS = 15e3;
499
499
  var HANDSHAKE_TIMEOUT_MS = 5e3;
@@ -505,13 +505,12 @@ var FAILURE_WINDOW_MS = 6e4;
505
505
  var MAX_FAILURES_PER_WINDOW = 5;
506
506
  var STDERR_TAIL_LIMIT = 2e3;
507
507
  var resolveSampleIntervalMs = (power, liveSubscriberCount) => {
508
- if (power === null || power.stale || power.source === "unknown") {
509
- return liveSubscriberCount > 0 ? SAMPLE_INTERVAL_MS : UNKNOWN_BACKGROUND_SAMPLE_INTERVAL_MS;
510
- }
508
+ const liveOrBackground = liveSubscriberCount > 0 ? SAMPLE_INTERVAL_MS : BACKGROUND_SAMPLE_INTERVAL_MS;
509
+ if (power === null || power.stale || power.source === "unknown") return liveOrBackground;
511
510
  if (power.suspended || power.locked === "true" || power.lowPowerMode === "true" || power.thermalState === "serious" || power.thermalState === "critical") {
512
511
  return CONSTRAINED_SAMPLE_INTERVAL_MS;
513
512
  }
514
- return power.onBattery === "false" ? SAMPLE_INTERVAL_MS : BATTERY_SAMPLE_INTERVAL_MS;
513
+ return power.onBattery === "false" ? liveOrBackground : BATTERY_SAMPLE_INTERVAL_MS;
515
514
  };
516
515
  var restartDelayMs = (attempt) => Math.min(INITIAL_RESTART_DELAY_MS * 2 ** attempt, MAX_RESTART_DELAY_MS);
517
516
  var toError = (value) => value instanceof Error ? value : new Error(String(value));
@@ -535,7 +534,7 @@ var TelemetrySidecar = class {
535
534
  generation = 0;
536
535
  liveSubscriberCount = 0;
537
536
  power = null;
538
- sampleIntervalMs = UNKNOWN_BACKGROUND_SAMPLE_INTERVAL_MS;
537
+ sampleIntervalMs = BACKGROUND_SAMPLE_INTERVAL_MS;
539
538
  streamingApplied = false;
540
539
  intervalApplied = 0;
541
540
  stopped = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-resource-telemetry",
3
- "version": "0.2.2167",
3
+ "version": "0.2.2510",
4
4
  "description": "Measures what this machine's processes cost in CPU, memory and disk.",
5
5
  "keywords": [
6
6
  "telemetry",
@@ -20,7 +20,7 @@
20
20
  "effect": "4.0.0-beta.103",
21
21
  "esbuild": "0.28.1",
22
22
  "vite-plus": "0.2.2",
23
- "@ycodium-ai/plugin-api": "0.2.2167"
23
+ "@ycodium-ai/plugin-api": "0.2.2510"
24
24
  },
25
25
  "ycodium": {
26
26
  "plugin": "./dist/index.js",