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 |
|---|---|---|---|---|---|---|
# Erwin Lejeune - 2026-02-18
"""Derivative-free policy optimisers.
Two are provided, both pure NumPy:
:class:`AugmentedRandomSearch`
Finite-difference gradient ascent with antithetic sampling and top-k
direction selection. This is the default. Reference: H. Mania,
A. Guy, B. Recht, "Simple random search p... | guilyx/flybots | src/flybots/gym/optimizers.py | .py | 9e21b6aabc9c9319 | 7.52 | 10 |
"""Fixtures for local live-backend integration tests.
These tests intentionally reuse the developer's existing Router-Maestro
configuration and GitHub Copilot auth files. They are outside the default
pytest tree and are only run with ``uv run pytest integration_tests/ -v``.
"""
from __future__ import annotations
imp... | MadSkittles/Router-Maestro | integration_tests/conftest.py | .py | dc15f522affa3ee0 | 7.13 | 17 |
"""Live service discovery and authenticated model-list checks."""
from __future__ import annotations
from typing import Any
import httpx
from integration_tests.conftest import assert_http_success
def test_public_health_endpoints(live_server):
"""The local service should start and expose public health metadata... | MadSkittles/Router-Maestro | integration_tests/test_live_discovery_and_auth.py | .py | 6190148f66cc4fa8 | 8.13 | 17 |
"""Live coverage for the codebase-review bug fixes.
These exercise the externally observable behaviours of the fixes against the
real GitHub Copilot backend:
* ``tool_choice`` translation (Anthropic ``any`` / OpenAI ``required``) — must
actually force a tool call rather than silently degrading to ``None``.
* Thinki... | MadSkittles/Router-Maestro | integration_tests/test_live_review_fixes.py | .py | f292c3522199ae3f | 8.13 | 17 |
#!/usr/bin/env python3
"""Probe Copilot Anthropic models for actual wire-level behavior.
Directly calls the Copilot /v1/messages endpoint for each Claude model to discover:
1. Which thinking shapes are accepted (enabled / adaptive / disabled)
2. Which effort values are accepted (low / medium / high / xhigh / max)
... | MadSkittles/Router-Maestro | scripts/probe_model_profiles.py | .py | c1a4d363163f6ea1 | 7.63 | 17 |
#!/usr/bin/env python3
"""Diagnostic script: test tool_choice support across Copilot API and Router-Maestro.
Tests whether GitHub Copilot API properly handles various tool_choice formats
by sending identical requests directly to Copilot and via Router-Maestro proxy.
Usage:
uv run python scripts/test_tool_choice.p... | MadSkittles/Router-Maestro | scripts/test_tool_choice.py | .py | f1e4f18ffc6e9328 | 8.13 | 17 |
"""Shared definitions for provider authentication discovery."""
from __future__ import annotations
from collections.abc import Mapping
from dataclasses import dataclass
from enum import StrEnum
from typing import Any
from router_maestro.auth.storage import AuthType
from router_maestro.config.providers import Provide... | MadSkittles/Router-Maestro | src/router_maestro/auth/discovery.py | .py | 91bbcf2641efe35e | 7.63 | 17 |
"""GitHub OAuth Device Flow implementation for Copilot."""
import time
from dataclasses import dataclass
import httpx
# GitHub OAuth constants (from copilot-api)
GITHUB_CLIENT_ID = "Iv1.b507a08c87ecfe98"
GITHUB_DEVICE_CODE_URL = "https://github.com/login/device/code"
GITHUB_ACCESS_TOKEN_URL = "https://github.com/log... | MadSkittles/Router-Maestro | src/router_maestro/auth/github_oauth.py | .py | f21ed2778f73e977 | 7.63 | 17 |
"""Authentication manager for all providers."""
import asyncio
import httpx
from rich.console import Console
from router_maestro.auth.github_oauth import (
GitHubOAuthError,
get_copilot_token,
poll_access_token,
request_device_code,
)
from router_maestro.auth.repository import CredentialRepository
fr... | MadSkittles/Router-Maestro | src/router_maestro/auth/manager.py | .py | d6483e46b7aee363 | 7.63 | 17 |
"""Atomic, single-provider credential persistence."""
from __future__ import annotations
import threading
from pathlib import Path
from router_maestro.auth.storage import AuthStorage, Credential
from router_maestro.config.paths import AUTH_FILE
_LOCKS_GUARD = threading.Lock()
_PATH_LOCKS: dict[Path, threading.RLock... | MadSkittles/Router-Maestro | src/router_maestro/auth/repository.py | .py | d4a195ac801a7415 | 7.63 | 17 |
"""Auth storage for credentials."""
import json
import logging
from enum import StrEnum
from pathlib import Path
from pydantic import BaseModel, Field, ValidationError
from router_maestro.config.paths import AUTH_FILE
from router_maestro.config.settings import write_json_owner_only
logger = logging.getLogger("route... | MadSkittles/Router-Maestro | src/router_maestro/auth/storage.py | .py | ef115947b1d5090c | 7.63 | 17 |
"""Authentication management commands."""
import asyncio
from collections.abc import Callable, Mapping, Sequence
from typing import Any, Protocol
import typer
from rich.console import Console
from rich.prompt import Prompt
from rich.table import Table
from router_maestro.auth.discovery import (
ProviderAuthDefin... | MadSkittles/Router-Maestro | src/router_maestro/cli/auth.py | .py | fe4dd270d90ca701 | 7.63 | 17 |
"""Gemini CLI (`~/.gemini/.env`) config generation."""
from __future__ import annotations
from pathlib import Path
from rich.panel import Panel
from router_maestro.cli.client_configs.base import (
ClientConfig,
GenerateContext,
console,
)
from router_maestro.cli.client_configs.model_id import (
Mode... | MadSkittles/Router-Maestro | src/router_maestro/cli/client_configs/gemini.py | .py | 9f3b0b2a70e32324 | 7.63 | 17 |
"""Structural model-family detection and per-vendor official-id spelling.
The optional "official model id" feature writes a vendor's native id (e.g.
``gpt-4.1``, ``claude-opus-4-6``) instead of the internal ``provider/upstream``
form. The conversion is derived from naming conventions — NOT a per-model lookup
table — s... | MadSkittles/Router-Maestro | src/router_maestro/cli/client_configs/model_id.py | .py | af03922bf93427cc | 7.63 | 17 |
"""Interactive selection helpers for client config generation."""
from __future__ import annotations
import sys
from collections.abc import Sequence
from typing import TypeVar
import questionary
import typer
T = TypeVar("T")
def supports_dropdowns() -> bool:
"""Return whether the current terminal can host int... | MadSkittles/Router-Maestro | src/router_maestro/cli/client_configs/prompts.py | .py | 910dd878d17dde65 | 7.63 | 17 |
"""Ordered registry of supported clients for `router-maestro config`.
Drives both the interactive tool picker and the ``config <key>`` dispatch.
Adding a client is one line here plus its module.
"""
from __future__ import annotations
from router_maestro.cli.client_configs.base import ClientConfig
from router_maestro... | MadSkittles/Router-Maestro | src/router_maestro/cli/client_configs/registry.py | .py | 14110e9460764ced | 7.63 | 17 |
"""Server management commands."""
import os
import socket
import typer
import uvicorn
from rich.console import Console
from rich.panel import Panel
from router_maestro.config.server import get_current_context_api_key, get_or_create_api_key
app = typer.Typer(no_args_is_help=True)
console = Console()
def is_port_in... | MadSkittles/Router-Maestro | src/router_maestro/cli/server.py | .py | a00e2d0bba81980b | 7.63 | 17 |
"""Context configuration for remote deployments."""
from pydantic import BaseModel, Field
class ContextConfig(BaseModel):
"""Configuration for a single deployment context."""
endpoint: str = Field(..., description="API endpoint URL")
api_key: str | None = Field(default=None, description="API key for aut... | MadSkittles/Router-Maestro | src/router_maestro/config/contexts.py | .py | 96b07c6903ab1b8f | 7.63 | 17 |
"""File path definitions for router-maestro."""
import os
from pathlib import Path
def get_data_dir() -> Path:
"""Get the data directory for router-maestro.
Returns ~/.local/share/router-maestro on Unix-like systems.
Returns %LOCALAPPDATA%/router-maestro on Windows.
"""
if os.name == "nt":
... | MadSkittles/Router-Maestro | src/router_maestro/config/paths.py | .py | 330b01b4d69a6035 | 7.63 | 17 |
"""Model priority configuration."""
from enum import StrEnum
from pydantic import BaseModel, Field
class FallbackStrategy(StrEnum):
"""Fallback strategy options."""
PRIORITY = "priority" # Fallback to next model in priorities list
SAME_MODEL = "same-model" # Only fallback to providers with the same m... | MadSkittles/Router-Maestro | src/router_maestro/config/priorities.py | .py | 49c3b8c6c1ad302d | 7.63 | 17 |
"""Provider and model configuration models."""
import re
from pydantic import BaseModel, ConfigDict, Field, field_validator
from router_maestro.routing.model_ref import validate_provider_id
RESERVED_PROVIDER_NAMES = frozenset({"github-copilot", "openai", "anthropic"})
def default_custom_api_key_env(provider: str)... | MadSkittles/Router-Maestro | src/router_maestro/config/providers.py | .py | ed542abdbf6ca2a5 | 7.63 | 17 |
"""Versioned runtime configuration snapshots and persistence."""
import hashlib
import json
import os
import threading
from dataclasses import dataclass, field
from pathlib import Path
from router_maestro.config.paths import PRIORITIES_FILE
from router_maestro.config.priorities import PrioritiesConfig
from router_mae... | MadSkittles/Router-Maestro | src/router_maestro/config/repository.py | .py | ac3cd7f24f41abba | 7.63 | 17 |
"""Server configuration management.
API keys are stored in contexts.json under context.
This module provides utilities to manage API keys.
"""
import secrets
from router_maestro.config.contexts import ContextConfig
from router_maestro.config.settings import load_contexts_config, save_contexts_config
def generate_a... | MadSkittles/Router-Maestro | src/router_maestro/config/server.py | .py | 32bec0c5ba3c6f5c | 7.63 | 17 |
import dataclasses
import statistics
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Sequence
from typing import Final
from eval.grader import FailureReason
from eval.model import TaskRun
from eval.model import TraceUsage
_CACHE_CAVEAT: Final = (
"{second} run... | wkentaro/git-hunk | eval/summary.py | .py | 425050cc91634743 | 7.52 | 10 |
import base64
import hashlib
import re
from dataclasses import dataclass
from dataclasses import replace
from typing import Any
from typing import Final
from typing import Literal
NO_NEWLINE_MARKER: Final = "\\ No newline at end of file"
HUMAN_ID_MIN_LENGTH: Final = 7
_HUNK_RANGE_RE: Final = re.compile(r"@@ -(\d+)(?:,... | wkentaro/git-hunk | git_hunk/_hunk.py | .py | e3bfd248c80c80fc | 7.52 | 10 |
import re
from collections.abc import Sequence
from dataclasses import replace
from typing import Final
from typing import NamedTuple
from ._hunk import NO_NEWLINE_MARKER
from ._hunk import Hunk
from ._hunk import count_changes
from ._hunk import format_hunk_range
from ._hunk import is_no_newline_marker
from ._hunk im... | wkentaro/git-hunk | git_hunk/_lines.py | .py | ab79864c742bf807 | 7.52 | 10 |
import os
import subprocess
import tempfile
from collections.abc import Generator
from typing import Final
import pytest
class GitRepo:
def __init__(self, path: str, /) -> None:
self.path = path
def run(
self, *args: str, input: str | None = None
) -> subprocess.CompletedProcess[str]:
... | wkentaro/git-hunk | tests/conftest.py | .py | 3716520e56d3a1ea | 7.02 | 10 |
import json
import os
import subprocess
from typing import Any
from typing import cast
import pytest
from click.testing import CliRunner
from git_hunk._cli import cli as git_hunk_cli
from tests.conftest import GitRepo
class GitHunkCLI:
def __init__(self, repo: GitRepo, /) -> None:
self.repo = repo
... | wkentaro/git-hunk | tests/e2e/conftest.py | .py | cc8172cf554948f2 | 7.02 | 10 |
import pytest
from .conftest import GitHunkCLI
@pytest.fixture
def cli_with_change(*, cli: GitHunkCLI) -> GitHunkCLI:
cli.repo.write_file("f.py", "a\nb\nc\n")
cli.repo.git("add", ".")
cli.repo.git("commit", "-m", "init")
cli.repo.write_file("f.py", "A\nb\nC\n")
return cli
# A caller that got th... | wkentaro/git-hunk | tests/e2e/exit_code_test.py | .py | 3413b9bfaf85adc2 | 7.02 | 10 |
from typing import Final
import pytest
from git_hunk._cli import cli as cli_group
from .conftest import GitHunkCLI
SUBCOMMAND_HELP: Final = [
("list", "List hunks"),
("show", "Show the diff for one or more hunks"),
("stage", "Stage one or more specific hunks"),
("unstage", "Unstage one or more speci... | wkentaro/git-hunk | tests/e2e/help_test.py | .py | cc01f18640257fe8 | 7.02 | 10 |
from pathlib import Path
import pytest
from git_hunk._hunk import parse_hunk_range
from ..conftest import GitHunkCLI
def _commit_prefixed_duplicate_blocks(*, cli: GitHunkCLI) -> list[str]:
# Room ahead of the first block, which the shared duplicate-group fixture
# does not leave: its file starts at the blo... | wkentaro/git-hunk | tests/e2e/hunk_identity/duplicate_test.py | .py | f1b29b9b308f973c | 7.02 | 10 |
import logging
import scrapy
import re
import base64
import json
import time
import os
import pandas as pd
from urllib.parse import urlparse
from ..items import ProxyItem
# 设置根日志记录器的等级
logging.basicConfig(level=logging.ERROR)
class TelegramCrawlerSpider(scrapy.Spider):
name = "telegram_crawler"
allowed_domain... | jagger235711/V2rayCollector | myproject/spiders/telegram_crawler.py | .py | df3a211af6fbd9e7 | 7.56 | 12 |
"""Dry-run image manifest: resolve title + snap + one in-game shot per arcade
title, deterministically by MAME setname against progettoSNAPS packs, using the
MAME DAT's cloneof to fall back to the parent set. Falls back to libretro
display-name matching for titles that have no setname.
Downloads nothing except metadat... | matijaerceg/misterzine | tools/build_manifest.py | .py | b2f6977aa823c36b | 7.54 | 11 |
"""Validate the fetch+self-host pipeline on a small sample.
Picks the best candidate filename per title, downloads Title/Snap/Boxart from
libretro-thumbnails raw, stores under data/cache/sample_images/, and validates
each PNG (reads IHDR for dimensions). Stdlib only.
"""
import json, re, struct, urllib.parse, urllib.r... | matijaerceg/misterzine | tools/fetch_sample.py | .py | 8cff6ac90f664a26 | 7.54 | 11 |
"""Regenerate the PWA / home-screen icons from the wordmark SVG.
Inputs: logo_white.svg at the repo root -- the MiSTer Zine sticker as a single
white path. The letter interiors are transparent HOLES in that path,
so whatever ground the sticker sits on shows through them; the dark
ground her... | matijaerceg/misterzine | tools/make_icons.py | .py | 87ae5c1b24012036 | 7.54 | 11 |
"""Title -> libretro-thumbnails filename matching for MiSTer arcade titles.
Shared matching logic: normalization (with camelCase split + alias handling)
and canonical candidate selection (region-aware, avoids bootleg/hack/proto).
"""
import json, re
from collections import defaultdict
TREE = "data/cache/libretro_mame... | matijaerceg/misterzine | tools/match.py | .py | 3c837a6827165da6 | 7.54 | 11 |
"""Probe libretro-thumbnails/MAME match rate for our arcade titles.
Reads the cached repo tree (data/cache/libretro_mame_tree.json) and the site
data (docs/releases/data.json), then reports how many arcade titles can be
matched to a Title / Snap / Boxart image. Pure measurement; downloads nothing.
"""
import json, re,... | matijaerceg/misterzine | tools/probe_images.py | .py | 02d5aa4ba1d04ac7 | 7.54 | 11 |
"""Resolve a setname for titles that lack one, by matching against MAME DAT
descriptions (parent-preferred). Shared by the manifest builder."""
import re, html
import match
DAT = "data/cache/MAME_arcade.dat"
# capture each machine's name, optional cloneof, and description
MACHINE = re.compile(
r'<machine\s+name="(... | matijaerceg/misterzine | tools/setname_backfill.py | .py | 0a96079af930ee4e | 7.54 | 11 |
"""Shared temp-project scaffolding for the Wikifier test suite (stdlib only).
Each TestCase gets a fresh tempfile.TemporaryDirectory as its project root,
with WIKIFIER_PROJECT_ROOT pointed at it for the duration of the test and
restored afterwards. This guarantees tests never read or mutate the Wikifier
repository's o... | IronAdamant/wikifier | tests/_base.py | .py | 7c0a312caa6212a5 | 8.07 | 13 |
"""Convenience runner for the full Wikifier test suite (stdlib only).
Equivalent to: python -m unittest discover tests -v
Usage: python tests/run_all.py
"""
import sys
import unittest
from pathlib import Path
TESTS_DIR = Path(__file__).resolve().parent
REPO_ROOT = TESTS_DIR.parent
if str(REPO_ROOT) not in sys... | IronAdamant/wikifier | tests/run_all.py | .py | 14ae8dd0f73ea25d | 7.07 | 13 |
"""Extracted self-test harness from wikifier/parsers/cdia.py (G12 agent navigability).
Run: python3 tests/selftest/run_cdia_selftest.py
Or: python3 -m unittest tests.test_selftest_wrappers
"""
import sys
from pathlib import Path
_ROOT = Path(__file__).resolve().parents[2]
if str(_ROOT) not in sys.path:
sys.path.i... | IronAdamant/wikifier | tests/selftest/run_cdia_selftest.py | .py | 8b67e660ee0addff | 7.07 | 13 |
"""Agent-first ideal-loop tests: content-dirty, bootstrap, suggest actions, preflight, journal."""
import importlib
import os
import time
import unittest
from pathlib import Path
from tests._base import TempProjectTestCase
from wikifier import cli
from wikifier.health import classify_content_dirty, compute_source_co... | IronAdamant/wikifier | tests/test_agent_loop.py | .py | a22851453eecc797 | 8.07 | 13 |
"""Agent-scale perf/accuracy path tests (zero-dirty, content-hash dirty, ACS v1.3).
Drives shipped library APIs only — no reimplementation of the unit under test.
"""
from __future__ import annotations
import os
import time
import unittest
from pathlib import Path
from tests._base import TempProjectTestCase
from w... | IronAdamant/wikifier | tests/test_agent_scale.py | .py | 90fadf1ef1ee58f5 | 8.07 | 13 |
"""Barrel churn invalidation tests — the E1 repro (Phase 0 of
Findings/2026-06-10-Fix-Plan.md).
Fixture: consumer.js imports './barrel'; barrel/index.js re-exports
'./leaf.js'. Parsing the consumer populates the BarrelResolutionCache
(_barrel_resolutions / _barrel_file_index in import_cache.json). Touching a
file in t... | IronAdamant/wikifier | tests/test_barrel_invalidation.py | .py | 7b09792793bca617 | 8.07 | 13 |
"""Real-path tests for gap amendment plan G1–G13/G15 closed-when bars.
Drives shipped library functions (session_bootstrap, build_structured_actions,
file_lock, build_map_coverage / run_full_update, library ACS section, protocol
strings). No theater: asserts against live code outputs.
"""
from __future__ import annot... | IronAdamant/wikifier | tests/test_gap_amendment_2026_08.py | .py | c4dc10fd4cc07b12 | 8.07 | 13 |
"""Health workflow tests (Phase 0 of Findings/2026-06-10-Fix-Plan.md).
Desired contract:
- record-change -> 🟡 Yellow entry + pending_updates.md line + journal entry
- mark-green -> 🟢 Green entry + pending line cleared
- check-changes auto-yellows dirty source files but honors exclude_patterns.txt (W8)
All operati... | IronAdamant/wikifier | tests/test_health.py | .py | 58d9611258cb8f6e | 8.07 | 13 |
"""Import-cache schema and graph-intel tests (Phase 0 of Findings/2026-06-10-Fix-Plan.md).
Canonical per-file schema round-trip through the real save_cache/load_cache,
reserved "_" key preservation, reverse dependencies on a 3-file chain, and
Tarjan cycle detection on a seeded 3-node SCC.
"""
import unittest
from te... | IronAdamant/wikifier | tests/test_import_cache.py | .py | 236142319f7f91f8 | 8.07 | 13 |
"""Index-first dirty, map_paths vs monitored_paths, JSON dual-write deprecation."""
from __future__ import annotations
import os
import unittest
from pathlib import Path
from tests._base import TempProjectTestCase
from wikifier import cli
from wikifier import cache_store as cs
from wikifier.candidates import (
... | IronAdamant/wikifier | tests/test_index_map_paths.py | .py | c15aca20ff1d4a00 | 7.07 | 13 |
"""Real-path tests for `wikifier init` lean path-list templates (4.6.8+).
Drives the shipped shell launcher (`./wikifier.sh init --target …`) so a
silent bare-`.` seed cannot regress without failing the suite.
"""
from __future__ import annotations
import os
import subprocess
import unittest
from pathlib import Path... | IronAdamant/wikifier | tests/test_init_seed.py | .py | d5ab4afa4476780c | 8.07 | 13 |
"""Parser edge-contract tests (Phase 0 of Findings/2026-06-10-Fix-Plan.md).
Python + JavaScript parsers on small temp fixtures: static / relative /
dynamic imports plus one barrel chain. Asserts the canonical per-edge
contract (raw module, relative resolution, real booleans, confidence fields).
"""
import textwrap
im... | IronAdamant/wikifier | tests/test_parsers.py | .py | a89575527e0233fd | 8.07 | 13 |
"""G12: run extracted selftest harnesses via unittest (no harness in prod modules)."""
import runpy
import unittest
from pathlib import Path
SELFTEST = Path(__file__).resolve().parent / "selftest"
class TestExtractedSelftests(unittest.TestCase):
def _run(self, name: str):
path = SELFTEST / name
... | IronAdamant/wikifier | tests/test_selftest_wrappers.py | .py | 5b8106d4052911a9 | 8.07 | 13 |
"""Walk cost, Core map_coverage, thin C#/C++ resolve, cache-status (shipped APIs)."""
from __future__ import annotations
import os
import time
import unittest
from pathlib import Path
from tests._base import TempProjectTestCase
from wikifier import cli
from wikifier import cache_store as cs
from wikifier.candidates... | IronAdamant/wikifier | tests/test_walk_coverage_resolvers.py | .py | d8fdf2c35a3837d7 | 8.07 | 13 |
"""Cache I/O — SQLite-primary load/save (legacy JSON dual-read)."""
from __future__ import annotations
import json
import os
from pathlib import Path
from typing import Any, Dict
try:
from .. import locking
except ImportError:
locking = None
CACHE_FILE = ".wikifier_staging/import_cache.json"
def _get_cach... | IronAdamant/wikifier | wikifier/cache/io.py | .py | 6a6efa7a564c0bc5 | 7.57 | 13 |
"""Stdlib SQLite import-cache store (agent warm-path; zero new deps).
AGENT MAP:
load_cache_dict / save_cache_dict — full cache dict (file entries + _meta keys)
load_mtime_index — light {rel: mtime, content_hash} for dirty
load_meta / save_meta_key — reserved _keys without loading pai... | IronAdamant/wikifier | wikifier/cache_store.py | .py | 589f3b48f7db3ad4 | 7.57 | 13 |
import { describe, it, expect, mock, beforeEach } from "bun:test";
// Mock the neo4j client BEFORE importing the module under test.
const writeCalls: Array<{ query: string; params: any }> = [];
const queryResults: any[][] = [];
mock.module("./neo4j-client.js", () => ({
write: async (q: string, params: any) => { wri... | kinkos1234/comad-world | brain/packages/core/src/evidence-writer.test.ts | .ts | b01d219baf0ffef7 | 7.13 | 17 |
"""Shared config loader for Soothe examples."""
from pathlib import Path
from soothe.config import SOOTHE_HOME
from soothe.config.settings import SootheConfig
def _load_nano_or_split(nano_path: Path) -> SootheConfig:
"""Load ``nano.yml``, composing sibling ``soothe.yml`` when present."""
soothe_sibling = na... | mirasoth/soothe | examples/_config_helper.py | .py | 8cab00beaf7dbae5 | 7.52 | 10 |
"""Self-contained config loader for soothe host examples.
Mirrors the fj-ai bootstrap pattern: load ``~/.soothe/config``, fall back to
monorepo develop config, then apply SQLite-friendly defaults for one-shot runs
outside the daemon.
"""
from __future__ import annotations
from pathlib import Path
from soothe.config... | mirasoth/soothe | examples/_shared/config.py | .py | 96b56c1c7355c13e | 7.52 | 10 |
"""Example: Using the academic_research subagent for academic literature research.
This example demonstrates how to leverage the academic_research subagent for
iterative academic literature research with adaptive report generation.
The academic_research subagent:
- Searches academic sources (arXiv, Semantic Scholar, ... | mirasoth/soothe | examples/agents/academic_research_example.py | .py | 0557f27e4428e451 | 7.52 | 10 |
"""Example: Using the deep_research subagent for iterative web research.
This example demonstrates how to leverage the deep_research subagent for
comprehensive public web research with adaptive report generation.
The deep_research subagent:
- Performs iterative web searches with URL crawling
- Gathers diverse sources... | mirasoth/soothe | examples/agents/deep_research_example.py | .py | 834bcc53f5665249 | 7.52 | 10 |
"""Batch tasks example -- tests headless CLI with auto-routing.
Runs a series of diverse tasks sequentially using the Soothe CLI in headless
mode, demonstrating auto-routing to different subagents.
Usage:
# From project root:
uv run python examples/batch_tasks_example.py
"""
import subprocess
from pathlib im... | mirasoth/soothe | examples/batch_tasks_example.py | .py | 989bb6fd584ead3e | 7.52 | 10 |
"""Example plugin demonstrating the Soothe SDK."""
from soothe_sdk.plugin import PluginHealth, plugin, subagent, tool, tool_group
@plugin(
name="example-plugin",
version="1.0.0",
description="Example plugin with tools and subagent",
author="Soothe Team",
dependencies=["langchain>=0.1.0"],
tru... | mirasoth/soothe | examples/example_plugin.py | .py | 3008e8c161ff83a1 | 7.52 | 10 |
"""In-process Soothe agent example -- embed Soothe as a library dependency.
This example demonstrates how to use Soothe as an embedded library:
- Import and configure SootheConfig programmatically
- Create CoreAgent via create_soothe_agent()
- Stream execution in-process without daemon
- Add custom tools for domain-sp... | mirasoth/soothe | examples/inproc_soothe_agent.py | .py | b15b9b48ad108e83 | 7.52 | 10 |
"""Build worker contribution / wire response from a completed PlanResult.
Lives under ``dispatch`` (wire contribution packing), not ``verify``
(judgment). StrangeLoop Plan-Execute-Eval owns goal-done judgment; autopilot
consensus compares goal text to the wire response synthesized here — not
host workspace probes (IG-... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/dispatch/plan_contribution.py | .py | eb19b00c7a5d0720 | 7.52 | 10 |
"""Daemon-owned storage for GoalDispatchContextContribution entries (RFC-222 revised).
Stores one ``GoalDispatchContextContribution`` per ``goal_id``. Used by the
``ContextProjector`` to merge a goal's parents' contributions into a single
``GoalDispatchContextBundle`` for hydration.
Production qualities of the in-mem... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/dispatch/store.py | .py | 50950e1e49c0d602 | 7.52 | 10 |
"""Job-scoped GOAL.md contract artifact under ``data/jobs/{job_id}/`` (IG-702/IG-733).
Persists the Autopilot root job description as a durable filesystem snapshot
alongside rail soft-state. Distinct from workspace ``GOAL.md`` (operator
contract in the project tree).
"""
from __future__ import annotations
import log... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/intake/contract.py | .py | 6c10ff217170a7c3 | 7.52 | 10 |
"""Guidance absorb/collect façade for Autopilot intake (IG-733 / RFC-228).
Absorbs advisory text into ContextEngine ``guidance_accumulated`` for the next
worker dispatch. Does not create or inject goals.
"""
from __future__ import annotations
from typing import Any, Protocol
from soothe.context.models import GoalNo... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/intake/guidance.py | .py | c3deb3bc0db19e07 | 7.52 | 10 |
"""Autopilot forest helpers for CLI ``top`` (RFC-228 /).
Pure filter/assembly used by ``AutopilotService.top_snapshot``. Server SoT for
which jobs/goals/loops appear in the live dashboard (active-only by default;
optional ``include_terminal`` keeps completed/failed/cancelled goals).
``mode=active`` filters goals and ... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/jobs/top_snapshot.py | .py | 4f28110081221b38 | 7.52 | 10 |
"""Durable at-most-once keys for job notify intents (IG-713)."""
from __future__ import annotations
import logging
import time
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from soothe_sdk.protocols.persistence import AsyncPersistStore
logger = logging.getLogger(__name__)
_DEDUP_PREFIX = "autopilot:notify... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/notify/dedup.py | .py | 2a3d5892f21f0c38 | 7.52 | 10 |
"""Job lifecycle notify intents (IG-713).
Channel-agnostic payloads produced by the host NotificationRouter and
consumed by daemon NotifySink adapters (email, webhook, Feishu, …).
"""
from __future__ import annotations
from datetime import UTC, datetime
from enum import StrEnum
from typing import Any, Literal
from ... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/notify/models.py | .py | 6b3f03270823b677 | 7.52 | 10 |
"""Compact job DAG progress for lifecycle notify (IG-713).
Counts every goal; never attaches a full goal list. Only a small capped
set of attention highlights (failed / cancelled / active / suspended).
"""
from __future__ import annotations
from typing import Any
_STATUS_COUNT_KEYS: dict[str, str] = {
"complete... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/notify/progress.py | .py | 09195d9c21094501 | 7.52 | 10 |
"""Host NotificationRouter — job-root intents to injected dispatcher (IG-713)."""
from __future__ import annotations
import logging
from collections.abc import Awaitable, Callable
from datetime import UTC, datetime
from typing import TYPE_CHECKING, Any
from soothe_autopilot.notify.dedup import NotifyDedupStore
from ... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/notify/router.py | .py | 641df77435a9c97f | 7.52 | 10 |
"""LoopRail guard prompt assembly (IG-736)."""
from __future__ import annotations
from typing import Any
from langchain_core.messages import BaseMessage, HumanMessage, SystemMessage
from soothe_autopilot.prompts.envelopes import wrap_untrusted
from soothe_autopilot.prompts.fragments import GUARD_SYSTEM_FRAGMENT
__... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/prompts/guards.py | .py | 2029c666a1ecb21b | 7.52 | 10 |
"""Verify / backoff prompt rendering and DAG format helpers (IG-736)."""
from __future__ import annotations
from soothe_autopilot.prompts.fragments import (
BACKOFF_REASONING_PROMPT,
DAG_HEALTH_VERIFICATION_PROMPT,
GOAL_PLACEMENT_PROMPT,
POST_COMPLETION_VERIFICATION_PROMPT,
)
__all__ = [
"BACKOFF... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/prompts/verify.py | .py | 3a3903582307b710 | 7.52 | 10 |
"""Native autoresearch rail execution helpers (RFC-231 / IG-717).
The ``autoresearch`` rail (``builtin_rails/autoresearch.yml``) uses YAML
``do:`` recipes for ``decompose_parallel`` and ``spawn_feedback_cycle`` and
``brief:`` overrides for ``review`` / ``qa_verify``. The generic
``_do_plan_and_implement`` fallback, ho... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/rails/autoresearch_exec.py | .py | 736d694642fb71eb | 7.52 | 10 |
"""Rail discovery helpers for built-in and user/project rails.
Precedence (low → high, last wins on duplicate ``id``):
1. Package ``soothe/rails/builtin_rails/``
2. ``$SOOTHE_HOME/rails/`` (typically ``~/.soothe/rails/``)
3. ``<workspace>/.soothe/rails/`` when a workspace is provided
``BUILTIN_RAIL_IDS`` (the set of... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/rails/builtins.py | .py | 5a9ab049e9aaa364 | 7.52 | 10 |
"""LoopRail catalog loader — resolve rail YAML by id with tier precedence."""
from __future__ import annotations
import hashlib
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
import yaml
from soothe_autopilot.rails.builtins import get_rails_paths
# CE built-ins referenced ... | mirasoth/soothe | packages/soothe-autopilot/src/soothe_autopilot/rails/catalog.py | .py | 64bfbafa9687c433 | 7.52 | 10 |
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026 Jimmy Wesley
"""Two-phase compose: reviewing a passport before the forest keeps it (J.8.1).
Curation is the one ingest step whose output somebody may want to see first.
A summary is the scent every later hop navigates by (A.4) and a proposal is
what the Ranger... | JimmyWesley/MonkeyLLM | apps/station/monkeyllm_station/compose.py | .py | a906355662a360b7 | 7.48 | 8 |
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026 Jimmy Wesley
"""The seeded demo forest offered at first-run setup (spec J.2.4).
An empty console teaches nothing: `Ask` has nothing to answer, `Explore` has
nothing to draw, and the first impression of a knowledge product is a blank
page. This plants a forest ... | JimmyWesley/MonkeyLLM | apps/station/monkeyllm_station/demo_forest.py | .py | 3c106298a3534be7 | 7.48 | 8 |
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026 Jimmy Wesley
"""Ingest jobs (spec J.9): the host's memory of running batches.
A job is process state, never forest content — progress is not curated
material, the same boundary that keeps model runs in the browser (J.5.9).
Reading a job therefore touches no fo... | JimmyWesley/MonkeyLLM | apps/station/monkeyllm_station/jobs.py | .py | 9d2669d2c81423fe | 7.48 | 8 |
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026 Jimmy Wesley
"""The G.5.1 vision describer: an image becomes findable text, once.
This is the ONE place a model sees the image. J.14 keeps payload bytes out
of model material everywhere else — the payload endpoint is a human
surface, `answer` and the walk read... | JimmyWesley/MonkeyLLM | apps/station/monkeyllm_station/vision.py | .py | efdeb896d61eef27 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 Jimmy Wesley
"""Chunk store for the RAG baselines (Monkey Bench v1).
Fairness rules (roadmap, Fase 1): the baselines see the SAME corpus with the
SAME embedder as MonkeyLLM. So this module ingests the forest the way a naive
RAG pipeline would ingest an Obsidian v... | JimmyWesley/MonkeyLLM | bench/chunks.py | .py | eb7d91683756bd90 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 Jimmy Wesley
"""Re-grade a saved bench report against the (possibly fixed) questions file,
without re-running the models. Grading bugs/gabarito fixes shouldn't cost a
GPU pass: the raw answers and harvested nodes are all in the report.
python bench/regrade.py... | JimmyWesley/MonkeyLLM | bench/regrade.py | .py | ed913eaa8c55b8de | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 Jimmy Wesley
"""Deterministic 100-document mixed dump for the T04 curation measurement.
Generates `forests/dump-ingest/` (git-ignored): a realistic brownfield
directory — markdown articles, plain-text notes, CSV/JSON tables — for a
fictional company ("Toucan Robo... | JimmyWesley/MonkeyLLM | forests/scripts/build_dump.py | .py | f3680ed405d0515a | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 Jimmy Wesley
"""Build the two brand images, from one palette and one set of numbers.
docs/banner.png 2000x760, the README hero: wordmark, tagline and
the stat strip.
docs/social-preview.png 1280x640, what GitHub serves as ... | JimmyWesley/MonkeyLLM | scripts/build_brand_art.py | .py | 09d9bb0db92170b6 | 7.48 | 8 |
"""Utilities for async operations with synchronous PagerDuty client."""
import asyncio
import logging
from collections.abc import Callable
from typing import Any
logger = logging.getLogger(__name__)
# Default cap when a list tool is called without an explicit `limit`.
# Each list tool's docstring exposes `limit` to... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/async_utils.py | .py | efdc736c34058b04 | 7.45 | 7 |
import logging
import os
from importlib.metadata import version
import pagerduty
from dotenv import load_dotenv
from fastmcp.server.dependencies import get_http_request
from starlette.requests import Request
from .errors import PagerDutyAuthError
# Load environment variables from .env file
load_dotenv()
logger = lo... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/client.py | .py | e00d85bbf7d7910d | 7.45 | 7 |
"""Common Pydantic models for PagerDuty resources."""
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
class PagerDutyBaseModel(BaseModel):
"""Base model for all PagerDuty resources with clean serialization."""
model_config = ConfigDict(
use_enum_values=True,
)
def ... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/models/common.py | .py | 1a9c8115a18e0569 | 7.45 | 7 |
"""Pydantic models for PagerDuty Escalation Policies."""
from pydantic import Field
from .common import IdOnly, PagerDutyBaseModel, Reference, TypedReference
class EscalationRuleTarget(TypedReference):
"""A target in an escalation rule.
Inherits from TypedReference which includes 'type' field for target id... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/models/escalation_policy.py | .py | cb4fb8fbe6b3f354 | 7.45 | 7 |
"""Pydantic models for PagerDuty Incidents."""
from typing import Any
from pydantic import Field, model_validator
from .common import IdOnly, PagerDutyBaseModel, Reference
class AssignmentItem(PagerDutyBaseModel):
"""An assignment in an incident."""
assignee: Reference
at: str
class AcknowledgementI... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/models/incident.py | .py | 28df5085fcc7874b | 7.45 | 7 |
"""Pydantic models for PagerDuty Notes."""
from pydantic import ConfigDict, Field
from .common import PagerDutyBaseModel
class NoteUser(PagerDutyBaseModel):
"""A user who created a note."""
model_config = ConfigDict(populate_by_name=True, use_enum_values=True)
id: str
name: str | None = Field(None... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/models/note.py | .py | c664ac7b6991998e | 7.45 | 7 |
"""Pydantic models for PagerDuty Schedules."""
from typing import Any
from pydantic import Field, field_validator
from .common import PagerDutyBaseModel, Reference
class ScheduleLayerUser(PagerDutyBaseModel):
"""A user in a schedule layer."""
id: str
summary: str | None = None
class ScheduleLayer(Pa... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/models/schedule.py | .py | 9c0afbf5d5b7f0fc | 7.45 | 7 |
"""Pydantic models for PagerDuty Teams."""
from pydantic import Field
from .common import PagerDutyBaseModel
class TeamParent(PagerDutyBaseModel):
"""A parent team reference."""
id: str
type: str | None = None
class Team(PagerDutyBaseModel):
"""A Pydantic model for a PagerDuty Team.
Contains... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/models/team.py | .py | 80dcd902f3c60f2c | 7.45 | 7 |
"""Pydantic models for PagerDuty Users."""
from typing import Any
from pydantic import Field
from .common import PagerDutyBaseModel, TypedReference
class NotificationRule(PagerDutyBaseModel):
"""A notification rule for a user."""
id: str
type: str
# API fields excluded from MCP responses for size... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/models/user.py | .py | 3f7daf7a212e9144 | 7.45 | 7 |
"""Pagerduty helper utilities"""
import logging
import sys
from datetime import datetime, timedelta
from typing import Any, NoReturn
from . import prompts
from .errors import PagerDutyError
from .models.common import PagerDutyBaseModel
logger = logging.getLogger(__name__)
RESPONSE_CHAR_LIMIT = 400000 # characters
... | wpfleger96/pagerduty-mcp-server | src/pagerduty_mcp_server/utils.py | .py | 26172ba11820502f | 7.45 | 7 |
"""Test .env file loading functionality."""
import os
import tempfile
from unittest.mock import patch
from dotenv import load_dotenv
class TestDotenvLoading:
"""Test .env file loading functionality."""
def test_dotenv_loads_from_file(self):
"""Test that dotenv can load environment variables from a ... | wpfleger96/pagerduty-mcp-server | tests/unit/test_dotenv_loading.py | .py | 1cb272fe7a85cc0d | 7.95 | 7 |
"""MCP boundary tests: verify PagerDuty failures set isError=true."""
from typing import cast
from unittest.mock import AsyncMock, patch
import pytest
from fastmcp.client import Client
from mcp.types import TextContent
from pagerduty_mcp_server.errors import PagerDutyAuthError
from pagerduty_mcp_server.server import... | wpfleger96/pagerduty-mcp-server | tests/unit/test_pagerduty_mcp_error_boundary.py | .py | d8ada3d910d507a1 | 7.95 | 7 |
import os
from pathlib import Path
from dotenv import load_dotenv
BASE_DIR = Path(__file__).parent
load_dotenv(BASE_DIR / ".env")
TMDB_API_KEY = os.getenv("TMDB_API_KEY", "")
JACKETT_URL = os.getenv("JACKETT_URL", "http://localhost:9117").rstrip("/")
JACKETT_API_KEY = os.getenv("JACKETT_API_KEY", "")
QBIT_URL = os.g... | ezenere/Outstasher | config.py | .py | b145f98b5e37871c | 7.6 | 15 |
"""Autenticacao simples por senha unica (estilo Jackett/qBittorrent).
- Uma senha, guardada com hash PBKDF2 na tabela `settings` (key MAIN_PASSWORD).
- Se nao houver senha no boot, a UI pede para criar (fluxo de "setup").
- Login troca a senha por um TOKEN de sessao (aleatorio) guardado em memoria.
O front guarda o ... | ezenere/Outstasher | services/auth.py | .py | 723713f458dc6362 | 7.6 | 15 |
"""Pipeline dos jobs de filme: criação e execução de ponta a ponta.
busca -> (escolha manual) -> download -> merge/entrega. Também cria os jobs de
conversão manual (dois arquivos locais).
"""
import asyncio
import uuid
from datetime import datetime
from pathlib import Path
from services import merger, store, tmdb, t... | ezenere/Outstasher | services/jobs/movies.py | .py | 4347cceea551dbd9 | 7.6 | 15 |
"""Recompressão de um filme que já está na coleção (sem torrent)."""
import asyncio
import uuid
from datetime import datetime
from pathlib import Path
from services import catalog, store, tmdb, transcode
from services.jobs.runtime import (
_event, _fail, _ffmpeg_hooks, _ffmpeg_procs, _free_name, _get_merge_lock,
... | ezenere/Outstasher | services/jobs/recompress.py | .py | 60b550347ef099ad | 7.6 | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.