release: bump version to 0.62.0
Some checks failed
ci / backend (push) Has been cancelled
ci / frontend (push) Has been cancelled
ci / delivery (push) Has been cancelled
release / images (push) Has been cancelled

This commit is contained in:
linkong
2026-05-21 01:37:32 +08:00
parent 5c65ee24d6
commit fbca381512
138 changed files with 21303 additions and 5721 deletions

View File

@@ -8,6 +8,23 @@ This project follows the repository versioning rule:
- `improvement` -> `+0.0.1`bugfix + 小功能混合)
- `bugfix` -> `+0.0.1`
## [0.62.0] — 2026-05-21
Released: 2026-05-21
### Highlights
- Admin Next 转正为正式后台入口,旧 AntD 控制台完整迁移到 `/legacy/admin/*` 作为回退和对照,并保留 `/admin-next/*` 兼容重定向。
- 新后台完成采集、AI Provider、Earth 内容、日志、BGP/告警、设置和认证链路的全量收口,新增 lazy tab loading、层级配置、移动端详情和 Markdown 文档渲染体验。
- 抽出 Tactile UI 按钮、开关、tooltip、滚动条和表格滚动组件为未来独立 npm 组件库打基础,同时补齐中英文开发文档。
### Added / Fixed / Improved
- 新增采集管理分层工作台,覆盖采集器配置、采集调度、采集历史/快照、凭证教程生成/重置、映射 propose/preview/create/activate 和真实连接/运行状态。
- 改进 AI Provider 与工具调用配置,修复 key fallback、脱敏显示、轻量连通性测试、默认 provider、OpenCode Go 路由和 Playground Markdown 输出。
- 更新 Earth 内容管理和 Earth 前台体验,支持品牌预览/上传/重置、TV 默认源与新增草稿、图层/新闻/3D 模型配置入口以及 live TV 预览。
- 强化后端数据源、系统日志、WebSocket、AI client、位置 LLM fallback、Earth layer cache 和 datasource connectivity并补充相关回归测试与运维脚本能力。
---
## [0.61.0] — 2026-05-18
Released: 2026-05-18

View File

@@ -35,7 +35,11 @@
- [Docs Gatekeeper 鉴权系统计划](/home/ray/dev/linkong/planet/docs/plans/docs-gatekeeper-auth-plan.md)
- [Location Resolver 共享管线计划](/home/ray/dev/linkong/planet/docs/plans/location-resolver-shared-pipeline-plan.md)
- [frontend-ai-playground-development-plan.md](/home/ray/dev/linkong/planet/docs/plans/frontend-ai-playground-development-plan.md)
- [AI Provider OpenClaw-Style Routing Plan](/home/ray/dev/linkong/planet/docs/plans/ai-provider-openclaw-style-routing-plan.md)
- [统一集成配置 Schema 系统计划](/home/ray/dev/linkong/planet/docs/plans/integration-config-schema-system-plan.md)
- [Lightweight Agent Orchestrator 与 WebSearch 证据层计划](/home/ray/dev/linkong/planet/docs/plans/agents-light-orchestrator-websearch-plan.md)
- [Admin Next Parity Checklist](/home/ray/dev/linkong/planet/docs/plans/admin-next-parity-checklist.md)
- [Admin Next Parity Audit Closeout](/home/ray/dev/linkong/planet/docs/plans/admin-next-parity-audit-closeout-plan.md)
- [ue5-mvp-fused-plan.md](/home/ray/dev/linkong/planet/docs/plans/ue5-mvp-fused-plan.md)
不适合放入这里的内容:

View File

@@ -0,0 +1,128 @@
# Admin Next 双轨全量迁移修正计划
## Summary
`/admin-next/*` 继续作为新版影子路由开发,旧 AntD 控制台必须完整保留作为生产回退和行为对照。只有新版完成全功能 parity 并通过验收后,才能逐个切换旧路由;删除旧页面和移除 AntD 必须作为最后独立步骤,并等待明确确认。
## Hard Rules
- 未完成 parity checklist 前,不删除旧页面、不移除 AntD、不切旧入口。
- “旧版能删除”只表示新版能力达到替代标准,不表示立即删除旧版。
- 新版不能只做看板旧版里可新增、编辑、删除、测试、触发、批量、轮询、WebSocket、权限控制、错误提示和确认弹窗的能力都必须迁移。
- `/admin-next/*` 可以重做交互和视觉但业务语义、API payload、权限和危险操作保护必须对齐旧版。
## Design Direction
- 风格采用“朴素工具化 + 轻微立体触感”:灰白/暗色低对比背景、清晰 1px 边框、轻微凸起/按下态、克制圆角、图标少量彩色。
- 禁止回到 soft-glass、hero、大发光、大渐变、大色块和装饰性卡片。
- 常规动作默认 icon-only + tooltip刷新、重启、退出、复制、查看、编辑、删除、关闭、设置。
- 强意图动作保留实心文字按钮:保存、创建、确认、执行、测试连接。
- 页面统一 `16px` 外边距、`16px` 主区块间距、`12px` 面板 header/body 间距;表格标题和表体不能贴边。
- 所有页面遵守一屏工作台:`PageHeader` 之外只允许一个主内容区域吃满剩余高度;详情区、表格区和 Playground 消息区内部滚动,不能被父级裁掉。
- 页内 tabs 必须按旧版用户心智组织,而不是按后端接口名拆散;接口状态只能作为分区内部信息。
## Implementation Plan
1. 恢复旧版安全网:恢复旧 AntD 页面、旧 `AppLayout`、旧 helper、AntD 依赖和旧路由;保留 `/admin-next/*` 影子路由。
2. 建立新版基础层:整理 admin-next token、按钮、tooltip、theme switch、sidebar account、`EntityTable``FormDialog``ConfirmDialog``DetailPanel`、移动端表格/卡片切换。
3. 拆掉通用看板页每个模块建立真实业务页面、API adapter、form/mutation、轮询或 WebSocket 逻辑,不再用万能 Resource table 聚合展示。
4. 按模块迁移:
- Dashboard统计、WebSocket、健康检查、重启任务、任务日志、恢复探测。
- DataSources内置源/自定义源/实时源、详情、stats、task-status、启停、触发、批量触发、清理数据。
- DataList列表、summary、sources/types/countries、搜索、筛选、分页、详情、导出、分布。
- Collection Managementconfigs CRUD、builtin connect/test、target schemas、mappings、run/stop、stream status。
- Settingssystem、notifications、security、SMTP、TV、integrations、collectors、测试连接、凭证指南。
- AIprovider、web search、OCR、prompt registry、playground 完整会话操作。
- Earth Contentbrand、upload、delete/reset、boundary config/build/status、TV/content。
- Logssources、level/date/search、刷新、详情、复制、tail/snapshot。
- BGPoverview、collectors、incidents、anomalies、events、AI briefs。
- Alerts系统告警、BGP 告警、态势告警,包含 ack/resolve/stats/brief。
- Userslist/create/edit/delete、role、Gatekeeper groups、权限显示。
- Auth登录、注册、验证邮箱、重发、找回、重置、logout。
5. 每完成一个模块,对照旧页面跑 checklist只有全部模块通过后才提出旧路由切换和旧版删除。
## Test Plan
- 恢复阶段:`cd frontend && /home/ray/.bun/bin/bun install && /home/ray/.bun/bin/bun run build`
- 旧路由检查:`/admin``/datasources``/settings``/ai``/logs` 必须继续打开旧版。
- 新路由检查:`/admin-next/*` 必须继续打开新版。
- 每模块 parity读写删、测试连接、触发、批量、轮询、WebSocket、权限、错误提示、确认弹窗、移动端和滚动。
- 视觉检查light/dark/system、低高度窗口、125%/150% 缩放、按钮/状态/badge 等高、无双滚动条。
## Parity Checklist
### Dashboard
- [x] `/dashboard/stats` 数据展示与旧版一致。
- [x] WebSocket 连接状态、健康状态、自动刷新语义一致。
- [x] 重启任务创建、轮询、日志查看、失败提示和恢复探测一致。
### DataSources
- [x] 内置源、自定义源、实时源分区清晰,不混表。
- [x] 详情、stats、task-status、enable/disable、trigger、trigger-batch、trigger-all、delete-data 与旧版一致。
- [x] 实时源 start/stop/restart、连接状态、任务状态与旧版一致。
### DataList
- [x] 列表、summary、sources/types/countries、搜索、筛选、分页参数与旧版一致。
- [x] 详情 metadata、分布摘要、JSON/CSV 导出与旧版一致。
- [x] 表格固定列、横向滚动、移动端卡片模式可用。
### Collection Management
- [x] configs/all、configs CRUD、builtin connect/test、custom sample 与旧版一致。
- [x] target schemas、mappings preview/list/update/activate 与旧版一致propose/create 已提供表单化入口。
- [x] run-mapped、stop-mapped、stream-status 与旧版一致。
### Settings
- [x] system、notifications、security、SMTP、TV、integrations、collectors 表单字段完整。
- [x] SMTP test、AI/Web/OCR secrets、connect tests、preset refresh 与旧版一致。
- [x] credential guides、cache 清理、危险操作确认一致。
### AI
- [x] Provider、Web Search、OCR、Prompt Registry 配置保存/重置完整。
- [x] Playground thread/session/messages/status/stop/resend/edit 完整。
- [x] provider refresh、connect test、secrets 读取、错误提示和 loading 状态完整。
- [x] 页内 tabs 按旧版心智恢复为模型供应商、工具调用、提示词、Playground。
### Earth Content
- [x] brand get/save/delete/reset/upload 完整。
- [x] boundary status/config/build/build-status 完整。
- [x] TV/content 配置与旧版 Settings 入口一致。
### Logs
- [x] sources、level/date/search、limit、刷新参数与旧版一致。
- [x] 日志正文、详情展开、复制、空态和错误态完整。
### BGP
- [x] overview、collectors、incidents、anomalies、events 的 summary/list/detail 完整。
- [x] AI brief list/detail/generate 完整。
- [x] collector collect-location、刷新、结果详情和错误提示完整。
### Alerts
- [x] 系统告警 list/detail/ack/resolve/stats/AI brief 完整。
- [x] BGP incidents/anomalies/brief 完整。
- [x] 态势告警 stats/list/brief 完整。
### Users
- [x] list/create/edit/delete、role、Gatekeeper groups 完整。
- [x] 权限显示、普通用户限制和 super admin 行为一致。
### Auth
- [x] login/register/verify/resend cooldown/forgot/reset/logout/me 完整。
- [x] 未验证邮箱跳转、错误提示、成功跳转和 token store 行为一致。
### Hierarchy Repair
- [x] AI 不再按接口/状态拍平成一张表;模型供应商恢复为 provider -> model/API/key 层级。
- [x] 工具调用恢复为 Web Search/OCR -> provider/API/高级参数层级。
- [x] 提示词恢复为 group -> prompt 入口层级,保存/重置只作用于当前入口。
- [x] Settings/Earth 配置型页面使用父级列表 + 右侧正式表单,长内容在一屏内内部滚动。
### Interaction Polish
- [x] 不会产生歧义的刷新、复制、详情、批量、状态、清理等动作优先改为 icon-only + tooltip/title。
- [x] 强意图动作保留实心文字按钮,例如保存、创建、触发全部、生成简报、确认执行。
- [x] 按钮字号、高度、图标容器和 hover 触感统一,接近侧栏深色模式滑块的轻微立体风格。
- [x] 表格与详情之间增加可拖动竖向 resize handle低高度和窄屏下不制造额外滚动条。
### Page Information Architecture
- [x] 页内 tab 默认使用中文BGP、AI、OCR、Web Search、Playground、Schema 等专有名词按可识别性保留。
- [x] 信息观测类页面使用列表 + 详情,例如 BGP、Alerts、Logs、DataSources。
- [x] 配置管理类页面使用分层结构,例如 AI、Settings、Earth Content、Collection Management。
- [x] 采集管理已从纯表格看板改为分层管理:采集器、映射模板、目标 Schema、运行状态先选父级再编辑或执行动作。

View File

