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
"""MCP tools for negative keyword shared sets management.""" from server.main import mcp from server.tools import get_runner, handle_cli_errors from server.tools.helpers import ( append_pagination, require_update_fields, tool_error_dict, ) @mcp.tool( name="negativekeywordsharedsets_get", descript...
axisrow/yandex-direct-mcp-plugin
plugins/yandex-direct/server/tools/negative_keyword_shared_sets.py
.py
3065e5ca3a2c9c45
7.56
12
"""MCP tools for keyword research.""" from server.main import mcp from server.tools import ToolError, get_runner, handle_cli_errors from server.tools.helpers import tool_error_dict @mcp.tool( name="keywordsresearch_has_search_volume", description="Check whether keywords have search volume in given regions. C...
axisrow/yandex-direct-mcp-plugin
plugins/yandex-direct/server/tools/research.py
.py
d28ca02bbe501522
7.56
12
"""MCP tools for retargeting list management.""" from server.main import mcp from server.tools import get_runner, handle_cli_errors from server.tools.helpers import ( CliOption, append_cli_options, append_pagination, require_update_fields, run_single_id_batch, tool_error_dict, validate_enum...
axisrow/yandex-direct-mcp-plugin
plugins/yandex-direct/server/tools/retargeting.py
.py
5fc201189588e199
7.56
12
"""MCP tools for smart ad target management.""" from server.main import mcp from server.tools import get_runner, handle_cli_errors from server.tools.helpers import ( CliOption, append_cli_options, append_id_filters, append_pagination, require_update_fields, run_set_bids, run_single_id_batch...
axisrow/yandex-direct-mcp-plugin
plugins/yandex-direct/server/tools/smart_ad_targets.py
.py
9d1463c26747988b
7.56
12
"""Meta-tool: on-demand detailed help for any MCP tool. To keep the startup context small, every tool exposes only a short one-line ``description``. The full documentation (parameter reference, examples, constraints) lives in each tool function's docstring and is served lazily through ``tool_help`` instead of being lo...
axisrow/yandex-direct-mcp-plugin
plugins/yandex-direct/server/tools/tool_help.py
.py
1a65ddc38a23d2ae
7.56
12
"""LRU cache of live application instances.""" from __future__ import annotations from threading import Lock from cachetools import TTLCache from cogbase.core.app import CogBaseApp def cache_key(account_id: str, namespace_id: str, name: str) -> str: """Composite cache key for a live app instance. An app'...
CogBaseAI/cogbase
api/app_cache.py
.py
18239bf4a0565ac8
7.66
20
"""FastAPI dependency providers.""" from __future__ import annotations from dataclasses import dataclass from typing import Annotated, Any from fastapi import Depends, Header, HTTPException, Request, status from api.app_cache import AppCache from api.auth import InvalidToken, decode_token from api.system_resources ...
CogBaseAI/cogbase
api/dependencies.py
.py
3d04270d22419bd4
7.66
20
"""Default-workspace provisioning for a freshly-minted account. When a brand-new account is minted at signup (the no-invite path), we seed it with a starter workspace so the user lands on something usable rather than an empty console: a ``legal-team`` namespace holding a ``contract-analyst`` application built from ``e...
CogBaseAI/cogbase
api/provisioning.py
.py
d5d51990695fc75a
7.66
20
"""First-party email/password authentication endpoints. Signup / login issue an access token (short-lived HS256 JWT) plus a refresh token (opaque, DB-backed, revocable). Every other route derives its tenant from the verified access token (see ``api/dependencies.py``), so these endpoints are the only ones reachable wit...
CogBaseAI/cogbase
api/routers/auth.py
.py
38268d6b647ce025
7.66
20
"""CRUD endpoints for managing namespaces within an account. A namespace is an in-account organizational unit: applications, skills, and all other resources are addressed as ``/namespaces/{namespace}/...``. The account is the security boundary (the ``X-Account-Id`` header); the namespace is a handle that is only uniq...
CogBaseAI/cogbase
api/routers/namespaces.py
.py
b70b2ed6bb71bbf7
7.66
20
"""Endpoints for uploading and managing system-wide skills. Skills are uploaded as a ZIP bundle (SKILL.md + scripts/assets). The bundle bytes are persisted in the system document store (the shared, multi-node source of truth) and materialized into a local cache dir for execution. Each skill gets a stable UUID; applica...
CogBaseAI/cogbase
api/routers/skills.py
.py
e6b148d8d348e682
7.66
20
"""System-level configuration — loaded once at service startup from a YAML file. The system config defines service-wide defaults for the structured store and vector store backends. Applications posted to ``POST /applications`` only need to declare their LLM, embedding, chunker, and pack settings; the store backends a...
CogBaseAI/cogbase
api/system_config.py
.py
969cf80b2c0a06a9
7.66
20
"""Shared data primitives used across all layers of CogBase.""" from enum import Enum from typing import Any from pydantic import BaseModel, ConfigDict, Field class TaskStatus(str, Enum): PENDING = "pending" RUNNING = "running" DONE = "done" FAILED = "failed" class DocWorkflowStatus(str, Enum): ...
CogBaseAI/cogbase
cogbase/core/models.py
.py
efa4eab3fa4361f4
7.66
20
"""Account profile — the account-scoped company profile document. The company profile is stable org-wide context a customer supplies once: who they are, jurisdictions, regulators, risk appetite, house style, role. None of it is derivable from their documents, and none of it should be re-collected per app — so it live...
CogBaseAI/cogbase
cogbase/core/profile.py
.py
116667f38bccc19b
7.66
20
"""Abstract contract and built-in implementations for text embedders.""" import abc import logging logger = logging.getLogger(__name__) # Conservative fallback context window (tokens) for a single input text. Most # hosted embedding models cap one input around 8k tokens (e.g. OpenAI's # ``text-embedding-3-*`` at 819...
CogBaseAI/cogbase
cogbase/embeddings/base.py
.py
d8520c7a1f151fa5
7.66
20
"""HuggingFace sentence-transformers based implementation of EmbeddingBase.""" import asyncio import functools import logging from typing import cast from cogbase.embeddings.base import DEFAULT_CONTEXT_WINDOW, EmbeddingBase logger = logging.getLogger(__name__) class SentenceTransformersEmbedding(EmbeddingBase): ...
CogBaseAI/cogbase
cogbase/embeddings/huggingface.py
.py
f04928368f9d10a8
7.66
20
"""OpenAI embedding api based implementation of EmbeddingBase. The provider that provides OpenAI compatible API can use this implementation. """ import logging from typing import Any from cogbase.embeddings.base import DEFAULT_CONTEXT_WINDOW, EmbeddingBase logger = logging.getLogger(__name__) #: Default maximum n...
CogBaseAI/cogbase
cogbase/embeddings/openai.py
.py
b95b8a1c4b2f5ff7
7.66
20
"""Abstract contract for chat-completion LLM backends.""" from __future__ import annotations import abc from collections.abc import AsyncGenerator, Awaitable, Callable from typing import Any, Literal, TypedDict ReasoningEffort = Literal["minimal", "low", "medium", "high"] # Conservative fallback context window (tok...
CogBaseAI/cogbase
cogbase/llms/base.py
.py
dc6922148ad4ea46
7.66
20
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/backup/backup.py
.py
d62d6f7cb1630a68
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/backup/base.py
.py
d211a06cd5093029
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/backup/local.py
.py
fe8cc3afa696f3a0
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/backup/qcow.py
.py
62dc82d3041df8b3
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/backup/s3.py
.py
0610fb5dc9a499ac
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/builder/base.py
.py
6816b6129bf6ac71
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/builder/packer.py
.py
a594eb1b59afb982
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/clients/base_client.py
.py
5b79a3356065b2c3
7.48
8
# Copyright 2025 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/cmd/base.py
.py
b02f370c67be2e03
7.48
8
# Copyright 2025-2026 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
exordos/exordos
exordos/cmd/compute/common.py
.py
862bb025dc86f772
7.48
8
# Copyright 2026 Genesis Corporation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
exordos/exordos
exordos/cmd/deploy/commands.py
.py
4edf9e6040dbc949
7.48
8
#!/usr/bin/env python3 """ Beast Mode Trading Dashboard 🚀 Real-time performance monitoring for the Unified Advanced Trading System. Features: - Live portfolio performance across all strategies - Risk metrics and capital efficiency - Market making vs directional trading breakdown - Expected returns and Sharpe ratios ...
anglil/kalshi-ai-trading-bot
beast_mode_dashboard.py
.py
cae041332c07f6bc
7.48
8
""" Deep analysis of all trading activity to identify the dominant loss driver. Pulls fills, settlements, orders, and positions from Kalshi API. """ import asyncio import json from datetime import datetime, timedelta from collections import defaultdict from src.clients.kalshi_client import KalshiClient async def main(...
anglil/kalshi-ai-trading-bot
deep_analysis.py
.py
200ab92b320cfed1
7.48
8
#!/usr/bin/env python3 """ Beast Mode Trading Dashboard 🚀 Real-time performance monitoring for the Unified Advanced Trading System. Features: - Live portfolio performance across all strategies - Risk metrics and capital efficiency - Market making vs directional trading breakdown - Expected returns and Sharpe ratios ...
anglil/kalshi-ai-trading-bot
scripts/beast_mode_dashboard.py
.py
b9abced3ad50cd63
7.48
8
#!/usr/bin/env python3 """ Cost Monitor - Real-time AI spending tracker for Kalshi Trading System Usage: python cost_monitor.py # Show today's costs python cost_monitor.py --week # Show weekly analysis python cost_monitor.py --live # Live monitoring mode """ import asyncio import argparse ...
anglil/kalshi-ai-trading-bot
scripts/cost_monitor.py
.py
f0126f2a5d543a73
7.48
8
#!/usr/bin/env python3 """ Database initialization script for Kalshi AI Trading Bot Creates the necessary database tables and schema """ import asyncio import sys from pathlib import Path # Add src to path for imports sys.path.append(str(Path(__file__).parent / "src")) from utils.database import DatabaseManager as...
anglil/kalshi-ai-trading-bot
scripts/init_database.py
.py
244ca6c4209ae49b
7.48
8
#!/usr/bin/env python3 """ Beast Mode Installation Script 🚀 This script installs dependencies and validates the Beast Mode trading system. Usage: python install_beast_mode.py """ import subprocess import sys import os from pathlib import Path def run_command(command, description): """Run a command and hand...
anglil/kalshi-ai-trading-bot
scripts/install_beast_mode.py
.py
6ac94882317a10bf
7.48
8
#!/usr/bin/env python3 """ Trading Dashboard Launcher Simple launcher for the comprehensive trading system dashboard. """ import subprocess import sys import os from pathlib import Path def check_requirements(): """Check if required packages are installed.""" required_packages = [ 'streamlit', ...
anglil/kalshi-ai-trading-bot
scripts/launch_dashboard.py
.py
d42fbcf2164d4a14
7.48
8
#!/usr/bin/env python3 """ Performance System Manager Comprehensive orchestration system for the automated Kalshi trading performance analyzer. This is the main entry point for managing the entire performance analysis ecosystem. Features: - Start/stop automated scheduler - Run on-demand analysis - Emergency interven...
anglil/kalshi-ai-trading-bot
scripts/performance_system_manager.py
.py
5624ceead7961942
7.48
8
#!/usr/bin/env python3 """ Portfolio Health Check Utility This script provides a clear view of your portfolio finances: - Available Cash (for new trades) - Position Value (current market value of holdings) - Total Portfolio Value (cash + positions) - Key utilization metrics """ import asyncio import sys import os fro...
anglil/kalshi-ai-trading-bot
scripts/portfolio_health_check.py
.py
76a555958bc60112
7.48
8
#!/usr/bin/env python3 """ Complete Dashboard Setup Script This script: 1. Fixes database schema issues 2. Ensures all tables and columns exist 3. Tests database connectivity 4. Launches the dashboard Run this to get your dashboard working properly. """ import asyncio import subprocess import sys import os from path...
anglil/kalshi-ai-trading-bot
scripts/run_dashboard_setup.py
.py
b4ad38798975aa6e
7.48
8
/** * Unit tests for the main-process log redaction in electron-log.ts. * * The redaction masks credential-looking key=value / key: value pairs in * console output. Metric keys that merely CONTAIN a keyword * (first_token_latency_ms, prompt_tokens, ...) must stay untouched. */ import { describe, it, expect } fro...
14790897/MiQi
apps/desktop/src/main/electron-log.test.ts
.ts
7e020fe982057bcc
7.02
10
/** * Qraft 真实环境集成测试(可选,默认跳过)。 * * 用法(凭据优先从环境变量读取,client_secret 测试阶段有默认值): * QRAFT_LIVE=1 QRAFT_PHONE=<测试账号手机号> QRAFT_PASSWORD=<密码> \ * npx vitest run src/main/qraft/live.integration.test.ts * * 走通完整流程:提取公钥 → 平台登录(RSA 加密)→ authorize → doConfirm * → 取 code → 换 token → userinfo → refresh。断言只检查脱敏摘要, * 不打印任何...
14790897/MiQi
apps/desktop/src/main/qraft/live.integration.test.ts
.ts
2f7bc3e8931ce8b9
7.02
10
#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Model-level coherence + throughput benchmark for PR1 Marlin HIP.""" import argparse import time def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser() pars...
QuixiAI/SlimServe
bench_pr1_model.py
.py
118726bc54c3dde5
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Simplified batch specification grammar for attention benchmarks. Grammar (underscore-separated segments): Format: (<count>?) q<q_len>(k?) (s<seq_len>(k?))? - count: Number of identical requests (optiona...
QuixiAI/SlimServe
benchmarks/attention_benchmarks/batch_spec.py
.py
da9af651cacec685
7.95
7
#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Benchmark to measure the performance overhead of VLLM_BATCH_INVARIANT mode. This benchmark runs the same workload twice: 1. With VLLM_BATCH_INVARIANT=0 (baseline) 2. With VLLM_BATCH_INV...
QuixiAI/SlimServe
benchmarks/benchmark_batch_invariance.py
.py
2253aad341055774
7.45
7
#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Exact-shape DSV4 throughput benchmark for a local OpenAI completion API.""" from __future__ import annotations import argparse import concurrent.futures import hashlib import json impo...
QuixiAI/SlimServe
benchmarks/benchmark_dsv4_exact.py
.py
8613d0767d313e8f
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Micro benchmark comparing built-in hash(), SHA-256, and xxHash. This focuses on a single test payload shaped like the prefix-cache hash input: (32-byte bytes object, 32-int tuple) Usage: python bench...
QuixiAI/SlimServe
benchmarks/benchmark_hash.py
.py
250c9dc9f7ea4699
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Benchmark hidden state extraction throughput. Measures two modes: 1. Baseline: bulk inference with max_tokens=1, no extraction. 2. Extract: async hidden state extraction via ExampleHiddenStatesConnector ...
QuixiAI/SlimServe
benchmarks/benchmark_hidden_state_extraction.py
.py
955d19a109955fe6
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Offline benchmark to test the long document QA throughput. Example usage: # This workload samples 8 different prompts with a default input # length of 20000 tokens, then replicates each prompt 2 times...
QuixiAI/SlimServe
benchmarks/benchmark_long_document_qa_throughput.py
.py
d91244835135768a
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Benchmark and regression-test pinned (page-locked) CPU memory for vLLM. Verifies that enabling pinned memory does not regress throughput or latency compared to unpinned memory. Each condition runs in an isola...
QuixiAI/SlimServe
benchmarks/benchmark_pin_memory.py
.py
02c187d8ab6031df
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Benchmark the efficiency of prefix caching. This script allows you to benchmark the performance of a model with and without prefix caching using either fixed prompts or prompts sampled from the ShareGPT datas...
QuixiAI/SlimServe
benchmarks/benchmark_prefix_caching.py
.py
a5dd2a79084885f2
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Benchmark offline prioritization.""" import argparse import json import random import time from transformers import AutoTokenizer, PreTrainedTokenizerBase from vllm.engine.arg_utils import EngineArgs from vl...
QuixiAI/SlimServe
benchmarks/benchmark_prioritization.py
.py
089b3ced2857b73c
7.45
7
#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Benchmark comparing Triton vs PyTorch sort-based top-k/top-p implementations. Compares: - apply_top_k_top_p_triton (Triton binary search) - apply_top_k_top_p (PyTorch sort-based) Scena...
QuixiAI/SlimServe
benchmarks/benchmark_topk_topp.py
.py
93b8663919250379
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable, Iterable from dataclasses import dataclass from itertools import product import torch import torch.nn.functional as F import torch.utils.benchmark as TBenchmark from torch.u...
QuixiAI/SlimServe
benchmarks/fused_kernels/silu_mul_block_quant_benchmark.py
.py
8fab7a4a7f446c95
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import argparse import torch from vllm import _custom_ops as ops from vllm.triton_utils import triton # DeepSeek V3 dimensions NOPE_DIM = 512 ROPE_DIM = 64 NUM_HEADS = 128 NUM_TOKENS = [8, 16, 32, 64, 128, 25...
QuixiAI/SlimServe
benchmarks/kernels/bench_concat_mla_q.py
.py
a145888a61e1dd88
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import argparse import math import torch from vllm import _custom_ops as ops from vllm.triton_utils import triton # DeepSeek V3 MLA dimensions NOPE_DIM = 512 ROPE_DIM = 64 HEAD_DIM = NOPE_DIM + ROPE_DIM # 576 ...
QuixiAI/SlimServe
benchmarks/kernels/bench_cp_gather_fp8.py
.py
a6fccb37a00fa48f
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass from enum import Enum from itertools import product from typing import Any import torch import torch.utils.benchmark as TBenchmark from torch.utils.benchmark import Measurement ...
QuixiAI/SlimServe
benchmarks/kernels/benchmark_2d_silu_mul_fp8_quant.py
.py
a487150bec47a76a
7.45
7
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os # Disable DeepGEMM for this benchmark to use CUTLASS os.environ["VLLM_USE_DEEP_GEMM"] = "0" import torch from vllm.benchmarks.lib.utils import default_vllm_config from vllm.model_executor.kernels.lin...
QuixiAI/SlimServe
benchmarks/kernels/benchmark_block_fp8_gemm.py
.py
f181a7f54df987ca
7.45
7
#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Benchmark script for device communicators: CustomAllreduce (oneshot, twoshot), PyNcclCommunicator, and SymmMemCommunicator (multimem, two-shot). for NCCL symmetric memory you need to s...
QuixiAI/SlimServe
benchmarks/kernels/benchmark_device_communicators.py
.py
aef8b6245d7151ac
7.45
7
"""Sterling & Vance — the public web presence of the firm that operates Bob's agent. Both of the identity conventions this lab adopts assume the requesting side has somewhere on the web that speaks for it, and neither works without one: /agent.json A Client ID Metadata Document (draft-ietf-oauth-client-id-met...
nickgamb/uma4agents
clients/agent-operator/server.py
.py
44e51a0c0d42347c
7.48
8
#!/usr/bin/env python3 """Alice's side of her own authorization server, with no identity provider. She holds an Ed25519 key. Every owner-API request is signed with it under RFC 9421 — the same message-signature profile agents use to prove possession of a grant, pointed the other way. The authority verifies one public ...
nickgamb/uma4agents
clients/owner-cli/owner.py
.py
86e6880d4c3224f4
7.48
8
"""What does agentgateway actually hand an external authorization service? The enforcement core (lib/uma4a_pep.py) decides from request *facts*: the tool being called, the signature headers, the authorization header, the authority. Under the file-driven gateway those facts arrive because of three settings in gateway/a...
nickgamb/uma4agents
k8s/verify/extauth/recorder.py
.py
db884d9414eb9686
7.48
8
"""The personal-AI binding against the real stack. Against the reference architecture — her identity provider, her replicated authority, the gateway, the vault and her portal all present and unchanged — because that is the deployment the binding has to work in to mean anything. The only difference from the portal's p...
nickgamb/uma4agents
kwaai/check.py
.py
c80236b9c1265426
7.48
8
"""A personal AI, reduced to the four things the ability needs from one. pAI-OS would be the host here. This stands in for it so the binding is runnable and reviewable today, and so the call with Kwaai is about mapping four named requirements onto their actual mechanism rather than starting from a blank page. What it...
nickgamb/uma4agents
kwaai/host_demo.py
.py
1745eb0620c88d28
7.48
8
"""uma4a_enroll — enroll a requesting agent with its AAuth agent server. The identified half of the AAuth identity model: the agent holds a persisted *stable* key (its long-term identity) and a per-session *ephemeral* key. It registers with its principal's agent server by POSTing its stable public key in a request sig...
nickgamb/uma4agents
lib/uma4a_enroll.py
.py
4f1e520ce2311c1b
7.48
8
"""Minimal RFC 9421 HTTP message signatures for the uma4agents lab. One implementation shared by the agent-shim (signing) and uma-pep (verification), so the two ends cannot drift. Profile: covered components: "@method" "@authority" "@path" "authorization" params: created, keyid, alg="ed25519" Covering the `autho...
nickgamb/uma4agents
lib/uma4a_http_sig.py
.py
a023caa544f952db
7.48
8
"""What a resource server publishes about itself, in one implementation. Discovery has two audiences and three documents: RFC 9728 metadata public, structural — the tools, the scopes, which authorization servers speak for this resource, and the key its metadata...
nickgamb/uma4agents
lib/uma4a_publish.py
.py
407e024f0d7cbc2b
7.48
8
"""alice-vault-mcp — Alice's brokerage vault as an MCP server. Fixture data through a real protocol path: positions, transaction history, and a pretend trade-execution endpoint, served over MCP streamable-http. Whether this server handles its own authorization, or something in front of it does, is a deployment choice...
nickgamb/uma4agents
mcp/alice-vault/server.py
.py
4a97409783fe8432
7.48
8
"""The same UMA enforcement, hosted inside the resource instead of ahead of it. An MCP SDK 2.x `Extension` that carries the FedAuthz obligations in-process: `intercept_tool_call` is a short-circuiting hook at exactly the boundary the gateway deployment protects from outside, and it reaches its verdicts by calling the ...
nickgamb/uma4agents
mcp/alice-vault/uma_extension.py
.py
1893cb88489d25c7
7.48
8
"""Shared per-forward-pass metadata produced by framework adapters. Carved out as part of the unified-adaptor refactor (Phase 1). Every ``BackendAdapter.build_step_context`` returns one of these objects; the driver feeds it to ``RingTransport.set_step_context`` and ``RingTransport.pre_push_all_metas``. Today this is...
ProjectDMX/DMI
src/dmi/adapters/types.py
.py
7da94743a868dedd
7.66
20
"""Configuration helpers for DMI capture scheduling.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Literal @dataclass class CaptureSchedule: """Schedule for step-level and request-level capture.""" step_stride: int = 1 step_offset: int = 0 warmup_...
ProjectDMX/DMI
src/dmi/config.py
.py
062aced8dcf98c1d
7.66
20
"""Hook-to-native-producer dispatch and hook installation.""" from __future__ import annotations from collections.abc import Sequence from typing import Optional import torch from .specs import HookSpec def dispatch_producer( ring_payload: torch.Tensor, tensor: torch.Tensor, strip_tensor: Optional[tor...
ProjectDMX/DMI
src/dmi/hooks/dispatch.py
.py
338fc735fb7e97d8
7.66
20
"""CLI entry point for the hermes-agent ACP adapter. Loads environment variables from ``~/.hermes/.env``, configures logging to write to stderr (so stdout is reserved for ACP JSON-RPC transport), and starts the ACP agent server. Usage:: python -m acp_adapter.entry # or hermes acp # or hermes-acp ...
cyborg-garden/hermes-agent-mt
acp_adapter/entry.py
.py
f8c0a430671643e7
7.54
11
class SSLConfigurationError(Exception): """Raised when SSL/TLS certificate bundle configuration fails.""" pass class EmptyStreamError(RuntimeError): """Raised when a provider closes a stream without yielding a response.""" pass class MoAPresetNotFoundError(ValueError): """Raised when a persiste...
cyborg-garden/hermes-agent-mt
agent/errors.py
.py
237581ac4180cffe
7.04
11
"""Helpers for translating OpenAI-style tool schemas to Gemini's schema subset.""" from __future__ import annotations from typing import Any, Dict # Gemini's ``FunctionDeclaration.parameters`` field accepts the ``Schema`` # object, which is only a subset of OpenAPI 3.0 / JSON Schema. Strip fields # outside that sub...
cyborg-garden/hermes-agent-mt
agent/gemini_schema.py
.py
b995fce2570ffe0f
7.54
11
from __future__ import annotations import hashlib import json import re from pathlib import Path from typing import Any QUEUE_CONTRACT_VERSION = "queue.v2" MAX_ID_LENGTH = 240 MAX_CAPABILITY_LENGTH = 80 # Queue identifiers become single filesystem path components. Keep the portable # contract intentionally narrower...
philngt/afc-runtime
wo_runtime/core/validation.py
.py
4b3786cf2e0a6a6a
7.42
6
#!/usr/bin/env python """Emit a launch plan from runtime/fleet.json for `scripts/run.sh up`. Groups roles by their assigned runtime. Headless (supervisor-capable) runtimes get one supervisor covering all their roles; interactive runtimes get one AGENT line per replica. Output (TAB-separated), one directive per line: ...
philngt/afc-runtime
wo_runtime/runtime/fleet_plan.py
.py
761b2632338ea62d
7.42
6
#!/usr/bin/env python """Generic runtime-adapter wiring self-test (no model calls, no network). For every runtime descriptor in runtime/runtimes/ (or --runtime NAME), verifies: 1. descriptor shape (name, bin, kinds; supervisor => exec block); 2. interactive resolve.py emits BIN + role_env + ARGs (binary stubbed); ...
philngt/afc-runtime
wo_runtime/runtime/selftest.py
.py
4db76c2557e86306
7.92
6
"""File-level CSV read/write helpers. Row-level (`from_csv_row`) and dict flattening (`to_records`) are the building blocks; these wrap them for whole files, so a CSV on disk becomes a list of normalized events, and events or bars go back out to a tidy CSV. Standard library only. """ from __future__ import annotations...
Harvestgroup360/market-data-normalizer
src/mdnorm/csvio.py
.py
b7aea829eef2f8ca
7.42
6
"""NDJSON (JSON Lines) read/write helpers. CSV is fine for tabular hand-offs, but modern data stacks — log shippers, object stores, streaming loaders — speak newline-delimited JSON. These helpers mirror :mod:`mdnorm.csvio`: events and bars go out as one JSON object per line, and event files come back as normalized :cl...
Harvestgroup360/market-data-normalizer
src/mdnorm/jsonl.py
.py
ea45d876e59ccee8
7.42
6
"""Labels, and splitting a time series without letting the answer leak. Everything in :mod:`mdnorm.features` refuses to look forward. A label has to, because a label *is* the future: the thing you are trying to predict. That reversal is the whole difficulty of this module — the one series in a research dataset that is...
Harvestgroup360/market-data-normalizer
src/mdnorm/labels.py
.py
34b9feb96deacc9a
7.42
6
"""Venue-specific normalizers. Each function takes one raw record and returns a :class:`MarketEvent`. They are intentionally small and pure so they are trivial to test and reuse. """ from __future__ import annotations from decimal import Decimal from typing import Any, Mapping from .schema import EventType, MarketEv...
Harvestgroup360/market-data-normalizer
src/mdnorm/normalizers.py
.py
dc02a2cb100c4e1f
7.42
6
"""Flatten events and bars into plain dicts. The last mile of any pipeline is getting normalized objects into a DataFrame, a CSV writer, or a JSON payload. These helpers turn ``MarketEvent`` and ``Bar`` into flat, JSON-serialisable dicts. ``Decimal`` values are emitted as strings by default (lossless); pass ``as_float...
Harvestgroup360/market-data-normalizer
src/mdnorm/records.py
.py
c63e630643c48eab
7.42
6
"""Unified market-data schema. All venue-specific feeds are normalized into a single, exchange-agnostic representation so downstream research and execution code never has to care where a tick came from. """ from __future__ import annotations from dataclasses import dataclass from decimal import Decimal from enum impo...
Harvestgroup360/market-data-normalizer
src/mdnorm/schema.py
.py
ba396fa4f81dffee
7.42
6
"""Trading sessions and calendar filtering. Raw feeds run around the clock; research rarely should. Overnight prints, weekend maintenance windows and pre-market crossings all distort features that were meant to describe regular trading hours. A :class:`Session` describes a recurring local-time window — regular US equ...
Harvestgroup360/market-data-normalizer
src/mdnorm/sessions.py
.py
3719b3327f98df1f
7.42
6
"""Consolidate and clean up multiple event streams. Real setups pull from several venues and reconnect often, so you end up with interleaved feeds and replayed duplicates. These helpers merge streams into one chronological timeline and drop exact duplicate events. """ from __future__ import annotations from typing im...
Harvestgroup360/market-data-normalizer
src/mdnorm/streams.py
.py
7bea078522bc163f
7.42
6
"""Canonical symbol normalization. Venues spell the same instrument in many ways (``BTCUSDT``, ``XBTUSD``, ``btc_usd``). Traded pairs are mapped to a single canonical ``BASE-QUOTE`` form. Single-listed instruments — equities, ETFs, indices — have no quote leg and keep their plain ticker (``AAPL``, ``SPY``, ``BRK.B``)....
Harvestgroup360/market-data-normalizer
src/mdnorm/symbols.py
.py
8fa9893235b98bee
7.42
6
"""Timestamp parsing helpers. Everything is normalized to integer nanoseconds since the Unix epoch (UTC). """ from __future__ import annotations from datetime import datetime, timezone _NS_PER_S = 1_000_000_000 def epoch_to_ns(value: float | int, unit: str = "s") -> int: """Convert an epoch timestamp expressed...
Harvestgroup360/market-data-normalizer
src/mdnorm/timeutil.py
.py
315bfad5e1e04d66
7.42
6
"""实时双语字幕 GUI 应用(Windows 主入口)。 把 ASR + 翻译流水线放后台线程,字幕推到透明悬浮窗显示。 音频源默认 WASAPI loopback(系统声音);用 --input 可改成文件(便于在任意平台预览 UI)。 运行(Windows): pip install PySide6 pyaudiowpatch set DEEPSEEK_API_KEY=你的key python app.py # 抓系统声音 python app.py --input demo.mp4 # 用文件预览 """ from __future__...
superLin006/LiveBabel
app.py
.py
d56d162da3c2da53
7.42
6
"""两遍 ASR 引擎。 Pass1(流式 zipformer):每帧解码,产出会变动的 volatile 文本,并负责 endpoint 检测。 Pass2(非流式 Qwen3-ASR):endpoint 触发时,对该句缓存的音频复识一次, 得到更准、不抖的定稿文本。 对外只暴露三件事: feed(samples) 喂一帧音频 poll() -> Event 拿当前状态:文本更新 / 句子结束(committed) 内部维护"当前句"的音频缓冲,以便 commit 时交给 Pass2。 """ from __future__ impor...
superLin006/LiveBabel
livebabel/asr/asr_engine.py
.py
9139fd20bfef1a7a
7.42
6
"""音频输入层抽象。 设计目标:把"音频从哪来"和"怎么处理"彻底解耦。 现在(WSL)用文件源验证逻辑;以后(Windows)只需新增一个 WasapiLoopbackSource 实现同样的接口,主流程一行不用改。 所有源统一输出:16kHz、单声道、float32、[-1,1] 的 PCM 块(numpy array)。 """ from __future__ import annotations import subprocess import time from abc import ABC, abstractmethod from typing import Iterator import numpy as ...
superLin006/LiveBabel
livebabel/asr/audio_source.py
.py
b5867ff300ae158d
7.42
6
"""麦克风输入采集(会议模式用,代表"我")。 与 WasapiLoopbackSource 同接口(frames() 产出 16k mono float32 块),但抓的是 默认输入设备(麦克风),不是 loopback。会议模式里: * 麦克风流 = 本机用户("我") * 系统声音 loopback = 远端所有人 两路各跑一套 ASR,转录按来源标上说话人,实现无需 torch 的"我/远端"区分。 依赖 pyaudiowpatch(Windows);普通 PyAudio 也兼容,这里统一用 pyaudiowpatch。 """ from __future__ import annotations impo...
superLin006/LiveBabel
livebabel/asr/audio_source_mic.py
.py
f4b0861fb40c9a20
7.42
6
"""Windows 系统声音采集(WASAPI loopback)。 抓"扬声器/耳机正在播放的声音"——无论来自视频播放器、浏览器、会议软件都行。 依赖 pyaudiowpatch(PyAudio 的 WASAPI loopback 分支),只能在 Windows 上跑: pip install pyaudiowpatch 设计目标: * 启动时正确抓到【当前默认输出设备】的声音。 * 在不同电脑上通用(设备数量/型号/是否有同名设备都能处理)。 * 输出与 FileSource 一致:16kHz mono float32 块,主流程不用改。 不做运行中自动切换设备(简单可靠优先)。切了输出设备请重启...
superLin006/LiveBabel
livebabel/asr/audio_source_windows.py
.py
01b160f18166bd9e
7.42
6
"""Qwen3-ASR ONNX model file selection. The application uses Qwen3-ASR for Pass2 re-recognition and offline subtitle transcription. This module keeps provider-specific file selection in one place without carrying an experimental Qwen streaming implementation. """ from __future__ import annotations import os def q...
superLin006/LiveBabel
livebabel/asr/qwen3_model.py
.py
2abd7e7118685d18
7.42
6
"""翻译层:DeepSeek API。 只翻译已定稿(committed)的句子。要点: * 异步:放后台线程跑,不阻塞 ASR 主循环。 * 带上下文:把最近几句已译内容作为上下文,保证术语/代词一致、措辞连贯。 * 缓存:相同原文不重复请求,省钱省延迟。 * 优雅降级:没有 API key 或请求失败时,返回占位串,不影响晃动验证。 key 从环境变量 DEEPSEEK_API_KEY 读,绝不硬编码。 """ from __future__ import annotations import os import queue import threading from collections impor...
superLin006/LiveBabel
livebabel/core/translator.py
.py
02fb9d41554fc24e
7.42
6
"""全局热键监听:按住说话,松开结束。Windows 用 keyboard。 回调: on_start() —— 右 Ctrl 按下后开始听写 on_stop() —— 右 Ctrl 松开后结束听写 默认热键为键盘右侧 Ctrl: * 按住右 Ctrl:开始录音和识别。 * 松开右 Ctrl:结束录音并输出最终文字。 注意:keyboard 在 Linux 需 root(WSL 无效),Windows 普通权限可用。 监听回调在 keyboard 的内部线程,务必只发信号、不做重活。 """ from __future__ import annotations import sys import thr...
superLin006/LiveBabel
livebabel/dictation/hotkey.py
.py
d996001b74e25107
7.42
6
"""把文字注入当前焦点输入框。平台抽象,Windows 先行。 两种方式: * paste: 写系统剪贴板 → 模拟 Ctrl+V → 恢复原剪贴板。中文最稳,默认。 * type : 逐字键入(keyboard.write)。不污染剪贴板,但中文/特殊字符易错,备选。 注入靠模拟按键 → 必须有真实桌面(WSL 无效)。Windows 用 keyboard; macOS 后续用 pynput(需辅助功能权限)。 """ from __future__ import annotations import sys import time _IS_WIN = sys.platform.startswith("win"...
superLin006/LiveBabel
livebabel/dictation/injector.py
.py
a4f1feb948949bfe
7.42
6
"""听写服务编排:热键 → 两阶段识别(草稿浮窗) → 松开定稿注入。 线程模型(关键): * keyboard 钩子回调在 keyboard 的内部线程,**只能发信号**,不能在那儿做 剪贴板/Qt/注入操作 —— Windows OLE 剪贴板需主线程 COM 上下文,否则 OleSetClipboard 报 CoInitialize 未调用。 * 用内部信号 _reqStart/_reqStop 以 QueuedConnection 投递到 Qt 主线程; 开始录音在主线程触发,结束后的识别在后台线程执行,最终注入回到主线程。 * engine 内部的采集/识别仍在它自己的工作线程;草...
superLin006/LiveBabel
livebabel/dictation/service.py
.py
c401b99409540981
7.42
6
"""定位 ffmpeg 可执行文件,并给出友好报错。 查找顺序: 1. 环境变量 LIVEBABEL_FFMPEG 指定的完整路径 2. 项目根的 ffmpeg/ 目录(ffmpeg[.exe]),方便随项目分发、不用配 PATH 3. 系统 PATH 里的 ffmpeg 找不到时抛出带安装指引的清晰错误,而不是看不懂的 WinError 2。 """ from __future__ import annotations import os import shutil import subprocess import sys from livebabel.paths import res def run_...
superLin006/LiveBabel
livebabel/ffmpeg_tool.py
.py
9da49a7315ab79eb
7.42
6
"""字幕历史记录:每次运行把最终定稿字幕自动存成 .srt + .txt,方便事后查看。 * .srt:带时间轴的标准双语字幕(原文一行、译文一行),可配视频或用播放器打开。 * .txt:原文/译文对照纯文本,方便快速翻阅、复制。 只记录"最终(committed 且非 provisional)"字幕。临时译文不写入历史。 文件按启动时间命名,存到 history/ 目录。增量写入(每来一条就落盘), 程序中途退出也不丢内容。 """ from __future__ import annotations import os import time from datetime import datetime fro...
superLin006/LiveBabel
livebabel/history_writer.py
.py
c119a14b81e6047b
7.42
6
"""离线说话人分离(声纹聚类)。 会议结束后对某一路(通常"远端")整段音频做声纹聚类,细分成"发言人1/2/3…"。 实现:VAD 切语音段 → sherpa speaker-embedding 逐段提声纹 → 球面 K-means 聚类。 不用 sherpa 内置的 OfflineSpeakerDiarization——实测它对中文多人对话会把清晰可分的 段全压成一个人(282:23)。改用「逐段 embedding + 自家 K-means」:实测同一人句内聚 0.7+、不同人 0.15~0.35,K-means(cosine 质心)能稳定分开,凝聚聚类则因雪球效应失败。 纯 ONNX + numpy,不依赖 torc...
superLin006/LiveBabel
livebabel/meeting/diarize.py
.py
f80e48f020e6eff5
7.42
6