Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
feat(examples): coding agent with OpenCode, with an agent-loop conformance check (#727)
Krisztian Gajdard59e8a118417
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ad29226f5..c03f6cc1b 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -80,6 +80,13 @@ jobs:mise exec -- uv run --frozen --project . --no-sync ruff check --select E,F,I,UP,B tools/cimise exec -- uv run --frozen --project . --no-sync ruff check --select E9,F63,F7,F82 tools/mise_tasksmise exec -- uv run --frozen --project . --no-sync pytest -q tools/ci/tests --ignore tools/ci/tests/test_required_ci.py --ignore tools/ci/tests/test_public_tree.py --ignore tools/ci/tests/test_helm_render.py+ - name: OpenCode example checker and gate+ working-directory: examples/coding-agent-opencode+ run: |+ mise exec -- uv lock --check+ mise exec -- uv run --frozen ruff format --check .+ mise exec -- uv run --frozen ruff check .+ mise exec -- uv run --frozen pytest -q- name: Pinned collector privacyrun: |mise run helm -- dependenciesdiff --git a/examples/README.md b/examples/README.mdindex bc657709b..128b3a2bf 100644--- a/examples/README.md+++ b/examples/README.md@@ -20,6 +20,7 @@ to a separately maintained repository (clone and run there).| [Extract custom entities from primary sources](./named-entity-extraction) | Changing zero-shot labels across financial, healthcare, rail-safety and legal text, with the two labels that came back empty left visible | `extract` | SIE endpoint with GLiNER multi v2.1; `fetch.py` pulls the recorded run, `score.py` reproduces the counts with no key | Runnable recorded example || [Extract the entity types you name, with no model to train](./custom-entity-types) | Asking for the 85 entity types of seven zero-shot NER sets and scoring exact spans against GPT-6 Luna, GPT-6 Sol, Claude Haiku 4.5, SIE Qwen3.8 27B, AWS Comprehend and spaCy, with a paired bootstrap and the price of each | `extract` | SIE server with GLiNER BioMed Large; `fetch.py` pulls the recorded run, `score.py` reproduces the figures with no key | Runnable recorded example || [Answer a question from a passage, and quote the sentence you used](./chat) | Checking a generated answer for its citation, its length and whether it declines a question the passage cannot answer | `chat/completions` | SIE Cloud with Qwen3.8 27B; `fetch.py` pulls the recorded run, `score.py` reproduces the numbers with no key | Runnable recorded example |+| [Run a coding agent on SIE with OpenCode](./coding-agent-opencode) | Pointing OpenCode at a laptop server, a self-hosted cluster or SIE Cloud, and checking the agent loop the way OpenCode drives it: streaming tool-call deltas, parallel calls, tool-result round trips, a 64K-plus prompt, finish reasons, usage and the reasoning field | `chat/completions` | An SIE Cloud endpoint that lists GLM-5.3-Flash via SIE Relay, or a local server; the laptop recipe was run only on Apple Silicon with Qwen3.5-4B, where the server refuses OpenCode's first turn today; `conformance.py` reports every case, `run_gate.sh` makes OpenCode fix a seeded failing test | Runnable check, Cloud results pending || [Route requests while skipping most generation calls](./request-routing) | Assigning support, banking and assistant requests to routes with an embedding classifier and conditional generation | `encode`, `chat/completions` | SIE server with Qwen3 Embedding 4B and Qwen3.8 27B; recorded 3,000-case verification needs no API key | Runnable recorded example || [Send each request to a cheap or a strong LLM](./request-routing/cost) | Cutting LLM spend with a bge-m3 nearest-neighbour router that picks GPT-6 Luna or GPT-6.1 Sol per request: 38.6% less than always using GPT-6.1 Sol at 95.8% of its quality on 728 held-out requests of a pre-registered study | `encode` | SIE Serverless with bge-m3; `fetch.py` pulls the recorded study, `score.py` reproduces the held-out table with no key | Runnable recorded example || [Turn PDF pages into Markdown, scored on olmOCR-Bench](./document-to-markdown-olmocr) | Converting all 1,403 pages of Ai2's olmOCR-Bench with LightOnOCR-2-1B and scoring them with Ai2's own scorer, beside published Azure Document Intelligence and AWS Textract runs | `extract` | SIE Cloud with LightOnOCR-2-1B; `fetch.py` pulls the recorded run, `score.py` reproduces the scores with no key | Runnable recorded example |diff --git a/examples/coding-agent-opencode/.gitignore b/examples/coding-agent-opencode/.gitignorenew file mode 100644index 000000000..24152e4df--- /dev/null+++ b/examples/coding-agent-opencode/.gitignore@@ -0,0 +1,7 @@+.venv/+run-output/+__pycache__/+.ruff_cache/+.pytest_cache/+fixture/.venv/+fixture/uv.lockdiff --git a/examples/coding-agent-opencode/README.md b/examples/coding-agent-opencode/README.mdnew file mode 100644index 000000000..f9b55bc84--- /dev/null+++ b/examples/coding-agent-opencode/README.md@@ -0,0 +1,377 @@+# Run a coding agent on SIE with OpenCode++## What this shows++[OpenCode](https://opencode.ai) is an open-source coding agent. It talks to+any OpenAI-compatible chat endpoint through a custom provider built on+`@ai-sdk/openai-compatible`, which targets `/v1/chat/completions`. This+example points it at SIE three ways and checks that the agent loop holds up:++- a laptop running `sie-server` with a small tools-capable model,+- a self-hosted SIE cluster, reached through its gateway with a key,+- SIE Cloud, where `zai-org/GLM-5.3-Flash:relay` is served through SIE Relay.++Three pieces are in this directory:++1. `recipes/<laptop|cluster|cloud>/opencode.json`, one OpenCode config per+ setup.+2. `conformance.py`, an agent-loop conformance check. It drives+ `/v1/chat/completions` the way OpenCode does, streaming, with tools declared+ on every turn and tool results sent back as `role: tool` messages, and+ reports each case as pass, fail or recorded, with the values it saw.+3. `fixture/` and `run_gate.sh`, a seeded gate. The fixture is a tiny package+ with two failing tests and a one-line task, "make the tests pass". The+ script runs OpenCode on a copy non-interactively, then runs pytest on the+ result and prints the verdict. A run where `opencode run` exits non-zero+ fails. A run that changed the tests or `pyproject.toml`, or added a+ `conftest.py`, fails before pytest is asked. The verdict run is pinned to+ the seeded `pyproject.toml` and `tests/` path and runs in a fresh+ environment outside the worked copy, so a new `pytest.ini`, test directory+ or anything planted in the copy's `.venv` does not count, and neither does+ a `PYTEST_ADDOPTS` or `PYTEST_PLUGINS` in the caller's environment. The+ OpenCode run is bounded: its build agent gets 50 steps (`GATE_STEPS`), and+ a run still going after 1,800 seconds (`GATE_DEADLINE_SECONDS`) is stopped+ and fails. OpenCode 1.19.0 treats the step budget as an instruction: at the+ last step it tells the model to answer in text but still declares the+ tools, so a model that keeps calling tools is stopped by the deadline.++The conformance check uses the `openai` Python package rather than the SIE+SDK. The thing under test is the OpenAI-compatible wire surface that+OpenCode's provider speaks, so the reference client for that surface is the+right instrument.++## Run it++### Against SIE Cloud++Set `SIE_BASE_URL` to the SIE Cloud endpoint your key belongs to, without+`/v1`, and check that `GET $SIE_BASE_URL/v1/models` lists+`zai-org/GLM-5.3-Flash:relay` there. The Cloud recipe reads both variables, so+it works unchanged against any endpoint that serves the model.++```sh+export SIE_BASE_URL=https://... # your SIE Cloud endpoint+export SIE_API_KEY=sk-sie-...+uv sync+uv run python conformance.py --base-url "$SIE_BASE_URL/v1" --model zai-org/GLM-5.3-Flash:relay+```++Then copy `recipes/cloud/opencode.json` into a project and start `opencode`+there, or run the seeded gate, which needs only `opencode` and `uv` on `PATH`+and the two variables:++```sh+./run_gate.sh+```++### Against a laptop++From a checkout of this repository:++```sh+mise run serve -- -b sglang # generation bundle; MLX on Apple Silicon+```++Then, from this directory:++```sh+uv sync+uv run python conformance.py --model Qwen/Qwen3.5-4B:long-context+./run_gate.sh laptop+```++`Qwen/Qwen3.5-4B:long-context` is the 32K-window profile of a 4B model that+declares tool calling. Its bare name has an 8K window, which is smaller than+OpenCode's own system prompt plus its ten tool schemas, so the recipe names the+profile.++The laptop recipe has been run on Apple Silicon only, with the MLX backend and+this model: the conformance check bare and as `:long-context`, the seeded gate+with the recipe's `:long-context`. Both pass there (see+[the recorded result](#laptop-apple-silicon-recorded)). It has not been run on+an NVIDIA machine.++### Against your cluster++Set `limit.context` and `limit.output` in `recipes/cluster/opencode.json` to+the window your cluster advertises for the model in `/v1/models`. The recipe+reads `SIE_BASE_URL` and `SIE_API_KEY` like the Cloud one. Then:++```sh+export SIE_BASE_URL=https://your-gateway+export SIE_API_KEY=...+uv run python conformance.py --base-url "$SIE_BASE_URL/v1" --model zai-org/GLM-5.3-Flash+./run_gate.sh cluster+```++The cluster recipe is a template and has not been run. On a model whose+declared window is under 64K tokens, such as the bare `zai-org/GLM-5.3-Flash`+at 16,384, the 64K-plus prompt case is recorded rather than judged. A window+that size also runs out within a long agent session.++Every path writes a JSON report, `run-output/conformance.json` by default,+and prints a table. The exit code is 1 when any case fails.++## The OpenCode recipes++The three configs differ only in `baseURL`, the key and the model list. The+Cloud one in full:++```json+{+ "$schema": "https://opencode.ai/config.json",+ "model": "sie/zai-org/GLM-5.3-Flash:relay",+ "provider": {+ "sie": {+ "npm": "@ai-sdk/openai-compatible",+ "name": "SIE Cloud",+ "options": {+ "baseURL": "{env:SIE_BASE_URL}/v1",+ "apiKey": "{env:SIE_API_KEY}",+ "timeout": 1800000,+ "headerTimeout": 600000,+ "chunkTimeout": 600000+ },+ "models": {+ "zai-org/GLM-5.3-Flash:relay": {+ "name": "GLM-5.3-Flash via SIE Relay",+ "limit": { "context": 131072, "output": 32768 },+ "tool_call": true,+ "reasoning": true,+ "interleaved": { "field": "reasoning_content" },+ "options": { "include_reasoning": true }+ }+ }+ }+ }+}+```++- `npm` names the AI SDK provider package OpenCode installs for a custom+ provider. `@ai-sdk/openai-compatible` speaks `/v1/chat/completions`.+- `{env:SIE_BASE_URL}` and `{env:SIE_API_KEY}` are OpenCode's own+ substitution; neither the endpoint nor the key sits in the file.+- `limit.context` and `limit.output` are what OpenCode budgets against. They+ match the window the `:relay` profile declares on SIE Cloud. OpenCode derives+ `max_tokens` from `limit.output` and sent 32000 for 32768.+- `options.include_reasoning` asks SIE to return the model's reasoning as+ `reasoning_content`. It is off by default, and a model that declares no+ reasoning answers it with nothing. `reasoning: true` declares the model as one+ that thinks.+- `interleaved.field: reasoning_content` makes OpenCode send each earlier+ assistant turn's reasoning back on that message as `reasoning_content`, an+ empty string when the turn had none, so the model sees its own earlier+ thinking on the next turn.+- `timeout`, `headerTimeout` and `chunkTimeout` bound the whole request, the+ wait for response headers and the gap between streamed chunks. A reasoning+ model can stream nothing for minutes while it thinks, so both of the last two+ are set above OpenCode's 300 s header default, and the whole-request bound is+ 30 minutes, so a long think never looks like a hang.++### What OpenCode puts on the wire++Verified on 2026-10-13 with OpenCode 1.19.0 and a recording stub standing in+for the endpoint, rather than assumed from the docs:++- `{env:SIE_BASE_URL}/v1` in `baseURL` is substituted, and the requests+ arrived at `/v1/chat/completions` on the stub.+- The model id is sent verbatim, colon included: `"model":+ "zai-org/GLM-5.3-Flash:relay"`. The `provider/model` selector splits on its+ first slash, so a model id can carry slashes and a colon.+- Per-model `options` are spread into the request body as top-level fields:+ every request carried `"include_reasoning": true`.+- `timeout`, `headerTimeout` and `chunkTimeout` never reach the body. OpenCode+ reads them off the provider options before building the request.+- Every agent turn is `stream: true` with `stream_options.include_usage:+ true`, `max_tokens`, `tool_choice: "auto"` and OpenCode's ten built-in tools+ (`bash`, `edit`, `glob`, `grep`, `read`, `skill`, `task`, `todowrite`,+ `webfetch`, `write`). No `temperature` and no `parallel_tool_calls` are sent.+ A separate, tool-less call names the session.+- The assistant turn that made a tool call goes back with `content: ""` and,+ with the Cloud recipe, `reasoning_content` set to the reasoning streamed in+ that turn, or `""` when there was none. With the cluster recipe, which has no+ `interleaved` setting, `reasoning_content` goes back only for a turn that+ streamed some.+- The key arrives as `Authorization: Bearer ...`.++Because both the colon and the option forwarding held, the fallback of+sending options as per-model `headers` was not needed and is not in the+recipes.++## What `conformance.py` checks++When the endpoint accepts `include_reasoning`, every tools turn below carries+it and the round trip sends the first turn's reasoning back as+`reasoning_content`, which is the wire the Cloud recipe makes OpenCode send.+When the endpoint refuses the field, the tools turns go without it, as with+the laptop and cluster recipes. The report's `tools_turn_params` says which.++| Case | Passes when |+|---|---|+| `tool_choice_auto` | the tools turn is accepted with `tool_choice: "auto"`, which OpenCode sends on every turn. When the field is refused, the remaining tool cases run without it so the rest of the loop is still measured. When the turn fails for another reason, the case is recorded as not judged |+| `streaming_tool_call_deltas` | the streamed deltas assemble into calls with an id, the name `get_weather`, JSON-object arguments carrying `city`, the first delta of each call carrying id and name, and `finish_reason: tool_calls` |+| `parallel_tool_calls` | one turn asked for Paris and Tokyo returns at least two calls with distinct ids and both cities |+| `tool_result_round_trip` | after the assistant `tool_calls` message and a `role: tool` result of 18 degrees, the final answer carries 18, no further call, `finish_reason: stop` |+| `prompt_above_64k_tokens` | a prompt of 68,000 filler words with a needle is accepted, `usage.prompt_tokens` is above 65,536, and an answer comes back; whether the needle was found is recorded, not required. When the model's declared window in `/v1/models` is under 65,536, a refusal or an acceptance is recorded instead |+| `finish_reason_stop` | a one-word answer ends with `stop` |+| `finish_reason_tool_calls` | the tool-call turn above ended with `tool_calls` |+| `finish_reason_length` | `max_tokens: 8` on a long request ends with `length` |+| `usage_on_final_chunk` | with `stream_options.include_usage`, the last chunk carries `prompt_tokens` and `completion_tokens` |+| `include_reasoning` | the flag is accepted streamed and not streamed, no raw `<think>` tag leaks into content, and without the flag no `reasoning_content` arrives. When the model reasoned, the stream carries `delta.reasoning_content` and the non-streamed answer `message.reasoning_content`. A model reasoned when it returned reasoning, or when its completion tokens exceed the UTF-8 bytes of its visible text by more than 16, since a byte-level tokenizer spends at most one token per byte. It did not reason when no answer took more than 16 completion tokens. Between the two, whether it reasoned is unknown and the case is recorded, not judged |+| `tool_choice_required` | recorded as `supported` when a call is forced or `refused` on a 400 or 422, neither a failure; accepted-but-ignored fails, and so does any other error |++Every request asks for up to 4,096 tokens, except the `length` case, so a+model that thinks before it answers has room to finish. The 68,000-word+prompt counts at least one token per word on any tokenizer that does not merge+words: 71,431 with `cl100k_base`, 71,917 with `o200k_base`, 74,835 with+Qwen3.5's tokenizer and 71,432 with GLM-5.3-Flash's.++Every case keeps what it observed in the JSON report: the assembled calls, the+delta counts, the finish reason, the usage object, the error body, any+retries, and the `x-sie-served-by` header when the endpoint sends one.++A server that is still loading the model answers `503 MODEL_LOADING`, so the+check first waits for a tiny request to be served, up to 15 minutes, and+records how long that took. A `429`, or a `503` other than `MODEL_LOADING`,+is retried after its `Retry-After`, up to 5 minutes per request, and each+retry is recorded. An error event in the middle of a stream is recorded as+that case's error.++## What result to expect++### Laptop, Apple Silicon, recorded++`Qwen/Qwen3.5-4B:long-context` on an Apple M3 Max with 48 GB under macOS+15.7, MLX backend (`mlx-community/Qwen3.5-4B-4bit`), `sie-server` from this+repository at commit `530dcde8` started with `mise run serve -- -b sglang`,+2026-10-13:++```+ tool_choice_auto pass tool_choice=auto accepted on the tools turn+ streaming_tool_call_deltas pass 1 call: get_weather({"city": "Paris"}); 1 deltas; finish_reason=tool_calls+ parallel_tool_calls pass 2 calls in one turn: get_weather({"city": "Paris"}), get_weather({"city": "Tokyo"})+ tool_result_round_trip pass final answer used the tool result: 'The weather in Paris is currently overcast with a temperature of 18°C.'+ prompt_above_64k_tokens recorded declared window 32768 is under 65536, yet 74847 prompt tokens were accepted+ finish_reason_stop pass finish_reason=stop after 'ready'+ finish_reason_tool_calls pass finish_reason=tool_calls on the tool-call turn+ finish_reason_length pass finish_reason=length at max_tokens=8 (completion_tokens=8)+ usage_on_final_chunk pass final chunk carries usage {'completion_tokens': 2, 'prompt_tokens': 20, 'total_tokens': 22, 'prompt_tokens_details': {'cached_tokens': 16}}+ include_reasoning pass the model did not reason here (4 completion tokens for '9.9'); no reasoning to return+ tool_choice_required recorded refused: 400 unsupported_field: 'tool_choice' must be 'auto' or 'none' on this device, which cannot force a tool call++9 pass, 0 fail, 2 recorded+```++- The server accepted `include_reasoning`, so the tools turns carried it.+ This model did not reason on the probe, so there was no reasoning to+ return.+- The MLX backend accepts `tool_choice` as `auto` or `none` and refuses+ `required`, since it cannot force a call. OpenCode sends only `auto`.+- The server accepted and answered a 74,847-token prompt although this+ profile declares a 32,768-token window. The declared window is what a+ cluster advertises in `/v1/models` and what OpenCode's `limit.context`+ should match.++The same check against the bare `Qwen/Qwen3.5-4B` gave the same table, with+`declared window 8192` in the long-prompt line.++`./run_gate.sh laptop` on the same server, with OpenCode 1.19.0 and no global+OpenCode config, OpenCode's JSON event lines left out:++```+== before: the seeded tests+FAILED tests/test_amounts.py::test_credit_in_parentheses_is_negative - decima...+FAILED tests/test_amounts.py::test_total_nets_credits - decimal.InvalidOperat...+2 failed, 1 passed in 0.01s+== opencode run, recipe laptop, up to 50 steps and 1800 s+== after: the seeded tests must be untouched+== after: pytest in a fresh environment, pinned to the seeded config and tests+... [100%]+3 passed in 0.00s+GATE PASS (.../run-output/gate-20261013T191942Z-KiK1JL)+```++OpenCode took 5 steps and 4 tool calls (`bash`, `read`, `edit`, `bash`), 8+seconds from its first event to its last. An earlier run on the same server+took 7 steps and 6 tool calls.++### SIE Cloud, GLM-5.3-Flash via SIE Relay++To be recorded on the deployed endpoint:++```+conformance table pending+x-sie-served-by pending (expected: remote)+seeded gate pending+terminal recording pending+SIE Cloud usage rows pending (expected: served_by relay)+```++### BFCL through SIE Relay++The planned measurement of `zai-org/GLM-5.3-Flash:relay` on the Berkeley+Function Calling Leaderboard, BFCL v3, from+`gorilla-llm/Berkeley-Function-Calling-Leaderboard`: the full `simple` split+and a 200-row subsample of `multiple`, each answer scored by AST match against+BFCL's accepted calls, sent through SIE Cloud with the tools declared on the+request.++| Task | Rows | AST accuracy |+|---|---|---|+| `simple` | 400 | pending |+| `multiple` | 200 | pending |++The numbers are filled in with the run date once the measurement is+recorded.++## Checked without a GPU++`sie-server` ships a weightless `sie-fake` model for CI, but it has no+chat-template child: `/v1/chat/completions` answers `501+unsupported_operation` for it. So the conformance check cannot run against+`sie-fake`.++What runs anywhere, and in this repository's CI, is the test suite:++- `tests/test_conformance.py` starts a scripted OpenAI-compatible stub that+ plays a conforming wire, then breaks one thing per test: tool-call deltas+ without ids, one call where two were asked for, `tool_choice: "required"`+ refused, silently ignored or rate-limited, usage missing, the long prompt+ refused, a smaller declared window, `<think>` tags leaking into content,+ reasoning arriving without the flag, a reasoning model whose server drops+ the flag, a long answer that leaves the reasoning question open, reasoning+ missing from the non-streamed answer, `include_reasoning`+ or `tool_choice: "auto"` refused, busy refusals, an error event mid-stream,+ a `/v1/models` answered as a bare list, a model that thinks for thousands+ of tokens, and a model that answers `MODEL_LOADING` for its first requests.+ Each verdict is checked for what it accepts and what it refuses.+- `tests/test_run_gate.py` runs `run_gate.sh` with a scripted stand-in for+ `opencode`: a real fix, no change, a failed `opencode run`, edited tests, an+ environment planted in the worked copy, a caller's `PYTEST_ADDOPTS` or+ `PYTEST_PLUGINS` that would deselect the failing tests, the step budget+ handed to the build agent, a run that outlives its deadline, with and+ without a child that ignores TERM, and two runs started in the same second.++```sh+uv run pytest+```++That is a check of the checker. The endpoint itself is only checked by running+`conformance.py` against it.++## What this does NOT establish++- **Not a coding benchmark.** The seeded fixture is two failing tests in a+ twenty-line module. Passing it shows that the loop closes, tools run and+ files land; it says nothing about harder tasks.+- **Not a tool-calling score.** The conformance cases use one weather tool.+ BFCL above is the measurement, and its numbers are pending.+- **Not a claim about every OpenCode version.** The wire facts were recorded+ with OpenCode 1.19.0. A later version can change what it sends; the+ recording stub approach in this README is how to re-check.+- **Not a claim about every laptop.** The laptop recipe was run on one Apple+ Silicon machine with one 4B model. NVIDIA and other models have not been+ run.+- **Not a Cloud result yet.** The Cloud table, the served-by header, the gate+ run, the terminal recording, the usage rows and the BFCL figures are+ placeholders until the run on the deployed endpoint is recorded here.diff --git a/examples/coding-agent-opencode/conformance.py b/examples/coding-agent-opencode/conformance.pynew file mode 100755index 000000000..054b99238--- /dev/null+++ b/examples/coding-agent-opencode/conformance.py@@ -0,0 +1,788 @@+#!/usr/bin/env python3+"""Agent-loop conformance check for an OpenAI-compatible chat endpoint.++ uv sync+ uv run python conformance.py --model Qwen/Qwen3.5-4B:long-context # local sie-server+ SIE_API_KEY=... uv run python conformance.py \+ --base-url "$SIE_BASE_URL/v1" --model zai-org/GLM-5.3-Flash:relay++Drives ``/v1/chat/completions`` the way a coding agent such as OpenCode does:+streaming on, tools declared on every turn, tool results sent back as+``role: tool`` messages. When the endpoint accepts ``include_reasoning``, every+tools turn carries it and the earlier turn's reasoning goes back as+``reasoning_content``, as OpenCode sends it with the SIE Cloud recipe. Every+case records what came back, so a failure says what the wire did rather than+only that it was wrong.++The check goes through the ``openai`` package on purpose. The thing under test+is the OpenAI-compatible wire surface that OpenCode's provider speaks, so the+reference client for that surface is the right instrument here.+"""++from __future__ import annotations++import argparse+import json+import os+import sys+import time+from dataclasses import dataclass, field+from datetime import UTC, datetime+from pathlib import Path+from typing import Any++import httpx+import openai++DEFAULT_BASE_URL = "http://localhost:8080/v1"+DEFAULT_REPORT = Path("run-output/conformance.json")+REQUEST_TIMEOUT_S = 900.0+WARM_UP_TIMEOUT_S = 900.0+WARM_UP_POLL_S = 5.0+RETRY_BUDGET_S = 300.0+RETRY_AFTER_DEFAULT_S = 5.0+RETRY_AFTER_MAX_S = 60.0+GENERATION_BUDGET = 4096+HIDDEN_TOKEN_SLACK = 16+LONG_PROMPT_MIN_TOKENS = 65_536+LONG_PROMPT_WORDS = 68_000+NEEDLE = "The access code is 7741-ZEBRA."+RECORDED_HEADERS = ("x-sie-served-by", "x-sie-model-revision")+REASONING_QUESTION = "Which is larger, 9.11 or 9.9? Answer with just the larger number."++WEATHER_TOOL = {+ "type": "function",+ "function": {+ "name": "get_weather",+ "description": "Current weather for one city.",+ "parameters": {+ "type": "object",+ "properties": {"city": {"type": "string", "description": "City name, for example Paris"}},+ "required": ["city"],+ },+ },+}++FILLER_WORDS = [+ "the",+ "ledger",+ "records",+ "every",+ "shipment",+ "that",+ "left",+ "the",+ "warehouse",+ "before",+ "noon",+ "and",+ "the",+ "clerk",+ "signs",+ "each",+ "page",+ "once",+ "the",+ "totals",+ "agree",+ "with",+ "the",+ "manifest",+ "while",+ "the",+ "driver",+ "waits",+ "by",+ "the",+ "gate",+ "for",+ "the",+ "stamped",+ "copy",+]+++@dataclass+class ToolCall:+ index: int+ id: str | None = None+ name: str | None = None+ arguments: str = ""+ first_delta_complete: bool = False+ deltas: int = 0++ def parsed_arguments(self) -> dict[str, Any] | None:+ try:+ value = json.loads(self.arguments)+ except json.JSONDecodeError:+ return None+ return value if isinstance(value, dict) else None+++@dataclass+class StreamResult:+ content: str = ""+ reasoning: str = ""+ reasoning_deltas: int = 0+ tool_calls: dict[int, ToolCall] = field(default_factory=dict)+ finish_reason: str | None = None+ usage: dict[str, Any] | None = None+ usage_on_last_chunk: bool = False+ chunks: int = 0+ headers: dict[str, str] = field(default_factory=dict)+ error: dict[str, Any] | None = None+ retries: list[dict[str, Any]] = field(default_factory=list)+ seconds: float = 0.0++ def calls(self) -> list[ToolCall]:+ return [self.tool_calls[index] for index in sorted(self.tool_calls)]++ def observed(self) -> dict[str, Any]:+ return {+ "finish_reason": self.finish_reason,+ "chunks": self.chunks,+ "content": self.content[:200],+ "reasoning_deltas": self.reasoning_deltas,+ "reasoning_chars": len(self.reasoning),+ "tool_calls": [+ {+ "index": call.index,+ "id": call.id,+ "name": call.name,+ "arguments": call.arguments[:200],+ "deltas": call.deltas,+ "first_delta_has_id_and_name": call.first_delta_complete,+ }+ for call in self.calls()+ ],+ "usage": self.usage,+ "usage_on_last_chunk": self.usage_on_last_chunk,+ "seconds": round(self.seconds, 2),+ "error": self.error,+ "retries": self.retries,+ "headers": self.headers,+ }++ def hidden_output_tokens(self) -> int | None:+ completion = (self.usage or {}).get("completion_tokens")+ if not isinstance(completion, int):+ return None+ texts = [self.content, self.reasoning, *(call.arguments for call in self.calls())]+ return completion - sum(len(text.encode()) for text in texts)+++@dataclass+class Case:+ name: str+ status: str+ detail: str+ observed: dict[str, Any]+++def _extra(obj: Any, key: str) -> Any:+ value = getattr(obj, key, None)+ if value is not None:+ return value+ extra = getattr(obj, "model_extra", None)+ return extra.get(key) if isinstance(extra, dict) else None+++def _error_payload(exc: Exception) -> dict[str, Any]:+ body = getattr(exc, "body", None)+ body = body if isinstance(body, dict) else {}+ inner = body.get("error") if isinstance(body.get("error"), dict) else body+ return {+ "status": exc.status_code if isinstance(exc, openai.APIStatusError) else None,+ "code": inner.get("code") or (None if isinstance(exc, openai.APIStatusError) else type(exc).__name__),+ "param": inner.get("param"),+ "message": inner.get("message") or str(exc),+ }+++def _retry_wait(exc: openai.APIStatusError) -> float | None:+ busy = exc.status_code == 429 or (exc.status_code == 503 and _error_payload(exc)["code"] != "MODEL_LOADING")+ if not busy:+ return None+ try:+ wait = float(exc.response.headers.get("retry-after", RETRY_AFTER_DEFAULT_S))+ except ValueError:+ wait = RETRY_AFTER_DEFAULT_S+ return min(max(wait, 0.0), RETRY_AFTER_MAX_S)+++def _create(client: openai.OpenAI, result: StreamResult, **kwargs: Any) -> Any:+ started = time.monotonic()+ while True:+ try:+ return client.chat.completions.with_raw_response.create(**kwargs)+ except openai.APIStatusError as exc:+ wait = _retry_wait(exc)+ if wait is None or time.monotonic() - started + wait > RETRY_BUDGET_S:+ raise+ result.retries.append({**_error_payload(exc), "waited_s": wait})+ time.sleep(wait)+++def _keep_headers(result: StreamResult, raw: Any) -> None:+ result.headers = {name: raw.headers[name] for name in RECORDED_HEADERS if name in raw.headers}+++def stream_chat(client: openai.OpenAI, model: str, messages: list[dict[str, Any]], **params: Any) -> StreamResult:+ result = StreamResult()+ started = time.monotonic()+ try:+ raw = _create(+ client,+ result,+ model=model,+ messages=messages,+ stream=True,+ stream_options={"include_usage": True},+ **params,+ )+ _keep_headers(result, raw)+ for chunk in raw.parse():+ result.chunks += 1+ result.usage_on_last_chunk = False+ usage = getattr(chunk, "usage", None)+ if usage is not None:+ result.usage = usage.model_dump(exclude_none=True)+ result.usage_on_last_chunk = True+ for choice in chunk.choices or []:+ if choice.index != 0:+ continue+ if choice.finish_reason:+ result.finish_reason = choice.finish_reason+ delta = choice.delta+ if delta is None:+ continue+ if delta.content:+ result.content += delta.content+ reasoning = _extra(delta, "reasoning_content")+ if isinstance(reasoning, str) and reasoning:+ result.reasoning += reasoning+ result.reasoning_deltas += 1+ for piece in delta.tool_calls or []:+ call = result.tool_calls.setdefault(piece.index, ToolCall(index=piece.index))+ call.deltas += 1+ if call.deltas == 1:+ call.first_delta_complete = bool(piece.id) and bool(piece.function and piece.function.name)+ if piece.id:+ call.id = piece.id+ if piece.function and piece.function.name:+ call.name = piece.function.name+ if piece.function and piece.function.arguments:+ call.arguments += piece.function.arguments+ except (openai.APIError, httpx.HTTPError) as exc:+ result.error = _error_payload(exc)+ result.seconds = time.monotonic() - started+ return result+++def complete_chat(client: openai.OpenAI, model: str, messages: list[dict[str, Any]], **params: Any) -> StreamResult:+ result = StreamResult()+ started = time.monotonic()+ try:+ raw = _create(client, result, model=model, messages=messages, **params)+ _keep_headers(result, raw)+ completion = raw.parse()+ if completion.usage is not None:+ result.usage = completion.usage.model_dump(exclude_none=True)+ for choice in completion.choices or []:+ if choice.index != 0:+ continue+ result.finish_reason = choice.finish_reason+ result.content = choice.message.content or ""+ reasoning = _extra(choice.message, "reasoning_content")+ if isinstance(reasoning, str):+ result.reasoning = reasoning+ except (openai.APIError, httpx.HTTPError) as exc:+ result.error = _error_payload(exc)+ result.seconds = time.monotonic() - started+ return result+++def _describe_calls(result: StreamResult) -> str:+ return ", ".join(f"{call.name}({call.arguments})" for call in result.calls()) or "no tool call"+++def _fail_on_error(name: str, result: StreamResult) -> Case | None:+ if result.error is None:+ return None+ error = result.error+ return Case(+ name, "fail", f"request failed: {error['status']} {error['code']}: {error['message']}", result.observed()+ )+++def _is_refusal(error: dict[str, Any]) -> bool:+ return error.get("status") in (400, 422)+++def _refuses_field(error: dict[str, Any], name: str) -> bool:+ return _is_refusal(error) and (error.get("param") == name or name in str(error.get("message") or ""))+++def case_streaming_tool_call_deltas(+ client: openai.OpenAI, model: str, tool_params: dict[str, Any]+) -> tuple[Case, StreamResult]:+ name = "streaming_tool_call_deltas"+ messages = [{"role": "user", "content": "What is the weather in Paris right now? Use the get_weather tool."}]+ result = stream_chat(+ client, model, messages, tools=[WEATHER_TOOL], max_tokens=GENERATION_BUDGET, temperature=0, **tool_params+ )+ failed = _fail_on_error(name, result)+ if failed:+ return failed, result+ calls = result.calls()+ problems = []+ if not calls:+ problems.append("no tool call came back")+ for call in calls:+ if not call.id:+ problems.append(f"call {call.index} has no id")+ if call.name != "get_weather":+ problems.append(f"call {call.index} named {call.name!r}")+ parsed = call.parsed_arguments()+ if parsed is None:+ problems.append(f"call {call.index} arguments are not a JSON object: {call.arguments[:80]!r}")+ elif "city" not in parsed:+ problems.append(f"call {call.index} arguments lack 'city': {parsed}")+ if not call.first_delta_complete:+ problems.append(f"call {call.index}: first delta lacks id or name")+ if result.finish_reason != "tool_calls":+ problems.append(f"finish_reason is {result.finish_reason!r}, expected 'tool_calls'")+ if problems:+ return Case(name, "fail", "; ".join(problems), result.observed()), result+ deltas = sum(call.deltas for call in calls)+ detail = f"{len(calls)} call: {_describe_calls(result)}; {deltas} deltas; finish_reason=tool_calls"+ return Case(name, "pass", detail, result.observed()), result+++def case_parallel_tool_calls(client: openai.OpenAI, model: str, tool_params: dict[str, Any]) -> Case:+ name = "parallel_tool_calls"+ messages = [+ {+ "role": "user",+ "content": "Get the current weather in Paris and in Tokyo. Call get_weather once per city, both in this turn.",+ }+ ]+ result = stream_chat(+ client, model, messages, tools=[WEATHER_TOOL], max_tokens=GENERATION_BUDGET, temperature=0, **tool_params+ )+ failed = _fail_on_error(name, result)+ if failed:+ return failed+ calls = result.calls()+ ids = [call.id for call in calls]+ cities = sorted(+ str((call.parsed_arguments() or {}).get("city", "")).lower() for call in calls if call.parsed_arguments()+ )+ observed = result.observed()+ if len(calls) < 2:+ return Case(name, "fail", f"{len(calls)} tool call in the turn: {_describe_calls(result)}", observed)+ if len(set(ids)) != len(ids) or None in ids:+ return Case(name, "fail", f"tool-call ids are not distinct: {ids}", observed)+ missing = [city for city in ("paris", "tokyo") if not any(city in c for c in cities)]+ if missing:+ return Case(name, "fail", f"{len(calls)} calls but cities {cities} miss {missing}", observed)+ return Case(name, "pass", f"{len(calls)} calls in one turn: {_describe_calls(result)}", observed)+++def case_tool_result_round_trip(+ client: openai.OpenAI, model: str, first: StreamResult, tool_params: dict[str, Any]+) -> Case:+ name = "tool_result_round_trip"+ calls = first.calls()+ if first.error or not calls:+ return Case(name, "fail", "no tool call from streaming_tool_call_deltas to send a result for", first.observed())+ assistant: dict[str, Any] = {+ "role": "assistant",+ "content": first.content,+ "tool_calls": [+ {+ "id": call.id,+ "type": "function",+ "function": {"name": call.name, "arguments": call.arguments},+ }+ for call in calls+ ],+ }+ if first.reasoning or "extra_body" in tool_params:+ assistant["reasoning_content"] = first.reasoning+ tool_messages = [+ {+ "role": "tool",+ "tool_call_id": call.id,+ "content": json.dumps({"city": "Paris", "temperature_c": 18, "conditions": "overcast"}),+ }+ for call in calls+ ]+ messages = [+ {"role": "user", "content": "What is the weather in Paris right now? Use the get_weather tool."},+ assistant,+ *tool_messages,+ ]+ result = stream_chat(+ client, model, messages, tools=[WEATHER_TOOL], max_tokens=GENERATION_BUDGET, temperature=0, **tool_params+ )+ failed = _fail_on_error(name, result)+ if failed:+ return failed+ observed = result.observed()+ observed["reasoning_content_sent_back"] = assistant.get("reasoning_content")+ problems = []+ if result.calls():+ problems.append(f"answered with another tool call: {_describe_calls(result)}")+ if result.finish_reason != "stop":+ problems.append(f"finish_reason is {result.finish_reason!r}, expected 'stop'")+ if not result.content.strip():+ problems.append("empty final answer")+ elif "18" not in result.content:+ problems.append(f"final answer does not carry the tool's 18: {result.content[:120]!r}")+ if problems:+ return Case(name, "fail", "; ".join(problems), observed)+ return Case(name, "pass", f"final answer used the tool result: {result.content.strip()[:100]!r}", observed)+++def long_prompt() -> str:+ words = [FILLER_WORDS[i % len(FILLER_WORDS)] for i in range(LONG_PROMPT_WORDS)]+ lines = [" ".join(words[i : i + 20]) + "." for i in range(0, len(words), 20)]+ lines.insert(int(len(lines) * 0.6), NEEDLE)+ return "\n".join(lines)+++def declared_window(entry: dict[str, Any] | None) -> int | None:+ for key in ("max_sequence_length", "context_length"):+ value = (entry or {}).get(key)+ if isinstance(value, int):+ return value+ return None+++def case_prompt_above_64k_tokens(client: openai.OpenAI, model: str, entry: dict[str, Any] | None) -> Case:+ name = "prompt_above_64k_tokens"+ document = long_prompt()+ messages = [+ {+ "role": "user",+ "content": f"Read this warehouse log, then answer.\n\n{document}\n\nWhat is the access code? Reply with just the code.",+ }+ ]+ result = stream_chat(client, model, messages, max_tokens=GENERATION_BUDGET, temperature=0)+ observed = result.observed()+ observed["prompt_chars"] = len(messages[0]["content"])+ observed["needle_found"] = "7741-ZEBRA" in result.content+ window = declared_window(entry)+ observed["declared_window"] = window+ if window is not None and window < LONG_PROMPT_MIN_TOKENS:+ error = result.error+ if error is None:+ prompt_tokens = (result.usage or {}).get("prompt_tokens")+ detail = f"declared window {window} is under {LONG_PROMPT_MIN_TOKENS}, yet {prompt_tokens} prompt tokens were accepted"+ return Case(name, "recorded", detail, observed)+ if _is_refusal(error):+ detail = f"declared window {window} is under {LONG_PROMPT_MIN_TOKENS}; refused: {error['status']} {error['code']}: {error['message']}"+ return Case(name, "recorded", detail, observed)+ failed = _fail_on_error(name, result)+ if failed:+ failed.observed = observed+ return failed+ prompt_tokens = (result.usage or {}).get("prompt_tokens")+ if prompt_tokens is None:+ return Case(name, "fail", "accepted, but no usage.prompt_tokens to confirm the prompt size", observed)+ if prompt_tokens < LONG_PROMPT_MIN_TOKENS:+ return Case(name, "fail", f"prompt counted as {prompt_tokens} tokens, under {LONG_PROMPT_MIN_TOKENS}", observed)+ if not result.content.strip() or result.finish_reason != "stop":+ return Case(+ name, "fail", f"accepted {prompt_tokens} tokens but finish_reason={result.finish_reason!r}", observed+ )+ needle = "needle found" if observed["needle_found"] else "needle not found"+ return Case(name, "pass", f"{prompt_tokens} prompt tokens accepted and answered; {needle}", observed)+++def case_finish_reason_stop(client: openai.OpenAI, model: str) -> tuple[Case, StreamResult]:+ name = "finish_reason_stop"+ messages = [{"role": "user", "content": "Reply with the single word: ready."}]+ result = stream_chat(client, model, messages, max_tokens=GENERATION_BUDGET, temperature=0)+ failed = _fail_on_error(name, result)+ if failed:+ return failed, result+ if result.finish_reason != "stop":+ return Case(name, "fail", f"finish_reason is {result.finish_reason!r}", result.observed()), result+ return Case(name, "pass", f"finish_reason=stop after {result.content.strip()[:40]!r}", result.observed()), result+++def case_finish_reason_tool_calls(first: Case) -> Case:+ name = "finish_reason_tool_calls"+ finish = first.observed.get("finish_reason")+ if finish == "tool_calls":+ return Case(name, "pass", "finish_reason=tool_calls on the tool-call turn", {"finish_reason": finish})+ return Case(name, "fail", f"tool-call turn ended with finish_reason={finish!r}", {"finish_reason": finish})+++def case_finish_reason_length(client: openai.OpenAI, model: str) -> Case:+ name = "finish_reason_length"+ messages = [{"role": "user", "content": "Write three paragraphs about the sea."}]+ result = stream_chat(client, model, messages, max_tokens=8, temperature=0)+ failed = _fail_on_error(name, result)+ if failed:+ return failed+ if result.finish_reason != "length":+ return Case(name, "fail", f"finish_reason is {result.finish_reason!r} with max_tokens=8", result.observed())+ completion = (result.usage or {}).get("completion_tokens")+ return Case(+ name, "pass", f"finish_reason=length at max_tokens=8 (completion_tokens={completion})", result.observed()+ )+++def case_usage_on_final_chunk(stop: StreamResult) -> Case:+ name = "usage_on_final_chunk"+ observed = {"usage": stop.usage, "usage_on_last_chunk": stop.usage_on_last_chunk, "chunks": stop.chunks}+ if stop.error:+ return Case(name, "fail", "the stop stream failed, see finish_reason_stop", observed)+ usage = stop.usage or {}+ if not usage:+ return Case(name, "fail", "no usage object on any chunk with stream_options.include_usage", observed)+ if not stop.usage_on_last_chunk:+ return Case(name, "fail", "usage arrived, but not on the final chunk", observed)+ missing = [key for key in ("prompt_tokens", "completion_tokens") if not usage.get(key)]+ if missing:+ return Case(name, "fail", f"usage lacks {missing}: {usage}", observed)+ return Case(name, "pass", f"final chunk carries usage {usage}", observed)+++def _hid_reasoning(result: StreamResult) -> bool:+ hidden = result.hidden_output_tokens()+ return hidden is not None and hidden > HIDDEN_TOKEN_SLACK+++def _too_short_to_have_reasoned(result: StreamResult) -> bool:+ completion = (result.usage or {}).get("completion_tokens")+ return isinstance(completion, int) and completion <= HIDDEN_TOKEN_SLACK+++def case_include_reasoning(client: openai.OpenAI, model: str) -> tuple[Case, bool]:+ name = "include_reasoning"+ messages = [{"role": "user", "content": REASONING_QUESTION}]+ flag = {"extra_body": {"include_reasoning": True}}+ with_flag = stream_chat(client, model, messages, max_tokens=GENERATION_BUDGET, temperature=0, **flag)+ without_flag = stream_chat(client, model, messages, max_tokens=GENERATION_BUDGET, temperature=0)+ whole = complete_chat(client, model, messages, max_tokens=GENERATION_BUDGET, temperature=0, **flag)+ contents = (with_flag.content, without_flag.content, whole.content)+ observed = {+ "with_include_reasoning": with_flag.observed(),+ "without_include_reasoning": without_flag.observed(),+ "non_streamed_with_include_reasoning": {+ "finish_reason": whole.finish_reason,+ "content": whole.content[:200],+ "reasoning_chars": len(whole.reasoning),+ "usage": whole.usage,+ "error": whole.error,+ "retries": whole.retries,+ },+ "content_has_think_tags": any("<think>" in text or "</think>" in text for text in contents),+ }+ accepted = with_flag.error is None+ for label, result in (("include_reasoning", with_flag), ("plain request", without_flag)):+ if result.error:+ error = result.error+ verdict = "refused" if label == "include_reasoning" else "failed"+ detail = f"{label} {verdict}: {error['status']} {error['code']}: {error['message']}"+ return Case(name, "fail", detail, observed), accepted+ if whole.error:+ error = whole.error+ detail = f"non-streamed include_reasoning failed: {error['status']} {error['code']}: {error['message']}"+ return Case(name, "fail", detail, observed), accepted+ if observed["content_has_think_tags"]:+ return Case(name, "fail", "raw <think> tags leaked into content", observed), accepted+ if without_flag.reasoning_deltas:+ detail = f"reasoning_content arrived without the flag ({without_flag.reasoning_deltas} deltas)"+ return Case(name, "fail", detail, observed), accepted+ results = (with_flag, without_flag, whole)+ reasoned = bool(with_flag.reasoning or whole.reasoning) or any(_hid_reasoning(result) for result in results)+ if not reasoned and not all(_too_short_to_have_reasoned(result) for result in results):+ observed["model_reasoned"] = None+ spent = [(result.usage or {}).get("completion_tokens") for result in results]+ detail = (+ f"no reasoning came back, and the visible text could account for the completion tokens {spent}, "+ "so whether the model reasoned is unknown"+ )+ return Case(name, "recorded", detail, observed), accepted+ observed["model_reasoned"] = reasoned+ if not reasoned:+ completion = (without_flag.usage or {}).get("completion_tokens")+ detail = f"the model did not reason here ({completion} completion tokens for {without_flag.content.strip()[:20]!r}); no reasoning to return"+ return Case(name, "pass", detail, observed), accepted+ problems = []+ if not with_flag.reasoning:+ problems.append("no delta.reasoning_content in the stream")+ if not whole.reasoning:+ problems.append("no message.reasoning_content in the non-streamed answer")+ if problems:+ hidden = max((r.hidden_output_tokens() or 0) for r in results)+ detail = f"the model reasoned (at least {hidden} completion tokens beyond the visible text) but with include_reasoning: {'; '.join(problems)}"+ return Case(name, "fail", detail, observed), accepted+ detail = (+ f"{with_flag.reasoning_deltas} reasoning_content deltas, {len(with_flag.reasoning)} chars; "+ f"message.reasoning_content {len(whole.reasoning)} chars; none without the flag"+ )+ return Case(name, "pass", detail, observed), accepted+++def case_tool_choice_required(client: openai.OpenAI, model: str) -> Case:+ name = "tool_choice_required"+ messages = [{"role": "user", "content": "Say hello."}]+ result = stream_chat(+ client,+ model,+ messages,+ tools=[WEATHER_TOOL],+ tool_choice="required",+ max_tokens=GENERATION_BUDGET,+ temperature=0,+ )+ observed = result.observed()+ if result.error:+ error = result.error+ if _is_refusal(error):+ observed["support"] = "refused"+ return Case(name, "recorded", f"refused: {error['status']} {error['code']}: {error['message']}", observed)+ return Case(name, "fail", f"request failed: {error['status']} {error['code']}: {error['message']}", observed)+ if result.calls():+ observed["support"] = "supported"+ return Case(name, "recorded", f"supported: forced {_describe_calls(result)}", observed)+ observed["support"] = "accepted but not forced"+ return Case(+ name, "fail", f"accepted tool_choice=required but answered without a call: {result.content[:80]!r}", observed+ )+++def model_entry(base_url: str, api_key: str, model: str) -> dict[str, Any] | None:+ headers = {"authorization": f"Bearer {api_key}"} if api_key else {}+ try:+ response = httpx.get(f"{base_url.rstrip('/')}/models", headers=headers, timeout=30.0)+ payload = response.json()+ except (httpx.HTTPError, ValueError):+ return None+ if isinstance(payload, dict):+ entries = payload.get("models") or payload.get("data") or []+ else:+ entries = payload+ if not isinstance(entries, list):+ return None+ for entry in entries:+ if isinstance(entry, dict) and (entry.get("name") == model or entry.get("id") == model):+ return {+ key: entry.get(key)+ for key in ("name", "id", "capabilities", "max_sequence_length", "context_length", "max_output_tokens")+ if key in entry+ }+ return None+++def wait_until_loaded(client: openai.OpenAI, model: str) -> dict[str, Any]:+ started = time.monotonic()+ attempts = 0+ messages = [{"role": "user", "content": "Reply with the single word: ready."}]+ while True:+ attempts += 1+ result = stream_chat(client, model, messages, max_tokens=4, temperature=0)+ elapsed = time.monotonic() - started+ if (result.error or {}).get("code") != "MODEL_LOADING" or elapsed > WARM_UP_TIMEOUT_S:+ return {"attempts": attempts, "seconds": round(elapsed, 1), "error": result.error}+ time.sleep(WARM_UP_POLL_S)+++def run(base_url: str, api_key: str, model: str) -> dict[str, Any]:+ client = openai.OpenAI(base_url=base_url, api_key=api_key or "none", timeout=REQUEST_TIMEOUT_S, max_retries=0)+ started = datetime.now(UTC)+ entry = model_entry(base_url, api_key, model)+ warm_up = wait_until_loaded(client, model)+ cases: list[Case] = []++ reasoning_case, reasoning_accepted = case_include_reasoning(client, model)+ tool_params: dict[str, Any] = {"tool_choice": "auto"}+ if reasoning_accepted:+ tool_params["extra_body"] = {"include_reasoning": True}+ tool_case, tool_result = case_streaming_tool_call_deltas(client, model, tool_params)+ if tool_result.error and _refuses_field(tool_result.error, "tool_choice"):+ error = tool_result.error+ detail = (+ "OpenCode sends tool_choice=auto on every tools turn; "+ f"refused: {error['status']} {error['code']}: {error['message']}"+ )+ cases.append(Case("tool_choice_auto", "fail", detail, tool_result.observed()))+ tool_params.pop("tool_choice")+ tool_case, tool_result = case_streaming_tool_call_deltas(client, model, tool_params)+ elif tool_result.error:+ error = tool_result.error+ detail = f"not judged, the tools turn failed: {error['status']} {error['code']}: {error['message']}"+ cases.append(Case("tool_choice_auto", "recorded", detail, tool_result.observed()))+ else:+ observed = {"tool_choice": "auto", "finish_reason": tool_result.finish_reason}+ cases.append(Case("tool_choice_auto", "pass", "tool_choice=auto accepted on the tools turn", observed))+ cases.append(tool_case)+ cases.append(case_parallel_tool_calls(client, model, tool_params))+ cases.append(case_tool_result_round_trip(client, model, tool_result, tool_params))+ cases.append(case_prompt_above_64k_tokens(client, model, entry))+ stop_case, stop_result = case_finish_reason_stop(client, model)+ cases.append(stop_case)+ cases.append(case_finish_reason_tool_calls(tool_case))+ cases.append(case_finish_reason_length(client, model))+ cases.append(case_usage_on_final_chunk(stop_result))+ cases.append(reasoning_case)+ cases.append(case_tool_choice_required(client, model))++ counts = {status: sum(1 for case in cases if case.status == status) for status in ("pass", "fail", "recorded")}+ return {+ "base_url": base_url,+ "model": model,+ "model_entry": entry,+ "started_at": started.isoformat(),+ "finished_at": datetime.now(UTC).isoformat(),+ "served_by": tool_result.headers.get("x-sie-served-by"),+ "warm_up": warm_up,+ "tools_turn_params": tool_params,+ "cases": [case.__dict__ for case in cases],+ "summary": counts,+ }+++def print_table(report: dict[str, Any]) -> None:+ width = max(len(case["name"]) for case in report["cases"])+ print(f"model {report['model']} at {report['base_url']}")+ if report.get("served_by"):+ print(f"served by {report['served_by']}")+ warm_up = report["warm_up"]+ print(f"warm-up: {warm_up['attempts']} attempt(s), {warm_up['seconds']}s")+ print()+ for case in report["cases"]:+ print(f" {case['name']:<{width}} {case['status']:<8} {case['detail']}")+ summary = report["summary"]+ print()+ print(f"{summary['pass']} pass, {summary['fail']} fail, {summary['recorded']} recorded")+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument(+ "--base-url", default=DEFAULT_BASE_URL, help=f"OpenAI-compatible base URL (default {DEFAULT_BASE_URL})"+ )+ parser.add_argument("--api-key", default=os.environ.get("SIE_API_KEY", ""), help="Bearer key (env SIE_API_KEY)")+ parser.add_argument("--model", required=True, help="model id, for example zai-org/GLM-5.3-Flash:relay")+ parser.add_argument(+ "--report", type=Path, default=DEFAULT_REPORT, help=f"JSON report path (default {DEFAULT_REPORT})"+ )+ args = parser.parse_args()++ report = run(args.base_url, args.api_key, args.model)+ args.report.parent.mkdir(parents=True, exist_ok=True)+ args.report.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8")+ print_table(report)+ print(f"report written to {args.report}")+ return 1 if report["summary"]["fail"] else 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/examples/coding-agent-opencode/fixture/README.md b/examples/coding-agent-opencode/fixture/README.mdnew file mode 100644index 000000000..26aa40392--- /dev/null+++ b/examples/coding-agent-opencode/fixture/README.md@@ -0,0 +1,5 @@+# Task++Make the tests pass.++Run them with `uv run pytest -q`. Do not change the tests.diff --git a/examples/coding-agent-opencode/fixture/invoice_totals/__init__.py b/examples/coding-agent-opencode/fixture/invoice_totals/__init__.pynew file mode 100644index 000000000..e69de29bbdiff --git a/examples/coding-agent-opencode/fixture/invoice_totals/amounts.py b/examples/coding-agent-opencode/fixture/invoice_totals/amounts.pynew file mode 100644index 000000000..0fd1e5fda--- /dev/null+++ b/examples/coding-agent-opencode/fixture/invoice_totals/amounts.py@@ -0,0 +1,18 @@+"""Parse the amount column of an exported invoice into Decimal values."""++from decimal import Decimal+++def parse_amount(text: str) -> Decimal:+ """Turn one amount cell into a Decimal.++ Accepts "$1,234.50", "1234.5" and " 12.00 ". A credit is written with+ parentheses, "(12.00)", and is a negative amount.+ """+ cleaned = text.strip().replace("$", "").replace(",", "")+ return Decimal(cleaned)+++def total(cells: list[str]) -> Decimal:+ """Net total of the amount column, credits subtracted."""+ return sum((parse_amount(cell) for cell in cells), Decimal(0))diff --git a/examples/coding-agent-opencode/fixture/pyproject.toml b/examples/coding-agent-opencode/fixture/pyproject.tomlnew file mode 100644index 000000000..672965b6b--- /dev/null+++ b/examples/coding-agent-opencode/fixture/pyproject.toml@@ -0,0 +1,18 @@+[project]+name = "invoice-totals"+version = "0.1.0"+description = "Sum the amount column of an exported invoice"+requires-python = ">=3.12"+dependencies = []++[tool.uv]+package = false++[dependency-groups]+dev = [+ "pytest>=8",+]++[tool.pytest.ini_options]+testpaths = ["tests"]+pythonpath = ["."]diff --git a/examples/coding-agent-opencode/fixture/tests/test_amounts.py b/examples/coding-agent-opencode/fixture/tests/test_amounts.pynew file mode 100644index 000000000..a3b663207--- /dev/null+++ b/examples/coding-agent-opencode/fixture/tests/test_amounts.py@@ -0,0 +1,18 @@+from decimal import Decimal++from invoice_totals.amounts import parse_amount, total+++def test_plain_and_formatted_amounts():+ assert parse_amount("$1,234.50") == Decimal("1234.50")+ assert parse_amount("1234.5") == Decimal("1234.5")+ assert parse_amount(" 12.00 ") == Decimal("12.00")+++def test_credit_in_parentheses_is_negative():+ assert parse_amount("(12.00)") == Decimal("-12.00")+ assert parse_amount("($1,000.00)") == Decimal("-1000.00")+++def test_total_nets_credits():+ assert total(["$100.00", "(12.50)", "2.50"]) == Decimal("90.00")diff --git a/examples/coding-agent-opencode/pyproject.toml b/examples/coding-agent-opencode/pyproject.tomlnew file mode 100644index 000000000..3dec0cdc5--- /dev/null+++ b/examples/coding-agent-opencode/pyproject.toml@@ -0,0 +1,26 @@+[project]+name = "superlinked-sie-coding-agent-opencode-example"+version = "0.1.0"+description = "Agent-loop conformance check and OpenCode recipes for SIE"+requires-python = ">=3.12,<3.13"+dependencies = [+ "httpx>=0.28,<1",+ "openai>=3.0",+]++[tool.uv]+package = false++[dependency-groups]+dev = [+ "pytest>=8",+ "ruff>=0.14",+]++[tool.pytest.ini_options]+testpaths = ["tests"]+pythonpath = ["."]++[tool.ruff]+line-length = 120+target-version = "py312"diff --git a/examples/coding-agent-opencode/recipes/cloud/opencode.json b/examples/coding-agent-opencode/recipes/cloud/opencode.jsonnew file mode 100644index 000000000..7ce5db238--- /dev/null+++ b/examples/coding-agent-opencode/recipes/cloud/opencode.json@@ -0,0 +1,34 @@+{+ "$schema": "https://opencode.ai/config.json",+ "model": "sie/zai-org/GLM-5.3-Flash:relay",+ "provider": {+ "sie": {+ "npm": "@ai-sdk/openai-compatible",+ "name": "SIE Cloud",+ "options": {+ "baseURL": "{env:SIE_BASE_URL}/v1",+ "apiKey": "{env:SIE_API_KEY}",+ "timeout": 1800000,+ "headerTimeout": 600000,+ "chunkTimeout": 600000+ },+ "models": {+ "zai-org/GLM-5.3-Flash:relay": {+ "name": "GLM-5.3-Flash via SIE Relay",+ "limit": {+ "context": 131072,+ "output": 32768+ },+ "tool_call": true,+ "reasoning": true,+ "interleaved": {+ "field": "reasoning_content"+ },+ "options": {+ "include_reasoning": true+ }+ }+ }+ }+ }+}diff --git a/examples/coding-agent-opencode/recipes/cluster/opencode.json b/examples/coding-agent-opencode/recipes/cluster/opencode.jsonnew file mode 100644index 000000000..6a7e5c60e--- /dev/null+++ b/examples/coding-agent-opencode/recipes/cluster/opencode.json@@ -0,0 +1,35 @@+{+ "$schema": "https://opencode.ai/config.json",+ "model": "sie-cluster/zai-org/GLM-5.3-Flash",+ "provider": {+ "sie-cluster": {+ "npm": "@ai-sdk/openai-compatible",+ "name": "SIE cluster",+ "options": {+ "baseURL": "{env:SIE_BASE_URL}/v1",+ "apiKey": "{env:SIE_API_KEY}",+ "timeout": 1800000,+ "headerTimeout": 600000,+ "chunkTimeout": 600000+ },+ "models": {+ "zai-org/GLM-5.3-Flash": {+ "name": "GLM-5.3-Flash on the cluster",+ "limit": {+ "context": 16384,+ "output": 4096+ },+ "tool_call": true+ },+ "Qwen/Qwen3-4B-Instruct-2507": {+ "name": "Qwen3-4B-Instruct-2507 on the cluster",+ "limit": {+ "context": 32768,+ "output": 4096+ },+ "tool_call": true+ }+ }+ }+ }+}diff --git a/examples/coding-agent-opencode/recipes/laptop/opencode.json b/examples/coding-agent-opencode/recipes/laptop/opencode.jsonnew file mode 100644index 000000000..b228c855d--- /dev/null+++ b/examples/coding-agent-opencode/recipes/laptop/opencode.json@@ -0,0 +1,27 @@+{+ "$schema": "https://opencode.ai/config.json",+ "model": "sie-local/Qwen/Qwen3.5-4B:long-context",+ "provider": {+ "sie-local": {+ "npm": "@ai-sdk/openai-compatible",+ "name": "SIE on this machine",+ "options": {+ "baseURL": "http://localhost:8080/v1",+ "apiKey": "local",+ "timeout": 1800000,+ "headerTimeout": 600000,+ "chunkTimeout": 600000+ },+ "models": {+ "Qwen/Qwen3.5-4B:long-context": {+ "name": "Qwen3.5-4B, 32K window",+ "limit": {+ "context": 32768,+ "output": 4096+ },+ "tool_call": true+ }+ }+ }+ }+}diff --git a/examples/coding-agent-opencode/run_gate.sh b/examples/coding-agent-opencode/run_gate.shnew file mode 100755index 000000000..33bf5d41d--- /dev/null+++ b/examples/coding-agent-opencode/run_gate.sh@@ -0,0 +1,113 @@+#!/usr/bin/env bash+# Seeded gate: OpenCode works the fixture non-interactively, then pytest judges it.+#+# SIE_BASE_URL=https://... SIE_API_KEY=sk-sie-... ./run_gate.sh # SIE Cloud (recipes/cloud)+# ./run_gate.sh laptop # sie-server on http://localhost:8080+# SIE_BASE_URL=https://... SIE_API_KEY=... ./run_gate.sh cluster # your gateway (recipes/cluster)+#+# Needs opencode and uv on PATH. Writes run-output/gate-<timestamp>-<suffix>/ with the+# worked copy of the fixture, OpenCode's event log and the pytest verdict.+#+# The run is bounded. OpenCode's build agent gets GATE_STEPS steps (default 50), after which+# OpenCode tells the model to answer in text. A run still going after GATE_DEADLINE_SECONDS+# (default 1800) is stopped, and the gate fails.+set -euo pipefail++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+RECIPE="${1:-cloud}"+CONFIG="$HERE/recipes/$RECIPE/opencode.json"+if [[ ! -f "$CONFIG" ]]; then+ echo "unknown recipe '$RECIPE'; pick laptop, cluster or cloud" >&2+ exit 2+fi+for tool in opencode uv; do+ if ! command -v "$tool" >/dev/null; then+ echo "$tool is not on PATH" >&2+ exit 2+ fi+done+GATE_STEPS="${GATE_STEPS:-50}"+GATE_DEADLINE_SECONDS="${GATE_DEADLINE_SECONDS:-1800}"+for var in GATE_STEPS GATE_DEADLINE_SECONDS; do+ if [[ ! "${!var}" =~ ^[1-9][0-9]*$ ]]; then+ echo "$var must be a positive whole number" >&2+ exit 2+ fi+done+if [[ "$RECIPE" != "laptop" ]]; then+ for var in SIE_BASE_URL SIE_API_KEY; do+ if [[ -z "${!var:-}" ]]; then+ echo "$var is not set" >&2+ exit 2+ fi+ done+fi++mkdir -p "$HERE/run-output"+OUT="$(mktemp -d "$HERE/run-output/gate-$(date -u +%Y%m%dT%H%M%SZ)-XXXXXX")"+WORK="$OUT/fixture"+cp -R "$HERE/fixture" "$WORK"+git -C "$WORK" init -q+TASK="$(cat "$WORK/README.md")"++seeded_tests() {+ (cd "$WORK" && unset PYTEST_ADDOPTS PYTEST_PLUGINS && uv tool run --quiet --isolated --no-config --python 3.12 --from 'pytest>=8' pytest -q -c pyproject.toml tests)+}++echo "== before: the seeded tests"+seeded_tests 2>&1 | tail -n 3 || true++echo "== opencode run, recipe $RECIPE, up to $GATE_STEPS steps and $GATE_DEADLINE_SECONDS s"+STEP_BUDGET="{\"agent\":{\"build\":{\"steps\":$GATE_STEPS}}}"+set -m+{+ (cd "$WORK" && OPENCODE_CONFIG="$CONFIG" OPENCODE_CONFIG_CONTENT="$STEP_BUDGET" \+ opencode run --agent build --auto --format json "$TASK" </dev/null) | tee "$OUT/opencode-events.jsonl"+} &+RUN=$!+{+ sleep "$GATE_DEADLINE_SECONDS"+ touch "$OUT/deadline-passed"+ kill -TERM -- "-$RUN"+ for _ in 1 2 3 4 5 6 7 8 9 10; do+ sleep 1+ kill -0 -- "-$RUN" || exit 0+ done+ kill -KILL -- "-$RUN"+} >/dev/null 2>&1 &+WATCHDOG=$!+set +m+trap 'kill -- "-$RUN" "-$WATCHDOG" 2>/dev/null || true' EXIT+trap 'exit 130' INT+trap 'exit 143' TERM+OPENCODE_STATUS=0+wait "$RUN" || OPENCODE_STATUS=$?+[[ -e "$OUT/deadline-passed" ]] || kill -- "-$WATCHDOG" 2>/dev/null || true+wait "$WATCHDOG" 2>/dev/null || true+trap - EXIT INT TERM+if [[ -e "$OUT/deadline-passed" ]]; then+ echo "GATE FAIL: opencode run passed its ${GATE_DEADLINE_SECONDS}s deadline and was stopped ($OUT)"+ exit 1+fi+if [[ "$OPENCODE_STATUS" -ne 0 ]]; then+ echo "GATE FAIL: opencode run exited $OPENCODE_STATUS ($OUT)"+ exit 1+fi++echo "== after: the seeded tests must be untouched"+if ! diff -r -x __pycache__ "$HERE/fixture/tests" "$WORK/tests" || ! diff "$HERE/fixture/pyproject.toml" "$WORK/pyproject.toml"; then+ echo "GATE FAIL: the tests or pyproject.toml were changed ($OUT)"+ exit 1+fi+if find "$WORK" -name conftest.py -not -path '*/.venv/*' | grep -q .; then+ echo "GATE FAIL: a conftest.py was added ($OUT)"+ exit 1+fi++echo "== after: pytest in a fresh environment, pinned to the seeded config and tests"+if seeded_tests 2>&1 | tee "$OUT/pytest.txt"; then+ echo "GATE PASS ($OUT)"+else+ echo "GATE FAIL ($OUT)"+ exit 1+fidiff --git a/examples/coding-agent-opencode/tests/test_conformance.py b/examples/coding-agent-opencode/tests/test_conformance.pynew file mode 100644index 000000000..b72c5a3e8--- /dev/null+++ b/examples/coding-agent-opencode/tests/test_conformance.py@@ -0,0 +1,419 @@+"""The conformance checker against a scripted OpenAI-compatible stub.++The stub plays the wire a conforming server sends, and each knob breaks one+thing, so every verdict is checked both for what it accepts and for what it+refuses. This is a check of the checker; the server itself is checked by+running ``conformance.py`` against a real endpoint.+"""++from __future__ import annotations++import json+import threading+from collections.abc import Iterator+from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer+from typing import Any++import pytest++import conformance++KNOBS: dict[str, Any] = {}+SEEN: dict[str, list[dict[str, Any]]] = {}++REASONING = " ".join(["Compare the tenths first: 9.9 has nine tenths and 9.11 has one tenth."] * 5)+LONG_ANSWER = (+ "9.9 is the larger number, because its tenths digit, 9, is larger than the tenths digit of 9.11, which is 1."+)+++def _words(text: str) -> int:+ return len(text.split())+++def _reply(body: dict[str, Any]) -> dict[str, Any]:+ messages = body["messages"]+ tools = body.get("tools")+ user_text = "".join(m.get("content") or "" for m in messages if m["role"] == "user")+ if body.get("include_reasoning") and KNOBS.get("reasoning") == "refuse":+ return {"status": 400, "code": "unsupported_field", "message": "field 'include_reasoning' is not supported"}+ if body.get("tool_choice") == "auto" and KNOBS.get("auto") == "refuse":+ return {"status": 400, "code": "unsupported_field", "message": "field 'tool_choice' is not supported"}+ if body.get("tool_choice") == "required":+ if KNOBS.get("required") == "refuse":+ return {"status": 400, "code": "unsupported_field", "message": "tool_choice 'required' is not supported"}+ if KNOBS.get("required") == "rate_limited":+ return {"status": 429, "code": "rate_limit_exceeded", "message": "rate limit exceeded, retry later"}+ if KNOBS.get("required") == "ignore":+ return {"content": "Hello!", "finish": "stop"}+ return {"calls": [("call_req", "get_weather", {"city": "Paris"})], "finish": "tool_calls"}+ if tools and messages[-1]["role"] == "tool":+ SEEN.setdefault("round_trip_assistant", []).append(messages[-2])+ return {"content": "It is 18 degrees and overcast in Paris.", "finish": "stop"}+ if tools:+ SEEN.setdefault("tools_turns", []).append(body)+ if KNOBS.get("tools_error"):+ return {"status": 500, "code": "INTERNAL_ERROR", "message": "worker failed"}+ if KNOBS.get("busy", 0) > len(SEEN.get("busy", [])):+ SEEN.setdefault("busy", []).append(body)+ return {"status": 503, "code": "QUEUE_FULL", "message": "upstream busy"}+ if KNOBS.get("midstream_error"):+ return {"midstream_error": True}+ if tools and "Tokyo" in user_text:+ calls = [("call_1", "get_weather", {"city": "Paris"}), ("call_2", "get_weather", {"city": "Tokyo"})]+ if KNOBS.get("parallel") == "single":+ calls = calls[:1]+ return {"calls": calls, "finish": "tool_calls", "reasoning": "two cities, two calls"}+ if tools:+ return {"calls": [("call_1", "get_weather", {"city": "Paris"})], "finish": "tool_calls", "reasoning": "a call"}+ if body.get("max_tokens") == 8:+ return {"content": "The sea is", "finish": "length"}+ if _words(user_text) > 10_000:+ if KNOBS.get("long") == "refuse":+ return {"status": 400, "code": "INPUT_TOO_LONG", "message": "prompt exceeds the context window"}+ return {"content": "7741-ZEBRA", "finish": "stop"}+ if "9.11" in user_text:+ mode = KNOBS.get("reasoning", "yes")+ reasoning = REASONING if mode in ("yes", "ignored", "stream_only") else ""+ answer = LONG_ANSWER if KNOBS.get("long_answer") else "9.9"+ if mode == "stream_only" and not body.get("stream"):+ return {"content": answer, "finish": "stop", "hidden": reasoning}+ if KNOBS.get("reasoning_without_flag") and not body.get("include_reasoning"):+ return {"content": answer, "finish": "stop", "reasoning": "leaked"}+ if not body.get("include_reasoning") or mode == "ignored":+ return {"content": answer, "finish": "stop", "hidden": reasoning}+ content = f"<think>hmm</think>{answer}" if KNOBS.get("leak_think") else answer+ return {"content": content, "finish": "stop", "reasoning": reasoning}+ return {"content": "ready", "finish": "stop"}+++def _thinking_budget_spent(body: dict[str, Any], reply: dict[str, Any]) -> dict[str, Any]:+ think = KNOBS.get("think_tokens", 0)+ max_tokens = body.get("max_tokens")+ if not think or max_tokens in (4, 8) or "status" in reply or reply.get("midstream_error"):+ return reply+ if max_tokens is None or max_tokens < think + 64:+ return {"content": "", "finish": "length", "hidden": "think " * (max_tokens or 0)}+ return reply+++class Handler(BaseHTTPRequestHandler):+ def log_message(self, *args: Any) -> None:+ pass++ def _json(self, status: int, payload: Any, headers: dict[str, str] | None = None) -> None:+ raw = json.dumps(payload).encode()+ self.send_response(status)+ self.send_header("content-type", "application/json")+ self.send_header("content-length", str(len(raw)))+ for name, value in (headers or {}).items():+ self.send_header(name, value)+ self.end_headers()+ self.wfile.write(raw)++ def do_GET(self) -> None:+ if self.path.endswith("/models"):+ if KNOBS.get("models_list"):+ self._json(200, [{"id": "stub-model"}])+ return+ entry: dict[str, Any] = {"name": "stub-model", "capabilities": {"tools": True}}+ if KNOBS.get("window"):+ entry["max_sequence_length"] = KNOBS["window"]+ self._json(200, {"models": [entry]})+ return+ self._json(404, {"error": {"message": "no such route"}})++ def _chunk(self, choices: list[dict[str, Any]], **extra: Any) -> None:+ payload = {"id": "chatcmpl-stub", "object": "chat.completion.chunk", "created": 1, "model": "stub-model"}+ payload["choices"] = choices+ payload.update(extra)+ self.wfile.write(f"data: {json.dumps(payload)}\n\n".encode())++ def _usage(self, body: dict[str, Any], reply: dict[str, Any]) -> dict[str, int]:+ prompt_tokens = sum(_words(m.get("content") or "") for m in body["messages"])+ completion = " ".join(+ [reply.get("content") or "", reply.get("reasoning") or "", reply.get("hidden") or ""]+ + [json.dumps(arguments) for _, _, arguments in reply.get("calls") or []]+ )+ completion_tokens = max(1, _words(completion))+ return {+ "prompt_tokens": prompt_tokens,+ "completion_tokens": completion_tokens,+ "total_tokens": prompt_tokens + completion_tokens,+ }++ def do_POST(self) -> None:+ body = json.loads(self.rfile.read(int(self.headers["content-length"])))+ KNOBS["_posts"] = KNOBS.get("_posts", 0) + 1+ if KNOBS["_posts"] <= KNOBS.get("loading", 0):+ error = {"message": "model is loading, please retry", "type": "server_error", "code": "MODEL_LOADING"}+ self._json(503, {"error": error})+ return+ reply = _thinking_budget_spent(body, _reply(body))+ if "status" in reply:+ error = {"message": reply["message"], "type": "invalid_request_error", "code": reply["code"]}+ retry = {"retry-after": str(KNOBS.get("retry_after", 0))} if reply["status"] in (429, 503) else {}+ self._json(reply["status"], {"error": error}, retry)+ return+ if not body.get("stream"):+ message: dict[str, Any] = {"role": "assistant", "content": reply.get("content")}+ if reply.get("reasoning"):+ message["reasoning_content"] = reply["reasoning"]+ payload = {+ "id": "chatcmpl-stub",+ "object": "chat.completion",+ "created": 1,+ "model": "stub-model",+ "choices": [{"index": 0, "message": message, "finish_reason": reply["finish"]}],+ "usage": self._usage(body, reply),+ }+ self._json(200, payload)+ return+ self.send_response(200)+ self.send_header("content-type", "text/event-stream")+ self.send_header("x-sie-served-by", "stub")+ self.send_header("x-sie-upstream", "vendor-name-from-the-profile")+ self.end_headers()+ self._chunk([{"index": 0, "delta": {"role": "assistant", "content": ""}, "finish_reason": None}])+ if reply.get("midstream_error"):+ self._chunk(+ [{"index": 0, "delta": {}, "finish_reason": None}],+ error={"message": "upstream busy", "type": "server_error", "param": None, "code": "QUEUE_FULL"},+ request_id="req-stub",+ )+ self.wfile.write(b"data: [DONE]\n\n")+ return+ for piece in (reply.get("reasoning") or "").split(" "):+ if piece:+ self._chunk([{"index": 0, "delta": {"reasoning_content": piece + " "}, "finish_reason": None}])+ for index, (call_id, name, arguments) in enumerate(reply.get("calls") or []):+ head = {"index": index, "type": "function", "function": {"name": name, "arguments": ""}}+ if not KNOBS.get("drop_ids"):+ head["id"] = call_id+ self._chunk([{"index": 0, "delta": {"tool_calls": [head]}, "finish_reason": None}])+ tail = {"index": index, "function": {"arguments": json.dumps(arguments)}}+ self._chunk([{"index": 0, "delta": {"tool_calls": [tail]}, "finish_reason": None}])+ for word in (reply.get("content") or "").split(" "):+ if word:+ self._chunk([{"index": 0, "delta": {"content": word + " "}, "finish_reason": None}])+ self._chunk([{"index": 0, "delta": {}, "finish_reason": reply["finish"]}])+ if not KNOBS.get("omit_usage"):+ self._chunk([], usage=self._usage(body, reply))+ self.wfile.write(b"data: [DONE]\n\n")++[email protected](scope="module")+def base_url() -> Iterator[str]:+ server = ThreadingHTTPServer(("127.0.0.1", 0), Handler)+ thread = threading.Thread(target=server.serve_forever, daemon=True)+ thread.start()+ try:+ yield f"http://127.0.0.1:{server.server_address[1]}/v1"+ finally:+ server.shutdown()++[email protected](autouse=True)+def reset_knobs() -> Iterator[None]:+ KNOBS.clear()+ SEEN.clear()+ yield+ KNOBS.clear()+ SEEN.clear()+++def _report(base_url: str, **knobs: Any) -> dict[str, Any]:+ KNOBS.update(knobs)+ return conformance.run(base_url, "", "stub-model")+++def _run(base_url: str, **knobs: Any) -> dict[str, dict[str, Any]]:+ return {case["name"]: case for case in _report(base_url, **knobs)["cases"]}+++def _failures(cases: dict[str, dict[str, Any]]) -> set[str]:+ return {name for name, case in cases.items() if case["status"] == "fail"}+++def test_conforming_wire_passes_every_case(base_url: str) -> None:+ report = _report(base_url)+ cases = {case["name"]: case for case in report["cases"]}+ assert _failures(cases) == set()+ assert cases["tool_choice_auto"]["status"] == "pass"+ assert cases["tool_choice_required"]["status"] == "recorded"+ assert cases["tool_choice_required"]["observed"]["support"] == "supported"+ assert cases["prompt_above_64k_tokens"]["observed"]["needle_found"] is True+ reasoning = cases["include_reasoning"]["observed"]+ assert reasoning["model_reasoned"] is True+ assert reasoning["with_include_reasoning"]["reasoning_deltas"] > 0+ assert reasoning["non_streamed_with_include_reasoning"]["reasoning_chars"] == len(REASONING)+ assert cases["streaming_tool_call_deltas"]["observed"]["headers"] == {"x-sie-served-by": "stub"}+ assert report["served_by"] == "stub"+ assert "vendor-name-from-the-profile" not in json.dumps(report)+++def test_tools_turns_carry_include_reasoning_and_send_reasoning_back(base_url: str) -> None:+ report = _report(base_url)+ assert report["tools_turn_params"] == {"tool_choice": "auto", "extra_body": {"include_reasoning": True}}+ assert SEEN["tools_turns"]+ assert all(turn.get("include_reasoning") is True for turn in SEEN["tools_turns"])+ (assistant,) = SEEN["round_trip_assistant"]+ assert assistant["content"] == ""+ assert assistant["reasoning_content"] == "a call "+ assert assistant["tool_calls"][0]["id"] == "call_1"+++def test_refused_include_reasoning_fails_and_the_tools_turns_go_without_it(base_url: str) -> None:+ report = _report(base_url, reasoning="refuse")+ cases = {case["name"]: case for case in report["cases"]}+ assert cases["include_reasoning"]["status"] == "fail"+ assert "include_reasoning refused: 400" in cases["include_reasoning"]["detail"]+ assert report["tools_turn_params"] == {"tool_choice": "auto"}+ assert all("include_reasoning" not in turn for turn in SEEN["tools_turns"])+ assert _failures(cases) == {"include_reasoning"}+++def test_tool_call_deltas_without_ids_fail(base_url: str) -> None:+ cases = _run(base_url, drop_ids=True)+ assert cases["streaming_tool_call_deltas"]["status"] == "fail"+ assert "no id" in cases["streaming_tool_call_deltas"]["detail"]+ assert cases["parallel_tool_calls"]["status"] == "fail"+++def test_model_loading_is_waited_out(base_url: str, monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(conformance, "WARM_UP_POLL_S", 0.01)+ report = _report(base_url, loading=3)+ assert report["warm_up"]["attempts"] == 4+ assert report["warm_up"]["error"] is None+ assert _failures({case["name"]: case for case in report["cases"]}) == set()+++def test_busy_refusals_are_retried_and_recorded(base_url: str) -> None:+ cases = _run(base_url, busy=2)+ assert _failures(cases) == set()+ assert cases["tool_choice_auto"]["status"] == "pass"+ retries = cases["streaming_tool_call_deltas"]["observed"]["retries"]+ assert [(retry["status"], retry["code"]) for retry in retries] == [(503, "QUEUE_FULL"), (503, "QUEUE_FULL")]+++def test_a_failed_tools_turn_does_not_blame_tool_choice(base_url: str) -> None:+ cases = _run(base_url, tools_error=True)+ assert cases["tool_choice_auto"]["status"] == "recorded"+ assert cases["tool_choice_auto"]["detail"].startswith("not judged")+ assert cases["streaming_tool_call_deltas"]["status"] == "fail"+++def test_an_error_event_mid_stream_is_recorded_not_raised(base_url: str) -> None:+ cases = _run(base_url, midstream_error=True)+ case = cases["streaming_tool_call_deltas"]+ assert case["status"] == "fail"+ assert case["observed"]["error"]["code"] == "QUEUE_FULL"+ assert case["observed"]["error"]["message"] == "upstream busy"+ assert cases["finish_reason_stop"]["status"] == "pass"+++def test_a_models_list_answered_as_a_json_array_keeps_the_report(base_url: str) -> None:+ report = _report(base_url, models_list=True)+ assert report["model_entry"] == {"id": "stub-model"}+ assert _failures({case["name"]: case for case in report["cases"]}) == set()+++def test_tool_choice_auto_refused_fails_and_the_loop_is_still_checked(base_url: str) -> None:+ report = _report(base_url, auto="refuse")+ cases = {case["name"]: case for case in report["cases"]}+ assert cases["tool_choice_auto"]["status"] == "fail"+ assert "tool_choice" in cases["tool_choice_auto"]["detail"]+ assert cases["streaming_tool_call_deltas"]["status"] == "pass"+ assert cases["parallel_tool_calls"]["status"] == "pass"+ assert cases["tool_result_round_trip"]["status"] == "pass"+ assert report["tools_turn_params"] == {"extra_body": {"include_reasoning": True}}+++def test_one_call_for_two_cities_fails(base_url: str) -> None:+ cases = _run(base_url, parallel="single")+ assert cases["parallel_tool_calls"]["status"] == "fail"+ assert cases["parallel_tool_calls"]["detail"].startswith("1 tool call")+++def test_required_refused_is_recorded_not_failed(base_url: str) -> None:+ cases = _run(base_url, required="refuse")+ assert cases["tool_choice_required"]["status"] == "recorded"+ assert cases["tool_choice_required"]["observed"]["support"] == "refused"+ assert cases["tool_choice_required"]["observed"]["error"]["status"] == 400+++def test_required_rate_limited_is_a_failure_not_a_refusal(base_url: str, monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(conformance, "RETRY_BUDGET_S", 0.2)+ cases = _run(base_url, required="rate_limited", retry_after=0.05)+ case = cases["tool_choice_required"]+ assert case["status"] == "fail"+ assert "support" not in case["observed"]+ assert case["observed"]["error"]["status"] == 429+ assert case["observed"]["retries"]+++def test_required_accepted_but_ignored_fails(base_url: str) -> None:+ cases = _run(base_url, required="ignore")+ assert cases["tool_choice_required"]["status"] == "fail"+++def test_missing_usage_fails(base_url: str) -> None:+ cases = _run(base_url, omit_usage=True)+ assert cases["usage_on_final_chunk"]["status"] == "fail"+ assert cases["prompt_above_64k_tokens"]["status"] == "fail"+ assert cases["finish_reason_stop"]["status"] == "pass"+++def test_long_prompt_refused_fails_with_the_error_recorded(base_url: str) -> None:+ cases = _run(base_url, long="refuse")+ case = cases["prompt_above_64k_tokens"]+ assert case["status"] == "fail"+ assert case["observed"]["error"]["code"] == "INPUT_TOO_LONG"+++def test_long_prompt_under_a_smaller_declared_window_is_recorded(base_url: str) -> None:+ refused = _run(base_url, long="refuse", window=16384)["prompt_above_64k_tokens"]+ assert refused["status"] == "recorded"+ assert refused["detail"].startswith("declared window 16384 is under 65536; refused: 400 INPUT_TOO_LONG")+ KNOBS.clear()+ accepted = _run(base_url, window=8192)["prompt_above_64k_tokens"]+ assert accepted["status"] == "recorded"+ assert "yet" in accepted["detail"]+++def test_long_prompt_clears_the_threshold_one_token_per_word() -> None:+ assert len(conformance.long_prompt().split()) >= conformance.LONG_PROMPT_MIN_TOKENS * 1.03+++def test_a_thinking_model_has_room_to_answer_every_case(base_url: str) -> None:+ cases = _run(base_url, think_tokens=3000)+ assert _failures(cases) == set()+ assert cases["tool_choice_required"]["observed"]["support"] == "supported"+++def test_reasoning_field_rules(base_url: str) -> None:+ assert _run(base_url, reasoning="no")["include_reasoning"]["status"] == "pass"+ assert _run(base_url, leak_think=True)["include_reasoning"]["status"] == "fail"+ assert _run(base_url, reasoning_without_flag=True)["include_reasoning"]["status"] == "fail"+++def test_a_reasoning_model_whose_server_drops_the_flag_fails(base_url: str) -> None:+ case = _run(base_url, reasoning="ignored")["include_reasoning"]+ assert case["status"] == "fail"+ assert "no delta.reasoning_content in the stream" in case["detail"]+ assert "no message.reasoning_content" in case["detail"]+++def test_reasoning_missing_from_the_non_streamed_message_fails(base_url: str) -> None:+ case = _run(base_url, reasoning="stream_only")["include_reasoning"]+ assert case["status"] == "fail"+ assert "no message.reasoning_content" in case["detail"]+ assert "in the stream" not in case["detail"]++[email protected]("reasoning", ["no", "ignored"])+def test_a_long_answer_without_reasoning_is_recorded_not_judged(base_url: str, reasoning: str) -> None:+ case = _run(base_url, reasoning=reasoning, long_answer=True)["include_reasoning"]+ assert case["status"] == "recorded", case["detail"]+ assert "whether the model reasoned is unknown" in case["detail"]+ assert case["observed"]["model_reasoned"] is Nonediff --git a/examples/coding-agent-opencode/tests/test_run_gate.py b/examples/coding-agent-opencode/tests/test_run_gate.pynew file mode 100644index 000000000..68022c55c--- /dev/null+++ b/examples/coding-agent-opencode/tests/test_run_gate.py@@ -0,0 +1,165 @@+"""run_gate.sh end to end, with a scripted stand-in for ``opencode`` on PATH.++Everything but the agent is real: the script copies the fixture, runs the+seeded tests before and after, checks the tests were left alone and prints+the verdict. Each stand-in plays one kind of agent run.+"""++from __future__ import annotations++import json+import os+import shutil+import subprocess+import time+from pathlib import Path++import pytest++EXAMPLE = Path(__file__).resolve().parents[1]++FIXED_AMOUNTS = """+from decimal import Decimal+++def parse_amount(text: str) -> Decimal:+ cleaned = text.strip()+ negative = cleaned.startswith("(") and cleaned.endswith(")")+ value = Decimal(cleaned.strip("()").replace("$", "").replace(",", ""))+ return -value if negative else value+++def total(cells: list[str]) -> Decimal:+ return sum((parse_amount(cell) for cell in cells), Decimal(0))+"""++DESELECT_FAILING_TESTS = (+ 'import os; os.environ["PYTEST_ADDOPTS"] = '+ '"--deselect tests/test_amounts.py::test_credit_in_parentheses_is_negative '+ '--deselect tests/test_amounts.py::test_total_nets_credits"'+)+++FIX = f"cat > invoice_totals/amounts.py <<'PY'\n{FIXED_AMOUNTS}\nPY"+NO_CHANGE = 'echo \'{"type":"text","text":"nothing to do"}\''+++def _executable(path: Path, body: str) -> None:+ path.write_text(f"#!/usr/bin/env bash\nset -eu\n{body}\n")+ path.chmod(0o755)+++def _gate(tmp_path: Path, agent: str, extra_env: dict[str, str] | None = None) -> tuple[int, list[str]]:+ root = tmp_path / "example"+ if not root.exists():+ root.mkdir()+ shutil.copy(EXAMPLE / "run_gate.sh", root)+ ignored = shutil.ignore_patterns(".venv", "uv.lock", "__pycache__", ".pytest_cache")+ shutil.copytree(EXAMPLE / "fixture", root / "fixture", ignore=ignored)+ shutil.copytree(EXAMPLE / "recipes", root / "recipes")+ bin_dir = tmp_path / "bin"+ bin_dir.mkdir(exist_ok=True)+ _executable(bin_dir / "opencode", agent)+ env = {key: value for key, value in os.environ.items() if key != "VIRTUAL_ENV"}+ env["PATH"] = f"{bin_dir}{os.pathsep}{env['PATH']}"+ env.update(extra_env or {})+ run = subprocess.run(+ ["bash", str(root / "run_gate.sh"), "laptop"], check=False, capture_output=True, text=True, env=env, timeout=600+ )+ return run.returncode, run.stdout.strip().splitlines()+++def test_a_real_fix_passes(tmp_path: Path) -> None:+ code, lines = _gate(tmp_path, FIX)+ assert code == 0, lines+ assert lines[-1].startswith("GATE PASS")+++def test_runs_started_in_the_same_second_judge_their_own_copies(tmp_path: Path) -> None:+ (tmp_path / "bin").mkdir()+ _executable(tmp_path / "bin" / "date", "echo 20260101T000000Z")+ first_code, first = _gate(tmp_path, FIX)+ second_code, second = _gate(tmp_path, NO_CHANGE)+ assert first_code == 0, first+ assert second_code == 1+ assert second[-1].startswith("GATE FAIL (")+ assert first[-1].rsplit("(", 1)[1] != second[-1].rsplit("(", 1)[1]+++def test_an_untouched_fixture_fails(tmp_path: Path) -> None:+ code, lines = _gate(tmp_path, NO_CHANGE)+ assert code == 1+ assert lines[-1].startswith("GATE FAIL (")+++def test_a_failed_opencode_run_still_prints_a_verdict(tmp_path: Path) -> None:+ code, lines = _gate(tmp_path, "exit 3")+ assert code == 1+ assert lines[-1].startswith("GATE FAIL: opencode run exited 3")+++def test_changed_tests_fail_before_pytest_is_asked(tmp_path: Path) -> None:+ code, lines = _gate(tmp_path, "printf 'def test_nothing():\\n assert True\\n' > tests/test_amounts.py")+ assert code == 1+ assert lines[-1].startswith("GATE FAIL: the tests or pyproject.toml were changed")+++def test_an_environment_planted_in_the_worked_copy_is_not_used(tmp_path: Path) -> None:+ agent = (+ "[ -d .venv ] || uv venv --quiet --python 3.12 .venv\n"+ "site=$(.venv/bin/python -c 'import sysconfig; print(sysconfig.get_paths()[\"purelib\"])')\n"+ f"echo '{DESELECT_FAILING_TESTS}' > \"$site/zz_gate.pth\""+ )+ code, lines = _gate(tmp_path, agent)+ assert code == 1+ assert lines[-1].startswith("GATE FAIL (")+ assert any("2 failed" in line for line in lines)++[email protected]("variable", ["PYTEST_ADDOPTS", "PYTEST_PLUGINS"])+def test_the_callers_pytest_environment_cannot_deselect_the_seeded_tests(tmp_path: Path, variable: str) -> None:+ plugins = tmp_path / "plugins"+ plugins.mkdir()+ (plugins / "gate_deselect.py").write_text(+ "def pytest_collection_modifyitems(config, items):\n"+ " items[:] = [item for item in items if 'credit' not in item.name]\n"+ )+ caller = {+ "PYTEST_ADDOPTS": {"PYTEST_ADDOPTS": "-k 'not credit'"},+ "PYTEST_PLUGINS": {"PYTEST_PLUGINS": "gate_deselect", "PYTHONPATH": str(plugins)},+ }[variable]+ code, lines = _gate(tmp_path, NO_CHANGE, caller)+ assert code == 1, lines+ assert lines[-1].startswith("GATE FAIL (")+ assert any("2 failed" in line for line in lines)+++def test_the_build_agent_gets_the_step_budget(tmp_path: Path) -> None:+ record = tmp_path / "opencode-call.txt"+ agent = f'printf \'%s\\n\' "$@" "$OPENCODE_CONFIG_CONTENT" > {record}\n{FIX}'+ code, lines = _gate(tmp_path, agent, {"GATE_STEPS": "7"})+ assert code == 0, lines+ *args, config = record.read_text().splitlines()+ assert args[args.index("--agent") + 1] == "build"+ assert json.loads(config) == {"agent": {"build": {"steps": 7}}}++[email protected]("ignores_term", [False, True])+def test_a_run_past_its_deadline_is_stopped_and_fails(tmp_path: Path, ignores_term: bool) -> None:+ child = tmp_path / "agent-child.pid"+ prelude = "trap '' TERM\n" if ignores_term else ""+ agent = f"{prelude}sleep 120 &\necho $! > {child}\nwait"+ started = time.monotonic()+ code, lines = _gate(tmp_path, agent, {"GATE_DEADLINE_SECONDS": "2"})+ assert code == 1, lines+ assert lines[-1].startswith("GATE FAIL: opencode run passed its 2s deadline")+ assert time.monotonic() - started < 60+ pid = int(child.read_text())+ for _ in range(50):+ try:+ os.kill(pid, 0)+ except ProcessLookupError:+ break+ time.sleep(0.1)+ else:+ pytest.fail(f"the agent's child process {pid} outlived the deadline")diff --git a/examples/coding-agent-opencode/uv.lock b/examples/coding-agent-opencode/uv.locknew file mode 100644index 000000000..e337c60b7--- /dev/null+++ b/examples/coding-agent-opencode/uv.lock@@ -0,0 +1,350 @@+version = 1+requires-python = "==3.12.*"++[[package]]+name = "annotated-types"+version = "0.8.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/5f/56/a8120250d128bed162cd73c76d45f6ef9991f3e068f62a8ee060afa3104a/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7", size = 15893 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427 },+]++[[package]]+name = "anyio"+version = "4.15.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "idna" },+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/a9/d2/f4d173e22df740bc37b1db102b386ba719b66e95b0f0d751f556b387e6d2/anyio-4.15.1.tar.gz", hash = "sha256:9f28306018cbd6d329e64a36d58256edff76dd996fe423bc957326e578b82a94", size = 276966 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/12/b8/4bd346e22b28902df4d651910f5242c28d84e4a5c2435ca5c3f797ed7e2e/anyio-4.15.1-py3-none-any.whl", hash = "sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101", size = 132079 },+]++[[package]]+name = "certifi"+version = "2026.7.22"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/a3/c2/24167ea9858356b47a87a50d39908bfdb72ceeefe0041586e704e5376b3a/certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55", size = 138112 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", size = 136983 },+]++[[package]]+name = "colorama"+version = "0.4.6"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },+]++[[package]]+name = "h11"+version = "0.16.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515 },+]++[[package]]+name = "httpcore"+version = "1.0.9"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "certifi" },+ { name = "h11" },+]+sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784 },+]++[[package]]+name = "httpcore2"+version = "2.13.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "h11" },+ { name = "truststore" },+]+sdist = { url = "https://files.pythonhosted.org/packages/cb/f3/1db7aa2bc2524062192bb0e0323969492d1883152a232fe36eea65f4e35c/httpcore2-2.13.1.tar.gz", hash = "sha256:e0aa977abe17e69a3b820a24542a6fa88702676d83880b8d194dcd18408e5103", size = 68071 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/09/ba/a4568248771ce81957bfb7cc600264a40fbcda092391ee1c415c50be4bea/httpcore2-2.13.1-py3-none-any.whl", hash = "sha256:e1e05d4f25f7d7d496bfb96748f6f4b67657b03da069b3a68c36069f3db73d0a", size = 83423 },+]++[[package]]+name = "httpx"+version = "0.28.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "anyio" },+ { name = "certifi" },+ { name = "httpcore" },+ { name = "idna" },+]+sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 },+]++[[package]]+name = "httpx2"+version = "2.13.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "anyio", marker = "sys_platform != 'emscripten'" },+ { name = "httpcore2", marker = "sys_platform != 'emscripten'" },+ { name = "httpx2-jsfetch", marker = "sys_platform == 'emscripten'" },+ { name = "idna" },+ { name = "truststore", marker = "sys_platform != 'emscripten'" },+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/d5/44/474bef2a0e9d90f1715d32cb98b0738695ca17ba324095fb2497ed7fbd59/httpx2-2.13.1.tar.gz", hash = "sha256:e48744a19e3af5ee48313d0ce5fe941d5422fae5705ea922a4aabf94d7800dfa", size = 100405 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/d8/9c/6fe8931fd9f381042a9e4c7d5a7b4cbf7016b252bec0c99a49fce42c3326/httpx2-2.13.1-py3-none-any.whl", hash = "sha256:6dff50fabc270ee5fd25d845d0b078ed20564579744d6d962850975996d2f9a4", size = 95597 },+]++[[package]]+name = "httpx2-jsfetch"+version = "1.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/cd/c4/0e5636363151a2a1795e0a77617168b9ca438e1748ec05fc9b5687f93d64/httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60", size = 6872 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/9b/43/832f631d32e4f1211caa2ba368317739fe71f0b8530e4c9d15dc454bac2a/httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32", size = 6382 },+]++[[package]]+name = "idna"+version = "3.20"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583 },+]++[[package]]+name = "iniconfig"+version = "2.3.1"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/01/e1/2069291243c926a2ff1cd706c7f3eeb9b62144bf60f77c9fb9ff2fb26bd3/iniconfig-2.3.1.tar.gz", hash = "sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960", size = 21209 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/56/43/4ca9e49d27a1fcf6bece6f6aec0ea46bb9112489b93d4b688fb415457bdb/iniconfig-2.3.1-py3-none-any.whl", hash = "sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7", size = 7552 },+]++[[package]]+name = "jiter"+version = "0.17.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/9c/1f/8176d92e001f86505424b41664032ae26a882bc9ca41a32c803f373f9195/jiter-0.17.0.tar.gz", hash = "sha256:03e432f226a453851079fb84cd17c6da9991eab723e28d716f14ae3d906e0c12", size = 229037 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/aa/f8/07bd8c3a23f7a8a6875e6a820bbffe1483a18f18f9398a91b5495123176e/jiter-0.17.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:ebf918dfd6a74adc1b9ad71f63c4ab00902fcd3b7fd39f2e24d871db8d713b91", size = 291633 },+ { url = "https://files.pythonhosted.org/packages/0e/5e/0de4c6f84ffefa6809ffc2d550b9a314365acf7e7ec9b6c7375d49047900/jiter-0.17.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:61aed66ee042b3b49ef85fdf75714234d055d89d8496ac1c6e47f89e7a30d5e4", size = 321695 },+ { url = "https://files.pythonhosted.org/packages/20/ac/befe2e82065bee37a0252081666ed2f48c1ac5f5c6c318c2de8168ba393d/jiter-0.17.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76eb4a5c20e86f9f848286f167024890f2862258a965d254774deb7fc1545ca1", size = 341967 },+ { url = "https://files.pythonhosted.org/packages/9f/cd/9797c1e529746750ae589da7c1a8c24373f00d88e11a989f9e5eb1959079/jiter-0.17.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bcc064f99183a9cbe7f26ed648c352031a74145cd61ed75d34632c73eb46a5a8", size = 326546 },+ { url = "https://files.pythonhosted.org/packages/d9/fd/e6914c38d6347bab4ebff2b1f0c0f191db276e7a1d5c376176757da42fe3/jiter-0.17.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:73b64e69c4150748e020356d958af94bec33c70a0a93d665cfa8f6d580fe1a63", size = 340995 },+ { url = "https://files.pythonhosted.org/packages/9d/7d/611b3abf6f88945b5474da5cdc6d1a185e805ac9bf446bb7766dcda6ea87/jiter-0.17.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f0bc7f684b65bcda9c20434267577db71bf9905ceddd32b60d1d93278d8c8d3a", size = 352188 },+ { url = "https://files.pythonhosted.org/packages/52/f8/b6e513ecbdf3b3cebe587c2279281ecf775b729a58cf4cc7bdf898ded029/jiter-0.17.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c21265b251d99bbb40080d178a8953e35601d3a1564e05c4de4c0d2ca616797", size = 345025 },+ { url = "https://files.pythonhosted.org/packages/28/a8/fe26d06c5a6c5a4cfe703c5154c8a140da1305671eb3681aba9422d4f393/jiter-0.17.0-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:f3d7f7b34114f7ddc6d72a8e882d49de636b35d9fd12b4d420d3c5729f6c9812", size = 329180 },+ { url = "https://files.pythonhosted.org/packages/e1/58/e6d66a26af40a20e62486feb7e222fd50f6e7aaa4f107abd89675dcc835b/jiter-0.17.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5078ab00664307fab2019b522a93aeb191122789f085daf5fd9e362154021d4a", size = 335805 },+ { url = "https://files.pythonhosted.org/packages/ef/3e/96520aa2fef5ef831d95483a902140bfab83dcac9eaa74f7df61b5e50a1b/jiter-0.17.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:470e1b1e4c42f1ead2189166a299691871a2df5056c976e7fb96feafaf5f9d44", size = 484121 },+ { url = "https://files.pythonhosted.org/packages/6a/8f/5d9d92fe538bf36ff481a2278c48147e59c1cf8eb2f7be665260665febe5/jiter-0.17.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:6eb6aedeb7352b8f3b6af9cbd67983840165c00428e63f1b420a85885128ea31", size = 521310 },+ { url = "https://files.pythonhosted.org/packages/50/06/a09f979b22e652afbc3de66c709b2ba92edcef555f7535ab937c86b4f21a/jiter-0.17.0-cp312-cp312-win32.whl", hash = "sha256:362bb47423886d45a9f705d2d9d4008c6eedd4e41eb1bab4e96fb6daa06b33fd", size = 185029 },+ { url = "https://files.pythonhosted.org/packages/6c/d9/98265a005b2473ec2be5a84e2b64c2f65382c673879f1574845cd4bcd77c/jiter-0.17.0-cp312-cp312-win_amd64.whl", hash = "sha256:9bd3caac219df476dd0cc3fe01d2f1581ed588906feac767abd9614c1c12f8b3", size = 227381 },+ { url = "https://files.pythonhosted.org/packages/a8/11/2e05bf5a56e57a543ebb8f585074adf09383e99d7b062dac92eab1f4d57f/jiter-0.17.0-cp312-cp312-win_arm64.whl", hash = "sha256:36ee6e69027396664e59995b9a635a947a5304ee9837279584a0bb8145c8f6b8", size = 183610 },+]++[[package]]+name = "openai"+version = "3.29.0"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "anyio" },+ { name = "httpx2" },+ { name = "jiter" },+ { name = "pydantic" },+ { name = "sniffio" },+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/e4/99/5f6206494a87edbaa67b35c5212a2cb5e6f414bee5efb0f0672c4704315a/openai-3.29.0.tar.gz", hash = "sha256:bc70a46d97b70ba64daedfcb3227f610a395f297ec68d39f735676190a92be94", size = 1828914 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/ef/9a/91285d01a9293d0b3d86167f9c7bd13f08c960d3fa365782751ce9bcbfb1/openai-3.29.0-py3-none-any.whl", hash = "sha256:860d3bad424c5d38cd9ba0a0a2050d558b58ce027596a39f9ccbc0f51a2090b7", size = 2173181 },+]++[[package]]+name = "packaging"+version = "26.3"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956 },+]++[[package]]+name = "pluggy"+version = "1.6.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538 },+]++[[package]]+name = "pydantic"+version = "2.14.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "annotated-types" },+ { name = "pydantic-core" },+ { name = "typing-extensions" },+ { name = "typing-inspection" },+]+sdist = { url = "https://files.pythonhosted.org/packages/7c/0b/8e10b2e693af8ec54346a14caf36221334775975a747c9ceaa3f8371d96d/pydantic-2.14.1.tar.gz", hash = "sha256:94f478203dd03404682a1ada216965651dd74b1d2d5ffd62e00e0837caab5c26", size = 900362 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/35/ea/a56b9fe5066f3537b7882f77e9c5dfb26d8c2eefdaed9b5fc73d57b4dc22/pydantic-2.14.1-py3-none-any.whl", hash = "sha256:9195d967ec791692a04438115466764fb8b9a27b31f14a760437694f40d6b454", size = 488106 },+]++[[package]]+name = "pydantic-core"+version = "2.50.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/a6/24/af4ec4be49fbc810f35b0bdcacc3d433b56bbfa469fd3bfd4ae116cd9bf1/pydantic_core-2.50.1.tar.gz", hash = "sha256:e50d7b94baac6c7d09927fa5ca5800a0c7ee5015c7fcff65beb3a1931b5a6e09", size = 513515 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/ee/94/101b49a6c63f99586755690696eae14532772587d9e39e93f7b8d28a49da/pydantic_core-2.50.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:704075d10b74f2f3c6e15407c696d88701df35fc8953f434a431add0d0074db0", size = 2222428 },+ { url = "https://files.pythonhosted.org/packages/db/a3/f8b1b39349c33037c73d7a1b794c9c29d8f07d5bd2b74399c1375a529cc6/pydantic_core-2.50.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e8e1d6ce820aa23317e8209a86bd65a540973c12dc7552b48a4f6c8e9926815e", size = 2025779 },+ { url = "https://files.pythonhosted.org/packages/d2/2d/862a7d115305cc621358e51ba13f296e0ffdf4fbd984be9f63bc7862730b/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c18db21573bd2c6489f9a544b7499f0df2853958c568e5e783536ee1f690af41", size = 2048429 },+ { url = "https://files.pythonhosted.org/packages/c0/7d/fed95d18bf2b5abe2d5ab2bbec4184bfc22b6805994a33ccdae8edffd25a/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cb57f304525a5e3c13333b772bf9a473f36326e9c821b2e8e1b2fd36f80ae2c3", size = 2173274 },+ { url = "https://files.pythonhosted.org/packages/93/1e/c6f22ceac65dc3d291ff79bea0eb74cbd1de8b128f01fee48af03bcea1e1/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a27c09d86600f1bf2fe3f37e1ae697faf3143931c09322cd799da94deee923b5", size = 2360403 },+ { url = "https://files.pythonhosted.org/packages/2c/97/190b5b6bfe4c72f265feb657913eb30749193927a5ad7b83cfa7866a25a2/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:46b3301d3b5c886f77de7546e47274a5842c622ea2020b8c6524c6b66913b4a6", size = 2439799 },+ { url = "https://files.pythonhosted.org/packages/90/24/48cd98388e4ac2c08d0800af36d15413db15e20387f1038123a2c86cb2f6/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93ba4e9d8210d941c200431a56b2c0400b131865947903937ed3ec5404307d2e", size = 2160157 },+ { url = "https://files.pythonhosted.org/packages/00/86/d909133d0b9979ed14c20f110f21124a0e346caf071bd66ac5af3009062b/pydantic_core-2.50.1-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:e5faeaee74a57d32b3ab3aebad2e348f06d3ba946fc5d28c1728455f00a3d13a", size = 2229523 },+ { url = "https://files.pythonhosted.org/packages/90/31/4b43f08131b2098e73a852fd932063385f3103b33839fd9d1abdb89e673d/pydantic_core-2.50.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a3cda0e538208e5d722bbf3698b24f19c0a7d05bc8d5f8a7f9b121ea7fa243d9", size = 2242700 },+ { url = "https://files.pythonhosted.org/packages/88/77/de39658569dc7a4c293d110a89629f61145e7538f00d1e4280c28debefd3/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:57f51b31ff826e2859120cf4737c5a758a48d96f3e97da40ccee1796d58078ff", size = 2278452 },+ { url = "https://files.pythonhosted.org/packages/46/bd/1eeb9e4e791e81210ef9096f58080b32ba15b5b13c108d50aaa3f8ce9f73/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8daa7ee75245d43ad7d747e5c9ecc1b1d06552f72b14887e9276f787d57375f4", size = 2450098 },+ { url = "https://files.pythonhosted.org/packages/1c/e6/b2accfdff17e5a88d6358536702146de00f9339adaa4d5bbe1ee93cb4832/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:acbf31f37c53a5ac0c34706c80b4f5107ba20b05fdd3816124bf236ef0c57dd2", size = 2476839 },+ { url = "https://files.pythonhosted.org/packages/3b/7e/c8a83eb5d2cd42c2e13507150fb777b1edea5a018adc9cbf2858a1d08285/pydantic_core-2.50.1-cp312-cp312-win32.whl", hash = "sha256:45b11cac094aa25725581d9304eee93c9028516b9ea80dd9e175e13a5a2c840e", size = 2101425 },+ { url = "https://files.pythonhosted.org/packages/c5/17/8bbd530b8659e9d963f5b16f6cb8e159f4cd174b4d6304e48969ab12dba8/pydantic_core-2.50.1-cp312-cp312-win_amd64.whl", hash = "sha256:132529c83901437ff642f585216831bf5fd7a91df66829907e155192ead62498", size = 2172522 },+ { url = "https://files.pythonhosted.org/packages/af/9f/a79d690b127e4e3cff143d031538ab9aa715f6b2fbeecbd07cd6f2bf9fb7/pydantic_core-2.50.1-cp312-cp312-win_arm64.whl", hash = "sha256:4e834f6a8e4ff772dcc34f58ef5504147a3ea5b0f4eeb13b0f8eb2ca75ac57f1", size = 2161366 },+]++[[package]]+name = "pygments"+version = "2.21.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147 },+]++[[package]]+name = "pytest"+version = "9.1.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "colorama", marker = "sys_platform == 'win32'" },+ { name = "iniconfig" },+ { name = "packaging" },+ { name = "pluggy" },+ { name = "pygments" },+]+sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536 },+]++[[package]]+name = "ruff"+version = "0.17.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/e9/a7/70debb024dfacda67b8e560cc7511f52b34b9348a8cc8c1ec23036dcd51d/ruff-0.17.0.tar.gz", hash = "sha256:5cd03240d8208a557c2a9655a5cb07ebe36aa6bb35065f97d48c1f6adef5a322", size = 5320554 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/bc/f8/ee5ab9da6089eae2a33e6008b01deb1eda19992c1c8e10661e98cee1640f/ruff-0.17.0-py3-none-linux_armv6l.whl", hash = "sha256:0e271826af9a20d18c6cfae8c51e82959167c24859686ddd3eb9a7f0842ce81e", size = 10148907 },+ { url = "https://files.pythonhosted.org/packages/9f/d9/2f81fb5a9d580afbb11b1c8ff915233a11f2a1b27405d7991f183c5e1976/ruff-0.17.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5f0ca4a40f81403689c04f12966e22f44e329ae362072d8f1587b7bda87f603b", size = 10224208 },+ { url = "https://files.pythonhosted.org/packages/a7/20/643f3c8f75594f937b2bf74801241c56a2e2b8e139d24dff8b66b28cdd7f/ruff-0.17.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:cbf7149e0927dc3295d5d64679a4765576eef71b00782b2ae969ef82274d6bb9", size = 9273324 },+ { url = "https://files.pythonhosted.org/packages/ec/91/627700b233d367736cb274f1bd0b47d1f2b12f68878192812bd875adadc3/ruff-0.17.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:13ee90156522998c3037059d8f66885c8adeeaf7643bdce2caceee196ecd23e0", size = 9953190 },+ { url = "https://files.pythonhosted.org/packages/cd/92/91f7b5ed39490f89d6cbf56e1f543c383667a725efa8e2c2dee0f01f5591/ruff-0.17.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3d8e4a002a94cd9d0dc48b51dc69d807a172b5b9bf2b668e656424dc5b55ead1", size = 9961746 },+ { url = "https://files.pythonhosted.org/packages/87/c5/7310f9fc63ce11ff6394edbd5e85433dfb0e14c9fbf6ccc97f1538491bc7/ruff-0.17.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c0b8a60c06a218c337e1161638d34757f83449243e2db161483ddf948e53ad14", size = 10625483 },+ { url = "https://files.pythonhosted.org/packages/a5/8d/97443f0dca4a03a0bc7629fd396fd494a1cb6666121e38c5075acb217d8f/ruff-0.17.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a330178bdffc4205dbf3bda11d93e059e388fd6546f8cdd304501a9160363c0d", size = 11350129 },+ { url = "https://files.pythonhosted.org/packages/9c/0a/c525efd9777be4b6b012e6969a3012648468e7e6c4b3e5b46af69f46e8eb/ruff-0.17.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7bb08489e234876fa2da67ae3ea938e9a2156da80293e0e4365abd6973d98329", size = 10906223 },+ { url = "https://files.pythonhosted.org/packages/2c/3c/4a01195d93420cad1175bedad13a515dc8a56f95a6e39789b92e582682f5/ruff-0.17.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc73e7c133e82d55b5f15897b2a442d72c0cb4a0c886c46801ce3c247150b60c", size = 10386314 },+ { url = "https://files.pythonhosted.org/packages/c7/72/1a3951665485a921f6375f91e754a1854d5a645d41acc3642668064ff64d/ruff-0.17.0-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:db4f74c533403ab70fe4007873f6ae0c9f94a8b03158cf48d78788e47cdbe399", size = 10565464 },+ { url = "https://files.pythonhosted.org/packages/90/8c/539b4d8c082f57e18db8ae2be85a460d77861c79dcd5798e32b536a6a06f/ruff-0.17.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3d8cc360e666d1914e47b0777c6906d70cf18891a55532bd0a16844195d70859", size = 10079468 },+ { url = "https://files.pythonhosted.org/packages/e0/b8/84286966db79434e8c26b585b0a0f6897cb3ab1c51a4aa4df10c28488b62/ruff-0.17.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d66de796b726c4801e05fa99a2a8d7a780e107be222486c304ab61765561e866", size = 9958556 },+ { url = "https://files.pythonhosted.org/packages/69/50/27b6eed27b83fcdd5bfa0d52b83231e29094754374698da404d094487ae3/ruff-0.17.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c3f268baf004aea944f040623327119527ea231af15f7fb7890e82cea0679589", size = 10352173 },+ { url = "https://files.pythonhosted.org/packages/2a/fa/955399fd13044cd827862044117d784a59e3196f6cce7424908ac9a7f914/ruff-0.17.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:864b6c1acb6b0bccf94b5a3938a1531fd09aaca5e5659a2e7bf0f3cf2a685540", size = 10791761 },+ { url = "https://files.pythonhosted.org/packages/ae/bf/024e01e1f6aec87768696725e648ed5b438941341eea8f8100beb681961f/ruff-0.17.0-py3-none-win32.whl", hash = "sha256:5e50aa5b84decd9fe5b0bb0e6f71c3b592f1767ed09faa4b7207d933961e35cd", size = 9904112 },+ { url = "https://files.pythonhosted.org/packages/cc/77/1ee73df41dcc8d1cdb686ee4bc46ea29704ea175feb6b95c78420f631ab8/ruff-0.17.0-py3-none-win_amd64.whl", hash = "sha256:8ab76bcda86dfd28e13776cb5de3c7bcdcf1ae3d37ed761113d1a5a415dc134c", size = 10115585 },+ { url = "https://files.pythonhosted.org/packages/fd/71/eb4f0ccc844aece56963e8578df9c95d4c00f580547d52329d4035d3af18/ruff-0.17.0-py3-none-win_arm64.whl", hash = "sha256:c154c73ff43f9854395e24cac507af13078962e53d2b511605058d22af1fdb88", size = 9872035 },+]++[[package]]+name = "sniffio"+version = "1.3.1"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 },+]++[[package]]+name = "superlinked-sie-coding-agent-opencode-example"+version = "0.1.0"+source = { virtual = "." }+dependencies = [+ { name = "httpx" },+ { name = "openai" },+]++[package.dev-dependencies]+dev = [+ { name = "pytest" },+ { name = "ruff" },+]++[package.metadata]+requires-dist = [+ { name = "httpx", specifier = ">=0.28,<1" },+ { name = "openai", specifier = ">=3.0" },+]++[package.metadata.requires-dev]+dev = [+ { name = "pytest", specifier = ">=8" },+ { name = "ruff", specifier = ">=0.14" },+]++[[package]]+name = "truststore"+version = "0.10.5"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/ee/9f/c5201d42a484c061e528825fc8e2d565f5abd50a4ced6fb7d29c4ec99b2b/truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd", size = 28091 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/51/e9/3a7820be2bb0fe53b6bc9c3be26d3d1158004e4c3ab953aa6840b955b1e9/truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c", size = 19017 },+]++[[package]]+name = "typing-extensions"+version = "4.16.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571 },+]++[[package]]+name = "typing-inspection"+version = "0.4.4"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "typing-extensions" },+]+sdist = { url = "https://files.pythonhosted.org/packages/a3/26/b09b8010994eccc3c09092e6b34058f36a460eea2d4c3e8b910c695975a0/typing_inspection-0.4.4.tar.gz", hash = "sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47", size = 76928 }+wheels = [+ { url = "https://files.pythonhosted.org/packages/67/81/4add07e5172b7ac40d8ed5ff580409a7801a4fe26d529bdd915401dabfbe/typing_inspection-0.4.4-py3-none-any.whl", hash = "sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147", size = 14750 },+]