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 | openviking/metrics/datasources/base.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from typing import Any, Callable, ClassVar
from openviking.metrics.core.base import MetricDataSource, ReadEnvelope
class EventMetricDataSource(MetricDataSource):
"""
Share... | 124 | 3,962 |
OpenViking | openviking/metrics/collectors/feedback.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import importlib
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, ClassVar
from openviking.metrics.core.base import MetricCollector
from .b... | 192 | 8,530 |
OpenViking | openviking/metrics/collectors/encryption_probe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.encryption import E... | 111 | 4,121 |
OpenViking | openviking/metrics/collectors/telemetry_bridge.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: TelemetryBridgeCollector.
This collector converts the aggregated telemetry summary of a single operation/request
into Prometheus metrics.
Input:
- A single `telemetry.summary` event per operation... | 320 | 12,950 |
OpenViking | openviking/metrics/collectors/manager.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Collector orchestration for Prometheus exposition.
This module implements the "scrape-triggered collection" workflow:
- `/metrics` export calls `CollectorManager.refresh_all(...)` before rendering.
- Each collecto... | 257 | 9,774 |
OpenViking | openviking/metrics/collectors/task_tracker.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.task import TaskStateDataS... | 99 | 3,741 |
OpenViking | openviking/metrics/collectors/async_system_probe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.probes import AsyncSystemP... | 74 | 2,885 |
OpenViking | openviking/metrics/collectors/rerank.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: RerankCollector.
Tracks rerank call count, duration, and token usage:
- Calls counter by provider/model
- Duration histogram by provider/model
- Token counters by provider/model
This collector is... | 129 | 4,740 |
OpenViking | openviking/metrics/collectors/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Collector entry points for event-driven, state, probe, and exporter-facing metrics writes."""
from .async_system_probe import AsyncSystemProbeCollector
from .base import (
CollectorConfig,
DomainStatsMetric... | 66 | 2,103 |
OpenViking | openviking/metrics/collectors/vlm.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: VLMCollector.
Tracks VLM call count, duration, and token usage:
- Calls counter by provider/model
- Duration histogram by provider/model
- Token counters by provider/model
This collector is fed b... | 139 | 4,973 |
OpenViking | openviking/metrics/collectors/retrieval_backend_probe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.probes import Retri... | 72 | 2,791 |
OpenViking | openviking/metrics/collectors/model_usage.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
DomainStats collector: ModelUsageCollector.
This collector exports aggregated model usage in a Prometheus-friendly way:
- Input source is cumulative usage (calls/tokens) from model instances or shared token tracke... | 197 | 8,225 |
OpenViking | openviking/metrics/collectors/http.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: HTTPCollector.
This collector is fed by the HTTP middleware via EventCollectorRouter events:
- http.request: records request count and duration histogram.
- http.inflight: records inflight request... | 137 | 5,171 |
OpenViking | openviking/metrics/collectors/resource.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: ResourceIngestionCollector.
Exports stage-level metrics for resource ingestion and processing:
- stage counters by stage/status
- stage duration histogram
- wait duration histogram (operation-leve... | 116 | 4,294 |
OpenViking | openviking/metrics/collectors/retrieval.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event/DomainStats collector: RetrievalCollector.
This collector records retrieval outcomes:
- request count, results count, zero-result count
- latency histogram
- rerank usage/fallback counts
It is fed by `Retri... | 139 | 5,543 |
OpenViking | openviking/metrics/collectors/observer_state.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
DomainStats collector: ObserverStateCollector.
This collector converts the observer's component status table into a small set of
low-cardinality gauges, suitable for dashboards and alerting.
Why not export the fu... | 113 | 4,465 |
OpenViking | openviking/metrics/collectors/session.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: SessionCollector.
Tracks session lifecycle and usage signals emitted from session-related code paths:
- create/get/delete/commit/extract lifecycle outcomes
- contexts and skills usage counts
- arc... | 124 | 4,363 |
OpenViking | openviking/metrics/collectors/encryption.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: EncryptionCollector.
This collector is fed by encryption DataSources (and by crypto code paths emitting those events).
It exports operational metrics for:
- encrypt/decrypt operation count and lat... | 267 | 10,767 |
OpenViking | openviking/metrics/collectors/embedding.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: EmbeddingCollector.
Tracks embedding request outcomes and latency:
- Requests counter by status
- Latency histogram by status
- Error counter by normalized error code
- Per-call provider/model cou... | 212 | 8,050 |
OpenViking | openviking/metrics/collectors/queue.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.queue import QueueP... | 97 | 3,888 |
OpenViking | openviking/metrics/collectors/service_probe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.probes import ServiceProbe... | 81 | 2,991 |
OpenViking | openviking/metrics/collectors/observer_health.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.observer_state impo... | 118 | 4,564 |
OpenViking | openviking/metrics/collectors/cache.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Event collector: CacheCollector.
Records cache hit/miss counters by cache level (L0/L1/L2).
The cache level label is intentionally bounded to avoid cardinality issues.
"""
from __future__ import annotations
from... | 70 | 2,529 |
OpenViking | openviking/metrics/collectors/lock.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.observer_state import Lock... | 49 | 1,895 |
OpenViking | openviking/metrics/collectors/storage_probe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.probes import Stora... | 71 | 2,649 |
OpenViking | openviking/metrics/collectors/base.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Shared collector-side type definitions.
This module separates two concerns:
- Collection semantics, which belong to `MetricCollector` in `metrics.base`
- Refresh-management semantics, which belong to `Refreshable`... | 604 | 21,529 |
OpenViking | openviking/metrics/collectors/vikingdb.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.observer_state impo... | 103 | 3,911 |
OpenViking | openviking/metrics/collectors/model_provider_probe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from dataclasses import dataclass, field
from typing import ClassVar
from openviking.metrics.core.base import MetricCollector
from openviking.metrics.datasources.probes import Model... | 71 | 2,681 |
OpenViking | openviking/utils/multimodal.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Helpers for handling multimodal request data safely."""
from __future__ import annotations
from typing import Any
def redact_image_data_urls(value: Any) -> Any:
"""Return a copy with inline image payloads rep... | 24 | 939 |
OpenViking | openviking/utils/process_lock.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""PID-based advisory lock for data directory exclusivity.
Prevents multiple OpenViking processes from contending for the same data
directory, which causes silent failures in AGFS and VectorDB.
"""
import atexit
impor... | 173 | 6,648 |
OpenViking | openviking/utils/resource_processor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Context Processor for OpenViking.
Handles coordinated writes and self-iteration processes
as described in the OpenViking design document.
"""
import inspect
import time
from collections.abc import Callable
from ty... | 766 | 32,741 |
OpenViking | openviking/utils/embedding_input.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Helpers for bounding text sent to embedding providers."""
from __future__ import annotations
import math
EMBEDDING_TRUNCATION_SUFFIX = "\n...(truncated for embedding)"
def estimate_embedding_input_tokens(text: s... | 68 | 1,840 |
OpenViking | openviking/utils/git_auth.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Request-local HTTP authentication for Git subprocesses."""
from __future__ import annotations
import base64
import os
from dataclasses import dataclass, field
from typing import Mapping
from openviking_cli.excepti... | 110 | 3,868 |
OpenViking | openviking/utils/agfs_utils.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
RAGFS Client utilities for creating and configuring RAGFS clients.
"""
import asyncio
import multiprocessing
import os
from dataclasses import dataclass
from pathlib import Path
from threading import Thread
from ty... | 593 | 22,912 |
OpenViking | openviking/utils/exceptions.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Common exception helpers."""
HTTP_STATUS_TO_ERROR_CODE = {
400: "INVALID_ARGUMENT",
401: "UNAUTHENTICATED",
402: "RESOURCE_EXHAUSTED",
403: "PERMISSION_DENIED",
404: "NOT_FOUND",
408: "DEADLI... | 49 | 1,512 |
OpenViking | openviking/utils/image_search.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Small helpers for image search inputs."""
from __future__ import annotations
import base64
import io
import mimetypes
import os
from pathlib import Path
from typing import Any, Dict, List, Optional
from PIL import... | 121 | 4,002 |
OpenViking | openviking/utils/media_limits.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Shared media limits and limit checks."""
from typing import Protocol
MAX_MEDIA_FILE_BYTES = 512 * 1024 * 1024
DEFAULT_LARGE_IMAGE_MAX_FILE_SIZE_MB = 10.0
DEFAULT_LARGE_IMAGE_THRESHOLD_DIMENSION = 4096
DEFAULT_IMAG... | 38 | 1,163 |
OpenViking | openviking/utils/network_guard.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Network target validation helpers for server-side remote fetches."""
from __future__ import annotations
import ipaddress
import socket
from collections.abc import Callable
from typing import Optional
from urllib.pa... | 154 | 5,136 |
OpenViking | openviking/utils/skill_processor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Skill Processor for OpenViking.
Handles skill parsing, LLM generation, and storage operations.
"""
import shutil
import tempfile
import time
import zipfile
from copy import deepcopy
from dataclasses import datacla... | 601 | 21,957 |
OpenViking | openviking/utils/embedding_utils.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Embedding utilities for OpenViking.
Common logic for creating Context objects and enqueuing them to EmbeddingQueue.
"""
import os
from datetime import datetime, timezone
from pathlib import Path
from typing import... | 708 | 24,364 |
OpenViking | openviking/utils/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Utility functions and helpers."""
from openviking.utils.code_hosting_utils import (
ParsedGitRepoURL,
is_code_hosting_blob_url,
is_code_hosting_url,
is_git_repo_url,
is_github_url,
is_gitlab_... | 41 | 1,164 |
OpenViking | openviking/utils/summarizer.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Summarizer for OpenViking.
Handles summarization and key information extraction.
"""
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
from openviking.core.namespace import context_type_for_uri
fr... | 218 | 9,119 |
OpenViking | openviking/utils/search_filters.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import re
from datetime import datetime, time, timedelta, timezone
from typing import Any, Dict, List, Literal, Optional, Union
from openviking.utils.time_utils import format_iso860... | 305 | 10,217 |
OpenViking | openviking/utils/zip_safe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Safe ZIP extraction with Zip Slip protection."""
import os
import re
import shutil
import zipfile
from pathlib import Path, PurePosixPath
_UTF8_FLAG = 0x800
_WINDOWS_DRIVE_RE = re.compile(r"^[A-Za-z]:$")
def _con... | 104 | 3,430 |
OpenViking | openviking/utils/time_utils.py | .py | import re
from datetime import datetime, timezone
# Matches fractional seconds with more than 6 digits (e.g. .1470042)
_EXCESS_FRAC_RE = re.compile(r"(\.\d{6})\d+")
def parse_iso_datetime(value: str) -> datetime:
"""Parse an ISO 8601 datetime string, tolerating >6-digit fractional seconds.
Windows may produ... | 44 | 1,351 |
OpenViking | openviking/utils/media_processor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Unified resource processor with strategy-based routing."""
from pathlib import Path
from typing import TYPE_CHECKING, Optional
from openviking.parse.accessors.base import LocalResource, SourceType
from openviking.p... | 330 | 13,836 |
OpenViking | openviking/utils/async_client_cache.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Event-loop scoped cache for reusable async clients."""
from __future__ import annotations
import asyncio
import inspect
import threading
import weakref
from collections.abc import Callable
from typing import Any, P... | 125 | 3,946 |
OpenViking | openviking/utils/path_safety.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Shared helpers for safe user-supplied path handling."""
import re
from urllib.parse import unquote
from openviking_cli.utils.uri import VikingURI
_UNSAFE_REL_PATH_RE = re.compile(r"(^|[\\/])\.\.($|[\\/])")
_WINDOW... | 63 | 2,589 |
OpenViking | openviking/utils/tags.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Utilities for explicit k=v search tags."""
from __future__ import annotations
import logging
from collections import OrderedDict
from typing import Any, Iterable
from openviking_cli.exceptions import InvalidArgume... | 99 | 3,111 |
OpenViking | openviking/utils/code_hosting_utils.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Utilities for code hosting platform URL parsing.
This module provides shared functionality for parsing URLs from code hosting
platforms like GitHub and GitLab.
"""
from collections.abc import Iterable
from datacla... | 786 | 27,065 |
OpenViking | openviking/utils/token_estimation.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Shared conservative token estimation helpers."""
from __future__ import annotations
import math
from typing import Any
def _is_cjk_code_point(code_point: int) -> bool:
return (
0x3400 <= code_point <... | 91 | 2,724 |
OpenViking | openviking/utils/model_retry.py | .py | from __future__ import annotations
import asyncio
import logging
import random
import re
import threading
import time
from typing import Awaitable, Callable, TypeVar
from openviking.utils.exceptions import AllCredentialsFailedError
logger = logging.getLogger(__name__)
T = TypeVar("T")
# Error classification catego... | 636 | 22,737 |
OpenViking | openviking/utils/circuit_breaker.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Circuit breaker and error classification for API call protection."""
from __future__ import annotations
import threading
import time
from openviking.utils.model_retry import (
ERROR_CLASS_AUTH,
ERROR_CLASS... | 135 | 4,955 |
OpenViking | openviking/utils/ingest_options.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Options carried with content as it enters downstream processing."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Iterable, Mapping, Optional
from openviking.utils.ta... | 60 | 1,903 |
OpenViking | openviking/service/reindex_executor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Admin reindex executor."""
from __future__ import annotations
import asyncio
import time
from dataclasses import dataclass, field
from typing import Any, Iterable, Optional
from openviking.core.context import (
... | 1,890 | 70,376 |
OpenViking | openviking/service/task_store.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Internal storage backends for TaskTracker."""
from __future__ import annotations
import json
from copy import deepcopy
from typing import Any, Dict, List, Optional, Protocol
from openviking.pyagfs import AsyncAGFS... | 164 | 5,673 |
OpenViking | openviking/service/task_work_index.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Runtime index of durable queue work owned by a tracked task.
QueueFS remains the durable source of truth. This index is rebuilt from all
unacknowledged queue messages during startup and then maintained by enqueue/A... | 311 | 11,181 |
OpenViking | openviking/service/task_tracker_concurrency.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Concurrency primitives used by the task tracker."""
import asyncio
import threading
import time
from concurrent.futures import Future as ConcurrentFuture
from concurrent.futures import InvalidStateError
from contex... | 257 | 8,881 |
OpenViking | openviking/service/session_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Session Service for OpenViking.
Provides session management operations: session, sessions, add_message, commit, delete.
"""
import asyncio
from dataclasses import replace
from datetime import datetime
from typing ... | 675 | 27,518 |
OpenViking | openviking/service/task_tracker.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Async Task Tracker for OpenViking.
Provides a lightweight registry for tracking background operations
(e.g. session commit with wait=false). Callers receive a task_id that can be
polled via the /tasks API to check ... | 1,041 | 38,616 |
OpenViking | openviking/service/resource_memory_link_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Link resource addition reasons to user memories.
This module keeps resource files immutable: all traceability lives in memory
files' MEMORY_FIELDS metadata.
"""
from __future__ import annotations
import asyncio
im... | 701 | 24,730 |
OpenViking | openviking/service/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Service layer for OpenViking.
Provides business logic decoupled from transport layer,
enabling reuse across HTTP Server and CLI.
"""
from importlib import import_module
from typing import TYPE_CHECKING, Any
if TY... | 64 | 2,276 |
OpenViking | openviking/service/user_deletion.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Durable, idempotent deletion of one user and their owned data."""
from __future__ import annotations
import asyncio
import json
import time
from typing import Any, Awaitable, Callable, Optional
from uuid import uui... | 540 | 19,559 |
OpenViking | openviking/service/pack_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Pack Service for OpenViking.
Provides ovpack export/import and backup/restore operations.
"""
from typing import Optional
from openviking.core.namespace import canonicalize_uri
from openviking.core.uri_validation... | 150 | 5,061 |
OpenViking | openviking/service/resource_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Resource Service for OpenViking.
Provides resource management operations: add_resource, add_skill, wait_processed.
"""
import asyncio
import contextlib
import inspect
import json
import time
from collections.abc i... | 1,920 | 78,115 |
OpenViking | openviking/service/session_auto_commit.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Runtime helpers for server-side automatic session commits."""
from __future__ import annotations
import asyncio
import json
from collections.abc import AsyncIterator
from datetime import datetime, timedelta, timezo... | 394 | 13,870 |
OpenViking | openviking/service/search_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Search Service for OpenViking.
Provides semantic search operations: search, find.
"""
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from openviking.core.path_variables import resolve_path_var... | 168 | 5,896 |
OpenViking | openviking/service/agent_evolution_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Agent Evolution product queries."""
from __future__ import annotations
import asyncio
from datetime import date, datetime, time, timedelta, timezone
from typing import TYPE_CHECKING, Any, Optional
from openviking.... | 232 | 8,071 |
OpenViking | openviking/service/fs_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
File System Service for OpenViking.
Provides file system operations: ls, mkdir, rm, mv, tree, stat, read, abstract, overview, grep, glob.
"""
import asyncio
from typing import TYPE_CHECKING, Any, Dict, List, Optio... | 837 | 31,428 |
OpenViking | openviking/service/relation_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Relation Service for OpenViking.
Provides relation management operations: relations, link, unlink.
"""
from typing import Any, Dict, List, Optional, Union
from openviking.core.uri_validation import validate_vikin... | 75 | 2,608 |
OpenViking | openviking/service/legacy_migration.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Legacy agent/session data migration to user-owned namespaces."""
from __future__ import annotations
import json
from dataclasses import dataclass, field
from typing import Any
from openviking.pyagfs import AsyncAG... | 801 | 30,798 |
OpenViking | openviking/service/debug_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Debug Service - provides system status query and health check.
"""
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
from openviking.server.identity import RequestContext
from openviki... | 295 | 9,341 |
OpenViking | openviking/service/core.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
OpenViking Service Core.
Main service class that composes all sub-services and manages infrastructure lifecycle.
"""
import asyncio
import os
from typing import TYPE_CHECKING, Any, Optional
from openviking.core.d... | 632 | 25,455 |
OpenViking | openviking/ingest/peer.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""peer_id resolution for replayed turns.
- assistant turns -> ``{harness}__{model}`` (or ``{harness}__{provider}__{model}``)
- user turns:
* single-user dev harnesses (claude_code/codex/opencode) -> git identity o... | 107 | 3,891 |
OpenViking | openviking/ingest/cursor_store.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Durable per-(harness, session) read-cursor + commit/idempotency state.
A single SQLite DB under ``~/.openviking/ingest/state.db`` records how far each
conversation has been ingested, plus:
- ``needs_commit``: append... | 366 | 13,363 |
OpenViking | openviking/ingest/normalize.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Convert ``NormalizedMessage`` -> OV ``AddMessageRequest`` payload dict.
Mirrors vikingbot's ``_normalize_session_messages`` shape (text/tool parts, peer_id
safe-naming). Conversation memory is driven by user/assista... | 53 | 1,698 |
OpenViking | openviking/ingest/models.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Core data structures shared across the ingest subsystem.
Note on "cursor": throughout this package, ``Cursor`` / ``cursor_store`` / ``cursor_kind``
refer to the read-position POINTER (how far we have ingested a give... | 96 | 3,344 |
OpenViking | openviking/ingest/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Conversation-log ingest: replay local agent-harness logs into OpenViking sessions.
Parses each harness's local conversation logs (Claude Code, Codex, OpenCode, Hermes,
OpenClaw, Cursor) into normalized messages and ... | 24 | 900 |
OpenViking | openviking/ingest/registry.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Registry of harness log-source adapters.
Adding a harness = one ``@register_source("name")`` decorator on a ``LogSource``
subclass; no config-schema change is needed (config keys are free-form).
"""
from __future__... | 56 | 1,957 |
OpenViking | openviking/ingest/poller.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Incremental ingest (watch mode): a WatchScheduler-style asyncio poll loop.
Mirrors ``openviking/resource/watch_scheduler.py`` (interval polling, graceful start/stop)
rather than depending on filesystem events: a dur... | 149 | 6,128 |
OpenViking | openviking/ingest/replay.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Replay normalized messages into OpenViking via the SDK HTTP client.
``ConversationReplayClient`` is a thin, vikingbot-free wrapper over ``ov.AsyncHTTPClient``
(client-side, transport-agnostic: targets a local or rem... | 213 | 8,696 |
OpenViking | openviking/ingest/cli.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""``openviking-server ingest`` CLI: replay local agent-harness logs into OpenViking.
Commands:
list-sources show registered harnesses and their config
status show per-session ingest progress (read cursors)... | 266 | 9,091 |
OpenViking | openviking/ingest/orchestrator.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Backfill orchestration: replay each discovered session cursor->end, then commit.
Incremental watch mode is handled by ``IngestPoller`` (``poller.py``).
"""
from __future__ import annotations
from dataclasses impor... | 144 | 5,598 |
OpenViking | openviking/ingest/sources/opencode.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""OpenCode (sst/opencode) adapter — SUPPORTED-EXPERIMENTAL.
Logs: ``~/.local/share/opencode/opencode.db`` (SQLite, WAL). ``session(id, title,
directory, model, time_created)``; ``message(id, session_id, time_created, ... | 138 | 5,349 |
OpenViking | openviking/ingest/sources/cursor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Cursor (IDE) adapter — DEFERRED stub.
NOTE: this is the Cursor *IDE harness*, distinct from the read-position ``Cursor``
pointer in ``models.py``.
Cursor stores chat in ``~/Library/Application Support/Cursor/User/{... | 60 | 2,311 |
OpenViking | openviking/ingest/sources/claude_code.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Claude Code adapter.
Logs: ``~/.claude/projects/<project-slug>/<session-uuid>.jsonl`` (append-only JSONL).
Each record has a top-level ``type``; conversation turns are ``type in {user, assistant}``
with a nested ``m... | 69 | 2,508 |
OpenViking | openviking/ingest/sources/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Harness log-source adapters. Importing this package registers all built-ins."""
# Import for side effects: each module's @register_source populates SOURCE_REGISTRY.
from openviking.ingest.sources import ( # noqa: F... | 16 | 486 |
OpenViking | openviking/ingest/sources/codex.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Codex (OpenAI Codex CLI) adapter.
Logs: ``~/.codex/sessions/YYYY/MM/DD/rollout-<ts>-<uuid>.jsonl`` (append-only JSONL).
Records: ``{timestamp, type, payload}``. Conversation turns are
``type=="response_item" & paylo... | 96 | 3,370 |
OpenViking | openviking/ingest/sources/base.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Log-source abstraction: one ABC + two intermediates so a new harness is a thin subclass.
- ``JsonlLogSource`` — append-only JSONL (Claude Code, Codex, Hermes, OpenClaw); byte-offset cursor.
- ``SqliteLogSource`` — ... | 253 | 9,904 |
OpenViking | openviking/ingest/sources/hermes.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Hermes adapter (group-chat agent).
Logs: ``~/.hermes/sessions/<ts>_<id>.jsonl`` (append-only JSONL). Records are keyed by
``role``: a leading ``session_meta`` (carries ``model`` + ``platform``), then ``user`` /
``as... | 65 | 2,366 |
OpenViking | openviking/ingest/sources/openclaw.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""OpenClaw adapter (group-chat agent).
Logs: ``~/.openclaw/agents/<agent>/sessions/<uuid>.jsonl`` (append-only JSONL). Records
carry a top-level ``type``; conversation turns are ``type=="message"`` with a nested
``mes... | 75 | 2,723 |
OpenViking | openviking/models/embedder/gemini_embedders.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Gemini Embedding 2 provider using the official google-genai SDK."""
from typing import Any, Dict, Optional
from google import genai
from google.genai import types
from google.genai.errors import APIError, ClientErr... | 289 | 10,961 |
OpenViking | openviking/models/embedder/cohere_embedders.py | .py | # Copyright (c) 2026 Antigravity / Dico Angelo
# SPDX-License-Identifier: AGPL-3.0
"""Cohere dense embedder implementation.
Uses Cohere's Embed API v2 (https://docs.cohere.com/reference/embed).
Supports embed-v4.0 and embed-english-v3.0 models with input_type
for asymmetric retrieval.
"""
from typing import Any, Dict... | 191 | 7,040 |
OpenViking | openviking/models/embedder/vikingdb_embedders.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""VikingDB Embedder Implementation via HTTP API"""
from typing import Any, Dict, List, Optional
import httpx
from openviking.models.embedder.base import (
DenseEmbedderBase,
EmbedResult,
HybridEmbedderBa... | 441 | 15,670 |
OpenViking | openviking/models/embedder/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
OpenViking Embedder Module
Provides three embedder abstractions:
- DenseEmbedderBase: Returns dense vectors
- SparseEmbedderBase: Returns sparse vectors
- HybridEmbedderBase: Returns both dense and sparse vectors
... | 95 | 2,951 |
OpenViking | openviking/models/embedder/volcengine_embedders.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Volcengine Embedder Implementation"""
from typing import Any, Dict, List, Optional
import volcenginesdkarkruntime
from openviking.models.embedder.base import (
DenseEmbedderBase,
EmbeddingInput,
EmbedR... | 572 | 21,002 |
OpenViking | openviking/models/embedder/jina_embedders.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Jina AI Embedder Implementation"""
from typing import Any, Dict, List, Optional
import openai
from openviking.models.embedder.base import (
DenseEmbedderBase,
EmbedResult,
)
from openviking.utils.async_cli... | 254 | 9,749 |
OpenViking | openviking/models/embedder/dashscope_embedders.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""DashScope Embedder Implementation
Supports both text (via OpenAI-compatible endpoint) and multimodal (via native
DashScope REST API) embedding modes.
"""
from typing import Any, Dict, List, Optional
import httpx
i... | 372 | 14,279 |
OpenViking | openviking/models/embedder/minimax_embedders.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""MiniMax Embedder Implementation via HTTP API"""
from typing import Any, Dict, List, Optional
import httpx
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from openvik... | 241 | 9,043 |
OpenViking | openviking/models/embedder/local_embedders.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Local GGUF embedders powered by llama-cpp-python."""
from __future__ import annotations
import importlib
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, List, Opti... | 225 | 8,308 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.