trinity-cli 0.2.0__tar.gz → 0.2.1__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.
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/PKG-INFO +1 -1
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/pyproject.toml +1 -1
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/client.py +1 -4
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/auth.py +34 -2
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli.egg-info/PKG-INFO +1 -1
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/README.md +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/setup.cfg +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/__init__.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/__init__.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/agents.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/chat.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/deploy.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/health.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/profiles.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/schedules.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/skills.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/commands/tags.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/config.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/main.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli/output.py +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli.egg-info/SOURCES.txt +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli.egg-info/dependency_links.txt +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli.egg-info/entry_points.txt +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli.egg-info/requires.txt +0 -0
- {trinity_cli-0.2.0 → trinity_cli-0.2.1}/trinity_cli.egg-info/top_level.txt +0 -0
|
@@ -84,10 +84,7 @@ class TrinityClient:
|
|
|
84
84
|
def post_form(self, path: str, data: dict) -> Any:
|
|
85
85
|
"""POST with form-encoded body (for OAuth2 token endpoint)."""
|
|
86
86
|
with httpx.Client(timeout=30) as c:
|
|
87
|
-
|
|
88
|
-
if self.token:
|
|
89
|
-
headers["Authorization"] = f"Bearer {self.token}"
|
|
90
|
-
resp = c.post(f"{self.base_url}{path}", data=data, headers=headers)
|
|
87
|
+
resp = c.post(f"{self.base_url}{path}", data=data)
|
|
91
88
|
return self._handle_response(resp)
|
|
92
89
|
|
|
93
90
|
def post_unauthenticated(self, path: str, json: Optional[dict] = None) -> Any:
|
|
@@ -90,9 +90,13 @@ def _get_profile_name(ctx: click.Context) -> str | None:
|
|
|
90
90
|
@click.option("--instance", help="Trinity instance URL (e.g. https://trinity.example.com)")
|
|
91
91
|
@click.option("--profile", "profile_opt", default=None,
|
|
92
92
|
help="Profile name to store credentials under (default: hostname)")
|
|
93
|
+
@click.option("--admin", is_flag=True, help="Login as admin with password instead of email")
|
|
93
94
|
@click.pass_context
|
|
94
|
-
def login(ctx, instance, profile_opt):
|
|
95
|
-
"""Log in to a Trinity instance
|
|
95
|
+
def login(ctx, instance, profile_opt, admin):
|
|
96
|
+
"""Log in to a Trinity instance.
|
|
97
|
+
|
|
98
|
+
By default, uses email verification. With --admin, uses password login.
|
|
99
|
+
"""
|
|
96
100
|
profile_name = profile_opt or _get_profile_name(ctx)
|
|
97
101
|
url = instance or get_instance_url(profile_name)
|
|
98
102
|
if not url:
|
|
@@ -113,6 +117,34 @@ def login(ctx, instance, profile_opt):
|
|
|
113
117
|
click.echo("Giving up after 3 attempts.", err=True)
|
|
114
118
|
raise SystemExit(1)
|
|
115
119
|
|
|
120
|
+
if admin:
|
|
121
|
+
# Admin password login via /api/token (form-encoded OAuth2)
|
|
122
|
+
password = click.prompt("Admin password", hide_input=True)
|
|
123
|
+
try:
|
|
124
|
+
result = client.post_form("/api/token", {
|
|
125
|
+
"username": "admin",
|
|
126
|
+
"password": password,
|
|
127
|
+
})
|
|
128
|
+
except TrinityAPIError as e:
|
|
129
|
+
click.echo(f"Admin login failed: {e.detail}", err=True)
|
|
130
|
+
raise SystemExit(1)
|
|
131
|
+
|
|
132
|
+
token = result["access_token"]
|
|
133
|
+
|
|
134
|
+
# Fetch user info with the new token
|
|
135
|
+
authed_client = TrinityClient(base_url=url, token=token)
|
|
136
|
+
try:
|
|
137
|
+
user = authed_client.get("/api/users/me")
|
|
138
|
+
except TrinityAPIError:
|
|
139
|
+
user = {"username": "admin", "role": "admin"}
|
|
140
|
+
|
|
141
|
+
target_profile = profile_name or profile_name_from_url(url)
|
|
142
|
+
set_auth(url, token, user, profile_name=target_profile)
|
|
143
|
+
click.echo(f"Logged in as admin [profile: {target_profile}]")
|
|
144
|
+
|
|
145
|
+
_provision_mcp_key(authed_client, target_profile)
|
|
146
|
+
return
|
|
147
|
+
|
|
116
148
|
email = click.prompt("Email")
|
|
117
149
|
|
|
118
150
|
# Request verification code
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|