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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
"""Build a self-contained STATIC demo of the training-similarity viewer.
The live viewer (``app/``) is served from a web root and references every file
with a leading ``/`` (``/systems.json``, ``/app.js``, ``/systems/<id>/...``).
The per-system PDB/CIF data (~188 MB across 94 dirs, 47 in the man... | rafwiewiora/foldarium | benchmark/prep/build_static_demo.py | .py | a5a77f066a31fec0 | 7 | 0 |
"""Select N viewer systems from the CAMEO 1-month AF3 dump.
Picks drug-like protein-ligand targets, verifies each crystal is RELEASED on RCSB
and actually contains the ligand HET, copies the 5 AF3 model CIFs into
verdict/data/poses/<ID>/, downloads the pristine crystal to systems/<ID>/xtal.cif,
and writes systems.json... | rafwiewiora/foldarium | benchmark/prep/build_systems.py | .py | 196b67bb8fb8d2a6 | 7 | 0 |
"""Add the physics-cutoff verdict to each viewer system in systems.json.
Rule (v1): mindist_min = min over the 5 poses of the closest heavy-atom distance between the
predicted ligand and AF3's OWN model protein. method_fail (flag as untrustworthy) if mindist_min
< 2.1 Å (poses jam sub-vdW into the protein). Computed f... | rafwiewiora/foldarium | benchmark/prep/compute_method.py | .py | 4759a0be32788ed6 | 7 | 0 |
"""Patch mislabeled targets in systems.json (caffeine TEP -> screening fragment).
For each system, re-read its CAMEO m3 ligand_pose.json across all models and apply
the corrected target-selection rule:
- candidate ligands = those passing build_systems.drug_like(het, atom_count) AND
having >=1 non-null rmsd.
- ... | rafwiewiora/foldarium | benchmark/prep/patch_targets.py | .py | f5031310ca7abadb | 7 | 0 |
"""QA gate over all systems: verify the DISPLAYED entities are geometrically consistent.
Checks the files the viewer actually loads (xtal_1copy.pdb, train_ligand[_disp].pdb, pose-*.pdb):
1. xtal_1copy contains exactly ONE ligand residue (the target HET), no lipids/ions -> declutter.
2. every CORRECT pose (rmsd<2)... | rafwiewiora/foldarium | benchmark/prep/qa_display.py | .py | 6c6ec6a18e2581e9 | 7 | 0 |
"""Execution and storage seams implemented by local or remote backends."""
from __future__ import annotations
from pathlib import Path
from typing import Any, Mapping, Protocol
class ExecutionBackend(Protocol):
def submit(self, task: Mapping[str, Any]) -> str:
"""Submit one normalized task and return th... | rafwiewiora/foldarium | pipeline/src/foldarium_pipeline/execution.py | .py | fcc88174a1a1a746 | 7 | 0 |
"""
Cryptocurrency analysis module.
Specialized analysis for cryptocurrencies including volatility, market metrics, and DeFi data.
"""
from typing import Dict, List, Optional, Tuple, Union
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import logging
from data.cache import cache_resul... | daakara/finance | analysis/crypto.py | .py | efbe995df8834d70 | 7 | 0 |
"""
ETF (Exchange-Traded Fund) analysis module.
Specialized analysis for ETFs including sector allocation, holdings, and performance metrics.
"""
from typing import Dict, List, Optional, Tuple, Union
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import logging
from data.cache import ... | daakara/finance | analysis/etf.py | .py | cdef7d9dfd996829 | 7 | 0 |
"""Multi-Factor Confluence & Dynamic Position Sizing Engine.
Fuses Technical Setups (VCP/ATR), Regulatory Filings (SEC Form 4 / Capitol Hill),
Fundamental Moats (ROIC / PEG), and Catalyst Risk Runways into a unified Confluence Score.
"""
from typing import Dict, Any, Optional
import math
class ConfluenceEngine:
... | daakara/finance | analyst_dashboard/analyzers/confluence_engine.py | .py | 94d8e5e4fc5faf32 | 7 | 0 |
"""
Financial Metrics Analyzer - Handles fundamental analysis calculations
Focused on financial ratios, valuation metrics, and company fundamentals
"""
import pandas as pd
import streamlit as st
import logging
from typing import Dict, List, Optional, Union, Any
logger = logging.getLogger(__name__)
class FinancialMet... | daakara/finance | analyst_dashboard/analyzers/financial_analyzer.py | .py | d0d0746175c853f9 | 7 | 0 |
"""
Market Regime Detection and Analysis
Identify market conditions and adapt analysis accordingly
"""
import pandas as pd
import numpy as np
from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import StandardScaler
import logging
from typing import Dict, List, Optional, Tuple, Any
logger = logging... | daakara/finance | analyst_dashboard/analyzers/market_regime_analyzer.py | .py | acac224f05704408 | 7 | 0 |
"""Optimal Entry & Exit Execution Engine based on Minervini VCP, Turtle ATR, Raschke 20 EMA & Institutional Volume Profile."""
import math
from typing import Dict, Any, List, Optional
try:
import pandas as pd
import numpy as np
except ImportError:
pd = None
np = None
class OptimalExecutionEngine:
... | daakara/finance | analyst_dashboard/analyzers/optimal_execution.py | .py | aff914c7de829f03 | 7 | 0 |
"""
Asset Data Manager - Handles data fetching and processing for different asset types
Focused on data acquisition, validation, and preparation
"""
import logging
from typing import Dict, List, Optional, Union, Any
import pandas as pd
logger = logging.getLogger(__name__)
class AssetDataManager:
"""Manages data ... | daakara/finance | analyst_dashboard/core/asset_data_manager.py | .py | 3f4d6c09f5b853e6 | 7 | 0 |
"""
Analyst Dashboard Core Manager - Handles application setup and coordination
Focused on dashboard initialization, configuration, and state management
"""
import streamlit as st
import logging
from typing import Dict, List, Optional, Union, Any
from datetime import datetime
from analyst_dashboard.workflows.single_a... | daakara/finance | analyst_dashboard/core/dashboard_manager.py | .py | 0ae81ddf4995d85a | 7 | 0 |
"""Database Schema & Persistence Engine for Historical Analytics & Quality Drift Monitoring."""
import sqlite3
import os
import json
import logging
from datetime import datetime
from typing import Dict, Any, List, Optional
logger = logging.getLogger(__name__)
DB_PATH = os.path.join(os.path.expanduser("~"), ".finance... | daakara/finance | analyst_dashboard/data/db_engine.py | .py | c76d609dd6e0bca9 | 7 | 0 |
"""FRED (Federal Reserve Economic Data) API Fetcher & Macroeconomic Analysis Module."""
import os
import logging
import requests
from typing import Dict, Any, Optional
logger = logging.getLogger(__name__)
DEFAULT_FRED_API_KEY = os.getenv("FRED_API_KEY", "70089dccee2c5a687260428851534996")
class FredMacroFetcher:
... | daakara/finance | analyst_dashboard/data/fred_fetcher.py | .py | 83058ded8b6ff3b2 | 7 | 0 |
"""Persistent SQLite Database Engine for Market Data, Historical OHLCV, Factors & Catalysts."""
import sqlite3
import os
import json
import logging
from datetime import datetime, timedelta
from typing import Dict, Any, List, Optional, Union
try:
import pandas as pd
except ImportError:
pd = None
logger = logg... | daakara/finance | analyst_dashboard/data/market_db.py | .py | 3e37910e70ed7f55 | 7 | 0 |
"""
Metrics Display Manager - Handles formatting and display of financial metrics
Focused on clean presentation of financial data and ratios
"""
import streamlit as st
import pandas as pd
import logging
from typing import Dict, List, Optional, Union, Any
logger = logging.getLogger(__name__)
class MetricsDisplayManag... | daakara/finance | analyst_dashboard/visualizers/metrics_display.py | .py | e7142778d7e685f9 | 7 | 0 |
"""On-system quick reference: keybinds and important file locations.
The installer renders a plain-text reference from the exact keybind source
that gets installed (``~/.config/hypr/conf/keybinds.lua``) and from the paths
the installer itself manages. The rendered text is installed to
``~/.config/arch-wm/help.txt`` an... | grapes7000/Arch-WM-install | installer/help.py | .py | e053781c5cdea4f8 | 7 | 0 |
from __future__ import annotations
import json
import os
import tempfile
PROFILE_PATH = os.path.join(os.path.expanduser("~"), ".config", "theme-engine", "starship.json")
# Nerd Font glyphs above U+FFFF need a surrogate pair once encoded to UTF-16.
# Something in the editing pipeline this file has passed through mang... | grapes7000/Arch-WM-install | modules/theme-engine/bin/theme_starship.py | .py | 586cda444c5c3a34 | 7 | 0 |
"""Regression tests for Theme Studio's live preview, Lua renderer, and schema.
Run with: PYTHONPATH=bin python -m unittest discover -s tests -p 'test_theme_studio.py' -v
The suite is hermetic: it redirects HOME/XDG_CONFIG_HOME to a temporary
directory before importing the theme modules, and disables Hyprland reloads... | grapes7000/Arch-WM-install | modules/theme-engine/tests/test_theme_studio.py | .py | 85b502192964f755 | 7.5 | 0 |
"""Semantic wallpaper renders must publish stable, retargeting symlinks."""
from __future__ import annotations
import sys
import tempfile
import types
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "modules/theme-engine/bin"))
# theme_runtime's compo... | grapes7000/Arch-WM-install | tests/test_theme_runtime_wallpaper_links.py | .py | 76aa13360a1a5e50 | 7.5 | 0 |
"""Assemble the causal-primary panel (reviewer fix: make the deployable, causal-covariate
configuration the main-text result rather than the perfect-foresight one).
Tiers and their causal source:
seasonal_naive, chronos (univariate), nas_gru_s* (past-only context => already causal)
<- canonical_preds / canonic... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | analysis/build_causal_primary.py | .py | cb6325ccedc4a52c | 7 | 0 |
"""Reviewer-requested equivalence analysis (added 2026-07-15, post-hoc, logged in the
deviations record).
A non-significant sign/Wilcoxon test is not evidence of equivalence. For each "tie" claim
in the manuscript we therefore report the paired per-city (or per-fraction) MASE difference,
a bootstrap 95% CI, and a two-... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | analysis/equivalence_tests.py | .py | 09fe86be464201a5 | 7.5 | 0 |
"""Figure 2 — per-city FM advantage (specialist − foundation model MASE), both domains.
Panel a: PM2.5 under the CAUSAL-primary configuration (matches Table 1; supervisor
review B9 — the old panel used the perfect-foresight panel, contradicting the
main-result config). Sign test P = 0.024 favouring the FM (21/29), Wil... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | figures/fig2_advantage.py | .py | ff894b8a5a3a62fa | 7 | 0 |
"""Figure 3 (money figure) — perfect-foresight covariate ablation.
Paired slopegraph per domain: LightGBM MASE with a perfect weather forecast (left)
vs causal last-known covariates (right); per-city thin slopes, bold mean slope,
Chronos zero-shot panel mean as a horizontal reference band.
Asserts the recomputed means... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | figures/fig3_foresight.py | .py | 95e79ede13c6db66 | 7 | 0 |
"""Figure 5 — E4 crux: transfer learning vs zero-shot across fine-tune budgets.
x = nominal fine-tune fraction (categorical 0/1/10/100%), y = MASE (mean across
15 scarce cities). NAS-GRU transfer: mean with band = ±sd across cities of the
per-city seed-means. LightGBM refit: dashed. Chronos zero-shot: horizontal
refer... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | figures/fig5_e4.py | .py | 45b0ea95ef0484cb | 7 | 0 |
"""
House style for journal-quality matplotlib figures.
from house_style import apply_house_style, figsize, save_figure
from palettes import ACTIVE_ROLES
apply_house_style(journal="lancet")
apply_house_style does three things:
1. Sets fonts, sizes, spines, ticks, legend, savefig DPI.
2. Sets the color... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | figures/house_style.py | .py | 5827595a6c9a7625 | 7 | 0 |
"""
Statistical sanity checks. Run these BEFORE writing a metric into a
manuscript table. Many "mediocre" tables are mediocre because they
quietly report an implausible value.
Each check raises a clear error rather than returning False.
"""
from __future__ import annotations
from typing import Optional
import math
... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | figures/sanity_checks.py | .py | 58893bb11751b4d7 | 7 | 0 |
#!/usr/bin/env python3
"""What may never reach a public artifact (GitHub `main`, the Zenodo deposit, any
future publish channel), and what must be redacted in what does.
This module is policy, not a build script. Every script that assembles a public-facing
artifact -- today `make_zenodo_pack.py` and `make_public_relea... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | paper/latex/confidentiality.py | .py | da881e9d60b5bc85 | 7 | 0 |
#!/usr/bin/env python3
r"""Assemble SUBMISSION/ -- a FLAT, self-contained folder the supervisor can zip and hand
to the journal, where manuscript.tex compiles with pdflatex alone.
Consumes the already-flattened MANUSCRIPT/manuscript.tex (make_submission.py owns the
\input expansion and the bibliography embedding; this... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | paper/latex/make_flat_submission.py | .py | 7ae37bdc2dfcae8e | 7 | 0 |
#!/usr/bin/env python
"""Build the marked-up ("tracked changes") copy for the Scientific Reports revision.
Scientific Reports forbids tracked changes inside the manuscript file itself, so the
marked-up version travels as a separate PDF under "related files". This builds it.
old = Submission Files/manuscript.tex ... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | paper/latex/make_markedup.py | .py | 4239c59b425d0e81 | 7 | 0 |
#!/usr/bin/env python3
r"""Flatten the manuscript into single self-contained .tex files for journal submission.
Produces (in MANUSCRIPT/):
manuscript.tex -- main.tex with every \input expanded inline and the bibliography
embedded from main.bbl (compiles standalone: pdflatex twice, no bibtex... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | paper/latex/make_submission.py | .py | b1de7b2a81bf998b | 7 | 0 |
#!/usr/bin/env python3
"""Build the Zenodo deposit archive for the revised manuscript.
The editor requires the underlying code to be deposited in a DOI-assigning repository and
linked from Methods or Code Availability. This builds that archive.
It is NOT the same artifact as `make_code_si.py`, and the difference matt... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | paper/latex/make_zenodo_pack.py | .py | e957ff77e6391774 | 7 | 0 |
r"""Convert paper/sections/*.md to LaTeX fragments via pandoc.
- Strips the top-level '# <Section>' heading (main.tex supplies \section commands).
- Pre-converts unicode math pandoc/inputenc cannot handle (superscript exponents).
- Drops the ledger HTML comments from the .tex output (the canonical, audited source
st... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | paper/latex/md2tex.py | .py | 6a238ff5d187e45b | 7 | 0 |
#!/usr/bin/env python3
"""Fetch all sensors in cities_manifest.csv -> data/cities/<city>.csv (timestamp,PM2.5).
Resumable: each city's progress checkpoints to data/cities/<city>.csv.partial.json after
every month, so a kill mid-fetch (this environment reaps long-running background processes)
only loses the current mon... | Muhtasim-Munif-Fahim/cost-aware-tsfm-forecasting | src/batch_fetch.py | .py | 4ee95dbad5036de3 | 7 | 0 |
"""Proof-of-Audit hub ledger — auditor rewards from invoke revenue (mirrors AgentAuditPool).
Off-chain reference for Pulse Terminal + invoke routing. On-chain bridge via
fundAuditRewards when ACEX_AUDIT_BRIDGE_MODE=onchain (Phase 2 worker).
Env:
ACEX_AUDIT_FEE_BPS Bps of gross invoke → auditors (default 10... | alexar76/aimarket-hub | aimarket_hub/acex_audit.py | .py | d2c3aeadc63d0e5f | 7 | 0 |
"""Pydantic request/response models for the hub API."""
from __future__ import annotations
from typing import Any
from pydantic import BaseModel, Field
class SearchRequest(BaseModel):
intent: str = Field("", max_length=4000)
budget: float | None = Field(None, ge=0, le=100_000)
max_latency_ms: int | Non... | alexar76/aimarket-hub | aimarket_hub/api_models.py | .py | 8192123415694d56 | 7 | 0 |
"""Auto-listing: publish COMPLETED factory products as hub capabilities.
When the pipeline finishes a product (state = COMPLETED or DEPLOYED_PRODUCTION),
this module automatically:
1. Reads the product from pipeline.json
2. Generates capabilities from its spec + deployed code
3. Registers them in the hub database
4. M... | alexar76/aimarket-hub | aimarket_hub/auto_listing.py | .py | cabf8b46e25add80 | 7 | 0 |
"""Hub capital pricing for Pulse Terminal (ACEX Phase 2)."""
from __future__ import annotations
import sys
from pathlib import Path
from fastapi import HTTPException
# acex/ lives at monorepo root (sibling of aimarket-hub) or at /app/acex in Hub image.
def _repo_root() -> Path:
here = Path(__file__).resolve()
... | alexar76/aimarket-hub | aimarket_hub/capital_pricing.py | .py | 586345287f86757f | 7 | 0 |
#!/usr/bin/env python3
"""AIMarket Hub CLI — crawl, search, invoke, publish, serve.
Usage:
aimarket serve Start the hub API server
aimarket publish capability.json Publish a capability to the hub catalog
aimarket crawl Run a federation crawl cycle
aimarket search <quer... | alexar76/aimarket-hub | aimarket_hub/cli.py | .py | ffff5d9f2d3ad697 | 7 | 0 |
"""Hub configuration — env vars, defaults, paths."""
from __future__ import annotations
import json
import os
from dataclasses import dataclass, field
from pathlib import Path
from aimarket_hub import __version__
# Anvil/Hardhat dev-mnemonic accounts and deterministic dev contract addresses.
# Their private keys a... | alexar76/aimarket-hub | aimarket_hub/config.py | .py | b1795b5e56d9120f | 7 | 0 |
"""Data-as-Capability (#7)
Paid upload of private corpus → corpus becomes paid RAG-capability.
Example: "notary company uploads 50k court decisions → legal.us-cases.search@v1,
$0.05 per query, 70% revenue to owner."
Doubles TAM — sell compute AND data. Snowflake-level monetization.
"""
from __future__ import annotat... | alexar76/aimarket-hub | aimarket_hub/data_capability.py | .py | d070f366af8f9445 | 7 | 0 |
"""Anonymized invocation dataset exporter.
Weekly export of ai-market-corpus-week-N.jsonl:
Anonymized task→capability→outcome→price tuples.
Privacy:
- Product/capability IDs are SALTED SHA-256 (16 hex chars).
Salt is loaded from AIMARKET_DATASET_SALT or generated per-deploy
and persisted to data/d... | alexar76/aimarket-hub | aimarket_hub/dataset_exporter.py | .py | d248b27386a92b65 | 7 | 0 |
"""Discovery ↔ AIMarket glue.
Before launching the pipeline, the Discovery agent searches the hub for:
- Data-as-capability: market signals, trends, competitor info
- Existing capabilities that could be reused instead of built from scratch
- Reputation data on relevant providers
Returns enriched context for the pipel... | alexar76/aimarket-hub | aimarket_hub/discovery_glue.py | .py | 25af9142004f710f | 7 | 0 |
"""C2 — accept a buyer's DebitAuthorization, or refuse the invoke.
The contract will only debit a channel against a signature from its depositor, so this is
where the hub earns the right to be paid: an invoke that runs without a stored, verified
authorization is work the hub can never collect for on chain.
Every chec... | alexar76/aimarket-hub | aimarket_hub/escrow_bridge/authorization.py | .py | 408c588ea3908914 | 7 | 0 |
"""Escrow bridge settings — every read dynamic, every default inert.
The bridge is the only part of the hub that can cause value to move on-chain, so its
configuration is deliberately boring and its defaults are deliberately useless:
mode OFF → nothing in the request path changes at all
strateg... | alexar76/aimarket-hub | aimarket_hub/escrow_bridge/config.py | .py | ae1d63d9886c71dc | 7 | 0 |
"""C1 — decide whether an on-chain escrow channel backs the credit being asked for.
This replaces "somebody paid the platform wallet, and the caller says it was them" with
"the contract itself says this depositor locked these funds in this channel". It is a
pure read: no keys, no writes, nothing to broadcast.
Two pro... | alexar76/aimarket-hub | aimarket_hub/escrow_bridge/escrow_verify.py | .py | b67365ec0ffd294f | 7 | 0 |
"""C3 signing strategies — the only place in the hub that can put value in motion.
Three strategies, ordered by how much trust they need:
plan the default. Refuses to sign anything. Everything upstream of a signature
still runs (build, simulate, record), so plan mode is genuinely useful: it
... | alexar76/aimarket-hub | aimarket_hub/escrow_bridge/signer.py | .py | ea3fce897444424a | 7 | 0 |
"""Can this hub actually execute a capability it is offering for sale?
One predicate, used by everything that either accepts a listing or advertises one, so
the three places that need the answer cannot drift apart:
* ``factory_bridge.import_factory_products`` — refuse the row at ingest;
* the ``/ai-market/v2/search``... | alexar76/aimarket-hub | aimarket_hub/fulfillment.py | .py | eae31b465aecaa2b | 7 | 0 |
"""LUMEN trust oracle client — PageRank/EigenTrust over the supply trust graph.
Every non-healthy return distinguishes TWO failure classes, because the caller must treat
them differently (see ``supply_security.refresh_publisher_trust``):
* ``unavailable=True`` — the oracle could not be consulted or answered nonsense ... | alexar76/aimarket-hub | aimarket_hub/lumen_client.py | .py | 7ebb898d3aa3a280 | 7 | 0 |
"""Hub-native MCP JSON-RPC at ``/mcp`` (and ``/ai-market/mcp``).
Peers that read ``mcp_endpoint`` from ``/.well-known/ai-market.json`` need a real
handler — advertising a 404 is a protocol lie. This surface speaks Streamable-HTTP
MCP (JSON-RPC 2.0 POST, SSE ``data:`` framing) with two tools that map onto the
hub's own... | alexar76/aimarket-hub | aimarket_hub/mcp_gateway.py | .py | 3ef94b375de74d58 | 7 | 0 |
"""MCP-Server-as-a-Product (#9)
Each product packaged as Docker image + MCP manifest + connection string.
Buyer: docker run aifactory/lyra → local MCP-server, Claude Desktop one-click.
Self-hosted distribution, subscription payment. Path to Anthropic MCP-registry
where "commercial MCP servers" niche is currently vaca... | alexar76/aimarket-hub | aimarket_hub/mcp_packager.py | .py | f71d36967b4a6498 | 7 | 0 |
"""Prometheus metrics for the AIMarket Hub.
Exposed at ``GET /metrics`` (Prometheus text format). Scrape from the factory
Prometheus job ``aimarket-hub`` — see ``prometheus.yml`` and
``docs/observability-prometheus.md``.
"""
from __future__ import annotations
import time
from contextlib import contextmanager
from ty... | alexar76/aimarket-hub | aimarket_hub/metrics.py | .py | bb55fc2769efa370 | 7 | 0 |
"""Data models for hub entities — capabilities, peers, stats."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
@dataclass
class Capability:
"""A single AI capability indexed by the hub."""
capability_id: str
product_id: str
name: str
version:... | alexar76/aimarket-hub | aimarket_hub/models.py | .py | fc650d043371ce9e | 7 | 0 |
"""m-of-n dispute-ruling quorum (threat assessment O-1).
The dispute oracle that decides slashes was single-operator — a trust bottleneck and a
pre-mainnet blocker. This replaces "one operator rules" with "**m of n authorities must each
sign the ruling**". A ruling is only valid when at least ``threshold`` *distinct* ... | alexar76/aimarket-hub | aimarket_hub/oracle_quorum.py | .py | ee215ee04fb3389c | 7 | 0 |
"""Orchestrator-as-a-Capability (#10)
The planner (which picks capability chains) IS a capability priced at 1% of spend.
External agent with empty head just sends NL task → orchestrator selects, negotiates,
executes, returns result + BOM.
Sell the brain, not just the muscles. When ecosystem grows, orchestrator become... | alexar76/aimarket-hub | aimarket_hub/orchestrator_capability.py | .py | 4746d5a9286738c8 | 7 | 0 |
"""SSRF-safe outbound HTTP for hub invoke and federation."""
from __future__ import annotations
import os
from ipaddress import ip_address
from urllib.parse import urlparse, urlunparse
import httpx
from aimarket_hub import crawler as _crawler
def _url_is_safe(url: str) -> bool:
# Dynamic delegation, NOT `from... | alexar76/aimarket-hub | aimarket_hub/outbound_http.py | .py | 77ad130db83b17bd | 7 | 0 |
"""DeepAgents 集成 — 主 Agent 构建。
主 Agent = langgraph ``create_react_agent``:
- 项目全量工具(ToolRegistry → StructuredTool,含技能白名单)
- ``task`` 委派工具(→ 配置化 SubAgent)
- ``spawn_tasks`` 批量委派工具(阶段 3:DAG 依赖 + 分层并发)
- ``revise_plan`` 计划修订工具(阶段 4:追加/取消/细化重发)
- system prompt 注入:任务工具说明 + 可用子智能体名册
架构对照 DeepAgents ``create_deep_agent``(底层... | reques/EasyRAG | app/agents/deep/agent.py | .py | 3b3f279f60c85d54 | 7.35 | 4 |
"""DeepAgents 结构化黑板(阶段 3)— spawn_tasks DAG 的任务产出物共享层。
与旧版 ``app/agents/blackboard.py``(orchestrator 时代,仅 500 字摘要)的区别:
- 结构化 Artifact:``{key, producer, summary, data, tags, version}``,
摘要 + 全量两级——调度注入默认用摘要,按需可取全量 ``data``;
- 订阅由 ``spawn_tasks`` 的 ``depends_on`` 派生:任务执行前注入依赖
artifact 摘要;
- 写通知:post 时经统一事件流... | reques/EasyRAG | app/agents/deep/blackboard.py | .py | b95d2401c2652279 | 7.35 | 4 |
"""DeepAgents 集成 — LangChain ChatModel 适配。
项目自研 LLMClient 直接面向 OpenAI 兼容 HTTP API(DashScope / DeepSeek 等),
而 langchain create_react_agent 需要 langchain BaseChatModel。由于所有端点
都是 OpenAI 兼容协议,用 ``ChatOpenAI`` 指向现有配置即可(零新依赖,配置
单一来源:app/core/config.py)。
2026-08-21(S8):DeepSeek 思考模式(reasoning)模型在响应中返回
``reasoning_content``,O... | reques/EasyRAG | app/agents/deep/llm.py | .py | 299191bd1629a2b4 | 7.35 | 4 |
"""DeepAgents 步骤透传 — 请求级观察者(S3,2026-08-21)。
问题:主 Agent 通过 ``task`` 工具委派 SubAgent 时,子 Agent 的执行过程
(推理/工具调用/工具返回)此前是黑盒——``_run_deep`` 的 on_step/on_artifact
只覆盖主 Agent 的 stream,前端 SSE 只能看到 "调用 task(...)" 与一条
"工具返回",看不到子 Agent 内部。
方案:task 工具与 SubAgent 同步运行在主 Agent 的 executor 线程内,用两层
ContextVar 把 ``_run_deep`` 的 on_step/o... | reques/EasyRAG | app/agents/deep/observe.py | .py | c49680c005717cf3 | 7.35 | 4 |
"""DeepAgents 集成 — SubAgent 配置与构建。
配置化的子智能体:``name / description / system_prompt / tools``。
主 Agent 通过 ``task(description, subagent_type)`` 工具按描述选择 SubAgent
(模型自动路由,业务代码零 if/else)。
SubAgent 用 langgraph ``create_react_agent`` 构建(DeepAgents 底层同款
harness),每次 invoke 独立 state —— 子 Agent 上下文天然与主 Agent 隔离,
结果以纯文本返回,不污染主 Age... | reques/EasyRAG | app/agents/deep/subagents.py | .py | fecb075689f0035e | 7.35 | 4 |
"""DeepAgents 集成 — 项目 ToolRegistry → langchain 工具转换。
EasyRAG 的工具中心是 ``app/tools/registry.py`` 的 ``ToolRegistry``(自动发现
``app/tools/*.py`` 导出的 ``TOOL`` + MCP 桥接),工具函数签名统一为
``fn(**kwargs) -> str``。langchain ``create_react_agent`` 需要 langchain
BaseTool。这里把 ``ToolDefinition`` 包装成 ``StructuredTool``(执行时仍走
``registry.invoke`... | reques/EasyRAG | app/agents/deep/tools.py | .py | e54f9b4ab1c5674d | 7.35 | 4 |
"""统一事件流 — 请求级 trace 上下文与结构化事件分发(2026-08-26,阶段 1)。
背景:智能体执行过程的中间上报此前散落在三套机制里——``_run_deep`` 的
_step/_artifact 闭包、observe.py 的双层观察者、registry 无任何事件。工具
调用的参数/结果/耗时没有统一的结构化记录,跨层(主 Agent → SubAgent →
工具)无法用同一 trace 串联,也无法可靠回放一次执行。
本模块提供进程内等价的"事件总线"(单进程部署,不引入 MQ):
- ``use_request_trace``:请求级 trace(trace_id + session_id + ... | reques/EasyRAG | app/agents/events.py | .py | 5a444aba841c218e | 7.35 | 4 |
"""Application-wide logger setup.
Provides `get_logger(name)` for per-module loggers all sharing the same
handler configuration. Uses stdlib logging - no extra runtime dependencies.
"""
from __future__ import annotations
import logging
import sys
from functools import lru_cache
_FORMAT = "%(asctime)s | %(... | reques/EasyRAG | app/core/logger.py | .py | b2569ccdf7103c93 | 7.35 | 4 |
"""LangGraph routing functions.
Each router receives the current AgentState and returns the name
of the next node to visit.
"""
from __future__ import annotations
from app.core.config import get_settings
from app.core.logger import get_logger
from app.graph.state import AgentState
logger = get_logger(__na... | reques/EasyRAG | app/graph/router.py | .py | f30fb319d9af2e1c | 7.35 | 4 |
"""Server-side chat model catalog.
Only stable public IDs and display metadata are exposed to the frontend. The
provider endpoint, concrete API model name and API key are resolved here so a
chat request cannot inject arbitrary upstream credentials or URLs.
"""
from __future__ import annotations
from dataclasses impo... | reques/EasyRAG | app/llm/models.py | .py | 7370257f8087fb29 | 7.35 | 4 |
"""OpenTelemetry 可选集成(2026-08-26,阶段 5)。
- 安装了 ``opentelemetry-api`` → ``trace_span``/``get_tracer`` 返回真实
tracer(需自行配置 exporter/TracerProvider 才能导出);
- 未安装 → no-op 等价物:``trace_span`` 直接 yield None,``instrument_app``
原样返回应用,零依赖零开销。
接入点(见各调用方):
- ``registry.invoke`` → span ``tool.invoke.<name>``
- ``task`` 工具 ... | reques/EasyRAG | app/observability/tracing.py | .py | f4567fd29b66d6c8 | 7.35 | 4 |
"""图片 OCR 引擎 — 当所选对话模型不支持多模态输入时的回退方案。
优先使用 MinerU 服务(独立部署的文档解析 API,中文效果好,见 .env 的 MINERU_* 配置);
MinerU 不可用时回退到本地 RapidOCR(纯 ONNX,无 PaddlePaddle 依赖,Windows 友好)。
引擎懒加载,仅在首次调用时初始化,避免拖慢后端启动。
"""
from __future__ import annotations
import asyncio
import base64
import io
import mimetypes
import re
import tempfile
import zip... | reques/EasyRAG | app/ocr/engine.py | .py | 41dd8fcddd003bbe | 7.35 | 4 |
"""图谱抽取器抽象(GraphRAG 阶段 5)。
抽取器把一段 chunk 文本变成结构化的实体/关系列表。当前内置
``LLMExtractor``(LLM JSON 模式抽取),未来可扩展其他方式
(如 neo4j-graphrag 的 SimpleKGPipeline、基于规则的抽取等),
通过 ``get_extractor(name)`` 工厂按配置切换。
"""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Awaitable, Callable, Dict,... | reques/EasyRAG | app/rag/extractors/base.py | .py | 4ecd43e80e00e88f | 7.35 | 4 |
"""图谱召回器(GraphRAG 阶段 5)。
检索流程:
1. query 向量化 → Milvus 图谱语义索引(graph_entity_index)召回实体/三元组;
2. 实体命中 → Neo4j 1 跳子图展开,收集关系上的 chunk 引用;
3. 三元组命中 → Neo4j 按 (source, relation, target) 精确取 chunk 引用;
4. 按 chunk 被命中的加权次数聚合排序,输出候选 chunk_id 列表 + 图谱上下文。
所有 Neo4j/Milvus 异常降级为空结果(检索主链路不受影响)。
"""
from __future__ import annotations
... | reques/EasyRAG | app/rag/graph_retriever.py | .py | 27d0a441e345a7a0 | 7.35 | 4 |
"""OCR 链路(阶段 2B)— RapidOCR 图片文字识别。
用途:
- 图片文件(.png/.jpg/.jpeg/.bmp/.webp)直接 OCR 提取文本;
- 扫描版 PDF(pypdf 提取不到文字的页)渲染成图片后 OCR 兜底。
RapidOCR 是本地推理(ONNX),无需外部服务;首次调用会加载模型,用进程级单例避免重复加载。
"""
from __future__ import annotations
import io
from typing import List
from app.core.logger import get_logger
logger = get_logger(_... | reques/EasyRAG | app/rag/ocr.py | .py | d00b055380647a28 | 7.35 | 4 |
"""AgentArk Demo — 5-minute wow experience
Creates a swarm demo with 3 agents working in parallel,
opens the 7-tab Command Center, and guides the user through
their first multi-agent experience.
"""
from __future__ import annotations
import subprocess
import time
import webbrowser
from pathlib import Path
from textwr... | lcyluke/agentark | agentark/cli/commands/demo.py | .py | d88b26bc4aab20df | 7.15 | 1 |
"""Apex — economy CLI command"""
from __future__ import annotations
import os
from pathlib import Path
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich import print as rprint
from agentark.core.profile import AGENTARK_HOME
from agentark.economy import BudgetManager,... | lcyluke/agentark | agentark/cli/commands/economy.py | .py | 34f5a6aefea5d940 | 7.15 | 1 |
"""Apex — evolution CLI command"""
from __future__ import annotations
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from agentark.core.evolution import EvolutionEngine
from agentark.core.profile import AGENTARK_HOME
console = Console()
def status_cmd():
"""View evol... | lcyluke/agentark | agentark/cli/commands/evolution.py | .py | 70931d06372a698a | 7.15 | 1 |
"""Apex — Help Command Group
Merges: help-request, help-approve, help-list under `apex help <sub>`
Usage:
apex help request <agent> <title> — Request help
apex help approve <id> -a <agent> — Approve help request
apex help list — List help requests
"""
from __future__ import annotations
f... | lcyluke/agentark | agentark/cli/commands/help_cmds.py | .py | 770a14ba89bca1ab | 7.15 | 1 |
"""Apex — init command (interactive project setup with agent matching)"""
from __future__ import annotations
from pathlib import Path
from rich.console import Console
from rich.panel import Panel
from rich.prompt import Prompt, Confirm
from rich.table import Table
from agentark.core.profile import ProfileManager
# P... | lcyluke/agentark | agentark/cli/commands/init.py | .py | c757935c77af7cd2 | 7.15 | 1 |
"""Apex — Mode Command Group
All collaboration modes under one roof: chain, debate, supervise, pipeline
Usage:
apex mode chain <goal> -p <type> — Sequential chain pipeline
apex mode debate <topic> — Multi-agent debate
apex mode supervise <goal> -w <n> — Hierarchical supervision
apex mode ... | lcyluke/agentark | agentark/cli/commands/mode_cmds.py | .py | c25def060c703aa1 | 7.15 | 1 |
"""Apex — Operations management CLI commands"""
from __future__ import annotations
import time
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.columns import Columns
from rich.layout import Layout
from rich import box
from agentark.orchestration.ops import get_ops,... | lcyluke/agentark | agentark/cli/commands/ops.py | .py | 2fb2f5d685e59b66 | 7.15 | 1 |
"""Pipeline CLI commands.
Commands:
apex pipeline normal <requirement> — 正常流程: 需求→拆解→分派
apex pipeline direct <task> — 专项直达: 指令→Agent
apex pipeline status <id> — 查看管线状态
apex pipeline confirm <id> — 人工确认继续
"""
from __future__ import annotations
from rich.console import Console
f... | lcyluke/agentark | agentark/cli/commands/pipeline_cmds.py | .py | 0126af5c84a6d3f1 | 7.15 | 1 |
"""Apex — Task Schedule & Gantt Chart View
Commands:
apex schedule view — Show all tasks in Gantt chart format
apex schedule view <id> — Show specific epic's tasks in Gantt
apex schedule list — List all schedules/epics
"""
from __future__ import annotations
import time
from pathlib import Path
from d... | lcyluke/agentark | agentark/cli/commands/schedule_cmds.py | .py | cebe7df7b500450a | 7.15 | 1 |
"""Apex — Skill Registry CLI commands.
Commands:
apex skill list — List all skills or filter by category
apex skill show <agent> — Show agent skill levels with evidence
apex skill assess — Assess/update agent skill level
apex skill match <task> — Find best agent for a task
a... | lcyluke/agentark | agentark/cli/commands/skill_mgmt.py | .py | e33d012d82a8fa24 | 7.15 | 1 |
"""Apex Sprint Pipeline CLI — MVP closed-loop development.
Commands:
apex sprint create <goal> — Start a new sprint
apex sprint status [id] — View sprint progress
apex sprint approve [id] — Approve current manual gate
apex sprint reject [id] — Reject current manual gate
apex sprint list ... | lcyluke/agentark | agentark/cli/commands/sprint.py | .py | aa0393a6436d2b52 | 7.15 | 1 |
"""Apex — Developer Squad Commander.
One-command launch for the full development team:
apex squad start — Start all 5 dev agents in new windows
apex squad status — Show all dev agent statuses
apex squad attach — Attach to a specific agent
"""
from __future__ import annotations
import os
import subprocess
... | lcyluke/agentark | agentark/cli/commands/squad_cmds.py | .py | 7e77530a22c70474 | 7.15 | 1 |
"""Apex — System Command Group
All system management under one roof: skill, economy, evolution, knowledge, autonomous
Usage:
apex system skill list — List skills
apex system economy status — Economy status
apex system evolution status — Evolution status
apex system knowledge que... | lcyluke/agentark | agentark/cli/commands/system_cmds.py | .py | a556fdd701b5ba9c | 7.15 | 1 |
"""Apex — Task Management CLI commands.
Commands:
apex task create — Create a hierarchical task (epic/story/task/subtask)
apex task list — List tasks with filters
apex task show — Show task with full tree
apex task status — Transition task workflow status
apex task epi... | lcyluke/agentark | agentark/cli/commands/task_mgmt.py | .py | 6874117bcb2c9dbb | 7.15 | 1 |
"""Apex — team command"""
from __future__ import annotations
from pathlib import Path
from rich.console import Console
from rich.panel import Panel
from rich.table import Table
from rich.prompt import Prompt
import click
from agentark.core.profile import ProfileManager
def create_cmd(name: str):
"""Create a new... | lcyluke/agentark | agentark/cli/commands/team.py | .py | c6e1ab952ab8eccb | 7.15 | 1 |
"""Short/long-term KV memory store."""
from __future__ import annotations
import json
import sqlite3
from pathlib import Path
from dataclasses import dataclass, field
from typing import Optional
class Memory:
"""Agent memory system"""
def __init__(self, db_path: Path):
self.db_path = db_path
... | lcyluke/agentark | agentark/core/memory.py | .py | aba15aab92119beb | 7.15 | 1 |
#!/usr/bin/env python3
"""Build the public status index without shell/JSON argument ambiguity."""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
def build_index(status_dir: Path) -> dict[str, list[dict[str, str]]]:
"""Return an index containing only valid stat... | vllm-ascend/vllm-ascend-recipes | .github/_scripts/build_status_index.py | .py | 969f5c643822c340 | 7.15 | 1 |
#!/usr/bin/env python3
"""Merge one configuration-level verification result into a model status JSON."""
from __future__ import annotations
import argparse
import copy
import json
from pathlib import Path
from typing import Any
def run_identity(run: dict[str, Any]) -> tuple[Any, ...]:
"""Identify one workflow r... | vllm-ascend/vllm-ascend-recipes | .github/_scripts/merge_target_status.py | .py | 23bfea9b81bdf137 | 7.15 | 1 |
#!/usr/bin/env python3
"""Seed skeleton status JSON files for every recipe in models/en/.
Run by .github/workflows/publish-status.yml as the first step of the
"Build status JSON files" stage. Idempotent: existing real records are
preserved; only recipes without a status JSON yet are seeded.
Why a separate file? The h... | vllm-ascend/vllm-ascend-recipes | .github/_scripts/publish_skeleton.py | .py | 4deee003bb9ee3bf | 7.15 | 1 |
#!/usr/bin/env python3
"""Load the explicit configuration-verification target registry."""
from __future__ import annotations
from pathlib import Path
from typing import Any
import yaml
_REQUIRED = {"id", "recipe", "mode", "runner", "selector"}
_SELECTOR_REQUIRED = {"npu", "precision", "deployment", "case"}
_MODES... | vllm-ascend/vllm-ascend-recipes | .github/_scripts/verification_targets.py | .py | 3ef7db5a8cc00d68 | 7.15 | 1 |
#!/usr/bin/env python3
"""Rebuild models/zh/**/*.yaml from the en mirror + translations, and update memory.
Reads the per-file {path → zh} map produced by yaml_translate.py and, for each
file, loads the English recipe with a ruamel round-trip loader (so key order,
comments and scalar styles survive), overwrites the tr... | vllm-ascend/vllm-ascend-recipes | scripts/translate/apply_translations.py | .py | ab6b7fae58b3e4dd | 7.15 | 1 |
#!/usr/bin/env python3
"""Resync translation-memory JSONs from the en + zh mirrors.
``models/translations/**/*.json`` is the translation memory — a
``{path: {"en", "zh"}}`` snapshot that ``detect_yaml_changes.py`` diffs against
the live English recipes. When a developer manually re-translates a recipe
(edits ``models/... | vllm-ascend/vllm-ascend-recipes | scripts/translate/resync_memory.py | .py | c9c22136cdc214a3 | 7.15 | 1 |
"""Command-line entry point for deterministic Recipe-to-plan conversion."""
from __future__ import annotations
import argparse
import hashlib
import json
import re
import sys
from pathlib import Path
from typing import Sequence
import yaml
from .emitter import EmitError, emit_bundle
from .model import ConversionErr... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/converter/cli.py | .py | 6a0c14deaee9ca59 | 7.65 | 1 |
"""Safely emit and verify an executable multi-node plan bundle."""
from __future__ import annotations
import os
import re
import shutil
import subprocess
import tempfile
from dataclasses import asdict, is_dataclass
from pathlib import Path, PurePosixPath
from typing import Any, Mapping
import yaml
from .model impor... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/converter/emitter.py | .py | 9d4645a9b151489c | 7.65 | 1 |
"""Resolve Recipe parameter defaults and render scenario scripts."""
from __future__ import annotations
import math
import re
from collections.abc import Mapping
from dataclasses import replace
import yaml
from .model import (
ConversionError,
ParameterValue,
ScenarioSource,
ScriptSource,
)
_PARAME... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/converter/parameters.py | .py | d682c97235ff059e | 7.65 | 1 |
"""Read the scenario-local contract from a Recipe document."""
from __future__ import annotations
import math
import re
from pathlib import Path
from typing import Any
import yaml
from .model import ConversionError, ParameterValue, ScenarioSource, ScriptSource
_CASE_PATTERN = re.compile(r"(?:[1-9]\d*)p(?:[1-9]\d*... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/converter/reader.py | .py | fbeaa8d494c02fcd | 7.65 | 1 |
"""Static analyzers for the shell fragments embedded in Recipe scenarios.
The converter deliberately does not execute Recipe shell. This module only
recognizes the small command contracts used by multi-node scenarios and turns
them into typed values that the planner can validate.
"""
from __future__ import annotatio... | vllm-ascend/vllm-ascend-recipes | test/recipe/multi_node/converter/shell.py | .py | bc5e0e71985c7145 | 7.65 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.