aethis-cli 0.40.2__tar.gz → 0.41.0__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.
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/PKG-INFO +8 -1
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/README.md +7 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/_version.py +1 -1
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/client.py +21 -1
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/generate_cmd.py +19 -3
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/refine_cmd.py +3 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/config.py +7 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli.egg-info/PKG-INFO +8 -1
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli.egg-info/SOURCES.txt +1 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/pyproject.toml +1 -1
- aethis_cli-0.41.0/tests/test_generation_models.py +127 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/LICENSE +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/__init__.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/__main__.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/_terminal_safe.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/auth.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/auth_helpers.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/auth_providers.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/__init__.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/_id_utils.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/account_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/cancel_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/decide_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/explain_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/fields_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/guidance_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/init_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/login_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/mcp_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/profile_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/projects_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/publish_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/review_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/rulebooks_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/rulesets_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/status_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/test_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/update_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/usage_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/commands/whoami_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/contract.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/decision_view.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/errors.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/generation_status.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/main.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/output.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/prompts.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/py.typed +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/render.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/source_safeguards.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/source_targets.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli/update_check.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli.egg-info/dependency_links.txt +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli.egg-info/entry_points.txt +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli.egg-info/requires.txt +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/aethis_cli.egg-info/top_level.txt +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/setup.cfg +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_account_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_auth.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_auth_providers.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_cancel_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_capability_boundary.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_client.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_config.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_contract_decide.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_contract_identity_and_sources.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_contract_request_surface.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_contract_rulebook_decide.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_decide_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_documented_commands_run.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_empty_input_guards.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_explain_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_field_behaviour_metadata_transport.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_field_display_metadata_transport.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_fields_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_generate_failure_reporting.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_generate_fields.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_generate_no_publish.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_generate_replace_tests.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_generation_status.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_guidance_cli.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_id_utils.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_init.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_json_projection_pinning.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_lazy_auth.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_login_headless.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_main.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_mcp_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_output.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_profiles.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_prompts.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_publish_force.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_publish_rulebook_flags.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_publish_source_targets.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_release_tooling.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_render.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_review_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_rulebooks_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_rulesets_b1b_lifecycle.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_source_safeguards.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_spacecraft_example_pin.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_status_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_transport_error_rendering.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_update_check.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_update_cmd.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_usage.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_value_space_transport.py +0 -0
- {aethis_cli-0.40.2 → aethis_cli-0.41.0}/tests/test_whoami_cmd.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aethis-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.41.0
|
|
4
4
|
Summary: CLI for the Aethis developer API — author, test, and publish rulesets
|
|
5
5
|
Author-email: Aethis <eng@aethis.ai>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -155,6 +155,13 @@ aethis decide -i '{"space.crew.species": "Human", "space.crew.age": 35, "space.c
|
|
|
155
155
|
|
|
156
156
|
See the example's [README](https://github.com/Aethis-ai/aethis-examples/blob/main/spacecraft-crew-certification/README.md) for what each scenario covers.
|
|
157
157
|
|
|
158
|
+
Generation and refinement accept `--model claude-sonnet-5` (the default) or
|
|
159
|
+
`--model deepseek-flash`. For DeepSeek, set `DEEPSEEK_API_KEY`; an alternative
|
|
160
|
+
environment variable name can be configured with `deepseek_key_env` in
|
|
161
|
+
`aethis.yaml`. The DeepSeek credential is sent only with generation.
|
|
162
|
+
This option requires an engine supporting model selection. Live-provider
|
|
163
|
+
validation has passed; the matching engine and CLI releases are still pending.
|
|
164
|
+
|
|
158
165
|
## Commands
|
|
159
166
|
|
|
160
167
|
### Decision (no API key required)
|
|
@@ -121,6 +121,13 @@ aethis decide -i '{"space.crew.species": "Human", "space.crew.age": 35, "space.c
|
|
|
121
121
|
|
|
122
122
|
See the example's [README](https://github.com/Aethis-ai/aethis-examples/blob/main/spacecraft-crew-certification/README.md) for what each scenario covers.
|
|
123
123
|
|
|
124
|
+
Generation and refinement accept `--model claude-sonnet-5` (the default) or
|
|
125
|
+
`--model deepseek-flash`. For DeepSeek, set `DEEPSEEK_API_KEY`; an alternative
|
|
126
|
+
environment variable name can be configured with `deepseek_key_env` in
|
|
127
|
+
`aethis.yaml`. The DeepSeek credential is sent only with generation.
|
|
128
|
+
This option requires an engine supporting model selection. Live-provider
|
|
129
|
+
validation has passed; the matching engine and CLI releases are still pending.
|
|
130
|
+
|
|
124
131
|
## Commands
|
|
125
132
|
|
|
126
133
|
### Decision (no API key required)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from enum import Enum
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from typing import Any, Callable, Optional
|
|
7
8
|
|
|
@@ -23,6 +24,13 @@ KeyRefreshCallback = Callable[..., str]
|
|
|
23
24
|
_UNPROBED = object()
|
|
24
25
|
|
|
25
26
|
|
|
27
|
+
class GenerationModel(str, Enum):
|
|
28
|
+
"""Supported per-generation authoring models."""
|
|
29
|
+
|
|
30
|
+
sonnet = "claude-sonnet-5"
|
|
31
|
+
deepseek = "deepseek-flash"
|
|
32
|
+
|
|
33
|
+
|
|
26
34
|
class AethisClient:
|
|
27
35
|
"""Synchronous client wrapping all Aethis API endpoints."""
|
|
28
36
|
|
|
@@ -439,6 +447,9 @@ class AethisClient:
|
|
|
439
447
|
project_id: str,
|
|
440
448
|
mode: Optional[str] = None,
|
|
441
449
|
seed_ruleset_id: Optional[str] = None,
|
|
450
|
+
*,
|
|
451
|
+
model: Optional[GenerationModel] = None,
|
|
452
|
+
deepseek_key: Optional[str] = None,
|
|
442
453
|
) -> dict:
|
|
443
454
|
"""Trigger generation. ``mode="refine"`` seeds from the section's active
|
|
444
455
|
ruleset and makes the minimal edit to fix failing tests; omitting ``mode``
|
|
@@ -450,7 +461,16 @@ class AethisClient:
|
|
|
450
461
|
body["mode"] = mode
|
|
451
462
|
if seed_ruleset_id is not None:
|
|
452
463
|
body["seed_ruleset_id"] = seed_ruleset_id
|
|
453
|
-
|
|
464
|
+
if model is not None:
|
|
465
|
+
body["model"] = GenerationModel(model).value
|
|
466
|
+
if deepseek_key and model != GenerationModel.deepseek:
|
|
467
|
+
raise ValueError("A DeepSeek key requires model=deepseek-flash")
|
|
468
|
+
kwargs: dict[str, Any] = {"json": body} if body else {}
|
|
469
|
+
if model == GenerationModel.deepseek:
|
|
470
|
+
if self._client.headers.get("X-Anthropic-Key"):
|
|
471
|
+
raise ValueError("Use a client without an Anthropic key for DeepSeek generation")
|
|
472
|
+
if deepseek_key:
|
|
473
|
+
kwargs["headers"] = {"X-DeepSeek-Key": deepseek_key}
|
|
454
474
|
return self._request("POST", f"/api/v1/public/projects/{project_id}/generate", **kwargs)
|
|
455
475
|
|
|
456
476
|
def get_status(self, project_id: str) -> dict:
|
|
@@ -12,13 +12,14 @@ import typer
|
|
|
12
12
|
import yaml
|
|
13
13
|
from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn
|
|
14
14
|
|
|
15
|
-
from aethis_cli.client import AethisClient
|
|
15
|
+
from aethis_cli.client import AethisClient, GenerationModel
|
|
16
16
|
from aethis_cli.config import (
|
|
17
17
|
load_project_config,
|
|
18
18
|
make_authed_client,
|
|
19
19
|
read_state,
|
|
20
20
|
resolve_anthropic_key,
|
|
21
21
|
resolve_api_key,
|
|
22
|
+
resolve_deepseek_key,
|
|
22
23
|
write_state,
|
|
23
24
|
)
|
|
24
25
|
from aethis_cli.errors import AethisAPIError, ConfigError
|
|
@@ -750,6 +751,7 @@ def _upload_rulebook_guidance(client: AethisClient, pid: str, project_dir: Path)
|
|
|
750
751
|
|
|
751
752
|
|
|
752
753
|
def generate(
|
|
754
|
+
model: Optional[GenerationModel] = typer.Option(None, "--model", help="Authoring model (default: claude-sonnet-5)"),
|
|
753
755
|
project_id: Optional[str] = typer.Option(None, "--project-id", "-p"),
|
|
754
756
|
poll: bool = typer.Option(True, "--poll/--no-poll", help="Poll until generation completes"),
|
|
755
757
|
timeout: int = typer.Option(600, "--timeout", "-t", help="Polling timeout in seconds"),
|
|
@@ -777,6 +779,7 @@ def generate(
|
|
|
777
779
|
mode=mode,
|
|
778
780
|
seed_ruleset_id=seed_ruleset_id,
|
|
779
781
|
no_publish=no_publish,
|
|
782
|
+
model=model,
|
|
780
783
|
)
|
|
781
784
|
|
|
782
785
|
|
|
@@ -789,6 +792,7 @@ def _run_generate(
|
|
|
789
792
|
seed_ruleset_id: Optional[str] = None,
|
|
790
793
|
extra_hint: Optional[str] = None,
|
|
791
794
|
no_publish: bool = False,
|
|
795
|
+
model: Optional[GenerationModel] = None,
|
|
792
796
|
) -> None:
|
|
793
797
|
"""Shared machinery for ``aethis generate`` and ``aethis refine``.
|
|
794
798
|
|
|
@@ -796,10 +800,17 @@ def _run_generate(
|
|
|
796
800
|
is the plumbing for one flag on one command, not a change of default for
|
|
797
801
|
everything that shares the machinery.
|
|
798
802
|
"""
|
|
803
|
+
if model is not None:
|
|
804
|
+
try:
|
|
805
|
+
model = GenerationModel(model)
|
|
806
|
+
except ValueError:
|
|
807
|
+
console.print("[red]Unsupported authoring model. Use claude-sonnet-5 or deepseek-flash.[/red]")
|
|
808
|
+
raise typer.Exit(code=2) from None
|
|
799
809
|
try:
|
|
800
810
|
cfg = load_project_config()
|
|
801
811
|
api_key = resolve_api_key(cfg)
|
|
802
|
-
anthropic_key = resolve_anthropic_key(cfg)
|
|
812
|
+
anthropic_key = None if model == GenerationModel.deepseek else resolve_anthropic_key(cfg)
|
|
813
|
+
deepseek_key = resolve_deepseek_key(cfg) if model == GenerationModel.deepseek else None
|
|
803
814
|
except ConfigError as e:
|
|
804
815
|
console.print(f"[red]{e}[/red]")
|
|
805
816
|
raise typer.Exit(code=1)
|
|
@@ -871,7 +882,12 @@ def _run_generate(
|
|
|
871
882
|
# Trigger generation
|
|
872
883
|
if mode == "refine":
|
|
873
884
|
info("Refining: seeding from the active ruleset and making the minimal edit to fix failing tests")
|
|
874
|
-
|
|
885
|
+
generation_options = {}
|
|
886
|
+
if model is not None:
|
|
887
|
+
generation_options["model"] = model
|
|
888
|
+
if deepseek_key:
|
|
889
|
+
generation_options["deepseek_key"] = deepseek_key
|
|
890
|
+
job = client.generate(pid, mode=mode, seed_ruleset_id=seed_ruleset_id, **generation_options)
|
|
875
891
|
write_state(project_dir, {"project_id": pid, "job_id": job["job_id"]})
|
|
876
892
|
info(f"Generation queued (job={job['job_id']})")
|
|
877
893
|
# Surface the remaining generate budget from the POST's X-RateLimit-*
|
|
@@ -7,10 +7,12 @@ from typing import Optional
|
|
|
7
7
|
|
|
8
8
|
import typer
|
|
9
9
|
|
|
10
|
+
from aethis_cli.client import GenerationModel
|
|
10
11
|
from aethis_cli.commands.generate_cmd import _run_generate
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
def refine(
|
|
15
|
+
model: Optional[GenerationModel] = typer.Option(None, "--model", help="Authoring model (default: claude-sonnet-5)"),
|
|
14
16
|
hint: Optional[str] = typer.Option(None, "--hint", help="Guidance hint to add before refining"),
|
|
15
17
|
project_id: Optional[str] = typer.Option(None, "--project-id", "-p"),
|
|
16
18
|
seed_ruleset_id: Optional[str] = typer.Option(
|
|
@@ -33,4 +35,5 @@ def refine(
|
|
|
33
35
|
mode="refine",
|
|
34
36
|
seed_ruleset_id=seed_ruleset_id,
|
|
35
37
|
extra_hint=hint,
|
|
38
|
+
model=model,
|
|
36
39
|
)
|
|
@@ -42,6 +42,7 @@ class ProjectConfig:
|
|
|
42
42
|
base_url: str = DEFAULT_BASE_URL
|
|
43
43
|
project_id: Optional[str] = None
|
|
44
44
|
config_path: Path = field(default_factory=lambda: Path.cwd())
|
|
45
|
+
deepseek_key_env: str = "DEEPSEEK_API_KEY"
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
def resolve_base_url_with_source() -> tuple[str, str]:
|
|
@@ -208,6 +209,7 @@ def load_project_config(path: Optional[Path] = None) -> ProjectConfig:
|
|
|
208
209
|
project=raw["project"],
|
|
209
210
|
api_key_env=raw.get("api_key_env", "AETHIS_API_KEY"),
|
|
210
211
|
anthropic_key_env=raw.get("anthropic_key_env", "ANTHROPIC_API_KEY"),
|
|
212
|
+
deepseek_key_env=raw.get("deepseek_key_env", "DEEPSEEK_API_KEY"),
|
|
211
213
|
base_url=base_url,
|
|
212
214
|
project_id=project_id,
|
|
213
215
|
config_path=project_dir,
|
|
@@ -450,3 +452,8 @@ def set_active_profile(name: str) -> None:
|
|
|
450
452
|
creds = load_credentials()
|
|
451
453
|
creds["active_profile"] = name
|
|
452
454
|
save_credentials(creds)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def resolve_deepseek_key(config: ProjectConfig) -> Optional[str]:
|
|
458
|
+
"""Read the generation-only DeepSeek credential from the configured env var."""
|
|
459
|
+
return os.environ.get(config.deepseek_key_env) or None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aethis-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.41.0
|
|
4
4
|
Summary: CLI for the Aethis developer API — author, test, and publish rulesets
|
|
5
5
|
Author-email: Aethis <eng@aethis.ai>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -155,6 +155,13 @@ aethis decide -i '{"space.crew.species": "Human", "space.crew.age": 35, "space.c
|
|
|
155
155
|
|
|
156
156
|
See the example's [README](https://github.com/Aethis-ai/aethis-examples/blob/main/spacecraft-crew-certification/README.md) for what each scenario covers.
|
|
157
157
|
|
|
158
|
+
Generation and refinement accept `--model claude-sonnet-5` (the default) or
|
|
159
|
+
`--model deepseek-flash`. For DeepSeek, set `DEEPSEEK_API_KEY`; an alternative
|
|
160
|
+
environment variable name can be configured with `deepseek_key_env` in
|
|
161
|
+
`aethis.yaml`. The DeepSeek credential is sent only with generation.
|
|
162
|
+
This option requires an engine supporting model selection. Live-provider
|
|
163
|
+
validation has passed; the matching engine and CLI releases are still pending.
|
|
164
|
+
|
|
158
165
|
## Commands
|
|
159
166
|
|
|
160
167
|
### Decision (no API key required)
|
|
@@ -74,6 +74,7 @@ tests/test_generate_failure_reporting.py
|
|
|
74
74
|
tests/test_generate_fields.py
|
|
75
75
|
tests/test_generate_no_publish.py
|
|
76
76
|
tests/test_generate_replace_tests.py
|
|
77
|
+
tests/test_generation_models.py
|
|
77
78
|
tests/test_generation_status.py
|
|
78
79
|
tests/test_guidance_cli.py
|
|
79
80
|
tests/test_id_utils.py
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Per-generation model and credential boundaries."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from unittest.mock import MagicMock
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
import respx
|
|
10
|
+
from typer.testing import CliRunner
|
|
11
|
+
|
|
12
|
+
from aethis_cli.client import AethisClient, GenerationModel
|
|
13
|
+
from aethis_cli.commands import generate_cmd, refine_cmd
|
|
14
|
+
from aethis_cli.config import load_project_config, resolve_deepseek_key
|
|
15
|
+
from aethis_cli.main import app
|
|
16
|
+
|
|
17
|
+
BASE = "https://test.local"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.mark.parametrize("mode", ["fresh", "refine"])
|
|
21
|
+
@respx.mock
|
|
22
|
+
def test_deepseek_generation_header_is_request_scoped(mode: str) -> None:
|
|
23
|
+
generate = respx.post(f"{BASE}/api/v1/public/projects/p/generate").respond(202, json={"job_id": "j"})
|
|
24
|
+
discover = respx.post(f"{BASE}/api/v1/public/projects/p/fields/discover").respond(200, json={})
|
|
25
|
+
review = respx.post(f"{BASE}/api/v1/public/projects/p/review").respond(200, json={})
|
|
26
|
+
with AethisClient("ak", BASE) as client:
|
|
27
|
+
client.generate("p", mode=mode, model=GenerationModel.deepseek, deepseek_key="secret")
|
|
28
|
+
client.discover_fields("p")
|
|
29
|
+
client.review("p", coach=True)
|
|
30
|
+
request = generate.calls.last.request
|
|
31
|
+
assert json.loads(request.content) == {"mode": mode, "model": "deepseek-flash"}
|
|
32
|
+
assert request.headers["X-DeepSeek-Key"] == "secret"
|
|
33
|
+
assert "X-Anthropic-Key" not in request.headers
|
|
34
|
+
for route in (discover, review):
|
|
35
|
+
assert "X-DeepSeek-Key" not in route.calls.last.request.headers
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@respx.mock
|
|
39
|
+
def test_explicit_sonnet_keeps_anthropic_transport() -> None:
|
|
40
|
+
route = respx.post(f"{BASE}/api/v1/public/projects/p/generate").respond(202, json={})
|
|
41
|
+
with AethisClient("ak", BASE, anthropic_key="anthropic") as client:
|
|
42
|
+
client.generate("p", model=GenerationModel.sonnet)
|
|
43
|
+
assert json.loads(route.calls.last.request.content) == {"model": "claude-sonnet-5"}
|
|
44
|
+
assert route.calls.last.request.headers["X-Anthropic-Key"] == "anthropic"
|
|
45
|
+
assert "X-DeepSeek-Key" not in route.calls.last.request.headers
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_client_rejects_provider_key_mix() -> None:
|
|
49
|
+
with AethisClient("ak", BASE, anthropic_key="anthropic") as client:
|
|
50
|
+
with pytest.raises(ValueError, match="without an Anthropic"):
|
|
51
|
+
client.generate("p", model=GenerationModel.deepseek, deepseek_key="secret")
|
|
52
|
+
with AethisClient("ak", BASE) as client:
|
|
53
|
+
with pytest.raises(ValueError, match="requires model"):
|
|
54
|
+
client.generate("p", deepseek_key="secret")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@pytest.mark.parametrize("command", ["generate", "refine"])
|
|
58
|
+
def test_flags_forward_model(command: str, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
59
|
+
run = MagicMock()
|
|
60
|
+
module = generate_cmd if command == "generate" else refine_cmd
|
|
61
|
+
monkeypatch.setattr(module, "_run_generate", run)
|
|
62
|
+
result = CliRunner().invoke(app, [command, "--model", "deepseek-flash", "--no-poll"])
|
|
63
|
+
assert result.exit_code == 0, result.output
|
|
64
|
+
assert run.call_args.kwargs["model"] == GenerationModel.deepseek
|
|
65
|
+
invalid = CliRunner().invoke(app, [command, "--model", "unknown"])
|
|
66
|
+
assert invalid.exit_code == 2
|
|
67
|
+
assert run.call_count == 1
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_configurable_deepseek_env(tmp_path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
71
|
+
config = tmp_path / "aethis.yaml"
|
|
72
|
+
config.write_text("project: example\ndeepseek_key_env: CUSTOM_DEEPSEEK\n")
|
|
73
|
+
monkeypatch.setenv("CUSTOM_DEEPSEEK", "secret")
|
|
74
|
+
assert resolve_deepseek_key(load_project_config(config)) == "secret"
|
|
75
|
+
config.write_text("project: example\n")
|
|
76
|
+
monkeypatch.setenv("DEEPSEEK_API_KEY", "default-secret")
|
|
77
|
+
assert resolve_deepseek_key(load_project_config(config)) == "default-secret"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@pytest.mark.parametrize("model", [None, GenerationModel.sonnet, GenerationModel.deepseek])
|
|
81
|
+
def test_generation_resolves_only_selected_provider(model, tmp_path, monkeypatch) -> None:
|
|
82
|
+
from tests.test_generate_no_publish import SUCCESS, _engine, _project, _wire
|
|
83
|
+
|
|
84
|
+
_project(tmp_path)
|
|
85
|
+
client = _engine(SUCCESS)
|
|
86
|
+
_wire(monkeypatch, tmp_path, client)
|
|
87
|
+
anthropic = MagicMock(return_value="anthropic-secret")
|
|
88
|
+
deepseek = MagicMock(return_value="deepseek-secret")
|
|
89
|
+
factory = MagicMock(return_value=client)
|
|
90
|
+
monkeypatch.setattr(generate_cmd, "resolve_anthropic_key", anthropic)
|
|
91
|
+
monkeypatch.setattr(generate_cmd, "resolve_deepseek_key", deepseek)
|
|
92
|
+
monkeypatch.setattr(generate_cmd, "make_authed_client", factory)
|
|
93
|
+
generate_cmd._run_generate(project_id="p", poll=False, timeout=30, model=model)
|
|
94
|
+
if model == GenerationModel.deepseek:
|
|
95
|
+
anthropic.assert_not_called()
|
|
96
|
+
deepseek.assert_called_once()
|
|
97
|
+
assert factory.call_args.kwargs["anthropic_key"] is None
|
|
98
|
+
assert client.generate.call_args.kwargs["deepseek_key"] == "deepseek-secret"
|
|
99
|
+
else:
|
|
100
|
+
deepseek.assert_not_called()
|
|
101
|
+
anthropic.assert_called_once()
|
|
102
|
+
assert factory.call_args.kwargs["anthropic_key"] == "anthropic-secret"
|
|
103
|
+
assert "deepseek_key" not in client.generate.call_args.kwargs
|
|
104
|
+
if model is None:
|
|
105
|
+
assert "model" not in client.generate.call_args.kwargs
|
|
106
|
+
else:
|
|
107
|
+
assert client.generate.call_args.kwargs["model"] == model
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_invalid_model_stops_before_project_loading(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
111
|
+
import typer
|
|
112
|
+
|
|
113
|
+
load = MagicMock()
|
|
114
|
+
monkeypatch.setattr(generate_cmd, "load_project_config", load)
|
|
115
|
+
with pytest.raises(typer.Exit):
|
|
116
|
+
generate_cmd._run_generate(project_id="p", poll=False, timeout=30, model="typo")
|
|
117
|
+
load.assert_not_called()
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def test_project_config_preserves_positional_arguments(tmp_path) -> None:
|
|
121
|
+
from aethis_cli.config import ProjectConfig
|
|
122
|
+
|
|
123
|
+
config = ProjectConfig("example", "API_KEY", "ANTHROPIC_KEY", BASE, "project-id", tmp_path)
|
|
124
|
+
assert config.base_url == BASE
|
|
125
|
+
assert config.project_id == "project-id"
|
|
126
|
+
assert config.config_path == tmp_path
|
|
127
|
+
assert config.deepseek_key_env == "DEEPSEEK_API_KEY"
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|