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.
Replace manual process management with systemctl --user commands.
Uses ollama.service and llama-server.service units for proper lifecycle
management, VRAM cleanup, and integration with system services.
Track PIDs of backends started by /backend command and only kill those
specific PIDs. Previous implementation used pkill which would kill all
Ollama/llama-server processes including those started by the user or
systemd services. Now we only terminate processes we started.
- Add local_providers with ollama and llamacpp configurations
- /backend command now stops current daemon before starting new one
- Start backends as detached processes to avoid blocking TUI
- Wait 500ms for daemon to initialize before switching