@simplexai/localmodels-darwin-arm64 0.1.0-dev.43 → 0.1.0-dev.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.identity +1 -1
- package/bootstrap.sha256 +76 -79
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +0 -1
- package/modules/localmodels/auth_proxy.py +285 -82
- package/modules/localmodels/bifrost_checks.py +3 -127
- package/modules/localmodels/bifrost_clients.py +1 -1
- package/modules/localmodels/bifrost_config.py +2 -2
- package/modules/localmodels/bifrost_models.py +9 -2
- package/modules/localmodels/bifrost_pi.py +1 -1
- package/modules/localmodels/bifrost_provider.py +42 -7
- package/modules/localmodels/budget.py +16 -1
- package/modules/localmodels/catalog.json +15 -50
- package/modules/localmodels/catalog_recipes.py +1 -1
- package/modules/localmodels/debug_mode.py +2 -18
- package/modules/localmodels/engines-strata-poly-0.1.45-poly.9.json +41 -1
- package/modules/localmodels/engines.py +19 -6
- package/modules/localmodels/gateway.py +50 -15
- package/modules/localmodels/gateway_accept.py +8 -5
- package/modules/localmodels/gateway_bifrost.py +23 -13
- package/modules/localmodels/gateway_cli.py +5 -2
- package/modules/localmodels/gateway_requests.py +9 -2
- package/modules/localmodels/harness.py +41 -12
- package/modules/localmodels/harness_gateway.py +1 -1
- package/modules/localmodels/hosts.py +7 -20
- package/modules/localmodels/library_convert.py +491 -57
- package/modules/localmodels/library_gateway.py +27 -16
- package/modules/localmodels/library_pricing.py +155 -31
- package/modules/localmodels/library_status.py +29 -4
- package/modules/localmodels/npm_transport.py +62 -54
- package/modules/localmodels/probe.py +42 -9
- package/modules/localmodels/recommend.py +1 -1
- package/modules/localmodels/recommend_cli.py +2 -2
- package/modules/localmodels/remote_ops.py +14 -6
- package/modules/localmodels/remote_ops_download.py +1 -1
- package/modules/localmodels/remote_ops_verify.py +0 -33
- package/modules/localmodels/runtime_args.py +2 -1
- package/modules/localmodels/runtime_auth.py +75 -25
- package/modules/localmodels/runtime_cli.py +9 -9
- package/modules/localmodels/runtime_install.py +57 -23
- package/modules/localmodels/runtime_io.py +224 -243
- package/modules/localmodels/runtime_process.py +15 -7
- package/modules/localmodels/runtime_windows_acl.py +196 -0
- package/modules/localmodels/source_byok.py +122 -33
- package/modules/localmodels/source_byok_probe.py +57 -141
- package/modules/localmodels/source_cli.py +19 -18
- package/modules/localmodels/stack.py +13 -6
- package/modules/localmodels/stack_args.py +6 -8
- package/modules/localmodels/stack_binding.py +3 -3
- package/modules/localmodels/stack_client_settings.py +8 -1
- package/modules/localmodels/stack_compose.py +4 -8
- package/modules/localmodels/stack_events.py +2 -1
- package/modules/localmodels/stack_plan.py +1 -4
- package/modules/localmodels/stack_ports.py +0 -1
- package/modules/localmodels/stack_route.py +1 -5
- package/modules/localmodels/stack_run.py +15 -30
- package/modules/localmodels/stack_suite.py +23 -46
- package/modules/localmodels/stack_summary.py +0 -1
- package/modules/localmodels/stack_try.py +3 -92
- package/modules/localmodels/stack_up.py +27 -4
- package/modules/localmodels/stack_update.py +5 -5
- package/modules/localmodels/stack_view_apply.py +1 -1
- package/modules/localmodels/stack_view_sandbox.py +0 -2
- package/modules/localmodels/stack_view_text.py +0 -1
- package/modules/localmodels/stack_view_words.py +0 -1
- package/modules/localmodels/suite.py +4 -7
- package/modules/localmodels/tui_dialogs.py +0 -1
- package/modules/localmodels/vision.py +2 -1
- package/modules/localmodels/web/view/view.css +1 -4
- package/modules/{simplex_localmodels-0.1.0.dev43.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev43.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/RECORD +73 -76
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/localmodels/bifrost_search.py +0 -66
- package/modules/localmodels/gateway_search.py +0 -223
- package/modules/localmodels/search-ddgs-9.16.1.txt +0 -222
- package/modules/localmodels/search_server.py +0 -474
- /package/modules/{simplex_localmodels-0.1.0.dev43.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev43.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev43.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev43.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -46,6 +46,7 @@ class LlmFacts(TypedDict):
|
|
|
46
46
|
context: int
|
|
47
47
|
efforts: list[str] # reasoning_effort values the LLM's template accepts, low to high
|
|
48
48
|
defaultEffort: str
|
|
49
|
+
vision: bool # True when the served LLM reads images (vision.reads_pictures)
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
class GatewayFacts(TypedDict):
|
|
@@ -95,6 +96,11 @@ def default_effort(levels: list[str]) -> str:
|
|
|
95
96
|
return "medium" if "medium" in levels else levels[(len(levels) - 1) // 2]
|
|
96
97
|
|
|
97
98
|
|
|
99
|
+
def input_modalities(facts: LlmFacts) -> list[str]:
|
|
100
|
+
"""Input modalities for Codex (``input_modalities``) and pi (``input``)."""
|
|
101
|
+
return ["text", "image"] if facts.get("vision") else ["text"]
|
|
102
|
+
|
|
103
|
+
|
|
98
104
|
def llm_facts(gw: GatewayPlan, display: str) -> LlmFacts:
|
|
99
105
|
levels = efforts(gw)
|
|
100
106
|
return {
|
|
@@ -102,6 +108,7 @@ def llm_facts(gw: GatewayPlan, display: str) -> LlmFacts:
|
|
|
102
108
|
"context": int(gw.get("context") or DEFAULT_CONTEXT),
|
|
103
109
|
"efforts": levels,
|
|
104
110
|
"defaultEffort": default_effort(levels),
|
|
111
|
+
"vision": bool(gw.get("vision")),
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
|
|
@@ -153,7 +160,7 @@ def codex_catalog(facts: LlmFacts, model: str) -> dict[str, Any]:
|
|
|
153
160
|
"context_window": facts["context"],
|
|
154
161
|
"max_context_window": facts["context"],
|
|
155
162
|
"effective_context_window_percent": 95,
|
|
156
|
-
"input_modalities":
|
|
163
|
+
"input_modalities": input_modalities(facts),
|
|
157
164
|
"shell_type": "unified_exec",
|
|
158
165
|
"base_instructions": CODEX_INSTRUCTIONS,
|
|
159
166
|
"support_verbosity": False,
|
|
@@ -188,7 +195,7 @@ def pi_provider(facts: LlmFacts, model: str, base: str) -> dict[str, Any]:
|
|
|
188
195
|
"thinkingLevelMap": {
|
|
189
196
|
level: level if level in facts["efforts"] else None for level in PI_LEVELS
|
|
190
197
|
},
|
|
191
|
-
"input":
|
|
198
|
+
"input": input_modalities(facts),
|
|
192
199
|
"contextWindow": context,
|
|
193
200
|
"maxTokens": min(32768, max(4096, context // 4)),
|
|
194
201
|
"cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
|
|
@@ -13,7 +13,7 @@ from typing import Any
|
|
|
13
13
|
|
|
14
14
|
from localmodels import bifrost_models, harness, hosts
|
|
15
15
|
from localmodels.gateway_bifrost import AGENT_MODEL, PI_MODEL, PI_PROVIDER
|
|
16
|
-
from localmodels.
|
|
16
|
+
from localmodels.gateway_requests import Check
|
|
17
17
|
from localmodels.harness import GatewayPlan, HarnessError, HarnessPlan
|
|
18
18
|
|
|
19
19
|
|
|
@@ -2,10 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import ipaddress
|
|
6
|
+
import urllib.parse
|
|
5
7
|
from typing import Any
|
|
6
8
|
|
|
7
9
|
from localmodels import harness
|
|
8
10
|
|
|
11
|
+
# Loopback upstreams (llama-server uses cpp-httplib's 5 s keep-alive timeout; auth_proxy fronts
|
|
12
|
+
# local services) sit on 127.0.0.1 where a fresh dial costs microseconds, while Bifrost's
|
|
13
|
+
# fasthttp pool defaults to a 30 s idle timeout and its StaleConnectionRetryIfErr only matches
|
|
14
|
+
# POSIX "broken pipe" / "connection reset by peer", not Windows Winsock WSAECONNABORTED (10053)
|
|
15
|
+
# or WSAECONNRESET (10054). Closing loopback connections after each response, capping idle
|
|
16
|
+
# keep-alive below 5 s, and allowing 2 fast retries on pre-response transport failures prevents
|
|
17
|
+
# Windows 502 wsasend aborts (evidence/2026-11-19-linger-agentic-batch1/REPORT.md, Issue #3).
|
|
18
|
+
LOOPBACK_KEEP_ALIVE_S = 2
|
|
19
|
+
LOOPBACK_MAX_RETRIES = 2
|
|
20
|
+
LOOPBACK_RETRY_INITIAL_MS = 100
|
|
21
|
+
LOOPBACK_RETRY_MAX_MS = 500
|
|
22
|
+
|
|
9
23
|
# What each provider may be asked: everything else Bifrost refuses before it reaches the
|
|
10
24
|
# service. The LLM speaks chat only, so Bifrost turns Responses (Codex) and Anthropic Messages
|
|
11
25
|
# (Claude Code) requests into chat completions instead of calling /v1/responses upstream.
|
|
@@ -21,6 +35,16 @@ _ALLOWED = {
|
|
|
21
35
|
_BASE_TYPE = {"decision": "typesafe", "rerank": "cohere"}
|
|
22
36
|
|
|
23
37
|
|
|
38
|
+
def _is_loopback(url: str) -> bool:
|
|
39
|
+
host = (urllib.parse.urlsplit(url).hostname or "").strip().lower()
|
|
40
|
+
if host == "localhost":
|
|
41
|
+
return True
|
|
42
|
+
try:
|
|
43
|
+
return ipaddress.ip_address(host).is_loopback
|
|
44
|
+
except ValueError:
|
|
45
|
+
return False
|
|
46
|
+
|
|
47
|
+
|
|
24
48
|
def render(role: str, url: str, model: str, key: str, pid: str) -> dict[str, Any]:
|
|
25
49
|
custom: dict[str, Any] = {
|
|
26
50
|
"base_provider_type": _BASE_TYPE.get(role, "openai"),
|
|
@@ -34,15 +58,26 @@ def render(role: str, url: str, model: str, key: str, pid: str) -> dict[str, Any
|
|
|
34
58
|
# a name only when the key has it in both ``models`` and ``aliases``; either alone does not.
|
|
35
59
|
entry["models"] = [model, harness.GROUP]
|
|
36
60
|
entry["aliases"] = {harness.GROUP: model}
|
|
61
|
+
network_config: dict[str, Any] = {
|
|
62
|
+
"base_url": origin(url),
|
|
63
|
+
"allow_private_network": True,
|
|
64
|
+
"max_retries": 0,
|
|
65
|
+
"default_request_timeout_in_seconds": 600,
|
|
66
|
+
"stream_idle_timeout_in_seconds": 600,
|
|
67
|
+
}
|
|
68
|
+
if _is_loopback(url):
|
|
69
|
+
network_config.update(
|
|
70
|
+
{
|
|
71
|
+
"max_retries": LOOPBACK_MAX_RETRIES,
|
|
72
|
+
"retry_backoff_initial": LOOPBACK_RETRY_INITIAL_MS,
|
|
73
|
+
"retry_backoff_max": LOOPBACK_RETRY_MAX_MS,
|
|
74
|
+
"keep_alive_timeout_in_seconds": LOOPBACK_KEEP_ALIVE_S,
|
|
75
|
+
"extra_headers": {"Connection": "close"},
|
|
76
|
+
}
|
|
77
|
+
)
|
|
37
78
|
return {
|
|
38
79
|
"keys": [entry],
|
|
39
|
-
"network_config":
|
|
40
|
-
"base_url": origin(url),
|
|
41
|
-
"allow_private_network": True,
|
|
42
|
-
"max_retries": 0,
|
|
43
|
-
"default_request_timeout_in_seconds": 600,
|
|
44
|
-
"stream_idle_timeout_in_seconds": 600,
|
|
45
|
-
},
|
|
80
|
+
"network_config": network_config,
|
|
46
81
|
"custom_provider_config": custom,
|
|
47
82
|
}
|
|
48
83
|
|
|
@@ -40,6 +40,11 @@ _POOL_RAM_FRACTION = 0.75
|
|
|
40
40
|
# A card whose free memory is below this share of its total holds someone else's work.
|
|
41
41
|
BUSY_GPU_FRACTION = 0.10 # another program holding more of a card than this needs consent
|
|
42
42
|
IDLE_USED_BYTES = 1 << 30 # what an idle card's driver context may hold
|
|
43
|
+
# Cap on observed non-model GPU VRAM kept back as a desktop/WDDM baseline on Windows and
|
|
44
|
+
# display-active GPUs: keeps real desktop overhead (Windows 11 WDDM + DWM + Linger, ~2.2-2.5 GiB)
|
|
45
|
+
# from pretending the card is empty, without letting a transient game or foreign server hide
|
|
46
|
+
# models that fit once that program closes.
|
|
47
|
+
DESKTOP_VRAM_BASELINE_CAP_BYTES = 3 << 30
|
|
43
48
|
# A GPU container whose image or name says it serves models. Others with GPU access (monitoring
|
|
44
49
|
# agents, CI builders run with --gpus all) block nothing; their work shows as compute processes.
|
|
45
50
|
_SERVING_IMAGE_RE = re.compile(
|
|
@@ -235,7 +240,17 @@ def idle_cards(facts: HostFacts, need_bytes: int) -> list[GPU]:
|
|
|
235
240
|
ours = [p for p in here if p.get("owned") is True]
|
|
236
241
|
if conflicts.get(g["uuid"]) or any(not p.get("in_suite") for p in ours):
|
|
237
242
|
return False
|
|
238
|
-
|
|
243
|
+
# A Windows desktop always holds part of its card through WDDM contexts that are not
|
|
244
|
+
# foreign work (foreign_work); up to the desktop baseline, with no inference server
|
|
245
|
+
# there, the card is still idle (decision 60), and a Strata engine sizes itself from
|
|
246
|
+
# what is free when it starts.
|
|
247
|
+
taken = max(g["used_bytes"], g["total_bytes"] - g["free_bytes"])
|
|
248
|
+
desktop = (
|
|
249
|
+
facts.get("platform") == "win32"
|
|
250
|
+
and services is not None
|
|
251
|
+
and taken <= DESKTOP_VRAM_BASELINE_CAP_BYTES
|
|
252
|
+
)
|
|
253
|
+
return g["used_bytes"] < IDLE_USED_BYTES or any(p.get("in_suite") for p in ours) or desktop
|
|
239
254
|
|
|
240
255
|
cards = [
|
|
241
256
|
g
|
|
@@ -3224,7 +3224,7 @@
|
|
|
3224
3224
|
"2026-11-05-ornith-8gb-ab-local118",
|
|
3225
3225
|
"2026-11-11-strata-poly-install-local118"
|
|
3226
3226
|
],
|
|
3227
|
-
"memory_estimate_bytes":
|
|
3227
|
+
"memory_estimate_bytes": 9663676416,
|
|
3228
3228
|
"files": [
|
|
3229
3229
|
{
|
|
3230
3230
|
"path": "Qwen3.6-35B-A3B-UD-Q3_K_M.gguf",
|
|
@@ -3259,7 +3259,7 @@
|
|
|
3259
3259
|
"STRATA_ENGINE_READY_S": "1800"
|
|
3260
3260
|
},
|
|
3261
3261
|
"profile": {
|
|
3262
|
-
"exe": "{
|
|
3262
|
+
"exe": "{engine}",
|
|
3263
3263
|
"args": [
|
|
3264
3264
|
"--model",
|
|
3265
3265
|
"{model}",
|
|
@@ -3272,7 +3272,9 @@
|
|
|
3272
3272
|
"--vram-reserve-mib",
|
|
3273
3273
|
"{vram_reserve_mib}",
|
|
3274
3274
|
"--tail-skip",
|
|
3275
|
-
"0"
|
|
3275
|
+
"0",
|
|
3276
|
+
"--ram-experts-mib",
|
|
3277
|
+
"6144"
|
|
3276
3278
|
],
|
|
3277
3279
|
"cwd": "{deploy_dir}",
|
|
3278
3280
|
"tokenizer": "{deploy_dir}/tokenizer",
|
|
@@ -3280,7 +3282,8 @@
|
|
|
3280
3282
|
"display_name": "Qwen3.6-35B-A3B UD-Q3_K_M",
|
|
3281
3283
|
"log": "{deploy_dir}/engine.log",
|
|
3282
3284
|
"lib_dirs": [
|
|
3283
|
-
"{engine_dir}"
|
|
3285
|
+
"{engine_dir}",
|
|
3286
|
+
"{engine_dir}/nvidia/cu13/bin/x86_64"
|
|
3284
3287
|
],
|
|
3285
3288
|
"host": "127.0.0.1",
|
|
3286
3289
|
"parallel": 1,
|
|
@@ -3300,7 +3303,7 @@
|
|
|
3300
3303
|
],
|
|
3301
3304
|
"health_path": "/health",
|
|
3302
3305
|
"verify_timeout_s": 1800,
|
|
3303
|
-
"note": "Qwen3.6-35B-A3B UD-Q3_K_M on PolyStrata's strata-poly engine (0.1.45-poly.9) for 8 GB cards with 32 GB of memory: the engine fills the card with the experts it uses most and keeps the rest in host RAM, so a 35B model with 3B active runs where the weights do not fit. 64K window, one request at a time, --tail-skip 0 (upstream's default of 6 skips expert rows).\nSP9I (2026-11-11, this engine build, installed by stack apply into an 8 GB share of a 96 GB card): acceptance 9/9, whole-card peak 7626 MiB during a 59.5K-token prompt with this recipe's 1152 MiB reserve (8138 MiB with 640, too close to an 8 GB card's 8192), anonymous memory at most 2.7 GiB, 100 tok/s after the 59.5K prompt on server-class CPU and memory. No real 8 GB card or desktop CPU was measured; speed there will be lower (upstream: 42-46 tok/s after 64K on an RTX 4070 Laptop).\nIts memory is mostly page cache of the GGUF; the service ceiling bounds it, and --conversation-cache-mib auto parks idle conversations inside that ceiling.\nGreedy output is not bit-reproducible between requests: the split of experts between card and CPU follows use (SPOLY).\nText only: the picture reader (strata-vision) is not in the engine build, so image input is off for this recipe.",
|
|
3306
|
+
"note": "Qwen3.6-35B-A3B UD-Q3_K_M on PolyStrata's strata-poly engine (0.1.45-poly.9) for 8 GB cards with 32 GB of memory: the engine fills the card with the experts it uses most and keeps the rest in host RAM, so a 35B model with 3B active runs where the weights do not fit. 64K window, one request at a time, --tail-skip 0 (upstream's default of 6 skips expert rows).\nSP9I (2026-11-11, this engine build, installed by stack apply into an 8 GB share of a 96 GB card): acceptance 9/9, whole-card peak 7626 MiB during a 59.5K-token prompt with this recipe's 1152 MiB reserve (8138 MiB with 640, too close to an 8 GB card's 8192), anonymous memory at most 2.7 GiB, 100 tok/s after the 59.5K prompt on server-class CPU and memory. No real 8 GB card or desktop CPU was measured; speed there will be lower (upstream: 42-46 tok/s after 64K on an RTX 4070 Laptop).\n--ram-experts-mib 6144 holds 6 GiB of the experts outside VRAM in RAM and leaves the rest in the file cache. Measured 2026-11-20 on an RTX 4070 Laptop (8 GB) with 32 GB, Windows 11, this engine build started with this recipe's planned command: 2.9 GiB of experts in VRAM, 10.8 GiB outside; engine working set at most 7.6 GiB and private memory at most 10.0 GiB during a 64K-token prompt; the 9 GiB memory estimate Windows plans are priced by is that working set and the server's with a margin, since Windows prices against available physical memory; 52 tok/s in a short chat, 46 tok/s after the 64K prompt, 69 tok/s over a 1,024-token answer.\nIts memory is mostly page cache of the GGUF; the service ceiling bounds it, and --conversation-cache-mib auto parks idle conversations inside that ceiling.\nGreedy output is not bit-reproducible between requests: the split of experts between card and CPU follows use (SPOLY).\nText only: the picture reader (strata-vision) is not in the engine build, so image input is off for this recipe.",
|
|
3304
3307
|
"quality": {
|
|
3305
3308
|
"score": 35,
|
|
3306
3309
|
"sources": [
|
|
@@ -3367,7 +3370,7 @@
|
|
|
3367
3370
|
"STRATA_ENGINE_READY_S": "1800"
|
|
3368
3371
|
},
|
|
3369
3372
|
"profile": {
|
|
3370
|
-
"exe": "{
|
|
3373
|
+
"exe": "{engine}",
|
|
3371
3374
|
"args": [
|
|
3372
3375
|
"--model",
|
|
3373
3376
|
"{model}",
|
|
@@ -3380,7 +3383,9 @@
|
|
|
3380
3383
|
"--vram-reserve-mib",
|
|
3381
3384
|
"{vram_reserve_mib}",
|
|
3382
3385
|
"--tail-skip",
|
|
3383
|
-
"0"
|
|
3386
|
+
"0",
|
|
3387
|
+
"--ram-experts-mib",
|
|
3388
|
+
"6144"
|
|
3384
3389
|
],
|
|
3385
3390
|
"cwd": "{deploy_dir}",
|
|
3386
3391
|
"tokenizer": "{deploy_dir}/tokenizer",
|
|
@@ -3388,7 +3393,8 @@
|
|
|
3388
3393
|
"display_name": "Qwen3.6-35B-A3B UD-Q4_K_M",
|
|
3389
3394
|
"log": "{deploy_dir}/engine.log",
|
|
3390
3395
|
"lib_dirs": [
|
|
3391
|
-
"{engine_dir}"
|
|
3396
|
+
"{engine_dir}",
|
|
3397
|
+
"{engine_dir}/nvidia/cu13/bin/x86_64"
|
|
3392
3398
|
],
|
|
3393
3399
|
"host": "127.0.0.1",
|
|
3394
3400
|
"parallel": 1,
|
|
@@ -3408,7 +3414,7 @@
|
|
|
3408
3414
|
],
|
|
3409
3415
|
"health_path": "/health",
|
|
3410
3416
|
"verify_timeout_s": 1800,
|
|
3411
|
-
"note": "Qwen3.6-35B-A3B UD-Q4_K_M on PolyStrata's strata-poly engine (0.1.45-poly.9) for 12 GB cards with 32 GB of memory: the engine fills the card with the experts it uses most and keeps the rest in host RAM, so a 35B model with 3B active runs where the weights do not fit. 64K window, one request at a time, --tail-skip 0 (upstream's default of 6 skips expert rows).\nSP9I (2026-11-11, this engine build, installed by stack apply into a 12 GB share of a 96 GB card): acceptance 9/9 with this recipe's 1280 MiB reserve, whole-card peak 11682 MiB during a 59.5K-token prompt (11788 MiB with 1152, 12 MiB above the card less 512 MiB); cgroup peak up to 26.9 GB under a 28 GB ceiling, nearly all page cache, anonymous memory at most 2.7 GiB; 94-104 tok/s after the 59K prompt on server-class CPU and memory. No real 12 GB card or desktop CPU was measured.\nIts memory is mostly page cache of the GGUF; the service ceiling bounds it, and --conversation-cache-mib auto parks idle conversations inside that ceiling.\nGreedy output is not bit-reproducible between requests: the split of experts between card and CPU follows use (SPOLY).\nText only: the picture reader (strata-vision) is not in the engine build, so image input is off for this recipe.",
|
|
3417
|
+
"note": "Qwen3.6-35B-A3B UD-Q4_K_M on PolyStrata's strata-poly engine (0.1.45-poly.9) for 12 GB cards with 32 GB of memory: the engine fills the card with the experts it uses most and keeps the rest in host RAM, so a 35B model with 3B active runs where the weights do not fit. 64K window, one request at a time, --tail-skip 0 (upstream's default of 6 skips expert rows).\nSP9I (2026-11-11, this engine build, installed by stack apply into a 12 GB share of a 96 GB card): acceptance 9/9 with this recipe's 1280 MiB reserve, whole-card peak 11682 MiB during a 59.5K-token prompt (11788 MiB with 1152, 12 MiB above the card less 512 MiB); cgroup peak up to 26.9 GB under a 28 GB ceiling, nearly all page cache, anonymous memory at most 2.7 GiB; 94-104 tok/s after the 59K prompt on server-class CPU and memory. No real 12 GB card or desktop CPU was measured.\n--ram-experts-mib 6144 as in the Q3 recipe. Measured 2026-11-20 on an RTX 4090 D held to a 12 GB card's budget, Linux, this engine build started with this recipe's planned command in a 9 GiB cgroup: 7.1 GiB of experts in VRAM, 11.6 GiB outside; engine resident memory at most 7.9 GiB, anonymous memory at most 2.3 GiB; 33 tok/s in a short chat, 22 tok/s after a 64K-token prompt, 50 tok/s over a 1,024-token answer. The memory estimate and the service ceilings are unchanged.\nIts memory is mostly page cache of the GGUF; the service ceiling bounds it, and --conversation-cache-mib auto parks idle conversations inside that ceiling.\nGreedy output is not bit-reproducible between requests: the split of experts between card and CPU follows use (SPOLY).\nText only: the picture reader (strata-vision) is not in the engine build, so image input is off for this recipe.",
|
|
3412
3418
|
"quality": {
|
|
3413
3419
|
"score": 36,
|
|
3414
3420
|
"sources": [
|
|
@@ -3854,47 +3860,6 @@
|
|
|
3854
3860
|
},
|
|
3855
3861
|
"note": "Kokoro-82M v1.0 FP32 ONNX (thewh1teagle/kokoro-onnx release model-files-v1.0, an export of hexgrad/Kokoro-82M) for debugging and tests: stack plan installs it only on --tts, never under --aux auto; not a product capability. tts_server.py serves OpenAI-style POST /v1/audio/speech (WAV only, 24 kHz mono, at most 2000 characters, one synthesis at a time) in the kokoro-tts-0.6.1.txt venv behind auth_proxy.py; 54 voices, z* through misaki's Chinese G2P, others through espeak-ng. FP32 is faster than INT8 on CPU (lab-12021 2026-10-16: RTF 0.55-0.57 at 2 threads vs 1.63). local-118 2026-10-27, 2 threads: 2.5 s English in 1.4 s, 2000 Chinese characters (408 s audio) in 177 s, peak RSS 1.77 GiB. Magpie has no /v1/audio/speech route, so clients call the service directly. Real stack apply --tts acceptance on lab-12021 2026-10-27 (evidence/2026-10-27-tts-stack-apply-lab12021); thread/load tuning on local-118 the same day: 2 threads holds for all lengths, 4 threads ~1.5x on long text but needs CPUQuota=400%, peak RSS 2037 MiB sits ~10 MiB under MemoryHigh=2G (evidence/2026-10-27-tts-kokoro-tuning-local118)."
|
|
3856
3862
|
},
|
|
3857
|
-
{
|
|
3858
|
-
"id": "ddgs-search",
|
|
3859
|
-
"task": "search",
|
|
3860
|
-
"runtime": "ddgs-cpu",
|
|
3861
|
-
"version": "9.16.1",
|
|
3862
|
-
"repo": "deedy5/ddgs",
|
|
3863
|
-
"revision": "v9.16.1",
|
|
3864
|
-
"license": "MIT",
|
|
3865
|
-
"license_url": "https://pypi.org/project/ddgs/9.16.1/",
|
|
3866
|
-
"status": "candidate",
|
|
3867
|
-
"tasks": [
|
|
3868
|
-
"search"
|
|
3869
|
-
],
|
|
3870
|
-
"evidence": [
|
|
3871
|
-
"evidence/2026-10-31-search-ddgs-lab12021/REPORT.md"
|
|
3872
|
-
],
|
|
3873
|
-
"memory_estimate_bytes": 104857600,
|
|
3874
|
-
"venv": "search-ddgs-9.16.1.txt",
|
|
3875
|
-
"venv_bytes": 52428800,
|
|
3876
|
-
"alias": "ddgs",
|
|
3877
|
-
"contract": "search",
|
|
3878
|
-
"port": 18390,
|
|
3879
|
-
"threads": 1,
|
|
3880
|
-
"limits": {
|
|
3881
|
-
"MemoryHigh": "100M",
|
|
3882
|
-
"MemoryMax": "150M",
|
|
3883
|
-
"CPUQuota": "100%"
|
|
3884
|
-
},
|
|
3885
|
-
"argv": [
|
|
3886
|
-
"{engine}",
|
|
3887
|
-
"-I",
|
|
3888
|
-
"{search_server}",
|
|
3889
|
-
"--host",
|
|
3890
|
-
"127.0.0.1",
|
|
3891
|
-
"--port",
|
|
3892
|
-
"{port}"
|
|
3893
|
-
],
|
|
3894
|
-
"health_path": "/health",
|
|
3895
|
-
"files": [],
|
|
3896
|
-
"note": "Free web search for Magpie, on by default in stack plan (--no-search leaves it out). search_server.py answers Magpie's searxng search API (GET /search?q=&format=json, SearXNG results) on loopback in the search-ddgs-9.16.1.txt venv, through ddgs with primp's browser TLS fingerprint: DuckDuckGo first, then yahoo, brave and mojeek, one engine at a time; an engine that failed rests 120 s. stack apply adds Magpie's own You.com search API (no key, 100 searches a day) after it: when the service answers 502 (no engine answered) Magpie asks You.com, and asks searxng first again next time (checked with Magpie 0.1.1296, 2026-10-31). No engine needs a key, so the service holds no secret, takes no API key and listens on 127.0.0.1 only; queries leave the computer for those engines. Plain HTTP clients get DuckDuckGo's anti-bot page from lab-12021, and ddgs itself is throttled after a burst (202 anti-bot page, brave 429), so results vary with the engines' rate limits. lab-12021 2026-10-31 (evidence/2026-10-31-search-ddgs-lab12021): stack apply installed and verified it (7 results via yahoo, 13 s; ~30 MB resident) and Magpie 3425 took it as its searxng API, but after a day of probing that IP every engine was throttled (2 of 5 searches answered), so it stays a candidate until results hold over time."
|
|
3897
|
-
},
|
|
3898
3863
|
{
|
|
3899
3864
|
"id": "d3-edge-q8",
|
|
3900
3865
|
"task": "decision",
|
|
@@ -17,7 +17,7 @@ SCHEMA_VERSION = 3
|
|
|
17
17
|
STATUSES = ("candidate", "validated", "deprecated")
|
|
18
18
|
PLATFORMS = ("linux", "darwin", "win32") # validated_on: Linux, Apple Silicon Macs, Windows
|
|
19
19
|
EFFORT_LEVELS = ("low", "medium", "high") # reasoning_effort values a gateway may send, in order
|
|
20
|
-
TASKS = tuple("llm vision decision embedding reranker stt tts
|
|
20
|
+
TASKS = tuple("llm vision decision embedding reranker stt tts privacy-span".split())
|
|
21
21
|
# Model-card families Linger's LocalModelFamily knows (its contract); "other" for the rest.
|
|
22
22
|
FAMILIES = tuple("qwen gemma llama openai deepseek mistral phi glm kimi claude grok other".split())
|
|
23
23
|
SCALE = r"[1-9][0-9]*(\.[0-9]+)?[BM]" # a parameter scale as a model's name states it: 27B, 1.7B
|
|
@@ -552,7 +552,6 @@ def _install_direct_pi_gateway() -> None:
|
|
|
552
552
|
"""Offline fallback for ``simulate`` when Bifrost is unavailable or ``offline_gateway`` is set."""
|
|
553
553
|
from localmodels import bifrost_models, library_gateway
|
|
554
554
|
from localmodels import catalog as cat
|
|
555
|
-
from localmodels.library_model import display_name, split_id
|
|
556
555
|
from localmodels.library_state import Registration
|
|
557
556
|
|
|
558
557
|
original_register = library_gateway.register
|
|
@@ -568,14 +567,7 @@ def _install_direct_pi_gateway() -> None:
|
|
|
568
567
|
stack_provider: str | None = None,
|
|
569
568
|
) -> Registration:
|
|
570
569
|
added = library_gateway.planned(model, plan, stack_provider=stack_provider)
|
|
571
|
-
|
|
572
|
-
context = int(str(plan["launch"].get("window") or 0)) or bifrost_models.DEFAULT_CONTEXT
|
|
573
|
-
facts_: bifrost_models.LlmFacts = {
|
|
574
|
-
"display": display_name(entry.display_name, split_id(model)[1]),
|
|
575
|
-
"context": context,
|
|
576
|
-
"efforts": levels,
|
|
577
|
-
"defaultEffort": bifrost_models.default_effort(levels),
|
|
578
|
-
}
|
|
570
|
+
facts_ = library_gateway.model_facts(model, entry, plan)
|
|
579
571
|
base_url = str(plan["endpoint"]["base_url"]).removesuffix("/v1").rstrip("/")
|
|
580
572
|
served = str(plan["endpoint"]["model"])
|
|
581
573
|
pi_entry = bifrost_models.pi_provider(facts_, served, base_url)["models"][0]
|
|
@@ -680,7 +672,6 @@ def _install_simulate_mode(config: DebugConfig) -> None:
|
|
|
680
672
|
if config.offline_gateway:
|
|
681
673
|
from localmodels import bifrost_models
|
|
682
674
|
from localmodels import catalog as cat
|
|
683
|
-
from localmodels.library_model import display_name, split_id
|
|
684
675
|
from localmodels.library_state import Registration
|
|
685
676
|
|
|
686
677
|
def offline_only_register(
|
|
@@ -694,14 +685,7 @@ def _install_simulate_mode(config: DebugConfig) -> None:
|
|
|
694
685
|
) -> Registration:
|
|
695
686
|
_ = key, facts
|
|
696
687
|
added = library_gateway.planned(model, plan, stack_provider=stack_provider)
|
|
697
|
-
|
|
698
|
-
context = int(str(plan["launch"].get("window") or 0)) or bifrost_models.DEFAULT_CONTEXT
|
|
699
|
-
facts_: bifrost_models.LlmFacts = {
|
|
700
|
-
"display": display_name(entry.display_name, split_id(model)[1]),
|
|
701
|
-
"context": context,
|
|
702
|
-
"efforts": levels,
|
|
703
|
-
"defaultEffort": bifrost_models.default_effort(levels),
|
|
704
|
-
}
|
|
688
|
+
facts_ = library_gateway.model_facts(model, entry, plan)
|
|
705
689
|
base_url = str(plan["endpoint"]["base_url"]).removesuffix("/v1").rstrip("/")
|
|
706
690
|
served = str(plan["endpoint"]["model"])
|
|
707
691
|
pi_entry = bifrost_models.pi_provider(facts_, served, base_url)["models"][0]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"tag": "strata-poly-0.1.45-poly.9",
|
|
4
4
|
"commit": "v0.1.45-poly.9",
|
|
5
5
|
"source": "https://github.com/simplexai-labs/PolyStrata/releases/tag/v0.1.45-poly.9",
|
|
6
|
-
"note": "PolyStrata 0.1.45-poly.9 (MIT, commit 83a7a332), built by this project on 2026-11-11 because upstream publishes only a Windows engine. The engine archive holds the strata-poly binary, PolyStrata's Python server (serve/) and tokenizer tool (tools/) as released, their licenses and BUILD.json; the second archive holds the CUDA 13.0.3 runtime libraries the binary loads (libcublas, libcublasLt, libcudart), under NVIDIA's license. Both unpack into one directory, which the service puts on LD_LIBRARY_PATH. Built in nvidia/cuda:13.0.3-devel-ubuntu22.04 without a GPU, with upstream's Windows release flags: -DSTRATA_PORTABLE=ON (AVX2 CPU baseline) and CUDA architectures 75, 80, 86, 89 and 120 (RTX 20, 30, 40 and 50 series). Needs an NVIDIA driver for CUDA 13.0 (580 or newer), glibc 2.34 and libstdc++ 12 (Ubuntu 22.04, Debian 12 or newer). The picture reader (strata-vision) is not built. Sources: PolyStrata tag archive sha256 eeeb605b..., llama.cpp 3cf03257 archive sha256 cbe23c59... (the full digests are in BUILD.json).",
|
|
6
|
+
"note": "PolyStrata 0.1.45-poly.9 (MIT, commit 83a7a332), built by this project on 2026-11-11 because upstream publishes only a Windows engine. The engine archive holds the strata-poly binary, PolyStrata's Python server (serve/) and tokenizer tool (tools/) as released, their licenses and BUILD.json; the second archive holds the CUDA 13.0.3 runtime libraries the binary loads (libcublas, libcublasLt, libcudart), under NVIDIA's license. Both unpack into one directory, which the service puts on LD_LIBRARY_PATH. Built in nvidia/cuda:13.0.3-devel-ubuntu22.04 without a GPU, with upstream's Windows release flags: -DSTRATA_PORTABLE=ON (AVX2 CPU baseline) and CUDA architectures 75, 80, 86, 89 and 120 (RTX 20, 30, 40 and 50 series). Needs an NVIDIA driver for CUDA 13.0 (580 or newer), glibc 2.34 and libstdc++ 12 (Ubuntu 22.04, Debian 12 or newer). The picture reader (strata-vision) is not built. Sources: PolyStrata tag archive sha256 eeeb605b..., llama.cpp 3cf03257 archive sha256 cbe23c59... (the full digests are in BUILD.json). The Windows build is upstream's own release zip (strata-poly.exe, CUDA 13.0, the same CUDA architectures), which holds no server: the tag archive beside it supplies serve/ and tools/, and NVIDIA's cuBLAS 13.0.2.14 wheel (the version upstream's setup.py installs on Windows) supplies cublas64_13.dll under nvidia/cu13/bin/x86_64, the directory the recipes' lib_dirs put on the engine's PATH.",
|
|
7
7
|
"builds": [
|
|
8
8
|
{
|
|
9
9
|
"platform": "linux",
|
|
@@ -30,6 +30,46 @@
|
|
|
30
30
|
"size_bytes": 422462968
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"platform": "win32",
|
|
36
|
+
"arch": "x64",
|
|
37
|
+
"backend": "cuda",
|
|
38
|
+
"min_cuda": "13.0",
|
|
39
|
+
"binary": "strata-poly.exe",
|
|
40
|
+
"assets": [
|
|
41
|
+
{
|
|
42
|
+
"name": "strata-poly-windows-x64-66af087edd486c6d.zip",
|
|
43
|
+
"url": "https://github.com/simplexai-labs/PolyStrata/releases/download/v0.1.45-poly.9/strata-poly-windows-x64-66af087edd486c6d.zip",
|
|
44
|
+
"sha256": "68b344cc4cbaa4afedbe292d3b26ad778801de2ac9c2fbc0cff531b58e4bae92",
|
|
45
|
+
"size_bytes": 170179677,
|
|
46
|
+
"npm_copy": {
|
|
47
|
+
"package": "@simplexai/engine-strata-poly-windows-x64-66af087edd486c6d",
|
|
48
|
+
"version": "0.0.0-sha256-68b344cc4cbaa4af"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "polystrata-0.1.45-poly.9-source.tar.gz",
|
|
53
|
+
"url": "https://github.com/simplexai-labs/PolyStrata/archive/refs/tags/v0.1.45-poly.9.tar.gz",
|
|
54
|
+
"sha256": "eeeb605b26e7e5d06bf4990b1ed14d2f0ae857d9bc304243593561cd740d5505",
|
|
55
|
+
"size_bytes": 25580808,
|
|
56
|
+
"members": [
|
|
57
|
+
"serve/",
|
|
58
|
+
"tools/",
|
|
59
|
+
"LICENSE"
|
|
60
|
+
],
|
|
61
|
+
"npm_copy": {
|
|
62
|
+
"package": "@simplexai/engine-polystrata-0.1.45-poly.9-source",
|
|
63
|
+
"version": "0.0.0-sha256-eeeb605b26e7e5d0"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "nvidia_cublas-13.0.2.14-py3-none-win_amd64.whl",
|
|
68
|
+
"url": "https://files.pythonhosted.org/packages/f3/91/bda39230b7a4c102bb724c21b50823efc63544490a885fea0b604911c0ab/nvidia_cublas-13.0.2.14-py3-none-win_amd64.whl",
|
|
69
|
+
"sha256": "5f7a90456b1392db60e28719547ba6e00696bfa81304b6887cf287f9edf2c1d7",
|
|
70
|
+
"size_bytes": 401887280
|
|
71
|
+
}
|
|
72
|
+
]
|
|
33
73
|
}
|
|
34
74
|
]
|
|
35
75
|
}
|
|
@@ -37,8 +37,9 @@ def _version(text: str | None) -> tuple[int, ...]:
|
|
|
37
37
|
return tuple(int(x) for x in re.findall(r"\d+", text or "")[:2])
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def _cuda_tuple(version: str) -> tuple[int,
|
|
41
|
-
|
|
40
|
+
def _cuda_tuple(version: str) -> tuple[int, int]:
|
|
41
|
+
parts = [int(x) for x in re.findall(r"\d+", version)[:2]]
|
|
42
|
+
return (parts[0], parts[1] if len(parts) > 1 else 0) if parts else (0, 0)
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
def engine_lock_path(tag: str | None = None) -> Path:
|
|
@@ -75,9 +76,12 @@ def select_engine_build(
|
|
|
75
76
|
for b in lock["builds"]
|
|
76
77
|
if b["platform"] == platform and b["arch"] == facts.get("arch") and b["backend"] in accepted
|
|
77
78
|
]
|
|
78
|
-
|
|
79
|
+
platform_builds = builds
|
|
80
|
+
driver_cuda = ""
|
|
81
|
+
driver = (0, 0)
|
|
79
82
|
if backend == "cuda":
|
|
80
|
-
|
|
83
|
+
driver_cuda = ((facts.get("nvidia") or {}).get("cuda_version") or "").strip()
|
|
84
|
+
driver = _cuda_tuple(driver_cuda)
|
|
81
85
|
builds = [b for b in builds if _cuda_tuple(b["min_cuda"]) <= driver]
|
|
82
86
|
builds.sort(
|
|
83
87
|
key=lambda b: (_cuda_tuple(b.get("min_cuda", "")), _version(b.get("min_glibc"))),
|
|
@@ -102,9 +106,18 @@ def select_engine_build(
|
|
|
102
106
|
"host; this tool does not install system packages"
|
|
103
107
|
)
|
|
104
108
|
if not builds:
|
|
109
|
+
detail = ""
|
|
110
|
+
if backend == "cuda" and platform_builds:
|
|
111
|
+
oldest = min((b["min_cuda"] for b in platform_builds), key=_cuda_tuple)
|
|
112
|
+
if driver == (0, 0):
|
|
113
|
+
detail = f" (could not detect the driver's CUDA version; requires CUDA >= {oldest})"
|
|
114
|
+
else:
|
|
115
|
+
detail = (
|
|
116
|
+
f" (the driver supports CUDA {driver_cuda}, "
|
|
117
|
+
f"older than the required CUDA >= {oldest})"
|
|
118
|
+
)
|
|
105
119
|
raise PlanError(
|
|
106
|
-
f"no {lock['tag']} prebuilt engine for {platform}/{facts.get('arch')}/{backend}"
|
|
107
|
-
+ (" (the driver supports too old a CUDA version)" if for_platform else "")
|
|
120
|
+
f"no {lock['tag']} prebuilt engine for {platform}/{facts.get('arch')}/{backend}{detail}"
|
|
108
121
|
)
|
|
109
122
|
return {"tag": lock["tag"], "commit": lock["commit"], **builds[0]}
|
|
110
123
|
|
|
@@ -8,6 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
import http.client
|
|
9
9
|
import json
|
|
10
10
|
import os
|
|
11
|
+
import re
|
|
11
12
|
import secrets
|
|
12
13
|
import shutil
|
|
13
14
|
import subprocess
|
|
@@ -15,7 +16,7 @@ import time
|
|
|
15
16
|
from collections.abc import Callable
|
|
16
17
|
from http.cookies import SimpleCookie
|
|
17
18
|
from pathlib import Path
|
|
18
|
-
from typing import TypedDict
|
|
19
|
+
from typing import Literal, TypedDict
|
|
19
20
|
|
|
20
21
|
from localmodels import (
|
|
21
22
|
gateway_accept,
|
|
@@ -34,12 +35,8 @@ from localmodels import (
|
|
|
34
35
|
from localmodels.contracts import decode
|
|
35
36
|
from localmodels.gateway_requests import PI_ACCEPT_FLAGS as PI_ACCEPT_FLAGS
|
|
36
37
|
from localmodels.gateway_requests import AuxEndpoint as AuxEndpoint
|
|
38
|
+
from localmodels.gateway_requests import Check as Check
|
|
37
39
|
from localmodels.gateway_requests import post as _post
|
|
38
|
-
from localmodels.gateway_search import SEARCH as SEARCH
|
|
39
|
-
from localmodels.gateway_search import Check as Check
|
|
40
|
-
from localmodels.gateway_search import search_url as search_url
|
|
41
|
-
from localmodels.gateway_search import unwire as unwire_search
|
|
42
|
-
from localmodels.gateway_search import wire_search
|
|
43
40
|
from localmodels.harness import (
|
|
44
41
|
Endpoint,
|
|
45
42
|
GatewayPlan,
|
|
@@ -69,7 +66,7 @@ AUX_PROVIDERS = {
|
|
|
69
66
|
"rerank": "localmodels-rerank",
|
|
70
67
|
"stt": "localmodels-stt",
|
|
71
68
|
}
|
|
72
|
-
WIRED = (
|
|
69
|
+
WIRED = tuple(AUX_PROVIDERS)
|
|
73
70
|
FOUNDATION_PROVIDERS = {
|
|
74
71
|
AUX_PROVIDERS["embedding"],
|
|
75
72
|
AUX_PROVIDERS["rerank"],
|
|
@@ -410,13 +407,6 @@ def wire(
|
|
|
410
407
|
)
|
|
411
408
|
hosts.own_gateway(tools_dir, "rule", gw["intent"])
|
|
412
409
|
done.append(f"rule intent → {llm_model}:{hard} (classifier {classifier})")
|
|
413
|
-
for ep in aux:
|
|
414
|
-
if ep["contract"] == SEARCH:
|
|
415
|
-
try:
|
|
416
|
-
done += wire_search(plan, search_url(ep))
|
|
417
|
-
except HarnessError as exc: # acceptance's search check reports it as failed
|
|
418
|
-
done.append(f"search not wired: {exc}")
|
|
419
|
-
|
|
420
410
|
if select_pi:
|
|
421
411
|
done.append(point_pi(plan, gw["pi_model_before"], f"group/{gw['group']}"))
|
|
422
412
|
done += gateway_clients.wire(plan)
|
|
@@ -565,10 +555,55 @@ def _unwire_magpie(
|
|
|
565
555
|
gone = _magpie(target, "provider", pid, timeout=20).returncode != 0
|
|
566
556
|
if gone or run(f"provider rm {pid}", "provider", "rm", pid):
|
|
567
557
|
hosts.own_listed(tools_dir, "providers", pid, False)
|
|
568
|
-
results +=
|
|
558
|
+
results += _unwire_search(target, gw.get("search"), bool(gw.get("search_you")), tools_dir)
|
|
569
559
|
return results + gateway_keys.remove(target, caller_keys, tools_dir)
|
|
570
560
|
|
|
571
561
|
|
|
562
|
+
def _search_apis(plan: ToolPlan) -> dict[str, str]:
|
|
563
|
+
"""Magpie's search APIs as {api: URL}. ``magpie search`` lists one per line, as
|
|
564
|
+
``N. SearXNG no key <url> [off]`` or ``N. You.com no key``; the api is the name's first
|
|
565
|
+
word in lower case (``you``)."""
|
|
566
|
+
out = _magpie(plan, "search", timeout=20)
|
|
567
|
+
if out.returncode != 0:
|
|
568
|
+
raise HarnessError(f"magpie search failed (exit {out.returncode})")
|
|
569
|
+
found: dict[str, str] = {}
|
|
570
|
+
for line in out.stdout.splitlines():
|
|
571
|
+
match = re.match(r"\s*\d+\.\s+(\S+)(.*)$", line)
|
|
572
|
+
if match:
|
|
573
|
+
url = next((w for w in match.group(2).split() if w.startswith("http")), "")
|
|
574
|
+
found[match.group(1).split(".")[0].lower()] = url
|
|
575
|
+
return found
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
def _unwire_search(plan: ToolPlan, url: str | None, you: bool, tools_dir: str) -> list[Check]:
|
|
579
|
+
"""Take out the searxng and You.com search APIs the manifest says this tool added to Magpie
|
|
580
|
+
for the web search service the stack used to run. A searxng someone has pointed elsewhere
|
|
581
|
+
since is theirs now, and only the manifest forgets it."""
|
|
582
|
+
if not (url or you):
|
|
583
|
+
return []
|
|
584
|
+
try:
|
|
585
|
+
listed = _search_apis(plan)
|
|
586
|
+
except HarnessError as exc:
|
|
587
|
+
return [{"check": "search rm", "ok": False, "detail": str(exc)}]
|
|
588
|
+
entries: list[tuple[str, bool, Literal["search", "search_you"]]] = []
|
|
589
|
+
if url:
|
|
590
|
+
entries.append(("searxng", listed.get("searxng") == url, "search"))
|
|
591
|
+
if you:
|
|
592
|
+
entries.append(("you", "you" in listed, "search_you"))
|
|
593
|
+
checks: list[Check] = []
|
|
594
|
+
for api, ours, field in entries:
|
|
595
|
+
if ours:
|
|
596
|
+
out = _magpie(plan, "search", "rm", api, timeout=60)
|
|
597
|
+
detail = " ".join((out.stdout + out.stderr).split())[-200:]
|
|
598
|
+
checks.append(
|
|
599
|
+
{"check": f"search rm {api}", "ok": out.returncode == 0, "detail": detail}
|
|
600
|
+
)
|
|
601
|
+
if out.returncode != 0:
|
|
602
|
+
continue
|
|
603
|
+
hosts.forget_search(tools_dir, field)
|
|
604
|
+
return checks
|
|
605
|
+
|
|
606
|
+
|
|
572
607
|
# ---------------------------------------------------------------------------- acceptance
|
|
573
608
|
|
|
574
609
|
|
|
@@ -14,8 +14,14 @@ from typing import Any
|
|
|
14
14
|
|
|
15
15
|
from localmodels import gateway_clients, harness, harness_gateway
|
|
16
16
|
from localmodels.contracts import decode
|
|
17
|
-
from localmodels.gateway_requests import
|
|
18
|
-
|
|
17
|
+
from localmodels.gateway_requests import (
|
|
18
|
+
PI_ACCEPT_FLAGS,
|
|
19
|
+
AuxEndpoint,
|
|
20
|
+
Check,
|
|
21
|
+
aux_answer,
|
|
22
|
+
post,
|
|
23
|
+
text,
|
|
24
|
+
)
|
|
19
25
|
from localmodels.harness import HarnessPlan, ToolPlan
|
|
20
26
|
from localmodels.remote_ops import DECISION_QUESTION, DECISION_STATE, TOUCH_EXPECT, TOUCH_PROMPT
|
|
21
27
|
|
|
@@ -158,9 +164,6 @@ def accept(
|
|
|
158
164
|
f"Magpie routing calls to {decider}: {before} → {after}",
|
|
159
165
|
)
|
|
160
166
|
for ep in aux:
|
|
161
|
-
if ep["contract"] == SEARCH:
|
|
162
|
-
checks += search_checks(plan, search_url(ep), timeout)
|
|
163
|
-
continue
|
|
164
167
|
pid = aux_providers[ep["contract"]]
|
|
165
168
|
name = f"gateway {ep['contract']} {pid}/{ep['model']}"
|
|
166
169
|
before = calls_fn(plan, pid, None)
|