@descryy/runtime-orchestrator 0.4.8 → 0.4.9
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/package.json +6 -6
- package/dist/attach-to-running-jvm-process.d.ts +0 -86
- package/dist/attach-to-running-jvm-process.d.ts.map +0 -1
- package/dist/attach-to-running-jvm-process.js +0 -408
- package/dist/attach-to-running-jvm-process.js.map +0 -1
- package/dist/attach-to-running-node-process.d.ts +0 -80
- package/dist/attach-to-running-node-process.d.ts.map +0 -1
- package/dist/attach-to-running-node-process.js +0 -290
- package/dist/attach-to-running-node-process.js.map +0 -1
- package/dist/attach-to-running-process.d.ts +0 -83
- package/dist/attach-to-running-process.d.ts.map +0 -1
- package/dist/attach-to-running-process.js +0 -86
- package/dist/attach-to-running-process.js.map +0 -1
- package/dist/cdp-client.d.ts +0 -27
- package/dist/cdp-client.d.ts.map +0 -1
- package/dist/cdp-client.js +0 -98
- package/dist/cdp-client.js.map +0 -1
- package/dist/cgroup-partial-restriction.d.ts +0 -80
- package/dist/cgroup-partial-restriction.d.ts.map +0 -1
- package/dist/cgroup-partial-restriction.js +0 -189
- package/dist/cgroup-partial-restriction.js.map +0 -1
- package/dist/collector-version.d.ts +0 -7
- package/dist/collector-version.d.ts.map +0 -1
- package/dist/collector-version.js +0 -9
- package/dist/collector-version.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +0 -1
- package/dist/instrumented-execution.d.ts +0 -135
- package/dist/instrumented-execution.d.ts.map +0 -1
- package/dist/instrumented-execution.js +0 -696
- package/dist/instrumented-execution.js.map +0 -1
- package/dist/jvm-agent/build.d.ts +0 -48
- package/dist/jvm-agent/build.d.ts.map +0 -1
- package/dist/jvm-agent/build.js +0 -129
- package/dist/jvm-agent/build.js.map +0 -1
- package/dist/polling-output-source.d.ts +0 -43
- package/dist/polling-output-source.d.ts.map +0 -1
- package/dist/polling-output-source.js +0 -64
- package/dist/polling-output-source.js.map +0 -1
- package/dist/profile-backend-observation.d.ts +0 -67
- package/dist/profile-backend-observation.d.ts.map +0 -1
- package/dist/profile-backend-observation.js +0 -107
- package/dist/profile-backend-observation.js.map +0 -1
- package/dist/respawn-and-supervise.d.ts +0 -86
- package/dist/respawn-and-supervise.d.ts.map +0 -1
- package/dist/respawn-and-supervise.js +0 -171
- package/dist/respawn-and-supervise.js.map +0 -1
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Partial going-forward resource restriction for an already-running, attached-to
|
|
3
|
-
* process, via cgroups v2 — narrower alternative to `respawn-and-supervise.ts`.
|
|
4
|
-
*
|
|
5
|
-
* Moving a live pid into a delegated cgroup applies real kernel-enforced limits
|
|
6
|
-
* (`memory.max`, `cpu.max`, `pids.max`) without killing/restarting it. **It does
|
|
7
|
-
* NOT and cannot give filesystem or network isolation** — that needs `setns()`
|
|
8
|
-
* against a live pid, out of scope here. `CGROUP_PARTIAL_RESTRICTION_SCOPE` is the
|
|
9
|
-
* literal string every result carries so nothing downstream rounds this up to
|
|
10
|
-
* "sandboxed"/"isolated" (which would misrepresent it as `sandbox.ts`'s real
|
|
11
|
-
* spawn-time bwrap isolation).
|
|
12
|
-
*
|
|
13
|
-
* Finding the delegated ancestor: a non-root user can only write under
|
|
14
|
-
* `/sys/fs/cgroup` where a systemd user session delegates it (`Delegate=yes`).
|
|
15
|
-
* Delegation isn't uniform all the way down — a leaf cgroup already holding a
|
|
16
|
-
* process (e.g. this Node process's own scope) generally can't extend
|
|
17
|
-
* `subtree_control` further; writing fails `EBUSY` (measured on this repo's dev
|
|
18
|
-
* host). So `findDelegatedCgroupAncestor` doesn't trust subtree_control text or
|
|
19
|
-
* permission bits — it walks up from `/proc/self/cgroup` and, at each ancestor,
|
|
20
|
-
* creates a real temporary probe child and checks whether the kernel actually gave
|
|
21
|
-
* it a `memory.max` file.
|
|
22
|
-
*/
|
|
23
|
-
import type { CapabilityStatus } from "@descryy/runtime-contracts";
|
|
24
|
-
/** Literal scope string every `CgroupMoveResult` carries under `scope` — never restated by hand, so quotes of it can't drift. */
|
|
25
|
-
export declare const CGROUP_PARTIAL_RESTRICTION_SCOPE: "partial -- resource limits only, no filesystem or network isolation";
|
|
26
|
-
/**
|
|
27
|
-
* Walks up from this process's cgroup toward `/sys/fs/cgroup`, returning the
|
|
28
|
-
* deepest ancestor whose children genuinely get a real `memory.max` — the actual
|
|
29
|
-
* delegation boundary. `null` if cgroups v2 isn't mounted, own path can't be
|
|
30
|
-
* determined, or no ancestor passes the probe.
|
|
31
|
-
*/
|
|
32
|
-
export declare function findDelegatedCgroupAncestor(): string | null;
|
|
33
|
-
export declare function cgroupV2Capability(): CapabilityStatus;
|
|
34
|
-
export interface CgroupResourceLimits {
|
|
35
|
-
/**
|
|
36
|
-
* Maps to cgroups v2 `memory.max`, in bytes. Also writes `memory.swap.max=0` for
|
|
37
|
-
* the same cgroup — measured: with swap available, `memory.max` alone doesn't
|
|
38
|
-
* kill anything, it just pushes pages to swap under pressure. Disabling swap is
|
|
39
|
-
* what makes it a hard, OOM-killer-enforced limit rather than a soft one. Not
|
|
40
|
-
* independently toggleable — "cap it but let it swap" would be a separate field.
|
|
41
|
-
*/
|
|
42
|
-
readonly memoryMaxBytes?: number;
|
|
43
|
-
/** Maps to cgroups v2 `pids.max` -- caps tasks (processes/threads) this cgroup may hold. */
|
|
44
|
-
readonly maxProcesses?: number;
|
|
45
|
-
/**
|
|
46
|
-
* Raw cgroups v2 `cpu.max` value (`"$MAX $PERIOD"`, e.g. `"50000 100000"` for
|
|
47
|
-
* 50% of one CPU). Throws rather than silently dropping if the delegated
|
|
48
|
-
* ancestor has no writable `cpu.max` — measured on this repo's dev host: `cpu`
|
|
49
|
-
* was NOT delegated at the same level `memory`/`pids` were.
|
|
50
|
-
*/
|
|
51
|
-
readonly cpuMax?: string;
|
|
52
|
-
}
|
|
53
|
-
export interface CgroupMoveResult {
|
|
54
|
-
readonly applied: true;
|
|
55
|
-
readonly cgroupPath: string;
|
|
56
|
-
/** Always the literal `CGROUP_PARTIAL_RESTRICTION_SCOPE` string. */
|
|
57
|
-
readonly scope: typeof CGROUP_PARTIAL_RESTRICTION_SCOPE;
|
|
58
|
-
readonly appliedLimits: CgroupResourceLimits;
|
|
59
|
-
/**
|
|
60
|
-
* Best-effort removal of the cgroup this call created. Succeeds only once
|
|
61
|
-
* `cgroup.procs` is empty (pid exited or moved elsewhere) -- cgroups v2 refuses
|
|
62
|
-
* to remove a non-empty cgroup. Returns whether removal happened; never throws.
|
|
63
|
-
*/
|
|
64
|
-
readonly release: () => boolean;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Moves `options.pid` (a process this runtime did not spawn) into a newly created,
|
|
68
|
-
* resource-limited cgroup. Throws if the target isn't alive, `cgroupV2Capability()`
|
|
69
|
-
* is unavailable, or a declared limit's controller file doesn't exist.
|
|
70
|
-
*
|
|
71
|
-
* Limits are written before the pid is moved in, so a process is never observed
|
|
72
|
-
* with a half-applied limit set; on any write failure the still-empty cgroup is
|
|
73
|
-
* removed and the error rethrown, never left orphaned.
|
|
74
|
-
*/
|
|
75
|
-
export declare function moveProcessIntoRestrictedCgroup(options: {
|
|
76
|
-
readonly pid: number;
|
|
77
|
-
readonly limits: CgroupResourceLimits;
|
|
78
|
-
readonly nameHint?: string;
|
|
79
|
-
}): CgroupMoveResult;
|
|
80
|
-
//# sourceMappingURL=cgroup-partial-restriction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cgroup-partial-restriction.d.ts","sourceRoot":"","sources":["../src/cgroup-partial-restriction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,iIAAiI;AACjI,eAAO,MAAM,gCAAgC,EAAG,qEAA8E,CAAC;AA2C/H;;;;;GAKG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,GAAG,IAAI,CAc3D;AAED,wBAAgB,kBAAkB,IAAI,gBAAgB,CAkBrD;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,4FAA4F;IAC5F,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,OAAO,gCAAgC,CAAC;IACxD,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACvD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,gBAAgB,CAsEnB"}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Partial going-forward resource restriction for an already-running, attached-to
|
|
3
|
-
* process, via cgroups v2 — narrower alternative to `respawn-and-supervise.ts`.
|
|
4
|
-
*
|
|
5
|
-
* Moving a live pid into a delegated cgroup applies real kernel-enforced limits
|
|
6
|
-
* (`memory.max`, `cpu.max`, `pids.max`) without killing/restarting it. **It does
|
|
7
|
-
* NOT and cannot give filesystem or network isolation** — that needs `setns()`
|
|
8
|
-
* against a live pid, out of scope here. `CGROUP_PARTIAL_RESTRICTION_SCOPE` is the
|
|
9
|
-
* literal string every result carries so nothing downstream rounds this up to
|
|
10
|
-
* "sandboxed"/"isolated" (which would misrepresent it as `sandbox.ts`'s real
|
|
11
|
-
* spawn-time bwrap isolation).
|
|
12
|
-
*
|
|
13
|
-
* Finding the delegated ancestor: a non-root user can only write under
|
|
14
|
-
* `/sys/fs/cgroup` where a systemd user session delegates it (`Delegate=yes`).
|
|
15
|
-
* Delegation isn't uniform all the way down — a leaf cgroup already holding a
|
|
16
|
-
* process (e.g. this Node process's own scope) generally can't extend
|
|
17
|
-
* `subtree_control` further; writing fails `EBUSY` (measured on this repo's dev
|
|
18
|
-
* host). So `findDelegatedCgroupAncestor` doesn't trust subtree_control text or
|
|
19
|
-
* permission bits — it walks up from `/proc/self/cgroup` and, at each ancestor,
|
|
20
|
-
* creates a real temporary probe child and checks whether the kernel actually gave
|
|
21
|
-
* it a `memory.max` file.
|
|
22
|
-
*/
|
|
23
|
-
import { existsSync, mkdirSync, readFileSync, rmdirSync, writeFileSync } from "node:fs";
|
|
24
|
-
import { dirname, join } from "node:path";
|
|
25
|
-
import { isProcessAlive } from "./attach-to-running-process.js";
|
|
26
|
-
const CGROUP_ROOT = "/sys/fs/cgroup";
|
|
27
|
-
/** Literal scope string every `CgroupMoveResult` carries under `scope` — never restated by hand, so quotes of it can't drift. */
|
|
28
|
-
export const CGROUP_PARTIAL_RESTRICTION_SCOPE = "partial -- resource limits only, no filesystem or network isolation";
|
|
29
|
-
function ownUnifiedCgroupPath() {
|
|
30
|
-
let content;
|
|
31
|
-
try {
|
|
32
|
-
content = readFileSync("/proc/self/cgroup", "utf8");
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
for (const line of content.trim().split("\n")) {
|
|
38
|
-
// unified-hierarchy lines read "0::<path>"; only the "0::" line matters here
|
|
39
|
-
const firstColon = line.indexOf(":");
|
|
40
|
-
const secondColon = line.indexOf(":", firstColon + 1);
|
|
41
|
-
if (firstColon === -1 || secondColon === -1)
|
|
42
|
-
continue;
|
|
43
|
-
if (line.slice(0, firstColon) === "0" && firstColon + 1 === secondColon) {
|
|
44
|
-
return line.slice(secondColon + 1);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Real empirical probe, not a permission-bit read — a directory can be
|
|
51
|
-
* `mkdir`-able yet its child still lack `memory.max` if the controller was never
|
|
52
|
-
* enabled in `subtree_control` (this process's own leaf scope is exactly this
|
|
53
|
-
* shape, measured directly).
|
|
54
|
-
*/
|
|
55
|
-
function probeControllableChild(candidateDir) {
|
|
56
|
-
const probe = join(candidateDir, `.descry-cgroup-probe-${String(process.pid)}-${String(Date.now())}-${String(Math.random()).slice(2, 8)}`);
|
|
57
|
-
try {
|
|
58
|
-
mkdirSync(probe);
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
const controllable = existsSync(join(probe, "memory.max"));
|
|
64
|
-
try {
|
|
65
|
-
rmdirSync(probe);
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// best-effort cleanup; not our problem if something raced to touch it first
|
|
69
|
-
}
|
|
70
|
-
return controllable;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Walks up from this process's cgroup toward `/sys/fs/cgroup`, returning the
|
|
74
|
-
* deepest ancestor whose children genuinely get a real `memory.max` — the actual
|
|
75
|
-
* delegation boundary. `null` if cgroups v2 isn't mounted, own path can't be
|
|
76
|
-
* determined, or no ancestor passes the probe.
|
|
77
|
-
*/
|
|
78
|
-
export function findDelegatedCgroupAncestor() {
|
|
79
|
-
if (process.platform !== "linux")
|
|
80
|
-
return null;
|
|
81
|
-
if (!existsSync(join(CGROUP_ROOT, "cgroup.controllers")))
|
|
82
|
-
return null;
|
|
83
|
-
const ownPath = ownUnifiedCgroupPath();
|
|
84
|
-
if (ownPath === null)
|
|
85
|
-
return null;
|
|
86
|
-
let dir = join(CGROUP_ROOT, ownPath.replace(/^\/+/, ""));
|
|
87
|
-
// never test CGROUP_ROOT itself: root-wide limits are root-only anyway
|
|
88
|
-
while (dir !== CGROUP_ROOT && dirname(dir) !== dir) {
|
|
89
|
-
if (existsSync(dir) && probeControllableChild(dir))
|
|
90
|
-
return dir;
|
|
91
|
-
dir = dirname(dir);
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
export function cgroupV2Capability() {
|
|
96
|
-
if (process.platform !== "linux") {
|
|
97
|
-
return { availability: "unavailable", reason: `cgroups v2 resource-limit move is Linux-only; not available on "${process.platform}"` };
|
|
98
|
-
}
|
|
99
|
-
if (!existsSync(join(CGROUP_ROOT, "cgroup.controllers"))) {
|
|
100
|
-
return { availability: "unavailable", reason: `${CGROUP_ROOT} has no cgroup.controllers file -- this host is not using the cgroups v2 unified hierarchy` };
|
|
101
|
-
}
|
|
102
|
-
const ancestor = findDelegatedCgroupAncestor();
|
|
103
|
-
if (ancestor === null) {
|
|
104
|
-
return {
|
|
105
|
-
availability: "unavailable",
|
|
106
|
-
reason: "cgroups v2 is mounted, but no writable, controller-delegated cgroup ancestor was found for this process -- commonly means this " +
|
|
107
|
-
"process is not running under a systemd user session with delegation (Delegate=yes on user@<uid>.service), or is running as a " +
|
|
108
|
-
"user with no cgroup delegation anywhere in its own ancestry. Refusing rather than silently doing nothing.",
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return { availability: "available", reason: null };
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Moves `options.pid` (a process this runtime did not spawn) into a newly created,
|
|
115
|
-
* resource-limited cgroup. Throws if the target isn't alive, `cgroupV2Capability()`
|
|
116
|
-
* is unavailable, or a declared limit's controller file doesn't exist.
|
|
117
|
-
*
|
|
118
|
-
* Limits are written before the pid is moved in, so a process is never observed
|
|
119
|
-
* with a half-applied limit set; on any write failure the still-empty cgroup is
|
|
120
|
-
* removed and the error rethrown, never left orphaned.
|
|
121
|
-
*/
|
|
122
|
-
export function moveProcessIntoRestrictedCgroup(options) {
|
|
123
|
-
if (!isProcessAlive(options.pid)) {
|
|
124
|
-
throw new Error(`moveProcessIntoRestrictedCgroup: pid ${String(options.pid)} is not running -- cannot move a target that does not exist.`);
|
|
125
|
-
}
|
|
126
|
-
const capability = cgroupV2Capability();
|
|
127
|
-
if (capability.availability !== "available") {
|
|
128
|
-
throw new Error(`moveProcessIntoRestrictedCgroup: cannot apply -- ${capability.reason}`);
|
|
129
|
-
}
|
|
130
|
-
const ancestor = findDelegatedCgroupAncestor();
|
|
131
|
-
if (ancestor === null) {
|
|
132
|
-
// unreachable given availability check above; narrows the type honestly
|
|
133
|
-
throw new Error("moveProcessIntoRestrictedCgroup: no delegated cgroup ancestor found despite capability reporting available -- internal inconsistency.");
|
|
134
|
-
}
|
|
135
|
-
const cgroupPath = join(ancestor, `descry-restrict-${options.nameHint ?? String(options.pid)}-${String(Date.now())}`);
|
|
136
|
-
mkdirSync(cgroupPath);
|
|
137
|
-
try {
|
|
138
|
-
if (options.limits.cpuMax !== undefined && !existsSync(join(cgroupPath, "cpu.max"))) {
|
|
139
|
-
throw new Error(`cpuMax was requested but the delegated cgroup ancestor (${ancestor}) does not expose a writable cpu.max to its children on this host -- ` +
|
|
140
|
-
"refusing rather than silently ignoring the limit.");
|
|
141
|
-
}
|
|
142
|
-
if (options.limits.memoryMaxBytes !== undefined) {
|
|
143
|
-
writeFileSync(join(cgroupPath, "memory.max"), String(options.limits.memoryMaxBytes));
|
|
144
|
-
// see memoryMaxBytes doc: without this, swap makes memory.max a soft limit.
|
|
145
|
-
// best-effort -- no memory.swap.max file (swap accounting disabled/not
|
|
146
|
-
// delegated) still gets a real memory.max, just without this hardening
|
|
147
|
-
try {
|
|
148
|
-
writeFileSync(join(cgroupPath, "memory.swap.max"), "0");
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
// disclosed above, not pretended to have succeeded
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (options.limits.maxProcesses !== undefined) {
|
|
155
|
-
writeFileSync(join(cgroupPath, "pids.max"), String(options.limits.maxProcesses));
|
|
156
|
-
}
|
|
157
|
-
if (options.limits.cpuMax !== undefined) {
|
|
158
|
-
writeFileSync(join(cgroupPath, "cpu.max"), options.limits.cpuMax);
|
|
159
|
-
}
|
|
160
|
-
// moved last, only once every requested limit is confirmed written
|
|
161
|
-
writeFileSync(join(cgroupPath, "cgroup.procs"), String(options.pid));
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
try {
|
|
165
|
-
rmdirSync(cgroupPath);
|
|
166
|
-
}
|
|
167
|
-
catch {
|
|
168
|
-
// best-effort: if the pid was already moved in, the dir is non-empty
|
|
169
|
-
// and can't be removed
|
|
170
|
-
}
|
|
171
|
-
throw new Error(`moveProcessIntoRestrictedCgroup: failed to apply limits or move pid ${String(options.pid)} into ${cgroupPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
172
|
-
}
|
|
173
|
-
return {
|
|
174
|
-
applied: true,
|
|
175
|
-
cgroupPath,
|
|
176
|
-
scope: CGROUP_PARTIAL_RESTRICTION_SCOPE,
|
|
177
|
-
appliedLimits: options.limits,
|
|
178
|
-
release: () => {
|
|
179
|
-
try {
|
|
180
|
-
rmdirSync(cgroupPath);
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
//# sourceMappingURL=cgroup-partial-restriction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cgroup-partial-restriction.js","sourceRoot":"","sources":["../src/cgroup-partial-restriction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC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,CAAC,GAAG,CAAC,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC;YACH,SAAS,CAAC,UAAU,CAAC,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,qEAAqE;YACrE,uBAAuB;QACzB,CAAC;QACD,MAAM,IAAI,KAAK,CACb,uEAAuE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,UAAU,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC3K,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,UAAU;QACV,KAAK,EAAE,gCAAgC;QACvC,aAAa,EAAE,OAAO,CAAC,MAAM;QAC7B,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,CAAC;gBACH,SAAS,CAAC,UAAU,CAAC,CAAC;gBACtB,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `Evidence.collectorVersion` for orchestrator-emitted evidence (e.g. `COLLECTOR_ERROR`
|
|
3
|
-
* before any collector ran). Reads `package.json` directly so it can't drift from
|
|
4
|
-
* what shipped, same approach as `nodeVersion`'s use of `process.version`.
|
|
5
|
-
*/
|
|
6
|
-
export declare const COLLECTOR_VERSION: string;
|
|
7
|
-
//# sourceMappingURL=collector-version.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector-version.d.ts","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,iBAAiB,EAAE,MAA6E,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `Evidence.collectorVersion` for orchestrator-emitted evidence (e.g. `COLLECTOR_ERROR`
|
|
3
|
-
* before any collector ran). Reads `package.json` directly so it can't drift from
|
|
4
|
-
* what shipped, same approach as `nodeVersion`'s use of `process.version`.
|
|
5
|
-
*/
|
|
6
|
-
import { createRequire } from "node:module";
|
|
7
|
-
const require = createRequire(import.meta.url);
|
|
8
|
-
export const COLLECTOR_VERSION = require("../package.json").version;
|
|
9
|
-
//# sourceMappingURL=collector-version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector-version.js","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAY,OAAO,CAAC,iBAAiB,CAAkC,CAAC,OAAO,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type { PollingProcessOutputSourceOptions } from "./polling-output-source.ts";
|
|
2
|
-
export { createPollingProcessOutputSource } from "./polling-output-source.ts";
|
|
3
|
-
export type { AttachToRunningProcessOptions, AttachedProcessOutputSource } from "./attach-to-running-process.ts";
|
|
4
|
-
export { attachToRunningProcess, isProcessAlive } from "./attach-to-running-process.ts";
|
|
5
|
-
export type { AttachToRunningNodeProcessOptions } from "./attach-to-running-node-process.ts";
|
|
6
|
-
export { attachToRunningNodeProcess, discoverNodeInspectorUrl } from "./attach-to-running-node-process.ts";
|
|
7
|
-
export type { CdpSession } from "./cdp-client.ts";
|
|
8
|
-
export { connectCdp } from "./cdp-client.ts";
|
|
9
|
-
export type { AttachToRunningJvmProcessOptions } from "./attach-to-running-jvm-process.ts";
|
|
10
|
-
export { attachToRunningJvmProcess } from "./attach-to-running-jvm-process.ts";
|
|
11
|
-
export type { RespawnCommand, RespawnCommandSource, RespawnAndSuperviseOptions, RespawnAndSuperviseResult, } from "./respawn-and-supervise.ts";
|
|
12
|
-
export { respawnAndSupervise, inferRespawnCommandFromProc } from "./respawn-and-supervise.ts";
|
|
13
|
-
export type { CgroupResourceLimits, CgroupMoveResult, } from "./cgroup-partial-restriction.ts";
|
|
14
|
-
export { CGROUP_PARTIAL_RESTRICTION_SCOPE, cgroupV2Capability, findDelegatedCgroupAncestor, moveProcessIntoRestrictedCgroup, } from "./cgroup-partial-restriction.ts";
|
|
15
|
-
export type { InstrumentedExecutionInput, InstrumentedExecutionResult, ExecutionBudgetOutcome } from "./instrumented-execution.ts";
|
|
16
|
-
export { runInstrumentedExecution, createSourceRootResolver, applyOutboundLaunch } from "./instrumented-execution.ts";
|
|
17
|
-
export type { BackendObservationMechanism, RunRemoteLogObservationInput, RunRemoteLogObservationResult, } from "./profile-backend-observation.ts";
|
|
18
|
-
export { backendObservationMechanismFor, runRemoteLogObservation } from "./profile-backend-observation.ts";
|
|
19
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAC9E,YAAY,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AACjH,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACxF,YAAY,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC3G,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC9F,YAAY,EACV,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gCAAgC,EAChC,kBAAkB,EAClB,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACnI,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACtH,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { createPollingProcessOutputSource } from "./polling-output-source.js";
|
|
2
|
-
export { attachToRunningProcess, isProcessAlive } from "./attach-to-running-process.js";
|
|
3
|
-
export { attachToRunningNodeProcess, discoverNodeInspectorUrl } from "./attach-to-running-node-process.js";
|
|
4
|
-
export { connectCdp } from "./cdp-client.js";
|
|
5
|
-
export { attachToRunningJvmProcess } from "./attach-to-running-jvm-process.js";
|
|
6
|
-
export { respawnAndSupervise, inferRespawnCommandFromProc } from "./respawn-and-supervise.js";
|
|
7
|
-
export { CGROUP_PARTIAL_RESTRICTION_SCOPE, cgroupV2Capability, findDelegatedCgroupAncestor, moveProcessIntoRestrictedCgroup, } from "./cgroup-partial-restriction.js";
|
|
8
|
-
export { runInstrumentedExecution, createSourceRootResolver, applyOutboundLaunch } from "./instrumented-execution.js";
|
|
9
|
-
export { backendObservationMechanismFor, runRemoteLogObservation } from "./profile-backend-observation.js";
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAExF,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE3G,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAO/E,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAK9F,OAAO,EACL,gCAAgC,EAChC,kBAAkB,EAClB,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAMtH,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The assembly wiring the runtime's pieces together in production code (previously
|
|
3
|
-
* only connected ad hoc by tests). Runs an `ExecutionController` over a `services`
|
|
4
|
-
* configuration; wraps each spawned process in a live `ProcessOutputSource`
|
|
5
|
-
* (polls the buffer, yields each line once); builds a `CollectorContext` with a
|
|
6
|
-
* real `resolveSourceRoot` closed over the execution's own processes; starts,
|
|
7
|
-
* drains and stops the adapter's collectors; writes every emitted item through
|
|
8
|
-
* `EvidenceStore` so redaction runs (plan §28).
|
|
9
|
-
*
|
|
10
|
-
* Deliberately does not decide whether a finding exists, correlate to graph
|
|
11
|
-
* nodes, or drive a browser — separate stages, separate contracts.
|
|
12
|
-
*/
|
|
13
|
-
import type { Evidence, Execution, ExecutionConfiguration, ProcessHandle, ServiceRootLookup } from "@descryy/runtime-contracts";
|
|
14
|
-
import type { RuntimeAdapter, OutboundHttpLaunch } from "@descryy/runtime-backend-observation";
|
|
15
|
-
import { type CreateExecutionInput, type RunOptions } from "@descryy/runtime-controller";
|
|
16
|
-
import { EvidenceStore } from "@descryy/runtime-evidence-store";
|
|
17
|
-
export interface InstrumentedExecutionInput {
|
|
18
|
-
/** Carries the `ExecutionConfiguration` itself — the controller's own input shape, not a parallel copy that could drift from it. */
|
|
19
|
-
readonly execution: CreateExecutionInput;
|
|
20
|
-
readonly runOptions: RunOptions;
|
|
21
|
-
/** Supplies the collectors. One adapter per execution: a run observes one backend runtime. */
|
|
22
|
-
readonly adapter: RuntimeAdapter;
|
|
23
|
-
/** Where evidence is written. Provided rather than constructed so a caller owns the database's lifetime and its redaction policy. */
|
|
24
|
-
readonly store: EvidenceStore;
|
|
25
|
-
/**
|
|
26
|
-
* How long to keep draining collector output after the services are up.
|
|
27
|
-
* There is no "the application is done" signal at this layer — a server
|
|
28
|
-
* runs until stopped — so the caller states how long the observation
|
|
29
|
-
* window is rather than this module guessing.
|
|
30
|
-
*/
|
|
31
|
-
readonly observeForMs: number;
|
|
32
|
-
/**
|
|
33
|
-
* Opt-in, per service name: front that service with `InboundProxy` (RT-192,
|
|
34
|
-
* DEC-271) once its own readiness has already succeeded — reads the answer
|
|
35
|
-
* `controller.run()` already produced (`serviceStartResults`), never re-asks.
|
|
36
|
-
* Absent or unnamed service: unchanged behaviour, no proxy.
|
|
37
|
-
*
|
|
38
|
-
* Does not close any per-language "HTTP observation" checklist row — those use
|
|
39
|
-
* self-initiated fixtures with no separate public port for a proxy to front.
|
|
40
|
-
* This only makes `InboundProxy` available for a future externally-driven
|
|
41
|
-
* scenario.
|
|
42
|
-
*/
|
|
43
|
-
readonly frontWithInboundProxy?: Readonly<Record<string, boolean>>;
|
|
44
|
-
/**
|
|
45
|
-
* Fires once every collector (including any fronting proxy) has started, before
|
|
46
|
-
* the observation window's sleep. Lets a caller drive real traffic through a
|
|
47
|
-
* just-started proxy while it's still alive — `InstrumentedExecutionResult` is
|
|
48
|
-
* only returned after the run has stopped everything, too late for that. A
|
|
49
|
-
* throwing callback is not caught here.
|
|
50
|
-
*/
|
|
51
|
-
readonly onReady?: (info: {
|
|
52
|
-
readonly execution: Execution;
|
|
53
|
-
/** Service name → the proxy's own bound port, for every service that was both flagged AND successfully fronted. */
|
|
54
|
-
readonly proxyPorts: Readonly<Record<string, number>>;
|
|
55
|
-
}) => void | Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
export interface InstrumentedExecutionResult {
|
|
58
|
-
readonly execution: Execution;
|
|
59
|
-
readonly evidence: readonly Evidence[];
|
|
60
|
-
/** Every collector's own report of what it could do, after the run — not what it claimed at construction. */
|
|
61
|
-
readonly collectorCapabilities: readonly {
|
|
62
|
-
readonly collectorId: string;
|
|
63
|
-
readonly capabilities: ReturnType<import("@descryy/runtime-contracts").Collector["capabilities"]>;
|
|
64
|
-
}[];
|
|
65
|
-
/** Set when `run()` refused before spawning anything. Evidence is empty and that is a refusal, not an absence of failures. */
|
|
66
|
-
readonly validationError: string | null;
|
|
67
|
-
/**
|
|
68
|
-
* What the declared whole-execution budget actually did to this run.
|
|
69
|
-
*
|
|
70
|
-
* `timeoutMs` used to bound only the service, not the observation window: a
|
|
71
|
-
* 1500ms budget with a 12000ms window measurably returned after 12288ms with
|
|
72
|
-
* zero evidence, since services had been dead for the last 10.8s. Reported as a
|
|
73
|
-
* struct so a caller can tell a full window that found nothing from one cut
|
|
74
|
-
* short before it could.
|
|
75
|
-
*/
|
|
76
|
-
readonly budget: ExecutionBudgetOutcome;
|
|
77
|
-
/**
|
|
78
|
-
* Service name → the combined stdout+stderr that service produced.
|
|
79
|
-
*
|
|
80
|
-
* The controller has always captured this and exposed it
|
|
81
|
-
* (`ExecutionController.readProcessOutput`); it was used only for readiness
|
|
82
|
-
* polling and never left this function, so a caller got
|
|
83
|
-
* `processes[].exitCode` and nothing about *why*. An exit code alone can
|
|
84
|
-
* actively mislead — `prlimit`, which wraps every sandboxed spawn, exits 126
|
|
85
|
-
* for "found but not executable" and writes the reason to stderr, and 126 has
|
|
86
|
-
* already been misread once as a nested-sandbox failure (bwrap exits 1 for
|
|
87
|
-
* every namespace failure, so it never means that).
|
|
88
|
-
*
|
|
89
|
-
* **A missing key and an empty string are different claims.** Present-and-
|
|
90
|
-
* empty is "this ran and said nothing"; absent is "no process was attributed
|
|
91
|
-
* to this service at all". Collapsing them loses the distinction for good.
|
|
92
|
-
*
|
|
93
|
-
* **RT-261 update — no longer whole.** Backed by `ManagedProcess.readOutput()`,
|
|
94
|
-
* which now holds head+tail per service (`OUTPUT_HEAD_BYTES`/`OUTPUT_TAIL_BYTES`
|
|
95
|
-
* in `@descryy/runtime-controller`'s `process-manager.ts`), not the full
|
|
96
|
-
* accumulated buffer -- a chatty service no longer grows Descry's own memory
|
|
97
|
-
* without bound. When a service's real output exceeded that bound, the
|
|
98
|
-
* string itself carries one inline marker naming how many bytes were
|
|
99
|
-
* dropped and the real total, so the cut is visible in the text a reader
|
|
100
|
-
* already has, not only in a structured field alongside it.
|
|
101
|
-
*/
|
|
102
|
-
readonly serviceOutput: Readonly<Record<string, string>>;
|
|
103
|
-
}
|
|
104
|
-
/** See `InstrumentedExecutionResult.budget`. */
|
|
105
|
-
export interface ExecutionBudgetOutcome {
|
|
106
|
-
/** `ExecutionConfiguration.timeoutMs`, verbatim. */
|
|
107
|
-
readonly declaredMs: number;
|
|
108
|
-
/** Wall-clock time this function actually took. */
|
|
109
|
-
readonly elapsedMs: number;
|
|
110
|
-
/** What `observeForMs` asked for. */
|
|
111
|
-
readonly requestedObservationMs: number;
|
|
112
|
-
/** What the budget left for it. Less than `requestedObservationMs` means the window was cut short. */
|
|
113
|
-
readonly observedForMs: number;
|
|
114
|
-
/** True when the run finished past its own deadline — teardown of real processes can overshoot even a bounded window. */
|
|
115
|
-
readonly exceeded: boolean;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Builds the origin → source-root lookup a collector reads through
|
|
119
|
-
* `CollectorContext.resolveSourceRoot`. Closes over the execution's own
|
|
120
|
-
* processes, which is what makes the port→service join possible at all — under
|
|
121
|
-
* ephemeral ports only the running process knows its own port.
|
|
122
|
-
*/
|
|
123
|
-
export declare function createSourceRootResolver(processes: readonly ProcessHandle[], configuration: ExecutionConfiguration): (origin: string) => ServiceRootLookup;
|
|
124
|
-
/**
|
|
125
|
-
* Rewrites every spawnable service so it launches with outbound
|
|
126
|
-
* instrumentation in place.
|
|
127
|
-
*
|
|
128
|
-
* The declaration comes from the adapter and names no language; this function
|
|
129
|
-
* applies it and also names none. `attach`-mode services are skipped: their
|
|
130
|
-
* process is already running, so there is no launch left to influence, and
|
|
131
|
-
* pretending otherwise would claim instrumentation that is not there.
|
|
132
|
-
*/
|
|
133
|
-
export declare function applyOutboundLaunch(execution: CreateExecutionInput, launch: OutboundHttpLaunch): CreateExecutionInput;
|
|
134
|
-
export declare function runInstrumentedExecution(input: InstrumentedExecutionInput): Promise<InstrumentedExecutionResult>;
|
|
135
|
-
//# sourceMappingURL=instrumented-execution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instrumented-execution.d.ts","sourceRoot":"","sources":["../src/instrumented-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAEV,QAAQ,EACR,SAAS,EACT,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAuB,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAGpH,OAAO,EAEL,K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