refactor(chat): move actors into machine directory

This commit is contained in:
2026-07-15 10:36:22 +08:00
parent 14600641e1
commit 2b90f90ab0
8 changed files with 11 additions and 31 deletions
-1
View File
@@ -45,7 +45,6 @@
"./src/integrations",
"./src/utils",
"./src/stores/auth",
"./src/stores/chat",
"./src/stores/user"
]
}
-18
View File
@@ -1,18 +0,0 @@
/**
* Backward-compatible actor exports.
*
* Concrete implementations live in capability flow files:
* - chat-history-flow
* - chat-send-flow
* - chat-unlock-flow
*/
export { loadHistoryActor } from "./chat-history-flow";
export {
httpMessageQueueActor,
sendMessageHttpActor,
} from "./chat-send-flow";
export {
unlockHistoryActor,
unlockMessageActor,
type UnlockMessageOutput,
} from "./chat-unlock-flow";
-1
View File
@@ -4,7 +4,6 @@
export * from "./chat-context";
export * from "./chat-events";
export * from "./chat-machine.actors";
export * from "./chat-machine.helpers";
export * from "./chat-machine";
export * from "./chat-state";
@@ -6,8 +6,8 @@ import {
readLocalHistorySnapshot,
resolveHistoryCacheIdentity,
syncNetworkHistory,
} from "./chat-history-sync";
import type { ChatEvent } from "./chat-events";
} from "../../chat-history-sync";
import type { ChatEvent } from "../../chat-events";
const log = new Logger("StoresChatChatHistoryFlow");
@@ -8,8 +8,8 @@ import { resolveChatCacheOwnerKey } from "@/data/repositories/chat_cache_identit
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import type { ChatEvent } from "./chat-events";
import { sendResponseToUiMessage } from "./chat-machine.helpers";
import type { ChatEvent } from "../../chat-events";
import { sendResponseToUiMessage } from "../../chat-machine.helpers";
const log = new Logger("StoresChatChatSendFlow");
@@ -5,11 +5,11 @@ import { resolveChatCacheOwnerKey } from "@/data/repositories/chat_cache_identit
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import { readAndSyncHistory } from "./chat-history-sync";
import { readAndSyncHistory } from "../../chat-history-sync";
import {
type UnlockMessageRequest,
type UnlockMessageOutput,
} from "./chat-machine.helpers";
} from "../../chat-machine.helpers";
const log = new Logger("StoresChatChatUnlockFlow");
@@ -93,5 +93,3 @@ export const unlockMessageActor = fromPromise<
response: unlockResult.data,
};
});
export type { UnlockMessageOutput } from "./chat-machine.helpers";
+4 -2
View File
@@ -1,13 +1,15 @@
import { setup, type ActionFunction, type EventObject } from "xstate";
import type { ChatEvent } from "../chat-events";
import { loadHistoryActor } from "./actors/history";
import {
httpMessageQueueActor,
loadHistoryActor,
sendMessageHttpActor,
} from "./actors/send";
import {
unlockHistoryActor,
unlockMessageActor,
} from "../chat-machine.actors";
} from "./actors/unlock";
import type { ChatState } from "../chat-state";
export const baseChatMachineSetup = setup({
+1 -1
View File
@@ -6,7 +6,7 @@ import {
countLockedHistoryMessages,
type UnlockMessageOutput,
} from "../chat-machine.helpers";
import type { UnlockHistoryOutput } from "../chat-unlock-flow";
import type { UnlockHistoryOutput } from "./actors/unlock";
import { sendMachineSetup } from "./send-flow";
import { createChatActorActionSetup } from "./setup";