text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
"""Provider-agnostic single-turn execution engine. A thin, transport-free function that runs one LLM turn and yields its events. The product/transport loop in :mod:`vtx.loop` owns sessions, UI events, goals and persistence; this module owns only the turn itself. Today this delegates to :func:`vtx.turn.run_single_turn...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/agent_runner.py
.py
ca6eec41f8312581
7.48
8
"""Harness-owned runtime knobs. The agent engine (loop, turn runner) must not depend on any product package, so the tunables it needs live here with product-neutral defaults. The coding agent's config loader (:mod:`vtx.coding_agent.config`) mirrors user YAML into this object via :func:`apply_harness_settings`, so end-...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/config.py
.py
9e14693b21197b5c
7.48
8
"""Per-iteration message repair before each model call. A minimal, correct context governance utility: strip tool-result messages that have no matching assistant tool call (orphans left by cancelled/partial turns) and enforce a soft budget on tool-result text so a single huge tool output can't blow the context window....
OEvortex/vtx-coding-agent
src/vtx/ai/agent/context_governance.py
.py
ff0ce08ef9a2b8d1
7.48
8
"""Sub-agent dispatcher context. Generic infrastructure for any tool that wants to dispatch a sub-agent in-process. The runtime populates a single ``DispatcherContext`` slot on every relevant state change (initialize, agent change, model change, thinking-level change); tools that need to spawn sub-agents read the slot...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/dispatcher.py
.py
a1f2785411ad6f07
7.48
8
""" Extension manager: install, list, and uninstall vtx extensions from PyPI or GitHub repos. An extension package can expose its extensions/agents via: 1. Entry points: - ``vtx.extensions`` -> module path (``my_pkg.ext:register``) - ``vtx.agents`` -> module path (``my_pkg.agent:AGENT``) 2. Package layout disc...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/extension_manager.py
.py
e0923c493f69b486
7.48
8
"""In-process agent hook API. This is an *additive* lifecycle layer alongside the existing external YAML hook system (``hooks/bridge.py`` + ``EventBus``). It lets Python callers observe and (in one case) transform a run without going through the shell hook machinery: - ``before_run`` / ``after_run`` / ``on_error`` / ...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/hooks/agent_hook.py
.py
27f496669e67bd31
7.48
8
"""Approvals: human-in-the-loop and resumable run state.""" from __future__ import annotations from dataclasses import dataclass, field from enum import StrEnum from typing import Any, TypeVar from vtx.ai.agent.sdk.items_base import RunItemBase from vtx.core.types import ToolCall T = TypeVar("T") class ApprovalDe...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/sdk/approvals.py
.py
ec996e8528dad43a
7.48
8
"""Guardrail type definitions shared by input/output/tool guardrails.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from typing import Any from vtx.core.types import TextContent, ToolResultMessage @dataclass class GuardrailFunctionOutput: """Result...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/sdk/guardrails/types.py
.py
213e2d44b06d3c0e
7.48
8
""" Handoffs — the multi-agent delegation primitive. A handoff is a callable that, when invoked, transfers control of the run to a target agent. The target agent receives the full conversation history and produces the response for the rest of the turn. """ from __future__ import annotations import asyncio import ins...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/sdk/handoffs.py
.py
c51f05f176f09170
7.48
8
"""Permission policy — the SDK-side wrapper around Vtx's permission system.""" from __future__ import annotations from collections.abc import Awaitable, Callable from dataclasses import dataclass from enum import StrEnum from typing import Any from vtx.ai.agent.tools.base import BaseTool from vtx.core.types import T...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/sdk/permissions.py
.py
3efdd636795704b7
7.48
8
"""RunResult — the value returned by ``Runner.run_sync`` / ``Runner.run``.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Any from vtx.ai.agent.sdk.items import RunItem from vtx.core.types import StopReason, Usage @dataclass class RunResult: """The result of a...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/sdk/results.py
.py
25e3061d9d1e2fd7
7.48
8
"""Skill loading utilities for the SDK. The SDK shares Vtx's existing skill loader so that project, user, and built-in skills all work the same way they do in the coding agent's TUI. The loader lives in the coding-agent layer (:mod:`vtx.coding_agent.context.skills`) and is imported lazily to keep the harness import-gr...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/sdk/skills.py
.py
c3c92a996b81b998
7.48
8
"""Harness-level tool infrastructure. Only generic, product-agnostic pieces live here: the :class:`BaseTool` contract and schema shaping for LLM tool definitions. Concrete built-in tools and the default registry belong to the coding agent (:mod:`vtx.coding_agent.tools`). """ from typing import Any from vtx.core.type...
OEvortex/vtx-coding-agent
src/vtx/ai/agent/tools/__init__.py
.py
337026dab9f92a39
7.48
8
import capnp import multiprocessing import numbers import random import threading import time from openpilot.common.test import OpenpilotTestCase from openpilot.common.parameterized import parameterized from openpilot.cereal import log from opendbc.car.structs import car import openpilot.cereal.messaging as messaging ...
herizon1054/openpilot
openpilot/cereal/messaging/tests/test_messaging.py
.py
c3e5bd4d3930d15f
7
9
import configparser import json import os import socket import subprocess import time from functools import cached_property, lru_cache from pathlib import Path from openpilot.cereal import log from openpilot.common.utils import sudo_read, sudo_write from openpilot.common.gpio import gpio_set, gpio_init, get_irqs_for_a...
herizon1054/openpilot
openpilot/common/hardware/comma/hardware.py
.py
8ae0cd8795528430
7.5
9
#!/usr/bin/env python3 """Render the README shields.io endpoint badges from this run's test output. Stdlib only, deliberately: the badges job installs no toolchain, so this runs on the runner's system python3. Inputs are the two artifacts produced by the SAME workflow run that gated the commit: --corpus tests/run_...
BigWhale/sushi-lang
.github/scripts/make_badges.py
.py
98f0baa3ec221372
7.42
6
"""MkDocs hook: put the version and the build date in the site footer. The site is built from main and carries no version of its own, so a reader cannot tell which compiler the pages describe. This hook writes the release version, the build date and the source commit into `config.copyright`, which Material renders in ...
BigWhale/sushi-lang
docs/hooks/version_footer.py
.py
d7c2181d0201c0bf
7.42
6
"""LLVM IR constant value creation utilities.""" from llvmlite import ir from sushi_lang.backend.constants.bit_widths import ( INT8_BIT_WIDTH, INT16_BIT_WIDTH, INT32_BIT_WIDTH, INT64_BIT_WIDTH, ) FALSE_I1 = ir.Constant(ir.IntType(1), 0) TRUE_I1 = ir.Constant(ir.IntType(1), 1) ZERO_I8 = ir.Constant(i...
BigWhale/sushi-lang
sushi_lang/backend/constants/llvm_values.py
.py
202f317acfe2c2cb
7.42
6
"""Dependency graph builder for symbol resolution.""" from __future__ import annotations import re from typing import TYPE_CHECKING if TYPE_CHECKING: from sushi_lang.backend.symbol_table import SymbolInfo, SymbolTable # Compiled regex for extracting symbol references from LLVM IR # Matches @symbol_name, @.symbol...
BigWhale/sushi-lang
sushi_lang/backend/dependency_graph.py
.py
3ecd4cc5f33d2a05
7.42
6
"""Borrow (peek / poke) emission for the Sushi language compiler.""" from __future__ import annotations from typing import TYPE_CHECKING from llvmlite import ir from sushi_lang.semantics.ast import Borrow from sushi_lang.internals.errors import raise_internal_error if TYPE_CHECKING: from sushi_lang.backend.codege...
BigWhale/sushi-lang
sushi_lang/backend/expressions/borrow.py
.py
b24387ce992ca94e
7.42
6
"""File open() function implementation with error handling.""" from __future__ import annotations from typing import TYPE_CHECKING from llvmlite import ir from sushi_lang.backend.constants.llvm_values import make_i32_const from sushi_lang.backend import enum_utils from sushi_lang.backend.expressions.calls.utils import...
BigWhale/sushi-lang
sushi_lang/backend/expressions/calls/file_open.py
.py
770cb34d72bc2194
7.42
6
"""Generic type method call handlers (Result, Maybe, Own, HashMap, List).""" from __future__ import annotations from typing import TYPE_CHECKING, Optional, Union from llvmlite import ir from sushi_lang.semantics.ast import DotCall, MethodCall from sushi_lang.semantics.typesys import EnumType, StructType if TYPE_CHECK...
BigWhale/sushi-lang
sushi_lang/backend/expressions/calls/generics.py
.py
7951383111ac6bb3
7.42
6
"""Type casting operations for the Sushi language compiler.""" from __future__ import annotations from typing import TYPE_CHECKING from llvmlite import ir from sushi_lang.semantics.ast import CastExpr, IntLit, UnaryOp from sushi_lang.backend.utils import require_builder if TYPE_CHECKING: from sushi_lang.backend.c...
BigWhale/sushi-lang
sushi_lang/backend/expressions/casts.py
.py
c19a6c007bbd1c7e
7.42
6
"""Literal expression emission for the Sushi language compiler.""" from __future__ import annotations from typing import TYPE_CHECKING from llvmlite import ir from sushi_lang.semantics.ast import ( Expr, IntLit, FloatLit, BoolLit, BlankLit, StringLit, InterpolatedString ) from sushi_lang.semantics.typesys import B...
BigWhale/sushi-lang
sushi_lang/backend/expressions/literals.py
.py
41363842a507ec67
7.42
6
"""Name (variable reference) emission for the Sushi language compiler.""" from __future__ import annotations from typing import Optional, TYPE_CHECKING from llvmlite import ir from sushi_lang.semantics.ast import Name from sushi_lang.internals.errors import raise_internal_error if TYPE_CHECKING: from sushi_lang.b...
BigWhale/sushi-lang
sushi_lang/backend/expressions/names.py
.py
21ee3e429c28786f
7.42
6
"""Operator expression emission for the Sushi language compiler.""" from __future__ import annotations from typing import TYPE_CHECKING, Optional from llvmlite import ir from sushi_lang.backend.constants import INT8_BIT_WIDTH from sushi_lang.semantics.ast import Expr, UnaryOp, BinaryOp from sushi_lang.internals.errors...
BigWhale/sushi-lang
sushi_lang/backend/expressions/operators.py
.py
2898b52196cdbeb6
7.42
6
"""Error-propagation (`??`) emission for the Sushi language compiler.""" from __future__ import annotations from typing import TYPE_CHECKING from llvmlite import ir from sushi_lang.internals.errors import raise_internal_error from sushi_lang.backend import enum_utils if TYPE_CHECKING: from sushi_lang.backend.code...
BigWhale/sushi-lang
sushi_lang/backend/expressions/try_expr.py
.py
fa4fe6453d7be882
7.42
6
"""Unified facade for LLVM function management.""" from __future__ import annotations from typing import TYPE_CHECKING from llvmlite import ir from sushi_lang.semantics.ast import FuncDef, ExtendDef from .helpers import FunctionHelpers, declare_stdlib_function from .declarations import FunctionDeclarations from .defi...
BigWhale/sushi-lang
sushi_lang/backend/functions/__init__.py
.py
616d6432e9100520
7.42
6
"""Function definition (body emission) for LLVM code generation.""" from __future__ import annotations from typing import TYPE_CHECKING from llvmlite import ir from sushi_lang.semantics.ast import FuncDef, ExtendDef from sushi_lang.internals.errors import raise_internal_error if TYPE_CHECKING: from sushi_lang.bac...
BigWhale/sushi-lang
sushi_lang/backend/functions/definitions.py
.py
5c0568aa21820de1
7.42
6
"""Main function wrapper handling for C compatibility.""" from __future__ import annotations from typing import TYPE_CHECKING, Tuple from llvmlite import ir from sushi_lang.semantics.ast import FuncDef from sushi_lang.semantics.typesys import Type as Ty from sushi_lang.backend import enum_utils from sushi_lang.interna...
BigWhale/sushi-lang
sushi_lang/backend/functions/main_wrapper.py
.py
d3a859286f0ca664
7.42
6
"""Count the context-window cost of every MCP tool definition. The README quotes a per-tool token cost, and until this script existed those numbers could not be reproduced — which made them a claim rather than a measurement. Run it after adding or re-describing a tool and paste the output into the README table. No gr...
SerPeter/code-atlas
scripts/count_tool_tokens.py
.py
1718987ac96c873d
7.42
6
"""In-process fallback backends (SQLite queue, SQLite graph) selected via config. Factory functions here decide, per :class:`~code_atlas.settings.BackendSettings`, whether to construct the network-backed implementation (Valkey ``EventBus``, Memgraph ``GraphClient``) or its embedded SQLite counterpart. """ from __futu...
SerPeter/code-atlas
src/code_atlas/backends/__init__.py
.py
80d50b490ce91026
7.42
6
"""Daemon manager — reusable watcher + pipeline lifecycle. Encapsulates the EventBus, FileWatcher, EmbedClient, EmbedCache, and AST/Embed consumers. Used by both the CLI (``atlas watch``, ``atlas daemon start``) and the MCP server for auto-indexing. """ from __future__ import annotations import asyncio import time ...
SerPeter/code-atlas
src/code_atlas/indexing/daemon.py
.py
7db35b50b4f4d879
7.42
6
"""Git history mining for hotspot/bus-factor/co-change signals (ADR-0013 git_signals). Mining (`mine_git_signals`) is pure Python over GitPython's structured commit data — no graph-backend dependency, so it's testable against a throwaway git repo with no mocking. Writing the mined signals into the graph (`write_git_si...
SerPeter/code-atlas
src/code_atlas/indexing/git_signals.py
.py
9262e8e3e51b2a38
7.42
6
"""Filesystem watcher with hybrid debounce for real-time indexing. Watches the project directory for file changes and publishes :class:`~code_atlas.events.FileChanged` events to Valkey Streams. Uses a hybrid debounce strategy: each change resets a short timer, and the first change in a batch starts a max-wait ceiling....
SerPeter/code-atlas
src/code_atlas/indexing/watcher.py
.py
70f9309b14c082cc
7.42
6
"""Cross-process rate limiting for embedding provider calls. Two mechanisms, both needed, because neither covers the other's case: **Token buckets (Valkey).** Providers enforce *requests per minute* and *tokens per minute*, not concurrency. A semaphore of size N is 60·N/latency requests per minute -- a number nobody ...
SerPeter/code-atlas
src/code_atlas/search/ratelimit.py
.py
385ece94c3185ff7
7.42
6
"""Architecture-health metrics over a module dependency graph. Pure functions on an edge list — no graph client, no I/O, no framework. That is deliberate: these are the numbers a human will use to decide whether a codebase is decaying, so they need to be checkable against hand-worked examples rather than only against ...
SerPeter/code-atlas
src/code_atlas/server/architecture.py
.py
277c24c3f0313078
7.42
6
"""Architecture-health snapshots over time (ATL-121). A propagation cost of 8.4% is close to meaningless on its own: against the published anchors it sits somewhere between refactored Mozilla (~2%) and pre-refactor Mozilla (~17%), which is most of the useful range. The same number *rising from 6% over ten index runs* ...
SerPeter/code-atlas
src/code_atlas/server/architecture_history.py
.py
a1314e84a43eb45e
7.42
6
"""Strict, provider-neutral proposals accepted by the scene runtime.""" from __future__ import annotations import json from typing import Literal from pydantic import BaseModel, ConfigDict, Field, ValidationError, model_validator from storygame.runtime.facts import Fact class RuntimeContractError(ValueError): ...
bcorfman/freytag-forge
storygame/runtime/contracts.py
.py
55516c62d735fa44
7.56
12
"""Typed, assertable runtime facts and their small canonical store.""" from __future__ import annotations from typing import Any from pydantic import BaseModel, ConfigDict, Field class Fact(BaseModel): """One canonical assertion; projections must never be used as its authority.""" model_config = ConfigDic...
bcorfman/freytag-forge
storygame/runtime/facts.py
.py
603709aa781272bd
7.56
12
"""Versioned, integrity-checked SQLite snapshots for scene runtime sessions.""" from __future__ import annotations import hashlib import json import sqlite3 from pathlib import Path from pydantic import ValidationError from storygame.runtime.state import RuntimeState from storygame.story_package.models import Story...
bcorfman/freytag-forge
storygame/runtime/persistence.py
.py
05d3c65f035f8f2b
7.56
12
"""API Client for Klereo.""" import asyncio import json import logging from typing import Any import aiohttp _LOGGER = logging.getLogger(__name__) # API wire constants API_URL_BASE = "https://connect.klereo.fr/php" API_URL_LOGIN = f"{API_URL_BASE}/GetJWT.php" API_URL_GET_INDEX = f"{API_URL_BASE}/GetIndex.php" API_UR...
JonBasse/ha-klereo
custom_components/klereo/api.py
.py
dd2633175bf3bfc9
7.45
7
"""Binary sensor platform for Klereo.""" import logging from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const im...
JonBasse/ha-klereo
custom_components/klereo/binary_sensor.py
.py
808006b029b1cb5d
7.45
7
"""Config flow for Klereo integration.""" import logging import aiohttp import voluptuous as vol from homeassistant import config_entries, core from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import callback from homeassistant.exceptions import HomeAssistantError from homeassistant...
JonBasse/ha-klereo
custom_components/klereo/config_flow.py
.py
4e76d09b7c3cc713
7.45
7
"""DataUpdateCoordinator for Klereo.""" import asyncio import logging from datetime import timedelta from typing import Any import aiohttp from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed, HomeAssistantError from homeassistant.helpers.update_coordinator import Dat...
JonBasse/ha-klereo
custom_components/klereo/coordinator.py
.py
29bec39b8f5d9a8f
7.45
7
"""Base entity for Klereo.""" import logging from collections.abc import Callable from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback from ho...
JonBasse/ha-klereo
custom_components/klereo/entity.py
.py
6dfdd1322bd06c52
7.45
7
"""Typed data models for Klereo.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Any from .const import REGULATION_REFERENCE_FIELDS @dataclass class KlereoProbe: """A Klereo probe sensor reading.""" index: int type: int | None = None status: int | N...
JonBasse/ha-klereo
custom_components/klereo/models.py
.py
ca74ff3ccbeb332d
7.45
7
"""Number platform for Klereo.""" import logging from homeassistant.components.number import NumberEntity, NumberMode from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import PAR...
JonBasse/ha-klereo
custom_components/klereo/number.py
.py
ee787f26a023e02d
7.45
7
"""Select platform for Klereo.""" import logging from homeassistant.components.select import SelectEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .api import ( HEAT_MODES,...
JonBasse/ha-klereo
custom_components/klereo/select.py
.py
28d8b2ba8a62d7b0
7.45
7
"""Sensor platform for Klereo.""" import logging import re from homeassistant.components.sensor import SensorEntity, SensorStateClass from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from ....
JonBasse/ha-klereo
custom_components/klereo/sensor.py
.py
eabb6b79ef0355ff
7.45
7
"""Switch platform for Klereo.""" import logging from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .api import ( HEAT_MODE_H...
JonBasse/ha-klereo
custom_components/klereo/switch.py
.py
8d331f03696dd78e
7.45
7
#!/usr/bin/env python3 """Verify that a release's three places agree. Publishing this integration correctly requires three things to say the same number: 1. `version` in `custom_components/klereo/manifest.json` 2. a `## [X.Y.Z]` section in `CHANGELOG.md` 3. a `vX.Y.Z` tag — which must reach **GitHub**, since HACS ins...
JonBasse/ha-klereo
scripts/check_release_agreement.py
.py
eba3c93a152feb56
7.45
7
"""Tests for the Klereo API client.""" import json from unittest.mock import AsyncMock, MagicMock import aiohttp import pytest from custom_components.klereo.api import API_URL_COMMAND_STATUS, KlereoApi, KlereoApiError @pytest.fixture def mock_session(): """Create a mock aiohttp session. We avoid spec=aioht...
JonBasse/ha-klereo
tests/test_api.py
.py
a28796efffe66e3e
7.95
7
"""Tests for Klereo binary sensor entities.""" from unittest.mock import MagicMock import pytest from custom_components.klereo.binary_sensor import KlereoBinarySensor from custom_components.klereo.models import ( KlereoPoolDetails, KlereoProbe, KlereoSystemData, KlereoSystemInfo, ) def _make_probe(*...
JonBasse/ha-klereo
tests/test_binary_sensor.py
.py
ca148d74a7e2bbe1
7.95
7
"""Tests for the Klereo climate entity. Requested in GitHub #59 by the reporter of GH #55, tracked as Forgejo #118. The entity aggregates four things the integration already exposes separately — the water probe, the `ConsigneEau` setpoint, the KlereoTherm mode and the on/off write — and Home Assistant's `climate` plat...
JonBasse/ha-klereo
tests/test_climate.py
.py
743558994ed43a38
7.95
7
"""Tests for Klereo diagnostics.""" from unittest.mock import MagicMock import pytest from custom_components.klereo.diagnostics import ( TO_REDACT, async_get_config_entry_diagnostics, ) from custom_components.klereo.models import ( KlereoPoolDetails, KlereoProbe, KlereoSystemData, KlereoSystem...
JonBasse/ha-klereo
tests/test_diagnostics.py
.py
32a4607e6e4a499c
7.95
7
"""Tests for Klereo model parsing — notably which container carries the setpoints. `RegulModes` was a guess (see #94): the commit that introduced it says so in its own comment, and the string appears nowhere in the upstream Jeedom plugin, which reads every setpoint from `params`. These tests pin the resolution rule do...
JonBasse/ha-klereo
tests/test_models.py
.py
f063c0207c6e8572
7.95
7
"""Tests for Klereo number entities.""" from unittest.mock import AsyncMock, MagicMock import pytest from custom_components.klereo.models import ( KlereoPoolDetails, KlereoSystemData, KlereoSystemInfo, ) from custom_components.klereo.number import KlereoNumber, _extract_numbers _ABSENT = object() @pyte...
JonBasse/ha-klereo
tests/test_number.py
.py
85f8d22621a72b33
7.95
7
"""Tests for Klereo switch entities.""" from unittest.mock import AsyncMock, MagicMock import pytest from custom_components.klereo.api import ( HEAT_MODE_HEATING, HEAT_MODE_STOP, OUT_IDX_HEATING, OUT_MODE_MAN, OUT_STATE_AUTO, OUT_STATE_OFF, OUT_STATE_ON, ) from custom_components.klereo.mod...
JonBasse/ha-klereo
tests/test_switch.py
.py
47a9182b23c0df0d
7.95
7
"""Build the static site from JSONL data files.""" from __future__ import annotations import json import shutil from collections import defaultdict from datetime import datetime, timedelta, timezone from pathlib import Path import yaml from jinja2 import Environment, FileSystemLoader ROOT = Path(__file__).resolve()...
kurokobo/dify-status
build/build.py
.py
9b74953d719e01bf
7.42
6
"""Archive data files older than retention_days.""" from __future__ import annotations import sys from datetime import datetime, timedelta, timezone from pathlib import Path import yaml ROOT = Path(__file__).resolve().parent.parent def load_config() -> dict: with open(ROOT / "config.yaml", encoding="utf-8") a...
kurokobo/dify-status
build/cleanup.py
.py
7f098c18f701cbd8
7.42
6
"""LeWM evaluation entry point: CEM planning rollouts through the stable_worldmodel harness.""" import os os.environ["MUJOCO_GL"] = "egl" import time from pathlib import Path import hydra import numpy as np import stable_pretraining as spt import torch from omegaconf import DictConfig, OmegaConf from sklearn import...
ssrhaso/surveyor
eval.py
.py
37523743eaf662a1
7.62
16
"""JEPA world model: image encoder, action encoder, and autoregressive latent predictor.""" import torch import torch.nn.functional as F from einops import rearrange from torch import nn def detach_clone(v): return v.detach().clone() if torch.is_tensor(v) else v class JEPA(nn.Module): def __init__( ...
ssrhaso/surveyor
jepa.py
.py
78197111a9f46870
7.62
16
"""Neural building blocks: the SIGReg regularizer and the Transformer stack. Shared by the JEPA encoder and predictor; the conditional blocks carry AdaLN-Zero modulation, the plain blocks do not. """ import torch from torch import nn import torch.nn.functional as F from einops import rearrange def modulate(x, shift,...
ssrhaso/surveyor
module.py
.py
1b1a9c9ebd44aa94
7.62
16
"""Walk the DINO-WM OSF project (view-only) and list/download files. python osf_fetch.py list python osf_fetch.py get <substring> <outdir> """ import json import os import sys import time import urllib.request VIEW = "a56a296ce3b24cceaf408383a175ce28" BASE = "https://files.us.osf.io/v1/resources/bmw48/providers/o...
ssrhaso/surveyor
surveyor/dinowm/osf_fetch.py
.py
3fb1c9c45de6b3fa
7.62
16
"""Shared I/O for the frozen LeWM world model: loading, frame encoding, the canonical PushT target, and tolerance-parameterized success criteria. The pretrained and local load paths produce the identical frozen model. Nothing here is trained or unfrozen. """ from __future__ import annotations import json import sys ...
ssrhaso/surveyor
surveyor/encoder.py
.py
6514a51f85215576
7.62
16
"""Fixed-population horizon episode file for OGBench-Cube. Uses hindsight goals at start + t (small offsets under the final-frame convention are vacuous: the cube is already at its target) and one fixed (episode, start) set reused at every offset so horizon is the only variable. A non-vacuity filter requires the cube ...
ssrhaso/surveyor
surveyor/envs/cube/build_populations.py
.py
c1e2f41407f6d524
7.62
16
#!/usr/bin/env python3 """Shared SSE→report helpers extracted from test_template.py. Used by both buddy (+test) and cue-research (any chat_stream consumer). Stdlib only. No behavior change from the originals — the test_template regression suite (test_skill_regression.py) is the contract. """ from __future__ import an...
sensedeal/cue-skills
cue-buddy/scripts/sse_report.py
.py
289c16eb7203ca22
7.42
6
#!/usr/bin/env python3 """End-to-end client contract validation for `cue_api.capabilities()`. Layer A: spin up the local backend process **via its actual route module** to exercise the full client path — url construction, query param serialization, ETag echo + If-None-Match short-circuit, 4xx structured detail decodin...
sensedeal/cue-skills
cue-buddy/scripts/test_capabilities_client.py
.py
1897b2188f960497
7.92
6
#!/usr/bin/env python3 """Corporate-credit template ↔ capabilities API coverage probe. Real-buddy validation per docs/tool_capabilities_api_2026_05_20.md §9 + references/examples/corporate-credit.md. The buddy author flow (`+author`) needs to translate template ``search_plan`` dimensions (e.g. ``[[主体核验]] 公开身份信息`` cov...
sensedeal/cue-skills
cue-buddy/scripts/test_corporate_credit_coverage.py
.py
ad5a188e0b69ad8c
7.92
6
#!/usr/bin/env python3 """cue-data-mcp skill regression — stdlib only.""" from __future__ import annotations import re import unittest from pathlib import Path _HERE = Path(__file__).resolve().parent _SKILL_DIR = _HERE.parent _SKILL_MD = _SKILL_DIR / "SKILL.md" _SKILL_ZH_MD = _SKILL_DIR / "SKILL.zh-CN.md" _SETUP_MD ...
sensedeal/cue-skills
cue-data-mcp/scripts/test_skill_regression.py
.py
f52c736d3c313154
7.92
6
"""从 /api/playbook 生成每场景的 SKILL.md 到 cue-skills/playbook/<slug>/。 单一生成源在 Cue 后端端点(GET /api/playbook/scenes/<scene>/skill)——本脚本只 fetch + 写文件 + 删退场,不复制渲染逻辑。运行时查 live 设计 → 搭子变动无需重跑, 仅场景集合变化才增删文件。仓分离,故走 HTTP(不能直接 import 后端代码)。 用法: python3 gen_scene_skills.py [--api-base https://cuecue.cn] [--apply] 默认 dry-run(只打印 diff);-...
sensedeal/cue-skills
scripts/gen_scene_skills.py
.py
e8b980b34689f935
7.42
6
"""Regression for gen_scene_skills.py — playbook scene-skill generator. Stdlib unittest (same style as every <skill>/scripts/test_skill_regression.py), so CI can run it with plain `python3 scripts/test_gen_scene_skills.py`. No pytest fixtures (tmp_path) — a bare-python run must not be a silent no-op. """ import os im...
sensedeal/cue-skills
scripts/test_gen_scene_skills.py
.py
c8265b3869641073
7.92
6
#!/usr/bin/env python3 """Validate every DSH bundle under ``dsh/<bundle>/``. A bundle is a package whose ``package.json`` declares ``dsh.bundle.patch``. For each such directory this check enforces: 1. ``package.json`` is valid JSON and declares ``dsh.bundle.patch`` (a path). 2. the referenced patch file exists. ...
sensedeal/cue-skills
scripts/verify_dsh_bundles.py
.py
6f7ead236901dabb
7.42
6
"""orze.benchmarks — preset framework for compliance-locked benchmark evaluation. A `Preset` codifies the rules for a specific benchmark so the eval cannot silently drift out of compliance. Concrete maintained presets ship in `orze_pro.benchmarks` (HF Open ASR Leaderboard, MMLU, HumanEval, etc.); this module ships the...
orze-ai/orze
src/orze/benchmarks/__init__.py
.py
682bd2cfca4d78db
7.45
7
"""Pro license management commands. Calling spec: from orze.cli_pro import pro_activate, pro_status, pro_deactivate pro_activate(key=None) # activate with key or prompt interactively pro_status() # print license status pro_deactivate(force=False) # remove saved key (prompts unle...
orze-ai/orze
src/orze/cli_pro.py
.py
87d839530b0ac51d
7.45
7
"""Host-local, process-safe leases for physical GPUs. Orze's in-process slot manager coordinates jobs owned by one controller. This module closes the separate-controller gap with kernel ``flock`` leases. Lease descriptors are deliberately passed to GPU children: if a controller crashes or detaches a child, the kerne...
orze-ai/orze
src/orze/core/gpu_lease.py
.py
d09a899090df9847
7.45
7
import logging import re import shutil from pathlib import Path from tempfile import TemporaryDirectory from typing import Any, ClassVar import pdf2image from beet import ( Context, File, ItemModel, Model, NamespaceFileScope, ResourcePack, Texture, configurable, ) from PIL import Image ...
Trioplane/reef
packages/reef/src/reef/assets/pdf.py
.py
ba4f20db1b11e1fc
7.57
13
import json import logging from typing import ClassVar from beet import ( Context, DataPack, Drop, Function, JsonFileBase, NamespaceFileScope, configurable, ) from pydantic import RootModel from .. import models, state from ..options import ReefPluginOptions __all__ = ["ReefSlideshowData"...
Trioplane/reef
packages/reef/src/reef/data/slideshow.py
.py
47c7601afda23ee1
7.57
13
import json import logging from typing import Annotated, Any, ClassVar, Literal from beet import ( Context, DataPack, Drop, Function, JsonFileBase, NamespaceFileScope, configurable, ) from pydantic import BaseModel, Field, RootModel from .. import state from ..models import NumberString, R...
Trioplane/reef
packages/reef/src/reef/data/special.py
.py
942f88d1be08a93a
8.07
13
"""Multi-trail aggregation for governing multi-agent systems.""" from __future__ import annotations from dataclasses import dataclass from datetime import datetime from typing import Any from provena.models import ChainVerdict, ContextSource @dataclass(frozen=True, slots=True) class HandoffEdge: """A tracked c...
rajfirke/provena
src/provena/aggregator.py
.py
76b9c29d1afd78ff
7.59
14
"""Async batch write buffer for high-throughput trail logging.""" from __future__ import annotations import atexit import contextlib import logging import signal import threading import weakref from collections import deque from typing import Any, Protocol _logger = logging.getLogger("provena.buffer") class _Appen...
rajfirke/provena
src/provena/buffer.py
.py
2e63a51834251e71
7.59
14
"""OpenTelemetry span exporter for governance events.""" from __future__ import annotations from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from provena.models import TrailRecord try: from opentelemetry import trace _HAS_OTEL = True except ImportError: _HAS_OTEL = False class OTelExporter...
rajfirke/provena
src/provena/exporters/otel.py
.py
80b6cc8f9f8ce5c1
7.59
14
"""SHA-256 hash chain computation and verification.""" from __future__ import annotations import hashlib import hmac GENESIS_HASH = hashlib.sha256(b"provena:genesis").hexdigest() HASH_ALGORITHM = "sha256" class ChainHasher: """Computes and verifies SHA-256 hash chain links. Supports optional HMAC-SHA256 s...
rajfirke/provena
src/provena/hasher.py
.py
26ab9d91bd529e08
7.59
14
"""AutoGen integration for logging agent messages to a Provena trail.""" from __future__ import annotations from typing import TYPE_CHECKING, Any from provena.models import ContextSource if TYPE_CHECKING: from provena.trail import ContextTrail class ProvenaAutoGenHook: """AutoGen hook that logs agent mess...
rajfirke/provena
src/provena/integrations/autogen.py
.py
4367dad37d7bb936
7.59
14
"""CrewAI integration for logging agent and task outputs to a Provena trail.""" from __future__ import annotations from typing import TYPE_CHECKING, Any from provena.models import ContextSource if TYPE_CHECKING: from provena.trail import ContextTrail try: from crewai.utilities.events.agent_events import Ag...
rajfirke/provena
src/provena/integrations/crewai.py
.py
ccbfa64282c7cfc0
7.59
14
"""Google ADK integration for logging tool outputs to a Provena trail.""" from __future__ import annotations from typing import TYPE_CHECKING, Any from provena.models import ContextSource if TYPE_CHECKING: from provena.trail import ContextTrail class ProvenaADKCallback: """Google ADK callback that logs to...
rajfirke/provena
src/provena/integrations/google_adk.py
.py
413136995b767f48
7.59
14
from __future__ import annotations from datetime import datetime from typing import TYPE_CHECKING, Any from uuid import UUID from provena.models import ContextSource, ProvenanceMetadata, parse_isoformat if TYPE_CHECKING: from provena.trail import ContextTrail try: from langchain_core.callbacks.base import B...
rajfirke/provena
src/provena/integrations/langchain.py
.py
25cc1efaf5b73cba
7.59
14
"""OpenAI Agents SDK integration for logging tool and agent outputs.""" from __future__ import annotations import asyncio from typing import TYPE_CHECKING, Any from provena.models import ContextSource if TYPE_CHECKING: from provena.trail import ContextTrail try: from agents import RunHooks from agents....
rajfirke/provena
src/provena/integrations/openai_agents.py
.py
940af447033d52f0
7.59
14
"""MCP server exposing governance data to agents via tools and resources.""" from __future__ import annotations import json import os import threading from typing import Any try: from fastmcp import FastMCP except ImportError: FastMCP = None # type: ignore[assignment] from provena.trail import ContextTrail...
rajfirke/provena
src/provena/mcp_server.py
.py
78e6b62b40bfda3e
7.59
14
"""Data models for context governance records and validation results.""" from __future__ import annotations import hashlib import json from dataclasses import dataclass, field from datetime import datetime, timezone from enum import Enum from typing import Any, Literal class ContextSource(str, Enum): """Enumera...
rajfirke/provena
src/provena/models.py
.py
01265c4764b32252
7.59
14
"""Policy engine for governance enforcement on context inputs.""" from __future__ import annotations import logging from dataclasses import dataclass from enum import Enum from typing import Any, Literal from provena.models import TrailRecord _logger = logging.getLogger("provena.policy") class EnforcementLevel(st...
rajfirke/provena
src/provena/policy.py
.py
87a426089a4927f7
7.59
14
"""Retention policy engine for automatic record lifecycle management.""" from __future__ import annotations import json import logging from dataclasses import dataclass from datetime import datetime, timedelta, timezone from typing import Any _logger = logging.getLogger("provena.retention") EU_AI_ACT_MINIMUM_DAYS =...
rajfirke/provena
src/provena/retention.py
.py
c4e1e2a034561417
7.59
14
"""Freshness checker for detecting stale context inputs.""" from __future__ import annotations import re from datetime import datetime, timedelta, timezone from provena.models import ContextEntry, FreshnessResult _MONTH_MAP: dict[str, int] = { "january": 1, "february": 2, "march": 3, "april": 4, ...
rajfirke/provena
src/provena/validators/freshness.py
.py
34cd82a7fc660eb9
7.59
14
"""Provenance metadata validator for context entries.""" from __future__ import annotations from provena.models import ContextEntry, ProvenanceMetadata, ValidationResult _DEFAULT_REQUIRED = ("source_url", "created_at") class ProvenanceValidator: """Validates that context entries carry required provenance metad...
rajfirke/provena
src/provena/validators/provenance.py
.py
d3227a97ebcce61b
7.59
14
""" Shared allowlist logic for website exceptions. Manages @@||domain^$important,document rules in AdGuard CLI's user.txt file. Used by both the standalone ExceptionsDialog and the ExceptionsTab in the Manager window. """ import logging import os import re import tempfile from pathlib import Path logger = logging.ge...
RiDDiX/adguard-tray
adguard_tray/_allowlist.py
.py
b2653d3ad2faaece
7.6
15
""" Persistent configuration stored as JSON at ~/.config/adguard-tray/config.json. Unknown keys from disk are silently ignored (forward-compatible). """ import json import logging from dataclasses import asdict, dataclass, fields from pathlib import Path from ._allowlist import write_atomic logger = logging.getLogge...
RiDDiX/adguard-tray
adguard_tray/config.py
.py
3e84f73a623c0710
7.6
15
""" Website exceptions dialog. Manages allowlist entries in AdGuard CLI's user.txt file. Each exception is stored as an AdBlock-style rule: @@||example.com^$important,document This tells AdGuard to skip content filtering on the specified domain. """ import logging from PyQt6.QtCore import Qt from PyQt6.QtWidgets ...
RiDDiX/adguard-tray
adguard_tray/exceptions_dialog.py
.py
30520d5bf85fe6ba
7.6
15
""" Entry point for adguard-tray. Wayland / platform notes: - Qt6 auto-detects Wayland via WAYLAND_DISPLAY (no manual override needed). - QSystemTrayIcon uses the StatusNotifierItem (SNI) DBus protocol on Wayland, which KDE Plasma supports natively. - On Hyprland, SNI works with waybar (tray module) or sfwba...
RiDDiX/adguard-tray
adguard_tray/main.py
.py
1132b6787e261808
7.6
15
""" Manager window – full GUI for managing AdGuard CLI. Tabs: 1. Overview – status, version, license, quick actions 2. Filters – HTTP filter management (existing dialog as tab page) 3. DNS Filters – DNS filter management 4. Userscripts – userscript management (existing dialog as tab page) 5. Excep...
RiDDiX/adguard-tray
adguard_tray/manager_window.py
.py
8aa0344844733423
7.6
15