@@ -0,0 +1,135 @@
# Admin Next Parity Audit Closeout
Last updated: 2026-05-21
## Status
Admin Next has been promoted to the official admin route family. The old AntD admin, old layout helpers, `antd`, and `@ant-design/icons` remain available under `/legacy/admin/*` as the rollback and comparison surface.
`/admin-next/*` is now compatibility-only: old test links redirect to the official route. Do not add new capabilities there as a separate entry point.
This closeout document is the final work log for the second parity audit. It records what has been fixed, what still requires manual verification, and what must not be treated as complete.
## Fixed In This Audit
- Restored the dual-track rule: old AntD pages and routes are not deleted and are not replaced before parity sign-off.
- Reworked management pages away from flat status tables toward business hierarchy:
- AI: `模型供应商 / 工具调用 / 提示词 / Playground`.
- Settings: system display, notification policy, security policy, SMTP only.
- Earth Content: brand, boundary precision, TV content.
- Collection: collector, collection schedule, history/snapshot.
- Repaired AI provider credential semantics:
- Provider status now comes from that provider's stored key or a runtime key that is explicitly scoped to that provider.
- Generic `.env` fallback no longer marks every provider as configured.
- Runtime fallback secrets stay masked by default; authorized administrators can reveal them through the console and each reveal must be audited without storing plaintext.
- Secret previews preserve the prefix before the first `-` when the backend preview exposes it, for example `sk-**********`.
- Connect-test buttons are icon-only plug actions and do not save configuration.
- Repaired key UI gaps:
- LLM API Key, proxy token, Web Search API Key, and OCR API Key use masked input with inline eye toggle.
- Save buttons use the disk icon.
- Default action is disabled when the item is already default.
- Repaired SMTP test flow:
- SMTP test has a recipient input.
- Request payload is `{ to, settings }`.
- Repaired Earth Content actions:
- Brand save, upload, delete/reset actions are available in the brand section.
- Brand preview renders with the same Earth left-top brand structure and starfield-style background.
- Boundary build is scoped to the boundary precision section, not the global page toolbar.
- TV default configuration is folded into item-level configuration; TV items support add/default/reset/delete semantics.
- TV default source now follows the same default-state semantics as AI Provider: if the response does not expose an explicit default, `cgtn-en` is treated as the runtime default; setting a default promotes that item visually and disables the redundant default action.
- Repaired Collection actions:
- Credential guide read/generate/reset entry points are available from collector-related panels.
- Create collector config uses field-first form controls with advanced JSON as a secondary path.
- Mapping propose/preview/create/activate flow is represented in the mapping workflow.
- Repaired shared UI rules:
- Management list names can wrap and remain readable instead of being squeezed by status tags.
- Status tags are fixed width and color-coded: default blue, configured green, unconfigured gray, error red.
- Configuration lists with a default item sort the default item to the top after save/default changes instead of leaving it in the previous alphabetical or API order.
- List footer actions are part of the scroll content; users see them after scrolling to the bottom.
- Footer icon buttons use the current tactile surface direction: external shadow first, without a separate inset/base-plate treatment.
- Detail panels use a dark neutral resize handle.
- Tooltip, dialog, modal backdrop, textarea scrollbar, custom scrollbar, mobile detail, and one-screen layout issues from the audit have been addressed in the shared admin-next layer.
- Multi-tab Admin Next pages now use lazy active-tab loading with local cache. Initial page load no longer requests every section endpoint; manual refresh and mutating actions refresh only the current section.
- Markdown-producing details, AI brief content, credential tutorials, and Playground assistant output use the shared Markdown renderer where the content is meant to be read as a document. Raw metadata remains available only where the page is explicitly showing original payloads.
- Added developer workflow scripts:
- `build:watch`
- `preview:auto`
- `bun run build` remains a production artifact build and does not reload an already-open dev page by itself.
## Manual Verification Status
The code has been updated. The list below records which areas are already manually checked and which still need route-level regression before replacement:
- AI:
- Latest manual pass marked provider status, secret reveal, and Playground behavior as checked.
- DataSources:
- Single trigger performs old task-status precheck, handles running-conflict confirmation, supports force recollect, and refreshes task status afterward.
- Batch trigger uses old `/datasources/trigger-batch` semantics for selected IDs, filters, and force.
- Builtin, custom, and realtime source actions match old enable/disable/start/stop/restart/clear-data behavior.
- 2026-05-20 implementation pass: Admin Next builtin datasource rows now expose task/collection status and metrics, and single trigger now performs task-status precheck with running-conflict force confirmation plus post-trigger task refresh.
- 2026-05-20 manual pass: builtin trigger, task-status precheck, force recollect, batch trigger, enable/disable, and clear-data were verified in Admin Next.
- Collection:
- Collector config create/update/delete, builtin connect, custom test/sample/run/stop/status, schedule save, history/snapshot, mapping propose/preview/create/activate, and credential guide read/generate/reset all work with real backend payloads.
- 2026-05-20 implementation pass: `采集历史 / 快照` now reads real datasource snapshots from `/datasources/snapshots` instead of config rows.
- 2026-05-20 implementation pass: default credential guide actions no longer call unsupported providers blindly; unsupported collectors show a clear empty state and supported providers use `barentswatch` / `aisstream`.
- Collection action buttons must follow the AI page's single-responsibility rule: navigation/link actions do not save, save actions do not connect/test, and connect/test actions do not persist drafts.
- 2026-05-20 manual pass: collector create/edit `auth_config`, mapping propose/preview/create/activate, custom test/sample/run/stop/status, credential guide read/generate/reset, and history/snapshot behavior were verified in Admin Next.
- 2026-05-20 follow-up: dead JSON modal create/mapping code was removed so Collection creation now goes through the list-bottom draft workflow only.
- Earth Content:
- Brand preview visually matches the Earth runtime left-top brand at the same structural level.
- Brand upload writes back `logo_src` or `title_src` correctly.
- 2026-05-20 implementation pass: Brand upload validates and displays accepted suffixes (`png`, `jpg`, `jpeg`, `webp`, `svg`) and supports drag-and-drop.
- Boundary status/config/build and TV add/save/default/delete/reset match old behavior.
- Logs:
- Sources, snapshot/tail, level/date/search, copy, empty/error states, and internal scrolling all work.
- 2026-05-20 implementation pass: Logs now include database-backed `system-db` and `audit-db` sources as a fallback when file/docker/buffer logs are empty or missing, and the UI auto-selects an available source. Manual regression must still verify snapshot/tail-like reading, filters, copy, and scrolling.
- BGP / Alerts:
- BGP overview, collectors, collect-location detail, incidents, anomalies, events, latest/detail/generate AI brief.
- System/BGP/situational alert detail, ack, resolve with note, refresh after mutation, and AI brief details.
- Users/Auth:
- Users CRUD, role, Gatekeeper groups.
- 2026-05-20 implementation pass: User edit select dropdowns now use an opaque high-z-index menu surface, and Gatekeeper checkbox groups use an explicit surface background. Manual visual regression is still required.
- Login, register, verify email, resend cooldown, forgot/reset password.
- Mobile:
- 375px, 430px, and 768px widths default to list/group first.
- Detail opens only after tap/click and has a visible back action.
- Long forms, JSON, logs, and Playground messages scroll internally without body-level double scrollbars.
## Explicit Non-Production Items
The old AntD page itself treated these Earth content tabs as placeholder-level capabilities. Admin Next must show a visible “backend capability pending” empty state and must not mix in unrelated data:
- `basemap`
- `layer_resources`
- `models_3d`
- `news_anchor_strategy`
If backend endpoints are later added, these items must be promoted into `docs/plans/admin-next-parity-checklist.md` with concrete API and UI acceptance criteria.
## Final Gate
After the route promotion, the final gate is no longer “switch old routes.” The remaining gate is “keep legacy available until the promoted routes are stable enough to remove AntD.”
1. Run `cd frontend && /home/ray/.bun/bin/bun run build`.
2. Run the static checks:
- `rg "map: \\(\\) => \\[\\]|暂不支持保存|placeholder" frontend/src/admin-next`
- `rg "ShadowPage|FeatureConsole|GlassPanel|InspectorDrawer" frontend/src/admin-next`
3. Manually verify every official route listed in `docs/plans/admin-next-parity-checklist.md`.
4. Confirm `/legacy/admin/*` still opens old AntD pages during the validation window.
5. Delete old AntD pages and remove AntD dependencies only as a separate final cleanup task after explicit confirmation.
## Current Build Verification
Last successful local build during this closeout, after the 2026-05-20 follow-up fixes:
```bash
cd frontend && /home/ray/.bun/bin/bun run build
```
Result: passed.
Backend syntax check also passed:
```bash
/home/ray/.local/bin/uv run python -m py_compile backend/app/api/v1/datasources.py backend/app/api/v1/datasource_config.py backend/app/api/v1/system_control.py
```

View File

@@ -0,0 +1,43 @@
# Admin Next Parity Checklist
Last updated: 2026-05-21
This checklist is the hard gate for deleting the old AntD admin. Admin Next now owns the official admin routes; old AntD pages stay available under `/legacy/admin/*` until every production capability below is verified.
## Route Gate
- `/admin` Dashboard: stats, health probe, WebSocket status, restart task, restart logs, recovery probe.
- `/datasources`: builtin sources, custom sources, realtime sources, detail/stat/task-status, trigger, batch trigger, enable/disable, clear data, realtime start/stop/restart, custom source test/sample/run/stop/status link.
- `/data`: list, summary, source/type/country filters, search, pagination, detail metadata, export, distribution chart.
- `/collection-management`: collector config, mapping templates, target schemas, collection schedule, history/snapshot, create config, propose/preview/create/activate mapping, builtin connect, run/stop/stream-status, credential guide read/generate/reset.
- `/settings`: system display, notifications, security, SMTP get/save/test with recipient.
- `/ai`: model providers, tool calling, prompts, key reveal, provider refresh, connect tests, OCR/WebSearch secrets, Playground thread/chat/edit/resend/stop.
- `/earth-content`: brand preview as Earth renders it, upload/save/delete/reset, boundary status/build/config, TV source add/save/default/delete/reset.
- `/logs`: sources, filters, snapshot, empty/error states, copy.
- `/bgp`: overview, collectors, collect-location, incidents, anomalies, events, AI brief list/latest/detail/generate.
- `/alerts/system`, `/alerts/bgp`, `/alerts/situational`: list/stat/detail, ack, resolve with note, AI brief generation.
- `/users`: list/create/edit/delete, role, Gatekeeper permission groups.
- Auth pages: login, register, verify email, resend cooldown, forgot/reset password.
Compatibility routes under `/admin-next/*` should redirect to these official paths and are not a separate validation target.
## Verified Manual Passes
- 2026-05-20 `/admin-next/collection-management`: user verified collector create/edit payloads, mapping propose/preview/create/activate, custom collector test/sample/run/stop/status, credential guide read/generate/reset, and collection history/snapshot behavior after the draft-form and Time Capsule updates.
- 2026-05-20 `/admin-next/datasources`: user verified builtin source trigger, task-status precheck, force recollect, batch trigger, enable/disable, and clear-data behavior.
## Known Non-Production Tabs
The old AntD page also marked these Earth content tabs as placeholder-level capabilities. Admin Next must show them as “backend capability pending” and must not mix in unrelated data:
- `basemap`
- `layer_resources`
- `models_3d`
- `news_anchor_strategy`
## Replacement Rules
- Keep `/legacy/admin/*` available until the matching route gate above is manually verified after promotion.
- Do not delete old AntD pages, old layout helpers, `antd`, or `@ant-design/icons` until final explicit confirmation.
- Do not use fake rows, unrelated endpoint data, or empty adapters for a real old capability.
- Any backend-missing capability must be recorded here with the missing endpoint and visible UI empty state.

View File

@@ -0,0 +1,217 @@
# Admin Next Soft Glass Goal-Driven Plan
## Goal
Rebuild `/admin-next/*` into a modern soft-glass / light-neumorphic console while keeping the legacy Ant Design admin routes available for comparison. The new console must use visual references only as design anchors, not as imported templates, and must be implemented as Planet-owned reusable components and page patterns.
The redesign must cover desktop and mobile. Data display, icon semantics, table readability, and scroll behavior are first-class acceptance criteria.
## Criteria For Success
- This plan exists at `docs/plans/admin-next-soft-glass-goal-driven-plan.md`.
- `/admin-next/*` has real pages for every route; route usage of `ShadowPage` is removed.
- Admin Next supports `system`, `light`, and `dark` theme modes using the same persistence and system-theme idea as Docs.
- The visual language reads as soft-glass / light-neumorphic instead of an AntD reskin: translucent panels, fine borders, subtle glow, cool backgrounds, restrained accent colors, crisp icons, and tactile controls.
- Mobile is explicitly designed: mobile navigation, filter sheets/chips, card-list data views, full-screen detail sheets, and bottom action bars instead of squeezed desktop tables.
- Tables do not show double scrollbars. Long fields are inspectable, copyable, or expandable; important columns stay readable.
- Existing custom scrollbar components remain the default scroll experience.
- `cd frontend && bun run build` passes.
- Static checks can prove no route-level placeholder remains.
## Reference Strategy
Use references to calibrate feel, not to take over code:
- User-provided soft-glass / light-neumorphic dashboard images define the desired mood.
- Shadcn / Tailwind / glassmorphism admin templates may be inspected for shadow, spacing, panel, dark-mode, and app-shell ideas.
- Do not import a complete template, router, auth layer, state layer, or business page.
- Planet-specific interactions such as datasource tasks, BGP briefs, AI settings, log streams, Earth resources, and custom scrollbars are implemented in this repo.
## Source-Of-Truth Mining
Design content and page boundaries from existing repo history and docs:
- `docs/CHANGELOG.md`
- `docs/plans/*`
- `docs/technical/*frontend*`
- `TODO.md`
Important current boundaries:
- `DataSources` is a datasource directory and runtime-control page, not a configuration editor.
- `Collection Management` owns collector endpoint, credential, custom source, mapping, and runtime configuration.
- `Earth Content` owns TV livestreams, brand assets, boundary precision, basemap, and Earth display resources.
- `AI` owns provider settings, tools, prompts, and Playground.
- `BGP` is an observability and evidence workspace, not just tables.
- `Alerts` is a duty/analysis workspace for system, BGP, and situational risk.
- `Logs` should become a usable log workbench with filtering and structured detail.
- `Settings` should keep platform settings only.
## Reusable Architecture
Recommended structure:
- `admin-next/design`: theme tokens, theme mode, status colors, icon semantics, chart themes, scrollbar themes.
- `admin-next/components`: primitive UI such as button, input, select, tabs, dialog, drawer, badge, status pill, icon badge.
- `admin-next/patterns`: page patterns such as `PageFrame`, `GlassPanel`, `MetricCard`, `CommandBar`, `FilterRail`, `InspectorDrawer`, `DataWorkspace`, `SettingsWorkspace`, `ScrollableRegion`, `TableRegion`, and `MobileSheet`.
- `admin-next/features`: business modules such as datasources, data-list, bgp, alerts, ai, logs, settings, earth-content, collection-management, users.
- `admin-next/services`: feature API gateways and hooks. Pages should not scatter URL construction.
- `admin-next/routes`: route manifest used by navigation, command search, breadcrumbs, and legacy links.
## Interaction Rules
- Row click opens an inspector; frequent row actions live in the inspector header.
- Bulk selection opens a floating command bar.
- Common filters stay visible; advanced filters open a sheet/drawer.
- Detail, JSON, log context, and AI brief use inspector or reading panels instead of stacked modal dialogs.
- Settings are split into `FormSection` blocks with local save, dirty state, connection test, and reset.
- Dangerous actions use a confirm sheet.
- Loading, empty, error, and retry states are shared through reusable patterns.
## Mobile Rules
- Do not squeeze desktop layout into mobile.
- Use mobile navigation and sheets instead of a permanent desktop sidebar.
- Filters collapse into a filter sheet; active filters remain visible as chips.
- Data workspaces default to card-list mode on mobile and allow explicit table mode for dense comparison.
- Details open in full-screen mobile sheets.
- Batch actions use a sticky bottom command bar.
- Long logs and JSON use full-screen reading/editing surfaces with custom scrollbars.
## Table And Data Display Rules
- Tables must prioritize complete data display:
- key columns get stable widths and priority;
- long fields have peek/expand or inspector detail;
- IDs, URLs, metadata, and errors are copyable;
- complex fields are rendered fully in inspector.
- Desktop tables use one `TableRegion` scroll container.
- Mobile defaults to card-list display and supports dense table mode.
- Native scrollbar visuals are hidden where custom scrollbars apply.
## Icon Rules
- Use `lucide-react`.
- Define icon semantics by category:
- navigation icon;
- entity icon;
- status icon;
- action icon;
- severity icon.
- Icons must not be the only semantic carrier unless the icon is universally obvious; use labels or tooltips.
- Status icons pair with `StatusPill`.
- Colors come from tokens, not ad hoc hard-coded values.
## Page Design
### Dashboard
- System health, realtime connection, datasource activity, task trend, alert summary, recent events, and quick commands.
- Restart flow uses a confirm sheet and log console.
- Mobile uses horizontal metric cards and collapsible event/command panels.
### DataSources
- Datasource directory and runtime control.
- Desktop: overview rail, datasource table/list, inspector.
- Mobile: datasource cards with status, latest task, trigger/toggle actions.
- Batch trigger uses command bar.
- Endpoint/config/task details are shown fully in inspector.
### DataList
- Collection result browsing, search, source/type filters, paging, distribution chart, and detail inspector.
- Fix double scrollbars.
- Mobile defaults to cards and allows table mode.
### BGP
- Views: collectors, incidents, anomalies, events, AI brief.
- Emphasize severity, region, ASN/prefix, collector coverage, and evidence.
- AI brief shows facts, judgment, and evidence gaps.
### Alerts
- Real pages for system, BGP, and situational alerts.
- Shared alert workspace with stats, severity/status filters, list, and inspector.
- AI brief appears in inspector/mobile sheet.
### AI
- Provider, tools, prompts, and Playground.
- Provider and tool settings use local save and connection tests.
- Prompt registry is grouped by task.
- Mobile Playground uses step tabs rather than cramped columns.
### Logs
- Log workbench with source, level, date, search, refresh, copy, and structured detail.
- Desktop uses a terminal-like log stream.
- Mobile rows expand or open a full-screen reading sheet.
### Users
- Search, role filter, create/edit/delete, Gatekeeper groups.
- Edit/create in drawer/sheet.
- Gatekeeper groups use checkbox chips.
### Settings
- Platform settings only: system, notification, security, SMTP.
- Each section saves independently.
### Earth Content
- TV livestreams, brand assets, boundary precision, basemap, and layer resources.
- Resource previews, upload state, and boundary build status are emphasized.
### Collection Management
- Collector config, custom sources, mapping, runtime control.
- Custom source creation uses a step sheet.
- Advanced JSON is isolated in a collapsible editor.
## Milestones
1. Save this plan and establish goal-driven criteria.
2. Build design/theme/pattern foundations.
3. Remove route-level placeholders and create real pages for all `/admin-next/*` routes.
4. Redesign layout, theme, mobile shell, scroll behavior, and table behavior.
5. Fill core workspaces with real API calls and reusable patterns.
6. Verify build, no `ShadowPage` route usage, and core route availability.
## Verification
Run:
```bash
cd frontend && bun run build
rg "ShadowPage" frontend/src/admin-next
rg "axios\\." frontend/src/admin-next/pages
rg "overflow: auto|overflow-y: auto" frontend/src/admin-next
```
Manual route checks:
- `/admin-next`
- `/admin-next/datasources`
- `/admin-next/data`
- `/admin-next/bgp`
- `/admin-next/alerts/system`
- `/admin-next/alerts/bgp`
- `/admin-next/alerts/situational`
- `/admin-next/ai`
- `/admin-next/logs`
- `/admin-next/users`
- `/admin-next/settings`
- `/admin-next/earth-content`
- `/admin-next/collection-management`
Manual viewport checks:
- desktop;
- mobile width;
- low height;
- 125% / 150% browser zoom;
- light / dark / system theme modes.

