|
15 | 15 | ### 2. Signatures |
16 | 16 |
|
17 | 17 | - Direct run: |
18 | | - - `uv run --script ai/coding/window-warmer/window_warmer.py --config ai/coding/window-warmer/window-warmer.toml` |
19 | | - - `uv run --script ai/coding/window-warmer/window_warmer.py --config ai/coding/window-warmer/window-warmer.toml --print-next` |
20 | | - - `uv run --script ai/coding/window-warmer/window_warmer.py --config ai/coding/window-warmer/window-warmer.toml --once --dry-run` |
| 18 | + - From `ai/coding/window-warmer`: `uv run python window_warmer.py --config window-warmer.toml` |
| 19 | + - From `ai/coding/window-warmer`: `uv run python window_warmer.py --config window-warmer.toml --print-next` |
| 20 | + - From `ai/coding/window-warmer`: `uv run python window_warmer.py --config window-warmer.toml --once --dry-run` |
21 | 21 | - PM2: |
22 | 22 | - `pm2 start ai/coding/window-warmer/window-warmer.pm2.config.cjs` |
23 | 23 | - PM2 app name: `coding-window-warmer` |
24 | 24 | - Python script: |
25 | 25 | - Entry file: `ai/coding/window-warmer/window_warmer.py` |
26 | | - - Dependency declaration: PEP 723 script metadata with `litellm>=1.81.0` |
| 26 | + - Dependency declaration: `ai/coding/window-warmer/pyproject.toml` |
| 27 | + - Locked dependencies: `ai/coding/window-warmer/uv.lock` |
27 | 28 | - Helper package: `ai/coding/window-warmer/window_warmer_lib/` |
28 | 29 |
|
29 | 30 | ### 3. Contracts |
|
33 | 34 | - `base_url`: direct upstream OpenAI-compatible API base URL. Default points to `https://open.bigmodel.cn/api/coding/paas/v4`, not local LiteLLM Proxy. |
34 | 35 | - `container_name`: optional local Docker readiness gate. When set to `litellm`, it only proves the local gateway container is running; it must not change the warm request destination. |
35 | 36 | - `api_key_env`: optional environment variable for upstream API key. Default for Z.ai Coding Plan is `Z_AI_API_KEY`. |
36 | | - - `env_file`: optional dotenv-style file path, resolved relative to the TOML file. |
| 37 | + - `env_file`: optional dotenv file path, resolved relative to the TOML file. Default is `.env.local` in the warmer directory. |
37 | 38 | - `health_path`: optional direct target health path. Default is `/models`. |
38 | 39 | - `request_timeout_seconds`: timeout used by health check and LiteLLM SDK completion. |
39 | 40 | - Plan config `[[plans]]`: |
|
65 | 66 | ### 5. Good/Base/Bad Cases |
66 | 67 |
|
67 | 68 | - Good: Default config checks optional local `litellm` container but sends `openai/GLM-5.1` to `https://open.bigmodel.cn/api/coding/paas/v4` through LiteLLM SDK. |
68 | | -- Good: `uv run --script` handles LiteLLM SDK dependency without creating repo-level `requirements.txt`, `pyproject.toml`, or a committed virtual environment. |
| 69 | +- Good: `uv add litellm` records the direct dependency in tool-local `pyproject.toml` and locks it in `uv.lock`; `uv run` syncs the environment before execution. |
| 70 | +- Good: Put real API keys in ignored `.env.local`; commit only `.env.example`. |
69 | 71 | - Good: Time calculation is pure and unit-tested separately from HTTP/LiteLLM SDK calls. |
70 | 72 | - Base: `fixed_times = ["08:00", "13:00", "18:00", "23:00"]` with `jitter_seconds = 120` schedules each event within two minutes after the base time. |
71 | 73 | - Bad: Pointing `[target].base_url` at `http://127.0.0.1:34000` for default GLM warmup, because the request can enter LiteLLM Proxy fallback chains. |
|
85 | 87 | - prompt, max tokens, temperature and timeout are passed. |
86 | 88 | - Dry-run test asserting readiness checks are skipped. |
87 | 89 | - Smoke commands: |
88 | | - - `uv run --script ai/coding/window-warmer/window_warmer.py --config ai/coding/window-warmer/window-warmer.toml --print-next` |
89 | | - - `uv run --script ai/coding/window-warmer/window_warmer.py --config ai/coding/window-warmer/window-warmer.toml --once --dry-run` |
| 90 | + - From `ai/coding/window-warmer`: `uv run python window_warmer.py --config window-warmer.toml --print-next` |
| 91 | + - From `ai/coding/window-warmer`: `uv run python window_warmer.py --config window-warmer.toml --once --dry-run` |
90 | 92 | - `node -c ai/coding/window-warmer/window-warmer.pm2.config.cjs` |
91 | 93 |
|
92 | 94 | ### 7. Wrong vs Correct |
@@ -115,6 +117,7 @@ name = "z-ai-coding-plan" |
115 | 117 | base_url = "https://open.bigmodel.cn/api/coding/paas/v4" |
116 | 118 | container_name = "litellm" |
117 | 119 | api_key_env = "Z_AI_API_KEY" |
| 120 | +env_file = ".env.local" |
118 | 121 | health_path = "/models" |
119 | 122 |
|
120 | 123 | [[plans]] |
|
0 commit comments