Files
jumpserver/docs/chat_ai_sse_schema.json
2026-07-26 15:45:55 +08:00

183 lines
5.9 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://jumpserver.org/schemas/chat-ai-sse.json",
"title": "JumpServer Chat AI SSE data schemas",
"$defs": {
"message_start": {
"type": "object",
"required": ["message_id", "agent_run_id", "assistant"],
"properties": {
"message_id": {"type": "string", "format": "uuid"},
"agent_run_id": {"type": "string", "format": "uuid"},
"assistant": {"enum": ["general", "asset", "session_audit", "ops"]}
},
"additionalProperties": false
},
"message_delta": {
"type": "object",
"required": ["content"],
"properties": {"content": {"type": "string"}},
"additionalProperties": false
},
"knowledge_search_start": {
"type": "object",
"required": ["query"],
"properties": {"query": {"type": "string"}},
"additionalProperties": false
},
"knowledge_search_result": {
"type": "object",
"required": ["query", "results"],
"properties": {
"query": {"type": "string"},
"results": {"type": "array", "items": {"type": "object"}}
},
"additionalProperties": false
},
"agent_plan": {
"type": "object",
"required": ["steps", "max_steps", "max_api_calls"],
"properties": {
"steps": {"type": "array", "items": {"type": "string"}},
"max_steps": {"type": "integer", "minimum": 1},
"max_api_calls": {"type": "integer", "minimum": 1},
"max_web_search_calls": {"type": "integer", "minimum": 1}
},
"additionalProperties": false
},
"web_search_start": {
"type": "object",
"required": ["query"],
"properties": {"query": {"type": "string"}},
"additionalProperties": false
},
"web_search_result": {
"type": "object",
"required": ["query", "ok", "sources"],
"properties": {
"query": {"type": "string"},
"ok": {"type": "boolean"},
"provider": {"type": "string"},
"error": {"type": "string"},
"sources": {
"type": "array",
"items": {
"type": "object",
"required": ["title", "url"],
"properties": {
"title": {"type": "string"},
"url": {"type": "string", "format": "uri"}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
},
"api_search_start": {
"type": "object",
"required": ["query"],
"properties": {"query": {"type": "string"}},
"additionalProperties": false
},
"api_search_result": {
"type": "object",
"required": ["query", "operations"],
"properties": {
"query": {"type": "string"},
"operations": {
"type": "array",
"items": {
"type": "object",
"required": ["operation_id", "method", "path", "risk_level", "requires_approval"],
"properties": {
"operation_id": {"type": "string"},
"method": {"enum": ["GET", "POST", "PUT", "PATCH"]},
"path": {"type": "string"},
"summary": {"type": "string"},
"description": {"type": "string"},
"tags": {"type": "array", "items": {"type": "string"}},
"risk_level": {"type": "string"},
"requires_approval": {"type": "boolean"}
}
}
}
},
"additionalProperties": false
},
"api_call_start": {
"type": "object",
"required": ["operation_id", "method", "path", "summary"],
"properties": {
"operation_id": {"type": "string"},
"method": {"enum": ["GET", "POST", "PUT", "PATCH"]},
"path": {"type": "string"},
"summary": {"type": "string"}
},
"additionalProperties": false
},
"api_call_result": {
"type": "object",
"required": ["operation_id", "status_code", "ok", "result", "presentation"],
"properties": {
"operation_id": {"type": "string"},
"status_code": {"type": "integer"},
"ok": {"type": "boolean"},
"result": {},
"presentation": {
"type": "object",
"required": ["type", "title", "source", "content"],
"properties": {
"type": {"enum": ["table", "timeline", "detail", "metric", "sources"]},
"title": {"type": "string"},
"source": {"type": "object"},
"content": {}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"approval_required": {
"type": "object",
"required": ["approval_id", "operation_id", "method", "path", "risk_level", "expires_at", "preview"],
"properties": {
"approval_id": {"type": "string", "format": "uuid"},
"operation_id": {"type": "string"},
"method": {"enum": ["POST", "PUT", "PATCH"]},
"path": {"type": "string"},
"risk_level": {"type": "string"},
"expires_at": {"type": "string", "format": "date-time"},
"preview": {"type": "object"}
},
"additionalProperties": false
},
"message_done": {
"type": "object",
"required": ["message_id", "status"],
"properties": {
"message_id": {"type": "string", "format": "uuid"},
"status": {"enum": ["completed", "awaiting_approval", "cancelled"]},
"usage": {
"type": "object",
"properties": {
"input_tokens": {"type": "integer", "minimum": 0},
"output_tokens": {"type": "integer", "minimum": 0}
}
}
},
"additionalProperties": false
},
"message_error": {
"type": "object",
"required": ["message_id", "code", "detail"],
"properties": {
"message_id": {"type": "string", "format": "uuid"},
"code": {"type": "string"},
"detail": {"type": "string"}
},
"additionalProperties": false
}
}
}