chore: land multi-daemon rollout
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
type BackgroundAgentAction = "create" | "resume";
|
||||
type OfflineAction =
|
||||
| "create"
|
||||
| "resume"
|
||||
| "dictation"
|
||||
| "import_list";
|
||||
|
||||
type AnalyticsEvent =
|
||||
| {
|
||||
type: "daemon_active_changed";
|
||||
daemonId: string;
|
||||
previousDaemonId: string | null;
|
||||
source?: string;
|
||||
}
|
||||
| {
|
||||
type: "background_agent_action";
|
||||
action: BackgroundAgentAction;
|
||||
daemonId: string;
|
||||
activeDaemonId: string | null;
|
||||
isBackground: boolean;
|
||||
cwd?: string;
|
||||
provider?: string;
|
||||
modeId?: string;
|
||||
model?: string;
|
||||
baseBranch?: string;
|
||||
}
|
||||
| {
|
||||
type: "offline_daemon_action_attempt";
|
||||
action: OfflineAction;
|
||||
daemonId: string | null;
|
||||
activeDaemonId: string | null;
|
||||
status: string | null;
|
||||
isBackground: boolean;
|
||||
reason?: string | null;
|
||||
};
|
||||
|
||||
export function trackAnalyticsEvent(event: AnalyticsEvent) {
|
||||
try {
|
||||
const payload = {
|
||||
...event,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
console.info("[Analytics]", payload);
|
||||
} catch (error) {
|
||||
console.error("[Analytics] Failed to emit event", error);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ConnectionStatus } from "@/contexts/daemon-connections-context";
|
||||
import { assertUnreachable } from "./exhaustive";
|
||||
|
||||
export function formatConnectionStatus(status: ConnectionStatus): string {
|
||||
switch (status) {
|
||||
@@ -10,8 +11,10 @@ export function formatConnectionStatus(status: ConnectionStatus): string {
|
||||
return "Offline";
|
||||
case "error":
|
||||
return "Error";
|
||||
default:
|
||||
case "idle":
|
||||
return "Idle";
|
||||
default:
|
||||
return assertUnreachable(status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +28,11 @@ export function getConnectionStatusTone(status: ConnectionStatus): ConnectionSta
|
||||
return "warning";
|
||||
case "error":
|
||||
return "error";
|
||||
default:
|
||||
case "offline":
|
||||
return "warning";
|
||||
case "idle":
|
||||
return "muted";
|
||||
default:
|
||||
return assertUnreachable(status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export function assertUnreachable(value: never): never {
|
||||
throw new Error(`Unhandled case: ${String(value)}`);
|
||||
}
|
||||
Reference in New Issue
Block a user