@descryy/runtime-orchestrator 0.4.9 → 0.4.10

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 (49) hide show
  1. package/dist/attach-to-running-jvm-process.d.ts +86 -0
  2. package/dist/attach-to-running-jvm-process.d.ts.map +1 -0
  3. package/dist/attach-to-running-jvm-process.js +408 -0
  4. package/dist/attach-to-running-jvm-process.js.map +1 -0
  5. package/dist/attach-to-running-node-process.d.ts +80 -0
  6. package/dist/attach-to-running-node-process.d.ts.map +1 -0
  7. package/dist/attach-to-running-node-process.js +290 -0
  8. package/dist/attach-to-running-node-process.js.map +1 -0
  9. package/dist/attach-to-running-process.d.ts +83 -0
  10. package/dist/attach-to-running-process.d.ts.map +1 -0
  11. package/dist/attach-to-running-process.js +86 -0
  12. package/dist/attach-to-running-process.js.map +1 -0
  13. package/dist/cdp-client.d.ts +27 -0
  14. package/dist/cdp-client.d.ts.map +1 -0
  15. package/dist/cdp-client.js +98 -0
  16. package/dist/cdp-client.js.map +1 -0
  17. package/dist/cgroup-partial-restriction.d.ts +80 -0
  18. package/dist/cgroup-partial-restriction.d.ts.map +1 -0
  19. package/dist/cgroup-partial-restriction.js +189 -0
  20. package/dist/cgroup-partial-restriction.js.map +1 -0
  21. package/dist/collector-version.d.ts +7 -0
  22. package/dist/collector-version.d.ts.map +1 -0
  23. package/dist/collector-version.js +9 -0
  24. package/dist/collector-version.js.map +1 -0
  25. package/dist/index.d.ts +19 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +10 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/instrumented-execution.d.ts +136 -0
  30. package/dist/instrumented-execution.d.ts.map +1 -0
  31. package/dist/instrumented-execution.js +696 -0
  32. package/dist/instrumented-execution.js.map +1 -0
  33. package/dist/jvm-agent/build.d.ts +48 -0
  34. package/dist/jvm-agent/build.d.ts.map +1 -0
  35. package/dist/jvm-agent/build.js +129 -0
  36. package/dist/jvm-agent/build.js.map +1 -0
  37. package/dist/polling-output-source.d.ts +43 -0
  38. package/dist/polling-output-source.d.ts.map +1 -0
  39. package/dist/polling-output-source.js +64 -0
  40. package/dist/polling-output-source.js.map +1 -0
  41. package/dist/profile-backend-observation.d.ts +67 -0
  42. package/dist/profile-backend-observation.d.ts.map +1 -0
  43. package/dist/profile-backend-observation.js +107 -0
  44. package/dist/profile-backend-observation.js.map +1 -0
  45. package/dist/respawn-and-supervise.d.ts +86 -0
  46. package/dist/respawn-and-supervise.d.ts.map +1 -0
  47. package/dist/respawn-and-supervise.js +171 -0
  48. package/dist/respawn-and-supervise.js.map +1 -0
  49. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumented-execution.js","sourceRoot":"","sources":["../src/instrumented-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAUtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EACL,mBAAmB,EAGnB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAuG3D;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,UAA+B;IAC3D,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,MAAM,IAAI,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QACpD,IAAI,MAAM,CAAC,WAAW,KAA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,IAAI;oBAChB,UAAU,EAAE,CAAC;oBACb,gBAAgB,EAAE,iBAAiB;iBACpC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,+EAA+E;IAC/E,IAAI,WAAW,KAAK,IAAI;QAAE,MAAM,WAAW,CAAC,KAAK,CAAC;IAClD,IAAI,eAAe,KAAK,IAAI;QAAE,MAAM,eAAe,CAAC,KAAK,CAAC;IAE1D,OAAO;QACL,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,QAAQ,EAAE,OAAO;QACjB,qBAAqB,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,WAAW,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACtI,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC;QACpC,aAAa,EAAE,oBAAoB,CAAC,UAAU,CAAC;KAChD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Compiles `Agent.java` into `agent.jar` and `Attacher.java` into `Attacher.class`,
