Przeglądaj źródła

feat: add node configuration and provider management UI and docs

jerry 2 miesięcy temu
rodzic
commit
cda29f1cfb

+ 2 - 3
.env.local

@@ -1,4 +1,3 @@
 # .env.local
-# 如果你的后端在本地运行,通常是 http://127.0.0.1:8000
-# 如果已经部署到服务器,填写服务器地址,如 https://api.text.skin.com
-NEXT_PUBLIC_API_URL=https://api.text.skin
+# 本地运行后端开发环境
+NEXT_PUBLIC_API_URL=http://127.0.0.1:8888

+ 577 - 0
docs/node_configuration.md

@@ -0,0 +1,577 @@
+# 前端开发 API 接口文档:Provider 模板与 Node Configuration
+
+本文档为 Coordinate 管理系统的前端接口规范,包含 **服务商模板管理(Provider)** 与 **节点任务配置管理(Node Configuration: booker / sentinel / standalone)** 的所有接口定义、字段说明及 JSON 示例。
+
+---
+
+## 0. 通用约定
+
+- **Base URL**: `/api` (例如 `http://127.0.0.1:8888/api`)
+- **请求头**: 除公共登录接口外,所有请求均须携带 Bearer Token:
+  ```http
+  Authorization: Bearer <token>
+  Content-Type: application/json
+  ```
+- **统一响应格式**:
+  ```json
+  {
+    "code": 0,
+    "message": "success",
+    "data": {}
+  }
+  ```
+  - `code === 0` 表示请求成功;
+  - `code !== 0` 表示业务异常,此时 `message` 包含人类可读的错误提示信息。
+
+### 业务错误码
+
+| code | HTTP 状态 | 说明 |
+| :--- | :--- | :--- |
+| `0` | 200 | 成功 |
+| `40000` | 400 | 参数校验失败 / 掩码占位符拦截 / 删除最后一条未确认 |
+| `40101` | 401 | 未登录或 Token 无效/已过期 |
+| `40301` | 403 | 权限不足 (非管理员) |
+| `40400` | 404 | 目标资源不存在 |
+| `40900` | 409 | Provider 名称已被占用 |
+| `40902` | 409 | 标识符冲突 (同节点下 `node_id + identifier` 已存在) |
+| `42200` | 422 | 请求 Body 结构或数据类型非法 |
+
+---
+
+## 1. Provider 服务商模板接口
+
+### 1.1 获取服务商目录列表
+- **接口路径**: `GET /api/providers`
+- **Query 参数**:
+  - `enabled_only` (*boolean*, 可选, 默认 `false`): 设为 `true` 时仅返回已启用的服务商(适用于向导新建下拉框)。
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "success",
+  "data": [
+    {
+      "id": 1,
+      "name": "vfs",
+      "enabled": 1,
+      "plugin_config": {
+        "lib_path": "plugins",
+        "plugin_name": "vfs_plugin",
+        "plugin_bin": "vfs_plugin.py",
+        "plugin_proto": "IVSPlg"
+      },
+      "role_templates": {
+        "booker": {
+          "proxy_cd": 300,
+          "session_max_life": 1800,
+          "booker.account_cd": 10800,
+          "booker.target_instances": 1
+        },
+        "sentinel": {
+          "sentinel.signal_ttl": 30,
+          "sentinel.query_wait.mode": "Random"
+        }
+      },
+      "version": 1,
+      "updated_by": "admin",
+      "created_at": "2026-08-23T20:00:00",
+      "updated_at": "2026-08-23T20:00:00"
+    }
+  ]
+}
+```
+
+---
+
+### 1.2 获取服务商详情
+- **接口路径**: `GET /api/providers/{name}`
+- **Path 参数**:
+  - `name` (*string*, 必填): 服务商唯一标识/名称(如 `vfs`, `tls`, `bls`)。
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "success",
+  "data": {
+    "id": 1,
+    "name": "vfs",
+    "enabled": 1,
+    "plugin_config": {
+      "lib_path": "plugins",
+      "plugin_name": "vfs_plugin",
+      "plugin_bin": "vfs_plugin.py",
+      "plugin_proto": "IVSPlg"
+    },
+    "role_templates": {
+      "booker": {
+        "proxy_cd": 300,
+        "session_max_life": 1800,
+        "booker.account_cd": 10800
+      },
+      "sentinel": {
+        "sentinel.signal_ttl": 30
+      }
+    },
+    "version": 1,
+    "updated_by": "admin",
+    "created_at": "2026-08-23T20:00:00",
+    "updated_at": "2026-08-23T20:00:00"
+  }
+}
+```
+
+---
+
+### 1.3 新建服务商模板
+- **接口路径**: `POST /api/providers`
+- **Body 参数**:
+  - `name` (*string*, 必填): 服务商唯一标识/名称(如 `vfs`, `tls`, `bls` 等)。
+  - `enabled` (*boolean*, 可选, 默认 `true`): 是否启用。
+  - `plugin_config` (*object*, 可选): 默认插件加载配置。
+  - `role_templates` (*object*, 可选): 角色配置模板(键仅允许 `sentinel` / `booker` / `standalone`,值为点路径平铺字典)。
+
+**请求示例**:
+```json
+{
+  "name": "tls",
+  "enabled": true,
+  "plugin_config": {
+    "lib_path": "plugins",
+    "plugin_name": "tls_plugin",
+    "plugin_bin": "tls_plugin.py",
+    "plugin_proto": "IVSPlg"
+  },
+  "role_templates": {
+    "standalone": {
+      "login_interval": 1800,
+      "session_max_life": 3600
+    }
+  }
+}
+```
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "Provider created successfully",
+  "data": {
+    "id": 2,
+    "name": "tls",
+    "enabled": 1,
+    "plugin_config": { ... },
+    "role_templates": { ... },
+    "version": 1,
+    "updated_by": "admin",
+    "created_at": "2026-08-23T20:05:00",
+    "updated_at": "2026-08-23T20:05:00"
+  }
+}
+```
+
+---
+
+### 1.4 编辑服务商模板
+- **接口路径**: `PUT /api/providers/{name}`
+- **Body 参数**(支持稀疏更新,Body 中不传 `name`):
+  - `enabled` (*boolean*, 可选): 启用状态。
+  - `plugin_config` (*object*, 可选): 插件配置对象。
+  - `role_templates` (*object*, 可选): 角色配置模板(覆盖更新)。
+
+**请求示例**:
+```json
+{
+  "enabled": true,
+  "plugin_config": {
+    "lib_path": "plugins",
+    "plugin_name": "tls_plugin_v2",
+    "plugin_bin": "tls_plugin.py",
+    "plugin_proto": "IVSPlg"
+  }
+}
+```
+
+**响应示例 (`code: 0`)**: 返回更新后的 Provider 完整对象。
+
+---
+
+### 1.5 删除服务商模板
+- **接口路径**: `DELETE /api/providers/{name}`
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "Provider deleted successfully",
+  "data": true
+}
+```
+
+---
+
+## 2. Node Configuration 节点任务配置接口
+
+> **`entry_type` 说明**: 所有端点中的 `{entry_type}` 统一取值为:
+> - `booker` (Booker 占位/出票角色)
+> - `sentinel` (Sentinel 监控/扫位角色)
+> - `standalone` (Standalone 独立一体化抢签任务)
+
+---
+
+### 2.1 分页查询配置列表
+- **接口路径**: `GET /api/node-configurations/{entry_type}`
+- **Query 参数**:
+  - `page` (*integer*, 可选, 默认 `1`): 页码。
+  - `pageSize` (*integer*, 可选, 默认 `20`): 每页条数(最大 100)。
+  - `identifier` (*string*, 可选): 任务标识模糊搜索(如 `vfs`)。
+  - `node_id` (*string*, 可选): 节点唯一标识精确搜索(如 `node01`)。
+  - `order_id` (*string*, 可选, 仅 `standalone` 有效): 关联订单 ID 精确搜索。
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "success",
+  "data": {
+    "total": 1,
+    "page": 1,
+    "page_size": 20,
+    "items": [
+      {
+        "id": 101,
+        "node_id": "node01",
+        "identifier": "vfs.ie.nl",
+        "enable": 0,
+        "debug": 0,
+        "need_account": 1,
+        "need_proxy": 1,
+        "proxy_pool": ["proxy-cheap"],
+        "proxy_cd": 300,
+        "session_max_life": 1800,
+        "active_time_start": "00:00",
+        "active_time_end": "23:59",
+        "website": "https://visa.vfsglobal.com/irl/en/nld/login",
+        "booker": {
+          "account_source": "built-in",
+          "account_pool_id": "ie.nl.booker",
+          "account_cd": 10800,
+          "target_instances": 1
+        },
+        "plugin_config": {
+          "lib_path": "plugins",
+          "plugin_name": "vfs_plugin",
+          "plugin_bin": "vfs_plugin.py",
+          "plugin_proto": "IVSPlg"
+        },
+        "appointment_types": [
+          {
+            "weight": 10,
+            "routing_key": "slot.dub.nl.tourist",
+            "city": "Dublin",
+            "visa_type": "Tourist",
+            "country": "Netherlands"
+          }
+        ],
+        "free_config": {
+          "mission_code": "nld",
+          "country_code": "irl"
+        },
+        "version": 1,
+        "updated_by": "admin",
+        "created_at": "2026-08-23T20:10:00",
+        "updated_at": "2026-08-23T20:10:00"
+      }
+    ]
+  }
+}
+```
+
+---
+
+### 2.2 获取配置详情
+- **接口路径**: `GET /api/node-configurations/{entry_type}/{entry_id}`
+- **Path 参数**:
+  - `entry_type` (*string*, 必填): `booker` | `sentinel` | `standalone`
+  - `entry_id` (*integer*, 必填): 配置条目主键 ID
+
+**响应示例 (`code: 0`)**: 返回该配置条目的全字段对象。
+
+---
+
+### 2.3 新建配置条目
+- **接口路径**: `POST /api/node-configurations/{entry_type}`
+- **重要规则**: **新建条目一律以停用状态落库 (`enable = 0`)**;同一节点下 `(node_id, identifier)` 冲突时返回 `40902`。
+
+#### A. Booker 角色请求 Body 示例:
+```json
+{
+  "node_id": "node01",
+  "identifier": "vfs.ie.nl",
+  "website": "https://visa.vfsglobal.com/irl/en/nld/login",
+  "need_account": 1,
+  "need_proxy": 1,
+  "proxy_pool": ["proxy-cheap"],
+  "proxy_cd": 300,
+  "session_max_life": 1800,
+  "active_time_start": "00:00",
+  "active_time_end": "23:59",
+  "booker": {
+    "account_source": "built-in",
+    "account_pool_id": "ie.nl.booker",
+    "target_instances": 1,
+    "account_cd": 10800,
+    "booking_cooldown": 300,
+    "max_bookings_per_account": 8
+  },
+  "plugin_config": {
+    "lib_path": "plugins",
+    "plugin_name": "vfs_plugin",
+    "plugin_bin": "vfs_plugin.py",
+    "plugin_proto": "IVSPlg"
+  },
+  "appointment_types": [
+    {
+      "weight": 10,
+      "routing_key": "slot.dub.nl.tourist",
+      "city": "Dublin",
+      "visa_type": "Tourist",
+      "country": "Netherlands"
+    }
+  ],
+  "free_config": {
+    "mission_code": "nld",
+    "country_code": "irl"
+  }
+}
+```
+
+#### B. Sentinel 角色请求 Body 示例:
+```json
+{
+  "node_id": "node01",
+  "identifier": "vfs.ie.nl",
+  "website": "https://visa.vfsglobal.com/irl/en/nld/login",
+  "sentinel": {
+    "account_source": "built-in",
+    "account_pool_id": "ie.nl.sentinel",
+    "target_instances": 1,
+    "signal_ttl": 30,
+    "query_wait": {
+      "mode": "Random",
+      "fixed_wait": 10,
+      "random_min": 60,
+      "random_max": 300
+    }
+  },
+  "plugin_config": { ... },
+  "appointment_types": [ ... ],
+  "free_config": { ... }
+}
+```
+
+#### C. Standalone 角色请求 Body 示例:
+```json
+{
+  "node_id": "node01",
+  "order_id": "ORD-20260823-001",
+  "identifier": "tls.shanghai.fr",
+  "account": {
+    "username": "user@example.com",
+    "password": "Password123"
+  },
+  "proxy_pool": ["proxy-cheap"],
+  "query_wait": {
+    "mode": "Random",
+    "fixed_wait": 10,
+    "random_min": 55,
+    "random_max": 65
+  },
+  "login_interval": 1800,
+  "session_max_life": 3600,
+  "user_preferences": {
+    "support_pta": false,
+    "expected_start_date": "2026-09-01",
+    "expected_end_date": "2026-09-20"
+  },
+  "plugin_config": { ... },
+  "appointment_types": [ ... ],
+  "free_config": { ... }
+}
+```
+
+**响应示例 (`code: 0`)**: 返回新生成的配置对象(初始 `enable: 0`, `version: 1`)。
+
+---
+
+### 2.4 稀疏更新配置 (Sparse Update)
+- **接口路径**: `PUT /api/node-configurations/{entry_type}/{entry_id}`
+- **说明**:
+  - `set`:支持顶级字段(如 `proxy_cd`)与多层 JSON 点路径更新(如 `booker.account_cd`、`sentinel.query_wait.random_min`)。
+  - `clear`:显式将字段清空重置为默认空值(如 `website` 重置为空串、`account` 重置为空对象)。
+  - 成功更新后自动写入修订历史链,`version` 版本号自增 +1。
+
+**请求示例**:
+```json
+{
+  "set": {
+    "proxy_cd": 600,
+    "booker.account_cd": 9000,
+    "booker.target_instances": 2
+  },
+  "clear": [
+    "website"
+  ]
+}
+```
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "Node configuration updated successfully",
+  "data": {
+    "id": 101,
+    "node_id": "node01",
+    "identifier": "vfs.ie.nl",
+    "proxy_cd": 600,
+    "website": "",
+    "booker": {
+      "account_source": "built-in",
+      "account_pool_id": "ie.nl.booker",
+      "account_cd": 9000,
+      "target_instances": 2
+    },
+    "version": 2,
+    "updated_by": "admin",
+    "created_at": "2026-08-23T20:10:00",
+    "updated_at": "2026-08-23T20:15:00"
+  }
+}
+```
+
+---
+
+### 2.5 启用 / 停用配置 (Enable / Disable)
+- **接口路径**: `PUT /api/node-configurations/{entry_type}/{entry_id}/enable`
+- **Body 参数**:
+  - `enable` (*boolean*, 必填): `true` 为启用 (`1`),`false` 为停用 (`0`)。
+
+**请求示例**:
+```json
+{
+  "enable": true
+}
+```
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "Node configuration status toggled",
+  "data": {
+    "id": 101,
+    "enable": 1,
+    "version": 3,
+    "updated_by": "admin",
+    ...
+  }
+}
+```
+
+---
+
+### 2.6 删除配置条目
+- **接口路径**: `DELETE /api/node-configurations/{entry_type}/{entry_id}`
+- **Query 参数**:
+  - `confirm_purge` (*boolean*, 可选, 默认 `false`): **删除保护守卫**。当当前角色的配置在数据库中**仅剩最后 1 条**时,若不传 `confirm_purge=true` 会拦截并返回 `40000`(提示需二次确认);有多条数据时可直接删除。
+
+**请求示例**:
+```http
+DELETE /api/node-configurations/booker/101?confirm_purge=true
+```
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "Node configuration deleted successfully",
+  "data": true
+}
+```
+
+---
+
+### 2.7 查询配置修订历史记录 (Revisions)
+- **接口路径**: `GET /api/node-configurations/{entry_type}/{entry_id}/revisions`
+- **说明**: 每次新建、修改、启停或回滚都会自动保留完整快照。按时间倒序排列。
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "success",
+  "data": [
+    {
+      "id": 15,
+      "entry_type": "booker",
+      "entry_id": 101,
+      "version": 3,
+      "action": "enable",
+      "snapshot": { ... },
+      "updated_by": "admin",
+      "created_at": "2026-08-23T20:20:00"
+    },
+    {
+      "id": 14,
+      "entry_type": "booker",
+      "entry_id": 101,
+      "version": 2,
+      "action": "update",
+      "snapshot": { ... },
+      "updated_by": "admin",
+      "created_at": "2026-08-23T20:15:00"
+    },
+    {
+      "id": 13,
+      "entry_type": "booker",
+      "entry_id": 101,
+      "version": 1,
+      "action": "create",
+      "snapshot": { ... },
+      "updated_by": "admin",
+      "created_at": "2026-08-23T20:10:00"
+    }
+  ]
+}
+```
+
+---
+
+### 2.8 回滚配置至指定历史版本 (Rollback)
+- **接口路径**: `POST /api/node-configurations/{entry_type}/{entry_id}/rollback`
+- **Body 参数**:
+  - `revision_id` (*integer*, 必填): 目标历史快照的 ID(来自 2.7 节)。
+
+**请求示例**:
+```json
+{
+  "revision_id": 13
+}
+```
+
+**响应示例 (`code: 0`)**:
+```json
+{
+  "code": 0,
+  "message": "Node configuration rolled back successfully",
+  "data": {
+    "id": 101,
+    "enable": 0,
+    "version": 4,
+    "updated_by": "admin",
+    ...
+  }
+}
+```

+ 528 - 0
src/app/admin/node-configurations/page.tsx

@@ -0,0 +1,528 @@
+// src/app/admin/node-configurations/page.tsx
+
+'use client';
+
+import React, { useState, useEffect, useCallback } from 'react';
+import {
+  RefreshCw,
+  Search,
+} from 'lucide-react';
+import { toast } from 'react-hot-toast';
+import {
+  NodeConfigEntryType,
+  ProviderItem,
+  NodeConfigurationItem,
+  NodeRuntimeStatus,
+} from '@/types';
+import { providerService } from '@/lib/services/providerService';
+import { nodeConfigService } from '@/lib/services/nodeConfigService';
+import { retroConfirm } from '@/lib/dialog';
+
+import ProviderTable from '@/components/admin/node-configurations/ProviderTable';
+import ProviderModal from '@/components/admin/node-configurations/ProviderModal';
+import NodeConfigTable from '@/components/admin/node-configurations/NodeConfigTable';
+import NodeConfigCreateWizardModal from '@/components/admin/node-configurations/NodeConfigCreateWizardModal';
+import NodeConfigEditModal from '@/components/admin/node-configurations/NodeConfigEditModal';
+import NodeConfigCloneModal from '@/components/admin/node-configurations/NodeConfigCloneModal';
+import NodeConfigDetailDrawer from '@/components/admin/node-configurations/NodeConfigDetailDrawer';
+import NodeClusterTelemetryBar from '@/components/admin/node-configurations/NodeClusterTelemetryBar';
+import LivePluginInstancesModal from '@/components/admin/node-configurations/LivePluginInstancesModal';
+
+type ActiveTabType = 'provider' | NodeConfigEntryType;
+
+export default function NodeConfigurationsPage() {
+  const [activeTab, setActiveTab] = useState<ActiveTabType>('provider');
+
+  // Provider state
+  const [providers, setProviders] = useState<ProviderItem[]>([]);
+  const [loadingProviders, setLoadingProviders] = useState(false);
+  const [isProviderModalOpen, setIsProviderModalOpen] = useState(false);
+  const [editingProvider, setEditingProvider] = useState<ProviderItem | null>(null);
+
+  // Node config state
+  const [configs, setConfigs] = useState<NodeConfigurationItem[]>([]);
+  const [loadingConfigs, setLoadingConfigs] = useState(false);
+  const [total, setTotal] = useState(0);
+  const [page, setPage] = useState(1);
+  const [pageSize, setPageSize] = useState(20);
+
+  // Realtime Telemetry state
+  const [runtimeNodes, setRuntimeNodes] = useState<NodeRuntimeStatus[]>([]);
+  const [loadingTelemetry, setLoadingTelemetry] = useState(false);
+  const [autoRefreshTelemetry, setAutoRefreshTelemetry] = useState(true);
+  const [lastTelemetryTime, setLastTelemetryTime] = useState<string>('');
+
+  // Live Instances Modal state
+  const [isInstancesModalOpen, setIsInstancesModalOpen] = useState(false);
+  const [instancesFilterNodeId, setInstancesFilterNodeId] = useState<string>('');
+  const [instancesFilterGroupId, setInstancesFilterGroupId] = useState<string>('');
+
+  // Filter params
+  const [identifierFilter, setIdentifierFilter] = useState('');
+  const [nodeIdFilter, setNodeIdFilter] = useState('');
+  const [orderIdFilter, setOrderIdFilter] = useState('');
+
+  // Modals & Drawers
+  const [isCreateWizardOpen, setIsCreateWizardOpen] = useState(false);
+  const [isEditModalOpen, setIsEditModalOpen] = useState(false);
+  const [editingConfig, setEditingConfig] = useState<NodeConfigurationItem | null>(null);
+  const [isCloneModalOpen, setIsCloneModalOpen] = useState(false);
+  const [cloningConfig, setCloningConfig] = useState<NodeConfigurationItem | null>(null);
+  const [isDetailDrawerOpen, setIsDetailDrawerOpen] = useState(false);
+  const [selectedConfig, setSelectedConfig] = useState<NodeConfigurationItem | null>(null);
+  const [drawerDefaultTab, setDrawerDefaultTab] = useState<'overview' | 'revisions'>('overview');
+
+  // Load Providers
+  const fetchProviders = useCallback(async () => {
+    setLoadingProviders(true);
+    try {
+      const res = await providerService.getList();
+      if (res.code === 0 && res.data) {
+        setProviders(Array.isArray(res.data) ? res.data : []);
+      } else {
+        setProviders([]);
+      }
+    } catch (e: any) {
+      console.error('Failed to fetch providers:', e);
+      toast.error('获取服务商模板失败: ' + (e?.response?.data?.message || e.message || '未知错误'));
+      setProviders([]);
+    } finally {
+      setLoadingProviders(false);
+    }
+  }, []);
+
+  // Load Node Configurations
+  const fetchNodeConfigs = useCallback(
+    async (entryType: NodeConfigEntryType) => {
+      setLoadingConfigs(true);
+      try {
+        const res = await nodeConfigService.getList(entryType, {
+          page,
+          pageSize,
+          identifier: identifierFilter.trim() || undefined,
+          node_id: nodeIdFilter.trim() || undefined,
+          order_id: entryType === 'standalone' ? orderIdFilter.trim() || undefined : undefined,
+        });
+
+        if (res.code === 0 && res.data) {
+          setConfigs(res.data.items || []);
+          setTotal(res.data.total || 0);
+        } else {
+          setConfigs([]);
+          setTotal(0);
+        }
+      } catch (e: any) {
+        console.error('Failed to fetch node configs:', e);
+        toast.error(`获取 ${entryType.toUpperCase()} 配置失败: ` + (e?.response?.data?.message || e.message || '未知错误'));
+        setConfigs([]);
+        setTotal(0);
+      } finally {
+        setLoadingConfigs(false);
+      }
+    },
+    [page, pageSize, identifierFilter, nodeIdFilter, orderIdFilter]
+  );
+
+  // Load Telemetry from Redis
+  const fetchTelemetry = useCallback(async () => {
+    setLoadingTelemetry(true);
+    try {
+      const res = await nodeConfigService.getRuntimeStatus();
+      if (res.code === 0 && res.data) {
+        setRuntimeNodes(res.data.nodes || []);
+        setLastTelemetryTime(res.data.timestamp || new Date().toLocaleTimeString());
+      }
+    } catch (e) {
+      console.error('Failed to fetch runtime telemetry:', e);
+    } finally {
+      setLoadingTelemetry(false);
+    }
+  }, []);
+
+  useEffect(() => {
+    fetchTelemetry();
+    if (!autoRefreshTelemetry) return;
+    const timer = setInterval(() => {
+      fetchTelemetry();
+    }, 5000);
+    return () => clearInterval(timer);
+  }, [autoRefreshTelemetry, fetchTelemetry]);
+
+  useEffect(() => {
+    if (activeTab === 'provider') {
+      fetchProviders();
+    } else {
+      fetchNodeConfigs(activeTab);
+    }
+  }, [activeTab, fetchProviders, fetchNodeConfigs]);
+
+  const handleTabChange = (newTab: ActiveTabType) => {
+    setActiveTab(newTab);
+    setPage(1);
+  };
+
+  const handleRefresh = () => {
+    if (activeTab === 'provider') {
+      fetchProviders();
+    } else {
+      fetchNodeConfigs(activeTab);
+    }
+  };
+
+  const handleOpenCreateProvider = () => {
+    setEditingProvider(null);
+    setIsProviderModalOpen(true);
+  };
+
+  const handleEditProvider = (provider: ProviderItem) => {
+    setEditingProvider(provider);
+    setIsProviderModalOpen(true);
+  };
+
+  const handleDeleteProvider = async (provider: ProviderItem) => {
+    const ok = await retroConfirm({
+      title: '[ CONFIRM DELETE PROVIDER // 删除服务商模板 ]',
+      message: `确定要删除服务商模板 [${provider.name}] 吗?依赖此模板的新建任务将无法自动继承其配置。`,
+      type: 'danger',
+    });
+
+    if (!ok) return;
+
+    try {
+      const res = await providerService.delete(provider.name);
+      if (res.code === 0) {
+        toast.success(`服务商模板 [${provider.name}] 已删除`);
+        fetchProviders();
+      } else {
+        toast.error(res.message || '删除失败');
+      }
+    } catch (err: any) {
+      console.error('Delete provider error:', err);
+      toast.error(err?.response?.data?.message || err.message || '删除异常');
+    }
+  };
+
+  const handleOpenCreateConfig = () => {
+    setIsCreateWizardOpen(true);
+  };
+
+  const handleOpenEditConfig = (item: NodeConfigurationItem) => {
+    setEditingConfig(item);
+    setIsEditModalOpen(true);
+  };
+
+  const handleOpenCloneConfig = (item: NodeConfigurationItem) => {
+    setCloningConfig(item);
+    setIsCloneModalOpen(true);
+  };
+
+  const handleOpenInstancesModal = (nodeId?: string, groupId?: string) => {
+    setInstancesFilterNodeId(nodeId || '');
+    setInstancesFilterGroupId(groupId || '');
+    setIsInstancesModalOpen(true);
+  };
+
+  const handleOpenDetailDrawer = (
+    item: NodeConfigurationItem,
+    defaultTab: 'overview' | 'revisions' = 'overview'
+  ) => {
+    setSelectedConfig(item);
+    setDrawerDefaultTab(defaultTab);
+    setIsDetailDrawerOpen(true);
+  };
+
+  const totalPages = Math.ceil(total / pageSize) || 1;
+
+  return (
+    <div className="space-y-6 font-mono">
+      {/* 顶部标头 (Industrial Ops Header Banner) */}
+      <div className="bg-neutral-100 border-2 border-black p-6 shadow-[6px_6px_0px_#000] flex flex-col md:flex-row md:items-center justify-between gap-4">
+        <div>
+          <div className="text-[10px] font-bold text-neutral-500 uppercase tracking-widest">
+            [ NODE-CLUSTER-CONFIGS // 节点任务与服务商中枢 ]
+          </div>
+          <h1 className="text-xl sm:text-2xl font-black text-black uppercase mt-1">
+            节点集群与服务商配置中心
+          </h1>
+          <p className="text-xs text-neutral-600 font-sans mt-0.5">
+            统一管理服务商 (Provider) 模板中枢与 Booker / Sentinel / Standalone 节点任务调度与修订历史链。
+          </p>
+        </div>
+
+        {/* 顶部右侧主要操作 */}
+        <div className="flex flex-wrap items-center gap-2">
+          <button
+            onClick={() => {
+              handleRefresh();
+              fetchTelemetry();
+            }}
+            disabled={loadingProviders || loadingConfigs || loadingTelemetry}
+            className="p-2 bg-neutral-50 hover:bg-neutral-200 border-2 border-black text-black transition shadow-[2px_2px_0px_#000]"
+            title="刷新配置与遥测数据"
+          >
+            <RefreshCw size={14} className={loadingProviders || loadingConfigs || loadingTelemetry ? 'animate-spin' : ''} />
+          </button>
+
+          {activeTab === 'provider' ? (
+            <button
+              onClick={handleOpenCreateProvider}
+              className="px-4 py-2 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5"
+            >
+              [ + 新建服务商模板 ]
+            </button>
+          ) : (
+            <button
+              onClick={handleOpenCreateConfig}
+              className="px-4 py-2 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5"
+            >
+              [ + 新建 {activeTab.toUpperCase()} 任务 ]
+            </button>
+          )}
+        </div>
+      </div>
+
+      {/* 节点集群实时状态监控看板 (Cluster Telemetry Bar) */}
+      <NodeClusterTelemetryBar
+        nodes={runtimeNodes}
+        loading={loadingTelemetry}
+        autoRefresh={autoRefreshTelemetry}
+        onToggleAutoRefresh={() => setAutoRefreshTelemetry(!autoRefreshTelemetry)}
+        onRefresh={fetchTelemetry}
+        onInspectInstances={handleOpenInstancesModal}
+        lastUpdatedTime={lastTelemetryTime}
+      />
+
+      {/* 顶部 Tab 栏 (Retro Brutalist Tabs) */}
+      <div className="flex flex-wrap gap-2">
+        <button
+          type="button"
+          onClick={() => handleTabChange('provider')}
+          className={`px-4 py-2 border-2 border-black text-xs font-mono uppercase transition shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 ${
+            activeTab === 'provider'
+              ? 'bg-amber-300 text-black font-black'
+              : 'bg-white text-neutral-800 font-bold hover:bg-neutral-100'
+          }`}
+        >
+          [ 服务商模板 PROVIDER ({providers.length}) ]
+        </button>
+
+        <button
+          type="button"
+          onClick={() => handleTabChange('booker')}
+          className={`px-4 py-2 border-2 border-black text-xs font-mono uppercase transition shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 ${
+            activeTab === 'booker'
+              ? 'bg-amber-300 text-black font-black'
+              : 'bg-white text-neutral-800 font-bold hover:bg-neutral-100'
+          }`}
+        >
+          [ BOOKER 占位任务 {activeTab === 'booker' ? `(${total})` : ''} ]
+        </button>
+
+        <button
+          type="button"
+          onClick={() => handleTabChange('sentinel')}
+          className={`px-4 py-2 border-2 border-black text-xs font-mono uppercase transition shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 ${
+            activeTab === 'sentinel'
+              ? 'bg-amber-300 text-black font-black'
+              : 'bg-white text-neutral-800 font-bold hover:bg-neutral-100'
+          }`}
+        >
+          [ SENTINEL 监控任务 {activeTab === 'sentinel' ? `(${total})` : ''} ]
+        </button>
+
+        <button
+          type="button"
+          onClick={() => handleTabChange('standalone')}
+          className={`px-4 py-2 border-2 border-black text-xs font-mono uppercase transition shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 ${
+            activeTab === 'standalone'
+              ? 'bg-amber-300 text-black font-black'
+              : 'bg-white text-neutral-800 font-bold hover:bg-neutral-100'
+          }`}
+        >
+          [ STANDALONE 独立任务 {activeTab === 'standalone' ? `(${total})` : ''} ]
+        </button>
+      </div>
+
+      {/* 搜索与过滤栏 (Filter Bar) */}
+      {activeTab !== 'provider' && (
+        <div className="bg-neutral-100 border-2 border-black p-4 shadow-[4px_4px_0px_#000] flex flex-wrap items-center gap-3">
+          <div className="flex-1 min-w-[200px] relative">
+            <input
+              type="text"
+              placeholder="🔍 模糊搜索任务标识 (identifier)..."
+              value={identifierFilter}
+              onChange={(e) => {
+                setIdentifierFilter(e.target.value);
+                setPage(1);
+              }}
+              className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+            />
+          </div>
+
+          <div className="w-52">
+            <input
+              type="text"
+              placeholder="精确节点 ID (node_id)..."
+              value={nodeIdFilter}
+              onChange={(e) => {
+                setNodeIdFilter(e.target.value);
+                setPage(1);
+              }}
+              className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+            />
+          </div>
+
+          {activeTab === 'standalone' && (
+            <div className="w-52">
+              <input
+                type="text"
+                placeholder="关联订单 ID (order_id)..."
+                value={orderIdFilter}
+                onChange={(e) => {
+                  setOrderIdFilter(e.target.value);
+                  setPage(1);
+                }}
+                className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+              />
+            </div>
+          )}
+
+          {(identifierFilter || nodeIdFilter || orderIdFilter) && (
+            <button
+              type="button"
+              onClick={() => {
+                setIdentifierFilter('');
+                setNodeIdFilter('');
+                setOrderIdFilter('');
+                setPage(1);
+              }}
+              className="px-3 py-2 bg-white hover:bg-neutral-200 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+            >
+              [ 清空筛选 ]
+            </button>
+          )}
+        </div>
+      )}
+
+      {/* 主视图内容 */}
+      {activeTab === 'provider' ? (
+        <ProviderTable
+          data={providers}
+          loading={loadingProviders}
+          onEdit={handleEditProvider}
+          onDelete={handleDeleteProvider}
+        />
+      ) : (
+        <div className="space-y-4">
+          <NodeConfigTable
+            entryType={activeTab}
+            data={configs}
+            loading={loadingConfigs}
+            runtimeNodes={runtimeNodes}
+            onViewDetails={handleOpenDetailDrawer}
+            onEdit={handleOpenEditConfig}
+            onClone={handleOpenCloneConfig}
+            onInspectInstances={handleOpenInstancesModal}
+            onRefresh={handleRefresh}
+          />
+
+          {/* 分页组件 (Pagination Spec) */}
+          {total > pageSize && (
+            <div className="flex items-center justify-between border-2 border-black bg-neutral-100 px-4 py-2.5 font-mono text-xs shadow-[2px_2px_0px_#000] mt-4">
+              <div className="text-neutral-700 font-bold">
+                显示第 <span className="font-mono text-black font-black">{(page - 1) * pageSize + 1}</span> 至{' '}
+                <span className="font-mono text-black font-black">{Math.min(page * pageSize, total)}</span> 条,共{' '}
+                <span className="font-mono text-black font-black">{total}</span> 条
+              </div>
+
+              <div className="flex items-center gap-1">
+                <button
+                  type="button"
+                  disabled={page <= 1}
+                  onClick={() => setPage((p) => Math.max(1, p - 1))}
+                  className="px-2.5 py-1 bg-white hover:bg-neutral-200 border border-black font-bold uppercase shadow-[1px_1px_0px_#000] disabled:opacity-40"
+                >
+                  [ 上一页 ]
+                </button>
+                <span className="px-2.5 py-1 bg-amber-300 border border-black font-black uppercase shadow-[1px_1px_0px_#000]">
+                  {page} / {totalPages}
+                </span>
+                <button
+                  type="button"
+                  disabled={page >= totalPages}
+                  onClick={() => setPage((p) => Math.min(totalPages, p + 1))}
+                  className="px-2.5 py-1 bg-white hover:bg-neutral-200 border border-black font-bold uppercase shadow-[1px_1px_0px_#000] disabled:opacity-40"
+                >
+                  [ 下一页 ]
+                </button>
+              </div>
+            </div>
+          )}
+        </div>
+      )}
+
+      {/* Provider Create/Edit Modal */}
+      <ProviderModal
+        isOpen={isProviderModalOpen}
+        onClose={() => setIsProviderModalOpen(false)}
+        provider={editingProvider}
+        onSuccess={fetchProviders}
+      />
+
+      {/* Node Config 3-Step Wizard Modal */}
+      {activeTab !== 'provider' && (
+        <NodeConfigCreateWizardModal
+          isOpen={isCreateWizardOpen}
+          onClose={() => setIsCreateWizardOpen(false)}
+          entryType={activeTab}
+          onSuccess={handleRefresh}
+        />
+      )}
+
+      {/* Node Config Edit Modal */}
+      {activeTab !== 'provider' && (
+        <NodeConfigEditModal
+          isOpen={isEditModalOpen}
+          onClose={() => setIsEditModalOpen(false)}
+          entryType={activeTab}
+          config={editingConfig}
+          onSuccess={handleRefresh}
+        />
+      )}
+
+      {/* Node Config Clone Modal */}
+      {activeTab !== 'provider' && (
+        <NodeConfigCloneModal
+          isOpen={isCloneModalOpen}
+          onClose={() => setIsCloneModalOpen(false)}
+          entryType={activeTab}
+          sourceConfig={cloningConfig}
+          onSuccess={handleRefresh}
+        />
+      )}
+
+      {/* Node Config Detail & Revisions Drawer */}
+      {activeTab !== 'provider' && (
+        <NodeConfigDetailDrawer
+          isOpen={isDetailDrawerOpen}
+          onClose={() => setIsDetailDrawerOpen(false)}
+          entryType={activeTab}
+          config={selectedConfig}
+          defaultTab={drawerDefaultTab}
+          runtimeNodes={runtimeNodes}
+          onSuccess={handleRefresh}
+        />
+      )}
+
+      {/* Live Plugin Instances Modal */}
+      <LivePluginInstancesModal
+        isOpen={isInstancesModalOpen}
+        onClose={() => setIsInstancesModalOpen(false)}
+        nodes={runtimeNodes}
+        initialNodeIdFilter={instancesFilterNodeId}
+        initialGroupIdFilter={instancesFilterGroupId}
+        onRefresh={fetchTelemetry}
+      />
+    </div>
+  );
+}

+ 2 - 1
src/components/admin/AdminSidebar.tsx

@@ -8,7 +8,7 @@ import {
   LayoutDashboard, ShoppingBag, LifeBuoy, Settings, LogOut, 
   Activity, CreditCard, Users, ChevronLeft, ChevronRight, 
   Plane, LucideIcon,
-  Menu, X, UserCog, Network, SlidersHorizontal, Puzzle
+  Menu, X, UserCog, Network, SlidersHorizontal, Puzzle, Cpu
 } from 'lucide-react';
 
 interface MenuItem {
@@ -33,6 +33,7 @@ export default function AdminSidebar() {
     { name: '支付通道配置', href: '/admin/payments', icon: CreditCard },
     { name: '签证服务商品', href: '/admin/products', icon: Settings },
     { name: '动态环境变量', href: '/admin/configurations', icon: SlidersHorizontal },
+    { name: '节点集群配置', href: '/admin/node-configurations', icon: Cpu },
     { name: '云端插件中枢', href: '/admin/plugins', icon: Puzzle },
     { name: '自动化任务队列', href: '/admin/tasks', icon: Activity },
     { name: '使馆账号池管理', href: '/admin/accounts', icon: UserCog },

+ 141 - 0
src/components/admin/node-configurations/AppointmentTypeEditor.tsx

@@ -0,0 +1,141 @@
+// src/components/admin/node-configurations/AppointmentTypeEditor.tsx
+
+'use client';
+
+import React from 'react';
+import { Plus, Trash2 } from 'lucide-react';
+import { AppointmentTypeItem } from '@/types';
+
+interface AppointmentTypeEditorProps {
+  items: AppointmentTypeItem[];
+  onChange: (items: AppointmentTypeItem[]) => void;
+  disabled?: boolean;
+}
+
+export default function AppointmentTypeEditor({
+  items = [],
+  onChange,
+  disabled = false,
+}: AppointmentTypeEditorProps) {
+  const handleAdd = () => {
+    const newItem: AppointmentTypeItem = {
+      routing_key: '',
+      city: '',
+      visa_type: '',
+      country: '',
+      weight: 10,
+    };
+    onChange([...items, newItem]);
+  };
+
+  const handleRemove = (index: number) => {
+    const updated = items.filter((_, i) => i !== index);
+    onChange(updated);
+  };
+
+  const handleFieldChange = (index: number, field: keyof AppointmentTypeItem, value: any) => {
+    const updated = [...items];
+    updated[index] = {
+      ...updated[index],
+      [field]: field === 'weight' ? (value === '' ? undefined : Number(value)) : value,
+    };
+    onChange(updated);
+  };
+
+  return (
+    <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] font-mono space-y-3">
+      {/* Header */}
+      <div className="flex items-center justify-between border-b-2 border-black pb-2">
+        <div className="flex items-center gap-2">
+          <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+          <span className="text-xs font-black text-black uppercase">
+            [ APPOINTMENT TYPES // 预约类型规则列表 ({items.length}) ]
+          </span>
+        </div>
+
+        {!disabled && (
+          <button
+            type="button"
+            onClick={handleAdd}
+            className="flex items-center gap-1 px-3 py-1 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5"
+          >
+            <Plus className="w-3.5 h-3.5" />
+            <span>[ + 添加规则 ]</span>
+          </button>
+        )}
+      </div>
+
+      {/* Rules List */}
+      {items.length === 0 ? (
+        <div className="p-4 border-2 border-dashed border-neutral-400 bg-white text-center text-xs font-bold text-neutral-500">
+          暂无预约类型规则,请点击上方按钮添加
+        </div>
+      ) : (
+        <div className="space-y-2 max-h-64 overflow-y-auto pr-1">
+          {items.map((item, idx) => (
+            <div
+              key={idx}
+              className="p-2.5 bg-white border-2 border-black shadow-[2px_2px_0px_#000] grid grid-cols-12 gap-2 items-center"
+            >
+              <div className="col-span-1 text-[11px] font-black text-black text-center bg-neutral-200 border border-black py-1">
+                #{idx + 1}
+              </div>
+              <div className="col-span-4">
+                <input
+                  type="text"
+                  placeholder="routing_key (必填,如 slot.dub.nl)"
+                  value={item.routing_key || ''}
+                  onChange={(e) => handleFieldChange(idx, 'routing_key', e.target.value)}
+                  disabled={disabled}
+                  className="w-full px-2 py-1 bg-neutral-50 focus:bg-white border-2 border-black text-xs font-mono text-black placeholder:text-neutral-400 outline-none shadow-[1px_1px_0px_#000]"
+                />
+              </div>
+              <div className="col-span-2">
+                <input
+                  type="text"
+                  placeholder="城市 (City)"
+                  value={item.city || ''}
+                  onChange={(e) => handleFieldChange(idx, 'city', e.target.value)}
+                  disabled={disabled}
+                  className="w-full px-2 py-1 bg-neutral-50 focus:bg-white border-2 border-black text-xs font-mono text-black placeholder:text-neutral-400 outline-none shadow-[1px_1px_0px_#000]"
+                />
+              </div>
+              <div className="col-span-2">
+                <input
+                  type="text"
+                  placeholder="签证类型 (Visa)"
+                  value={item.visa_type || ''}
+                  onChange={(e) => handleFieldChange(idx, 'visa_type', e.target.value)}
+                  disabled={disabled}
+                  className="w-full px-2 py-1 bg-neutral-50 focus:bg-white border-2 border-black text-xs font-mono text-black placeholder:text-neutral-400 outline-none shadow-[1px_1px_0px_#000]"
+                />
+              </div>
+              <div className="col-span-2">
+                <input
+                  type="number"
+                  placeholder="权重 (Weight)"
+                  value={item.weight ?? ''}
+                  onChange={(e) => handleFieldChange(idx, 'weight', e.target.value)}
+                  disabled={disabled}
+                  className="w-full px-2 py-1 bg-neutral-50 focus:bg-white border-2 border-black text-xs font-mono text-black placeholder:text-neutral-400 outline-none shadow-[1px_1px_0px_#000]"
+                />
+              </div>
+              <div className="col-span-1 text-center">
+                {!disabled && (
+                  <button
+                    type="button"
+                    onClick={() => handleRemove(idx)}
+                    className="p-1 bg-rose-100 hover:bg-rose-200 border border-black text-rose-950 shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                    title="删除此规则"
+                  >
+                    <Trash2 className="w-3.5 h-3.5" />
+                  </button>
+                )}
+              </div>
+            </div>
+          ))}
+        </div>
+      )}
+    </div>
+  );
+}

+ 469 - 0
src/components/admin/node-configurations/LivePluginInstancesModal.tsx

@@ -0,0 +1,469 @@
+// src/components/admin/node-configurations/LivePluginInstancesModal.tsx
+
+'use client';
+
+import React, { useState, useMemo } from 'react';
+import {
+  Activity,
+  Server,
+  Search,
+  ExternalLink,
+  Copy,
+  Check,
+  Filter,
+} from 'lucide-react';
+import { toast } from 'react-hot-toast';
+import {
+  NodeRuntimeStatus,
+  RuntimeGroupStatus,
+  RuntimePluginInstance,
+} from '@/types';
+
+interface FlattenedInstance extends RuntimePluginInstance {
+  node_id: string;
+  role: string;
+  group_id: string;
+  group_enable: boolean;
+  plugin_name: string;
+  wrapper_state: string;
+  group_updated_at: string;
+  collected_at: string;
+  is_node_online: boolean;
+}
+
+interface LivePluginInstancesModalProps {
+  isOpen: boolean;
+  onClose: () => void;
+  nodes: NodeRuntimeStatus[];
+  initialNodeIdFilter?: string;
+  initialGroupIdFilter?: string;
+  onRefresh?: () => void;
+}
+
+export default function LivePluginInstancesModal({
+  isOpen,
+  onClose,
+  nodes,
+  initialNodeIdFilter = '',
+  initialGroupIdFilter = '',
+  onRefresh,
+}: LivePluginInstancesModalProps) {
+  const [selectedNodeFilter, setSelectedNodeFilter] = useState(initialNodeIdFilter);
+  const [selectedGroupFilter, setSelectedGroupFilter] = useState(initialGroupIdFilter);
+  const [healthFilter, setHealthFilter] = useState<'all' | 'healthy' | 'unhealthy'>('all');
+  const [keyword, setKeyword] = useState('');
+  const [copiedId, setCopiedId] = useState<string | null>(null);
+  const [inspectingJsonInstance, setInspectingJsonInstance] = useState<FlattenedInstance | null>(null);
+
+  // Flatten all instances across all nodes & groups
+  const allInstances: FlattenedInstance[] = useMemo(() => {
+    const list: FlattenedInstance[] = [];
+    nodes.forEach((node) => {
+      node.groups?.forEach((group) => {
+        group.plugins?.forEach((inst) => {
+          list.push({
+            ...inst,
+            node_id: node.node_id,
+            role: node.role,
+            group_id: group.group_id,
+            group_enable: group.enable,
+            plugin_name: group.plugin_name,
+            wrapper_state: group.wrapper_state,
+            group_updated_at: group.updated_at,
+            collected_at: node.collected_at,
+            is_node_online: node.is_online,
+          });
+        });
+      });
+    });
+    return list;
+  }, [nodes]);
+
+  // Unique node IDs and group IDs for filter dropdowns
+  const uniqueNodes = useMemo(() => Array.from(new Set(nodes.map((n) => n.node_id))), [nodes]);
+  const uniqueGroups = useMemo(
+    () => Array.from(new Set(allInstances.map((i) => i.group_id))),
+    [allInstances]
+  );
+
+  // Filtered instances
+  const filteredInstances = useMemo(() => {
+    return allInstances.filter((inst) => {
+      if (selectedNodeFilter && inst.node_id !== selectedNodeFilter) return false;
+      if (selectedGroupFilter && inst.group_id !== selectedGroupFilter) return false;
+      if (healthFilter === 'healthy' && !inst.is_healthy) return false;
+      if (healthFilter === 'unhealthy' && inst.is_healthy) return false;
+
+      if (keyword.trim()) {
+        const q = keyword.trim().toLowerCase();
+        const matchInstId = inst.instance_id?.toLowerCase().includes(q);
+        const matchAccount = inst.account?.toLowerCase().includes(q);
+        const matchProxy = inst.proxy?.toLowerCase().includes(q);
+        const matchState = inst.state?.toLowerCase().includes(q);
+        const matchPlugin = inst.plugin_name?.toLowerCase().includes(q);
+        const matchGroup = inst.group_id?.toLowerCase().includes(q);
+        const matchUrl = inst.current_url?.toLowerCase().includes(q);
+        if (!matchInstId && !matchAccount && !matchProxy && !matchState && !matchPlugin && !matchGroup && !matchUrl) {
+          return false;
+        }
+      }
+
+      return true;
+    });
+  }, [allInstances, selectedNodeFilter, selectedGroupFilter, healthFilter, keyword]);
+
+  if (!isOpen) return null;
+
+  const handleCopy = (text: string, id: string) => {
+    navigator.clipboard.writeText(text);
+    setCopiedId(id);
+    toast.success('已复制');
+    setTimeout(() => setCopiedId(null), 1500);
+  };
+
+  return (
+    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-3 md:p-6 font-mono">
+      <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-6xl max-h-[92vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-150">
+        {/* Header */}
+        <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
+          <div className="flex items-center gap-2.5">
+            <span className="w-3 h-3 bg-amber-300 border border-black inline-block animate-pulse" />
+            <div>
+              <div className="flex items-center gap-2">
+                <h3 className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
+                  [ LIVE PLUGIN INSTANCES // 运行中插件并发实例监控 ]
+                </h3>
+                <span className="px-1.5 py-0.2 border border-black bg-white text-[10px] font-bold">
+                  共 {allInstances.length} 个实例上报 ({filteredInstances.length} 匹配)
+                </span>
+              </div>
+              <div className="text-[10px] text-neutral-600 font-bold mt-0.5">
+                数据源: groups[].plugins // 实时捕获各计算节点正在运行的插件状态
+              </div>
+            </div>
+          </div>
+
+          <div className="flex items-center gap-2">
+            {onRefresh && (
+              <button
+                type="button"
+                onClick={onRefresh}
+                className="px-2.5 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[10px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase"
+              >
+                [ 立即同步 ]
+              </button>
+            )}
+            <button
+              type="button"
+              onClick={onClose}
+              className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+            >
+              ✕
+            </button>
+          </div>
+        </div>
+
+        {/* Filter Bar */}
+        <div className="p-3.5 bg-neutral-100 border-b-2 border-black flex flex-wrap items-center gap-2.5 text-xs shrink-0">
+          {/* Keyword Search */}
+          <div className="flex-1 min-w-[200px] relative">
+            <input
+              type="text"
+              value={keyword}
+              onChange={(e) => setKeyword(e.target.value)}
+              placeholder="🔍 搜索实例ID / 账号 / 代理 / URL / 状态..."
+              className="w-full px-3 py-1.5 border-2 border-black bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+            />
+          </div>
+
+          {/* Node Filter */}
+          <div className="w-36">
+            <select
+              value={selectedNodeFilter}
+              onChange={(e) => setSelectedNodeFilter(e.target.value)}
+              className="w-full px-2 py-1.5 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
+            >
+              <option value="">全部节点</option>
+              {uniqueNodes.map((nid) => (
+                <option key={nid} value={nid}>
+                  节点: {nid}
+                </option>
+              ))}
+            </select>
+          </div>
+
+          {/* Group Filter */}
+          <div className="w-40">
+            <select
+              value={selectedGroupFilter}
+              onChange={(e) => setSelectedGroupFilter(e.target.value)}
+              className="w-full px-2 py-1.5 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
+            >
+              <option value="">全部任务组</option>
+              {uniqueGroups.map((gid) => (
+                <option key={gid} value={gid}>
+                  组: {gid}
+                </option>
+              ))}
+            </select>
+          </div>
+
+          {/* Health Filter */}
+          <div className="flex border-2 border-black bg-white p-0.5 gap-1">
+            <button
+              type="button"
+              onClick={() => setHealthFilter('all')}
+              className={`px-2 py-1 text-[10px] font-bold uppercase transition ${
+                healthFilter === 'all'
+                  ? 'bg-amber-300 text-black font-black border border-black shadow-[1px_1px_0px_#000]'
+                  : 'text-neutral-700 hover:bg-neutral-100'
+              }`}
+            >
+              全部 ({allInstances.length})
+            </button>
+            <button
+              type="button"
+              onClick={() => setHealthFilter('healthy')}
+              className={`px-2 py-1 text-[10px] font-bold uppercase transition ${
+                healthFilter === 'healthy'
+                  ? 'bg-emerald-300 text-black font-black border border-black shadow-[1px_1px_0px_#000]'
+                  : 'text-neutral-700 hover:bg-neutral-100'
+              }`}
+            >
+              🟢 仅健康
+            </button>
+            <button
+              type="button"
+              onClick={() => setHealthFilter('unhealthy')}
+              className={`px-2 py-1 text-[10px] font-bold uppercase transition ${
+                healthFilter === 'unhealthy'
+                  ? 'bg-rose-300 text-rose-950 font-black border border-black shadow-[1px_1px_0px_#000]'
+                  : 'text-neutral-700 hover:bg-neutral-100'
+              }`}
+            >
+              🔴 仅异常
+            </button>
+          </div>
+
+          {(keyword || selectedNodeFilter || selectedGroupFilter || healthFilter !== 'all') && (
+            <button
+              type="button"
+              onClick={() => {
+                setKeyword('');
+                setSelectedNodeFilter('');
+                setSelectedGroupFilter('');
+                setHealthFilter('all');
+              }}
+              className="px-2 py-1 bg-white hover:bg-neutral-200 text-black border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000]"
+            >
+              [ 清除筛选 ]
+            </button>
+          )}
+        </div>
+
+        {/* Table Body */}
+        <div className="flex-1 overflow-y-auto p-4 bg-white">
+          {filteredInstances.length === 0 ? (
+            <div className="py-16 text-center text-neutral-500 font-bold border-2 border-dashed border-neutral-300 bg-neutral-50 space-y-2">
+              <Activity className="w-8 h-8 text-neutral-400 mx-auto" />
+              <div>未找到匹配的插件运行实例</div>
+              <p className="text-[11px] text-neutral-400">
+                请确认 Worker 节点已启动并正在持续向 Redis 汇报 <code>vs:status:*:*</code> 遥测数据
+              </p>
+            </div>
+          ) : (
+            <div className="border-2 border-black bg-white shadow-[4px_4px_0px_#000] overflow-hidden">
+              <div className="overflow-x-auto">
+                <table className="w-full text-left text-xs border-collapse font-mono">
+                  <thead>
+                    <tr className="border-b-2 border-black bg-neutral-200 text-black uppercase font-black">
+                      <th className="p-3">实例 ID</th>
+                      <th className="p-3">所属节点 / 角色</th>
+                      <th className="p-3">任务组 / 插件</th>
+                      <th className="p-3">运行状态 (STATE)</th>
+                      <th className="p-3">执行账号 (ACCOUNT)</th>
+                      <th className="p-3">出口代理 (PROXY)</th>
+                      <th className="p-3">会话存活 / 活跃时间</th>
+                      <th className="p-3 text-right">操作</th>
+                    </tr>
+                  </thead>
+                  <tbody className="divide-y-2 divide-black">
+                    {filteredInstances.map((inst, index) => (
+                      <tr key={index} className="hover:bg-amber-50/50 transition">
+                        {/* Instance ID */}
+                        <td className="p-3 font-mono font-black text-black">
+                          <div className="flex items-center gap-1.5">
+                            <span
+                              className={`w-2 h-2 border border-black inline-block ${
+                                inst.is_healthy ? 'bg-emerald-400' : 'bg-rose-400'
+                              }`}
+                            />
+                            <span className="bg-neutral-100 px-1.5 py-0.5 border border-black">
+                              #{inst.instance_id}
+                            </span>
+                          </div>
+                        </td>
+
+                        {/* Node & Role */}
+                        <td className="p-3">
+                          <div className="flex items-center gap-1.5">
+                            <span className="font-bold text-black">{inst.node_id}</span>
+                            <span className="px-1 py-0.2 bg-black text-white text-[10px] font-bold uppercase">
+                              {inst.role}
+                            </span>
+                          </div>
+                        </td>
+
+                        {/* Group & Plugin */}
+                        <td className="p-3">
+                          <div className="flex flex-col gap-0.5">
+                            <span className="font-black text-black">{inst.group_id}</span>
+                            <span className="text-[10px] text-neutral-500 font-bold">
+                              {inst.plugin_name}
+                            </span>
+                          </div>
+                        </td>
+
+                        {/* State & Health */}
+                        <td className="p-3">
+                          <div className="flex flex-col gap-1">
+                            <span
+                              className={`px-2 py-0.5 border border-black text-[10px] font-black uppercase shadow-[1px_1px_0px_#000] w-fit ${
+                                inst.is_healthy
+                                  ? 'bg-emerald-300 text-black'
+                                  : 'bg-rose-200 text-rose-950'
+                              }`}
+                            >
+                              {inst.is_healthy ? '●' : '▲'} [{inst.state || 'running'}]
+                            </span>
+                            <span className="text-[10px] text-neutral-500">
+                              Wrapper: {inst.wrapper_state}
+                            </span>
+                          </div>
+                        </td>
+
+                        {/* Account */}
+                        <td className="p-3 text-black">
+                          {inst.account ? (
+                            <div className="flex items-center gap-1">
+                              <span className="font-mono font-bold max-w-[140px] truncate" title={inst.account}>
+                                {inst.account}
+                              </span>
+                              <button
+                                type="button"
+                                onClick={() => handleCopy(inst.account || '', `acc-${inst.instance_id}`)}
+                                className="text-neutral-400 hover:text-black"
+                                title="复制账号"
+                              >
+                                {copiedId === `acc-${inst.instance_id}` ? (
+                                  <Check className="w-3 h-3 text-emerald-600" />
+                                ) : (
+                                  <Copy className="w-3 h-3" />
+                                )}
+                              </button>
+                            </div>
+                          ) : (
+                            <span className="text-neutral-400">-</span>
+                          )}
+                        </td>
+
+                        {/* Proxy */}
+                        <td className="p-3 text-black">
+                          {inst.proxy ? (
+                            <span className="font-mono text-[11px] font-bold bg-neutral-100 px-1 py-0.5 border border-black">
+                              {inst.proxy}
+                            </span>
+                          ) : (
+                            <span className="text-neutral-400">直连 / 本地</span>
+                          )}
+                        </td>
+
+                        {/* Session & Active Time */}
+                        <td className="p-3">
+                          <div className="flex flex-col gap-0.5 text-[11px]">
+                            <span className="font-bold text-neutral-800">
+                              存活: {inst.session_age_sec !== undefined ? `${inst.session_age_sec}s` : '-'}
+                            </span>
+                            <span className="text-neutral-500 text-[10px]">
+                              {inst.last_active_at ? inst.last_active_at.slice(11) : '-'}
+                            </span>
+                          </div>
+                        </td>
+
+                        {/* Action: JSON snapshot */}
+                        <td className="p-3 text-right">
+                          <button
+                            type="button"
+                            onClick={() => setInspectingJsonInstance(inst)}
+                            className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+                          >
+                            [ 详情 JSON ]
+                          </button>
+                        </td>
+                      </tr>
+                    ))}
+                  </tbody>
+                </table>
+              </div>
+            </div>
+          )}
+        </div>
+
+        {/* Footer */}
+        <div className="px-5 py-3 bg-neutral-200 border-t-2 border-black flex justify-between items-center shrink-0">
+          <div className="text-[11px] text-neutral-600 font-bold">
+            监控来自各计算节点 Redis 实时通道:<code>vs:status:&#123;role&#125;:&#123;node_id&#125;</code>
+          </div>
+          <button
+            type="button"
+            onClick={onClose}
+            className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+          >
+            [ 关闭 ]
+          </button>
+        </div>
+      </div>
+
+      {/* Instance Raw JSON Modal */}
+      {inspectingJsonInstance && (
+        <div className="fixed inset-0 z-[60] flex items-center justify-center bg-black/60 backdrop-grayscale p-4 font-mono">
+          <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-150">
+            <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
+              <div className="flex items-center gap-2">
+                <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+                <h4 className="font-black text-black text-xs uppercase tracking-wider">
+                  [ INSTANCE RAW TELEMETRY // 实例 #{inspectingJsonInstance.instance_id} 快照 ]
+                </h4>
+              </div>
+              <button
+                type="button"
+                onClick={() => setInspectingJsonInstance(null)}
+                className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+              >
+                ✕
+              </button>
+            </div>
+
+            <div className="flex-1 overflow-y-auto p-4 bg-white space-y-3 text-xs">
+              <div className="p-3 bg-neutral-900 border-2 border-black shadow-[4px_4px_0px_#000]">
+                <pre className="text-amber-300 font-mono text-xs overflow-x-auto leading-relaxed max-h-96">
+                  {JSON.stringify(inspectingJsonInstance, null, 2)}
+                </pre>
+              </div>
+            </div>
+
+            <div className="px-5 py-3 bg-neutral-200 border-t-2 border-black flex justify-end shrink-0">
+              <button
+                type="button"
+                onClick={() => setInspectingJsonInstance(null)}
+                className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+              >
+                [ 返回 ]
+              </button>
+            </div>
+          </div>
+        </div>
+      )}
+    </div>
+  );
+}

+ 369 - 0
src/components/admin/node-configurations/NodeClusterTelemetryBar.tsx

@@ -0,0 +1,369 @@
+// src/components/admin/node-configurations/NodeClusterTelemetryBar.tsx
+
+'use client';
+
+import React, { useState } from 'react';
+import {
+  Activity,
+  RefreshCw,
+  Server,
+  Package,
+  Layers,
+  ChevronDown,
+  ChevronUp,
+} from 'lucide-react';
+import {
+  NodeRuntimeStatus,
+  InstalledPluginItem,
+} from '@/types';
+
+interface NodeClusterTelemetryBarProps {
+  nodes: NodeRuntimeStatus[];
+  loading: boolean;
+  autoRefresh: boolean;
+  onToggleAutoRefresh: () => void;
+  onRefresh: () => void;
+  onInspectInstances?: (nodeId?: string, groupId?: string) => void;
+  lastUpdatedTime?: string;
+}
+
+export default function NodeClusterTelemetryBar({
+  nodes,
+  loading,
+  autoRefresh,
+  onToggleAutoRefresh,
+  onRefresh,
+  onInspectInstances,
+  lastUpdatedTime,
+}: NodeClusterTelemetryBarProps) {
+  const [collapsed, setCollapsed] = useState(false);
+  const [inspectingPluginsNode, setInspectingPluginsNode] = useState<NodeRuntimeStatus | null>(null);
+
+  // Compute aggregate stats
+  const totalNodes = nodes.length;
+  const onlineNodes = nodes.filter((n) => n.is_online).length;
+
+  let totalTasks = 0;
+  let healthyTasks = 0;
+  const allPluginNames = new Set<string>();
+
+  nodes.forEach((n) => {
+    n.installed_plugins?.forEach((p) => allPluginNames.add(p.name));
+    n.groups?.forEach((g) => {
+      totalTasks += g.total_tasks || 0;
+      healthyTasks += g.healthy_tasks || 0;
+    });
+  });
+
+  return (
+    <div className="bg-neutral-100 border-2 border-black shadow-[4px_4px_0px_#000] font-mono text-xs overflow-hidden">
+      {/* Telemetry Bar Header */}
+      <div className="px-4 py-3 bg-neutral-200 border-b-2 border-black flex flex-wrap items-center justify-between gap-3 select-none">
+        <div className="flex items-center gap-2.5">
+          <div className="relative flex items-center justify-center">
+            <span
+              className={`w-3 h-3 border border-black inline-block ${
+                onlineNodes > 0 ? 'bg-emerald-400 animate-pulse' : 'bg-rose-400'
+              }`}
+            />
+          </div>
+          <div>
+            <div className="flex items-center gap-2">
+              <span className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
+                [ CLUSTER TELEMETRY // 节点集群实时状态监控 ]
+              </span>
+              <span className="px-1.5 py-0.2 border border-black bg-white text-[10px] font-bold">
+                {onlineNodes}/{totalNodes} 在线
+              </span>
+            </div>
+            <div className="text-[10px] text-neutral-600 font-bold mt-0.5">
+              心跳键 vs:status:*:* | 离线阈值: 60s
+              {lastUpdatedTime && ` | 上次同步: ${lastUpdatedTime}`}
+            </div>
+          </div>
+        </div>
+
+        {/* Controls */}
+        <div className="flex items-center gap-2">
+          {onInspectInstances && (
+            <button
+              type="button"
+              onClick={() => onInspectInstances()}
+              className="px-2.5 py-1 bg-amber-300 hover:bg-amber-400 text-black border border-black text-[11px] font-black uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+              title="查看全集群所有运行中的插件并发实例"
+            >
+              [ ⚡️ 查看运行实例 ({totalTasks}) ]
+            </button>
+          )}
+
+          {/* Auto Refresh Toggle */}
+          <button
+            type="button"
+            onClick={onToggleAutoRefresh}
+            className={`px-2.5 py-1 text-[11px] font-black uppercase border border-black shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition ${
+              autoRefresh
+                ? 'bg-emerald-300 text-emerald-950'
+                : 'bg-white text-neutral-700 hover:bg-neutral-100'
+            }`}
+          >
+            [ 自动轮询: {autoRefresh ? '开启 (5s)' : '已暂停'} ]
+          </button>
+
+          {/* Manual Refresh */}
+          <button
+            type="button"
+            onClick={onRefresh}
+            disabled={loading}
+            className="flex items-center gap-1 px-2.5 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[11px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition disabled:opacity-50 uppercase"
+            title="手动刷新节点遥测"
+          >
+            <RefreshCw className={`w-3 h-3 ${loading ? 'animate-spin' : ''}`} />
+            <span>[ 刷新 ]</span>
+          </button>
+
+          {/* Collapse Toggle */}
+          <button
+            type="button"
+            onClick={() => setCollapsed(!collapsed)}
+            className="p-1 bg-white hover:bg-neutral-100 border border-black shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+            title={collapsed ? '展开监控看板' : '收起监控看板'}
+          >
+            {collapsed ? <ChevronDown className="w-3.5 h-3.5" /> : <ChevronUp className="w-3.5 h-3.5" />}
+          </button>
+        </div>
+      </div>
+
+      {!collapsed && (
+        <div className="p-4 space-y-4 bg-white">
+          {/* Top Metrics Cards */}
+          <div className="grid grid-cols-2 md:grid-cols-4 gap-3">
+            {/* Online Nodes */}
+            <div className="p-3 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-1">
+              <div className="flex items-center justify-between text-neutral-600">
+                <span className="text-[10px] font-bold uppercase">集群上报节点</span>
+                <Server className="w-3.5 h-3.5 text-black" />
+              </div>
+              <div className="flex items-baseline gap-1.5">
+                <span className="text-xl font-black text-black">{onlineNodes}</span>
+                <span className="text-[11px] text-neutral-500 font-bold">/ {totalNodes} 个</span>
+              </div>
+              <div className="text-[10px] text-neutral-500">
+                {onlineNodes === totalNodes && totalNodes > 0
+                  ? '所有节点心跳正常'
+                  : totalNodes === 0
+                  ? '暂无节点上报数据'
+                  : `${totalNodes - onlineNodes} 个节点心跳超时`}
+              </div>
+            </div>
+
+            {/* Live Concurrency / Healthy Tasks */}
+            <div className="p-3 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-1">
+              <div className="flex items-center justify-between text-neutral-600">
+                <span className="text-[10px] font-bold uppercase">活跃并发任务</span>
+                <Activity className="w-3.5 h-3.5 text-black" />
+              </div>
+              <div className="flex items-baseline gap-1.5">
+                <span className="text-xl font-black text-emerald-600">{healthyTasks}</span>
+                <span className="text-[11px] text-neutral-500 font-bold">/ {totalTasks} 实例健康</span>
+              </div>
+              <div className="text-[10px] text-neutral-500">
+                健康度: {totalTasks > 0 ? Math.round((healthyTasks / totalTasks) * 100) : 100}%
+              </div>
+            </div>
+
+            {/* Total Task Groups */}
+            <div className="p-3 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-1">
+              <div className="flex items-center justify-between text-neutral-600">
+                <span className="text-[10px] font-bold uppercase">监控任务组 (Groups)</span>
+                <Layers className="w-3.5 h-3.5 text-black" />
+              </div>
+              <div className="flex items-baseline gap-1.5">
+                <span className="text-xl font-black text-black">
+                  {nodes.reduce((acc, n) => acc + (n.groups?.length || 0), 0)}
+                </span>
+                <span className="text-[11px] text-neutral-500 font-bold">组</span>
+              </div>
+              <div className="text-[10px] text-neutral-500">
+                跨 {totalNodes} 个计算节点
+              </div>
+            </div>
+
+            {/* Cluster Plugins */}
+            <div className="p-3 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-1">
+              <div className="flex items-center justify-between text-neutral-600">
+                <span className="text-[10px] font-bold uppercase">已装载插件种类</span>
+                <Package className="w-3.5 h-3.5 text-black" />
+              </div>
+              <div className="flex items-baseline gap-1.5">
+                <span className="text-xl font-black text-black">{allPluginNames.size}</span>
+                <span className="text-[11px] text-neutral-500 font-bold">种</span>
+              </div>
+              <div className="text-[10px] text-neutral-500">
+                覆盖使馆与签证预约系统
+              </div>
+            </div>
+          </div>
+
+          {/* Node Cards Row */}
+          {nodes.length === 0 ? (
+            <div className="p-4 border-2 border-dashed border-neutral-300 bg-neutral-50 text-center text-neutral-500 font-bold text-xs">
+              ⚠️ 暂未检测到任何正在上报的 Worker 节点(等待 Worker 节点启动并上报 vs:status:*:* 键)
+            </div>
+          ) : (
+            <div className="space-y-2">
+              <div className="font-black text-black uppercase text-[11px] flex items-center justify-between">
+                <span>[ 在线计算节点列表 ({nodes.length}) ]</span>
+                <span className="text-[10px] text-neutral-500 font-normal">点击「插件清单」可查看节点装载详情</span>
+              </div>
+
+              <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
+                {nodes.map((node, idx) => {
+                  const nodeGroups = node.groups || [];
+                  const nodeTotalTasks = nodeGroups.reduce((acc, g) => acc + (g.total_tasks || 0), 0);
+                  const nodeHealthyTasks = nodeGroups.reduce((acc, g) => acc + (g.healthy_tasks || 0), 0);
+
+                  return (
+                    <div
+                      key={idx}
+                      className="p-3 bg-neutral-50 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2"
+                    >
+                      {/* Node Top Row */}
+                      <div className="flex items-center justify-between">
+                        <div className="flex items-center gap-2">
+                          <span
+                            className={`w-2.5 h-2.5 border border-black inline-block ${
+                              node.is_online ? 'bg-emerald-400' : 'bg-neutral-300'
+                            }`}
+                          />
+                          <span className="font-black text-black text-xs uppercase">
+                            {node.node_id}
+                          </span>
+                          <span className="px-1.5 py-0.2 bg-black text-white text-[10px] font-bold uppercase">
+                            {node.role}
+                          </span>
+                        </div>
+
+                        {node.is_online ? (
+                          <span className="px-1.5 py-0.2 border border-black bg-emerald-300 text-black text-[10px] font-black uppercase">
+                            [ ONLINE ]
+                          </span>
+                        ) : (
+                          <span className="px-1.5 py-0.2 border border-black bg-rose-200 text-rose-950 text-[10px] font-bold uppercase">
+                            [ 离线 ({node.age_sec}s) ]
+                          </span>
+                        )}
+                      </div>
+
+                      {/* Node Stats */}
+                      <div className="grid grid-cols-2 gap-2 text-[11px] pt-1 border-t border-black/10">
+                        <div>
+                          <span className="text-neutral-500 block text-[10px]">任务健康度:</span>
+                          <span className="font-bold text-black">
+                            {nodeHealthyTasks} / {nodeTotalTasks} 实例
+                          </span>
+                        </div>
+                        <div>
+                          <span className="text-neutral-500 block text-[10px]">心跳时间:</span>
+                          <span className="font-bold text-neutral-700">
+                            {node.collected_at ? node.collected_at.slice(11) : '-'} ({node.age_sec}s前)
+                          </span>
+                        </div>
+                      </div>
+
+                      {/* Node Actions */}
+                      <div className="pt-1.5 flex items-center justify-between border-t border-black/10">
+                        <span className="text-[10px] text-neutral-500 font-bold">
+                          {node.installed_plugins?.length || 0} 个插件
+                        </span>
+                        <div className="flex items-center gap-1.5">
+                          {onInspectInstances && (
+                            <button
+                              type="button"
+                              onClick={() => onInspectInstances(node.node_id)}
+                              className="px-2 py-0.5 bg-amber-300 hover:bg-amber-400 text-black border border-black text-[10px] font-black shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase"
+                              title="查看此节点运行中的插件实例"
+                            >
+                              [ 实例 ({nodeTotalTasks}) ]
+                            </button>
+                          )}
+                          <button
+                            type="button"
+                            onClick={() => setInspectingPluginsNode(node)}
+                            className="px-2 py-0.5 bg-white hover:bg-neutral-200 text-black border border-black text-[10px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase"
+                          >
+                            [ 插件清单 ]
+                          </button>
+                        </div>
+                      </div>
+                    </div>
+                  );
+                })}
+              </div>
+            </div>
+          )}
+        </div>
+      )}
+
+      {/* Installed Plugins Inspection Modal */}
+      {inspectingPluginsNode && (
+        <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-4 font-mono">
+          <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-150">
+            <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
+              <div className="flex items-center gap-2">
+                <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+                <h3 className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
+                  [ INSTALLED PLUGINS // 节点插件清单: {inspectingPluginsNode.node_id} ({inspectingPluginsNode.role}) ]
+                </h3>
+              </div>
+              <button
+                type="button"
+                onClick={() => setInspectingPluginsNode(null)}
+                className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+              >
+                ✕
+              </button>
+            </div>
+
+            <div className="flex-1 overflow-y-auto p-5 space-y-3 bg-white text-xs">
+              {inspectingPluginsNode.installed_plugins?.length === 0 ? (
+                <div className="p-8 text-center text-neutral-500 font-bold">
+                  该节点未上报已安装插件
+                </div>
+              ) : (
+                <div className="space-y-2.5">
+                  {inspectingPluginsNode.installed_plugins?.map((plugin: InstalledPluginItem, idx: number) => (
+                    <div
+                      key={idx}
+                      className="p-3 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-1"
+                    >
+                      <div className="flex items-center justify-between">
+                        <div className="flex items-center gap-2">
+                          <span className="font-black text-black text-xs">{plugin.name}</span>
+                          <span className="px-1.5 py-0.2 bg-black text-white text-[10px] font-bold">
+                            v{plugin.version}
+                          </span>
+                        </div>
+                        <span className="text-neutral-500 font-mono text-[10px]">{plugin.filename}</span>
+                      </div>
+                      <p className="text-[11px] text-neutral-700 font-sans">{plugin.description}</p>
+                    </div>
+                  ))}
+                </div>
+              )}
+            </div>
+
+            <div className="px-5 py-3 bg-neutral-200 border-t-2 border-black flex justify-end shrink-0">
+              <button
+                type="button"
+                onClick={() => setInspectingPluginsNode(null)}
+                className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+              >
+                [ 关闭 ]
+              </button>
+            </div>
+          </div>
+        </div>
+      )}
+    </div>
+  );
+}

+ 224 - 0
src/components/admin/node-configurations/NodeConfigCloneModal.tsx

@@ -0,0 +1,224 @@
+// src/components/admin/node-configurations/NodeConfigCloneModal.tsx
+
+'use client';
+
+import React, { useState, useEffect } from 'react';
+import { toast } from 'react-hot-toast';
+import {
+  NodeConfigEntryType,
+  NodeConfigurationItem,
+} from '@/types';
+import { nodeConfigService } from '@/lib/services/nodeConfigService';
+
+interface NodeConfigCloneModalProps {
+  isOpen: boolean;
+  onClose: () => void;
+  entryType: NodeConfigEntryType;
+  sourceConfig: NodeConfigurationItem | null;
+  onSuccess: () => void;
+}
+
+export default function NodeConfigCloneModal({
+  isOpen,
+  onClose,
+  entryType,
+  sourceConfig,
+  onSuccess,
+}: NodeConfigCloneModalProps) {
+  const [targetNodeId, setTargetNodeId] = useState('');
+  const [targetIdentifier, setTargetIdentifier] = useState('');
+  const [cloning, setCloning] = useState(false);
+
+  useEffect(() => {
+    if (sourceConfig && isOpen) {
+      setTargetNodeId('');
+      setTargetIdentifier(sourceConfig.identifier || '');
+    }
+  }, [sourceConfig, isOpen]);
+
+  if (!isOpen || !sourceConfig) return null;
+
+  const handleSubmit = async (e: React.FormEvent) => {
+    e.preventDefault();
+
+    const trimmedNodeId = targetNodeId.trim();
+    const trimmedIdentifier = targetIdentifier.trim();
+
+    if (!trimmedNodeId) {
+      toast.error('请输入目标节点 ID (target node_id)');
+      return;
+    }
+
+    if (!trimmedIdentifier) {
+      toast.error('请输入任务唯一标识 (identifier)');
+      return;
+    }
+
+    if (trimmedNodeId === sourceConfig.node_id && trimmedIdentifier === sourceConfig.identifier) {
+      toast.error('目标节点 ID 和任务标识不能与源配置完全相同,否则会发生键冲突');
+      return;
+    }
+
+    setCloning(true);
+    try {
+      // Build complete clone payload from source
+      const payload: Partial<NodeConfigurationItem> = {
+        node_id: trimmedNodeId,
+        identifier: trimmedIdentifier,
+        website: sourceConfig.website,
+        debug: sourceConfig.debug,
+        enable: 0, // Always start disabled
+        need_account: sourceConfig.need_account,
+        need_proxy: sourceConfig.need_proxy,
+        proxy_pool: sourceConfig.proxy_pool,
+        proxy_cd: sourceConfig.proxy_cd,
+        session_max_life: sourceConfig.session_max_life,
+        active_time_start: sourceConfig.active_time_start,
+        active_time_end: sourceConfig.active_time_end,
+        plugin_config: sourceConfig.plugin_config,
+        appointment_types: sourceConfig.appointment_types,
+        free_config: sourceConfig.free_config,
+      };
+
+      if (entryType === 'booker') {
+        payload.booker = sourceConfig.booker;
+      } else if (entryType === 'sentinel') {
+        payload.sentinel = sourceConfig.sentinel;
+      } else if (entryType === 'standalone') {
+        payload.order_id = sourceConfig.order_id;
+        payload.account = sourceConfig.account;
+        payload.query_wait = sourceConfig.query_wait;
+        payload.login_interval = sourceConfig.login_interval;
+        payload.user_preferences = sourceConfig.user_preferences;
+      }
+
+      const res = await nodeConfigService.create(entryType, payload);
+      if (res.code === 0) {
+        toast.success(
+          `已成功将配置克隆至节点 [${trimmedNodeId}] (标识: ${trimmedIdentifier})`
+        );
+        onSuccess();
+        onClose();
+      } else {
+        toast.error(res.message || '克隆失败');
+      }
+    } catch (err: any) {
+      console.error('Clone config error:', err);
+      toast.error(err?.response?.data?.message || err.message || '克隆发生异常');
+    } finally {
+      setCloning(false);
+    }
+  };
+
+  return (
+    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-4 font-mono">
+      <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-lg overflow-hidden animate-in zoom-in-95 duration-150">
+        {/* Header */}
+        <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none">
+          <div className="flex items-center gap-2">
+            <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+            <h3 className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
+              [ CLONE CONFIG TO NODE // 拷贝配置至目标节点 ]
+            </h3>
+          </div>
+
+          <button
+            type="button"
+            onClick={onClose}
+            className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+          >
+            ✕
+          </button>
+        </div>
+
+        {/* Form Body */}
+        <form onSubmit={handleSubmit} className="p-5 space-y-4 bg-white text-xs">
+          {/* Source Info Card */}
+          <div className="p-3.5 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2">
+            <div className="flex items-center gap-2 border-b border-black/20 pb-1">
+              <span className="w-2 h-2 bg-black inline-block" />
+              <span className="font-black text-black uppercase">[ 源配置参数概要 ]</span>
+            </div>
+            <div className="grid grid-cols-2 gap-2 text-[11px]">
+              <div>
+                <span className="text-neutral-500 block text-[10px]">角色类型:</span>
+                <span className="font-bold text-black uppercase">{entryType}</span>
+              </div>
+              <div>
+                <span className="text-neutral-500 block text-[10px]">来源节点 (node_id):</span>
+                <span className="font-bold text-black">{sourceConfig.node_id}</span>
+              </div>
+              <div className="col-span-2">
+                <span className="text-neutral-500 block text-[10px]">任务标识 (identifier):</span>
+                <span className="font-mono font-bold text-black bg-amber-300 px-1 border border-black">
+                  {sourceConfig.identifier}
+                </span>
+              </div>
+            </div>
+          </div>
+
+          {/* Target Node & Identifier Inputs */}
+          <div className="space-y-3">
+            <div>
+              <label className="block text-[11px] font-bold text-black mb-1">
+                目标节点 ID (target node_id) <span className="text-rose-600 font-black">*</span>
+              </label>
+              <input
+                type="text"
+                required
+                autoFocus
+                value={targetNodeId}
+                onChange={(e) => setTargetNodeId(e.target.value)}
+                placeholder="例如: node02, node-hk-01..."
+                className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+              />
+              <span className="text-[10px] text-neutral-500 block mt-0.5">
+                指定要将此配置副本部署到的目标计算节点
+              </span>
+            </div>
+
+            <div>
+              <label className="block text-[11px] font-bold text-black mb-1">
+                任务唯一标识 (identifier) <span className="text-rose-600 font-black">*</span>
+              </label>
+              <input
+                type="text"
+                required
+                value={targetIdentifier}
+                onChange={(e) => setTargetIdentifier(e.target.value)}
+                placeholder="例如: vfs.ie.nl"
+                className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+              />
+              <span className="text-[10px] text-neutral-500 block mt-0.5">
+                默认沿用原标识;同一节点内 identifier 必须唯一
+              </span>
+            </div>
+          </div>
+
+          {/* Notice Box */}
+          <div className="p-2.5 bg-amber-100 border border-black text-[10px] text-amber-950 font-bold">
+            💡 提示:克隆副本将完整复制源配置的使馆网址、账号来源、代理策略与预约规则,并初始化为停用状态 (ENABLE=0),防止非预期运行。
+          </div>
+
+          {/* Footer Actions */}
+          <div className="pt-3 border-t-2 border-black flex justify-end items-center gap-2">
+            <button
+              type="button"
+              onClick={onClose}
+              className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+            >
+              [ 取消 ]
+            </button>
+            <button
+              type="submit"
+              disabled={cloning}
+              className="px-5 py-1.5 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black text-xs font-black uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition disabled:opacity-50"
+            >
+              {cloning ? '[ 克隆中... ]' : '[ 执行克隆并创建 ]'}
+            </button>
+          </div>
+        </form>
+      </div>
+    </div>
+  );
+}

+ 862 - 0
src/components/admin/node-configurations/NodeConfigCreateWizardModal.tsx

@@ -0,0 +1,862 @@
+// src/components/admin/node-configurations/NodeConfigCreateWizardModal.tsx
+
+'use client';
+
+import React, { useState, useEffect } from 'react';
+import { toast } from 'react-hot-toast';
+import {
+  NodeConfigEntryType,
+  ProviderItem,
+  AppointmentTypeItem,
+  PluginConfig,
+  NodeConfigurationItem,
+} from '@/types';
+import { providerService } from '@/lib/services/providerService';
+import { nodeConfigService } from '@/lib/services/nodeConfigService';
+import AppointmentTypeEditor from './AppointmentTypeEditor';
+
+interface NodeConfigCreateWizardModalProps {
+  isOpen: boolean;
+  onClose: () => void;
+  entryType: NodeConfigEntryType;
+  onSuccess: () => void;
+}
+
+export default function NodeConfigCreateWizardModal({
+  isOpen,
+  onClose,
+  entryType,
+  onSuccess,
+}: NodeConfigCreateWizardModalProps) {
+  const [step, setStep] = useState<1 | 2 | 3>(1);
+  const [providers, setProviders] = useState<ProviderItem[]>([]);
+  const [selectedProviderName, setSelectedProviderName] = useState<string>('');
+  const [loadingProviders, setLoadingProviders] = useState(false);
+  const [submitting, setSubmitting] = useState(false);
+
+  // Step 1: Base & Identity
+  const [nodeId, setNodeId] = useState('node01');
+  const [identifier, setIdentifier] = useState('');
+  const [website, setWebsite] = useState('');
+  const [needAccount, setNeedAccount] = useState(1);
+  const [needProxy, setNeedProxy] = useState(1);
+  const [proxyPoolStr, setProxyPoolStr] = useState('proxy-cheap');
+  const [proxyCd, setProxyCd] = useState(300);
+  const [sessionMaxLife, setSessionMaxLife] = useState(1800);
+  const [activeTimeStart, setActiveTimeStart] = useState('00:00');
+  const [activeTimeEnd, setActiveTimeEnd] = useState('23:59');
+
+  // Standalone specifics
+  const [orderId, setOrderId] = useState('');
+  const [accountUsername, setAccountUsername] = useState('');
+  const [accountPassword, setAccountPassword] = useState('');
+  const [supportPta, setSupportPta] = useState(false);
+  const [expectedStartDate, setExpectedStartDate] = useState('');
+  const [expectedEndDate, setExpectedEndDate] = useState('');
+  const [loginInterval, setLoginInterval] = useState(1800);
+
+  // Booker specifics
+  const [bookerAccountSource, setBookerAccountSource] = useState('built-in');
+  const [bookerAccountPoolId, setBookerAccountPoolId] = useState('');
+  const [bookerTargetInstances, setBookerTargetInstances] = useState(1);
+  const [bookerAccountCd, setBookerAccountCd] = useState(10800);
+  const [bookerCooldown, setBookerCooldown] = useState(300);
+  const [bookerMaxBookings, setBookerMaxBookings] = useState(8);
+
+  // Sentinel specifics
+  const [sentinelAccountSource, setSentinelAccountSource] = useState('built-in');
+  const [sentinelAccountPoolId, setSentinelAccountPoolId] = useState('');
+  const [sentinelTargetInstances, setSentinelTargetInstances] = useState(1);
+  const [sentinelSignalTtl, setSentinelSignalTtl] = useState(30);
+
+  // Query Wait
+  const [queryWaitMode, setQueryWaitMode] = useState<'Random' | 'Fixed'>('Random');
+  const [fixedWait, setFixedWait] = useState(10);
+  const [randomMin, setRandomMin] = useState(60);
+  const [randomMax, setRandomMax] = useState(300);
+
+  // Plugin config
+  const [pluginConfig, setPluginConfig] = useState<PluginConfig>({
+    lib_path: 'plugins',
+    plugin_name: '',
+    plugin_bin: '',
+    plugin_proto: 'IVSPlg',
+  });
+
+  // Appointment types & free config
+  const [appointmentTypes, setAppointmentTypes] = useState<AppointmentTypeItem[]>([]);
+  const [freeConfigStr, setFreeConfigStr] = useState('{}');
+
+  useEffect(() => {
+    if (isOpen) {
+      setStep(1);
+      fetchEnabledProviders();
+      resetForm();
+    }
+  }, [isOpen, entryType]);
+
+  const fetchEnabledProviders = async () => {
+    setLoadingProviders(true);
+    try {
+      const res = await providerService.getList({ enabled_only: true });
+      if (res.code === 0 && res.data) {
+        setProviders(res.data);
+      }
+    } catch (e) {
+      console.error('Failed to fetch providers:', e);
+    } finally {
+      setLoadingProviders(false);
+    }
+  };
+
+  const resetForm = () => {
+    setSelectedProviderName('');
+    setNodeId('node01');
+    setIdentifier('');
+    setWebsite('');
+    setNeedAccount(1);
+    setNeedProxy(1);
+    setProxyPoolStr('proxy-cheap');
+    setProxyCd(300);
+    setSessionMaxLife(1800);
+    setActiveTimeStart('00:00');
+    setActiveTimeEnd('23:59');
+
+    setOrderId('');
+    setAccountUsername('');
+    setAccountPassword('');
+    setSupportPta(false);
+    setExpectedStartDate('');
+    setExpectedEndDate('');
+    setLoginInterval(1800);
+
+    setBookerAccountSource('built-in');
+    setBookerAccountPoolId('');
+    setBookerTargetInstances(1);
+    setBookerAccountCd(10800);
+    setBookerCooldown(300);
+    setBookerMaxBookings(8);
+
+    setSentinelAccountSource('built-in');
+    setSentinelAccountPoolId('');
+    setSentinelTargetInstances(1);
+    setSentinelSignalTtl(30);
+
+    setQueryWaitMode('Random');
+    setFixedWait(10);
+    setRandomMin(60);
+    setRandomMax(300);
+
+    setPluginConfig({
+      lib_path: 'plugins',
+      plugin_name: '',
+      plugin_bin: '',
+      plugin_proto: 'IVSPlg',
+    });
+
+    setAppointmentTypes([]);
+    setFreeConfigStr('{}');
+  };
+
+  const handleProviderSelect = (providerName: string) => {
+    setSelectedProviderName(providerName);
+    const p = providers.find((item) => item.name === providerName);
+    if (!p) return;
+
+    if (p.plugin_config) {
+      setPluginConfig({
+        lib_path: p.plugin_config.lib_path || 'plugins',
+        plugin_name: p.plugin_config.plugin_name || '',
+        plugin_bin: p.plugin_config.plugin_bin || '',
+        plugin_proto: p.plugin_config.plugin_proto || 'IVSPlg',
+      });
+    }
+
+    const roleTpl = p.role_templates?.[entryType];
+    if (roleTpl) {
+      if (roleTpl.proxy_cd !== undefined) setProxyCd(Number(roleTpl.proxy_cd));
+      if (roleTpl.session_max_life !== undefined) setSessionMaxLife(Number(roleTpl.session_max_life));
+      if (roleTpl.login_interval !== undefined) setLoginInterval(Number(roleTpl.login_interval));
+
+      if (entryType === 'booker') {
+        if (roleTpl['booker.account_source'] !== undefined) setBookerAccountSource(roleTpl['booker.account_source']);
+        if (roleTpl['booker.account_pool_id'] !== undefined) setBookerAccountPoolId(roleTpl['booker.account_pool_id']);
+        if (roleTpl['booker.account_cd'] !== undefined) setBookerAccountCd(Number(roleTpl['booker.account_cd']));
+        if (roleTpl['booker.target_instances'] !== undefined) setBookerTargetInstances(Number(roleTpl['booker.target_instances']));
+        if (roleTpl['booker.booking_cooldown'] !== undefined) setBookerCooldown(Number(roleTpl['booker.booking_cooldown']));
+        if (roleTpl['booker.max_bookings_per_account'] !== undefined) setBookerMaxBookings(Number(roleTpl['booker.max_bookings_per_account']));
+      } else if (entryType === 'sentinel') {
+        if (roleTpl['sentinel.account_source'] !== undefined) setSentinelAccountSource(roleTpl['sentinel.account_source']);
+        if (roleTpl['sentinel.account_pool_id'] !== undefined) setSentinelAccountPoolId(roleTpl['sentinel.account_pool_id']);
+        if (roleTpl['sentinel.target_instances'] !== undefined) setSentinelTargetInstances(Number(roleTpl['sentinel.target_instances']));
+        if (roleTpl['sentinel.signal_ttl'] !== undefined) setSentinelSignalTtl(Number(roleTpl['sentinel.signal_ttl']));
+        if (roleTpl['sentinel.query_wait.mode'] !== undefined) setQueryWaitMode(roleTpl['sentinel.query_wait.mode']);
+      }
+    }
+
+    toast.success(`已从服务商模板 [${providerName}] 继承参数`);
+  };
+
+  const buildPayload = (): Partial<NodeConfigurationItem> => {
+    const proxyList = proxyPoolStr
+      .split(',')
+      .map((s) => s.trim())
+      .filter(Boolean);
+
+    let parsedFreeConfig = {};
+    try {
+      if (freeConfigStr.trim()) parsedFreeConfig = JSON.parse(freeConfigStr);
+    } catch {}
+
+    const base: any = {
+      node_id: nodeId.trim(),
+      identifier: identifier.trim(),
+      website: website.trim(),
+      plugin_config: pluginConfig,
+      appointment_types: appointmentTypes,
+      free_config: parsedFreeConfig,
+    };
+
+    if (entryType === 'booker') {
+      base.need_account = needAccount;
+      base.need_proxy = needProxy;
+      base.proxy_pool = proxyList;
+      base.proxy_cd = proxyCd;
+      base.session_max_life = sessionMaxLife;
+      base.active_time_start = activeTimeStart;
+      base.active_time_end = activeTimeEnd;
+      base.booker = {
+        account_source: bookerAccountSource,
+        account_pool_id: bookerAccountPoolId.trim(),
+        target_instances: Number(bookerTargetInstances),
+        account_cd: Number(bookerAccountCd),
+        booking_cooldown: Number(bookerCooldown),
+        max_bookings_per_account: Number(bookerMaxBookings),
+      };
+    } else if (entryType === 'sentinel') {
+      base.sentinel = {
+        account_source: sentinelAccountSource,
+        account_pool_id: sentinelAccountPoolId.trim(),
+        target_instances: Number(sentinelTargetInstances),
+        signal_ttl: Number(sentinelSignalTtl),
+        query_wait: {
+          mode: queryWaitMode,
+          ...(queryWaitMode === 'Fixed'
+            ? { fixed_wait: Number(fixedWait) }
+            : { random_min: Number(randomMin), random_max: Number(randomMax) }),
+        },
+      };
+    } else if (entryType === 'standalone') {
+      base.order_id = orderId.trim();
+      base.account = {
+        username: accountUsername.trim(),
+        password: accountPassword,
+      };
+      base.proxy_pool = proxyList;
+      base.login_interval = Number(loginInterval);
+      base.session_max_life = Number(sessionMaxLife);
+      base.query_wait = {
+        mode: queryWaitMode,
+        ...(queryWaitMode === 'Fixed'
+          ? { fixed_wait: Number(fixedWait) }
+          : { random_min: Number(randomMin), random_max: Number(randomMax) }),
+      };
+      base.user_preferences = {
+        support_pta: supportPta,
+        expected_start_date: expectedStartDate,
+        expected_end_date: expectedEndDate,
+      };
+    }
+
+    return base;
+  };
+
+  const handleNext = () => {
+    if (step === 1) {
+      if (!nodeId.trim()) {
+        toast.error('节点 ID (node_id) 不能为空');
+        return;
+      }
+      if (!identifier.trim()) {
+        toast.error('任务标识 (identifier) 不能为空');
+        return;
+      }
+      setStep(2);
+    } else if (step === 2) {
+      try {
+        if (freeConfigStr.trim()) JSON.parse(freeConfigStr);
+      } catch {
+        toast.error('自定义 Free Config JSON 格式错误');
+        return;
+      }
+      setStep(3);
+    }
+  };
+
+  const handleSubmit = async () => {
+    const payload = buildPayload();
+    setSubmitting(true);
+    try {
+      const res = await nodeConfigService.create(entryType, payload);
+      if (res.code === 0) {
+        toast.success(`[${entryType.toUpperCase()}] 节点任务配置创建成功 (默认已停用)`);
+        onSuccess();
+        onClose();
+      } else {
+        toast.error(res.message || '创建失败');
+      }
+    } catch (err: any) {
+      console.error('Create node config error:', err);
+      const msg = err?.response?.data?.message || err.message || '创建异常';
+      toast.error(msg);
+    } finally {
+      setSubmitting(false);
+    }
+  };
+
+  if (!isOpen) return null;
+
+  return (
+    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-4 font-mono">
+      <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-4xl max-h-[92vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-150">
+        {/* Header */}
+        <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
+          <div className="flex items-center gap-2">
+            <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+            <h3 className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
+              [ CREATE {entryType.toUpperCase()} WIZARD // 新建{entryType.toUpperCase()}任务向导 ]
+            </h3>
+          </div>
+
+          {/* Stepper Tabs */}
+          <div className="flex items-center gap-1">
+            {[
+              { num: 1, label: '01. 模板与标识' },
+              { num: 2, label: '02. 策略与参数' },
+              { num: 3, label: '03. 核对与提交' },
+            ].map((s) => (
+              <span
+                key={s.num}
+                className={`px-2 py-0.5 border border-black text-[11px] font-black uppercase ${
+                  step === s.num
+                    ? 'bg-amber-300 text-black shadow-[1px_1px_0px_#000]'
+                    : step > s.num
+                    ? 'bg-emerald-300 text-black'
+                    : 'bg-white text-neutral-500'
+                }`}
+              >
+                {s.label}
+              </span>
+            ))}
+          </div>
+
+          <button
+            type="button"
+            onClick={onClose}
+            className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+          >
+            ✕
+          </button>
+        </div>
+
+        {/* Wizard Body */}
+        <div className="flex-1 overflow-y-auto p-5 space-y-5 bg-white text-xs">
+          {/* STEP 1 */}
+          {step === 1 && (
+            <div className="space-y-5">
+              {/* Provider Selection */}
+              <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                <div className="flex items-center justify-between border-b-2 border-black pb-1.5">
+                  <div className="flex items-center gap-2">
+                    <span className="w-2 h-2 bg-amber-300 border border-black inline-block" />
+                    <span className="font-black text-black uppercase">[ PROVIDER TEMPLATE // 选择预设服务商模板 ]</span>
+                  </div>
+                  <span className="text-[11px] text-neutral-500">选择后将自动继承默认配置</span>
+                </div>
+
+                <div className="grid grid-cols-1 md:grid-cols-2 gap-3 items-center">
+                  <select
+                    value={selectedProviderName}
+                    onChange={(e) => handleProviderSelect(e.target.value)}
+                    disabled={loadingProviders}
+                    className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
+                  >
+                    <option value="">-- 手动配置 (不继承模板) --</option>
+                    {providers.map((p) => (
+                      <option key={p.id || p.name} value={p.name}>
+                        {p.name.toUpperCase()} (插件: {p.plugin_config?.plugin_name || '内置'})
+                      </option>
+                    ))}
+                  </select>
+
+                  {selectedProviderName && (
+                    <div className="text-[11px] font-black text-black bg-amber-300 border border-black px-2 py-1 shadow-[1px_1px_0px_#000] inline-block">
+                      ✓ 已继承 [{selectedProviderName.toUpperCase()}] 模板参数
+                    </div>
+                  )}
+                </div>
+              </div>
+
+              {/* Node Identity */}
+              <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                  <span className="w-2 h-2 bg-black inline-block" />
+                  <span className="font-black text-black uppercase">[ IDENTITY // 任务与节点标识 ]</span>
+                </div>
+
+                <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+                  <div>
+                    <label className="block text-[11px] font-bold text-black mb-1">
+                      目标节点唯一标识 (node_id) <span className="text-red-500">*</span>
+                    </label>
+                    <input
+                      type="text"
+                      placeholder="node01"
+                      value={nodeId}
+                      onChange={(e) => setNodeId(e.target.value)}
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+                    />
+                  </div>
+
+                  <div>
+                    <label className="block text-[11px] font-bold text-black mb-1">
+                      任务唯一标识符 (identifier) <span className="text-red-500">*</span>
+                    </label>
+                    <input
+                      type="text"
+                      placeholder="vfs.ie.nl"
+                      value={identifier}
+                      onChange={(e) => setIdentifier(e.target.value)}
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+                    />
+                  </div>
+
+                  <div className="md:col-span-2">
+                    <label className="block text-[11px] font-bold text-black mb-1">使馆/登录网址 (website)</label>
+                    <input
+                      type="text"
+                      placeholder="https://visa.vfsglobal.com/..."
+                      value={website}
+                      onChange={(e) => setWebsite(e.target.value)}
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+                    />
+                  </div>
+                </div>
+              </div>
+
+              {/* Standalone special */}
+              {entryType === 'standalone' && (
+                <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="font-black text-black uppercase">[ STANDALONE CREDENTIALS // 订单与账号凭证 ]</span>
+                  </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">关联订单号 (order_id)</label>
+                      <input
+                        type="text"
+                        placeholder="ORD-20260823-001"
+                        value={orderId}
+                        onChange={(e) => setOrderId(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">抢签账号 (username)</label>
+                      <input
+                        type="text"
+                        placeholder="user@example.com"
+                        value={accountUsername}
+                        onChange={(e) => setAccountUsername(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">抢签密码 (password)</label>
+                      <input
+                        type="password"
+                        placeholder="••••••••"
+                        value={accountPassword}
+                        onChange={(e) => setAccountPassword(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                  </div>
+                </div>
+              )}
+            </div>
+          )}
+
+          {/* STEP 2 */}
+          {step === 2 && (
+            <div className="space-y-5">
+              {/* Booker fields */}
+              {entryType === 'booker' && (
+                <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="font-black text-black uppercase">[ BOOKER PARAMS // 占位调度与池参数 ]</span>
+                  </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">使馆账号池 ID (account_pool_id)</label>
+                      <input
+                        type="text"
+                        value={bookerAccountPoolId}
+                        onChange={(e) => setBookerAccountPoolId(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">目标并发实例 (target_instances)</label>
+                      <input
+                        type="number"
+                        min={1}
+                        value={bookerTargetInstances}
+                        onChange={(e) => setBookerTargetInstances(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">账号冷却 (account_cd / 秒)</label>
+                      <input
+                        type="number"
+                        value={bookerAccountCd}
+                        onChange={(e) => setBookerAccountCd(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">下单间隔冷却 (booking_cooldown / 秒)</label>
+                      <input
+                        type="number"
+                        value={bookerCooldown}
+                        onChange={(e) => setBookerCooldown(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">单号最大占位次数</label>
+                      <input
+                        type="number"
+                        value={bookerMaxBookings}
+                        onChange={(e) => setBookerMaxBookings(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">代理冷却时间 (proxy_cd / 秒)</label>
+                      <input
+                        type="number"
+                        value={proxyCd}
+                        onChange={(e) => setProxyCd(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div className="md:col-span-2">
+                      <label className="block text-[11px] font-bold text-black mb-1">网络代理池标签列表 (proxy_pool, 逗号分隔)</label>
+                      <input
+                        type="text"
+                        value={proxyPoolStr}
+                        onChange={(e) => setProxyPoolStr(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">Session 最长存活 (秒)</label>
+                      <input
+                        type="number"
+                        value={sessionMaxLife}
+                        onChange={(e) => setSessionMaxLife(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                  </div>
+                </div>
+              )}
+
+              {/* Sentinel fields */}
+              {entryType === 'sentinel' && (
+                <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="font-black text-black uppercase">[ SENTINEL PARAMS // 监控与等待策略 ]</span>
+                  </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">使馆账号池 ID (account_pool_id)</label>
+                      <input
+                        type="text"
+                        value={sentinelAccountPoolId}
+                        onChange={(e) => setSentinelAccountPoolId(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">监控并发实例数</label>
+                      <input
+                        type="number"
+                        min={1}
+                        value={sentinelTargetInstances}
+                        onChange={(e) => setSentinelTargetInstances(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">放位信号 TTL 持续 (秒)</label>
+                      <input
+                        type="number"
+                        value={sentinelSignalTtl}
+                        onChange={(e) => setSentinelSignalTtl(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">扫位轮询模式 (query_wait.mode)</label>
+                      <select
+                        value={queryWaitMode}
+                        onChange={(e) => setQueryWaitMode(e.target.value as any)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
+                      >
+                        <option value="Random">Random (随机等待)</option>
+                        <option value="Fixed">Fixed (固定等待)</option>
+                      </select>
+                    </div>
+
+                    {queryWaitMode === 'Fixed' ? (
+                      <div>
+                        <label className="block text-[11px] font-bold text-black mb-1">固定等待 (秒)</label>
+                        <input
+                          type="number"
+                          value={fixedWait}
+                          onChange={(e) => setFixedWait(Number(e.target.value))}
+                          className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                        />
+                      </div>
+                    ) : (
+                      <>
+                        <div>
+                          <label className="block text-[11px] font-bold text-black mb-1">随机最小等待 (秒)</label>
+                          <input
+                            type="number"
+                            value={randomMin}
+                            onChange={(e) => setRandomMin(Number(e.target.value))}
+                            className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                          />
+                        </div>
+                        <div>
+                          <label className="block text-[11px] font-bold text-black mb-1">随机最大等待 (秒)</label>
+                          <input
+                            type="number"
+                            value={randomMax}
+                            onChange={(e) => setRandomMax(Number(e.target.value))}
+                            className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                          />
+                        </div>
+                      </>
+                    )}
+                  </div>
+                </div>
+              )}
+
+              {/* Standalone fields */}
+              {entryType === 'standalone' && (
+                <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="font-black text-black uppercase">[ STANDALONE PARAMS // 偏好与轮询策略 ]</span>
+                  </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">登录重试间隔 (秒)</label>
+                      <input
+                        type="number"
+                        value={loginInterval}
+                        onChange={(e) => setLoginInterval(Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">期望最早日期 (start_date)</label>
+                      <input
+                        type="date"
+                        value={expectedStartDate}
+                        onChange={(e) => setExpectedStartDate(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">期望最晚日期 (end_date)</label>
+                      <input
+                        type="date"
+                        value={expectedEndDate}
+                        onChange={(e) => setExpectedEndDate(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                  </div>
+                </div>
+              )}
+
+              {/* Appointment Types */}
+              <AppointmentTypeEditor
+                items={appointmentTypes}
+                onChange={setAppointmentTypes}
+              />
+
+              {/* Plugin & Free Config */}
+              <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                  <span className="w-2 h-2 bg-black inline-block" />
+                  <span className="font-black text-black uppercase">[ EXTENSION // 插件与自由键值配置 ]</span>
+                </div>
+
+                <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
+                  <div>
+                    <label className="block text-[11px] font-bold text-black mb-1">插件名称 (plugin_name)</label>
+                    <input
+                      type="text"
+                      value={pluginConfig.plugin_name || ''}
+                      onChange={(e) => setPluginConfig({ ...pluginConfig, plugin_name: e.target.value })}
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                    />
+                  </div>
+                  <div>
+                    <label className="block text-[11px] font-bold text-black mb-1">二进制脚本 (plugin_bin)</label>
+                    <input
+                      type="text"
+                      value={pluginConfig.plugin_bin || ''}
+                      onChange={(e) => setPluginConfig({ ...pluginConfig, plugin_bin: e.target.value })}
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                    />
+                  </div>
+                </div>
+
+                <div>
+                  <label className="block text-[11px] font-bold text-black mb-1">
+                    自定义扩展 JSON (free_config)
+                  </label>
+                  <textarea
+                    rows={3}
+                    value={freeConfigStr}
+                    onChange={(e) => setFreeConfigStr(e.target.value)}
+                    className="w-full p-2.5 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000]"
+                  />
+                </div>
+              </div>
+            </div>
+          )}
+
+          {/* STEP 3 */}
+          {step === 3 && (
+            <div className="space-y-5">
+              {/* Notice Stamp */}
+              <div className="p-3 bg-amber-100 border-2 border-black shadow-[2px_2px_0px_#000] text-black font-bold text-xs leading-relaxed">
+                ⚠️ [ 落库安全提示 ]:新建的节点任务配置将一律以 <span className="bg-rose-200 border border-black px-1 py-0.2 font-black">[ 已停用 (enable: 0) ]</span> 状态落库。创建成功后可在列表中核实并随时开启。
+              </div>
+
+              {/* Summary Cards */}
+              <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+                <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2 text-xs">
+                  <div className="font-black text-black border-b-2 border-black pb-1 uppercase">[ 基础信息核对 ]</div>
+                  <div className="flex justify-between">
+                    <span className="text-neutral-600">目标节点:</span>
+                    <span className="font-bold text-black">{nodeId}</span>
+                  </div>
+                  <div className="flex justify-between">
+                    <span className="text-neutral-600">任务标识:</span>
+                    <span className="font-black text-black">{identifier}</span>
+                  </div>
+                  <div className="flex justify-between">
+                    <span className="text-neutral-600">角色类型:</span>
+                    <span className="font-bold text-black uppercase">{entryType}</span>
+                  </div>
+                  <div className="flex justify-between">
+                    <span className="text-neutral-600">规则数量:</span>
+                    <span className="font-bold text-black">{appointmentTypes.length} 条</span>
+                  </div>
+                </div>
+
+                <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2 text-xs">
+                  <div className="font-black text-black border-b-2 border-black pb-1 uppercase">[ 插件与继承模板 ]</div>
+                  <div className="flex justify-between">
+                    <span className="text-neutral-600">继承模板:</span>
+                    <span className="font-bold text-black">{selectedProviderName || '无'}</span>
+                  </div>
+                  <div className="flex justify-between">
+                    <span className="text-neutral-600">插件名:</span>
+                    <span className="font-bold text-black">{pluginConfig.plugin_name || '默认'}</span>
+                  </div>
+                  <div className="flex justify-between">
+                    <span className="text-neutral-600">脚本文件:</span>
+                    <span className="font-bold text-black">{pluginConfig.plugin_bin || '-'}</span>
+                  </div>
+                </div>
+              </div>
+
+              {/* JSON Terminal Preview */}
+              <div className="space-y-1">
+                <div className="text-[11px] font-black text-black uppercase">[ JSON TERMINAL // 最终提交负载 ]</div>
+                <div className="border-2 border-black shadow-[4px_4px_0px_#000]">
+                  <pre className="p-4 bg-neutral-900 text-amber-300 font-mono text-xs overflow-x-auto max-h-60 leading-relaxed">
+                    {JSON.stringify(buildPayload(), null, 2)}
+                  </pre>
+                </div>
+              </div>
+            </div>
+          )}
+        </div>
+
+        {/* Footer */}
+        <div className="px-5 py-3 bg-neutral-200 border-t-2 border-black flex justify-between items-center shrink-0">
+          <div>
+            {step > 1 && (
+              <button
+                type="button"
+                onClick={() => setStep((prev) => (prev - 1) as any)}
+                className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+              >
+                [ ← 上一步 ]
+              </button>
+            )}
+          </div>
+
+          <div className="flex items-center gap-2">
+            <button
+              type="button"
+              onClick={onClose}
+              className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+            >
+              [ 取消 ]
+            </button>
+
+            {step < 3 ? (
+              <button
+                type="button"
+                onClick={handleNext}
+                className="px-5 py-1.5 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black text-xs font-black uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+              >
+                [ 下一步 → ]
+              </button>
+            ) : (
+              <button
+                type="button"
+                onClick={handleSubmit}
+                disabled={submitting}
+                className="px-5 py-1.5 bg-emerald-300 hover:bg-emerald-400 text-black border-2 border-black text-xs font-black uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition disabled:opacity-50"
+              >
+                {submitting ? '[ 提交中... ]' : '[ 确认提交落库 ]'}
+              </button>
+            )}
+          </div>
+        </div>
+      </div>
+    </div>
+  );
+}

+ 581 - 0
src/components/admin/node-configurations/NodeConfigDetailDrawer.tsx

@@ -0,0 +1,581 @@
+// src/components/admin/node-configurations/NodeConfigDetailDrawer.tsx
+
+'use client';
+
+import React, { useState, useEffect, useCallback } from 'react';
+import {
+  RotateCcw,
+  Copy,
+  Check,
+  ChevronDown,
+  ChevronUp,
+} from 'lucide-react';
+import { toast } from 'react-hot-toast';
+import {
+  NodeConfigEntryType,
+  NodeConfigurationItem,
+  RevisionItem,
+  NodeRuntimeStatus,
+} from '@/types';
+import { nodeConfigService } from '@/lib/services/nodeConfigService';
+import { retroConfirm } from '@/lib/dialog';
+
+interface NodeConfigDetailDrawerProps {
+  isOpen: boolean;
+  onClose: () => void;
+  entryType: NodeConfigEntryType;
+  config: NodeConfigurationItem | null;
+  defaultTab?: 'overview' | 'revisions';
+  runtimeNodes?: NodeRuntimeStatus[];
+  onSuccess: () => void;
+}
+
+export default function NodeConfigDetailDrawer({
+  isOpen,
+  onClose,
+  entryType,
+  config,
+  defaultTab = 'overview',
+  runtimeNodes,
+  onSuccess,
+}: NodeConfigDetailDrawerProps) {
+  const [activeTab, setActiveTab] = useState<'overview' | 'revisions'>('overview');
+  const [copied, setCopied] = useState(false);
+
+  // Revisions state
+  const [revisions, setRevisions] = useState<RevisionItem[]>([]);
+  const [loadingRevisions, setLoadingRevisions] = useState(false);
+  const [expandedRevId, setExpandedRevId] = useState<number | null>(null);
+  const [rollingBackId, setRollingBackId] = useState<number | null>(null);
+
+  const fetchRevisions = useCallback(async () => {
+    if (!config) return;
+    setLoadingRevisions(true);
+    try {
+      const res = await nodeConfigService.getRevisions(entryType, config.id);
+      if (res.code === 0 && res.data) {
+        setRevisions(res.data);
+      }
+    } catch (e) {
+      console.error('Failed to fetch revisions:', e);
+      setRevisions([]);
+    } finally {
+      setLoadingRevisions(false);
+    }
+  }, [config, entryType]);
+
+  useEffect(() => {
+    if (isOpen && config) {
+      setActiveTab(defaultTab);
+      fetchRevisions();
+    }
+  }, [isOpen, config, defaultTab, fetchRevisions]);
+
+  if (!isOpen || !config) return null;
+
+  const handleCopyJson = () => {
+    navigator.clipboard.writeText(JSON.stringify(config, null, 2));
+    setCopied(true);
+    toast.success('已复制配置 JSON 至剪贴板');
+    setTimeout(() => setCopied(false), 2000);
+  };
+
+  const handleRollback = async (rev: RevisionItem) => {
+    const ok = await retroConfirm({
+      title: '[ CONFIRM ROLLBACK // 版本回滚确认 ]',
+      message: `确定要将配置 [${config.identifier}] 回滚到版本 v${rev.version} (快照 ID: ${rev.id}) 吗?系统将恢复该历史快照并生成新的版本记录。`,
+      type: 'warning',
+      confirmText: '[ 执行回滚 ]',
+      cancelText: '[ 取消 ]',
+    });
+
+    if (!ok) return;
+
+    setRollingBackId(rev.id);
+    try {
+      const res = await nodeConfigService.rollback(entryType, config.id, rev.id);
+      if (res.code === 0) {
+        toast.success(`已成功回滚到版本 v${rev.version}`);
+        onSuccess();
+        fetchRevisions();
+      } else {
+        toast.error(res.message || '回滚失败');
+      }
+    } catch (err: any) {
+      console.error('Rollback error:', err);
+      toast.error(err?.response?.data?.message || err.message || '回滚异常');
+    } finally {
+      setRollingBackId(null);
+    }
+  };
+
+  const isEnabled = config.enable === 1 || config.enable === true;
+
+  return (
+    <div className="fixed inset-0 z-50 overflow-hidden bg-black/60 backdrop-grayscale flex justify-end font-mono">
+      <div className="w-full max-w-2xl bg-neutral-50 border-l-2 border-black shadow-[-8px_0px_0px_#000] h-full flex flex-col animate-in slide-in-from-right duration-200">
+        {/* Header */}
+        <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
+          <div className="flex items-center gap-2">
+            <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+            <div>
+              <div className="flex items-center gap-2">
+                <span className="text-xs md:text-sm font-black text-black uppercase">
+                  [ {config.identifier} // v{config.version} ]
+                </span>
+                {isEnabled ? (
+                  <span className="px-1.5 py-0.2 border border-black bg-emerald-300 text-black font-black uppercase text-[10px] shadow-[1px_1px_0px_#000]">
+                    [ 运行中 ]
+                  </span>
+                ) : (
+                  <span className="px-1.5 py-0.2 border border-black bg-rose-200 text-rose-950 font-bold uppercase text-[10px] shadow-[1px_1px_0px_#000]">
+                    [ 已停用 ]
+                  </span>
+                )}
+              </div>
+              <div className="text-[10px] text-neutral-600 font-bold mt-0.5">
+                节点: {config.node_id} | 角色: {entryType.toUpperCase()}
+              </div>
+            </div>
+          </div>
+
+          <button
+            type="button"
+            onClick={onClose}
+            className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+          >
+            ✕
+          </button>
+        </div>
+
+        {/* Tab Switcher */}
+        <div className="flex border-b-2 border-black bg-neutral-200 px-5 pt-2 gap-2 shrink-0">
+          <button
+            type="button"
+            onClick={() => setActiveTab('overview')}
+            className={`px-4 py-2 text-xs font-black uppercase transition border-t-2 border-x-2 border-black ${
+              activeTab === 'overview'
+                ? 'bg-amber-300 text-black shadow-[2px_0px_0px_#000]'
+                : 'bg-white text-neutral-700 hover:bg-neutral-100'
+            }`}
+          >
+            [ 配置详情概览 ]
+          </button>
+
+          <button
+            type="button"
+            onClick={() => setActiveTab('revisions')}
+            className={`px-4 py-2 text-xs font-black uppercase transition border-t-2 border-x-2 border-black ${
+              activeTab === 'revisions'
+                ? 'bg-amber-300 text-black shadow-[2px_0px_0px_#000]'
+                : 'bg-white text-neutral-700 hover:bg-neutral-100'
+            }`}
+          >
+            [ 修订历史与回滚 ({revisions.length}) ]
+          </button>
+        </div>
+
+        {/* Body */}
+        <div className="flex-1 overflow-y-auto p-5 space-y-5 bg-white text-xs">
+          {activeTab === 'overview' ? (
+            <div className="space-y-4">
+              {/* Copy Bar */}
+              <div className="flex items-center justify-between">
+                <span className="font-black text-black uppercase">[ 结构化属性视窗 ]</span>
+                <button
+                  type="button"
+                  onClick={handleCopyJson}
+                  className="flex items-center gap-1 px-3 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[11px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase"
+                >
+                  {copied ? <Check className="w-3.5 h-3.5 text-emerald-600" /> : <Copy className="w-3.5 h-3.5" />}
+                  <span>{copied ? '[ 已复制 ]' : '[ 复制 JSON ]'}</span>
+                </button>
+              </div>
+
+              {/* Live Telemetry Stack Card */}
+              {(() => {
+                const matchedNode = runtimeNodes?.find(
+                  (n) => n.node_id === config.node_id && n.role === entryType
+                );
+                const matchedGroup = matchedNode?.groups?.find(
+                  (g) =>
+                    g.group_id === config.identifier ||
+                    g.group_id === config.identifier.split('.')[0] ||
+                    g.plugin_name === config.plugin_config?.plugin_name
+                );
+
+                return (
+                  <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-3">
+                    <div className="font-black text-black border-b-2 border-black pb-1.5 flex items-center justify-between">
+                      <div className="flex items-center gap-2">
+                        <span
+                          className={`w-2.5 h-2.5 border border-black inline-block ${
+                            matchedNode?.is_online ? 'bg-emerald-400' : 'bg-neutral-300'
+                          }`}
+                        />
+                        <span className="uppercase">[ LIVE RUNTIME TELEMETRY // 实时运行遥测 ]</span>
+                      </div>
+
+                      {matchedNode?.is_online ? (
+                        <span className="px-1.5 py-0.2 border border-black bg-emerald-300 text-black text-[10px] font-black uppercase">
+                          [ 在线 ({matchedNode.age_sec}s前上报) ]
+                        </span>
+                      ) : (
+                        <span className="px-1.5 py-0.2 border border-black bg-neutral-200 text-neutral-600 text-[10px] font-bold uppercase">
+                          [ 节点离线 / 无遥测 ]
+                        </span>
+                      )}
+                    </div>
+
+                    {matchedGroup ? (
+                      <div className="space-y-3">
+                        <div className="grid grid-cols-2 md:grid-cols-4 gap-2 text-xs">
+                          <div>
+                            <span className="text-neutral-500 block text-[10px]">Wrapper 状态:</span>
+                            <span className="font-black text-black">{matchedGroup.wrapper_state}</span>
+                          </div>
+                          <div>
+                            <span className="text-neutral-500 block text-[10px]">健康并发数:</span>
+                            <span className="font-black text-emerald-600">
+                              {matchedGroup.healthy_tasks} / {matchedGroup.total_tasks} 实例
+                            </span>
+                          </div>
+                          <div>
+                            <span className="text-neutral-500 block text-[10px]">装载插件:</span>
+                            <span className="font-bold text-black">{matchedGroup.plugin_name}</span>
+                          </div>
+                          <div>
+                            <span className="text-neutral-500 block text-[10px]">上报时间:</span>
+                            <span className="font-bold text-neutral-700">{matchedGroup.updated_at || '-'}</span>
+                          </div>
+                        </div>
+
+                        {/* Plugin Active Instances */}
+                        {matchedGroup.plugins && matchedGroup.plugins.length > 0 && (
+                          <div className="space-y-2 pt-2 border-t border-black/20">
+                            <span className="font-black text-black text-[11px] block">
+                              [ 活跃 Worker 实例堆栈 ({matchedGroup.plugins.length}) ]
+                            </span>
+                            <div className="space-y-2">
+                              {matchedGroup.plugins.map((inst, i) => (
+                                <div
+                                  key={i}
+                                  className="p-2.5 bg-white border border-black text-xs space-y-1.5 shadow-[1px_1px_0px_#000]"
+                                >
+                                  <div className="flex items-center justify-between">
+                                    <div className="flex items-center gap-2">
+                                      <span className="font-mono font-black text-black">
+                                        #{inst.instance_id}
+                                      </span>
+                                      <span
+                                        className={`px-1.5 py-0.2 border border-black text-[10px] font-black uppercase ${
+                                          inst.is_healthy ? 'bg-emerald-300 text-black' : 'bg-rose-200 text-rose-950'
+                                        }`}
+                                      >
+                                        [{inst.state}]
+                                      </span>
+                                    </div>
+                                    <span className="text-[10px] text-neutral-500 font-bold">
+                                      存活: {inst.session_age_sec}s
+                                    </span>
+                                  </div>
+
+                                  <div className="grid grid-cols-1 md:grid-cols-2 gap-1 text-[11px] text-neutral-700">
+                                    {inst.account && (
+                                      <div>
+                                        <span className="text-neutral-500">账号: </span>
+                                        <span className="font-bold text-black">{inst.account}</span>
+                                      </div>
+                                    )}
+                                    {inst.proxy && (
+                                      <div>
+                                        <span className="text-neutral-500">代理: </span>
+                                        <span className="font-bold text-black">{inst.proxy}</span>
+                                      </div>
+                                    )}
+                                    {inst.current_url && (
+                                      <div className="col-span-2 truncate">
+                                        <span className="text-neutral-500">URL: </span>
+                                        <span className="font-mono text-[10px] text-black">{inst.current_url}</span>
+                                      </div>
+                                    )}
+                                  </div>
+                                </div>
+                              ))}
+                            </div>
+                          </div>
+                        )}
+                      </div>
+                    ) : (
+                      <div className="p-3 bg-white border border-black text-center text-neutral-500 font-bold text-xs">
+                        {matchedNode?.is_online
+                          ? '该节点已在线,但当前任务组尚未启动或无活跃实例上报'
+                          : '节点未上报心跳数据'}
+                      </div>
+                    )}
+                  </div>
+                );
+              })()}
+
+              {/* Base Info Card */}
+              <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-3">
+                <div className="font-black text-black border-b-2 border-black pb-1.5 flex items-center gap-2">
+                  <span className="w-2 h-2 bg-black inline-block" />
+                  <span className="uppercase">[ 基础标识与使馆网址 ]</span>
+                </div>
+                <div className="grid grid-cols-2 gap-3 text-xs">
+                  <div>
+                    <span className="text-neutral-500 block text-[10px]">配置主键 ID:</span>
+                    <span className="text-black font-bold">#{config.id}</span>
+                  </div>
+                  <div>
+                    <span className="text-neutral-500 block text-[10px]">目标节点 ID:</span>
+                    <span className="text-black font-bold">{config.node_id}</span>
+                  </div>
+                  <div>
+                    <span className="text-neutral-500 block text-[10px]">任务唯一标识:</span>
+                    <span className="text-black font-black bg-amber-300 px-1 border border-black">
+                      {config.identifier}
+                    </span>
+                  </div>
+                  <div>
+                    <span className="text-neutral-500 block text-[10px]">当前版本:</span>
+                    <span className="text-black font-bold">v{config.version}</span>
+                  </div>
+                  <div className="col-span-2">
+                    <span className="text-neutral-500 block text-[10px]">使馆登录网址 (website):</span>
+                    <span className="text-black font-mono break-all">{config.website || '未设置'}</span>
+                  </div>
+                </div>
+              </div>
+
+              {/* Role Specific Details Card */}
+              {entryType === 'booker' && config.booker && (
+                <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="font-black text-black border-b-2 border-black pb-1.5 flex items-center gap-2">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="uppercase">[ BOOKER 角色专项属性 ]</span>
+                  </div>
+                  <div className="grid grid-cols-2 gap-3 text-xs">
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">账号来源:</span>
+                      <span className="text-black font-bold">{config.booker.account_source || 'built-in'}</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">账号池 ID:</span>
+                      <span className="text-black font-bold">{config.booker.account_pool_id || '-'}</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">目标并发实例:</span>
+                      <span className="text-black font-bold">{config.booker.target_instances ?? 1}</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">账号冷却 CD:</span>
+                      <span className="text-black font-bold">{config.booker.account_cd ?? 0} 秒</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">下单冷却:</span>
+                      <span className="text-black font-bold">{config.booker.booking_cooldown ?? 0} 秒</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">单号最大占位:</span>
+                      <span className="text-black font-bold">{config.booker.max_bookings_per_account ?? '-'}</span>
+                    </div>
+                  </div>
+                </div>
+              )}
+
+              {entryType === 'sentinel' && config.sentinel && (
+                <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="font-black text-black border-b-2 border-black pb-1.5 flex items-center gap-2">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="uppercase">[ SENTINEL 角色专项属性 ]</span>
+                  </div>
+                  <div className="grid grid-cols-2 gap-3 text-xs">
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">账号池 ID:</span>
+                      <span className="text-black font-bold">{config.sentinel.account_pool_id || '-'}</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">信号持续 TTL:</span>
+                      <span className="text-black font-bold">{config.sentinel.signal_ttl ?? 30} 秒</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">扫位等待模式:</span>
+                      <span className="text-black font-bold">{config.sentinel.query_wait?.mode || 'Random'}</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">等待区间:</span>
+                      <span className="text-black font-bold">
+                        {config.sentinel.query_wait?.mode === 'Fixed'
+                          ? `${config.sentinel.query_wait?.fixed_wait}s`
+                          : `${config.sentinel.query_wait?.random_min || 0} ~ ${config.sentinel.query_wait?.random_max || 0}s`}
+                      </span>
+                    </div>
+                  </div>
+                </div>
+              )}
+
+              {entryType === 'standalone' && (
+                <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="font-black text-black border-b-2 border-black pb-1.5 flex items-center gap-2">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="uppercase">[ STANDALONE 独立任务属性 ]</span>
+                  </div>
+                  <div className="grid grid-cols-2 gap-3 text-xs">
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">关联订单号:</span>
+                      <span className="text-black font-black">{config.order_id || '未关联'}</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">账号用户名:</span>
+                      <span className="text-black font-bold">{config.account?.username || '-'}</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">登录重试间隔:</span>
+                      <span className="text-black font-bold">{config.login_interval ?? 1800} 秒</span>
+                    </div>
+                    <div>
+                      <span className="text-neutral-500 block text-[10px]">PTA 支持:</span>
+                      <span className="text-black font-bold">{config.user_preferences?.support_pta ? '是' : '否'}</span>
+                    </div>
+                  </div>
+                </div>
+              )}
+
+              {/* Appointment Types List */}
+              {config.appointment_types && config.appointment_types.length > 0 && (
+                <div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2">
+                  <div className="font-black text-black border-b-2 border-black pb-1 uppercase">
+                    [ 预约规则 ({config.appointment_types.length}) ]
+                  </div>
+                  <div className="space-y-1.5">
+                    {config.appointment_types.map((appt, i) => (
+                      <div
+                        key={i}
+                        className="p-2 bg-white border border-black text-xs flex items-center justify-between"
+                      >
+                        <span className="font-black text-black">{appt.routing_key}</span>
+                        <span className="text-neutral-600 font-bold">
+                          {appt.city || '-'} / {appt.visa_type || '-'} (权重: {appt.weight ?? '-'})
+                        </span>
+                      </div>
+                    ))}
+                  </div>
+                </div>
+              )}
+
+              {/* Raw JSON Terminal */}
+              <div className="space-y-1">
+                <div className="font-black text-black uppercase text-[11px]">[ FULL CONFIG JSON TERMINAL ]</div>
+                <div className="border-2 border-black shadow-[4px_4px_0px_#000]">
+                  <pre className="p-4 bg-neutral-900 text-amber-300 font-mono text-xs overflow-x-auto max-h-72 leading-relaxed">
+                    {JSON.stringify(config, null, 2)}
+                  </pre>
+                </div>
+              </div>
+            </div>
+          ) : (
+            /* REVISIONS TIMELINE */
+            <div className="space-y-4">
+              <div className="flex items-center justify-between border-b-2 border-black pb-2">
+                <span className="font-black text-black uppercase">[ 修订历史记录时间轴 ]</span>
+                <span className="text-[11px] text-neutral-600 font-bold">按版本倒序排列</span>
+              </div>
+
+              {loadingRevisions ? (
+                <div className="py-12 flex flex-col items-center justify-center gap-2 text-black font-bold text-xs">
+                  <div className="w-5 h-5 border-2 border-black border-t-amber-400 rounded-full animate-spin" />
+                  <span>正在读取历史版本快照...</span>
+                </div>
+              ) : revisions.length === 0 ? (
+                <div className="p-8 border-2 border-dashed border-neutral-400 bg-white text-center text-xs font-bold text-neutral-500">
+                  暂无历史修订记录
+                </div>
+              ) : (
+                <div className="relative pl-6 space-y-4 before:absolute before:left-2 before:top-2 before:bottom-2 before:w-[2px] before:bg-black">
+                  {revisions.map((rev) => {
+                    const isExpanded = expandedRevId === rev.id;
+                    const isRollingBack = rollingBackId === rev.id;
+                    const isCurrent = rev.version === config.version;
+
+                    return (
+                      <div key={rev.id} className="relative group">
+                        {/* Timeline Square */}
+                        <div
+                          className={`absolute -left-6 top-1.5 w-4 h-4 border-2 border-black flex items-center justify-center ${
+                            isCurrent ? 'bg-amber-300' : 'bg-neutral-200'
+                          }`}
+                        >
+                          <div className="w-1.5 h-1.5 bg-black" />
+                        </div>
+
+                        {/* Revision Card */}
+                        <div className="p-3.5 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2.5">
+                          <div className="flex items-center justify-between">
+                            <div className="flex items-center gap-2">
+                              <span className="px-2 py-0.5 bg-black text-white font-black text-xs uppercase">
+                                v{rev.version}
+                              </span>
+                              <span className="font-black text-black uppercase">
+                                [{rev.action}]
+                              </span>
+                              {isCurrent && (
+                                <span className="px-1.5 py-0.2 border border-black bg-emerald-300 text-black text-[10px] font-black uppercase">
+                                  当前生效
+                                </span>
+                              )}
+                            </div>
+
+                            {/* Rollback Button */}
+                            {!isCurrent && (
+                              <button
+                                type="button"
+                                onClick={() => handleRollback(rev)}
+                                disabled={isRollingBack}
+                                className="flex items-center gap-1 px-2.5 py-1 bg-amber-300 hover:bg-amber-400 text-black border border-black font-black text-xs uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition disabled:opacity-50"
+                                title="将配置回滚至此版本"
+                              >
+                                <RotateCcw className="w-3 h-3" />
+                                <span>{isRollingBack ? '回滚中...' : '[ 回滚到此版本 ]'}</span>
+                              </button>
+                            )}
+                          </div>
+
+                          <div className="flex items-center gap-4 text-[11px] text-neutral-600 font-bold">
+                            <span>操作人: {rev.updated_by || 'admin'}</span>
+                            <span>时间: {rev.created_at ? new Date(rev.created_at).toLocaleString() : '-'}</span>
+                          </div>
+
+                          {/* Snapshot Toggle */}
+                          <div className="pt-2 border-t border-black/20">
+                            <button
+                              type="button"
+                              onClick={() => setExpandedRevId(isExpanded ? null : rev.id)}
+                              className="flex items-center gap-1 text-[11px] font-bold text-black hover:underline"
+                            >
+                              {isExpanded ? <ChevronUp className="w-3.5 h-3.5" /> : <ChevronDown className="w-3.5 h-3.5" />}
+                              <span>{isExpanded ? '[ 收起快照 ]' : '[ 展开查看快照 JSON ]'}</span>
+                            </button>
+
+                            {isExpanded && (
+                              <div className="mt-2 border-2 border-black shadow-[2px_2px_0px_#000]">
+                                <pre className="p-3 bg-neutral-900 text-amber-300 font-mono text-[11px] overflow-x-auto max-h-56 leading-relaxed">
+                                  {JSON.stringify(rev.snapshot, null, 2)}
+                                </pre>
+                              </div>
+                            )}
+                          </div>
+                        </div>
+                      </div>
+                    );
+                  })}
+                </div>
+              )}
+            </div>
+          )}
+        </div>
+      </div>
+    </div>
+  );
+}

+ 692 - 0
src/components/admin/node-configurations/NodeConfigEditModal.tsx

@@ -0,0 +1,692 @@
+// src/components/admin/node-configurations/NodeConfigEditModal.tsx
+
+'use client';
+
+import React, { useState, useEffect } from 'react';
+import { toast } from 'react-hot-toast';
+import {
+  NodeConfigEntryType,
+  NodeConfigurationItem,
+  SparseUpdatePayload,
+  AppointmentTypeItem,
+  PluginConfig,
+} from '@/types';
+import { nodeConfigService } from '@/lib/services/nodeConfigService';
+import AppointmentTypeEditor from './AppointmentTypeEditor';
+
+interface NodeConfigEditModalProps {
+  isOpen: boolean;
+  onClose: () => void;
+  entryType: NodeConfigEntryType;
+  config: NodeConfigurationItem | null;
+  onSuccess: () => void;
+}
+
+export default function NodeConfigEditModal({
+  isOpen,
+  onClose,
+  entryType,
+  config,
+  onSuccess,
+}: NodeConfigEditModalProps) {
+  const [mode, setMode] = useState<'visual' | 'json'>('visual');
+  const [saving, setSaving] = useState(false);
+
+  // Visual mode form fields
+  const [nodeId, setNodeId] = useState('');
+  const [website, setWebsite] = useState('');
+  const [proxyCd, setProxyCd] = useState<number | ''>('');
+  const [sessionMaxLife, setSessionMaxLife] = useState<number | ''>('');
+  const [activeTimeStart, setActiveTimeStart] = useState('');
+  const [activeTimeEnd, setActiveTimeEnd] = useState('');
+  const [proxyPoolStr, setProxyPoolStr] = useState('');
+
+  // Standalone specifics
+  const [orderId, setOrderId] = useState('');
+  const [accountUsername, setAccountUsername] = useState('');
+  const [accountPassword, setAccountPassword] = useState('');
+  const [supportPta, setSupportPta] = useState(false);
+  const [expectedStartDate, setExpectedStartDate] = useState('');
+  const [expectedEndDate, setExpectedEndDate] = useState('');
+  const [loginInterval, setLoginInterval] = useState<number | ''>('');
+
+  // Booker specifics
+  const [bookerAccountSource, setBookerAccountSource] = useState('');
+  const [bookerAccountPoolId, setBookerAccountPoolId] = useState('');
+  const [bookerTargetInstances, setBookerTargetInstances] = useState<number | ''>('');
+  const [bookerAccountCd, setBookerAccountCd] = useState<number | ''>('');
+  const [bookerCooldown, setBookerCooldown] = useState<number | ''>('');
+  const [bookerMaxBookings, setBookerMaxBookings] = useState<number | ''>('');
+
+  // Sentinel specifics
+  const [sentinelAccountSource, setSentinelAccountSource] = useState('');
+  const [sentinelAccountPoolId, setSentinelAccountPoolId] = useState('');
+  const [sentinelTargetInstances, setSentinelTargetInstances] = useState<number | ''>('');
+  const [sentinelSignalTtl, setSentinelSignalTtl] = useState<number | ''>('');
+  const [queryWaitMode, setQueryWaitMode] = useState<'Random' | 'Fixed'>('Random');
+  const [fixedWait, setFixedWait] = useState<number | ''>('');
+  const [randomMin, setRandomMin] = useState<number | ''>('');
+  const [randomMax, setRandomMax] = useState<number | ''>('');
+
+  // Plugin & Free config & Appointment types
+  const [pluginConfig, setPluginConfig] = useState<PluginConfig>({});
+  const [appointmentTypes, setAppointmentTypes] = useState<AppointmentTypeItem[]>([]);
+  const [freeConfigStr, setFreeConfigStr] = useState('{}');
+
+  // JSON mode payload
+  const [rawJsonStr, setRawJsonStr] = useState('{\n  "set": {},\n  "clear": []\n}');
+
+  useEffect(() => {
+    if (config) {
+      setNodeId(config.node_id || '');
+      setWebsite(config.website || '');
+      setProxyCd(config.proxy_cd !== undefined ? config.proxy_cd : '');
+      setSessionMaxLife(config.session_max_life !== undefined ? config.session_max_life : '');
+      setActiveTimeStart(config.active_time_start || '');
+      setActiveTimeEnd(config.active_time_end || '');
+      setProxyPoolStr(config.proxy_pool ? config.proxy_pool.join(', ') : '');
+
+      setOrderId(config.order_id || '');
+      setAccountUsername(config.account?.username || '');
+      setAccountPassword(config.account?.password || '');
+      setSupportPta(!!config.user_preferences?.support_pta);
+      setExpectedStartDate(config.user_preferences?.expected_start_date || '');
+      setExpectedEndDate(config.user_preferences?.expected_end_date || '');
+      setLoginInterval(config.login_interval !== undefined ? config.login_interval : '');
+
+      setBookerAccountSource(config.booker?.account_source || 'built-in');
+      setBookerAccountPoolId(config.booker?.account_pool_id || '');
+      setBookerTargetInstances(config.booker?.target_instances !== undefined ? config.booker.target_instances : 1);
+      setBookerAccountCd(config.booker?.account_cd !== undefined ? config.booker.account_cd : '');
+      setBookerCooldown(config.booker?.booking_cooldown !== undefined ? config.booker.booking_cooldown : '');
+      setBookerMaxBookings(config.booker?.max_bookings_per_account !== undefined ? config.booker.max_bookings_per_account : '');
+
+      setSentinelAccountSource(config.sentinel?.account_source || 'built-in');
+      setSentinelAccountPoolId(config.sentinel?.account_pool_id || '');
+      setSentinelTargetInstances(config.sentinel?.target_instances !== undefined ? config.sentinel.target_instances : 1);
+      setSentinelSignalTtl(config.sentinel?.signal_ttl !== undefined ? config.sentinel.signal_ttl : '');
+
+      const qw = config.sentinel?.query_wait || config.query_wait;
+      if (qw) {
+        setQueryWaitMode((qw.mode as any) || 'Random');
+        setFixedWait(qw.fixed_wait !== undefined ? qw.fixed_wait : '');
+        setRandomMin(qw.random_min !== undefined ? qw.random_min : '');
+        setRandomMax(qw.random_max !== undefined ? qw.random_max : '');
+      } else {
+        setQueryWaitMode('Random');
+        setFixedWait('');
+        setRandomMin('');
+        setRandomMax('');
+      }
+
+      setPluginConfig(config.plugin_config || {});
+      setAppointmentTypes(config.appointment_types || []);
+      setFreeConfigStr(config.free_config ? JSON.stringify(config.free_config, null, 2) : '{}');
+
+      setRawJsonStr(
+        JSON.stringify(
+          {
+            set: {},
+            clear: [],
+          },
+          null,
+          2
+        )
+      );
+    }
+  }, [config, isOpen]);
+
+  if (!isOpen || !config) return null;
+
+  const calculateSparsePayload = (): SparseUpdatePayload => {
+    const setObj: Record<string, any> = {};
+    const clearArr: string[] = [];
+
+    if (nodeId.trim() && nodeId.trim() !== (config.node_id || '')) {
+      setObj['node_id'] = nodeId.trim();
+    }
+
+    if (website !== (config.website || '')) {
+      if (website === '') clearArr.push('website');
+      else setObj['website'] = website;
+    }
+
+    if (proxyCd !== '' && proxyCd !== config.proxy_cd) {
+      setObj['proxy_cd'] = Number(proxyCd);
+    }
+
+    if (sessionMaxLife !== '' && sessionMaxLife !== config.session_max_life) {
+      setObj['session_max_life'] = Number(sessionMaxLife);
+    }
+
+    if (activeTimeStart !== (config.active_time_start || '')) setObj['active_time_start'] = activeTimeStart;
+    if (activeTimeEnd !== (config.active_time_end || '')) setObj['active_time_end'] = activeTimeEnd;
+
+    const newProxyList = proxyPoolStr.split(',').map((s) => s.trim()).filter(Boolean);
+    const oldProxyList = config.proxy_pool || [];
+    if (JSON.stringify(newProxyList) !== JSON.stringify(oldProxyList)) {
+      setObj['proxy_pool'] = newProxyList;
+    }
+
+    if (entryType === 'booker') {
+      if (bookerAccountSource !== (config.booker?.account_source || '')) setObj['booker.account_source'] = bookerAccountSource;
+      if (bookerAccountPoolId !== (config.booker?.account_pool_id || '')) setObj['booker.account_pool_id'] = bookerAccountPoolId;
+      if (bookerTargetInstances !== '' && bookerTargetInstances !== config.booker?.target_instances) {
+        setObj['booker.target_instances'] = Number(bookerTargetInstances);
+      }
+      if (bookerAccountCd !== '' && bookerAccountCd !== config.booker?.account_cd) {
+        setObj['booker.account_cd'] = Number(bookerAccountCd);
+      }
+      if (bookerCooldown !== '' && bookerCooldown !== config.booker?.booking_cooldown) {
+        setObj['booker.booking_cooldown'] = Number(bookerCooldown);
+      }
+      if (bookerMaxBookings !== '' && bookerMaxBookings !== config.booker?.max_bookings_per_account) {
+        setObj['booker.max_bookings_per_account'] = Number(bookerMaxBookings);
+      }
+    }
+
+    if (entryType === 'sentinel') {
+      if (sentinelAccountSource !== (config.sentinel?.account_source || '')) setObj['sentinel.account_source'] = sentinelAccountSource;
+      if (sentinelAccountPoolId !== (config.sentinel?.account_pool_id || '')) setObj['sentinel.account_pool_id'] = sentinelAccountPoolId;
+      if (sentinelTargetInstances !== '' && sentinelTargetInstances !== config.sentinel?.target_instances) {
+        setObj['sentinel.target_instances'] = Number(sentinelTargetInstances);
+      }
+      if (sentinelSignalTtl !== '' && sentinelSignalTtl !== config.sentinel?.signal_ttl) {
+        setObj['sentinel.signal_ttl'] = Number(sentinelSignalTtl);
+      }
+      if (queryWaitMode !== (config.sentinel?.query_wait?.mode || 'Random')) {
+        setObj['sentinel.query_wait.mode'] = queryWaitMode;
+      }
+      if (queryWaitMode === 'Fixed' && fixedWait !== '' && fixedWait !== config.sentinel?.query_wait?.fixed_wait) {
+        setObj['sentinel.query_wait.fixed_wait'] = Number(fixedWait);
+      }
+      if (queryWaitMode === 'Random') {
+        if (randomMin !== '' && randomMin !== config.sentinel?.query_wait?.random_min) {
+          setObj['sentinel.query_wait.random_min'] = Number(randomMin);
+        }
+        if (randomMax !== '' && randomMax !== config.sentinel?.query_wait?.random_max) {
+          setObj['sentinel.query_wait.random_max'] = Number(randomMax);
+        }
+      }
+    }
+
+    if (entryType === 'standalone') {
+      if (orderId !== (config.order_id || '')) setObj['order_id'] = orderId;
+      if (accountUsername !== (config.account?.username || '')) setObj['account.username'] = accountUsername;
+      if (accountPassword && accountPassword !== (config.account?.password || '')) setObj['account.password'] = accountPassword;
+      if (loginInterval !== '' && loginInterval !== config.login_interval) setObj['login_interval'] = Number(loginInterval);
+      if (supportPta !== !!config.user_preferences?.support_pta) setObj['user_preferences.support_pta'] = supportPta;
+      if (expectedStartDate !== (config.user_preferences?.expected_start_date || '')) setObj['user_preferences.expected_start_date'] = expectedStartDate;
+      if (expectedEndDate !== (config.user_preferences?.expected_end_date || '')) setObj['user_preferences.expected_end_date'] = expectedEndDate;
+    }
+
+    if (JSON.stringify(pluginConfig) !== JSON.stringify(config.plugin_config || {})) {
+      setObj['plugin_config'] = pluginConfig;
+    }
+
+    if (JSON.stringify(appointmentTypes) !== JSON.stringify(config.appointment_types || [])) {
+      setObj['appointment_types'] = appointmentTypes;
+    }
+
+    try {
+      const parsedFree = freeConfigStr.trim() ? JSON.parse(freeConfigStr) : {};
+      if (JSON.stringify(parsedFree) !== JSON.stringify(config.free_config || {})) {
+        setObj['free_config'] = parsedFree;
+      }
+    } catch {}
+
+    return {
+      set: Object.keys(setObj).length > 0 ? setObj : undefined,
+      clear: clearArr.length > 0 ? clearArr : undefined,
+    };
+  };
+
+  const handleFormatJson = () => {
+    try {
+      const parsed = JSON.parse(rawJsonStr);
+      setRawJsonStr(JSON.stringify(parsed, null, 2));
+      toast.success('JSON 已格式化');
+    } catch {
+      toast.error('JSON 语法错误,无法格式化');
+    }
+  };
+
+  const handleCopyJson = () => {
+    navigator.clipboard.writeText(rawJsonStr);
+    toast.success('已复制到剪贴板');
+  };
+
+  const handleSubmit = async (e: React.FormEvent) => {
+    e.preventDefault();
+    setSaving(true);
+
+    try {
+      let payload: SparseUpdatePayload;
+
+      if (mode === 'json') {
+        try {
+          payload = JSON.parse(rawJsonStr);
+        } catch {
+          toast.error('JSON 格式错误,请检查语法');
+          setSaving(false);
+          return;
+        }
+      } else {
+        payload = calculateSparsePayload();
+        if (!payload.set && (!payload.clear || payload.clear.length === 0)) {
+          toast('未检测到任何字段变更', { icon: 'ℹ️' });
+          onClose();
+          setSaving(false);
+          return;
+        }
+      }
+
+      const res = await nodeConfigService.sparseUpdate(entryType, config.id, payload);
+      if (res.code === 0) {
+        toast.success(`配置更新成功 (版本已升至 v${res.data?.version || config.version + 1})`);
+        onSuccess();
+        onClose();
+      } else {
+        toast.error(res.message || '更新失败');
+      }
+    } catch (err: any) {
+      console.error('Update config error:', err);
+      toast.error(err?.response?.data?.message || err.message || '更新异常');
+    } finally {
+      setSaving(false);
+    }
+  };
+
+  return (
+    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-4 font-mono">
+      <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-4xl max-h-[92vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-150">
+        {/* Header */}
+        <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
+          <div className="flex items-center gap-2">
+            <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+            <div>
+              <h3 className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
+                [ EDIT {entryType.toUpperCase()} CONFIG // 稀疏编辑: {config.node_id} / {config.identifier} (v{config.version}) ]
+              </h3>
+            </div>
+          </div>
+
+          {/* Mode Switcher */}
+          <div className="flex items-center gap-2">
+            <div className="flex border-2 border-black bg-white p-0.5 gap-1">
+              <button
+                type="button"
+                onClick={() => setMode('visual')}
+                className={`px-3 py-1 text-xs font-mono uppercase transition border ${
+                  mode === 'visual'
+                    ? 'bg-amber-300 text-black font-black border-black shadow-[1px_1px_0px_#000]'
+                    : 'text-neutral-700 font-bold border-transparent hover:bg-neutral-100'
+                }`}
+              >
+                [ 可视化表单 ]
+              </button>
+              <button
+                type="button"
+                onClick={() => setMode('json')}
+                className={`px-3 py-1 text-xs font-mono uppercase transition border ${
+                  mode === 'json'
+                    ? 'bg-amber-300 text-black font-black border-black shadow-[1px_1px_0px_#000]'
+                    : 'text-neutral-700 font-bold border-transparent hover:bg-neutral-100'
+                }`}
+              >
+                [ JSON 稀疏模式 ]
+              </button>
+            </div>
+
+            <button
+              type="button"
+              onClick={onClose}
+              className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 ml-2"
+            >
+              ✕
+            </button>
+          </div>
+        </div>
+
+        {/* Body */}
+        <form onSubmit={handleSubmit} className="flex-1 overflow-y-auto p-5 space-y-5 bg-white text-xs">
+          {mode === 'visual' ? (
+            <div className="space-y-5">
+              {/* Base & Network */}
+              <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                  <span className="w-2 h-2 bg-black inline-block" />
+                  <span className="font-black text-black uppercase">[ 01 // 节点与网络参数 ]</span>
+                </div>
+
+                <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
+                  <div className="md:col-span-2">
+                    <label className="block text-[11px] font-bold text-black mb-1">
+                      目标计算节点 (node_id) <span className="text-rose-600 font-bold">*</span>
+                    </label>
+                    <input
+                      type="text"
+                      required
+                      value={nodeId}
+                      onChange={(e) => setNodeId(e.target.value)}
+                      placeholder="default, node01, node02..."
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                    />
+                  </div>
+
+                  <div className="md:col-span-2">
+                    <label className="block text-[11px] font-bold text-black mb-1">使馆/登录网址 (website)</label>
+                    <input
+                      type="text"
+                      value={website}
+                      onChange={(e) => setWebsite(e.target.value)}
+                      placeholder="https://visa.vfsglobal.com/..."
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                    />
+                  </div>
+
+                  <div>
+                    <label className="block text-[11px] font-bold text-black mb-1">代理冷却时间 (proxy_cd / 秒)</label>
+                    <input
+                      type="number"
+                      value={proxyCd}
+                      onChange={(e) => setProxyCd(e.target.value === '' ? '' : Number(e.target.value))}
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                    />
+                  </div>
+
+                  <div>
+                    <label className="block text-[11px] font-bold text-black mb-1">Session 最长存活时间 (秒)</label>
+                    <input
+                      type="number"
+                      value={sessionMaxLife}
+                      onChange={(e) => setSessionMaxLife(e.target.value === '' ? '' : Number(e.target.value))}
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                    />
+                  </div>
+
+                  <div className="md:col-span-2">
+                    <label className="block text-[11px] font-bold text-black mb-1">网络代理池标签列表 (proxy_pool, 逗号分隔)</label>
+                    <input
+                      type="text"
+                      value={proxyPoolStr}
+                      onChange={(e) => setProxyPoolStr(e.target.value)}
+                      placeholder="proxy-cheap, proxy-fast"
+                      className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                    />
+                  </div>
+                </div>
+              </div>
+
+              {/* Booker fields */}
+              {entryType === 'booker' && (
+                <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="font-black text-black uppercase">[ 02 // Booker 调度与池参数 ]</span>
+                  </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">使馆账号池 ID (account_pool_id)</label>
+                      <input
+                        type="text"
+                        value={bookerAccountPoolId}
+                        onChange={(e) => setBookerAccountPoolId(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">目标并发实例 (target_instances)</label>
+                      <input
+                        type="number"
+                        min={1}
+                        value={bookerTargetInstances}
+                        onChange={(e) => setBookerTargetInstances(e.target.value === '' ? '' : Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">账号冷却 CD (account_cd / 秒)</label>
+                      <input
+                        type="number"
+                        value={bookerAccountCd}
+                        onChange={(e) => setBookerAccountCd(e.target.value === '' ? '' : Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">下单冷却 (booking_cooldown / 秒)</label>
+                      <input
+                        type="number"
+                        value={bookerCooldown}
+                        onChange={(e) => setBookerCooldown(e.target.value === '' ? '' : Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">单号最大占位次数</label>
+                      <input
+                        type="number"
+                        value={bookerMaxBookings}
+                        onChange={(e) => setBookerMaxBookings(e.target.value === '' ? '' : Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                  </div>
+                </div>
+              )}
+
+              {/* Sentinel fields */}
+              {entryType === 'sentinel' && (
+                <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="font-black text-black uppercase">[ 02 // Sentinel 扫位与信号策略 ]</span>
+                  </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">账号池 ID (account_pool_id)</label>
+                      <input
+                        type="text"
+                        value={sentinelAccountPoolId}
+                        onChange={(e) => setSentinelAccountPoolId(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">并发实例数 (target_instances)</label>
+                      <input
+                        type="number"
+                        min={1}
+                        value={sentinelTargetInstances}
+                        onChange={(e) => setSentinelTargetInstances(e.target.value === '' ? '' : Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">信号 TTL 持续 (秒)</label>
+                      <input
+                        type="number"
+                        value={sentinelSignalTtl}
+                        onChange={(e) => setSentinelSignalTtl(e.target.value === '' ? '' : Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">扫位轮询模式 (query_wait.mode)</label>
+                      <select
+                        value={queryWaitMode}
+                        onChange={(e) => setQueryWaitMode(e.target.value as any)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
+                      >
+                        <option value="Random">Random (随机等待)</option>
+                        <option value="Fixed">Fixed (固定等待)</option>
+                      </select>
+                    </div>
+
+                    {queryWaitMode === 'Fixed' ? (
+                      <div>
+                        <label className="block text-[11px] font-bold text-black mb-1">固定等待 (秒)</label>
+                        <input
+                          type="number"
+                          value={fixedWait}
+                          onChange={(e) => setFixedWait(e.target.value === '' ? '' : Number(e.target.value))}
+                          className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                        />
+                      </div>
+                    ) : (
+                      <>
+                        <div>
+                          <label className="block text-[11px] font-bold text-black mb-1">随机最小等待 (秒)</label>
+                          <input
+                            type="number"
+                            value={randomMin}
+                            onChange={(e) => setRandomMin(e.target.value === '' ? '' : Number(e.target.value))}
+                            className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                          />
+                        </div>
+                        <div>
+                          <label className="block text-[11px] font-bold text-black mb-1">随机最大等待 (秒)</label>
+                          <input
+                            type="number"
+                            value={randomMax}
+                            onChange={(e) => setRandomMax(e.target.value === '' ? '' : Number(e.target.value))}
+                            className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                          />
+                        </div>
+                      </>
+                    )}
+                  </div>
+                </div>
+              )}
+
+              {/* Standalone fields */}
+              {entryType === 'standalone' && (
+                <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+                  <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                    <span className="w-2 h-2 bg-black inline-block" />
+                    <span className="font-black text-black uppercase">[ 02 // Standalone 偏好与凭证 ]</span>
+                  </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">关联订单号 (order_id)</label>
+                      <input
+                        type="text"
+                        value={orderId}
+                        onChange={(e) => setOrderId(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">登录重试间隔 (秒)</label>
+                      <input
+                        type="number"
+                        value={loginInterval}
+                        onChange={(e) => setLoginInterval(e.target.value === '' ? '' : Number(e.target.value))}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                    <div>
+                      <label className="block text-[11px] font-bold text-black mb-1">抢签账号 (username)</label>
+                      <input
+                        type="text"
+                        value={accountUsername}
+                        onChange={(e) => setAccountUsername(e.target.value)}
+                        className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
+                      />
+                    </div>
+                  </div>
+                </div>
+              )}
+
+              {/* Appointment Types */}
+              <AppointmentTypeEditor
+                items={appointmentTypes}
+                onChange={setAppointmentTypes}
+              />
+
+              {/* Free Config */}
+              <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-2">
+                <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+                  <span className="w-2 h-2 bg-black inline-block" />
+                  <span className="font-black text-black uppercase">[ 03 // 自定义扩展 (FREE_CONFIG) ]</span>
+                </div>
+                <textarea
+                  rows={3}
+                  value={freeConfigStr}
+                  onChange={(e) => setFreeConfigStr(e.target.value)}
+                  className="w-full p-2.5 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000]"
+                />
+              </div>
+            </div>
+          ) : (
+            /* JSON Sparse Mode */
+            <div className="w-full font-mono text-xs select-none space-y-3">
+              <div className="flex items-center justify-between px-3 py-2 bg-neutral-200 border-2 border-black">
+                <div className="flex items-center gap-2">
+                  <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+                  <span className="font-black text-black uppercase">[ SPARSE JSON TERMINAL // 稀疏更新视窗 ]</span>
+                </div>
+                <div className="flex items-center gap-1">
+                  <button
+                    type="button"
+                    onClick={handleFormatJson}
+                    className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[11px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase"
+                  >
+                    [ 格式化 ]
+                  </button>
+                  <button
+                    type="button"
+                    onClick={handleCopyJson}
+                    className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[11px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase"
+                  >
+                    [ 复制 ]
+                  </button>
+                </div>
+              </div>
+
+              <div className="border-2 border-black shadow-[4px_4px_0px_#000]">
+                <textarea
+                  rows={14}
+                  value={rawJsonStr}
+                  onChange={(e) => setRawJsonStr(e.target.value)}
+                  placeholder='{\n  "set": {},\n  "clear": []\n}'
+                  className="w-full p-4 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-amber-300 resize-y"
+                />
+              </div>
+            </div>
+          )}
+        </form>
+
+        {/* Footer */}
+        <div className="px-5 py-3 bg-neutral-200 border-t-2 border-black flex justify-between items-center shrink-0">
+          <div className="text-[11px] text-neutral-600 font-bold">
+            {mode === 'visual' ? '前端将在提交时自动比对生成 set / clear 稀疏负载' : '直接提交 JSON 负载'}
+          </div>
+
+          <div className="flex items-center gap-2">
+            <button
+              type="button"
+              onClick={onClose}
+              className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+            >
+              [ 取消 ]
+            </button>
+            <button
+              type="button"
+              onClick={handleSubmit}
+              disabled={saving}
+              className="px-5 py-1.5 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black text-xs font-black uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition disabled:opacity-50"
+            >
+              {saving ? '[ 保存中... ]' : '[ 保存更新 ]'}
+            </button>
+          </div>
+        </div>
+      </div>
+    </div>
+  );
+}

+ 371 - 0
src/components/admin/node-configurations/NodeConfigTable.tsx

@@ -0,0 +1,371 @@
+// src/components/admin/node-configurations/NodeConfigTable.tsx
+
+'use client';
+
+import React, { useState } from 'react';
+import { Cpu } from 'lucide-react';
+import { toast } from 'react-hot-toast';
+import {
+  NodeConfigEntryType,
+  NodeConfigurationItem,
+  NodeRuntimeStatus,
+} from '@/types';
+import { nodeConfigService } from '@/lib/services/nodeConfigService';
+import { retroConfirm } from '@/lib/dialog';
+
+interface NodeConfigTableProps {
+  entryType: NodeConfigEntryType;
+  data: NodeConfigurationItem[];
+  loading: boolean;
+  runtimeNodes?: NodeRuntimeStatus[];
+  onViewDetails: (item: NodeConfigurationItem, defaultTab?: 'overview' | 'revisions') => void;
+  onEdit: (item: NodeConfigurationItem) => void;
+  onClone?: (item: NodeConfigurationItem) => void;
+  onInspectInstances?: (nodeId: string, groupId: string) => void;
+  onRefresh: () => void;
+}
+
+export default function NodeConfigTable({
+  entryType,
+  data,
+  loading,
+  runtimeNodes,
+  onViewDetails,
+  onEdit,
+  onClone,
+  onInspectInstances,
+  onRefresh,
+}: NodeConfigTableProps) {
+  const [togglingId, setTogglingId] = useState<number | null>(null);
+
+  const handleToggleEnable = async (item: NodeConfigurationItem) => {
+    const currentEnabled = item.enable === 1 || item.enable === true;
+    const targetEnable = !currentEnabled;
+
+    setTogglingId(item.id);
+    try {
+      const res = await nodeConfigService.toggleEnable(entryType, item.id, targetEnable);
+      if (res.code === 0) {
+        toast.success(`配置已${targetEnable ? '启用' : '停用'}`);
+        onRefresh();
+      } else {
+        toast.error(res.message || '状态切换失败');
+      }
+    } catch (err: any) {
+      console.error('Toggle enable error:', err);
+      toast.error(err?.response?.data?.message || err.message || '切换异常');
+    } finally {
+      setTogglingId(null);
+    }
+  };
+
+  const handleDelete = async (item: NodeConfigurationItem) => {
+    const confirmed = await retroConfirm({
+      title: '[ CONFIRM DELETE // 永久删除配置项 ]',
+      message: `警告:确定要删除节点 [${item.node_id}] 的配置 [${item.identifier}] 吗?此操作不可撤销!`,
+      type: 'danger',
+      confirmText: '[ 确认删除 ]',
+      cancelText: '[ 取消 ]',
+    });
+
+    if (!confirmed) return;
+
+    try {
+      const res = await nodeConfigService.delete(entryType, item.id, false);
+      if (res.code === 0) {
+        toast.success('节点配置已删除');
+        onRefresh();
+      } else {
+        toast.error(res.message || '删除失败');
+      }
+    } catch (err: any) {
+      const errData = err?.response?.data;
+      if (errData && (errData.code === 40000 || err?.response?.status === 400)) {
+        const forceConfirm = await retroConfirm({
+          title: '[ CAUTION: LAST CONFIG // 最后一条配置强力保护 ]',
+          message: `${errData.message || '当前角色在数据库中仅剩最后 1 条配置'}。是否确认执行深度强制清理 (Purge)?`,
+          type: 'danger',
+          confirmText: '[ 强制清理 (PURGE) ]',
+          cancelText: '[ 取消保护 ]',
+        });
+
+        if (forceConfirm) {
+          try {
+            const purgeRes = await nodeConfigService.delete(entryType, item.id, true);
+            if (purgeRes.code === 0) {
+              toast.success('已强制清理最后一条配置');
+              onRefresh();
+            } else {
+              toast.error(purgeRes.message || '强制清理失败');
+            }
+          } catch (purgeErr: any) {
+            toast.error(purgeErr?.response?.data?.message || purgeErr.message || '强制删除异常');
+          }
+        }
+      } else {
+        toast.error(errData?.message || err.message || '删除异常');
+      }
+    }
+  };
+
+  if (loading) {
+    return (
+      <div className="w-full py-16 flex flex-col items-center justify-center gap-3 text-black font-mono text-xs border-2 border-black bg-white shadow-[4px_4px_0px_#000]">
+        <div className="w-6 h-6 border-2 border-black border-t-amber-400 rounded-full animate-spin" />
+        <span className="font-bold">[ LOADING {entryType.toUpperCase()} CONFIGS... // 正在加载节点任务配置 ]</span>
+      </div>
+    );
+  }
+
+  if (data.length === 0) {
+    return (
+      <div className="w-full py-16 flex flex-col items-center justify-center gap-2 text-neutral-600 font-mono text-xs border-2 border-black bg-white shadow-[4px_4px_0px_#000]">
+        <Cpu className="w-8 h-8 text-neutral-400 mb-1" />
+        <span className="font-bold text-black">[ NO {entryType.toUpperCase()} CONFIGS // 暂无节点配置 ]</span>
+        <span className="text-[11px] text-neutral-500">点击右上角「新建 {entryType.toUpperCase()} 任务」开始创建</span>
+      </div>
+    );
+  }
+
+  return (
+    <div className="border-2 border-black bg-white shadow-[4px_4px_0px_#000] font-mono overflow-hidden">
+      <div className="overflow-x-auto">
+        <table className="w-full text-left text-xs border-collapse">
+          <thead>
+            <tr className="border-b-2 border-black bg-neutral-200 text-black uppercase font-black">
+              <th className="p-3.5">节点 ID // 标识符</th>
+              <th className="p-3.5">配置开关</th>
+              <th className="p-3.5">实时遥测 (LIVE)</th>
+              {entryType === 'standalone' && (
+                <th className="p-3.5">关联订单 // 账号</th>
+              )}
+              {entryType === 'booker' && (
+                <th className="p-3.5">账号池 // 实例与CD</th>
+              )}
+              {entryType === 'sentinel' && (
+                <th className="p-3.5">TTL // 扫位模式</th>
+              )}
+              <th className="p-3.5">预约规则</th>
+              <th className="p-3.5">版本</th>
+              <th className="p-3.5">更新人 / 时间</th>
+              <th className="p-3.5 text-right">操作 (ACTIONS)</th>
+            </tr>
+          </thead>
+          <tbody className="divide-y-2 divide-black">
+            {data.map((item) => {
+              const isEnabled = item.enable === 1 || item.enable === true;
+              const isToggling = togglingId === item.id;
+              const apptCount = item.appointment_types?.length || 0;
+
+              return (
+                <tr
+                  key={item.id}
+                  className="hover:bg-amber-50/50 transition group"
+                >
+                  {/* Node & Identifier */}
+                  <td className="p-3.5 font-bold text-black">
+                    <div className="flex flex-col gap-1">
+                      <div className="flex items-center gap-1.5">
+                        <span className="font-black text-black">{item.node_id}</span>
+                        <span className="text-[10px] text-neutral-500 font-normal">#{item.id}</span>
+                      </div>
+                      <div>
+                        <span className="px-1.5 py-0.2 border border-black bg-amber-300 text-black font-black uppercase text-[10px] shadow-[1px_1px_0px_#000]">
+                          {item.identifier}
+                        </span>
+                      </div>
+                    </div>
+                  </td>
+
+                  {/* Status Toggle Button */}
+                  <td className="p-3.5">
+                    <button
+                      type="button"
+                      disabled={isToggling}
+                      onClick={() => handleToggleEnable(item)}
+                      className={`px-2 py-1 border border-black text-[10px] font-black uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition ${
+                        isEnabled
+                          ? 'bg-emerald-300 hover:bg-emerald-400 text-black'
+                          : 'bg-rose-200 hover:bg-rose-300 text-rose-950'
+                      }`}
+                      title="点击切换运行状态"
+                    >
+                      {isToggling ? '切换中...' : isEnabled ? '🟢 [ RUNNING ]' : '🔴 [ STOPPED ]'}
+                    </button>
+                  </td>
+
+                  {/* Live Telemetry Status Pill */}
+                  <td className="p-3.5">
+                    {(() => {
+                      const matchedNode = runtimeNodes?.find(
+                        (n) => n.node_id === item.node_id && n.role === entryType
+                      );
+
+                      if (!matchedNode || !matchedNode.is_online) {
+                        return (
+                          <span className="px-2 py-0.5 border border-black bg-neutral-100 text-neutral-500 text-[10px] font-bold">
+                            ○ 节点离线
+                          </span>
+                        );
+                      }
+
+                      const matchedGroup = matchedNode.groups?.find(
+                        (g) =>
+                          g.group_id === item.identifier ||
+                          g.group_id === item.identifier.split('.')[0] ||
+                          g.plugin_name === item.plugin_config?.plugin_name
+                      );
+
+                      if (!matchedGroup) {
+                        return (
+                          <span className="px-2 py-0.5 border border-black bg-neutral-100 text-neutral-600 text-[10px] font-bold">
+                            ○ 待机中
+                          </span>
+                        );
+                      }
+
+                      const isHealthy = matchedGroup.healthy_tasks > 0 && matchedGroup.healthy_tasks === matchedGroup.total_tasks;
+                      const activeInstance = matchedGroup.plugins?.[0];
+
+                      return (
+                        <div className="flex flex-col gap-0.5">
+                          <button
+                            type="button"
+                            onClick={() => onInspectInstances?.(item.node_id, item.identifier)}
+                            className={`px-2 py-0.5 border border-black text-[10px] font-black uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 text-left w-fit transition ${
+                              isHealthy
+                                ? 'bg-emerald-300 hover:bg-emerald-400 text-black'
+                                : matchedGroup.healthy_tasks > 0
+                                ? 'bg-amber-300 hover:bg-amber-400 text-black'
+                                : 'bg-rose-200 hover:bg-rose-300 text-rose-950'
+                            }`}
+                            title="点击查看该任务正在运行的并发实例堆栈"
+                          >
+                            ● {matchedGroup.healthy_tasks}/{matchedGroup.total_tasks} 活跃
+                            {activeInstance?.state ? ` [${activeInstance.state}]` : ''} 🔍
+                          </button>
+                        </div>
+                      );
+                    })()}
+                  </td>
+
+                  {/* Standalone special */}
+                  {entryType === 'standalone' && (
+                    <td className="p-3.5 text-black">
+                      <div className="flex flex-col gap-0.5 text-[11px]">
+                        <span className="font-black">{item.order_id || '无关联订单'}</span>
+                        <span className="text-neutral-500 text-[10px]">
+                          账号: {item.account?.username || '-'}
+                        </span>
+                      </div>
+                    </td>
+                  )}
+
+                  {/* Booker special */}
+                  {entryType === 'booker' && (
+                    <td className="p-3.5 text-black">
+                      <div className="flex flex-col gap-0.5 text-[11px]">
+                        <span className="font-bold">池: {item.booker?.account_pool_id || '未绑定'}</span>
+                        <span className="text-neutral-500 text-[10px]">
+                          并发: {item.booker?.target_instances ?? 1} 实例 | CD: {item.booker?.account_cd ?? 0}s
+                        </span>
+                      </div>
+                    </td>
+                  )}
+
+                  {/* Sentinel special */}
+                  {entryType === 'sentinel' && (
+                    <td className="p-3.5 text-black">
+                      <div className="flex flex-col gap-0.5 text-[11px]">
+                        <span className="font-bold">TTL: {item.sentinel?.signal_ttl ?? 30}s</span>
+                        <span className="text-neutral-500 text-[10px]">
+                          模式: {item.sentinel?.query_wait?.mode || 'Random'} (
+                          {item.sentinel?.query_wait?.mode === 'Fixed'
+                            ? `${item.sentinel?.query_wait?.fixed_wait}s`
+                            : `${item.sentinel?.query_wait?.random_min || 0}-${item.sentinel?.query_wait?.random_max || 0}s`}
+                          )
+                        </span>
+                      </div>
+                    </td>
+                  )}
+
+                  {/* Appointment Types */}
+                  <td className="p-3.5">
+                    <span className="px-1.5 py-0.5 border border-black bg-white text-black font-bold uppercase text-[10px] shadow-[1px_1px_0px_#000]">
+                      {apptCount} 条规则
+                    </span>
+                  </td>
+
+                  {/* Version */}
+                  <td className="p-3.5 font-bold text-black">
+                    <span className="px-1.5 py-0.5 border border-black bg-neutral-100 text-black text-[11px]">
+                      v{item.version ?? 1}
+                    </span>
+                  </td>
+
+                  {/* Updated At */}
+                  <td className="p-3.5 text-black">
+                    <div className="flex flex-col gap-0.5 text-[11px]">
+                      <span className="font-bold">{item.updated_by || 'admin'}</span>
+                      <span className="text-neutral-500 text-[10px]">
+                        {item.updated_at ? new Date(item.updated_at).toLocaleString() : '-'}
+                      </span>
+                    </div>
+                  </td>
+
+                  {/* Actions */}
+                  <td className="p-3.5 text-right">
+                    <div className="flex items-center justify-end gap-1.5">
+                      <button
+                        type="button"
+                        onClick={() => onViewDetails(item, 'overview')}
+                        className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                        title="查看详情"
+                      >
+                        [ 详情 ]
+                      </button>
+                      <button
+                        type="button"
+                        onClick={() => onViewDetails(item, 'revisions')}
+                        className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                        title="版本修订历史与回滚"
+                      >
+                        [ 修订 ]
+                      </button>
+                      <button
+                        type="button"
+                        onClick={() => onEdit(item)}
+                        className="px-2 py-1 bg-amber-300 hover:bg-amber-400 text-black border border-black text-[10px] font-black uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                        title="编辑配置 (稀疏更新)"
+                      >
+                        [ 编辑 ]
+                      </button>
+                      {onClone && (
+                        <button
+                          type="button"
+                          onClick={() => onClone(item)}
+                          className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                          title="拷贝此配置至其他节点"
+                        >
+                          [ 拷贝 ]
+                        </button>
+                      )}
+                      <button
+                        type="button"
+                        onClick={() => handleDelete(item)}
+                        className="px-2 py-1 bg-rose-100 hover:bg-rose-200 text-rose-950 border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                        title="删除配置条目"
+                      >
+                        [ 删除 ]
+                      </button>
+                    </div>
+                  </td>
+                </tr>
+              );
+            })}
+          </tbody>
+        </table>
+      </div>
+    </div>
+  );
+}

+ 374 - 0
src/components/admin/node-configurations/ProviderModal.tsx

@@ -0,0 +1,374 @@
+// src/components/admin/node-configurations/ProviderModal.tsx
+
+'use client';
+
+import React, { useState, useEffect } from 'react';
+import { toast } from 'react-hot-toast';
+import { ProviderItem, ProviderCreatePayload, ProviderUpdatePayload } from '@/types';
+import { providerService } from '@/lib/services/providerService';
+
+interface ProviderModalProps {
+  isOpen: boolean;
+  onClose: () => void;
+  provider: ProviderItem | null;
+  onSuccess: () => void;
+}
+
+export default function ProviderModal({
+  isOpen,
+  onClose,
+  provider,
+  onSuccess,
+}: ProviderModalProps) {
+  const isEdit = !!provider;
+
+  const [name, setName] = useState('');
+  const [enabled, setEnabled] = useState(true);
+
+  // Plugin config
+  const [libPath, setLibPath] = useState('plugins');
+  const [pluginName, setPluginName] = useState('');
+  const [pluginBin, setPluginBin] = useState('');
+  const [pluginProto, setPluginProto] = useState('IVSPlg');
+
+  // Role templates
+  const [activeRoleTab, setActiveRoleTab] = useState<'booker' | 'sentinel' | 'standalone'>('booker');
+  const [bookerJson, setBookerJson] = useState('{\n  "proxy_cd": 300,\n  "session_max_life": 1800,\n  "booker.account_cd": 10800,\n  "booker.target_instances": 1\n}');
+  const [sentinelJson, setSentinelJson] = useState('{\n  "sentinel.signal_ttl": 30,\n  "sentinel.query_wait.mode": "Random"\n}');
+  const [standaloneJson, setStandaloneJson] = useState('{\n  "login_interval": 1800,\n  "session_max_life": 3600\n}');
+
+  const [saving, setSaving] = useState(false);
+
+  useEffect(() => {
+    if (provider) {
+      setName(provider.name || '');
+      setEnabled(provider.enabled === 1 || provider.enabled === true);
+
+      if (provider.plugin_config) {
+        setLibPath(provider.plugin_config.lib_path || 'plugins');
+        setPluginName(provider.plugin_config.plugin_name || '');
+        setPluginBin(provider.plugin_config.plugin_bin || '');
+        setPluginProto(provider.plugin_config.plugin_proto || 'IVSPlg');
+      } else {
+        setLibPath('plugins');
+        setPluginName('');
+        setPluginBin('');
+        setPluginProto('IVSPlg');
+      }
+
+      const rt = provider.role_templates || {};
+      setBookerJson(rt.booker ? JSON.stringify(rt.booker, null, 2) : '{}');
+      setSentinelJson(rt.sentinel ? JSON.stringify(rt.sentinel, null, 2) : '{}');
+      setStandaloneJson(rt.standalone ? JSON.stringify(rt.standalone, null, 2) : '{}');
+    } else {
+      setName('');
+      setEnabled(true);
+      setLibPath('plugins');
+      setPluginName('');
+      setPluginBin('');
+      setPluginProto('IVSPlg');
+      setBookerJson('{\n  "proxy_cd": 300,\n  "session_max_life": 1800,\n  "booker.account_cd": 10800,\n  "booker.target_instances": 1\n}');
+      setSentinelJson('{\n  "sentinel.signal_ttl": 30,\n  "sentinel.query_wait.mode": "Random"\n}');
+      setStandaloneJson('{\n  "login_interval": 1800,\n  "session_max_life": 3600\n}');
+    }
+  }, [provider, isOpen]);
+
+  if (!isOpen) return null;
+
+  const handleSubmit = async (e: React.FormEvent) => {
+    e.preventDefault();
+
+    if (!isEdit && !name.trim()) {
+      toast.error('服务商唯一标识 (name) 不能为空');
+      return;
+    }
+
+    let parsedBooker = {};
+    let parsedSentinel = {};
+    let parsedStandalone = {};
+
+    try {
+      if (bookerJson.trim()) parsedBooker = JSON.parse(bookerJson);
+    } catch {
+      toast.error('Booker 角色配置 JSON 格式不合法');
+      return;
+    }
+
+    try {
+      if (sentinelJson.trim()) parsedSentinel = JSON.parse(sentinelJson);
+    } catch {
+      toast.error('Sentinel 角色配置 JSON 格式不合法');
+      return;
+    }
+
+    try {
+      if (standaloneJson.trim()) parsedStandalone = JSON.parse(standaloneJson);
+    } catch {
+      toast.error('Standalone 角色配置 JSON 格式不合法');
+      return;
+    }
+
+    const pluginConfig = {
+      lib_path: libPath.trim(),
+      plugin_name: pluginName.trim(),
+      plugin_bin: pluginBin.trim(),
+      plugin_proto: pluginProto.trim(),
+    };
+
+    const roleTemplates = {
+      booker: parsedBooker,
+      sentinel: parsedSentinel,
+      standalone: parsedStandalone,
+    };
+
+    setSaving(true);
+    try {
+      if (isEdit) {
+        const payload: ProviderUpdatePayload = {
+          enabled,
+          plugin_config: pluginConfig,
+          role_templates: roleTemplates,
+        };
+        const res = await providerService.update(provider.name, payload);
+        if (res.code === 0) {
+          toast.success('服务商模板更新成功');
+          onSuccess();
+          onClose();
+        } else {
+          toast.error(res.message || '更新失败');
+        }
+      } else {
+        const payload: ProviderCreatePayload = {
+          name: name.trim(),
+          enabled,
+          plugin_config: pluginConfig,
+          role_templates: roleTemplates,
+        };
+        const res = await providerService.create(payload);
+        if (res.code === 0) {
+          toast.success('服务商模板创建成功');
+          onSuccess();
+          onClose();
+        } else {
+          toast.error(res.message || '创建失败');
+        }
+      }
+    } catch (err: any) {
+      console.error('Provider save error:', err);
+      toast.error(err?.response?.data?.message || err.message || '操作异常');
+    } finally {
+      setSaving(false);
+    }
+  };
+
+  return (
+    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-4 font-mono">
+      <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-3xl overflow-hidden flex flex-col max-h-[90vh] animate-in zoom-in-95 duration-150">
+        {/* Header */}
+        <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
+          <div className="flex items-center gap-2">
+            <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
+            <h3 className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
+              {isEdit ? `[ EDIT PROVIDER // 编辑服务商: ${provider?.name} ]` : '[ NEW PROVIDER // 新建服务商模板 ]'}
+            </h3>
+          </div>
+          <button
+            type="button"
+            onClick={onClose}
+            className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-black text-xs transition shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
+          >
+            ✕
+          </button>
+        </div>
+
+        {/* Body */}
+        <form onSubmit={handleSubmit} className="flex-1 overflow-y-auto p-5 space-y-5 bg-white text-xs">
+          {/* Base Info */}
+          <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+            <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+              <span className="w-2 h-2 bg-black inline-block" />
+              <span className="font-black text-black uppercase">[ 01 // 基础属性定义 ]</span>
+            </div>
+
+            <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+              <div>
+                <label className="block text-[11px] font-bold text-black mb-1">
+                  服务商唯一标识 (NAME) <span className="text-red-500">*</span>
+                </label>
+                <input
+                  type="text"
+                  placeholder="例如: vfs, tls, bls"
+                  value={name}
+                  onChange={(e) => setName(e.target.value)}
+                  disabled={isEdit}
+                  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400 disabled:bg-neutral-200 disabled:cursor-not-allowed"
+                />
+              </div>
+
+              <div>
+                <label className="block text-[11px] font-bold text-black mb-1">启用状态 (STATUS)</label>
+                <select
+                  value={enabled ? '1' : '0'}
+                  onChange={(e) => setEnabled(e.target.value === '1')}
+                  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
+                >
+                  <option value="1">🟢 正常启用 (Enabled)</option>
+                  <option value="0">🔴 停止使用 (Disabled)</option>
+                </select>
+              </div>
+            </div>
+          </div>
+
+          {/* Plugin Config */}
+          <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+            <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
+              <span className="w-2 h-2 bg-black inline-block" />
+              <span className="font-black text-black uppercase">[ 02 // 默认插件参数 (PLUGIN CONFIG) ]</span>
+            </div>
+
+            <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
+              <div>
+                <label className="block text-[11px] font-bold text-black mb-1">动态库目录 (lib_path)</label>
+                <input
+                  type="text"
+                  placeholder="plugins"
+                  value={libPath}
+                  onChange={(e) => setLibPath(e.target.value)}
+                  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+                />
+              </div>
+              <div>
+                <label className="block text-[11px] font-bold text-black mb-1">插件模块名 (plugin_name)</label>
+                <input
+                  type="text"
+                  placeholder="vfs_plugin"
+                  value={pluginName}
+                  onChange={(e) => setPluginName(e.target.value)}
+                  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+                />
+              </div>
+              <div>
+                <label className="block text-[11px] font-bold text-black mb-1">二进制脚本文件 (plugin_bin)</label>
+                <input
+                  type="text"
+                  placeholder="vfs_plugin.py"
+                  value={pluginBin}
+                  onChange={(e) => setPluginBin(e.target.value)}
+                  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+                />
+              </div>
+              <div>
+                <label className="block text-[11px] font-bold text-black mb-1">协议标识 (plugin_proto)</label>
+                <input
+                  type="text"
+                  placeholder="IVSPlg"
+                  value={pluginProto}
+                  onChange={(e) => setPluginProto(e.target.value)}
+                  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
+                />
+              </div>
+            </div>
+          </div>
+
+          {/* Role Templates Tabs */}
+          <div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
+            <div className="flex items-center justify-between border-b-2 border-black pb-1.5">
+              <div className="flex items-center gap-2">
+                <span className="w-2 h-2 bg-black inline-block" />
+                <span className="font-black text-black uppercase">[ 03 // 角色配置模板平铺字典 (ROLE TEMPLATES) ]</span>
+              </div>
+              <span className="text-[10px] text-neutral-500 font-mono">键支持点路径</span>
+            </div>
+
+            {/* Role Stepper / Tabs */}
+            <div className="flex border-2 border-black bg-neutral-200 p-1 gap-1">
+              <button
+                type="button"
+                onClick={() => setActiveRoleTab('booker')}
+                className={`flex-1 py-1.5 text-xs font-mono uppercase transition border ${
+                  activeRoleTab === 'booker'
+                    ? 'bg-amber-300 text-black font-black border-black shadow-[1px_1px_0px_#000]'
+                    : 'bg-white text-neutral-700 font-bold border-transparent hover:bg-neutral-100'
+                }`}
+              >
+                [ BOOKER 模板 ]
+              </button>
+              <button
+                type="button"
+                onClick={() => setActiveRoleTab('sentinel')}
+                className={`flex-1 py-1.5 text-xs font-mono uppercase transition border ${
+                  activeRoleTab === 'sentinel'
+                    ? 'bg-amber-300 text-black font-black border-black shadow-[1px_1px_0px_#000]'
+                    : 'bg-white text-neutral-700 font-bold border-transparent hover:bg-neutral-100'
+                }`}
+              >
+                [ SENTINEL 模板 ]
+              </button>
+              <button
+                type="button"
+                onClick={() => setActiveRoleTab('standalone')}
+                className={`flex-1 py-1.5 text-xs font-mono uppercase transition border ${
+                  activeRoleTab === 'standalone'
+                    ? 'bg-amber-300 text-black font-black border-black shadow-[1px_1px_0px_#000]'
+                    : 'bg-white text-neutral-700 font-bold border-transparent hover:bg-neutral-100'
+                }`}
+              >
+                [ STANDALONE 模板 ]
+              </button>
+            </div>
+
+            {/* JSON Code Window */}
+            <div className="border-2 border-black shadow-[4px_4px_0px_#000]">
+              {activeRoleTab === 'booker' && (
+                <textarea
+                  rows={6}
+                  value={bookerJson}
+                  onChange={(e) => setBookerJson(e.target.value)}
+                  className="w-full p-3 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-amber-300 resize-y"
+                  placeholder="{}"
+                />
+              )}
+              {activeRoleTab === 'sentinel' && (
+                <textarea
+                  rows={6}
+                  value={sentinelJson}
+                  onChange={(e) => setSentinelJson(e.target.value)}
+                  className="w-full p-3 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-emerald-300 resize-y"
+                  placeholder="{}"
+                />
+              )}
+              {activeRoleTab === 'standalone' && (
+                <textarea
+                  rows={6}
+                  value={standaloneJson}
+                  onChange={(e) => setStandaloneJson(e.target.value)}
+                  className="w-full p-3 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-cyan-300 resize-y"
+                  placeholder="{}"
+                />
+              )}
+            </div>
+          </div>
+        </form>
+
+        {/* Footer */}
+        <div className="px-5 py-3 bg-neutral-200 border-t-2 border-black flex justify-end gap-2 shrink-0">
+          <button
+            type="button"
+            onClick={onClose}
+            className="px-4 py-1.5 bg-white hover:bg-neutral-100 text-black border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+          >
+            [ 取消 ]
+          </button>
+          <button
+            type="button"
+            onClick={handleSubmit}
+            disabled={saving}
+            className="px-5 py-1.5 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black text-xs font-black uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 disabled:opacity-50"
+          >
+            {saving ? '[ 保存中... ]' : isEdit ? '[ 保存修改 ]' : '[ 确认创建 ]'}
+          </button>
+        </div>
+      </div>
+    </div>
+  );
+}

+ 167 - 0
src/components/admin/node-configurations/ProviderTable.tsx

@@ -0,0 +1,167 @@
+// src/components/admin/node-configurations/ProviderTable.tsx
+
+'use client';
+
+import React from 'react';
+import { Edit, Trash2, Layers } from 'lucide-react';
+import { ProviderItem } from '@/types';
+
+interface ProviderTableProps {
+  data: ProviderItem[];
+  loading: boolean;
+  onEdit: (provider: ProviderItem) => void;
+  onDelete: (provider: ProviderItem) => void;
+}
+
+export default function ProviderTable({
+  data,
+  loading,
+  onEdit,
+  onDelete,
+}: ProviderTableProps) {
+  if (loading) {
+    return (
+      <div className="w-full py-16 flex flex-col items-center justify-center gap-3 text-black font-mono text-xs border-2 border-black bg-white shadow-[4px_4px_0px_#000]">
+        <div className="w-6 h-6 border-2 border-black border-t-amber-400 rounded-full animate-spin" />
+        <span className="font-bold">[ LOADING PROVIDER TEMPLATES... // 正在加载服务商模板数据 ]</span>
+      </div>
+    );
+  }
+
+  if (data.length === 0) {
+    return (
+      <div className="w-full py-16 flex flex-col items-center justify-center gap-2 text-neutral-600 font-mono text-xs border-2 border-black bg-white shadow-[4px_4px_0px_#000]">
+        <Layers className="w-8 h-8 text-neutral-400 mb-1" />
+        <span className="font-bold text-black">[ NO PROVIDER TEMPLATES // 暂无服务商模板数据 ]</span>
+        <span className="text-[11px] text-neutral-500">点击右上角「新建服务商模板」添加</span>
+      </div>
+    );
+  }
+
+  return (
+    <div className="border-2 border-black bg-white shadow-[4px_4px_0px_#000] font-mono overflow-hidden">
+      <div className="overflow-x-auto">
+        <table className="w-full text-left text-xs border-collapse">
+          <thead>
+            <tr className="border-b-2 border-black bg-neutral-200 text-black uppercase font-black">
+              <th className="p-3.5">服务商标识 (NAME)</th>
+              <th className="p-3.5">状态 (STATUS)</th>
+              <th className="p-3.5">默认插件 (PLUGIN)</th>
+              <th className="p-3.5">角色模板 (ROLES)</th>
+              <th className="p-3.5">版本</th>
+              <th className="p-3.5">更新人 / 时间</th>
+              <th className="p-3.5 text-right">操作 (ACTIONS)</th>
+            </tr>
+          </thead>
+          <tbody className="divide-y-2 divide-black">
+            {data.map((item) => {
+              const isEnabled = item.enabled === 1 || item.enabled === true;
+              const roles = item.role_templates ? Object.keys(item.role_templates) : [];
+
+              return (
+                <tr
+                  key={item.id || item.name}
+                  className="hover:bg-amber-50/50 transition group"
+                >
+                  {/* Name */}
+                  <td className="p-3.5 font-bold text-black">
+                    <div className="flex items-center gap-2">
+                      <span className="px-2 py-0.5 bg-amber-300 border border-black text-black font-black text-xs uppercase shadow-[1px_1px_0px_#000]">
+                        {item.name}
+                      </span>
+                      <span className="text-[11px] text-neutral-500">#{item.id}</span>
+                    </div>
+                  </td>
+
+                  {/* Status */}
+                  <td className="p-3.5">
+                    {isEnabled ? (
+                      <span className="px-1.5 py-0.5 border border-black bg-emerald-300 text-black text-[10px] font-black uppercase shadow-[1px_1px_0px_#000]">
+                        [ 正常启用 ]
+                      </span>
+                    ) : (
+                      <span className="px-1.5 py-0.5 border border-black bg-rose-200 text-rose-950 text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000]">
+                        [ 已停用 ]
+                      </span>
+                    )}
+                  </td>
+
+                  {/* Plugin */}
+                  <td className="p-3.5 text-black">
+                    {item.plugin_config ? (
+                      <div className="flex flex-col gap-0.5 text-[11px]">
+                        <span className="font-bold">{item.plugin_config.plugin_name || '内置'}</span>
+                        <span className="text-neutral-500 text-[10px]">
+                          {item.plugin_config.plugin_bin || '-'} ({item.plugin_config.plugin_proto || '-'})
+                        </span>
+                      </div>
+                    ) : (
+                      <span className="text-neutral-400">-</span>
+                    )}
+                  </td>
+
+                  {/* Roles */}
+                  <td className="p-3.5">
+                    {roles.length > 0 ? (
+                      <div className="flex flex-wrap gap-1">
+                        {roles.map((r) => (
+                          <span
+                            key={r}
+                            className="px-1.5 py-0.5 border border-black bg-white text-black font-bold uppercase text-[10px] shadow-[1px_1px_0px_#000]"
+                          >
+                            {r}
+                          </span>
+                        ))}
+                      </div>
+                    ) : (
+                      <span className="text-neutral-400 text-[11px]">未配置</span>
+                    )}
+                  </td>
+
+                  {/* Version */}
+                  <td className="p-3.5 font-bold text-black">
+                    <span className="px-1.5 py-0.5 border border-black bg-neutral-100 text-black text-[11px]">
+                      v{item.version ?? 1}
+                    </span>
+                  </td>
+
+                  {/* Updated At */}
+                  <td className="p-3.5 text-black">
+                    <div className="flex flex-col gap-0.5 text-[11px]">
+                      <span className="font-bold">{item.updated_by || 'admin'}</span>
+                      <span className="text-neutral-500 text-[10px]">
+                        {item.updated_at ? new Date(item.updated_at).toLocaleString() : '-'}
+                      </span>
+                    </div>
+                  </td>
+
+                  {/* Actions */}
+                  <td className="p-3.5 text-right">
+                    <div className="flex items-center justify-end gap-1.5">
+                      <button
+                        type="button"
+                        onClick={() => onEdit(item)}
+                        className="px-2.5 py-1 bg-amber-300 hover:bg-amber-400 text-black border border-black text-[10px] font-black uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                        title="编辑服务商模板"
+                      >
+                        [ 编辑 ]
+                      </button>
+                      <button
+                        type="button"
+                        onClick={() => onDelete(item)}
+                        className="px-2.5 py-1 bg-rose-100 hover:bg-rose-200 text-rose-950 border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition"
+                        title="删除服务商模板"
+                      >
+                        [ 删除 ]
+                      </button>
+                    </div>
+                  </td>
+                </tr>
+              );
+            })}
+          </tbody>
+        </table>
+      </div>
+    </div>
+  );
+}

+ 166 - 0
src/lib/services/nodeConfigService.ts

@@ -0,0 +1,166 @@
+// src/lib/services/nodeConfigService.ts
+
+import api from '@/lib/api';
+import {
+  NodeConfigEntryType,
+  NodeConfigurationItem,
+  NodeConfigListParams,
+  SparseUpdatePayload,
+  RevisionItem,
+} from '@/types';
+
+export const nodeConfigService = {
+  /**
+   * 分页查询配置列表
+   */
+  async getList(
+    entryType: NodeConfigEntryType,
+    params?: NodeConfigListParams
+  ): Promise<{
+    code: number;
+    message: string;
+    data: {
+      total: number;
+      page: number;
+      page_size: number;
+      items: NodeConfigurationItem[];
+    };
+  }> {
+    const res = await api.get(`/api/node-configurations/${entryType}`, { params });
+    return res.data;
+  },
+
+  /**
+   * 获取配置详情
+   */
+  async getDetail(
+    entryType: NodeConfigEntryType,
+    entryId: number
+  ): Promise<{
+    code: number;
+    message: string;
+    data: NodeConfigurationItem;
+  }> {
+    const res = await api.get(`/api/node-configurations/${entryType}/${entryId}`);
+    return res.data;
+  },
+
+  /**
+   * 新建配置条目
+   */
+  async create(
+    entryType: NodeConfigEntryType,
+    payload: Partial<NodeConfigurationItem>
+  ): Promise<{
+    code: number;
+    message: string;
+    data: NodeConfigurationItem;
+  }> {
+    const res = await api.post(`/api/node-configurations/${entryType}`, payload);
+    return res.data;
+  },
+
+  /**
+   * 稀疏更新配置 (Sparse Update)
+   */
+  async sparseUpdate(
+    entryType: NodeConfigEntryType,
+    entryId: number,
+    payload: SparseUpdatePayload
+  ): Promise<{
+    code: number;
+    message: string;
+    data: NodeConfigurationItem;
+  }> {
+    const res = await api.put(`/api/node-configurations/${entryType}/${entryId}`, payload);
+    return res.data;
+  },
+
+  /**
+   * 启用 / 停用配置
+   */
+  async toggleEnable(
+    entryType: NodeConfigEntryType,
+    entryId: number,
+    enable: boolean
+  ): Promise<{
+    code: number;
+    message: string;
+    data: NodeConfigurationItem;
+  }> {
+    const res = await api.put(`/api/node-configurations/${entryType}/${entryId}/enable`, {
+      enable,
+    });
+    return res.data;
+  },
+
+  /**
+   * 删除配置条目 (支持 confirm_purge 保护守卫)
+   */
+  async delete(
+    entryType: NodeConfigEntryType,
+    entryId: number,
+    confirmPurge: boolean = false
+  ): Promise<{
+    code: number;
+    message: string;
+    data: boolean;
+  }> {
+    const res = await api.delete(`/api/node-configurations/${entryType}/${entryId}`, {
+      params: confirmPurge ? { confirm_purge: true } : undefined,
+    });
+    return res.data;
+  },
+
+  /**
+   * 查询配置修订历史记录 (Revisions)
+   */
+  async getRevisions(
+    entryType: NodeConfigEntryType,
+    entryId: number
+  ): Promise<{
+    code: number;
+    message: string;
+    data: RevisionItem[];
+  }> {
+    const res = await api.get(`/api/node-configurations/${entryType}/${entryId}/revisions`);
+    return res.data;
+  },
+
+  /**
+   * 回滚配置至指定历史版本
+   */
+  async rollback(
+    entryType: NodeConfigEntryType,
+    entryId: number,
+    revisionId: number
+  ): Promise<{
+    code: number;
+    message: string;
+    data: NodeConfigurationItem;
+  }> {
+    const res = await api.post(`/api/node-configurations/${entryType}/${entryId}/rollback`, {
+      revision_id: revisionId,
+    });
+    return res.data;
+  },
+
+  /**
+   * 获取 Worker 节点集群实时状态与心跳
+   */
+  async getRuntimeStatus(params?: {
+    role?: string;
+    node_id?: string;
+  }): Promise<{
+    code: number;
+    message: string;
+    data: {
+      nodes: import('@/types').NodeRuntimeStatus[];
+      timestamp: string;
+    };
+  }> {
+    const res = await api.get('/api/node-configurations/runtime-status', { params });
+    return res.data;
+  },
+};
+

+ 73 - 0
src/lib/services/providerService.ts

@@ -0,0 +1,73 @@
+// src/lib/services/providerService.ts
+
+import api from '@/lib/api';
+import {
+  ProviderItem,
+  ProviderCreatePayload,
+  ProviderUpdatePayload,
+} from '@/types';
+
+export const providerService = {
+  /**
+   * 获取服务商目录列表
+   */
+  async getList(params?: { enabled_only?: boolean }): Promise<{
+    code: number;
+    message: string;
+    data: ProviderItem[];
+  }> {
+    const res = await api.get('/api/providers', { params });
+    return res.data;
+  },
+
+  /**
+   * 获取服务商详情
+   */
+  async getDetail(name: string): Promise<{
+    code: number;
+    message: string;
+    data: ProviderItem;
+  }> {
+    const res = await api.get(`/api/providers/${encodeURIComponent(name)}`);
+    return res.data;
+  },
+
+  /**
+   * 新建服务商模板
+   */
+  async create(payload: ProviderCreatePayload): Promise<{
+    code: number;
+    message: string;
+    data: ProviderItem;
+  }> {
+    const res = await api.post('/api/providers', payload);
+    return res.data;
+  },
+
+  /**
+   * 编辑服务商模板
+   */
+  async update(
+    name: string,
+    payload: ProviderUpdatePayload
+  ): Promise<{
+    code: number;
+    message: string;
+    data: ProviderItem;
+  }> {
+    const res = await api.put(`/api/providers/${encodeURIComponent(name)}`, payload);
+    return res.data;
+  },
+
+  /**
+   * 删除服务商模板
+   */
+  async delete(name: string): Promise<{
+    code: number;
+    message: string;
+    data: boolean;
+  }> {
+    const res = await api.delete(`/api/providers/${encodeURIComponent(name)}`);
+    return res.data;
+  },
+};

+ 1 - 0
src/types/index.ts

@@ -12,3 +12,4 @@ export * from './config';
 export * from './slot';
 export * from './card';
 export * from './plugin';
+export * from './node_config';

+ 212 - 0
src/types/node_config.ts

@@ -0,0 +1,212 @@
+// src/types/node_config.ts
+
+export type NodeConfigEntryType = 'booker' | 'sentinel' | 'standalone';
+
+export interface PluginConfig {
+  lib_path?: string;
+  plugin_name?: string;
+  plugin_bin?: string;
+  plugin_proto?: string;
+}
+
+export type RoleTemplateMap = Record<string, any>;
+
+export interface ProviderItem {
+  id: number;
+  name: string;
+  enabled: number | boolean;
+  plugin_config?: PluginConfig;
+  role_templates?: {
+    booker?: RoleTemplateMap;
+    sentinel?: RoleTemplateMap;
+    standalone?: RoleTemplateMap;
+  };
+  version: number;
+  updated_by?: string;
+  created_at?: string;
+  updated_at?: string;
+}
+
+export interface ProviderCreatePayload {
+  name: string;
+  enabled?: boolean;
+  plugin_config?: PluginConfig;
+  role_templates?: {
+    booker?: RoleTemplateMap;
+    sentinel?: RoleTemplateMap;
+    standalone?: RoleTemplateMap;
+  };
+}
+
+export interface ProviderUpdatePayload {
+  enabled?: boolean;
+  plugin_config?: PluginConfig;
+  role_templates?: {
+    booker?: RoleTemplateMap;
+    sentinel?: RoleTemplateMap;
+    standalone?: RoleTemplateMap;
+  };
+}
+
+export interface AppointmentTypeItem {
+  weight?: number;
+  routing_key: string;
+  city?: string;
+  visa_type?: string;
+  country?: string;
+  [key: string]: any;
+}
+
+export interface BookerConfig {
+  account_source?: string;
+  account_pool_id?: string;
+  target_instances?: number;
+  account_cd?: number;
+  booking_cooldown?: number;
+  max_bookings_per_account?: number;
+  [key: string]: any;
+}
+
+export interface SentinelQueryWait {
+  mode: 'Random' | 'Fixed' | string;
+  fixed_wait?: number;
+  random_min?: number;
+  random_max?: number;
+}
+
+export interface SentinelConfig {
+  account_source?: string;
+  account_pool_id?: string;
+  target_instances?: number;
+  signal_ttl?: number;
+  query_wait?: SentinelQueryWait;
+  [key: string]: any;
+}
+
+export interface StandaloneAccount {
+  username?: string;
+  password?: string;
+  [key: string]: any;
+}
+
+export interface StandaloneUserPreferences {
+  support_pta?: boolean;
+  expected_start_date?: string;
+  expected_end_date?: string;
+  [key: string]: any;
+}
+
+export interface NodeConfigRollbackPayload {
+  revision_id: number;
+}
+
+// ==========================================
+// 节点集群实时状态上报 (Telemetry Types)
+// ==========================================
+
+export interface InstalledPluginItem {
+  name: string;
+  version: string;
+  description: string;
+  filename: string;
+}
+
+export interface RuntimePluginInstance {
+  instance_id: string;
+  is_healthy: boolean;
+  state: string;
+  current_url?: string;
+  account?: string;
+  proxy?: string;
+  session_age_sec?: number;
+  last_active_at?: string;
+}
+
+export interface RuntimeGroupStatus {
+  group_id: string;
+  enable: boolean;
+  plugin_name: string;
+  wrapper_state: string;
+  total_tasks: number;
+  healthy_tasks: number;
+  plugins: RuntimePluginInstance[];
+  updated_at: string;
+}
+
+export interface NodeRuntimeStatus {
+  role: string;
+  node_id: string;
+  is_online: boolean;
+  age_sec: number;
+  installed_plugins: InstalledPluginItem[];
+  groups: RuntimeGroupStatus[];
+  collected_at: string;
+}
+
+export interface RuntimeStatusResponse {
+  nodes: NodeRuntimeStatus[];
+  timestamp: string;
+}
+
+export interface NodeConfigurationItem {
+  id: number;
+  node_id: string;
+  identifier: string;
+  enable: number | boolean;
+  debug?: number | boolean;
+  need_account?: number;
+  need_proxy?: number;
+  proxy_pool?: string[];
+  proxy_cd?: number;
+  session_max_life?: number;
+  active_time_start?: string;
+  active_time_end?: string;
+  website?: string;
+
+  // Booker role
+  booker?: BookerConfig;
+
+  // Sentinel role
+  sentinel?: SentinelConfig;
+
+  // Standalone role
+  order_id?: string;
+  account?: StandaloneAccount;
+  login_interval?: number;
+  query_wait?: SentinelQueryWait;
+  user_preferences?: StandaloneUserPreferences;
+
+  // Common objects
+  plugin_config?: PluginConfig;
+  appointment_types?: AppointmentTypeItem[];
+  free_config?: Record<string, any>;
+
+  version: number;
+  updated_by?: string;
+  created_at?: string;
+  updated_at?: string;
+}
+
+export interface NodeConfigListParams {
+  page?: number;
+  pageSize?: number;
+  identifier?: string;
+  node_id?: string;
+  order_id?: string;
+}
+
+export interface SparseUpdatePayload {
+  set?: Record<string, any>;
+  clear?: string[];
+}
+
+export interface RevisionItem {
+  id: number;
+  entry_type: NodeConfigEntryType;
+  entry_id: number;
+  version: number;
+  action: 'create' | 'update' | 'enable' | 'rollback' | string;
+  snapshot: Record<string, any>;
+  updated_by?: string;
+  created_at?: string;
+}