Files
OpenViking/openviking/server/models.py
T
fujiajie666 c91b0d36f2 feat: implement Skill-driven knowledge compilation for ov compile (#3567)
* feat(compile): implement skill-driven ov compile

Require a Skill and run compile tasks through VikingBot AgentLoop with structured wiki bundle rendering and durable task state.

Add OpenViking batch-write and bot proxy APIs, Python SDK and Rust CLI support, shared link and memory helpers, tests, and a One-Page demo.

* fix(compile): refine defaults, links, and failure handling

* fix(compile): normalize skill tools and degrade gracefully

* feat(compile): support skill-defined artifact outputs

* feat(compile): improve artifact reliability and wiki navigation

* feat(compile): support generating and updating skill packages

* fix(compile): validate OKF frontmatter and catalog page types

* feat(compile): rank target catalog and validate updates lazily

* feat(compile): tag generated wiki files for search

* fix(compile): preserve generated skill artifacts in submissions

* fix(compile): enforce fixed toolset and workspace artifact submissions

* fix(skills): preserve nested metadata in skill frontmatter

* fix(compile): normalize wiki paths and citation line breaks

* docs(examples): remove outdated compile demos

* docs(api): document compile and batch-write endpoints

* fix(content): allow arbitrary resource files in batch writes

* fix(compile): harden task lifecycle, auth, and execution

* fix(compile): disable direct exec by default

* fix(compile): allow file-only tasks when exec is disabled

* fix(compile): prevent task lock leaks
2026-07-28 20:33:25 +08:00

63 lines
1.5 KiB
Python

# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Response models and error codes for OpenViking HTTP Server."""
from typing import Any, Dict, Optional
from pydantic import BaseModel
class ErrorInfo(BaseModel):
"""Error information."""
code: str
message: str
details: Optional[dict] = None
class Response(BaseModel):
"""Standard API response."""
status: str # "ok" | "error"
result: Optional[Any] = None
error: Optional[ErrorInfo] = None
telemetry: Optional[Dict[str, Any]] = None
profile: Optional[list[str]] = None
# Error code to HTTP status code mapping
ERROR_CODE_TO_HTTP_STATUS = {
"OK": 200,
"INVALID_ARGUMENT": 400,
"INVALID_URI": 400,
"NOT_FOUND": 404,
"ALREADY_EXISTS": 409,
"CONFLICT": 409,
"PERMISSION_DENIED": 403,
"UNAUTHENTICATED": 401,
"RESOURCE_EXHAUSTED": 429,
"FAILED_PRECONDITION": 412,
"ABORTED": 409,
"DEADLINE_EXCEEDED": 504,
"UNAVAILABLE": 503,
"INTERNAL": 500,
"UNIMPLEMENTED": 501,
"NOT_INITIALIZED": 500,
"PROCESSING_ERROR": 500,
"EMBEDDING_FAILED": 500,
"VLM_FAILED": 500,
"SESSION_EXPIRED": 410,
"UNSUPPORTED_URI": 400,
"UNSUPPORTED_MODE": 400,
"RESTORE_WRITEBACK_PARTIAL": 500,
"SKILL_INVALID": 400,
"SKILL_CAPABILITY_UNAVAILABLE": 400,
"AGENT_OUTPUT_INVALID": 500,
"MODEL_UNAVAILABLE": 503,
"WRITE_CONFLICT": 409,
"WRITE_FAILED": 500,
"REFRESH_FAILED": 500,
"BOT_RESTARTED": 503,
"UNKNOWN": 500,
}