@hydranium/core 1.0.0-next.197 → 1.0.0-next.199

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.
@@ -18,7 +18,6 @@ export * from './latency-from-env.js';
18
18
  export * from './measure-memory.js';
19
19
  export * from './memory-monitor.js';
20
20
  export * from './lint-grammar.js';
21
- export * from './process-memory.js';
22
21
  export * from './profile-capture.js';
23
22
  export * from './profile-digest.js';
24
23
  export * from './profiling-run.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAgBlF,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAQxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAgBlF,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAQxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
package/lib/node/index.js CHANGED
@@ -37,7 +37,6 @@ export * from './latency-from-env.js';
37
37
  export * from './measure-memory.js';
38
38
  export * from './memory-monitor.js';
39
39
  export * from './lint-grammar.js';
40
- export * from './process-memory.js';
41
40
  export * from './profile-capture.js';
42
41
  export * from './profile-digest.js';
43
42
  export * from './profiling-run.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,iFAAiF;AACjF,6EAA6E;AAC7E,iFAAiF;AACjF,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,mBAAmB;AACnB,iFAAiF;AACjF,iFAAiF;AACjF,8CAA8C;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAExC,8EAA8E;AAC9E,+EAA+E;AAC/E,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,sCAAsC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,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qB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AAExC,sBAAsB,EAAE,CAAC;AACzB,yBAAyB,EAAE,CAAC"}
@@ -19,7 +19,7 @@ import { Format } from '@hydranium/protocol';
19
19
  import * as fs from 'node:fs';
20
20
  import { Session } from 'node:inspector';
21
21
  import { constants, monitorEventLoopDelay, PerformanceObserver, performance } from 'node:perf_hooks';
22
- import { snapshotFilePath, writeHeapSnapshotToDir } from './process-memory.js';
22
+ import { snapshotFilePath, writeHeapSnapshotToDir } from '@hydranium/protocol/node';
23
23
  export const DEFAULT_CPU_INTERVAL_MICROS = 1000;
24
24
  export const DEFAULT_ALLOCATION_INTERVAL_BYTES = 32768;
25
25
  /** V8 GC-kind flag → readable name; unknown flags fall back to the number as a string. */
