"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStorageChangeEvent = exports.CUSTOM_EVENTS = void 0;
exports.createCustomEvent = createCustomEvent;
exports.CUSTOM_EVENTS = {
    /**
     * Event to show a toast notification when thinking level changes
     * Detail: { workspaceId: string, level: ThinkingLevel }
     */
    THINKING_LEVEL_TOAST: "cmux:thinkingLevelToast",
    /**
     * Event to insert text into the chat input
     * Detail: { text: string }
     */
    INSERT_TO_CHAT_INPUT: "cmux:insertToChatInput",
    /**
     * Event to open the model selector
     * No detail
     */
    OPEN_MODEL_SELECTOR: "cmux:openModelSelector",
    /**
     * Event to trigger resume check for a workspace
     * Detail: { workspaceId: string }
     *
     * Emitted when:
     * - Stream error occurs
     * - Stream aborted
     * - App startup (for all workspaces with interrupted streams)
     *
     * useResumeManager handles this idempotently - safe to emit multiple times
     */
    RESUME_CHECK_REQUESTED: "cmux:resumeCheckRequested",
    /**
     * Event to switch to a different workspace after fork
     * Detail: { workspaceId: string, projectPath: string, projectName: string, workspacePath: string, branch: string }
     */
    WORKSPACE_FORK_SWITCH: "cmux:workspaceForkSwitch",
    /**
     * Event to execute a command from the command palette
     * Detail: { commandId: string }
     */
    EXECUTE_COMMAND: "cmux:executeCommand",
};
/**
 * Helper to create a typed custom event
 *
 * @example
 * ```typescript
 * const event = createCustomEvent(CUSTOM_EVENTS.RESUME_CHECK_REQUESTED, {
 *   workspaceId: 'abc123',
 *   isManual: true
 * });
 * window.dispatchEvent(event);
 * ```
 */
function createCustomEvent(eventName, ...args) {
    const [detail] = args;
    return new CustomEvent(eventName, { detail });
}
/**
 * Helper to create a storage change event name for a specific key
 * Used by usePersistedState for same-tab synchronization
 */
const getStorageChangeEvent = (key) => `storage-change:${key}`;
exports.getStorageChangeEvent = getStorageChangeEvent;
//# sourceMappingURL=events.js.map