/** * TIA-∞ Mode Controller * Handles switching between Guided Builder mode and Autonomous mode. * Ensures safety, approval, and persistent state tracking. */ export type TIAMode = "guided" | "autonomous"; export interface ModeState { current: TIAMode; lastChanged: number; } let state: ModeState = { current: "guided", lastChanged: Date.now(), }; export function getMode(): ModeState { return state; } export function requestAutonomousSwitch(): string { return ` I am ready to transition from Guided Mode to Autonomous Mode. In Autonomous Mode I will: - repair approved issues automatically - rebuild incomplete modules - resolve drift - maintain structure - evolve the ecosystem safely Do you approve this transition? (approve / decline) `.trim(); } export function approveAutonomousSwitch(): ModeState { state = { current: "autonomous", lastChanged: Date.now(), }; return state; } export function declineAutonomousSwitch(): string { return "Understood. Remaining in Guided Mode."; }