View File

@@ -0,0 +1,182 @@
# AI Provider OpenClaw-Style Routing Plan
Last updated: 2026-05-20
## Summary
Planet 的 AI Provider 路由要从“运行时识别特殊 provider / 特殊模型”收敛到 OpenClaw 风格的配置驱动模型:模型引用、协议、鉴权、轻量探测、真实调用和模型级例外都由 provider catalog / preset / runtime metadata 描述,运行时只解释这些元数据,不再散落 `if provider == ... and model == ...` 这类硬编码。
这份计划覆盖 Admin Next 的 Provider 配置体验、backend settings API、`aiprovider` 适配服务和未来模型目录同步方式。目标是让 OpenCode Go、MiniMax、DeepSeek、OpenAI-compatible、Anthropic-compatible、Ollama、OpenRouter / One API 类代理都能用同一套规则扩展。
## Background
当前实现已经完成了两步临时修正:
- OpenCode Go 模型目录不再使用普通 Zen free 列表,而是使用 `https://opencode.ai/zen/go/v1/models`
- `minimax-m2.7` / `minimax-m2.5` 的协议例外已从 `aiprovider` 运行逻辑移到 `model_provider_apis` 元数据中。
但整体还没有完全达到 OpenClaw 式结构。OpenClaw 的关键思想是:
- 模型引用使用 `provider/model`,由 provider 前缀确定 runtime provider。
- provider 插件或 catalog 拥有 `normalizeModelId``normalizeTransport``normalizeConfig``prepareRuntimeAuth``createStreamFn` 等 provider 行为。
- 主推理循环不认识具体模型名,只使用解析后的 provider config、transport 和 request adapter。
- 上游网关能自己路由时,尽量透传 provider routing metadata不在本地复制上游逻辑。
Planet 不需要完整复制 OpenClaw 插件系统,但需要学习它的边界划分。
## Design Principles
- Provider catalog 是路由事实来源runtime 不是。
- 模型级协议例外必须是 metadata例如 `model_provider_apis`,不能是 Python set / if 分支。
- 轻量连通性测试只验证网络、鉴权和模型目录,不发真实 prompt。
- 真实模型调用只发生在 Playground、AI brief、分析任务等明确需要生成的路径。
- 保存配置不自动设为默认,不自动触发连接测试;保存、设默认、测试三种按钮职责分离。
- 目录刷新使用增量合并语义:发现新模型,标记旧模型 stale不直接删除用户选择或自定义模型。
- 如果 provider 不提供可靠 `/models`,可以用内置 preset 确认已知模型,但 UI 必须说清楚这是 preset confirmation不是假装 provider 返回了目录。
## Target Data Model
Provider preset / runtime config 应逐步收敛为类似结构:
```json
{
"provider": "opencode-go",
"label": "OpenCode Go",
"default_transport": "openai-completions",
"base_url": "https://opencode.ai/zen/go/v1",
"auth": {
"type": "bearer",
"api_key_env": "OPENCODE_GO_API_KEY"
},
"models": [
{
"id": "glm-5.1",
"label": "GLM 5.1",
"transport": "openai-completions",
"context_window": null,
"capabilities": ["text"]
},
{
"id": "minimax-m2.7",
"label": "MiniMax M2.7",
"transport": "anthropic-messages",
"capabilities": ["text", "reasoning"]
}
],
"discovery": {
"type": "openai-models",
"url": "https://opencode.ai/zen/go/v1/models",
"auth": "provider-api-key"
}
}
```
Runtime 选择规则:
1. 解析 provider。
2. 解析 model。
3.`models[].transport` 找模型级 transport。
4. 若没有模型级 transport使用 provider `default_transport`
5. 将解析结果传给 `aiprovider`
6. `aiprovider` 只按 `transport` 组装请求,不认识 provider 专属模型名。
## Implementation Plan
### Phase 1: Stabilize Current Metadata Path
- Keep `model_provider_apis` as the immediate compatibility bridge.
- Ensure `_provider_defaults()` includes provider metadata such as `model_provider_apis`.
- Ensure `_runtime_config_from_ai_payload()` sends the resolved metadata through `AIProviderClient`.
- Ensure `AIProviderClient` forwards metadata to `aiprovider` with a structured header.
- Ensure `aiprovider.ProviderService` reads model metadata and resolves `provider_api = model_provider_apis[model] ?? provider_api`.
- Add tests proving `aiprovider` does not contain provider/model-specific literals for routing decisions.
### Phase 2: Replace `model_provider_apis` With Structured Model Catalog
- Extend `backend/app/services/llm_provider_catalog.py` preset shape with `models_metadata`.
- Preserve old `models` as a compatibility list for the UI.
- Add helpers:
- `get_provider_model_metadata(provider, model)`
- `resolve_provider_transport(provider_config, model)`
- `merge_discovered_models(existing, discovered)`
- Return both `models` and `models_metadata` from refresh endpoints.
- Admin Next should render model labels, capabilities and transport hints from metadata.
### Phase 3: Provider Discovery And Incremental Sync
- Add provider discovery descriptors:
- OpenAI-compatible `/models`
- Anthropic-compatible no-models / preset-confirmed path
- Ollama `/api/tags`
- OpenCode Go `/zen/go/v1/models`
- OpenRouter / One API passthrough model discovery
- Add incremental merge behavior:
- New discovered model: add.
- Existing discovered model: update `last_seen_at`, metadata.
- Missing discovered model: mark `stale`, do not delete.
- User custom model: keep unless explicitly removed.
- Surface discovery source in Admin Next: `实时发现 / 内置预设 / 用户自定义 / 已过期`.
### Phase 4: Transport Adapters
- Replace provider-specific request decisions with adapter descriptors:
- `openai-completions`
- `anthropic-messages`
- `ollama-generate`
- future `openai-responses`
- future `gemini-generate-content`
- Each adapter owns:
- path
- auth header format
- request body transform
- response text extraction
- reasoning/thinking block extraction
- models endpoint strategy
- `ProviderService.analyze()` should select adapter by resolved transport and call the adapter.
### Phase 5: Admin Next UX
- Model provider page should show:
- provider status tag
- default model tag
- source tag: env / runtime / preset / discovered
- model list with transport/capability hint
- separate buttons for save, set default, refresh model catalog, lightweight test
- The connect plug button remains lightweight.
- Full generation test lives only in Playground or a clearly named “试运行” action.
- If lightweight test falls back to preset confirmation, toast must say so explicitly.
## TODO
- [ ] Add `models_metadata` to provider presets and refresh responses.
- [ ] Add runtime resolver helper for provider/model transport selection.
- [ ] Remove any remaining provider/model-specific literals from `aiprovider` runtime routing.
- [ ] Add tests that `opencode-go/minimax-m2.7` resolves through metadata, not through runtime hardcode.
- [ ] Add tests for lightweight connectivity:
- [ ] 401 / 403 fail as auth error.
- [ ] 404 with known preset model passes as preset-confirmed.
- [ ] `/models` missing alias passes only when preset contains the alias.
- [ ] unknown model fails.
- [ ] Add discovery descriptors for OpenCode Go, OpenAI-compatible, Anthropic-compatible, Ollama, OpenRouter / One API.
- [ ] Add incremental model catalog merge semantics with stale marking.
- [ ] Update Admin Next model list to show model source, transport and capability.
- [ ] Keep save / set default / lightweight test / full test as separate actions.
- [ ] Document the final provider catalog schema in technical docs after implementation.
## Current Acceptance Criteria
- No runtime routing branch may depend on concrete model names like `minimax-m2.7`.
- OpenCode Go model refresh must not use the ordinary Zen free-model endpoint.
- Lightweight connect must not call `analyze()` or consume generation quota.
- Saving a provider must not automatically set it as default.
- Provider UI must distinguish configured key, fallback key, preset model and live-discovered model.
## Related Files
- `backend/app/services/llm_provider_catalog.py`
- `backend/app/api/v1/settings.py`
- `backend/app/services/ai_client.py`
- `aiprovider/main.py`
- `aiprovider/provider_service.py`
- `frontend/src/admin-next/pages/PlainResourcePages.tsx`
- `docs/plans/admin-next-parity-audit-closeout-plan.md`

View File

