4142c53fa6
Replace SSE /desktop/events with priority AMQP dispatch for monitoring
runs, and add phase1/phase2 infrastructure so desktop workers can lease,
resume, report, skip, and cancel monitoring tasks over the existing
dispatch WebSocket.
- Add monitoring collect outbox worker and phase2 desktop task fields
- Add /desktop/monitoring/tasks/{lease,resume,result,skip,cancel} routes
- Introduce execution-devtools and network-observer on desktop runtime
- Refactor runtime-controller, LoginView, and doubao adapter for the new flow
- Add channelName column to tracking views
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
import type { WebContents } from "electron/main";
|
|
|
|
function normalizeBooleanEnv(value: string | undefined): boolean | null {
|
|
if (!value) {
|
|
return null;
|
|
}
|
|
|
|
const normalized = value.trim().toLowerCase();
|
|
if (["1", "true", "yes", "on"].includes(normalized)) {
|
|
return true;
|
|
}
|
|
if (["0", "false", "no", "off"].includes(normalized)) {
|
|
return false;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export function shouldAutoOpenExecutionDevtools(): boolean {
|
|
const explicit = normalizeBooleanEnv(process.env.GEO_DESKTOP_EXECUTION_DEVTOOLS);
|
|
if (explicit !== null) {
|
|
return explicit;
|
|
}
|
|
|
|
return Boolean(process.env.ELECTRON_RENDERER_URL);
|
|
}
|
|
|
|
export function shouldAutoOpenBackgroundExecutionDevtools(): boolean {
|
|
const explicit = normalizeBooleanEnv(process.env.GEO_DESKTOP_EXECUTION_DEVTOOLS);
|
|
if (explicit !== null) {
|
|
return explicit;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
export function maybeOpenExecutionDevtools(
|
|
webContents: WebContents,
|
|
label: string,
|
|
options: { background?: boolean } = {},
|
|
): void {
|
|
const allowOpen = options.background
|
|
? shouldAutoOpenBackgroundExecutionDevtools()
|
|
: shouldAutoOpenExecutionDevtools();
|
|
if (!allowOpen) {
|
|
return;
|
|
}
|
|
if (webContents.isDestroyed() || webContents.isDevToolsOpened()) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
webContents.openDevTools({ mode: "detach" });
|
|
console.info("[desktop-devtools] opened execution devtools", { label });
|
|
} catch (error) {
|
|
console.warn("[desktop-devtools] failed to open execution devtools", { label, error });
|
|
}
|
|
}
|