Compare commits
4
Commits
17f16a6bfc
...
dff4849947
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dff4849947 | ||
|
|
0efbf218c5 | ||
|
|
f1e0de33ca | ||
|
|
ee7700275c |
No files matched your search
@@ -147,10 +147,20 @@ timers.py in-process timer/alarm service (TimerService) owned by the
|
||||
the gateway routes it to the originating chat, the dashboard
|
||||
shows pending/fired). Real local compute (`compute` transport),
|
||||
per-process, and deliberately NOT persisted across restarts.
|
||||
engine.py SemIfEngine -> semif_phase1.llamacpp_backend (lazy import);
|
||||
call() scores a decision, generate() autoregressively samples
|
||||
text from the same loaded model (shares the engine lock, clears
|
||||
the KV cache) — backs the `semif` llm provider
|
||||
engine.py DecisionEngine (the pluggable contract: call/warm/loaded/
|
||||
generate) + SemIfEngine, the default local provider ->
|
||||
semif_phase1.llamacpp_backend (lazy import); call() scores a
|
||||
decision, generate() autoregressively samples text from the
|
||||
same loaded model (shares the engine lock, clears the KV cache)
|
||||
— backs the `semif` llm provider. Selected per machine by
|
||||
`engine.provider` (mirrors llm.provider/codegen.provider).
|
||||
winnow.py WinnowEngine -> a remote Winnow `/v1/systemone` typed-decision
|
||||
HTTP API (`engine.provider == "winnow"`): maps DecisionRequest
|
||||
to a `choice` question (options -> criteria), validates and
|
||||
normalizes the returned distribution over exactly those option
|
||||
ids, and generate() via /v1/chat/completions. stdlib urllib; an
|
||||
internal lock serializes on the single-slot server; every
|
||||
failure raises EngineUnavailable (fatal, like the local engine)
|
||||
codegen.py CodegenClient (OpenAI-compatible) writes real-integration skill
|
||||
bodies against CODEGEN.md (real actions via stdlib transports,
|
||||
data from the runner via ctx.config, never embedded; bodies
|
||||
@@ -561,6 +571,33 @@ CLI, unit tests (24) + integration tests (2).
|
||||
|
||||
## Constraints & gotchas (learned the hard way)
|
||||
|
||||
### Decision engine (providers)
|
||||
- The decision engine is **pluggable**, selected per machine by `engine.provider`
|
||||
in config.json — the same provider pattern as `llm`/`codegen`. `"semif"`
|
||||
(default) is the local llama.cpp GGUF (`SemIfEngine`); `"winnow"` is a remote
|
||||
Winnow `/v1/systemone` typed-decision API (`semif_agent.winnow.WinnowEngine`,
|
||||
configured by the nested `engine.winnow` block). `cli.build_engine` picks the
|
||||
class; `SemIfEngine`/`WinnowEngine` both satisfy `engine.DecisionEngine`
|
||||
(`call`/`warm`/`loaded`/`generate`).
|
||||
- **The engine is always real and every `EngineUnavailable` is fatal**,
|
||||
whichever provider is selected: `WinnowEngine` converts every network, HTTP,
|
||||
and malformed/unnormalized-distribution failure into `EngineUnavailable` so
|
||||
the scheduler's fatal path (and the codegen watchdog / LLM bridge's graceful
|
||||
paths) behave identically to the local engine. There is no fallback model.
|
||||
- The agent's flat decision (`state` + `question` + typed `options`) maps onto
|
||||
Winnow's `choice` question type (`options` -> `criteria` id->description,
|
||||
`question` -> `instructions`); the returned distribution is validated against
|
||||
exactly the requested option ids and normalized. `generate` goes through the
|
||||
same server's `/v1/chat/completions`, so `llm.provider == "semif"` keeps
|
||||
working when the decision engine is Winnow.
|
||||
- Swapping the decision model changes routing/assessment behaviour and the
|
||||
decision-log distribution; that is the intended per-machine choice. The
|
||||
decision log and `dream` cost are unchanged because `DecisionResult` is the
|
||||
same contract.
|
||||
- Context differs by provider (the local engine's `engine.context_tokens` vs the
|
||||
remote server's own `--ctx-size`); a state that overflows is a fatal
|
||||
`EngineUnavailable`, the same class as the local token limit.
|
||||
|
||||
### Environment
|
||||
- The core is pure stdlib and runs anywhere Python does. Never pip-install heavy
|
||||
deps on a thin client; a full install belongs on a provisioned host.
|
||||
|
||||
+16
-3
@@ -5,7 +5,7 @@
|
||||
"creation_approval": false,
|
||||
"timezone": "",
|
||||
"navigation": {
|
||||
"_comment": "Navigation is two-stage at BOTH levels and the guards are the create doors (no threshold gate). Category: the softmax offers each existing category WITH its description (bare names carried no signal) plus create_category; confirm_category_fit then confirms the winner's scope (phase navigate:category_scope, P(covers) >= category_tau) and a rejected winner authors a new category. The `response` catchall and create_category share a boundary arbitrated by the actionability guard confirm_non_action (phase navigate:actionability, P(non_action) >= action_tau): the closed response tree is reached ONLY when the input is not a request, so a request no skill covers (e.g. \"what is 255 * 12?\") authors instead of getting a canned reply. Leaf: the softmax offers only existing skills; confirm_skill_fit then compares the winner's action to the request (phase navigate:intent, P(same) >= intent_tau) and a mismatch authors a new leaf. All three taus are separate from the top-level tau so tuning reuse-vs-create or actionability does not move run assessment/fidelity. The category check is deliberately permissive: with real descriptions in-scope requests score 0.9-1.0, so a borderline over-cover routes into a plausible category and the leaf guard catches it. A softmax winner at or above `softmax_bypass_tau` (default 0.5) skips its confirm guard — the winner is already decisive and each skipped guard is one fewer SemIf call on the hot path (traced `category_scope_bypassed` / `intent_bypass`); below it the two-stage confirm runs unchanged.",
|
||||
"_comment": "Navigation is two-stage at BOTH levels and the guards are the create doors (no threshold gate). Category: the softmax offers each existing category WITH its description (bare names carried no signal) plus create_category; confirm_category_fit then confirms the winner's scope (phase navigate:category_scope, P(covers) >= category_tau) and a rejected winner authors a new category. The `response` catchall and create_category share a boundary arbitrated by the actionability guard confirm_non_action (phase navigate:actionability, P(non_action) >= action_tau): the closed response tree is reached ONLY when the input is not a request, so a request no skill covers (e.g. \"what is 255 * 12?\") authors instead of getting a canned reply. Leaf: the softmax offers only existing skills; confirm_skill_fit then compares the winner's action to the request (phase navigate:intent, P(same) >= intent_tau) and a mismatch authors a new leaf. All three taus are separate from the top-level tau so tuning reuse-vs-create or actionability does not move run assessment/fidelity. The category check is deliberately permissive: with real descriptions in-scope requests score 0.9-1.0, so a borderline over-cover routes into a plausible category and the leaf guard catches it. A **category** softmax winner at or above `softmax_bypass_tau` (default 0.5) skips the scope confirm (traced `category_scope_bypassed`) — `create_category` is one of its options, so a confident winner really did beat authoring a category. The **leaf** intent guard is never bypassed: the leaf softmax offers only existing skills, so a confident winner is \"best of the wrong lot\", not a match, and the guard is the only leaf-level create door.",
|
||||
"intent_tau": 0.6,
|
||||
"category_tau": 0.75,
|
||||
"action_tau": 0.5,
|
||||
@@ -15,12 +15,25 @@
|
||||
"engine": {
|
||||
"_comment": "Per-machine engine settings only. The pinned engine/tokenizer/GGUF refs (semif_repo, semif_ref, gguf_url, gguf_sha256, source, revision) live in the committed pins.json — bumped on update, never per-machine config. The GGUF path is derived from pins.json's engine.gguf_url under .runtime/models/; set `gguf` here only to override it with a custom path.",
|
||||
"_gpu_comment": "gpu_layers: 0 keeps the CPU-only default, -1 offloads every layer, a positive count offloads that many. Requires a llama-cpp-python built with a GPU backend (bootstrap detects Vulkan/ROCm/CUDA). gpu_device picks the llama.cpp device index and gpu_split sets its split mode (0 = none).",
|
||||
"_provider_comment": "provider selects the decision engine, exactly like llm.provider/codegen.provider: \"semif\" (default) is the local llama.cpp GGUF described below; \"winnow\" is a remote /v1/systemone typed-decision API configured by the `winnow` block (a different model, e.g. Winnow-12B on a ROCm host). The engine is always real: a provider that cannot be reached raises EngineUnavailable, which is fatal — there is no fallback model. The decision log and `dream` cost work unchanged either way.",
|
||||
"provider": "semif",
|
||||
"backend": "llamacpp",
|
||||
"context_tokens": 4096,
|
||||
"threads": 8,
|
||||
"gpu_layers": 0,
|
||||
"gpu_device": null,
|
||||
"gpu_split": 0
|
||||
"gpu_split": 0,
|
||||
"winnow": {
|
||||
"_comment": "Settings for provider == \"winnow\": a remote Winnow typed-decision server (`winnow-server`, ROCm/HIP on a dedicated GPU host) exposing POST /v1/systemone (choice questions) and /v1/chat/completions (text, used by llm.provider == \"semif\"). base_url is the server root; model is required (no default). timeout bounds each request; retries is the number of transient-failure retries before the engine is declared unavailable (0 = a single attempt; an unreachable engine is fatal by contract). api_key/api_key_env add a bearer token (usually unset on a LAN); extra_headers/user_agent pass through for custom setups. The Winnow model holds the whole GPU, so it cannot be resident alongside a large codegen model — stop one before starting the other.",
|
||||
"base_url": "http://127.0.0.1:8091",
|
||||
"model": "",
|
||||
"api_key": "",
|
||||
"api_key_env": "",
|
||||
"timeout": 120,
|
||||
"retries": 0,
|
||||
"user_agent": "semif-agent",
|
||||
"extra_headers": {}
|
||||
}
|
||||
},
|
||||
"llm": {
|
||||
"_comment": "Small OpenAI-compatible model that authors a new category/skill title + description (never the runnable body — that is `codegen` below). Deliberately its own endpoint/model, so it can be local and fast even when codegen is remote. Runs on THIS machine's local ollama; bootstrap reads base_url/model from here (a --llm-url/--llm-model flag overrides for that run only) and pulls `model` if it is missing. `model` is required (no default): set it to a model the endpoint serves. Uses the same provider machinery as codegen (real SSE stream, token budget, idle watchdog); short JSON replies. Sampler params (temperature/top_p/presence_penalty/frequency_penalty) are opt-in: an unset value is omitted from the request so the server's model default applies — set them here only when you know the right values for the model. The draft is authored asynchronously by a single-slot worker and the request re-runs when it lands; an unreachable endpoint is graceful (traced, user notified), not fatal. disable_thinking sends reasoning_effort:none so a reasoning model answers the short JSON directly instead of spending the reply budget on hidden chain-of-thought (set false only for an endpoint that rejects the parameter). provider selects the transport: \"ollama\" (default; a local OpenAI-compatible server, context auto-detected via /api/show), \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code or glm-5.3, and provide api_key or api_key_env; the ollama probe is skipped), or \"semif\" (the loaded SemIf decision GGUF generates in-process via SemIfEngine.generate — no endpoint/model/api_key is used; see the `semif` block below).",
|
||||
@@ -144,7 +157,7 @@
|
||||
"_comment": "Messenger COMMAND intake — and nothing else. `python -m semif_agent.cli gateway` runs one or more platforms (`--platform simplex,lxmf` or `all`) in a SINGLE process sharing one scheduler/skill store — never run two gateway processes over one store. Each platform feeds authorized DM text through the normal gate/score/queue/dispatch pipeline; results, authoring questions, and repair offers are sent back to the originating chat. It must never read a contact's history, show/create invite links, or compose on the user's behalf — that is the independent bridge services' job (`bridges`). home_channel receives messages whose origin chat is unknown (e.g. a background repair offer). reply_prefix is prepended to every reply. text_batch_delay concatenates rapid-fire messages from one contact.",
|
||||
"humanize": {
|
||||
"_comment": "Optional LLM cleanup of a skill's result line for chat replies. Off by default. When enabled, a completed result is unwrapped from the scheduler's `<skill>: <ok|failed> — <detail>` bookkeeping and rewritten by the scheduler's `llm` client into one grounded, friendly sentence; it never decides success/failure and always falls back to the raw result on any error. `timeout`/`max_tokens`/`max_chars` bound the auxiliary call (a slow cleanup must not hold the gateway). A platform turns it on/off with its own `humanize` key (bool or `{enabled: ...}`), overriding this global default; `timeout`/`max_tokens`/`max_chars` are global. Only result lines are cleaned — questions, repair/approval notices, and status chatter are untouched.",
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"timeout": 20.0,
|
||||
"max_tokens": 200,
|
||||
"max_chars": 600
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 1487.92px; background-color: white;" viewBox="4 4 1487.923095703125 7298.546875" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"]Line truncated
|
||||
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 1725.9px; background-color: white;" viewBox="4 4 1725.9010009765625 6951.078125" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"]Line truncated
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
@@ -96,4 +96,4 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAAfcABMAAAAAENQAAAdzAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGx4cKD9NVkFSgQQGYD9TVEFUgWInLgBUL3QRCAqDIIMLCw4AMIV2ATYCJAMUBCAFjXYHTgwHG2MPSI7UVnlAcpP/PG76574XKIQgNQ9aMWYOzJzOnNE6+ESr23eT2sQ1RNFtdi+PQgg0oMcgECuU/O/3a6IXUT+YhE5qlMRjzRMmUcT/YlIScRND3N9WFIkkvBEqHjKN0AqmS7W7pslGyKGniKzRX/+9JQiAiBw5aNSYSTOggQAAigIAiiIHB/beSc/SWAAGANDyAhpoMeP2RQKKNKUDo1nRZauCIaHysUgQAKNoAY8HlgeJKDoirKqpjmHl8iNBgurKDAAZMvKGFua5re5aEBjg+Fyna7lAoPNUChXAbmNzAEzcG6ZFKEsOpL8J4Egh/wvuyzsb30Avf8A/UtSA8DEZl4DuBwBmYF8AkEkgMGigApBCB2AoNnnqlKmk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=") format("woff2-variations"); unicode-range: U+460-52F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAC98ABQAAAAAckwAAC8MAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGnUbh2wcKD9NVkFSgQQGYD9TVEFUgWInLgCDAC90EQgKxVy+FwuCHAAw6w4BNgIkA4QkBCAFjXYHilcMBxsPbCXs2Eu4HUBQUm2iiIrVrkZUkiIm//8lQY64LdyqxwUoEfFu9YzNaLwD6TZ2ztHaAWFzikR5Xi6076tcblFCgSgoqF/G54g+NvH2HKUdx3BKkns+Jt0QAZc+7CS+BWwZfEVglBik+hP91k9GW3FD9t4jNPZJ7g+0uX+XcHccHHAcNTJHLora3AarNlZGz8gZf8rMqT9S/RmlPyL8qT0IyjFyL8kDl1kBCsMOyBGwAgLX8cRCtcJVdTzJDOhWBs7hzXz7nyticzuapbqZjG9W6neOBA5N8KghySGB4IEiuu3FmkCQJa9BABJw5s3S2nYlkDL5TQ2Vq7Whm0ikdKLRZ0gkjW+OaG78vH+v533AkadUDDxM7Zat4Nb1/cC4jyGxV8PmvKVJiB0q1KnfzJAjnZZmZ0GA5iPi9j5F8wgtgeVHhO4A0YkVkCKwFoXJbIAd/X9v0yrt37+fbZlWGi0MkLzbs9ag7aV0RvIsRccUXQSRWr/lVnerNTKW1LYHNSSNB+QFyXA7UkuyeYE9Bwwta8BYJS96vYcQXl0ESOmFFF3lEG24SXjhhZdfxEGQHwF0Kmec5S0IebDEbHRsq1X7IB24gQpawAJgoex/6q1ALlUkPIMMcpn/1MdQnVZ7PzWPKGZoyNnxzVcVD/JINjoUm2VwNkIzPFZC5aWM/dX2VQECo3AeLwiFW2c9zEbjZ9MWW00Ttp2OACj95EgwECgEFLa+Yl+/KgBQAH0TSNpB3Q7STtB0h8AgGFsMCBQ4vye1A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3zXS37/HcmIq3GkAb/r1FdXsrTwcXHewQPeQ8+psPN+9mkcvZdJHiGxgNQ7bH0PfLh0oH40PXrXY7T48PjvVXDOcYobuL9fy8SEe0K9YVaZ/LchMpWHuiM9Yd64l0gXZT+65FzIl1bvatadesxvIRfZXW57RbOHw+3nVLfCC6KhcXlRkS502cl+S9UWvLqKe4r/515+P7E8l/jvsd6epyA6n/ZSgFZazJNAerh/S15bZZafh+oSmZSpqUPfO7eQlKoBJKTpFdBIFjvOfm7/XOHidnMXPRXS+XGnsCt0toBY0pobbcyPojDYpPVKnZfHAs5qkVUuWxfmOgPMP7wnXmOYEiayZ/kcOazDjFS3ipN5PxF+374on7BAiqY3M8VcM9Kcwewc2cmVPOGSFZMiLUz4tut7X0987t11/t+GJ9VhOzLxIukkhUYhSTF2KGdlcM6I+a2kvnpO19PzQL4FOHW4y7DLnAxmT58HBJJWBMlQ+9TzLF5U1BVy64ynGgO7beUt4ccjb5Vrm2dkfXwcWL8YgND862ORaXdAY0f07X3NugvWrLSae1Tq0wBvoH/OYaE63sL9mlbu9UncZlEGf1s8CG99x5Z7eIZUHFEpe7itoqbyi7KrK/8WhLzE5pBA4jOkUOidKhtD513zrLYHB79OLYpUIKpyjqIfGoMxFaE9ngW2TK5vQLine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAMcoABQAAAACIVgAAMazAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoFpG6NkHIJ6P01WQVKBBAZgP1NUQVSBYicuAIhQL3QRCAqC7HSCwVgLhiAAMITeAAE2AiQDjDwEIAWNdgedLwwHW0AHckHF6x6C2wbAvHMdZvVXhTJuj3CeYJV5mv/DZkbzOAi4NJL9/39SciJjbCrwqe83ywIzgolkyo3VCjtasCkUIVMwDzfKONHViNbg12b3EYqYi2Z2gbgyLnivrnQwI5gRjORbUCxIgbEUGuMtOH4+0kIxJ7MeGRm5znGzgd0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zIvyE/a0PZPhgoQDQwsib87fnob5YX6Tfps/S1+oDP3f5GL3qz9cAiPjNmy/0AHz5/+7bnnc+TzyPM07kefh58Hnguf/5GIBA7iTPk/PTqfYrqZQKVaxSVeiSrnPXRc+oW6d14clkenVV13VTt3VXffqmC5ZDBCYxhVmsN8x6OPwtQ6IEG5BsxGErLtvw2I7PjpeX/xlcmy2G2kiLine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAANo0ABQAAAABw5wAANnAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoNJG+NQHJFiP01WQVKBBAZgP1NUQVSBYicuAIUuL3QRCAqClRSB7QQLhEwAMIPENgE2AiQDiRAEIAWNdgeLCAwHW+GrcUA2xSrj8Xqzqt7vcDOutoLdMgy1E/ncqmGr3EUHco+DocGCzf//OUmHDA24BYDSav30gpTm5oLukVWFEcnonETmsMyRwaxVlcU6uxC9iCZsnT5P+qBoOkFJiqiJxWuPNWT7PHCRw81p1qChF3rCbO9Tu7fKOEyVB/700RQcsJ+gQiqTRi2ocJv6bJMhDPbujiO3awaKVPgtloNHC3ypGDWXlJT8TCcDP38oPBpOaRPPvYUR27Ml25a6QKxwENkIP/a69v/FRGp+aQ7XI8XziaUuA2OXQYk21onIvMPT3P69d7HtlowxR4Zz4BwVR6VBW2SMlChRwmzEbMxGP1b9j1EBH3DbDdCcdsQEon7JRfwSB2JOgISEoFrXAasoq9ikuqrMWEV/62jp5u1E+1v/V5m3nf1UU7+qXlFXNUotNMcB/IgeADjNAt72urO3lVp2YBGuBJyZT+j874Adx5a4m6t4+H87sPv+xERJd6LbnJR0C9XSut7hn/pD3nP3/VCsEWY8IKVyL0BRbPrJwpkALvSfe/ntnpvXkl+oTdlum8K2LiSDUyiDU4xHZ6hWWmURJHAkUCRwVVYWcFc1qyW2TDDkPQCUy/ISPQnRMEiSLBlE0Gqe0tm/u7JkGT8STP/bEDVVzr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pmIYO4g/Bj8wdz8Z1w7QuokoeDT5Q8jn4XNGvcVi9pLzE3DSV3A7cAO4Tln3gIuvBiSx7sqBWE4fQ39WG8nh69A7GiVWZplT8PArb4jehpagq1AmeB1Sp+3l+KNYThiyATRFLycFABkJGtAnX84izk7SdL6mKU7RsblqHaAaDWikpui6dkNU5rnjAcf2emgJlmE1OrEGLwze9vTyQom9s3/vYywsGgv22B9x5IhjTJ5YOb12pjm7cc55F5qLj25XXXMz7gzjnuI+8SB5Fs8VL/BSv/8NGDREh5krkFcIFilrNmzZsedAzhvdc3a3TAprp7fObeDqdrvdblT3f3bbufl+E4BoTAS81czMRESkxMTMzMzMfGNzkCr4IPhwwgxc3FsEAJiZKzMYAAAAeBamvWW367vZplUq9gSVmSSp72dTbxER4SofXDI07b0w+uLW3GOci7O4ePgEhCu4/xu3SVBnco+soMDgCCQKjcHiGv7ITwECkUSmUGl0RoYzq9jC5nB5fIFwiKZuiyPx+hEjRWkU1V+dTy4XVw1uHx8w+WF4PbzDpwnfxA8d/giIQAQJFiI0wi6H8FtEiGyiSrQYo40ZxrbY4RB3iUeCREmSY3w7THhMVEySyU3KLVWadBkyI0uyI0dyh7xT/nUUmEJFikPd/LXkUhplR5RLRVMZUyarHtW3msNazbpx1CsaGo1/brpiKU7n4xWgIP4o+U4ePZjydRr25K9KhImUIlWadBkyZatWc19jdz8U3lqP/XJRt6uuuemeB+NCsREhMo+TRkREWmRP5q5Zo0bjOKtKFH8M7IQBlH8Ei8ULine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAANo0ABQAAAABw5wAANnAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoNJG+NQHJFiP01WQVKBBAZgP1NUQVSBYicuAIUuL3QRCAqClRSB7QQLhEwAMIPENgE2AiQDiRAEIAWNdgeLCAwHW+GrcUA2xSrj8Xqzqt7vcDOutoLdMgy1E/ncqmGr3EUHco+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USmUGl0RoYzq9jC5nB5fIFwiKZuiyPx+hEjRWkU1V+dTy4XVw1uHx8w+WF4PbzDpwnfxA8d/giIQAQJFiI0wi6H8FtEiGyiSrQYo40ZxrbY4RB3iUeCREmSY3w7THhMVEySyU3KLVWadBkyI0uyI0dyh7xT/nUUmEJFikPd/LXkUhplR5RLRVMZUyarHtW3msNazbpx1CsaGo1/brpiKU7n4xWgIP4o+U4ePZjydRr25K9KhImUIlWadBkyZatWc19jdz8U3lqP/XJRt6uuuemeB+NCsREhMo+TRkREWmRP5q5Zo0bjOKtKFH8M7IQBlH8Ei8ULine truncated
|
||||
|
Before Width: | Height: | Size: 363 KiB After Width: | Height: | Size: 355 KiB |
+8
-8
@@ -58,15 +58,13 @@ flowchart TD
|
||||
HASSKILLS -- "none" --> CREATESKILL["CreateSkill"]
|
||||
HASSKILLS -- "one" --> SOLE["sole skill<br/>softmax skipped"]
|
||||
HASSKILLS -- "many" --> LEAF["SemIf choice<br/>phase 'navigate:leaf'<br/>options = existing skills only"]
|
||||
LEAF --> PICK["picked skill<br/>+ leaf_softmax_prob"]
|
||||
LEAF --> PICK["picked skill"]
|
||||
SOLE --> PICK
|
||||
|
||||
%% ---------- reuse vs create ----------
|
||||
PICK --> HARD{"hard-locked category?<br/>(housekeeping)"}
|
||||
HARD -- "yes" --> RUN
|
||||
HARD -- "no" --> INTENTBYP{"winner prob >=<br/>softmax_bypass_tau?"}
|
||||
INTENTBYP -- "yes (decisive)" --> RUN
|
||||
INTENTBYP -- "no (unsure)" --> INTENT["SemIf choice<br/>phase 'navigate:intent'<br/>P same >= intent_tau?"]
|
||||
HARD -- "no" --> INTENT["SemIf choice<br/>phase 'navigate:intent'<br/>P same >= intent_tau?"]
|
||||
INTENT -- "same" --> RUN
|
||||
INTENT -- "different" --> CREATESKILL
|
||||
|
||||
@@ -196,7 +194,7 @@ flowchart TD
|
||||
| Category scope | does it cover? | `navigate:category_scope` | descend / create (skipped when decisive) |
|
||||
| Canned | which reply | `navigate:response` | canned line |
|
||||
| Leaf | which skill | `navigate:leaf` | skill |
|
||||
| Intent guard | same action? | `navigate:intent` | run / create (skipped when decisive) |
|
||||
| Intent guard | same action? | `navigate:intent` | run / create (never bypassed) |
|
||||
| Config record | record or ask? | `config:record` | persisted / per-fire |
|
||||
| Outcome | did it succeed? | `assess:outcome` | ok / failed |
|
||||
| Requeue | complete or retry? | `assess:requeue` | done / requeue |
|
||||
@@ -214,9 +212,11 @@ first and decides whether the input is an actionable request at all; only
|
||||
non-action input reaches the closed `response` tree, so a request is never
|
||||
canned. The category softmax then offers the real categories (never `response`)
|
||||
plus `create_category`, and the leaf softmax offers only the existing skills —
|
||||
the reuse-vs-create decision is the intent guard. A softmax winner at or above
|
||||
`softmax_bypass_tau` (default 0.5) is already decisive, so its confirm guard
|
||||
(scope/intent) is skipped; below it the guard runs and can reject into create.
|
||||
the reuse-vs-create decision is the intent guard. A **category** softmax winner
|
||||
at or above `softmax_bypass_tau` (default 0.5) is already decisive, so its scope
|
||||
confirm is skipped; the **leaf** intent guard is never bypassed (the leaf softmax
|
||||
has no create option, so a confident winner is only the closest existing skill,
|
||||
never a match) — it always runs and can reject into create.
|
||||
New-skill creation is also gated deterministically by the per-category
|
||||
`locks.new_skill` (the `housekeeping` and `response` categories are hard-locked
|
||||
in code).
|
||||
@@ -9,6 +9,11 @@ the configured default contact is used; with no configured default (or a default
|
||||
with no unread message) the weak winner stands. It then pops and reports the
|
||||
oldest unread message for that conversation.
|
||||
|
||||
When the live buffer is empty it falls back to the daemon's persistent unread
|
||||
(`/unread` + `/history`), so a message that arrived before the bridge started is
|
||||
still reported. (v7 has no mark-read command, so a persistent-unread message can
|
||||
be reported again until the user reads it in their own client.)
|
||||
|
||||
The bridge owns the read cursor, so this skill keeps no state of its own. It
|
||||
never opens a WebSocket to the `simplex-chat` daemon — the bridge is the only
|
||||
messaging surface it uses.
|
||||
@@ -97,6 +102,20 @@ def _senders(messages):
|
||||
return senders
|
||||
|
||||
|
||||
def _is_healthy(sender):
|
||||
"""A conversation is healthy when its connection is not known-bad.
|
||||
|
||||
`connected` is absent when the source did not report it (treat as unknown);
|
||||
`auth_errors` counts failed sends on the connection and marks a stale peer.
|
||||
"""
|
||||
if sender.get("connected") is False:
|
||||
return False
|
||||
try:
|
||||
return int(sender.get("auth_errors") or 0) == 0
|
||||
except (TypeError, ValueError):
|
||||
return True
|
||||
|
||||
|
||||
def _default_sender(ctx, senders):
|
||||
"""The configured default contact, if it has unread messages."""
|
||||
default = str(ctx.config.get("simplex_default_contact", "") or "").strip()
|
||||
@@ -142,11 +161,15 @@ def act(ctx, request):
|
||||
except BridgeError as exc:
|
||||
return ActionResult(action_log=str(exc), new_state=request.text)
|
||||
senders = _senders(payload.get("messages") or [])
|
||||
if not senders:
|
||||
return ActionResult(
|
||||
action_log="no unread SimpleX messages.",
|
||||
new_state="no unread SimpleX messages",
|
||||
)
|
||||
if senders:
|
||||
return _read_live(ctx, request, senders)
|
||||
# The live buffer only holds messages that arrived while the bridge was
|
||||
# connected; fall back to the daemon's persistent unread so a message that
|
||||
# landed before the bridge started is not silently missed.
|
||||
return _read_persistent(ctx, request)
|
||||
|
||||
|
||||
def _read_live(ctx, request, senders):
|
||||
decisions = []
|
||||
contact = _resolve_contact(ctx, request, senders, decisions)
|
||||
try:
|
||||
@@ -166,7 +189,70 @@ def act(ctx, request):
|
||||
new_state="no unread SimpleX messages",
|
||||
decisions=decisions,
|
||||
)
|
||||
sender = message.get("display_name") or contact
|
||||
body = str(message.get("text") or "")
|
||||
report = f"SimpleX message from {sender}: {body}"
|
||||
return _report(message.get("display_name") or contact, message.get("text"), decisions)
|
||||
|
||||
|
||||
def _read_persistent(ctx, request):
|
||||
try:
|
||||
payload = _get(ctx, "/unread")
|
||||
except BridgeError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"no unread SimpleX messages ({exc}).",
|
||||
new_state="no unread SimpleX messages",
|
||||
)
|
||||
chats = [c for c in (payload.get("chats") or []) if c.get("unread")]
|
||||
if not chats:
|
||||
return ActionResult(
|
||||
action_log="no unread SimpleX messages.",
|
||||
new_state="no unread SimpleX messages",
|
||||
)
|
||||
senders = [
|
||||
{
|
||||
"id": str(chat.get("contact_id") or ""),
|
||||
"display_name": chat.get("display_name") or str(chat.get("contact_id") or ""),
|
||||
"connected": chat.get("connected"),
|
||||
"auth_errors": chat.get("auth_errors"),
|
||||
}
|
||||
for chat in chats
|
||||
if chat.get("contact_id")
|
||||
]
|
||||
decisions = []
|
||||
healthy = [s for s in senders if _is_healthy(s)]
|
||||
if len(healthy) == 1:
|
||||
# Exactly one conversation is on a healthy connection (the rest are
|
||||
# stale duplicates): read it without a coin-flip decision.
|
||||
contact = healthy[0]["id"]
|
||||
else:
|
||||
contact = _resolve_contact(ctx, request, senders, decisions)
|
||||
try:
|
||||
history = _get(
|
||||
ctx, f"/history?contact={urllib.parse.quote(contact)}&count=50"
|
||||
)
|
||||
except BridgeError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"failed reading {contact!r}: {exc}",
|
||||
new_state=request.text,
|
||||
decisions=decisions,
|
||||
)
|
||||
messages = [m for m in (history.get("messages") or []) if m.get("unread")]
|
||||
if not messages:
|
||||
# Fall back to the previewed unread messages from /unread.
|
||||
chat = next(
|
||||
(c for c in chats if str(c.get("contact_id")) == str(contact)), {}
|
||||
)
|
||||
messages = [m for m in (chat.get("messages") or []) if m.get("unread")]
|
||||
if not messages:
|
||||
return ActionResult(
|
||||
action_log=f"no unread message from {contact!r}.",
|
||||
new_state="no unread SimpleX messages",
|
||||
decisions=decisions,
|
||||
)
|
||||
sender = next(
|
||||
(s["display_name"] for s in senders if s["id"] == str(contact)), str(contact)
|
||||
)
|
||||
return _report(sender, messages[0].get("text"), decisions)
|
||||
|
||||
|
||||
def _report(sender, body, decisions):
|
||||
report = f"SimpleX message from {sender}: {str(body or '')}"
|
||||
return ActionResult(action_log=report, new_state=report, decisions=decisions)
|
||||
@@ -51,6 +51,8 @@ class FakeEngine:
|
||||
|
||||
class BridgeHandler(BaseHTTPRequestHandler):
|
||||
messages = []
|
||||
unread_chats = []
|
||||
history = {}
|
||||
requests = []
|
||||
tokens = []
|
||||
|
||||
@@ -76,6 +78,13 @@ class BridgeHandler(BaseHTTPRequestHandler):
|
||||
found = self.messages.pop(index)
|
||||
break
|
||||
self._send({"message": found})
|
||||
elif url.path == "/unread":
|
||||
self._send({"chats": list(self.unread_chats)})
|
||||
elif url.path == "/history":
|
||||
contact = (urllib.parse.parse_qs(url.query).get("contact") or [None])[0]
|
||||
self._send(
|
||||
{"contact_id": contact, "messages": list(self.history.get(str(contact), []))}
|
||||
)
|
||||
else:
|
||||
self._send({"error": "not found"}, 404)
|
||||
|
||||
@@ -83,11 +92,17 @@ class BridgeHandler(BaseHTTPRequestHandler):
|
||||
pass
|
||||
|
||||
|
||||
def start_server(messages):
|
||||
def start_server(messages, unread_chats=None, history=None):
|
||||
handler = type(
|
||||
"Handler",
|
||||
(BridgeHandler,),
|
||||
{"messages": list(messages), "requests": [], "tokens": []},
|
||||
{
|
||||
"messages": list(messages),
|
||||
"unread_chats": list(unread_chats or []),
|
||||
"history": dict(history or {}),
|
||||
"requests": [],
|
||||
"tokens": [],
|
||||
},
|
||||
)
|
||||
server = ThreadingHTTPServer(("127.0.0.1", 0), handler)
|
||||
threading.Thread(target=server.serve_forever, daemon=True).start()
|
||||
@@ -225,7 +240,88 @@ def test_empty_inbox_is_reported_honestly():
|
||||
request = Request("read my next simplex message")
|
||||
action = skill.act(ctx, request)
|
||||
assert "no unread" in action.action_log, action.action_log
|
||||
assert handler.requests == ["/inbox"], "an empty inbox needs no pop"
|
||||
# An empty live buffer falls back to the daemon's persistent unread.
|
||||
assert handler.requests == ["/inbox", "/unread"], handler.requests
|
||||
print(action.action_log)
|
||||
finally:
|
||||
server.shutdown()
|
||||
server.server_close()
|
||||
|
||||
|
||||
def test_empty_live_inbox_falls_back_to_persistent_unread():
|
||||
server, handler, url = start_server(
|
||||
[],
|
||||
unread_chats=[
|
||||
{
|
||||
"contact_id": "3",
|
||||
"display_name": "pepper",
|
||||
"unread_count": 2,
|
||||
"min_unread_item_id": "8",
|
||||
"unread": True,
|
||||
"messages": [],
|
||||
}
|
||||
],
|
||||
history={
|
||||
"3": [
|
||||
{"item_id": "8", "text": "hello", "status": "rcvNew", "unread": True},
|
||||
{"item_id": "9", "text": "hey yo", "status": "rcvNew", "unread": True},
|
||||
]
|
||||
},
|
||||
)
|
||||
try:
|
||||
engine = FakeEngine()
|
||||
ctx = ActionContext(engine=engine, config=config(url))
|
||||
request = Request("read my next simplex message")
|
||||
action = skill.act(ctx, request)
|
||||
assert engine.decisions == [], "a single unread chat needs no decision"
|
||||
assert "hello" in action.action_log, action.action_log
|
||||
assert "pepper" in action.action_log, action.action_log
|
||||
assert handler.requests == ["/inbox", "/unread", "/history?contact=3&count=50"], (
|
||||
handler.requests
|
||||
)
|
||||
print(action.action_log)
|
||||
finally:
|
||||
server.shutdown()
|
||||
server.server_close()
|
||||
|
||||
|
||||
def test_persistent_unread_prefers_a_healthy_conversation():
|
||||
server, handler, url = start_server(
|
||||
[],
|
||||
unread_chats=[
|
||||
{
|
||||
"contact_id": "3",
|
||||
"display_name": "pepper",
|
||||
"unread_count": 1,
|
||||
"unread": True,
|
||||
"connected": True,
|
||||
"auth_errors": 2,
|
||||
"messages": [],
|
||||
},
|
||||
{
|
||||
"contact_id": "4",
|
||||
"display_name": "pepper",
|
||||
"unread_count": 1,
|
||||
"unread": True,
|
||||
"connected": True,
|
||||
"auth_errors": 0,
|
||||
"messages": [],
|
||||
},
|
||||
],
|
||||
history={
|
||||
"3": [{"item_id": "8", "text": "stale hello", "status": "rcvNew", "unread": True}],
|
||||
"4": [{"item_id": "20", "text": "fresh hello", "status": "rcvNew", "unread": True}],
|
||||
},
|
||||
)
|
||||
try:
|
||||
engine = FakeEngine()
|
||||
ctx = ActionContext(engine=engine, config=config(url))
|
||||
action = skill.act(ctx, Request("read my next simplex message"))
|
||||
assert engine.decisions == [], "one healthy chat must win without a decision"
|
||||
assert "fresh hello" in action.action_log, action.action_log
|
||||
assert handler.requests == ["/inbox", "/unread", "/history?contact=4&count=50"], (
|
||||
handler.requests
|
||||
)
|
||||
print(action.action_log)
|
||||
finally:
|
||||
server.shutdown()
|
||||
@@ -264,6 +360,8 @@ def main():
|
||||
test_weak_winner_without_default_stands()
|
||||
test_single_sender_needs_no_decision()
|
||||
test_empty_inbox_is_reported_honestly()
|
||||
test_empty_live_inbox_falls_back_to_persistent_unread()
|
||||
test_persistent_unread_prefers_a_healthy_conversation()
|
||||
test_unreachable_bridge_fails_honestly()
|
||||
test_auth_token_is_sent_when_configured()
|
||||
print("ok")
|
||||
|
||||
@@ -18,7 +18,7 @@ class MessagingInbox:
|
||||
self._lock = threading.Lock()
|
||||
self._items: deque[dict] = deque()
|
||||
self._max = max(1, int(max_size))
|
||||
self._contacts: dict[str, str] = {}
|
||||
self._contacts: dict[str, dict] = {}
|
||||
|
||||
def record(self, message: dict) -> dict:
|
||||
contact_id = str(message.get("contact_id") or "")
|
||||
@@ -31,15 +31,26 @@ class MessagingInbox:
|
||||
"received_at": time.time(),
|
||||
}
|
||||
with self._lock:
|
||||
if display_name:
|
||||
self._contacts[contact_id] = display_name
|
||||
else:
|
||||
self._contacts.setdefault(contact_id, "")
|
||||
self._remember(contact_id, message)
|
||||
self._items.append(entry)
|
||||
while len(self._items) > self._max:
|
||||
self._items.popleft()
|
||||
return entry
|
||||
|
||||
def _remember(self, contact_id: str, contact: dict) -> None:
|
||||
"""Upsert the cached contact for an id (caller holds the lock)."""
|
||||
current = self._contacts.setdefault(
|
||||
contact_id, {"id": contact_id, "display_name": ""}
|
||||
)
|
||||
name = contact.get("display_name") or ""
|
||||
if name:
|
||||
current["display_name"] = name
|
||||
# Keep the unique local name and connection health when the source knows
|
||||
# them; never invent them (an inbound item has no connection state).
|
||||
for key in ("local_name", "connected", "auth_errors"):
|
||||
if key in contact and contact[key] not in (None, ""):
|
||||
current[key] = contact[key]
|
||||
|
||||
def peek(self) -> list[dict]:
|
||||
with self._lock:
|
||||
return list(self._items)
|
||||
@@ -59,22 +70,17 @@ class MessagingInbox:
|
||||
"""Upsert contacts learned from the daemon (not from a message).
|
||||
|
||||
A non-empty incoming name overwrites a cached one; an empty name never
|
||||
clobbers a name already learned from an inbound message.
|
||||
clobbers a name already learned from an inbound message. The unique
|
||||
local name and connection health ride along when the daemon reports
|
||||
them.
|
||||
"""
|
||||
with self._lock:
|
||||
for contact in contacts:
|
||||
contact_id = str(contact.get("id") or "")
|
||||
if not contact_id:
|
||||
continue
|
||||
name = contact.get("display_name") or ""
|
||||
if name:
|
||||
self._contacts[contact_id] = name
|
||||
else:
|
||||
self._contacts.setdefault(contact_id, "")
|
||||
self._remember(contact_id, contact)
|
||||
|
||||
def contacts(self) -> list[dict]:
|
||||
with self._lock:
|
||||
return [
|
||||
{"id": contact_id, "display_name": name}
|
||||
for contact_id, name in self._contacts.items()
|
||||
]
|
||||
return [dict(contact) for contact in self._contacts.values()]
|
||||
+169
-23
@@ -14,12 +14,21 @@ gateway process.
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
import time
|
||||
|
||||
from semif_agent.simplex_ws import SimplexDaemon
|
||||
from semif_agent.simplex_ws import SimplexDaemon, parse_send_response
|
||||
|
||||
from .base import BridgeInfo, BridgeService
|
||||
from .inbox import MessagingInbox
|
||||
|
||||
#: Send statuses that mean the message really left the agent.
|
||||
SEND_OK_STATUSES = frozenset({"sndSent", "sndRcvd"})
|
||||
#: Send statuses that are final (no further polling needed).
|
||||
SEND_TERMINAL_STATUSES = frozenset({"sndSent", "sndRcvd", "sndError"})
|
||||
#: How long to poll the daemon for a terminal send status before giving up.
|
||||
SEND_CONFIRM_TIMEOUT = 6.0
|
||||
SEND_POLL_INTERVAL = 0.5
|
||||
|
||||
|
||||
class SimplexBridge(BridgeService):
|
||||
name = "simplex"
|
||||
@@ -34,9 +43,13 @@ class SimplexBridge(BridgeService):
|
||||
endpoints=(
|
||||
"GET /health -> 200 {\"ok\": true, \"platform\": \"simplex\"} — the "
|
||||
"bridge is up",
|
||||
"GET /contacts -> 200 {\"contacts\": [{\"id\", \"display_name\"}]} — "
|
||||
"contacts known to the daemon (learned from inbound messages and "
|
||||
"refreshed from the daemon's contact list)",
|
||||
"GET /contacts -> 200 {\"contacts\": [{\"id\", \"display_name\", "
|
||||
"\"local_name\"?, \"connected\"?}]} — contacts known to the daemon "
|
||||
"(learned from inbound messages and refreshed from the daemon's "
|
||||
"contact list). `display_name` is the peer's profile name and can "
|
||||
"collide; `local_name` is the daemon's unique local name; "
|
||||
"`connected` (when the daemon reports it) is false for a peer whose "
|
||||
"connection is not ready — prefer a connected peer",
|
||||
"GET /inbox -> 200 {\"messages\": [{\"id\", \"contact_id\", "
|
||||
"\"display_name\", \"text\", \"received_at\"}]} — peek buffered "
|
||||
"inbound messages; does not consume",
|
||||
@@ -44,22 +57,29 @@ class SimplexBridge(BridgeService):
|
||||
"the oldest unread message (optionally from one contact); null means "
|
||||
"none buffered. The bridge owns the read cursor",
|
||||
"GET /unread -> 200 {\"chats\": [{\"contact_id\", \"display_name\", "
|
||||
"\"unread_count\", \"min_unread_item_id\", \"unread\", \"messages\": "
|
||||
"\"unread_count\", \"min_unread_item_id\", \"unread\", "
|
||||
"\"connected\"?, \"auth_errors\"?, \"messages\": "
|
||||
"[{item_id, text, status, unread, direction, sent_at}]}]} — the "
|
||||
"daemon's persistent unread chats (survives bridge restarts), not "
|
||||
"just what arrived while connected. Read-only; 503 when the daemon "
|
||||
"is not connected, 502 when the lookup fails",
|
||||
"GET /history?contact=<id>&count=<n> -> 200 {\"contact_id\", "
|
||||
"\"messages\": [{item_id, text, status, unread, direction, "
|
||||
"sent_at}]} — recent message history for one contact (count default "
|
||||
"20); status is rcvNew (unread) or rcvRead. Read-only; 503/502 as "
|
||||
"/unread, 400 without a contact",
|
||||
"sent_at, error?}]} — recent message history for one contact (count "
|
||||
"default 20); status is rcvNew (unread), rcvRead, sndSent, sndRcvd, "
|
||||
"or sndError, and `error` carries the agent reason (e.g. auth) on a "
|
||||
"failed send. Read-only; 503/502 as /unread, 400 without a contact",
|
||||
"GET /address -> 200 {\"short_link\", \"full_link\", \"created\"} — "
|
||||
"the agent's contact link; creates it on first call. 503 when the "
|
||||
"daemon is not connected, 502 when the lookup fails",
|
||||
"POST /send {\"recipient\": \"<id|display_name>\", \"text\": \"...\"} "
|
||||
"-> 200 {\"ok\": true, \"contact_id\": \"<id>\"}; 400 {\"error\": "
|
||||
"\"...\"} on a missing/invalid field or an unknown recipient",
|
||||
"POST /send {\"recipient\": \"<id|local_name|display_name>\", "
|
||||
"\"text\": \"...\"} -> 200 {\"ok\": bool, \"contact_id\": \"<id>\", "
|
||||
"\"item_id\": \"<id>\", \"status\": \"sndSent|sndRcvd|sndError\", "
|
||||
"\"error\": \"...\"?}. The bridge resolves the recipient, sends, and "
|
||||
"waits for the daemon's real send status: `ok` is true only for "
|
||||
"sndSent/sndRcvd, and a failed send (e.g. an auth error on a dead "
|
||||
"connection) returns ok:false with the reason — never a false "
|
||||
"success. 400 on a missing/invalid field or an unknown recipient",
|
||||
"any request -> 401 {\"error\": \"unauthorized\"} when the token is "
|
||||
"configured and the auth header is missing or wrong",
|
||||
),
|
||||
@@ -170,10 +190,10 @@ class SimplexBridge(BridgeService):
|
||||
if not isinstance(text, str) or not text.strip():
|
||||
return 400, {"error": "text is required"}
|
||||
try:
|
||||
contact_id = self.send(recipient, text)
|
||||
result = self.send(recipient, text)
|
||||
except ValueError as exc:
|
||||
return 400, {"error": str(exc)}
|
||||
return 200, {"ok": True, "contact_id": contact_id}
|
||||
return 200, result
|
||||
|
||||
# ---- actions ----
|
||||
|
||||
@@ -207,8 +227,25 @@ class SimplexBridge(BridgeService):
|
||||
return 503, {"error": f"unread lookup is not available: {exc}"[:300]}
|
||||
except Exception as exc: # TimeoutError, daemon error
|
||||
return 502, {"error": f"unread lookup failed: {exc}"[:300]}
|
||||
self._attach_health(chats)
|
||||
return 200, {"chats": chats}
|
||||
|
||||
def _attach_health(self, chats: list[dict]) -> None:
|
||||
"""Merge cached connection health into each chat summary, in place.
|
||||
|
||||
Lets a caller prefer a live conversation over a stale duplicate when
|
||||
several chats share a display name. Best-effort: a chat with no cached
|
||||
contact is left untouched.
|
||||
"""
|
||||
health = {c["id"]: c for c in self.inbox.contacts()}
|
||||
for chat in chats:
|
||||
info = health.get(str(chat.get("contact_id") or ""))
|
||||
if not info:
|
||||
continue
|
||||
for key in ("connected", "auth_errors"):
|
||||
if key in info:
|
||||
chat[key] = info[key]
|
||||
|
||||
def _history(self, contact: str | None, count: str | None) -> tuple[int, dict]:
|
||||
"""Recent message history for one contact, straight from the daemon.
|
||||
|
||||
@@ -247,20 +284,93 @@ class SimplexBridge(BridgeService):
|
||||
return 502, {"error": "address lookup returned no link"}
|
||||
return 200, link
|
||||
|
||||
def send(self, recipient: str, text: str) -> str:
|
||||
"""Resolve a recipient and enqueue the message. Returns the contact id."""
|
||||
def send(self, recipient: str, text: str) -> dict:
|
||||
"""Resolve a recipient, send the text, and report the real outcome.
|
||||
|
||||
Returns `{ok, contact_id, item_id?, status?, error?}`. `ok` is True only
|
||||
when the daemon created the message and it reached a terminal status of
|
||||
`sndSent` (relayed to the server) or `sndRcvd` (delivered to the peer).
|
||||
A dead connection surfaces as `ok: false` carrying the daemon's agent
|
||||
error (e.g. `auth`) — never a false success.
|
||||
"""
|
||||
contact_id = self.resolve(recipient)
|
||||
if contact_id is None:
|
||||
raise ValueError(f"unknown SimpleX recipient: {recipient!r}")
|
||||
self.daemon.enqueue(contact_id, text)
|
||||
return contact_id
|
||||
try:
|
||||
response = self.daemon.request_send(contact_id, text)
|
||||
except RuntimeError as exc:
|
||||
return {
|
||||
"ok": False,
|
||||
"contact_id": contact_id,
|
||||
"status": "unavailable",
|
||||
"error": str(exc)[:300],
|
||||
}
|
||||
except Exception as exc: # TimeoutError, daemon error
|
||||
return {
|
||||
"ok": False,
|
||||
"contact_id": contact_id,
|
||||
"status": "error",
|
||||
"error": str(exc)[:300],
|
||||
}
|
||||
parsed = parse_send_response(response)
|
||||
if parsed["item_id"] is None:
|
||||
return {
|
||||
"ok": False,
|
||||
"contact_id": contact_id,
|
||||
"status": "rejected",
|
||||
"error": parsed["error"] or "the daemon rejected the send",
|
||||
}
|
||||
item_id = parsed["item_id"]
|
||||
status, error = parsed["status"], parsed["error"]
|
||||
if status not in SEND_TERMINAL_STATUSES:
|
||||
status, error = self._await_send_status(contact_id, item_id, status)
|
||||
result = {
|
||||
"ok": status in SEND_OK_STATUSES,
|
||||
"contact_id": contact_id,
|
||||
"item_id": item_id,
|
||||
"status": status,
|
||||
}
|
||||
if not result["ok"]:
|
||||
result["error"] = error or f"send status {status}"
|
||||
return result
|
||||
|
||||
def _await_send_status(
|
||||
self, contact_id: str, item_id: str, current: str,
|
||||
timeout: float = SEND_CONFIRM_TIMEOUT,
|
||||
) -> tuple[str, str]:
|
||||
"""Poll the daemon for the item's terminal send status + agent error.
|
||||
|
||||
A send is `sndNew` the moment it is created; the agent then resolves it
|
||||
to `sndSent`/`sndRcvd` (success) or `sndError` (failure, with the reason
|
||||
in `agentError`). Returns `(status, error)`; a still-`sndNew` item after
|
||||
the window stays unconfirmed rather than being reported as sent.
|
||||
"""
|
||||
deadline = time.monotonic() + timeout
|
||||
status, error = current, ""
|
||||
while True:
|
||||
try:
|
||||
messages = self.daemon.request_chat_history(contact_id, count=20)
|
||||
except Exception:
|
||||
return status or "unknown", error
|
||||
for message in messages:
|
||||
if str(message.get("item_id")) == str(item_id):
|
||||
status = str(message.get("status") or "")
|
||||
error = str(message.get("error") or "")
|
||||
if status in SEND_TERMINAL_STATUSES:
|
||||
return status, error
|
||||
if time.monotonic() >= deadline:
|
||||
return status or "unknown", error
|
||||
time.sleep(SEND_POLL_INTERVAL)
|
||||
|
||||
def resolve(self, recipient: str) -> str | None:
|
||||
"""A numeric id (with or without `@`) or a known display name.
|
||||
"""A numeric id (with or without `@`), a unique local name, or a display name.
|
||||
|
||||
On a display-name miss, refresh the daemon's contact list once and
|
||||
retry: a contact the bridge has never received from is still addressable
|
||||
as long as the daemon knows them.
|
||||
An explicit id always wins. Two peers can share a profile display name
|
||||
(the daemon suffixes its own local names, e.g. `pepper` / `pepper_1`),
|
||||
so a local-name or display-name match that hits several peers prefers
|
||||
the healthiest (connected, no recorded auth errors). On a miss, refresh
|
||||
the daemon's contact list once and retry: a contact the bridge has never
|
||||
received from is still addressable as long as the daemon knows them.
|
||||
"""
|
||||
recipient = str(recipient or "").strip()
|
||||
if not recipient:
|
||||
@@ -275,7 +385,43 @@ class SimplexBridge(BridgeService):
|
||||
return match
|
||||
|
||||
def _match_contact(self, recipient: str) -> str | None:
|
||||
for contact in self.inbox.contacts():
|
||||
if contact["display_name"] == recipient or contact["id"] == recipient:
|
||||
contacts = self.inbox.contacts()
|
||||
for contact in contacts:
|
||||
if contact["id"] == recipient:
|
||||
return contact["id"]
|
||||
exact = [
|
||||
c
|
||||
for c in contacts
|
||||
if c.get("local_name") == recipient or c["display_name"] == recipient
|
||||
]
|
||||
if exact:
|
||||
return self._prefer_connected(exact)
|
||||
lowered = recipient.lower()
|
||||
partial = [
|
||||
c
|
||||
for c in contacts
|
||||
if lowered in c["display_name"].lower()
|
||||
or lowered in str(c.get("local_name", "")).lower()
|
||||
]
|
||||
if len(partial) == 1:
|
||||
return partial[0]["id"]
|
||||
if partial:
|
||||
return self._prefer_connected(partial)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _prefer_connected(matches: list[dict]) -> str:
|
||||
"""Pick the healthiest peer among equally-named matches.
|
||||
|
||||
Prefer a ready connection, then a connection with no recorded auth
|
||||
errors (a stale duplicate that fails to send), and finally the first.
|
||||
"""
|
||||
|
||||
def rank(contact: dict) -> tuple[bool, bool]:
|
||||
try:
|
||||
clean = int(contact.get("auth_errors") or 0) == 0
|
||||
except (TypeError, ValueError):
|
||||
clean = True
|
||||
return (bool(contact.get("connected")), clean)
|
||||
|
||||
return max(matches, key=rank)["id"]
|
||||
+41
-3
@@ -28,7 +28,8 @@ from .console import (
|
||||
ConsoleLLMClient,
|
||||
)
|
||||
from .decisions import DecisionRequest, Option
|
||||
from .engine import EngineConfig, EngineUnavailable, SemIfEngine
|
||||
from .engine import DecisionEngine, EngineConfig, EngineUnavailable, SemIfEngine
|
||||
from .winnow import WinnowConfig, WinnowEngine
|
||||
from .llm import LLMClient, SemIfLLMClient
|
||||
from .log import DecisionLog
|
||||
from .scheduler import Scheduler
|
||||
@@ -38,6 +39,8 @@ from .trace import TraceLog
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
DEFAULT_WINNOW_URL = "http://127.0.0.1:8091"
|
||||
|
||||
_PATH_KEYS = (
|
||||
"skill_seeds",
|
||||
"skill_bodies",
|
||||
@@ -191,6 +194,41 @@ def build_engine_config(config: dict, pins: dict | None = None) -> EngineConfig:
|
||||
)
|
||||
|
||||
|
||||
def build_engine(config: dict, pins: dict | None = None) -> DecisionEngine:
|
||||
"""Build the decision engine from the `engine` config block.
|
||||
|
||||
`provider` selects the implementation, mirroring `llm`/`codegen`:
|
||||
|
||||
* ``"semif"`` (default) — the local llama.cpp GGUF (`SemIfEngine`), built
|
||||
from the per-machine `engine` knobs + the pinned refs in pins.json.
|
||||
* ``"winnow"`` — a remote `/v1/systemone` typed-decision API
|
||||
(`WinnowEngine`), configured by the nested `engine.winnow` block
|
||||
(`base_url`/`model`/`api_key`/`timeout`/`retries`).
|
||||
|
||||
The engine is always real: a provider that cannot be reached raises
|
||||
`EngineUnavailable` at call time, which the scheduler treats as fatal. The
|
||||
`winnow` model is required (no default) exactly as `llm.model`/`codegen.model`
|
||||
are, so a misconfigured endpoint fails as an actionable config error.
|
||||
"""
|
||||
eng = config.get("engine", {}) or {}
|
||||
provider = str(eng.get("provider", "semif") or "semif").lower()
|
||||
if provider == "winnow":
|
||||
win = eng.get("winnow", {}) or {}
|
||||
endpoint = _provider_endpoint(win, DEFAULT_WINNOW_URL)
|
||||
return WinnowEngine(
|
||||
WinnowConfig(
|
||||
base_url=endpoint["base_url"],
|
||||
model=_required_model(win, "engine.winnow"),
|
||||
timeout=float(win.get("timeout", 120.0)),
|
||||
retries=int(win.get("retries", 0)),
|
||||
api_key=endpoint["api_key"],
|
||||
extra_headers=endpoint["extra_headers"],
|
||||
user_agent=str(win.get("user_agent") or "semif-agent"),
|
||||
)
|
||||
)
|
||||
return SemIfEngine(build_engine_config(config, pins))
|
||||
|
||||
|
||||
def build_codegen_client(config: dict) -> CodegenClient:
|
||||
"""Build the codegen client from the `codegen` config block.
|
||||
|
||||
@@ -275,7 +313,7 @@ def build_llm_client(config: dict, engine):
|
||||
|
||||
|
||||
def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
|
||||
engine = SemIfEngine(build_engine_config(config))
|
||||
engine = build_engine(config)
|
||||
llm = build_llm_client(config, engine)
|
||||
log = DecisionLog(config.get("log", "data/decisions.jsonl"))
|
||||
trace = TraceLog(config.get("trace", "data/runs.jsonl"))
|
||||
@@ -374,7 +412,7 @@ def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
|
||||
|
||||
def try_warm(scheduler: Scheduler) -> str:
|
||||
try:
|
||||
scheduler.engine._ensure_loaded()
|
||||
scheduler.engine.warm()
|
||||
return "decision engine loaded."
|
||||
except EngineUnavailable as exc:
|
||||
return f"decision engine unavailable: {exc}"
|
||||
|
||||
+71
-6
@@ -1,17 +1,21 @@
|
||||
"""Real SemIf decision engine (no mocking).
|
||||
"""The decision-engine contract and the local SemIf implementation.
|
||||
|
||||
Wraps the SemIf package (`semif_phase1`). The import and model load happen
|
||||
`DecisionEngine` is the pluggable contract every provider satisfies; the
|
||||
provider is selected per machine by `engine.provider` in config.json, exactly
|
||||
like `llm.provider` / `codegen.provider`. `SemIfEngine` is the default: it wraps
|
||||
the SemIf package (`semif_phase1`). The import and model load happen
|
||||
lazily so the rest of the agent is pure stdlib and testable without SemIf
|
||||
installed. The shipped llama.cpp backend scores a local GGUF; it runs on CPU by
|
||||
default, and `EngineConfig.gpu_layers` offloads to a GPU when llama-cpp-python
|
||||
was built with a GPU backend (Vulkan/ROCm/CUDA). This engine is only usable on a
|
||||
machine with SemIf and the pinned GGUF available; elsewhere calls raise
|
||||
EngineUnavailable.
|
||||
EngineUnavailable. The remote alternative lives in `semif_agent.winnow`.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
@@ -19,7 +23,58 @@ from .decisions import DecisionRequest, DecisionResult
|
||||
|
||||
|
||||
class EngineUnavailable(RuntimeError):
|
||||
"""SemIf is not installed or the configured model is missing."""
|
||||
"""The decision engine is not installed, not reachable, or failed.
|
||||
|
||||
This is the one error a decision engine raises. It is fatal by contract:
|
||||
the scheduler records it (`_mark_fatal`) and the front ends exit, because
|
||||
the agent cannot make decisions without a real engine.
|
||||
"""
|
||||
|
||||
|
||||
class DecisionEngine(ABC):
|
||||
"""The pluggable decision-engine contract.
|
||||
|
||||
A decision engine answers a `DecisionRequest` (state + question + typed
|
||||
options) with a `DecisionResult` (probabilities over exactly those options).
|
||||
It is selected per machine by `engine.provider` in config.json, mirroring
|
||||
`llm.provider` / `codegen.provider`:
|
||||
|
||||
* ``"semif"`` (default) — the local llama.cpp GGUF (`SemIfEngine`).
|
||||
* ``"winnow"`` — a remote ``/v1/systemone`` typed-decision API
|
||||
(`semif_agent.winnow.WinnowEngine`).
|
||||
|
||||
The engine is always real: any failure to produce a decision raises
|
||||
`EngineUnavailable`, which the scheduler treats as fatal. `generate` is the
|
||||
optional text-generation face of the same model (used by
|
||||
`llm.provider == "semif"`); an engine that cannot generate text raises
|
||||
`EngineUnavailable` there rather than inventing a reply.
|
||||
"""
|
||||
|
||||
label: str = "engine"
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def loaded(self) -> bool:
|
||||
"""Whether the underlying model is loaded/warm."""
|
||||
|
||||
@abstractmethod
|
||||
def warm(self) -> None:
|
||||
"""Load/warm the model, raising `EngineUnavailable` on failure."""
|
||||
|
||||
@abstractmethod
|
||||
def call(self, request: DecisionRequest) -> DecisionResult:
|
||||
"""Score one decision, raising `EngineUnavailable` on failure."""
|
||||
|
||||
def generate(
|
||||
self,
|
||||
messages: list[dict],
|
||||
temperature: float = 0.0,
|
||||
max_tokens: int = 256,
|
||||
) -> str:
|
||||
"""Autoregressively generate text from the same model, if supported."""
|
||||
raise EngineUnavailable(
|
||||
f"{self.label} engine does not support text generation"
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -93,8 +148,14 @@ def _offloading_params(original, config: EngineConfig):
|
||||
return offloading
|
||||
|
||||
|
||||
class SemIfEngine:
|
||||
"""One pinned SemIf model, loaded once and used for every decision."""
|
||||
class SemIfEngine(DecisionEngine):
|
||||
"""One pinned SemIf model, loaded once and used for every decision.
|
||||
|
||||
The default `engine.provider`: the local llama.cpp GGUF. Text generation
|
||||
from the same model backs `llm.provider == "semif"`.
|
||||
"""
|
||||
|
||||
label = "semif"
|
||||
|
||||
def __init__(self, config: EngineConfig):
|
||||
self.config = config
|
||||
@@ -153,6 +214,10 @@ class SemIfEngine:
|
||||
def loaded(self) -> bool:
|
||||
return self._model is not None
|
||||
|
||||
def warm(self) -> None:
|
||||
"""Load the model (idempotent), raising `EngineUnavailable` on failure."""
|
||||
self._ensure_loaded()
|
||||
|
||||
def call(self, request: DecisionRequest) -> DecisionResult:
|
||||
with self._lock:
|
||||
model, tokenizer, metadata = self._ensure_loaded()
|
||||
|
||||
+12
-20
@@ -33,7 +33,7 @@ from .codegen import (
|
||||
skill_contract_ref,
|
||||
)
|
||||
from .decisions import DecisionRequest, Option, Request
|
||||
from .engine import EngineUnavailable, SemIfEngine
|
||||
from .engine import DecisionEngine, EngineUnavailable
|
||||
from .llm import LLMClient
|
||||
from .log import DecisionLog
|
||||
from .provider import ProviderError
|
||||
@@ -224,7 +224,7 @@ class SchedulerReply:
|
||||
class Scheduler:
|
||||
def __init__(
|
||||
self,
|
||||
engine: SemIfEngine,
|
||||
engine: DecisionEngine,
|
||||
llm: LLMClient,
|
||||
log: DecisionLog,
|
||||
config: dict,
|
||||
@@ -248,9 +248,10 @@ class Scheduler:
|
||||
self.intent_tau = float(nav_cfg.get("intent_tau", 0.6))
|
||||
self.category_tau = float(nav_cfg.get("category_tau", 0.75))
|
||||
self.action_tau = float(nav_cfg.get("action_tau", 0.5))
|
||||
#: A softmax winner at or above this probability skips its confirm guard
|
||||
#: (scope/intent) — the winner is already decisive. Below it the guard
|
||||
#: runs and can reject into create.
|
||||
#: A **category** softmax winner at or above this probability skips the
|
||||
#: category scope confirm — the winner is already decisive. The leaf
|
||||
#: intent guard is never bypassed (the leaf softmax has no create
|
||||
#: option, so its confidence carries no match signal).
|
||||
self.bypass_tau = float(nav_cfg.get("softmax_bypass_tau", 0.5))
|
||||
self.max_reentries = max_reentries
|
||||
self.codegen = codegen
|
||||
@@ -456,10 +457,6 @@ class Scheduler:
|
||||
# ---- dispatch ----
|
||||
|
||||
def _dispatch(self, request: Request) -> DispatchResult:
|
||||
# Clear any confidence a prior dispatch left on the request (meta is
|
||||
# copied across a requeue); navigation sets it fresh when a leaf softmax
|
||||
# runs.
|
||||
request.meta.pop("leaf_softmax_prob", None)
|
||||
# Explicit housekeeping commands are deterministic: they route straight
|
||||
# to the meta skill, bypassing the generic guards (which misread a
|
||||
# task-like skill name as the task). Natural-language phrasings still go
|
||||
@@ -501,17 +498,12 @@ class Scheduler:
|
||||
# navigation's pick directly (the meta skill asks for any missing
|
||||
# target as an input variable).
|
||||
return self._run_skill(navigation, request)
|
||||
leaf_prob = request.meta.pop("leaf_softmax_prob", None)
|
||||
if leaf_prob is not None and leaf_prob >= self.bypass_tau:
|
||||
# A decisive leaf softmax winner skips the intent confirm.
|
||||
self.trace.append(
|
||||
"intent_bypass",
|
||||
request.id,
|
||||
category=navigation.category,
|
||||
skill=navigation.name,
|
||||
prob=leaf_prob,
|
||||
)
|
||||
return self._run_skill(navigation, request)
|
||||
# The leaf softmax offers only existing skills (create_skill is
|
||||
# deliberately not an option), so its winner is "the closest existing
|
||||
# skill", never a statement that the skill matches. The intent guard is
|
||||
# therefore the sole leaf-level create door and is never bypassed: a
|
||||
# confident softmax winner among only-wrong options must still be
|
||||
# checked, or codegen can never be reached for an unmatched request.
|
||||
if not confirm_skill_fit(
|
||||
self.engine, self.log, self.trace, request, navigation, self.intent_tau
|
||||
):
|
||||
|
||||
@@ -34,25 +34,45 @@ ConnectedHandler = Callable[[], Awaitable[None]]
|
||||
|
||||
|
||||
def contact_entry(contact: dict) -> dict | None:
|
||||
"""Normalize one daemon `Contact` into `{"id", "display_name"}`, or None.
|
||||
"""Normalize one daemon `Contact` into a contact dict, or None.
|
||||
|
||||
The single source of truth for contact identity across the wire: the same
|
||||
shape appears in `newChatItems` items and in the `/_contacts` list. v7's
|
||||
`Contact.displayName` is null and the real peer name lives in
|
||||
`profile.displayName`; `localDisplayName` is auto-suffixed on collisions
|
||||
(e.g. a second contact becomes `pepper_1`).
|
||||
`profile.displayName`; `localDisplayName` is the daemon's **unique** local
|
||||
name, auto-suffixed on collisions (e.g. a second contact becomes
|
||||
`pepper_1`). We keep both: `display_name` is the peer's profile name (what
|
||||
a human recognizes, but it can collide) and `local_name` is the daemon's
|
||||
unique name, so two peers with the same profile name stay distinguishable.
|
||||
When the daemon reports connection state (the `/_contacts` list does),
|
||||
`connected` and `auth_errors` are included so callers can prefer a live
|
||||
peer over a dead one.
|
||||
"""
|
||||
contact_id = str(contact.get("contactId") or contact.get("chatId") or "")
|
||||
if not contact_id:
|
||||
return None
|
||||
profile = contact.get("profile") or {}
|
||||
local_name = (
|
||||
contact.get("localDisplayName")
|
||||
or contact.get("displayName")
|
||||
or profile.get("displayName")
|
||||
or ""
|
||||
)
|
||||
display_name = (
|
||||
profile.get("displayName")
|
||||
or contact.get("displayName")
|
||||
or contact.get("localDisplayName")
|
||||
or local_name
|
||||
or ""
|
||||
)
|
||||
return {"id": contact_id, "display_name": display_name}
|
||||
entry = {"id": contact_id, "display_name": display_name, "local_name": local_name}
|
||||
active = contact.get("activeConn") or {}
|
||||
conn = active.get("connStatus") or {}
|
||||
status = contact.get("contactStatus")
|
||||
if status is not None or conn:
|
||||
entry["connected"] = status == "active" and conn.get("type") == "ready"
|
||||
if isinstance(active.get("authErrCounter"), int):
|
||||
entry["auth_errors"] = active["authErrCounter"]
|
||||
return entry
|
||||
|
||||
|
||||
def contact_link(resp: dict) -> dict:
|
||||
@@ -111,8 +131,9 @@ def parse_chat_item(item: dict) -> dict | None:
|
||||
text = _text_from_content(item.get("content") or {})
|
||||
if not text:
|
||||
return None
|
||||
status = (meta.get("itemStatus") or {}).get("type") or ""
|
||||
return {
|
||||
status_obj = meta.get("itemStatus") or {}
|
||||
status = status_obj.get("type") or ""
|
||||
entry = {
|
||||
"item_id": str(item_id),
|
||||
"text": text,
|
||||
"status": status,
|
||||
@@ -120,6 +141,12 @@ def parse_chat_item(item: dict) -> dict | None:
|
||||
"direction": (item.get("chatDir") or {}).get("type") or "",
|
||||
"sent_at": meta.get("itemTs") or "",
|
||||
}
|
||||
# A failed send carries the agent-level reason (`{"type":"auth"}` etc.);
|
||||
# surface it so a caller can report *why* a message did not go out.
|
||||
agent_error = status_obj.get("agentError") or {}
|
||||
if agent_error:
|
||||
entry["error"] = agent_error.get("type") or str(agent_error)
|
||||
return entry
|
||||
|
||||
|
||||
def parse_chat(achat: dict) -> dict | None:
|
||||
@@ -198,6 +225,7 @@ def parse_direct_text_item(item: dict) -> InboundDict | None:
|
||||
"text": text,
|
||||
"contact_id": entry["id"],
|
||||
"display_name": entry["display_name"],
|
||||
"local_name": entry.get("local_name", ""),
|
||||
"raw": item,
|
||||
}
|
||||
|
||||
@@ -228,6 +256,31 @@ def accept_command(resp: dict) -> str | None:
|
||||
return f"/_accept {req_id}"
|
||||
|
||||
|
||||
def parse_send_response(resp: dict) -> dict:
|
||||
"""Normalize a `/_send` response into `{item_id, status, error}`.
|
||||
|
||||
A successful send comes back as `newChatItems` carrying the freshly created
|
||||
`chatItem` (its `meta.itemId` and initial `meta.itemStatus`, usually
|
||||
`sndNew`). A rejected send comes back as `chatCmdError`. `item_id` is None
|
||||
on any rejection so the caller can tell "no message was created" from
|
||||
"created but later failed at the agent layer".
|
||||
"""
|
||||
if not isinstance(resp, dict):
|
||||
return {"item_id": None, "status": "", "error": "empty daemon response"}
|
||||
if resp.get("type") == "chatCmdError" or resp.get("error"):
|
||||
detail = resp.get("chatError") or resp.get("error") or "chat command failed"
|
||||
return {"item_id": None, "status": "", "error": str(detail)[:300]}
|
||||
for item in resp.get("chatItems") or []:
|
||||
meta = (item.get("chatItem") or {}).get("meta") or {}
|
||||
item_id = meta.get("itemId")
|
||||
if item_id is None:
|
||||
continue
|
||||
status = (meta.get("itemStatus") or {}).get("type") or ""
|
||||
error = ((meta.get("itemStatus") or {}).get("agentError") or {}).get("type") or ""
|
||||
return {"item_id": str(item_id), "status": status, "error": error}
|
||||
return {"item_id": None, "status": "", "error": "daemon returned no message id"}
|
||||
|
||||
|
||||
class SimplexDaemon:
|
||||
"""One WebSocket connection to a `simplex-chat` daemon.
|
||||
|
||||
@@ -434,6 +487,37 @@ class SimplexDaemon:
|
||||
future.cancel()
|
||||
raise TimeoutError("simplex address request timed out") from exc
|
||||
|
||||
# ---- send ----
|
||||
|
||||
async def send(self, chat_id: str, text: str, timeout: float = 20.0) -> dict:
|
||||
"""Send a direct text message and return the daemon's correlated reply.
|
||||
|
||||
Unlike `enqueue` (fire-and-forget, used by the command gateway), this
|
||||
awaits the `/_send` response so the caller sees whether the message was
|
||||
created and its initial status. The daemon reports agent-level failures
|
||||
(auth, quota) asynchronously, so a caller that needs delivery truth must
|
||||
still poll `chat_history` for the item's terminal status.
|
||||
"""
|
||||
return await self._roundtrip(send_text_command(chat_id, text), timeout)
|
||||
|
||||
def request_send(self, chat_id: str, text: str, timeout: float = 20.0) -> dict:
|
||||
"""Thread-safe correlated send for callers off the event loop.
|
||||
|
||||
Raises `RuntimeError` when no live connection exists and `TimeoutError`
|
||||
when the daemon does not answer in time — never a fabricated success.
|
||||
"""
|
||||
loop = self._loop
|
||||
if loop is None or not loop.is_running():
|
||||
raise RuntimeError("simplex gateway is not connected")
|
||||
future = asyncio.run_coroutine_threadsafe(
|
||||
self.send(chat_id, text, timeout=timeout), loop
|
||||
)
|
||||
try:
|
||||
return future.result(timeout=timeout + 5.0)
|
||||
except concurrent.futures.TimeoutError as exc:
|
||||
future.cancel()
|
||||
raise TimeoutError("simplex send request timed out") from exc
|
||||
|
||||
# ---- contacts ----
|
||||
|
||||
async def active_user(self, timeout: float = 20.0) -> int:
|
||||
|
||||
+23
-21
@@ -22,7 +22,7 @@ from pathlib import Path
|
||||
from typing import Callable
|
||||
|
||||
from .decisions import DecisionRequest, Option, Request
|
||||
from .engine import SemIfEngine
|
||||
from .engine import DecisionEngine
|
||||
from .llm import LLMClient
|
||||
from .log import DecisionLog
|
||||
from .timers import TimerService
|
||||
@@ -41,7 +41,7 @@ class ActionResult:
|
||||
|
||||
@dataclass
|
||||
class ActionContext:
|
||||
engine: SemIfEngine
|
||||
engine: DecisionEngine
|
||||
config: dict
|
||||
timers: TimerService | None = None
|
||||
# The scheduler, exposed to built-in meta skills (housekeeping) so they can
|
||||
@@ -1117,7 +1117,7 @@ def merge_registry(tree: dict[str, list[Skill]], categories: dict[str, dict]) ->
|
||||
|
||||
|
||||
def _navigate_canned(
|
||||
engine: SemIfEngine,
|
||||
engine: DecisionEngine,
|
||||
log: DecisionLog,
|
||||
trace: TraceLog,
|
||||
request: Request,
|
||||
@@ -1160,7 +1160,7 @@ def _navigate_canned(
|
||||
|
||||
|
||||
def navigate(
|
||||
engine: SemIfEngine,
|
||||
engine: DecisionEngine,
|
||||
log: DecisionLog,
|
||||
trace: TraceLog,
|
||||
request: Request,
|
||||
@@ -1171,17 +1171,22 @@ def navigate(
|
||||
) -> Skill | CreateCategory | CreateSkill:
|
||||
"""Descend the tree one SemIf choice per level. Every choice is logged.
|
||||
|
||||
**Confident softmax winners skip their confirm guard.** When the category
|
||||
softmax winner's probability is >= `bypass_tau` (default 0.5) the scope
|
||||
confirm (`confirm_category_fit`) is skipped — the winner is taken as-is
|
||||
(traced `category_scope_bypassed`); below it the guard runs and can reject
|
||||
the winner into create. The leaf softmax winner's probability is handed to
|
||||
dispatch (`request.meta["leaf_softmax_prob"]`) so `confirm_skill_fit` is
|
||||
likewise skipped above the threshold (traced `intent_bypass`). The guards
|
||||
exist to catch an unsure softmax; a winner at 0.5+ is already decisive, and
|
||||
each skipped guard is one fewer SemIf call on the hot path. Below the
|
||||
threshold the two-stage behavior is unchanged. The recorded data agrees:
|
||||
every logged winner >= 0.5 also passed its guard.
|
||||
**A confident category winner skips the scope confirm; the leaf intent
|
||||
guard always runs.** When the category softmax winner's probability is >=
|
||||
`bypass_tau` (default 0.5) the scope confirm (`confirm_category_fit`) is
|
||||
skipped — the winner is taken as-is (traced `category_scope_bypassed`). That
|
||||
is sound because `create_category` is one of the category softmax options, so
|
||||
a confident winner genuinely beat "author a new category"; below the threshold
|
||||
the guard runs and can reject the winner into create. The leaf softmax has
|
||||
**no** create option (`create_skill` is deliberately absent), so its
|
||||
probabilities are renormalized over only the existing skills and a confident
|
||||
winner means "best of the wrong lot", not a match. The leaf intent guard
|
||||
(`confirm_skill_fit`) is therefore **never** bypassed: it is the sole
|
||||
leaf-level create door, and skipping it would make codegen unreachable for an
|
||||
unmatched request. (Regression: with Winnow as the engine, "send a message to
|
||||
pepper on SimpleX" picked `connect_link` at 0.86 / `next_message` at 0.995,
|
||||
skipped the guard, and ran a read skill instead of authoring
|
||||
`simplex.send_message`.)
|
||||
|
||||
The **actionability guard** (`confirm_non_action`, phase
|
||||
`navigate:actionability`, keyed by `navigation.action_tau`) runs at the **top**
|
||||
@@ -1333,14 +1338,11 @@ def navigate(
|
||||
leaf_result = engine.call(leaf)
|
||||
log.append(leaf, leaf_result, extra={"phase": "navigate:leaf", "run_id": request.id})
|
||||
pick = leaf_result.selected
|
||||
# Hand the winner's confidence to dispatch so it can skip the intent guard
|
||||
# when the softmax is already decisive (see `navigate` docstring).
|
||||
request.meta["leaf_softmax_prob"] = float(leaf_result.probs.get(pick, 0.0))
|
||||
return next((s for s in skills if s.name == pick), skills[0])
|
||||
|
||||
|
||||
def confirm_category_fit(
|
||||
engine: SemIfEngine,
|
||||
engine: DecisionEngine,
|
||||
log: DecisionLog,
|
||||
trace: TraceLog,
|
||||
request: Request,
|
||||
@@ -1405,7 +1407,7 @@ def confirm_category_fit(
|
||||
|
||||
|
||||
def confirm_non_action(
|
||||
engine: SemIfEngine,
|
||||
engine: DecisionEngine,
|
||||
log: DecisionLog,
|
||||
trace: TraceLog,
|
||||
request: Request,
|
||||
@@ -1468,7 +1470,7 @@ def confirm_non_action(
|
||||
|
||||
|
||||
def confirm_skill_fit(
|
||||
engine: SemIfEngine,
|
||||
engine: DecisionEngine,
|
||||
log: DecisionLog,
|
||||
trace: TraceLog,
|
||||
request: Request,
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
"""Remote Winnow decision engine: a `/v1/systemone` typed-decision HTTP API.
|
||||
|
||||
An alternative to the local SemIf llama.cpp engine (`engine.SemIfEngine`),
|
||||
selected per machine with ``engine.provider == "winnow"`` in config.json — the
|
||||
same provider pattern as ``llm`` / ``codegen``. The agent's flat decision
|
||||
contract (state + question + typed options) maps onto Winnow's ``choice``
|
||||
question type: the options become the question's ``criteria`` (id -> description)
|
||||
and the question becomes its ``instructions``; the server returns a probability
|
||||
over exactly those keys.
|
||||
|
||||
Winnow runs as its own process (``winnow-server``); see ``local/ENVIRONMENT.md``
|
||||
for this deployment. The engine is real: any network, HTTP, or distribution
|
||||
failure raises `EngineUnavailable`, which the scheduler treats as fatal — there
|
||||
is no fallback model and no fabricated reply.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import math
|
||||
import threading
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .decisions import DecisionRequest, DecisionResult
|
||||
from .engine import DecisionEngine, EngineUnavailable
|
||||
|
||||
|
||||
@dataclass
|
||||
class WinnowConfig:
|
||||
"""Per-machine settings for the remote Winnow engine (`engine.winnow`)."""
|
||||
|
||||
base_url: str = "http://127.0.0.1:8091"
|
||||
model: str = "Winnow-12B"
|
||||
timeout: float = 120.0
|
||||
# Transient-failure retries before declaring the engine unavailable. 0 means
|
||||
# a single attempt: an unreachable remote engine is fatal by contract.
|
||||
retries: int = 0
|
||||
api_key: str = ""
|
||||
extra_headers: dict | None = None
|
||||
user_agent: str = "semif-agent"
|
||||
|
||||
|
||||
class WinnowEngine(DecisionEngine):
|
||||
"""One Winnow `/v1/systemone` endpoint, used for every decision.
|
||||
|
||||
Scoring maps `DecisionRequest` -> a single ``choice`` question and reads the
|
||||
returned distribution back over the requested option ids. The endpoint is a
|
||||
single-slot server, so calls serialize on an internal lock exactly as
|
||||
`SemIfEngine` serializes on its llama.cpp context.
|
||||
"""
|
||||
|
||||
label = "winnow"
|
||||
|
||||
def __init__(self, config: WinnowConfig):
|
||||
self.config = config
|
||||
self._lock = threading.Lock()
|
||||
self._loaded = False
|
||||
|
||||
@property
|
||||
def loaded(self) -> bool:
|
||||
return self._loaded
|
||||
|
||||
# ---- transport ----
|
||||
|
||||
def _headers(self) -> dict:
|
||||
headers = {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json",
|
||||
}
|
||||
if self.config.user_agent:
|
||||
headers["user-agent"] = self.config.user_agent
|
||||
if self.config.api_key:
|
||||
headers["authorization"] = f"Bearer {self.config.api_key}"
|
||||
for key, value in (self.config.extra_headers or {}).items():
|
||||
headers[str(key)] = str(value)
|
||||
return headers
|
||||
|
||||
def _post(self, path: str, payload: dict) -> dict:
|
||||
"""POST JSON, returning the parsed object or raising `EngineUnavailable`."""
|
||||
url = self.config.base_url.rstrip("/") + path
|
||||
data = json.dumps(payload).encode("utf-8")
|
||||
attempts = max(0, int(self.config.retries)) + 1
|
||||
last: Exception | None = None
|
||||
for attempt in range(attempts):
|
||||
request = urllib.request.Request(
|
||||
url, data=data, method="POST", headers=self._headers()
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(
|
||||
request, timeout=self.config.timeout
|
||||
) as response:
|
||||
body = response.read().decode("utf-8", errors="replace")
|
||||
parsed = json.loads(body)
|
||||
if not isinstance(parsed, dict):
|
||||
raise EngineUnavailable(
|
||||
f"Winnow response from {url} is not a JSON object"
|
||||
)
|
||||
return parsed
|
||||
except urllib.error.HTTPError as exc:
|
||||
detail = ""
|
||||
try:
|
||||
detail = exc.read().decode("utf-8", errors="replace")[:300]
|
||||
except Exception:
|
||||
pass
|
||||
last = EngineUnavailable(
|
||||
f"HTTP {exc.code} from {url}: {detail}".strip()
|
||||
)
|
||||
# A 4xx (except 429) will not succeed on retry.
|
||||
if 400 <= exc.code < 500 and exc.code != 429:
|
||||
break
|
||||
except EngineUnavailable:
|
||||
raise
|
||||
except Exception as exc: # URLError, timeout, socket, JSONDecodeError
|
||||
last = exc
|
||||
if attempt + 1 < attempts:
|
||||
time.sleep(min(2.0**attempt, 5.0))
|
||||
if isinstance(last, EngineUnavailable):
|
||||
raise last
|
||||
raise EngineUnavailable(
|
||||
f"Winnow request to {url} failed: {type(last).__name__}: {last}"
|
||||
)
|
||||
|
||||
# ---- DecisionEngine ----
|
||||
|
||||
def warm(self) -> None:
|
||||
"""Verify the endpoint is reachable (`GET /health`), else raise."""
|
||||
url = self.config.base_url.rstrip("/") + "/health"
|
||||
request = urllib.request.Request(url, method="GET", headers=self._headers())
|
||||
try:
|
||||
with urllib.request.urlopen(
|
||||
request, timeout=self.config.timeout
|
||||
) as response:
|
||||
if getattr(response, "status", 200) != 200:
|
||||
raise EngineUnavailable(
|
||||
f"Winnow health check returned HTTP {response.status}"
|
||||
)
|
||||
except EngineUnavailable:
|
||||
raise
|
||||
except Exception as exc:
|
||||
raise EngineUnavailable(f"Winnow unreachable at {url}: {exc}") from exc
|
||||
self._loaded = True
|
||||
|
||||
def call(self, request: DecisionRequest) -> DecisionResult:
|
||||
option_ids = [option.id for option in request.options]
|
||||
payload = {
|
||||
"state": request.state,
|
||||
"model": self.config.model,
|
||||
"questions": {
|
||||
"decision": {
|
||||
"type": "choice",
|
||||
"instructions": request.question,
|
||||
"criteria": {
|
||||
option.id: option.description for option in request.options
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
with self._lock:
|
||||
started = time.perf_counter()
|
||||
body = self._post("/v1/systemone", payload)
|
||||
elapsed = time.perf_counter() - started
|
||||
|
||||
answers = body.get("answers")
|
||||
answer = answers.get("decision") if isinstance(answers, dict) else None
|
||||
if not isinstance(answer, dict):
|
||||
raise EngineUnavailable("Winnow response is missing answers.decision")
|
||||
if answer.get("type") not in (None, "choice"):
|
||||
raise EngineUnavailable(
|
||||
f"Winnow answer type {answer.get('type')!r} is not 'choice'"
|
||||
)
|
||||
raw = answer.get("probabilities")
|
||||
if not isinstance(raw, dict):
|
||||
raise EngineUnavailable("Winnow answer is missing probabilities")
|
||||
if set(raw) != set(option_ids):
|
||||
raise EngineUnavailable(
|
||||
"Winnow probabilities do not match the requested options: "
|
||||
f"{sorted(raw)} != {sorted(option_ids)}"
|
||||
)
|
||||
try:
|
||||
values = [float(raw[option_id]) for option_id in option_ids]
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise EngineUnavailable(
|
||||
f"Winnow probabilities are not numeric: {exc}"
|
||||
) from exc
|
||||
if any((not math.isfinite(value)) or value < 0.0 or value > 1.0 for value in values):
|
||||
raise EngineUnavailable(
|
||||
"Winnow returned a non-finite or out-of-range probability"
|
||||
)
|
||||
total = sum(values)
|
||||
if total <= 0.0:
|
||||
raise EngineUnavailable("Winnow returned an all-zero distribution")
|
||||
probabilities = [value / total for value in values]
|
||||
usage = body.get("usage") if isinstance(body.get("usage"), dict) else {}
|
||||
self._loaded = True
|
||||
return DecisionResult(
|
||||
request=request,
|
||||
option_ids=option_ids,
|
||||
probabilities=probabilities,
|
||||
extra={
|
||||
"input_tokens": usage.get("input_tokens"),
|
||||
"output_tokens": usage.get("output_tokens"),
|
||||
"forward_seconds": elapsed,
|
||||
"total_seconds": elapsed,
|
||||
"raw_probability_sum": total,
|
||||
"served_model": body.get("model"),
|
||||
"confidence": answer.get("confidence"),
|
||||
},
|
||||
)
|
||||
|
||||
def generate(
|
||||
self,
|
||||
messages: list[dict],
|
||||
temperature: float = 0.0,
|
||||
max_tokens: int = 256,
|
||||
) -> str:
|
||||
"""Text generation via the same server's `/v1/chat/completions`.
|
||||
|
||||
Backs `llm.provider == "semif"` when the decision engine is Winnow.
|
||||
"""
|
||||
payload = {
|
||||
"model": self.config.model,
|
||||
"messages": messages,
|
||||
"max_tokens": max_tokens,
|
||||
"temperature": temperature,
|
||||
}
|
||||
with self._lock:
|
||||
body = self._post("/v1/chat/completions", payload)
|
||||
choices = body.get("choices")
|
||||
if not isinstance(choices, list) or not choices:
|
||||
raise EngineUnavailable("Winnow chat response has no choices")
|
||||
first = choices[0]
|
||||
message = first.get("message") if isinstance(first, dict) else None
|
||||
content = message.get("content") if isinstance(message, dict) else None
|
||||
if not isinstance(content, str):
|
||||
raise EngineUnavailable("Winnow chat response has no message content")
|
||||
self._loaded = True
|
||||
return content.strip()
|
||||
@@ -350,13 +350,18 @@ def test_busy_queue_path(tmp_path):
|
||||
scheduler.idle()
|
||||
|
||||
|
||||
def test_engine_scoring_only(tmp_path):
|
||||
"""The pinned decision model scores (makes decisions); it no longer writes
|
||||
free text. Text authoring is the `llm` provider's job."""
|
||||
def test_engine_is_pluggable(tmp_path):
|
||||
"""The configured decision engine satisfies the `DecisionEngine` contract
|
||||
(`call` + `warm` + `generate`), whether the local `semif` provider or a
|
||||
remote `winnow` one. The engine is selected by `engine.provider`."""
|
||||
config = load_config()
|
||||
require_real(config)
|
||||
scheduler, config = build_scheduler(config)
|
||||
assert not hasattr(scheduler.engine, "generate")
|
||||
from semif_agent.engine import DecisionEngine
|
||||
|
||||
assert isinstance(scheduler.engine, DecisionEngine)
|
||||
assert hasattr(scheduler.engine, "call")
|
||||
assert hasattr(scheduler.engine, "generate")
|
||||
|
||||
|
||||
def test_generate_category(tmp_path):
|
||||
|
||||
+112
-2
@@ -32,6 +32,8 @@ class FakeDaemon:
|
||||
chats_error=None,
|
||||
history=None,
|
||||
history_error=None,
|
||||
send_response=None,
|
||||
send_error=None,
|
||||
):
|
||||
self.link = link
|
||||
self.error = error
|
||||
@@ -41,6 +43,8 @@ class FakeDaemon:
|
||||
self.chats_error = chats_error
|
||||
self.history_list = history or []
|
||||
self.history_error = history_error
|
||||
self.send_response = send_response
|
||||
self.send_error = send_error
|
||||
self.refresh_count = 0
|
||||
self.chat_calls = []
|
||||
self.history_calls = []
|
||||
@@ -58,6 +62,19 @@ class FakeDaemon:
|
||||
if chat_id is not None:
|
||||
self.sent.append((chat_id, text))
|
||||
|
||||
def request_send(self, chat_id, text, timeout=20.0):
|
||||
self.sent.append((chat_id, text))
|
||||
if self.send_error is not None:
|
||||
raise self.send_error
|
||||
if self.send_response is not None:
|
||||
return self.send_response
|
||||
return {
|
||||
"type": "newChatItems",
|
||||
"chatItems": [
|
||||
{"chatItem": {"meta": {"itemId": 1, "itemStatus": {"type": "sndRcvd"}}}}
|
||||
],
|
||||
}
|
||||
|
||||
def request_address(self, timeout=20.0):
|
||||
if self.error is not None:
|
||||
raise self.error
|
||||
@@ -186,7 +203,9 @@ def test_send_routes_to_daemon():
|
||||
bridge, daemon, base = start_bridge()
|
||||
try:
|
||||
result = post(f"{base}/send", {"recipient": "7", "text": "on my way"})
|
||||
assert result == {"ok": True, "contact_id": "7"}
|
||||
assert result["ok"] is True, result
|
||||
assert result["contact_id"] == "7", result
|
||||
assert result["status"] == "sndRcvd", result
|
||||
assert daemon.sent == [("7", "on my way")]
|
||||
finally:
|
||||
bridge.stop()
|
||||
@@ -203,6 +222,80 @@ def test_send_resolves_known_display_name():
|
||||
bridge.stop()
|
||||
|
||||
|
||||
def test_send_reports_a_failed_send_not_a_false_success():
|
||||
# A dead connection: the daemon creates the item then marks it sndError.
|
||||
# The bridge must surface ok:false with the reason, never a false success.
|
||||
failed = {
|
||||
"type": "newChatItems",
|
||||
"chatItems": [
|
||||
{
|
||||
"chatItem": {
|
||||
"meta": {
|
||||
"itemId": 12,
|
||||
"itemStatus": {
|
||||
"type": "sndError",
|
||||
"agentError": {"type": "auth"},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
daemon = FakeDaemon(send_response=failed)
|
||||
bridge, _, base = start_bridge(daemon=daemon)
|
||||
try:
|
||||
result = post(f"{base}/send", {"recipient": "7", "text": "hey"})
|
||||
assert result["ok"] is False, result
|
||||
assert result["status"] == "sndError", result
|
||||
assert result["error"] == "auth", result
|
||||
assert result["contact_id"] == "7"
|
||||
finally:
|
||||
bridge.stop()
|
||||
|
||||
|
||||
def test_send_verifies_status_via_history():
|
||||
# The daemon accepts the send (sndNew) and only later resolves it to a
|
||||
# delivered status; the bridge polls history to confirm.
|
||||
accepted = {
|
||||
"type": "newChatItems",
|
||||
"chatItems": [
|
||||
{"chatItem": {"meta": {"itemId": 5, "itemStatus": {"type": "sndNew"}}}}
|
||||
],
|
||||
}
|
||||
history = [
|
||||
{"item_id": "5", "text": "hi", "status": "sndRcvd", "unread": False,
|
||||
"direction": "directSnd", "sent_at": ""},
|
||||
]
|
||||
daemon = FakeDaemon(send_response=accepted, history=history)
|
||||
bridge, _, base = start_bridge(daemon=daemon)
|
||||
try:
|
||||
result = post(f"{base}/send", {"recipient": "7", "text": "hi"})
|
||||
assert result["ok"] is True, result
|
||||
assert result["status"] == "sndRcvd", result
|
||||
assert daemon.history_calls, "the bridge must poll for the real status"
|
||||
finally:
|
||||
bridge.stop()
|
||||
|
||||
|
||||
def test_resolve_prefers_a_healthy_duplicate():
|
||||
# Two peers share the display name "pepper"; the stale one has auth errors.
|
||||
daemon = FakeDaemon(
|
||||
contacts=[
|
||||
{"id": "3", "display_name": "pepper", "local_name": "pepper",
|
||||
"connected": True, "auth_errors": 2},
|
||||
{"id": "4", "display_name": "pepper", "local_name": "pepper_1",
|
||||
"connected": True, "auth_errors": 0},
|
||||
]
|
||||
)
|
||||
bridge, _, _ = start_bridge(daemon=daemon)
|
||||
try:
|
||||
assert bridge.resolve("pepper") == "4", "a stale duplicate must lose"
|
||||
assert bridge.resolve("pepper_1") == "4"
|
||||
assert bridge.resolve("3") == "3", "an explicit id always wins"
|
||||
finally:
|
||||
bridge.stop()
|
||||
|
||||
|
||||
def test_contacts_refreshed_from_daemon():
|
||||
# A contact the bridge has never received from must still be visible: the
|
||||
# daemon knows them, so /send can address them.
|
||||
@@ -222,7 +315,7 @@ def test_send_resolves_daemon_only_contact():
|
||||
bridge, _, base = start_bridge(daemon=daemon)
|
||||
try:
|
||||
result = post(f"{base}/send", {"recipient": "Zed", "text": "hello"})
|
||||
assert result == {"ok": True, "contact_id": "42"}
|
||||
assert result["ok"] is True and result["contact_id"] == "42", result
|
||||
assert daemon.sent == [("42", "hello")]
|
||||
finally:
|
||||
bridge.stop()
|
||||
@@ -370,6 +463,23 @@ def test_unread_returns_daemon_chats():
|
||||
bridge.stop()
|
||||
|
||||
|
||||
def test_unread_attaches_cached_connection_health():
|
||||
daemon = FakeDaemon(chats=[chat_summary(contact_id="4", display_name="pepper")])
|
||||
bridge, _, base = start_bridge(daemon=daemon)
|
||||
try:
|
||||
bridge.inbox.merge_contacts(
|
||||
[
|
||||
{"id": "4", "display_name": "pepper", "local_name": "pepper_1",
|
||||
"connected": True, "auth_errors": 0},
|
||||
]
|
||||
)
|
||||
chats = get(f"{base}/unread")["chats"]
|
||||
assert chats[0]["connected"] is True
|
||||
assert chats[0]["auth_errors"] == 0
|
||||
finally:
|
||||
bridge.stop()
|
||||
|
||||
|
||||
def test_unread_honours_count_query():
|
||||
daemon = FakeDaemon(chats=[])
|
||||
bridge, _, base = start_bridge(daemon=daemon)
|
||||
|
||||
@@ -9,12 +9,17 @@ from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
from semif_agent.cli import build_engine_config
|
||||
import pytest
|
||||
|
||||
from semif_agent.cli import build_engine, build_engine_config
|
||||
from semif_agent.engine import (
|
||||
DecisionEngine,
|
||||
EngineConfig,
|
||||
SemIfEngine,
|
||||
_install_gpu_state_reset,
|
||||
_offloading_params,
|
||||
)
|
||||
from semif_agent.winnow import WinnowEngine
|
||||
|
||||
PINS = {
|
||||
"engine": {
|
||||
@@ -77,3 +82,32 @@ def test_gpu_state_reset_clears_cache_data():
|
||||
_install_gpu_state_reset(SimpleNamespace(engine=engine))
|
||||
engine.clear()
|
||||
assert calls == [("mem", True)]
|
||||
|
||||
|
||||
def test_build_engine_defaults_to_the_local_semif_provider():
|
||||
engine = build_engine({"engine": {"backend": "llamacpp"}}, PINS)
|
||||
assert isinstance(engine, SemIfEngine)
|
||||
assert isinstance(engine, DecisionEngine)
|
||||
assert engine.label == "semif"
|
||||
|
||||
|
||||
def test_build_engine_selects_the_winnow_provider():
|
||||
engine = build_engine(
|
||||
{
|
||||
"engine": {
|
||||
"provider": "winnow",
|
||||
"winnow": {"base_url": "http://example:8091", "model": "Winnow-12B"},
|
||||
}
|
||||
},
|
||||
PINS,
|
||||
)
|
||||
assert isinstance(engine, WinnowEngine)
|
||||
assert isinstance(engine, DecisionEngine)
|
||||
assert engine.label == "winnow"
|
||||
assert engine.config.base_url == "http://example:8091"
|
||||
assert engine.config.model == "Winnow-12B"
|
||||
|
||||
|
||||
def test_build_engine_winnow_requires_a_model():
|
||||
with pytest.raises(SystemExit):
|
||||
build_engine({"engine": {"provider": "winnow", "winnow": {}}}, PINS)
|
||||
@@ -141,18 +141,66 @@ def test_contact_link_reads_both_shapes():
|
||||
def test_contact_entry_reads_v7_shape():
|
||||
assert contact_entry(
|
||||
{"contactId": 4, "displayName": None, "profile": {"displayName": "Alice"}}
|
||||
) == {"id": "4", "display_name": "Alice"}
|
||||
) == {"id": "4", "display_name": "Alice", "local_name": "Alice"}
|
||||
assert contact_entry({"contactId": 7, "localDisplayName": "bob_1"}) == {
|
||||
"id": "7",
|
||||
"display_name": "bob_1",
|
||||
"local_name": "bob_1",
|
||||
}
|
||||
assert contact_entry({"chatId": 9, "profile": {"displayName": "Carol"}}) == {
|
||||
"id": "9",
|
||||
"display_name": "Carol",
|
||||
"local_name": "Carol",
|
||||
}
|
||||
assert contact_entry({"profile": {"displayName": "no id"}}) is None
|
||||
|
||||
|
||||
def test_contact_entry_keeps_unique_local_name_and_health():
|
||||
# Two peers share the profile name "pepper"; the daemon's local name is
|
||||
# unique, and the connection health tells a live peer from a stale one.
|
||||
healthy = contact_entry(
|
||||
{
|
||||
"contactId": 4,
|
||||
"localDisplayName": "pepper_1",
|
||||
"profile": {"displayName": "pepper"},
|
||||
"contactStatus": "active",
|
||||
"activeConn": {"connStatus": {"type": "ready"}, "authErrCounter": 0},
|
||||
}
|
||||
)
|
||||
assert healthy == {
|
||||
"id": "4",
|
||||
"display_name": "pepper",
|
||||
"local_name": "pepper_1",
|
||||
"connected": True,
|
||||
"auth_errors": 0,
|
||||
}
|
||||
stale = contact_entry(
|
||||
{
|
||||
"contactId": 3,
|
||||
"localDisplayName": "pepper",
|
||||
"profile": {"displayName": "pepper"},
|
||||
"contactStatus": "active",
|
||||
"activeConn": {"connStatus": {"type": "ready"}, "authErrCounter": 2},
|
||||
}
|
||||
)
|
||||
assert stale["local_name"] == "pepper"
|
||||
assert stale["connected"] is True
|
||||
assert stale["auth_errors"] == 2
|
||||
|
||||
|
||||
def test_contact_entry_marks_a_non_ready_connection_disconnected():
|
||||
entry = contact_entry(
|
||||
{
|
||||
"contactId": 4,
|
||||
"profile": {"displayName": "Alice"},
|
||||
"contactStatus": "active",
|
||||
"activeConn": {"connStatus": {"type": "connecting"}},
|
||||
}
|
||||
)
|
||||
assert entry["connected"] is False
|
||||
assert "auth_errors" not in entry
|
||||
|
||||
|
||||
# ---- daemon: accept + round-trips ----
|
||||
|
||||
class FakeWS:
|
||||
@@ -315,8 +363,8 @@ def test_contacts_parses_contacts_list():
|
||||
|
||||
result, ws = asyncio.run(scenario())
|
||||
assert result == [
|
||||
{"id": "4", "display_name": "Alice"},
|
||||
{"id": "7", "display_name": "bob_1"},
|
||||
{"id": "4", "display_name": "Alice", "local_name": "Alice"},
|
||||
{"id": "7", "display_name": "bob_1", "local_name": "bob_1"},
|
||||
]
|
||||
assert [m["cmd"] for m in ws.sent] == ["/user", "/_contacts 3"]
|
||||
|
||||
|
||||
+20
-10
@@ -1015,7 +1015,8 @@ def test_dispatch_intent_tau_controls_reuse_vs_create(tmp_path):
|
||||
{
|
||||
"top-level category": {"simplex": 1.0},
|
||||
"Does the scope": {"covers": 1.0},
|
||||
# Below softmax_bypass_tau (0.5), so the intent guard runs.
|
||||
# The leaf softmax offers only existing skills, so the intent
|
||||
# guard always runs (it is the create door).
|
||||
"skill performs": {"next_message": 0.45, "connect_link": 0.3},
|
||||
"same action": {"same": 0.8, "different": 0.2},
|
||||
}
|
||||
@@ -1127,10 +1128,15 @@ def test_dispatch_intent_match_runs_skill(tmp_path):
|
||||
assert result.skill == "next_message"
|
||||
|
||||
|
||||
def test_dispatch_confident_leaf_winner_skips_intent_guard(tmp_path):
|
||||
"""A leaf softmax winner at/above `softmax_bypass_tau` skips the intent
|
||||
confirm: the guard would reject here (same action = different), but a
|
||||
decisive softmax runs the skill instead."""
|
||||
def test_dispatch_confident_leaf_winner_still_runs_intent_guard(tmp_path):
|
||||
"""A leaf softmax winner at/above `softmax_bypass_tau` does NOT skip the
|
||||
intent confirm: the leaf softmax offers only existing skills (no create
|
||||
option), so a confident winner is "best of the wrong lot", never a match.
|
||||
The guard runs and, here, rejects the winner into create_skill.
|
||||
|
||||
Regression: with Winnow as the engine a send request picked `connect_link`
|
||||
at 0.86 / `next_message` at 0.995, the old `intent_bypass` ran a read skill,
|
||||
and codegen was never reached."""
|
||||
engine = _ProbEngine(
|
||||
{
|
||||
"top-level category": {"simplex": 1.0},
|
||||
@@ -1165,12 +1171,16 @@ def test_dispatch_confident_leaf_winner_skips_intent_guard(tmp_path):
|
||||
Skill(name="connect_link", category="simplex", description="Show the contact link."),
|
||||
]
|
||||
}
|
||||
result = scheduler._dispatch(Request("read the next simplex message"))
|
||||
assert result.kind == "ran"
|
||||
assert result.skill == "next_message"
|
||||
assert any(e["kind"] == "intent_bypass" for e in scheduler.trace.read())
|
||||
queued: list = []
|
||||
scheduler._queue_draft = lambda request, category, kind: queued.append(
|
||||
(category, kind)
|
||||
)
|
||||
result = scheduler._dispatch(Request("send a simplex message to pepper"))
|
||||
assert result.kind == "create_skill"
|
||||
assert queued == [("simplex", "skill")]
|
||||
assert not any(e["kind"] == "intent_bypass" for e in scheduler.trace.read())
|
||||
phases = [r["extra"].get("phase") for r in scheduler.log.read()]
|
||||
assert "navigate:intent" not in phases
|
||||
assert "navigate:intent" in phases
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
"""Pure-stdlib tests for the remote Winnow decision engine provider.
|
||||
|
||||
The engine is exercised over a real loopback HTTP server (the transport is not
|
||||
mocked): the handler records the request body and returns a canned
|
||||
``/v1/systemone`` response, so the tests prove the decision-contract mapping and
|
||||
the strict distribution validation. No model, no GGUF, no external network.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import threading
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
import pytest
|
||||
|
||||
from semif_agent.decisions import DecisionRequest, Option
|
||||
from semif_agent.engine import EngineUnavailable
|
||||
from semif_agent.winnow import WinnowConfig, WinnowEngine
|
||||
|
||||
|
||||
class _Handler(BaseHTTPRequestHandler):
|
||||
def log_message(self, *args): # keep the test output quiet
|
||||
pass
|
||||
|
||||
def _read(self) -> dict:
|
||||
length = int(self.headers.get("content-length", 0) or 0)
|
||||
raw = self.rfile.read(length) if length else b"{}"
|
||||
return json.loads(raw or b"{}")
|
||||
|
||||
def _send(self, status: int, payload: dict) -> None:
|
||||
body = json.dumps(payload).encode("utf-8")
|
||||
self.send_response(status)
|
||||
self.send_header("content-type", "application/json")
|
||||
self.send_header("content-length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/health":
|
||||
status = self.server.state.get("health_status", 200)
|
||||
self._send(status, {"status": "ok"} if status == 200 else {"error": "down"})
|
||||
else:
|
||||
self._send(404, {"error": "not found"})
|
||||
|
||||
def do_POST(self):
|
||||
body = self._read()
|
||||
self.server.state.setdefault("requests", []).append(
|
||||
(self.path, body, {k.lower(): v for k, v in self.headers.items()})
|
||||
)
|
||||
if self.path == "/v1/systemone":
|
||||
status = self.server.state.get("systemone_status", 200)
|
||||
response = self.server.state.get("systemone_response")
|
||||
if response is None:
|
||||
response = _default_systemone(body)
|
||||
self._send(status, response)
|
||||
elif self.path == "/v1/chat/completions":
|
||||
self._send(
|
||||
200,
|
||||
{"choices": [{"message": {"role": "assistant", "content": " hello "}}]},
|
||||
)
|
||||
else:
|
||||
self._send(404, {"error": "not found"})
|
||||
|
||||
|
||||
def _default_systemone(body: dict) -> dict:
|
||||
criteria = body["questions"]["decision"]["criteria"]
|
||||
keys = list(criteria)
|
||||
probs = {
|
||||
key: (0.9 if index == 0 else 0.1 / max(len(keys) - 1, 1))
|
||||
for index, key in enumerate(keys)
|
||||
}
|
||||
# Return the keys in REVERSE order to prove the engine aligns by id, not by
|
||||
# position in the returned object.
|
||||
return {
|
||||
"model": "Winnow-12B",
|
||||
"answers": {
|
||||
"decision": {
|
||||
"type": "choice",
|
||||
"probabilities": dict(reversed(list(probs.items()))),
|
||||
"confidence": 0.9,
|
||||
"choice": keys[0],
|
||||
}
|
||||
},
|
||||
"usage": {"input_tokens": 42, "output_tokens": 0},
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def winnow():
|
||||
server = ThreadingHTTPServer(("127.0.0.1", 0), _Handler)
|
||||
server.state = {}
|
||||
thread = threading.Thread(target=server.serve_forever, daemon=True)
|
||||
thread.start()
|
||||
base = f"http://127.0.0.1:{server.server_address[1]}"
|
||||
yield server, base
|
||||
server.shutdown()
|
||||
server.server_close()
|
||||
|
||||
|
||||
def _engine(base: str, **cfg) -> WinnowEngine:
|
||||
return WinnowEngine(
|
||||
WinnowConfig(base_url=base, model="Winnow-12B", timeout=5.0, **cfg)
|
||||
)
|
||||
|
||||
|
||||
def _decision(*option_ids: str) -> DecisionRequest:
|
||||
return DecisionRequest(
|
||||
state="the user said hello",
|
||||
question="Which category handles this request?",
|
||||
options=[Option(oid, f"description for {oid}") for oid in option_ids],
|
||||
)
|
||||
|
||||
|
||||
def test_call_maps_decision_to_a_choice_question(winnow):
|
||||
server, base = winnow
|
||||
engine = _engine(base)
|
||||
result = engine.call(_decision("response", "calendar"))
|
||||
|
||||
assert result.option_ids == ["response", "calendar"]
|
||||
assert result.prob("response") == pytest.approx(0.9)
|
||||
assert result.prob("calendar") == pytest.approx(0.1)
|
||||
assert result.selected == "response"
|
||||
assert result.extra["input_tokens"] == 42
|
||||
|
||||
path, body, _ = server.state["requests"][-1]
|
||||
assert path == "/v1/systemone"
|
||||
assert body["model"] == "Winnow-12B"
|
||||
assert body["state"] == "the user said hello"
|
||||
question = body["questions"]["decision"]
|
||||
assert question["type"] == "choice"
|
||||
assert question["instructions"] == "Which category handles this request?"
|
||||
assert question["criteria"] == {
|
||||
"response": "description for response",
|
||||
"calendar": "description for calendar",
|
||||
}
|
||||
|
||||
|
||||
def test_call_normalizes_an_unnormalized_distribution(winnow):
|
||||
server, base = winnow
|
||||
server.state["systemone_response"] = {
|
||||
"answers": {"decision": {"type": "choice", "probabilities": {"a": 0.4, "b": 0.4}}}
|
||||
}
|
||||
result = _engine(base).call(_decision("a", "b"))
|
||||
assert result.probs == pytest.approx({"a": 0.5, "b": 0.5})
|
||||
|
||||
|
||||
def test_call_rejects_mismatched_probability_keys(winnow):
|
||||
server, base = winnow
|
||||
server.state["systemone_response"] = {
|
||||
"answers": {"decision": {"type": "choice", "probabilities": {"a": 1.0}}}
|
||||
}
|
||||
with pytest.raises(EngineUnavailable):
|
||||
_engine(base).call(_decision("a", "b"))
|
||||
|
||||
|
||||
def test_call_rejects_all_zero_distribution(winnow):
|
||||
server, base = winnow
|
||||
server.state["systemone_response"] = {
|
||||
"answers": {"decision": {"type": "choice", "probabilities": {"a": 0.0, "b": 0.0}}}
|
||||
}
|
||||
with pytest.raises(EngineUnavailable):
|
||||
_engine(base).call(_decision("a", "b"))
|
||||
|
||||
|
||||
def test_call_rejects_http_error(winnow):
|
||||
server, base = winnow
|
||||
server.state["systemone_status"] = 500
|
||||
with pytest.raises(EngineUnavailable):
|
||||
_engine(base).call(_decision("a", "b"))
|
||||
|
||||
|
||||
def test_call_rejects_missing_answer(winnow):
|
||||
server, base = winnow
|
||||
server.state["systemone_response"] = {"answers": {}}
|
||||
with pytest.raises(EngineUnavailable):
|
||||
_engine(base).call(_decision("a", "b"))
|
||||
|
||||
|
||||
def test_call_sends_bearer_token(winnow):
|
||||
server, base = winnow
|
||||
_engine(base, api_key="secret").call(_decision("a", "b"))
|
||||
_, _, headers = server.state["requests"][-1]
|
||||
assert headers.get("authorization") == "Bearer secret"
|
||||
|
||||
|
||||
def test_generate_uses_chat_completions(winnow):
|
||||
server, base = winnow
|
||||
text = _engine(base).generate([{"role": "user", "content": "hi"}], max_tokens=16)
|
||||
assert text == "hello"
|
||||
path, body, _ = server.state["requests"][-1]
|
||||
assert path == "/v1/chat/completions"
|
||||
assert body["max_tokens"] == 16
|
||||
|
||||
|
||||
def test_warm_checks_health_and_marks_loaded(winnow):
|
||||
server, base = winnow
|
||||
engine = _engine(base)
|
||||
assert engine.loaded is False
|
||||
engine.warm()
|
||||
assert engine.loaded is True
|
||||
|
||||
server.state["health_status"] = 503
|
||||
with pytest.raises(EngineUnavailable):
|
||||
_engine(base).warm()
|
||||
|
||||
|
||||
def test_unreachable_endpoint_raises_engine_unavailable():
|
||||
engine = WinnowEngine(
|
||||
WinnowConfig(base_url="http://127.0.0.1:1", model="Winnow-12B", timeout=1.0)
|
||||
)
|
||||
with pytest.raises(EngineUnavailable):
|
||||
engine.call(_decision("a", "b"))
|
||||
Reference in new issue
Block a user