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 |
|---|---|---|---|---|---|---|
from __future__ import annotations
from dataclasses import asdict
from ..models import KNOB_DEFINITIONS
from .extractor import StyleAnalysis
class StyleToKnobMapper:
"""Maps StyleAnalysis into PersonaProfile-compatible knob values."""
def __init__(self) -> None:
self._knob_keys = tuple(... | Team-Deepiri/diri-persola | persola/analysis/mapper.py | .py | 3a439214aa9ae947 | 7.48 | 8 |
import os
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.requests import Request
from starlette.responses import JSONResponse
_EXEMPT_PREFIXES = ("/health", "/", "/ui", "/static", "/metrics", "/api/v1/city/health")
def _get_valid_keys() -> frozenset[str]:
raw = os.environ.get(... | Team-Deepiri/diri-persola | persola/auth.py | .py | 84076b7216af7d32 | 7.48 | 8 |
"""
Async SQLAlchemy engine and session management.
"""
from sqlalchemy.ext.asyncio import (
AsyncSession,
async_sessionmaker,
create_async_engine,
)
from sqlalchemy.orm import DeclarativeBase
from .settings import get_db_settings
settings = get_db_settings()
engine = create_async_engine(... | Team-Deepiri/diri-persola | persola/db/config.py | .py | 9330c61c5ed67291 | 7.48 | 8 |
"""
Database settings — loaded from environment / .env file.
"""
from functools import lru_cache
from pydantic_settings import BaseSettings
class DBSettings(BaseSettings):
database_url: str = "postgresql+asyncpg://deepiri:deepiripassword@persola-db:5433/persola"
db_echo: bool = False
db_pool_s... | Team-Deepiri/diri-persola | persola/db/settings.py | .py | 85318fbef2c4370e | 7.48 | 8 |
"""Shared auth-error detection for adapter / provider error output.
Used by the CLI session adapter and ``core`` so their auth-vs-rate-limit
split can't drift. Substring match — safe on adapter error output, but
NOT on free-form agent prose (the worker uses anchored patterns there).
"""
from __future__ import annotat... | puffo-ai/puffo-agent | src/puffo_agent/agent/_auth_markers.py | .py | 99f6d5d7dd5aabc5 | 7.42 | 6 |
"""Exception → process-outcome mapping. Sibling of ``_usage_markers``.
Quota before auth: a spent-plan API error also reports ``is_auth``.
"""
from __future__ import annotations
from .errors import AgentAPIError, ProviderFailureError
def failure_outcome(exc: Exception) -> str:
"""``drained`` | ``auth_failed`` ... | puffo-ai/puffo-agent | src/puffo_agent/agent/_failure_outcomes.py | .py | 84ae95175015f4c3 | 7.42 | 6 |
"""Human-facing copy for invite failures and the OAuth-expired
operator DM (``format_oauth_expired``)."""
from __future__ import annotations
import json
from ..crypto.http_client import HttpError
def format_invite_error(exc: Exception, verb: str) -> str:
"""Translate an invite-accept/reject failure into a user... | puffo-ai/puffo-agent | src/puffo_agent/agent/_invite_strings.py | .py | 8693af957945f61e | 7.42 | 6 |
"""Usage-limit (quota) markers. Sibling of ``_auth_markers``.
Check quota BEFORE auth at every site: spent-quota bodies carry
auth-adjacent wording. Input: adapter error output, not agent prose.
"""
from __future__ import annotations
import re
# shipped plan-budget spellings; stable cores — full sentences drift per... | puffo-ai/puffo-agent | src/puffo_agent/agent/_usage_markers.py | .py | bd32d14bcb4ad4f1 | 7.42 | 6 |
"""Adapter interface.
Adapters translate ``TurnContext`` into a runtime-native invocation,
forward output back as a ``TurnResult``, and manage the runtime
instance's lifecycle. The runtime owns the agentic loop and tool
catalog.
"""
from __future__ import annotations
import logging
from abc import ABC, abstractmetho... | puffo-ai/puffo-agent | src/puffo_agent/agent/adapters/base.py | .py | 2b1a7ecf18c1f0e1 | 7.42 | 6 |
"""Spawn-time install of operator-picked skill + MCP templates.
Runs once per worker spawn, after host-sync. Both harnesses install:
* claude skills → ``<agent_home>/.claude/skills/<id>/SKILL.md``
* codex skills → ``<workspace>/.agents/skills/<id>/SKILL.md``
(body has ``mcp__puffo__`` prefix s... | puffo-ai/puffo-agent | src/puffo_agent/agent/adapters/desired_install.py | .py | b1156f5f4bdb2d0b | 7.42 | 6 |
"""Autonomous provider-turn lifecycle for ``GlobalInboxRuntime``.
This private implementation trait keeps the runtime as the single owner of
the active Inbox union while separating one cohesive provider lifecycle from
the composition root.
"""
from __future__ import annotations
import asyncio
import logging
import t... | puffo-ai/puffo-agent | src/puffo_agent/agent/autonomous_turns.py | .py | 5e17657b8cb2a9f2 | 7.42 | 6 |
"""Construction-only state assembly for :mod:`puffo_core_client`."""
from __future__ import annotations
import asyncio
import logging
from typing import Any
from ..limits import (
DEFAULT_CATCHUP_STALE_HOURS,
MAX_INLINE_MESSAGE_CHARS,
MESSAGE_SEGMENT_CHARS,
)
from ..portal.state import agent_dir
from .cl... | puffo-ai/puffo-agent | src/puffo_agent/agent/client_setup.py | .py | e9509d8b351627dd | 7.42 | 6 |
"""Small support types and constants used by the Puffo message client."""
from __future__ import annotations
import json
import logging
from typing import Any
from ..crypto.encoding import base64url_decode
from ..crypto.http_client import PuffoCoreHttpClient
DM_GATE_SENDER_ACK = (
"Thanks — your message has rea... | puffo-ai/puffo-agent | src/puffo_agent/agent/client_support.py | .py | 8333b9389077b1dc | 7.42 | 6 |
"""The agent's own DM contact cache (allowlist + blocklist), hydrated
from puffo-server. Per-agent - the server scopes both lists to the
authenticated identity. Single read/write point for every allow/block
decision - never hit /allowlists + /blocklists ad hoc.
A keyless transport can never hydrate those signed lists,... | puffo-ai/puffo-agent | src/puffo_agent/agent/contact_cache.py | .py | a2e3e302effdf27f | 7.42 | 6 |
"""Provider-neutral context admission and control.
This module deliberately knows nothing about Inbox storage or message
lifecycle. Callers supply opaque candidate payloads and a re-plan callback;
providers supply snapshots and bounded native control operations.
"""
from __future__ import annotations
from dataclass... | puffo-ai/puffo-agent | src/puffo_agent/agent/context_controller.py | .py | cd3ee4400a1a465b | 7.42 | 6 |
"""Profile, member, space, channel, and avatar cache operations."""
from __future__ import annotations
import asyncio
import logging
import time
from collections.abc import Awaitable, Callable
from typing import Any
from . import disk_cache
from ..tasks import spawn
PROFILE_CACHE_TTL_SECONDS = 10 * 60
PROFILE_FETCH... | puffo-ai/puffo-agent | src/puffo_agent/agent/directory_cache.py | .py | b7568106ec32b3f4 | 7.42 | 6 |
"""Persistence for pending per-agent DM approval prompts."""
from __future__ import annotations
import json
import logging
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from ..portal.state import agent_dir
logger = logging.getLogger(__name__)
# Marker distinguishing a ... | puffo-ai/puffo-agent | src/puffo_agent/agent/dm_approvals.py | .py | 24ab06c6bfc395f8 | 7.42 | 6 |
"""Shared agent-runtime exceptions with no adapter or harness dependencies."""
from __future__ import annotations
class AgentAPIError(Exception):
"""Provider failure that the Global Inbox can recover from.
``is_auth`` distinguishes credentials requiring operator action from
retryable provider failures, ... | puffo-ai/puffo-agent | src/puffo_agent/agent/errors.py | .py | 95a2f03eb35c6b0f | 7.42 | 6 |
"""SignedEvent builder for events posted to /spaces/events."""
from __future__ import annotations
import os
import uuid
from typing import Any
from ..crypto.canonical import canonicalize_for_signing
from ..crypto.encoding import base64url_encode
from ..crypto.primitives import Ed25519KeyPair
def random_event_id() ... | puffo-ai/puffo-agent | src/puffo_agent/agent/events.py | .py | 19517d0712ac115a | 7.42 | 6 |
"""Read-only file browser served over the daemon's WebSocket RPC.
Executes ``list_files`` / ``read_file`` RPCs against a whitelist of
directories; never exposes secrets or anything outside the whitelist.
"""
from __future__ import annotations
import logging
import os
from typing import Tuple
logger = logging.getLog... | puffo-ai/puffo-agent | src/puffo_agent/agent/file_browser.py | .py | 5e95e72c4651ef6b | 7.42 | 6 |
"""Failure gates for the Global Inbox runtime: degraded backoff + drained park."""
from __future__ import annotations
import time
from .global_inbox_types import RuntimeHealth
# degrade = transient incident, not a verdict on pending rows; the runtime
# re-arms its own bounded backoff so retries don't depend on unre... | puffo-ai/puffo-agent | src/puffo_agent/agent/global_inbox_degraded.py | .py | 3fb6115832ae9665 | 7.42 | 6 |
from __future__ import annotations
import asyncio
from dataclasses import dataclass, field
from typing import Any, Awaitable, Callable, Protocol, Sequence
from .context_controller import AdmissionCandidate
from .message_projection import canonical_target_parts, format_message_group
from .message_store import MessageS... | puffo-ai/puffo-agent | src/puffo_agent/agent/global_inbox_types.py | .py | bdb27c33bbac102a | 7.42 | 6 |
"""Provider-neutral command/event contract for interactive harnesses.
The native diagnostic attached to :class:`HarnessEvent` is intentionally an
opaque, non-serializable object. It is available to an in-process debugger,
but is never part of the public event or structured logging contracts.
"""
from __future__ impo... | puffo-ai/puffo-agent | src/puffo_agent/agent/harness/driver.py | .py | db7861535ee227af | 7.42 | 6 |
"""Currency utilities with 24h cached USD base rates.
Fetches USD-based currency rates from the JSDelivr currency API and caches the
uppercased currency mapping for 24 hours using async-lru's built-in TTL.
All conversions use Decimal for precision.
"""
from __future__ import annotations
import asyncio
from decimal i... | Atena-IT/tokenpricing | libraries/python/src/tokenpricing/currency.py | .py | d1ec6578363389bc | 7.5 | 9 |
"""Data models for canonical AI model pricing information."""
from datetime import datetime
from pydantic import BaseModel, Field
class PricingInfo(BaseModel):
"""Pricing information for a model."""
input_per_million: float = Field(
description="Price per million input tokens in the specified curre... | Atena-IT/tokenpricing | libraries/python/src/tokenpricing/modeling.py | .py | 1c7066f56bcb7809 | 7.5 | 9 |
"""Fetch and manage canonical pricing data from tokenpricing.
Data source: https://github.com/Atena-IT/tokenpricing
"""
import httpx
from async_lru import alru_cache
from tokenpricing.modeling import PricingData
# Canonical pricing data URL - updated every 6 hours
CANONICAL_DATASET_URL = "https://raw.githubusercont... | Atena-IT/tokenpricing | libraries/python/src/tokenpricing/pricing.py | .py | 1e8d4314154d8d10 | 7.5 | 9 |
import asyncio
import functools
import threading
from typing import Any, Callable, Coroutine, ParamSpec
P = ParamSpec("P")
class _AsyncThread(threading.Thread):
"""helper thread class for running async coroutines in a separate thread"""
def __init__(self, coroutine: Coroutine[Any, Any, Any]):
self.... | Atena-IT/tokenpricing | libraries/python/src/tokenpricing/safeasyncio.py | .py | 5f25028761671ed1 | 7.5 | 9 |
"""Suggestions utilities for helpful "Did you mean?" error messages.
Provides fuzzy string matching using thefuzz library with high thresholds
to suggest likely intended values when exact lookups fail. This is NOT for
automatic approximate matching—lookups remain exact, but errors become
more informative.
"""
from __... | Atena-IT/tokenpricing | libraries/python/src/tokenpricing/suggestions.py | .py | ea6a248894b188a9 | 7.5 | 9 |
"""Tests for synchronous public API wrappers.
Tests that sync versions work correctly and use the same cache as async versions.
"""
from decimal import Decimal
from unittest.mock import Mock, patch
import pytest
from tokenpricing import compute_cost_sync, get_pricing_sync
@pytest.fixture
def sample_llmtracker_res... | Atena-IT/tokenpricing | libraries/python/tests/test_core.py | .py | a547adf1807fb6af | 7 | 9 |
"""Tests for data models."""
from datetime import datetime
import pytest
from tokenpricing.modeling import (
MetadataInfo,
ModelInfo,
PricingData,
PricingInfo,
ProviderInfo,
SourceInfo,
)
class TestPricingInfo:
"""Test PricingInfo model."""
def test_pricing_info_creation(self):
... | Atena-IT/tokenpricing | libraries/python/tests/test_modeling.py | .py | 1a52eac8b00b5310 | 8 | 9 |
"""Tests for suggestions utilities (\"Did you mean?\" suggestions)."""
import pytest
from tokenpricing.suggestions import (
DEFAULT_SCORE_THRESHOLD,
FuzzyMatch,
suggest_match,
suggest_currency,
suggest_model,
)
class TestFuzzyMatch:
"""Test FuzzyMatch dataclass."""
def test_is_exact_tru... | Atena-IT/tokenpricing | libraries/python/tests/test_suggestions.py | .py | 622b9b7b01c74eef | 8 | 9 |
"""Amp agent implementation."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, ClassVar
from ai_rules.agents.base import Agent
if TYPE_CHECKING:
from ai_rules.mcp import MCPManager
class AmpAgent(Agent):
"""Agent for Amp configuration."""
name = "Amp"
... | wpfleger96/ai-agent-rules | src/ai_rules/agents/amp.py | .py | 89bcd05b18c4cb9d | 7.5 | 9 |
"""Base agent class."""
from __future__ import annotations
from abc import abstractmethod
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar
from ai_rules.targets.base import ConfigTarget
if TYPE_CHECKING:
from ai_rules.mcp import MCPManager, MCPStatus... | wpfleger96/ai-agent-rules | src/ai_rules/agents/base.py | .py | 5a6258f3036d810f | 7.5 | 9 |
"""Claude Code agent implementation."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, ClassVar
from ai_rules.agents.base import Agent
from ai_rules.utils import is_managed_target
if TYPE_CHECKING:
from ai_rules.claude_extensions import ClaudeExtensionStatus
fr... | wpfleger96/ai-agent-rules | src/ai_rules/agents/claude.py | .py | d6c0b54debe756ea | 7.5 | 9 |
"""Codex CLI agent implementation."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, ClassVar
from ai_rules.agents.base import Agent
if TYPE_CHECKING:
from ai_rules.mcp import MCPManager
class CodexAgent(Agent):
"""Agent for Codex CLI configuration."""
n... | wpfleger96/ai-agent-rules | src/ai_rules/agents/codex.py | .py | 98e02b5265eb535c | 7.5 | 9 |
"""Gemini CLI agent implementation."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from ai_rules.agents.base import Agent
if TYPE_CHECKING:
from ai_rules.mcp import MCPManager
class GeminiAgent(Agent):
"""Agent for Gemini CLI configuration."""
name = "... | wpfleger96/ai-agent-rules | src/ai_rules/agents/gemini.py | .py | 74571f4aab1d33b1 | 7.5 | 9 |
"""Goose agent implementation."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, ClassVar
from ai_rules.agents.base import Agent
from ai_rules.platform import get_goose_config_dir
if TYPE_CHECKING:
from ai_rules.mcp import MCPManager
class GooseAgent(Agent):
... | wpfleger96/ai-agent-rules | src/ai_rules/agents/goose.py | .py | 873f224d99d5c644 | 7.5 | 9 |
"""Shared agent implementation for agent-agnostic configurations."""
from __future__ import annotations
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
from ai_rules.agents.base import Agent
if TYPE_CHECKING:
from ai_rules.skills import SkillStatus
class SharedA... | wpfleger96/ai-agent-rules | src/ai_rules/agents/shared.py | .py | 053d5ecddd9f46c4 | 7.5 | 9 |
"""Tool installation utilities."""
from __future__ import annotations
import re
import shutil
import subprocess
import sys
import tomllib
from enum import Enum, auto
from pathlib import Path
from typing import TYPE_CHECKING
from urllib.parse import urlparse
if TYPE_CHECKING:
from ai_rules.bootstrap.updater impo... | wpfleger96/ai-agent-rules | src/ai_rules/bootstrap/installer.py | .py | 8f3f584cd7e4cf26 | 7.5 | 9 |
"""Version utilities for package management."""
from packaging.version import InvalidVersion, Version
def parse_version(version_str: str) -> Version:
"""Parse version string, handling 'v' prefix.
Args:
version_str: Version string (e.g., "1.2.3" or "v1.2.3")
Returns:
Parsed Version objec... | wpfleger96/ai-agent-rules | src/ai_rules/bootstrap/version.py | .py | 31593aa87b044834 | 7.5 | 9 |
from __future__ import annotations
import sys
import click
import ai_rules.cli as cli_facade
from ai_rules.cli.display import dim, print_dim
@click.group()
def exclude() -> None:
"""Manage exclusion patterns."""
pass
@exclude.command("add")
@click.argument("pattern")
def exclude_add(pattern: str) -> Non... | wpfleger96/ai-agent-rules | src/ai_rules/cli/groups/exclude.py | .py | f970740a2ae2e475 | 7.5 | 9 |
"""Shell completion installation and management."""
import os
import re
from dataclasses import dataclass
from pathlib import Path
COMPLETION_MARKER_START = "# ai-agent-rules shell completion"
COMPLETION_MARKER_END = "# End ai-agent-rules shell completion"
_LEGACY_MARKER_START = "# ai-rules shell completion"
_LEGAC... | wpfleger96/ai-agent-rules | src/ai_rules/completions.py | .py | 6ff699e8d60523e1 | 7.5 | 9 |
#!/usr/bin/env python3
"""Example script demonstrating how to update credentials remotely via HTTP."""
import json
import os
import sys
from pathlib import Path
import requests
def _auth_headers(token: str | None = None) -> dict[str, str]:
"""Build request headers, adding an admin bearer token when configured.
... | lusky3/play-store-mcp | examples/update_credentials.py | .py | 12b2bad3a726610b | 7.65 | 19 |
"""Pytest configuration and fixtures."""
from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING, Any
from unittest.mock import MagicMock, patch
import structlog
if TYPE_CHECKING:
from collections.abc import Generator
import pytest
from play_store_mcp.client import PlaySto... | lusky3/play-store-mcp | tests/conftest.py | .py | 1120feec788f8f10 | 8.15 | 19 |
"""Integration tests with real Google Play API.
These tests use real credentials but only perform READ operations.
No destructive changes are made to Play Console.
To run these tests:
1. Source the .env.local file: source .env.local
2. Run: pytest tests/test_integration.py -v -s
IMPORTANT: These tests require:
- Val... | lusky3/play-store-mcp | tests/test_integration.py | .py | 76faa1bfd4ff65b8 | 8.15 | 19 |
#!/usr/bin/env python3
"""Integration test for the remote credentials feature."""
import os
import socket
import subprocess
import sys
import tempfile
import time
import requests
def _find_free_port() -> int:
"""Find a free port by binding to port 0."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM)... | lusky3/play-store-mcp | tests/test_integration_credentials.py | .py | f3a556f0e92f9d85 | 8.15 | 19 |
#!/usr/bin/env python3
"""Quick integration test script for Play Store MCP Server.
This script performs safe, read-only operations to verify the API works.
No changes are made to Play Console.
Usage:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/credentials.json"
export TEST_PACKAGE_NAME="com.your.app" # O... | lusky3/play-store-mcp | tests/test_live_api.py | .py | 09da096b801f34bf | 8.15 | 19 |
"""Tests for Pydantic models."""
from __future__ import annotations
from play_store_mcp.models import (
AppDetails,
DeploymentResult,
Release,
Review,
SubscriptionProduct,
)
class TestRelease:
"""Test Release model."""
def test_release_minimal(self) -> None:
"""Test creating a r... | lusky3/play-store-mcp | tests/test_models.py | .py | d64e6e8da24e9821 | 8.15 | 19 |
"""Tests for MCP server tools."""
from __future__ import annotations
from unittest.mock import MagicMock
import pytest
class TestServerTools:
"""Test MCP server tool functions."""
@pytest.fixture
def mock_client(self) -> MagicMock:
"""Create a mock PlayStoreClient."""
return MagicMock(... | lusky3/play-store-mcp | tests/test_server.py | .py | 81840b154c9aef3a | 8.15 | 19 |
"""Trajectory analysis helpers for the macromolecule visualization notebook."""
from __future__ import annotations
import warnings
import numpy as np
import pandas as pd
import plotly.express as px
from MDAnalysis.lib.distances import distance_array
from helpers.config import LIGAND_SELECTION, RECEPTOR_SELECTION
... | appautomaton/mlx-atomistic | notebooks/archive/atp-pocket-mlx-demo/helpers/analysis.py | .py | 14c52e4a74e41cae | 7.57 | 13 |
"""Configuration for the macromolecule visualization notebook."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
LIGAND_RESNAMES = ["ATP", "ADP", "ANP", "ACP", "MG"]
LIPID_RESNAMES = ["POPC", "POPE", "POPS", "POPG", "DPPC", "DOPC", "CHOL", "CARD", "CDL"]
RECEPTOR_SELECT... | appautomaton/mlx-atomistic | notebooks/archive/atp-pocket-mlx-demo/helpers/config.py | .py | 7735fdf1c13ead98 | 7.57 | 13 |
"""Static py3Dmol structure previews for the notebook."""
from __future__ import annotations
from pathlib import Path
import py3Dmol
from helpers.config import (
LIGAND_RESNAMES,
LIPID_RESNAMES,
STRUCTURE_FORMAT_BY_SUFFIX,
VIEWER_HEIGHT,
VIEWER_WIDTH,
)
def style_macromolecule(view):
"""St... | appautomaton/mlx-atomistic | notebooks/archive/atp-pocket-mlx-demo/helpers/static_views.py | .py | 147e278370aea0af | 7.57 | 13 |
#!/usr/bin/env python
"""Generate Starlight API-reference pages from mlx_atomistic docstrings.
Static-only: this uses Griffe's AST loader, so it never imports the package and
needs neither MLX nor a Metal GPU. That keeps it runnable on Linux Pages CI.
# Apple Silicon, with the project's docs group:
uv run --g... | appautomaton/mlx-atomistic | scripts/gen_api_docs.py | .py | ad78dc729a52d4a8 | 7.57 | 13 |
#!/usr/bin/env python
"""Generate Starlight narrative pages from the canonical ``docs/`` tree."""
from __future__ import annotations
import argparse
import json
import os
import re
import shutil
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
DOCS = ROOT / "docs"
OUT = ROOT / "site"... | appautomaton/mlx-atomistic | scripts/sync_site_docs.py | .py | af0f711d0740ac2e | 7.57 | 13 |
"""
Agent Factory
Factory for creating and initializing agents with Ollama integration
"""
from typing import Optional, Dict, Any
from ..core.types import AgentConfig, AgentRole, IndustryNiche
from ..core.agent_initializer import get_agent_initializer
from ..integrations.local_llm import get_local_llm, LocalLLMProvider... | Team-Deepiri/diri-cyrex | app/agents/agent_factory.py | .py | 66e62786ccee8297 | 7.48 | 8 |
"""
Creative Sparker Agent Implementation
"""
from typing import Dict, Any
from ..base_agent import BaseAgent
from ..prompts.creative_sparker_prompts import CREATIVE_SPARKER_PROMPT
from ...core.types import AgentConfig, AgentRole
class CreativeSparkerAgent(BaseAgent):
"""Agent specialized in creative idea... | Team-Deepiri/diri-cyrex | app/agents/implementations/creative_sparker_agent.py | .py | e7a4fb7143318e05 | 7.48 | 8 |
"""
Engagement Specialist Agent Implementation
"""
from typing import Dict, Any
from ..base_agent import BaseAgent
from ..prompts.engagement_specialist_prompts import ENGAGEMENT_SPECIALIST_PROMPT
from ...core.types import AgentConfig, AgentRole
class EngagementSpecialistAgent(BaseAgent):
"""Agent speciali... | Team-Deepiri/diri-cyrex | app/agents/implementations/engagement_specialist_agent.py | .py | b00532f45914599e | 7.98 | 8 |
"""
Quality Assurance Agent Implementation
"""
from typing import Dict, Any
from ..base_agent import BaseAgent
from ..prompts.quality_assurance_prompts import QUALITY_ASSURANCE_PROMPT
from ...core.types import AgentConfig, AgentRole
class QualityAssuranceAgent(BaseAgent):
"""Agent specialized in quality a... | Team-Deepiri/diri-cyrex | app/agents/implementations/quality_assurance_agent.py | .py | bf2c81ea6ed476d9 | 7.48 | 8 |
"""
Task Decomposer Agent Implementation
"""
from typing import Dict, Any
from ..base_agent import BaseAgent
from ..prompts.task_decomposer_prompts import TASK_DECOMPOSER_PROMPT
from ...core.types import AgentConfig, AgentRole
from ...core.agent_initializer import get_agent_initializer
from ...integrations.loca... | Team-Deepiri/diri-cyrex | app/agents/implementations/task_decomposer_agent.py | .py | 8d7b57a3b01286ce | 7.48 | 8 |
"""
Time Optimizer Agent Implementation
"""
from typing import Dict, Any
from ..base_agent import BaseAgent
from ..prompts.time_optimizer_prompts import TIME_OPTIMIZER_PROMPT
from ...core.types import AgentConfig, AgentRole
class TimeOptimizerAgent(BaseAgent):
"""Agent specialized in time optimization"""
... | Team-Deepiri/diri-cyrex | app/agents/implementations/time_optimizer_agent.py | .py | 01265e10f4989eb3 | 7.48 | 8 |
"""
Utility Tools for Agents
General utility tools for agents, delegated to diri-agent-toolbox so behavior
matches ComprehensiveAPITools (no duplicated implementations).
"""
from typing import Any, Dict
from diri_agent_toolbox.data import json_format, json_parse, safe_calculate
from ...logging_config import get_logge... | Team-Deepiri/diri-cyrex | app/agents/tools/utility_tools.py | .py | e99878e3fd31c0fe | 7.48 | 8 |
"""API key authorization policy for the Cyrex HTTP surface.
Deliberately free of framework and settings imports so the policy can be unit
tested without standing up the app or its dependencies.
"""
from __future__ import annotations
import hmac
from typing import Optional
# Served before authentication so orchestra... | Team-Deepiri/diri-cyrex | app/api_key_auth.py | .py | b6fe6f412444d9f5 | 7.48 | 8 |
"""
Database Configuration
Connection management for MongoDB and SQL databases
"""
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo import MongoClient
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from ..settings import settings
from ..logging_config import get_log... | Team-Deepiri/diri-cyrex | app/config/database.py | .py | 37c7a935b6c49ea7 | 7.48 | 8 |
"""
Agent Initialization System
Data structures and initialization logic for agent setup
"""
from typing import Dict, List, Optional, Any
from datetime import datetime
from ..core.types import AgentConfig, AgentRole, AgentStatus
from ..database.postgres import get_postgres_manager
from ..logging_config import g... | Team-Deepiri/diri-cyrex | app/core/agent_initializer.py | .py | d647b924091204eb | 7.48 | 8 |
"""
Agent State Processor
LangChain-style state processing for agent invocations
Processes current state and generates response based on LLM
"""
from typing import Dict, List, Optional, Any, Callable
from dataclasses import dataclass, field, asdict
from datetime import datetime
from enum import Enum
import jso... | Team-Deepiri/diri-cyrex | app/core/agent_state_processor.py | .py | 082f684f5f5ef774 | 7.48 | 8 |
"""
Authentication System
API key and token-based authentication for agents and API endpoints
"""
from typing import Dict, Optional, Any, Callable
from dataclasses import dataclass
from datetime import datetime, timedelta
from enum import Enum
import hashlib
import secrets
import os
import jwt
from ..databa... | Team-Deepiri/diri-cyrex | app/core/authentication.py | .py | e2d1883471089233 | 7.48 | 8 |
"""
HTTP Connection Pool Manager for Ollama
Reuses HTTP connections across requests to eliminate TCP handshake overhead.
This provides 50-100ms latency reduction per request.
"""
import asyncio
import httpx
from typing import Optional, Dict
from ..logging_config import get_logger
logger = get_logger("cyrex... | Team-Deepiri/diri-cyrex | app/core/connection_pool.py | .py | 72edc06c0cb72be0 | 7.48 | 8 |
"""
Enhanced Guardrails System
Comprehensive safety, content filtering, and policy enforcement
"""
from typing import Dict, List, Optional, Any, Callable
from datetime import datetime
import re
import asyncio
from ..database.postgres import get_postgres_manager
from ..logging_config import get_logger
import j... | Team-Deepiri/diri-cyrex | app/core/enhanced_guardrails.py | .py | c5ad6f694cf9bd10 | 7.48 | 8 |
"""
Event Registry
Centralized registry for event types, schemas, and handlers
"""
from typing import Dict, List, Optional, Any, Callable
from dataclasses import dataclass, field
from datetime import datetime
from enum import Enum
from pydantic import BaseModel, Field
import json
import uuid
from ..logging_c... | Team-Deepiri/diri-cyrex | app/core/event_registry.py | .py | bc83fff54751f31a | 7.48 | 8 |
"""
Task Execution Engine
Orchestrates tool execution, manages execution trees, and handles step-by-step decomposition
"""
from typing import Dict, List, Optional, Any
from dataclasses import dataclass
from enum import Enum
import asyncio
import re
from datetime import datetime
from ..logging_config import get_logger
f... | Team-Deepiri/diri-cyrex | app/core/execution_engine.py | .py | b69b8a6309a5187b | 7.48 | 8 |
"""
Safety Guardrails
Content filtering, prompt injection detection, output validation
Enterprise-grade safety checks for AI interactions
"""
from typing import Dict, List, Optional, Any, Tuple, Type
from enum import Enum
from dataclasses import dataclass
import re
from datetime import datetime
from ..logging_config im... | Team-Deepiri/diri-cyrex | app/core/guardrails.py | .py | 45640c7f29659316 | 7.48 | 8 |
"""
LangGraph Integration
State machine integration for agent workflows using LangGraph
"""
from typing import Dict, List, Optional, Any, Callable, TypedDict
from datetime import datetime
import asyncio
from ..core.types import LangGraphState
from ..database.postgres import get_postgres_manager
from ..logging_... | Team-Deepiri/diri-cyrex | app/core/langgraph_integration.py | .py | 92f1e3e9f13545fe | 7.48 | 8 |
"""Deterministic offline model for evaluating a PydanticAI target without a provider.
The same reasoning as the OpenAI adapter's controlled model: this replaces the
one thing the target does not own, and it stays neutral on purpose. A model
scripted to choose actions would be authoring the behaviour under evaluation,
... | WaseemGhanem98/AgentCheck | agentcheck/adapters/pydantic_ai_controlled.py | .py | 1e0042c77cbe3e46 | 7.45 | 7 |
"""Strict, independently versioned behavioral-coverage contracts."""
from __future__ import annotations
import hmac
from enum import Enum
from typing import Annotated, Literal
from pydantic import Field, model_validator
from agentcheck.domain import ContractModel, canonical_hash
from agentcheck.privacy import redac... | WaseemGhanem98/AgentCheck | agentcheck/coverage/contract.py | .py | d0fb47cb687fdb41 | 7.45 | 7 |
"""Contracts a custom agent implements to be evaluated by AgentCheck.
AgentCheck supports the OpenAI Agents SDK and PydanticAI by rebuilding the
target from its declared surface, so the original tool handlers are never
reachable. An agent written directly against a model API has no framework
surface to rebuild from, s... | WaseemGhanem98/AgentCheck | agentcheck/custom.py | .py | b8353ab0361167b6 | 7.45 | 7 |
"""Versioned, evidence-carrying description of an agent under test."""
from __future__ import annotations
from enum import Enum
from typing import Generic, Literal, TypeVar
from pydantic import Field, model_validator
from .base import ContractModel, JsonObject, UtcDatetime
AGENT_SPEC_CONTRACT_VERSION: Literal["ag... | WaseemGhanem98/AgentCheck | agentcheck/domain/agent_spec.py | .py | 9142931db2daf354 | 7.95 | 7 |
"""Shared primitives for versioned AgentCheck domain contracts."""
from __future__ import annotations
import hashlib
import json
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Any, TypeAlias, TypeVar, Union
from pydantic import AfterValidator, AwareDatetime, BaseModel, ConfigDict
from typi... | WaseemGhanem98/AgentCheck | agentcheck/domain/base.py | .py | a92b869b2772539d | 7.45 | 7 |
"""Strongly typed, replayable deterministic test scenarios."""
from __future__ import annotations
import hmac
from enum import Enum
from typing import Any, Literal
from pydantic import Field, field_validator, model_serializer, model_validator
from .base import ContractModel, JsonObject, JsonValue, canonical_hash
... | WaseemGhanem98/AgentCheck | agentcheck/domain/scenario.py | .py | 231a2385d85fb918 | 7.45 | 7 |
"""Derived launch-stage relations for one recorded run.
AgentCheck's question is not "which call ran first" but "what had the agent
actually observed when it decided to act". A model response can carry several
tool calls at once. Those calls are chosen together, before any of their
results exist, so executing them in ... | WaseemGhanem98/AgentCheck | agentcheck/evaluate/launch.py | .py | 4fee523d6e37b42e | 7.45 | 7 |
"""Load and validate representative input values from inside the target.
Mirrors the policy-pack loader deliberately: contained path, no symlink
following, bounded size, versioned contract, and a ``ConfigurationError`` on
anything malformed. A fixture that cannot be trusted is refused rather than
partially applied, be... | WaseemGhanem98/AgentCheck | agentcheck/fixtures/loader.py | .py | 8b7851679295481f | 7.45 | 7 |
"""Developer-supplied representative input values, as inert versioned data.
A tool may declare only ``confirmation_number: string`` with a prose
description. Nothing in that contract says a realistic value looks like
``TEST-ABC123``, so generation falls back to an obviously synthetic string and
the action path stays s... | WaseemGhanem98/AgentCheck | agentcheck/fixtures/pack.py | .py | 4b5348546b56f014 | 7.45 | 7 |
"""
PASSPORT ISSUER & VAULT MANAGER
Birthplace and issuer of Wooden Tags (VIP/GUEST/BOT) for communicating entities.
Tokens are persisted to JSON file to survive restarts.
"""
import uuid
import hashlib
import time
import json
import os
import threading
from pathlib import Path
_VALID_LEVELS = {"VIP", "GUEST", "BOT", ... | LongLeo287/OmniClaw | core/bridge/passport_issuer.py | .py | 40896863b423b9d8 | 7.45 | 7 |
#!/usr/bin/env python3
"""
build_v5_indices.py — OmniClaw V5.0 Architecture Index Builder
Rebuilds the 6 Core FAST Indices based strictly on Namespace (physical paths)
to prevent legacy `type:` tags from leaking across architectural boundaries.
"""
import os
import re
import json
import logging
from datetime import da... | LongLeo287/OmniClaw | core/ops/scripts/build_v5_indices.py | .py | 7c1033356054b6e8 | 7.45 | 7 |
#!/usr/bin/env python3
"""
ops/scripts/cognitive_reflector.py €” Phase 5 Auto-Synthesis (B3)
Reads all dept briefs from today †’ writes SYNTHESIS_<date>.md + Telegram notify
Usage:
python ops/scripts/cognitive_reflector.py # Synthesize today's briefs
python ops/scripts/cognitive_reflector.py --date 2026-03-... | LongLeo287/OmniClaw | core/ops/scripts/cognitive_reflector.py | .py | 902537e8cc884e01 | 7.45 | 7 |
import os
import sys
import subprocess
import shutil
from pathlib import Path
# Hardcoded Port Assignment (Enforced by backend repo compatibility)
PORT = "20128"
current_dir = Path(__file__).resolve().parent
REPO_ROOT = Path(os.getenv("OMNICLAW_ROOT", current_dir.parents[1])).resolve()
REMOTE_ROOT = Path(os.getenv("O... | LongLeo287/OmniClaw | ecosystem/bridges/launch_9router.py | .py | f490111c6ba2f4f7 | 7.45 | 7 |
"""Holographic Reduced Representations (HRR) with phase encoding.
HRRs are a vector symbolic architecture for encoding compositional structure
into fixed-width distributed representations. This module uses *phase vectors*:
each concept is a vector of angles in [0, 2π). The algebraic operations are:
bind — circula... | LongLeo287/OmniClaw | ecosystem/plugins/holographic/holographic.py | .py | 4bad73e86d5868c0 | 7.45 | 7 |
"""Runtime configuration, resolved from environment variables.
See SPEC.md section 3 for the full table. Flags handled by run.sh / cli.py are
exported into these same env vars before pytest runs, so this is the single
source of truth.
"""
import os
from dataclasses import dataclass
def _env(*names, default=None):
... | OkkBtc/openagent-compat-lab | mcs/config.py | .py | 0e1d5c76dda4849f | 7.45 | 7 |
"""Optional request/response recorder, enabled with ``--record-responses DIR``.
When a record directory is configured, every HTTP request the suite makes and
the response it gets back are written to plain-text files, organised one folder
per test:
DIR/<test-name>/<model>_input.txt # the request body/bodies (pr... | OkkBtc/openagent-compat-lab | mcs/recording.py | .py | d81b9ebd8b99c577 | 7.45 | 7 |
"""Shared pytest fixtures + marker registration.
Lives in the *suites* directory (next to the test modules) so pytest always
loads it as the tests' conftest -- independent of where the rootdir lands. That
matters for the installed `mcs` / curl|bash flow: a conftest one
level up (the package root) is NOT loaded when th... | OkkBtc/openagent-compat-lab | mcs/suites/conftest.py | .py | eedf14ce54685a21 | 7.95 | 7 |
"""core suite -- API contract basics. Reference implementation; see SPEC.md 7.1.
This is the pattern other suites should follow:
- every assertion is deterministic (status, schema, token counts, substring /
regex / closed-set membership) -- there is no LLM judge
- prompts are short and constrained so the struc... | OkkBtc/openagent-compat-lab | mcs/suites/core.py | .py | f210333faf1f6208 | 7.45 | 7 |
"""multiturn suite -- multi-turn conversation state. See SPEC.md 7.6.
Deterministic via a sentinel the model can't guess: state a code early, ask for
it later, assert the exact code comes back. mt-tools (a tool call mid-
conversation) is covered by the tools suite's tools-multiturn, which currently fails
on the -tools... | OkkBtc/openagent-compat-lab | mcs/suites/multiturn.py | .py | 3d613b1f4c178e12 | 7.45 | 7 |
"""robustness suite -- chat-template injection & error paths. See SPEC.md 7.8.
Deterministic structural checks: status codes, special-token leakage (regex),
sentinel membership, Unicode round-trip. These probe the serving/template layer's
resilience, not the model's judgement -- except robust-roleinject, which fails
l... | OkkBtc/openagent-compat-lab | mcs/suites/robustness.py | .py | 4e01b45f85376126 | 7.45 | 7 |
"""streaming suite -- SSE streaming behavior. See SPEC.md 7.2.
Deterministic structural checks only (SPEC.md 6): chunk count, stream
termination, finish_reason presence, stop-sequence honoring. The SSE framing is
itself under test, so stream-basic parses the raw wire bytes.
Note (2026-06): the swissai endpoint does N... | OkkBtc/openagent-compat-lab | mcs/suites/streaming.py | .py | f4695da043dea510 | 7.45 | 7 |
"""tools suite -- OpenAI-compatible function / tool calling. See SPEC.md 7.4.
Deterministic structural checks only (see SPEC.md section 6): tool-call shape,
JSON-parseable `arguments`, required-key presence, closed-set sentinels. No
LLM-as-judge.
Target model: a tool-capable Apertus, e.g.
--model swiss-ai/Apertus... | OkkBtc/openagent-compat-lab | mcs/suites/tools.py | .py | d50dcb4fc82a706e | 7.45 | 7 |
"""pycubrid — Pure Python DB-API 2.0 driver for CUBRID."""
from __future__ import annotations
import ssl as ssl_module
from typing import TYPE_CHECKING, Any
from pycubrid.error_codes import get_error_description
from pycubrid.exceptions import (
DatabaseError,
DataError,
Error,
IntegrityError,
In... | cubrid-lab/pycubrid | pycubrid/__init__.py | .py | ead802ca1095d05e | 7.63 | 17 |
"""PEP 249 cursor implementation for pycubrid."""
from __future__ import annotations
import logging
import re
import time
from typing import TYPE_CHECKING, Any, Sequence
from .constants import CUBRIDStatementType
from ._cursor_common import (
CursorParamsMixin,
DescriptionItem,
DML_BATCH_VERBS,
extra... | cubrid-lab/pycubrid | pycubrid/cursor.py | .py | 9387b0c6588062f6 | 7.63 | 17 |
from __future__ import annotations
import inspect
import logging
from types import TracebackType
from typing import Any, Literal, Protocol
from .constants import CUBRIDDataType as CCI_U_TYPE
from .exceptions import InterfaceError, NotSupportedError, OperationalError
from .protocol import LOBNewPacket, LOBReadPacket, ... | cubrid-lab/pycubrid | pycubrid/lob.py | .py | 1b1b39680639e579 | 7.63 | 17 |
from __future__ import annotations
import datetime
import json
import logging
import struct
from decimal import Decimal, InvalidOperation
from typing import Any
from zoneinfo import ZoneInfo
from .constants import CUBRIDDataType, DataSize
_LOGGER = logging.getLogger(__name__)
# Pre-compiled struct objects — avoids... | cubrid-lab/pycubrid | pycubrid/packet.py | .py | 3c19ba695327201a | 7.63 | 17 |
"""Optional driver-level timing statistics.
When ``enable_timing=True`` is passed to :func:`pycubrid.connect` (or
the ``PYCUBRID_ENABLE_TIMING`` environment variable is set), a
:class:`TimingStats` instance is attached to the connection and records
nanosecond-precision elapsed times for connect, execute, fetch, and
cl... | cubrid-lab/pycubrid | pycubrid/timing.py | .py | 7a22b925f7c8cf3f | 7.63 | 17 |
#!/usr/bin/env python3
"""Verify that the public API surface has not changed unexpectedly.
This script extracts the public API surface of ``pycubrid`` and ``pycubrid.aio``
and compares it against a committed baseline (``api-baseline.json``). If the
surface differs, the script prints a structured diff and exits non-zer... | cubrid-lab/pycubrid | scripts/check_public_api.py | .py | 70f0111af8056abc | 7.63 | 17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.