@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
32 lines • 1.29 kB
JavaScript
import { writeSync } from "node:fs";
/**
* A detached daemon exiting right after an async stderr.write to a file can lose the output
* entirely; the supervisor writes synchronously so its diagnostics always land.
*/
export function writeStderrLine(text) {
try {
writeSync(2, `${text}\n`);
}
catch {
/* fd 2 unavailable: nothing more we can do. */
}
}
export function supervisorLog(message) {
writeStderrLine(`senpi rpc host supervisor: ${message}`);
}
export function writeHostReady(socket, coldStart, idleExitMs) {
writeStderrLine(`senpi rpc host ready on unix://${socket} (coldStart=${coldStart}, idleExitMs=${coldStart === "persistent" ? "never" : String(idleExitMs)})`);
}
// Identity refusal loops share one process-local diagnostic budget, not a persisted latch.
const loggedUnknownIdentities = new Set();
export function logUnknownHostIdentity(record, pid) {
const key = `${record}:${pid}`;
if (loggedUnknownIdentities.has(key))
return;
loggedUnknownIdentities.add(key);
writeStderrLine(JSON.stringify({ event: "legacy_host_identity_unknown", record, pid }));
}
export function errorMessage(cause) {
return cause instanceof Error ? cause.message : String(cause);
}
//# sourceMappingURL=host-supervisor-log.js.map