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:
@@ -0,0 +1,18 @@
|
||||
DROP INDEX IF EXISTS uq_desktop_tasks_monitor_active;
|
||||
DROP INDEX IF EXISTS idx_desktop_tasks_monitor_task;
|
||||
DROP INDEX IF EXISTS idx_desktop_tasks_target_client_lane;
|
||||
|
||||
ALTER TABLE desktop_tasks
|
||||
DROP COLUMN IF EXISTS enqueued_at,
|
||||
DROP COLUMN IF EXISTS interrupt_reason,
|
||||
DROP COLUMN IF EXISTS interrupted_at,
|
||||
DROP COLUMN IF EXISTS started_at,
|
||||
DROP COLUMN IF EXISTS interrupt_generation,
|
||||
DROP COLUMN IF EXISTS control_flags,
|
||||
DROP COLUMN IF EXISTS supersedes_task_id,
|
||||
DROP COLUMN IF EXISTS monitor_task_id,
|
||||
DROP COLUMN IF EXISTS scheduler_group_key,
|
||||
DROP COLUMN IF EXISTS source,
|
||||
DROP COLUMN IF EXISTS lane_weight,
|
||||
DROP COLUMN IF EXISTS lane,
|
||||
DROP COLUMN IF EXISTS priority;
|
||||
@@ -0,0 +1,57 @@
|
||||
ALTER TABLE desktop_tasks
|
||||
ADD COLUMN IF NOT EXISTS priority INT NOT NULL DEFAULT 12000,
|
||||
ADD COLUMN IF NOT EXISTS lane VARCHAR(20) NOT NULL DEFAULT 'normal',
|
||||
ADD COLUMN IF NOT EXISTS lane_weight INT NOT NULL DEFAULT 80,
|
||||
ADD COLUMN IF NOT EXISTS source VARCHAR(20) NOT NULL DEFAULT 'manual',
|
||||
ADD COLUMN IF NOT EXISTS scheduler_group_key VARCHAR(120),
|
||||
ADD COLUMN IF NOT EXISTS monitor_task_id BIGINT,
|
||||
ADD COLUMN IF NOT EXISTS supersedes_task_id UUID,
|
||||
ADD COLUMN IF NOT EXISTS control_flags JSONB NOT NULL DEFAULT '{}'::jsonb,
|
||||
ADD COLUMN IF NOT EXISTS interrupt_generation INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS started_at TIMESTAMPTZ,
|
||||
ADD COLUMN IF NOT EXISTS interrupted_at TIMESTAMPTZ,
|
||||
ADD COLUMN IF NOT EXISTS interrupt_reason VARCHAR(64),
|
||||
ADD COLUMN IF NOT EXISTS enqueued_at TIMESTAMPTZ NOT NULL DEFAULT NOW();
|
||||
|
||||
UPDATE desktop_tasks
|
||||
SET priority = CASE
|
||||
WHEN kind = 'monitor' AND status = 'queued' THEN 100
|
||||
WHEN kind = 'monitor' THEN 100
|
||||
ELSE 12000
|
||||
END,
|
||||
lane = CASE
|
||||
WHEN kind = 'monitor' THEN 'normal'
|
||||
ELSE 'normal'
|
||||
END,
|
||||
lane_weight = CASE
|
||||
WHEN kind = 'monitor' THEN 40
|
||||
ELSE 80
|
||||
END,
|
||||
source = CASE
|
||||
WHEN kind = 'monitor' THEN 'daily_schedule'
|
||||
ELSE 'manual'
|
||||
END,
|
||||
control_flags = COALESCE(control_flags, '{}'::jsonb),
|
||||
enqueued_at = COALESCE(enqueued_at, created_at, NOW()),
|
||||
updated_at = NOW()
|
||||
WHERE kind IN ('publish', 'monitor');
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_desktop_tasks_target_client_lane
|
||||
ON desktop_tasks (
|
||||
target_client_id,
|
||||
status,
|
||||
lane_weight DESC,
|
||||
priority DESC,
|
||||
enqueued_at ASC
|
||||
)
|
||||
WHERE status IN ('queued', 'in_progress', 'unknown');
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_desktop_tasks_monitor_task
|
||||
ON desktop_tasks (monitor_task_id, status, created_at DESC)
|
||||
WHERE kind = 'monitor' AND monitor_task_id IS NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uq_desktop_tasks_monitor_active
|
||||
ON desktop_tasks (monitor_task_id)
|
||||
WHERE kind = 'monitor'
|
||||
AND monitor_task_id IS NOT NULL
|
||||
AND status IN ('queued', 'in_progress', 'unknown');
|
||||
Reference in New Issue
Block a user