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
@@ -32,24 +32,37 @@ type CreateDesktopPublishJobParams struct {
}
type DesktopTask struct {
DesktopID uuid.UUID
JobID uuid.UUID
TenantID int64
WorkspaceID int64
TargetAccountID uuid.UUID
TargetClientID uuid.UUID
Platform string
Kind string
Payload []byte
Status string
DedupKey *string
ActiveAttemptID *uuid.UUID
LeaseExpiresAt *time.Time
Attempts int
Result []byte
Error []byte
CreatedAt time.Time
UpdatedAt time.Time
DesktopID uuid.UUID
JobID uuid.UUID
TenantID int64
WorkspaceID int64
TargetAccountID uuid.UUID
TargetClientID uuid.UUID
Platform string
Kind string
Payload []byte
Status string
Priority int
Lane string
LaneWeight int
Source string
SchedulerGroupKey *string
MonitorTaskID *int64
SupersedesTaskID *uuid.UUID
ControlFlags []byte
InterruptGeneration int
DedupKey *string
ActiveAttemptID *uuid.UUID
LeaseExpiresAt *time.Time
Attempts int
Result []byte
Error []byte
StartedAt *time.Time
InterruptedAt *time.Time
InterruptReason *string
EnqueuedAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
type CreateDesktopTaskParams struct {
@@ -315,24 +328,37 @@ func desktopPublishJobFromGenerated(row generated.DesktopPublishJob) *DesktopPub
func desktopTaskFromGenerated(row generated.DesktopTask) *DesktopTask {
return &DesktopTask{
DesktopID: uuidFromPG(row.DesktopID),
JobID: uuidFromPG(row.JobID),
TenantID: row.TenantID,
WorkspaceID: row.WorkspaceID,
TargetAccountID: uuidFromPG(row.TargetAccountID),
TargetClientID: uuidFromPG(row.TargetClientID),
Platform: row.PlatformID,
Kind: row.Kind,
Payload: row.Payload,
Status: row.Status,
DedupKey: nullableText(row.DedupKey),
ActiveAttemptID: nullableUUID(row.ActiveAttemptID),
LeaseExpiresAt: optionalTime(row.LeaseExpiresAt),
Attempts: int(row.Attempts),
Result: row.Result,
Error: row.Error,
CreatedAt: timeFromTimestamp(row.CreatedAt),
UpdatedAt: timeFromTimestamp(row.UpdatedAt),
DesktopID: uuidFromPG(row.DesktopID),
JobID: uuidFromPG(row.JobID),
TenantID: row.TenantID,
WorkspaceID: row.WorkspaceID,
TargetAccountID: uuidFromPG(row.TargetAccountID),
TargetClientID: uuidFromPG(row.TargetClientID),
Platform: row.PlatformID,
Kind: row.Kind,
Payload: row.Payload,
Status: row.Status,
Priority: int(row.Priority),
Lane: row.Lane,
LaneWeight: int(row.LaneWeight),
Source: row.Source,
SchedulerGroupKey: nullableText(row.SchedulerGroupKey),
MonitorTaskID: nullableInt64(row.MonitorTaskID),
SupersedesTaskID: nullableUUID(row.SupersedesTaskID),
ControlFlags: row.ControlFlags,
InterruptGeneration: int(row.InterruptGeneration),
DedupKey: nullableText(row.DedupKey),
ActiveAttemptID: nullableUUID(row.ActiveAttemptID),
LeaseExpiresAt: optionalTime(row.LeaseExpiresAt),
Attempts: int(row.Attempts),
Result: row.Result,
Error: row.Error,
StartedAt: optionalTime(row.StartedAt),
InterruptedAt: optionalTime(row.InterruptedAt),
InterruptReason: nullableText(row.InterruptReason),
EnqueuedAt: timeFromTimestamp(row.EnqueuedAt),
CreatedAt: timeFromTimestamp(row.CreatedAt),
UpdatedAt: timeFromTimestamp(row.UpdatedAt),
}
}