export async function readManualUpdate(fileStore) {
    return (await fileStore.read()).manualUpdate;
}
export async function rememberManualUpdate(fileStore, manualUpdate) {
    await fileStore.update((state) => ({ ...state, manualUpdate }), { flush: 'immediate' });
}
export async function clearManualUpdate(fileStore) {
    if (!(await fileStore.read()).manualUpdate) {
        return;
    }
    await fileStore.update((state) => ({ ...state, manualUpdate: null }), { flush: 'immediate' });
}
export async function readAgentManualUpdate(fileStore, agentId) {
    return (await fileStore.read()).agentManualUpdates[agentId] ?? null;
}
export async function rememberAgentManualUpdate(fileStore, agentId, manualUpdate) {
    await fileStore.update((state) => ({
        ...state,
        agentManualUpdates: {
            ...state.agentManualUpdates,
            [agentId]: manualUpdate
        }
    }), { flush: 'immediate' });
}
export async function clearAgentManualUpdate(fileStore, agentId) {
    if (!(await fileStore.read()).agentManualUpdates[agentId]) {
        return;
    }
    await fileStore.update((state) => {
        const { [agentId]: _removed, ...agentManualUpdates } = state.agentManualUpdates;
        return { ...state, agentManualUpdates };
    }, { flush: 'immediate' });
}
//# sourceMappingURL=manualUpdateState.js.map