feat: Worker Registration System - #7
Merged
Merged
Conversation
- Add in-memory worker registry with heartbeat tracking - Add POST/GET /api/workers (register + list + dispatch) - Add GET/PATCH/DELETE /api/workers/[id] (status, heartbeat, remove) - Add /workers portal page with live status, auto-refresh - Add standalone worker agent (worker/src/index.ts) - Add Workers nav item to sidebar - API key auth between portal and workers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Worker Registration System 🖥️
ClickUp task: 86e0yp09t
Allow local machines to register as workers for n8n task dispatch. Workers connect to the portal, send heartbeats, and receive tasks via HTTP.
What's included
Portal (6 files)
lib/workers.ts— In-memory worker registry with heartbeat tracking (60s timeout), LRU-based task dispatch, API key authapi/workers/route.ts—GET(list workers + summary) /POST(register or dispatch task)api/workers/[id]/route.ts—GET/PATCH(heartbeat, status update) /DELETE(remove)(dashboard)/workers/page.tsx— Live worker dashboard with 10s auto-refresh, status cards (🟢 idle / 🟡 busy / 🔴 offline), capabilities badges, quick-start guideSidebar.tsx— Workers 🖥️ nav itemconfig.ts—workerApiKeyfrom envStandalone Worker Agent (4 files)
worker/src/index.ts— Node.js agent: auto-register with portal, 30s heartbeat loop, HTTP server on:9800for task dispatch, graceful shutdown with auto-deregisterworker/package.json—@teamflow/workerwith tsxworker/tsconfig.json— ES2022, NodeNextworker/.env.example— Configuration referenceArchitecture
How to test
Next up