← 返回
未分类 中文

Nm Leyline Service Registry

Service registry patterns for managing external services, health checks, centralized configuration, and unified execution
注册外部服务,支持健康检查、集中配置和统一执行。
athola athola 来源
未分类 clawhub v1.9.14 5 版本 100000 Key: 无需
★ 0
Stars
📥 380
下载
💾 1
安装
5
版本
#latest

概述

> Night Market Skill — ported from claude-night-market/leyline. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

Table of Contents

Service Registry

Overview

A registry pattern for managing connections to external services. Handles configuration, health checking, and execution across multiple service integrations.

When To Use

  • Managing multiple external services.
  • Need consistent execution interface.
  • Want health monitoring across services.
  • Building service failover logic.

When NOT To Use

  • Single service integration without registry needs

Core Concepts

Service Configuration

@dataclass
class ServiceConfig:
    name: str
    command: str
    auth_method: str  # "api_key", "oauth", "token"
    auth_env_var: str
    quota_limits: dict
    models: list[str] = field(default_factory=list)

Verification: Run the command with --help flag to verify availability.

Execution Result

@dataclass
class ExecutionResult:
    success: bool
    stdout: str
    stderr: str
    exit_code: int
    duration: float
    tokens_used: int

Verification: Run the command with --help flag to verify availability.

Quick Start

Register Services

from leyline.service_registry import ServiceRegistry

registry = ServiceRegistry()

registry.register("gemini", ServiceConfig(
    name="gemini",
    command="gemini",
    auth_method="api_key",
    auth_env_var="GEMINI_API_KEY",
    quota_limits={"rpm": 60, "daily": 1000}
))

Verification: Run the command with --help flag to verify availability.

Execute via Service

result = registry.execute(
    service="gemini",
    prompt="Analyze this code",
    files=["src/main.py"],
    model="gemini-2.5-pro"
)

if result.success:
    print(result.stdout)

Verification: Run the command with --help flag to verify availability.

Health Checks

# Check single service
status = registry.health_check("gemini")

# Check all services
all_status = registry.health_check_all()
for service, healthy in all_status.items():
    print(f"{service}: {'OK' if healthy else 'FAILED'}")

Verification: Run the command with --help flag to verify availability.

Service Selection

Auto-Selection

# Select best service for task
service = registry.select_service(
    requirements={
        "large_context": True,
        "fast_response": False
    }
)

Verification: Run the command with --help flag to verify availability.

Failover Pattern

def execute_with_failover(prompt: str, files: list) -> ExecutionResult:
    for service in registry.get_healthy_services():
        result = registry.execute(service, prompt, files)
        if result.success:
            return result
    raise AllServicesFailedError()

Verification: Run the command with --help flag to verify availability.

Integration Pattern

# In your skill's frontmatter
dependencies: [leyline:service-registry]

Verification: Run the command with --help flag to verify availability.

Detailed Resources

  • Service Config: See modules/service-config.md for configuration options.
  • Execution Patterns: See modules/execution-patterns.md for advanced usage.

Exit Criteria

  • Services registered with configuration.
  • Health checks passing.
  • Execution results properly handled.

版本历史

共 5 个版本

  • v1.9.14 当前
    2026-07-02 08:58
  • v1.9.13
    2026-06-30 17:11 安全 安全
  • v1.9.12
    2026-06-19 20:08 安全 安全
  • v1.0.2
    2026-05-09 16:47 安全 安全
  • v1.0.1
    2026-05-07 19:32 安全 安全

安全检测

腾讯云安全 (Keen)

队列中

腾讯云安全 (Sanbu)

队列中

🔗 相关推荐

it-ops-security

Free Ride - Unlimited free AI

shaivpidadi
管理OpenClaw的OpenRouter免费AI模型,自动按质量排名模型,配置速率限制备用方案,并更新opencla...
★ 472 📥 78,743
dev-programming

Nm Parseltongue Python Performance

athola
分析 Python 代码的性能瓶颈和内存问题
★ 0 📥 882
it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,955