- Update .awoooi-agent-rules.md (4 occurrences) - Update docs/api/openapi.yaml (all schema references) - Update apps/web/tailwind.config.ts (comment) - Update apps/api/src/core/config.py (comment) Legacy CLAWBOT_URL field kept for backward compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1756 lines
45 KiB
YAML
1756 lines
45 KiB
YAML
openapi: 3.1.0
|
||
info:
|
||
title: AWOOOI API
|
||
description: AWOOOI 智能運維平台 API - 由 leWOOOgo Engine 驅動
|
||
version: 1.0.0
|
||
paths:
|
||
/api/v1/health:
|
||
get:
|
||
tags:
|
||
- Health
|
||
summary: Get Health
|
||
description: 'Full health check with real component probes
|
||
|
||
|
||
Performs async health checks on all external dependencies:
|
||
|
||
- PostgreSQL: Primary database
|
||
|
||
- Redis: Cache layer
|
||
|
||
- Ollama: Local LLM service
|
||
|
||
- OpenClaw: AI Agent service
|
||
|
||
- SigNoz: Observability platform
|
||
|
||
|
||
Returns overall system status based on component health.'
|
||
operationId: get_health_api_v1_health_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HealthResponse'
|
||
/api/v1/health/ready:
|
||
get:
|
||
tags:
|
||
- Health
|
||
summary: Get Readiness
|
||
description: 'K8s readinessProbe
|
||
|
||
|
||
Returns 200 when the service is ready to accept traffic.
|
||
|
||
Lightweight check - doesn''t probe external services.'
|
||
operationId: get_readiness_api_v1_health_ready_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
additionalProperties:
|
||
type: string
|
||
type: object
|
||
title: Response Get Readiness Api V1 Health Ready Get
|
||
/api/v1/health/live:
|
||
get:
|
||
tags:
|
||
- Health
|
||
summary: Get Liveness
|
||
description: 'K8s livenessProbe
|
||
|
||
|
||
Returns 200 when the service is alive.
|
||
|
||
Used by K8s to determine if pod needs restart.'
|
||
operationId: get_liveness_api_v1_health_live_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
additionalProperties:
|
||
type: string
|
||
type: object
|
||
title: Response Get Liveness Api V1 Health Live Get
|
||
/api/v1/dashboard:
|
||
get:
|
||
tags:
|
||
- Dashboard
|
||
summary: Get Dashboard
|
||
description: 'Get aggregated dashboard data
|
||
|
||
|
||
Fetches status from all four hosts using asyncio.gather.
|
||
|
||
Returns CPU/Memory metrics when MOCK_MODE is enabled.'
|
||
operationId: get_dashboard_api_v1_dashboard_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/DashboardResponse'
|
||
/api/v1/dashboard/stream:
|
||
get:
|
||
tags:
|
||
- Dashboard
|
||
summary: Stream Dashboard
|
||
description: "SSE real-time dashboard updates\n\nEnterprise-grade SSE implementation\
|
||
\ with:\n- Automatic disconnect detection\n- Resource cleanup on disconnect\n\
|
||
- Heartbeat mechanism (every 15s)\n- Backpressure handling\n\nClient Usage\
|
||
\ (JavaScript):\n```javascript\nconst es = new EventSource('/api/v1/dashboard/stream');\n\
|
||
es.addEventListener('host_update', (e) => {\n const data = JSON.parse(e.data);\n\
|
||
\ console.log('Host update:', data);\n});\nes.addEventListener('heartbeat',\
|
||
\ (e) => {\n console.log('Heartbeat received');\n});\nes.onerror = (e)\
|
||
\ => {\n console.log('Connection lost, reconnecting...');\n};\n```\n\n\
|
||
Disconnect Detection:\n- When browser closes or navigates away\n- When network\
|
||
\ connection is lost\n- When client calls es.close()\n\nThe server automatically\
|
||
\ detects disconnection via:\n1. asyncio.CancelledError on generator exit\n\
|
||
2. Heartbeat timeout detection\n3. Queue full backpressure"
|
||
operationId: stream_dashboard_api_v1_dashboard_stream_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema: {}
|
||
/api/v1/dashboard/hosts:
|
||
get:
|
||
tags:
|
||
- Dashboard
|
||
summary: Get Hosts
|
||
description: 'Get four-host architecture status
|
||
|
||
|
||
Returns the configured four-host IPs and their roles.'
|
||
operationId: get_hosts_api_v1_dashboard_hosts_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
title: Response Get Hosts Api V1 Dashboard Hosts Get
|
||
/api/v1/dashboard/stream/clients:
|
||
get:
|
||
tags:
|
||
- Dashboard
|
||
summary: Get Stream Clients
|
||
description: Get current SSE client count (debug endpoint)
|
||
operationId: get_stream_clients_api_v1_dashboard_stream_clients_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
title: Response Get Stream Clients Api V1 Dashboard Stream Clients
|
||
Get
|
||
/api/v1/dashboard/snapshot:
|
||
get:
|
||
tags:
|
||
- Dashboard
|
||
summary: Get Dashboard Snapshot
|
||
description: 'Full dashboard snapshot for SSE hydration
|
||
|
||
|
||
Client workflow:
|
||
|
||
1. Connect to /dashboard/stream (SSE)
|
||
|
||
2. Immediately fetch /dashboard/snapshot
|
||
|
||
3. Apply snapshot as initial state
|
||
|
||
4. Process SSE events for incremental updates
|
||
|
||
|
||
This ensures no alerts are missed during connection setup.'
|
||
operationId: get_dashboard_snapshot_api_v1_dashboard_snapshot_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
title: Response Get Dashboard Snapshot Api V1 Dashboard Snapshot Get
|
||
/api/v1/approvals/k8s-test:
|
||
get:
|
||
tags:
|
||
- HITL Approvals
|
||
- HITL Approvals
|
||
summary: 測試 K8s 連線
|
||
description: 連接 K3s 叢集並列出所有 Namespace。用於驗證 kubeconfig 設定。
|
||
operationId: test_k8s_connection_api_v1_approvals_k8s_test_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
title: Response Test K8S Connection Api V1 Approvals K8S Test Get
|
||
/api/v1/approvals/pending:
|
||
get:
|
||
tags:
|
||
- HITL Approvals
|
||
- HITL Approvals
|
||
summary: 取得待簽核清單
|
||
description: 獲取所有等待簽核的授權請求,供戰情室前端渲染。
|
||
operationId: get_pending_approvals_api_v1_approvals_pending_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/PendingApprovalsResponse'
|
||
/api/v1/approvals:
|
||
post:
|
||
tags:
|
||
- HITL Approvals
|
||
- HITL Approvals
|
||
summary: 建立授權請求
|
||
description: 建立新的 HITL 授權請求。LOW 風險自動批准,MEDIUM/CRITICAL 需要簽核。
|
||
operationId: create_approval_api_v1_approvals_post
|
||
requestBody:
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ApprovalRequestCreate'
|
||
required: true
|
||
responses:
|
||
'201':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ApprovalRequestResponse'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/approvals/{approval_id}/sign:
|
||
post:
|
||
tags:
|
||
- HITL Approvals
|
||
- HITL Approvals
|
||
summary: 簽核授權請求
|
||
description: 提交簽核。當滿足所需簽核數時,狀態轉為 APPROVED 並觸發背景執行。
|
||
operationId: sign_approval_api_v1_approvals__approval_id__sign_post
|
||
parameters:
|
||
- name: approval_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
title: Approval Id
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SignRequest'
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SignResponse'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/approvals/{approval_id}/reject:
|
||
post:
|
||
tags:
|
||
- HITL Approvals
|
||
- HITL Approvals
|
||
summary: 拒絕授權請求
|
||
description: 拒絕並終止授權請求。狀態轉為 REJECTED。
|
||
operationId: reject_approval_api_v1_approvals__approval_id__reject_post
|
||
parameters:
|
||
- name: approval_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
title: Approval Id
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/RejectRequest'
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ApprovalRequestResponse'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/ai/analyze-and-propose:
|
||
post:
|
||
tags:
|
||
- AI Decision
|
||
- AI Decision
|
||
summary: AI 分析並自動立案
|
||
description: 拉取當前監控數據,交給 OpenClaw 分析。若判定需要修復,自動建立 ApprovalRecord。
|
||
operationId: analyze_and_propose_api_v1_ai_analyze_and_propose_post
|
||
requestBody:
|
||
content:
|
||
application/json:
|
||
schema:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/OpenClawAnalysisRequest'
|
||
- type: 'null'
|
||
title: Request
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/OpenClawAnalysisResponse'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/ai/status:
|
||
get:
|
||
tags:
|
||
- AI Decision
|
||
- AI Decision
|
||
summary: AI 服務狀態
|
||
description: 檢查 OpenClaw AI 服務狀態與可用的 AI 提供者。
|
||
operationId: get_ai_status_api_v1_ai_status_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
title: Response Get Ai Status Api V1 Ai Status Get
|
||
/api/v1/plugins:
|
||
get:
|
||
tags:
|
||
- Plugins
|
||
summary: List Plugins
|
||
description: 列出所有已註冊 Plugin
|
||
operationId: list_plugins_api_v1_plugins_get
|
||
parameters:
|
||
- name: category
|
||
in: query
|
||
required: false
|
||
schema:
|
||
anyOf:
|
||
- enum:
|
||
- INPUT
|
||
- BRAIN
|
||
- OUTPUT
|
||
- ACTION
|
||
- DATA
|
||
- UI
|
||
type: string
|
||
- type: 'null'
|
||
title: Category
|
||
- name: enabled
|
||
in: query
|
||
required: false
|
||
schema:
|
||
anyOf:
|
||
- type: boolean
|
||
- type: 'null'
|
||
title: Enabled
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/Plugin'
|
||
title: Response List Plugins Api V1 Plugins Get
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/plugins/{plugin_id}:
|
||
get:
|
||
tags:
|
||
- Plugins
|
||
summary: Get Plugin
|
||
description: 取得 Plugin 詳情
|
||
operationId: get_plugin_api_v1_plugins__plugin_id__get
|
||
parameters:
|
||
- name: plugin_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
title: Plugin Id
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Plugin'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/plugins/{plugin_id}/health:
|
||
get:
|
||
tags:
|
||
- Plugins
|
||
summary: Get Plugin Health
|
||
description: Plugin 健康檢查
|
||
operationId: get_plugin_health_api_v1_plugins__plugin_id__health_get
|
||
parameters:
|
||
- name: plugin_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
title: Plugin Id
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/PluginHealth'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/pipelines:
|
||
get:
|
||
tags:
|
||
- Pipelines
|
||
summary: List Pipelines
|
||
description: 列出工作流
|
||
operationId: list_pipelines_api_v1_pipelines_get
|
||
parameters:
|
||
- name: status
|
||
in: query
|
||
required: false
|
||
schema:
|
||
anyOf:
|
||
- enum:
|
||
- draft
|
||
- active
|
||
- paused
|
||
- archived
|
||
type: string
|
||
- type: 'null'
|
||
title: Status
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/PipelineList'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
post:
|
||
tags:
|
||
- Pipelines
|
||
summary: Create Pipeline
|
||
description: 建立工作流
|
||
operationId: create_pipeline_api_v1_pipelines_post
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/PipelineCreate'
|
||
responses:
|
||
'201':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Pipeline'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/pipelines/{pipeline_id}:
|
||
get:
|
||
tags:
|
||
- Pipelines
|
||
summary: Get Pipeline
|
||
description: 取得工作流詳情
|
||
operationId: get_pipeline_api_v1_pipelines__pipeline_id__get
|
||
parameters:
|
||
- name: pipeline_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
title: Pipeline Id
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Pipeline'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
delete:
|
||
tags:
|
||
- Pipelines
|
||
summary: Delete Pipeline
|
||
description: 刪除工作流
|
||
operationId: delete_pipeline_api_v1_pipelines__pipeline_id__delete
|
||
parameters:
|
||
- name: pipeline_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
title: Pipeline Id
|
||
responses:
|
||
'204':
|
||
description: Successful Response
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/pipelines/{pipeline_id}/trigger:
|
||
post:
|
||
tags:
|
||
- Pipelines
|
||
summary: Trigger Pipeline
|
||
description: 手動觸發工作流
|
||
operationId: trigger_pipeline_api_v1_pipelines__pipeline_id__trigger_post
|
||
parameters:
|
||
- name: pipeline_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
title: Pipeline Id
|
||
responses:
|
||
'202':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/PipelineExecution'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/agent/chat:
|
||
post:
|
||
tags:
|
||
- Agent
|
||
summary: Chat With Agent
|
||
description: 與 OpenClaw 對話
|
||
operationId: chat_with_agent_api_v1_agent_chat_post
|
||
requestBody:
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ChatRequest'
|
||
required: true
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ChatResponse'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/agent/chat/stream:
|
||
post:
|
||
tags:
|
||
- Agent
|
||
summary: Chat With Agent Stream
|
||
description: 與 OpenClaw 對話 (SSE 串流)
|
||
operationId: chat_with_agent_stream_api_v1_agent_chat_stream_post
|
||
requestBody:
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ChatRequest'
|
||
required: true
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema: {}
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/agent/status:
|
||
get:
|
||
tags:
|
||
- Agent
|
||
summary: Get Agent Status
|
||
description: OpenClaw 狀態
|
||
operationId: get_agent_status_api_v1_agent_status_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/AgentStatus'
|
||
/api/v1/agent/thinking:
|
||
get:
|
||
tags:
|
||
- Agent
|
||
summary: Get Agent Thinking
|
||
description: 'OpenClaw 思考軌跡 (SSE 串流)
|
||
|
||
Phase 1.2: 真實串接 Ollama at 192.168.0.188:11434'
|
||
operationId: get_agent_thinking_api_v1_agent_thinking_get
|
||
parameters:
|
||
- name: prompt
|
||
in: query
|
||
required: false
|
||
schema:
|
||
type: string
|
||
description: 發送給 AI 的提示詞
|
||
default: 你是 AWOOOI 智能運維助手。請簡短分析一下目前系統的健康狀態,用中文回答。
|
||
title: Prompt
|
||
description: 發送給 AI 的提示詞
|
||
- name: model
|
||
in: query
|
||
required: false
|
||
schema:
|
||
type: string
|
||
description: Ollama 模型名稱
|
||
default: llama3.2:latest
|
||
title: Model
|
||
description: Ollama 模型名稱
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema: {}
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
/api/v1/notifications/channels:
|
||
get:
|
||
tags:
|
||
- Notifications
|
||
summary: List Notification Channels
|
||
description: 列出通知頻道
|
||
operationId: list_notification_channels_api_v1_notifications_channels_get
|
||
responses:
|
||
'200':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
items:
|
||
$ref: '#/components/schemas/NotificationChannel'
|
||
type: array
|
||
title: Response List Notification Channels Api V1 Notifications Channels
|
||
Get
|
||
/api/v1/notifications/send:
|
||
post:
|
||
tags:
|
||
- Notifications
|
||
summary: Send Notification
|
||
description: 發送通知
|
||
operationId: send_notification_api_v1_notifications_send_post
|
||
requestBody:
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/NotificationRequest'
|
||
required: true
|
||
responses:
|
||
'202':
|
||
description: Successful Response
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/NotificationResult'
|
||
'422':
|
||
description: Validation Error
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/HTTPValidationError'
|
||
components:
|
||
schemas:
|
||
AIRiskLevel:
|
||
type: string
|
||
enum:
|
||
- low
|
||
- medium
|
||
- critical
|
||
title: AIRiskLevel
|
||
description: AI 風險評估等級
|
||
AgentStatus:
|
||
properties:
|
||
status:
|
||
type: string
|
||
enum:
|
||
- idle
|
||
- thinking
|
||
- executing
|
||
- waiting_approval
|
||
title: Status
|
||
active_conversations:
|
||
type: integer
|
||
title: Active Conversations
|
||
current_task:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Current Task
|
||
last_activity:
|
||
anyOf:
|
||
- type: string
|
||
format: date-time
|
||
- type: 'null'
|
||
title: Last Activity
|
||
type: object
|
||
required:
|
||
- status
|
||
- active_conversations
|
||
title: AgentStatus
|
||
ApprovalRequestCreate:
|
||
properties:
|
||
action:
|
||
type: string
|
||
title: Action
|
||
description: 執行動作描述
|
||
description:
|
||
type: string
|
||
title: Description
|
||
description: 詳細說明
|
||
risk_level:
|
||
$ref: '#/components/schemas/RiskLevel'
|
||
description: 風險等級
|
||
blast_radius:
|
||
$ref: '#/components/schemas/BlastRadius'
|
||
dry_run_checks:
|
||
items:
|
||
$ref: '#/components/schemas/DryRunCheck'
|
||
type: array
|
||
title: Dry Run Checks
|
||
requested_by:
|
||
type: string
|
||
title: Requested By
|
||
description: 請求發起者
|
||
expires_at:
|
||
anyOf:
|
||
- type: string
|
||
format: date-time
|
||
- type: 'null'
|
||
title: Expires At
|
||
description: 到期時間
|
||
metadata:
|
||
anyOf:
|
||
- additionalProperties: true
|
||
type: object
|
||
- type: 'null'
|
||
title: Metadata
|
||
description: 額外元資料
|
||
type: object
|
||
required:
|
||
- action
|
||
- description
|
||
- risk_level
|
||
- requested_by
|
||
title: ApprovalRequestCreate
|
||
description: 建立授權請求 (API 輸入)
|
||
ApprovalRequestResponse:
|
||
properties:
|
||
id:
|
||
type: string
|
||
title: Id
|
||
action:
|
||
type: string
|
||
title: Action
|
||
description:
|
||
type: string
|
||
title: Description
|
||
status:
|
||
$ref: '#/components/schemas/ApprovalStatus'
|
||
risk_level:
|
||
$ref: '#/components/schemas/RiskLevel'
|
||
blast_radius:
|
||
$ref: '#/components/schemas/BlastRadius'
|
||
dry_run_checks:
|
||
items:
|
||
$ref: '#/components/schemas/DryRunCheck'
|
||
type: array
|
||
title: Dry Run Checks
|
||
required_signatures:
|
||
type: integer
|
||
title: Required Signatures
|
||
current_signatures:
|
||
type: integer
|
||
title: Current Signatures
|
||
signatures:
|
||
items:
|
||
$ref: '#/components/schemas/Signature'
|
||
type: array
|
||
title: Signatures
|
||
requested_by:
|
||
type: string
|
||
title: Requested By
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
title: Created At
|
||
expires_at:
|
||
anyOf:
|
||
- type: string
|
||
format: date-time
|
||
- type: 'null'
|
||
title: Expires At
|
||
resolved_at:
|
||
anyOf:
|
||
- type: string
|
||
format: date-time
|
||
- type: 'null'
|
||
title: Resolved At
|
||
type: object
|
||
required:
|
||
- id
|
||
- action
|
||
- description
|
||
- status
|
||
- risk_level
|
||
- blast_radius
|
||
- dry_run_checks
|
||
- required_signatures
|
||
- current_signatures
|
||
- signatures
|
||
- requested_by
|
||
- created_at
|
||
- expires_at
|
||
- resolved_at
|
||
title: ApprovalRequestResponse
|
||
description: 授權請求 API 回應
|
||
ApprovalStatus:
|
||
type: string
|
||
enum:
|
||
- pending
|
||
- approved
|
||
- rejected
|
||
- expired
|
||
- execution_success
|
||
- execution_failed
|
||
title: ApprovalStatus
|
||
description: "授權請求狀態機\n\nPENDING → APPROVED → EXECUTION_SUCCESS\n \
|
||
\ → EXECUTION_FAILED\nPENDING → REJECTED\nPENDING → EXPIRED"
|
||
BlastRadius:
|
||
properties:
|
||
affected_pods:
|
||
type: integer
|
||
minimum: 0.0
|
||
title: Affected Pods
|
||
default: 0
|
||
estimated_downtime:
|
||
type: string
|
||
title: Estimated Downtime
|
||
default: '0'
|
||
related_services:
|
||
items:
|
||
type: string
|
||
type: array
|
||
title: Related Services
|
||
data_impact:
|
||
$ref: '#/components/schemas/DataImpact'
|
||
default: none
|
||
type: object
|
||
title: BlastRadius
|
||
description: 爆炸半徑 - 影響範圍評估
|
||
ChatRequest:
|
||
properties:
|
||
message:
|
||
type: string
|
||
title: Message
|
||
conversation_id:
|
||
anyOf:
|
||
- type: string
|
||
format: uuid
|
||
- type: 'null'
|
||
title: Conversation Id
|
||
context:
|
||
anyOf:
|
||
- additionalProperties: true
|
||
type: object
|
||
- type: 'null'
|
||
title: Context
|
||
type: object
|
||
required:
|
||
- message
|
||
title: ChatRequest
|
||
ChatResponse:
|
||
properties:
|
||
message:
|
||
type: string
|
||
title: Message
|
||
conversation_id:
|
||
type: string
|
||
format: uuid
|
||
title: Conversation Id
|
||
actions:
|
||
anyOf:
|
||
- items:
|
||
$ref: '#/components/schemas/src__routes__agent__SuggestedAction'
|
||
type: array
|
||
- type: 'null'
|
||
title: Actions
|
||
requires_approval:
|
||
type: boolean
|
||
title: Requires Approval
|
||
default: false
|
||
approval_id:
|
||
anyOf:
|
||
- type: string
|
||
format: uuid
|
||
- type: 'null'
|
||
title: Approval Id
|
||
type: object
|
||
required:
|
||
- message
|
||
- conversation_id
|
||
title: ChatResponse
|
||
OpenClawAnalysisRequest:
|
||
properties:
|
||
force_refresh:
|
||
type: boolean
|
||
title: Force Refresh
|
||
description: 強制重新抓取監控數據
|
||
default: false
|
||
type: object
|
||
title: OpenClawAnalysisRequest
|
||
description: 分析請求
|
||
OpenClawAnalysisResponse:
|
||
properties:
|
||
success:
|
||
type: boolean
|
||
title: Success
|
||
message:
|
||
type: string
|
||
title: Message
|
||
decision:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/OpenClawDecision'
|
||
- type: 'null'
|
||
approval_created:
|
||
type: boolean
|
||
title: Approval Created
|
||
description: 是否已建立待簽核卡片
|
||
default: false
|
||
approval_id:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Approval Id
|
||
description: 建立的 ApprovalRecord ID
|
||
ai_provider:
|
||
type: string
|
||
title: Ai Provider
|
||
description: 使用的 AI 提供者 (ollama/gemini/claude)
|
||
default: unknown
|
||
raw_llm_response:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Raw Llm Response
|
||
description: LLM 原始回應 (debug 用)
|
||
type: object
|
||
required:
|
||
- success
|
||
- message
|
||
title: OpenClawAnalysisResponse
|
||
description: 分析回應
|
||
OpenClawDecision:
|
||
properties:
|
||
suggested_action:
|
||
$ref: '#/components/schemas/src__models__ai__SuggestedAction'
|
||
description: 建議執行的操作類型
|
||
target_resource:
|
||
type: string
|
||
title: Target Resource
|
||
description: 目標資源名稱 (e.g., 'harbor', 'grafana')
|
||
namespace:
|
||
type: string
|
||
title: Namespace
|
||
description: Kubernetes namespace
|
||
default: default
|
||
risk_level:
|
||
$ref: '#/components/schemas/AIRiskLevel'
|
||
description: 風險等級評估
|
||
reasoning:
|
||
type: string
|
||
title: Reasoning
|
||
description: 給人類主管看的分析理由 (繁體中文)
|
||
deviation_analysis:
|
||
type: string
|
||
title: Deviation Analysis
|
||
description: 基準線偏差分析 (例如:CPU 85% 超出基準線 45% 達 +4σ)
|
||
default: ''
|
||
confidence:
|
||
type: number
|
||
maximum: 1.0
|
||
minimum: 0.0
|
||
title: Confidence
|
||
description: 決策信心度 (0-1)
|
||
default: 0.8
|
||
affected_services:
|
||
items:
|
||
type: string
|
||
type: array
|
||
title: Affected Services
|
||
description: 可能受影響的相關服務
|
||
type: object
|
||
required:
|
||
- suggested_action
|
||
- target_resource
|
||
- risk_level
|
||
- reasoning
|
||
title: OpenClawDecision
|
||
description: 'OpenClaw AI 決策輸出 (強制結構化)
|
||
|
||
|
||
LLM 必須輸出此格式的 JSON,否則視為解析失敗'
|
||
ComponentHealth:
|
||
properties:
|
||
status:
|
||
type: string
|
||
enum:
|
||
- up
|
||
- down
|
||
- degraded
|
||
title: Status
|
||
latency_ms:
|
||
anyOf:
|
||
- type: number
|
||
- type: 'null'
|
||
title: Latency Ms
|
||
error:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Error
|
||
type: object
|
||
required:
|
||
- status
|
||
title: ComponentHealth
|
||
description: Individual component health status
|
||
DashboardResponse:
|
||
properties:
|
||
timestamp:
|
||
type: string
|
||
format: date-time
|
||
title: Timestamp
|
||
environment:
|
||
type: string
|
||
title: Environment
|
||
mock_mode:
|
||
type: boolean
|
||
title: Mock Mode
|
||
overall_status:
|
||
type: string
|
||
title: Overall Status
|
||
hosts:
|
||
items:
|
||
$ref: '#/components/schemas/HostStatusResponse'
|
||
type: array
|
||
title: Hosts
|
||
alerts_count:
|
||
type: integer
|
||
title: Alerts Count
|
||
pending_approvals:
|
||
type: integer
|
||
title: Pending Approvals
|
||
type: object
|
||
required:
|
||
- timestamp
|
||
- environment
|
||
- mock_mode
|
||
- overall_status
|
||
- hosts
|
||
- alerts_count
|
||
- pending_approvals
|
||
title: DashboardResponse
|
||
description: Dashboard aggregated data
|
||
DataImpact:
|
||
type: string
|
||
enum:
|
||
- none
|
||
- read_only
|
||
- write
|
||
- destructive
|
||
title: DataImpact
|
||
description: 資料影響類型
|
||
DryRunCheck:
|
||
properties:
|
||
name:
|
||
type: string
|
||
title: Name
|
||
passed:
|
||
type: boolean
|
||
title: Passed
|
||
message:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Message
|
||
type: object
|
||
required:
|
||
- name
|
||
- passed
|
||
title: DryRunCheck
|
||
description: Dry-Run 預演檢查結果
|
||
HTTPValidationError:
|
||
properties:
|
||
detail:
|
||
items:
|
||
$ref: '#/components/schemas/ValidationError'
|
||
type: array
|
||
title: Detail
|
||
type: object
|
||
title: HTTPValidationError
|
||
HealthResponse:
|
||
properties:
|
||
status:
|
||
type: string
|
||
enum:
|
||
- healthy
|
||
- degraded
|
||
- unhealthy
|
||
title: Status
|
||
version:
|
||
type: string
|
||
title: Version
|
||
environment:
|
||
type: string
|
||
title: Environment
|
||
mock_mode:
|
||
type: boolean
|
||
title: Mock Mode
|
||
timestamp:
|
||
type: string
|
||
format: date-time
|
||
title: Timestamp
|
||
components:
|
||
additionalProperties:
|
||
$ref: '#/components/schemas/ComponentHealth'
|
||
type: object
|
||
title: Components
|
||
type: object
|
||
required:
|
||
- status
|
||
- version
|
||
- environment
|
||
- mock_mode
|
||
- timestamp
|
||
- components
|
||
title: HealthResponse
|
||
description: Full health check response
|
||
HostStatusResponse:
|
||
properties:
|
||
ip:
|
||
type: string
|
||
title: Ip
|
||
name:
|
||
type: string
|
||
title: Name
|
||
role:
|
||
type: string
|
||
title: Role
|
||
status:
|
||
type: string
|
||
title: Status
|
||
services:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
title: Services
|
||
metrics:
|
||
anyOf:
|
||
- additionalProperties:
|
||
type: number
|
||
type: object
|
||
- type: 'null'
|
||
title: Metrics
|
||
type: object
|
||
required:
|
||
- ip
|
||
- name
|
||
- role
|
||
- status
|
||
- services
|
||
title: HostStatusResponse
|
||
description: Host status for API response
|
||
NotificationChannel:
|
||
properties:
|
||
id:
|
||
type: string
|
||
title: Id
|
||
type:
|
||
type: string
|
||
enum:
|
||
- telegram
|
||
- slack
|
||
- line
|
||
- email
|
||
- discord
|
||
- webhook
|
||
title: Type
|
||
name:
|
||
type: string
|
||
title: Name
|
||
enabled:
|
||
type: boolean
|
||
title: Enabled
|
||
type: object
|
||
required:
|
||
- id
|
||
- type
|
||
- name
|
||
- enabled
|
||
title: NotificationChannel
|
||
NotificationRequest:
|
||
properties:
|
||
channel_id:
|
||
type: string
|
||
title: Channel Id
|
||
message:
|
||
type: string
|
||
title: Message
|
||
template_id:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Template Id
|
||
variables:
|
||
anyOf:
|
||
- additionalProperties: true
|
||
type: object
|
||
- type: 'null'
|
||
title: Variables
|
||
priority:
|
||
type: string
|
||
enum:
|
||
- low
|
||
- normal
|
||
- high
|
||
- urgent
|
||
title: Priority
|
||
default: normal
|
||
type: object
|
||
required:
|
||
- channel_id
|
||
- message
|
||
title: NotificationRequest
|
||
NotificationResult:
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
title: Id
|
||
status:
|
||
type: string
|
||
enum:
|
||
- queued
|
||
- sent
|
||
- failed
|
||
title: Status
|
||
sent_at:
|
||
anyOf:
|
||
- type: string
|
||
format: date-time
|
||
- type: 'null'
|
||
title: Sent At
|
||
error:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Error
|
||
type: object
|
||
required:
|
||
- id
|
||
- status
|
||
title: NotificationResult
|
||
PendingApprovalsResponse:
|
||
properties:
|
||
count:
|
||
type: integer
|
||
title: Count
|
||
approvals:
|
||
items:
|
||
$ref: '#/components/schemas/ApprovalRequestResponse'
|
||
type: array
|
||
title: Approvals
|
||
type: object
|
||
required:
|
||
- count
|
||
- approvals
|
||
title: PendingApprovalsResponse
|
||
description: 待簽核清單回應
|
||
Pipeline:
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
title: Id
|
||
name:
|
||
type: string
|
||
title: Name
|
||
description:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Description
|
||
status:
|
||
type: string
|
||
enum:
|
||
- draft
|
||
- active
|
||
- paused
|
||
- archived
|
||
title: Status
|
||
steps:
|
||
items:
|
||
$ref: '#/components/schemas/PipelineStep'
|
||
type: array
|
||
title: Steps
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
title: Created At
|
||
updated_at:
|
||
type: string
|
||
format: date-time
|
||
title: Updated At
|
||
type: object
|
||
required:
|
||
- id
|
||
- name
|
||
- status
|
||
- steps
|
||
- created_at
|
||
- updated_at
|
||
title: Pipeline
|
||
PipelineCreate:
|
||
properties:
|
||
name:
|
||
type: string
|
||
title: Name
|
||
description:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Description
|
||
steps:
|
||
items:
|
||
$ref: '#/components/schemas/PipelineStep'
|
||
type: array
|
||
title: Steps
|
||
type: object
|
||
required:
|
||
- name
|
||
- steps
|
||
title: PipelineCreate
|
||
PipelineExecution:
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
title: Id
|
||
pipeline_id:
|
||
type: string
|
||
format: uuid
|
||
title: Pipeline Id
|
||
status:
|
||
type: string
|
||
enum:
|
||
- pending
|
||
- running
|
||
- completed
|
||
- failed
|
||
- cancelled
|
||
title: Status
|
||
started_at:
|
||
type: string
|
||
format: date-time
|
||
title: Started At
|
||
completed_at:
|
||
anyOf:
|
||
- type: string
|
||
format: date-time
|
||
- type: 'null'
|
||
title: Completed At
|
||
type: object
|
||
required:
|
||
- id
|
||
- pipeline_id
|
||
- status
|
||
- started_at
|
||
title: PipelineExecution
|
||
PipelineList:
|
||
properties:
|
||
items:
|
||
items:
|
||
$ref: '#/components/schemas/Pipeline'
|
||
type: array
|
||
title: Items
|
||
next_page_token:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Next Page Token
|
||
type: object
|
||
required:
|
||
- items
|
||
title: PipelineList
|
||
PipelineStep:
|
||
properties:
|
||
id:
|
||
type: string
|
||
title: Id
|
||
plugin_id:
|
||
type: string
|
||
title: Plugin Id
|
||
type:
|
||
type: string
|
||
enum:
|
||
- INPUT
|
||
- BRAIN
|
||
- OUTPUT
|
||
- ACTION
|
||
- DATA
|
||
- UI
|
||
title: Type
|
||
config:
|
||
anyOf:
|
||
- additionalProperties: true
|
||
type: object
|
||
- type: 'null'
|
||
title: Config
|
||
type: object
|
||
required:
|
||
- id
|
||
- plugin_id
|
||
- type
|
||
title: PipelineStep
|
||
Plugin:
|
||
properties:
|
||
id:
|
||
type: string
|
||
title: Id
|
||
name:
|
||
type: string
|
||
title: Name
|
||
version:
|
||
type: string
|
||
title: Version
|
||
category:
|
||
type: string
|
||
enum:
|
||
- INPUT
|
||
- BRAIN
|
||
- OUTPUT
|
||
- ACTION
|
||
- DATA
|
||
- UI
|
||
title: Category
|
||
enabled:
|
||
type: boolean
|
||
title: Enabled
|
||
description:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Description
|
||
type: object
|
||
required:
|
||
- id
|
||
- name
|
||
- version
|
||
- category
|
||
- enabled
|
||
title: Plugin
|
||
PluginHealth:
|
||
properties:
|
||
plugin_id:
|
||
type: string
|
||
title: Plugin Id
|
||
status:
|
||
type: string
|
||
enum:
|
||
- healthy
|
||
- unhealthy
|
||
- unknown
|
||
title: Status
|
||
last_check:
|
||
type: string
|
||
format: date-time
|
||
title: Last Check
|
||
error:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Error
|
||
type: object
|
||
required:
|
||
- plugin_id
|
||
- status
|
||
- last_check
|
||
title: PluginHealth
|
||
RejectRequest:
|
||
properties:
|
||
rejector_id:
|
||
type: string
|
||
title: Rejector Id
|
||
description: 退回者 ID
|
||
rejector_name:
|
||
type: string
|
||
title: Rejector Name
|
||
description: 退回者名稱
|
||
reason:
|
||
type: string
|
||
title: Reason
|
||
description: 退回原因
|
||
type: object
|
||
required:
|
||
- rejector_id
|
||
- rejector_name
|
||
- reason
|
||
title: RejectRequest
|
||
description: 退回請求
|
||
RiskLevel:
|
||
type: string
|
||
enum:
|
||
- low
|
||
- medium
|
||
- critical
|
||
title: RiskLevel
|
||
description: '風險等級 - 決定所需簽核人數
|
||
|
||
|
||
- LOW: 0 人,自動放行
|
||
|
||
- MEDIUM: 需 1 人簽核
|
||
|
||
- CRITICAL: 需 2 人 Multi-Sig 雙重簽核'
|
||
SignRequest:
|
||
properties:
|
||
signer_id:
|
||
type: string
|
||
title: Signer Id
|
||
description: 簽核者 ID
|
||
signer_name:
|
||
type: string
|
||
title: Signer Name
|
||
description: 簽核者名稱
|
||
comment:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Comment
|
||
description: 簽核備註
|
||
type: object
|
||
required:
|
||
- signer_id
|
||
- signer_name
|
||
title: SignRequest
|
||
description: 簽核請求
|
||
SignResponse:
|
||
properties:
|
||
success:
|
||
type: boolean
|
||
title: Success
|
||
message:
|
||
type: string
|
||
title: Message
|
||
approval:
|
||
$ref: '#/components/schemas/ApprovalRequestResponse'
|
||
execution_triggered:
|
||
type: boolean
|
||
title: Execution Triggered
|
||
description: 是否觸發執行 (當簽核數滿足時)
|
||
default: false
|
||
type: object
|
||
required:
|
||
- success
|
||
- message
|
||
- approval
|
||
title: SignResponse
|
||
description: 簽核回應
|
||
Signature:
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
title: Id
|
||
signer_id:
|
||
type: string
|
||
title: Signer Id
|
||
description: 簽核者 ID
|
||
signer_name:
|
||
type: string
|
||
title: Signer Name
|
||
description: 簽核者名稱
|
||
signed_at:
|
||
type: string
|
||
format: date-time
|
||
title: Signed At
|
||
comment:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Comment
|
||
type: object
|
||
required:
|
||
- signer_id
|
||
- signer_name
|
||
title: Signature
|
||
description: 簽核記錄
|
||
ValidationError:
|
||
properties:
|
||
loc:
|
||
items:
|
||
anyOf:
|
||
- type: string
|
||
- type: integer
|
||
type: array
|
||
title: Location
|
||
msg:
|
||
type: string
|
||
title: Message
|
||
type:
|
||
type: string
|
||
title: Error Type
|
||
input:
|
||
title: Input
|
||
ctx:
|
||
type: object
|
||
title: Context
|
||
type: object
|
||
required:
|
||
- loc
|
||
- msg
|
||
- type
|
||
title: ValidationError
|
||
src__models__ai__SuggestedAction:
|
||
type: string
|
||
enum:
|
||
- RESTART_DEPLOYMENT
|
||
- DELETE_POD
|
||
- SCALE_DEPLOYMENT
|
||
- NO_ACTION
|
||
title: SuggestedAction
|
||
description: 'AI 建議操作類型
|
||
|
||
|
||
必須與 executor.OperationType 對應'
|
||
src__routes__agent__SuggestedAction:
|
||
properties:
|
||
id:
|
||
type: string
|
||
title: Id
|
||
label:
|
||
type: string
|
||
title: Label
|
||
description:
|
||
anyOf:
|
||
- type: string
|
||
- type: 'null'
|
||
title: Description
|
||
risk_level:
|
||
type: string
|
||
enum:
|
||
- low
|
||
- medium
|
||
- high
|
||
- critical
|
||
title: Risk Level
|
||
type: object
|
||
required:
|
||
- id
|
||
- label
|
||
- risk_level
|
||
title: SuggestedAction
|
||
|