@@ -0,0 +1,349 @@
# 统一集成配置 Schema 系统计划
Last updated: 2026-05-20
## Summary
Planet 的采集器、AI Provider 和工具调用配置需要从“页面各自硬编码字段”收敛到同一套低代码 schema 系统。系统负责两件事:
- 用后台可编辑 schema 生成配置表单。
- 按字段 target 把表单值组装成后端运行时需要的请求、凭证和 JSON 配置。
这套 schema 不替代 `target_schema_registry``target_schema_registry` 继续负责采集结果映射和校验;本计划中的 `integration_config_schemas` 负责“怎么配置一个集成”。
## Current Problems
- Admin Next 的采集器配置曾把不同凭证形态压成通用 `api_key`,导致 `barentswatch_vessels` 这种 OAuth client credentials 丢失 `client_id` 字段。
- AI Provider、Web Search、OCR 和 DataSource 配置各自维护表单字段、secret 处理和 payload 组装逻辑,重复且容易漂移。
- 新增字段时需要改前端字段列表和保存逻辑,无法做到后台配置化扩展。
## Target Model
新增统一 registry`integration_config_schemas`,存储在 `SystemSetting.payload`
Registry 包含:
- `fragments`:可复用字段片段,例如 endpoint、API Key、OAuth Client、HTTP 请求、WebSocket 订阅、AI Provider 基础字段、工具超时字段。
- `auth_schemas`:可复用认证编排,例如 API Key、Bearer Token、Basic、OAuth2 Client Credentials、OAuth2 Authorization Code、Session Cookie Login。
- `schemas`:具体配置对象使用的 schema例如 `datasource:barentswatch_vessels``ai_provider:minimax``tool:web_search:tavily`
- `defaults`:每类集成的默认 schema例如 `datasource``ai_provider``tool`
Schema 必须声明 `kind`
- `datasource`
- `ai_provider`
- `tool`
字段定义统一使用:
```json
{
"key": "client_secret",
"label": "Client Secret",
"type": "secret",
"secret": true,
"target": "auth_config.client_secret",
"required": true,
"wide": true
}
```
字段 target 支持写入:
- DataSource`root.*``auth_config.*``headers.*``config.*`
- AI Provider`ai_provider.*``ai_provider.providers.{provider}.*`
- Tool`web_search.*``web_search.providers.{provider}.*``ocr.*`
## Auth Schema Model
认证必须成为 schema 系统的一等能力,不能再把所有凭证强行压成 `api_key`。每个配置 schema 可以引用一个 `auth_schema`,也可以内联声明认证编排。
Auth schema 描述:
- 凭证字段:哪些字段是 secret、是否必填、写入哪个 target。
- 凭证来源DB、env fallback、运行时草稿、用户授权回调。
- 预认证请求例如登录接口、token endpoint、OAuth callback。
- 凭证注入方式header、query、form、JSON body、cookie jar、WebSocket subscription payload。
- reveal 策略:管理员可 reveal 并写 audit log无 DB/env 值时显示空。
- 测试策略:连接测试必须使用当前表单草稿优先,再 fallback 到已保存/env。
v1 需要支持的认证类型:
- `none`:无认证。
- `api_key`API Key 写入 header/query/form/body。
- `bearer_token`Bearer token header。
- `basic`username/password支持直接 Basic header 或 provider 特定登录。
- `oauth2_client_credentials`client_id/client_secret 换 access_token。
- `oauth2_authorization_code`:第三方登录授权,包含 authorize URL、callback、token exchange、refresh。
- `session_cookie_login`:用户名密码登录后保存 cookie jar再访问数据接口。
- `custom_auth_preflight`:无法归类时,用声明式 preflight 请求生成后续请求上下文。
Auth schema 示例:
```json
{
"key": "spacetrack_session",
"type": "session_cookie_login",
"fields": [
{
"key": "username",
"label": "Username",
"target": "auth_config.username",
"required": true
},
{
"key": "password",
"label": "Password",
"type": "secret",
"secret": true,
"target": "auth_config.password",
"required": true
}
],
"preflight": {
"method": "POST",
"url": "https://www.space-track.org/ajaxauth/login",
"body_type": "form",
"body": {
"identity": "{{auth_config.username}}",
"password": "{{auth_config.password}}"
},
"success": {
"type": "cookie"
}
},
"inject": {
"type": "cookie_jar"
}
}
```
OAuth Authorization Code 示例:
```json
{
"key": "github_oauth",
"type": "oauth2_authorization_code",
"fields": [
{ "key": "client_id", "target": "auth_config.client_id", "required": true },
{ "key": "client_secret", "type": "secret", "secret": true, "target": "auth_config.client_secret", "required": true },
{ "key": "scopes", "type": "tags", "target": "auth_config.scopes" }
],
"authorization": {
"url": "https://github.com/login/oauth/authorize",
"client_id": "{{auth_config.client_id}}",
"scopes": "{{auth_config.scopes}}",
"redirect_uri": "{{system.callback_base_url}}/api/v1/integrations/oauth/github/callback"
},
"token": {
"method": "POST",
"url": "https://github.com/login/oauth/access_token",
"body_type": "form",
"body": {
"client_id": "{{auth_config.client_id}}",
"client_secret": "{{auth_config.client_secret}}",
"code": "{{oauth.code}}",
"redirect_uri": "{{oauth.redirect_uri}}"
}
},
"inject": {
"type": "bearer_header",
"token_path": "access_token"
}
}
```
## Request And Runtime Assembly
这套系统本质是面向 Planet 集成的低代码 Postman但目标不是临时发请求而是沉淀成可保存、可测试、可调度、可审计的运行配置。
Schema 支持描述:
- HTTP method`GET``POST`
- endpoint
- headers
- query params
- JSON body / form body
- auth schema / auth config / preflight auth flow
- WebSocket endpoint 和 subscription payload
- AI Provider 的 `provider_api``base_url``model``api_key``service_token`
- Tool 的 provider、base_url、api_key、timeout 和工具专属参数
请求执行顺序:
1. 从 schema 字段 target 组装 root/auth_config/headers/config。
2. 如果存在 auth schema先解析凭证来源和草稿覆盖。
3. 需要 preflight 时执行认证请求,例如 token exchange 或 login。
4. 把认证结果注入正式请求,例如 bearer header、cookie jar、query token。
5. 执行连接测试、采样、采集、AI Provider connect 或 tool connect。
## Default Schemas
### DataSource
默认采集器:
- endpoint
- method
- headers JSON
- query/body/config JSON
- API Key auth
- advanced JSON
`barentswatch_vessels`
- endpoint
- Client ID -> `auth_config.client_id`
- Client Secret -> `auth_config.client_secret`
- fixed `auth_type = oauth_client`
`aisstream_vessels`
- WebSocket endpoint
- API Key -> `auth_config.api_key`
- subscription / bounding boxes config
`spacetrack_tle`
- API Base URL / endpoint
- Username -> `auth_config.username`
- Password -> `auth_config.password`
- auth schema = `session_cookie_login`
- login endpoint = `https://www.space-track.org/ajaxauth/login`
- login body fields`identity` / `password`
- run/test request uses returned session cookie
### AI Provider
默认字段:
- provider
- provider_api
- base_url
- model
- api_key
- max_tokens
- anthropic_version
- service_url
- service_token
- timeout_seconds
- retry_attempts
- model_provider_apis
Provider presets supply initial defaults, but the editable schema controls which fields appear and where values are saved.
AI Provider auth variants
- OpenAI-compatible providers`api_key` or `bearer_token`
- Local/sidecar services`none``service_token` or custom header。
- OAuth-backed providers`oauth2_authorization_code`,适用于需要用户授权登录的 provider。
- CLI/session-backed tools such as Codex优先作为 `tool` 或本机 runner 集成;如果作为 provider必须显式声明会话来源、权限边界、不可多用户复用的限制。
### Tool
`web_search`
- enabled
- provider / default_provider
- base_url
- api_key
- max_results
- timeout_seconds
- endpoint_path
- search_depth
- engine
- include_answer / include_raw_content / include_text
- search_path / scrape_path / scrape_formats
`ocr`
- enabled
- provider
- base_url
- api_key
- model
- languages
- timeout_seconds
- max_file_size_mb
- output_format
Tool auth variants
- GitHub PAT`bearer_token`
- GitHub OAuth App`oauth2_authorization_code`,适合用户授权登录和代表用户访问。
- GitHub App`app_installation`,需要 app id/private key/installation id并通过 schema 声明 installation token exchange。
- Browser/session tools必须显式标记为 `session_local_only`,不能作为后台多用户稳定凭证。
## API Plan
- `GET /api/v1/integration-config-schemas`
- Return the full registry.
- `PUT /api/v1/integration-config-schemas`
- Save the registry. Admin only.
- `POST /api/v1/integration-config-schemas/validate`
- Validate full registry or one schema.
- `POST /api/v1/integration-config-schemas/auth/test`
- Test auth schema with draft credentials without saving.
- `GET /api/v1/integration-config-schemas/auth/secrets`
- Reveal stored/env-backed secret fields for admins; write audit log.
- `POST /api/v1/integrations/oauth/{provider}/start`
- Start OAuth Authorization Code flow.
- `GET /api/v1/integrations/oauth/{provider}/callback`
- Complete OAuth callback and store token material according to schema.
- `GET /api/v1/datasources/configs/all`
- Add `form_schema` to each row.
- `GET /api/v1/settings/integrations`
- Add `form_schema` for AI Provider and tools.
Existing save APIs remain compatible:
- DataSource saves to `DataSourceConfig`.
- AI Provider, Web Search and OCR save to `external_integrations`.
Secret fields never return plaintext through list/config endpoints. They return configured state and masked preview only.
Secret reveal endpoints return plaintext only on explicit administrator action and must log target, actor, source, result and timestamp. List/config endpoints must never leak secret plaintext.
## Frontend Plan
Admin Next extracts a reusable `SchemaForm`:
- Render fields from `form_schema.fields`.
- Build payload by writing values to each field `target`.
- Preserve masked secret semantics: unchanged masked values do not overwrite stored secrets.
- Reveal secrets through a schema-aware reveal action; if neither DB nor env has a value, show an empty editable input.
- Support text, secret, number, boolean, select, textarea, JSON and tags controls.
- Support auth controls for API key, username/password, OAuth connect/disconnect, session cookie login and custom preflight status.
- Validate schema before saving registry changes.
Pages migrated in v1:
- Collection Management / collector configs.
- AI / Provider configuration.
- AI / Tools configuration for Web Search and OCR.
Each detail page gets a schema editing action for admins. The editor saves registry JSON after validation.
## Test Plan
- Default registry initializes with datasource, AI Provider and tool schemas.
- Validation rejects duplicate keys, illegal targets, illegal field types and secret plaintext defaults.
- `barentswatch_vessels` renders and saves `client_id` / `client_secret`.
- `spacetrack_tle` renders username/password, tests with draft credentials, and does not require API Key.
- `aisstream_vessels` renders API Key and WebSocket subscription fields.
- Session cookie login auth executes preflight before sample/run and uses the resulting cookie jar.
- OAuth Authorization Code schema can start callback flow, store token metadata and inject bearer token.
- Secret reveal returns DB value, env fallback or empty value according to source, and writes audit log.
- Connection tests always prefer current draft credentials over saved/env credentials.
- AI Provider renders and saves `provider_api`, `base_url`, `model`, `api_key` and `service_token`.
- AI Provider and tool schemas can reuse the same auth schema primitives as DataSource.
- Web Search and OCR render and save provider-specific tool fields.
- Adding a schema field in the registry makes it appear in Admin Next without frontend code changes.
- Existing connection tests, datasource sampling, datasource run, AI Provider connect/reveal/refresh, and Web Search connect keep working.
## Assumptions
- `target_schema_registry` remains separate because it describes collected result shape, not configuration forms.
- The first implementation stores schema registry in `SystemSetting`; no new database table is required.
- Old AntD Settings pages stay compatible but are not migrated in v1.
- Tool scope in v1 is Web Search and OCR.

View File

@@ -30,8 +30,10 @@ What belongs here:
- [Collector Settings and Connectivity Validation](/home/ray/dev/linkong/planet/docs/technical/en/datasource-collector-settings-connectivity.md): Data source catalog, collector settings, connectivity validation, and BarentsWatch credentials
- [Shared Location Resolution Pipeline Development Guide](/home/ray/dev/linkong/planet/docs/technical/en/location-pipeline-development.md): Backend location resolver / pipeline interfaces, registries, and extension points
- [Docs Gatekeeper Development Guide](/home/ray/dev/linkong/planet/docs/technical/en/docs-gatekeeper-development.md): Backend Docs catalog, Markdown content loading, and Gatekeeper permission groups
- [Naming Glossary](/home/ray/dev/linkong/planet/docs/technical/en/naming-glossary.md): English/Chinese term mapping for the console, Earth, backend, and docs
- [Earth Interactable Usage](/home/ray/dev/linkong/planet/docs/technical/en/earth-interactable-usage.md): API, lifecycle, and integration examples for Earth surface icon Interactable
- [Earth Toolbar and Overlay Coordination](/home/ray/dev/linkong/planet/docs/technical/en/earth-toolbar-overlay-coordination.md): Closing matrix and integration rules for toolbar buttons, search, settings, news, and layer overlays
- [Tactile UI Components](/home/ray/dev/linkong/planet/docs/technical/en/tactile-ui-components.md): Portable button, switch, tooltip, and scrollbar APIs, theme tokens, and migration rules
What does not belong here:

View File

@@ -101,6 +101,19 @@ The AI settings page uses:
These endpoints require an authenticated user. The `secrets` endpoint is only used when the settings page reveals a key or token; hiding the field restores the masked preview.
Admin Next keeps the AI page aligned with the legacy information architecture:
- `Model Providers`
- Manages provider, wire adapter, default model, LLM API key, proxy URL, proxy token, model refresh, set-as-default, and lightweight connectivity testing.
- `Tool Calling`
- Manages tools such as WebSearch and OCR. Each tool first selects a provider, then edits that provider's API, key, and advanced parameters.
- `Prompts`
- Edits system/user prompts by prompt group and task key. Save and reset only affect the current task.
- `Playground`
- Runs real conversations with the active provider and prompt configuration. AI responses are rendered as Markdown.
Save, set-as-default, and connectivity testing are separate responsibilities: save only persists the form, set-as-default only changes the active provider/tool, and connectivity testing only validates the current draft. It must not implicitly save or switch defaults.
The `ai-prompts` endpoints back the Prompts tab in AI settings. Shipped defaults come from versioned backend resources, while business code references stable task keys. The API stores only operator overrides. Resetting a prompt removes the override and falls back to the current shipped default.
### Prompt Boundary
@@ -259,6 +272,34 @@ Each provider has its own key slot. Resolution order is:
`.env` is only a fallback. After the settings page saves successfully, or after the connection test succeeds, PostgreSQL becomes the global default source.
Admin Next must compute key status per provider or tool:
- If the database has a key for the current provider/tool, show `configured`.
- If the database has no key but the fallback provider, model, or tool matches the current item, show the fallback masked preview.
- If neither database nor matching fallback exists, show `not configured`; a generic `.env` key for another provider must not make this item appear configured.
- Masking keeps the prefix before the first `-`, for example `sk-********`. Plaintext reveal is only available inside the authorized configuration page.
Tool keys follow the same rule. WebSearch and OCR must match the current tool and provider before they can use fallback credentials.
### Lightweight Connectivity Testing
The Admin Next plug button performs a lightweight connectivity check and does not save configuration. Common API-platform practice is two-tiered:
- Check a provider catalog or low-cost endpoint to validate base URL, authentication, and model reachability.
- Send full model requests only when the user explicitly runs Playground or a business task.
Connectivity results should be explicit:
- `ok`: authentication, route, and model catalog are usable.
- `warning`: service is reachable, but the current model is missing from the catalog or capability metadata is incomplete.
- `error`: authentication, network, protocol, or model lookup failed.
Toast titles must match the result; failures must not be titled as a successful connection.
### OpenCode Go Routing Model
Subscription channels such as OpenCode Go should not be handled by hard-coded frontend model sets. Prefer provider catalog or backend capability discovery that records per-model capabilities such as `chat_completions`, `anthropic_messages`, `models_endpoint`, and whether a subscription key is required. The frontend should display capabilities; the backend should map provider, base URL, model, and adapter into the real request.
#### Settings Page Behavior
- The Provider select controls the global default provider.

View File

@@ -93,6 +93,16 @@ Earth boundaries are no longer data collectors. They are Earth static rendering
TOP500 and Epoch AI compute sources do not always provide usable coordinates. The unified Earth compute-center endpoint uses only valid source-provided coordinates or `compute_center_locations` dimension-table coordinates during the main map startup path; records without coordinates are returned as `unresolved` instead of being rendered from a local registry, country centroid, or guessed city. When users manually collect candidates, the backend queries ROR and Nominatim/OpenStreetMap from source fields; accepted candidates are saved into `compute_center_locations` and rendered from that table on the next layer refresh.
Admin Next collection management follows the business hierarchy instead of flattening every endpoint into one table:
- `Collectors`: endpoint, authentication, headers, base parameters, enabled state, and credential guides.
- `Collection Schedule`: scheduler state and task controls.
- `Collection History / Snapshots`: history grouped by collector, with a detail-side snapshot selector for versions.
Snapshot lists should not show every snapshot of the same collector as separate top-level records. The top-level list selects a collector; the detail area switches between time versions.
Credential guides are maintained by `backend/app/services/credential_guides.py`. The console uses read / generate / reset actions to load or create Markdown instructions. The frontend should render the guide Markdown for operators, not expose generation prompts or raw metadata.
## IV. Data Format (stored in CollectedData table)
```python

View File

@@ -32,8 +32,8 @@ If endpoint, headers, base configuration, or credential fingerprint changes afte
Files:
- [DataSources.tsx](/home/ray/dev/linkong/planet/frontend/src/pages/DataSources/DataSources.tsx)
- [index.css](/home/ray/dev/linkong/planet/frontend/src/index.css)
- [PlainResourcePages.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/pages/PlainResourcePages.tsx)
- [AdminNextRoutes.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/AdminNextRoutes.tsx)
Current behavior:
@@ -53,30 +53,35 @@ Current behavior:
`data-source-bulk-toolbar__running-pill` is the styling entry point for the "Collecting" pill. It is aligned with other status tags, while hover treatment, arrow affordance, and blue outline indicate interactivity.
### Collectors
### Collection Management
File:
- [Settings.tsx](/home/ray/dev/linkong/planet/frontend/src/pages/Settings/Settings.tsx)
- [PlainResourcePages.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/pages/PlainResourcePages.tsx)
Current behavior:
- The `collector_credentials` tab is displayed as "Collectors" under `/collection-management`.
- A select lists built-in collectors and supports maintaining custom supplemental sources that merge into built-in data.
- The only button beside the select is a plug icon for health checks.
- Status tags below the select show:
- `Credentials required` / `No credentials required`
- Module
- `Enabled` / `Disabled`
- `Unchecked` / `Available` / `Unavailable`
- Whether the endpoint is overridden
- Collectors that require credentials place the credential card above base configuration.
- Collectors without credentials only show base configuration.
- `/collection-management` follows the legacy hierarchy: `Collectors`, `Collection Schedule`, and `Collection History / Snapshots`.
- `Collectors` is the configuration page. The left list shows collector configs; the right form edits endpoint, authentication, headers, collection parameters, and enabled state.
- New collectors and target schemas use draft detail pages instead of transparent JSON modals; save persists the draft, while cancel destroys it.
- The connection button only tests connectivity and does not save. The save button only persists the form.
- Credential guides open in a draggable Markdown modal. When no guide exists, the modal still opens and offers a generate action. Generation shows a centered waiting state; reset confirmation must render above the guide modal.
- `Collection History / Snapshots` groups by collector. The list must not repeat every snapshot for the same datasource; detail view switches versions through a Time Capsule / Time Machine style selector.
- The AISStream collector uses WebSocket semantics: connecting, streaming, reconnecting, or stopped. It does not use a fixed completion percentage.
- Custom source editing lives in collector settings. The data source catalog keeps overview, run controls, and read-only drawers.
The connection button uses an inline Tabler-style plug icon with `plug-connected` semantics, avoiding the older refresh icon for a connection action.
### Mapping Templates and Target Schemas
Mapping remains part of collection management, but not the main collector tab:
- `Mapping Templates` owns sample payload, AI propose, preview, create/update, and activate.
- `Target Schemas` maintains writable target structures.
- `run-mapped`, `stop-mapped`, and `stream-status` run mapped custom collectors.
The new UI should keep these paths form-first. Only advanced fields should collapse into JSON. Do not flatten templates, schemas, runtime status, and collector configuration into one table.
## Backend APIs
### Data Source Configuration List
@@ -140,6 +145,26 @@ Successful responses include:
- `credential_provider`
- `credential_source`
### Credential Guides
```http
GET /api/v1/datasources/credential-guides/{provider}
POST /api/v1/datasources/credential-guides/{provider}/generate
POST /api/v1/datasources/credential-guides/{provider}/reset
```
Purpose:
- Read the Markdown credential guide for a provider.
- Generate a guide from collector metadata when none exists.
- Reset back to the backend default guide.
Frontend rules:
- Render Markdown, not backend prompts or metadata.
- Generate/reset actions belong inside the guide modal, not in the collector configuration toolbar.
- Missing guides still open a modal so the user can generate one from there.
### BarentsWatch AIS Connectivity Validation
```http

