feat(models): add Z.AI (GLM) credential integration and setup flow

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 is contained in:
William Valentin
2026-02-13 16:23:49 -08:00
parent 8a6cd7f559
commit 7df0569a39
10 changed files with 271 additions and 4 deletions
+20
View File
@@ -777,6 +777,26 @@
],
"test_status": "pnpm typecheck + pnpm test:run passing"
},
"zai-glm-4.7-credential-integration": {
"status": "completed",
"date": "2026-02-13",
"summary": "Added first-class Z.AI (GLM) credential storage and setup flow. Z.AI authenticates via API keys (HTTP Bearer), so Flynn now supports `flynn zai-auth` to store the key in ~/.config/flynn/auth.json, `/login zai` in the minimal TUI, and `use_oauth: true` for the zhipuai provider to resolve credentials from the auth store (or env) without embedding secrets in config.",
"files_created": [
"src/auth/zai.ts",
"src/cli/zai-auth.ts"
],
"files_modified": [
"src/auth/index.ts",
"src/cli/index.ts",
"src/cli/setup/providers.ts",
"src/daemon/models.ts",
"src/daemon/clientFactory.test.ts",
"src/frontends/tui/minimal.ts",
"src/frontends/tui/commands.ts"
],
"test_status": "pnpm build + pnpm typecheck + pnpm test:run passing"
},
"runtime-context-awareness": {
"status": "completed",
"date": "2026-02-07",