LastNoob commited on
Commit
d3ccc1b
·
1 Parent(s): 3c28f87

Reapply "set auto compaction window for fcc-claude to 190K"

Browse files
README.md CHANGED
@@ -120,7 +120,7 @@ The default model is already set to `nvidia_nim/z-ai/glm4.7`. You can change it
120
  fcc-claude
121
  ```
122
 
123
- `fcc-claude` reads the current configured port and auth token each time it starts, sets the Claude Code environment variables, and then launches the real `claude` command.
124
 
125
  ## Choose A Provider
126
 
@@ -257,7 +257,7 @@ For terminal use, prefer the installed launcher:
257
  fcc-claude
258
  ```
259
 
260
- Keep `fcc-server` running while you work. The Admin UI manages proxy config, restarts the server when runtime settings change, and `fcc-claude` reads the current Admin UI-managed port and auth token every time it starts.
261
 
262
  ### 2. VS Code Extension
263
 
@@ -267,7 +267,8 @@ Open Settings, search for `claude-code.environmentVariables`, choose **Edit in s
267
  "claudeCode.environmentVariables": [
268
  { "name": "ANTHROPIC_BASE_URL", "value": "http://localhost:8082" },
269
  { "name": "ANTHROPIC_AUTH_TOKEN", "value": "freecc" },
270
- { "name": "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY", "value": "1" }
 
271
  ]
272
  ```
273
 
@@ -286,7 +287,8 @@ Set the environment for `acp.registry.claude-acp`:
286
  "env": {
287
  "ANTHROPIC_BASE_URL": "http://localhost:8082",
288
  "ANTHROPIC_AUTH_TOKEN": "freecc",
289
- "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
 
290
  }
291
  ```
292
 
@@ -411,7 +413,7 @@ Run them in that order before pushing. CI enforces the same checks.
411
 
412
  - `fcc-server`: starts the proxy with configured host and port.
413
  - `fcc-init`: optional advanced scaffold for `~/.fcc/.env`; prefer the **Admin UI** for normal configuration.
414
- - `fcc-claude`: launches Claude Code with the configured local proxy URL, auth token, and model discovery flag.
415
  - `free-claude-code`: compatibility alias for `fcc-server`.
416
 
417
  ### 5. Extending
 
120
  fcc-claude
121
  ```
122
 
123
+ `fcc-claude` reads the current configured port and auth token each time it starts, sets the Claude Code environment variables (including a 190k-token `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction), and then launches the real `claude` command.
124
 
125
  ## Choose A Provider
126
 
 
257
  fcc-claude
258
  ```
259
 
260
+ Keep `fcc-server` running while you work. The Admin UI manages proxy config, restarts the server when runtime settings change, and `fcc-claude` reads the current Admin UI-managed port and auth token every time it starts. It also sets `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to `190000` for auto-compaction.
261
 
262
  ### 2. VS Code Extension
263
 
 
267
  "claudeCode.environmentVariables": [
268
  { "name": "ANTHROPIC_BASE_URL", "value": "http://localhost:8082" },
269
  { "name": "ANTHROPIC_AUTH_TOKEN", "value": "freecc" },
270
+ { "name": "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY", "value": "1" },
271
+ { "name": "CLAUDE_CODE_AUTO_COMPACT_WINDOW", "value": "190000" }
272
  ]
273
  ```
274
 
 
287
  "env": {
288
  "ANTHROPIC_BASE_URL": "http://localhost:8082",
289
  "ANTHROPIC_AUTH_TOKEN": "freecc",
290
+ "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
291
+ "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "190000"
292
  }
293
  ```
294
 
 
413
 
414
  - `fcc-server`: starts the proxy with configured host and port.
415
  - `fcc-init`: optional advanced scaffold for `~/.fcc/.env`; prefer the **Admin UI** for normal configuration.
416
+ - `fcc-claude`: launches Claude Code with the configured local proxy URL, auth token, model discovery flag, and a 190k `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction.
417
  - `free-claude-code`: compatibility alias for `fcc-server`.
418
 
419
  ### 5. Extending
cli/entrypoints.py CHANGED
@@ -182,6 +182,7 @@ def _claude_child_env(
182
  env.pop("ANTHROPIC_API_KEY", None)
183
  env["ANTHROPIC_BASE_URL"] = local_proxy_root_url(settings)
184
  env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"
 
185
  if token := settings.anthropic_auth_token.strip():
186
  env["ANTHROPIC_AUTH_TOKEN"] = token
187
  return env
 
182
  env.pop("ANTHROPIC_API_KEY", None)
183
  env["ANTHROPIC_BASE_URL"] = local_proxy_root_url(settings)
184
  env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"
185
+ env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] = "190000"
186
  if token := settings.anthropic_auth_token.strip():
187
  env["ANTHROPIC_AUTH_TOKEN"] = token
188
  return env
cli/session.py CHANGED
@@ -119,6 +119,7 @@ class CLISession:
119
  else:
120
  env["ANTHROPIC_BASE_URL"] = self.api_url
121
  env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"
 
122
  env.pop("ANTHROPIC_API_KEY", None)
123
  if token := self.auth_token.strip():
124
  env["ANTHROPIC_AUTH_TOKEN"] = token
 
119
  else:
120
  env["ANTHROPIC_BASE_URL"] = self.api_url
121
  env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"
122
+ env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] = "190000"
123
  env.pop("ANTHROPIC_API_KEY", None)
124
  if token := self.auth_token.strip():
125
  env["ANTHROPIC_AUTH_TOKEN"] = token
tests/cli/test_cli.py CHANGED
@@ -533,6 +533,7 @@ class TestCLISession:
533
  env = mock_exec.call_args.kwargs["env"]
534
  assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
535
  assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
 
536
  assert "ANTHROPIC_API_KEY" not in env
537
 
538
  @pytest.mark.asyncio
 
533
  env = mock_exec.call_args.kwargs["env"]
534
  assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
535
  assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
536
+ assert env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] == "190000"
537
  assert "ANTHROPIC_API_KEY" not in env
538
 
539
  @pytest.mark.asyncio
tests/cli/test_entrypoints.py CHANGED
@@ -306,6 +306,7 @@ def test_claude_child_env_targets_current_proxy_config() -> None:
306
  assert env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9090"
307
  assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
308
  assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
 
309
  assert "ANTHROPIC_API_KEY" not in env
310
 
311
 
@@ -355,6 +356,7 @@ def test_launch_claude_passes_args_and_child_env(
355
  assert child_env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9191"
356
  assert child_env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
357
  assert child_env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
 
358
  assert child_env["KEEP_ME"] == "yes"
359
  register_pid.assert_called_once_with(12345)
360
  unregister_pid.assert_called_once_with(12345)
 
306
  assert env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9090"
307
  assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
308
  assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
309
+ assert env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] == "190000"
310
  assert "ANTHROPIC_API_KEY" not in env
311
 
312
 
 
356
  assert child_env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9191"
357
  assert child_env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
358
  assert child_env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
359
+ assert child_env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] == "190000"
360
  assert child_env["KEEP_ME"] == "yes"
361
  register_pid.assert_called_once_with(12345)
362
  unregister_pid.assert_called_once_with(12345)