mirror of
https://github.com/TianyiDataScience/openclaw-control-center.git
synced 2026-08-14 00:47:58 +00:00
13 KiB
13 KiB
Architecture (Official-First)
Core Principle
Use official OpenClaw interfaces first, then add thin adapters only when required.
Official Capability Mapping
- Gateway (control plane)
- Endpoint:
GATEWAY_URL(defaults tows://127.0.0.1:18789) - Role: real-time event/control backbone
- Sessions APIs
sessions_list: discover sessions/agentssessions_history: inspect message historysessions_send: route instructions- Local session-visibility module merges
sessions_listwith per-session latest history snippets for operator read APIs. - Session history normalization distinguishes regular messages and tool events for readonly drill-down rendering.
- Runtime status
session_status: usage/time/cost/status snapshots
- Scheduling / Ops
cron: list/add/run/runs for scheduled tasks
- Governance
- approvals + tool policy boundaries for sensitive actions
- approvals action service is runtime-gated and dry-run by default
- every approval action attempt writes audit entries to
runtime/approval-actions.log
- Visual layer
- Canvas/A2UI for future Gameboy-style rendering
- Project/task state
- Local typed project store at
runtime/projects.json - Local typed task store at
runtime/tasks.json - Tasks are linked to projects via
projectIdand validated on create/update flows - Domain entities include project status/owner/title + task owner/DoD/artifacts/rollback plan/per-scope thresholds
- Local HTTP APIs support project list/create/update and task list/create/update-status with schema validation
- Snapshot includes
projectSummariesfor board views and operational counts
- Budget governance
- Scopes:
agent,project,task - Inputs: session usage snapshots (
tokensIn,tokensOut, optionalcost) - Runtime policy file:
runtime/budgets.jsonwith validated defaults and optional per-scope overrides - Output status:
ok,warn,overvia threshold + warn ratio computation - Commander exceptions endpoint reports
over-budgetentries only
- Alert routing
- Levels:
info,warn,action-required - Routing targets:
info->timelinewarn->operator-watchaction-required->action-queue
- Exceptions feed endpoint:
GET /exceptions - Notification center queue endpoint:
GET /api/action-queue - Queue items include links to related
/sessions/:id,/tasks,/projectstargets when context is available. - Queue acknowledgements persisted at
runtime/acks.json - Ack API endpoint:
POST /api/action-queue/:itemId/ack- optional acknowledgement expiry via
ttlMinutesorsnoozeUntil
- optional acknowledgement expiry via
- Audit timeline
- Aggregates runtime sources into a unified event list:
runtime/timeline.log(monitor diffs)runtime/approval-actions.log(action audit trail)runtime/operation-audit.log(import dry-run + backup export actions)- snapshot health event from
runtime/last-snapshot.json
- Local page:
GET /audit - JSON API:
GET /api/audit - Timeline is newest-first with severity filter (
all|info|warn|action-required|error).
- Linkage graph + state export
GET /graphreturns normalized graph data (project/task/session/agentnodes and linkage edges).GET /export/state.jsonreturns bundled project/task/budget/exception state for downstream consumers.
- Commander digest
- On each monitor run, a daily digest is written to:
runtime/digests/YYYY-MM-DD.jsonruntime/digests/YYYY-MM-DD.md
- Digest captures operational counts + alerts + exception summary for commander review.
- Pixel data adapter (Phase 7)
- Endpoint:
GET /view/pixel-state.json - Purpose: minimal adapter for future Gameboy view.
- Output model:
rooms,entities,linksgenerated from local project/task/session/agent state.
- Notification policy engine (Phase 7)
- Runtime policy file:
runtime/notification-policy.json - Supports:
- quiet hours suppression
- severity-to-route mapping (
info/warn/action-required)
- Preview endpoint:
GET /notifications/preview(optional?at=<ISO>simulation).
- Cron overview (Phase 7)
- Endpoint:
GET /cron - Summarizes next run timing, per-job health (
scheduled/due/late/unknown/disabled), and monitor lag state.
- System health panel endpoint (Phase 7)
- Endpoint:
GET /healthz - Combines:
- build/runtime info (
package.json, dist build timestamp, safety gates) - snapshot freshness (
runtime/last-snapshot.jsonage) - monitor lag (
runtime/timeline.loglatest tick)
- build/runtime info (
- Markdown digest renderer page (Phase 7)
- Endpoint:
GET /digest/latest - Reads latest
runtime/digests/*.mdand renders safe HTML for operator consumption.
- Operator dashboard preferences + quick filters (Phase 8)
- Home page resolves effective filters from URL query + persisted defaults in
runtime/ui-preferences.json. - Compact status strip mode is persisted and toggleable from dashboard UI.
- Quick filters (
all,attention, task states) apply readonly task subsets without mutating task state.
- Search APIs (Phase 8)
- Endpoints:
GET /api/search/tasksGET /api/search/projectsGET /api/search/sessionsGET /api/search/exceptions
- Semantics:
- case-insensitive substring matching only (safe includes, no regex eval)
- bounded
limitquery to cap payload size and prevent oversized scans
- Replay index + API docs (Phase 8)
GET /api/replay/indexindexes:runtime/timeline.logruntime/digests/*.jsonruntime/export-snapshots/*.jsonruntime/exports/*.json
- optional query window filters:
from=<ISO>to=<ISO>
- replay response includes per-source filter observability stats:
total,returned,filteredOut,filteredOutByWindow,filteredOutByLimit
GET /api/docsreturns route + schema summary payload for operator/debug usage.GET /export/state.jsonnow also persists timestamped export snapshots underruntime/export-snapshots/.
- Request telemetry correlation (Phase 8)
- Request ID resolution:
- incoming
x-request-idsanitized and reused when valid - otherwise generated UUID
- incoming
- Correlation propagation:
- all responses include
x-request-id - JSON responses include top-level
requestId - error envelope includes
error.requestId - warn/error logs include the same requestId
- all responses include
- Integration readiness + backup/import surfaces (Phase 9)
- Final integration checklist endpoint:
GET /done-checklist(aliasGET /api/done-checklist)- Builds docs-aligned checklist with runtime capability checks.
- Computes lightweight readiness scores:
observability,governance,collaboration,security.
- Export backup command:
- app command mode
backup-exportwrites timestamped bundles toruntime/exports/*.json.
- app command mode
- Import dry-run validator:
- API:
POST /api/import/dry-run - app command mode:
import-validate <file> - validates bundle shape only; no mutation.
- API:
- Optional live import mutation endpoint:
- API:
POST /api/import/live - requires explicit env gate
IMPORT_MUTATION_ENABLED=true - still requires local token auth
- blocked while
READONLY_MODE=trueunless request setsdryRun=true
- API:
- Commander feed order is normalized for operator priority:
- severity first (
action-required>warn>info) - newest event timestamp within each severity bucket.
- severity first (
- Local mutation/import auth gate + deterministic ordering hardening (Phase 10)
- New local auth gate defaults:
LOCAL_TOKEN_AUTH_REQUIRED=trueLOCAL_API_TOKENmust be configured for protected operations- token accepted via
x-local-tokenorAuthorization: Bearer
- Protected routes:
- all state-changing endpoints (
POST/PATCH) - import/export routes with side effects (
/api/import/dry-run,/api/import/live,/export/state.json,/api/export/state.json)
- all state-changing endpoints (
- Protected command paths:
backup-exportimport-validateacks-prune
- Operation audit trail:
- import dry-run, import apply, backup export, and ack prune attempts append JSONL entries to
runtime/operation-audit.log - audit timeline now includes source
operation
- import dry-run, import apply, backup export, and ack prune attempts append JSONL entries to
- Commander feed ordering tie-breakers are now fully deterministic after severity/time (code/source/sourceId/route/message).
- Replay windowing + acknowledgement TTL semantics (Phase 13)
- Replay index supports optional global time window filtering (
from,to) over:- timeline entries
- digest entries
- export snapshots
- export bundles
- Action queue acknowledgements support optional expiry:
ttlMinutes(relative duration)snoozeUntil(absolute future timestamp)
- Expired acknowledgements are treated as inactive, so queue items reappear without manual reset.
- Replay filter stats + stale ack prune command (Phase 14)
- Replay index exposes per-source and aggregate filtered-vs-returned stats for operator debugging on large windows.
- Replay stats now include per-source latency and size indicators (
latencyMs,latencyBucketsMs.p50,latencyBucketsMs.p95,totalSizeBytes,returnedSizeBytes) for large-instance troubleshooting. - Home dashboard replay panel surfaces returned/filtered counts to reduce blind spots when window/limit filters hide artifacts.
- Added command-mode stale ack prune:
APP_COMMAND=acks-prune- optional dry-run via
COMMAND_ARG=--dry-runorACK_PRUNE_DRY_RUN=true - local token-gated by default when
LOCAL_TOKEN_AUTH_REQUIRED=true - prunes expired
runtime/acks.jsonentries and writesack_pruneoperation audit records.
- Mission Control v3 parity + office model (Phase 25)
- UI shell upgraded to polished pixel-office visual system (tokenized colors/spacing/radii/shadows, layered background, responsive rails, subtle motion).
- Primary IA renamed for operator intent:
- Command Deck, Usage & Billing, Pixel Office, Work Board, Decisions, Timeline, Control Room.
- Added Mac parity surface matrix panel in Command Deck:
- each core capability exposes status + direct route entry.
- Added agent roster adapter:
- module:
src/runtime/agent-roster.ts - source: best-effort read from
~/.openclaw/openclaw.json(read-only) - fallback merge with runtime session/task/project/budget signals to avoid missing inactive agents.
- module:
- Pixel Office renders desk/zone occupancy instead of session-only grouping.
- Subscription usage/remaining contract (Phase 25)
- Usage adapter now includes best-effort subscription source probes:
runtime/subscription-snapshot.json~/.openclaw/subscription.json~/.openclaw/billing/subscription.json~/.openclaw/billing/usage.json~/.openclaw/usage/subscription.json
- Data contract in
UsageCostSnapshot.subscription:connected: consumed/remaining/limit/cycle/source availablepartial: source found but fields incomplete/parse issuesnot_connected: explicit connection hint
- Connector state now includes
subscriptionUsageand exposes actionable TODOs when disconnected.
MVP Scope (Phase 1)
- Local scaffold only
- No network calls in default readonly mode
- Define contracts + polling config
Safety Constraints (Current)
READONLY_MODE=trueis the default and remains the primary runtime mode.APPROVAL_ACTIONS_ENABLED=falseby default; no real approve/reject runs unless this is explicitlytrue.APPROVAL_ACTIONS_DRY_RUN=trueby default; action endpoints simulate and audit but do not execute.IMPORT_MUTATION_ENABLED=falseby default; live import apply is disabled unless explicitly gated on.IMPORT_MUTATION_DRY_RUN=falseby default;/api/import/liveuses requestdryRun=truefor non-mutating execution when needed.LOCAL_TOKEN_AUTH_REQUIRED=trueby default; protected operations remain blocked unless explicit local token is configured and presented.- Writes are limited to local
control-center/runtime/*files (last-snapshot.json,timeline.log,projects.json,tasks.json,budgets.json,acks.json,approval-actions.log,operation-audit.log,ui-preferences.json,export-snapshots/*.json,exports/*.json). - Runtime digests are local-only artifacts under
control-center/runtime/digests/*. - No mutation of OpenClaw runtime config from this project.
Local API Surface
GET /projectsGET /api/projectsPOST /api/projectsPATCH /api/projects/:projectIdGET /api/tasksGET /tasksGET /sessionsGET /sessions/:idGET /session/:idGET /api/sessionsGET /api/sessions/:idPOST /api/tasksPATCH /api/tasks/:taskId/statusGET /api/action-queueGET /api/action-queue/acks/prune-previewPOST /api/action-queue/:itemId/ackGET /exceptionsGET /api/commander/exceptionsGET /graphGET /view/pixel-state.jsonGET /export/state.jsonGET /notifications/previewGET /cronGET /healthzGET /digest/latestGET /auditGET /api/auditGET /api/ui/preferencesPATCH /api/ui/preferencesGET /api/search/tasksGET /api/search/projectsGET /api/search/sessionsGET /api/search/exceptionsGET /api/replay/indexGET /api/docsGET /done-checklistGET /api/done-checklistPOST /api/import/dry-runPOST /api/import/livePOST /api/approvals/:approvalId/approvePOST /api/approvals/:approvalId/reject