View File

@@ -151,6 +151,15 @@ Each module is responsible for its own:
`brand.js` manages Earth HUD brand resources. Static assets provide the default brand; runtime overrides come from `/api/v1/earth/brand`, and uploaded images are served from `/earth-brand-assets/...`. The frontend must treat logo/title images and text fallback separately: if an image fails, show the text title; if text fields are empty, rely on backend defaults so the HUD brand area never renders blank. The console Earth Content page owns saving and resetting brand configuration; the Earth frontend only consumes it.
The Admin Next Earth Content page must preserve runtime semantics:
- `Brand`: brand preview should use the same dark starfield background, size, spacing, logo/title rendering, and text fallback as the Earth HUD top-left brand block, not a generic form preview.
- `Boundary Precision`: build boundary, refresh status, and restore defaults belong inside this section, not in the global page toolbar.
- `TV`: the list distinguishes built-in, collected, and custom sources. Card state represents enabled, disabled, draft, or error. Built-in sources cannot be deleted; collected and custom sources can. A new live source only enters draft state after the plus button is clicked; save persists it into the list, while cancel destroys the draft.
- `Basemap`, `Layer Resources`, `3D Models`, and `News Anchor Strategy`: if backend capability is not available yet, the console should show an explicit pending state instead of mixing those items into TV or brand configuration.
TV preview should reuse the Earth runtime live-card structure and state labels as closely as possible so built-in markers, live loading state, stream source, region, and language match what users see on Earth.
The compute-center layer row has a notification badge for GeoJSON `unresolved` records. The badge means "no trustworthy coordinates, cannot render on the globe"; it is different from the `?` marker drawn on already positioned but unconfirmed compute centers. Clicking the badge opens a fixed info card beside the layer panel. Row-level `采集` fetches candidates only. Header-level `一键采用` processes the queue top-to-bottom, saves the highest-confidence valid candidate, removes successful rows, renumbers the list, and dispatches `earth:compute-center-unresolved-count-change` so the badge updates immediately. When the batch ends, `earth:compute-center-location-saved` refreshes the real layer.
Location candidate state in the details card is cached in [info-card.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/info-card.js) by `entityType:entityId`. If the user closes the details card or unresolved queue and reopens the same compute center / BGP collector, previously collected candidates and status text are restored. Header-level `一键采用` prefers cached candidates, avoiding repeated online geocoding or LLM factcheck calls. After a location is saved, that entity's candidate list is cleared to a "refreshing layer" status so stale candidates do not keep misleading the user.

View File

