koder 0.4.9__tar.gz → 0.4.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {koder-0.4.9 → koder-0.4.10}/PKG-INFO +1 -1
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/base.py +7 -3
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/cli_handler.py +96 -32
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/providers/antigravity.py +103 -25
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/providers/chatgpt.py +12 -5
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/providers/claude.py +10 -3
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/providers/google.py +12 -5
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/tool_utils.py +2 -6
- {koder-0.4.9 → koder-0.4.10}/pyproject.toml +16 -1
- koder-0.4.9/.claude/settings.local.json +0 -47
- koder-0.4.9/.github/dependabot.yml +0 -11
- koder-0.4.9/.uv-cache/.gitignore +0 -1
- koder-0.4.9/.uv-cache/CACHEDIR.TAG +0 -1
- koder-0.4.9/.uv-cache/interpreter-v4/aarch64/72afda6228b75bee.msgpack +0 -1
- koder-0.4.9/.uv-cache/sdists-v7/.git +0 -0
- koder-0.4.9/.uv-cache/sdists-v7/.gitignore +0 -0
- koder-0.4.9/AGENTS.md +0 -112
- koder-0.4.9/CLAUDE.md +0 -112
- koder-0.4.9/CONTRIBUTING.md +0 -165
- koder-0.4.9/GEMINI.md +0 -1
- koder-0.4.9/docs/configuration.md +0 -392
- koder-0.4.9/scripts/generate_codex_prompts.py +0 -161
- koder-0.4.9/scripts/upgrade_dependency.py +0 -105
- koder-0.4.9/tests/auth/__init__.py +0 -1
- koder-0.4.9/tests/auth/test_oauth_providers.py +0 -376
- koder-0.4.9/tests/auth/test_token_refresh.py +0 -299
- koder-0.4.9/tests/auth/test_token_storage.py +0 -201
- koder-0.4.9/tests/auth/test_tool_calling.py +0 -514
- koder-0.4.9/tests/auth/test_tool_utils.py +0 -574
- koder-0.4.9/tests/fixtures/skills/large-skill/SKILL.md +0 -106
- koder-0.4.9/tests/fixtures/skills/large-skill/reference.md +0 -24
- koder-0.4.9/tests/fixtures/skills/medium-skill/SKILL.md +0 -74
- koder-0.4.9/tests/fixtures/skills/small-skill/SKILL.md +0 -56
- koder-0.4.9/tests/fixtures/skills/template-skill/SKILL.md +0 -20
- koder-0.4.9/tests/integration/__init__.py +0 -10
- koder-0.4.9/tests/integration/conftest.py +0 -33
- koder-0.4.9/tests/integration/test_antigravity_oauth.py +0 -95
- koder-0.4.9/tests/integration/test_chatgpt_oauth.py +0 -87
- koder-0.4.9/tests/integration/test_claude_oauth.py +0 -108
- koder-0.4.9/tests/integration/test_google_oauth.py +0 -86
- koder-0.4.9/tests/test_capture_usage.py +0 -217
- koder-0.4.9/tests/test_file_tools.py +0 -1071
- koder-0.4.9/tests/test_llm_completion_responses.py +0 -65
- koder-0.4.9/tests/test_model_info.py +0 -142
- koder-0.4.9/tests/test_model_resolution.py +0 -129
- koder-0.4.9/tests/test_security_guard.py +0 -11
- koder-0.4.9/tests/test_shell_background.py +0 -378
- koder-0.4.9/tests/test_skill_loader.py +0 -518
- koder-0.4.9/tests/test_skill_restrictions.py +0 -713
- koder-0.4.9/tests/test_skill_token_efficiency.py +0 -241
- koder-0.4.9/tests/test_streaming_display.py +0 -381
- koder-0.4.9/tests/test_usage_tracker.py +0 -233
- koder-0.4.9/tests/test_web.py +0 -402
- koder-0.4.9/uv.lock +0 -4053
- {koder-0.4.9 → koder-0.4.10}/.gitignore +0 -0
- {koder-0.4.9 → koder-0.4.10}/LICENSE +0 -0
- {koder-0.4.9 → koder-0.4.10}/README.md +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/agentic/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/agentic/agent.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/agentic/approval_hooks.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/agentic/hooks.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/agentic/skill_guardrail.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/callback_server.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/client_integration.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/codex_prompts.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/constants.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/litellm_oauth.py +1 -1
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/providers/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/auth/token_storage.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/cli.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/config/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/config/cli_handler.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/config/manager.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/config/models.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/commands.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/interactive.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/keyboard_listener.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/scheduler.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/security.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/session.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/status_line.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/streaming_display.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/core/usage_tracker.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/mcp/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/mcp/cli_handler.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/mcp/server_config.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/mcp/server_factory.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/mcp/server_manager.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/engine.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/file.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/search.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/shell.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/skill.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/skill_context.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/task.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/todo.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/tools/web.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/utils/__init__.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/utils/client.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/utils/model_info.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/utils/prompts.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/utils/queue.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/utils/sessions.py +0 -0
- {koder-0.4.9 → koder-0.4.10}/koder_agent/utils/terminal_theme.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: koder
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.10
|
|
4
4
|
Summary: An intuitive AI coding assistant and interactive CLI tool that boosts developer productivity with intelligent automation and context-aware support.
|
|
5
5
|
Project-URL: Homepage, https://github.com/feiskyer/koder
|
|
6
6
|
Project-URL: Repository, https://github.com/feiskyer/koder
|
|
@@ -315,15 +315,19 @@ class OAuthProvider(ABC):
|
|
|
315
315
|
"""
|
|
316
316
|
return {"Authorization": f"Bearer {access_token}"}
|
|
317
317
|
|
|
318
|
-
async def list_models(self, access_token: str) -> list[str]:
|
|
318
|
+
async def list_models(self, access_token: str, verbose: bool = False) -> tuple[list[str], dict]:
|
|
319
319
|
"""List available models for this provider.
|
|
320
320
|
|
|
321
321
|
Override in subclasses to call provider's models API.
|
|
322
322
|
|
|
323
323
|
Args:
|
|
324
324
|
access_token: Valid access token
|
|
325
|
+
verbose: If True, return detailed status info
|
|
325
326
|
|
|
326
327
|
Returns:
|
|
327
|
-
|
|
328
|
+
Tuple of (model list, status dict with 'source' and optional 'error')
|
|
329
|
+
- source: "api", "fallback", or "hardcoded"
|
|
330
|
+
- error: Error message if API call failed (None otherwise)
|
|
331
|
+
- reason: Optional explanation (e.g., "No public API available")
|
|
328
332
|
"""
|
|
329
|
-
return []
|
|
333
|
+
return [], {"source": "hardcoded", "error": None}
|
|
@@ -88,7 +88,7 @@ async def handle_login(provider_id: str, timeout: float = 300) -> bool:
|
|
|
88
88
|
|
|
89
89
|
# Fetch available models from provider API
|
|
90
90
|
console.print("Fetching available models...")
|
|
91
|
-
models = await provider.list_models(tokens.access_token)
|
|
91
|
+
models, _ = await provider.list_models(tokens.access_token)
|
|
92
92
|
tokens.models = models
|
|
93
93
|
tokens.models_fetched_at = int(time.time() * 1000)
|
|
94
94
|
|
|
@@ -184,12 +184,12 @@ async def _handle_manual_code_flow(auth_url: str, timeout: float) -> "CallbackRe
|
|
|
184
184
|
)
|
|
185
185
|
|
|
186
186
|
|
|
187
|
-
def handle_list() -> None:
|
|
188
|
-
"""List all configured OAuth providers with their
|
|
187
|
+
async def handle_list() -> None:
|
|
188
|
+
"""List all configured OAuth providers with their models."""
|
|
189
189
|
storage = get_token_storage()
|
|
190
|
-
|
|
190
|
+
all_tokens = storage.get_all_tokens()
|
|
191
191
|
|
|
192
|
-
if not
|
|
192
|
+
if not all_tokens:
|
|
193
193
|
console.print(
|
|
194
194
|
"\n[yellow]No OAuth providers configured.[/yellow]\n"
|
|
195
195
|
"Use 'koder auth login <provider>' to authenticate.\n"
|
|
@@ -197,23 +197,54 @@ def handle_list() -> None:
|
|
|
197
197
|
)
|
|
198
198
|
return
|
|
199
199
|
|
|
200
|
-
for provider_id,
|
|
201
|
-
# Build info panel
|
|
200
|
+
for provider_id, tokens in all_tokens.items():
|
|
202
201
|
description = PROVIDER_DESCRIPTIONS.get(provider_id, "")
|
|
203
|
-
info
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
202
|
+
# Claude doesn't provide user info via OAuth
|
|
203
|
+
account = tokens.email if tokens.email else None
|
|
204
|
+
if account:
|
|
205
|
+
info = f"[bold]Account:[/bold] {account}\n[bold]Type:[/bold] {description}\n"
|
|
206
|
+
else:
|
|
207
|
+
info = f"[bold]Type:[/bold] {description}\n"
|
|
208
|
+
|
|
209
|
+
# Auto-refresh token if expired
|
|
210
|
+
access_token = tokens.access_token
|
|
211
|
+
if tokens.is_expired():
|
|
212
|
+
console.print(f"[dim]Refreshing {provider_id} token...[/dim]")
|
|
213
|
+
try:
|
|
214
|
+
provider = get_provider(provider_id)
|
|
215
|
+
result = await provider.refresh_tokens(tokens.refresh_token)
|
|
216
|
+
if result.success and result.tokens:
|
|
217
|
+
storage.save(result.tokens)
|
|
218
|
+
tokens = result.tokens
|
|
219
|
+
access_token = tokens.access_token
|
|
220
|
+
except Exception as e:
|
|
221
|
+
info += f"\n[red]Token refresh failed: {e}[/red]\n"
|
|
222
|
+
|
|
223
|
+
# Fetch models from API if cache is stale or empty
|
|
224
|
+
models = tokens.models
|
|
225
|
+
source = "cached"
|
|
226
|
+
|
|
227
|
+
if not tokens.is_models_cache_valid() or not models:
|
|
228
|
+
try:
|
|
229
|
+
provider = get_provider(provider_id)
|
|
230
|
+
models, status = await provider.list_models(access_token)
|
|
231
|
+
source = status.get("source", "api")
|
|
232
|
+
|
|
233
|
+
# Update cache
|
|
234
|
+
tokens.models = models
|
|
235
|
+
tokens.models_fetched_at = int(time.time() * 1000)
|
|
236
|
+
storage.save(tokens)
|
|
237
|
+
except Exception:
|
|
238
|
+
source = "cached" if models else "unavailable"
|
|
239
|
+
|
|
240
|
+
# Display models
|
|
241
|
+
if models:
|
|
242
|
+
source_label = "[green]API[/green]" if source == "api" else "[cyan]cached[/cyan]"
|
|
243
|
+
info += f"\n[bold]Models ({len(models)}):[/bold] {source_label}\n"
|
|
244
|
+
for model in sorted(models):
|
|
214
245
|
info += f" • {model}\n"
|
|
215
246
|
else:
|
|
216
|
-
info += "\n[dim]No models
|
|
247
|
+
info += "\n[dim]No models available[/dim]\n"
|
|
217
248
|
|
|
218
249
|
console.print(
|
|
219
250
|
Panel(
|
|
@@ -258,7 +289,7 @@ async def handle_revoke(provider_id: str) -> bool:
|
|
|
258
289
|
return True
|
|
259
290
|
|
|
260
291
|
|
|
261
|
-
def handle_status(provider_id: Optional[str] = None) -> None:
|
|
292
|
+
async def handle_status(provider_id: Optional[str] = None) -> None:
|
|
262
293
|
"""Show OAuth token status.
|
|
263
294
|
|
|
264
295
|
Args:
|
|
@@ -273,7 +304,7 @@ def handle_status(provider_id: Optional[str] = None) -> None:
|
|
|
273
304
|
console.print(f"[yellow]No tokens found for provider '{provider_id}'[/yellow]")
|
|
274
305
|
return
|
|
275
306
|
|
|
276
|
-
_print_token_details(provider_id, tokens)
|
|
307
|
+
await _print_token_details(provider_id, tokens, storage)
|
|
277
308
|
else:
|
|
278
309
|
# Show all providers
|
|
279
310
|
all_tokens = storage.get_all_tokens()
|
|
@@ -282,12 +313,26 @@ def handle_status(provider_id: Optional[str] = None) -> None:
|
|
|
282
313
|
return
|
|
283
314
|
|
|
284
315
|
for pid, tokens in all_tokens.items():
|
|
285
|
-
_print_token_details(pid, tokens)
|
|
316
|
+
await _print_token_details(pid, tokens, storage)
|
|
286
317
|
console.print()
|
|
287
318
|
|
|
288
319
|
|
|
289
|
-
def _print_token_details(provider_id: str, tokens) -> None:
|
|
290
|
-
"""Print detailed token information."""
|
|
320
|
+
async def _print_token_details(provider_id: str, tokens, storage) -> None:
|
|
321
|
+
"""Print detailed token information with models."""
|
|
322
|
+
# Auto-refresh token if expired
|
|
323
|
+
access_token = tokens.access_token
|
|
324
|
+
if tokens.is_expired():
|
|
325
|
+
console.print(f"[dim]Refreshing {provider_id} token...[/dim]")
|
|
326
|
+
try:
|
|
327
|
+
provider = get_provider(provider_id)
|
|
328
|
+
result = await provider.refresh_tokens(tokens.refresh_token)
|
|
329
|
+
if result.success and result.tokens:
|
|
330
|
+
storage.save(result.tokens)
|
|
331
|
+
tokens = result.tokens
|
|
332
|
+
access_token = tokens.access_token
|
|
333
|
+
except Exception:
|
|
334
|
+
pass
|
|
335
|
+
|
|
291
336
|
# Determine status
|
|
292
337
|
if tokens.is_expired(0):
|
|
293
338
|
status = "[red]EXPIRED[/red]"
|
|
@@ -304,24 +349,43 @@ def _print_token_details(provider_id: str, tokens) -> None:
|
|
|
304
349
|
expires = datetime.fromtimestamp(tokens.expires_at / 1000)
|
|
305
350
|
|
|
306
351
|
# Build detailed info
|
|
352
|
+
account_line = f"Account: {tokens.email}\n" if tokens.email else ""
|
|
307
353
|
info = (
|
|
308
354
|
f"Status: {status}\n"
|
|
309
|
-
f"
|
|
355
|
+
f"{account_line}"
|
|
310
356
|
f"Expires: {expires.strftime('%Y-%m-%d %H:%M:%S')}\n"
|
|
311
357
|
f"Time left: {time_left_mins} minutes\n"
|
|
312
358
|
f"Access token: {tokens.access_token[:20]}...\n"
|
|
313
359
|
f"Refresh token: {tokens.refresh_token[:20]}..."
|
|
314
360
|
)
|
|
315
361
|
|
|
362
|
+
# Fetch models from API if cache is stale or empty
|
|
363
|
+
models = tokens.models
|
|
364
|
+
source = "cached"
|
|
365
|
+
|
|
366
|
+
if not tokens.is_models_cache_valid() or not models:
|
|
367
|
+
try:
|
|
368
|
+
provider = get_provider(provider_id)
|
|
369
|
+
models, status_info = await provider.list_models(access_token)
|
|
370
|
+
source = "api" if status_info.get("source") == "api" else "cached"
|
|
371
|
+
|
|
372
|
+
# Update cache
|
|
373
|
+
tokens.models = models
|
|
374
|
+
tokens.models_fetched_at = int(time.time() * 1000)
|
|
375
|
+
storage.save(tokens)
|
|
376
|
+
except Exception:
|
|
377
|
+
pass
|
|
378
|
+
|
|
316
379
|
# Add models info
|
|
317
|
-
if
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
380
|
+
if models:
|
|
381
|
+
source_label = "[green]API[/green]" if source == "api" else "[cyan]cached[/cyan]"
|
|
382
|
+
info += f"\n\n[bold]Models ({len(models)}):[/bold] {source_label}\n"
|
|
383
|
+
for model in sorted(models):
|
|
384
|
+
info += f" • {model}\n"
|
|
321
385
|
|
|
322
386
|
console.print(
|
|
323
387
|
Panel(
|
|
324
|
-
info,
|
|
388
|
+
info.strip(),
|
|
325
389
|
title=f"[bold]{provider_id}[/bold]",
|
|
326
390
|
border_style="blue",
|
|
327
391
|
)
|
|
@@ -369,7 +433,7 @@ async def run_auth_command(args) -> int:
|
|
|
369
433
|
return 0 if success else 1
|
|
370
434
|
|
|
371
435
|
elif args.auth_command == "list":
|
|
372
|
-
handle_list()
|
|
436
|
+
await handle_list()
|
|
373
437
|
return 0
|
|
374
438
|
|
|
375
439
|
elif args.auth_command == "revoke":
|
|
@@ -377,7 +441,7 @@ async def run_auth_command(args) -> int:
|
|
|
377
441
|
return 0 if success else 1
|
|
378
442
|
|
|
379
443
|
elif args.auth_command == "status":
|
|
380
|
-
handle_status(getattr(args, "provider", None))
|
|
444
|
+
await handle_status(getattr(args, "provider", None))
|
|
381
445
|
return 0
|
|
382
446
|
|
|
383
447
|
else:
|
|
@@ -24,6 +24,13 @@ from koder_agent.auth.constants import (
|
|
|
24
24
|
GOOGLE_USERINFO_URL,
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
+
# Antigravity internal API endpoints
|
|
28
|
+
CLOUD_CODE_BASE_URL = "https://cloudcode-pa.googleapis.com"
|
|
29
|
+
LOAD_CODE_ASSIST_URL = f"{CLOUD_CODE_BASE_URL}/v1internal:loadCodeAssist"
|
|
30
|
+
FETCH_MODELS_URL = f"{CLOUD_CODE_BASE_URL}/v1internal:fetchAvailableModels"
|
|
31
|
+
ANTIGRAVITY_USER_AGENT = "antigravity/1.11.3 Darwin/arm64"
|
|
32
|
+
DEFAULT_PROJECT_ID = "bamboo-precept-lgxtn"
|
|
33
|
+
|
|
27
34
|
|
|
28
35
|
class AntigravityOAuthProvider(OAuthProvider):
|
|
29
36
|
"""Antigravity OAuth provider for Gemini 3 + Claude access.
|
|
@@ -185,35 +192,106 @@ class AntigravityOAuthProvider(OAuthProvider):
|
|
|
185
192
|
"""
|
|
186
193
|
return ANTIGRAVITY_API_BASE
|
|
187
194
|
|
|
188
|
-
async def
|
|
189
|
-
"""
|
|
195
|
+
async def _fetch_project_id(self, access_token: str) -> tuple[Optional[str], Optional[str]]:
|
|
196
|
+
"""Fetch project ID and subscription tier from loadCodeAssist API."""
|
|
197
|
+
try:
|
|
198
|
+
async with aiohttp.ClientSession() as session:
|
|
199
|
+
async with session.post(
|
|
200
|
+
LOAD_CODE_ASSIST_URL,
|
|
201
|
+
headers={
|
|
202
|
+
"Authorization": f"Bearer {access_token}",
|
|
203
|
+
"Content-Type": "application/json",
|
|
204
|
+
"User-Agent": ANTIGRAVITY_USER_AGENT,
|
|
205
|
+
},
|
|
206
|
+
json={"metadata": {"ideType": "ANTIGRAVITY"}},
|
|
207
|
+
) as response:
|
|
208
|
+
if response.ok:
|
|
209
|
+
data = await response.json()
|
|
210
|
+
project_id = data.get("cloudaicompanionProject")
|
|
211
|
+
paid_tier = data.get("paidTier", {})
|
|
212
|
+
current_tier = data.get("currentTier", {})
|
|
213
|
+
tier_id = paid_tier.get("id") or current_tier.get("id")
|
|
214
|
+
return project_id, tier_id
|
|
215
|
+
except Exception:
|
|
216
|
+
pass
|
|
217
|
+
return None, None
|
|
190
218
|
|
|
191
|
-
|
|
192
|
-
|
|
219
|
+
async def _fetch_available_models(
|
|
220
|
+
self, access_token: str, project_id: str
|
|
221
|
+
) -> tuple[list[str], dict]:
|
|
222
|
+
"""Fetch available models from fetchAvailableModels API."""
|
|
223
|
+
models = []
|
|
224
|
+
status = {"source": "api", "error": None, "project_id": project_id}
|
|
225
|
+
|
|
226
|
+
try:
|
|
227
|
+
async with aiohttp.ClientSession() as session:
|
|
228
|
+
async with session.post(
|
|
229
|
+
FETCH_MODELS_URL,
|
|
230
|
+
headers={
|
|
231
|
+
"Authorization": f"Bearer {access_token}",
|
|
232
|
+
"Content-Type": "application/json",
|
|
233
|
+
"User-Agent": ANTIGRAVITY_USER_AGENT,
|
|
234
|
+
},
|
|
235
|
+
json={"project": project_id},
|
|
236
|
+
) as response:
|
|
237
|
+
if response.ok:
|
|
238
|
+
data = await response.json()
|
|
239
|
+
models_data = data.get("models", {})
|
|
240
|
+
|
|
241
|
+
for model_name, model_info in models_data.items():
|
|
242
|
+
# Skip internal models
|
|
243
|
+
if model_info.get("isInternal"):
|
|
244
|
+
continue
|
|
245
|
+
# Only include models with quota info
|
|
246
|
+
if model_info.get("quotaInfo"):
|
|
247
|
+
models.append(f"{self.provider_id}/{model_name}")
|
|
248
|
+
|
|
249
|
+
status["model_count"] = len(models_data)
|
|
250
|
+
status["filtered_count"] = len(models)
|
|
251
|
+
else:
|
|
252
|
+
error_text = await response.text()
|
|
253
|
+
status["error"] = f"API returned {response.status}: {error_text[:200]}"
|
|
254
|
+
status["source"] = "fallback"
|
|
255
|
+
except Exception as e:
|
|
256
|
+
status["error"] = f"API request failed: {str(e)}"
|
|
257
|
+
status["source"] = "fallback"
|
|
258
|
+
|
|
259
|
+
return models, status
|
|
260
|
+
|
|
261
|
+
async def list_models(self, access_token: str, verbose: bool = False) -> tuple[list[str], dict]:
|
|
262
|
+
"""List available Antigravity models from live API.
|
|
193
263
|
|
|
194
264
|
Args:
|
|
195
265
|
access_token: Valid Antigravity OAuth access token
|
|
266
|
+
verbose: If True, return detailed status info
|
|
196
267
|
|
|
197
268
|
Returns:
|
|
198
|
-
|
|
269
|
+
Tuple of (model list, status dict with 'source' info)
|
|
199
270
|
"""
|
|
200
|
-
#
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
271
|
+
# Fetch project ID first
|
|
272
|
+
project_id, tier_id = await self._fetch_project_id(access_token)
|
|
273
|
+
project_id = project_id or DEFAULT_PROJECT_ID
|
|
274
|
+
|
|
275
|
+
# Fetch models from API
|
|
276
|
+
models, status = await self._fetch_available_models(access_token, project_id)
|
|
277
|
+
|
|
278
|
+
if tier_id:
|
|
279
|
+
status["subscription_tier"] = tier_id
|
|
280
|
+
|
|
281
|
+
# Fallback to hardcoded list if API fails
|
|
282
|
+
if not models:
|
|
283
|
+
status["source"] = "fallback"
|
|
284
|
+
if not status.get("error"):
|
|
285
|
+
status["error"] = "API returned no models"
|
|
286
|
+
models = [
|
|
287
|
+
f"{self.provider_id}/gemini-3-flash",
|
|
288
|
+
f"{self.provider_id}/gemini-3-pro-low",
|
|
289
|
+
f"{self.provider_id}/gemini-3-pro-high",
|
|
290
|
+
f"{self.provider_id}/claude-sonnet-4-5",
|
|
291
|
+
f"{self.provider_id}/claude-sonnet-4-5-thinking",
|
|
292
|
+
f"{self.provider_id}/claude-opus-4-5-thinking",
|
|
293
|
+
f"{self.provider_id}/gemini-2.5-flash",
|
|
294
|
+
f"{self.provider_id}/gemini-2.5-pro",
|
|
295
|
+
]
|
|
296
|
+
|
|
297
|
+
return models, status
|
|
@@ -140,18 +140,21 @@ class ChatGPTOAuthProvider(OAuthProvider):
|
|
|
140
140
|
"stream": True,
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
async def list_models(self, access_token: str) -> list[str]:
|
|
143
|
+
async def list_models(self, access_token: str, verbose: bool = False) -> tuple[list[str], dict]:
|
|
144
144
|
"""List available OpenAI models.
|
|
145
145
|
|
|
146
146
|
Note: Falls back to known models if API call fails.
|
|
147
147
|
|
|
148
148
|
Args:
|
|
149
149
|
access_token: Valid ChatGPT OAuth access token
|
|
150
|
+
verbose: If True, return detailed status info
|
|
150
151
|
|
|
151
152
|
Returns:
|
|
152
|
-
|
|
153
|
+
Tuple of (model list, status dict with 'source' and optional 'error')
|
|
153
154
|
"""
|
|
154
155
|
models = []
|
|
156
|
+
status = {"source": "api", "error": None}
|
|
157
|
+
|
|
155
158
|
try:
|
|
156
159
|
async with aiohttp.ClientSession() as session:
|
|
157
160
|
async with session.get(
|
|
@@ -167,11 +170,15 @@ class ChatGPTOAuthProvider(OAuthProvider):
|
|
|
167
170
|
prefix in model_id for prefix in ["gpt-", "o1", "o3", "chatgpt"]
|
|
168
171
|
):
|
|
169
172
|
models.append(f"{self.provider_id}/{model_id}")
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
else:
|
|
174
|
+
error_text = await response.text()
|
|
175
|
+
status["error"] = f"API returned {response.status}: {error_text[:200]}"
|
|
176
|
+
except Exception as e:
|
|
177
|
+
status["error"] = f"API request failed: {str(e)}"
|
|
172
178
|
|
|
173
179
|
# Fallback to known models if API call fails or returns empty
|
|
174
180
|
if not models:
|
|
181
|
+
status["source"] = "fallback"
|
|
175
182
|
models = [
|
|
176
183
|
# GPT-5.2 Codex models
|
|
177
184
|
f"{self.provider_id}/gpt-5.2-codex",
|
|
@@ -189,4 +196,4 @@ class ChatGPTOAuthProvider(OAuthProvider):
|
|
|
189
196
|
f"{self.provider_id}/gpt-4o-mini",
|
|
190
197
|
]
|
|
191
198
|
|
|
192
|
-
return models
|
|
199
|
+
return models, status
|
|
@@ -220,7 +220,7 @@ class ClaudeOAuthProvider(OAuthProvider):
|
|
|
220
220
|
"anthropic-beta": ",".join(ANTHROPIC_BETA_HEADERS),
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
async def list_models(self, access_token: str) -> list[str]:
|
|
223
|
+
async def list_models(self, access_token: str, verbose: bool = False) -> tuple[list[str], dict]:
|
|
224
224
|
"""List available Claude models.
|
|
225
225
|
|
|
226
226
|
Note: Anthropic doesn't provide a public models listing API.
|
|
@@ -228,14 +228,20 @@ class ClaudeOAuthProvider(OAuthProvider):
|
|
|
228
228
|
|
|
229
229
|
Args:
|
|
230
230
|
access_token: Valid Claude OAuth access token
|
|
231
|
+
verbose: If True, return detailed status info
|
|
231
232
|
|
|
232
233
|
Returns:
|
|
233
|
-
|
|
234
|
+
Tuple of (model list, status dict with 'source' info)
|
|
234
235
|
"""
|
|
235
236
|
# Anthropic doesn't have a models listing API
|
|
236
237
|
# Return commonly available models for Claude Max subscription
|
|
237
238
|
# Model names must match actual Anthropic API model identifiers
|
|
238
|
-
|
|
239
|
+
status = {
|
|
240
|
+
"source": "hardcoded",
|
|
241
|
+
"error": None,
|
|
242
|
+
"reason": "Anthropic has no public models API",
|
|
243
|
+
}
|
|
244
|
+
models = [
|
|
239
245
|
# Claude 4.5 models (latest versions)
|
|
240
246
|
f"{self.provider_id}/claude-sonnet-4-5-20250929",
|
|
241
247
|
f"{self.provider_id}/claude-opus-4-5-20251101",
|
|
@@ -252,3 +258,4 @@ class ClaudeOAuthProvider(OAuthProvider):
|
|
|
252
258
|
f"{self.provider_id}/claude-3-5-sonnet-20241022",
|
|
253
259
|
f"{self.provider_id}/claude-3-opus-20240229",
|
|
254
260
|
]
|
|
261
|
+
return models, status
|
|
@@ -136,7 +136,7 @@ class GoogleOAuthProvider(OAuthProvider):
|
|
|
136
136
|
except Exception:
|
|
137
137
|
return False
|
|
138
138
|
|
|
139
|
-
async def list_models(self, access_token: str) -> list[str]:
|
|
139
|
+
async def list_models(self, access_token: str, verbose: bool = False) -> tuple[list[str], dict]:
|
|
140
140
|
"""List available Gemini models.
|
|
141
141
|
|
|
142
142
|
Note: The OAuth scope may not include model listing permission.
|
|
@@ -144,11 +144,14 @@ class GoogleOAuthProvider(OAuthProvider):
|
|
|
144
144
|
|
|
145
145
|
Args:
|
|
146
146
|
access_token: Valid Google OAuth access token
|
|
147
|
+
verbose: If True, return detailed status info
|
|
147
148
|
|
|
148
149
|
Returns:
|
|
149
|
-
|
|
150
|
+
Tuple of (model list, status dict with 'source' and optional 'error')
|
|
150
151
|
"""
|
|
151
152
|
models = []
|
|
153
|
+
status = {"source": "api", "error": None}
|
|
154
|
+
|
|
152
155
|
try:
|
|
153
156
|
async with aiohttp.ClientSession() as session:
|
|
154
157
|
async with session.get(
|
|
@@ -165,11 +168,15 @@ class GoogleOAuthProvider(OAuthProvider):
|
|
|
165
168
|
# Filter for generation models (exclude embedding, etc.)
|
|
166
169
|
if "generateContent" in model.get("supportedGenerationMethods", []):
|
|
167
170
|
models.append(f"{self.provider_id}/{model_id}")
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
else:
|
|
172
|
+
error_text = await response.text()
|
|
173
|
+
status["error"] = f"API returned {response.status}: {error_text[:200]}"
|
|
174
|
+
except Exception as e:
|
|
175
|
+
status["error"] = f"API request failed: {str(e)}"
|
|
170
176
|
|
|
171
177
|
# Fallback to known models if API call fails or returns empty
|
|
172
178
|
if not models:
|
|
179
|
+
status["source"] = "fallback"
|
|
173
180
|
models = [
|
|
174
181
|
# Gemini 3 models (preview)
|
|
175
182
|
f"{self.provider_id}/gemini-3-pro-preview",
|
|
@@ -184,4 +191,4 @@ class GoogleOAuthProvider(OAuthProvider):
|
|
|
184
191
|
f"{self.provider_id}/gemini-1.5-flash",
|
|
185
192
|
]
|
|
186
193
|
|
|
187
|
-
return models
|
|
194
|
+
return models, status
|
|
@@ -167,9 +167,7 @@ def _cleanup_thought_signature_cache_unlocked() -> None:
|
|
|
167
167
|
|
|
168
168
|
# Clean main cache - remove expired entries
|
|
169
169
|
expired_keys = [
|
|
170
|
-
key
|
|
171
|
-
for key, (_, ts) in _thought_signature_cache.items()
|
|
172
|
-
if now - ts >= _CACHE_TTL_SECONDS
|
|
170
|
+
key for key, (_, ts) in _thought_signature_cache.items() if now - ts >= _CACHE_TTL_SECONDS
|
|
173
171
|
]
|
|
174
172
|
for key in expired_keys:
|
|
175
173
|
del _thought_signature_cache[key]
|
|
@@ -192,9 +190,7 @@ def _cleanup_thought_signature_cache_unlocked() -> None:
|
|
|
192
190
|
# Enforce size limit on main cache (LRU-style: remove oldest)
|
|
193
191
|
if len(_thought_signature_cache) > _MAX_CACHE_SIZE:
|
|
194
192
|
# Sort by timestamp and remove oldest entries
|
|
195
|
-
sorted_entries = sorted(
|
|
196
|
-
_thought_signature_cache.items(), key=lambda x: x[1][1]
|
|
197
|
-
)
|
|
193
|
+
sorted_entries = sorted(_thought_signature_cache.items(), key=lambda x: x[1][1])
|
|
198
194
|
entries_to_remove = len(_thought_signature_cache) - _MAX_CACHE_SIZE
|
|
199
195
|
for key, _ in sorted_entries[:entries_to_remove]:
|
|
200
196
|
del _thought_signature_cache[key]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "koder"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.10"
|
|
4
4
|
description = "An intuitive AI coding assistant and interactive CLI tool that boosts developer productivity with intelligent automation and context-aware support."
|
|
5
5
|
authors = [{ name = "Pengfei Ni" }]
|
|
6
6
|
readme = "README.md"
|
|
@@ -94,3 +94,18 @@ filterwarnings = [
|
|
|
94
94
|
|
|
95
95
|
[tool.hatch.build.targets.wheel]
|
|
96
96
|
packages = ["koder_agent"]
|
|
97
|
+
|
|
98
|
+
[tool.hatch.build.targets.sdist]
|
|
99
|
+
exclude = [
|
|
100
|
+
".claude/",
|
|
101
|
+
".github/",
|
|
102
|
+
".uv-cache/",
|
|
103
|
+
"scripts/",
|
|
104
|
+
"tests/",
|
|
105
|
+
"docs/",
|
|
106
|
+
"AGENTS.md",
|
|
107
|
+
"CLAUDE.md",
|
|
108
|
+
"GEMINI.md",
|
|
109
|
+
"CONTRIBUTING.md",
|
|
110
|
+
"uv.lock",
|
|
111
|
+
]
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(uv run python:*)",
|
|
5
|
-
"Bash(cat:*)",
|
|
6
|
-
"Bash(python -m py_compile:*)",
|
|
7
|
-
"Bash(uv run pytest:*)",
|
|
8
|
-
"mcp__plugin_claude-code-settings_exa__get_code_context_exa",
|
|
9
|
-
"Bash(find:*)",
|
|
10
|
-
"WebFetch(domain:www.anthropic.com)",
|
|
11
|
-
"Bash(uv run ruff check:*)",
|
|
12
|
-
"mcp__firecrawl__firecrawl_scrape",
|
|
13
|
-
"Bash(uv run:*)",
|
|
14
|
-
"Bash(uv run pip:*)",
|
|
15
|
-
"Bash(KODER_MODEL=\"github_copilot/gpt-5.1-codex\" uv run koder:*)",
|
|
16
|
-
"Bash(python3:*)",
|
|
17
|
-
"Bash(timeout 90 bash -c \"KODER_MODEL=''github_copilot/gpt-5.1-codex'' uv run koder ''respond with just hello''\")",
|
|
18
|
-
"Bash(git add:*)",
|
|
19
|
-
"Bash(git commit:*)",
|
|
20
|
-
"Bash(grep:*)",
|
|
21
|
-
"Bash(xargs:*)",
|
|
22
|
-
"WebFetch(domain:github.com)",
|
|
23
|
-
"Skill(ralph-wiggum:ralph-loop)",
|
|
24
|
-
"WebFetch(domain:docs.litellm.ai)",
|
|
25
|
-
"Bash(KODER_MODEL=\"antigravity/antigravity-claude-sonnet-4-5-thinking-high\" uv run koder 'list me your tools')",
|
|
26
|
-
"Bash(KODER_MODEL=\"antigravity/antigravity-claude-sonnet-4-5-thinking-high\" uv run koder:*)",
|
|
27
|
-
"Bash(KODER_MODEL=\"antigravity/antigravity-gemini-3-flash\" uv run koder:*)",
|
|
28
|
-
"Bash(KODER_MODEL=\"antigravity/antigravity-claude-opus-4-5-thinking-high\" uv run koder:*)",
|
|
29
|
-
"Bash(export KODER_MODEL=\"chatgpt/gpt-5.2\")",
|
|
30
|
-
"Bash(timeout 60 uv run:*)",
|
|
31
|
-
"Bash(export LITELLM_LOG=DEBUG)",
|
|
32
|
-
"Bash(done)",
|
|
33
|
-
"Bash(KODER_MODEL=\"antigravity/antigravity-gemini-3-pro-high\" timeout 30 uv run koder 'say hello')",
|
|
34
|
-
"Bash(timeout 90 uv run python3:*)",
|
|
35
|
-
"Bash(KODER_MODEL=\"google/gemini-2.0-flash\" timeout 90 uv run koder:*)",
|
|
36
|
-
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"chatgpt/gpt-5.2\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
37
|
-
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"google/gemini-2.0-flash\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
38
|
-
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"claude/claude-sonnet-4-20250514\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
39
|
-
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"antigravity/antigravity-gemini-2.5-flash\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
40
|
-
"Bash(timeout 120 uv run python3:*)",
|
|
41
|
-
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"antigravity/antigravity-gemini-3-pro-high\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
42
|
-
"WebFetch(domain:ai.google.dev)"
|
|
43
|
-
],
|
|
44
|
-
"deny": [],
|
|
45
|
-
"ask": []
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "uv" # See documentation for possible values
|
|
9
|
-
directory: "/" # Location of package manifests
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "daily"
|
koder-0.4.9/.uv-cache/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Signature: 8a477f597d28d172789f06886806bc55
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
���g����*������macos�aarch64��implementation_name�cpython�implementation_version�3.13.1�os_name�posix�platform_machine�arm64�platform_python_implementation�CPython�platform_release�25.1.0�platform_system�Darwin�platform_version�eDarwin Kernel Version 25.1.0: Mon Oct 20 19:34:03 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8112�python_full_version�3.13.1�python_version�3.13�sys_platform�darwin��@/Users/fei/coding-agent/koder/.venv/lib/python3.13/site-packages�@/Users/fei/coding-agent/koder/.venv/lib/python3.13/site-packages�'/Users/fei/coding-agent/koder/.venv/bin�#/Users/fei/coding-agent/koder/.venv�;/Users/fei/coding-agent/koder/.venv/include/site/python3.13��lib/python3.13/site-packages�lib/python3.13/site-packages�bin��include/site/python3.13��#/Users/fei/coding-agent/koder/.venv�C/Users/fei/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none�C/Users/fei/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none�R/Users/fei/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/bin/python3.13�//Users/fei/coding-agent/koder/.venv/bin/python3��2/Users/fei/coding-agent/koder/.uv-cache/.tmpX75eW6�U/Users/fei/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python313.zip�R/Users/fei/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13�^/Users/fei/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13/lib-dynload�@/Users/fei/coding-agent/koder/.venv/lib/python3.13/site-packages�/Users/fei/coding-agent/koder�R/Users/fei/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13â64�
|
|
File without changes
|
|
File without changes
|