cacli 0.2.0__tar.gz → 0.2.2__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.
- {cacli-0.2.0/src/cacli.egg-info → cacli-0.2.2}/PKG-INFO +4 -3
- {cacli-0.2.0 → cacli-0.2.2}/README.md +3 -2
- {cacli-0.2.0 → cacli-0.2.2}/pyproject.toml +1 -1
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/__init__.py +2 -1
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/cli.py +3 -10
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/engine.py +3 -18
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/codex.py +7 -2
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/inference.py +39 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/runner.py +3 -1
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/spawn.py +2 -2
- {cacli-0.2.0 → cacli-0.2.2/src/cacli.egg-info}/PKG-INFO +4 -3
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_codex_provider.py +9 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_launch.py +50 -4
- {cacli-0.2.0 → cacli-0.2.2}/LICENSE +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/setup.cfg +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/devin_stream.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/SKILL.md +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/__init__.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/aexec.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/cli.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/costs.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/host.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/journal.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/runs.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/sandbox.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/schema.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/flow/shim.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/__init__.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/base.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/claude.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/cursor.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/devin.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/opencode.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/harnesses/pi.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/server.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/sessions.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/status.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/transcript_apply.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli/types.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli.egg-info/SOURCES.txt +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli.egg-info/dependency_links.txt +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli.egg-info/entry_points.txt +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli.egg-info/requires.txt +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/src/cacli.egg-info/top_level.txt +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_claude_provider.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_cursor_provider.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_devin_provider.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_devin_stream.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_flow.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_flow_resume.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_flow_schema.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_opencode_provider.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_pi_provider.py +0 -0
- {cacli-0.2.0 → cacli-0.2.2}/tests/test_transcript_apply.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cacli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Harness and provider CLI for running coding agents
|
|
5
5
|
Author: Benjamin Anderson
|
|
6
6
|
License-Expression: MIT
|
|
@@ -48,10 +48,11 @@ A run selects a CLI harness, an inference provider, and an unqualified model ID:
|
|
|
48
48
|
```bash
|
|
49
49
|
cacli run "Review this diff" --harness claude --provider claude-api --model claude-opus-4-8
|
|
50
50
|
cacli run "Review this diff" --harness pi --provider workers-ai --model @cf/zai-org/glm-5.3
|
|
51
|
+
cacli run "Review this diff" --harness codex --provider azure --model gpt-5.3-codex
|
|
51
52
|
```
|
|
52
53
|
|
|
53
|
-
The CLI reads non-secret provider parameters from `AWS_REGION
|
|
54
|
-
`CLOUDFLARE_ACCOUNT_ID` and checks required credential names or login files
|
|
54
|
+
The CLI reads non-secret provider parameters from `AWS_REGION`,
|
|
55
|
+
`CLOUDFLARE_ACCOUNT_ID`, or `AZURE_OPENAI_ENDPOINT` and checks required credential names or login files
|
|
55
56
|
before execution. `build_launch()` returns the command, non-secret environment,
|
|
56
57
|
environment variables to unset, and credential wire metadata without reading
|
|
57
58
|
secret values. See [the provider design](docs/harnesses-and-providers.md).
|
|
@@ -33,10 +33,11 @@ A run selects a CLI harness, an inference provider, and an unqualified model ID:
|
|
|
33
33
|
```bash
|
|
34
34
|
cacli run "Review this diff" --harness claude --provider claude-api --model claude-opus-4-8
|
|
35
35
|
cacli run "Review this diff" --harness pi --provider workers-ai --model @cf/zai-org/glm-5.3
|
|
36
|
+
cacli run "Review this diff" --harness codex --provider azure --model gpt-5.3-codex
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
The CLI reads non-secret provider parameters from `AWS_REGION
|
|
39
|
-
`CLOUDFLARE_ACCOUNT_ID` and checks required credential names or login files
|
|
39
|
+
The CLI reads non-secret provider parameters from `AWS_REGION`,
|
|
40
|
+
`CLOUDFLARE_ACCOUNT_ID`, or `AZURE_OPENAI_ENDPOINT` and checks required credential names or login files
|
|
40
41
|
before execution. `build_launch()` returns the command, non-secret environment,
|
|
41
42
|
environment variables to unset, and credential wire metadata without reading
|
|
42
43
|
secret values. See [the provider design](docs/harnesses-and-providers.md).
|
|
@@ -5,7 +5,7 @@ Harness-agnostic interface for running headless coding agents.
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from cacli.harnesses import get_harness, list_harnesses
|
|
8
|
-
from cacli.inference import Credential, Param, Provider, WireBinding
|
|
8
|
+
from cacli.inference import Credential, Param, Provider, WireBinding, provider_params
|
|
9
9
|
from cacli.runner import (
|
|
10
10
|
LaunchSpec,
|
|
11
11
|
build_launch,
|
|
@@ -20,6 +20,7 @@ from cacli.types import AgentRunResult, ExecResult, ShellExecFn
|
|
|
20
20
|
__all__ = [
|
|
21
21
|
"run_agent",
|
|
22
22
|
"build_launch",
|
|
23
|
+
"provider_params",
|
|
23
24
|
"parse_output",
|
|
24
25
|
"build_initial_log_entry",
|
|
25
26
|
"build_pr_description_command",
|
|
@@ -7,7 +7,7 @@ import subprocess
|
|
|
7
7
|
import sys
|
|
8
8
|
|
|
9
9
|
from cacli.harnesses import list_harnesses
|
|
10
|
-
from cacli.inference import PROVIDERS
|
|
10
|
+
from cacli.inference import PROVIDERS, provider_params
|
|
11
11
|
from cacli.runner import build_launch, check_credentials, run_agent
|
|
12
12
|
from cacli.transcript_apply import TranscriptApplyError, run_transcript_apply
|
|
13
13
|
from cacli.types import ExecResult
|
|
@@ -111,13 +111,6 @@ def _add_common_args(parser: argparse.ArgumentParser) -> None:
|
|
|
111
111
|
)
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
def _provider_params() -> dict[str, str]:
|
|
115
|
-
return {
|
|
116
|
-
"region": os.environ.get("AWS_REGION", ""),
|
|
117
|
-
"account_id": os.environ.get("CLOUDFLARE_ACCOUNT_ID", ""),
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
114
|
def _run_command(args) -> None:
|
|
122
115
|
"""Handle 'cacli run' — synchronous agent execution."""
|
|
123
116
|
launch = build_launch(
|
|
@@ -125,7 +118,7 @@ def _run_command(args) -> None:
|
|
|
125
118
|
args.prompt,
|
|
126
119
|
provider=args.provider,
|
|
127
120
|
model=args.model,
|
|
128
|
-
params=
|
|
121
|
+
params=provider_params(),
|
|
129
122
|
reasoning_effort=args.reasoning_effort,
|
|
130
123
|
web_search=args.web_search,
|
|
131
124
|
settings=args.settings,
|
|
@@ -139,7 +132,7 @@ def _run_command(args) -> None:
|
|
|
139
132
|
result = run_agent(
|
|
140
133
|
harness=args.harness,
|
|
141
134
|
provider=args.provider,
|
|
142
|
-
params=
|
|
135
|
+
params=provider_params(),
|
|
143
136
|
prompt=args.prompt,
|
|
144
137
|
exec_fn=subprocess_exec,
|
|
145
138
|
model=args.model,
|
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
6
|
import json
|
|
7
|
-
import os
|
|
8
7
|
import time
|
|
9
8
|
from typing import Any, Awaitable, Callable
|
|
10
9
|
|
|
@@ -22,6 +21,7 @@ from cacli.flow.schema import (
|
|
|
22
21
|
validate_output,
|
|
23
22
|
)
|
|
24
23
|
from cacli.harnesses import get_harness
|
|
24
|
+
from cacli.inference import provider_params
|
|
25
25
|
from cacli.runner import build_launch, check_credentials
|
|
26
26
|
|
|
27
27
|
|
|
@@ -218,14 +218,7 @@ class FlowEngine:
|
|
|
218
218
|
prompt,
|
|
219
219
|
provider=provider_name,
|
|
220
220
|
model=model,
|
|
221
|
-
params=
|
|
222
|
-
"region": (env or {}).get(
|
|
223
|
-
"AWS_REGION", os.environ.get("AWS_REGION", "")
|
|
224
|
-
),
|
|
225
|
-
"account_id": (env or {}).get(
|
|
226
|
-
"CLOUDFLARE_ACCOUNT_ID", os.environ.get("CLOUDFLARE_ACCOUNT_ID", "")
|
|
227
|
-
),
|
|
228
|
-
},
|
|
221
|
+
params=provider_params(env),
|
|
229
222
|
)
|
|
230
223
|
adapter = get_harness(harness_name)
|
|
231
224
|
if self.exec_fn is aexec:
|
|
@@ -378,15 +371,7 @@ class FlowEngine:
|
|
|
378
371
|
schema_prompt + FLOW_PROMPT_SUFFIX,
|
|
379
372
|
provider=provider_name,
|
|
380
373
|
model=model,
|
|
381
|
-
params=
|
|
382
|
-
"region": (env or {}).get(
|
|
383
|
-
"AWS_REGION", os.environ.get("AWS_REGION", "")
|
|
384
|
-
),
|
|
385
|
-
"account_id": (env or {}).get(
|
|
386
|
-
"CLOUDFLARE_ACCOUNT_ID",
|
|
387
|
-
os.environ.get("CLOUDFLARE_ACCOUNT_ID", ""),
|
|
388
|
-
),
|
|
389
|
-
},
|
|
374
|
+
params=provider_params(env),
|
|
390
375
|
reasoning_effort=effort,
|
|
391
376
|
web_search=web_search,
|
|
392
377
|
settings=settings,
|
|
@@ -51,6 +51,11 @@ class CodexHarness(BaseHarness):
|
|
|
51
51
|
requires_model=True,
|
|
52
52
|
verified=False,
|
|
53
53
|
),
|
|
54
|
+
Pairing(
|
|
55
|
+
"azure",
|
|
56
|
+
credentials=("AZURE_OPENAI_API_KEY",),
|
|
57
|
+
requires_model=True,
|
|
58
|
+
),
|
|
54
59
|
Pairing(
|
|
55
60
|
"workers-ai",
|
|
56
61
|
credentials=("CLOUDFLARE_API_KEY",),
|
|
@@ -102,8 +107,8 @@ class CodexHarness(BaseHarness):
|
|
|
102
107
|
if reasoning_effort is not None:
|
|
103
108
|
cmd += f" --config model_reasoning_effort={shlex.quote(reasoning_effort)}"
|
|
104
109
|
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
# Codex enables cached web search by default, so state both cases.
|
|
111
|
+
cmd += f" --config web_search={'live' if web_search else 'disabled'}"
|
|
107
112
|
if output_schema is not None:
|
|
108
113
|
cmd += f" --output-schema {shlex.quote(str(output_schema))}"
|
|
109
114
|
return cmd
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"""Inference providers, required parameters, and credential wire metadata."""
|
|
2
2
|
|
|
3
|
+
import os
|
|
4
|
+
from collections.abc import Callable, Mapping
|
|
3
5
|
from dataclasses import dataclass, replace
|
|
6
|
+
from urllib.parse import urlsplit
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
@dataclass(frozen=True)
|
|
7
10
|
class Param:
|
|
8
11
|
name: str
|
|
9
12
|
env: str
|
|
13
|
+
normalize: Callable[[str], str] | None = None
|
|
14
|
+
|
|
15
|
+
def read(self, env: Mapping[str, str] | None = None) -> str:
|
|
16
|
+
return (env or {}).get(self.env, os.environ.get(self.env, ""))
|
|
10
17
|
|
|
11
18
|
|
|
12
19
|
@dataclass(frozen=True)
|
|
@@ -66,8 +73,16 @@ class Provider:
|
|
|
66
73
|
openai_base_url: str | None = None
|
|
67
74
|
|
|
68
75
|
|
|
76
|
+
def _hostname(endpoint: str) -> str:
|
|
77
|
+
"""Accept a bare host or a portal endpoint URL like https://x.openai.azure.com/."""
|
|
78
|
+
return urlsplit(endpoint if "//" in endpoint else f"//{endpoint}").hostname or ""
|
|
79
|
+
|
|
80
|
+
|
|
69
81
|
REGION = Param("region", "AWS_REGION")
|
|
70
82
|
ACCOUNT_ID = Param("account_id", "CLOUDFLARE_ACCOUNT_ID")
|
|
83
|
+
# Any of the resource's hosts works: *.openai.azure.com,
|
|
84
|
+
# *.cognitiveservices.azure.com, or *.services.ai.azure.com.
|
|
85
|
+
AZURE_HOST = Param("azure_host", "AZURE_OPENAI_ENDPOINT", normalize=_hostname)
|
|
71
86
|
|
|
72
87
|
PROVIDERS = {
|
|
73
88
|
"claude-sub": Provider(
|
|
@@ -137,6 +152,21 @@ PROVIDERS = {
|
|
|
137
152
|
),
|
|
138
153
|
"https://bedrock-runtime.{region}.amazonaws.com/openai/v1",
|
|
139
154
|
),
|
|
155
|
+
"azure": Provider(
|
|
156
|
+
"azure",
|
|
157
|
+
(AZURE_HOST,),
|
|
158
|
+
(
|
|
159
|
+
Credential(
|
|
160
|
+
env="AZURE_OPENAI_API_KEY",
|
|
161
|
+
binding=WireBinding(
|
|
162
|
+
("{azure_host}",),
|
|
163
|
+
header="Authorization",
|
|
164
|
+
value_format="Bearer {secret}",
|
|
165
|
+
),
|
|
166
|
+
),
|
|
167
|
+
),
|
|
168
|
+
"https://{azure_host}/openai/v1",
|
|
169
|
+
),
|
|
140
170
|
"workers-ai": Provider(
|
|
141
171
|
"workers-ai",
|
|
142
172
|
(ACCOUNT_ID,),
|
|
@@ -175,3 +205,12 @@ PROVIDERS = {
|
|
|
175
205
|
),
|
|
176
206
|
),
|
|
177
207
|
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def provider_params(env: Mapping[str, str] | None = None) -> dict[str, str]:
|
|
211
|
+
"""Read every provider parameter from env, falling back to os.environ."""
|
|
212
|
+
return {
|
|
213
|
+
param.name: param.read(env)
|
|
214
|
+
for provider in PROVIDERS.values()
|
|
215
|
+
for param in provider.params
|
|
216
|
+
}
|
|
@@ -37,8 +37,10 @@ def _build_launch(
|
|
|
37
37
|
adapter = get_harness(harness)
|
|
38
38
|
pair = adapter.pairing(provider)
|
|
39
39
|
catalog = PROVIDERS[pair.provider]
|
|
40
|
-
supplied = params or {}
|
|
40
|
+
supplied = dict(params or {})
|
|
41
41
|
for param in catalog.params:
|
|
42
|
+
if param.normalize and supplied.get(param.name):
|
|
43
|
+
supplied[param.name] = param.normalize(supplied[param.name])
|
|
42
44
|
if not supplied.get(param.name):
|
|
43
45
|
raise ValueError(
|
|
44
46
|
f"Missing provider parameter {param.name!r} (environment variable {param.env})"
|
|
@@ -7,7 +7,7 @@ import subprocess
|
|
|
7
7
|
import time
|
|
8
8
|
|
|
9
9
|
from cacli.runner import build_launch, build_initial_log_entry
|
|
10
|
-
from cacli.
|
|
10
|
+
from cacli.inference import provider_params
|
|
11
11
|
from cacli.runner import check_credentials
|
|
12
12
|
from cacli.sessions import (
|
|
13
13
|
SessionInfo,
|
|
@@ -41,7 +41,7 @@ def spawn_agent(args) -> None:
|
|
|
41
41
|
args.harness,
|
|
42
42
|
args.prompt,
|
|
43
43
|
provider=args.provider,
|
|
44
|
-
params=
|
|
44
|
+
params=provider_params(),
|
|
45
45
|
model=args.model,
|
|
46
46
|
reasoning_effort=getattr(args, "reasoning_effort", None),
|
|
47
47
|
web_search=getattr(args, "web_search", True),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cacli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Harness and provider CLI for running coding agents
|
|
5
5
|
Author: Benjamin Anderson
|
|
6
6
|
License-Expression: MIT
|
|
@@ -48,10 +48,11 @@ A run selects a CLI harness, an inference provider, and an unqualified model ID:
|
|
|
48
48
|
```bash
|
|
49
49
|
cacli run "Review this diff" --harness claude --provider claude-api --model claude-opus-4-8
|
|
50
50
|
cacli run "Review this diff" --harness pi --provider workers-ai --model @cf/zai-org/glm-5.3
|
|
51
|
+
cacli run "Review this diff" --harness codex --provider azure --model gpt-5.3-codex
|
|
51
52
|
```
|
|
52
53
|
|
|
53
|
-
The CLI reads non-secret provider parameters from `AWS_REGION
|
|
54
|
-
`CLOUDFLARE_ACCOUNT_ID` and checks required credential names or login files
|
|
54
|
+
The CLI reads non-secret provider parameters from `AWS_REGION`,
|
|
55
|
+
`CLOUDFLARE_ACCOUNT_ID`, or `AZURE_OPENAI_ENDPOINT` and checks required credential names or login files
|
|
55
56
|
before execution. `build_launch()` returns the command, non-secret environment,
|
|
56
57
|
environment variables to unset, and credential wire metadata without reading
|
|
57
58
|
secret values. See [the provider design](docs/harnesses-and-providers.md).
|
|
@@ -19,6 +19,15 @@ def test_build_command_no_sandbox_uses_danger_full_access():
|
|
|
19
19
|
assert "workspace-write" not in cmd
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def test_build_command_sets_web_search_explicitly():
|
|
23
|
+
provider = CodexHarness()
|
|
24
|
+
|
|
25
|
+
assert "--config web_search=live" in provider.build_command("x")
|
|
26
|
+
off = provider.build_command("x", web_search=False)
|
|
27
|
+
assert "--config web_search=disabled" in off
|
|
28
|
+
assert "web_search_request" not in off
|
|
29
|
+
|
|
30
|
+
|
|
22
31
|
def test_openai_pairing_keeps_model_and_effort_defaults():
|
|
23
32
|
cmd = build_launch("codex", "fix the tests").command
|
|
24
33
|
|
|
@@ -7,18 +7,22 @@ import pytest
|
|
|
7
7
|
|
|
8
8
|
from cacli import build_launch, get_harness, list_harnesses
|
|
9
9
|
from cacli.cli import check_credentials
|
|
10
|
-
from cacli.inference import PROVIDERS
|
|
10
|
+
from cacli.inference import PROVIDERS, provider_params
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
MATRIX = {
|
|
14
14
|
"claude": ("claude-sub", "claude-api", "bedrock"),
|
|
15
|
-
"codex": ("openai-sub", "openai-api", "bedrock", "workers-ai"),
|
|
15
|
+
"codex": ("openai-sub", "openai-api", "bedrock", "azure", "workers-ai"),
|
|
16
16
|
"pi": ("workers-ai", "claude-api", "openai-api"),
|
|
17
17
|
"opencode": ("workers-ai", "claude-api", "openai-api"),
|
|
18
18
|
"cursor": ("cursor",),
|
|
19
19
|
"devin": ("devin",),
|
|
20
20
|
}
|
|
21
|
-
PARAMS = {
|
|
21
|
+
PARAMS = {
|
|
22
|
+
"region": "us-west-2",
|
|
23
|
+
"account_id": "account-123",
|
|
24
|
+
"azure_host": "res.cognitiveservices.azure.com",
|
|
25
|
+
}
|
|
22
26
|
|
|
23
27
|
|
|
24
28
|
def test_full_support_matrix_and_unsupported_pairs():
|
|
@@ -208,7 +212,7 @@ def test_adapter_prefix_stays_before_binary_for_adversarial_prompts(
|
|
|
208
212
|
|
|
209
213
|
|
|
210
214
|
def test_codex_non_openai_pairs_require_explicit_model():
|
|
211
|
-
for provider in ("bedrock", "workers-ai"):
|
|
215
|
+
for provider in ("bedrock", "azure", "workers-ai"):
|
|
212
216
|
with pytest.raises(ValueError, match=f"model is required.*{provider}"):
|
|
213
217
|
build_launch("codex", "hello", provider=provider, params=PARAMS)
|
|
214
218
|
launch = build_launch(
|
|
@@ -236,3 +240,45 @@ def test_claude_sub_accepts_local_login_without_env(monkeypatch):
|
|
|
236
240
|
assert launch.credentials[0].local_login == "claude /login"
|
|
237
241
|
check_credentials(launch)
|
|
238
242
|
assert "ANTHROPIC_API_KEY" in launch.unset_env
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
@pytest.mark.parametrize(
|
|
246
|
+
"endpoint",
|
|
247
|
+
[
|
|
248
|
+
"https://res.cognitiveservices.azure.com/",
|
|
249
|
+
"https://res.cognitiveservices.azure.com/openai/v1",
|
|
250
|
+
"res.cognitiveservices.azure.com",
|
|
251
|
+
],
|
|
252
|
+
)
|
|
253
|
+
def test_azure_endpoint_resolves_to_host(endpoint):
|
|
254
|
+
launch = build_launch(
|
|
255
|
+
"codex",
|
|
256
|
+
"hello",
|
|
257
|
+
provider="azure",
|
|
258
|
+
model="gpt-5.3-codex",
|
|
259
|
+
params={"azure_host": endpoint},
|
|
260
|
+
)
|
|
261
|
+
assert (
|
|
262
|
+
"model_providers.azure.base_url=https://res.cognitiveservices.azure.com/openai/v1"
|
|
263
|
+
in launch.command
|
|
264
|
+
)
|
|
265
|
+
assert "model_providers.azure.env_key=AZURE_OPENAI_API_KEY" in launch.command
|
|
266
|
+
(credential,) = launch.credentials
|
|
267
|
+
assert credential.binding.hosts == ("res.cognitiveservices.azure.com",)
|
|
268
|
+
assert credential.binding.header == "Authorization"
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def test_azure_requires_endpoint():
|
|
272
|
+
with pytest.raises(ValueError, match="azure_host.*AZURE_OPENAI_ENDPOINT"):
|
|
273
|
+
build_launch("codex", "hello", provider="azure", model="m", params={})
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def test_provider_params_reads_every_param(monkeypatch):
|
|
277
|
+
monkeypatch.setenv("AWS_REGION", "us-east-1")
|
|
278
|
+
monkeypatch.delenv("CLOUDFLARE_ACCOUNT_ID", raising=False)
|
|
279
|
+
params = provider_params({"AZURE_OPENAI_ENDPOINT": "https://res.openai.azure.com/"})
|
|
280
|
+
assert params == {
|
|
281
|
+
"region": "us-east-1",
|
|
282
|
+
"account_id": "",
|
|
283
|
+
"azure_host": "https://res.openai.azure.com/",
|
|
284
|
+
}
|
|
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
|