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
"""Binary sensor platform for HYXI Cloud.""" from __future__ import annotations import logging from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar from urllib.parse import urlparse from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntit...
Veldkornet/ha-hyxi-cloud
custom_components/hyxi_cloud/binary_sensor.py
.py
292dcaa449a6f1e6
7.57
13
"""DataUpdateCoordinator for HYXI Cloud.""" import logging from datetime import datetime, timedelta from typing import Any, TypedDict from aiohttp import ClientError from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFa...
Veldkornet/ha-hyxi-cloud
custom_components/hyxi_cloud/coordinator.py
.py
33cc79d5d670523c
7.57
13
"""Base entity for HYXI Cloud.""" from __future__ import annotations from typing import TYPE_CHECKING from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN, MANUFACTURER if TYPE_CHECKING: from .coordinator import HyxiDataUpdateCoordinator class HyxiEntity(Coordinato...
Veldkornet/ha-hyxi-cloud
custom_components/hyxi_cloud/entity.py
.py
3cd4c3267fcd26b8
7.57
13
"""HALO register model, from HYXIPower's Micro Storage RS485 document V1.0. Transcribed from the specification shared on issue #662 with permission to publish. Values are unverified against hardware -- no HALO has been on a bus yet -- so everything here is the vendor's claim, not an observation. Two rules govern the ...
Veldkornet/ha-hyxi-cloud
custom_components/hyxi_cloud/modbus/registers.py
.py
9dcbf18071390c48
7.57
13
"""HYX-H hybrid inverter register model. Transcribed from HYXIPower's *RS485_MODBUS RTU Hybrid Inverter Protocol*, V4.1 (2025/6/13), supplied directly to this project. Covers HYX-H(5~12)K-HT, HYX-H(15~25)K-HT, HYX-H(6~15)K-HTA and HYX-H(6~15)K-HTAC -- including the H10K-HT this transport is being brought up against. ...
Veldkornet/ha-hyxi-cloud
custom_components/hyxi_cloud/modbus/registers_hybrid.py
.py
44d3de69e7120193
7.57
13
"""Coordinator for the local Modbus transport. Subclasses the cloud coordinator rather than standing beside it, because everything downstream -- diagnostic sensors, the protection controllers, the Energy Manager engine -- reaches for attributes established in that __init__: hyxi_metadata, protection_controllers, engin...
Veldkornet/ha-hyxi-cloud
custom_components/hyxi_cloud/modbus_coordinator.py
.py
a9db7208901cc746
7.57
13
"""Minimal battery protection for HYXI inverter mode controls.""" from __future__ import annotations import asyncio import logging import time from typing import TYPE_CHECKING from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback from homeassistant.helpers import entity_registry as er from .const im...
Veldkornet/ha-hyxi-cloud
custom_components/hyxi_cloud/protection.py
.py
3617349623c859f1
7.57
13
"""Sync translation keys from en.json to all other language files. Adds any keys present in en.json but missing from a language file, preserving existing translations. Run after adding new strings to en.json. """ import json import pathlib def sync_keys(source_dict, target_dict): """Recursively add missing keys...
Veldkornet/ha-hyxi-cloud
scripts/sync_translations.py
.py
41d4ca6dd14831f9
7.57
13
#!/usr/bin/env python3 """Sync generated version/dependency fields from their sources of truth. Sources of truth: - manifest.json["version"] -> propagated into pyproject.toml's version - pyproject.toml["dependencies"] -> propagated into manifest.json["requirements"] Rewrites either file in place if it drifts, m...
Veldkornet/ha-hyxi-cloud
scripts/sync_versions.py
.py
17a308cfd3031834
7.57
13
"""Benchmark for HyxiSensor.device_info property.""" # pylint: disable=wrong-import-position import sys import time from unittest.mock import MagicMock # Simple mock classes class MockCoordinatorEntity: def __init__(self, coordinator, *args, **kwargs): self.coordinator = coordinator class MockSensorEn...
Veldkornet/ha-hyxi-cloud
tests/benchmark_device_info.py
.py
40ed5fb7d6ae4b40
8.07
13
"""Configuration for pytest.""" import os import sys from pathlib import Path from unittest.mock import MagicMock # This adds the root directory to the path so 'custom_components' can be found sys.path.insert(0, str(Path(__file__).parent.parent.resolve())) # Custom Exception classes to avoid TypeError when catching...
Veldkornet/ha-hyxi-cloud
tests/conftest.py
.py
20440e29c4a7717b
8.07
13
"""Fixtures for hyxi_cloud integration tests.""" from pathlib import Path import pytest import custom_components # Filter out non-existent directory paths (like setuptools editable installation finder hooks) # which cause Home Assistant's loader to throw FileNotFoundError when trying to iterdir() them. custom_compo...
Veldkornet/ha-hyxi-cloud
tests/integration/conftest.py
.py
de9cfa2590c4a56d
7.07
13
"""Tests for the HYX-H hybrid inverter Modbus client. Runs against modbus_connection's own mock unit, exercising the real field descriptors and block planner -- see test_modbus.py's module docstring for why a hand-rolled double would not do the same job. Register values below are realistic, not the document's own wor...
Veldkornet/ha-hyxi-cloud
tests/integration/test_modbus_hybrid.py
.py
78a84d87f57fb204
8.07
13
"""Tests for the hyxi_cloud const module.""" from custom_components.hyxi_cloud.const import ( BASE_URL_DEFAULT, DEFAULT_REGION, default_region_for_country, detect_phase_type, get_raw_device_code, get_software_version, is_null_value, is_zero_value, mask_sensitive_key_value, mask_...
Veldkornet/ha-hyxi-cloud
tests/test_const.py
.py
bf0b5247870d441b
8.07
13
"""Tests for the base entity.""" # pylint: disable=missing-module-docstring, wrong-import-position, import-outside-toplevel import sys from unittest.mock import MagicMock # 1. BULLETPROOF MOCKS class FakeBase: """Fake base class for testing.""" class FakeCoordinatorEntity(FakeBase): """Fake coordinator ent...
Veldkornet/ha-hyxi-cloud
tests/test_entity.py
.py
db795cd317d78df9
7.07
13
"""Tests for MICRO_INVERTER specific logic and sensors.""" # pylint: disable=missing-module-docstring, wrong-import-position, import-outside-toplevel import logging import sys from typing import Any from unittest.mock import MagicMock import pytest # 1. THE BULLETPROOF MOCK (Copied from test_sensor_logic.py strateg...
Veldkornet/ha-hyxi-cloud
tests/test_micro_inverter.py
.py
c91eb89bf3f5f994
7.07
13
"""Tests for Hyxi Cloud sensor parsers.""" import sys from datetime import UTC, datetime from unittest.mock import MagicMock, patch import pytest # pylint: disable=missing-module-docstring, wrong-import-position, import-outside-toplevel # 1. THE BULLETPROOF MOCK class FakeBase: pass class FakeCoordinatorEnti...
Veldkornet/ha-hyxi-cloud
tests/test_parsers.py
.py
e3f4210491f40455
8.07
13
"""Tests for HYXI Cloud custom services.""" from unittest.mock import AsyncMock, MagicMock, patch import pytest from homeassistant.exceptions import HomeAssistantError from custom_components.hyxi_cloud import ( DOMAIN, async_get_subscription_codes, async_register_subscription_code, async_unload_entry...
Veldkornet/ha-hyxi-cloud
tests/test_services.py
.py
dd7c5e026b35708f
7.07
13
import { describe, expect, it } from "vitest"; import { clampToAvailable } from "./metricInsightsSelect"; /** * The rule three views rely on to keep a metric selection valid. It replaced an * effect that corrected the selection after the fact, so these tests are what * make that rewrite safe. */ describe("clampTo...
IBM/text2sql-eval-toolkit
dashboard/src/lib/metricInsightsSelect.test.ts
.ts
3cca1eb4ac1892f9
7.06
12
import { beforeEach, describe, expect, it, vi } from "vitest"; import { expandUrl, fetchPipelineAliases, looksLikeAlias, resetPipelineAliasCache, shortenUrl, type PipelineAliases, } from "./pipelineAlias"; /** * The alias layer only matters for links that leave the app: it is what makes a * pasted URL s...
IBM/text2sql-eval-toolkit
dashboard/src/lib/pipelineAlias.test.ts
.ts
1a41309a907ab447
7.06
12
import "@testing-library/jest-dom/vitest"; import { cleanup } from "@testing-library/react"; import { afterEach, vi } from "vitest"; // Each test starts from a clean DOM and no leftover fetch stubs; without this, // a component mounted by one test is still in the document during the next. afterEach(() => { cleanup()...
IBM/text2sql-eval-toolkit
dashboard/src/test-setup.ts
.ts
5cb107349666c799
7.06
12
#!/usr/bin/env python # # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ Check that the version agrees with itself everywhere it appears. This exists because it already went wrong once: ``pyproject.toml`` and ``__init__.py`` said 1.1.0 while ``CHANGELOG.md`` documented a 1.2.0 release who...
IBM/text2sql-eval-toolkit
scripts/ci/check_version.py
.py
ead46ca69538a515
7.56
12
#!/usr/bin/env python # # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ Build a tiny, self-contained data root for the end-to-end tests. The real results snapshot is ~4 GB and lives on the Hugging Face Hub, so CI cannot browse it. What the E2E tests actually need is much smaller: a regi...
IBM/text2sql-eval-toolkit
scripts/ci/make_e2e_fixture.py
.py
387462232552b948
7.56
12
#!/usr/bin/env python3 # # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ Script to add unique 'id' fields to JSON objects in an array. Takes a JSON file path as input, adds hash-based IDs to each object, and writes back to the same file with 'id' as the first field. """ import json impor...
IBM/text2sql-eval-toolkit
scripts/curation/add_ids_to_json.py
.py
cd1b2306343ef994
7.56
12
#!/usr/bin/env python3 # # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ Script to execute SQL queries from a JSON file containing records with "sql" fields. Reuses MySQL execution infrastructure from existing predictions runner. """ import argparse import asyncio import importlib import...
IBM/text2sql-eval-toolkit
scripts/curation/beaver_sql_runner.py
.py
ec6a360e4172fe6a
7.56
12
import argparse import os import json import logging import psycopg2 logging.basicConfig(level=logging.INFO, format="[%(levelname)s] %(message)s") logger = logging.getLogger(__name__) def get_primary_keys(cur, table): """ Gets the primary keys for a given table. Args: cur: Postgres cursor. ...
IBM/text2sql-eval-toolkit
scripts/curation/bird_schema_converter_postgres.py
.py
e1a328423ecb2974
7.56
12
# # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # import json import re import sys def uppercase_table_names(json_file_path, output_file_path=None): """ Replace table names in SQL queries with their uppercase versions. Args: json_file_path (str): Path to the input JSON ...
IBM/text2sql-eval-toolkit
scripts/curation/fix_beaver_table_casings.py
.py
bfe2f1c51eeeb2cd
7.56
12
#!/usr/bin/env python3 # # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ SQLAlchemy Schema Extractor This script connects to any SQL database supported by SQLAlchemy and extracts schema information for specified databases, outputting a comprehensive schema.json file. Supports: MySQL, Po...
IBM/text2sql-eval-toolkit
scripts/curation/sqlalchemy_schema_extractor.py
.py
7147097855588046
7.56
12
#!/usr/bin/env python3 """Generate agentic-ci's bundled OpenAI pricing snapshot from LiteLLM.""" import argparse import json import os import re import urllib.parse from pathlib import Path from typing import Any import requests REPO_ROOT = Path(__file__).resolve().parent.parent DEFAULT_OUTPUT = REPO_ROOT / "src" / ...
opendatahub-io/agentic-ci
scripts/update_litellm_cost_map.py
.py
02ffb0d0f144c4fa
7.52
10
"""Abstract base class for sandbox backends.""" from __future__ import annotations import os import subprocess import sys import threading import time from abc import ABC, abstractmethod from pathlib import Path from typing import TYPE_CHECKING from agentic_ci import log from agentic_ci.config import load_config if...
opendatahub-io/agentic-ci
src/agentic_ci/backend.py
.py
701a30c99fcf3ac6
7.52
10
"""Local (direct execution) backend for agentic-ci.""" from __future__ import annotations import os import subprocess from typing import TYPE_CHECKING from agentic_ci import log from agentic_ci.backend import Backend if TYPE_CHECKING: from agentic_ci.harness import Harness class LocalBackend(Backend): """...
opendatahub-io/agentic-ci
src/agentic_ci/backends/local.py
.py
21732212b4a25817
7.52
10
"""OpenShell sandbox backend for agentic-ci.""" from __future__ import annotations import json import os import shlex import shutil import subprocess import tempfile import threading from pathlib import Path from typing import TYPE_CHECKING from agentic_ci import log from agentic_ci.backend import Backend from agent...
opendatahub-io/agentic-ci
src/agentic_ci/backends/openshell/__init__.py
.py
e742d73122252e2f
7.52
10
"""OpenShell gateway lifecycle management.""" import os import re import signal import subprocess import tempfile import time import tenacity from agentic_ci import log GATEWAY_PORT = 17670 _GATEWAY_TOML = """\ [openshell] version = 1 [openshell.gateway] # 0.0.0.0 is required: the sandbox supervisor connects to t...
opendatahub-io/agentic-ci
src/agentic_ci/backends/openshell/gateway.py
.py
b8ca93c718d48a77
7.52
10
"""Policy resolution for OpenShell sandbox.""" import copy import os import yaml from agentic_ci.backends.openshell.provider import PROVIDER_NAME REPO_POLICY_PATH = ".agentic-ci/openshell-policy.yml" # Default network endpoints in openshell policy update format: # host:port:access[:protocol[:enforcement]] # No p...
opendatahub-io/agentic-ci
src/agentic_ci/backends/openshell/policy.py
.py
f16db09fe3516e99
7.52
10
"""OpenShell credential provider setup.""" import json import os import subprocess from collections.abc import Mapping from agentic_ci import log from agentic_ci.gcp import adc_path as _adc_path from agentic_ci.gcp import ensure_adc from agentic_ci.gcp import read_credential_type as _adc_credential_type PROVIDER_NAM...
opendatahub-io/agentic-ci
src/agentic_ci/backends/openshell/provider.py
.py
09f9a7d54f647de0
7.52
10
"""OpenShell sandbox lifecycle management.""" import json import os import subprocess import tempfile import yaml from agentic_ci import log from agentic_ci.backends.openshell.policy import build_credential_binding_patch, resolve_endpoints from agentic_ci.backends.openshell.provider import PROVIDER_NAME SANDBOX_NAM...
opendatahub-io/agentic-ci
src/agentic_ci/backends/openshell/sandbox.py
.py
9ff36178cfb04297
7.52
10
"""Branch resolution for version-aware CI workflows. This module provides functionality to resolve target branches from Jira tickets using fixVersion fields and component configuration overrides. """ from __future__ import annotations import logging from typing import Any from agentic_ci.git import validate_branch_...
opendatahub-io/agentic-ci
src/agentic_ci/branch.py
.py
e5c602ff6c8e9140
7.52
10
"""Project-level configuration for agentic-ci. Loads ``.agentic-ci/config.yml`` from the target repository's workdir. """ from __future__ import annotations import logging import os from dataclasses import dataclass, field import yaml log = logging.getLogger(__name__) REPO_CONFIG_PATH = ".agentic-ci/config.yml" ...
opendatahub-io/agentic-ci
src/agentic_ci/config.py
.py
a1fb9f3ee66a4636
7.52
10
"""Auto-configure podman storage for container-in-container environments. When agentic-ci runs inside a CI container (GitHub Actions, GitLab CI, Prow), the inner podman needs a storage driver compatible with nested execution. Default overlay-on-overlay fails without fuse-overlayfs. This module detects the nested scen...
opendatahub-io/agentic-ci
src/agentic_ci/container.py
.py
574abddba80de677
7.52
10
"""Model pricing helpers for telemetry-derived cost estimates.""" from __future__ import annotations import json import os from collections.abc import Mapping from functools import lru_cache from importlib.resources import files from pathlib import Path from typing import Any _CUSTOM_COST_MAP_ENV = "AGENTIC_CI_LITEL...
opendatahub-io/agentic-ci
src/agentic_ci/cost.py
.py
17d784b742206468
7.52
10
"""Git forge abstraction for GitLab and GitHub. Provides a polymorphic interface for merge/pull request operations, pipeline status checking, and review comment handling. Follows the same ABC pattern as ``agentic_ci.backend`` and ``agentic_ci.harness``. Usage:: from agentic_ci.forge import Forge forge = For...
opendatahub-io/agentic-ci
src/agentic_ci/forge/__init__.py
.py
3a5fa9a31710fffa
7.52
10
"""CLI subcommands for forge operations. Registered as the ``agentic-ci forge`` subcommand group. Usage:: agentic-ci forge mr-status <URL> agentic-ci forge mr-comments <URL> agentic-ci forge mr-general-comments <URL> [--since ISO] agentic-ci forge mr-reply <URL> <thread_id> <message> agentic-ci f...
opendatahub-io/agentic-ci
src/agentic_ci/forge/cli.py
.py
94525da0d66362a4
7.52
10
"""HTTP session and adapter configuration for forge API calls. Provides auth-injecting adapters for GitLab (PRIVATE-TOKEN) and GitHub (Bearer token), plus a pre-configured session with retry logic. """ from __future__ import annotations import logging import os import requests import tenacity from requests.adapters...
opendatahub-io/agentic-ci
src/agentic_ci/forge/session.py
.py
71111ef468d8d333
7.52
10
"""GCP credential resolution for agentic-ci backends. Locates GCP service account or user credentials from environment variables, files, or the default gcloud ADC path. Used by both the Podman and OpenShell backends. """ from __future__ import annotations import base64 import json import os from collections.abc impo...
opendatahub-io/agentic-ci
src/agentic_ci/gcp.py
.py
cf6c8c36259cad2a
7.52
10
"""Atlassian CLI (acli) wrapper for agentic-ci. Downloads the acli binary if not already on PATH, handles authentication, and provides a subprocess runner for acli commands. """ from __future__ import annotations import logging import os import shutil import stat import subprocess log = logging.getLogger(__name__) ...
opendatahub-io/agentic-ci
src/agentic_ci/jira/acli.py
.py
901f5ca819da036c
7.52
10
"""Colored CLI output helpers for agentic-ci.""" import os import sys def _use_color() -> bool: return not os.environ.get("NO_COLOR") and hasattr(sys.stdout, "isatty") and sys.stdout.isatty() def section(msg: str) -> None: """Print a section header: ▶ msg""" if _use_color(): print(f"\033[1;36m▶...
opendatahub-io/agentic-ci
src/agentic_ci/log.py
.py
056a1ad71075eaf2
7.52
10
"""GitLab child pipeline YAML generation. Generates YAML for child pipelines that process one ticket (or work item) per job. The templates are parameterised so any project can use the same slot-distribution and noop-pipeline patterns. """ from __future__ import annotations import hashlib import json import re impor...
opendatahub-io/agentic-ci
src/agentic_ci/pipeline.py
.py
97ea147fbec3b2a8
7.52
10
"""Parse YAML frontmatter from SKILL.md files without requiring pyyaml.""" from __future__ import annotations import logging import re from dataclasses import dataclass, field from pathlib import Path log = logging.getLogger(__name__) _FRONTMATTER_RE = re.compile(r"\A---\n(.*?\n)---\n", re.DOTALL) _KEY_VALUE_RE = r...
opendatahub-io/agentic-ci
src/agentic_ci/skill_metadata.py
.py
5163c120c3a4727b
7.52
10
"""Verdict JSON schema validation and loading. Provides a generic framework for loading and validating structured verdict files produced by AI agent runs. Callers define their own schemas (required fields, allowed verdict values) and this module handles file I/O, JSON parsing, and schema validation. """ from __futur...
opendatahub-io/agentic-ci
src/agentic_ci/verdict.py
.py
6bb7974878f02de2
7.52
10
"""Tests for branch resolution module.""" import subprocess from unittest.mock import patch import pytest from agentic_ci.branch import ( BranchResolutionError, resolve_branch_from_jira, ) from agentic_ci.git import _validate_ref, validate_branch_exists class TestValidateRef: """Test _validate_ref func...
opendatahub-io/agentic-ci
tests/test_branch.py
.py
78a6e41861a3d73a
7.02
10
"""Tests for verdict-path guard on SIGKILL promotion. When an agent is SIGKILL'd but the stream processor detected completion, _process_stream checks whether the verdict file exists before promoting the exit code to 0. If the file is missing, the original exit code is preserved so run_skill does not treat the run as ...
opendatahub-io/agentic-ci
tests/test_completion_validator.py
.py
207b2430770eafa5
7.02
10
#!/usr/bin/env python3 # /// script # requires-python = ">=3.8" # dependencies = [] # /// """Bump the version in pyproject.toml based on semantic versioning.""" import re import sys from pathlib import Path def parse_version(version: str) -> tuple[int, int, int]: """Parse a semantic version string into major, mi...
inspirepan/klaude-code
.claude/skills/publish/scripts/bump_version.py
.py
d3f2dcd4caf25573
7.57
13
#!/usr/bin/env python3 # /// script # requires-python = ">=3.8" # dependencies = [] # /// """Update CHANGELOG.md with commits since the last tag.""" import json import os import re import subprocess import sys from datetime import date from pathlib import Path from typing import cast from urllib.request import Request...
inspirepan/klaude-code
.claude/skills/publish/scripts/update_changelog.py
.py
e1716abd70efac9b
7.57
13
from __future__ import annotations from collections.abc import AsyncGenerator, Awaitable, Callable, Iterable from klaude_code.agent.agent_profile import AgentProfile, ModelProfileProvider from klaude_code.agent.task import SessionContext, TaskExecutionContext, TaskExecutor from klaude_code.llm import LLMClientABC fro...
inspirepan/klaude-code
src/klaude_code/agent/agent.py
.py
7a06e4b39719e3ce
7.57
13
from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Protocol if TYPE_CHECKING: from klaude_code.config.config import Config from klaude_code.agent.attachments.autonomy import autonomy_attachment from klaude_code.agent.attachments.collect...
inspirepan/klaude-code
src/klaude_code/agent/agent_profile.py
.py
37f9c056e51e98ae
7.57
13
"""Agent attachment package. Shared helpers for <system-reminder> content produced by attachments live here. Each concrete attachment (files, memory, skills, …) is responsible for truncating its own output; these helpers provide a consistent Read-tool-style notice so the agent always knows how to fetch the full conten...
inspirepan/klaude-code
src/klaude_code/agent/attachments/__init__.py
.py
27d1ad7389c0d75d
7.57
13
"""Away-summary ("while you were away" recap) generator. Given a session, ask a small/fast LLM for a 1-2 sentence recap of where the user left off. Mirrors `session_title.generate_session_title` in spirit: one-shot non-streaming call, single synthesized user message, no tools. """ from __future__ import annotations ...
inspirepan/klaude-code
src/klaude_code/agent/away_summary.py
.py
043480731e1fc10f
7.57
13
"""Bash-mode execution helpers. This module provides the implementation for running non-interactive shell commands with streaming output to the UI, plus session history recording. """ from __future__ import annotations import asyncio import contextlib import os import secrets import shutil import signal import subpr...
inspirepan/klaude-code
src/klaude_code/agent/bash_mode.py
.py
1f052677a51fba08
7.57
13
"""Cache-safe LLM request construction for forked queries. A forked LLM query (compact, handoff, sub-agent fork_context, etc.) wants to piggy-back on the parent session's server-side prompt cache. The Anthropic API cache key is composed of: - system prompt - tools (schema) - model id - thinking config - messages pref...
inspirepan/klaude-code
src/klaude_code/agent/cache_safe.py
.py
ac94bdea4ea6c807
7.57
13
"""Context-window usage analysis. Produces a single ``ContextUsageUIExtra`` describing how the context window is spent, so the TUI, the web UI, and any future non-interactive caller all read from one computation. What is measured is the *LLM-facing* view (``session.get_llm_history()``), not the raw conversation histo...
inspirepan/klaude-code
src/klaude_code/agent/context_usage.py
.py
873771386b9488fd
7.57
13
"""Prompt-suggestion generator (forked LLM query, cache-shared with main step). After every task finishes, predict what the user might naturally type next. Mirrors claude-code's promptSuggestion service: short single-step LLM call with the main profile's system/tools/model/thinking, so the wire prefix equals the paren...
inspirepan/klaude-code
src/klaude_code/agent/prompt_suggestion/prompt_suggestion.py
.py
757ec78943356d31
7.57
13
"""Summary generation for the user-facing `/rewind` command. Writes the fork-summary request. Two paths: - Cache-sharing fork (preferred): the request wire is the session's FULL LLM-facing history (``get_llm_history()``) plus a trailing instruction message. The prefix is byte-identical to the parent's most recent...
inspirepan/klaude-code
src/klaude_code/agent/rewind/summary.py
.py
6cad248127e94d6c
7.57
13
"""Operation dispatcher: wiring layer that routes operations to handlers.""" from __future__ import annotations import asyncio from collections.abc import Awaitable, Callable from dataclasses import dataclass from typing import Literal from klaude_code.agent.agent import Agent from klaude_code.agent.agent_profile im...
inspirepan/klaude-code
src/klaude_code/agent/runtime/dispatcher.py
.py
93d232797d1e5d2b
7.57
13
"""Sub-agent spawning: each sub-agent runs as a first-class server session. The Agent tool used to execute sub-agents inline inside the parent's task, forwarding child events through the parent's pipeline. Phase 5 routes them through their own session actor instead: the launcher prepares the child session, registers i...
inspirepan/klaude-code
src/klaude_code/agent/runtime/sub_agent.py
.py
81114e5f9570430c
7.57
13
"""`/btw` side question: a single-turn forked query beside the running task. The user asks something while the main agent keeps working. The answer must not change what the main agent sees, so this module only *reads* the session: - The wire prefix is ``session.get_llm_history()`` — the same transform the parent st...
inspirepan/klaude-code
src/klaude_code/agent/side_question.py
.py
7f017f5773439e5e
7.57
13
from __future__ import annotations from collections.abc import Callable from pathlib import Path from typing import TypeVar _T = TypeVar("_T") def _safe_skill_call(fn: Callable[[], _T], default: _T) -> _T: try: return fn() except Exception: return default def get_skill_names_by_location(wo...
inspirepan/klaude-code
src/klaude_code/agent/skill_inventory.py
.py
43b6915f86c12e89
7.57
13
from __future__ import annotations import datetime import shutil from functools import cache from importlib.resources import files from pathlib import Path from klaude_code.const import ProjectPaths, find_git_repo_root, find_jj_workspace_root, project_key_from_path from klaude_code.protocol import llm_param, model_id...
inspirepan/klaude-code
src/klaude_code/agent/system_prompt.py
.py
fb876a4763baf929
7.57
13
"""Local token estimation. There is no token-counting API available here, so token counts are estimated from text. A flat ``chars / 4`` is close enough for English prose but wrong in two ways that matter: - CJK text costs roughly one token per character, so ``chars / 4`` underestimates it ~3x. - Code, JSON, and absol...
inspirepan/klaude-code
src/klaude_code/agent/token_estimate.py
.py
7b672ad5b9215460
7.57
13
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Alembic environment script — async-aware (SQLAlchemy 2.x + asyncpg). The pattern follows the upstream `Alembic async cookbook <https://alembic.sqlalchemy.org/en/latest/cookbook.html#using-asyncio-with-alembic>`_: ``run_migrations_online`` ente...
evoila/meho
backend/alembic/env.py
.py
577755914385c981
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Create the audit_log table. Revision ID: 0001 Revises: Create Date: 2026-05-10 This is the first migration on the schema, landing the v0.1 audit-log shape (Initiative #26, Task #28). Every authenticated request writes one row into this table ...
evoila/meho
backend/alembic/versions/0001_create_audit_log.py
.py
6b83184351395816
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Create the documents table backed by the pgvector extension. Revision ID: 0003 Revises: 0002 Create Date: 2026-05-12 This is the schema foundation of Initiative #225 (G0.4 Retrieval substrate), Task #258 (T1). The migration adds three structu...
evoila/meho
backend/alembic/versions/0003_create_documents_with_pgvector.py
.py
570bd6ad80c82c0c
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Create the ``web_session`` table for BFF session custody. Revision ID: 0013 Revises: 0012 Create Date: 2026-05-22 Initiative #337 (G10.0 Frontend chassis), Task #864 (G10.0-T3). The operator-console is locked to the Backend-for-Frontend (BFF)...
evoila/meho
backend/alembic/versions/0013_create_web_session.py
.py
1b8b4ae5a1aef81e
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Create the ``agent_run`` table for the in-process agent runtime. Revision ID: 0017 Revises: 0016 Create Date: 2026-05-24 This migration is the schema substrate of Initiative #802 (G11.1 Agent runtime), Task #813 (T6). It adds the ``agent_run`...
evoila/meho
backend/alembic/versions/0017_create_agent_run.py
.py
5f1a9e6c9f515fbe
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Create the ``agent_principal`` table for G11.2-T1. Revision ID: 0019 Revises: 0018 Create Date: 2026-05-25 This migration is the schema substrate of Task #815 (G11.2-T1) under Initiative #803 (G11.2 Agent identity + RBAC + approval). It creat...
evoila/meho
backend/alembic/versions/0019_create_agent_principal.py
.py
16c8e399367411bf
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Create the ``approval_request`` table for the durable approval queue. Revision ID: 0023 Revises: 0022 Create Date: 2026-05-25 This migration is the schema substrate of Initiative #803 (G11.2 Agent permission model), Task #817 (T4). It adds th...
evoila/meho
backend/alembic/versions/0023_create_approval_request.py
.py
506dc5b270242caf
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Add ``expires_at`` to ``agent_permission`` for G11.2-T6 grant elevation. Revision ID: 0024 Revises: 0023 Create Date: 2026-05-25 This migration is the schema substrate of Task #819 (G11.2-T6) under Initiative #803 (the P3 agent identity + RBA...
evoila/meho
backend/alembic/versions/0024_add_agent_permission_expires_at.py
.py
39cd1e5d337ab209
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Add ``params`` to ``approval_request`` for direct-op approve re-dispatch. Revision ID: 0036 Revises: 0035 Create Date: 2026-06-04 This migration is the schema substrate of Task #1503 (G0.20-T3) under Initiative #1500 (the v0.10.1 closed-loop ...
evoila/meho
backend/alembic/versions/0036_add_approval_request_params.py
.py
97f6d627c015c434
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Add ``audit_log.work_ref`` for external change-ticket correlation. Revision ID: 0039 Revises: 0038 Create Date: 2026-06-12 Schema keystone of Task #1655 (work_ref I1-T1) under Initiative #1652, Goal #1651. No governed MEHO object can currentl...
evoila/meho
backend/alembic/versions/0039_add_audit_log_work_ref.py
.py
a5f99515477b51df
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Add ``approval_request.work_ref`` for external change-ticket correlation. Revision ID: 0040 Revises: 0039 Create Date: 2026-06-13 Task #1659 (work_ref I2-T1) under Initiative #1653, Goal #1651. A parked approval -- the durable change-authoris...
evoila/meho
backend/alembic/versions/0040_add_approval_request_work_ref.py
.py
84841768859bca86
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Add ``agent_run.work_ref`` for change-ticket correlation of agent runs. Revision ID: 0041 Revises: 0040 Create Date: 2026-06-13 Task #1662 (work_ref I3-T2) under Initiative #1654, Goal #1651. An agent run carries no link to the change ticket ...
evoila/meho
backend/alembic/versions/0041_add_agent_run_work_ref.py
.py
4d3b53ac8122f0cc
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Add ``runbook_runs.work_ref`` for change-ticket correlation of runs. Revision ID: 0042 Revises: 0041 Create Date: 2026-06-13 Task #1661 (work_ref I3-T1) under Initiative #1654, Goal #1651. A runbook run carries no link to the change ticket it...
evoila/meho
backend/alembic/versions/0042_add_runbook_runs_work_ref.py
.py
7fbd6ec99c43208a
7.45
7
# SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2026 evoila Group """Add ``scheduled_trigger.work_ref`` for change-ticket inheritance. Revision ID: 0043 Revises: 0042 Create Date: 2026-06-13 Task #1663 (work_ref I3-T3) under Initiative #1654, Goal #1651. A scheduled trigger -- the authorizing definition for a ...
evoila/meho
backend/alembic/versions/0043_add_scheduled_trigger_work_ref.py
.py
25e84bbf1da6888e
7.45
7
"""Differential noise compensation for JARVIS. A running appliance raises the room's measured ``ambient_db``, which would push the prosody pipeline to project louder than necessary. ``NoiseGate`` checks appliance power signatures (``sensor.<appliance>_power``) and, when one is drawing power, subtracts that appliance's...
sam3gp8/jarvis-aio
custom_components/jarvis/audio/noise_gate.py
.py
e2bacfaf9aefb955
7.5
9
"""Entity concurrency control for JARVIS. ``EntityLockRegistry`` enforces mutual exclusion on hardware entities so two commands can't drive the same device at once, with a priority ladder: a real-time visual-presence command preempts a lower-priority predictive one, while an equal-or-lower priority request is discarde...
sam3gp8/jarvis-aio
custom_components/jarvis/automation/mutex.py
.py
98ae1d0fb4ae0943
7.5
9
""" JARVIS Automation Creator (v5.6.0). Registers a custom HA service + tool that allows JARVIS to create Home Assistant automations from natural language instructions. Usage via conversation: "JARVIS, create an automation that turns off the living room lights at midnight." The LLM generates the automation YAML, thi...
sam3gp8/jarvis-aio
custom_components/jarvis/automation_creator.py
.py
3701b1c433da2beb
7.5
9
"""One-command backup / restore of JARVIS state — memory, patterns, knowledge, and config — so a device re-flash or migration doesn't lose it. Everything JARVIS persists lives under the HA config dir. ``create_backup`` tars it into ``/config/jarvis_backups/`` (download that file before re-flashing); ``restore_backup``...
sam3gp8/jarvis-aio
custom_components/jarvis/backup.py
.py
a4fad0af20a9a836
7.5
9
"""Boot guard primitives for JARVIS. ``AlertBuffer`` holds jarvis.speak requests that arrive before the integration is fully initialised (or during a config-entry reload) and replays them, in order, once readiness is declared. Stdlib-only (asyncio), so it loads and tests without Home Assistant; the dispatch of a buffe...
sam3gp8/jarvis-aio
custom_components/jarvis/boot_guard.py
.py
65ff49bc97ddb836
7.5
9
""" JARVIS — Observer Tier 1: the classifier (v5.7.00). Rule-based classifier handles 95%+ of events with zero API calls. Only genuinely ambiguous events fall through to LLM classification. Previous versions sent every event to Groq (~500 calls/day). Now: Python rules handle obvious cases. LLM fallback for <20/day. "...
sam3gp8/jarvis-aio
custom_components/jarvis/classifier.py
.py
9c11a03386afa94e
7.5
9
""" JARVIS Communication Agent (v6.51.0). The blueprint's "Communication Agent": proactively surface calendar conflicts and upcoming commitments. This module handles calendars only; read-only email access lives in mail.py (v6.81.0) — fetched on request via IMAP and sanitized, superseding the earlier stance that the in...
sam3gp8/jarvis-aio
custom_components/jarvis/comms.py
.py
3862f7e2b5e9915b
7.5
9
""" JARVIS Config Flow. HACS integration: the config flow is the primary setup path. 1. Manual entry of a cloud API key OR a local LLM endpoint (the common case). 2. If /config/jarvis/config.json already exists (a previous install — the panel's runtime config survives integration removal), auto-imports it so ...
sam3gp8/jarvis-aio
custom_components/jarvis/config_flow.py
.py
c8aa5acb414c5250
7.5
9
""" JARVIS Connectivity Circuit Breaker (v5.9.06). Tracks whether the cloud LLM (Groq/Gemini) is reachable so JARVIS can: 1. Avoid wasting 5-10s on doomed network calls when already known-offline. 2. Degrade gracefully to local-only handling during outages. 3. Recover automatically once connectivity returns. Cl...
sam3gp8/jarvis-aio
custom_components/jarvis/connectivity.py
.py
00f5479381fd641e
7.5
9
""" JARVIS — continued conversation / turn-taking (v6.88.0). Natural turn-taking: after JARVIS asks something, keep the satellite listening for the reply without a new wake word. This module decides when a response invites a follow-up (should_continue) and reads the enable flag; conversation.py sets continue_conversat...
sam3gp8/jarvis-aio
custom_components/jarvis/continued_conversation.py
.py
9eff5599fc8e1bbf
7.5
9
"""JARVIS diagnostics layer: infrastructure health triage + fault history. Also provides Home Assistant's config-entry diagnostics entry point (async_get_config_entry_diagnostics) so the "Download diagnostics" button on the integration page produces a useful, credential-redacted dump (v6.70.2). Without this function H...
sam3gp8/jarvis-aio
custom_components/jarvis/diagnostics/__init__.py
.py
d41b054bcf6d0527
7.5
9
""" JARVIS — Prime directive injection helper. Used by every module that builds an LLM system prompt to ensure the unrelenting directive is prepended BEFORE the persona or task-specific instructions. This is the mechanism that makes the directive truly unrelenting: it runs at every LLM call, not just conversation tur...
sam3gp8/jarvis-aio
custom_components/jarvis/directive_helper.py
.py
b74376283cfe1a1e
7.5
9
""" Door open/closed state for the Residence 3D model. Resolves the home's doors into the model's fixed door slots (front · garage · garage_rear · kitchen_garage · cellar · basement). An explicit mapping (slot -> entity_id, configured on the Residence tab) is honoured first and removes all guessing; any slot without a...
sam3gp8/jarvis-aio
custom_components/jarvis/door_state.py
.py
41575d48039f26a9
7.5
9
"""Custom provider + registration example. Implements the ``KnowledgeProvider`` protocol with an in-memory store and registers it under the name ``"static"`` so it can be used by the decorators. """ from __future__ import annotations import azure.functions as func from azure_functions_knowledge import Document, Kno...
yeongseon/azure-functions-knowledge-python
examples/custom_provider.py
.py
434aea07d68d6a15
7.42
6
"""Real-Azure certification app for azure-functions-knowledge. This app exists **only** for the release gate. The ``e2e-azure`` GitHub workflow deploys it to a temporary Azure Functions Consumption (Y1) host, runs ``tests/e2e`` against it, records an ``azure-cert`` artifact, then deletes the resource group. It is del...
yeongseon/azure-functions-knowledge-python
examples/e2e_app/function_app.py
.py
21ff03af9242f994
7.42
6
"""Notion provider options demo. Shows forwarding provider-specific options (``include_content``, ``content_max_chars``, ``max_depth``, ``max_blocks``) through the decorator. """ from __future__ import annotations import azure.functions as func from azure_functions_knowledge import Document, KnowledgeBindings app ...
yeongseon/azure-functions-knowledge-python
examples/notion_options.py
.py
d21e2129a6f4010a
7.42
6
"""Typed cross-package metadata contract for the ``knowledge`` namespace. This module defines the shape of the ``_azure_functions_metadata`` convention attribute that the knowledge decorators attach to Azure Functions handlers. Sibling toolkit packages (``azure-functions-openapi``, validation, logging) read this attri...
yeongseon/azure-functions-knowledge-python
src/azure_functions_knowledge/_metadata.py
.py
47a10696c22be3c7
7.42
6
from __future__ import annotations import os import re from .errors import ConfigurationError _ENV_PATTERN = re.compile(r"%([A-Za-z_][A-Za-z0-9_]*)%") def resolve_connection(value: str) -> str: """Resolve ``%VAR%`` placeholders in *value* with environment variables. Raises :class:`ConfigurationError` when...
yeongseon/azure-functions-knowledge-python
src/azure_functions_knowledge/auth.py
.py
44b7e94a31b3ec8e
7.42
6