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
"""Unit tests for the gh-graph dependency-navigation tool. Covers forward imports (ast), reverse imports (grep over a temp repo), and graceful degradation on non-Python / missing files. Run with: pytest tests/ -q """ import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent / ...
remyxai/outrider
tests/test_gh_graph.py
.py
82aee953ce12b5ea
8.16
20
"""Tests for the inline refinement chain. After recommend mode files a draft PR, the same run.py invocation continues sequentially into the chain — fidelity audit → convention pass → test gate — on the just-opened PR, so the chain runs by default without the customer deploying the standalone outrider-fidelity/conventi...
remyxai/outrider
tests/test_inline_refinement_chain.py
.py
1ad7ee11fe79b435
7.16
20
"""Regression tests: the INVOCATION.md prompt must not open with `---`. INVOCATION.md carries OKF-conformant YAML frontmatter. The file is passed verbatim as the Claude CLI's `-p` value, and the CLI's option parser reads a leading `---` as an unknown flag (`error: unknown option '---'`), hard-failing the implementatio...
remyxai/outrider
tests/test_invocation_frontmatter_strip.py
.py
a6b8076f1aa97825
8.16
20
"""Log-emission tests for lead-content connector routing. When a connector (Linear, and later GitHub / engine.remyx.ai) returns a non-ok status, the coding session proceeds by falling through to the raw URL — so the failure would otherwise be invisible until someone re-runs the dispatch. The log line has to carry `err...
remyxai/outrider
tests/test_lead_content_log_detail.py
.py
06d26d76ac41ec5d
8.16
20
"""Screen-capture helpers, isolated so they can be mocked in tests.""" from __future__ import annotations import cv2 import mss import numpy as np def capture_region(x: int, y: int, w: int, h: int) -> np.ndarray: with mss.mss() as sct: return cv2.cvtColor(np.array(sct.grab({"left": x, "top": y, "width": ...
SuperiorIntelligence/chess-vision-ai
chess_vision_ai/capture.py
.py
00708a8c262bea0a
7.65
19
"""Pure functions for turning a detected board map into a valid FEN. Nothing here touches the filesystem, the network, or an engine, which makes this the easiest module in the project to unit test exhaustively. """ from __future__ import annotations MAX_COUNT = {"K": 1, "k": 1, "Q": 9, "q": 9, "R": 10, "r": 10, ...
SuperiorIntelligence/chess-vision-ai
chess_vision_ai/fen_utils.py
.py
109ca297c29e2f29
7.65
19
"""Standard-library logging configuration for the whole app. The Tkinter UI still wants a human-readable, line-by-line log for its on-screen "Log" tab — that behaviour is preserved by attaching a callback handler (see ``attach_ui_handler``) instead of routing everything through scattered ``print()`` calls. """ from __...
SuperiorIntelligence/chess-vision-ai
chess_vision_ai/logging_setup.py
.py
a150add14e0362e0
7.65
19
"""Typed data structures shared across the app. Using dataclasses instead of ad-hoc dicts makes the engine/UI boundary explicit, gives editors/type-checkers something to work with, and prevents typo bugs like ``m["scor"]`` from silently returning ``None``. """ from __future__ import annotations from dataclasses impor...
SuperiorIntelligence/chess-vision-ai
chess_vision_ai/models.py
.py
e1029d882fb4828f
7.65
19
import chess from chess_vision_ai.phase import GamePhase, detect_phase def test_starting_position_is_opening(): assert detect_phase(chess.Board()) == GamePhase.OPENING def test_kr_vs_k_is_tablebase(): board = chess.Board("8/8/8/4k3/8/8/4R3/4K3 w - - 0 1") assert detect_phase(board) == GamePhase.TABLEBA...
SuperiorIntelligence/chess-vision-ai
tests/test_phase.py
.py
dcd4dbb70b1e618e
7.15
19
import json import logging import traceback from datetime import datetime, timezone from pathlib import Path from app.core.config import settings # Maximum number of log entries kept in the file before oldest are trimmed MAX_LOG_LINES = 500 # Custom level above WARNING (30) — used to highlight successful # operatio...
deep-div/url-shortener
backend/app/core/logging.py
.py
d2cc1319d5ba8959
7.56
12
from urllib.parse import urlparse def validate_url(url: str) -> None: parsed = urlparse(url) if parsed.scheme not in ("http", "https"): raise ValueError("URL must start with http:// or https://") if not parsed.netloc: raise ValueError("URL has no domain") def extract_code(value: str) -...
deep-div/url-shortener
backend/app/modules/url_shortener/security.py
.py
a5014dacebe65eb0
7.56
12
#!/usr/bin/env python3 """ Release tool for the wicked-garden unified plugin. Since the repo is a single plugin, this script releases from the repo root. The --changed flag checks if there are any changes since the last tag. Usage: python batch_release.py --changed # Release if changed python bat...
mikeparcewski/wicked-garden
.claude/skills/releasing/scripts/batch_release.py
.py
1b92dc2d56fd0e20
7.48
8
#!/usr/bin/env python3 """ Generate changelog from git commit history. Usage: python changelog.py <component-path> [--since <tag>] [--format <format>] Formats: markdown (default), json, plain """ import subprocess import re import sys import json from datetime import datetime from typing import List, Dict, A...
mikeparcewski/wicked-garden
.claude/skills/releasing/scripts/changelog.py
.py
21ee3ad124171f3d
7.48
8
#!/usr/bin/env python3 """ Release automation tool for the wicked-garden unified plugin. Usage: python release.py <component-path> [options] Options: --bump <major|minor|patch> Force specific version bump --version <version> Set specific version --dry-run Preview changes wit...
mikeparcewski/wicked-garden
.claude/skills/releasing/scripts/release.py
.py
21a00611776e1618
7.48
8
#!/usr/bin/env python3 """ Component scaffolding tool for the wicked-garden unified plugin. Skills-only layout: the plugin ships skills and hooks. The former commands/ and agents/ trees were absorbed into skills/ — * a former COMMAND is now an ACTION of a consolidated per-domain router skill at skills/{domain}/...
mikeparcewski/wicked-garden
.claude/skills/scaffolding/scripts/scaffold.py
.py
ff3a0dd291dc6143
7.48
8
""" daemon/__init__.py — wicked-garden daemon package. The daemon is a background service that: - Monitors the wicked-bus event stream for garden-relevant events - Manages council sessions (multi-model voting) - Runs HITL (human-in-the-loop) hooks - Maintains a projector for state projection - Provides an HTTP server ...
mikeparcewski/wicked-garden
daemon/__init__.py
.py
eecd5aee3eb5699c
7.48
8
#!/usr/bin/env python3 """SessionEnd hook — heavy cadence work that previously ran every Stop. Provenance: v9.2.15 redesign. Stop fires per-turn (~30/session). The four heavy functions (memory decay/consolidation, telemetry, guard pipeline) are session-scope work and do not need to run after every model response. Thi...
mikeparcewski/wicked-garden
hooks/scripts/session_end.py
.py
0260be6add06e86d
7.48
8
# Copyright (c) InverSQL Authors - All Rights Reserved import dataclasses as dcls import logging from collections import abc as cabc import sqlglot from sklearn import tree from inversql.joins import ( Joiner, JoinerList, cross_joiner, shared_col_name_joiner, ) from inversql.rels import SkLearnTreeRe...
rentruewang/inversql
src/inversql/pipelines.py
.py
56bde6b0491562ba
7.62
16
# Copyright (c) InverSQL Authors - All Rights Reserved "Relations." import abc import dataclasses as dcls import functools import math import operator import typing from collections import abc as cabc import numpy as np import pandas as pd import sqlglot from numpy import typing as npt from sklearn import tree from ...
rentruewang/inversql
src/inversql/rels.py
.py
831b72f27ebd806d
7.62
16
# Copyright (c) InverSQL Authors - All Rights Reserved import abc import collections import dataclasses as dcls import functools import typing from collections import abc as cabc import numpy as np import sympy from sklearn import tree from sklearn.utils import validation from inversql._utils import BoolArray, Float...
rentruewang/inversql
src/inversql/trees.py
.py
277924a5a08e009e
7.62
16
# Copyright (c) InverSQL Authors - All Rights Reserved import pandas as pd import pytest from inversql.joins import ( FilteredJoiner, Joiner, JoinerList, all_subsets, cross_joiner, shared_col_name_joiner, ) from inversql.rels import SourceRelation def _sets(): yield "abcde" yield "ab...
rentruewang/inversql
tests/test_joins.py
.py
dafe4b5c7a6ed693
7.12
16
import torch import torch.nn.functional as F from dataclasses import dataclass # from configs.guidance_config import GuidanceConfig # from diffusers import IFPipeline, UNet2DConditionModel from diffusers.pipelines.deepfloyd_if.pipeline_if import IFPipeline from diffusers.models.unets.unet_2d_condition import UNet2DCon...
threedle/radmesh
radmesh/csd.py
.py
eff8679829888511
7.66
20
from typing import Optional, Callable, TypeVar, List, Tuple from functools import partial, lru_cache import os import sys from contextlib import contextmanager _T = TypeVar("_T") _S = TypeVar("_S") def expect(mx: Optional[_T], exc: Exception) -> _T: if mx is None: raise exc else: return mx ...
threedle/radmesh
radmesh/misc_helpers.py
.py
80a4a1fd5705211f
7.66
20
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn.functional as F def quaternion_to_matrix(quaternions: torch.Tensor) -> torch.Ten...
threedle/radmesh
radmesh/pytorch3d/transforms.py
.py
e88c12b84fae0c24
7.66
20
"""Create or delete a hosted Foundry support agent for the end-to-end tutorial. The tutorial in ``docs/tutorial-end-to-end.md`` walks the user through a realistic agent-with-tools evaluation. This helper avoids forcing the user to click through the Foundry portal: it registers three function tools (``lookup_order``, `...
Azure/agentops
scripts/create_support_agent.py
.py
8d5bd2e9398dd2cf
7.57
13
"""Aggregate per-scenario E2E artifacts into a single Markdown summary. Reads downloaded GitHub Actions artifacts from ``artifacts/<job-name>/`` and emits a single Markdown summary table to stdout (or ``--out`` if provided) covering both the offline smoke scenarios and every live-* scenario, so the run page shows one ...
Azure/agentops
scripts/e2e_aggregate_summary.py
.py
3db156f33cca1d37
7.57
13
"""End-to-end demo runner for AgentOps. Exercises the full CLI surface against an in-process HTTP echo agent and produces a self-contained ``evidence/`` folder suitable for pull-request reviews and GitHub Actions artifact uploads. The script is offline by design: it does not contact Azure, Foundry, or any real model ...
Azure/agentops
scripts/e2e_demo.py
.py
1db7e5943a207fe6
7.57
13
"""Render scenario-specific agentops.yaml files for the e2e workflow. Reads target identifiers from environment variables (set by the GitHub Actions workflow from repo Actions Variables + Bicep outputs) and writes one agentops.yaml per scenario into ``./e2e-runs/<scenario>/``. Scenarios: - foundry-prompt: AGENTOPS_...
Azure/agentops
scripts/e2e_render_config.py
.py
04a4351e949b247a
7.57
13
"""Legacy id / category aliases for the WAF-aligned rename. This module is the single auditable home for the ``genaiops`` -> ``operational_excellence`` / ``genaiops.*`` -> ``opex.*`` rename. It exists to soften the upgrade for users with existing ``agent.yaml`` files that reference the old names; the canonical surface...
Azure/agentops
src/agentops/agent/_legacy_ids.py
.py
371cc24ab5d94f2d
7.57
13
"""Lazy Azure SDK glue for the ``rbac_openai_data_plane`` Doctor check. Kept in a private module so the parent check can attempt the lazy import in a single place and stay silent when ``azure-identity`` / ``azure-mgmt-authorization`` are not installed. All errors that should make the check skip are normalised into :cl...
Azure/agentops
src/agentops/agent/checks/_rbac_authorization.py
.py
149bccc458ebdca3
7.57
13
"""Operational excellence check. Pipeline-hygiene findings that are time-based or stability-based rather than file-based (which live in :mod:`agentops.agent.checks.mlops`). Findings emitted: * ``opex.stale_evaluation`` - Doctor warns when no fresh eval run has landed in the configured window. * ``opex.flaky_metric...
Azure/agentops
src/agentops/agent/checks/opex.py
.py
01e13d437e200398
7.57
13
"""Check: signed-in principal has Cognitive Services OpenAI User RBAC. Cloud eval graders and any other data-plane Azure OpenAI call run by ``agentops eval run`` need the **Cognitive Services OpenAI User** role (or another role granting the ``Microsoft.CognitiveServices/accounts/OpenAI/*/action`` data action) on the A...
Azure/agentops
src/agentops/agent/checks/rbac_openai_data_plane.py
.py
03360a5bc1482bcd
7.57
13
"""Severity-ranked findings produced by the watchdog agent.""" from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict class Category(str, Enum): """High-level grouping for a finding. Categories are stable user-facing buckets used for f...
Azure/agentops
src/agentops/agent/findings.py
.py
2df8e12f445418da
7.57
13
"""Append-only analysis history for the watchdog agent. Each ``agentops doctor`` invocation appends one JSON record to ``.agentops/agent/history.jsonl``. The file is the canonical local storage for the cockpit (``agentops cockpit``) and for any future trend-based checks. No Azure resource required. When OpenTelemetry...
Azure/agentops
src/agentops/agent/history.py
.py
90e06246eda1c856
7.57
13
"""WAF AI Landing Zones knowledge base for the Doctor agent. This package ships a CSV (`waf-checklist.csv`) that maps every Doctor finding id to the Microsoft Well-Architected Framework (WAF) for AI workloads pillar/area it belongs to. The shipped CSV is the **packaged baseline**. Users can override or extend it on a...
Azure/agentops
src/agentops/agent/knowledge/__init__.py
.py
0f06fd7ca1662534
7.57
13
"""Base helpers for individual LLM-judged rules. Every rule shares the same shape: a focused system prompt, a Pydantic schema for the verdict, and a small builder that converts a verdict into a :class:`Finding`. This module factors out the duplicate code. """ from __future__ import annotations import hashlib from da...
Azure/agentops
src/agentops/agent/llm_assist/_base.py
.py
c1cb1b6edcf97edf
7.57
13
"""LLM-judged Operational Excellence check: evaluator-bundle coverage. Reads the project's evaluator bundle YAML and a short agent description excerpt, then asks the judge model whether the bundle covers the evaluators a project of that shape typically needs (e.g. a RAG agent without ``GroundednessEvaluator``). """ f...
Azure/agentops
src/agentops/agent/llm_assist/_bundle_rule.py
.py
5bbbcce035a63c01
7.57
13
#!/usr/bin/env python3 """Regenerate data/ioc-index.csv from the **IOCs:** lines of families/<category>/*.md. Output is a plain CSV (header row `indicator,type,family,category`), greppable: `grep -i '<hash-or-defanged-domain>' data/ioc-index.csv`. Hashes are authoritative. Domains and IPs are stored FULLY DEFANGED (ev...
stuartjash/macos-malware-kb
scripts/build-ioc-index.py
.py
d7c034a0a2ff4349
7.56
12
#!/usr/bin/env python3 """Defang every domain and IP in the family entries (in place). Rewrites domains/IPs to a fully-defanged form (evil[.]com, 1[.]2[.]3[.]4) everywhere in each families/<category>/*.md EXCEPT the **References:** block, where citation URLs are left live. Idempotent: re-running changes nothing. Run a...
stuartjash/macos-malware-kb
scripts/defang-iocs.py
.py
0ea604da0d0564d5
7.56
12
#!/usr/bin/env python3 """Diff two versions of a YARA / XPScripts rule file at the RULE level. For each rule that changed, prints the rule name and what changed: - Added rule -> its body as `+` lines - Removed rule -> its body as `-` lines - Modified rule -> a unified diff of that rule's block (context + `+`...
stuartjash/macos-malware-kb
scripts/xprotect-rulediff.py
.py
2d6c3d5f9fe91a5a
7.56
12
# SPDX-License-Identifier: Apache-2.0 """Metering value extraction helpers.""" from __future__ import annotations from typing import Any def get_header(headers: dict[str, Any], name: str) -> str | None: """Return a header value using case-insensitive lookup.""" lowered_name = name.lower() for key, value...
IBM/cpex-plugins
plugins/python/ica_metering_exporter/cpex_ica_metering_exporter/metering.py
.py
e1c02fb023d95637
7.52
10
# SPDX-License-Identifier: Apache-2.0 """ICA metering transport and authentication.""" from __future__ import annotations import logging import os import time from dataclasses import dataclass from typing import Any import httpx import jwt logger = logging.getLogger(__name__) @dataclass(frozen=True, slots=True) c...
IBM/cpex-plugins
plugins/python/ica_metering_exporter/cpex_ica_metering_exporter/transport.py
.py
03f8fb66fc82775e
7.52
10
# SPDX-License-Identifier: Apache-2.0 """Build contract tests for plugin-local distribution artifacts.""" from pathlib import Path def test_build_target_writes_plugin_local_artifacts() -> None: # Given the plugin Makefile executed by the CI target. makefile_path = Path(__file__).parents[1] / "Makefile" ...
IBM/cpex-plugins
plugins/python/ica_metering_exporter/tests/test_build_contract.py
.py
237fe24abc99eae5
7.02
10
# -*- coding: utf-8 -*- """Location: ./plugins/encoded_exfil_detection/encoded_exfil_detector.py Copyright 2026 SPDX-License-Identifier: Apache-2.0 Encoded Exfiltration Detector Plugin. Detects suspicious encoded payloads (base64, base64url, hex, percent-encoding, hex escapes) in prompt args and tool outputs, then bl...
IBM/cpex-plugins
plugins/rust/python-package/encoded_exfil_detection/cpex_encoded_exfil_detection/encoded_exfil_detection.py
.py
79f6b947e90bbf55
7.52
10
# -*- coding: utf-8 -*- # Copyright 2026 # SPDX-License-Identifier: Apache-2.0 """Thin compatibility shim for the Rust-owned PII filter plugin.""" from __future__ import annotations from cpex.framework import Plugin from cpex_pii_filter.pii_filter_rust import PIIDetectorRust, PIIFilterPluginCore class PIIFilterPlug...
IBM/cpex-plugins
plugins/rust/python-package/pii_filter/cpex_pii_filter/pii_filter.py
.py
bc0a94c2aaf8da0b
7.52
10
# -*- coding: utf-8 -*- """Thin compatibility shim for the Rust-owned rate limiter plugin.""" from __future__ import annotations import logging from cpex.framework import Plugin, PromptPrehookResult, ToolPreInvokeResult from cpex_rate_limiter.rate_limiter_rust import ( RateLimiterPluginCore, compat_default_c...
IBM/cpex-plugins
plugins/rust/python-package/rate_limiter/cpex_rate_limiter/rate_limiter.py
.py
d4341a7428376b41
7.52
10
# -*- coding: utf-8 -*- """Gateway-facing retry-with-backoff plugin - pure Rust delegation.""" from __future__ import annotations import logging from cpex.framework import ( Plugin, PluginConfig, PluginContext, ResourcePostFetchPayload, ResourcePostFetchResult, ToolPostInvokePayload, Tool...
IBM/cpex-plugins
plugins/rust/python-package/retry_with_backoff/cpex_retry_with_backoff/retry_with_backoff.py
.py
f58fe98fc208b57a
7.52
10
# -*- coding: utf-8 -*- """Thin compatibility shim for the Rust-owned secrets detection plugin.""" from __future__ import annotations from cpex.framework import Plugin from cpex_secrets_detection.secrets_detection_rust import ( SecretsDetectionPluginCore, py_scan_container, ) class SecretsDetectionPlugin(Pl...
IBM/cpex-plugins
plugins/rust/python-package/secrets_detection/cpex_secrets_detection/secrets_detection.py
.py
324d1b1c623cdaae
7.52
10
"""Action Plan 领域模型(Phase 5-B,仅可执行规格契约,不执行动作)。""" from __future__ import annotations from enum import StrEnum from pydantic import BaseModel, Field class ActionPlanStatus(StrEnum): """动作计划状态。""" DRAFT = "DRAFT" VALIDATING = "VALIDATING" READY = "READY" BLOCKED = "BLOCKED" class ActionStep(Ba...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/action_plan/models.py
.py
24cfc3dbd3320a85
7.64
18
"""ActionPlanValidator:缺失 target / 未知 action / 不可满足前置 / 低置信。""" from __future__ import annotations from pydantic import BaseModel, Field from maple_agent.action_plan.models import ActionPlan, ActionPlanStatus # 与 decision.evaluator 白名单保持一致;本地定义避免 action_plan -> decision 依赖环 ALLOWED_ACTIONS = frozenset( { ...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/action_plan/validator.py
.py
f1ed20e804eaf6d1
7.64
18
"""Action Proposal 数据模型(Phase 12-C,动作建议参考,不执行)。""" from __future__ import annotations from enum import StrEnum from pydantic import BaseModel, Field class ActionType(StrEnum): """语义动作类型(不是执行动作)。""" OBSERVE = "OBSERVE" NAVIGATE = "NAVIGATE" INTERACT = "INTERACT" COMBAT = "COMBAT" COLLECT = ...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/action_proposal/models.py
.py
2b7622abf1ddf89b
7.64
18
"""Action Outcome Verification 数据模型(Phase 13-C,动作结果验证参考,只读)。""" from __future__ import annotations from enum import StrEnum from pydantic import BaseModel, Field class ActionOutcomeStatus(StrEnum): """动作结果状态。""" NOT_EVALUATED = "NOT_EVALUATED" SUCCESS = "SUCCESS" PARTIAL_SUCCESS = "PARTIAL_SUCCESS...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/action_verification/models.py
.py
5110155299660130
7.64
18
"""OutcomeTimeoutPolicy:数据驱动的验证超时参考(无 Timer / 后台线程)。""" from __future__ import annotations from pydantic import BaseModel, Field class OutcomeTimeoutPolicy(BaseModel): """各动作类型的参考超时(秒),全部数据驱动。""" NAVIGATE_LOCAL: float = Field(default=20.0, ge=0) NAVIGATE_PORTAL: float = Field(default=60.0, ge=0) IN...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/action_verification/timeout.py
.py
5adea5cf0d2fb1b0
7.64
18
"""ActionOutcomeValidator:结果验证参考校验(只读)。""" from __future__ import annotations from enum import StrEnum from pydantic import BaseModel, Field from maple_agent.action_verification.models import ( ActionOutcomeReference, ActionOutcomeStatus, ) class ActionOutcomeVerdict(StrEnum): """结果校验结论。""" VALID...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/action_verification/validator.py
.py
af6dde34af6d3e19
7.64
18
"""AgentLoopTrace:统一闭环 Replay(只读审计)。""" from __future__ import annotations import json from pathlib import Path from pydantic import BaseModel, Field from maple_agent.architecture import AGENT_VERSION, TRACE_SCHEMA_VERSION class AgentLoopStage(BaseModel): """单个阶段记录。""" stage: str status: str = "" c...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/agent_loop/trace.py
.py
37403f3f1f7672b3
7.64
18
"""Behavior Planning 数据模型(Phase 12-B,高层行为参考,不执行)。""" from __future__ import annotations from enum import StrEnum from pydantic import BaseModel, Field class BehaviorStepType(StrEnum): """语义行为类型(不是执行命令)。""" QUEST_ANALYSIS = "QUEST_ANALYSIS" NAVIGATE_REFERENCE = "NAVIGATE_REFERENCE" INTERACT_REFEREN...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/behavior/models.py
.py
fa0c68d1baa9c8a4
7.64
18
"""BehaviorSequenceBuilder:行为步骤排序/组合(确定性)。""" from __future__ import annotations from maple_agent.behavior.models import BehaviorStep, BehaviorStepType class BehaviorSequenceBuilder: """确保导航在前、验证在最后,等待优先。""" _ORDER = { BehaviorStepType.WAIT_REFERENCE: 0, BehaviorStepType.NAVIGATE_REFERENCE:...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/behavior/sequence.py
.py
994920a6c4268a1b
7.64
18
"""BehaviorValidator:行为参考校验(只读)。""" from __future__ import annotations from enum import StrEnum from pydantic import BaseModel, Field from maple_agent.behavior.models import BehaviorReference class BehaviorVerdict(StrEnum): """行为校验结论。""" VALID = "VALID" WARNING = "WARNING" BLOCKED = "BLOCKED" c...
Yokoo3431/Maple-AI-Companion-Agent
src/maple_agent/behavior/validator.py
.py
29bd1ad1188ce544
7.64
18
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Shared helpers for the RAI review Streamlit app. Keeps the page files short and focused on layout; all workflow glue (model loading, running a assessment, saving artifacts) lives here. """ from __f...
wandb/rai-toolkit
demo/rai_review/_common.py
.py
cf1a195a22ca03d3
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Finance Information Assistant: a small RAG demo app for the financial-services preset. Same shape as ``demo_app.triage_assistant`` but tuned for the financial- services review flow: lending fairness...
wandb/rai-toolkit
demo_app/finance_advisor.py
.py
9d63feb07101ea50
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Policy-violation demo model: intentionally unsafe clinical outputs. Use this model when you need a **deterministic** healthcare assessment that surfaces policy violations in the report / Weave trace...
wandb/rai-toolkit
demo_app/policy_violation_demo.py
.py
9d3ad9f34cc9cbc0
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Triage Assistant: a small healthcare RAG used as the demo app. This is *the app under review*. The RAI team submits this through the intake form and probes it both automatically (via the assessment ...
wandb/rai-toolkit
demo_app/triage_assistant.py
.py
2ef6cd61b356b4f7
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Garak red-team adapter. Bridges ``NVIDIA/garak`` probes into the toolkit's :class:`RedTeamReport` schema so they merge cleanly with the in-tree catalog and PyRIT runs. The adapter shape mirrors :mod...
wandb/rai-toolkit
integrations/garak_integration/adapter.py
.py
b8f4948516b55612
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """NeMo Guardrails implementation of the BaseGuardrail interface.""" from __future__ import annotations import logging from pathlib import Path from typing import Any from rai_toolkit import _tracing...
wandb/rai-toolkit
integrations/nemo_integration/nemo_guardrail.py
.py
36bbd5452b24ddae
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """NeMo Guardrails wrapped as a rai_toolkit scorer for evaluations.""" from __future__ import annotations import asyncio import logging from typing import Any from rai_toolkit.scorers.base import Bas...
wandb/rai-toolkit
integrations/nemo_integration/nemo_scorer.py
.py
711d96a898569b44
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Weave evaluation runner: runs rai_toolkit evaluations via weave.Evaluation.""" from __future__ import annotations import logging from typing import Any import weave from rai_toolkit.compliance.en...
wandb/rai-toolkit
integrations/weave_integration/evaluation.py
.py
b5fca79a421e2e3f
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Weave annotations for the human-in-the-loop layer. When a reviewer pins a chat turn as a ``ManualFinding`` or signs off on a submission, those actions belong on the *same* Weave trace that produced ...
wandb/rai-toolkit
integrations/weave_integration/feedback.py
.py
cd17a17646fa85af
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Weave model adapter: wraps rai_toolkit BaseModel as weave.Model.""" from __future__ import annotations from typing import Any import weave from rai_toolkit import _tracing from rai_toolkit.models...
wandb/rai-toolkit
integrations/weave_integration/models.py
.py
c7a5eb17308532dc
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Weave scorer adapter: bridges rai_toolkit scorers to Weave scorers.""" from __future__ import annotations import logging from typing import Any import weave from rai_toolkit.scorers.base import B...
wandb/rai-toolkit
integrations/weave_integration/scorers.py
.py
43607c5eea70fc7b
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Weave tracing integration: @weave.op wrapping and initialization.""" from __future__ import annotations import functools import logging from typing import Any, Callable, TypeVar import weave logg...
wandb/rai-toolkit
integrations/weave_integration/tracing.py
.py
4504b9bd10603eaf
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """W&B run lifecycle helpers for the Streamlit demo. Bridges a synchronous "do work in Streamlit" block to a single W&B run so every Weave trace produced inside the block is searchable in the W&B UI by...
wandb/rai-toolkit
integrations/weave_integration/wandb_run.py
.py
a5ea85558ed02fe9
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Optional Weave tracing shim. The core toolkit stays platform-agnostic: nothing in `rai_toolkit/` imports `weave` at module load. This shim gives us a single integration point that is a no-op when tr...
wandb/rai-toolkit
rai_toolkit/_tracing.py
.py
605fea5499ae59e9
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Renderer-agnostic view model for an :class:`AssessmentResult`. Three render surfaces consume this view: * :func:`rai_toolkit.assessment.assessor._render_html`: the standalone HTML report attached...
wandb/rai-toolkit
rai_toolkit/assessment/report_view.py
.py
c23faca8f3c5ef5c
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Compliance Mapping Engine: the central orchestrator. Maps compliance frameworks to risk categories to scorers. This is the primary interface for building compliance-aware RAI evaluations. """ from ...
wandb/rai-toolkit
rai_toolkit/compliance/engine.py
.py
0a49389de31daba5
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """EU AI Act compliance mapping. Maps EU AI Act requirements to RAI toolkit capabilities and MIT risk categories. Full enforcement of high-risk AI requirements: August 2, 2026. """ from __future__ imp...
wandb/rai-toolkit
rai_toolkit/compliance/eu_ai_act_mapping.py
.py
bdadc8531ba92dfd
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Data models for compliance frameworks, risk categories, and profiles.""" from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Any c...
wandb/rai-toolkit
rai_toolkit/compliance/frameworks.py
.py
60496bab1e891302
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """NIST AI Risk Management Framework mapping. Maps NIST AI RMF 1.0 functions and categories to RAI toolkit capabilities and Weave features (when used with the Weave integration). """ from __future__ i...
wandb/rai-toolkit
rai_toolkit/compliance/nist_mapping.py
.py
c2f2ca7c4f9d8810
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Scorer registry: maps risk categories to scorer classes. This is the central mapping table. When the compliance engine resolves a profile, it looks up each risk category here to find which scorers t...
wandb/rai-toolkit
rai_toolkit/compliance/scorer_registry.py
.py
c402b22e341d1335
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Contracts for multi-turn and agentic evaluation (scaffolding). The core :class:`rai_toolkit.models.base.BaseModel` API is single-turn ``predict(input_text, context=...) -> ModelResponse``. Productio...
wandb/rai-toolkit
rai_toolkit/evaluation/agentic.py
.py
fa62a25bedd9647f
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Dataset loading and creation utilities.""" from __future__ import annotations import csv import json import logging from pathlib import Path from typing import Any logger = logging.getLogger(__nam...
wandb/rai-toolkit
rai_toolkit/evaluation/datasets.py
.py
0c4fa145c2ad1e9a
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """RAI Evaluation Pipeline: compliance-aware evaluation orchestration.""" from __future__ import annotations import asyncio import inspect import logging from dataclasses import dataclass, field from ...
wandb/rai-toolkit
rai_toolkit/evaluation/pipeline.py
.py
0ceb9833cbb11456
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Compliance report generation.""" from __future__ import annotations import json from typing import Any from rai_toolkit.evaluation.pipeline import EvaluationResults class ComplianceReport: "...
wandb/rai-toolkit
rai_toolkit/evaluation/report.py
.py
22916727e9e1e3c0
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Convert Weave ``get_eval_results`` output into ``EvaluationResults`` for assessment. Lives under ``rai_toolkit.evaluation`` so importing it does not pull in ``weave`` at import time (unlike ``integr...
wandb/rai-toolkit
rai_toolkit/evaluation/weave_adapter.py
.py
a6e859e55c8a155a
7.48
8
# SPDX-FileCopyrightText: 2026 CoreWeave, Inc. # SPDX-License-Identifier: Apache-2.0 # SPDX-PackageName: rai-toolkit """Base guardrail interface: platform-agnostic guardrail abstraction.""" from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass, field from typing imp...
wandb/rai-toolkit
rai_toolkit/guardrails/base.py
.py
b391c9ccbbdffd20
7.48
8
from dotenv import load_dotenv load_dotenv(".flaskenv") from os import path, environ from yaml import safe_load, YAMLError import logging import pytest logging.getLogger("kubernetes").setLevel(logging.INFO) KUBERNETES_INGRESSES_NAMESPACE = "default" FAVICON_HOSTNAME = "prometheus.io" FAVICON_INVALID_HOSTNAME = "a....
ByTheHugo/kubeboard
tests/conftest.py
.py
bc62d3feb90a7988
7
9
from dotenv import load_dotenv load_dotenv(".flaskenv") from app.favicon import _favicon_fetch from conftest import FAVICON_HOSTNAME, FAVICON_INVALID_HOSTNAME, FAVICON_URLS # The favicon library used seems to be buggy when retrieving the favicon in SPA. # That's why we run the test against a common static page. def...
ByTheHugo/kubeboard
tests/test_favicon.py
.py
7112ed7101705af9
7
9
from abc import ABCMeta, abstractmethod from dataclasses import dataclass, fields, replace from typing import Any, Optional from anthropic.types.beta import BetaToolUnionParam class BaseAnthropicTool(metaclass=ABCMeta): """Abstract base class for Anthropic-defined tools.""" @abstractmethod def __call__(...
SalesforceAIResearch/SCUBA
agents/anthropic/tools/base.py
.py
9f73a26a2417ad2d
7.54
11
import asyncio import os from typing import ClassVar, Literal, Optional from anthropic.types.beta import BetaToolBash20241022Param from .base import BaseAnthropicTool, CLIResult, ToolError, ToolResult class _BashSession: """A session of a bash shell.""" _started: bool _process: asyncio.subprocess.Proce...
SalesforceAIResearch/SCUBA
agents/anthropic/tools/bash.py
.py
c9a785798b838995
7.54
11
"""Collection classes for managing multiple tools.""" from typing import Any from anthropic.types.beta import BetaToolUnionParam from .base import ( BaseAnthropicTool, ToolError, ToolFailure, ToolResult, ) class ToolCollection: """A collection of anthropic-defined tools.""" def __init__(se...
SalesforceAIResearch/SCUBA
agents/anthropic/tools/collection.py
.py
4ead1f93f3d0ebdb
7.54
11
import asyncio import base64 import os import shlex import shutil from enum import Enum from pathlib import Path from typing import Literal, TypedDict, Optional, Tuple from uuid import uuid4 from anthropic.types.beta import BetaToolComputerUse20241022Param from .base import BaseAnthropicTool, ToolError, ToolResult fr...
SalesforceAIResearch/SCUBA
agents/anthropic/tools/computer.py
.py
1e52dc2c0e0a8d4f
7.54
11
from collections import defaultdict from pathlib import Path from typing import Literal, get_args, Optional, List from anthropic.types.beta import BetaToolTextEditor20241022Param from .base import BaseAnthropicTool, CLIResult, ToolError, ToolResult from .run import maybe_truncate, run Command = Literal[ "view", ...
SalesforceAIResearch/SCUBA
agents/anthropic/tools/edit.py
.py
c735ad6e81f3606f
7.54
11
"""Utility to run shell commands asynchronously with a timeout.""" import asyncio from typing import Optional TRUNCATED_MESSAGE: str = "<response clipped><NOTE>To save on context only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to ...
SalesforceAIResearch/SCUBA
agents/anthropic/tools/run.py
.py
a217892ae4e6c179
7.54
11
import logging import platform from typing import Dict, List, Tuple from agents.s2_5.agents.grounding import ACI from agents.s2_5.agents.worker import Worker logger = logging.getLogger("desktopenv.agent") class UIAgent: """Base class for UI automation agents""" def __init__( self, engine_pa...
SalesforceAIResearch/SCUBA
agents/s2_5/agents/agent_s.py
.py
1f5396b797f03a7d
7.54
11
import argparse import datetime import io import logging import os import platform import pyautogui import signal import sys import time from PIL import Image from agents.s2_5.agents.grounding import OSWorldACI from agents.s2_5.agents.agent_s import AgentS2_5 current_platform = platform.system().lower() # Global fl...
SalesforceAIResearch/SCUBA
agents/s2_5/cli_app.py
.py
2d5a3155a3558bf0
7.54
11
from typing import Dict, Optional from agents.s2_5.core.mllm import LMMAgent class BaseModule: def __init__(self, engine_params: Dict, platform: str): self.engine_params = engine_params self.platform = platform def _create_agent( self, system_prompt: str = None, engine_params: Optiona...
SalesforceAIResearch/SCUBA
agents/s2_5/core/module.py
.py
dff32e954c2be918
7.54
11
from __future__ import annotations import base64 import io import logging import os import platform from typing import TYPE_CHECKING, Optional from browser_use.agent.views import ( AgentHistoryList, ) if TYPE_CHECKING: from PIL import Image, ImageFont logger = logging.getLogger(__name__) def create_history_gif(...
SalesforceAIResearch/SCUBA
browser_use/agent/gif.py
.py
848d3a4b21ba15c9
7.54
11
from __future__ import annotations import logging from typing import Dict, List, Optional from langchain_core.messages import ( AIMessage, BaseMessage, HumanMessage, SystemMessage, ToolMessage, ) from pydantic import BaseModel from browser_use.agent.message_manager.views import MessageMetadata from browser_use....
SalesforceAIResearch/SCUBA
browser_use/agent/message_manager/service.py
.py
15168718464a975c
7.54
11
import pytest from langchain_anthropic import ChatAnthropic from langchain_core.messages import AIMessage, HumanMessage, SystemMessage from langchain_openai import AzureChatOpenAI, ChatOpenAI from browser_use.agent.message_manager.service import MessageManager, MessageManagerSettings from browser_use.agent.views impor...
SalesforceAIResearch/SCUBA
browser_use/agent/message_manager/tests.py
.py
540f13a474f2ae13
8.04
11
from __future__ import annotations import json import logging import os from typing import Any, Optional, Type from langchain_core.messages import ( AIMessage, BaseMessage, HumanMessage, SystemMessage, ToolMessage, ) logger = logging.getLogger(__name__) def extract_json_from_model_output(content: str) -> dict...
SalesforceAIResearch/SCUBA
browser_use/agent/message_manager/utils.py
.py
d557f8f9976064f6
7.54
11
from __future__ import annotations from typing import TYPE_CHECKING, Any from langchain_core.load import dumpd, load from langchain_core.messages import AIMessage, BaseMessage, HumanMessage, SystemMessage, ToolMessage from pydantic import BaseModel, ConfigDict, Field, model_serializer, model_validator if TYPE_CHECKI...
SalesforceAIResearch/SCUBA
browser_use/agent/message_manager/views.py
.py
ad18a10befae110a
7.54
11