feat(monitoring): dispatch monitoring tasks to desktop via AMQP outbox

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>
This commit is contained in:
2026-04-22 00:24:21 +08:00
parent 749b6b99cd
commit 4142c53fa6
57 changed files with 7897 additions and 985 deletions
@@ -7,6 +7,7 @@ import { collectRecoverySnapshot } from "./crash-recovery";
import { getKeepAlivePlan } from "./keep-alive";
import { getLeaseManagerSnapshot } from "./lease-manager";
import { getMonitorSchedulerSnapshot } from "./monitor-scheduler";
import { getObservedRequestSnapshot } from "./network-observer";
import { getHiddenPlaywrightSnapshot } from "./playwright-cdp";
import { getRateLimiterSnapshot } from "./rate-limiter";
import { getRuntimeControllerSnapshot } from "./runtime-controller";
@@ -131,7 +132,7 @@ function createLiveRuntimeSnapshot(controller: ReturnType<typeof getRuntimeContr
workspace: {
id: `ws-${controller.client?.workspace_id ?? controller.session?.desktop_client?.workspace_id ?? "current"}`,
name: `Workspace #${controller.client?.workspace_id ?? controller.session?.desktop_client?.workspace_id ?? "current"}`,
strategy: controller.sseConnected ? "rabbitmq-first / db-fallback" : "db-fallback / heartbeat recovery",
strategy: controller.dispatchConnected ? "websocket-first / db-fallback" : "db-fallback / heartbeat recovery",
nextSweepAt: scheduler.nextPullAt ?? minutesAhead(now, 1),
lastFullSyncAt: controller.lastAccountsSyncAt || now,
},
@@ -157,7 +158,7 @@ function createLiveRuntimeSnapshot(controller: ReturnType<typeof getRuntimeContr
recovery: collectRecoverySnapshot(),
runtimeController: {
running: controller.running,
sseConnected: controller.sseConnected,
dispatchConnected: controller.dispatchConnected,
queueDepth: controller.queueDepth,
lastHeartbeatAt: controller.lastHeartbeatAt,
lastHeartbeatStatus: controller.lastHeartbeatStatus,
@@ -172,6 +173,7 @@ function createLiveRuntimeSnapshot(controller: ReturnType<typeof getRuntimeContr
sessions,
hotViews,
hotViewPool: getHotViewPoolPolicy(),
networkDebug: getObservedRequestSnapshot(),
playwright: getHiddenPlaywrightSnapshot(),
processMetrics: getProcessMetricsSnapshot(),
vault: describeVaultBackend(),