repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
OpenViking | bot/vikingbot/channels/manager.py | .py | """Channel manager for coordinating chat channels."""
from __future__ import annotations
import asyncio
from typing import Any
from loguru import logger
from vikingbot.bus.queue import MessageBus
from vikingbot.channels.base import BaseChannel
from vikingbot.config.schema import BaseChannelConfig, ChannelType, Conf... | 254 | 9,207 |
OpenViking | bot/vikingbot/channels/__init__.py | .py | """Chat channels module with plugin architecture."""
from vikingbot.channels.base import BaseChannel
from vikingbot.channels.manager import ChannelManager
__all__ = ["BaseChannel", "ChannelManager"]
| 7 | 201 |
OpenViking | bot/vikingbot/channels/chat.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Chat channel for interactive mode."""
import asyncio
import os
import signal
from pathlib import Path
from typing import Any
from rich.style import Style
from vikingbot.bus.events import InboundMessage, OutboundEv... | 189 | 6,093 |
OpenViking | bot/vikingbot/channels/feishu_test.py | .py | import json
import lark_oapi as lark
from lark_oapi.api.contact.v3 import GetUserRequest
def main():
# 创建client
client = lark.Client.builder().app_id("").app_secret("").log_level(lark.LogLevel.DEBUG).build()
# 构造请求对象
request: GetUserRequest = GetUserRequest.builder().user_id("").user_id_type("open_i... | 30 | 871 |
OpenViking | bot/vikingbot/channels/feishu.py | .py | """Feishu/Lark channel implementation using lark-oapi SDK with WebSocket long connection."""
import asyncio
import io
import json
import re
import threading
import time
from collections import OrderedDict
from typing import Any
import httpx
from loguru import logger
from vikingbot.config import load_config
from viki... | 1,111 | 43,463 |
OpenViking | bot/vikingbot/channels/telegram.py | .py | """Telegram channel implementation using python-telegram-bot."""
from __future__ import annotations
import asyncio
import re
from loguru import logger
from telegram import BotCommand, Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes
from telegram.request import HTTPXR... | 423 | 15,992 |
OpenViking | bot/vikingbot/channels/qq.py | .py | """QQ channel implementation using botpy SDK."""
import asyncio
from collections import deque
from loguru import logger
from vikingbot.bus.events import OutboundMessage
from vikingbot.bus.queue import MessageBus
from vikingbot.channels.base import BaseChannel
from vikingbot.config.schema import QQChannelConfig
try:... | 145 | 4,641 |
OpenViking | bot/vikingbot/channels/discord.py | .py | """Discord channel implementation using Discord Gateway websocket."""
import asyncio
import json
from pathlib import Path
from typing import Any
import httpx
import websockets
from loguru import logger
from vikingbot.bus.events import OutboundMessage
from vikingbot.bus.queue import MessageBus
from vikingbot.channels... | 275 | 10,122 |
OpenViking | bot/vikingbot/channels/dingtalk.py | .py | """DingTalk/DingDing channel implementation using Stream Mode."""
import asyncio
import json
import time
from typing import Any
import httpx
from loguru import logger
from vikingbot.bus.events import OutboundMessage
from vikingbot.bus.queue import MessageBus
from vikingbot.channels.base import BaseChannel
from vikin... | 251 | 9,324 |
OpenViking | bot/vikingbot/channels/openapi.py | .py | """OpenAPI channel for HTTP-based chat API."""
import asyncio
import hashlib
import ipaddress
import secrets
import uuid
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional
from urllib.parse import urlsplit
import httpx
from fastapi imp... | 1,813 | 74,133 |
OpenViking | bot/vikingbot/channels/base.py | .py | """Base channel interface for chat platforms."""
import base64
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Tuple
import httpx
from loguru import logger
from vikingbot.bus.events import InboundMessage, OutboundMessage
from vikingbot.bus.queue import MessageBus
from vikingbot.c... | 339 | 11,647 |
OpenViking | third_party/spdlog-1.14.1/scripts/extract_version.py | .py | #!/usr/bin/env python3
import os
import re
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
config_h = os.path.join(base_path, 'include', 'spdlog', 'version.h')
data = {'MAJOR': 0, 'MINOR': 0, 'PATCH': 0}
reg = re.compile(r'^\s*#define\s+SPDLOG_VER_([A-Z]+)\s+([0-9]+).*$')
with open(config_... | 18 | 497 |
OpenViking | docker/pending_health_server.py | .py | """Pending health server for the OpenViking Docker entrypoint.
While the container is waiting for ``ov.conf`` to appear, the entrypoint
runs this tiny HTTP server on the same port the real OpenViking server
will bind. It answers *every* request — `/`, `/health`, anything — with
the same 503 JSON payload describing wha... | 102 | 3,450 |
OpenViking | sdk/python/openviking_sdk/_utils.py | .py | from __future__ import annotations
import asyncio
import atexit
import os
import threading
from typing import Any, Coroutine
_worker_lock = threading.Lock()
_worker_loop: asyncio.AbstractEventLoop | None = None
_worker_thread: threading.Thread | None = None
async def _capture_result(coro: Coroutine[Any, Any, Any]) ... | 68 | 2,127 |
OpenViking | sdk/python/openviking_sdk/errors.py | .py | from __future__ import annotations
from typing import Optional
class OpenVikingError(Exception):
def __init__(self, message: str, code: str = "UNKNOWN", details: Optional[dict] = None):
super().__init__(message)
self.message = message
self.code = code
self.details = details or {}
... | 149 | 5,335 |
OpenViking | sdk/python/openviking_sdk/actor_peer.py | .py | from __future__ import annotations
from contextlib import contextmanager
from contextvars import ContextVar
from typing import Iterator
_actor_peer_id: ContextVar[str | None] = ContextVar(
"openviking_actor_peer_id",
default=None,
)
def _normalize_actor_peer_id(actor_peer_id: str | None) -> str | None:
... | 46 | 1,279 |
OpenViking | sdk/python/openviking_sdk/__init__.py | .py | from .actor_peer import get_actor_peer_id, use_actor_peer
from .client import AsyncHTTPClient, SyncHTTPClient
from .errors import (
AbortedError,
ConflictError,
OpenVikingError,
ResourceExhaustedError,
UnimplementedError,
)
__all__ = [
"AbortedError",
"AsyncHTTPClient",
"ConflictError",... | 22 | 471 |
OpenViking | sdk/python/openviking_sdk/uploads.py | .py | from __future__ import annotations
import tempfile
import uuid
import zipfile
from pathlib import Path
def zip_directory(dir_path: str) -> str:
path = Path(dir_path)
if not path.is_dir():
raise ValueError(f"Path {path} is not a directory")
root = path.resolve()
zip_path = Path(tempfile.gette... | 28 | 836 |
OpenViking | sdk/python/openviking_sdk/client.py | .py | from __future__ import annotations
import base64
import inspect
import mimetypes
import os
import tempfile
import uuid
import zipfile
from enum import Enum
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Union
from urllib.parse import quote
import httpx
from ._utils import run_async
... | 2,878 | 101,462 |
OpenViking | sdk/python/openviking_sdk/config.py | .py | from __future__ import annotations
import base64
import json
import os
from dataclasses import dataclass
from difflib import get_close_matches
from pathlib import Path
from typing import Optional
OPENVIKING_CLI_CONFIG_ENV = "OPENVIKING_CLI_CONFIG_FILE"
DEFAULT_OVCLI_CONF = Path.home() / ".openviking" / "ovcli.conf"
... | 352 | 12,671 |
OpenViking | sdk/python/tests/test_ldap_auth.py | .py | import pytest
import base64
import json
import os
from pathlib import Path
from openviking_sdk import AsyncHTTPClient
from openviking_sdk.config import (
resolve_client_config,
get_basic_auth_header,
load_ovcli_config,
)
class TestBasicAuthHeader:
"""测试 Basic Auth header 生成"""
def test_get_basic... | 423 | 17,740 |
OpenViking | sdk/python/tests/test_packaging_imports.py | .py | from openviking_sdk import AsyncHTTPClient, OpenVikingError, SyncHTTPClient
def test_sdk_top_level_imports():
assert AsyncHTTPClient is not None
assert SyncHTTPClient is not None
assert OpenVikingError is not None
| 8 | 228 |
OpenViking | sdk/python/tests/test_legacy_shims.py | .py | import sys
from pathlib import Path
import pytest
SDK_ROOT = Path(__file__).resolve().parents[1]
REPO_ROOT = Path(__file__).resolve().parents[3]
if str(SDK_ROOT) not in sys.path:
sys.path.insert(0, str(SDK_ROOT))
if str(REPO_ROOT) not in sys.path:
sys.path.insert(0, str(REPO_ROOT))
def _purge_legacy_module... | 71 | 2,266 |
OpenViking | sdk/python/tests/test_main_package_exports.py | .py | import sys
from pathlib import Path
SDK_ROOT = Path(__file__).resolve().parents[1]
REPO_ROOT = Path(__file__).resolve().parents[3]
if str(SDK_ROOT) not in sys.path:
sys.path.insert(0, str(SDK_ROOT))
if str(REPO_ROOT) not in sys.path:
sys.path.insert(0, str(REPO_ROOT))
def _purge_openviking_modules() -> None... | 85 | 2,966 |
OpenViking | sdk/python/tests/test_actor_peer.py | .py | import asyncio
from concurrent.futures import ThreadPoolExecutor
import httpx
import pytest
from openviking_sdk import (
AsyncHTTPClient,
SyncHTTPClient,
get_actor_peer_id,
use_actor_peer,
)
class _HeaderRecordingTransport:
def __init__(self):
self.requests: list[dict[str, str]] = []
... | 145 | 4,874 |
OpenViking | sdk/python/tests/test_client_config.py | .py | import pytest
from openviking_sdk import AsyncHTTPClient
def test_explicit_arguments_win_over_env(monkeypatch):
monkeypatch.setenv("OPENVIKING_URL", "http://env-host:1933")
monkeypatch.setenv("OPENVIKING_API_KEY", "env-key")
monkeypatch.setenv("OPENVIKING_ACCOUNT", "env-account")
monkeypatch.setenv("O... | 53 | 1,894 |
OpenViking | sdk/python/tests/test_ovcli_config_compat.py | .py | from __future__ import annotations
import json
import httpx
import pytest
from openviking_sdk import AsyncHTTPClient
def test_async_http_client_loads_connection_fields_from_ovcli_config(tmp_path, monkeypatch):
config_path = tmp_path / "ovcli.conf"
config_path.write_text(
json.dumps(
{
... | 216 | 7,066 |
OpenViking | sdk/python/tests/test_error_mapping.py | .py | import pytest
from openviking_sdk import AsyncHTTPClient
from openviking_sdk.errors import (
AbortedError,
ConflictError,
OpenVikingError,
ResourceExhaustedError,
UnimplementedError,
)
@pytest.mark.parametrize(
("code", "exc_type"),
(
("CONFLICT", ConflictError),
("ABORTED"... | 44 | 1,194 |
OpenViking | sdk/python/tests/test_async_client_behaviors.py | .py | import inspect
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import AsyncMock, Mock, patch
import pytest
from openviking_sdk import AsyncHTTPClient, SyncHTTPClient
from openviking_sdk.client import Session, SyncSession
from openviking_sdk.errors import NotFoundError
def test_add_resou... | 1,165 | 39,495 |
OpenViking | sdk/python/tests/test_uploads.py | .py | import tempfile
import zipfile
from pathlib import Path
import pytest
from openviking_sdk import AsyncHTTPClient
class _FakeHTTPClient:
def __init__(self):
self.calls = []
async def post(self, path, json=None, files=None, data=None):
self.calls.append({"path": path, "json": json, "files": fi... | 60 | 1,947 |
OpenViking | sdk/python/tests/test_utils.py | .py | import asyncio
import pytest
from openviking_sdk._utils import run_async
def test_run_async_reuses_worker_loop_across_sync_and_async_contexts():
async def identify_execution():
return asyncio.get_running_loop()
first_loop = run_async(identify_execution())
async def call_from_running_loop():
... | 28 | 726 |
OpenViking | sdk/python/tests/conftest.py | .py | from __future__ import annotations
import sys
from pathlib import Path
import pytest
SDK_ROOT = Path(__file__).resolve().parents[1]
if str(SDK_ROOT) not in sys.path:
sys.path.insert(0, str(SDK_ROOT))
@pytest.fixture(autouse=True)
def _isolate_sdk_tests_from_default_ovcli_config(monkeypatch):
monkeypatch.s... | 17 | 395 |
OpenViking | openviking/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
OpenViking - An Agent-native context database
Data in, Context out.
"""
try:
from ._version import version as __version__
except ImportError:
try:
from importlib.metadata import version
__... | 36 | 798 |
OpenViking | openviking/_sdk_import.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import sys
from importlib import import_module
from pathlib import Path
def import_openviking_sdk():
try:
return import_module("openviking_sdk")
except ImportError a... | 25 | 846 |
OpenViking | openviking/client/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""HTTP client compatibility exports for the main OpenViking package."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from openviking_cli.client.http import AsyncHTTPClien... | 29 | 766 |
OpenViking | openviking/crypto/exceptions.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Encryption module exception definitions.
"""
class EncryptionError(Exception):
"""Base class for encryption-related errors."""
pass
class InvalidMagicError(EncryptionError):
"""Invalid magic number ... | 54 | 877 |
OpenViking | openviking/crypto/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
OpenViking Encryption Module
Provides multi-tenant encryption functionality, including:
- Envelope Encryption
- Multiple key providers (Local File, Vault, Volcengine KMS)
- API Key hashing storage (Argon2id)
"""
f... | 47 | 1,173 |
OpenViking | openviking/crypto/config.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Encryption module configuration management.
Provides configuration validation and encryption module initialization.
"""
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
from ... | 212 | 7,130 |
OpenViking | openviking/crypto/encryptor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
File encryptor - envelope encryption implementation.
Implements Envelope Encryption pattern:
- Each file has independent random File Key
- File Key is encrypted with Account Key
- Account Key is derived from Root K... | 333 | 11,273 |
OpenViking | openviking/crypto/providers.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Key provider abstractions and implementations.
Provides multiple key management methods:
- LocalFileProvider: Local file storage for Root Key
- VaultProvider: HashiCorp Vault
- VolcengineKMSProvider: Volcengine KMS... | 861 | 31,062 |
OpenViking | openviking/connector/delegate.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Connector delegation for resource imports.
ResourceService hands an add_resource request to :class:`ConnectorDelegate`
when the source belongs to the external Connector integration; the native
service keeps only tha... | 619 | 26,550 |
OpenViking | openviking/connector/client.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Client for the external Connector service (knowledge-base doc/add pipeline)."""
from __future__ import annotations
from typing import Any, Dict, Optional
import httpx
from openviking_cli.exceptions import Interna... | 124 | 4,814 |
OpenViking | openviking/connector/routing.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Connector source-type detection shared by routing and input guards.
Detection mirrors the standard pipeline's own routing (accessor
``can_handle`` predicates) instead of raw URL schemes, so a Connector
add_type matc... | 84 | 3,678 |
OpenViking | openviking/retrieve/hierarchical_retriever.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Hierarchical retriever for OpenViking.
Implements directory-based hierarchical retrieval with recursive search
and rerank-based relevance scoring.
"""
import asyncio
import heapq
import logging
import math
import ... | 639 | 26,569 |
OpenViking | openviking/retrieve/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Retrieval module for OpenViking.
Provides intent-driven hierarchical context retrieval.
"""
from openviking.retrieve.hierarchical_retriever import HierarchicalRetriever
from openviking.retrieve.intent_analyzer imp... | 34 | 735 |
OpenViking | openviking/retrieve/retrieval_stats.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Thread-safe retrieval statistics accumulator.
Collects per-query metrics from the ``HierarchicalRetriever`` so that
the ``RetrievalObserver`` can report aggregate health and quality data
via the observer API.
"""
i... | 179 | 5,699 |
OpenViking | openviking/retrieve/memory_lifecycle.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Hotness scoring for cold/hot memory lifecycle management (#296).
Provides a pure function to compute a 0.0–1.0 hotness score based on
access frequency (active_count) and recency (updated_at). The score
can be blend... | 65 | 2,107 |
OpenViking | openviking/retrieve/intent_analyzer.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Intent analyzer for OpenViking retrieval.
Analyzes session context to generate query plans.
"""
from typing import Any, List, Optional
from openviking.message import Message
from openviking.prompts import render_... | 181 | 6,603 |
OpenViking | openviking/retrieve/context_assembler/pipeline.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Single-request context assembly: retrieve, budget, render, optionally digest.
One HTTP round trip replaces the per-type search-then-read loops each harness
plugin used to run, so every plugin inherits budgeting, tie... | 166 | 5,981 |
OpenViking | openviking/retrieve/context_assembler/rewrite.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Optional LLM digest over assembled context.
Opt-in and fail-closed: when the model is slow, absent, or off-contract the
caller still gets the unrewritten ``rendered`` block.
"""
from __future__ import annotations
... | 142 | 5,011 |
OpenViking | openviking/retrieve/context_assembler/render.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Flat XML rendering of assembled context.
Metadata lives in node attributes and the body is the tag content, so the
envelope costs a fraction of what recall v1's nested groups did.
"""
from __future__ import annotat... | 52 | 1,817 |
OpenViking | openviking/retrieve/context_assembler/expansion.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Bounded, session-aware query expansion.
Short prompts retrieve badly because the raw user sentence carries little
signal. Expansion borrows the session's recent turns to widen the query, under
a hard cap and a timeo... | 70 | 2,362 |
OpenViking | openviking/retrieve/context_assembler/models.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Output models for context assembly."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Dict, List
from openviking.retrieve.context_assembler.params import Tier
... | 52 | 1,340 |
OpenViking | openviking/retrieve/context_assembler/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Server-side context assembly kernel shared by /search and /recall."""
from openviking.retrieve.context_assembler.models import AssembledEntry, AssembleResult
from openviking.retrieve.context_assembler.params import ... | 53 | 1,546 |
OpenViking | openviking/retrieve/context_assembler/tiers.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Detail-tier text resolution.
Every tier always carries the URI; the tiers differ only in how much body text
they spend. ``abstract`` comes from the vector payload and costs no read, while
``overview`` and ``full`` n... | 227 | 7,852 |
OpenViking | openviking/retrieve/context_assembler/params.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Parameter contract and normalization for server-side context assembly."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Dict, Literal, Mapping, Optional, Sequen... | 228 | 8,325 |
OpenViking | openviking/retrieve/context_assembler/gather.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Candidate gathering for context assembly.
Generalizes the memory-only type-quota fan-out to every context category and
keeps the peer-origin ranking rules that recall v1 established.
"""
from __future__ import anno... | 424 | 15,305 |
OpenViking | openviking/retrieve/context_assembler/recall_preset.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""``/recall`` as a thin preset over context assembly.
The endpoint keeps working for shipped plugins: it only overlays defaults and
folds the v1 field names onto the context contract. No assembly logic lives
here.
"""... | 125 | 4,434 |
OpenViking | openviking/retrieve/context_assembler/ledger.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Cross-turn dedup ledger.
Recording served URIs on the server means every harness plugin inherits
cross-turn dedup for free, and the server knows which tier each URI was served
at. The ledger is bookkeeping: it is wr... | 174 | 6,139 |
OpenViking | openviking/retrieve/context_assembler/budget.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Token budgeting and breadth-first-then-depth tier filling.
Scores cluster in a narrow band, so spending the whole budget on the top hit is
a bad bet. Every candidate is placed at its category's default tier first an... | 195 | 6,895 |
OpenViking | openviking/server/app.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""FastAPI application for OpenViking HTTP Server."""
import asyncio
import logging
import os
import time
from contextlib import asynccontextmanager
from pathlib import Path
from typing import Callable, Optional
from ... | 805 | 32,467 |
OpenViking | openviking/server/telemetry.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""HTTP router helpers for operation telemetry."""
from __future__ import annotations
from typing import Any, Awaitable, Callable
from openviking.telemetry import TelemetryRequest, TelemetrySelection
from openviking.... | 34 | 979 |
OpenViking | openviking/server/responses.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Helpers for building consistent HTTP API response envelopes."""
from typing import Any, Dict, Optional
from fastapi.responses import JSONResponse
from openviking.server.models import ERROR_CODE_TO_HTTP_STATUS, Err... | 87 | 2,739 |
OpenViking | openviking/server/resource_ingest.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Shared helper to ingest an already-uploaded temp file as a resource.
Used by both the MCP ``add_resource`` tool (``temp_file_id`` branch) and the signed
``temp_upload`` route (automatic post-upload ingestion). Resol... | 77 | 3,354 |
OpenViking | openviking/server/models.py | .py | # 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
mes... | 66 | 1,641 |
OpenViking | openviking/server/bootstrap.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Bootstrap script for OpenViking HTTP Server."""
import asyncio
import argparse
import json
import os
import shutil
import socket
import subprocess
import sys
import time
from dataclasses import dataclass
from pathli... | 489 | 17,188 |
OpenViking | openviking/server/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""OpenViking HTTP Server module."""
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from openviking.server.app import create_app
from openviking.server.bootstrap import main as run_server
def __getattr__... | 25 | 637 |
OpenViking | openviking/server/error_mapping.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import ast
import re
from typing import Any, Iterator
from openviking.pyagfs.exceptions import (
AGFSAlreadyExistsError,
AGFSClientError,
AGFSConfigError,
AGFSConnectionError,
AGFSDirectoryNotEmpty... | 576 | 19,622 |
OpenViking | openviking/server/body_dump_middleware.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""HTTP request/response body dump middleware for trace debugging.
Attaches the request and response bodies as attributes on the active OpenTelemetry
root span so they can be inspected in trace UIs (Jaeger, Tempo, etc.... | 130 | 4,448 |
OpenViking | openviking/server/request_id.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Request ID handling for the OpenViking HTTP server."""
from __future__ import annotations
import logging
import re
import time
import uuid
from starlette.responses import JSONResponse
from starlette.types import ... | 116 | 4,189 |
OpenViking | openviking/server/dependencies.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Dependency injection for OpenViking HTTP Server."""
from typing import TYPE_CHECKING, Optional
from openviking.service.core import OpenVikingService
if TYPE_CHECKING:
from openviking.server.config import Serve... | 58 | 1,649 |
OpenViking | openviking/server/user_config.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Server-side user configuration helpers."""
from __future__ import annotations
import json
from contextlib import asynccontextmanager
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, AsyncIte... | 269 | 8,273 |
OpenViking | openviking/server/agent_evolution_config.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Live access to account-scoped Agent Evolution settings."""
from __future__ import annotations
from pathlib import Path
from threading import Lock
from typing import Optional
from openviking.server.account_settings... | 104 | 3,732 |
OpenViking | openviking/server/local_input_guard.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Guards for local-path handling on the HTTP server."""
from __future__ import annotations
import re
from pathlib import Path
from typing import Optional
from openviking.utils.network_guard import ensure_public_remo... | 98 | 3,667 |
OpenViking | openviking/server/profile_middleware.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""HTTP request profiling middleware helpers."""
from __future__ import annotations
import cProfile
import json
import site
import sysconfig
from pathlib import Path
from typing import Awaitable, Callable
from fastap... | 227 | 7,095 |
OpenViking | openviking/server/upload_token_store.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""In-memory store for short-lived upload tokens used by the MCP progressive upload flow.
Issued by the MCP ``add_resource`` tool when a caller passes a local-file path; consumed by
``POST /api/v1/resources/temp_upload... | 154 | 5,371 |
OpenViking | openviking/server/identity.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Identity and role types for OpenViking multi-tenant HTTP Server."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import Enum
from typing import TYPE_CHECKING, Any, List, Opt... | 136 | 4,139 |
OpenViking | openviking/server/account_settings.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Persistent, account-scoped runtime settings."""
from __future__ import annotations
import json
from typing import Any, Optional
from pydantic import BaseModel
from openviking.pyagfs import AGFSAlreadyExistsError,... | 186 | 6,226 |
OpenViking | openviking/server/mcp_endpoint.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""MCP (Model Context Protocol) endpoint for OpenViking server.
Exposes tools to Claude Code (or any MCP client) via streamable HTTP:
find, search, read, write, edit, list, tree, remember, add_resource, grep, glob, f... | 1,246 | 50,937 |
OpenViking | openviking/server/config.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Server configuration for OpenViking HTTP Server."""
import sys
from typing import Dict, List, Literal, Optional
from pydantic import BaseModel, Field, ValidationError, field_validator
# Import auth plugin registry... | 535 | 20,391 |
OpenViking | openviking/server/openviking_assets.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Server-side parsing and validation for OpenViking Assets manifests."""
from __future__ import annotations
import asyncio
import contextlib
import hashlib
import math
import os
import re
from typing import Any
impo... | 585 | 21,801 |
OpenViking | openviking/server/temp_upload_store.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Temporary upload storage backends for HTTP server uploads."""
from __future__ import annotations
import json
import os
import tempfile
import time
import uuid
from contextlib import suppress
from dataclasses import... | 416 | 15,688 |
OpenViking | openviking/server/skill_source_metadata.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Helpers for persisted skill source metadata."""
import json
from typing import Any, Dict, Optional
from openviking.server.identity import RequestContext
SOURCE_METADATA_FILENAME = ".source.json"
def skill_source... | 78 | 2,151 |
OpenViking | openviking/server/routers/watches.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Watch management endpoints for OpenViking HTTP Server.
Implements RFC #2104 (Watch Management API) on the REST control plane.
Routes mirror WatchManager primitives with dual-key support: every
single-resource endpoi... | 356 | 14,504 |
OpenViking | openviking/server/routers/filesystem.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Filesystem endpoints for OpenViking HTTP Server."""
from typing import Any, Literal, Optional
from fastapi import APIRouter, Body, Depends, Query
from pydantic import BaseModel
from openviking.core.namespace impor... | 325 | 12,025 |
OpenViking | openviking/server/routers/admin.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Admin endpoints for OpenViking multi-tenant HTTP Server."""
import asyncio
from fastapi import APIRouter, Body, Depends, Path, Request
from pydantic import BaseModel
from openviking.server.account_settings import ... | 529 | 17,367 |
OpenViking | openviking/server/routers/bot.py | .py | """Bot API router for proxying requests to Vikingbot OpenAPIChannel.
This router provides endpoints for the Bot API that proxy requests to the
Vikingbot OpenAPIChannel when the --with-bot option is enabled.
"""
import json
from typing import AsyncGenerator, Optional
import httpx
from fastapi import APIRouter, Depend... | 451 | 15,576 |
OpenViking | openviking/server/routers/webdav.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Minimal WebDAV adapter for resources scope."""
from __future__ import annotations
import mimetypes
import xml.etree.ElementTree as ET
from datetime import timezone
from email.utils import format_datetime
from typin... | 444 | 15,648 |
OpenViking | openviking/server/routers/stats.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Memory health statistics endpoints for OpenViking HTTP Server."""
from typing import Optional
from fastapi import APIRouter, Depends, Path, Query
from openviking.server.auth import get_request_context
from openvik... | 72 | 2,607 |
OpenViking | openviking/server/routers/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""OpenViking HTTP Server routers."""
from openviking.server.routers.admin import router as admin_router
from openviking.server.routers.agent_evolution import router as agent_evolution_router
from openviking.server.rou... | 56 | 2,456 |
OpenViking | openviking/server/routers/observer.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Observer endpoints for OpenViking HTTP Server.
Provides observability API for monitoring component status.
Mirrors SDK's client.observer API:
- /api/v1/observer/queue - Queue status
- /api/v1/observer/vikingdb - Vik... | 113 | 3,570 |
OpenViking | openviking/server/routers/system.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""System endpoints for OpenViking HTTP Server."""
import asyncio
from typing import Optional
from fastapi import APIRouter, Depends, Request
from fastapi.responses import JSONResponse
from pydantic import BaseModel
... | 313 | 11,319 |
OpenViking | openviking/server/routers/privacy_configs.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Privacy config endpoints for OpenViking HTTP Server."""
from typing import Any, Dict, Optional
from fastapi import APIRouter, Depends, Path
from pydantic import BaseModel, ConfigDict
from openviking.server.auth im... | 154 | 5,523 |
OpenViking | openviking/server/routers/debug.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Debug endpoints for OpenViking HTTP Server.
Provides debug API for system diagnostics.
- /api/v1/debug/health - Quick health check
- /api/v1/debug/vector/scroll - Paginated vector records
- /api/v1/debug/vector/coun... | 106 | 3,574 |
OpenViking | openviking/server/routers/sessions.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Sessions endpoints for OpenViking HTTP Server."""
from typing import Any, Dict, List, Literal, Optional
from fastapi import APIRouter, Body, Depends, HTTPException, Path, Query
from pydantic import BaseModel, Field... | 841 | 30,818 |
OpenViking | openviking/server/routers/console.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Console BFF endpoints for usage and audit data."""
from __future__ import annotations
from typing import Optional
from fastapi import APIRouter, Query, Request
from openviking.server.auth import require_role
from... | 138 | 4,317 |
OpenViking | openviking/server/routers/skills.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Agent-scope skill management endpoints for OpenViking HTTP Server."""
import asyncio
import shutil
import uuid
from pathlib import Path
from typing import Any, Dict, Optional
import yaml
from fastapi import APIRout... | 687 | 25,472 |
OpenViking | openviking/server/routers/snapshot.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""HTTP routes for git-style version control (snapshots).
Mirrors VikingFS.commit / VikingFS.restore / VikingFS.show / VikingFS.diff / VikingFS.log,
which already implement the underlying semantics.
"""
from typing im... | 292 | 9,719 |
OpenViking | openviking/server/routers/search.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Search endpoints for OpenViking HTTP Server."""
import math
from typing import Any, Dict, List, Literal, Optional, Sequence, Union
from fastapi import APIRouter, Depends
from fastapi import Response as FastAPIRespo... | 514 | 17,565 |
OpenViking | openviking/server/routers/metrics.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Prometheus metrics endpoint for OpenViking HTTP Server."""
from fastapi import APIRouter, Request
from fastapi.responses import PlainTextResponse
from openviking.metrics.exporters.prometheus import PrometheusExport... | 29 | 1,004 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.