@nredd/pi-resource-sampler 0.1.0 → 0.2.0

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.
package/dist/types.d.ts CHANGED
@@ -10,9 +10,17 @@ export type Metric<T> = {
10
10
  export interface ProcessSample {
11
11
  pid: number;
12
12
  parentPid: number;
13
+ /**
14
+ * Executable basename from kernel metadata, never argv, environment, process title or Linux comm:
15
+ * Darwin `p_comm` (at most 16 bytes), Linux `/proc/PID/exe` basename. "" means unavailable,
16
+ * e.g. another user's Linux process. Untrusted display text: whoever names the file chooses it, and
17
+ * a Linux process can exec a `memfd_create` file it named itself.
18
+ */
13
19
  name: string;
14
20
  identity: string;
15
21
  rssBytes: number;
22
+ /** Darwin physical footprint (includes compressed memory); failure is never zero. */
23
+ footprint?: Metric<number>;
16
24
  /** Interval utilization: 100 is one logical core, values may exceed 100. */
17
25
  cpu: Metric<number>;
18
26
  }
@@ -37,7 +45,18 @@ export interface ResourceSnapshot {
37
45
  loadAverage: number[];
38
46
  memory: {
39
47
  totalBytes: number;
48
+ /** Free pages only, not reclaimable cache. */
40
49
  freeBytes: number;
50
+ /** Optional additive v1 fields; absent in older producers and on non-Darwin platforms. */
51
+ usage?: Metric<{
52
+ usedBytes: number;
53
+ availableBytes: number;
54
+ basis: "app+wired+compressed";
55
+ }>;
56
+ swap?: Metric<{
57
+ usedBytes: number;
58
+ totalBytes: number;
59
+ }>;
41
60
  };
42
61
  processes: ProcessSample[];
43
62
  coverage: {
package/package.json CHANGED
@@ -1,22 +1,47 @@
1
1
  {
2
2
  "name": "@nredd/pi-resource-sampler",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Bounded, privacy-safe host resource interval sampling without Pi dependencies.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "nredd",
8
- "publishConfig": { "access": "public" },
9
- "engines": { "node": ">=22.14.0" },
10
- "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } },
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "engines": {
12
+ "node": ">=22.14.0"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
11
20
  "types": "./dist/index.d.ts",
12
- "files": ["dist", "LICENSE", "README.md"],
13
- "repository": { "type": "git", "url": "git+https://github.com/nredd/pi-harness.git", "directory": "packages/resource-sampler" },
21
+ "files": [
22
+ "dist",
23
+ "LICENSE",
24
+ "README.md"
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/nredd/pi-harness.git",
29
+ "directory": "packages/resource-sampler"
30
+ },
14
31
  "scripts": {
15
32
  "build": "tsc -p tsconfig.build.json",
16
33
  "lint": "biome check src test",
17
34
  "typecheck": "tsc --noEmit",
18
- "test": "vitest run --maxWorkers=1",
19
- "check": "npm run lint && npm run typecheck && npm run build && npm test"
35
+ "test": "vitest run --coverage --maxWorkers=1",
36
+ "test:bun": "node ../../scripts/run-vitest.ts bun --maxWorkers=1 --coverage --coverage.provider=istanbul --coverage.reporter=text --coverage.reporter=lcov --coverage.reportsDirectory=coverage/bun",
37
+ "check": "npm run lint && npm run typecheck && npm run build && npm test && npm run test:bun"
20
38
  },
21
- "devDependencies": { "@biomejs/biome": "2.5.15", "@types/node": "26.6.5", "typescript": "7.0.2", "vitest": "5.0.3" }
39
+ "devDependencies": {
40
+ "@biomejs/biome": "2.5.15",
41
+ "@types/node": "26.6.5",
42
+ "@vitest/coverage-istanbul": "5.0.3",
43
+ "@vitest/coverage-v8": "5.0.3",
44
+ "typescript": "7.0.2",
45
+ "vitest": "5.0.3"
46
+ }
22
47
  }