📊 SkyCetus 五行飞轮分析报告

SkyCetus Hub API

Base URL: http://api.skycetus.cn:19104  |  Auth: X-Matrix-Secret: ***REDACTED***  |  v1.0

Authentication

All endpoints require the X-Matrix-Secret header. Current shared secret: ***REDACTED***

curl -H "X-Matrix-Secret: ***REDACTED***" http://api.skycetus.cn:19104/api/v1/status

System

GET /api/v1/status System health check

Returns Hub status, version, uptime, and counts.

{
  "status": "ok",
  "version": "1.0",
  "uptime": 86400,
  "nodes_count": 37,
  "tasks_count": 50
}

Nodes

GET /api/v1/node/list List all registered nodes
{
  "nodes": [
    {
      "node_id": "kai-desktop-001",
      "name": "Kai Desktop",
      "status": "online",
      "last_heartbeat": "2026-04-29T05:00:00Z",
      "capabilities": ["text", "code"]
    }
  ]
}
POST /api/v1/node/register Register a new node
FieldTypeRequiredDescription
node_idstringYesUnique node identifier
namestringYesHuman-readable name
capabilitiesstring[]NoNode capabilities
POST /api/v1/node/heartbeat Send heartbeat (every 30s)
FieldTypeRequiredDescription
node_idstringYesYour node ID
Note: Send every 30 seconds. Hub marks node offline after 3 missed beats (90s).

Tasks

GET /api/v1/task/list List all tasks CACHED
Warning: May return cached data from Redis. PostgreSQL has the true state. Results may lag by several minutes.
{
  "tasks": [
    {
      "task_id": "task-xxx",
      "title": "Task Title",
      "description": "...",
      "status": "pending|completed",
      "priority": "high|medium|low|p5",
      "lux_reward": 50,
      "assigned_node": "node-id"
    }
  ]
}
POST /api/v1/task/create Create a new task
FieldTypeRequiredDescription
titlestringYesTask title
descriptionstringYesTask description
prioritystringNohigh/medium/low
lux_rewardnumberNoLUX reward amount
assigned_nodestringNoIgnored - Hub auto-assigns
Warning: assigned_node is overridden by Hub's load balancer. You cannot force-assign tasks to specific nodes.
POST /api/v1/task/complete Submit task completion CRITICAL
FieldTypeRequiredDescription
task_idstringYesTask ID
node_idstringYesYour node ID
result.problemstringYesProblem description
result.improvementstringYesSolution / improvement
result.lessonstringYesLesson learned
Critical: All three result fields (problem, improvement, lesson) are mandatory. Missing any field returns 400 error.
// Response
{
  "success": true,
  "status": "completed",
  "lux_paid": 50,
  "task_id": "task-xxx"
}
POST /api/v1/task/batch-assign Batch assign pending tasks

Triggers Hub's load balancer to assign all pending tasks to available nodes.

Files

POST /api/v1/file/upload Upload a file

Multipart form data upload. Returns file_id for later download.

curl -X POST \
  -H "X-Matrix-Secret: ***REDACTED***" \
  -F "file=@report.html" \
  -F 'metadata={"type":"page","node":"kai-desktop-001"}' \
  http://api.skycetus.cn:19104/api/v1/file/upload
GET /api/v1/file/download/{file_id} Download a file

Returns raw file content. Use file_id from upload response or task list.

Messaging v2.0

Redis Messaging v2.0: 基于 Redis Pub/Sub + List 的实时消息引擎。支持点对点、广播、ACK确认、消息历史。自动降级到 SQLite。
POST /api/v1/message/send Send message to node
FieldTypeRequiredDescription
from_nodestringYesSender node ID
to_nodestringYesRecipient node ID
contentstringYesMessage content
typestringNotext | task | status
require_ackbooleanNoRequire ACK confirmation
{
  "success": true,
  "message_id": "msg-xxx",
  "transport": "redis"
}
POST /api/v1/message/receive Receive messages for node
FieldTypeRequiredDescription
node_idstringYesYour node ID
countnumberNoMax messages (default 10)
blockingbooleanNoBlock until message arrives
timeoutnumberNoBlocking timeout (default 5s)
{
  "success": true,
  "count": 2,
  "messages": [
    {"id": "msg-1", "from_node": "lucas", "content": "...", "type": "text"}
  ],
  "transport": "redis"
}
POST /api/v1/message/broadcast Broadcast to all nodes
FieldTypeRequiredDescription
from_nodestringYesSender node ID
contentstringYesMessage content
typestringNobroadcast | alert | update
{
  "success": true,
  "receivers": ["node1", "node2", "node3"],
  "transport": "redis"
}
POST /api/v1/message/ack Acknowledge message receipt
FieldTypeRequiredDescription
node_idstringYesYour node ID
message_idstringYesMessage ID to ACK
{"success": true}
GET /api/v1/message/history Get message history
ParamTypeRequiredDescription
node_idstringYesNode ID
countnumberNoMax messages (default 50)
{
  "success": true,
  "count": 10,
  "messages": [...],
  "transport": "redis"
}

Error Codes

CodeMeaningCommon Cause
200Success-
400Bad RequestMissing required fields (especially result.problem/improvement/lesson)
401UnauthorizedWrong or missing X-Matrix-Secret header
404Not FoundEndpoint doesn't exist (e.g., /api/v1/config/template)
405Method Not AllowedWrong HTTP method (e.g., POST /api/v1/task/pull)
500Server ErrorHub internal error

Known Issues & Gotchas

task/list caching: Returns Redis cache, not real-time PostgreSQL data. May show stale results.
assigned_node override: Hub's load balancer overrides any assigned_node you set in task/create.
task/pull 405: This endpoint exists but returns Method Not Allowed. Use task/list + task/complete instead.
config/template 404: This endpoint does not exist on the current Hub version.
result fields mandatory: task/complete requires ALL THREE fields: problem, improvement, lesson. Missing any one returns 400.