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 |
|---|---|---|---|---|---|---|
"""One-off analyzer: compare OAuth Basic header + extract JS bundle across the
Hymer and Eriba EHG XAPKs. Working tool, source/ is gitignored."""
from __future__ import annotations
import base64
import re
import sys
import zipfile
from pathlib import Path
BASE = Path(__file__).resolve().parent
ANDROID = BASE.parent /... | BetaHydri/hymer-connect-ha-ble | tools/analyze_ehg_apk.py | .py | 06b9cfc77709f77f | 7.48 | 8 |
"""Extract EHG component/device identifiers from the Hermes bundles and diff
across app versions/brands to spot newly supported devices or mappings.
Reads the bundles dumped by analyze_ehg_apk.py under
source/androidapp/analysis/<app>/index.android.bundle plus the old app bundle in
_archive_old_app/. source/ is gitign... | BetaHydri/hymer-connect-ha-ble | tools/analyze_ehg_devices.py | .py | 603bbafd5265decb | 7.48 | 8 |
"""Generate gated base.json sensor candidates from tools/ehg_metadata.json.
Phase B (brandless auto-mapping): every EHG appliance is bound to a fixed bus,
so a component mapped once in the universal base.json appears on any brand that
reports it. This tool proposes `sensors` entries for the read-only slots of
document... | BetaHydri/hymer-connect-ha-ble | tools/generate_base_from_metadata.py | .py | dcfe42b66ad5a044 | 7.48 | 8 |
"""Parse the committed EHG metadata Markdown into structured JSON.
`docs/ehg-app-metadata.md` is the human-readable reference extracted from the
decompiled EHG app. It holds:
* a component table (bus -> component_id, kind, name, slot count, mapped?)
* per-component slot tables under "### Bus <n> - ..." headers
... | BetaHydri/hymer-connect-ha-ble | tools/parse_ehg_metadata.py | .py | ddc300a031b9993d | 7.48 | 8 |
#!/usr/bin/env python3
"""Check every connector definition's field names against the live proxy.
The connector proxy builds each command as ``command(**params)``, so a field name
that the connector does not declare is silently never sent -- the profile value
just does not arrive, and the failure surfaces as a confusin... | AOT-Technologies/m8flow | bin/check-connector-fields.py | .py | 9de77c94d6893e03 | 7.42 | 6 |
#!/usr/bin/env python
"""Replace m8flow's copied model files with thin re-export shims.
Background
----------
m8flow used to copy each upstream model file and add its tenant column, which
placed LGPL-2.1 upstream code inside the Apache-2.0 tree. The schema delta now
lives in m8flow_backend/models/tenant_schema.py, wh... | AOT-Technologies/m8flow | bin/generate-model-shims.py | .py | 1a05dd140dd450b9 | 7.42 | 6 |
"""Connectors-tab page helpers (functional "page object").
Mirrors the style of :mod:`helpers.templates`: small functions that drive the
Connectors view and assert on its stable ``data-testid`` locators.
"""
from __future__ import annotations
import re
from typing import Any
from playwright.sync_api import Page, exp... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/helpers/connectors.py | .py | f56c0e384e6e01b6 | 7.92 | 6 |
import logging
from playwright.sync_api import Page, expect, TimeoutError as PlaywrightTimeout
from helpers.config import (
BASE_URL,
API_PREFIX,
DEFAULT_USERNAME,
DEFAULT_PASSWORD,
DEFAULT_TENANT,
SUPER_ADMIN_USERNAME,
SUPER_ADMIN_PASSWORD,
MASTER_REALM_IDENTIFIER,
KC_TIMEOUT,
... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/helpers/login.py | .py | 1662275b5be52fb6 | 7.92 | 6 |
"""Shared helpers for navigating process groups and creating the test group."""
from __future__ import annotations
import logging
import re
from playwright.sync_api import Page, TimeoutError as PlaywrightTimeout
from helpers.config import BASE_URL, ELEMENT_TIMEOUT, PAGE_DATA_TIMEOUT, SHORT_TIMEOUT
from helpers.wait... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/helpers/process_group_setup.py | .py | d6c074e9a0aa9fe6 | 7.92 | 6 |
import pytest
from playwright.sync_api import Page, expect, TimeoutError as PlaywrightTimeout
from helpers.config import BASE_URL, PAGE_DATA_TIMEOUT, ELEMENT_TIMEOUT, SHORT_TIMEOUT
from helpers.waiters import wait_for_app_ready
def navigate_to_templates(page: Page) -> None:
"""Click the Templates nav item and wai... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/helpers/templates.py | .py | ea2e9b55816eccbf | 7.92 | 6 |
from playwright.sync_api import Page, expect
from helpers.config import BASE_URL, PAGE_DATA_TIMEOUT, ELEMENT_TIMEOUT, SHORT_TIMEOUT
from helpers.waiters import wait_for_app_ready
def navigate_to_tenants(page: Page) -> None:
"""Navigate to the tenant management page."""
page.goto(f"{BASE_URL}/tenants")
wai... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/helpers/tenants.py | .py | b85966c78812da81 | 7.92 | 6 |
"""Shared paths under ``test-results`` for screenshots and reports."""
from __future__ import annotations
import hashlib
import os
from pathlib import Path
try:
from slugify import slugify as _slugify
except ImportError: # pragma: no cover
def _slugify(value: str) -> str: # type: ignore[misc]
retu... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/helpers/test_artifacts.py | .py | ba3a336e379a38c4 | 7.92 | 6 |
from playwright.sync_api import Page, expect
from helpers.config import APP_READY_TIMEOUT, PAGE_DATA_TIMEOUT
def wait_for_app_ready(page: Page, timeout: int = APP_READY_TIMEOUT) -> None:
"""Wait until the m8flow app shell has fully loaded.
Checks that both the user-actions menu and the SideNav logo are
r... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/helpers/waiters.py | .py | cde25e1cdcfd1c68 | 7.92 | 6 |
"""Home inbox — tenant-admin vs super-admin header tabs and tenant column.
CHK-01 and CHK-04: tenant-admin session. Super-admin counterparts live in
``roles/test_super_admin_home_tasks.py``.
"""
from __future__ import annotations
import logging
from playwright.sync_api import expect
from helpers.config import ELEME... | AOT-Technologies/m8flow | extensions/m8flow-frontend/test/browser/home/test_home_rbac.py | .py | 75cd6916afb49d76 | 7.92 | 6 |
#!/usr/bin/env python3
"""Compare two LoCoMo benchmark runs side-by-side.
Usage:
python3 benchmarks/compare_runs.py run_a.json run_b.json
python3 benchmarks/compare_runs.py run_a.json.conv0.jsonl run_b.json.conv0.jsonl
Outputs a table comparing overall and per-category metrics, highlighting
improvements and r... | star-ga/mind-mem | benchmarks/compare_runs.py | .py | bef6f9debe2f4549 | 7.6 | 15 |
#!/usr/bin/env python3
"""Cross-Encoder A/B Test — retrieval-level comparison.
Compares retrieval quality with and without cross-encoder reranking on
LoCoMo conv-0. Measures:
- Reciprocal Rank (MRR) of gold-answer keywords in retrieved context
- Rank displacement per question (how many positions the best hit move... | star-ga/mind-mem | benchmarks/crossencoder_ab.py | .py | c4737284c370ada5 | 7.6 | 15 |
#!/usr/bin/env python3
"""BM25F Field Weight Grid Search for mind-mem Recall Engine.
Tests different BM25F field weight combinations against the LoCoMo
retrieval benchmark, recording R@1, R@5, R@10, and MRR for each
combination. Outputs a sorted comparison table and saves results
to benchmarks/grid_search_results.json... | star-ga/mind-mem | benchmarks/grid_search.py | .py | 15705596f4cb7ff8 | 7.6 | 15 |
#!/usr/bin/env python3
"""LongMemEval Benchmark Harness for mind-mem recall engine.
Evaluates mind-mem BM25 recall against the LongMemEval benchmark (ICLR 2025).
Downloads the dataset from HuggingFace, converts chat sessions into mind-mem
block format, runs retrieval queries, and reports Recall@K and MRR metrics
with ... | star-ga/mind-mem | benchmarks/longmemeval_harness.py | .py | c35a5be962bc0bc7 | 7.6 | 15 |
#!/usr/bin/env python3
"""Reproducible NIAH benchmark harness — emits independently-verifiable evidence.
This runs the SAME Needle-In-A-Haystack code the test suite uses (imported from
`tests/test_niah.py`, not reimplemented) and writes a third-party-reproducible
artifact set:
results.jsonl — one line per case (s... | star-ga/mind-mem | benchmarks/repro_niah.py | .py | fa4a03c511ed8ded | 7.6 | 15 |
"""Shared pytest fixtures for mind-mem test suite."""
import os
import shutil
import sqlite3
import stat
import sys
import pytest
# On Windows, pytest's `tmp_path` / `tmp_path_factory` fixtures use
# `shutil.rmtree` for teardown. When a test has opened a SQLite
# connection inside the temp dir (every mind-mem recall... | star-ga/mind-mem | conftest.py | .py | b4b364c71cbe6c16 | 8.1 | 15 |
"""The `gh pr view` fetch shared by Gauntlet campaign deciders."""
from __future__ import annotations
import json
import subprocess
from pathlib import Path
def _detail(exc: Exception) -> str:
"""One failure, described so the message is never EMPTY and always names what went wrong.
ONLY THE TOTAL `except E... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/_gauntlet/gh.py | .py | 2326aeeef44e7081 | 7.64 | 18 |
"""Git ref selection shared by campaign base-fetch operations."""
from __future__ import annotations
import hashlib
import subprocess
from dataclasses import dataclass
@dataclass(frozen=True)
class BaseFetchRefs:
"""The fully qualified refspec and exact local ref for one fetched base."""
refspec: str
l... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/_gauntlet/git_refs.py | .py | 627364fe8806cd36 | 7.64 | 18 |
"""Shared JSONL object reader for Gauntlet campaign stores."""
from __future__ import annotations
import json
from collections.abc import Iterator
from typing import cast
class JsonlError(ValueError):
"""A malformed JSONL record, with its source line number."""
def object_lines(text: str) -> "Iterator[tuple[i... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/_gauntlet/jsonl.py | .py | 0d48c0ab06d1b1fc | 7.64 | 18 |
"""Load sibling Gauntlet scripts whose filenames are not importable module names."""
from __future__ import annotations
import importlib.util
import sys
from pathlib import Path
from types import ModuleType
def load_module_from_path(module_name: str, path: Path, *, register: bool = False) -> ModuleType | None:
... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/_gauntlet/modules.py | .py | f34097e2d9666fdd | 7.64 | 18 |
"""Shared mechanics for Gauntlet's source-mutation test harnesses."""
from __future__ import annotations
import ast
import re
import types
from collections.abc import Callable, Collection
from pathlib import Path
MarkedStatements = dict[str, tuple[str, ast.stmt]]
ErrorFactory = Callable[[str], Exception]
_MARKER_R... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/_gauntlet/mutation.py | .py | 3c686935562fc10c | 7.64 | 18 |
"""Shared dispatch for the two public reviewer entry-point scripts."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
from types import ModuleType
from typing import Protocol, cast
from .modules import load_module_from_path
class _ReviewPassOwner(Protocol):
def add_emit_... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/_gauntlet/review_door.py | .py | 2aa6d80bc95d7461 | 7.64 | 18 |
"""Shared rendering for human-readable Gauntlet state tables."""
from __future__ import annotations
import unicodedata
def _hex_escape(ch: str) -> str:
"""``\\xNN`` for a byte-sized code point, ``\\uNNNN`` above it."""
return f"\\x{ord(ch):02x}" if ord(ch) < 0x100 else f"\\u{ord(ch):04x}"
def escape_cell(... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/_gauntlet/table.py | .py | 0d7dab07f44b0331 | 7.64 | 18 |
#!/usr/bin/env python3
"""Refuse to format a file whose write could land OUTSIDE the worktree.
The cheap CI-fix subagent runs a formatter (`gofmt -w`, …) that writes bytes back through the path it is
given. A formatter writes THROUGH a symlink: point one at a file elsewhere on the machine and the bytes
land there, whi... | lestrrat-ai/claude-code-plugins | plugins/gauntlet/skills/campaign/scripts/format-preflight.py | .py | 3aa9b0cf501b5065 | 7.64 | 18 |
"""LocalChat application entry point.
Production (Docker / Uvicorn)::
uvicorn "app:create_uvicorn_app" --factory --host 0.0.0.0 --port 5000
Development::
python app.py
"""
import os
import socket
import subprocess
import sys
import time
from pathlib import Path
# Add src to path if running from root
sys.... | jwvanderstam/LocalChat | app.py | .py | d59fb03d1daebe09 | 7.42 | 6 |
"""Expand the runtime environment variables a shell would have expanded.
The hardened base image ships no shell, so the previous `sh -c` CMD — and the
`${SERVER_PORT:-5000}` style defaults inside it — cannot run. This does that job
in Python and then `exec`s uvicorn in place, so the server stays PID 1 and
signals reac... | jwvanderstam/LocalChat | docker-entrypoint.py | .py | cd0353e2b2cddeb8 | 7.42 | 6 |
"""
MCP Server Base
===============
Lightweight JSON-RPC 2.0 server base class for LocalChat MCP domain servers.
Each server exposes tools via POST /mcp and a GET /health endpoint.
Protocol:
- tools/list -> {"jsonrpc":"2.0","id":N,"method":"tools/list","params":{}}
- tools/call -> {"jsonrpc":"2.0","id":N,"metho... | jwvanderstam/LocalChat | mcp_servers/base.py | .py | b847c8604b8a77a5 | 7.42 | 6 |
"""Alembic environment — connects to the app's PostgreSQL via src.config."""
from __future__ import annotations
import urllib.parse
from logging.config import fileConfig
from alembic import context
from sqlalchemy import create_engine
alembic_cfg = context.config
if alembic_cfg.config_file_name is not None:
# ... | jwvanderstam/LocalChat | migrations/env.py | .py | 9f28a81d99469163 | 7.42 | 6 |
"""Early additive columns — conversations, documents, conversation_messages.
Adds columns that were introduced during initial feature development:
conversations.document_ids
documents.content_hash, doc_type, chunker_version, local_only
conversation_messages.plan_json
conversations.memory_extracted_at
All stat... | jwvanderstam/LocalChat | migrations/versions/0002_early_additive_columns.py | .py | a665200ffb4a2ed0 | 7.42 | 6 |
"""v1.1/v1.5 documents columns — language, last_ingested_at, source_id.
Adds:
documents.language (v1.1 — multilingual detection)
documents.last_ingested_at (v1.1 — scheduled re-ingest tracking) + backfill
documents.source_id (v1.5 — multi-source connector ID) + index
All statements are idempotent (IF NOT EXISTS... | jwvanderstam/LocalChat | migrations/versions/0004_documents_language_ingest_source.py | .py | ea3e620506edbf5c | 7.42 | 6 |
"""CW-1: soft-delete columns for documents and document_chunks.
Adds:
documents.deleted_at (TIMESTAMPTZ) — set on soft-delete; NULL = live
documents.deleted_by (UUID FK → users.id) — who triggered the retirement
document_chunks.deleted_at (TIMESTAMPTZ) — reserved for per-chunk retirement
All statements are ... | jwvanderstam/LocalChat | migrations/versions/0005_document_soft_delete.py | .py | 866b563b4be86fae | 7.42 | 6 |
"""CW-2a: soft-delete columns for conversations.
Adds:
conversations.deleted_at (TIMESTAMPTZ) — set on soft-delete; NULL = live
conversations.deleted_by (UUID FK → users.id) — who triggered the retirement
All statements are idempotent (IF NOT EXISTS).
Revision ID: 0006
Revises: 0005
Create Date: 2026-06-28
"""... | jwvanderstam/LocalChat | migrations/versions/0006_cw2a_conversations_soft_delete.py | .py | c8a7136b9ba83761 | 7.42 | 6 |
"""CW-2b: soft-delete columns for users.
Adds:
users.deleted_at (TIMESTAMPTZ) — set on soft-delete; NULL = live
users.deleted_by (UUID FK → users.id, self-referential) — admin who retired the account
All statements are idempotent (IF NOT EXISTS).
Revision ID: 0007
Revises: 0006
Create Date: 2026-06-28
"""
from... | jwvanderstam/LocalChat | migrations/versions/0007_cw2b_users_soft_delete.py | .py | dbdedf4f20b68d4c | 7.42 | 6 |
"""Enforce one live document per (filename, workspace_id).
document_exists() previously ignored workspace_id entirely, so two
workspaces uploading a same-named file could read and soft-delete each
other's document. Now that the read is workspace-scoped, this migration
closes the other half: nothing previously stopped ... | jwvanderstam/LocalChat | migrations/versions/0013_documents_unique_filename_workspace.py | .py | c4945077e5f7bac8 | 7.42 | 6 |
"""RBAC-1 prerequisite: backfill workspace_members so nobody is locked out.
Membership was never written on the creation path, so on an existing instance no
user is a member of any workspace. Once RBAC-1 enforces membership, that state
denies everyone everything. This backfill establishes the starting membership.
Two... | jwvanderstam/LocalChat | migrations/versions/0014_rbac1_backfill_workspace_members.py | .py | 97741a47ded07a4c | 7.42 | 6 |
"""Workspace API keys — programmatic access to one workspace, no user attached."""
from alembic import op
revision = "0015"
down_revision = "0014"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.execute("""
CREATE TABLE IF NOT EXISTS workspace_api_keys (
id UUID PRI... | jwvanderstam/LocalChat | migrations/versions/0015_workspace_api_keys.py | .py | 04c65fb84b67e6a5 | 7.42 | 6 |
"""PERF-2 — measure /api/chat under concurrent SSE load.
PERF-1's defect (sync retrieval inline on the event loop, so one slow query stalled
every other request) survived for months because nothing ever measured behaviour with
more than one client. A single-user stopwatch cannot see it: the request that blocks
the loo... | jwvanderstam/LocalChat | scripts/bench_concurrency.py | .py | 5f26c280f5318fab | 7.42 | 6 |
"""DEL-2 — measure retrieval quality against a fixed set of question/source pairs.
The ticket asks whether GraphRAG's 1-hop expansion earns its place. That is not
a question inspection can answer, and it is not a question a single anecdote can
answer either: it needs the same questions asked of the same corpus with th... | jwvanderstam/LocalChat | scripts/eval_retrieval.py | .py | afbb89914070c5cb | 7.42 | 6 |
"""TQ-3 — the nightly mutation gate.
Runs `mutmut` over the isolation-critical modules and fails when a module's kill
rate falls under the agreed threshold. Coverage says a line executed; this says
something asserted its behaviour.
Scoped ruthlessly on purpose. A whole-repo run is hours, and the modules here are
wher... | jwvanderstam/LocalChat | scripts/mutation_gate.py | .py | 78347147205704e8 | 7.42 | 6 |
"""
Model Registry
==============
Maps logical model classes (FAST, BASE, LARGE, CODE, VISION) to concrete
Ollama model IDs and request parameters.
Model IDs are read from environment variables at import time. An empty
model_id means "use the user-selected active model" — the registry never
overrides unless a specif... | jwvanderstam/LocalChat | src/agent/models.py | .py | 2c179d7165c8298e | 7.42 | 6 |
"""
Agent Result Types
==================
Data classes for the output of AggregatorAgent.run(). Kept in a
separate module so they can be imported without pulling in the full
agent machinery (useful in tests and type annotations).
"""
from __future__ import annotations
from dataclasses import dataclass, field
@dat... | jwvanderstam/LocalChat | src/agent/result.py | .py | 3e32229d3c8e8378 | 7.42 | 6 |
"""
Base Connector Interface
========================
All live-sync connectors implement ``BaseConnector``. The interface is
intentionally synchronous so connectors can run inside a normal thread
pool without requiring an async event loop in the main application process.
"""
from __future__ import annotations
impor... | jwvanderstam/LocalChat | src/connectors/base.py | .py | 78ae1704b1073d67 | 7.42 | 6 |
#!/usr/bin/env python3
"""Check OpenAPI spec for breaking changes using oasdiff.
This script compares two OpenAPI specs and detects breaking changes,
returning structured JSON output for consumption by CI or local tooling.
Usage:
./check-breaking-changes.py --base devel --head HEAD
./check-breaking-changes.py... | syntara-orchestration/syntara | backend/scripts/openapi/check-breaking-changes.py | .py | a9f31106d8c0df84 | 7.48 | 8 |
#!/usr/bin/env python3
"""Post or update GitHub PR comment for breaking changes check results.
This script formats the breaking changes check results and posts/updates
a PR comment using the GitHub API via gh CLI.
Usage:
./post-breaking-changes-comment.py --results results.json --pr-number 123
./post-breaking... | syntara-orchestration/syntara | backend/scripts/openapi/post-breaking-changes-comment.py | .py | e1bc1921b81965e5 | 7.48 | 8 |
#!/usr/bin/env python3
"""Post or update GitHub PR comment for contract regeneration check results.
This script formats the contract check results and posts/updates
a PR comment using the GitHub API via gh CLI.
Usage:
./post-contract-regeneration-comment.py --results results.json --pr-number 123
./post-contra... | syntara-orchestration/syntara | backend/scripts/openapi/post-contract-regeneration-comment.py | .py | a7c9a1ad952b66f3 | 7.48 | 8 |
import pytest
from unittest.mock import MagicMock
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntry
from custom_components.power_max_tracker.coordinator import PowerMaxCoordinator
from custom_components.power_max_tracker.const import (
CONF_SOURCE_SENSOR,
CONF_M... | perosb/power_max_tracker | conftest.py | .py | 81aa51d19b6e1232 | 8.16 | 20 |
import uuid
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.helpers import selector
from .const import (
DOMAIN,
CONF_SOURCE_SENSOR,
CONF_MONTHLY_RESET,
CONF_NUM_MAX_VALUES,
CONF_BINARY_SENSOR,
CONF_PRICE_PER_KW,
CONF_POWER_SCALING_FACTOR,
CONF_START_... | perosb/power_max_tracker | custom_components/power_max_tracker/config_flow.py | .py | d9858b32f2effe03 | 7.66 | 20 |
"""Tests for PowerMaxTracker config flow.
Note: These tests require a full Home Assistant development environment with all dependencies.
They will fail when run in a standalone environment without HA installed.
"""
import pytest
from unittest.mock import MagicMock, AsyncMock, patch
from homeassistant.core import Hom... | perosb/power_max_tracker | custom_components/power_max_tracker/tests/test_config_flow.py | .py | b89ac3d4bad5849c | 7.16 | 20 |
"""Tests for PowerMaxCoordinator helper methods."""
import pytest
from datetime import datetime
from unittest.mock import MagicMock
# Test the helper method logic without importing the full coordinator
# We'll simulate the helper methods here for testing
def watts_to_kilowatts(watts: float) -> float:
"""Convert... | perosb/power_max_tracker | custom_components/power_max_tracker/tests/test_coordinator_helpers.py | .py | 589b66624cf62113 | 8.16 | 20 |
"""Tests for PowerMaxTracker __init__.py services.
Note: These tests require a full Home Assistant development environment with all dependencies.
They will fail when run in a standalone environment without HA installed.
"""
import pytest
from unittest.mock import MagicMock, AsyncMock, patch
from homeassistant.const ... | perosb/power_max_tracker | custom_components/power_max_tracker/tests/test_init.py | .py | 666ee7e6684057aa | 8.16 | 20 |
#!/usr/bin/env python3
"""Generate Claude-native subagent type definitions from the models.conf catalog.
`CFG_NATIVE_AGENT_CATALOG` (adapters/claude/config/models.conf) maps each native
subagent type to one portable execution profile. This generator resolves every
profile through `utilities/model_profile.py` and write... | dmlguq456/hearting | adapters/claude/bin/sync-native-agents.py | .py | f7d8daf7e7e52cf3 | 7.45 | 7 |
#!/usr/bin/env python3
"""Generate the Claude-native plugin projection for the portable harness.
Claude is the native runtime — skills/agents live at the repo-root SoT
directly (`adapters/claude/skills/`, `adapters/claude/agents/`), unlike
Codex which needs a sync-native-skills generator first. This is the
*first* Cla... | dmlguq456/hearting | adapters/claude/bin/sync-native-plugin.py | .py | 58147b4b43d922ba | 7.45 | 7 |
import logging
from collections import deque
from datetime import datetime
from typing import Dict, Any, List, Optional
from loguru import logger
# Ring buffer for retaining recent Cloud Run / backend logs for UI diagnostics
DIAGNOSTIC_LOG_BUFFER: deque = deque(maxlen=1500)
# Structured storage for individual turn la... | manishkjs/gemini_live_pipecat | server/diagnostic_buffer.py | .py | 8f1e5d4a50ce8b51 | 7.57 | 13 |
from loguru import logger
from pipecat.processors.frame_processor import FrameProcessor, FrameDirection
from pipecat.frames.frames import (
Frame,
TextFrame,
InterruptionFrame,
LLMMessagesAppendFrame,
LLMFullResponseEndFrame,
TranscriptionFrame,
)
class RepeatOnInterruptionProcessor(FrameProce... | manishkjs/gemini_live_pipecat | server/processors/repeat_on_interruption.py | .py | e52db082483f26f7 | 7.57 | 13 |
import asyncio
import os
import re
from loguru import logger
from pipecat.services.llm_service import FunctionCallParams
from pipecat.adapters.schemas.function_schema import FunctionSchema
try:
import vertexai
from vertexai.preview import rag
except ImportError:
vertexai = None
rag = None
import google.... | manishkjs/gemini_live_pipecat | server/rag_function.py | .py | 828c5819e38cc950 | 7.57 | 13 |
import unittest
import os
import sys
server_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if server_dir not in sys.path:
sys.path.insert(0, server_dir)
from agent import validate_stt_model, validate_llm_model, validate_tts_model
class TestModelRouting(unittest.TestCase):
def test_stt_mod... | manishkjs/gemini_live_pipecat | server/tests/test_model_routing.py | .py | c0e0633aa56033df | 7.07 | 13 |
"""tasks:// adapter — reference example of a third-party reveal plugin.
Demonstrates the plugin discovery mechanism (BACK-256): dropped into
<project>/.reveal/adapters/tasks/, this package is auto-discovered on `cd`
into the project, no installation or reveal-core changes required. See this
example's README.md for a w... | Semantic-Infrastructure-Lab/reveal | examples/plugin-adapters/tasks-adapter/.reveal/adapters/tasks/adapter.py | .py | f78361af30de566b | 7.52 | 10 |
"""File analysis and structure extraction for AST adapter."""
import builtins as _builtins_module
import os
import sys
from pathlib import Path
from typing import Dict, List, Any, Optional
from ...utils.path_utils import is_skippable_dir
from .call_graph import build_symbol_map, resolve_callees
# All public names i... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/analysis.py | .py | 81c6965a6b9295ae | 7.52 | 10 |
"""Cross-file call graph resolution for the AST adapter (Phase 3).
Given a function's raw `calls` list (bare names like ["validate_item", "db.insert"]),
and the import map for the file, resolves entries to their source files where possible.
Keeps `calls` as List[str] (backward-compat) and adds `resolved_calls` as Lis... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/call_graph.py | .py | dbfb28ad329128cc | 7.52 | 10 |
"""Filter matching logic for AST adapter."""
import re
from fnmatch import fnmatch
from typing import Dict, List, Any, Set
from ...utils.query import compare_values
# Filter keys `matches_filters` special-cases (mapped to a differently-named
# or derived element field, not a literal dict key) — always valid filter
# ... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/filtering.py | .py | 56e0b4044a692163 | 7.52 | 10 |
from typing import Any, Callable, Dict, List, Optional
from .nav_exits import collect_deps
from .nav_effects import (
collect_effects,
collect_effects_transitive,
format_effect_target,
render_effects_transitive,
)
_PHP_SUPERGLOBALS = frozenset({
'$_GET', '$_POST', '$_SESSION', '$_SERVER', '$_FILE... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_boundary.py | .py | 1d82d8a0250cb201 | 7.52 | 10 |
"""Tree-sitter contract extraction for C++ — abstract classes and their subclasses.
BACK-403 pt 2 (contracts breadth). C++ has no `interface` keyword; the idiomatic
contract is an **abstract class** — a `class`/`struct` with at least one *pure
virtual* method (`virtual T f() = 0;`). Implementors are declared **explici... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_contracts_cpp.py | .py | 6f4b94d1a14e01ad | 7.52 | 10 |
"""Tree-sitter contract extraction for Go — interfaces and their implementers.
BACK-403 pt 2 (contracts breadth). Go's contract construct is the **interface**
(`type Foo interface { ... }`), the public-API / moat surface a DD read wants.
Two things make Go need its own scanner rather than the shared
`_scan_contracts_t... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_contracts_go.py | .py | 1d0c8182efaab3eb | 7.52 | 10 |
"""Tree-sitter contract extraction for Rust — traits and their implementors.
BACK-403 pt 2 (contracts breadth). Rust's contract construct is the **trait**
(`trait Foo { ... }`); a type satisfies it through an **explicit** `impl Foo for
Bar` block — so, unlike Go's implicit method-set satisfaction, implementors are
*de... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_contracts_rust.py | .py | 6faecd11b83da143 | 7.52 | 10 |
"""Loop-focused navigation: collect_loops (--loopmap), collect_fanout (--fanout).
BACK-439b: agents routinely need "which loops exist, what do they iterate,
and which side effects happen inside them" for N+1 database checks, per-item
HTTP calls, filesystem fan-out, and retry-safety review. The raw facts
already exist ... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_loops.py | .py | 0ecfa23f4744924f | 7.52 | 10 |
"""Persistent/shared-state mutation surface: collect_statewrites (--statewrites).
BACK-439c: --mutations is local-variable/refactor oriented (read-after-write
hazards); --sideeffects is call-oriented. Neither answers "what shared state
does this code mutate" — dogfood-confirmed blind spot on
GitRefResource._parse_and_... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_statewrites.py | .py | 88eba68fef4a0645 | 7.52 | 10 |
"""Tree-sitter surface extraction for C++ — env vars, FS writes, HTTP routes, CLI, includes.
BACK-403 pt 2 (surface breadth). C++ has no single dominant web framework, so
route coverage is the two most common shapes, both leading-`/` guarded:
- **cpp-httplib**: `svr.Get("/path", handler)` — a `field_expression` call ... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_surface_cpp.py | .py | 0b306f58d1baa76c | 7.52 | 10 |
"""Tree-sitter surface extraction for C# — env vars, FS writes, HTTP routes, CLI, imports.
BACK-403 pt 2. Mirrors nav_surface_java.py's shape: attributes for ASP.NET Core
HTTP routes, `Environment.GetEnvironmentVariable` for env access,
`static void/int Main` for the CLI entrypoint, and using-root taxonomy for
network... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_surface_csharp.py | .py | 3a8f4049c2d224dc | 7.52 | 10 |
"""Tree-sitter surface extraction for Go — env vars, FS writes, HTTP routes, CLI, imports.
BACK-403 pt 2 (surface breadth). Mirrors nav_surface_java.py's categorised-dict
shape but walks Go's grammar:
- **HTTP routes** for the dominant Go routers, all of which express a route as a
method call whose selector field i... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_surface_go.py | .py | d28bbaeb77932004 | 7.52 | 10 |
"""Tree-sitter surface extraction for PHP — env vars, HTTP routes, imports.
BACK-403 pt 2 (surface breadth). Mirrors nav_surface_java.py's categorised-dict
shape but walks PHP's grammar for the three dominant web frameworks:
- **Laravel** routes: ``Route::get('/path', ...)`` — a ``scoped_call_expression``
whose rec... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/nav_surface_php.py | .py | 211cc56a02cf2601 | 7.52 | 10 |
"""Query parsing and formatting for AST adapter."""
from typing import Dict, Any
from ...utils.query import parse_query_filters
def parse_equality_value(key: str, value: str) -> Dict[str, Any]:
"""Parse equality parameter value based on content.
Args:
key: Parameter key (e.g., 'type', 'name')
... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/queries.py | .py | c4f5128455c2ad50 | 7.52 | 10 |
"""Rendering for AST query adapter."""
import sys
class AstRenderer:
"""Renderer for AST query results."""
@staticmethod
def render_structure(result: dict, format: str = 'text') -> None:
"""Render AST query results.
Args:
result: Query result dict from AstAdapter.get_structu... | Semantic-Infrastructure-Lab/reveal | reveal/adapters/ast/renderer.py | .py | d6c97d38227de58e | 7.52 | 10 |
"""hermes-talk — OpenAI Realtime speech-to-speech voice for Hermes Agent.
``register(ctx)`` wires five surfaces: the ``hermes talk`` CLI command, the
``/talk`` slash command, lifecycle hooks (session end plus the v0.6
subagent start/stop pair that powers push-based run control), and (when the
host exposes the provider... | TheSmokeDev/hermes-talk | __init__.py | .py | fba3a37d91884ece | 7.66 | 20 |
"""OpenAI Platform auth resolution with Codex OAuth fallback.
Port of the proven Talk Mode auth ordering (itself a port of OpenClaw
PR #100671, "Reuse Codex OAuth for OpenAI Realtime voice"). Resolution
order, fail-closed at every step:
1. ``TALK_OPENAI_API_KEY`` — a Talk-scoped configured key. Present but
blank f... | TheSmokeDev/hermes-talk | talk_auth.py | .py | 1a92b28311227042 | 7.66 | 20 |
"""Live capability catalog — what this Hermes session can ACTUALLY do.
Talk could always describe itself; it could never check. Asked "what can you
do right now?" the model either recited its system prompt or spent a whole
delegated agent turn finding out. This module is the third answer: a bounded,
read-only snapshot... | TheSmokeDev/hermes-talk | talk_capabilities.py | .py | fe1c867650e1bf7e | 7.66 | 20 |
"""Transport-neutral admission primitives for canonical Talk sessions."""
from __future__ import annotations
import asyncio
import uuid
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any
try:
from . import talk_config, talk_core_realtime
except ImportError: # pragma: n... | TheSmokeDev/hermes-talk | talk_core_session.py | .py | e76f486eb148407e | 7.66 | 20 |
"""Realtime session instructions — the voice preamble and identity assembly.
A Realtime session prompt is re-read on EVERY turn, so the per-section caps
here are a budget, not a preference. The preamble is the behavioural contract
and always ships; host identity sections are optional and additive.
Fail-open is the ru... | TheSmokeDev/hermes-talk | talk_identity.py | .py | 91d37a87dd17710b | 7.66 | 20 |
"""Subagent lifecycle — push-based, from the host's own hook bus.
v0.5 learned that a child was gone by PULLING: ``degrade_gone_children()``
sweeps the delegation registry at ``check_work`` time, so a finished child
went unnoticed until the operator next asked. The 0.20 host fires
``subagent_start`` / ``subagent_stop`... | TheSmokeDev/hermes-talk | talk_lifecycle.py | .py | 618dfe512cea1602 | 7.66 | 20 |
"""OpenAI TTS and transcription providers for Hermes's pluggable backends.
Bonus surface, not the point of this plugin: hermes-talk already resolves an
OpenAI Platform key, so it can also service Hermes's turn-based speech hooks.
The ABCs are imported defensively — the plugin must import and test green on a
machine wi... | TheSmokeDev/hermes-talk | talk_providers.py | .py | 1a146de047d68dc3 | 7.66 | 20 |
"""Vault recall — the durable-notes lookup a voice session can actually make.
Hermes's memory PROVIDERS publish a system-prompt block that tells the model
which tools to call (``homie_memory_search``, ``homie_memory_context``, …).
Those tools exist in a text agent's registry and **not** in a Realtime
session's, so pas... | TheSmokeDev/hermes-talk | talk_vault.py | .py | 7016e83fecee68d5 | 7.66 | 20 |
"""Pure OpenAI Realtime wire layer — session payloads and ephemeral mints.
Ported from a prior proven Talk Mode implementation.
This module knows the OpenAI Realtime wire format and NOTHING about the
host: no Hermes imports, no identity assembly, no tool handlers. Callers
pass instructions, tools, and an auth token in... | TheSmokeDev/hermes-talk | talk_wire.py | .py | 1fd3df594eeb6d13 | 7.66 | 20 |
"""Shared suite plumbing."""
from __future__ import annotations
import pytest
@pytest.fixture(autouse=True)
def _ephemeral_runs_optin(monkeypatch):
"""The suite's EXPLICIT opt-in to non-durable run acceptance.
The run-history tee is inert under pytest by design (see
``talk_runs._history_enabled``), and... | TheSmokeDev/hermes-talk | tests/conftest.py | .py | 880d6eb3b186a9ab | 7.16 | 20 |
"""Load adversarial test payloads from ``tests/fixtures/``.
The strings these helpers return are attack-shaped bytes — injection text,
destructive commands, dummy credentials — quoted by the containment and
redaction tests to prove those protections hold against the real thing.
They live in ``.fixture`` files because ... | TheSmokeDev/hermes-talk | tests/fixture_data.py | .py | 20588dd33a2084bc | 8.16 | 20 |
"""Dashboard manifest — the host reads this, so a typo is a silent dead tab.
``_discover_dashboard_plugins`` swallows a bad manifest with a log warning and
moves on, and ``serve_plugin_asset`` 404s a missing entry file. Neither failure
reaches the operator as anything but an empty tab, so the shape is asserted
here in... | TheSmokeDev/hermes-talk | tests/test_dashboard_manifest.py | .py | 73eb557926c97ee8 | 8.16 | 20 |
"""Helpers for lazy public exports and optional dependency errors."""
from __future__ import annotations
from collections.abc import Mapping
from importlib import import_module
from typing import Final, NoReturn
LazyExports = Mapping[str, tuple[str, str]]
# Top-level import names installed by each optional extra's ... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/_imports.py | .py | cf85b9a6623b5fb9 | 7.45 | 7 |
"""Clipboard support for interactive CLI flows.
Uses a local tool when one can serve the session; otherwise OSC 52 so the
terminal sets the clipboard even over SSH and tmux.
"""
from __future__ import annotations
import base64
import os
import platform
import shutil
import subprocess
import sys
_LOCAL_TOOL_TIMEOUT ... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/clipboard.py | .py | 4816380a1821793b | 7.45 | 7 |
"""Benchmark catalog and run management commands."""
from __future__ import annotations
from pathlib import Path
import typer
from osmosis_ai.cli.options import (
all_option,
cursor_option,
limit_option,
log_limit_option,
)
from osmosis_ai.cli.output import CommandResult
app: typer.Typer = typer.Ty... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/benchmark.py | .py | 29ded4fa8fbc029d | 7.45 | 7 |
"""Dataset management commands (thin shell delegating to platform/cli/dataset.py)."""
from __future__ import annotations
import typer
from osmosis_ai.cli.options import (
all_option,
cursor_option,
limit_option,
log_limit_option,
)
from osmosis_ai.cli.output import CommandResult
app: typer.Typer = t... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/dataset.py | .py | f3e9b1608dfaf8c1 | 7.45 | 7 |
from __future__ import annotations
from typing import NoReturn
import typer
from osmosis_ai.cli.options import all_option, limit_option
from osmosis_ai.cli.output import CommandResult
from osmosis_ai.platform.constants import MAX_LOG_PAGE_SIZE
app: typer.Typer = typer.Typer(
help="Manage a remote rollout server... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/dev/server.py | .py | c1a74d3b6b73295b | 7.45 | 7 |
"""Model management commands (thin shell delegating to platform/cli/model.py).
Models cover both base (foundation) models and LoRA models produced by
training runs:
osmosis model list -> GET /api/cli/models/base + /api/cli/models/lora
osmosis model info <lora-model> -> GET /api/... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/model.py | .py | 8b794386dfa3d2c7 | 7.45 | 7 |
"""Rollout commands: list."""
from __future__ import annotations
from typing import Annotated
import typer
from osmosis_ai.cli.options import all_option, limit_option
from osmosis_ai.cli.output import CommandResult
app: typer.Typer = typer.Typer(
help="Manage rollouts (init, list).",
no_args_is_help=True,
... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/rollout.py | .py | 056baecc3474ef3c | 7.45 | 7 |
"""Secret management commands.
``osmosis secret`` manages secrets — the same records referenced by the
``[secrets]`` section in submit configs. Evaluation configs must include
this section; default OpenAI eval configs should include ``OPENAI_API_KEY`` and
use ``required = []`` only when no secret refs are needed. Trai... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/secret.py | .py | dd64bebc52d555c4 | 7.45 | 7 |
"""``osmosis template`` command shell.
Thin Typer wrapper that delegates to :mod:`osmosis_ai.templates.cli`. Heavy
imports stay inside the command bodies per the CLI lazy-loading contract.
"""
from __future__ import annotations
from typing import Any
import typer
from osmosis_ai.cli.output import CommandResult
ap... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/template.py | .py | db24a83362cef1a7 | 7.45 | 7 |
"""Training run management commands (thin shells delegating to platform/cli/train.py)."""
from __future__ import annotations
from pathlib import Path
import typer
from osmosis_ai.cli.options import (
all_option,
cursor_option,
limit_option,
log_limit_option,
)
from osmosis_ai.cli.output import Comma... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/commands/train.py | .py | b27d226e6a900efc | 7.45 | 7 |
"""Console output facade with Rich and output-context aware rendering.
Rich automatically strips ANSI control codes when output is not directed
to a terminal (e.g., piped to a file), and respects the NO_COLOR
environment variable.
Rich is imported on first use in rich mode so ``--json`` / ``--plain``
paths can import... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/console.py | .py | 0f14d28dd7464b09 | 7.45 | 7 |
from __future__ import annotations
from collections.abc import Mapping
from enum import StrEnum
from typing import Any
class CLIErrorCode(StrEnum):
"""Public CLI error codes in JSON error envelopes and ``CLIError.code``."""
VALIDATION = "VALIDATION"
AUTH_REQUIRED = "AUTH_REQUIRED"
NOT_FOUND = "NOT_F... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/errors.py | .py | 310f9b5c16431350 | 7.45 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.