antechamber 1.0.29 → 1.0.30
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/CHANGELOG.md +6 -0
- package/dist/pi-rpc.d.ts +6 -0
- package/dist/pi-rpc.js +22 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/extensions/omo-compat/package.json +1 -1
- package/extensions/omo-dag/package.json +1 -1
- package/extensions/omo-work/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/pi-rpc.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ export declare const COMPACT_RPC_TIMEOUT_MS: number;
|
|
|
24
24
|
export declare class UpstreamProtocolError extends Error {
|
|
25
25
|
constructor(message: string);
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* How far above antechamber's own `oom_score_adj` each agent is placed. The agent and everything it starts
|
|
29
|
+
* (test runners, compilers, OmO's task host) inherit it, so under memory pressure the kernel OOM killer and
|
|
30
|
+
* earlyoom take a workload before the adapter, whose death stops every session at once.
|
|
31
|
+
*/
|
|
32
|
+
export declare const AGENT_OOM_SCORE_ADJ_MARGIN = 300;
|
|
27
33
|
/** A process's group and kernel start time: with the PID, the identity that survives PID reuse checks. */
|
|
28
34
|
interface ProcessIdentity {
|
|
29
35
|
readonly pid: number;
|
package/dist/pi-rpc.js
CHANGED
|
@@ -11,7 +11,7 @@ import { spawn } from "node:child_process";
|
|
|
11
11
|
import { StringDecoder } from "node:string_decoder";
|
|
12
12
|
import { EventEmitter } from "node:events";
|
|
13
13
|
import { randomUUID } from "node:crypto";
|
|
14
|
-
import { readdirSync, readFileSync } from "node:fs";
|
|
14
|
+
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
15
15
|
import { constants as osConstants } from "node:os";
|
|
16
16
|
import { systemClock } from "./lifecycle.js";
|
|
17
17
|
import { agentBinary, envSetting } from "./config.js";
|
|
@@ -31,6 +31,25 @@ export class UpstreamProtocolError extends Error {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
const PROCESS_KILL_GRACE_MS = 5_000;
|
|
34
|
+
/**
|
|
35
|
+
* How far above antechamber's own `oom_score_adj` each agent is placed. The agent and everything it starts
|
|
36
|
+
* (test runners, compilers, OmO's task host) inherit it, so under memory pressure the kernel OOM killer and
|
|
37
|
+
* earlyoom take a workload before the adapter, whose death stops every session at once.
|
|
38
|
+
*/
|
|
39
|
+
export const AGENT_OOM_SCORE_ADJ_MARGIN = 300;
|
|
40
|
+
/** Linux only: rank the agent above antechamber for the OOM killer. Raising a child's score needs no privilege. */
|
|
41
|
+
function rankAboveAdapterForOom(pid) {
|
|
42
|
+
if (process.platform !== "linux")
|
|
43
|
+
return;
|
|
44
|
+
try {
|
|
45
|
+
const target = Math.min(1000, Number(readFileSync("/proc/self/oom_score_adj", "utf8")) + AGENT_OOM_SCORE_ADJ_MARGIN);
|
|
46
|
+
if (Number(readFileSync(`/proc/${pid}/oom_score_adj`, "utf8")) < target)
|
|
47
|
+
writeFileSync(`/proc/${pid}/oom_score_adj`, String(target));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error(`[pi-rpc] could not raise the agent's OOM score: ${error instanceof Error ? error.message : error}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
34
53
|
// Linux /proc. Any read failure (gone, no permission, no /proc) means the identity cannot be
|
|
35
54
|
// verified, and an unverifiable process is never signalled: fail closed.
|
|
36
55
|
const procTable = {
|
|
@@ -165,6 +184,8 @@ export class PiRpcClient extends EventEmitter {
|
|
|
165
184
|
},
|
|
166
185
|
detached: true,
|
|
167
186
|
});
|
|
187
|
+
if (this.proc.pid !== undefined)
|
|
188
|
+
rankAboveAdapterForOom(this.proc.pid);
|
|
168
189
|
this.proc.stderr.on("data", (chunk) => {
|
|
169
190
|
this.stderrTail = (this.stderrTail + chunk.toString()).slice(-8192);
|
|
170
191
|
});
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const ADAPTER_VERSION: string;
|
|
2
|
-
export declare const OPENCODE_API_VERSION = "2.
|
|
2
|
+
export declare const OPENCODE_API_VERSION = "2.999.0";
|
package/dist/version.js
CHANGED
|
@@ -11,4 +11,4 @@ export const ADAPTER_VERSION = manifest.version;
|
|
|
11
11
|
// OpenChamber parses --version as an OpenCode version and requires major 2.
|
|
12
12
|
// This API contract version must not follow the npm package version.
|
|
13
13
|
// OpenChamber 2.5.2 requires 2.1.0, which added top-level `archived` to PATCH /api/session/{id}.
|
|
14
|
-
export const OPENCODE_API_VERSION = "2.
|
|
14
|
+
export const OPENCODE_API_VERSION = "2.999.0";
|