@ycodium-ai/plugin-resource-telemetry 0.2.2984 → 0.2.2990

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 +51 -47
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -492,6 +492,8 @@ var buildHistory = (input) => {
492
492
 
493
493
  // src/sidecar.ts
494
494
  import * as NodeCrypto from "node:crypto";
495
+
496
+ // src/sidecarSupport.ts
495
497
  var SAMPLE_INTERVAL_MS = 1e3;
496
498
  var BACKGROUND_SAMPLE_INTERVAL_MS = 5e3;
497
499
  var BATTERY_SAMPLE_INTERVAL_MS = 5e3;
@@ -514,6 +516,55 @@ var resolveSampleIntervalMs = (power, liveSubscriberCount) => {
514
516
  };
515
517
  var restartDelayMs = (attempt) => Math.min(INITIAL_RESTART_DELAY_MS * 2 ** attempt, MAX_RESTART_DELAY_MS);
516
518
  var toError = (value) => value instanceof Error ? value : new Error(String(value));
519
+ var raceHandshake = (hello, ended, timeoutMs) => {
520
+ let timer;
521
+ return Promise.race([
522
+ hello,
523
+ ended.then(() => null),
524
+ new Promise((resolve) => {
525
+ timer = setTimeout(() => resolve(null), timeoutMs);
526
+ })
527
+ ]).finally(() => {
528
+ if (timer !== void 0) clearTimeout(timer);
529
+ });
530
+ };
531
+ var withTimeout = (promise, timeoutMs, operation) => {
532
+ let timer;
533
+ return Promise.race([
534
+ promise,
535
+ new Promise((_, reject) => {
536
+ timer = setTimeout(() => {
537
+ reject(
538
+ new Error(
539
+ `the resource monitor '${operation}' request timed out after ${String(timeoutMs)}ms`
540
+ )
541
+ );
542
+ }, timeoutMs);
543
+ })
544
+ ]).finally(() => {
545
+ if (timer !== void 0) clearTimeout(timer);
546
+ });
547
+ };
548
+ var pumpLines = async (source, onLine) => {
549
+ const decoder = new TextDecoder();
550
+ let buffer = "";
551
+ for await (const chunk of source) {
552
+ buffer += decoder.decode(chunk, { stream: true });
553
+ let index = buffer.indexOf("\n");
554
+ while (index >= 0) {
555
+ onLine(buffer.slice(0, index));
556
+ buffer = buffer.slice(index + 1);
557
+ index = buffer.indexOf("\n");
558
+ }
559
+ }
560
+ onLine(buffer);
561
+ };
562
+ var pumpChunks = async (source, onText) => {
563
+ const decoder = new TextDecoder();
564
+ for await (const chunk of source) onText(decoder.decode(chunk, { stream: true }));
565
+ };
566
+
567
+ // src/sidecar.ts
517
568
  var TelemetrySidecar = class {
518
569
  input;
519
570
  state = {
@@ -981,53 +1032,6 @@ var TelemetrySidecar = class {
981
1032
  }
982
1033
  }
983
1034
  };
984
- var raceHandshake = (hello, ended, timeoutMs) => {
985
- let timer;
986
- return Promise.race([
987
- hello,
988
- ended.then(() => null),
989
- new Promise((resolve) => {
990
- timer = setTimeout(() => resolve(null), timeoutMs);
991
- })
992
- ]).finally(() => {
993
- if (timer !== void 0) clearTimeout(timer);
994
- });
995
- };
996
- var withTimeout = (promise, timeoutMs, operation) => {
997
- let timer;
998
- return Promise.race([
999
- promise,
1000
- new Promise((_, reject) => {
1001
- timer = setTimeout(() => {
1002
- reject(
1003
- new Error(
1004
- `the resource monitor '${operation}' request timed out after ${String(timeoutMs)}ms`
1005
- )
1006
- );
1007
- }, timeoutMs);
1008
- })
1009
- ]).finally(() => {
1010
- if (timer !== void 0) clearTimeout(timer);
1011
- });
1012
- };
1013
- var pumpLines = async (source, onLine) => {
1014
- const decoder = new TextDecoder();
1015
- let buffer = "";
1016
- for await (const chunk of source) {
1017
- buffer += decoder.decode(chunk, { stream: true });
1018
- let index = buffer.indexOf("\n");
1019
- while (index >= 0) {
1020
- onLine(buffer.slice(0, index));
1021
- buffer = buffer.slice(index + 1);
1022
- index = buffer.indexOf("\n");
1023
- }
1024
- }
1025
- onLine(buffer);
1026
- };
1027
- var pumpChunks = async (source, onText) => {
1028
- const decoder = new TextDecoder();
1029
- for await (const chunk of source) onText(decoder.decode(chunk, { stream: true }));
1030
- };
1031
1035
 
1032
1036
  // src/index.ts
1033
1037
  var unknownPower = (readAtIso) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-resource-telemetry",
3
- "version": "0.2.2984",
3
+ "version": "0.2.2990",
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.2984"
23
+ "@ycodium-ai/plugin-api": "0.2.2990"
24
24
  },
25
25
  "ycodium": {
26
26
  "plugin": "./dist/index.js",