3
+ * once, only when source is newer than build output (same mtime-cache rule
4
+ * `kotlin-server/build.ts` uses). This is shipped product code —
5
+ * `attach-to-running-jvm-process.ts` runs the compiled artifacts, never compiles
6
+ * them at call time.
7
+ *
8
+ * **`tools.jar` is JDK-8-only.** `com.sun.tools.attach.VirtualMachine` shipped in
9
+ * `tools.jar` through JDK 8; from JDK 9 it's in the `jdk.attach` module, no extra
10
+ * jar needed. `findToolsJarIfPresent` returns `null` when absent (JDK 9+ or no
11
+ * `tools.jar`) and `Attacher.java` compiles/runs with no extra classpath entry —
12
+ * correct for JDK 9+, but only exercised against JDK 8 on this machine (disclosed
13
+ * gap, see this module's decisions-inbox entry).
14
+ *
15
+ * **ByteBuddy is vendored** (same pattern as `junit-platform-console-standalone`
16
+ * for the JUnit reporter): one pinned version, fetched once from Maven Central,
17
+ * checksum-verified, never a build tool. `Agent.java` needs real bytecode
18
+ * manipulation for `DispatcherServlet` method-entry advice (RT-201) — hand-written
19
+ * ASM isn't realistic, and Maven/Gradle would mean resolving a dependency tree for
20
+ * one library. The plain `net.bytebuddy:byte-buddy` artifact (not `byte-buddy-dep`)
21
+ * is used because it repackages its own ASM under `net.bytebuddy.jar.asm.*`
22
+ * (verified via `unzip -l`) — one self-contained jar. **A version bump changes the
23
+ * URL AND the digest, in one reviewable diff** (plus `MANIFEST.MF`'s `Class-Path`
24
+ * line, which is static and version-pinned, not generated). `byte-buddy-*.jar`
25
+ * sits beside `agent.jar` because the JDK resolves an agent JAR's `Class-Path`
26
+ * relative to the agent JAR's own location.
27
+ *
28
+ * **`Agent.java`/`Attacher.java`/`MANIFEST.MF` live in `packages/orchestrator/jvm-agent/`,
29
+ * a sibling of `src/`/`dist/`, NOT inside `src/jvm-agent/`.** Found the hard way:
30
+ * `tsc` only emits `.js`/`.d.ts`, so a `.java` file nested inside `src/jvm-agent/`
31
+ * has no `dist/` counterpart and `import.meta.url`-relative resolution would point
32
+ * at a source-only directory. A relative URL walking OUT of `src/`/`dist/` to a
33
+ * shared sibling resolves identically from either, since both sit at the same
34
+ * depth under `packages/orchestrator/`.
35
+ */
36
+ export declare const JVM_AGENT_DIR: string;
37
+ export declare const BYTEBUDDY_JAR: string;
38
+ /** Fetches the pinned ByteBuddy jar if absent or its checksum no longer matches — refuses a mismatch rather than proceeding, since this jar is both compiled against and loaded into a target JVM. */
39
+ export declare function ensureByteBuddyJar(): Promise<string>;
40
+ /** `$JAVA_HOME/lib/tools.jar` if it exists, else derived from `java`'s own reported `java.home`. `null` when neither yields a real file — the JDK 9+, no-`tools.jar` case. */
41
+ export declare function findToolsJarIfPresent(): string | null;
42
+ /** Compiles `Agent.java` and packages it as `agent.jar` with `Agent-Class` in its manifest. Returns the jar's path. */
43
+ export declare function buildJvmAgentJar(): Promise<string>;
44
+ /** Compiles `Attacher.java` to `Attacher.class` in this same directory. Returns the directory to put on the classpath (the class itself, not a jar — one file, no packaging step needed). */
45
+ export declare function buildAttacherClass(): string;
46
+ /** Ensures a directory exists (for the caller's tmp output file), mirroring the small helper every attach module in this package already needs once for its own scratch state. */
47
+ export declare function ensureDir(path: string): void;
48
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/jvm-agent/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAQH,eAAO,MAAM,aAAa,QAA6D,CAAC;AAMxF,eAAO,MAAM,aAAa,QAA6D,CAAC;AAMxF,sMAAsM;AACtM,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAe1D;AAMD,8KAA8K;AAC9K,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAYrD;AAED,uHAAuH;AACvH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAuBxD;AAED,6LAA6L;AAC7L,wBAAgB,kBAAkB,IAAI,MAAM,CAY3C;AAED,kLAAkL;AAClL,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Compiles `Agent.java` into `agent.jar` and `Attacher.java` into `Attacher.class`,
3
+ * once, only when source is newer than build output (same mtime-cache rule
4
+ * `kotlin-server/build.ts` uses). This is shipped product code —
5
+ * `attach-to-running-jvm-process.ts` runs the compiled artifacts, never compiles
6
+ * them at call time.
7
+ *
8
+ * **`tools.jar` is JDK-8-only.** `com.sun.tools.attach.VirtualMachine` shipped in
9
+ * `tools.jar` through JDK 8; from JDK 9 it's in the `jdk.attach` module, no extra
10
+ * jar needed. `findToolsJarIfPresent` returns `null` when absent (JDK 9+ or no
11
+ * `tools.jar`) and `Attacher.java` compiles/runs with no extra classpath entry —
12
+ * correct for JDK 9+, but only exercised against JDK 8 on this machine (disclosed
13
+ * gap, see this module's decisions-inbox entry).
14
+ *
15
+ * **ByteBuddy is vendored** (same pattern as `junit-platform-console-standalone`
16
+ * for the JUnit reporter): one pinned version, fetched once from Maven Central,
17
+ * checksum-verified, never a build tool. `Agent.java` needs real bytecode
18
+ * manipulation for `DispatcherServlet` method-entry advice (RT-201) — hand-written
19
+ * ASM isn't realistic, and Maven/Gradle would mean resolving a dependency tree for
20
+ * one library. The plain `net.bytebuddy:byte-buddy` artifact (not `byte-buddy-dep`)
21
+ * is used because it repackages its own ASM under `net.bytebuddy.jar.asm.*`
22
+ * (verified via `unzip -l`) — one self-contained jar. **A version bump changes the
23
+ * URL AND the digest, in one reviewable diff** (plus `MANIFEST.MF`'s `Class-Path`
24
+ * line, which is static and version-pinned, not generated). `byte-buddy-*.jar`
25
+ * sits beside `agent.jar` because the JDK resolves an agent JAR's `Class-Path`
26
+ * relative to the agent JAR's own location.
27
+ *
28
+ * **`Agent.java`/`Attacher.java`/`MANIFEST.MF` live in `packages/orchestrator/jvm-agent/`,
29
+ * a sibling of `src/`/`dist/`, NOT inside `src/jvm-agent/`.** Found the hard way:
30
+ * `tsc` only emits `.js`/`.d.ts`, so a `.java` file nested inside `src/jvm-agent/`
31
+ * has no `dist/` counterpart and `import.meta.url`-relative resolution would point
32
+ * at a source-only directory. A relative URL walking OUT of `src/`/`dist/` to a
33
+ * shared sibling resolves identically from either, since both sit at the same
34
+ * depth under `packages/orchestrator/`.
35
+ */
36
+ import { spawnSync } from "node:child_process";
37
+ import { createHash } from "node:crypto";
38
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
39
+ import { join } from "node:path";
40
+ import { fileURLToPath } from "node:url";
41
+ export const JVM_AGENT_DIR = fileURLToPath(new URL("../../jvm-agent", import.meta.url));
42
+ /** Pinned. A version bump changes the URL, the digest, and `MANIFEST.MF`'s `Class-Path` line, in one reviewable diff. */
43
+ const BYTEBUDDY_VERSION = "1.15.11";
44
+ const BYTEBUDDY_SHA256 = "fa08998aae1e7bdae83bde0712c50e8444d71c0e0c196bb2247ade8d4ad0eb90";
45
+ const BYTEBUDDY_URL = `https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy/${BYTEBUDDY_VERSION}/byte-buddy-${BYTEBUDDY_VERSION}.jar`;
46
+ export const BYTEBUDDY_JAR = join(JVM_AGENT_DIR, `byte-buddy-${BYTEBUDDY_VERSION}.jar`);
47
+ function digestOf(path) {
48
+ return createHash("sha256").update(readFileSync(path)).digest("hex");
49
+ }
50
+ /** Fetches the pinned ByteBuddy jar if absent or its checksum no longer matches — refuses a mismatch rather than proceeding, since this jar is both compiled against and loaded into a target JVM. */
51
+ export async function ensureByteBuddyJar() {
52
+ if (existsSync(BYTEBUDDY_JAR) && digestOf(BYTEBUDDY_JAR) === BYTEBUDDY_SHA256)
53
+ return BYTEBUDDY_JAR;
54
+ mkdirSync(JVM_AGENT_DIR, { recursive: true });
55
+ const response = await fetch(BYTEBUDDY_URL);
56
+ if (!response.ok) {
57
+ throw new Error(`jvm-agent build: could not fetch ${BYTEBUDDY_URL} — HTTP ${String(response.status)}`);
58
+ }
59
+ writeFileSync(BYTEBUDDY_JAR, Buffer.from(await response.arrayBuffer()));
60
+ const actual = digestOf(BYTEBUDDY_JAR);
61
+ if (actual !== BYTEBUDDY_SHA256) {
62
+ throw new Error(`jvm-agent build: checksum mismatch for ${BYTEBUDDY_JAR}\n expected ${BYTEBUDDY_SHA256}\n actual ${actual}`);
63
+ }
64
+ return BYTEBUDDY_JAR;
65
+ }
66
+ function newerThan(output, source) {
67
+ return existsSync(output) && statSync(output).mtimeMs >= statSync(source).mtimeMs;
68
+ }
69
+ /** `$JAVA_HOME/lib/tools.jar` if it exists, else derived from `java`'s own reported `java.home`. `null` when neither yields a real file — the JDK 9+, no-`tools.jar` case. */
70
+ export function findToolsJarIfPresent() {
71
+ const fromEnv = process.env["JAVA_HOME"];
72
+ if (fromEnv !== undefined) {
73
+ const candidate = join(fromEnv, "lib", "tools.jar");
74
+ if (existsSync(candidate))
75
+ return candidate;
76
+ }
77
+ const probe = spawnSync("java", ["-XshowSettings:properties", "-version"], { encoding: "utf8" });
78
+ const combined = `${probe.stdout ?? ""}${probe.stderr ?? ""}`;
79
+ const match = /java\.home\s*=\s*(.+)/.exec(combined);
80
+ if (match?.[1] === undefined)
81
+ return null;
82
+ const candidate = join(match[1].trim(), "lib", "tools.jar");
83
+ return existsSync(candidate) ? candidate : null;
84
+ }
85
+ /** Compiles `Agent.java` and packages it as `agent.jar` with `Agent-Class` in its manifest. Returns the jar's path. */
86
+ export async function buildJvmAgentJar() {
87
+ const source = join(JVM_AGENT_DIR, "Agent.java");
88
+ const jarPath = join(JVM_AGENT_DIR, "agent.jar");
89
+ const byteBuddyJar = await ensureByteBuddyJar();
90
+ // invalidates on either input changing -- a ByteBuddy version bump must rebuild
91
+ // too, since the compiled advice classes are compiled against it
92
+ if (newerThan(jarPath, source) && newerThan(jarPath, byteBuddyJar))
93
+ return jarPath;
94
+ const compiled = spawnSync("javac", ["-cp", byteBuddyJar, "-d", JVM_AGENT_DIR, source], { encoding: "utf8", timeout: 60_000 });
95
+ if (compiled.status !== 0) {
96
+ throw new Error(`javac failed to compile Agent.java. This is a toolchain failure, not a test failure:\n${compiled.stdout ?? ""}${compiled.stderr ?? ""}`);
97
+ }
98
+ // Agent.java declares nested static classes (ByteBuddy advice); javac emits one
99
+ // Agent$Name.class per nested class, and every one must be in the jar or the
100
+ // JVM throws NoClassDefFoundError when the advice class is needed.
101
+ const agentClassFiles = readdirSync(JVM_AGENT_DIR).filter((name) => name === "Agent.class" || name.startsWith("Agent$"));
102
+ const jarArgs = ["cfm", jarPath, join(JVM_AGENT_DIR, "MANIFEST.MF")];
103
+ for (const classFile of agentClassFiles)
104
+ jarArgs.push("-C", JVM_AGENT_DIR, classFile);
105
+ const jarred = spawnSync("jar", jarArgs, { encoding: "utf8", timeout: 30_000 });
106
+ if (jarred.status !== 0) {
107
+ throw new Error(`jar failed to package agent.jar:\n${jarred.stdout ?? ""}${jarred.stderr ?? ""}`);
108
+ }
109
+ return jarPath;
110
+ }
111
+ /** Compiles `Attacher.java` to `Attacher.class` in this same directory. Returns the directory to put on the classpath (the class itself, not a jar — one file, no packaging step needed). */
112
+ export function buildAttacherClass() {
113
+ const source = join(JVM_AGENT_DIR, "Attacher.java");
114
+ const classFile = join(JVM_AGENT_DIR, "Attacher.class");
115
+ if (newerThan(classFile, source))
116
+ return JVM_AGENT_DIR;
117
+ const toolsJar = findToolsJarIfPresent();
118
+ const args = toolsJar !== null ? ["-cp", toolsJar, "-d", JVM_AGENT_DIR, source] : ["-d", JVM_AGENT_DIR, source];
119
+ const compiled = spawnSync("javac", args, { encoding: "utf8", timeout: 60_000 });
120
+ if (compiled.status !== 0) {
121
+ throw new Error(`javac failed to compile Attacher.java. This is a toolchain failure, not a test failure:\n${compiled.stdout ?? ""}${compiled.stderr ?? ""}`);
122
+ }
123
+ return JVM_AGENT_DIR;
124
+ }
125
+ /** Ensures a directory exists (for the caller's tmp output file), mirroring the small helper every attach module in this package already needs once for its own scratch state. */
126
+ export function ensureDir(path) {
127
+ mkdirSync(path, { recursive: true });
128
+ }
129
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/jvm-agent/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,aAA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vC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * A live `ProcessOutputSource` over a polled buffer.
3
+ *
4
+ * `ManagedProcess.readOutput()` returns the whole accumulated stdout+stderr, not a
5
+ * delta — re-emitting it every tick would duplicate every line. This source tracks
6
+ * the length already consumed and slices forward from it.
7
+ *
8
+ * Ends when `isFinished()` is true **and** the buffer has stopped growing, checked
9
+ * in that order: a process can exit with output still unread, so stopping at the
10
+ * exit event alone would drop what it printed on the way out.
11
+ */
12
+ import { type ProcessOutputSource } from "@descryy/runtime-backend-observation";
13
+ export interface PollingProcessOutputSourceOptions {
14
+ readonly processId: string;
15
+ /** Carried onto the `ProcessOutputSource` so collectors can attribute what it emits; `null` is a statement, not an omission. */
16
+ readonly serviceName: string | null;
17
+ /** The whole accumulated buffer so far — `ManagedProcess.readOutput` has exactly this shape. */
18
+ readonly readOutput: () => string;
19
+ /** True once the process has exited. Output already buffered is still drained afterwards. */
20
+ readonly isFinished: () => boolean;
21
+ readonly pollIntervalMs?: number;
22
+ /**
23
+ * How many of the lines this source will EVER yield already existed in the
24
+ * underlying buffer before observation began — e.g. `attachToRunningProcess`'s
25
+ * attach-time snapshot of an already-running target's log file (RT-N3).
26
+ * Counted in complete (newline-terminated) lines, not bytes: this source
27
+ * already reasons in lines, and byte offsets don't survive UTF-8 decoding
28
+ * cleanly. Default 0 — an ordinary spawned process has no pre-existing
29
+ * backlog. The Nth line this source yields (0-indexed, across BOTH the main
30
+ * loop and the final flush) is marked `preExisting: true` when N is less
31
+ * than this count.
32
+ *
33
+ * One disclosed edge case: a line torn exactly at the attach instant (an
34
+ * unterminated partial already in the file at attach, completed by content
35
+ * written afterward) is counted as NOT pre-existing by this index-based
36
+ * rule, even though its opening bytes are — the same "cannot be made
37
+ * perfectly correct over a plain text file" limit `attachToRunningProcess`
38
+ * documents, not solved here either.
39
+ */
40
+ readonly preExistingLineCount?: number;
41
+ }
42
+ export declare function createPollingProcessOutputSource(options: PollingProcessOutputSourceOptions): ProcessOutputSource;
43
+ //# sourceMappingURL=polling-output-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polling-output-source.d.ts","sourceRoot":"","sources":["../src/polling-output-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAwC,KAAK,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAEtH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,gIAAgI;IAChI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,gGAAgG;IAChG,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;IAClC,6FAA6F;IAC7F,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AAID,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,iCAAiC,GAAG,mBAAmB,CAyDhH"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * A live `ProcessOutputSource` over a polled buffer.
3
+ *
4
+ * `ManagedProcess.readOutput()` returns the whole accumulated stdout+stderr, not a
5
+ * delta — re-emitting it every tick would duplicate every line. This source tracks
6
+ * the length already consumed and slices forward from it.
7
+ *
8
+ * Ends when `isFinished()` is true **and** the buffer has stopped growing, checked
9
+ * in that order: a process can exit with output still unread, so stopping at the
10
+ * exit event alone would drop what it printed on the way out.
11
+ */
12
+ import { LineSplitter } from "@descryy/runtime-backend-observation";
13
+ const DEFAULT_POLL_INTERVAL_MS = 50;
14
+ export function createPollingProcessOutputSource(options) {
15
+ const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
16
+ const preExistingLineCount = options.preExistingLineCount ?? 0;
17
+ return {
18
+ processId: options.processId,
19
+ serviceName: options.serviceName,
20
+ lines: (async function* () {
21
+ const splitter = new LineSplitter();
22
+ let consumed = 0;
23
+ let lineIndex = 0;
24
+ function nextLine(text, observedAt) {
25
+ const preExisting = lineIndex < preExistingLineCount;
26
+ lineIndex++;
27
+ return { text, stream: "combined", observedAt, ...(preExisting ? { preExisting: true } : {}) };
28
+ }
29
+ for (;;) {
30
+ const whole = options.readOutput();
31
+ // Relies on the buffer only ever growing (true of `ManagedProcess` today,
32
+ // uncapped). If a future cap/rotation shrinks it, `consumed` would sit past
33
+ // the end and this source would silently emit nothing forever. Throw instead:
34
+ // `LogCollector`'s consume loop catches it and flips `backendLogAccess`
35
+ // unavailable (RT-036).
36
+ if (whole.length < consumed) {
37
+ throw new Error(`process output buffer shrank from ${consumed} to ${whole.length} characters — this source ` +
38
+ "slices forward from a consumed offset and cannot reconstruct a truncated or rotated buffer " +
39
+ "without either duplicating or dropping lines. Reported rather than guessed.");
40
+ }
41
+ if (whole.length > consumed) {
42
+ const chunk = whole.slice(consumed);
43
+ consumed = whole.length;
44
+ const observedAt = new Date().toISOString();
45
+ for (const text of splitter.push(chunk)) {
46
+ yield nextLine(text, observedAt);
47
+ }
48
+ // no sleep: a burst of output should drain at memory speed
49
+ continue;
50
+ }
51
+ if (options.isFinished()) {
52
+ const observedAt = new Date().toISOString();
53
+ // a final unterminated line matters most -- a process dying mid-write
54
+ for (const text of splitter.flush()) {
55
+ yield nextLine(text, observedAt);
56
+ }
57
+ return;
58
+ }
59
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
60
+ }
61
+ })(),
62
+ };
63
+ }
64
+ //# sourceMappingURL=polling-output-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polling-output-source.js","sourceRoot":"","sources":["../src/polling-output-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAoD,MAAM,sCAAsC,CAAC;AAgCtH,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC,MAAM,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C;oBACxB,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;oBAC5C,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;wBACxC,MAAM,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;oBACnC,CAAC;oBACD,2DAA2D;oBAC3D,SAAS;gBACX,CAAC;gBAED,IAAI,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;oBACzB,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;oBAC5C,sEAAsE;oBACtE,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;wBACpC,MAAM,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;oBACnC,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;YACtE,CAAC;QACH,CAAC,CAAC,EAAE;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Profile-driven backend traffic observation (RT-197, DEC-271).
3
+ *
4
+ * `InboundProxy` (RT-192) is wired into `runInstrumentedExecution` via
5
+ * `frontWithInboundProxy` — the local, Descry-booted half of DEC-271. This module is
6
+ * the other half: given an `EnvironmentProfile`, decide which of the two mechanisms
7
+ * (inbound proxy vs. `@descryy/runtime-remote-log-ingestion`) applies, never both.
8
+ *
9
+ * **Mutual exclusivity is structural, not asserted** — this file never imports
10
+ * `createInboundProxy`, so nothing here can construct a proxy. `"localBooted"` is
11
+ * refused with a `validationError`: DEC-271 names no ingestion mechanism for a
12
+ * profile Descry itself booted (its proxy path is `frontWithInboundProxy`, not this
13
+ * function).
14
+ *
15
+ * `"localAttached"` is refused too, disclosed rather than guessed: DEC-271's table
16
+ * covers only "local, booted" and "remote/production", not `"localAttached"`
17
+ * (RT-024's readiness-then-front sequencing doesn't apply to a process Descry didn't
18
+ * start). Inventing an answer here would be the guess DEC-266/DEC-271 both reject.
19
+ */
20
+ import type { Evidence } from "@descryy/runtime-contracts";
21
+ import type { EnvironmentProfile } from "@descryy/runtime-environment-profile";
22
+ import { EvidenceStore } from "@descryy/runtime-evidence-store";
23
+ import { type RemoteLogSourceConfig } from "@descryy/runtime-remote-log-ingestion";
24
+ /**
25
+ * The mechanism decision exposed as data, not just a side effect, so a caller can
26
+ * inspect which mechanism a profile resolves to and "never both" is checkable
27
+ * structurally.
28
+ */
29
+ export type BackendObservationMechanism = {
30
+ readonly kind: "inboundProxy";
31
+ } | {
32
+ readonly kind: "remoteLogIngestion";
33
+ readonly config: RemoteLogSourceConfig;
34
+ } | {
35
+ readonly kind: "none";
36
+ readonly reason: string;
37
+ };
38
+ /**
39
+ * Pure decision function — DEC-271's table read off `EnvironmentProfile.mode`.
40
+ * Never touches network or filesystem; `runRemoteLogObservation` below does the
41
+ * actual ingestion.
42
+ */
43
+ export declare function backendObservationMechanismFor(profile: EnvironmentProfile): BackendObservationMechanism;
44
+ export interface RunRemoteLogObservationInput {
45
+ readonly profile: EnvironmentProfile;
46
+ readonly executionId: string;
47
+ /** Where ingested lines are written. Provided rather than constructed, same discipline as `InstrumentedExecutionInput.store`. */
48
+ readonly store: EvidenceStore;
49
+ }
50
+ export interface RunRemoteLogObservationResult {
51
+ readonly evidence: readonly Evidence[];
52
+ /** Set when this function refused to ingest anything -- a profile mode this function does not handle, or a declared source this pass has no adapter for. Evidence is empty and that is a refusal, not an absence of logs. */
53
+ readonly validationError: string | null;
54
+ }
55
+ /**
56
+ * The remote/production half of DEC-271. Reads the profile's `remoteLogSource`
57
+ * **once** (`ingestFileLog` is one-shot, see `file-log-adapter.ts`) and writes each
58
+ * line through `EvidenceStore` as `BACKEND_LOG`, so redaction runs the same as it
59
+ * does for `LogCollector`'s local-process output.
60
+ *
61
+ * Refuses (via `validationError`, never silently empty) when: mode isn't
62
+ * remote/production; no `remoteLogSource` declared; or `location.kind` isn't
63
+ * `"file"` — the only built adapter (`"command"`/`"url"` are typed but unbuilt, see
64
+ * `log-source-config.ts`). Never constructs `InboundProxy` — not imported here.
65
+ */
66
+ export declare function runRemoteLogObservation(input: RunRemoteLogObservationInput): Promise<RunRemoteLogObservationResult>;
67
+ //# sourceMappingURL=profile-backend-observation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-backend-observation.d.ts","sourceRoot":"","sources":["../src/profile-backend-observation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAA2C,KAAK,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAI5H;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GACnC;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE,GACjC;IAAE,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,kBAAkB,GAAG,2BAA2B,CAkBvG;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iIAAiI;IACjI,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,CAAC;IACvC,6NAA6N;IAC7N,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAwDzH"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Profile-driven backend traffic observation (RT-197, DEC-271).
3
+ *
4
+ * `InboundProxy` (RT-192) is wired into `runInstrumentedExecution` via
5
+ * `frontWithInboundProxy` — the local, Descry-booted half of DEC-271. This module is
6
+ * the other half: given an `EnvironmentProfile`, decide which of the two mechanisms
7
+ * (inbound proxy vs. `@descryy/runtime-remote-log-ingestion`) applies, never both.
8
+ *
9
+ * **Mutual exclusivity is structural, not asserted** — this file never imports
10
+ * `createInboundProxy`, so nothing here can construct a proxy. `"localBooted"` is
11
+ * refused with a `validationError`: DEC-271 names no ingestion mechanism for a
12
+ * profile Descry itself booted (its proxy path is `frontWithInboundProxy`, not this
13
+ * function).
14
+ *
15
+ * `"localAttached"` is refused too, disclosed rather than guessed: DEC-271's table
16
+ * covers only "local, booted" and "remote/production", not `"localAttached"`
17
+ * (RT-024's readiness-then-front sequencing doesn't apply to a process Descry didn't
18
+ * start). Inventing an answer here would be the guess DEC-266/DEC-271 both reject.
19
+ */
20
+ import { EvidenceStore } from "@descryy/runtime-evidence-store";
21
+ import { ingestFileLog } from "@descryy/runtime-remote-log-ingestion";
22
+ import { COLLECTOR_VERSION } from "./collector-version.js";
23
+ /**
24
+ * Pure decision function — DEC-271's table read off `EnvironmentProfile.mode`.
25
+ * Never touches network or filesystem; `runRemoteLogObservation` below does the
26
+ * actual ingestion.
27
+ */
28
+ export function backendObservationMechanismFor(profile) {
29
+ if (profile.mode === "localBooted") {
30
+ return { kind: "inboundProxy" };
31
+ }
32
+ if (profile.mode === "remote" || profile.mode === "production") {
33
+ if (profile.remoteLogSource == null) {
34
+ return {
35
+ kind: "none",
36
+ reason: `profile "${profile.name}" is mode "${profile.mode}" but declares no remoteLogSource -- DEC-271's honest "not observable here", not an error.`,
37
+ };
38
+ }
39
+ return { kind: "remoteLogIngestion", config: profile.remoteLogSource };
40
+ }
41
+ // localAttached: disclosed gap, see file header.
42
+ return {
43
+ kind: "none",
44
+ reason: `profile "${profile.name}" is mode "localAttached" -- DEC-271 names a mechanism for neither local-attached nor any third case; not guessed at here.`,
45
+ };
46
+ }
47
+ /**
48
+ * The remote/production half of DEC-271. Reads the profile's `remoteLogSource`
49
+ * **once** (`ingestFileLog` is one-shot, see `file-log-adapter.ts`) and writes each
50
+ * line through `EvidenceStore` as `BACKEND_LOG`, so redaction runs the same as it
51
+ * does for `LogCollector`'s local-process output.
52
+ *
53
+ * Refuses (via `validationError`, never silently empty) when: mode isn't
54
+ * remote/production; no `remoteLogSource` declared; or `location.kind` isn't
55
+ * `"file"` — the only built adapter (`"command"`/`"url"` are typed but unbuilt, see
56
+ * `log-source-config.ts`). Never constructs `InboundProxy` — not imported here.
57
+ */
58
+ export async function runRemoteLogObservation(input) {
59
+ const { profile, executionId, store } = input;
60
+ const mechanism = backendObservationMechanismFor(profile);
61
+ if (mechanism.kind !== "remoteLogIngestion") {
62
+ const reason = mechanism.kind === "none"
63
+ ? mechanism.reason
64
+ : `profile "${profile.name}" resolves to mechanism "${mechanism.kind}", not remote log ingestion -- runRemoteLogObservation never constructs an InboundProxy, so it refuses rather than silently doing nothing.`;
65
+ return { evidence: [], validationError: reason };
66
+ }
67
+ const { config } = mechanism;
68
+ if (config.location.kind !== "file") {
69
+ return {
70
+ evidence: [],
71
+ validationError: `remoteLogSource.location.kind "${config.location.kind}" has no ingestion adapter yet -- only "file" is built (see file-log-adapter.ts's own doc); not observable here.`,
72
+ };
73
+ }
74
+ const fileConfig = { ...config, location: config.location };
75
+ let lines;
76
+ try {
77
+ lines = await ingestFileLog({ config: fileConfig });
78
+ }
79
+ catch (error) {
80
+ const detail = error instanceof Error ? error.message : String(error);
81
+ return { evidence: [], validationError: `remote log ingestion failed for profile "${profile.name}": ${detail}` };
82
+ }
83
+ const evidence = [];
84
+ for (const line of lines) {
85
+ evidence.push(store.write({
86
+ executionId,
87
+ timestamp: line.timestamp ?? new Date().toISOString(),
88
+ source: "backend-process",
89
+ service: null,
90
+ process: null,
91
+ eventType: "BACKEND_LOG",
92
+ payload: { raw: line.raw, ingestedVia: "remote-log-ingestion", profile: profile.name },
93
+ traceId: line.traceId,
94
+ requestId: line.requestId,
95
+ correlationId: null,
96
+ graphNodeId: null,
97
+ sourceLocation: null,
98
+ stackTrace: null,
99
+ // the line itself isn't probabilistic; a later correlation to a captured
100
+ // request is a separate, lower-confidence question (correlateLogLine's tiers)
101
+ confidence: 1,
102
+ collectorVersion: COLLECTOR_VERSION,
103
+ }));
104
+ }
105
+ return { evidence, validationError: null };
106
+ }
107
+ //# sourceMappingURL=profile-backend-observation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-backend-observation.js","sourceRoot":"","sources":["../src/profile-backend-observation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAwD,MAAM,uCAAuC,CAAC;AAE5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAY3D;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,OAA2B;IACxE,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QACnC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAClC,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC/D,IAAI,OAAO,CAAC,eAAe,IAAI,IAAI,EAAE,CAAC;YACpC,OAAO;gBACL,IAAI,EA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ach mode, not a
3
+ * change to attach mode itself.
4
+ *
5
+ * **The tradeoff, stated up front — must never apply silently.** Attach mode
6
+ * reaches an already-running, unconfined process; there is no honest way to
7
+ * retroactively sandbox it (`sandbox.ts`). This module doesn't try — it kills the
8
+ * attached target and spawns a fresh equivalent via the existing `spawnProcess()`,
9
+ * which gets full sandboxing for anything it spawns. Price: in-memory state, open
10
+ * connections, anything unpersisted is gone the moment the old process is killed.
11
+ * A caller must choose this explicitly — nothing upgrades an attach into a respawn
12
+ * on its own.
13
+ *
14
+ * **How this learns what to respawn.** Follows RT-032's "declared, never inferred"
15
+ * precedent: caller-declared (`source: "caller-declared"`) is the recommended,
16
+ * default path. `/proc/<pid>/cmdline` readback is a real but best-effort,
17
+ * opt-in-only fallback (`inferRespawnCommandFromProc`), labelled `source:
18
+ * "proc-cmdline-inferred"` so it's never mistaken for a declaration.
19
+ *
20
+ * **Killing the old process.** Doesn't assume ownership of the target's process
21
+ * group — it may not even be its own group leader — so this signals the individual
22
+ * pid only (SIGTERM, then SIGKILL after `gracePeriodMs`), not `spawnProcess`'s
23
+ * group-kill escape hatch (`signalGroup`), which is only valid for a group it
24
+ * created itself.
25
+ */
26
+ import { type ManagedProcess, type SpawnProcessOptions } from "@descryy/runtime-controller";
27
+ export type RespawnCommandSource = "caller-declared" | "proc-cmdline-inferred";
28
+ /**
29
+ * Everything `spawnProcess` needs to relaunch the killed target, plus `source`
30
+ * (never optional) so a real declaration is always distinguishable from a
31
+ * best-effort guess.
32
+ */
33
+ export interface RespawnCommand {
34
+ readonly command: string;
35
+ readonly args?: readonly string[];
36
+ readonly cwd: string;
37
+ readonly env?: Readonly<Record<string, string | undefined>>;
38
+ readonly source: RespawnCommandSource;
39
+ }
40
+ export interface RespawnAndSuperviseOptions {
41
+ readonly processId: string;
42
+ /** The pid of the already-running, attached-to target. Verified alive before anything is killed. */
43
+ readonly targetPid: number;
44
+ /** How the replacement process is launched. See file header: `source: "caller-declared"` is the recommended path. */
45
+ readonly respawn: RespawnCommand;
46
+ /** How long to wait for the old target to exit after SIGTERM before escalating to SIGKILL. Same default as `ManagedProcess.kill()`. */
47
+ readonly gracePeriodMs?: number;
48
+ readonly serviceName?: string;
49
+ readonly port?: number;
50
+ readonly resourceLimits?: SpawnProcessOptions["resourceLimits"];
51
+ readonly filesystemPolicy?: SpawnProcessOptions["filesystemPolicy"];
52
+ readonly networkPolicy?: SpawnProcessOptions["networkPolicy"];
53
+ }
54
+ export interface RespawnAndSuperviseResult {
55
+ /** The freshly spawned, supervised (sandboxed if declared) replacement — `spawnProcess()`'s own return, unwrapped. */
56
+ readonly managedProcess: ManagedProcess;
57
+ readonly killedPid: number;
58
+ /** Whether the old target was observed to exit within `gracePeriodMs` of SIGTERM, or needed SIGKILL. Either way this does not return until the old pid is confirmed dead. */
59
+ readonly killedViaSigkill: boolean;
60
+ readonly respawnSource: RespawnCommandSource;
61
+ }
62
+ /**
63
+ * Kills the process at `options.targetPid` and spawns a fresh, supervised,
64
+ * optionally sandboxed replacement via `spawnProcess()`.
65
+ *
66
+ * Not a silent behavior change to attach mode — reached only by explicit call,
67
+ * never an automatic upgrade path. `ATTACH_MODE_SCOPE_DISCLOSURE` still governs
68
+ * attach mode itself regardless.
69
+ *
70
+ * Throws if `targetPid` isn't alive at call time, matching `attachToRunningProcess`'s
71
+ * refuse-rather-than-operate-on-nonexistent-target contract.
72
+ */
73
+ export declare function respawnAndSupervise(options: RespawnAndSuperviseOptions): Promise<RespawnAndSuperviseResult>;
74
+ /**
75
+ * Opt-in, best-effort convenience — never the default. Reads `/proc/<pid>/cmdline`,
76
+ * `/cwd` and `/environ` to reconstruct a `RespawnCommand`, labelled `source:
77
+ * "proc-cmdline-inferred"` so it's never mistaken for a caller declaration.
78
+ *
79
+ * Disclosed limitations: Linux-only; `/proc/<pid>/environ` reflects only the
80
+ * environment at `execve()` time, so env vars set programmatically after exec are
81
+ * invisible; already-open file descriptors (inherited sockets/pipes) have no
82
+ * command-line representation and can't be recovered. Returns `null` — never
83
+ * throws, never guesses partially — when cmdline can't be read or is empty.
84
+ */
85
+ export declare function inferRespawnCommandFromProc(pid: number, platform?: NodeJS.Platform): RespawnCommand | null;
86
+ //# sourceMappingURL=respawn-and-supervise.d.ts.map