refactor(app): unified panel state machine for mobile sidebars
Replace separate sidebar stores with a unified panel store that uses a discriminated union state machine on mobile. This makes it impossible for both the agent list and file explorer sidebars to be open at the same time on mobile. Mobile state machine (mobileView): - 'agent': Main agent view (no overlay panel) - 'agent-list': Agent list sidebar (left overlay) - 'file-explorer': File explorer sidebar (right overlay) Desktop retains independent boolean toggles since sidebars sit alongside content rather than overlaying it. Key changes: - Created stores/panel-store.ts with unified state - Deleted stores/sidebar-store.ts and explorer-sidebar-store.ts - Updated all components to use new panel store - Animation contexts derive isOpen from unified state
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
||||
SessionInboundMessageSchema,
|
||||
WSOutboundMessageSchema,
|
||||
} from "../shared/messages.js";
|
||||
import { getRootLogger } from "../server/logger.js";
|
||||
import type {
|
||||
AgentStreamEventPayload,
|
||||
AgentSnapshotPayload,
|
||||
@@ -40,7 +39,19 @@ import type {
|
||||
} from "../server/agent/agent-sdk-types.js";
|
||||
import { getAgentProviderDefinition } from "../server/agent/provider-manifest.js";
|
||||
|
||||
const logger = getRootLogger().child({ module: "daemon-client" });
|
||||
export interface Logger {
|
||||
debug(obj: object, msg?: string): void;
|
||||
info(obj: object, msg?: string): void;
|
||||
warn(obj: object, msg?: string): void;
|
||||
error(obj: object, msg?: string): void;
|
||||
}
|
||||
|
||||
const consoleLogger: Logger = {
|
||||
debug: (obj, msg) => console.debug(msg, obj),
|
||||
info: (obj, msg) => console.info(msg, obj),
|
||||
warn: (obj, msg) => console.warn(msg, obj),
|
||||
error: (obj, msg) => console.error(msg, obj),
|
||||
};
|
||||
|
||||
export type DaemonTransport = {
|
||||
send: (data: string) => void;
|
||||
@@ -115,6 +126,7 @@ export type DaemonClientV2Config = {
|
||||
suppressSendErrors?: boolean;
|
||||
transportFactory?: DaemonTransportFactory;
|
||||
webSocketFactory?: WebSocketFactory;
|
||||
logger?: Logger;
|
||||
reconnect?: {
|
||||
enabled?: boolean;
|
||||
baseDelayMs?: number;
|
||||
@@ -197,6 +209,7 @@ export class DaemonClientV2 {
|
||||
private connectionState: ConnectionState = { status: "idle" };
|
||||
private messageQueueLimit: number | null;
|
||||
private agentIndex: Map<string, AgentSnapshotPayload> = new Map();
|
||||
private logger: Logger;
|
||||
|
||||
constructor(private config: DaemonClientV2Config) {
|
||||
this.messageQueueLimit =
|
||||
@@ -204,6 +217,7 @@ export class DaemonClientV2 {
|
||||
? DEFAULT_MESSAGE_QUEUE_LIMIT
|
||||
: config.messageQueueLimit;
|
||||
this.conversationId = config.conversationId ?? null;
|
||||
this.logger = config.logger ?? consoleLogger;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -1412,7 +1426,7 @@ export class DaemonClientV2 {
|
||||
const parsed = WSOutboundMessageSchema.safeParse(parsedJson);
|
||||
if (!parsed.success) {
|
||||
const msgType = (parsedJson as { message?: { type?: string } })?.message?.type ?? "unknown";
|
||||
logger.warn({ msgType, error: parsed.error.message }, "Message validation failed");
|
||||
this.logger.warn({ msgType, error: parsed.error.message }, "Message validation failed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user