Patch local chat realtime and align Caddy

This commit is contained in:
kris
2026-04-10 22:12:58 +08:00
parent a084688e35
commit 1b0f126d4f
8 changed files with 144 additions and 17 deletions

View File

@@ -23,6 +23,7 @@ export interface BossEventPayload {
note?: string;
conversationItem?: unknown;
threadConversationItem?: unknown;
projectMessagesPayload?: unknown;
}
type BossEventListener = (event: BossEventName, payload: BossEventPayload) => void;

View File

@@ -548,6 +548,12 @@ export interface ConversationFolderView {
threads: ConversationItem[];
}
export interface ProjectMessagesRealtimePayload {
ok: true;
project: Project;
devices: Device[];
}
export function getConversationHomeItems(state: BossState): ConversationItem[] {
const flatItems = getConversationItems(state);
const projectMap = new Map(state.projects.map((project) => [project.id, project]));
@@ -702,6 +708,25 @@ export function getConversationFolderView(
};
}
export function buildProjectMessagesRealtimePayload(
state: BossState,
projectId: string,
): ProjectMessagesRealtimePayload | null {
const normalizedProjectId = projectId.trim();
if (!normalizedProjectId) {
return null;
}
const project = state.projects.find((item) => item.id === normalizedProjectId);
if (!project) {
return null;
}
return {
ok: true,
project,
devices: state.devices.filter((device) => project.deviceIds.includes(device.id)),
};
}
function resolveProjectAgentControls(
state: BossState,
projectId: string,