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 |
|---|---|---|---|---|---|---|
"""Identifier and qualified-spot helpers (SPECIFICATIONS.md §8).
Environment-defined ids use the v0 identifier grammar, and spots are referenced
in the qualified form `<device>.<spot>`. Both validators (and later the scheduler)
share these two checks.
"""
from __future__ import annotations
import re
# v0 identifier... | ofplang/schedule | ofplang/schedule/core/identifiers.py | .py | 6582128187004c46 | 7 | 0 |
"""Objective stages (SPECIFICATIONS.md §4.8, §5.8).
The objective is a sequence of **stages** minimised lexicographically. v0 defines
two of them, and three places have to agree on what a stage list means: the two
schema validators (is this `kind` well formed?), the solver (what am I
minimising?), and the plan rendere... | ofplang/schedule | ofplang/schedule/core/objective.py | .py | 5b73aea011ffb210 | 7 | 0 |
"""Position-tracking YAML wrapper.
The schema validators report diagnostics with a `file:line:col` source position
(SPECIFICATIONS.md §9). PyYAML's ordinary loaders discard node positions, so this
module composes the YAML *node* tree (which keeps a `start_mark`) and wraps it in
lightweight nodes that carry the origina... | ofplang/schedule | ofplang/schedule/core/yamlnode.py | .py | 8c775eccbd58d3d1 | 7 | 0 |
"""Public entry point: workflow + environment (+ status) -> execution plan.
Orchestrates the pipeline (validate/load environment -> parse workflow -> build
instance -> solve -> render plan) and collects diagnostics from every stage into
one report. Given a `document_path` that sets `now`, the same pipeline replans: th... | ofplang/schedule | ofplang/schedule/scheduler/api.py | .py | 71bc73d5a9d7e570 | 7 | 0 |
"""Load an execution environment definition into the typed `Environment` model.
The document is first run through the existing schema validator (§9.1); only a
shape-valid document is turned into a model. Because that pass has already
guaranteed the structure, the build here does not re-check shapes.
A file is parsed ... | ofplang/schedule | ofplang/schedule/scheduler/envload.py | .py | 90f344cde2b253cf | 7 | 0 |
"""Render a solved instance as an execution document (SPECIFICATIONS.md §6).
A plan is action-first: each activity's main fields say what is actually done,
with the workflow provenance (`node` / `arc`) carried alongside. On an initial
plan every activity is pending, so `status` and `now` are omitted. On a replan the
s... | ofplang/schedule | ofplang/schedule/scheduler/plan.py | .py | 564bb88fe85bac1f | 7 | 0 |
"""The `objective` checks shared by the two schema validators (§5.8, §6.1, §9).
Both validators accept the same `kind`: the environment *declares* the objective
and the execution document *reports* it, and §6.2 lets a plan be fed straight back
in as the next input -- so a shape one accepts and the other rejects would ... | ofplang/schedule | ofplang/schedule/validation/_objective.py | .py | 12b48d407722558b | 7 | 0 |
"""Small shape-checking helpers shared by the two schema validators.
These wrap the recurring "is this the right kind of node, and is this key
present" checks so `environment.py` and `document.py` stay readable. Each helper
emits at most one diagnostic and returns either the narrowed node or None, so
callers can short... | ofplang/schedule | ofplang/schedule/validation/_shape.py | .py | ef8bc61523ec0e85 | 7 | 0 |
"""Duplicate mapping-key detection, shared by both schema validators (§9).
YAML permits a mapping to repeat a key and resolves it last-wins, so a document
that repeats one is read as something other than what it appears to say. Nothing
in these schemas ever means to do that, so a repeat is an error (`duplicate_key`).
... | ofplang/schedule | ofplang/schedule/validation/duplicates.py | .py | 154a0a8ae441a203 | 7 | 0 |
"""Shared helpers for the scheduling integration tests.
These tests drive `schedule()` end to end on **valid** inputs and assert the
optimal makespan (CP-SAT's optimum is a unique value, so it is a stable golden
anchor) plus the key structural choices. Small hand-built environments keep the
optimum hand-verifiable.
""... | ofplang/schedule | tests/schedutil.py | .py | 4bbb43a9f57964b1 | 7.5 | 0 |
"""CLI tests: the `validate` and `schedule` subcommands and their exit codes."""
from pathlib import Path
from ofplang.schedule import cli, validate_document
CASES = Path(__file__).parent / "conformance" / "cases"
EXAMPLES = Path(__file__).resolve().parents[1] / "examples"
def test_missing_file_is_usage_error():
... | ofplang/schedule | tests/test_cli.py | .py | 19ae8bcf39a7f596 | 7.5 | 0 |
"""Conformance runner for the schema validators.
Discovers every case under tests/conformance/cases/{env,doc}/, runs the matching
validator, and compares the produced error/warning codes to the case's
`.expected.yaml` (SPECIFICATIONS.md §9, §10). See tests/conformance/README.md.
"""
from __future__ import annotations... | ofplang/schedule | tests/test_conformance.py | .py | 326c184c60d64b80 | 7.5 | 0 |
"""Tests for loading the execution environment into the typed model."""
from __future__ import annotations
from pathlib import Path
from ofplang.schedule.scheduler.envload import load_environment
EXAMPLES = Path(__file__).resolve().parents[1] / "examples"
def test_load_simple_env():
env, result = load_environ... | ofplang/schedule | tests/test_envload.py | .py | 71e81d4e9f16e327 | 7.5 | 0 |
"""Identifier / node-path formatting helpers (core/identifiers.py)."""
from __future__ import annotations
from ofplang.schedule.core.identifiers import format_endpoint, format_node_path
def test_format_node_path_single_level():
assert format_node_path(("SampleSource",)) == "SampleSource"
def test_format_node_... | ofplang/schedule | tests/test_identifiers.py | .py | 33a460abecd1bf5c | 7.5 | 0 |
"""In-memory inputs: `schedule()` and both validators accept an already-loaded
document (a mapping) wherever they accept a path.
The point of these tests is equivalence: an in-memory document must be read
*exactly* as the file it would otherwise have been written to and read back --
same plan, same diagnostics codes -... | ofplang/schedule | tests/test_in_memory_inputs.py | .py | 0279e908ef9e9147 | 7.5 | 0 |
"""The basic-workflow generator: it emits both a v0 workflow and a matching
environment (their source/sink port count and the loader's spots scale with the
branch count). These tests exercise several sizes and the committed sample.
"""
from __future__ import annotations
import importlib.util
from pathlib import Path
... | ofplang/schedule | tests/test_plate_batch.py | .py | 9188a923cc1bdb32 | 7.5 | 0 |
"""Device-less Pure-Data-only processes (SPECIFICATIONS.md §5.5).
A Pure-Data-only process occupies no device and no spot; it exists only to take
time and to impose ordering through its Pure Data arcs (a `bind` binding is a
precedence edge, not a transport). Its mode may therefore have a **zero**
duration -- an instan... | ofplang/schedule | tests/test_pure_data.py | .py | 6bae9cad48c7d398 | 7.5 | 0 |
"""End-to-end replanning through the public API and the CLI.
Uses the `simple` example (source -> transport -> target). A status that marks
the source completed at now=3 leaves the transport and target to be re-optimised
at or after now, so the makespan grows from 5 (initial) to 6.
"""
from __future__ import annotati... | ofplang/schedule | tests/test_replan.py | .py | 948d9eaffd8e472e | 7.5 | 0 |
"""End-to-end re-routing on a replan: a committed transport delivered an Object
to a spot, the destination device became unavailable (its mode removed from the
env, its spot + transport routes kept), and the scheduler re-routes via a relay
and a re-transport. Uses the `simple` workflow (SampleSource -> SampleTarget) an... | ofplang/schedule | tests/test_reroute.py | .py | b7d20e92e1fb36ce | 7.5 | 0 |
"""What the inventory constraint assumes of CP-SAT's reservoir.
FORMULATION §11 models a stock as a reservoir whose level changes are the amounts
consumed and added. The added amounts are **decision variables**, and that is the
delicate part: `AddReservoirConstraintWithActive` accepts a `LinearExpr` there by
its type ... | ofplang/schedule | tests/test_reservoir.py | .py | 081c7048cc0133a9 | 7.5 | 0 |
#!/usr/bin/env python3
"""Full attention on the Apple Neural Engine, including both activation matmuls.
This closes the gap left in scripts/ane-transformer.py, where Q@K^T and
attn@V ran on the CPU. The reason given was that the ANE gemm reads its weights
from the kernel-weight DMA blob, so it computes W @ x and never... | joshuaswarren/ane-linux-experiments | ane-attention.py | .py | 722b8ab7c23d933b | 7 | 0 |
#!/usr/bin/env python3
"""Trace every ANE ioctl to /dev/kmsg, then run an example.
Why: netconsole is UDP and an SoC reset loses the tail, so "no driver print
arrived" does not prove the driver never printed. Marking each ioctl from
userspace *before* it is entered gives an independent record of which call
killed the ... | joshuaswarren/ane-linux-experiments | ane-ioctl-trace.py | .py | eb81a9bb1fd5f848 | 7 | 0 |
#!/usr/bin/env python3
"""Correlate ACTIVE probe ground-truth with PASSIVE Censys fields.
Goal: use active probing to DISCOVER passive indicators the passive
pipeline missed. For each probed host its live reality is now known
(REAL_DEVICE / DEAD / SUSPECT). The SAME host's full passive Censys
record is pulled from the... | hllayd/ics-honeypot-detection | correlate_active_passive.py | .py | e39149ad65ec2420 | 7 | 0 |
#!/usr/bin/env python3
"""enrich_ipinfo.py - A faithful equivalent of the paper's 2_look_up_as_categories.py
step.
The paper queries the IPinfo 'IP to Company' database (standard_company.mmdb)
OFFLINE with maxminddb and adds company.type + as.type to each host. This script
does the same for Censys Platform (v3) data: ... | hllayd/ics-honeypot-detection | enrich_ipinfo.py | .py | 63be8622b1df976e | 7 | 0 |
"""Collects the ENTIRE set of Censys Platform search results into a single file
by paginating. Follows next_page_token and concatenates the 'hits' list of all
pages.
Usage (PowerShell):
$env:CENSYS_PAT = "censys_pat_xxx" # Personal Access Token
$env:CENSYS_ORG = "12345678-91011-1213" # Organizat... | hllayd/ics-honeypot-detection | paginate_all.py | .py | 2a036ec635efd08e | 7 | 0 |
#!/usr/bin/env python3
"""Select top low-confidence population hosts for active probing.
Purpose
- Focus on hosts that are still not HIGH/MEDIUM in passive pipeline (LOW or NONE).
- Rank by non-productive likelihood using existing weak signals + new strong candidates.
- Emit top-N candidates with protocol-aware probe ... | hllayd/ics-honeypot-detection | select_active_probe_candidates.py | .py | 3996bb7324ef7725 | 7 | 0 |
"""
Candidates per model request — the number multi-offspring exists to move.
The distinction that matters is between *candidates* and *useful* candidates. A
response containing three alternatives that all collapse to the same AST is one
candidate that cost a request and a half; counting it as three would make the
fea... | ShumpZeke/OpenEvo | control_plane/analysis/throughput.py | .py | 9251540a33a69a4c | 7 | 0 |
"""
Evolution run entrypoint.
Executed as a subprocess by the run manager. It configures telemetry, installs
the engine hooks (in this process and in every ProcessPoolExecutor worker), then
hands control to OpenEvolve's ordinary CLI.
The CLI is invoked unmodified. That is the point: the same `openevolve-run.py`
the o... | ShumpZeke/OpenEvo | control_plane/runner/entrypoint.py | .py | 8ca18ca7cae94108 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
2D Affine Transform
Apply a 2D affine transformation to an input image (2D array). The transformation is defined by a 2x3 matrix which combines rotation, scaling, shearing, and translation. This task uses cubic spline interpolation (order=3) and handles boundary conditions using the 'constant'... | ShumpZeke/OpenEvo | examples/algotune/affine_transform_2d/best_program.py | .py | f26e7d3da6c7c978 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
2D Affine Transform
Apply a 2D affine transformation to an input image (2D array). The transformation is defined by a 2x3 matrix which combines rotation, scaling, shearing, and translation. This task uses cubic spline interpolation (order=3) and handles boundary conditions using the 'constant'... | ShumpZeke/OpenEvo | examples/algotune/affine_transform_2d/initial_program.py | .py | 9db015d1eb816132 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
Convolve2D Full Fill
This task computes the two-dimensional convolution of two matrices.
The input is a tuple of two 2D arrays: the first array has dimensions (30*n)×(30*n) and the second has dimensions (8*n)×(8*n), where n is a scaling factor that increases the problem size.
The convoluti... | ShumpZeke/OpenEvo | examples/algotune/convolve2d_full_fill/best_program.py | .py | a3048be5459a4f0a | 7 | 0 |
# EVOLVE-BLOCK-START
"""
Convolve2D Full Fill
This task computes the two-dimensional convolution of two matrices.
The input is a tuple of two 2D arrays: the first array has dimensions (30*n)×(30*n) and the second has dimensions (8*n)×(8*n), where n is a scaling factor that increases the problem size.
The convoluti... | ShumpZeke/OpenEvo | examples/algotune/convolve2d_full_fill/initial_program.py | .py | 3f763fe19ec1eed5 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
EigenvectorsComplex Task:
Given a square matrix with real entries, the task is to compute its eigenpairs (eigenvalues and eigenvectors).
Although the matrix is real, its eigenvalues may be complex.
The goal is to compute the approximated eigenpairs and return:
- A list of eigenvalues (comple... | ShumpZeke/OpenEvo | examples/algotune/eigenvectors_complex/best_program.py | .py | 72eb8bbfa6178804 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
EigenvectorsComplex Task:
Given a square matrix with real entries, the task is to compute its eigenpairs (eigenvalues and eigenvectors).
Although the matrix is real, its eigenvalues may be complex.
The goal is to compute the approximated eigenpairs and return:
- A list of eigenvalues (comple... | ShumpZeke/OpenEvo | examples/algotune/eigenvectors_complex/initial_program.py | .py | a0f2f5c54b7eebe2 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
FFT Complex
This task requires computing the N-dimensional Fast Fourier Transform (FFT) of a complex-valued matrix.
The FFT is a mathematical technique that converts data from the spatial (or time) domain into the frequency domain, revealing both the magnitude and phase of the frequency comp... | ShumpZeke/OpenEvo | examples/algotune/fft_cmplx_scipy_fftpack/best_program.py | .py | c53942a3cd82ccbb | 7 | 0 |
# EVOLVE-BLOCK-START
"""
FFT Complex
This task requires computing the N-dimensional Fast Fourier Transform (FFT) of a complex-valued matrix.
The FFT is a mathematical technique that converts data from the spatial (or time) domain into the frequency domain, revealing both the magnitude and phase of the frequency comp... | ShumpZeke/OpenEvo | examples/algotune/fft_cmplx_scipy_fftpack/initial_program.py | .py | 3b39d71fb1efaea2 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
FFT Convolution Task:
Given two signals x and y, the task is to compute their convolution using the Fast Fourier Transform (FFT) approach. The convolution of x and y is defined as:
z[n] = sum_k x[k] * y[n-k]
Using the FFT approach exploits the fact that convolution in the time domain is ... | ShumpZeke/OpenEvo | examples/algotune/fft_convolution/best_program.py | .py | b196561b6b25145a | 7 | 0 |
# EVOLVE-BLOCK-START
"""
FFT Convolution Task:
Given two signals x and y, the task is to compute their convolution using the Fast Fourier Transform (FFT) approach. The convolution of x and y is defined as:
z[n] = sum_k x[k] * y[n-k]
Using the FFT approach exploits the fact that convolution in the time domain is ... | ShumpZeke/OpenEvo | examples/algotune/fft_convolution/initial_program.py | .py | 85d7c38d94a7f7fe | 7 | 0 |
# EVOLVE-BLOCK-START
"""
LUFactorization Task:
Given a square matrix A, the task is to compute its LU factorization.
The LU factorization decomposes A as:
A = P · L · U
where P is a permutation matrix, L is a lower triangular matrix with ones on the diagonal, and U is an upper triangular matrix.
Input: A dictio... | ShumpZeke/OpenEvo | examples/algotune/lu_factorization/best_program.py | .py | 51619271709548e5 | 7 | 0 |
# EVOLVE-BLOCK-START
"""
LUFactorization Task:
Given a square matrix A, the task is to compute its LU factorization.
The LU factorization decomposes A as:
A = P · L · U
where P is a permutation matrix, L is a lower triangular matrix with ones on the diagonal, and U is an upper triangular matrix.
Input: A dictio... | ShumpZeke/OpenEvo | examples/algotune/lu_factorization/initial_program.py | .py | 15465cecf84e9364 | 7 | 0 |
"""Adobe DNG SDK 1.7 triple-illuminant HueSatMap carrier semantics."""
from __future__ import annotations
from dataclasses import dataclass
import numpy as np
# Wyszecki & Stiles table copied from the public DNG SDK dng_temperature.cpp.
_TEMP_TABLE = np.asarray(
[
(0, .18006, .26352, -.24341), (10, .18... | fishvivfish/HNCS-Lightroom | hncs_core/adobe_triple_illuminant.py | .py | 2b957258e52c9379 | 7.15 | 1 |
"""SSH agent forwarding wire framing.
Used by both the host-side pump and the in-container relay.
Importable by tests; also concatenated as source onto the inlined
`python3 -c` invocations at runtime.
"""
import struct
import threading
SENTINEL = b"\x00\x00\x00\x00" # length-prefix 0 = "raw side closed"
# Relay → ... | d4re/tmux-agents | src/tmux_agents/_ssh_framing.py | .py | 157fd55314045292 | 7 | 0 |
"""Host-side SSH agent pump.
Importable by tests; also run detached on the host as
`python -m tmux_agents._ssh_pump_script <container> <user>` (see
`tmux_agents.ssh_forward.spawn_pump`). It supervises an in-container relay,
which it delivers as plain files (`_ssh_framing.py` + `_ssh_relay_script.py`)
via `docker exec`... | d4re/tmux-agents | src/tmux_agents/_ssh_pump_script.py | .py | f24d76e5b818da66 | 7 | 0 |
"""In-container SSH agent relay.
Delivered into the container as a plain file (alongside `_ssh_framing.py`) by
the host pump and run as `python3 <dir>/_ssh_relay_script.py`; also importable
by tests as `tmux_agents._ssh_relay_script`.
"""
# Framing names come from the installed package when imported normally (tests),... | d4re/tmux-agents | src/tmux_agents/_ssh_relay_script.py | .py | dec10b6d3337671e | 7 | 0 |
"""The two supported agent kinds and their per-kind knowledge: executable
name and resume-argument spelling. Nothing else may hardcode 'claude'."""
from __future__ import annotations
import shlex
CLAUDE = "claude"
CODEX = "codex"
KINDS = (CLAUDE, CODEX)
# Exported (=1) only by agent exec templates; codex-hook.sh req... | d4re/tmux-agents | src/tmux_agents/agent_kind.py | .py | 79b356d58cabf89d | 7 | 0 |
"""User-layer Codex hook provisioning: a package-owned codex-hook.sh
installed OUTSIDE every workspace + owned entries in ~/.codex/hooks.json.
Ownership = exact structural command match (quoted script path as the
sole first argument + one action word) — migration-safe without a ledger,
and immune to matching user wrapp... | d4re/tmux-agents | src/tmux_agents/codex_hooks.py | .py | 17f196de2feaa4ac | 7 | 0 |
"""`agent-other` entry point: start, revive, or switch focus to the
*secondary* agent — the kind other than the window's default slot's kind
(claude<->codex) — in the active agent window.
One smart action per invocation (spec:
docs/superpowers/specs/2026-07-17-codex-support-design.md Section 4):
1. No window mapping ... | d4re/tmux-agents | src/tmux_agents/commands/other.py | .py | 60196783d4e5c0c9 | 7 | 0 |
"""`agent-rebuild`: force-recreate a project's shared container and resume
its agents.
Two halves, like `agent-new`:
- interactive `main` (runs in the `display-popup`): pick the project, warn,
confirm, then fire the worker via `tmux.run_shell_bg` and return so the
popup closes.
- detached `main --worker` (parente... | d4re/tmux-agents | src/tmux_agents/commands/rebuild.py | .py | f3e0d0a3dbb21b53 | 7 | 0 |
"""`agent-terminal` entry point.
Pops a shell rooted at the active agent's worktree — host projects do
`chdir` + `exec $SHELL -il`; container/devcontainer projects exec into
`docker exec -it -u <user> -w <workdir> <container> bash -il` with the
same env forwarding (TERM, COLORTERM, TMUX_PANE, optional
SSH_AUTH_SOCK) C... | d4re/tmux-agents | src/tmux_agents/commands/terminal.py | .py | 20c29b40dfe5883e | 7 | 0 |
"""projects.toml loader. Resolves the three project modes (named
`container` / `devcontainer = true` / host-only) and fills in defaults
for `exec_cmd`, `up_cmd`, and `container_workdir`."""
from __future__ import annotations
import tomllib
from dataclasses import dataclass
from pathlib import Path
from tmux_agents im... | d4re/tmux-agents | src/tmux_agents/config.py | .py | 1d2d55fedd397e4d | 7 | 0 |
"""GitHub CLI auth sharing: one-shot host→container token sync.
Public API used by `agent-new`, `agent-restore`, and `agent-rebuild`:
maybe_sync_gh_auth(container, user) -> SyncResult
The host token comes from `gh auth token` (keyring-backed on macOS — the
container can't read it, and a rebuilt container loses it... | d4re/tmux-agents | src/tmux_agents/gh_auth.py | .py | 55fe2f57390518b6 | 7 | 0 |
"""Filesystem locations for config, state, per-worktree, and per-window
data. Env-overridable (`TMUX_AGENTS_CONFIG_DIR` / `TMUX_AGENTS_STATE_DIR`)
so tests redirect — every path used elsewhere should come from here."""
from __future__ import annotations
import json
import logging
import os
import tempfile
from pathlib... | d4re/tmux-agents | src/tmux_agents/paths.py | .py | b68ba20636b502ff | 7 | 0 |
"""Hook-written phase vocabulary and display-letter derivation.
`state.py` keeps the single-letter display codes the overview renders. This
module bridges the JSON `phase` field Claude hooks write into those codes,
overlaying the background/sleeping item counts computed by `registry.scan`,
using the priority rule X > ... | d4re/tmux-agents | src/tmux_agents/phase.py | .py | 7da166a6b60ebb37 | 7 | 0 |
"""Shared fzf idioms for interactive commands.
Keep this module free of any tmux or project knowledge — it only wraps the
fzf-backed primitives (pick, yes/no, free text, pick-or-create) that
agent-new and agent-kill consume.
"""
from __future__ import annotations
import logging
import subprocess
from collections.abc ... | d4re/tmux-agents | src/tmux_agents/pickers.py | .py | 295deb1dbe5659ec | 7 | 0 |
"""Per-stage progress output for `agent-new` (popup) and `agent-restore`
(placeholder logs).
`Reporter` owns one output stream; `Stage` is its context-manager helper.
`MultiReporter` fans out to N reporters for the restore broadcast case."""
from __future__ import annotations
import os
import sys
import time
from typ... | d4re/tmux-agents | src/tmux_agents/progress.py | .py | cb7d734c889bd04b | 7 | 0 |
"""Idempotent merge of src/tmux_agents/hooks/agents.json into a worktree's
.claude/settings.local.json, plus the helper script the hooks invoke.
We own three top-level keys: `_tmux_agents_version`, `tui`, and the
entries in `hooks` that correspond to events we ship. User-authored
hooks on the SAME event are preserved ... | d4re/tmux-agents | src/tmux_agents/provisioning.py | .py | d752fb33ee73ecd0 | 7 | 0 |
"""Per-pane registry of self-expiring background/scheduled markers.
Claude hooks (running inside the container) drop one marker file per
pending/running thing under <worktree>/.local/.tmux-agents/pending-<pane>/,
named '<kind>__<id>' (or just 'wakeup' for the singleton). File content is the
kind's schedule signal (epo... | d4re/tmux-agents | src/tmux_agents/registry.py | .py | d2d873235404c858 | 7 | 0 |
"""SSH agent forwarding: probes, pump spawn, pump lifecycle.
Public API used by `agent-new` and `agent-restore`:
has_python3_in_container(container) -> bool
host_ssh_auth_sock() -> str | None
spawn_pump(container) -> subprocess.Popen
maybe_spawn_pump(container, user) -> PumpResult (idempotent wrapper)... | d4re/tmux-agents | src/tmux_agents/ssh_forward.py | .py | abe9709a5da53f25 | 7 | 0 |
"""Shared spawn/restore primitives used by both `agent-new` (async startup)
and `agent-restore`. These are the pieces common to placing a placeholder
pane, respawning it, writing per-pane state, and showing a static message —
the orchestration around them lives in commands/new.py and commands/restore.py.
"""
from __fu... | d4re/tmux-agents | src/tmux_agents/startup.py | .py | decd15eccc128857 | 7 | 0 |
"""Sole module that shells out to `tmux -L agents`. Add new tmux
invocations here, not inline in callers."""
from __future__ import annotations
import os
import subprocess
from dataclasses import dataclass
from pathlib import Path
SESSION = "agents"
CONTROL_WINDOW = "ctrl"
_TMUX = ["tmux", "-L", "agents"]
def lega... | d4re/tmux-agents | src/tmux_agents/tmux.py | .py | 36ed5d38fe025116 | 7 | 0 |
"""Window->worktree mapping files used by the host-side state tick.
Each tmux window created by `agent-new` has a JSON file at
~/.config/tmux-agents/windows/<window_id>.json that records the project,
branch, host-side worktree path, and pane id. The tick reads these to
locate per-worktree state JSON files written by C... | d4re/tmux-agents | src/tmux_agents/windows.py | .py | ce1e2075f08ced15 | 7 | 0 |
"""`git worktree add/remove`. For container projects, runs git via
`docker exec` so the worktree's internal `.git` pointers resolve inside
the container instead of pointing at host paths the container can't
reach."""
from __future__ import annotations
import logging
import subprocess
from pathlib import Path
from tmu... | d4re/tmux-agents | src/tmux_agents/worktree.py | .py | 7157ca4bc393a208 | 7 | 0 |
import tempfile
from pathlib import Path
from types import SimpleNamespace
import pytest
from tmux_agents import tmux
FIXTURES = Path(__file__).parent / "fixtures"
@pytest.fixture(autouse=True)
def _reset_prefix_label_cache():
"""prefix_label is process-cached; never let one test's value leak."""
tmux.reset... | d4re/tmux-agents | tests/conftest.py | .py | 528250956ab80284 | 7.5 | 0 |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # Expectation Propagation from Scr... | jejjohnson/gaussx | docs/notebooks/expectation_propagation.py | .py | 635fabf96dcfbab5 | 7.24 | 2 |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # LOVE: Fast Leave-One-Out Cross-V... | jejjohnson/gaussx | docs/notebooks/love_crossval.py | .py | 7d5b564c83217f73 | 7.24 | 2 |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # Whitened SVGP & Bayesian Linear ... | jejjohnson/gaussx | docs/notebooks/whitened_svgp.py | .py | e7671b58367d97c7 | 7.24 | 2 |
"""Linear-Gaussian state-space models as sampleable densities."""
from __future__ import annotations
import math
import equinox as eqx
import jax
import jax.numpy as jnp
import lineax as lx
import numpyro.distributions as dist
from jaxtyping import Array, Bool, Float
from numpyro.distributions.util import lazy_prope... | jejjohnson/gaussx | src/gaussx/_distributions/_lgssm.py | .py | b99cf1dd17c4f5ef | 7.24 | 2 |
"""Projection: K_XZ @ K_ZZ^{-1} via Cholesky solve."""
from __future__ import annotations
import jax
import lineax as lx
from jaxtyping import Array, Float
def project(
K_XZ: Float[Array, "B M"],
L_Z: lx.AbstractLinearOperator,
) -> Float[Array, "B M"]:
"""Compute A_X = K_XZ @ K_ZZ^{-1} via Cholesky sol... | jejjohnson/gaussx | src/gaussx/_distributions/_project.py | .py | ba3390316d2f5ef7 | 7.24 | 2 |
"""Gaussian distribution in exponential family form."""
from __future__ import annotations
import equinox as eqx
import jax.numpy as jnp
import lineax as lx
from jaxtyping import Array, Float
from gaussx._distributions._gaussian import _LOG_2PI
from gaussx._einx import einsum
from gaussx._expfam._natural import mean... | jejjohnson/gaussx | src/gaussx/_expfam/_gaussian.py | .py | e55425193ceac5aa | 7.24 | 2 |
"""Gaussian conditional via Schur complement (base_conditional)."""
from __future__ import annotations
import jax
import jax.numpy as jnp
import jax.scipy.linalg as jsla
import lineax as lx
from jaxtyping import Array, Float
from gaussx._einx import rearrange, repeat
from gaussx._primitives._cholesky import cholesky... | jejjohnson/gaussx | src/gaussx/_gp/_base_conditional.py | .py | 281df205c3d714ea | 7.24 | 2 |
"""Variational ELBO sugar: Gaussian and Monte Carlo ELBO objectives."""
from __future__ import annotations
from collections.abc import Callable
import jax.numpy as jnp
from jaxtyping import Array, Float
from gaussx._distributions._gaussian import _LOG_2PI
def variational_elbo_gaussian(
y: Float[Array, " N"],
... | jejjohnson/gaussx | src/gaussx/_gp/_elbo.py | .py | a3e5a90118f307a2 | 7.24 | 2 |
"""KL divergence between Gaussian distributions."""
from __future__ import annotations
import jax
import jax.numpy as jnp
import jax.scipy.linalg as jsla
import lineax as lx
from jaxtyping import Array, Float
from gaussx._primitives._cholesky import cholesky
from gaussx._primitives._logdet import cholesky_logdet
fro... | jejjohnson/gaussx | src/gaussx/_gp/_gauss_kl.py | .py | 2355f79dc19394bd | 7.24 | 2 |
"""
Video Stream Capture, decodes H.264 feed from VTX/VRX via FFmpeg.
Provides a thread-safe frame queue for real-time inference.
"""
import queue
import subprocess
import threading
import time
import cv2
import numpy as np
class VideoStreamCapture:
"""
Captures frames from VTX/VRX digital RF link via FFmpe... | Aqshalikhsan/PEARL-Navigation | deployment/video_stream.py | .py | 8a72c75baf0becc2 | 7.39 | 5 |
"""DepthAnything depth network wrapper for PI-CMDR."""
import torch
import torch.nn as nn
import torch.nn.functional as F
class DepthAnythingWrapper(nn.Module):
"""
Wraps DepthAnything (via torch.hub) to produce (B,1,H,W) depth maps.
Falls back to a lightweight CNN if hub unavailable.
"""
def __... | Aqshalikhsan/PEARL-Navigation | perception/depth_nets/depthanything_wrapper.py | .py | 825b36a42ca8de48 | 7.39 | 5 |
"""MiDaS depth network wrapper for PI-CMDR."""
import torch
import torch.nn as nn
import torch.nn.functional as F
class MiDaSWrapper(nn.Module):
"""
Wraps MiDaS (via torch.hub) to produce (B,1,H,W) depth maps
compatible with PI-CMDR.
"""
def __init__(self, model_type: str = "DPT_Large", pretrain... | Aqshalikhsan/PEARL-Navigation | perception/depth_nets/midas_wrapper.py | .py | 27297c5bfba4b09d | 7.39 | 5 |
"""
LSTM Belief Aggregator, temporal belief under partial observability.
Implements Algorithm 3 (Spatio-Temporal pipeline) from the paper:
h_t, c_t = LSTM(Z_t, h_{t-1}, c_{t-1})
d_t = Pool(D~_t ⊙ C_t)
s_t = Phi(h_t ⊕ d_t ⊕ sigma_t)
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class L... | Aqshalikhsan/PEARL-Navigation | perception/lstm_belief.py | .py | 367e6edc76b86fa0 | 7.39 | 5 |
"""
Actor Network: Gaussian policy pi_theta(a_t | s_t).
Implements Eq. 60-61: a_t ~ N(mu_theta(s_t), Sigma_theta)
"""
import numpy as np
import torch
import torch.nn as nn
LOG_STD_MIN = -5.0
LOG_STD_MAX = 2.0
class Actor(nn.Module):
"""
Gaussian actor for continuous UAV control.
Output: [v_x (forward sp... | Aqshalikhsan/PEARL-Navigation | policy/actor.py | .py | f14bd2c9a819d457 | 7.39 | 5 |
"""
Critic Network, state-value function V_phi(s_t).
Used for advantage estimation in PPO.
"""
import torch
import torch.nn as nn
class Critic(nn.Module):
"""
State-value critic V_psi(s_t) for PPO advantage estimation.
"""
def __init__(self, latent_dim: int = 256, hidden_sizes: list = None):
... | Aqshalikhsan/PEARL-Navigation | policy/critic.py | .py | 3a00ad0450d016ec | 7.39 | 5 |
"""
LPC: Learned Perceptual Curriculum.
Implements Eqs. (42)-(44) from the paper:
A_t = sigma-bar_t + lambda_d * (1 - C-bar_t) Eq. (42)
where sigma-bar_t = (1/d) sum_k |sigma_{t,k}|, Eq. (21)
A-bar = (1/T') * sum_{t=1..T'} A_t Eq. (43)
T' is the rollout horizon, ... | Aqshalikhsan/PEARL-Navigation | training/curriculum.py | .py | 632c04e818b99765 | 7.39 | 5 |
"""Training logger: TensorBoard + console output."""
import os
import time
from collections import defaultdict
import numpy as np
try:
from torch.utils.tensorboard import SummaryWriter
TB_AVAILABLE = True
except ImportError:
TB_AVAILABLE = False
class TrainLogger:
"""Unified logger for all PEARL-N... | Aqshalikhsan/PEARL-Navigation | training/logger.py | .py | f714f69a61786afe | 7.39 | 5 |
"""GAP-6 客户端限流适配 — 429 退避重试。
fusion-mlx 上游 --rate-limit 限流 (issue #635 已修: --rate-limit 0 真正关闭,
默认即关; 显式设上限值时仍会返 429)。本模块在 agent→fusion-mlx HTTP 调用层
拦截 429: 读 Retry-After 头, 指数退避 sleep, 在任务超时预算内重试。
预算耗尽仍 429 → 上抛 RateLimitExhausted 供调用方归类为瞬时失败 (可重试),
而非逻辑错误 (不该 ban 节点)。
旧缺陷: FusionMLXBackend.chat 直接 raise_for_status ... | dahai80/fusion-multi-nodes | fusion_multi_node/agent/rate_pacer.py | .py | 94cd47a1cb4c823f | 7 | 0 |
"""Fusion-Multi-Node 配置管理。"""
from __future__ import annotations
import copy
import json
import logging
import os
from pathlib import Path
from typing import Any
from ..agent import AgentConfig
logger = logging.getLogger(__name__)
class ConfigValidationError(ValueError):
"""配置项类型/范围校验失败。"""
# 已知配置键 → 校验函数。s... | dahai80/fusion-multi-nodes | fusion_multi_node/config/config.py | .py | e64517beb0d03850 | 7 | 0 |
"""M1-05 手动 IP 加入 — mDNS 失败时的 IP 直连回退机制。
提供 join_by_ip() 方法,允许 Agent 通过已知的 Master IP:Port 直接注册,
无需 mDNS 发现。同时提供 Master 端的 /api/join 端点。
"""
from __future__ import annotations
import logging
import time
from dataclasses import dataclass
from typing import Any
import httpx
logger = logging.getLogger(__name__)
@dat... | dahai80/fusion-multi-nodes | fusion_multi_node/discovery/manual_join.py | .py | c2027e3dd148343f | 7 | 0 |
"""mDNS/Bonjour 零配置节点发现。
基于 zeroconf 实现:
- Master: 注册 mDNS 服务,局域网可发现
- Agent: 浏览 mDNS 服务,自动发现 Master
- 支持共享密钥验证,防止未授权节点加入
"""
from __future__ import annotations
import hashlib
import logging
import platform
import socket
import threading
import time
from collections.abc import Callable
from dataclasses import datacl... | dahai80/fusion-multi-nodes | fusion_multi_node/discovery/mdns_discovery.py | .py | 5401f24e28dc71a9 | 7 | 0 |
"""Caveman Token Compression — 跨节点张量传输压缩。
分布式推理中,跨节点传输的中间激活和 KV 缓存占用大量带宽。
Caveman 通过轻量无损压缩算法,降低 40-60% 传输量。
算法:
1. Token 频率统计:对传输的 token 序列做频率分析
2. 字典压缩:高频 token 用短编码替换
3. 差分编码:连续相似的 token 只传差值
"""
from __future__ import annotations
import struct
import zlib
from collections import Counter
from dataclasses import d... | dahai80/fusion-multi-nodes | fusion_multi_node/distributed_mlx/caveman_compress.py | .py | e2a4bdda81a370e9 | 7 | 0 |
"""Distributed MLX 分布式算子桥 — 封装 mlx.distributed 底层 API。
提供统一并行接口:
- 流水线并行(Pipeline Parallelism):大模型分层拆分到多节点
- 数据并行(Data Parallelism):多节点完整加载同款模型
- 通信压缩(Caveman token compression)
- MoE 模型分布式路由
能力状态(2026-08-24 AR 审计 H1):
- 数据并行(DATA):可用。走 fusion-mlx `/v1/chat/completions`(已存在)。
- 流水线并行(PIPELINE):未实现,依赖 fusion-mlx `/dis... | dahai80/fusion-multi-nodes | fusion_multi_node/distributed_mlx/distributed_bridge.py | .py | 918ae389351302ef | 7 | 0 |
"""M3-03 Master 选举机制 — 优先级 + 心跳超时的分布式选举协议。
当 Master 节点故障时,集群中多个 Standby 节点通过选举协议确定新 Master。
选举策略:
- 优先级: 每个候选人有优先级值,高优先级优先
- 心跳超时: 基于超时检测触发选举
- 投票: 候选人向已知节点拉票,多数票获胜
- 分裂预防: 优先级相同按 node_id 字典序打破
"""
from __future__ import annotations
import asyncio
import json
import logging
import os
import random
import time
from c... | dahai80/fusion-multi-nodes | fusion_multi_node/master/election.py | .py | 79e3cdb899002c9e | 7 | 0 |
"""Task Sharding — 任务分片类型、自动分片算法、结果合并。
M5-01: ShardingType 枚举 (inference/ast/vectorize)
M5-02: 自动分片算法 (by file/document/batch)
M5-05: 分片结果合并/聚合
"""
from __future__ import annotations
import logging
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import Any
logger = logging.get... | dahai80/fusion-multi-nodes | fusion_multi_node/master/task_sharding.py | .py | d1bd51b95555164d | 7 | 0 |
"""MCP 集群网关 — Claude 兼容的全局统一 MCP 服务入口。
⚠️ AR审计 P2: MCP协议路由+Token额度管理,职责更像API Gateway。
整改方案: 标记为待迁移至 fusion-gateway,后续版本移除。
调用此模块时将发出 DeprecationWarning。
核心职责:
- 聚合所有节点插件能力,统一供给 Claude Desktop / Claude Code
- 自动路由工具调用到最优节点
- 子代理分布式分流
- Coding Plan 额度统一管理
"""
from __future__ import annotations
import asyncio
import c... | dahai80/fusion-multi-nodes | fusion_multi_node/mcp_gateway/mcp_gateway.py | .py | 612ede9da86892bc | 7 | 0 |
"""Cluster Observability — 全集群统一可观测模块。
核心能力:
- 全集群统一日志聚合
- 指标监控(内存/推理TPS/网络RTT/会话耗时)
- 告警体系(节点离线/长任务卡死/内存爆满)
"""
from __future__ import annotations
import asyncio
import bisect
import collections
import logging
import time
import uuid
from collections.abc import Callable
from dataclasses import dataclass, field
from... | dahai80/fusion-multi-nodes | fusion_multi_node/observability/observability.py | .py | 9c73c31555222858 | 7 | 0 |
"""Circuit Breaker 熔断器。
防止故障节点拖垮整个集群:
- CLOSED: 正常状态,请求放行
- OPEN: 熔断状态,请求直接拒绝
- HALF_OPEN: 半开状态,放行探测请求
参数:
- failure_threshold: 连续失败次数阈值(默认 5)
- recovery_timeout: 熔断恢复超时(默认 30s)
- half_open_max: 半开状态最大放行数(默认 1)
"""
from __future__ import annotations
import logging
import time
from enum import Enum
logger = logging... | dahai80/fusion-multi-nodes | fusion_multi_node/protocol/circuit_breaker.py | .py | 46130a1bf58e5eb4 | 7 | 0 |
"""FMP TCP 长连接管理。
节点间维持 TCP 长连接:
- 自动重连(3s 内完成)
- 心跳保活
- 连接池管理
- 与 CircuitBreaker 集成
"""
from __future__ import annotations
import asyncio
import logging
import time
import uuid
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any
from .circuit_breaker import CircuitBreaker
... | dahai80/fusion-multi-nodes | fusion_multi_node/protocol/fmp_connection.py | .py | de1d6149b8ce1659 | 7 | 0 |
"""FMP 消息路由器。
职责:
- 消息路由: 根据 target_id 投递到正确连接
- hop_count 校验: 超限直接拦截
- 多轮对话管理: round_id + round_number 追踪
- 与 CircuitBreaker 集成
"""
from __future__ import annotations
import logging
import time
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any
from .fmp_connection import... | dahai80/fusion-multi-nodes | fusion_multi_node/protocol/fmp_router.py | .py | 665bcd53871913d6 | 7 | 0 |
"""ECDH 密钥交换 + TLS 自签名证书工具。
提供:
- ECDH 密钥交换: 节点间协商 AES-256 会话密钥
- TLS 自签名证书: 节点间加密通信
- 证书指纹 pinning: 集群内节点信任验证
"""
from __future__ import annotations
import hashlib
import logging
import os
from datetime import UTC, datetime, timedelta
from pathlib import Path
from typing import Any
logger = logging.getLogger(__nam... | dahai80/fusion-multi-nodes | fusion_multi_node/protocol/key_exchange.py | .py | 9a0f6136e7c48d36 | 7 | 0 |
"""审计日志 — 追加写 JSONL, 记录所有安全相关动作 (GAP-8, 复审计 2026-08-26)。
企业级商业生产发布阻塞项: 旧实现无审计日志 — 节点注册/审批/鉴权失败/权限拒绝/任务提交取消
等敏感动作无留痕, 事故不可溯源。本模块补齐: append-only JSONL 落盘 `~/.fusion/multi-node/audit.log`,
每行一条事件, 字段固定。
字段契约:
ts ISO8601 带时区时间戳
actor 动作发起方 (node_id / "master" / "unknown" / ip)
action 动作类型 (register/join/... | dahai80/fusion-multi-nodes | fusion_multi_node/security/audit_log.py | .py | cea2ade9416aafdd | 7 | 0 |
"""集群 mTLS — 私有 CA + 节点叶证书, 集群内 HTTP 双向认证。
env 开关 (默认关, 不破坏现有 http + ASGITransport 测试):
FUSION_MTLS_ENABLED=1 开启 mTLS (server 要求客户端证书, client 带证书)
FUSION_MTLS_CA_CERT=<path> 集群 CA 证书 PEM (节点共享同一 CA)
FUSION_MTLS_NODE_CERT=<path> 本节点叶证书 PEM
FUSION_MTLS_NODE_KEY=<path> 本节点叶私钥 PEM
FUSIO... | dahai80/fusion-multi-nodes | fusion_multi_node/security/mtls.py | .py | 239b2867af03ff1f | 7 | 0 |
"""Generic webhook alerter."""
from __future__ import annotations
from typing import Any
import httpx
import structlog
from anomx.config.models import WebhookAlertingSettings
logger = structlog.get_logger(__name__)
class WebhookAlerter:
"""POST alert payloads to a configured HTTP endpoint."""
def __init... | idris404/AnomX | packages/anomx/anomx/alerting/webhook.py | .py | 5664635492b6cf1a | 7 | 0 |
"""CSV/Parquet batch source connector."""
from __future__ import annotations
from pathlib import Path
from typing import Any, Literal
import structlog
from anomx.connectors.common import load_timeseries_frame, records_from_timeseries_frame
logger = structlog.get_logger(__name__)
class CsvBatchSource:
"""Read... | idris404/AnomX | packages/anomx/anomx/connectors/csv_batch.py | .py | 9efe1038065912cc | 7 | 0 |
"""Pipeline orchestration (Phase 0 stub)."""
from __future__ import annotations
from typing import Any
import structlog
from anomx.core.interfaces import Sink, Source
logger = structlog.get_logger(__name__)
class Pipeline:
"""Minimal ingest pipeline: source → sink."""
def __init__(self, source: Source, ... | idris404/AnomX | packages/anomx/anomx/core/pipeline.py | .py | 349743319d8a767d | 7 | 0 |
"""Build composite explanations for ensemble alerts."""
from __future__ import annotations
from typing import Any
from anomx.core.ensemble import EnsembleDetector
from anomx.detectors.isolation_forest import IsolationForestDetector
from anomx.detectors.mad import MADDetector
from anomx.explain.mad_rules import expla... | idris404/AnomX | packages/anomx/anomx/explain/builder.py | .py | 00d9763975d4a456 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.