refactor: consolidate chat state and task bridges
Centralize session scope, chat projections and typed task bridges. Keep historical interaction replies authoritative and publish terminal state to subscribers. Validate Server contracts before replacing generated artifacts.
This commit is contained in:
@@ -174,27 +174,6 @@ export const generateSessionTitle = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const getConversationTurnStats = async (
|
||||
runtime: OpencodeRuntimeAdapter,
|
||||
sessionId: string,
|
||||
) => {
|
||||
const messages = await runtime.messages(sessionId, 12);
|
||||
return messages.reduce(
|
||||
(stats, message) => {
|
||||
if (message.info.role === "user") {
|
||||
stats.userMessageCount += 1;
|
||||
} else if (message.info.role === "assistant") {
|
||||
stats.assistantMessageCount += 1;
|
||||
}
|
||||
return stats;
|
||||
},
|
||||
{
|
||||
userMessageCount: 0,
|
||||
assistantMessageCount: 0,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const buildPromptWithLearningContext = async (
|
||||
memoryStore: MemoryStore,
|
||||
actorKey: string,
|
||||
|
||||
Reference in New Issue
Block a user