104
105
export function cleanupLocalAgentHostEndpointMetadataSync(userDataPath: string, owner: ILocalAgentHostEndpointMetadata): void {
107
>
const entries = readMetadata(metadataPath);
108
>
const remaining = entries.filter(entry => entry.pid !== owner.pid || entry.instanceId !== owner.instanceId || entry.type !== owner.type);
109
>
if (remaining.length === entries.length) {
110
>
return;
111
>
}
112
>
if (remaining.length === 0) {
113
>
fs.rmSync(metadataPath, { force: true });
114
>
} else {
115
fs.writeFileSync(metadataPath, JSON.stringify(remaining), { encoding: 'utf8', mode: 0o600 });
116
}
118
119
export function cleanupLocalAgentHostEndpointSocketSync(endpointPath: string): void {