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.
Add runtime truthfulness modes and autonomy-level tool gating with audit metadata for overrides/denials.
Wire policy through prompt assembly, tool execution context, and daemon/gateway agent paths; update tests and planning state for Phase 3 PR #2 completion.
- Add session_config SQLite table for per-session settings
- Update routing to support session override → agent config → global default resolution chain
- Upgrade WebChat SessionBridge from NativeAgent to AgentOrchestrator
- Add /model, /local, /cloud commands to Telegram adapter
- Add /model command to WebChat gateway handlers
- Clear session overrides on /reset command
- Pass memoryStore and config through to SessionBridge
- Add comprehensive tests for all new functionality
Fixes model persistence bug where TUI model changes didn't affect WebChat/Telegram sessions. Now:
- TUI /model sets global default (persists across restarts, affects all new sessions)
- WebChat/Telegram /model sets session override (only that conversation, cleared on /reset)
- WebChat sessions gain AgentOrchestrator features (delegation, compaction, memory)