provider-onboarding
БесплатноБез исполняемых скриптовНе проверенRules, checklist, credential selection machinery, multi-source handover, delegated refresh contract, and test discipline for onboarding new quota providers or…
от kunchenguid★ 182 звезды на GitHubОб этом скилле
Provider Onboarding & Credential Architecture
This document defines the requirements, shared machinery, and safety invariants for onboarding new quota providers or modifying existing adapters in quota-axi.
Clean-Room & Dependency Policy
- Clean-room implementation: Adapter behavior (retry-after handling, snake/camel field tolerance, window parsing) must be an original implementation derived solely from the vendor's own HTTP/OAuth behavior. quota-axi carries no vendored third-party adapter code. The Z.AI adapter is the single attribution exception (derived from opencode-glm-quota, MIT) credited in
src/providers/zai.ts. - HTTP & proxy handling: Remote HTTP requests must route through
src/lib/http.ts(providerFetch) so standardHTTP_PROXY,HTTPS_PROXY, andNO_PROXYpolicies apply consistently without leaking proxy credentials in logs. Do not use globalfetchdirectly.- Node 26 compatibility:
src/lib/http.tspairs the installedundicibuild'sProxyAgentwith that same build'sfetchbecause Node's built-in global fetch only accepts dispatchers from its bundledundici, and Node 26 rejects externalProxyAgentinstances withInvalidArgumentError: invalid onError method.
- Node 26 compatibility:
- Process table reads: Any process-table inspection (e.g. Antigravity loopback detection or Claude process checks) must route through
currentUserProcessListArgsinsrc/lib/process.tsto handle platform flag differences portably (Linux procps rejects BSD-xalongside-u).
Provider Onboarding Checklist
When adding a new provider or migrating an existing adapter:
Enumerate every source in ownership-stability order:
- Declare source priority via a named constant (e.g.
COPILOT_SOURCE_ORDER). - Distinguish
absent,structurally_invalid,unsupported,read_error, andresolved(stored-validorstored-expired) at the typed local resolution boundary. - Route Pi agent entries through
classifyPiAuthEntryinsrc/lib/pi-auth-store.ts. - Derive
credentialPresentonce from local resolution rather than ad hoc at call sites.
- Declare source priority via a named constant (e.g.
Separate local resolution from the bounded read-only liveness probe:
- Enroll stored-expired credentials instead of skipping them.
- Never infer liveness from presence alone.
- Classify probe outcomes as
usable,live_no_quota,definitively_rejected, ortransient. - Only a first-party HTTP 401 or 403 is an authentication verdict. Server errors, rate limits, network timeouts, or schema mismatches are request failures, not auth verdicts.
Handover only after definitive credential failure:
- An absent source is never marked degraded.
- A present-but-broken source superseded by a working sibling is marked degraded on fresh readings only (
state.degradedSources). - Stale means last-known cache.
- Never exchange a refresh token, and never retain, log, render, cache, or send its value. Delegated refresh checks presence only; Pi brokers may read a stored refresh value only to classify it as a usable literal, then discard it.
Add comprehensive adapter regression tests:
- Test cases: primary healthy, stored-expired plus live sibling, structurally invalid present, absent source, all rejected, refreshable expired, and transient failure stops handover.
- Extend the cross-provider invariant table in
test/credential-contract.test.ts.
Credential Selection Machinery
Credential selection is shared in src/providers/credential-selection.ts:
- Advisory stored expiry: Stored
expiresAtorexpiredfields are advisory only within a source, never a verdict or a reason to reorder declared sources. - Empirical testing: Stored-expired credentials are tested in that source's fixed priority position before any sign-in or expired verdict. An empirically live credential always wins.
- Transient failures: Network errors, 5xx responses, or timeouts must never switch candidates within one source or become auth verdicts.
- Adapters using selection: Grok, Codex, Kimi, Command Code, Copilot, OpenCode Go, Devin, and Muse route through
selectCredential. Codex, Kimi, Copilot, and Devin call it once per source so each provider's ownership-stability order remains authoritative. - Probe token safety: A broker's
expiredresolution carries the stored token for probe use only; it must never be logged, cached, or rendered. - Profile-only mode:
--profile-onlyis the fail-closed single-account quota probe for Claude and Codex: it requiresCLAUDE_CONFIG_DIRorCODEX_HOME, reads only that profile's native credential file, and bypasses alternate sources, delegated refresh, and quota cache access (full JSON keeps non-secret account/source/attempt evidence; ordinary output stays redacted). Omitting the flag must preserve legacy discovery and cache behavior. Contract: README Profile-only quota reads.
Multi-Source Handover & Degrade
Установить provider-onboarding в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл provider-onboarding?
Rules, checklist, credential selection machinery, multi-source handover, delegated refresh contract, and test discipline for onboarding new quota providers or modifying existing provider adapters in quota-axi.
Как установить скилл provider-onboarding?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл provider-onboarding запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic