Timeline Studio API Documentation - v0.26.0
    Preparing search index...
    chatMachine: StateMachine<
        ChatMachineContext,
        ChatMachineEvent,
        {},
        never,
        Values<{ logReceiveMessage: {}; logSelectAgent: {}; logSendMessage: {} }>,
        never,
        never,

            | "idle"
            | "processing"
            | "creatingTimeline"
            | "analyzingResources"
            | "executingCommand",
        string,
        {},
        {},
        EventObject,
        MetaObject,
        {
            context: ChatMachineContext;
            id: "chat";
            initial: "idle";
            states: {
                analyzingResources: {
                    on: {
                        TIMELINE_OPERATION_ERROR: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { error: string; type: "TIMELINE_OPERATION_ERROR" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                            target: "idle";
                        };
                        TIMELINE_OPERATION_SUCCESS: {
                            actions: readonly [
                                ActionFunction<
                                    ChatMachineContext,
                                    { result: any; type: "TIMELINE_OPERATION_SUCCESS" },
                                    ChatMachineEvent,
                                    undefined,
                                    never,
                                    never,
                                    never,
                                    never,
                                    never,
                                >,
                                (
                                    __namedParameters: ActionArgs<
                                        ChatMachineContext,
                                        { result: any; type: "TIMELINE_OPERATION_SUCCESS" },
                                        ChatMachineEvent,
                                    >,
                                ) => void,
                            ];
                            target: "idle";
                        };
                    };
                };
                creatingTimeline: {
                    on: {
                        TIMELINE_OPERATION_ERROR: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { error: string; type: "TIMELINE_OPERATION_ERROR" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                            target: "idle";
                        };
                        TIMELINE_OPERATION_SUCCESS: {
                            actions: readonly [
                                ActionFunction<
                                    ChatMachineContext,
                                    { result: any; type: "TIMELINE_OPERATION_SUCCESS" },
                                    ChatMachineEvent,
                                    undefined,
                                    never,
                                    never,
                                    never,
                                    never,
                                    never,
                                >,
                                (
                                    __namedParameters: ActionArgs<
                                        ChatMachineContext,
                                        { result: any; type: "TIMELINE_OPERATION_SUCCESS" },
                                        ChatMachineEvent,
                                    >,
                                ) => void,
                            ];
                            target: "idle";
                        };
                    };
                };
                executingCommand: {
                    on: {
                        TIMELINE_OPERATION_ERROR: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { error: string; type: "TIMELINE_OPERATION_ERROR" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                            target: "idle";
                        };
                        TIMELINE_OPERATION_SUCCESS: {
                            actions: readonly [
                                ActionFunction<
                                    ChatMachineContext,
                                    { result: any; type: "TIMELINE_OPERATION_SUCCESS" },
                                    ChatMachineEvent,
                                    undefined,
                                    never,
                                    never,
                                    never,
                                    never,
                                    never,
                                >,
                                (
                                    __namedParameters: ActionArgs<
                                        ChatMachineContext,
                                        { result: any; type: "TIMELINE_OPERATION_SUCCESS" },
                                        ChatMachineEvent,
                                    >,
                                ) => void,
                            ];
                            target: "idle";
                        };
                    };
                };
                idle: {
                    on: {
                        ANALYZE_RESOURCES: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { query: string; type: "ANALYZE_RESOURCES" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                            target: "analyzingResources";
                        };
                        CLEAR_MESSAGES: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { type: "CLEAR_MESSAGES" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                        CREATE_NEW_CHAT: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { type: "CREATE_NEW_CHAT" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                        CREATE_TIMELINE_FROM_PROMPT: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { prompt: string; type: "CREATE_TIMELINE_FROM_PROMPT" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                            target: "creatingTimeline";
                        };
                        DELETE_SESSION: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { sessionId: string; type: "DELETE_SESSION" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                        EXECUTE_AI_COMMAND: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { command: string; params?: any; type: "EXECUTE_AI_COMMAND" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                            target: "executingCommand";
                        };
                        NEW_CHAT_CREATED: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { session: ChatListItem; type: "NEW_CHAT_CREATED" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                        REMOVE_MESSAGE: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { messageId: string; type: "REMOVE_MESSAGE" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                        SELECT_AGENT: {
                            actions: readonly [
                                { type: "logSelectAgent" },
                                ActionFunction<
                                    ChatMachineContext,
                                    { agentId: string; type: "SELECT_AGENT" },
                                    ChatMachineEvent,
                                    undefined,
                                    never,
                                    never,
                                    never,
                                    never,
                                    never,
                                >,
                            ];
                        };
                        SEND_CHAT_MESSAGE: {
                            actions: readonly [
                                { type: "logSendMessage" },
                                ActionFunction<
                                    ChatMachineContext,
                                    { message: string; type: "SEND_CHAT_MESSAGE" },
                                    ChatMachineEvent,
                                    undefined,
                                    never,
                                    never,
                                    never,
                                    never,
                                    never,
                                >,
                            ];
                            target: "processing";
                        };
                        SWITCH_SESSION: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { sessionId: string; type: "SWITCH_SESSION" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                        UPDATE_SESSIONS: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { sessions: ChatListItem[]; type: "UPDATE_SESSIONS" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                    };
                };
                processing: {
                    on: {
                        RECEIVE_CHAT_MESSAGE: {
                            actions: readonly [
                                { type: "logReceiveMessage" },
                                ActionFunction<
                                    ChatMachineContext,
                                    { message: ChatMessage; type: "RECEIVE_CHAT_MESSAGE" },
                                    ChatMachineEvent,
                                    undefined,
                                    never,
                                    never,
                                    never,
                                    never,
                                    never,
                                >,
                            ];
                            target: "idle";
                        };
                        SELECT_AGENT: {
                            actions: readonly [
                                { type: "logSelectAgent" },
                                ActionFunction<
                                    ChatMachineContext,
                                    { agentId: string; type: "SELECT_AGENT" },
                                    ChatMachineEvent,
                                    undefined,
                                    never,
                                    never,
                                    never,
                                    never,
                                    never,
                                >,
                            ];
                        };
                        SET_ERROR: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { error: string; type: "SET_ERROR" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                            target: "idle";
                        };
                        SET_PROCESSING: {
                            actions: ActionFunction<
                                ChatMachineContext,
                                { isProcessing: boolean; type: "SET_PROCESSING" },
                                ChatMachineEvent,
                                undefined,
                                never,
                                never,
                                never,
                                never,
                                never,
                            >;
                        };
                    };
                };
            };
        },
    > = ...

    Машина состояний для управления чатом с ИИ

    Обрабатывает:

    • Отправку и получение сообщений
    • Выбор агента (модели ИИ)
    • Состояние обработки
    • Ошибки