@agxnte/reidx 2.0.7 → 2.0.9
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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/reidx/__init__.py +1 -1
- package/src/reidx/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/reidx/__pycache__/__main__.cpython-312.pyc +0 -0
- package/src/reidx/app/__pycache__/commands.cpython-312.pyc +0 -0
- package/src/reidx/provider/models.py +3 -4
- package/src/reidx/provider/store.py +1 -1
- package/src/reidx/provider_manager/__pycache__/catalog.cpython-312.pyc +0 -0
- package/src/reidx/provider_manager/__pycache__/keychain.cpython-312.pyc +0 -0
- package/src/reidx/provider_manager/__pycache__/palette.cpython-312.pyc +0 -0
- package/src/reidx/provider_manager/palette.py +0 -4
- package/src/reidx/ui/__pycache__/app.cpython-312.pyc +0 -0
- package/src/reidx/ui/commands.py +41 -2
package/README.md
CHANGED
package/package.json
CHANGED
package/pyproject.toml
CHANGED
package/src/reidx/__init__.py
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
import re
|
|
5
5
|
from dataclasses import dataclass
|
|
6
|
-
from typing import Optional
|
|
7
6
|
|
|
8
7
|
from reidx.diagnostics.logger import get_logger
|
|
9
8
|
|
|
@@ -75,12 +74,12 @@ class NormalizedModel:
|
|
|
75
74
|
provider: str
|
|
76
75
|
model_id: str
|
|
77
76
|
full_id: str
|
|
78
|
-
variant:
|
|
77
|
+
variant: str | None
|
|
79
78
|
base_model: str
|
|
80
79
|
is_valid: bool
|
|
81
80
|
|
|
82
81
|
|
|
83
|
-
def normalize_model_id(raw: str, provider_name:
|
|
82
|
+
def normalize_model_id(raw: str, provider_name: str | None = None) -> NormalizedModel:
|
|
84
83
|
original = raw.strip()
|
|
85
84
|
|
|
86
85
|
# Remove UI display text like "[via openrouter]"
|
|
@@ -204,7 +203,7 @@ class ModelCache:
|
|
|
204
203
|
self._cache: dict[str, tuple[list[str], float]] = {}
|
|
205
204
|
self._ttl = 3600
|
|
206
205
|
|
|
207
|
-
def get(self, provider_name: str) ->
|
|
206
|
+
def get(self, provider_name: str) -> list[str] | None:
|
|
208
207
|
import time
|
|
209
208
|
if provider_name in self._cache:
|
|
210
209
|
models, timestamp = self._cache[provider_name]
|
|
@@ -186,8 +186,8 @@ def load_into(registry: ProviderRegistry, storage_root: Path) -> list[str]:
|
|
|
186
186
|
|
|
187
187
|
|
|
188
188
|
def load_from_database(registry: ProviderRegistry, storage_root: Path) -> list[str]:
|
|
189
|
-
from reidx.provider_manager.database import ProviderDatabase
|
|
190
189
|
from reidx.provider.models import denormalize_model_id, normalize_model_id
|
|
190
|
+
from reidx.provider_manager.database import ProviderDatabase
|
|
191
191
|
|
|
192
192
|
added: list[str] = []
|
|
193
193
|
db = ProviderDatabase(storage_root)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -10,12 +10,8 @@ from prompt_toolkit.buffer import Buffer
|
|
|
10
10
|
|
|
11
11
|
from reidx.diagnostics.logger import get_logger
|
|
12
12
|
from reidx.provider.models import (
|
|
13
|
-
ModelCache,
|
|
14
|
-
NormalizedModel,
|
|
15
13
|
denormalize_model_id,
|
|
16
|
-
fetch_provider_models,
|
|
17
14
|
normalize_model_id,
|
|
18
|
-
validate_model_against_provider,
|
|
19
15
|
)
|
|
20
16
|
from reidx.provider.store import ProviderRecord, build_provider, validate_provider
|
|
21
17
|
from reidx.provider_manager.catalog import (
|
|
Binary file
|
package/src/reidx/ui/commands.py
CHANGED
|
@@ -81,6 +81,7 @@ SLASH_COMMANDS: list[tuple[str, str, str, str]] = [
|
|
|
81
81
|
("/connect", "", "open the interactive provider connection palette", "Providers"),
|
|
82
82
|
("/disconnect", "<name>", "remove a saved provider", "Providers"),
|
|
83
83
|
("/use", "<name>", "switch this session to a registered provider", "Providers"),
|
|
84
|
+
("/models", "[provider]", "list available models from providers (optionally filter by provider)", "Providers"),
|
|
84
85
|
("/help", "", "show this help", "Meta"),
|
|
85
86
|
("/clear", "", "clear the screen", "Meta"),
|
|
86
87
|
("/exit", "", f"quit {APP_NAME}", "Meta"),
|
|
@@ -485,9 +486,9 @@ def _providers_store(orchestrator: Orchestrator) -> ProviderStore:
|
|
|
485
486
|
|
|
486
487
|
|
|
487
488
|
def _save_to_database(orchestrator: Orchestrator, record: ProviderRecord) -> None:
|
|
489
|
+
from reidx.provider.models import denormalize_model_id, normalize_model_id
|
|
488
490
|
from reidx.provider_manager import keychain
|
|
489
491
|
from reidx.provider_manager.database import ProviderDatabase, StoredKey, StoredProvider
|
|
490
|
-
from reidx.provider.models import denormalize_model_id, normalize_model_id
|
|
491
492
|
|
|
492
493
|
root = orchestrator.config.storage_root or storage_root()
|
|
493
494
|
db = ProviderDatabase(root)
|
|
@@ -624,6 +625,42 @@ def _handle_disconnect(orchestrator: Orchestrator, arg: str) -> None:
|
|
|
624
625
|
render.print_error(f"no saved provider named '{name}'")
|
|
625
626
|
|
|
626
627
|
|
|
628
|
+
def _handle_models(orchestrator: Orchestrator, arg: str) -> None:
|
|
629
|
+
"""Handle /models command - list available models from providers."""
|
|
630
|
+
provider_filter = arg.strip() or None
|
|
631
|
+
|
|
632
|
+
if orchestrator.providers is None:
|
|
633
|
+
render.print_error("no provider registry available")
|
|
634
|
+
return
|
|
635
|
+
|
|
636
|
+
provider_names = orchestrator.providers.names()
|
|
637
|
+
if not provider_names:
|
|
638
|
+
render.print_info("no providers registered")
|
|
639
|
+
return
|
|
640
|
+
|
|
641
|
+
if provider_filter:
|
|
642
|
+
if provider_filter not in provider_names:
|
|
643
|
+
render.print_error(f"provider '{provider_filter}' not registered (see /providers)")
|
|
644
|
+
return
|
|
645
|
+
provider_names = [provider_filter]
|
|
646
|
+
|
|
647
|
+
for name in provider_names:
|
|
648
|
+
provider = orchestrator.providers.get(name)
|
|
649
|
+
try:
|
|
650
|
+
models = provider.fetch_models()
|
|
651
|
+
except Exception as exc:
|
|
652
|
+
render.print_error(f" {name}: failed to fetch models - {exc}")
|
|
653
|
+
continue
|
|
654
|
+
|
|
655
|
+
if not models:
|
|
656
|
+
render.print_info(f" {name}: (no models returned)")
|
|
657
|
+
continue
|
|
658
|
+
|
|
659
|
+
render.print_info(f" {name} ({len(models)} models):")
|
|
660
|
+
for model in models:
|
|
661
|
+
render.print_info(f" {model}")
|
|
662
|
+
|
|
663
|
+
|
|
627
664
|
def _handle_use(orchestrator: Orchestrator, arg: str) -> None:
|
|
628
665
|
name = arg.strip()
|
|
629
666
|
if not name:
|
|
@@ -738,10 +775,12 @@ def handle(orchestrator: Orchestrator, line: str) -> str:
|
|
|
738
775
|
_handle_disconnect(orchestrator, arg)
|
|
739
776
|
elif cmd == "use":
|
|
740
777
|
_handle_use(orchestrator, arg)
|
|
778
|
+
elif cmd == "models":
|
|
779
|
+
_handle_models(orchestrator, arg)
|
|
741
780
|
elif cmd == "clear":
|
|
742
781
|
render.console.clear()
|
|
743
782
|
elif cmd in ("exit", "quit", "q"):
|
|
744
783
|
return "exit"
|
|
745
784
|
else:
|
|
746
785
|
render.print_error(f"unknown command: /{cmd} (try /help)")
|
|
747
|
-
return "continue"
|
|
786
|
+
return "continue"
|