mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
Adds a new authentication provider that lets SuperGrok subscribers sign in to Hermes with their xAI account via the standard OAuth 2.0 PKCE loopback flow, instead of pasting a raw API key from console.x.ai. Highlights ---------- * OAuth 2.0 PKCE loopback login against accounts.x.ai with discovery, state/nonce, and a strict CORS-origin allowlist on the callback. * Authorize URL carries `plan=generic` (required for non-allowlisted loopback clients) and `referrer=hermes-agent` for best-effort attribution in xAI's OAuth server logs. * Token storage in `auth.json` with file-locked atomic writes; JWT `exp`-based expiry detection with skew; refresh-token rotation synced both ways between the singleton store and the credential pool so multi-process / multi-profile setups don't tear each other's refresh tokens. * Reactive 401 retry: on a 401 from the xAI Responses API, the agent refreshes the token, swaps it back into `self.api_key`, and retries the call once. Guarded against silent account swaps when the active key was sourced from a different (manual) pool entry. * Auxiliary tasks (curator, vision, embeddings, etc.) route through a dedicated xAI Responses-mode auxiliary client instead of falling back to OpenRouter billing. * Direct HTTP tools (`tools/xai_http.py`, transcription, TTS, image-gen plugin) resolve credentials through a unified runtime → singleton → env-var fallback chain so xai-oauth users get them for free. * `hermes auth add xai-oauth` and `hermes auth remove xai-oauth N` are wired through the standard auth-commands surface; remove cleans up the singleton loopback_pkce entry so it doesn't silently reinstate. * `hermes model` provider picker shows "xAI Grok OAuth (SuperGrok Subscription)" and the model-flow falls back to pool credentials when the singleton is missing. Hardening --------- * Discovery and refresh responses validate the returned `token_endpoint` host against the same `*.x.ai` allowlist as the authorization endpoint, blocking MITM persistence of a hostile endpoint. * Discovery / refresh / token-exchange `response.json()` calls are wrapped to raise typed `AuthError` on malformed bodies (captive portals, proxy error pages) instead of leaking JSONDecodeError tracebacks. * `prompt_cache_key` is routed through `extra_body` on the codex transport (sending it as a top-level kwarg trips xAI's SDK with a TypeError). * Credential-pool sync-back preserves `active_provider` so refreshing an OAuth entry doesn't silently flip the active provider out from under the running agent. Testing ------- * New `tests/hermes_cli/test_auth_xai_oauth_provider.py` (~63 tests) covers JWT expiry, OAuth URL params (plan + referrer), CORS origins, redirect URI validation, singleton↔pool sync, concurrency races, refresh error paths, runtime resolution, and malformed-JSON guards. * Extended `test_credential_pool.py`, `test_codex_transport.py`, and `test_run_agent_codex_responses.py` cover the pool sync-back, `extra_body` routing, and 401 reactive refresh paths. * 165 tests passing on this branch via `scripts/run_tests.sh`.
267 lines
8.1 KiB
TypeScript
267 lines
8.1 KiB
TypeScript
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
|
|
|
const sidebars: SidebarsConfig = {
|
|
docs: [
|
|
'user-stories',
|
|
{
|
|
type: 'category',
|
|
label: 'Getting Started',
|
|
collapsed: true,
|
|
items: [
|
|
'getting-started/quickstart',
|
|
'getting-started/installation',
|
|
'getting-started/termux',
|
|
'getting-started/nix-setup',
|
|
'getting-started/updating',
|
|
'getting-started/learning-path',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Using Hermes',
|
|
collapsed: true,
|
|
items: [
|
|
'user-guide/cli',
|
|
'user-guide/tui',
|
|
'user-guide/windows-native',
|
|
'user-guide/windows-wsl-quickstart',
|
|
'user-guide/configuration',
|
|
'user-guide/configuring-models',
|
|
'user-guide/sessions',
|
|
'user-guide/profiles',
|
|
'user-guide/profile-distributions',
|
|
'user-guide/git-worktrees',
|
|
'user-guide/docker',
|
|
'user-guide/security',
|
|
'user-guide/checkpoints-and-rollback',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Features',
|
|
collapsed: true,
|
|
items: [
|
|
'user-guide/features/overview',
|
|
'user-guide/features/tool-gateway',
|
|
{
|
|
type: 'category',
|
|
label: 'Core',
|
|
items: [
|
|
'user-guide/features/tools',
|
|
'user-guide/features/skills',
|
|
'user-guide/features/lsp',
|
|
'user-guide/features/curator',
|
|
'user-guide/features/memory',
|
|
'user-guide/features/memory-providers',
|
|
'user-guide/features/context-files',
|
|
'user-guide/features/context-references',
|
|
'user-guide/features/personality',
|
|
'user-guide/features/skins',
|
|
'user-guide/features/plugins',
|
|
'user-guide/features/built-in-plugins',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Automation',
|
|
items: [
|
|
'user-guide/features/cron',
|
|
'user-guide/features/delegation',
|
|
'user-guide/features/kanban',
|
|
'user-guide/features/codex-app-server-runtime',
|
|
'user-guide/features/kanban-tutorial',
|
|
'user-guide/features/kanban-worker-lanes',
|
|
'user-guide/features/goals',
|
|
'user-guide/features/code-execution',
|
|
'user-guide/features/hooks',
|
|
'user-guide/features/batch-processing',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Media & Web',
|
|
items: [
|
|
'user-guide/features/voice-mode',
|
|
'user-guide/features/web-search',
|
|
'user-guide/features/browser',
|
|
'user-guide/features/computer-use',
|
|
'user-guide/features/vision',
|
|
'user-guide/features/image-generation',
|
|
'user-guide/features/tts',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Management',
|
|
items: [
|
|
'user-guide/features/web-dashboard',
|
|
'user-guide/features/extending-the-dashboard',
|
|
'user-guide/features/subscription-proxy',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Advanced',
|
|
items: [
|
|
'user-guide/features/spotify',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Skills',
|
|
collapsed: true,
|
|
items: [
|
|
'reference/skills-catalog',
|
|
'reference/optional-skills-catalog',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Messaging Platforms',
|
|
collapsed: true,
|
|
items: [
|
|
'user-guide/messaging/index',
|
|
'user-guide/messaging/telegram',
|
|
'user-guide/messaging/discord',
|
|
'user-guide/messaging/slack',
|
|
'user-guide/messaging/whatsapp',
|
|
'user-guide/messaging/signal',
|
|
'user-guide/messaging/email',
|
|
'user-guide/messaging/sms',
|
|
'user-guide/messaging/homeassistant',
|
|
'user-guide/messaging/mattermost',
|
|
'user-guide/messaging/matrix',
|
|
'user-guide/messaging/dingtalk',
|
|
'user-guide/messaging/feishu',
|
|
'user-guide/messaging/wecom',
|
|
'user-guide/messaging/wecom-callback',
|
|
'user-guide/messaging/weixin',
|
|
'user-guide/messaging/bluebubbles',
|
|
'user-guide/messaging/qqbot',
|
|
'user-guide/messaging/yuanbao',
|
|
'user-guide/messaging/teams',
|
|
'user-guide/messaging/teams-meetings',
|
|
'user-guide/messaging/msgraph-webhook',
|
|
'user-guide/messaging/line',
|
|
'user-guide/messaging/simplex',
|
|
'user-guide/messaging/open-webui',
|
|
'user-guide/messaging/webhooks',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Integrations',
|
|
collapsed: true,
|
|
items: [
|
|
'integrations/index',
|
|
'integrations/providers',
|
|
'user-guide/features/mcp',
|
|
'user-guide/features/acp',
|
|
'user-guide/features/api-server',
|
|
'user-guide/features/honcho',
|
|
'user-guide/features/provider-routing',
|
|
'user-guide/features/fallback-providers',
|
|
'user-guide/features/credential-pools',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Guides & Tutorials',
|
|
collapsed: true,
|
|
items: [
|
|
'guides/tips',
|
|
'guides/local-llm-on-mac',
|
|
'guides/daily-briefing-bot',
|
|
'guides/team-telegram-assistant',
|
|
'guides/python-library',
|
|
'guides/use-mcp-with-hermes',
|
|
'guides/use-soul-with-hermes',
|
|
'guides/use-voice-mode-with-hermes',
|
|
'guides/build-a-hermes-plugin',
|
|
'guides/automate-with-cron',
|
|
'guides/cron-script-only',
|
|
'guides/automation-templates',
|
|
'guides/cron-troubleshooting',
|
|
'guides/work-with-skills',
|
|
'guides/delegation-patterns',
|
|
'guides/github-pr-review-agent',
|
|
'guides/webhook-github-pr-review',
|
|
'guides/migrate-from-openclaw',
|
|
'guides/aws-bedrock',
|
|
'guides/azure-foundry',
|
|
'guides/xai-grok-oauth',
|
|
'guides/microsoft-graph-app-registration',
|
|
'guides/operate-teams-meeting-pipeline',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Developer Guide',
|
|
collapsed: true,
|
|
items: [
|
|
'developer-guide/contributing',
|
|
{
|
|
type: 'category',
|
|
label: 'Architecture',
|
|
items: [
|
|
'developer-guide/architecture',
|
|
'developer-guide/agent-loop',
|
|
'developer-guide/prompt-assembly',
|
|
'developer-guide/context-compression-and-caching',
|
|
'developer-guide/gateway-internals',
|
|
'developer-guide/session-storage',
|
|
'developer-guide/provider-runtime',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Extending',
|
|
items: [
|
|
'developer-guide/adding-tools',
|
|
'developer-guide/adding-providers',
|
|
'developer-guide/adding-platform-adapters',
|
|
'developer-guide/memory-provider-plugin',
|
|
'developer-guide/context-engine-plugin',
|
|
'developer-guide/model-provider-plugin',
|
|
'developer-guide/image-gen-provider-plugin',
|
|
'developer-guide/video-gen-provider-plugin',
|
|
'developer-guide/plugin-llm-access',
|
|
'developer-guide/creating-skills',
|
|
'developer-guide/extending-the-cli',
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Internals',
|
|
items: [
|
|
'developer-guide/tools-runtime',
|
|
'developer-guide/acp-internals',
|
|
'developer-guide/cron-internals',
|
|
'developer-guide/trajectory-format',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'Reference',
|
|
items: [
|
|
'reference/cli-commands',
|
|
'reference/slash-commands',
|
|
'reference/profile-commands',
|
|
'reference/environment-variables',
|
|
'reference/tools-reference',
|
|
'reference/toolsets-reference',
|
|
'reference/mcp-config-reference',
|
|
'reference/model-catalog',
|
|
'reference/skills-catalog',
|
|
'reference/optional-skills-catalog',
|
|
'reference/faq',
|
|
],
|
|
},
|
|
],
|
|
};
|
|
|
|
export default sidebars;
|