@@ -22,7 +22,7 @@ Main entry point:
- [App.tsx](/home/ray/dev/linkong/planet/frontend/src/App.tsx)
Current admin-related routes:
Admin Next now owns the official admin routes:
- `/admin`
- `/users`
@@ -37,15 +37,45 @@ Current admin-related routes:
- `/collection-management`
- `/settings`
These routes render [AdminNextRoutes.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/AdminNextRoutes.tsx). Page metadata and menu entries come from [manifest.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/routes/manifest.tsx). `/admin-next/*` remains only as a compatibility entry and redirects to the official route; it is no longer a parallel primary entry.
The old AntD console remains available under `/legacy/admin/*` for comparison and rollback:
- `/legacy/admin`
- `/legacy/admin/datasources`
- `/legacy/admin/data`
- `/legacy/admin/collection-management`
- `/legacy/admin/earth-content`
- `/legacy/admin/ai`
- `/legacy/admin/logs`
- `/legacy/admin/settings`
- `/legacy/admin/users`
- `/legacy/admin/bgp`
- `/legacy/admin/alerts/*`
Legacy pages, `AppLayout`, `antd`, and `@ant-design/icons` stay in place during the legacy validation window. Do not remove them before Admin Next parity is accepted.
`/earth` is a standalone display page and is not part of the console shell.
## Current Page Shell
The console shared shell is at:
The official admin shell is at:
- [AdminNextLayout.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/components/layout/AdminNextLayout.tsx)
Responsibilities:
- Left navigation, grouped collapse, and mobile drawer
- Current account, version, logout, and theme switching
- Top search, breadcrumbs, and page shortcuts
- Single-screen content-area height closure
- Coordination for Admin Next internal scrolling, tables, detail panels, and mobile detail views
The old AntD legacy shell remains at:
- [AppLayout.tsx](/home/ray/dev/linkong/planet/frontend/src/components/AppLayout/AppLayout.tsx)
Responsibilities:
Legacy responsibilities:
- Left-side navigation
- Collapse and expand
@@ -66,7 +96,19 @@ Current structure:
</Layout>
```
Future console pages should adapt to this shell rather than redefining full-page height semantics.
Future official admin pages should adapt to `AdminNextLayout` and Admin Next page patterns rather than adding new capability to the old `AppLayout`. Only `/legacy/admin/*` maintenance should change the old shell.
## Admin Next Section Loading
Multi-tab pages are currently coordinated by [PlainResourcePages.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/pages/PlainResourcePages.tsx), which hosts the current management and information workbench patterns. Section loading follows these rules:
- Initial page load requests only the active tab; it does not prefetch every tab endpoint.
- Switching tabs lazily loads that tab. Loaded tabs stay cached in local `states`, so returning to a tab reuses the previous data.
- Explicit actions such as refresh, save, test, upload, and credential-guide generation refresh only the current section instead of fanning out to unrelated sections.
- Datasource directory filter changes clear the built-in-source section cache and reload the current section with the new filters.
- Top summary metrics count loaded sections only, so unopened tabs are not reported as failed interfaces.
This keeps Earth, AI, collection management, and other multi-section pages from flooding backend APIs on cold start while preserving a fast cached tab-switching experience. Full health checks should use backend health endpoints or explicit refresh flows rather than relying on page initialization to touch every business endpoint.
## Current Shared Components
@@ -74,7 +116,8 @@ Future console pages should adapt to this shell rather than redefining full-page
File:
- [Scrollbar.tsx](/home/ray/dev/linkong/planet/frontend/src/components/Scrollbar/Scrollbar.tsx)
- [Scrollbar.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/Scrollbar.tsx)
- [Tactile UI Components](/home/ray/dev/linkong/planet/docs/technical/en/tactile-ui-components.md)
Purpose:
@@ -91,7 +134,7 @@ Current constraint:
File:
- [ScrollbarOverlay.tsx](/home/ray/dev/linkong/planet/frontend/src/components/Scrollbar/ScrollbarOverlay.tsx)
- [ScrollbarOverlay.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/ScrollbarOverlay.tsx)
Purpose:
@@ -100,25 +143,42 @@ Purpose:
Current usage:
- Data sources
- Collected data
- User management
- Settings page
- Alerts page
- BGP page
- Admin Next data sources, collected data, collection management, logs, alerts, and BGP pages
- Old AntD legacy pages continue using shared scrolling behavior through compatibility wrappers
### 3. `TableScrollRegion`
File:
- [TableScrollRegion.tsx](/home/ray/dev/linkong/planet/frontend/src/components/Scrollbar/TableScrollRegion.tsx)
- [TableScrollRegion.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/TableScrollRegion.tsx)
Purpose:
- Provides a unified wrapper for table scroll areas
- New table pages should reuse this rather than repeating the "table area + overlay scrollbar" boilerplate
### 4. `SegmentedControl`
### 4. `TactileButton` / `TactileSwitch` / `ControlGroup`
Files:
- [Button.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/Button.tsx)
- [Switch.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/Switch.tsx)
- [ControlGroup.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/ControlGroup.tsx)
Purpose:
- Admin Next global tool buttons and detail-panel toolbars
- Icon-only ordinary actions with tooltips
- Strong-intent actions such as save, create, confirm, delete, and stop
- Compact switches aligned with the Docs theme slider
Current constraints:
- Neutral buttons default to a white tactile surface with external shadow
- Unambiguous actions prefer icon + tooltip; strong-intent actions like save may keep text
- Feature pages should customize through props and CSS variables, not by rewriting core button CSS
### 5. `SegmentedControl`
Files:
@@ -146,7 +206,7 @@ Current constraints:
- Prefer CSS variable overrides for colors instead of hard-coding theme colors in feature components
- Best for a small set of mutually exclusive choices; do not use it as a long list, navigation menu, or select replacement
### 5. `MarkdownRenderer`
### 6. `MarkdownRenderer`
File:
@@ -165,7 +225,7 @@ Current constraints:
- Internal document links should be converted to `/docs/:slug` through `transformLink`
- Heading anchors are injected through `getHeadingId`, keeping route state outside the renderer
### 6. `ConnectionTestInput`
### 7. `ConnectionTestInput`
File:
@@ -183,7 +243,7 @@ Current constraints:
- Disabled integrations must grey out both the input and its connection-test action
- The component only combines the input and action; callers still own form state, loading, disabled state, and the request itself
### 7. `TableActions`
### 8. `TableActions`
File:

View File

@@ -0,0 +1,99 @@
# Naming Glossary
This document standardizes terms used across the Planet console, Earth, backend APIs, and documentation. When adding Chinese UI labels, chart labels, or translated documentation, prefer the Chinese display names listed here to avoid unnecessary mixed Chinese/English copy.
## Usage Rules
- Chinese UI should use the Chinese display name.
- API fields, database fields, code identifiers, and external brand names keep their original English or snake_case form.
- On first mention in long-form docs, use “Chinese Display Name (English Term)” when clarification helps; subsequent mentions can use the Chinese display name.
- Industry abbreviations such as BGP, AI, API, URL, ID, TLE, ASN, GPU, and AIS may remain English.
- External service brands keep their official English names, such as PeeringDB, Space-Track, BarentsWatch, AISStream, and GitHub.
## Core Product Terms
| English / Key | Chinese Display Name | Usage |
| --- | --- | --- |
| Planet | Planet | Product name |
| Admin Next | 新控制台 | New admin console |
| Earth | Earth | Visualization product name |
| datasource | 数据源 | APIs, lists, filters |
| collector | 采集器 | Collection jobs and credential configuration |
| collected data | 采集数据 | Data list and statistics |
| snapshot | 快照 | Collection history |
| mapping | 映射 | Field mapping |
| target schema | 目标 Schema | Mapping target structure |
| credential | 凭证 | Secrets, account passwords, OAuth material |
| secret reveal | 密钥 reveal | Explicit administrator secret reveal action |
| AI Provider | AI Provider | Service name |
| tool | 工具 | Web Search, OCR, and similar integrations |
| Playground | Playground | Interactive debugging entry |
## Data Types
| data_type | Chinese Display Name | Meaning |
| --- | --- | --- |
| `supercomputer` | 超算 | TOP500 supercomputer record |
| `gpu_cluster` | GPU 集群 | Epoch AI GPU cluster |
| `model` | 模型 | Hugging Face model |
| `dataset` | 数据集 | Hugging Face dataset |
| `space` | 空间 | Hugging Face Space |
| `ixp` | 互联网交换点 | PeeringDB IXP |
| `network` | 网络 | PeeringDB network |
| `facility` | 设施 | PeeringDB facility |
| `submarine_cable` | 海底光缆 | Submarine cable route |
| `landing_point` | 登陆点 | Cable landing point |
| `cable_system` | 海缆系统 | TeleGeography cable system |
| `cable_landing_relation` | 海缆登陆关系 | Cable-to-landing-point relation |
| `satellite_tle` | 卫星轨道根数 | CelesTrak / Space-Track TLE |
| `bgp_rib` | BGP 路由表 | BGP RIB snapshot |
| `bgp_update` | BGP 更新 | BGP update event |
| `prefix_geography` | 前缀地理位置 | IP prefix geography |
| `vessel_ais` | AIS 船舶 | AIS vessel observation |
| `vessel` | 船舶 | Aggregated vessel object |
| `news_live_stream` | 新闻直播源 | News live stream source |
| `news_item` | 新闻条目 | Archived news item |
| `device_stats` | 设备统计 | Cloudflare Radar device statistics |
| `traffic_stats` | 流量统计 | Cloudflare Radar traffic statistics |
| `as_stats` | 自治系统统计 | Cloudflare Radar AS statistics |
| `compute_center` | 算力中心 | Aggregated Earth compute-center object |
| `generic` | 通用数据 | Generic collector output |
| `generic_records` | 通用记录 | Generic mapping output |
## Datasources And External Services
| English / Key | Chinese Display Name | Notes |
| --- | --- | --- |
| TOP500 | TOP500 超算榜单 | Keep TOP500 as the external list name |
| Epoch AI | Epoch AI GPU 集群 | Keep Epoch AI as the service name |
| Hugging Face | Hugging Face | Official brand name |
| PeeringDB IXP | PeeringDB 交换中心 | IXP can also be explained as 互联网交换点 |
| PeeringDB Networks | PeeringDB 网络 | Network entity |
| PeeringDB Facilities | PeeringDB 设施 | Facility entity |
| Submarine Cables | 海底光缆 | Prefer Chinese in charts and lists |
| Cable Landing Points | 海缆登陆点 | Use 登陆点 consistently |
| CelesTrak TLE | CelesTrak 轨道根数 | TLE may remain abbreviated |
| Space-Track TLE | Space-Track 轨道根数 | Keep Space-Track as brand name |
| RIPE RIS Live BGP | RIPE RIS Live BGP | Keep service name and BGP abbreviation |
| IPtoASN Prefix Geography | IPtoASN 前缀地理位置 | Keep IPtoASN as dataset name |
| OpenGeoFeed Prefix Geography | OpenGeoFeed 前缀地理位置 | Keep OpenGeoFeed as brand name |
| NRO Delegated Prefix Geography | NRO Delegated 前缀地理位置 | Keep NRO Delegated as dataset name |
| BarentsWatch AIS Vessels | BarentsWatch AIS 船舶 | Keep BarentsWatch / AIS |
| AISStream Vessels | AISStream 船舶 | Keep AISStream as brand name |
## UI Actions And Statuses
| English / Key | Chinese Display Name | Usage |
| --- | --- | --- |
| success | 成功 | Status badge |
| failed | 失败 | Status badge |
| running | 运行中 | Task status |
| completed | 已完成 | Task status |
| cancelled | 已取消 | Task status |
| enabled | 已启用 | Toggle state |
| disabled | 已停用 | Toggle state |
| configured | 已配置 | Credential / integration state |
| unconfigured | 未配置 | Credential / integration state |
| refresh | 刷新 | Button |
| copy | 复制 | Button |
| reveal | reveal | Keep English for audited secret reveal semantics |

View File

@@ -87,8 +87,8 @@ Recent logs:
Follow:
```bash
./planet.sh log -f # frontend: /tmp/planet_frontend.log
./planet.sh log -b # backend: /tmp/planet_backend.log
./planet.sh log -f # frontend: ~/.local/state/planet/frontend.log
./planet.sh log -b # backend: ~/.local/state/planet/backend.log
./planet.sh log -a # AI Provider: planet_aiprovider container logs
```
@@ -234,6 +234,20 @@ Validate the frontend build:
source ~/.zshrc && bun run build
```
Use `bun run dev` during development; Vite HMR refreshes the browser after source saves. `bun run build` only writes the `dist` artifact and does not refresh an already-open dev page.
To inspect the production bundle with automatic reload after successful builds:
```bash
bun run preview:auto
```
To watch sources and rebuild continuously without starting the preview server:
```bash
bun run build:watch
```
Backend dependencies are managed with uv:
```bash

View File

@@ -0,0 +1,205 @@
# Tactile UI Components
Tactile UI is Planet's portable React control layer. It was extracted from the Admin Next button, switch, scrollbar, and tooltip work, but the components themselves do not depend on Admin Next, AntD, Radix, Tailwind, or `an-*` classes. The immediate goal is stable in-repo usage; the structure is intentionally close to something that can later be published as an npm package.
## Design Goals
- **Light tactile feel**: controls default to a white or themed surface, thin borders, and external shadow, matching the subtle depth of the Docs theme slider rather than large colored blocks or glow.
- **Portable styling**: classes use the `tui-*` prefix and styles live in `frontend/src/components/tactile-ui/styles.css`.
- **Low dependency surface**: components assume React and React DOM. Preset icons currently use `lucide-react`, and callers may also pass custom React nodes.
- **Theme friendly**: CSS variables expose the default styling surface. Planet pages adapt the library through theme variables and props.
- **Clear semantics**: unambiguous actions should prefer icon-only buttons with tooltips; strong-intent actions such as save, confirm, create, and run can keep text.
## Import
In this repository:
```tsx
import { TactileButton, TactileSwitch, ControlGroup } from '@/components/tactile-ui'
import '@/components/tactile-ui/styles.css'
```
After a future package extraction:
```tsx
import { TactileButton, TactileSwitch } from '@planet/tactile-ui'
import '@planet/tactile-ui/styles.css'
```
## Theme Tokens
Core tokens are exposed as `--tui-*` CSS variables. Product themes should override variables instead of rewriting internal component classes.
```css
:root {
--tui-surface: #ffffff;
--tui-surface-raised-hover: #f8fbff;
--tui-border-soft: #d6dfeb;
--tui-border-hover: #b8c6d9;
--tui-text: #0f172a;
--tui-primary: #2563eb;
--tui-danger: #dc2626;
}
[data-theme='dark'] {
--tui-surface: #111827;
--tui-text: #e5edf8;
}
```
Most controls also accept a `tactile` prop for local width, height, radius, background, border, and shadow overrides. Use local overrides for small special cases; use CSS variables for product-wide styling.
## `TactileButton`
The button component covers regular buttons, icon buttons, strong-intent buttons, and link-like buttons.
Common props:
| Prop | Description |
| --- | --- |
| `variant` | `neutral`, `primary`, `danger`, `subtle`, or `ghost` |
| `size` | `sm`, `md`, `lg`, or `icon` |
| `shape` | `square` or `pill` |
| `icon` | Preset icon name or a custom React node |
| `iconOnly` | Fixed-size icon button; provide `tooltip` or `aria-label` |
| `tooltip` | Rendered through a portal and offset away from the cursor |
| `loading` | Disables the button and exposes `aria-disabled` |
| `tactile` | Overrides size, radius, shadow, background, and dark-mode variables |
```tsx
<TactileButton icon="refresh" iconOnly tooltip="Refresh" />
<TactileButton variant="primary" icon="save">Save</TactileButton>
<TactileButton variant="danger" icon="delete" iconOnly tooltip="Delete" />
```
`variant="neutral"` defaults to a white tactile button. Colored buttons should still keep the same height and external shadow instead of relying on page-specific CSS overrides.
## Icon Presets
Preset icons are maintained in `tactileIconPresets`. Feature pages should call icons by semantic name so actions remain consistent across the console.
Common semantics:
| Name | Use |
| --- | --- |
| `refresh` | Refresh data |
| `save` | Save |
| `delete` | Delete |
| `trigger` / `collect` | Trigger collection |
| `start` / `play` | Start |
| `stop` | Stop |
| `connect` / `test` | Connectivity check |
| `guide` | Credential guide |
| `generate` | AI generation |
| `reset` | Restore defaults |
| `detail` | View details |
| `copy` | Copy |
| `upload` | Upload |
Custom icons are also supported:
```tsx
<TactileButton icon={<MyIcon aria-hidden="true" />} iconOnly tooltip="Custom action" />
```
## `TactileSwitch`
`TactileSwitch` is for binary settings. It is not a large iOS-style switch; it matches the compact tactile slider used by Docs.
```tsx
<TactileSwitch
checked={enabled}
onCheckedChange={setEnabled}
label="Enable WebSearch"
tooltip="Enable WebSearch"
/>
```
The label defaults to tooltip content. If visible text is needed, render it in the surrounding layout rather than inside the switch.
## `ControlGroup`
`ControlGroup` arranges action buttons with consistent spacing and alignment. It has no grey base by default; use `withBase` or `baseTactile` only when a base surface is intentional.
```tsx
<ControlGroup align="end" gap={8}>
<TactileButton icon="refresh" iconOnly tooltip="Refresh" />
<TactileButton variant="primary" icon="save">Save</TactileButton>
</ControlGroup>
```
In list footers, the group should appear at the end of the scroll content, not float in the middle of the list. In detail toolbars, size and shadow should come from the shared component defaults.
## `TactileTooltip`
Tooltips render to `document.body` via `createPortal`, support `top`, `right`, `bottom`, and `left`, and perform simple collision correction. The default position is offset down and to the right from the trigger so it does not sit under the cursor.
```tsx
<TactileTooltip label="Refresh" anchor={buttonRef.current} open={open} side="bottom" />
```
Application code usually does not need to use it directly because `TactileButton` and `TactileSwitch` include tooltip handling.
## `Scrollbar`
`Scrollbar` wraps ordinary scrollable content. Native scrolling remains on the viewport; Tactile UI only renders the overlay track and thumb.
```tsx
<Scrollbar axis="both" minThumbSize={28} autoHide>
<LongContent />
</Scrollbar>
```
Common props:
| Prop | Description |
| --- | --- |
| `axis` | `x`, `y`, or `both` |
| `autoHide` | Fade/soften when not hovered or dragged |
| `alwaysVisible` | Keep scrollbars visible |
| `trackSize` / `thumbSize` | Track and thumb dimensions |
| `inset` / `radius` | Edge inset and radius |
| `thumbColor` / `trackColor` | Local color overrides |
| `viewportRef` | External real scroll node |
Do not force overlay scrollbars onto textareas. Text selection and the resize grip need native behavior. If a consistent textarea look is needed, use a dedicated resizable textarea style that preserves the native grip hit area.
## `ScrollbarOverlay`
`ScrollbarOverlay` is for areas that already own a scroll node, such as a third-party table or custom viewport. It does not create a new scroll container; it observes the target and paints overlay scrollbars.
```tsx
<div ref={hostRef}>
<ThirdPartyTable />
<ScrollbarOverlay containerRef={hostRef} targetSelector=".tui-scroll-target" />
</div>
```
## `TableScrollRegion`
`TableScrollRegion` is a convenience wrapper for table scroll areas. The default target selector is `.tui-scroll-target`; Admin Next passes its table viewport selector explicitly so package code does not contain product-specific names.
```tsx
<TableScrollRegion targetSelector=".table-viewport">
<EntityTable />
</TableScrollRegion>
```
## Accessibility
- `iconOnly` buttons must provide `tooltip` or `aria-label`.
- `TactileSwitch` uses `role="switch"` and `aria-checked`.
- Tooltip text is explanatory only; state must still be represented by text, badges, or `aria-*` attributes.
- Disabled and loading states set `aria-disabled`; real `button` elements also receive `disabled`.
## Admin Next Migration Rules
Admin Next should use Tactile UI for global tool buttons, detail-panel toolbars, and list footer actions:
- Unambiguous actions: `TactileButton iconOnly tooltip`
- Save/create/confirm: `TactileButton variant="primary"`, usually with text
- Delete/stop: `TactileButton variant="danger"`, with text only when risk or ambiguity requires it
- Switches: `TactileSwitch`
- Long lists, tables, logs, and Markdown: `Scrollbar` / `ScrollbarOverlay` / `TableScrollRegion`
The boundary is deliberate: Tactile UI owns touch feel, size, shadow, tooltip, and scrollbar behavior; feature pages own APIs, state machines, permissions, and copy.

View File

@@ -28,8 +28,10 @@
- [数据源、采集器设置与连接验证](/home/ray/dev/linkong/planet/docs/technical/zh/datasource-collector-settings-connectivity.md)数据源目录、采集器设置、连接验证、BarentsWatch 凭证链路
- [通用位置估算管线开发说明](/home/ray/dev/linkong/planet/docs/technical/zh/location-pipeline-development.md):后端 location resolver / pipeline 的接口、注册表和扩展方式
- [Docs Gatekeeper 开发说明](/home/ray/dev/linkong/planet/docs/technical/zh/docs-gatekeeper-development.md):后端 Docs 目录、正文读取和 Gatekeeper 权限组实现
- [命名与术语对照](/home/ray/dev/linkong/planet/docs/technical/zh/naming-glossary.md)控制台、Earth、后端和文档常见名词的中英对照
- [Earth 可交互图标接入](/home/ray/dev/linkong/planet/docs/technical/zh/earth-interactable-usage.md)Earth 地表可交互图标 `Interactable` 的接口、生命周期和接入示例
- [Earth 工具栏与浮层协同](/home/ray/dev/linkong/planet/docs/technical/zh/earth-toolbar-overlay-coordination.md):工具栏按钮与搜索 / 设置 / 新闻 / 图层浮层之间的关闭矩阵和接入规则
- [Tactile UI 组件库](/home/ray/dev/linkong/planet/docs/technical/zh/tactile-ui-components.md)可移植按钮、开关、tooltip 和滚动条组件的 API、主题 token 与迁移约定
不适合放入这里的内容:

View File

@@ -101,6 +101,19 @@ AI 配置页使用的接口:
这些接口都需要用户登录。`secrets` 接口只用于配置页点击显示 key/token 时取回明文,隐藏时前端恢复为脱敏预览。
Admin Next 的 AI 页面按旧版信息架构组织为:
- `模型供应商`
- 管理 provider、协议适配、默认模型、LLM API Key、代理地址、代理 token、模型列表刷新、设为默认和轻量连通性测试。
- `工具调用`
- 管理 WebSearch、OCR 等工具。工具内部先选 provider再编辑该 provider 的 API、key 和高级参数。
- `提示词`
- 按 prompt 分组和 task key 编辑系统提示词 / 用户提示词;保存和重置只作用于当前 task。
- `Playground`
- 使用当前默认 provider 和 prompt 配置发起真实会话AI 回复使用 Markdown 渲染。
保存、设为默认和连通性测试是三个独立职责:保存只持久化表单,设为默认只切换默认 provider/tool连通性测试只验证当前草稿是否可用不应隐式保存或切换默认项。
`ai-prompts` 接口用于运维配置页的“提示词”Tab。默认提示词来自后端随发布包携带的版本化资源业务代码只引用稳定 task key接口只保存运维覆盖值。重置时删除覆盖值并恢复当前发布包中的缺省提示词。
### 提示词边界
@@ -259,6 +272,34 @@ AI 配置仍保存在 PostgreSQL不写入 JSON 文件。核心结构如下:
`.env` 只是兜底。配置页保存或测试连接成功后PostgreSQL 中的配置会成为全局默认。
Admin Next 的密钥状态必须按 provider / tool 精确判断:
- 数据库中当前 provider/tool 有密钥时,显示为“已配置”。
- 数据库没有密钥,但 fallback provider、model 或 tool 与当前项匹配时,可以显示 fallback 的脱敏预览。
- 数据库没有密钥且 fallback 不匹配当前项时,显示为“未配置”,不能把其它 provider 的 `.env` 通用 key 当成当前项已配置。
- 脱敏规则保留 key 第一个 `-` 之前的前缀,例如 `sk-********`;明文显示只在有权限的配置页面内按需触发。
工具 key 使用同样规则。WebSearch、OCR 这类工具必须先匹配当前工具和 provider再决定能否使用 fallback。
### 轻量连通性测试
Admin Next 的插头按钮走轻量连通性测试,不承担保存职责。业界常见做法是分两层:
- 快速检查 provider 目录或低成本 endpoint确认 base URL、鉴权和当前模型是否可达。
- 只有在用户明确运行 Playground 或业务任务时才发完整模型请求。
因此,连通性测试应尽量使用低成本请求,并返回明确状态:
- `ok`: 鉴权、路由和模型目录可用。
- `warning`: 服务可达,但当前模型不在目录或能力声明不完整。
- `error`: 鉴权失败、网络失败、协议错误或模型不可用。
错误 toast 标题必须和结果一致,不能在失败时显示“连通性正常”。
### OpenCode Go 路由模型
OpenCode Go 这类订阅通道不要靠前端硬编码模型集合判断协议。推荐在 provider catalog 或后端能力发现中记录每个模型的协议能力,例如 `chat_completions``anthropic_messages``models_endpoint` 和是否需要订阅 key。前端只展示能力结果后端负责把 provider、base URL、model 和协议适配映射为实际请求。
#### 配置页行为
- Provider 下拉框决定当前默认 provider。

View File

@@ -228,9 +228,22 @@ if datasource.last_status == "success":
这个记录用于控制台“采集管理 -> 采集器”中的连接状态判断:如果当前配置和成功采集时的 checksum 一致,就视为已连接,不要求用户再手动点击连接按钮。只有 endpoint、请求头、基础配置或凭证指纹变化时才需要重新验证。
### 采集管理与快照
Admin Next 的采集管理入口按业务层级组织:
- `采集器`:配置 endpoint、认证方式、请求头、基础参数、启用状态和凭证教程。
- `采集调度`:查看和调整调度状态,触发、停止或刷新采集任务。
- `采集历史 / 快照`:按采集器聚合展示历史,详情中用快照选择器查看同一采集器的不同版本。
快照列表不应把同一个采集器的每次快照都拍平成独立主列表项。主列表负责选择采集器,详情区负责时间版本切换。
凭证教程由 `backend/app/services/credential_guides.py` 维护,控制台通过 read / generate / reset 三个动作读取或生成 Markdown 教程。教程面向运维配置人员,前端应渲染 Markdown 正文,而不是展示生成 prompt 或原始元数据。
相关实现见:
- [datasource_connectivity.py](/home/ray/dev/linkong/planet/backend/app/services/datasource_connectivity.py)
- [credential_guides.py](/home/ray/dev/linkong/planet/backend/app/services/credential_guides.py)
- [数据源、采集器设置与连接验证](/home/ray/dev/linkong/planet/docs/technical/zh/datasource-collector-settings-connectivity.md)
## 八、相关代码文件

View File

@@ -32,8 +32,8 @@
文件:
- [DataSources.tsx](/home/ray/dev/linkong/planet/frontend/src/pages/DataSources/DataSources.tsx)
- [index.css](/home/ray/dev/linkong/planet/frontend/src/index.css)
- [PlainResourcePages.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/pages/PlainResourcePages.tsx)
- [AdminNextRoutes.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/AdminNextRoutes.tsx)
当前行为:
@@ -53,30 +53,35 @@
`data-source-bulk-toolbar__running-pill` 是“采集中”标签的样式入口。它和其他状态标签同排,但通过 hover、箭头和蓝色描边表达可交互性。
### 采集
### 采集管理
文件:
- [Settings.tsx](/home/ray/dev/linkong/planet/frontend/src/pages/Settings/Settings.tsx)
- [PlainResourcePages.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/pages/PlainResourcePages.tsx)
当前行为:
- `collector_credentials` tab 在 `/collection-management` 下展示为“采集器”
- 下拉框列出内置采集器,并支持维护合并到内置数据的自定义补充源
- 下拉框右侧只有一个插头图标按钮,用于健康检查
- 下拉框下方用状态标签展示:
- `需要凭证` / `无需凭证`
- 模块
- `启用` / `禁用`
- `未检查` / `可用` / `不可用`
- 是否覆盖 endpoint
- 需要凭证的采集器把凭证卡片放在基础配置上方。
- 不需要凭证的采集器只显示基础配置。
- `/collection-management` 按旧版层级收敛为 `采集器``采集调度``采集历史 / 快照`
- `采集器` 是配置页,左侧列表展示采集器配置;右侧表单编辑 endpoint、认证、请求头、采集参数和启用状态
- 新增采集器和目标 Schema 使用草稿详情页,不再用透明 JSON 弹窗;保存后才固化到列表,取消会销毁草稿
- 连接按钮只做连通性测试,不保存配置;保存按钮只持久化表单。
- 凭证教程以可拖拽 Markdown 弹窗展示。没有教程时仍打开弹窗并提供生成入口;生成时显示中心等待状态;重置确认层级必须高于教程弹窗。
- `采集历史 / 快照` 按采集器聚合。列表不再重复展示同一数据源的所有快照;详情页内部用 Time Capsule / Time Machine 式选择器切换快照版本。
- AISStream 采集器使用 WebSocket 语义,状态会显示为连接中、实时接收、重连或停止,不使用固定百分比表达完成度。
- 自定义源入口放在采集器设置内,不在数据源目录里重复提供编辑入口;数据源目录只保留总览、运行和只读抽屉。
连接按钮使用内联 Tabler 风格插头图标,来源语义对应 `plug-connected`,避免继续使用刷新图标表达连接动作。
### 映射模板和目标 Schema
映射能力仍属于采集管理,但不是采集器主 tab
- `映射模板` 承担 sample payload、AI propose、preview、create/update、activate。
- `目标 Schema` 维护可写入目标结构。
- `run-mapped``stop-mapped``stream-status` 负责运行映射后的自定义采集器。
这些入口在新版中需要表单化,只有高级字段才折叠为 JSON。不要把模板、Schema、运行状态和采集器配置拍平成同一张表。
## 后端接口
### 数据源配置列表
@@ -140,6 +145,26 @@ POST /api/v1/datasources/configs/builtin/connect
- `credential_provider`
- `credential_source`
### 凭证教程
```http
GET /api/v1/datasources/credential-guides/{provider}
POST /api/v1/datasources/credential-guides/{provider}/generate
POST /api/v1/datasources/credential-guides/{provider}/reset
```
用途:
- 读取当前 provider 的 Markdown 凭证教程。
- 没有教程时,由 AI 根据采集器元数据生成教程。
- 重置时恢复后端默认教程。
前端展示规则:
- 展示渲染后的 Markdown不展示后端 prompt 或元数据。
- 生成/重置是教程弹窗内部动作,不放在采集器配置主工具栏。
- 没有教程也要打开弹窗,让用户能从弹窗里生成教程。
### BarentsWatch AIS 连接验证
```http

View File

@@ -162,6 +162,15 @@ Earth 地表是多层近似同心球,不是单一 mesh。`earth.js` 的基座
`brand.js` 管理 Earth HUD 品牌资源。默认品牌来自静态资源,运行时覆盖值来自 `/api/v1/earth/brand`,上传的图片通过 `/earth-brand-assets/...` 读取。前端必须把 logo/title 图片和文本 fallback 分开处理:图片加载失败时显示文本标题,文本字段为空时使用后端默认值,避免 HUD 品牌区空白。控制台的 Earth 内容页负责保存和重置品牌配置Earth 前端只消费结果。
Admin Next 的 Earth 内容页必须按运行时语义组织这些配置:
- `品牌标识`:品牌预览应使用与 Earth HUD 左上角一致的深色星空背景、尺寸、间距、logo/title 渲染和文本 fallback而不是普通表单预览。
- `国界精度`:构建边界、刷新状态和恢复默认属于这个分区内部动作,不应放在页面全局工具栏。
- `电视直播`:列表同时区分内置源、采集源和自定义源;卡片状态表达启用、停用、新建或错误。内置源不能删除,采集源和自定义源可以删除。新增直播源在点击加号后才进入草稿状态,保存后固化到列表,取消则销毁草稿。
- `底图资源``图层资源``3D 模型``新闻锚点策略`:如果后端能力未接入,控制台应明确显示待接入空态,不应混入 TV 或品牌配置。
TV 预览需要尽量复用 Earth 运行时的直播卡片结构和状态标签,这样控制台看到的内置、直播加载中、播放源、地区、语言等信息与 Earth 中实际显示保持一致。
其中 Earth 启动加载链现在也拆成了两层:
- `controls.js`

View File

@@ -22,7 +22,7 @@
- [App.tsx](/home/ray/dev/linkong/planet/frontend/src/App.tsx)
当前后台相关路由包括
当前正式后台路由已经由 Admin Next 接管
- `/admin`
- `/users`
@@ -37,15 +37,45 @@
- `/collection-management`
- `/settings`
这些路径渲染 [AdminNextRoutes.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/AdminNextRoutes.tsx),页面清单和菜单元信息来自 [manifest.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/routes/manifest.tsx)。`/admin-next/*` 仅作为兼容入口存在,会重定向到上面的正式路径,不再作为并行主入口。
旧 AntD 控制台保留在 `/legacy/admin/*`,用于对照和回退:
- `/legacy/admin`
- `/legacy/admin/datasources`
- `/legacy/admin/data`
- `/legacy/admin/collection-management`
- `/legacy/admin/earth-content`
- `/legacy/admin/ai`
- `/legacy/admin/logs`
- `/legacy/admin/settings`
- `/legacy/admin/users`
- `/legacy/admin/bgp`
- `/legacy/admin/alerts/*`
旧页面、`AppLayout``antd``@ant-design/icons` 在 legacy 验收期继续保留。不要在新版 parity 验收前删除这些文件或依赖。
`/earth` 是独立展示页,不属于控制台骨架。
## 当前页面骨架
控制台公共壳层在:
正式后台公共壳层在:
- [AdminNextLayout.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/components/layout/AdminNextLayout.tsx)
职责:
- 左侧导航、分组折叠和移动端抽屉
- 当前账号、版本、退出登录和主题切换
- 顶部搜索、面包屑和页面快捷入口
- 内容区单屏高度闭合
- Admin Next 内部滚动、表格、详情面板和移动端详情视图协调
旧 AntD legacy 壳层仍在:
- [AppLayout.tsx](/home/ray/dev/linkong/planet/frontend/src/components/AppLayout/AppLayout.tsx)
职责:
legacy 职责:
- 左侧导航
- 折叠与展开
@@ -66,7 +96,19 @@
</Layout>
```
后续控制台页面应优先适配这套壳层,而不是重新定义全页高度语义
后续正式控制台页面应优先适配 `AdminNextLayout` 和 Admin Next 页面模式,而不是继续往旧 `AppLayout` 增加新能力。只有维护 `/legacy/admin/*` 时才应修改旧壳层
## Admin Next 分区加载策略
多 tab 页面由 [PlainResourcePages.tsx](/home/ray/dev/linkong/planet/frontend/src/admin-next/pages/PlainResourcePages.tsx) 统一承载当前的管理型和信息型工作台。分区加载规则是:
- 初次进入页面只请求当前 active tab不预先拉取所有 tab 的接口。
- 用户切换 tab 时懒加载该 tab已经加载过的 tab 保留在本地 `states` 缓存中,切回时直接复用。
- 手动刷新、保存、测试、上传、生成教程等明确动作只刷新当前分区,避免把无关分区的接口一起打出去。
- 数据源目录的筛选条件变化会清掉内置源分区缓存,并按新筛选重新请求当前分区。
- 顶部 summary 只统计“已加载分区”,不把未访问 tab 误报成异常接口。
这样做是为了降低 Earth、AI、采集管理等多分区页面的冷启动压力同时保留 tab 数量、状态和用户切换后的缓存体验。需要全量健康巡检时应走后端健康接口或显式刷新流程,不要依赖页面初始化时顺手拉所有业务接口。
## 当前共享组件
@@ -74,7 +116,8 @@
文件:
- [Scrollbar.tsx](/home/ray/dev/linkong/planet/frontend/src/components/Scrollbar/Scrollbar.tsx)
- [Scrollbar.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/Scrollbar.tsx)
- [Tactile UI 组件库](/home/ray/dev/linkong/planet/docs/technical/zh/tactile-ui-components.md)
用途:
@@ -91,7 +134,7 @@
文件:
- [ScrollbarOverlay.tsx](/home/ray/dev/linkong/planet/frontend/src/components/Scrollbar/ScrollbarOverlay.tsx)
- [ScrollbarOverlay.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/ScrollbarOverlay.tsx)
用途:
@@ -100,25 +143,42 @@
当前使用场景:
- 数据源
- 采集数据
- 用户管理
- 设置页
- 告警页
- BGP 页面
- Admin Next 数据源、采集数据、采集管理、日志、告警和 BGP 页面
- 旧 AntD legacy 页面通过兼容封装继续使用共享滚动能力
### 3. `TableScrollRegion`
文件:
- [TableScrollRegion.tsx](/home/ray/dev/linkong/planet/frontend/src/components/Scrollbar/TableScrollRegion.tsx)
- [TableScrollRegion.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/TableScrollRegion.tsx)
用途:
- 为表格滚动区提供统一包裹层
- 后续新表格页优先复用,不要重复写“表格区域 + overlay scrollbar”样板
### 4. `SegmentedControl`
### 4. `TactileButton` / `TactileSwitch` / `ControlGroup`
文件:
- [Button.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/Button.tsx)
- [Switch.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/Switch.tsx)
- [ControlGroup.tsx](/home/ray/dev/linkong/planet/frontend/src/components/tactile-ui/ControlGroup.tsx)
用途:
- Admin Next 全局工具按钮和详情页工具按钮
- icon-only + tooltip 的普通操作
- 保存、创建、确认、删除、停止等强意图操作
- 与 Docs 主题滑块一致的紧凑开关
当前约束:
- 默认按钮是白色触感按钮,通过外部投影表达轻微立体感
- 无歧义动作优先图标 + tooltip保存这类强意图动作可保留文字
- 业务页面通过 props 和 CSS variables 调整,不要直接手写按钮核心样式
### 5. `SegmentedControl`
文件:
@@ -146,7 +206,7 @@
- 颜色优先通过 CSS 变量覆盖,避免在业务组件里硬编码主题色
- 适合少量互斥选项,不适合用作长列表、导航菜单或表单下拉
### 5. `MarkdownRenderer`
### 6. `MarkdownRenderer`
文件:
@@ -165,7 +225,7 @@
- 文档内部链接应通过 `transformLink` 转成 `/docs/:slug`
- 标题锚点由 `getHeadingId` 注入,避免渲染器自己理解路由状态
### 6. `ConnectionTestInput`
### 7. `ConnectionTestInput`
文件:
@@ -183,7 +243,7 @@
- 禁用的集成能力必须同时置灰输入框和连接测试按钮
- 组件只负责输入框与测试入口组合不保存业务状态调用方仍负责表单值、loading、disabled 和连接请求
### 7. `TableActions`
### 8. `TableActions`
文件:

View File

@@ -0,0 +1,99 @@
# 命名与术语对照
本文约定 Planet 控制台、Earth、后端 API 和文档中的常见名词。新增 UI 文案、接口字段展示、图表标签和文档说明时,优先使用这里的中文名,避免同一页面中出现不必要的中英混合。
## 使用规则
- 面向中文界面的可见标签使用“中文显示名”。
- API 字段、数据库字段、代码类型和外部品牌名保留英文或 snake_case。
- 专有名词第一次出现时可以写成“中文显示名English Term之后使用中文显示名。
- BGP、AI、API、URL、ID、TLE、ASN、GPU、AIS 等行业缩写可保留英文。
- 外部服务品牌保留官方英文名,例如 PeeringDB、Space-Track、BarentsWatch、AISStream、GitHub。
## 核心产品名词
| English / Key | 中文显示名 | 使用场景 |
| --- | --- | --- |
| Planet | Planet | 产品名,保留英文 |
| Admin Next | 新控制台 | 新版管理端上下文 |
| Earth | Earth | 地球可视化产品名,保留英文 |
| datasource | 数据源 | API、列表、筛选 |
| collector | 采集器 | 采集任务、凭证配置 |
| collected data | 采集数据 | 数据列表、统计 |
| snapshot | 快照 | 采集历史 |
| mapping | 映射 | 采集字段映射 |
| target schema | 目标 Schema | 映射目标结构 |
| credential | 凭证 | 密钥、账号密码、OAuth 信息 |
| secret reveal | 密钥 reveal | 管理员显式查看密钥动作,保留 reveal 表示审计语义 |
| AI Provider | AI Provider | 服务名,保留英文 |
| tool | 工具 | Web Search、OCR 等工具配置 |
| Playground | Playground | 交互调试入口,保留英文 |
## 数据类型
| data_type | 中文显示名 | 说明 |
| --- | --- | --- |
| `supercomputer` | 超算 | TOP500 超算记录 |
| `gpu_cluster` | GPU 集群 | Epoch AI GPU 集群 |
| `model` | 模型 | Hugging Face 模型 |
| `dataset` | 数据集 | Hugging Face 数据集 |
| `space` | 空间 | Hugging Face Spaces |
| `ixp` | 互联网交换点 | PeeringDB IXP |
| `network` | 网络 | PeeringDB 网络 |
| `facility` | 设施 | PeeringDB 设施 |
| `submarine_cable` | 海底光缆 | 海缆线路 |
| `landing_point` | 登陆点 | 海缆登陆点 |
| `cable_system` | 海缆系统 | TeleGeography cable system |
| `cable_landing_relation` | 海缆登陆关系 | 海缆与登陆点关系 |
| `satellite_tle` | 卫星轨道根数 | CelesTrak / Space-Track TLE |
| `bgp_rib` | BGP 路由表 | BGP RIB 快照 |
| `bgp_update` | BGP 更新 | BGP update 事件 |
| `prefix_geography` | 前缀地理位置 | IP 前缀地理位置 |
| `vessel_ais` | AIS 船舶 | AIS 船舶观测 |
| `vessel` | 船舶 | 聚合后的船舶对象 |
| `news_live_stream` | 新闻直播源 | 新闻直播源配置 |
| `news_item` | 新闻条目 | 新闻归档条目 |
| `device_stats` | 设备统计 | Cloudflare Radar 设备统计 |
| `traffic_stats` | 流量统计 | Cloudflare Radar 流量统计 |
| `as_stats` | 自治系统统计 | Cloudflare Radar AS 统计 |
| `compute_center` | 算力中心 | Earth 聚合展示对象 |
| `generic` | 通用数据 | 通用采集输出 |
| `generic_records` | 通用记录 | 通用映射输出 |
## 数据源与外部服务
| English / Key | 中文显示名 | 说明 |
| --- | --- | --- |
| TOP500 | TOP500 超算榜单 | 外部榜单名保留 TOP500 |
| Epoch AI | Epoch AI GPU 集群 | 外部服务名保留 Epoch AI |
| Hugging Face | Hugging Face | 官方品牌名 |
| PeeringDB IXP | PeeringDB 交换中心 | IXP 可补充写作“互联网交换点” |
| PeeringDB Networks | PeeringDB 网络 | 网络实体 |
| PeeringDB Facilities | PeeringDB 设施 | 机房 / 设施 |
| Submarine Cables | 海底光缆 | 图表和列表优先用中文 |
| Cable Landing Points | 海缆登陆点 | 不是“着陆点” |
| CelesTrak TLE | CelesTrak 轨道根数 | TLE 可保留缩写 |
| Space-Track TLE | Space-Track 轨道根数 | Space-Track 保留品牌名 |
| RIPE RIS Live BGP | RIPE RIS Live BGP | 外部服务名和 BGP 缩写保留英文 |
| IPtoASN Prefix Geography | IPtoASN 前缀地理位置 | IPtoASN 保留品牌 / 数据集名 |
| OpenGeoFeed Prefix Geography | OpenGeoFeed 前缀地理位置 | OpenGeoFeed 保留品牌名 |
| NRO Delegated Prefix Geography | NRO Delegated 前缀地理位置 | NRO Delegated 保留数据集名 |
| BarentsWatch AIS Vessels | BarentsWatch AIS 船舶 | BarentsWatch / AIS 保留 |
| AISStream Vessels | AISStream 船舶 | AISStream 保留品牌名 |
## 界面动作与状态
| English / Key | 中文显示名 | 使用场景 |
| --- | --- | --- |
| success | 成功 | 状态徽标 |
| failed | 失败 | 状态徽标 |
| running | 运行中 | 任务状态 |
| completed | 已完成 | 任务状态 |
| cancelled | 已取消 | 任务状态 |
| enabled | 已启用 | 开关状态 |
| disabled | 已停用 | 开关状态 |
| configured | 已配置 | 凭证 / 集成状态 |
| unconfigured | 未配置 | 凭证 / 集成状态 |
| refresh | 刷新 | 按钮 |
| copy | 复制 | 按钮 |
| reveal | reveal | 密钥显示动作,因审计语义保留英文 |

View File

@@ -87,8 +87,8 @@
持续跟随:
```bash
./planet.sh log -f # 前端: /tmp/planet_frontend.log
./planet.sh log -b # 后端: /tmp/planet_backend.log
./planet.sh log -f # 前端: ~/.local/state/planet/frontend.log
./planet.sh log -b # 后端: ~/.local/state/planet/backend.log
./planet.sh log -a # AI Provider: planet_aiprovider 容器日志
```
@@ -234,6 +234,20 @@ bun run build
source ~/.zshrc && bun run build
```
开发时继续使用 `bun run dev`Vite HMR 会在保存源码后刷新浏览器。`bun run build` 只生成 `dist` 产物,不会刷新已经打开的 dev 页面。
需要看生产包并在构建成功后自动刷新时使用:
```bash
bun run preview:auto
```
只想监听源码并持续构建,不启动预览服务时使用:
```bash
bun run build:watch
```
后端依赖通过 uv 管理:
```bash

View File

@@ -0,0 +1,205 @@
# Tactile UI 组件库
Tactile UI 是 Planet 内部抽出的可移植 React 控件层。它来自 Admin Next 的按钮、开关、滚动条和 tooltip 收口,但组件本身不依赖 Admin Next、AntD、Radix、Tailwind 或 `an-*` class。目标是先在仓库内稳定使用后续可以作为独立 npm 包发布。
## 设计目标
- **轻触感**:默认控件使用白色或主题表面、细边框和外部投影,接近 Docs 主题滑块的轻微立体感,不使用大色块或发光效果。
- **可移植**:组件 class 使用 `tui-*` 前缀,样式集中在 `frontend/src/components/tactile-ui/styles.css`
- **低依赖**:组件只假设 React/React DOM图标预设当前使用 `lucide-react`,调用方也可以传自定义 React 节点。
- **主题友好**:默认样式通过 CSS variables 暴露Planet 可以在 Admin Next 或其它页面按主题覆盖 token。
- **语义清楚**:无歧义操作优先 icon-only + tooltip保存、确认、创建、执行这类强意图操作可以保留文字。
## 导入
仓库内使用:
```tsx
import { TactileButton, TactileSwitch, ControlGroup } from '@/components/tactile-ui'
import '@/components/tactile-ui/styles.css'
```
未来拆包后建议导入形式:
```tsx
import { TactileButton, TactileSwitch } from '@planet/tactile-ui'
import '@planet/tactile-ui/styles.css'
```
## 主题 Token
核心 token 在 CSS 中以 `--tui-*` 暴露。业务主题只需要覆盖变量,不应直接重写组件内部 class。
```css
:root {
--tui-surface: #ffffff;
--tui-surface-raised-hover: #f8fbff;
--tui-border-soft: #d6dfeb;
--tui-border-hover: #b8c6d9;
--tui-text: #0f172a;
--tui-primary: #2563eb;
--tui-danger: #dc2626;
}
[data-theme='dark'] {
--tui-surface: #111827;
--tui-text: #e5edf8;
}
```
组件还支持通过 `tactile` prop 传入局部尺寸、圆角、背景、边框和阴影参数。局部参数适合少量特殊按钮;全局视觉应优先走 CSS variables。
## `TactileButton`
按钮组件覆盖普通按钮、图标按钮、强意图按钮和链接式按钮。
常用 props
| Prop | 说明 |
| --- | --- |
| `variant` | `neutral``primary``danger``subtle``ghost` |
| `size` | `sm``md``lg``icon` |
| `shape` | `square``pill` |
| `icon` | 预设图标名称或自定义 React 节点 |
| `iconOnly` | 图标按钮固定尺寸,并要求提供 `tooltip``aria-label` |
| `tooltip` | 通过 portal 渲染,默认避开光标位置 |
| `loading` | 禁用按钮并暴露 `aria-disabled` |
| `tactile` | 覆盖宽高、圆角、阴影、背景和深色模式变量 |
```tsx
<TactileButton icon="refresh" iconOnly tooltip="刷新" />
<TactileButton variant="primary" icon="save"></TactileButton>
<TactileButton variant="danger" icon="delete" iconOnly tooltip="删除" />
```
`variant="neutral"` 的默认按钮是白色触感按钮。彩色按钮仍应保留外部投影和统一高度,不应在业务 CSS 中手写新的阴影体系。
## 图标预设
预设图标由 `tactileIconPresets` 统一维护,业务页面通过语义名称调用,避免每个页面随意选择图标。
常用语义:
| 名称 | 用途 |
| --- | --- |
| `refresh` | 刷新数据 |
| `save` | 保存 |
| `delete` | 删除 |
| `trigger` / `collect` | 触发采集 |
| `start` / `play` | 启动 |
| `stop` | 停止 |
| `connect` / `test` | 连接或连通性测试 |
| `guide` | 凭证教程 |
| `generate` | AI 生成 |
| `reset` | 恢复默认 |
| `detail` | 查看详情 |
| `copy` | 复制 |
| `upload` | 上传 |
如果预设不足,可以直接传 React 节点:
```tsx
<TactileButton icon={<MyIcon aria-hidden="true" />} iconOnly tooltip="自定义动作" />
```
## `TactileSwitch`
开关组件用于二元设置。它不是 iOS 风格大开关,而是与 Docs 主题滑块一致的小型轻触感控件。
```tsx
<TactileSwitch
checked={enabled}
onCheckedChange={setEnabled}
label="启用 WebSearch"
tooltip="启用 WebSearch"
/>
```
文案默认进入 tooltip。需要显示文字时由调用方在布局中单独放 label不应把长文案塞进 switch 内部。
## `ControlGroup`
`ControlGroup` 用于把一组按钮按统一间距和对齐方式排列。默认没有灰色底座;只有显式传 `withBase``baseTactile` 时才显示底座。
```tsx
<ControlGroup align="end" gap={8}>
<TactileButton icon="refresh" iconOnly tooltip="刷新" />
<TactileButton variant="primary" icon="save"></TactileButton>
</ControlGroup>
```
用于列表底部时,按钮应随着列表滚动出现,而不是固定漂浮在列表中部。用于详情页工具栏时,按钮高度和阴影应由组件默认值统一。
## `TactileTooltip`
Tooltip 使用 `createPortal` 挂到 `document.body`,支持 `top``right``bottom``left` 和 collision 修正。默认位置会相对触发元素向右下偏移,避免被鼠标指针挡住。
```tsx
<TactileTooltip label="刷新" anchor={buttonRef.current} open={open} side="bottom" />
```
应用层通常不需要直接使用它,`TactileButton``TactileSwitch` 已经内置 tooltip。
## `Scrollbar`
`Scrollbar` 包裹普通滚动容器。真实滚动仍由内部 viewport 承担Tactile UI 只提供覆盖式 track/thumb。
```tsx
<Scrollbar axis="both" minThumbSize={28} autoHide>
<LongContent />
</Scrollbar>
```
常用 props
| Prop | 说明 |
| --- | --- |
| `axis` | `x``y``both` |
| `autoHide` | 非 hover/拖拽时自动弱化 |
| `alwaysVisible` | 始终显示滚动条 |
| `trackSize` / `thumbSize` | 控制轨道和 thumb 尺寸 |
| `inset` / `radius` | 控制贴边距离和圆角 |
| `thumbColor` / `trackColor` | 局部颜色覆盖 |
| `viewportRef` | 由外部提供真实滚动节点 |
Textarea 不建议强行套 overlay 滚动条,因为浏览器 resize grip 和文本选择需要原生交互。需要统一外观时,应使用专门的 resizable textarea 样式,让原生 grip 保留可点击区域。
## `ScrollbarOverlay`
`ScrollbarOverlay` 适合已经存在滚动节点的区域,例如第三方表格或自定义 viewport。它不会创建新的滚动容器只会监听目标节点并画覆盖式滚动条。
```tsx
<div ref={hostRef}>
<ThirdPartyTable />
<ScrollbarOverlay containerRef={hostRef} targetSelector=".tui-scroll-target" />
</div>
```
## `TableScrollRegion`
`TableScrollRegion` 是表格滚动区域的便利封装。默认目标选择器是 `.tui-scroll-target`Admin Next 会显式传自己的 table viewport selector避免组件库里出现业务命名。
```tsx
<TableScrollRegion targetSelector=".table-viewport">
<EntityTable />
</TableScrollRegion>
```
## 可访问性
- `iconOnly` 按钮必须提供 `tooltip``aria-label`
- `TactileSwitch` 使用 `role="switch"``aria-checked`
- tooltip 只是说明不承担唯一状态表达状态仍应通过文本、badge 或 `aria-*` 呈现。
- 禁用和 loading 状态会设置 `aria-disabled`button 元素会同步 `disabled`
## Admin Next 迁移约定
Admin Next 中所有全局工具按钮、详情页工具按钮和列表底部动作应使用 Tactile UI
- 无歧义动作:`TactileButton iconOnly tooltip`
- 保存/创建/确认:`TactileButton variant="primary"`,通常保留文字
- 删除/停止:`TactileButton variant="danger"`,根据风险决定是否保留文字
- 开关:`TactileSwitch`
- 长列表、表格、日志、Markdown`Scrollbar` / `ScrollbarOverlay` / `TableScrollRegion`
这样做的边界是组件负责触感、尺寸、阴影、tooltip 和滚动条行为;业务页面负责 API、状态机、权限和文案。

View File

@@ -16,12 +16,13 @@
## Current Version
- `main` 当前主线历史推导到:`0.16.5`
- `dev` 当前开发分支历史推导到:`0.61.0`
- `dev` 当前开发分支历史推导到:`0.62.0`
## Timeline
| Version | Type | Branch | Commit | Summary |
| --- | --- | --- | --- | --- |
| `0.62.0` | feature | `dev` | `pending` | Admin Next 转正并迁移旧 AntD 到 `/legacy/admin/*`,补齐采集/AI Provider/Earth/日志/BGP/告警工作台,抽出 Tactile UI 组件库并优化懒加载、Markdown 和移动端详情 |
| `0.61.0` | feature | `dev` | `pending` | Earth 图层新增 Redis 读穿缓存、防击穿、stale 兜底、payload budget、缓存状态/清理接口和采集后主动失效,降低船只与重图层演示 OOM 风险 |
| `0.60.0` | feature | `dev` | `pending` | Earth 内容/国界运行体验、新闻中文摘要展示、AI Provider 纯净边界和提示词运维配置落地,并补充 Agent Runtime 与 Earth LLM 指令计划 |
| `0.59.0` | feature | `dev` | `pending` | Earth 国界迁移为静态资产并恢复低精 fallback新增工具栏高精构建进度、后台 Earth 内容/采集管理拆分、AI task prompt 管理和新闻锚点队列补丁链路 |