//#region src/agent/lifecycle/typing.ts
function createTypingController(params) {
	const { onStart, onStop, intervalSeconds = 5 } = params;
	let typingTimer = null;
	let stopped = false;
	const start = () => {
		if (stopped) return;
		if (typingTimer) return;
		onStart().catch(() => {});
		typingTimer = setInterval(() => {
			if (stopped) stop();
			else onStart().catch(() => {});
		}, intervalSeconds * 1e3);
	};
	const stop = async () => {
		if (typingTimer) {
			clearInterval(typingTimer);
			typingTimer = null;
		}
		if (!stopped) await onStop().catch(() => {});
		stopped = true;
	};
	return {
		start,
		stop
	};
}
//#endregion
export { createTypingController };

//# sourceMappingURL=typing.js.map