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
""" qc.py - dashboard parser for adaptive-sampling QC. Replaces the hybrid-capture QC parsers inherited from the reference pipeline (hsmetrics, fastp, Picard), none of which apply to nanopore adaptive sampling. The QC that does apply is what QC_ONTARGET already emits per sample: <effective_dir>/qc/<sample>.region...
patkarlab/mm-awgs-nextflow
bin/dashboard_builder/parsers/qc.py
.py
c03be182bc8da71e
7
0
""" translocations.py - dashboard parser for merged, annotated structural variants. Reads the per-sample annotated translocation table produced by merge_translocations.py + annotate_mm_translocations.py: <effective_dir>/translocations/<sample>.mm_annotated.tsv The schema is read from the file's own header row; n...
patkarlab/mm-awgs-nextflow
bin/dashboard_builder/parsers/translocations.py
.py
9a003ec2932efca3
7
0
"""Parse somaticseq variant TSVs. Two flavors with overlapping schemas: - clinical_final.tsv : curated clinical variants (smaller column set, PASS/REJECT verdict) - filtered.tsv : full annotated set (adds ClinVar, gnomAD AF, etc.) Both are simple tab-delimited with a header row. We use pandas for robustness...
patkarlab/mm-awgs-nextflow
bin/dashboard_builder/parsers/variants.py
.py
d9709c5cfb2299a4
7
0
#!/usr/bin/env python3 """ Embedding engine for jina-embeddings-v3 with dual backend support: 1. PyTorch / Transformers (AutoModel + AutoTokenizer, trust_remote_code=True) 2. ONNX Runtime (onnx/model.onnx + onnx/model.onnx_data, task_id adapter routing, mean pooling, L2 normalization) Supported task adapters: - retrie...
mmahdi-sz/jina-embeddings-v3-ort
python-ref/embed.py
.py
7e5a56725d8f6ad5
7
0
#!/usr/bin/env python3 """ Comprehensive verification harness and ground-truth exporter for jina-embeddings-v3. Verifies: 1. Structural Validity (shape 1024, float32, no NaN/Inf, unit L2 norm) 2. PyTorch vs. ONNX Numerical Parity (cosine sim > 0.9999, max diff < 1e-4) 3. Intra-Category Semantic Cohesion (pairwise simi...
mmahdi-sz/jina-embeddings-v3-ort
python-ref/verify.py
.py
e36fefdb62c92a52
7
0
"""Lightweight ``.env`` loader for local development (no external dependency). Mirrors the pattern used by ``scripts/sync_notion_brain.py`` so behaviour is identical across the repo: the gitignored project-root ``.env`` is read once and any keys not already present in the process environment are applied. Existing envi...
asifdotpy/forge-mind
src/forgemind/_env.py
.py
1f7ca2d30c0f7af5
7
0
from __future__ import annotations """Small, dependency-free HTML rendering helpers.""" from typing import Any def _esc(value: Any) -> str: """Minimal HTML escaping for untrusted artifact values.""" text = "" if value is None else str(value) return ( text.replace("&", "&amp;") .replace("<"...
asifdotpy/forge-mind
src/forgemind/api/dashboard/helpers.py
.py
937b8b536deed574
7
0
from __future__ import annotations """Pydantic request envelopes for the ForgeMind HTTP API.""" from typing import Any, Dict, List, Literal, Optional from pydantic import BaseModel, ConfigDict class EventInput(BaseModel): """Request envelope for ``POST /api/v1/events``. Only ``event`` is required. The Event...
asifdotpy/forge-mind
src/forgemind/api/models.py
.py
7d33318f451a6183
7
0
from __future__ import annotations """Pure five-tier pipeline orchestration (no HTTP logic).""" import json from pathlib import Path from typing import Any, Dict, List, Optional from forgemind._paths import FIXTURES_INPUT_DIR from forgemind.acquisition import acquire_event from forgemind.action_gate import ActionVali...
asifdotpy/forge-mind
src/forgemind/api/pipeline.py
.py
77af4a914777b7f0
7
0
from __future__ import annotations """FastAPI route handlers - thin HTTP mapping over pipeline + dashboard.""" import json import logging from pathlib import Path from typing import Any, Dict, Optional from fastapi import FastAPI from fastapi.responses import HTMLResponse, JSONResponse from forgemind._env import loa...
asifdotpy/forge-mind
src/forgemind/api/routes.py
.py
41e6481c9257f3f4
7
0
"""Gemini 3.5 (Vertex AI) adapter for bounded free-text evidence synthesis. ADR-010 scope ONLY. This module is the single point where a model may influence the pipeline. Its contract is deliberately narrow: generate_observations(domain, context, *, model="gemini-3.5-flash") -> list[str] | None gener...
asifdotpy/forge-mind
src/forgemind/llm/adapter.py
.py
ad6b5dc1dd07bb40
7
0
"""M3-A judge-visible surface: pure derivation of the M3 proof block. Presentation-only (SPEC-001 M3-A / T720). This module contains ZERO tier logic: it reads the dict returned by :func:`forgemind.api.run_pipeline` and projects it into the four judge-visible properties: 1. ``provenance_links`` — unbroken Event -...
asifdotpy/forge-mind
src/forgemind/m3_proof.py
.py
517becaed1e88407
7
0
"""Memory tools for ForgeMind ADK agents. Tools that agents can call to interact with long-term memory. All tools fail gracefully when Memory Bank is not configured. """ from __future__ import annotations import logging from typing import Any, Dict, List logger = logging.getLogger(__name__) def remember_pattern(p...
asifdotpy/forge-mind
src/forgemind/memory/memory_tools.py
.py
a8b92deee20773b3
7
0
"""GitHub API client wrapper for ForgeMind ADK tools. Provides a thin, typed wrapper around the GitHub REST API using the ``requests`` library (already a project dependency). Handles authentication, rate-limit detection, pagination, and error normalization so individual tools stay focused on their domain logic. Envir...
asifdotpy/forge-mind
src/forgemind/tools/github_client.py
.py
f4c1e1637658532d
7
0
"""Tool registry for ForgeMind ADK agents. Provides a registry pattern for mapping tool names to tool objects so agents can be configured with tools=get_default_registry().tools """ from __future__ import annotations import logging from typing import Any, Callable, Dict, List logger = logging.getLogger(__name__) ...
asifdotpy/forge-mind
src/forgemind/tools/tool_registry.py
.py
44fcf6226a2da360
7
0
"""Contract tests: validate the canonical Phase 0 fixtures against the machine-readable JSON Schemas. These implement SPEC-001 Required Contract Tests (see specs/001-hierarchical-runtime-dag/spec.md): valid event creation; provenance preservation; evidence-shard validation; escalation generation; uncertainty preservat...
asifdotpy/forge-mind
tests/contract/test_contracts.py
.py
ffa75ba4f3032ea3
7.5
0
"""M3-B integration tests (T733) — bounded Gemini + ADK 2 workflow. These tests exercise the M3-B additions WITHOUT asserting any model text: they verify the fail-closed deterministic fallback, the ADK runtime import surface, parity between the deterministic and ADK paths, the human-approval pause/resume gate, and the...
asifdotpy/forge-mind
tests/contract/test_m3b_adk.py
.py
756feffc82c6af83
7.5
0
"""Demo: run a tiny RLMTask through a real dspy.RLM on a Claude Pro/Max SUBSCRIPTION. `ClaudeAgentLM` now ships in the kit — `from rlm_harness import ClaudeAgentLM`. The adapter's setup, politeness policy, and trade-offs live in its module docstring (`rlm_harness/claude_agent_lm.py`); this file is just the runnable de...
qazbnm456/rlm-harness
examples/claude_agent_lm.py
.py
db89e1fa16e44699
7.35
4
"""Example: a container-backed ISOLATED runner for ``make_command_tool``. rlm-harness ships NO command executor on purpose — the runner's isolation IS the security boundary (see ``rlm_harness/tools/command.py``). This example shows the reference pattern: run each model-chosen command inside a disposable, network-off D...
qazbnm456/rlm-harness
examples/command_runner.py
.py
b9c3f447e34eace1
7.35
4
"""Example: IN-PROCESS harness delegation — no subprocess, no HTTP. ``make_harness_tool`` + ``harness_from_endpoint`` (``tools/harness.py``) are transport-agnostic by design: the kit ships no ``call_endpoint`` and never will (see their docstrings — "the kit ships NONE and names NONE"). The two usual transports are a s...
qazbnm456/rlm-harness
examples/harness_local_run.py
.py
09dc4ef8e1ef8efb
7.35
4
"""Example: RLM-as-Harness — intercepted sub-LM + skills tools + traced run. Wires every Phase A/B/C piece together (illustrative; needs real model creds and a sandbox, so it is NOT imported by the test suite): - a local/base model wrapped via intercept_sub_lm (validate + post-process), - a Skills directory whose cat...
qazbnm456/rlm-harness
examples/harness_run.py
.py
ac16dd0e94b649e0
7.35
4
"""Worked example — serve a harness over the make_harness_tool delegation contract (the SERVER side). Run it directly: echo "some long context" | python examples/harness_serve.py [workdir_base] It prints ONE `HarnessPointer` JSON line on stdout. In production the harness's OWN venv runs this as a module (`python...
qazbnm456/rlm-harness
examples/harness_serve.py
.py
86d7e9f9295dce76
7.35
4
"""Minimal real end-to-end RLM run — verifies the forward() path with a live model. Self-contained: configures from RLM_* env, runs one tiny task through a real dspy.RLM (real Deno sandbox + real model), records the trajectory, and prints both the validated result and a trajectory summary so we can confirm the live sh...
qazbnm456/rlm-harness
examples/mini_run.py
.py
8c915d55e7d05162
7.35
4
"""Shims for ``dspy``'s ``RLM`` / interpreter API, resolved by introspection in ONE place. PRIVATE (``_``-prefixed): not part of the public surface, may change without notice. **Why this module exists, and why it survives the 3.3.0 floor.** rlm-harness declares only a FLOOR on dspy and consumers pin the KIT, so a con...
qazbnm456/rlm-harness
rlm_harness/_dspy_compat.py
.py
83cbc7a108cc74f9
7.35
4
"""The validation + retry engine shared by every RLM task. This replaces the hand-rolled ``while execute_count < MAX_RETRY`` loops that were copy-pasted across the original CVE app. It is deliberately free of any ``dspy`` import: it operates on a ``runner`` coroutine that returns a prediction-like object (anything wit...
qazbnm456/rlm-harness
rlm_harness/_retry.py
.py
8994a4db2841756e
7.35
4
"""REPL-safety rules for a tool — its NAME and its SIGNATURE, one derivation each. The module is ``_``-prefixed, but **three of its functions are PUBLIC and SemVer-frozen** since 1.1.0, re-exported from ``rlm_harness.__all__``: :func:`is_valid_tool_name`, :func:`sanitize_tool_name` and :func:`unique_tool_names`, plus ...
qazbnm456/rlm-harness
rlm_harness/_toolname.py
.py
038d6d64d4b02946
7.35
4
"""``atomic_write_text`` / ``atomic_write_stream`` — write a file such that a concurrent reader never sees a partial write. A same-directory temp file + ``fsync`` + ``os.replace`` — the standard "never a half-written file visible mid-write" idiom, useful for any consumer building a resumable/checkpointed job on top of...
qazbnm456/rlm-harness
rlm_harness/atomic.py
.py
10250c8cde115dea
7.35
4
"""Single source of truth for RLM runtime configuration. Everything the scaffold needs to stand up a Recursive Language Model — model names, credentials, the sandbox interpreter, budget caps, retry policy — lives here and is driven by environment variables. No other module reads ``os.environ``. This module intentiona...
qazbnm456/rlm-harness
rlm_harness/config.py
.py
5ae843667b7ddcf9
7.35
4
"""Phase C (part 2) — export recorded runs as Agentic-RL / SFT datasets. The JSONL trace is the source of truth. This module turns it into training-ready records, in three shapes: - ``export_sft_turns`` — per-root-TURN SFT samples (``input = full history`` seeded with the run's initial state, ``output = that turn``...
qazbnm456/rlm-harness
rlm_harness/dataset.py
.py
b2fbda642fb13f47
7.35
4
"""``python -m rlm_harness.harness_serve <pkg.module:run> [workdir_base]`` — the zero-file way to serve a harness over the delegation contract (the runnable front-end of :func:`rlm_harness.serve_harness`). Resolves the harness's ``run`` callable from ``<module:attr>`` and, if the same module exposes a ``to_pointer`` (...
qazbnm456/rlm-harness
rlm_harness/harness_serve.py
.py
e014b0b7ea06c55a
7.35
4
"""``run_in_subprocess`` — a safe, isolated-subprocess primitive. A small PRIMITIVE only: "safely run one picklable callable in an isolated OS process, get its result or a clear error back, bounded by a timeout." Queue/scheduling logic (how a web server actually schedules many of these — Celery, RQ, a plain thread/pro...
qazbnm456/rlm-harness
rlm_harness/isolation.py
.py
54c32b27e53062c0
7.35
4
"""Trace utilization metrics — how a run's activity was distributed across the root LM's own turns, tool calls, and sub-LM escalations. A sibling to ``rubric.py``'s "derive facts from a trace" shape, but structurally different: ``rubric.criteria_facts`` slices a CALLER-SUPPLIED facts dict against a caller-supplied lens...
qazbnm456/rlm-harness
rlm_harness/metrics.py
.py
9984718a20ff9532
7.35
4
"""GEPA optimization harness — PHASE 1 SKELETON. The whole point of choosing DSPy for RLM is that tasks can be *compiled* (prompt + few-shot demos optimised against a metric) rather than hand-tuned. This module wires that interface and ships ready-to-use metric templates. What is implemented now (Phase 1): - Metric t...
qazbnm456/rlm-harness
rlm_harness/optimize.py
.py
9ce0aae5931c5a86
7.35
4
"""Phase C (part 1) — reconstruct and replay a recorded run. Replay reads the JSONL trace and rebuilds an ordered timeline. For deterministic replay it serves *recorded* tool outputs rather than re-executing tools (which may be non-deterministic or have side effects). This makes a past run inspectable and step-through...
qazbnm456/rlm-harness
rlm_harness/replay.py
.py
18edec98efaa01a3
7.35
4
"""Reward-free rubric primitives — the shared substrate for decomposing "did this run succeed?" into observable CRITERIA carried as LABELS. ``category`` is an OPAQUE, caller-defined label: rlm-harness never interprets it, hardcodes no taxonomy, and carries no domain vocabulary. A consumer defines its own category set,...
qazbnm456/rlm-harness
rlm_harness/rubric.py
.py
a140d1bf28486ca8
7.35
4
"""One-time runtime initialization: wire dspy + (optional) observability. Replaces the original app's scattered ``agent.py`` global setup. Call :func:`configure` once at process start; tasks then read the shared config and sub-LM via :func:`get_config` / :func:`get_sub_lm`. """ from __future__ import annotations imp...
qazbnm456/rlm-harness
rlm_harness/runtime.py
.py
d818eda09f689812
7.35
4
"""Serve an rlm-harness harness over the delegation contract — the SERVER-side mirror of ``make_harness_tool`` (``tools/harness.py``). ``make_harness_tool`` is the CLIENT: a parent RLM wraps a downstream harness as a tool and reaches it through an injected ``call_endpoint`` (a subprocess command, an HTTP URL, …). This...
qazbnm456/rlm-harness
rlm_harness/serving.py
.py
66f6deebc36d0dbe
7.35
4
"""Phase A — expose a directory of Skills to the RLM as tools. A "Skill" here follows the common convention of a folder containing a ``SKILL.md`` (with optional YAML-ish frontmatter for ``name``/``description``), or a flat ``<name>.md`` file. The main LM decides, inside the REPL, which skill to read — keeping control ...
qazbnm456/rlm-harness
rlm_harness/skills.py
.py
e8791d4e9615d4ee
7.35
4
"""Phase A — ``intercept_sub_lm``: the one hook to intercept the RLM's sub-LM. ``dspy.RLM`` exposes no hook to intercept a sub-LLM response before it returns to the main model — and its built-in ``llm_query`` / ``llm_query_batched`` tools just call ``self.sub_lm(prompt)``. So the ONLY interception point is the sub_lm ...
qazbnm456/rlm-harness
rlm_harness/sub_lm.py
.py
49d8c09b822bbd24
7.35
4
"""The ``RLMTask`` base class — the one abstraction this scaffold exists for. A task is declared by subclassing ``RLMTask`` and filling four fields: class Summarize(RLMTask): signature = "document: str -> article: Article" output_field = "article" output_model = Article # a...
qazbnm456/rlm-harness
rlm_harness/task.py
.py
00700c6a280384af
7.35
4
"""Test support for driving the RLM forward path OFFLINE — no live model, no Deno, no network. ``dspy.RLM`` normally runs the model's Python inside a sandboxed interpreter (pyodide/deno). That makes the *forward* path (planner turn -> tool call -> SUBMIT -> validated result) expensive to test: it needs a paid model an...
qazbnm456/rlm-harness
rlm_harness/testing.py
.py
d79275ab2d6dd47b
7.85
4
"""``run_isolated`` — bridge a coroutine into a sync call site that may already own a running event loop (mirrors the bridging problem ``mcp.py`` solves for its own, different reason). A consumer building their OWN transport for :func:`rlm_harness.tools.harness_from_endpoint` (e.g. an in-process ``call_endpoint`` that...
qazbnm456/rlm-harness
rlm_harness/tools/_async.py
.py
ebbcda43ff10d129
7.35
4
"""``make_extract_archive_tool`` — safe zip/tar extraction into a bounded local directory. Python's ``zipfile.extractall()``/``tarfile.extractall()`` are not safe by default: a malicious archive entry can carry an absolute path, a ``..``-traversal path, or (tar) a symlink/hardlink pointing outside the extraction targe...
qazbnm456/rlm-harness
rlm_harness/tools/archive.py
.py
20faee6420fd19af
7.35
4
"""Reusable ``run_command`` tooling — execute a local command through a consumer-supplied, ISOLATED runner (mirrors ``fetch.py`` / ``search.py``). An agent built on the RLM often needs to run a local command (a build, a test, a git op) the way a coding agent does. The reusable half is the same as every other tool here...
qazbnm456/rlm-harness
rlm_harness/tools/command.py
.py
04c445ab1b0813b7
7.35
4
"""``list_candidate_paths`` — a safe, good-default way to compute ``make_read_file_tool``/ ``make_grep_files_tool``'s ``candidate_paths``. ``fs.py`` deliberately leaves ``candidate_paths`` REQUIRED, consumer-supplied — no default directory walk, no built-in ``.gitignore`` handling (the base/wrap split: the kit owns th...
qazbnm456/rlm-harness
rlm_harness/tools/discover.py
.py
b5b30f4f19fe5122
7.35
4
"""``make_write_file_tool`` / ``make_edit_file_tool`` — the write side of the filesystem tools, sitting alongside ``fs.py``'s read side (``make_read_file_tool`` / ``make_grep_files_tool``). Kept in a SEPARATE module from ``fs.py`` (which is already the largest single file in `tools/` — 355 lines, ~1.6× the next-larges...
qazbnm456/rlm-harness
rlm_harness/tools/edit.py
.py
bd2bff41dbb2c7cb
7.35
4
"""SSRF-aware fetch tooling for RLM tasks. Tasks routinely need to pull remote content (web pages, docs, feeds, threat intel). Handing an LLM-driven REPL an unrestricted fetcher is an SSRF liability: the model can be steered — by the very untrusted content it is analysing — into requesting internal services or cloud m...
qazbnm456/rlm-harness
rlm_harness/tools/fetch.py
.py
39ff4fb3a4299e1a
7.35
4
"""``make_git_clone_tool`` — safe git clone with fallback auth, base/wrap, same shape as ``make_fetch_tool``/``make_command_tool`` (not a new pattern). A task that wants to clone a repository to analyze it has no safe way to do so without this: (1) SSRF-shaped URL abuse (a ``file://`` URL, an internal git server); (2)...
qazbnm456/rlm-harness
rlm_harness/tools/git_clone.py
.py
667a862adcb682b8
7.35
4
"""Provider-agnostic ``make_harness_tool`` — delegate a sub-task to ANOTHER rlm-harness harness, wrapped as a tool (the promoted "wrap a downstream harness as a tool" shape; mirrors ``model.py``). A *harness* is a full RLM in its own right: it takes a long-text input, runs its own Root LM in a REPL loop over that text...
qazbnm456/rlm-harness
rlm_harness/tools/harness.py
.py
8259d2e2cb88cd48
7.35
4
"""Provider-agnostic ``make_model_tool`` — the generic "model-backed tool + validate" core (mirrors ``fetch.py`` / ``search.py``). A model-as-tool — a SECONDARY model the RLM root calls as a tool to PRODUCE something (YAML, code, SQL, …) which is then deterministically validated — is a recurring shape. The reusable me...
qazbnm456/rlm-harness
rlm_harness/tools/model.py
.py
ef613ec55a4aa649
7.35
4
"""Provider-agnostic ``web_search`` building blocks (mirrors ``fetch.py``). A search tool needs two halves: the PROVIDER (an HTTP call to DuckDuckGo / Tavily / TinyFish / … plus its API key) and the generic GUARD/NORMALISE step. rlm-harness owns only the generic half — it picks NO provider. The consuming project suppl...
qazbnm456/rlm-harness
rlm_harness/tools/search.py
.py
7561169d54d65a76
7.35
4
"""Schema-validation tool factories. Two shapes, both consumer-facing base primitives: - ``make_schema_validator(model)`` — a plain callable the RLM invokes inside the REPL to check its draft JSON against a pydantic schema before emitting a final answer (returns a human message). The generalised form of the origi...
qazbnm456/rlm-harness
rlm_harness/tools/validation.py
.py
138570a16d600ba0
7.35
4
"""`run_isolated` — the async-bridge primitive for a consumer's own harness-delegation transport. All offline, no dspy: `run_isolated` is pure `threading`/`asyncio`, dspy-free by construction.""" import asyncio import pytest from rlm_harness.tools import run_isolated from rlm_harness.trace import TraceRecorder, curr...
qazbnm456/rlm-harness
tests/test_async.py
.py
9b32b57722d78583
7.85
4
"""atomic_write_text / atomic_write_stream — write-without-partial-file. All offline, dspy-free.""" from __future__ import annotations import os import stat import pytest from rlm_harness import atomic_write_stream, atomic_write_text from rlm_harness.atomic import _ExtractionBudgetExceeded def _read(path): wit...
qazbnm456/rlm-harness
tests/test_atomic.py
.py
fd49fb56153511d8
7.85
4
"""ClaudeAgentLM tests — the optional Claude-subscription adapter (`rlm-harness[subscription]`). The heavy `claude-agent-sdk` is NOT a test dependency: the pure helpers run without it, the lazy export is asserted without it, and construction is exercised against a FAKE `claude_agent_sdk` injected into `sys.modules` — ...
qazbnm456/rlm-harness
tests/test_claude_agent_lm.py
.py
ae0575572c4f88af
7.85
4
"""Verify the CHANGELOG compare links match the declared version. Cutting a release moves entries into a new section, and the link definitions live ~1700 lines away at the bottom of the file — so the cut looks complete on screen while the links still point at the previous release. That has now happened twice: PR #100 ...
andrei-shtanakov/spec-runner
scripts/check_changelog_links.py
.py
c15b87cd2f3a0d2f
7
0
"""Compliance audit-trail writer (LABS-40). Structured JSON-Lines appender for regulated projects that need a durable record of every state transition the executor made, independent of the ordinary structlog output (which is console-oriented and rotates). Opt-in: disabled by default. Enable by setting `audit_log_path...
andrei-shtanakov/spec-runner
src/spec_runner/audit_log.py
.py
1559e091531e0754
7.5
0
"""The status flip a blocked task leaves behind, committed — #192 (F-8). `post_done_hook` writes `🔍 REVIEW` into `tasks.md` when review *starts*, so a run killed mid-review is resumable rather than prematurely DONE (#66). That write is uncommitted by design: the commit that would carry it comes later. But when a pre-...
andrei-shtanakov/spec-runner
src/spec_runner/bookkeeping.py
.py
715c03ebf9ee1c3d
7.5
0
"""The pre-call budget guard (#213, second half). **A guard, not a cap.** It answers one question, immediately before a paid call: *is there anything left to spend?* It cannot stop the call that crosses the line, because a call's cost is known only after it returns. The only true hard cap is a backend-enforced per-cal...
andrei-shtanakov/spec-runner
src/spec_runner/budget.py
.py
f9090a092abb792a
7.5
0
"""`spec-runner budget authorize` — an operator raising a ceiling (#230 part 2). Refunds and a separate infrastructure budget were rejected at design time: both stop the sentence *"the number bounds the money"* from being true. A refund turns the cap into a progress bound, and a deterministic instrument failure then l...
andrei-shtanakov/spec-runner
src/spec_runner/budget_cmd.py
.py
582d01011d5703b6
7.5
0
"""``change`` subcommands: new, list, archive (M2, change-as-folder). A change lives at ``spec/changes/<id>/`` and is a self-rooted spec dir — the rest of the toolchain scopes to it via ``config.change_id`` (CLI ``--change``). Archiving here only moves the folder to ``spec/changes/archive/`` with a date prefix; mergin...
andrei-shtanakov/spec-runner
src/spec_runner/change_commands.py
.py
eb6643067b2ea74d
7.5
0
"""File claims — the byte-lock behind a confirmed RED (#141 slice 2). A claim says: *this file, at these bytes, is frozen, because a confirmed RED depends on it.* The pilot's first version checked only the file of the current selector, so neighbouring tests were protected by a sentence in the agent's prompt rather tha...
andrei-shtanakov/spec-runner
src/spec_runner/claims.py
.py
33f99a4af384851b
7.5
0
"""Error classification for CLI agent stderr (v2.3.0). Adds short, human-readable reasons to failures (previously surfaced as "Unknown error"). Pattern library + last-N-lines stderr fallback. """ from __future__ import annotations import re from dataclasses import dataclass STDERR_TAIL_LINES = 5 @dataclass(frozen...
andrei-shtanakov/spec-runner
src/spec_runner/errors.py
.py
1ae1754a9acd0091
7.5
0
"""Event bus for streaming task execution events to TUI and other subscribers.""" import asyncio import collections import contextlib import threading import time from dataclasses import dataclass, field @dataclass class TaskEvent: """A single event from task execution.""" task_id: str event_type: str ...
andrei-shtanakov/spec-runner
src/spec_runner/events.py
.py
fc96ac3df5e685ef
7.5
0
"""Backward-compatible re-exports. All public API is available from this module for existing imports. Implementation moved to execution.py, cli.py. """ from .logging import get_logger logger = get_logger("executor") # Global shutdown flag — kept here because state.py imports it from .executor _shutdown_requested = ...
andrei-shtanakov/spec-runner
src/spec_runner/executor.py
.py
5d883ab7d6cf9a73
7.5
0
"""Harness-mutation tripwire (#64). The verification harness (test/lint configuration, dependency manifests, CI workflows) lives inside the agent's write scope: an agent that sees a failing gate can create a bridge — or neuter the oracle outright — and the run reports success. Observed in the field: a pytest bridge (`...
andrei-shtanakov/spec-runner
src/spec_runner/harness.py
.py
384a34fa3ec417ff
7.5
0
""" spec-runner init — install Claude Code skills to project. Usage: spec-runner-init # Install to .claude/skills in current directory spec-runner-init /path/to/project """ from __future__ import annotations import argparse import shutil import sys from pathlib import Path def get_skills_sourc...
andrei-shtanakov/spec-runner
src/spec_runner/init_cmd.py
.py
788baaabe45f8f8d
7.5
0
"""The TDD lifecycle as a recorded state machine — #141 slice 4a. Slices 1–3 built the parts: a verified red, a byte-lock on what it depends on, typed operator remedies. Where a task *was* still lived in inference — read the checkpoints, read the claims, guess. This makes it a fact. ``` READY → RED_AUTHORING → RED_VE...
andrei-shtanakov/spec-runner
src/spec_runner/lifecycle.py
.py
5d922cbb69647316
7.5
0
"""Back-compat shim over spec_runner.obs. The canonical entrypoint is now `spec_runner.obs.init_logging`. This module remains for existing callers that import `setup_logging`, `get_logger`, or `redact_sensitive`. """ from __future__ import annotations import re from pathlib import Path import structlog from spec_r...
andrei-shtanakov/spec-runner
src/spec_runner/logging.py
.py
9cae769429c1fd70
7.5
0
"""MCP server for spec-runner -- exposes status, tasks, costs, logs, and execution tools. Security: the stdio transport inherits the trust boundary of the process that launched it (typically a developer's terminal or Claude Code). There is no built-in authentication. Write tools (`run_task`, `stop`) spawn subprocesses...
andrei-shtanakov/spec-runner
src/spec_runner/mcp_server.py
.py
3c015c90f35a41ae
7.5
0
"""Notifications for spec-runner. Sends notifications via Telegram Bot API and/or generic webhook on run_complete, task_failed, state_degraded and pr_opened events. Best-effort — errors are logged, never raised. Notifications are ONLY sent when explicitly configured in the project config file (spec-runner.config.yaml...
andrei-shtanakov/spec-runner
src/spec_runner/notifications.py
.py
7e101fe7e1e27811
7.5
0
"""Orchestra observability emitter — reference implementation. Source of truth for `obs.py` (vendored into other Python projects). Produces OpenTelemetry Logs Data Model JSONL, one file per PID. Contract: see maestro/contracts/observability/log-schema.json """ from __future__ import annotations import logging as _s...
andrei-shtanakov/spec-runner
src/spec_runner/obs.py
.py
0263a47cf5e2088d
7.5
0
"""Typed outcome for a task phase — slice 0 of the lifecycle contract. Until now a stage said only where it was (`StageReporter`) and, if it died, where it died (`attempts.error_stage`). That is the whole vocabulary: a stage either fell over or it did not. One phase already grew a real one under pressure — `review`, i...
andrei-shtanakov/spec-runner
src/spec_runner/phases.py
.py
5e9e2485c70c226f
7.5
0
"""Plugin discovery and loading for spec-runner. Scans a plugins directory for subdirectories containing plugin.yaml manifests, parses them into PluginInfo/PluginHook dataclasses. Executes plugin hooks as subprocesses with env vars and run_on filtering. """ from __future__ import annotations import os import subproc...
andrei-shtanakov/spec-runner
src/spec_runner/plugins.py
.py
56bddf614386b394
7.5
0
"""Read-only preflight: what is missing, and what of that blocks a run (#142a). There is no zero stage. On a greenfield repo "what do I need before tasks can run" was answered one task failure at a time, and a gate that is green on an empty project answers nothing at all: an empty suite exits 0, and so does a linter w...
andrei-shtanakov/spec-runner
src/spec_runner/preflight.py
.py
2540617f7655956f
7.5
0
"""spec-runner config — apply CLI profile presets to spec-runner.config.yaml.""" from __future__ import annotations import argparse import shutil import sys from dataclasses import dataclass from importlib.resources import files from pathlib import Path from typing import TYPE_CHECKING import yaml if TYPE_CHECKING:...
andrei-shtanakov/spec-runner
src/spec_runner/preset_cmd.py
.py
83331eab97456df5
7.5
0
"""One writer for the prompts of the paid calls (#282, and the review half after it). Three stages of a task cost money — RED authoring, the implementation pass, and review — and until #282 only the implementation pass left a record of what it had asked. The RED prompt decides which file is frozen for the rest of the ...
andrei-shtanakov/spec-runner
src/spec_runner/prompts_log.py
.py
63656a5dd9c123ca
7.5
0
"""Traceability matrix report. Maps requirements -> design decisions -> tasks -> execution state to produce a full pipeline visibility report. """ from __future__ import annotations import json import re from dataclasses import dataclass, field from .config import ExecutorConfig from .state import ExecutorState fro...
andrei-shtanakov/spec-runner
src/spec_runner/report.py
.py
0bd9552187538dd0
7.5
0
"""Structured, tolerant parsing of requirements documents (M1). Turns a ``requirements.md`` into id-keyed :class:`Requirement` blocks so a requirement becomes a diffable/mergeable unit — the foundation for delta specs and archive merge (M3). Requirements in the wild use heterogeneous sub-structure (gherkin acceptance...
andrei-shtanakov/spec-runner
src/spec_runner/requirements.py
.py
95efa57fc32283e5
7.5
0
"""`spec` subcommands: status, approve, reject, adopt, check.""" from __future__ import annotations import argparse import subprocess from collections.abc import Callable from datetime import UTC, datetime from .config import ExecutorConfig, ExecutorLock from .logging import get_logger from .spec import ( SpecMe...
andrei-shtanakov/spec-runner
src/spec_runner/spec_commands.py
.py
88cfbaaf11a90e67
7.5
0
"""Deterministic merge of a delta spec into the source-of-truth requirements (M3). Identity is the REQ/NFR id, so matching is exact (no whitespace-tolerant header heuristics as in OpenSpec): ADDED requires a new id, MODIFIED replaces the whole existing block, REMOVED deletes it (Reason + Migration are mandatory), RENA...
andrei-shtanakov/spec-runner
src/spec_runner/spec_merge.py
.py
2040ec5a7d67546f
7.5
0
"""Per-task sub-stage tracking and mirroring (v2.3.0). One StageReporter per task. Threaded explicitly through execution; safe with `max_concurrent > 1` because each task gets its own reporter and there are no thread-locals. """ from __future__ import annotations from collections.abc import Callable from typing impo...
andrei-shtanakov/spec-runner
src/spec_runner/stages.py
.py
7628c800315c6ca9
7.5
0
"""Post-merge sync command (#73): close the run → PR → merge → next-run loop. After the human merges the integration PR, the operator used to hand-run `git pull --ff-only`, delete merged run/task branches locally and on the remote, and sanity-check executor state. `spec-runner sync` does exactly that, reporting each s...
andrei-shtanakov/spec-runner
src/spec_runner/sync_cmd.py
.py
921e407cab199115
7.5
0
# jinxurn.py """ Main module for JinxUrn application. """ import argparse import logging import sys from typing import Optional class JinxUrn: """Main class for JinxUrn functionality.""" def __init__(self, verbose: bool = False): """Initialize with verbosity setting.""" self.verbose = ver...
annakowqmvd/JinxUrn
jinxurn.py
.py
decac1defff464ec
7
0
# test_jinxurn.py """ Tests for JinxUrn module. """ import unittest from jinxurn import JinxUrn class TestJinxUrn(unittest.TestCase): """Test cases for JinxUrn class.""" def test_initialization(self): """Test class initialization.""" instance = JinxUrn() self.assertIsInstance(inst...
annakowqmvd/JinxUrn
test_jinxurn.py
.py
34c8cd92fe4891be
7.5
0
import os import numpy as np import pandas as pd # Define fixed crime categories for consistent encoding across train/val/test CRIME_CATEGORIES = [ 'routine_transaction', 'suspicious_cash_withdrawal', 'unusual_online_activity', 'high_value_transfer' ] def extract_features(df): """ Transforms p...
malikafarah/CyberSentinel
ml-model/src/features.py
.py
fbe9727538af4fbf
7
0
import os import joblib import numpy as np import pandas as pd from typing import List, Optional from fastapi import FastAPI, HTTPException from pydantic import BaseModel # 1. Define Request / Response Schemas (API Contract) class LocationCandidate(BaseModel): location_id: str latitude: float longitude: fl...
malikafarah/CyberSentinel
ml-model/src/predictionapi.py
.py
adefb2f03f3a15eb
7
0
import os import numpy as np import pandas as pd # City-to-Coordinate Mapping for the 43 US Cities in the dataset CITY_COORDINATES = { 'Albuquerque': (35.0844, -106.6504), 'Atlanta': (33.7490, -84.3880), 'Austin': (30.2672, -97.7431), 'Baltimore': (39.2904, -76.6122), 'Boston': (42.3601, -71.0589),...
malikafarah/CyberSentinel
ml-model/src/preprocessing.py
.py
5c267895fd778d32
7
0
#!/usr/bin/env python3 # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Trivial sidecar k8s charm used to validate the opcli CI build pipeline. Deploys to a k8s model with a rock container. Goes active once pebble is ready. """ import ops class K8sCharm(ops.CharmBase): """A minimal ...
canonical/charm-ci
examples/k8s-charm/src/charm.py
.py
4d213ee9b3608cdd
7.3
3
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Fixtures for k8s-charm sub-charm integration tests. This demonstrates a monorepo layout where a sub-charm has its own integration tests directory with its own conftest, independent of the top-level tests/integration/. Artifact fixtures (cha...
canonical/charm-ci
examples/k8s-charm/tests/integration/conftest.py
.py
9a49fadc3428484a
7.8
3
#!/usr/bin/env python3 # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Trivial machine charm used to validate the opcli CI build pipeline.""" import ops class MachineCharm(ops.CharmBase): """A minimal machine charm that immediately goes active.""" def __init__(self, *args: obje...
canonical/charm-ci
examples/machine-charm/src/charm.py
.py
506e9274d905da52
7.3
3
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Fixtures for machine-charm sub-charm integration tests. Artifact fixtures (charm_path, etc.) are provided automatically by the pytest-opcli plugin — no flag plumbing needed. """ from collections.abc import Generator import jubilant import ...
canonical/charm-ci
examples/machine-charm/tests/integration/conftest.py
.py
b1742f69b9d49159
7.8
3
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Integration test for the machine-charm sub-charm (monorepo pattern). Demonstrates auto-discover: false — variants are listed explicitly. """ import jubilant from opcli.pytest_plugin import CharmPathList def test_deploy(juju: jubilant.Juj...
canonical/charm-ci
examples/machine-charm/tests/integration/test_charm.py
.py
92a69d5089a369f3
7.8
3
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Shared pytest fixtures and CLI options for examples integration tests. Artifact fixtures (charm_paths, resource_images, etc.) are provided automatically by the pytest-opcli plugin — no flag plumbing needed. For multi-charm repos ``resource_...
canonical/charm-ci
examples/tests/integration/conftest.py
.py
17b39eb80a6dcf1c
7.8
3
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Integration test: machine-charm deploys and reaches active/idle.""" import os import jubilant from opcli.pytest_plugin import CharmPathList def test_spread_job_forwarded_to_pytest() -> None: """SPREAD_JOB set by spread is forwarded i...
canonical/charm-ci
examples/tests/integration/test_machine_charm.py
.py
e51dbdd502d89376
7.8
3
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Top-level Typer application — registers all command groups.""" import logging import sys from collections.abc import Sequence from typing import Any try: import typer from typer.core import TyperGroup except ImportError: print( ...
canonical/charm-ci
src/opcli/app.py
.py
2c39fcccd44c58e8
7.3
3
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """CLI commands for artifact discovery and building.""" import json from pathlib import Path from typing import Annotated import typer from opcli.core.artifacts import ( _DEFAULT_WAIT_TIMEOUT_SECONDS, artifacts_build, artifacts_co...
canonical/charm-ci
src/opcli/commands/artifacts.py
.py
d293179c0199794f
7.3
3
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """CLI commands for test environment management.""" from pathlib import Path import typer from opcli.core.provision import provision_prepare, provision_registry app = typer.Typer( help="Manage test environments (provisioning and registry...
canonical/charm-ci
src/opcli/commands/env.py
.py
e08d77427a20f11a
7.3
3
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """CLI commands for installing tool dependencies.""" import typer from opcli.core.install import ( install_all, install_charmcraft, install_concierge, install_doctor, install_gh, install_lxd, install_rockcraft, ...
canonical/charm-ci
src/opcli/commands/install.py
.py
d581a97db59a7d77
7.3
3
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """CLI commands for spread-based test execution.""" import json from pathlib import Path from typing import Annotated import typer from opcli.core.spread import spread_expand, spread_init, spread_jobs, spread_run app = typer.Typer( help=...
canonical/charm-ci
src/opcli/commands/spread.py
.py
6c3aefec96f559d5
7.3
3