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
@@ -8,6 +8,19 @@ import (
"github.com/jackc/pgx/v5/pgtype"
)
type AiPlatform struct {
ID int64 `json:"id"`
AiPlatformID string `json:"ai_platform_id"`
Name string `json:"name"`
ShortName string `json:"short_name"`
AccentColor string `json:"accent_color"`
LoginUrl pgtype.Text `json:"login_url"`
Status string `json:"status"`
SortOrder int32 `json:"sort_order"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type Article struct {
ID int64 `json:"id"`
TenantID int64 `json:"tenant_id"`
@@ -150,26 +163,39 @@ type DesktopPublishJob struct {
}
type DesktopTask struct {
ID int64 `json:"id"`
DesktopID pgtype.UUID `json:"desktop_id"`
JobID pgtype.UUID `json:"job_id"`
TenantID int64 `json:"tenant_id"`
WorkspaceID int64 `json:"workspace_id"`
TargetAccountID pgtype.UUID `json:"target_account_id"`
TargetClientID pgtype.UUID `json:"target_client_id"`
PlatformID string `json:"platform_id"`
Kind string `json:"kind"`
Payload []byte `json:"payload"`
Status string `json:"status"`
DedupKey pgtype.Text `json:"dedup_key"`
ActiveAttemptID pgtype.UUID `json:"active_attempt_id"`
LeaseTokenHash []byte `json:"lease_token_hash"`
LeaseExpiresAt pgtype.Timestamptz `json:"lease_expires_at"`
Attempts int32 `json:"attempts"`
Result []byte `json:"result"`
Error []byte `json:"error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
ID int64 `json:"id"`
DesktopID pgtype.UUID `json:"desktop_id"`
JobID pgtype.UUID `json:"job_id"`
TenantID int64 `json:"tenant_id"`
WorkspaceID int64 `json:"workspace_id"`
TargetAccountID pgtype.UUID `json:"target_account_id"`
TargetClientID pgtype.UUID `json:"target_client_id"`
PlatformID string `json:"platform_id"`
Kind string `json:"kind"`
Payload []byte `json:"payload"`
Status string `json:"status"`
DedupKey pgtype.Text `json:"dedup_key"`
ActiveAttemptID pgtype.UUID `json:"active_attempt_id"`
LeaseTokenHash []byte `json:"lease_token_hash"`
LeaseExpiresAt pgtype.Timestamptz `json:"lease_expires_at"`
Attempts int32 `json:"attempts"`
Result []byte `json:"result"`
Error []byte `json:"error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
Priority int32 `json:"priority"`
Lane string `json:"lane"`
LaneWeight int32 `json:"lane_weight"`
Source string `json:"source"`
SchedulerGroupKey pgtype.Text `json:"scheduler_group_key"`
MonitorTaskID pgtype.Int8 `json:"monitor_task_id"`
SupersedesTaskID pgtype.UUID `json:"supersedes_task_id"`
ControlFlags []byte `json:"control_flags"`
InterruptGeneration int32 `json:"interrupt_generation"`
StartedAt pgtype.Timestamptz `json:"started_at"`
InterruptedAt pgtype.Timestamptz `json:"interrupted_at"`
InterruptReason pgtype.Text `json:"interrupt_reason"`
EnqueuedAt pgtype.Timestamptz `json:"enqueued_at"`
}
type DesktopTaskAttempt struct {