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
# core/events.py """简单发布/订阅事件总线,用于解耦核心层和 UI 层""" import logging from typing import Callable logger = logging.getLogger(__name__) # 核心事件名称常量,统一引用避免拼写错误 EVENT_STATUS_CHANGED = "status_changed" EVENT_LOG_LINE = "log_line" EVENT_ERROR = "error" EVENT_STATS_UPDATE = "stats_update" class EventBus: """轻量级发布/订阅事件总线"""...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/core/events.py
.py
83c1aa7af234e0dd
7.48
8
# core/log_watcher.py """日志监控器:读取 subprocess 的 stdout/stderr 管道并推送事件""" import logging import threading from core.events import EventBus, EVENT_LOG_LINE logger = logging.getLogger(__name__) # 需要高亮的关键词映射 KEYWORD_EVENTS = { "error": "log_error", "cuda error": "log_error", "out of memory": "log_oom", "...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/core/log_watcher.py
.py
b6bc5cbdc427b8e1
7.48
8
# core/model_library.py """扫描目录下的 GGUF 模型文件,解析基本元数据""" import os import struct from dataclasses import dataclass, field # GGUF 魔数 _GGUF_MAGIC = b"GGUF" # 量化类型映射(GGUF type id → 名称) _QUANT_NAMES = { 0: "F32", 1: "F16", 2: "Q4_0", 3: "Q4_1", 6: "Q5_0", 7: "Q5_1", 8: "Q8_0", 9: "Q8_1", 10: "Q2_K", 11: "Q3_K...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/core/model_library.py
.py
b96390edaf3b2a96
7.48
8
# core/process_manager.py """llama-server 进程生命周期管理:启动、停止、存活检测""" import logging import os import socket import subprocess import threading import time from collections import deque from enum import Enum from queue import Queue, Empty import psutil from core.events import EventBus, EVENT_STATUS_CHANGED, EVENT_LOG_LIN...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/core/process_manager.py
.py
7ebd0d1f72abc9be
7.48
8
# main.py """LLM 本地模型启动器 入口文件""" import logging import os import sys # 确保项目根目录在 sys.path 中,方便 core/ui 导入 PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, PROJECT_ROOT) from ui.app import LlamaLauncherApp def setup_logging(): """配置日志格式与级别""" logging.basicConfig( level=log...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/main.py
.py
f514379d3283d79c
7.48
8
# ui/confirm_dialog.py """通用二次确认弹窗""" from textual.app import ComposeResult from textual.containers import Horizontal, Vertical from textual.screen import ModalScreen from textual.widgets import Button, Label class ConfirmDialog(ModalScreen[bool]): """显示确认消息,返回 True(确认)或 False(取消)""" def __init__(self, mess...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/ui/confirm_dialog.py
.py
e9cf7bdab710674a
7.48
8
# ui/log_panel.py """右侧日志面板:实时显示 llama-server 输出日志""" import subprocess from datetime import datetime from textual.app import ComposeResult from textual.containers import Vertical, Horizontal from textual.widgets import Label, Button, RichLog class LogPanel(Vertical): """日志面板:显示 llama-server 的 stdout/stderr 输出"...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/ui/log_panel.py
.py
0ede52526cc23bfc
7.48
8
"""运行时监控面板:GPU/CPU/内存""" import logging import subprocess import threading from typing import Any import psutil from textual.app import ComposeResult from textual.containers import Horizontal from textual.widgets import Static logger = logging.getLogger(__name__) class MonitorPanel(Horizontal): """运行时监控面板""" ...
Narcissu-s1/llm-launcher
llm launcher_TUI原型/ui/widgets/monitor_panel.py
.py
00658168f2f62f3e
7.48
8
"""聊天面板 Markdown 渲染测试。""" import os import sys import pytest from PySide6.QtWidgets import QApplication sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @pytest.fixture(scope="session") def qt_app(): return QApplication.instance() or QApplication(sys.argv) @pytest.fixture def panel(qt_app, t...
Narcissu-s1/llm-launcher
tests/test_chat_panel.py
.py
a572e0c9347fedbb
7.98
8
# tests/test_config.py """ConfigStore 单元测试""" import os import sys import tempfile sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from core.config import ConfigStore def test_文件不存在时返回默认值(): """配置文件不存在时,load 应返回默认配置字典""" with tempfile.TemporaryDirectory() as tmp_dir: store = Confi...
Narcissu-s1/llm-launcher
tests/test_config.py
.py
35b95739b7daabb5
7.98
8
# tests/test_control_panel_io.py """ControlPanel 的导入/导出/模型专属预设 UI 测试 策略:mock QFileDialog 与 QMessageBox,避免打开真实对话框, 只验证 control_panel 的逻辑路径(数据流过 import_presets / export_presets)。 """ import json import os import sys import tempfile from unittest.mock import MagicMock, patch import pytest from PySide6.QtWidgets import ...
Narcissu-s1/llm-launcher
tests/test_control_panel_io.py
.py
c9e507c7eb5e4d5b
7.98
8
"""内置参数指南内容测试""" import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) def _guide_text() -> str: from ui.widgets.guide_panel import _SECTIONS parts = [] for title, rows in _SECTIONS: parts.append(title) for row in rows: parts.extend(row) ...
Narcissu-s1/llm-launcher
tests/test_guide_panel.py
.py
075bafb795bfc812
7.98
8
import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from unittest.mock import patch, MagicMock def test_GPU检测失败时不崩溃(): """nvidia-smi 不可用时 _collect 应返回不含 GPU 键的字典,不抛异常""" from ui.widgets.monitor_panel import _MonitorWorker worker = _MonitorWorker(lambda: None) with ...
Narcissu-s1/llm-launcher
tests/test_monitor.py
.py
24c58c3bb7643bbe
7.98
8
"""高级参数组 UI 测试""" import os import sys import pytest from PySide6.QtWidgets import QApplication sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @pytest.fixture(scope="session") def qt_app(): """确保 QApplication 实例存在""" return QApplication.instance() or QApplication(sys.argv) def test_采样参...
Narcissu-s1/llm-launcher
tests/test_param_groups.py
.py
56e845e6ccc0f7ea
7.98
8
"""Project configuration for anti-slop. Configuration lives in a project's ``pyproject.toml`` under the ``[tool.anti-slop]`` table (or a standalone ``anti-slop.toml``). The schema is intentionally small:: [tool.anti-slop] ignore = ["vendor/**", "generated/**"] [tool.anti-slop.rules."anti-slop/no-runtime-...
zaterka/anti-slop-python
anti_slop/config.py
.py
54a8c3e11090a10a
7.45
7
"""Core data types and the :class:`Rule` base class. Every anti-slop rule is a small, self-contained subclass of :class:`Rule` that receives a :class:`FileContext` (the parsed file plus per-rule options) and yields zero or more :class:`Violation` objects. Rules never talk to each other; the :class:`~anti_slop.engine.E...
zaterka/anti-slop-python
anti_slop/core.py
.py
98793511f3d8fd91
7.45
7
"""Engine: walk Python files, run the active rules, collect results. The engine is deliberately simple. It parses each file once, hands every active rule a :class:`~anti_slop.core.FileContext`, and gathers the violations. A rule that raises is contained (reported as a result error) so one buggy rule cannot take down a...
zaterka/anti-slop-python
anti_slop/engine.py
.py
8ad7999829c7bf50
7.45
7
"""``no-any-aliases``: ban named aliases that merely conceal ``Any``. Port of ``anti-slop/no-unknown-type-aliases``. An alias whose resolved type is ``Any`` hides the escape hatch from its consumers; ``Any`` must stay explicit at the parsing boundary. """ from __future__ import annotations import ast from anti_slop...
zaterka/anti-slop-python
anti_slop/rules/no_any_aliases.py
.py
fd773daff90e751e
7.45
7
"""``no-any-parameters``: ban explicit ``Any`` on function inputs. Port of ``anti-slop/no-unknown-parameters``. Function inputs must use a named domain type; ``Any`` inputs mean the function accepts unparsed data. (The JS rule's ``cause`` exemption is not ported: Python exception chaining is ``raise X from e``, not a ...
zaterka/anti-slop-python
anti_slop/rules/no_any_parameters.py
.py
a1137db4a299dbe0
7.45
7
"""``no-any-returns``: ban ``Any`` in function return contracts. Port of ``anti-slop/no-unknown-returns``. A function that returns ``Any`` pushes the parsing responsibility onto its callers. ``Any`` must stay at the I/O boundary, not in the contract. """ from __future__ import annotations import ast from anti_slop....
zaterka/anti-slop-python
anti_slop/rules/no_any_returns.py
.py
a5afbf43467da594
7.45
7
"""``no-async-without-await``: ban async functions that never await. Python-specific rule (no JS/TS counterpart). An ``async def`` that contains no ``await`` buys a coroutine wrapper and an event-loop dependency for nothing — it cannot yield to the loop, it just runs synchronously and hands back a future. Make it a pl...
zaterka/anti-slop-python
anti_slop/rules/no_async_without_await.py
.py
51b7698595768214
7.45
7
"""``no-blocking-sleep-in-async``: ban ``time.sleep`` inside async functions. Python-specific rule (no JS/TS counterpart — the JS equivalent is ``setTimeout`` misuse, which is framework-shaped). ``time.sleep`` blocks the thread, and in an async context that thread runs the event loop: every other coroutine stalls for ...
zaterka/anti-slop-python
anti_slop/rules/no_blocking_sleep_in_async.py
.py
f0e2d4ef1f012dc7
7.45
7
"""``no-chained-casts``: ban ``cast`` of ``cast``. Port of ``anti-slop/no-chained-type-assertions``. Every ``typing.cast`` fabricates evidence the type checker cannot verify; chaining one inside another compounds the fabrication. Exactly one violation is reported per chain (on the outermost cast). """ from __future__...
zaterka/anti-slop-python
anti_slop/rules/no_chained_casts.py
.py
8aec4d61c72e539b
7.45
7
"""``no-conditional-empty-dict-spread``: ban ``{**(cond and d or {})}``-style omission. Port of ``anti-slop/no-conditional-empty-object-spread``. A conditional spread whose branch is an empty dict hides key omission behind ``{}``; the omission should be explicit in the code flow instead. """ from __future__ import an...
zaterka/anti-slop-python
anti_slop/rules/no_conditional_empty_dict_spread.py
.py
e74aecc2fee2aefb
7.45
7
"""``no-dataclass-mutable-defaults``: ban mutable defaults on dataclass fields. Python-specific rule (no JS/TS counterpart). A ``@dataclass`` field with a mutable literal default (``items: list = []``) is a runtime ``ValueError`` at class-creation time — Python refuses the field because the default would be shared by ...
zaterka/anti-slop-python
anti_slop/rules/no_dataclass_mutable_defaults.py
.py
a7a94949d3ec222f
7.45
7
"""``no-debug-prints``: ban ``print`` calls outside the ``__main__`` guard. Python-specific rule (no JS/TS counterpart). ``print`` in application code is a debug artifact: it bypasses logging (no levels, no sinks, no timestamps) and shows up in places stdout is not the interface. Output belongs in a logger or the prog...
zaterka/anti-slop-python
anti_slop/rules/no_debug_prints.py
.py
b7341a978d207824
7.45
7
"""``no-dynamic-dispatch``: ban ``getattr(obj, name)(...)`` dynamic dispatch. Port of ``anti-slop/no-reflect-apply``. Calling a method looked up by a non-literal name bypasses typed function calls; model dynamic dispatch behind a named interface instead. (Dynamic *reads* are reported by ``no-dynamic-getattr``; this ru...
zaterka/anti-slop-python
anti_slop/rules/no_dynamic_dispatch.py
.py
be265dbebea9ea8c
7.45
7
"""``no-dynamic-getattr``: ban dynamic attribute access with a non-literal name. Port of ``anti-slop/no-reflect-get``. ``getattr(obj, dynamic_name)`` bypasses typed attribute access and the evidence it provides; read attributes directly (``obj.attr``) or parse dynamic input into a named domain type first. Python adap...
zaterka/anti-slop-python
anti_slop/rules/no_dynamic_getattr.py
.py
e3d2dae515018984
7.45
7
"""``no-eval-exec``: ban ``eval`` and ``exec``. Python-specific rule (no JS/TS counterpart — in JS the same smell is ``Function``/indirect ``eval``, rarely hand-written). Dynamic code execution defeats every static analysis that follows the value, opens injection attacks when the string is even partly external, and is...
zaterka/anti-slop-python
anti_slop/rules/no_eval_exec.py
.py
6b41a65ac969a6c4
7.45
7
"""``no-fstring-logging``: ban f-strings as logging message arguments. Python-specific rule (no JS/TS counterpart). ``logger.info(f"job {job_id} failed")`` builds the string eagerly, even when the log level would discard the record — wasted work on a hot path, and the classic tell of code written without reading the l...
zaterka/anti-slop-python
anti_slop/rules/no_fstring_logging.py
.py
aed92bf2a813217b
7.45
7
"""``no-module-mocking``: ban test-framework module/attribute mocking. Port of ``anti-slop/no-module-mocking``. ``mock.patch`` (and friends) and ``monkeypatch.setattr`` replace real dependencies with fakes behind the system's back; tests should replace dependencies through real interfaces — dependency injection, a ser...
zaterka/anti-slop-python
anti_slop/rules/no_module_mocking.py
.py
05e8129e7734b79b
7.45
7
"""``no-mutable-defaults``: ban mutable literal parameter defaults. Python-specific rule (no JS/TS counterpart). ``def f(items=[])`` evaluates the literal once, at function definition time, and every call that omits ``items`` shares that one list — the classic shared-state bug (state leaking between calls, and the tra...
zaterka/anti-slop-python
anti_slop/rules/no_mutable_defaults.py
.py
e0309724a52da3b1
7.45
7
"""``no-numbered-symbol-names``: reject numbered and throwaway-suffix names. Python-specific rule, **opt-in** (``default_enabled = False``): it is naming policy, not evidence, so it should be a deliberate choice. LLM-generated code reaches for ``data2``, ``result_final``, and ``temp3`` when it has not chosen a domain...
zaterka/anti-slop-python
anti_slop/rules/no_numbered_symbol_names.py
.py
554dccb7524d45bc
7.45
7
"""``no-object-parameters``: ban the broad ``object`` type on function inputs. Port of ``anti-slop/no-object-parameters``. Inputs must use an owner-provided type and be parsed at their boundary, not the top of the type hierarchy (Python's ``object`` plays the role the JS rule assigns to TS ``object``). Protocol exemp...
zaterka/anti-slop-python
anti_slop/rules/no_object_parameters.py
.py
1dffb8c8963324ea
7.45
7
"""``no-runtime-isinstance``: ban ad hoc ``isinstance`` narrowing. Port of ``anti-slop/no-runtime-typeof``. An ``isinstance`` check deep in the logic narrows a representation without establishing its contract; external values should be decoded into meaningful types at their I/O boundary. Python adaptations (``typeof`...
zaterka/anti-slop-python
anti_slop/rules/no_runtime_isinstance.py
.py
ea6d1f01c3142478
7.45
7
"""``no-shape-in-symbol-names``: reject "shape" in declared symbol names. Port of ``anti-slop/no-shape-in-symbol-names``, **opt-in in Python** (``default_enabled = False``). "Shape" is TypeScript naming vocabulary (``interface UserShape`` = the structure of an object); the JS rule polices a team convention exported as...
zaterka/anti-slop-python
anti_slop/rules/no_shape_in_symbol_names.py
.py
b2358bf361181239
7.45
7
"""``no-swallowed-exceptions``: ban handlers that swallow the exception. Python-specific rule (no JS/TS counterpart). An ``except`` handler whose body does nothing with the failure converts every error into silence; the program carries on believing nothing happened. "Does nothing" covers ``pass``, ``continue``, a bare...
zaterka/anti-slop-python
anti_slop/rules/no_swallowed_exceptions.py
.py
5248db244b11e4cf
7.45
7
"""``no-trivial-asserts``: ban assertions that can never fail. Python-specific rule (no JS/TS counterpart). ``assert True``, ``assert x is x``, ``self.assertEqual(a, a)`` — and their contradictory twins like ``assert x is not x`` — look like coverage but check nothing. Models under pressure pad test suites with exactl...
zaterka/anti-slop-python
anti_slop/rules/no_trivial_asserts.py
.py
0dab28e57ea1081e
7.45
7
"""``no-unsafe-dict-type``: ban dictionary value contracts without a real type. Port of ``anti-slop/no-unsafe-dictionary-type``. A ``dict[K, V]`` whose value type is ``Any``, ``object``, or a union containing one of those gives callers no concrete value contract. The outermost unsafe dictionary is reported once; neste...
zaterka/anti-slop-python
anti_slop/rules/no_unsafe_dict_type.py
.py
d8194f77b46c0f01
7.45
7
"""``no-utcnow``: ban ``datetime.utcnow``. Python-specific rule (no JS/TS counterpart). ``utcnow()`` was deprecated in Python 3.12: it returns a *naive* timestamp labeled as UTC, which breaks arithmetic with timezone-aware datetimes (``TypeError`` on subtraction) and is the most common model mistake around time. Use `...
zaterka/anti-slop-python
anti_slop/rules/no_utcnow.py
.py
8159671f04d863e5
7.45
7
"""Lightweight binding tracking for flow-sensitive rules. Python's AST has no scope tree, so these helpers approximate one: they collect the simple-name assignments made in a statement list (a function body or the module body) and record, per name, the initializing assignment and any later writes. A name with exactly ...
zaterka/anti-slop-python
anti_slop/shared/bindings.py
.py
2fd0cce9c99e1d3d
7.45
7
"""Iterate the *declared* symbol names of a module. The reference implementation flags every identifier reference, which is reasonable in TypeScript but noisy in Python (every attribute lookup and variable read is an identifier). The Python rule therefore reports declarations only: the one place a name is *chosen*. ""...
zaterka/anti-slop-python
anti_slop/shared/names.py
.py
4780bb6e39fb033c
7.45
7
"""Locate ``@typing.overload`` implementation functions. An overload set states its real contract in the stubs; the implementation that follows them is required to accept and return the *union* of every stub, which in practice is spelled ``Any``:: @overload def parse(raw: str) -> Document: ... @overload ...
zaterka/anti-slop-python
anti_slop/shared/overloads.py
.py
51cdf4a197eb79e6
7.45
7
"""Parent-link helpers. Python's :mod:`ast` does not link nodes to their parents, so rules that need to know the enclosing scope (a function, a statement, a type-parameter scope) build a parent map once per file and query it. """ from __future__ import annotations import ast from typing import Iterator __all__ = [ ...
zaterka/anti-slop-python
anti_slop/shared/parents.py
.py
c4c225398c5fc368
7.45
7
"""Helpers for inspecting Python type annotations in an AST. Python type hints are just expressions, so these helpers answer the questions the rules need: *what name does this annotation refer to, does it (through a local alias) resolve to ``Any`` or ``object``, is it a union, and what is the value type of a ``dict[.....
zaterka/anti-slop-python
anti_slop/shared/type_utils.py
.py
4452b02553e61fb9
7.45
7
"""Inline suppression comments. Opinionated rules need an escape hatch that is cheaper than switching the rule off for the whole project. A suppression comment marks one line, or one file, as a deliberate exception:: value = eval(expression) # anti-slop: ignore[no-eval-exec] sandboxed input print(banner) ...
zaterka/anti-slop-python
anti_slop/suppressions.py
.py
4054cd613ae7423c
7.45
7
#!/usr/bin/env python3 """Install the anti-slop package into a target repository. Usage:: python install.py [--repo PATH] [--dest RELPATH] [--force] [--no-validate] Steps: 1. Copy the ``anti_slop`` package next to this skill's repository root into ``<repo>/<dest>`` (default ``tools/anti_slop``). 2. Ensure a `...
zaterka/anti-slop-python
skills/install-anti-slop/scripts/install.py
.py
02cb8b723e4bec3d
7.45
7
"""Deliberately sloppy sample code. Not a test module and not imported by one: this file exists so CI can point the action at something with known findings and assert that it annotates them. It is excluded from the self-lint in pyproject.toml for that reason. """ from typing import Any def handle(payload: Any) -> A...
zaterka/anti-slop-python
tests/fixtures/sloppy_sample.py
.py
db7505f8ff90bd6d
7.45
7
"""A minimal RuleTester, mirroring the oxlint RuleTester the JS project uses. Each rule's test file looks like:: from anti_slop.rules.no_object_parameters import NoObjectParametersRule from tests.harness import RuleTester def test_no_object_parameters() -> None: RuleTester(NoObjectParametersRule(...
zaterka/anti-slop-python
tests/harness.py
.py
874d4ac867e8cd82
7.95
7
"""Tests for configuration and rule enablement. Pins the opt-in mechanism: rules with ``default_enabled = False`` are inactive unless the configuration explicitly enables them, and ``Config.is_enabled`` falls back to the caller-supplied default when the rule is not mentioned. """ from anti_slop.config import Config f...
zaterka/anti-slop-python
tests/test_config.py
.py
0be1763f4b7412f0
7.95
7
"""add users table and repository owner Revision ID: 0002_users_and_repo_owner Revises: 0001_initial Create Date: 2026-07-11 The revision id is kept under 32 characters because Alembic's default alembic_version.version_num column is VARCHAR(32), which PostgreSQL enforces. """ from datetime import UTC, datetime from...
Second-Origin/PARTHA
apps/backend/alembic/versions/0002_users_and_repo_owner.py
.py
d78d647afb61a5a9
7.5
9
"""add password hash and refresh tokens Revision ID: 0003_auth_credentials Revises: 0002_users_and_repo_owner Create Date: 2026-07-11 Revision ids stay under 32 characters: alembic_version.version_num is VARCHAR(32) and PostgreSQL enforces it. """ from alembic import op import sqlalchemy as sa revision = "0003_auth...
Second-Origin/PARTHA
apps/backend/alembic/versions/0003_auth_credentials.py
.py
9e18de2b069f9279
7.5
9
"""add per-user encrypted ai provider configs Revision ID: 0004_ai_provider_configs Revises: 0003_auth_credentials Create Date: 2026-07-15 Revision ids stay under 32 characters: alembic_version.version_num is VARCHAR(32) and PostgreSQL enforces it. Replaces the single global ``ai-provider.json`` file with a per-user...
Second-Origin/PARTHA
apps/backend/alembic/versions/0004_ai_provider_configs.py
.py
8c460a21b393fac0
7.5
9
"""remove the always-"real" data_source placeholder column Revision ID: 0007_remove_data_source Revises: 0006_analysis_jobs Create Date: 2026-07-25 ``data_source`` was written as the literal "real" on every repository, never derived from any actual distinction (#96). Downgrade restores the column with its original se...
Second-Origin/PARTHA
apps/backend/alembic/versions/0007_remove_data_source.py
.py
1f2be4cd09ff5030
7.5
9
"""add directional snapshot-edge indexes for impact traversal Revision ID: 0008_impact_query_edge_indexes Revises: 0007_remove_data_source Create Date: 2026-07-28 The sealed-snapshot impact query filters resolved edges by snapshot, one endpoint direction, and predicate. These complementary composite indexes keep both...
Second-Origin/PARTHA
apps/backend/alembic/versions/0008_impact_query_edge_indexes.py
.py
af5c7da30c3d98c5
7.5
9
"""add account-deletion cascades and audit trail Revision ID: 0010_account_deletion Revises: 0009_ai_conversation_messages Create Date: 2026-08-13 Issue #290: verified account deletion. Several owner foreign keys did not declare database-level cascade deletion, so deleting a ``users`` row would raise a foreign-key vi...
Second-Origin/PARTHA
apps/backend/alembic/versions/0010_account_deletion.py
.py
38225831c555d0ed
7.5
9
"""add waitlist_entries for the public landing-page waitlist Revision ID: 0012_waitlist_entries Revises: 0011_invite_tokens Create Date: 2026-08-23 Issue #334: the public landing page collects email/name signups for the owner to review and invite manually, rather than open self-serve registration. Deliberately not an...
Second-Origin/PARTHA
apps/backend/alembic/versions/0012_waitlist_entries.py
.py
d9e88374105eea8d
7.5
9
"""Owner-scoped, encrypted-at-rest storage for AI provider configuration. Every read and write is scoped to a single ``owner_id``, so one user can never observe or spend another user's provider key (E1.5 / #65, and the credential half of the ``ai/*`` scoping in #63). API keys are encrypted with :class:`ProviderKeyCiph...
Second-Origin/PARTHA
apps/backend/app/ai/providers/config_store.py
.py
8d400eb338fe29b5
7.5
9
"""Pinned HTTP sender shared by every AI provider implementation.""" from __future__ import annotations from typing import Protocol import anyio import httpx from app.core.ai_egress import DestinationPolicyError, ProviderEgressPolicy from app.ai.types import AiProviderConfig from app.core.exceptions import External...
Second-Origin/PARTHA
apps/backend/app/ai/providers/http.py
.py
4f37b46814ca08df
7.5
9
"""Evidence-backed authentication explanation (#95). Reads exclusively through :class:`SnapshotQueryService`: no filesystem read, no working-tree fallback, no legacy ``repo_metadata['intelligence']`` read, and no second parser or consumer-specific fact store. Every displayed claim resolves to a real evidence span stor...
Second-Origin/PARTHA
apps/backend/app/analysis/authentication.py
.py
c6644bcd1d415425
7.5
9
"""Build and verify revision manifests from sealed snapshots (#113).""" from app.intelligence.canonical import canonical_json_bytes, sha256_prefixed from app.intelligence.query_service import SnapshotQueryService from app.models.snapshot import RiSnapshot from app.schemas.manifest import ( VERIFICATION_METHOD, ...
Second-Origin/PARTHA
apps/backend/app/analysis/manifest.py
.py
71fb9eb33327940a
7.5
9
"""Fail-closed resource budgets for one repository analysis run.""" from __future__ import annotations import ctypes import importlib import mmap import sys import time from collections.abc import Callable from dataclasses import dataclass, field from pathlib import Path RESOURCE_EXCEEDED_CODE = "resource_exceeded"...
Second-Origin/PARTHA
apps/backend/app/analysis/resource_budget.py
.py
8d7016177cef2af8
7.5
9
"""Deterministic, symlink-safe streaming of a stored repository manifest.""" from __future__ import annotations import os import stat from collections.abc import Callable, Iterator, Mapping, Sequence from pathlib import Path, PurePosixPath from app.analysis.resource_budget import AnalysisResourceBudget from app.inte...
Second-Origin/PARTHA
apps/backend/app/analysis/source_stream.py
.py
de31fec7d6e4ffd4
7.5
9
"""Reusable OpenAPI response metadata. The API has one runtime error envelope, :class:`ErrorResponse`. Route modules use the helpers in this module to publish that fact consistently without changing how requests are handled or how responses are serialised. """ from collections.abc import Mapping from typing import A...
Second-Origin/PARTHA
apps/backend/app/api/openapi.py
.py
66a65fc866180e12
7.5
9
"""Example demonstrating agent evaluation with Phoenix observability.""" import os import asyncio from typing import List # Set up Phoenix before importing miiflow-agent os.environ["PHOENIX_ENABLED"] = "true" os.environ["PHOENIX_ENDPOINT"] = "http://localhost:6006" os.environ["STRUCTURED_LOGGING"] = "true" # Import ...
MiiFlow/miiflow-agent
examples/agent_evaluation_example.py
.py
5631461410564b53
7.64
18
"""Basic chat completion example. This example demonstrates the simplest usage of miiflow-agent: - Creating a client for any provider - Sending messages and getting responses - Handling both sync and async patterns """ import asyncio from miiflow_agent import LLMClient, Message def sync_example(): """Synchronou...
MiiFlow/miiflow-agent
examples/basic_chat.py
.py
abab6d34ae84a779
7.64
18
"""Context Injection example (Pydantic AI style). This example demonstrates dependency injection for tools: - Defining typed context with dataclasses - Injecting context into tools via RunContext - Using deps_type for type-safe context access """ import asyncio from dataclasses import dataclass, field from typing imp...
MiiFlow/miiflow-agent
examples/context_injection.py
.py
640f387ad0a454a8
7.64
18
"""Example demonstrating Phoenix observability with miiflow-agent.""" import os import asyncio from typing import List # Set up Phoenix before importing miiflow-agent os.environ["PHOENIX_ENABLED"] = "true" os.environ["PHOENIX_ENDPOINT"] = "http://localhost:6006" os.environ["STRUCTURED_LOGGING"] = "true" # Import mii...
MiiFlow/miiflow-agent
examples/observability_example.py
.py
6b593b665a919d31
7.64
18
"""ReAct Agent example. This example demonstrates the ReAct (Reasoning + Acting) pattern: 1. Basic usage - Creating an agent with tools 2. Streaming - Real-time event streaming """ import asyncio import math from miiflow_agent import LLMClient, Agent, AgentType, RunContext, tool from miiflow_agent.core.react import ...
MiiFlow/miiflow-agent
examples/react_agent.py
.py
9027b7c26e2c3487
7.64
18
"""Yahoo Finance tools for fetching stock market data. These tools use the yfinance library to fetch real-time and historical stock data. No API key is required. Install: pip install yfinance """ from typing import Optional from miiflow_agent.core.tools import tool @tool("get_stock_quote", "Get real-time stock quo...
MiiFlow/miiflow-agent
examples/tools/finance.py
.py
0f953f0433e2ce88
7.64
18
""" Type definitions for the artifact system. An artifact is an opaque file (PDF, HTML doc, etc.) produced by a tool and persisted for download + side-panel viewing. Unlike MediaResult or VisualizationResult (which are inline display payloads), artifacts have real size, are uploaded to object storage by the streaming ...
MiiFlow/miiflow-agent
miiflow_agent/artifacts/types.py
.py
7dc3b29a3914462c
7.64
18
"""Context variable management for callback context. This module provides a way to pass context (like organization_id, agent_node_run_id) through LLM calls to callbacks without changing method signatures. Usage: from miiflow_agent import CallbackContext, callback_context ctx = CallbackContext( organi...
MiiFlow/miiflow-agent
miiflow_agent/core/callback_context.py
.py
99d466d8e4a0c23f
7.64
18
"""AgentConfig — a single dataclass that captures everything you need to construct an `Agent`, including `sub_agents`. This is the **canonical** way to construct an Agent going forward. The legacy `Agent(client, tools=..., agent_type=..., ...)` kwargs constructor still works (and internally builds an AgentConfig), but...
MiiFlow/miiflow-agent
miiflow_agent/core/config.py
.py
a2ad614211101dbc
7.64
18
"""Context-window budgets, resolved from the model registry. The compressor previously hard-coded ``max_context_tokens or 128000``. That default is wrong for essentially every model this package actually runs: Claude is 200K–1M, GPT-5 is 400K, Gemini is 1M–2M. On a 1M-token model it means compaction fires at 96K — sum...
MiiFlow/miiflow-agent
miiflow_agent/core/context/budget.py
.py
868466af4c8d1367
7.64
18
"""Engine selection by name. This is the seam that makes the engine swappable per assistant rather than per deployment. A host application resolves a config value — ``context.engine`` — to a constructor here, so shipping a second policy (server-side compaction on providers that offer it, a retrieval-backed engine, a n...
MiiFlow/miiflow-agent
miiflow_agent/core/context/registry.py
.py
f6cfc48356f0fe04
7.64
18
"""The shape of a request, as the context engine sees it. The defect this type exists to fix: ``ContextCompressor.compress_if_needed()`` took only ``messages``. It never saw the system prompt or the tool schemas, so it was blind to the two largest and *least* compressible parts of the request. On a tool-heavy assista...
MiiFlow/miiflow-agent
miiflow_agent/core/context/shape.py
.py
a399d04052681e9a
7.64
18
"""Self-calibrating correction factor for local token estimates. Local estimation is cheap but approximate. Every provider response, however, reports the *real* prompt token count it billed. That number is ground truth for everything we sent, and it costs nothing extra to read. This module closes the loop: after each...
MiiFlow/miiflow-agent
miiflow_agent/core/context/tokens/calibration.py
.py
2eee59df47bb5e94
7.64
18
"""Session-scoped data reference cache for render tools. When data tools (e.g. google_ads_query, meta_ads_insights) return large result sets, the LLM has to re-emit the data inline whenever it wants to render it — `render_table(rows=[...several hundred rows...])`. At realistic dataset sizes this blows the model's max_...
MiiFlow/miiflow-agent
miiflow_agent/core/data_reference.py
.py
5dd83e2dad28a6e6
7.64
18
"""Message handling and format conversion for different providers.""" import mimetypes import urllib.parse from dataclasses import dataclass, field from datetime import datetime from enum import Enum from pathlib import Path from typing import Any, Dict, List, Literal, Optional, Union class MessageRole(Enum): ""...
MiiFlow/miiflow-agent
miiflow_agent/core/message.py
.py
e3ceb0ab21c70dd5
7.64
18
"""Trace context management for observability.""" import contextvars from dataclasses import dataclass, field from typing import Optional, Dict, Any from uuid import uuid4 @dataclass class TraceContext: """Context for trace information.""" trace_id: str = field(default_factory=lambda: str(uuid4())) span...
MiiFlow/miiflow-agent
miiflow_agent/core/observability/context.py
.py
e711c6737041ba89
7.64
18
"""Simplified structured logging with trace correlation.""" import logging import sys import structlog from typing import Any, Dict, Optional from contextvars import ContextVar from .config import ObservabilityConfig from .context import get_current_trace_context # Context variable for additional logging context _l...
MiiFlow/miiflow-agent
miiflow_agent/core/observability/logging.py
.py
105684f3910d58db
7.64
18
"""Canonical tool-observation port — one stored record per tool execution. The orchestrator invokes an adapter-supplied ``ObservationSink`` at the moment a tool observation is finalized (serial step, parallel batch, deterministic approval-resume). The sink persists the observation once and returns an opaque ``ref``; e...
MiiFlow/miiflow-agent
miiflow_agent/core/observation.py
.py
8106e2048ea73c83
7.64
18
"""File-backed reference implementation of the ObservationSink port. Standalone deployments (no adapter sink wired) previously had exactly one behavior for an oversized tool output: truncate it and tell the model to re-run the tool with a narrower scope — the omitted data was gone. This sink gives them the same spill-...
MiiFlow/miiflow-agent
miiflow_agent/core/observation_local.py
.py
5c93e8c2963f30a6
7.64
18
"""Rate-limit-adaptive concurrency for parallel tool batches. The parallel batch path used a fixed Semaphore(8). When a branch hits a provider rate limit — the dominant case being a wide ``dispatch_assistant`` fan-out where every branch is a full sub-agent making LLM calls — launching the remaining branches at full wi...
MiiFlow/miiflow-agent
miiflow_agent/core/react/adaptive_concurrency.py
.py
81b34a20200c29a2
7.64
18
"""Turning a finished (or halted) run into what the caller receives. Owns the terminal paths of a ReAct run: publishing the closing final-answer event, building the success/crash results, the one tool-free wrap-up turn after a safety halt (_answer_after_halt — report the work in hand instead of discarding it), and the...
MiiFlow/miiflow-agent
miiflow_agent/core/react/answer_synthesis.py
.py
1fd02aeefdbda929
7.64
18
"""Council Governance Router -- flight 008. Takes the stabilized 10-seed council manifold from loop 007 and routes probe inputs to ALLOW / QUARANTINE / ESCALATE / DENY using nearest-seed distance in the mixed metric, cutover-flag policy, Pi_exchange, and z-vector scrutiny. This is a STANDALONE sim. It does not touch ...
issdandavis/SCBE-AETHERMOORE
.scbe/grounding/council_router.py
.py
935f412a184d35d8
7.42
6
""" Agent Bus browser backends — three swappable modes. Modes (industry-standard names per 2026 SOTA review): - "headless": raw PlaywrightRuntime, fastest, no governance - "headed": SCBEBrowserAgent — visible browser, every action goes through the SCBE governance pipeline (ALLOW/QUARANTINE/ESCALA...
issdandavis/SCBE-AETHERMOORE
agents/agent_bus_browser.py
.py
a782038f87beb88c
7.42
6
""" Agent Bus cost metering + budget enforcement. Closes the "cost tracking" gap from AGENT_BUS_NOTES.md: every LLM call is priced in USD-equivalent from per-provider token rates, accumulated on a session meter, and the `--budget` CLI flag becomes a hard gate instead of advisory. The bus's default providers (Ollama lo...
issdandavis/SCBE-AETHERMOORE
agents/agent_bus_cost.py
.py
10bdbf38ca815a0c
7.42
6
""" Agent Bus → HYDRA Ledger bridge. Every BusEvent gets two persistence paths: 1. Local JSONL (artifacts/agent-bus/events.jsonl) — fast, lossy-on-disk-corruption 2. HYDRA central ledger (SQLite) — cross-session, queryable, signed at write time If the HYDRA ledger isn't available in this deployment, the bridge si...
issdandavis/SCBE-AETHERMOORE
agents/agent_bus_ledger.py
.py
ee5fbd2f346398a4
7.42
6
""" Agent Bus event schema versioning + validation. Every event written to events.jsonl carries a `_schema_version` field. This module defines the current version, the migration table, and a validator that the reader (or a verify CLI) can use to reject events from unsupported future versions. Versioning rule (semver-...
issdandavis/SCBE-AETHERMOORE
agents/agent_bus_schema.py
.py
f74a53693b850c4c
7.42
6
""" Agent Bus team coordination — wraps existing HYDRA / SwarmBrowser systems. The bus is the spinal cord; this module is the reflex that asks the team "should we do this?" before executing high-stakes actions. Two patterns: 1. Roundtable consensus (Byzantine-safe): six Sacred Tongue agents vote. Requires 4/6 ...
issdandavis/SCBE-AETHERMOORE
agents/agent_bus_team.py
.py
78885e52cb9bedb7
7.42
6
""" Agent Bus self-training — perf-triggered fine-tunes. The bus continually appends signed BusEvent records to artifacts/agent-bus/events.jsonl. This module reads that ledger, computes a rolling performance score, and when the score drops below a threshold, kicks off a training run via existing scripts: - Failure ...
issdandavis/SCBE-AETHERMOORE
agents/agent_bus_training.py
.py
e770992e01f85f77
7.42
6
""" @file phdm_brain.py @module agents/browser/phdm_brain @layer Layer 5, Layer 12, Layer 13 @component SimplePHDM Brain for Browser Agent @version 1.0.0 Geometrically-contained decision making using Poincare ball model. Actions are only permitted if their embeddings fall within the safe radius. """ from __future__ i...
issdandavis/SCBE-AETHERMOORE
agents/browser/phdm_brain.py
.py
f7a39441680575cd
7.42
6
""" @file playwright_wrapper.py @module agents/browser/playwright_wrapper @layer Layer 13, Layer 14 @component Browser Control with Timeout Safety @version 1.0.0 Safe browser automation wrapper using Playwright with built-in timeouts and action logging for governance auditing. """ from __future__ import annotations ...
issdandavis/SCBE-AETHERMOORE
agents/browser/playwright_wrapper.py
.py
ab308426bc94f9e1
7.42
6
""" @file vision_embedding.py @module agents/browser/vision_embedding @layer Layer 4, Layer 5 @component CLIP to Poincare Projection @version 1.0.0 Converts visual observations to Poincare ball embeddings for geometric containment. Uses CLIP for vision encoding, then projects to hyperbolic space. """ from __future__ ...
issdandavis/SCBE-AETHERMOORE
agents/browser/vision_embedding.py
.py
2c471b0f25c702d5
7.42
6
#!/usr/bin/env python3 ''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code con...
ROCm/cvs
build_tools/gen_anc_suites.py
.py
52a6d55bdfc0e928
7.63
17
class SubcommandPlugin: """Base class for CLI subcommand plugins.""" PLUGIN_ORDERS = { "monitor": 999, "exec": 1000, # High number to ensure exec appears last } def get_name(self): raise NotImplementedError def get_parser(self, subparsers): """Register subcommand ...
ROCm/cvs
cvs/cli_plugins/base.py
.py
56a07e6605398872
7.63
17
from .base import SubcommandPlugin import argparse import sys import os import pkgutil import importlib from abc import ABC, abstractmethod class GeneratorPlugin(ABC): """Base class for all generator plugins""" @abstractmethod def get_name(self): """Return the name of this generator""" pa...
ROCm/cvs
cvs/cli_plugins/generate_plugin.py
.py
82dd8e2640cd7dd2
7.63
17
import os import sys import importlib.resources as resources import re import pytest from io import StringIO import contextlib from .base import SubcommandPlugin from cvs.extension import ExtensionConfig, CORE_PKG_NAME, CORE_TESTS_DIR class ListPlugin(SubcommandPlugin): @staticmethod def discover_tests(): ...
ROCm/cvs
cvs/cli_plugins/list_plugin.py
.py
735164072ebe971b
7.63
17
import pytest import sys import os import json from cvs.core.run_layout import RunLayout from .list_plugin import ListPlugin # Legacy preflight pytest entry points — resolved at CLI time only so full-module # collection does not register duplicate tests (same function object, two names). LEGACY_PREFLIGHT_TEST_ALIASE...
ROCm/cvs
cvs/cli_plugins/run_plugin.py
.py
77298fb90c61f4fe
7.63
17