@@ -1 +1 @@
1
- {"version":3,"file":"profile-capture.js","sourceRoot":"","sources":["../../src/node/profile-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAA8B,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACJ,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EAGb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAChD,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,CAAC;AAOvD,0FAA0F;AAC1F,MAAM,aAAa,GAA2B;IAC3C,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,UAAU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,OAAgB,EAAE,SAA6B,EAAE,KAAa,EAAE,MAAc,EAAE,GAAW;QACnH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACjE,4EAA4E;QAC5E,0EAA0E;QAC1E,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,OAAO,QAAQ,CAAC;IACnB,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAClC,OAAuE,EACvE,GAAqB;IAErB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC;IAC1C,IAAI,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACd,IAAI,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC7B,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,KAAK,CAAC;IACf,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/core",
3
- "version": "1.0.0-next.197",
3
+ "version": "1.0.0-next.199",
4
4
  "description": "Foundational runtime of the hydranium framework: AST coordination layer (services, integrity, AST extension, serialization, multi-client documents) plus the LSP textual head at the /lsp subpath. Consumed by protocol-head packages (@hydranium/data-server, @hydranium/glsp-server).",
5
5
  "keywords": [
6
6
  "ast",
@@ -107,8 +107,8 @@
107
107
  "diff": "^5.2.0"
108
108
  },
109
109
  "devDependencies": {
110
- "@hydranium/langium": "1.0.0-next.197",
111
- "@hydranium/protocol": "1.0.0-next.197",
110
+ "@hydranium/langium": "1.0.0-next.199",
111
+ "@hydranium/protocol": "1.0.0-next.199",
112
112
  "@playwright/test": "^1.40.0",
113
113
  "@types/diff": "^5.2.0",
114
114
  "rimraf": "^5.0.0",
@@ -120,8 +120,8 @@
120
120
  "vscode-languageserver-types": "^3.17.5"
121
121
  },
122
122
  "peerDependencies": {
123
- "@hydranium/langium": "1.0.0-next.197",
124
- "@hydranium/protocol": "1.0.0-next.197",
123
+ "@hydranium/langium": "1.0.0-next.199",
124
+ "@hydranium/protocol": "1.0.0-next.199",
125
125
  "@playwright/test": "^1.40.0",
126
126
  "vscode-jsonrpc": "9.0.1",
127
127
  "vscode-languageserver": "~10.0.1",
package/src/node/index.ts CHANGED
@@ -40,7 +40,6 @@ export * from './latency-from-env.js';
40
40
  export * from './measure-memory.js';
41
41
  export * from './memory-monitor.js';
42
42
  export * from './lint-grammar.js';
43
- export * from './process-memory.js';
44
43
  export * from './profile-capture.js';
45
44
  export * from './profile-digest.js';
46
45
  export * from './profiling-run.js';
@@ -28,7 +28,7 @@ import {
28
28
  type IntervalHistogram,
29
29
  type PerformanceEntry
30
30
  } from 'node:perf_hooks';
31
- import { snapshotFilePath, writeHeapSnapshotToDir } from './process-memory.js';
31
+ import { snapshotFilePath, writeHeapSnapshotToDir } from '@hydranium/protocol/node';
32
32
 
33
33
  export const DEFAULT_CPU_INTERVAL_MICROS = 1000;
34
34
  export const DEFAULT_ALLOCATION_INTERVAL_BYTES = 32768;
@@ -1,66 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the MIT License which is available in the project root.
6
- *
7
- * SPDX-License-Identifier: MIT
8
- ********************************************************************************/
9
- /**
10
- * Format a one-shot memory snapshot of the CURRENT process (heap, rss, external, V8 limit).
11
- * Suited to a process that hosts no Langium documents (e.g. a host backend); for the
12
- * language-server process with document counts, see `formatServerState`.
13
- */
14
- export declare function formatProcessMemory(label: string): string;
15
- /**
16
- * Compose an absolute artifact file path of the form `<prefix>[-<label>].<ext>` inside
17
- * {@link directory} (e.g. the workspace folder, so it lands on the persistent volume in cloud and
18
- * is visible in the file explorer), falling back to the OS temp dir when the directory is missing
19
- * or does not exist. The {@link prefix} carries the origin-first stem (e.g. `server-cpu`) and, when
20
- * a non-empty {@link label} is given (a named capture window), it is sanitised (non-word characters
21
- * → `_`, truncated to 40 chars) and appended as `-<label>`; an empty label yields the bare
22
- * `<prefix>.<ext>` so the manifest `kind` equals the filename stem. No timestamp — a fresh session
23
- * directory per run keeps names stable and collision-free. Shared by the heap-snapshot writer and
24
- * the sampled-profile capture so heap / CPU / allocation artefacts land identically, differing only
25
- * by extension.
26
- */
27
- export declare function snapshotFilePath(directory: string | undefined, label: string, prefix: string, ext: string): string;
28
- /**
29
- * Write a V8 heap snapshot of the CURRENT process to {@link directory}, falling back to the OS temp
30
- * dir when it is missing (see {@link snapshotFilePath}). `v8.writeHeapSnapshot` runs a full GC first and
31
- * briefly pauses the process; it also transiently inflates RSS while serialising. Returns the
32
- * absolute file path. The {@link prefix} (default `server-heap`, the origin-first stem) and
33
- * {@link label} are folded into the name.
34
- */
35
- export declare function writeHeapSnapshotToDir(directory: string | undefined, label: string, prefix?: string): string;
36
- /** A readable role for a process, whether it belongs to the app, and whether exactly one is expected. */
37
- export interface ProcessRole {
38
- /** Human-readable role shown in the snapshot. */
39
- role: string;
40
- /** Whether this process is part of the application (vs. tooling/debugger), counted in the app total. */
41
- isApp: boolean;
42
- /**
43
- * Set when at most one instance of this role should exist; `formatPodMemory` warns when more than
44
- * one is found (e.g. a duplicated/ghost language server).
45
- */
46
- singletonExpected?: boolean;
47
- }
48
- /** Map a raw command line to a {@link ProcessRole}. A head supplies this to label its own processes. */
49
- export type ProcessClassifier = (cmdline: string) => ProcessRole;
50
- /** Options for {@link formatPodMemory}. */
51
- export interface PodMemoryOptions {
52
- /** Map a process command line to a readable role; lets a head label its own processes. */
53
- classify?: ProcessClassifier;
54
- /** Heading for the in-app process group (default `Application`). */
55
- appLabel?: string;
56
- }
57
- /**
58
- * Format a pod/container-level memory snapshot read from the cgroup this process belongs to
59
- * (cgroup v2 `memory.current`/`peak`/`max`/`stat`, falling back to cgroup v1). This is the figure
60
- * the Kubernetes OOM-killer watches — it covers every process in the pod plus page cache and kernel
61
- * memory, so it is higher than any single `process.memoryUsage().rss`. Also sums per-process RSS so
62
- * the per-process split is visible. Explains itself when no cgroup memory controller is present
63
- * (e.g. local dev outside a container).
64
- */
65
- export declare function formatPodMemory(options?: PodMemoryOptions): string;
66
- //# sourceMappingURL=process-memory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process-memory.d.ts","sourceRoot":"","sources":["../../src/node/process-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAelF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKlH;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAgB,GAAG,MAAM,CAInH;AA8CD,yGAAyG;AACzG,MAAM,WAAW,WAAW;IACzB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,wGAAwG;IACxG,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wGAAwG;AACxG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,CAAC;AA2EjE,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC9B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM,CA6EtE"}
@@ -1,252 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the MIT License which is available in the project root.
6
- *
7
- * SPDX-License-Identifier: MIT
8
- ********************************************************************************/
9
- /*
10
- * Node-only process- and pod-level memory introspection plus heap-snapshot
11
- * writing. Everything here is generic OS-level code (V8 stats, cgroup v2/v1,
12
- * `/proc`); the only host-specific part is naming the processes, which a head
13
- * supplies through a `ProcessClassifier`.
14
- */
15
- import { Format } from '@hydranium/protocol';
16
- import * as fs from 'node:fs';
17
- import * as os from 'node:os';
18
- import * as path from 'node:path';
19
- import * as v8 from 'node:v8';
20
- /**
21
- * Format a one-shot memory snapshot of the CURRENT process (heap, rss, external, V8 limit).
22
- * Suited to a process that hosts no Langium documents (e.g. a host backend); for the
23
- * language-server process with document counts, see `formatServerState`.
24
- */
25
- export function formatProcessMemory(label) {
26
- const mem = process.memoryUsage();
27
- const heap = v8.getHeapStatistics();
28
- const heapPercent = Math.round((mem.heapUsed / heap.heap_size_limit) * 100);
29
- return [
30
- `${label}:`,
31
- ` heap ${Format.bytes(mem.heapUsed)} used / ${Format.bytes(mem.heapTotal)} total / ` +
32
- `${Format.bytes(heap.heap_size_limit)} limit (${heapPercent}% of limit)`,
33
- ` rss ${Format.bytes(mem.rss)}, external ${Format.bytes(mem.external)}, arrayBuffers ${Format.bytes(mem.arrayBuffers)}`,
34
- ` uptime ${Math.round(process.uptime())}s, pid ${process.pid}`
35
- ].join('\n');
36
- }
37
- /**
38
- * Compose an absolute artifact file path of the form `<prefix>[-<label>].<ext>` inside
39
- * {@link directory} (e.g. the workspace folder, so it lands on the persistent volume in cloud and
40
- * is visible in the file explorer), falling back to the OS temp dir when the directory is missing
41
- * or does not exist. The {@link prefix} carries the origin-first stem (e.g. `server-cpu`) and, when
42
- * a non-empty {@link label} is given (a named capture window), it is sanitised (non-word characters
43
- * → `_`, truncated to 40 chars) and appended as `-<label>`; an empty label yields the bare
44
- * `<prefix>.<ext>` so the manifest `kind` equals the filename stem. No timestamp — a fresh session
45
- * directory per run keeps names stable and collision-free. Shared by the heap-snapshot writer and
46
- * the sampled-profile capture so heap / CPU / allocation artefacts land identically, differing only
47
- * by extension.
48
- */
49
- export function snapshotFilePath(directory, label, prefix, ext) {
50
- const safeLabel = label ? label.replace(/[^\w.-]+/g, '_').slice(0, 40) : '';
51
- const dir = directory && fs.existsSync(directory) ? directory : os.tmpdir();
52
- const stem = safeLabel ? `${prefix}-${safeLabel}` : prefix;
53
- return path.join(dir, `${stem}.${ext}`);
54
- }
55
- /**
56
- * Write a V8 heap snapshot of the CURRENT process to {@link directory}, falling back to the OS temp
57
- * dir when it is missing (see {@link snapshotFilePath}). `v8.writeHeapSnapshot` runs a full GC first and
58
- * briefly pauses the process; it also transiently inflates RSS while serialising. Returns the
59
- * absolute file path. The {@link prefix} (default `server-heap`, the origin-first stem) and
60
- * {@link label} are folded into the name.
61
- */
62
- export function writeHeapSnapshotToDir(directory, label, prefix = 'server-heap') {
63
- const filePath = snapshotFilePath(directory, label, prefix, 'heapsnapshot');
64
- v8.writeHeapSnapshot(filePath);
65
- return filePath;
66
- }
67
- const CGROUP_ROOT = '/sys/fs/cgroup';
68
- function readNumber(file) {
69
- try {
70
- const text = fs.readFileSync(file, 'utf8').trim();
71
- if (text === 'max') {
72
- return Number.POSITIVE_INFINITY;
73
- }
74
- const value = Number(text);
75
- return Number.isFinite(value) ? value : undefined;
76
- }
77
- catch {
78
- return undefined;
79
- }
80
- }
81
- /** Parse a `key value` per-line file (cgroup memory.stat) into a map. */
82
- function readKeyedBytes(file) {
83
- const out = {};
84
- try {
85
- for (const line of fs.readFileSync(file, 'utf8').split('\n')) {
86
- const [key, value] = line.trim().split(/\s+/);
87
- if (key && value !== undefined) {
88
- const num = Number(value);
89
- if (Number.isFinite(num)) {
90
- out[key] = num;
91
- }
92
- }
93
- }
94
- }
95
- catch {
96
- // file absent or unreadable; caller handles the empty map.
97
- }
98
- return out;
99
- }
100
- /** Generic fallback: every process is shown under the app heading, labelled by its (truncated) command line. */
101
- const defaultProcessClassifier = cmdline => ({ role: cmdline ? cmdline.slice(0, 60) : 'process', isApp: true });
102
- /** Read /proc for every visible process: pid, ppid, RSS, and a command label. */
103
- function readAllProcs() {
104
- const procs = [];
105
- let entries = [];
106
- try {
107
- entries = fs.readdirSync('/proc');
108
- }
109
- catch {
110
- return procs;
111
- }
112
- for (const entry of entries) {
113
- if (!/^\d+$/.test(entry)) {
114
- continue;
115
- }
116
- let status = '';
117
- try {
118
- status = fs.readFileSync(`/proc/${entry}/status`, 'utf8');
119
- }
120
- catch {
121
- continue;
122
- }
123
- const rssMatch = status.match(/^VmRSS:\s+(\d+)\s+kB/m);
124
- if (!rssMatch) {
125
- continue;
126
- }
127
- const ppid = Number(status.match(/^PPid:\s+(\d+)/m)?.[1] ?? 0);
128
- let label = '';
129
- try {
130
- label = fs.readFileSync(`/proc/${entry}/cmdline`, 'utf8').replace(/\0/g, ' ').trim();
131
- }
132
- catch {
133
- // fall back to the process name from status below.
134
- }
135
- if (!label) {
136
- label = status.match(/^Name:\s+(.+)$/m)?.[1] ?? `pid ${entry}`;
137
- }
138
- procs.push({ pid: Number(entry), ppid, rssBytes: Number(rssMatch[1]) * 1024, label });
139
- }
140
- return procs;
141
- }
142
- /**
143
- * Sum and list per-process RSS. When {@link rootPid} is given, restrict to that process and its
144
- * descendants (the app's own process tree), which keeps the figure meaningful in local dev where
145
- * /proc otherwise shows the whole machine. In a container's PID namespace the tree is effectively
146
- * all the pod's processes anyway.
147
- */
148
- function collectProcessRss(rootPid) {
149
- const all = readAllProcs();
150
- let selected = all;
151
- let scoped = false;
152
- if (rootPid !== undefined) {
153
- const childrenByPpid = new Map();
154
- for (const proc of all) {
155
- (childrenByPpid.get(proc.ppid) ?? childrenByPpid.set(proc.ppid, []).get(proc.ppid)).push(proc);
156
- }
157
- const tree = [];
158
- const queue = all.filter(proc => proc.pid === rootPid);
159
- while (queue.length > 0) {
160
- const proc = queue.shift();
161
- tree.push(proc);
162
- queue.push(...(childrenByPpid.get(proc.pid) ?? []));
163
- }
164
- if (tree.length > 0) {
165
- selected = tree;
166
- scoped = true;
167
- }
168
- }
169
- const total = selected.reduce((sum, proc) => sum + proc.rssBytes, 0);
170
- selected.sort((a, b) => b.rssBytes - a.rssBytes);
171
- return { total, processes: selected, scoped };
172
- }
173
- /**
174
- * Format a pod/container-level memory snapshot read from the cgroup this process belongs to
175
- * (cgroup v2 `memory.current`/`peak`/`max`/`stat`, falling back to cgroup v1). This is the figure
176
- * the Kubernetes OOM-killer watches — it covers every process in the pod plus page cache and kernel
177
- * memory, so it is higher than any single `process.memoryUsage().rss`. Also sums per-process RSS so
178
- * the per-process split is visible. Explains itself when no cgroup memory controller is present
179
- * (e.g. local dev outside a container).
180
- */
181
- export function formatPodMemory(options = {}) {
182
- const classify = options.classify ?? defaultProcessClassifier;
183
- const appLabel = options.appLabel ?? 'Application';
184
- const lines = ['Pod memory snapshot:'];
185
- const v2Current = path.join(CGROUP_ROOT, 'memory.current');
186
- const v1Usage = path.join(CGROUP_ROOT, 'memory', 'memory.usage_in_bytes');
187
- if (fs.existsSync(v2Current)) {
188
- const current = readNumber(v2Current);
189
- const peak = readNumber(path.join(CGROUP_ROOT, 'memory.peak'));
190
- const max = readNumber(path.join(CGROUP_ROOT, 'memory.max'));
191
- const stat = readKeyedBytes(path.join(CGROUP_ROOT, 'memory.stat'));
192
- lines.push(' cgroup v2');
193
- lines.push(` current ${current !== undefined ? Format.bytes(current) : 'n/a'}`);
194
- lines.push(` peak ${peak !== undefined ? Format.bytes(peak) : 'n/a (kernel too old for memory.peak)'}`);
195
- lines.push(` limit ${max === Number.POSITIVE_INFINITY ? 'unlimited' : max !== undefined ? Format.bytes(max) : 'n/a'}`);
196
- if (Object.keys(stat).length > 0) {
197
- lines.push(` breakdown anon ${Format.bytes(stat.anon ?? 0)} (heaps/stacks), file ${Format.bytes(stat.file ?? 0)} (page cache), ` +
198
- `kernel ${Format.bytes(stat.kernel ?? stat.slab ?? 0)}, sock ${Format.bytes(stat.sock ?? 0)}`);
199
- }
200
- }
201
- else if (fs.existsSync(v1Usage)) {
202
- const v1 = path.join(CGROUP_ROOT, 'memory');
203
- const current = readNumber(v1Usage);
204
- const peak = readNumber(path.join(v1, 'memory.max_usage_in_bytes'));
205
- const limit = readNumber(path.join(v1, 'memory.limit_in_bytes'));
206
- const stat = readKeyedBytes(path.join(v1, 'memory.stat'));
207
- lines.push(' cgroup v1');
208
- lines.push(` current ${current !== undefined ? Format.bytes(current) : 'n/a'}`);
209
- lines.push(` peak ${peak !== undefined ? Format.bytes(peak) : 'n/a'}`);
210
- // v1 reports a huge sentinel for "unlimited"; treat anything >= 2^60 as unlimited.
211
- lines.push(` limit ${limit !== undefined && limit < 2 ** 60 ? Format.bytes(limit) : 'unlimited'}`);
212
- if (Object.keys(stat).length > 0) {
213
- lines.push(` breakdown rss ${Format.bytes(stat.rss ?? 0)}, cache ${Format.bytes(stat.cache ?? 0)} (page cache), ` +
214
- `kernel ${Format.bytes(stat.kernel ?? 0)}`);
215
- }
216
- }
217
- else {
218
- lines.push(' cgroup no memory controller under /sys/fs/cgroup (not running in a container?)');
219
- }
220
- // Root at this process so local dev reports only the app's tree, not the whole machine.
221
- const { processes } = collectProcessRss(process.pid);
222
- if (processes.length > 0) {
223
- const classified = processes.map(proc => ({ ...proc, ...classify(proc.label) }));
224
- const appProcs = classified.filter(proc => proc.isApp);
225
- const otherProcs = classified.filter(proc => !proc.isApp);
226
- const appTotal = appProcs.reduce((sum, proc) => sum + proc.rssBytes, 0);
227
- lines.push('');
228
- lines.push(` ${appLabel}: ${Format.bytes(appTotal)} across ${appProcs.length} process(es)`);
229
- for (const proc of appProcs) {
230
- lines.push(` ${Format.bytes(proc.rssBytes).padStart(10)} ${proc.role} (pid ${proc.pid})`);
231
- }
232
- const singletonCounts = new Map();
233
- for (const proc of appProcs) {
234
- if (proc.singletonExpected) {
235
- singletonCounts.set(proc.role, (singletonCounts.get(proc.role) ?? 0) + 1);
236
- }
237
- }
238
- for (const [role, count] of singletonCounts) {
239
- if (count > 1) {
240
- lines.push(` WARNING: ${count} instances of "${role}" running - likely ghost process(es); expected 1`);
241
- }
242
- }
243
- if (otherProcs.length > 0) {
244
- const otherTotal = otherProcs.reduce((sum, proc) => sum + proc.rssBytes, 0);
245
- lines.push(` Other (tooling/debugger, not counted above): ${Format.bytes(otherTotal)} across ${otherProcs.length} process(es)`);
246
- }
247
- lines.push(' Note: in a real pod the cgroup figure above is the OOM ceiling; this per-process');
248
- lines.push(' split is for attribution. Local dev may include debugger processes (excluded here).');
249
- }
250
- return lines.join('\n');
251
- }
252
- //# sourceMappingURL=process-memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process-memory.js","sourceRoot":"","sources":["../../src/node/process-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC9C,MA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MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC5E,KAAK,CAAC,IAAI,CAAC,kDAAkD,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,UAAU,CAAC,MAAM,cAAc,CAAC,CAAC;QACpI,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;QACjG,KAAK,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;IACvG,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
@@ -1,299 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the MIT License which is available in the project root.
6
- *
7
- * SPDX-License-Identifier: MIT
8
- ********************************************************************************/
9
-
10
- /*
11
- * Node-only process- and pod-level memory introspection plus heap-snapshot
12
- * writing. Everything here is generic OS-level code (V8 stats, cgroup v2/v1,
13
- * `/proc`); the only host-specific part is naming the processes, which a head
14
- * supplies through a `ProcessClassifier`.
15
- */
16
-
17
- import { Format } from '@hydranium/protocol';
18
- import * as fs from 'node:fs';
19
- import * as os from 'node:os';
20
- import * as path from 'node:path';
21
- import * as v8 from 'node:v8';
22
-
23
- /**
24
- * Format a one-shot memory snapshot of the CURRENT process (heap, rss, external, V8 limit).
25
- * Suited to a process that hosts no Langium documents (e.g. a host backend); for the
26
- * language-server process with document counts, see `formatServerState`.
27
- */
28
- export function formatProcessMemory(label: string): string {
29
- const mem = process.memoryUsage();
30
- const heap = v8.getHeapStatistics();
31
- const heapPercent = Math.round((mem.heapUsed / heap.heap_size_limit) * 100);
32
- return [
33
- `${label}:`,
34
- ` heap ${Format.bytes(mem.heapUsed)} used / ${Format.bytes(mem.heapTotal)} total / ` +
35
- `${Format.bytes(heap.heap_size_limit)} limit (${heapPercent}% of limit)`,
36
- ` rss ${Format.bytes(mem.rss)}, external ${Format.bytes(mem.external)}, arrayBuffers ${Format.bytes(mem.arrayBuffers)}`,
37
- ` uptime ${Math.round(process.uptime())}s, pid ${process.pid}`
38
- ].join('\n');
39
- }
40
-
41
- /**
42
- * Compose an absolute artifact file path of the form `<prefix>[-<label>].<ext>` inside
43
- * {@link directory} (e.g. the workspace folder, so it lands on the persistent volume in cloud and
44
- * is visible in the file explorer), falling back to the OS temp dir when the directory is missing
45
- * or does not exist. The {@link prefix} carries the origin-first stem (e.g. `server-cpu`) and, when
46
- * a non-empty {@link label} is given (a named capture window), it is sanitised (non-word characters
47
- * → `_`, truncated to 40 chars) and appended as `-<label>`; an empty label yields the bare
48
- * `<prefix>.<ext>` so the manifest `kind` equals the filename stem. No timestamp — a fresh session
49
- * directory per run keeps names stable and collision-free. Shared by the heap-snapshot writer and
50
- * the sampled-profile capture so heap / CPU / allocation artefacts land identically, differing only
51
- * by extension.
52
- */
53
- export function snapshotFilePath(directory: string | undefined, label: string, prefix: string, ext: string): string {
54
- const safeLabel = label ? label.replace(/[^\w.-]+/g, '_').slice(0, 40) : '';
55
- const dir = directory && fs.existsSync(directory) ? directory : os.tmpdir();
56
- const stem = safeLabel ? `${prefix}-${safeLabel}` : prefix;
57
- return path.join(dir, `${stem}.${ext}`);
58
- }
59
-
60
- /**
61
- * Write a V8 heap snapshot of the CURRENT process to {@link directory}, falling back to the OS temp
62
- * dir when it is missing (see {@link snapshotFilePath}). `v8.writeHeapSnapshot` runs a full GC first and
63
- * briefly pauses the process; it also transiently inflates RSS while serialising. Returns the
64
- * absolute file path. The {@link prefix} (default `server-heap`, the origin-first stem) and
65
- * {@link label} are folded into the name.
66
- */
67
- export function writeHeapSnapshotToDir(directory: string | undefined, label: string, prefix = 'server-heap'): string {
68
- const filePath = snapshotFilePath(directory, label, prefix, 'heapsnapshot');
69
- v8.writeHeapSnapshot(filePath);
70
- return filePath;
71
- }
72
-
73
- const CGROUP_ROOT = '/sys/fs/cgroup';
74
-
75
- function readNumber(file: string): number | undefined {
76
- try {
77
- const text = fs.readFileSync(file, 'utf8').trim();
78
- if (text === 'max') {
79
- return Number.POSITIVE_INFINITY;
80
- }
81
- const value = Number(text);
82
- return Number.isFinite(value) ? value : undefined;
83
- } catch {
84
- return undefined;
85
- }
86
- }
87
-
88
- /** Parse a `key value` per-line file (cgroup memory.stat) into a map. */
89
- function readKeyedBytes(file: string): Record<string, number> {
90
- const out: Record<string, number> = {};
91
- try {
92
- for (const line of fs.readFileSync(file, 'utf8').split('\n')) {
93
- const [key, value] = line.trim().split(/\s+/);
94
- if (key && value !== undefined) {
95
- const num = Number(value);
96
- if (Number.isFinite(num)) {
97
- out[key] = num;
98
- }
99
- }
100
- }
101
- } catch {
102
- // file absent or unreadable; caller handles the empty map.
103
- }
104
- return out;
105
- }
106
-
107
- interface ProcInfo {
108
- pid: number;
109
- rssBytes: number;
110
- label: string;
111
- }
112
-
113
- interface RawProc extends ProcInfo {
114
- ppid: number;
115
- }
116
-
117
- /** A readable role for a process, whether it belongs to the app, and whether exactly one is expected. */
118
- export interface ProcessRole {
119
- /** Human-readable role shown in the snapshot. */
120
- role: string;
121
- /** Whether this process is part of the application (vs. tooling/debugger), counted in the app total. */
122
- isApp: boolean;
123
- /**
124
- * Set when at most one instance of this role should exist; `formatPodMemory` warns when more than
125
- * one is found (e.g. a duplicated/ghost language server).
126
- */
127
- singletonExpected?: boolean;
128
- }
129
-
130
- /** Map a raw command line to a {@link ProcessRole}. A head supplies this to label its own processes. */
131
- export type ProcessClassifier = (cmdline: string) => ProcessRole;
132
-
133
- /** Generic fallback: every process is shown under the app heading, labelled by its (truncated) command line. */
134
- const defaultProcessClassifier: ProcessClassifier = cmdline => ({ role: cmdline ? cmdline.slice(0, 60) : 'process', isApp: true });
135
-
136
- /** Read /proc for every visible process: pid, ppid, RSS, and a command label. */
137
- function readAllProcs(): RawProc[] {
138
- const procs: RawProc[] = [];
139
- let entries: string[] = [];
140
- try {
141
- entries = fs.readdirSync('/proc');
142
- } catch {
143
- return procs;
144
- }
145
- for (const entry of entries) {
146
- if (!/^\d+$/.test(entry)) {
147
- continue;
148
- }
149
- let status = '';
150
- try {
151
- status = fs.readFileSync(`/proc/${entry}/status`, 'utf8');
152
- } catch {
153
- continue;
154
- }
155
- const rssMatch = status.match(/^VmRSS:\s+(\d+)\s+kB/m);
156
- if (!rssMatch) {
157
- continue;
158
- }
159
- const ppid = Number(status.match(/^PPid:\s+(\d+)/m)?.[1] ?? 0);
160
- let label = '';
161
- try {
162
- label = fs.readFileSync(`/proc/${entry}/cmdline`, 'utf8').replace(/\0/g, ' ').trim();
163
- } catch {
164
- // fall back to the process name from status below.
165
- }
166
- if (!label) {
167
- label = status.match(/^Name:\s+(.+)$/m)?.[1] ?? `pid ${entry}`;
168
- }
169
- procs.push({ pid: Number(entry), ppid, rssBytes: Number(rssMatch[1]) * 1024, label });
170
- }
171
- return procs;
172
- }
173
-
174
- /**
175
- * Sum and list per-process RSS. When {@link rootPid} is given, restrict to that process and its
176
- * descendants (the app's own process tree), which keeps the figure meaningful in local dev where
177
- * /proc otherwise shows the whole machine. In a container's PID namespace the tree is effectively
178
- * all the pod's processes anyway.
179
- */
180
- function collectProcessRss(rootPid?: number): { total: number; processes: ProcInfo[]; scoped: boolean } {
181
- const all = readAllProcs();
182
- let selected: RawProc[] = all;
183
- let scoped = false;
184
- if (rootPid !== undefined) {
185
- const childrenByPpid = new Map<number, RawProc[]>();
186
- for (const proc of all) {
187
- (childrenByPpid.get(proc.ppid) ?? childrenByPpid.set(proc.ppid, []).get(proc.ppid)!).push(proc);
188
- }
189
- const tree: RawProc[] = [];
190
- const queue = all.filter(proc => proc.pid === rootPid);
191
- while (queue.length > 0) {
192
- const proc = queue.shift()!;
193
- tree.push(proc);
194
- queue.push(...(childrenByPpid.get(proc.pid) ?? []));
195
- }
196
- if (tree.length > 0) {
197
- selected = tree;
198
- scoped = true;
199
- }
200
- }
201
- const total = selected.reduce((sum, proc) => sum + proc.rssBytes, 0);
202
- selected.sort((a, b) => b.rssBytes - a.rssBytes);
203
- return { total, processes: selected, scoped };
204
- }
205
-
206
- /** Options for {@link formatPodMemory}. */
207
- export interface PodMemoryOptions {
208
- /** Map a process command line to a readable role; lets a head label its own processes. */
209
- classify?: ProcessClassifier;
210
- /** Heading for the in-app process group (default `Application`). */
211
- appLabel?: string;
212
- }
213
-
214
- /**
215
- * Format a pod/container-level memory snapshot read from the cgroup this process belongs to
216
- * (cgroup v2 `memory.current`/`peak`/`max`/`stat`, falling back to cgroup v1). This is the figure
217
- * the Kubernetes OOM-killer watches — it covers every process in the pod plus page cache and kernel
218
- * memory, so it is higher than any single `process.memoryUsage().rss`. Also sums per-process RSS so
219
- * the per-process split is visible. Explains itself when no cgroup memory controller is present
220
- * (e.g. local dev outside a container).
221
- */
222
- export function formatPodMemory(options: PodMemoryOptions = {}): string {
223
- const classify = options.classify ?? defaultProcessClassifier;
224
- const appLabel = options.appLabel ?? 'Application';
225
- const lines: string[] = ['Pod memory snapshot:'];
226
-
227
- const v2Current = path.join(CGROUP_ROOT, 'memory.current');
228
- const v1Usage = path.join(CGROUP_ROOT, 'memory', 'memory.usage_in_bytes');
229
-
230
- if (fs.existsSync(v2Current)) {
231
- const current = readNumber(v2Current);
232
- const peak = readNumber(path.join(CGROUP_ROOT, 'memory.peak'));
233
- const max = readNumber(path.join(CGROUP_ROOT, 'memory.max'));
234
- const stat = readKeyedBytes(path.join(CGROUP_ROOT, 'memory.stat'));
235
- lines.push(' cgroup v2');
236
- lines.push(` current ${current !== undefined ? Format.bytes(current) : 'n/a'}`);
237
- lines.push(` peak ${peak !== undefined ? Format.bytes(peak) : 'n/a (kernel too old for memory.peak)'}`);
238
- lines.push(` limit ${max === Number.POSITIVE_INFINITY ? 'unlimited' : max !== undefined ? Format.bytes(max) : 'n/a'}`);
239
- if (Object.keys(stat).length > 0) {
240
- lines.push(
241
- ` breakdown anon ${Format.bytes(stat.anon ?? 0)} (heaps/stacks), file ${Format.bytes(stat.file ?? 0)} (page cache), ` +
242
- `kernel ${Format.bytes(stat.kernel ?? stat.slab ?? 0)}, sock ${Format.bytes(stat.sock ?? 0)}`
243
- );
244
- }
245
- } else if (fs.existsSync(v1Usage)) {
246
- const v1 = path.join(CGROUP_ROOT, 'memory');
247
- const current = readNumber(v1Usage);
248
- const peak = readNumber(path.join(v1, 'memory.max_usage_in_bytes'));
249
- const limit = readNumber(path.join(v1, 'memory.limit_in_bytes'));
250
- const stat = readKeyedBytes(path.join(v1, 'memory.stat'));
251
- lines.push(' cgroup v1');
252
- lines.push(` current ${current !== undefined ? Format.bytes(current) : 'n/a'}`);
253
- lines.push(` peak ${peak !== undefined ? Format.bytes(peak) : 'n/a'}`);
254
- // v1 reports a huge sentinel for "unlimited"; treat anything >= 2^60 as unlimited.
255
- lines.push(` limit ${limit !== undefined && limit < 2 ** 60 ? Format.bytes(limit) : 'unlimited'}`);
256
- if (Object.keys(stat).length > 0) {
257
- lines.push(
258
- ` breakdown rss ${Format.bytes(stat.rss ?? 0)}, cache ${Format.bytes(stat.cache ?? 0)} (page cache), ` +
259
- `kernel ${Format.bytes(stat.kernel ?? 0)}`
260
- );
261
- }
262
- } else {
263
- lines.push(' cgroup no memory controller under /sys/fs/cgroup (not running in a container?)');
264
- }
265
-
266
- // Root at this process so local dev reports only the app's tree, not the whole machine.
267
- const { processes } = collectProcessRss(process.pid);
268
- if (processes.length > 0) {
269
- const classified = processes.map(proc => ({ ...proc, ...classify(proc.label) }));
270
- const appProcs = classified.filter(proc => proc.isApp);
271
- const otherProcs = classified.filter(proc => !proc.isApp);
272
- const appTotal = appProcs.reduce((sum, proc) => sum + proc.rssBytes, 0);
273
-
274
- lines.push('');
275
- lines.push(` ${appLabel}: ${Format.bytes(appTotal)} across ${appProcs.length} process(es)`);
276
- for (const proc of appProcs) {
277
- lines.push(` ${Format.bytes(proc.rssBytes).padStart(10)} ${proc.role} (pid ${proc.pid})`);
278
- }
279
- const singletonCounts = new Map<string, number>();
280
- for (const proc of appProcs) {
281
- if (proc.singletonExpected) {
282
- singletonCounts.set(proc.role, (singletonCounts.get(proc.role) ?? 0) + 1);
283
- }
284
- }
285
- for (const [role, count] of singletonCounts) {
286
- if (count > 1) {
287
- lines.push(` WARNING: ${count} instances of "${role}" running - likely ghost process(es); expected 1`);
288
- }
289
- }
290
- if (otherProcs.length > 0) {
291
- const otherTotal = otherProcs.reduce((sum, proc) => sum + proc.rssBytes, 0);
292
- lines.push(` Other (tooling/debugger, not counted above): ${Format.bytes(otherTotal)} across ${otherProcs.length} process(es)`);
293
- }
294
- lines.push(' Note: in a real pod the cgroup figure above is the OOM ceiling; this per-process');
295
- lines.push(' split is for attribution. Local dev may include debugger processes (excluded here).');
296
- }
297
-
298
- return lines.join('\n');
299
- }