Implement first-class Z.AI credential storage and authentication:
- New auth provider: src/auth/zai.ts for Z.AI API key management
- New CLI command: flynn zai-auth to store Z.AI API keys
- New TUI command: /login zai for interactive credential entry
- Modified src/auth/index.ts to register zai provider
- Modified src/cli/index.ts to register zai-auth command
- Modified src/cli/setup/providers.ts to include Z.AI in setup wizard
- Modified src/daemon/models.ts to support zhipuai use_oauth flag
- Modified src/daemon/clientFactory.test.ts to add Z.AI tests
- Modified src/frontends/tui/commands.ts to add login command
- Modified src/frontends/tui/minimal.ts to support credential prompts
This allows users to authenticate with Z.AI (GLM models) without
embedding secrets in config files. Credentials are stored securely in
~/.config/flynn/auth.json and resolved at runtime.
Updated state.json with new feature entry documenting the integration.
This commit adds 6 new documentation files to fill critical gaps:
- CONTRIBUTING.md: Developer onboarding guide with setup, workflow,
code style, testing, and adding features
- TROUBLESHOOTING.md: Common issues and solutions for errors,
model issues, tool issues, channel issues, gateway issues,
configuration issues, and memory/database issues
- docs/api/PROTOCOL.md: Gateway JSON-RPC protocol documentation
with connection, authentication, message format, methods,
events, error codes, and example client implementation
- docs/api/TOOLS.md: Tools API documentation covering tool interface,
input schema format, result format, tool patterns,
tool registration, tool policy, execution flow, and
builtin tools reference
- docs/deployment/PRODUCTION.md: Production deployment guide
covering Docker deployment, systemd service, security,
configuration, monitoring, backup & recovery, and
performance tuning
- docs/performance/TUNING.md: Performance optimization guide
covering context management, model routing, tool execution,
memory & embeddings, session management, database
performance, gateway performance, and resource usage
These files complement the existing excellent documentation
(README.md, AGENTS.md, ARCHITECTURE.md, STRUCTURE.md,
CONVENTIONS.md) to provide complete coverage for users,
developers, and operators.
Store per-session config in SQLite and route /model and /reset through command fast-paths so channel sessions keep independent model selection across reconnects and restarts.