@simplexai/localmodels-linux-x64 0.1.0-dev.32.build.git9f03dd7a81cec1338df8eaf613ec9e3013365c9c → 0.1.0-dev.35
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 +138 -97
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +4 -0
- package/modules/localmodels/app.py +7 -2
- package/modules/localmodels/approval.py +4 -4
- package/modules/localmodels/bifrost_checks.py +121 -3
- package/modules/localmodels/bifrost_provider.py +53 -0
- package/modules/localmodels/bifrost_unit.py +32 -1
- package/modules/localmodels/budget.py +5 -1
- package/modules/localmodels/catalog.json +51 -10
- package/modules/localmodels/catalog.py +30 -29
- package/modules/localmodels/catalog_add.py +1 -0
- package/modules/localmodels/cli_parser.py +10 -2
- package/modules/localmodels/component.py +7 -1
- package/modules/localmodels/decode_calibration.json +6 -0
- package/modules/localmodels/decode_calibration.py +104 -0
- package/modules/localmodels/deploy.py +44 -7
- package/modules/localmodels/deploy_steps.py +10 -1
- package/modules/localmodels/engines-strata-0.1.49.2.json +31 -0
- package/modules/localmodels/engines.json +57 -1
- package/modules/localmodels/engines.py +6 -2
- package/modules/localmodels/estimator.py +21 -7
- package/modules/localmodels/frontend.py +4 -4
- package/modules/localmodels/gateway.py +14 -4
- package/modules/localmodels/gateway_app_bifrost.py +4 -3
- package/modules/localmodels/gateway_bifrost.py +70 -57
- package/modules/localmodels/gateway_probe.py +3 -4
- package/modules/localmodels/gguf.py +7 -0
- package/modules/localmodels/harness.py +24 -25
- package/modules/localmodels/harness_gateway.py +19 -10
- package/modules/localmodels/harness_probe.py +33 -6
- package/modules/localmodels/hosts.py +73 -9
- package/modules/localmodels/install.py +36 -6
- package/modules/localmodels/library_cli.py +179 -0
- package/modules/localmodels/library_convert.py +132 -0
- package/modules/localmodels/library_gateway.py +471 -0
- package/modules/localmodels/library_jobs.py +314 -0
- package/modules/localmodels/library_model.py +246 -0
- package/modules/localmodels/library_pricing.py +347 -0
- package/modules/localmodels/library_serve.py +348 -0
- package/modules/localmodels/library_state.py +373 -0
- package/modules/localmodels/library_status.py +349 -0
- package/modules/localmodels/llm_rank.py +16 -2
- package/modules/localmodels/memcalc.py +7 -30
- package/modules/localmodels/metal.py +26 -0
- package/modules/localmodels/plan_envelope.py +4 -1
- package/modules/localmodels/preparation.py +49 -0
- package/modules/localmodels/probe.py +8 -8
- package/modules/localmodels/process_identity.py +536 -9
- package/modules/localmodels/quant_formats.py +123 -0
- package/modules/localmodels/recommend_cli.py +8 -4
- package/modules/localmodels/records.py +1 -0
- package/modules/localmodels/remote_ops.py +104 -6
- package/modules/localmodels/remote_ops_download.py +17 -2
- package/modules/localmodels/remote_ops_prepare.py +406 -0
- package/modules/localmodels/remote_ops_remove.py +40 -7
- package/modules/localmodels/remote_ops_service.py +110 -8
- package/modules/localmodels/remote_ops_verify.py +15 -2
- package/modules/localmodels/runtime_auth.py +31 -1
- package/modules/localmodels/runtime_cli.py +3 -4
- package/modules/localmodels/runtime_io.py +50 -6
- package/modules/localmodels/service_autostart.py +45 -1
- package/modules/localmodels/service_control.py +13 -0
- package/modules/localmodels/service_deployment.py +12 -3
- package/modules/localmodels/service_jobs.py +33 -4
- package/modules/localmodels/service_probe.py +67 -13
- package/modules/localmodels/service_stop.py +152 -0
- package/modules/localmodels/service_worker.py +9 -1
- package/modules/localmodels/services_cli.py +50 -6
- package/modules/localmodels/setup_inspection.py +34 -25
- package/modules/localmodels/setup_text.py +118 -0
- package/modules/localmodels/sizecalc.py +625 -0
- package/modules/localmodels/sizecalc_cli.py +249 -0
- package/modules/localmodels/stack.py +69 -17
- package/modules/localmodels/stack_args.py +91 -19
- package/modules/localmodels/stack_auto.py +78 -0
- package/modules/localmodels/stack_binding.py +23 -35
- package/modules/localmodels/stack_card.py +195 -0
- package/modules/localmodels/stack_cleanup.py +379 -0
- package/modules/localmodels/stack_clients.py +4 -1
- package/modules/localmodels/stack_compose.py +150 -194
- package/modules/localmodels/stack_console.py +2 -0
- package/modules/localmodels/stack_decision.py +3 -2
- package/modules/localmodels/stack_down.py +189 -0
- package/modules/localmodels/stack_events.py +54 -0
- package/modules/localmodels/stack_hardware.py +22 -23
- package/modules/localmodels/stack_journal.py +29 -8
- package/modules/localmodels/stack_ledger.py +411 -0
- package/modules/localmodels/stack_lifecycle.py +162 -167
- package/modules/localmodels/stack_llm_ram.py +57 -5
- package/modules/localmodels/stack_memory.py +721 -0
- package/modules/localmodels/stack_picks.py +139 -0
- package/modules/localmodels/stack_plan.py +140 -22
- package/modules/localmodels/stack_ports.py +22 -0
- package/modules/localmodels/stack_preflight.py +699 -0
- package/modules/localmodels/stack_review.py +123 -5
- package/modules/localmodels/stack_rollback.py +2 -0
- package/modules/localmodels/stack_route.py +256 -0
- package/modules/localmodels/stack_run.py +11 -0
- package/modules/localmodels/stack_suite.py +102 -17
- package/modules/localmodels/stack_summary.py +65 -4
- package/modules/localmodels/stack_try.py +354 -0
- package/modules/localmodels/stack_try_client.py +194 -0
- package/modules/localmodels/stack_try_docs.py +139 -0
- package/modules/localmodels/stack_up.py +8 -1
- package/modules/localmodels/stack_update.py +29 -4
- package/modules/localmodels/stack_verify.py +3 -1
- package/modules/localmodels/stack_view.py +10 -11
- package/modules/localmodels/stack_view_apply.py +4 -2
- package/modules/localmodels/stack_view_events.py +2 -1
- package/modules/localmodels/stack_view_serve.py +3 -0
- package/modules/localmodels/stack_view_text.py +1 -1
- package/modules/localmodels/stack_view_words.py +4 -1
- package/modules/localmodels/stack_warm.py +574 -0
- package/modules/localmodels/stack_whatif.py +558 -0
- package/modules/localmodels/suite.py +48 -39
- package/modules/localmodels/tool_archive.py +40 -0
- package/modules/localmodels/tools.json +8 -0
- package/modules/localmodels/transport.py +1 -0
- package/modules/localmodels/vision.py +8 -1
- package/modules/localmodels/web/sizecalc/app.js +431 -0
- package/modules/localmodels/web/sizecalc/calc.js +269 -0
- package/modules/localmodels/web/sizecalc/page.html +362 -0
- package/modules/localmodels/web/view/ASSET-SOURCES.md +11 -0
- package/modules/localmodels/web/view/i18n.js +1 -1
- package/modules/localmodels/web/view/logo-claude.svg +3 -0
- package/modules/localmodels/web/view/logo-codex.png +0 -0
- package/modules/localmodels/web/view/logo-pi.svg +6 -0
- package/modules/localmodels/web/view/view.css +4 -0
- package/modules/localmodels/web/view/view.js +15 -6
- package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/METADATA +1 -1
- package/modules/simplex_localmodels-0.1.0.dev35.dist-info/RECORD +241 -0
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/simplex_localmodels-0.1.0.dev32.dist-info/RECORD +0 -200
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -14,11 +14,13 @@ from localmodels import (
|
|
|
14
14
|
guard,
|
|
15
15
|
hosts,
|
|
16
16
|
install,
|
|
17
|
+
library_cli,
|
|
17
18
|
magpie_setup,
|
|
18
19
|
memcalc_cli,
|
|
19
20
|
runtime_args,
|
|
20
21
|
services_cli,
|
|
21
22
|
setup_inspection,
|
|
23
|
+
sizecalc_cli,
|
|
22
24
|
stack,
|
|
23
25
|
stack_lifecycle,
|
|
24
26
|
)
|
|
@@ -31,10 +33,13 @@ Detect this computer's hardware and existing installs, recommend one proven loca
|
|
|
31
33
|
stack, and install and verify it after you approve the plan.
|
|
32
34
|
HOST is "local", a registered device id, or an SSH target."""
|
|
33
35
|
GROUPS = (
|
|
34
|
-
("get started", ("install", "stack", "recommend", "memcalc", "probe", "models")),
|
|
36
|
+
("get started", ("install", "stack", "recommend", "memcalc", "sizecalc", "probe", "models")),
|
|
35
37
|
("one model on any host", ("plan", "deploy", "service", "services")),
|
|
36
38
|
("devices", ("discover", "devices", "desktop-snapshot")),
|
|
37
|
-
(
|
|
39
|
+
(
|
|
40
|
+
"installer integration",
|
|
41
|
+
("setup", "library", "foundations", "harness", "gateway", "magpie", "guard"),
|
|
42
|
+
),
|
|
38
43
|
("interfaces and catalog", ("tui", "serve", "catalog", "commands", "completion")),
|
|
39
44
|
)
|
|
40
45
|
SUMMARIES = {
|
|
@@ -42,6 +47,7 @@ SUMMARIES = {
|
|
|
42
47
|
"gateway": "manage an isolated Magpie gateway without installing models",
|
|
43
48
|
"setup": "read-only setup inspection for installers (JSON)",
|
|
44
49
|
"foundations": "background decision, embedding and reranker services",
|
|
50
|
+
"library": "download, load, unload and remove single models (JSON)",
|
|
45
51
|
"guard": "optional CPU privacy profile; never rewires services",
|
|
46
52
|
"magpie": "Magpie alone for Claude Code/Codex subscriptions (no local model)",
|
|
47
53
|
"catalog": "maintain the model catalog (`add` drafts an entry from a GGUF)",
|
|
@@ -313,10 +319,12 @@ def argument_parser() -> argparse.ArgumentParser:
|
|
|
313
319
|
stack.add_parser(sub)
|
|
314
320
|
magpie_setup.add_parser(sub)
|
|
315
321
|
memcalc_cli.add_parser(sub)
|
|
322
|
+
sizecalc_cli.add_parser(sub)
|
|
316
323
|
runtime_args.add_parser(sub)
|
|
317
324
|
gateway_cli.add_parser(sub)
|
|
318
325
|
setup_inspection.add_parser(sub)
|
|
319
326
|
services_cli.add_parser(sub)
|
|
327
|
+
library_cli.add_parser(sub)
|
|
320
328
|
for name, summary in SUMMARIES.items():
|
|
321
329
|
cli_help.summarize(sub, name, summary)
|
|
322
330
|
cli_help.document(parser, DESCRIPTION, sections=SECTIONS)
|
|
@@ -11,6 +11,7 @@ pinned in the catalog, so planning needs no Hub request.
|
|
|
11
11
|
|
|
12
12
|
from __future__ import annotations
|
|
13
13
|
|
|
14
|
+
import sys
|
|
14
15
|
from dataclasses import dataclass
|
|
15
16
|
from pathlib import Path
|
|
16
17
|
|
|
@@ -122,7 +123,7 @@ def build_plan(host_id: str, facts: HostFacts, options: ComponentOptions) -> Pla
|
|
|
122
123
|
f"the decision model runs on CPU ({threads} threads, prompt cap {ctx} tokens); "
|
|
123
124
|
"past CPU measurements took about 3 s per request, GPU about 0.04 s",
|
|
124
125
|
]
|
|
125
|
-
if facts["service_manager"]["kind"] == "nohup":
|
|
126
|
+
if facts["service_manager"]["kind"] == "nohup" and facts["platform"] != "win32":
|
|
126
127
|
warnings.append(
|
|
127
128
|
"host has no usable systemd --user; services start with nohup and do not come back after a reboot"
|
|
128
129
|
)
|
|
@@ -384,6 +385,11 @@ def gpu_plan(
|
|
|
384
385
|
)
|
|
385
386
|
|
|
386
387
|
|
|
388
|
+
def venv_python(venv: str) -> str:
|
|
389
|
+
"""The interpreter inside a venv: Scripts/python.exe on Windows, bin/python elsewhere."""
|
|
390
|
+
return f"{venv}/Scripts/python.exe" if sys.platform == "win32" else f"{venv}/bin/python"
|
|
391
|
+
|
|
392
|
+
|
|
387
393
|
def front_venv(base_dir: str, requirements: str) -> str:
|
|
388
394
|
return f"{base_dir.rstrip('/')}/{FRONT_VENV}/{Path(requirements).stem}"
|
|
389
395
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"method": "No factor shipped. The Blackwell-only llama.cpp/CUDA MoE candidate failed the shown-pick measurement floor and its own Flash-Next training measurements; see the retained analysis.",
|
|
4
|
+
"report": "evidence/2026-11-13-decode-calibration/REPORT.md",
|
|
5
|
+
"factors": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Static efficiency corrections for resident decode, fitted by scripts/calibrate_decode.py."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import math
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from functools import lru_cache
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Protocol, TypedDict
|
|
11
|
+
|
|
12
|
+
from localmodels.contracts import decode
|
|
13
|
+
|
|
14
|
+
CALIBRATION_PATH = Path(__file__).with_suffix(".json")
|
|
15
|
+
ARCHITECTURES = ("dense", "moe", "hybrid", "swa")
|
|
16
|
+
ENGINES = ("llama.cpp", "Strata", "MLX")
|
|
17
|
+
BACKENDS = ("cuda", "metal")
|
|
18
|
+
Category = tuple[str, str, str]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DecodeModel(Protocol):
|
|
22
|
+
@property
|
|
23
|
+
def moe(self) -> bool: ...
|
|
24
|
+
@property
|
|
25
|
+
def recurrent_layers(self) -> int: ...
|
|
26
|
+
@property
|
|
27
|
+
def swa_layers(self) -> int: ...
|
|
28
|
+
@property
|
|
29
|
+
def runtime(self) -> str: ...
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True)
|
|
33
|
+
class DecodeEstimate:
|
|
34
|
+
tok_s: float
|
|
35
|
+
basis: str
|
|
36
|
+
bandwidth_gb_s: float | None
|
|
37
|
+
bytes_per_token: float
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def category(entry: DecodeModel, backend: str) -> Category:
|
|
41
|
+
"""MoE takes precedence over recurrent attention, then hybrid, SWA and dense."""
|
|
42
|
+
architecture = (
|
|
43
|
+
"moe"
|
|
44
|
+
if entry.moe
|
|
45
|
+
else "hybrid"
|
|
46
|
+
if entry.recurrent_layers
|
|
47
|
+
else "swa"
|
|
48
|
+
if entry.swa_layers
|
|
49
|
+
else "dense"
|
|
50
|
+
)
|
|
51
|
+
engine = "MLX" if entry.runtime == "mlx-lm" else entry.runtime
|
|
52
|
+
return (architecture, engine, backend)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Factor(TypedDict):
|
|
56
|
+
architecture: str
|
|
57
|
+
engine: str
|
|
58
|
+
backend: str
|
|
59
|
+
factor: float
|
|
60
|
+
sample_count: int
|
|
61
|
+
runs: list[str]
|
|
62
|
+
models: list[str]
|
|
63
|
+
pooled_architectures: list[str]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class Calibration(TypedDict):
|
|
67
|
+
schema_version: int
|
|
68
|
+
method: str
|
|
69
|
+
report: str
|
|
70
|
+
factors: list[Factor]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def load_factors(path: Path) -> dict[Category, float]:
|
|
74
|
+
"""Validate shipped data rather than silently accepting a corrupt correction."""
|
|
75
|
+
doc = decode(json.loads(path.read_text(encoding="utf-8")), Calibration)
|
|
76
|
+
if doc["schema_version"] != 1:
|
|
77
|
+
raise ValueError("unsupported decode calibration schema")
|
|
78
|
+
found: dict[Category, float] = {}
|
|
79
|
+
for row in doc["factors"]:
|
|
80
|
+
key = (row["architecture"], row["engine"], row["backend"])
|
|
81
|
+
if (
|
|
82
|
+
key[0] not in ARCHITECTURES
|
|
83
|
+
or key[1] not in ENGINES
|
|
84
|
+
or key[2] not in BACKENDS
|
|
85
|
+
or key in found
|
|
86
|
+
or not math.isfinite(row["factor"])
|
|
87
|
+
or row["factor"] <= 0
|
|
88
|
+
or row["sample_count"] < 5
|
|
89
|
+
or len(set(row["runs"])) < 2
|
|
90
|
+
or len(set(row["models"])) < 2
|
|
91
|
+
):
|
|
92
|
+
raise ValueError("invalid decode calibration factor")
|
|
93
|
+
found[key] = row["factor"]
|
|
94
|
+
return found
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@lru_cache(maxsize=1)
|
|
98
|
+
def factors() -> dict[Category, float]:
|
|
99
|
+
return load_factors(CALIBRATION_PATH)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def efficiency(category: Category) -> float:
|
|
103
|
+
"""Only recorded categories receive a correction; missing categories keep physics."""
|
|
104
|
+
return factors().get(category, 1.0)
|
|
@@ -9,6 +9,7 @@ from __future__ import annotations
|
|
|
9
9
|
import json
|
|
10
10
|
import os
|
|
11
11
|
import secrets
|
|
12
|
+
import urllib.error
|
|
12
13
|
import urllib.parse
|
|
13
14
|
import urllib.request
|
|
14
15
|
from collections.abc import Callable
|
|
@@ -124,10 +125,32 @@ class PlanOptions:
|
|
|
124
125
|
quant: str = "" # a catalog variant (stack --quant, a debug override); "": the last one
|
|
125
126
|
|
|
126
127
|
|
|
128
|
+
class AgentMemoryError(PlanError):
|
|
129
|
+
"""The agent planner's refusal, with the same capacity figures used to admit a model."""
|
|
130
|
+
|
|
131
|
+
def __init__(self, message: str, refused: PhysicsRefusal, memory: str) -> None:
|
|
132
|
+
super().__init__(message)
|
|
133
|
+
self.needed_bytes = refused.needed_bytes
|
|
134
|
+
self.available_bytes = refused.available_bytes
|
|
135
|
+
self.memory = memory
|
|
136
|
+
|
|
137
|
+
|
|
127
138
|
def _hf_get(url: str) -> object:
|
|
139
|
+
"""One Hub API document. A Hub that cannot be reached is a refusal that says how to go on:
|
|
140
|
+
home networks often reach a mirror but not huggingface.co (the Mac mini, 2026-11-12)."""
|
|
128
141
|
req = urllib.request.Request(url, headers={"User-Agent": "localmodels-plan"})
|
|
129
|
-
|
|
130
|
-
|
|
142
|
+
try:
|
|
143
|
+
with urllib.request.urlopen(req, timeout=20) as r:
|
|
144
|
+
return json.load(r)
|
|
145
|
+
except urllib.error.HTTPError:
|
|
146
|
+
raise # the Hub answered: a missing repo or revision is the caller's to report
|
|
147
|
+
except OSError as exc: # URLError and timeouts
|
|
148
|
+
host = urllib.parse.urlsplit(url).netloc
|
|
149
|
+
raise PlanError(
|
|
150
|
+
f"cannot reach {host} to look up the model files ({getattr(exc, 'reason', exc)}); "
|
|
151
|
+
"name a reachable Hub with --hf-endpoint URL or HF_ENDPOINT (a mirror such as "
|
|
152
|
+
"https://hf-mirror.com), or plan from the catalog's pins with --offline"
|
|
153
|
+
) from exc
|
|
131
154
|
|
|
132
155
|
|
|
133
156
|
class Revision(TypedDict):
|
|
@@ -251,17 +274,25 @@ def _choose_agent_placement(
|
|
|
251
274
|
agent = posture_for(options.agent, placement.backend)
|
|
252
275
|
planned = entry.launch_plan(variant, live, agent=agent)
|
|
253
276
|
if isinstance(planned.decision, PhysicsRefusal) or planned.decision.spilled:
|
|
254
|
-
|
|
277
|
+
if isinstance(planned.decision, PhysicsRefusal) and (
|
|
278
|
+
refused is None
|
|
279
|
+
or planned.decision.needed_bytes - planned.decision.available_bytes
|
|
280
|
+
< refused.needed_bytes - refused.available_bytes
|
|
281
|
+
):
|
|
282
|
+
refused = planned.decision
|
|
255
283
|
continue
|
|
256
284
|
return placement, planned
|
|
257
285
|
memory = "unified memory" if any(p.backend == "metal" for p in capacity) else "GPU memory"
|
|
258
286
|
if refused is not None and options.agent is not None: # what debug overrides pinned
|
|
259
287
|
if pinned := stack_debug.refusal(variant, options.agent, options.quant, refused, memory):
|
|
260
|
-
raise
|
|
261
|
-
|
|
288
|
+
raise AgentMemoryError(f"{entry.display_name} {pinned}", refused, memory)
|
|
289
|
+
message = (
|
|
262
290
|
f"{entry.display_name} in the agent posture does not fit this host's free {memory}; "
|
|
263
291
|
"pick a smaller model, or name a catalog model with --llm"
|
|
264
292
|
)
|
|
293
|
+
if refused is not None:
|
|
294
|
+
raise AgentMemoryError(message, refused, memory)
|
|
295
|
+
raise PlanError(message)
|
|
265
296
|
|
|
266
297
|
|
|
267
298
|
def _choose_placement(
|
|
@@ -428,7 +459,8 @@ def build_plan(
|
|
|
428
459
|
env["CUDA_VISIBLE_DEVICES"] = ""
|
|
429
460
|
elif placement.gpu_indices and not placement.budget.uma:
|
|
430
461
|
env["CUDA_VISIBLE_DEVICES"] = ",".join(gpus[i]["uuid"] for i in placement.gpu_indices)
|
|
431
|
-
|
|
462
|
+
# Windows loads a program's DLLs from its own directory; LD_LIBRARY_PATH means nothing there.
|
|
463
|
+
if facts["platform"] != "win32" and (engine["source"] == "release" or not options.engine_path):
|
|
432
464
|
env["LD_LIBRARY_PATH"] = engine.get("dir") or engine["binary"].rsplit("/", 1)[0]
|
|
433
465
|
if (
|
|
434
466
|
facts["platform"] == "linux"
|
|
@@ -527,7 +559,12 @@ def _service_warnings(
|
|
|
527
559
|
warnings.append(f"API on {options.bind}:{options.port} is LAN-reachable; use an API key")
|
|
528
560
|
if service_kind == "systemd-user" and not facts["service_manager"].get("linger"):
|
|
529
561
|
warnings.append("systemd linger is off for this user; services stop after logout")
|
|
530
|
-
if service_kind == "nohup":
|
|
562
|
+
if service_kind == "nohup" and facts["platform"] == "win32":
|
|
563
|
+
warnings.append(
|
|
564
|
+
"on Windows the services run as background processes of this user, with no window;"
|
|
565
|
+
" they stop at sign-out and reboot"
|
|
566
|
+
)
|
|
567
|
+
elif service_kind == "nohup":
|
|
531
568
|
warnings.append("no usable systemd --user: services run under nohup, gone after reboot")
|
|
532
569
|
return warnings
|
|
533
570
|
|
|
@@ -8,6 +8,7 @@ from typing import TYPE_CHECKING, Literal
|
|
|
8
8
|
|
|
9
9
|
from localmodels import catalog as cat
|
|
10
10
|
from localmodels import vision
|
|
11
|
+
from localmodels.contracts import decode
|
|
11
12
|
from localmodels.records import Plan, ReusableFile
|
|
12
13
|
from localmodels.remote_ops import (
|
|
13
14
|
DownloadParams,
|
|
@@ -15,6 +16,7 @@ from localmodels.remote_ops import (
|
|
|
15
16
|
InstallParams,
|
|
16
17
|
Reusable,
|
|
17
18
|
ServiceParams,
|
|
19
|
+
StrataPreparation,
|
|
18
20
|
VerifyParams,
|
|
19
21
|
)
|
|
20
22
|
|
|
@@ -47,6 +49,8 @@ def _download_spec(f: ReusableFile) -> Reusable:
|
|
|
47
49
|
spec["reuse"] = f["reuse"]
|
|
48
50
|
if f.get("mirrors"):
|
|
49
51
|
spec["mirrors"] = f["mirrors"]
|
|
52
|
+
if f.get("generated"):
|
|
53
|
+
spec["generated"] = True
|
|
50
54
|
return spec
|
|
51
55
|
|
|
52
56
|
|
|
@@ -70,7 +74,10 @@ def _engine_params(plan: Plan, _api_key: str) -> EngineParams:
|
|
|
70
74
|
|
|
71
75
|
|
|
72
76
|
def _download_params(plan: Plan, _api_key: str) -> DownloadParams:
|
|
73
|
-
|
|
77
|
+
params: DownloadParams = {"files": [_download_spec(f) for f in plan["files"]]}
|
|
78
|
+
if preparation := plan["launch"].get("preparation"):
|
|
79
|
+
params["preparation"] = decode(preparation, StrataPreparation)
|
|
80
|
+
return params
|
|
74
81
|
|
|
75
82
|
|
|
76
83
|
def _install_params(plan: Plan, api_key: str) -> InstallParams:
|
|
@@ -117,6 +124,8 @@ def _verify_params(plan: Plan, api_key: str) -> VerifyParams:
|
|
|
117
124
|
verify["window"] = window # the server must serve at least the planned window
|
|
118
125
|
if vision.reads_pictures(plan.get("launch") or {}): # readiness reads a picture too
|
|
119
126
|
verify["vision"] = True
|
|
127
|
+
if (plan.get("placement") or {}).get("gpus") and launch.get("spilled") is False:
|
|
128
|
+
verify["weights_on_gpu"] = True
|
|
120
129
|
return verify
|
|
121
130
|
|
|
122
131
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "localmodels.engine-lock/v1",
|
|
3
|
+
"tag": "strata-0.1.49.2",
|
|
4
|
+
"commit": "v0.2.4",
|
|
5
|
+
"source": "https://github.com/Niko1221/Strata/releases/tag/v0.2.4",
|
|
6
|
+
"note": "Strata 0.2.4 with control 0.1.49.2 and unchanged engine 0.1.48, checked 2026-11-11. The former 0.1.49.1 control URL returns 404; the release now provides this pinned replacement. Control includes CPython 3.12.15, numpy/regex and the model preparation tools. The existing CUDA 13 engine archive and launch settings are retained; its local archive name includes the control version to keep the flat mirror unambiguous alongside the historical lock. Both archives unpack into one directory. New artifact preparation has separate CPU-only validation; this lock update does not claim new GPU model acceptance.",
|
|
7
|
+
"builds": [
|
|
8
|
+
{
|
|
9
|
+
"platform": "linux",
|
|
10
|
+
"arch": "x64",
|
|
11
|
+
"backend": "cuda",
|
|
12
|
+
"min_cuda": "13.0",
|
|
13
|
+
"min_glibc": "2.34",
|
|
14
|
+
"binary": "bin/strata",
|
|
15
|
+
"assets": [
|
|
16
|
+
{
|
|
17
|
+
"name": "strata-control-0.1.49.2-linux-x86_64.tar.gz",
|
|
18
|
+
"url": "https://github.com/Niko1221/Strata/releases/download/v0.2.4/strata-control-0.1.49.2-linux-x86_64.tar.gz",
|
|
19
|
+
"sha256": "2f905fe9e7f0c0f7e1d055a414acc0b3dae6db2d42e7f6a97e57e8ff7d3cf9c6",
|
|
20
|
+
"size_bytes": 98918561
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "strata-engine-0.1.48-control-0.1.49.2-linux-x86_64-cuda-cuda13.tar.gz",
|
|
24
|
+
"url": "https://github.com/Niko1221/Strata/releases/download/v0.2.4/strata-engine-0.1.48-linux-x86_64-cuda-cuda13.tar.gz",
|
|
25
|
+
"sha256": "3e11a82e325cf4968a1734446e8945d7918a5657e964c6c5d2c262aa59258f57",
|
|
26
|
+
"size_bytes": 606513890
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"tag": "b11370",
|
|
4
4
|
"commit": "bed0a856606ee4a24a164066f73d2379447033f5",
|
|
5
5
|
"source": "https://github.com/ggml-org/llama.cpp/releases/tag/b11370",
|
|
6
|
-
"note": "Release asset digests from the GitHub release API, read 2026-10-12. b11370 is the build Hermes' catalog constants were measured on. min_glibc is the highest GLIBC symbol version the build's binaries import (objdump -T, 2026-10-20); builds without it were not checked. The ubuntu22.04 variant (2026-10-23) is this repository's rebuild of the same commit for hosts whose glibc is older than upstream's 2.38: scripts/build_cuda_engine.py runs the release workflow's CMake flags in nvidia/cuda:12.8.2-devel-ubuntu22.04 pinned by digest; its provenance JSON records the image, flags and toolchain, and its archives live in the public generic package registry of simplexai/infra/llm-engine-builds. Every upstream Linux build links GCC's OpenMP runtime (libgomp.so.1, Debian package libgomp1; readelf NEEDED, 2026-10-23), which minimal images lack, so a plan on such a host stops instead of installing it. The ubuntu22.04-r2 rebuild (2026-10-23) carries its own libgomp.so.1 and replaces r1, which needed the system copy. The ubuntu22.04-r3 rebuild (2026-10-26) also compiles the q8_0-q4_0 FlashAttention K-V kernels (GGML_CUDA_FA_QUANTS), which the agent stack's K q8_0 / V q4_0 cache needs to decode at full speed (evidence/2026-10-25-vram-stack-probe-r3-lab12021); it replaces r2.",
|
|
6
|
+
"note": "Release asset digests from the GitHub release API, read 2026-10-12. b11370 is the build Hermes' catalog constants were measured on. min_glibc is the highest GLIBC symbol version the build's binaries import (objdump -T, 2026-10-20); builds without it were not checked. The ubuntu22.04 variant (2026-10-23) is this repository's rebuild of the same commit for hosts whose glibc is older than upstream's 2.38: scripts/build_cuda_engine.py runs the release workflow's CMake flags in nvidia/cuda:12.8.2-devel-ubuntu22.04 pinned by digest; its provenance JSON records the image, flags and toolchain, and its archives live in the public generic package registry of simplexai/infra/llm-engine-builds. Every upstream Linux build links GCC's OpenMP runtime (libgomp.so.1, Debian package libgomp1; readelf NEEDED, 2026-10-23), which minimal images lack, so a plan on such a host stops instead of installing it. The ubuntu22.04-r2 rebuild (2026-10-23) carries its own libgomp.so.1 and replaces r1, which needed the system copy. The ubuntu22.04-r3 rebuild (2026-10-26) also compiles the q8_0-q4_0 FlashAttention K-V kernels (GGML_CUDA_FA_QUANTS), which the agent stack's K q8_0 / V q4_0 cache needs to decode at full speed (evidence/2026-10-25-vram-stack-probe-r3-lab12021); it replaces r2. Windows x64 builds (2026-11-11) are upstream's win-cuda-12.4/13.4 and win-cpu zips with their cudart companions, digests from the same release API; the CUDA zips hold llama-server.exe beside the ggml DLLs and the cudart zip adds the CUDA runtime DLLs to the same directory.",
|
|
7
7
|
"builds": [
|
|
8
8
|
{
|
|
9
9
|
"platform": "linux",
|
|
@@ -205,6 +205,62 @@
|
|
|
205
205
|
"size_bytes": 11445204
|
|
206
206
|
}
|
|
207
207
|
]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"platform": "win32",
|
|
211
|
+
"arch": "x64",
|
|
212
|
+
"backend": "cuda",
|
|
213
|
+
"min_cuda": "12.4",
|
|
214
|
+
"binary": "llama-server.exe",
|
|
215
|
+
"assets": [
|
|
216
|
+
{
|
|
217
|
+
"name": "llama-b11370-bin-win-cuda-12.4-x64.zip",
|
|
218
|
+
"url": "https://github.com/ggml-org/llama.cpp/releases/download/b11370/llama-b11370-bin-win-cuda-12.4-x64.zip",
|
|
219
|
+
"sha256": "7b512fc9fdf3e0e430264fabd0ab7991641d82e268cd984fee675ac77d3470a4",
|
|
220
|
+
"size_bytes": 263457938
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "cudart-llama-bin-win-cuda-12.4-x64.zip",
|
|
224
|
+
"url": "https://github.com/ggml-org/llama.cpp/releases/download/b11370/cudart-llama-bin-win-cuda-12.4-x64.zip",
|
|
225
|
+
"sha256": "8c79a9b226de4b3cacfd1f83d24f962d0773be79f1e7b75c6af4ded7e32ae1d6",
|
|
226
|
+
"size_bytes": 391443627
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"platform": "win32",
|
|
232
|
+
"arch": "x64",
|
|
233
|
+
"backend": "cuda",
|
|
234
|
+
"min_cuda": "13.4",
|
|
235
|
+
"binary": "llama-server.exe",
|
|
236
|
+
"assets": [
|
|
237
|
+
{
|
|
238
|
+
"name": "llama-b11370-bin-win-cuda-13.4-x64.zip",
|
|
239
|
+
"url": "https://github.com/ggml-org/llama.cpp/releases/download/b11370/llama-b11370-bin-win-cuda-13.4-x64.zip",
|
|
240
|
+
"sha256": "05a1e951d7eb3fb32a8159b6f6dc06f5e8f681154b57369d585ae4100bae4999",
|
|
241
|
+
"size_bytes": 152876036
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"name": "cudart-llama-bin-win-cuda-13.4-x64.zip",
|
|
245
|
+
"url": "https://github.com/ggml-org/llama.cpp/releases/download/b11370/cudart-llama-bin-win-cuda-13.4-x64.zip",
|
|
246
|
+
"sha256": "738f8c251ac22b70c3ae6f83a10cf222725df0395246a2cf58f32bdb85fbe668",
|
|
247
|
+
"size_bytes": 423535356
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"platform": "win32",
|
|
253
|
+
"arch": "x64",
|
|
254
|
+
"backend": "cpu",
|
|
255
|
+
"binary": "llama-server.exe",
|
|
256
|
+
"assets": [
|
|
257
|
+
{
|
|
258
|
+
"name": "llama-b11370-bin-win-cpu-x64.zip",
|
|
259
|
+
"url": "https://github.com/ggml-org/llama.cpp/releases/download/b11370/llama-b11370-bin-win-cpu-x64.zip",
|
|
260
|
+
"sha256": "e433a6b1592af1deedf001dcc1abc933e990be8dc94e5d28104c3c4406a1d35f",
|
|
261
|
+
"size_bytes": 19333283
|
|
262
|
+
}
|
|
263
|
+
]
|
|
208
264
|
}
|
|
209
265
|
]
|
|
210
266
|
}
|
|
@@ -75,6 +75,7 @@ def select_engine_build(
|
|
|
75
75
|
for b in lock["builds"]
|
|
76
76
|
if b["platform"] == platform and b["arch"] == facts.get("arch") and b["backend"] in accepted
|
|
77
77
|
]
|
|
78
|
+
for_platform = bool(builds)
|
|
78
79
|
if backend == "cuda":
|
|
79
80
|
driver = _cuda_tuple((facts.get("nvidia") or {}).get("cuda_version", ""))
|
|
80
81
|
builds = [b for b in builds if _cuda_tuple(b["min_cuda"]) <= driver]
|
|
@@ -103,7 +104,7 @@ def select_engine_build(
|
|
|
103
104
|
if not builds:
|
|
104
105
|
raise PlanError(
|
|
105
106
|
f"no {lock['tag']} prebuilt engine for {platform}/{facts.get('arch')}/{backend}"
|
|
106
|
-
+ (" (the driver supports too old a CUDA version)" if
|
|
107
|
+
+ (" (the driver supports too old a CUDA version)" if for_platform else "")
|
|
107
108
|
)
|
|
108
109
|
return {"tag": lock["tag"], "commit": lock["commit"], **builds[0]}
|
|
109
110
|
|
|
@@ -184,9 +185,10 @@ def release_engine(build: SelectedBuild, base_dir: str) -> ReleaseEngine:
|
|
|
184
185
|
+ (f"-cuda{build['min_cuda']}" if build.get("min_cuda") else "")
|
|
185
186
|
+ (f"-{build['variant']}" if build.get("variant") else "")
|
|
186
187
|
)
|
|
188
|
+
binary = build.get("binary") or "llama-server"
|
|
187
189
|
engine: ReleaseEngine = {
|
|
188
190
|
"source": "release",
|
|
189
|
-
"binary": directory
|
|
191
|
+
"binary": f"{directory}/{binary}",
|
|
190
192
|
"build": build["tag"],
|
|
191
193
|
"commit": build["commit"],
|
|
192
194
|
"backend": build["backend"],
|
|
@@ -203,4 +205,6 @@ def release_engine(build: SelectedBuild, base_dir: str) -> ReleaseEngine:
|
|
|
203
205
|
engine["provenance"] = build["provenance"]
|
|
204
206
|
if "min_glibc" in build:
|
|
205
207
|
engine["min_glibc"] = build["min_glibc"]
|
|
208
|
+
if binary != "llama-server":
|
|
209
|
+
engine["binary_name"] = binary
|
|
206
210
|
return engine
|
|
@@ -162,6 +162,10 @@ class ModelProfile:
|
|
|
162
162
|
# Compute-buffer bytes per window token at the launch posture (plan_launch sets it from
|
|
163
163
|
# window_compute_bytes, the microbatch and the context count); zero prices none.
|
|
164
164
|
window_compute_per_token: int = 0
|
|
165
|
+
# MLA: llama.cpp keeps one K tensor of the latent per layer and no V tensor
|
|
166
|
+
# (llama-kv-cache.cpp: has_v = !is_mla), so the layers' f16 bytes are all K and -ctv does
|
|
167
|
+
# not apply. WHI-677.
|
|
168
|
+
kv_k_only: bool = False
|
|
165
169
|
|
|
166
170
|
@property
|
|
167
171
|
def window_compute_bytes(self) -> int:
|
|
@@ -221,6 +225,9 @@ def profile_from_gguf(header: GGUFHeader) -> ModelProfile:
|
|
|
221
225
|
# Trailing MTP (nextn) blocks are not model layers: priced by mtp_layer_bytes, never a layer.
|
|
222
226
|
main = len(kv_heads) - header.nextn_layers
|
|
223
227
|
dk, dv = header.head_dim_k, header.head_dim_v
|
|
228
|
+
mla = header.key_length_mla > 0
|
|
229
|
+
if mla: # key_length is the cached latent (kv_lora_rank + rope); value_length is not stored
|
|
230
|
+
dv = 0
|
|
224
231
|
dk_swa = header.key_length_swa or dk
|
|
225
232
|
dv_swa = header.value_length_swa or dv
|
|
226
233
|
|
|
@@ -281,6 +288,7 @@ def profile_from_gguf(header: GGUFHeader) -> ModelProfile:
|
|
|
281
288
|
ssm_dt_rank=header.ssm_dt_rank,
|
|
282
289
|
ffn_block_bytes=dict(header.ffn_block_bytes),
|
|
283
290
|
lazy_bytes=header.lazy_bytes,
|
|
291
|
+
kv_k_only=mla,
|
|
284
292
|
)
|
|
285
293
|
|
|
286
294
|
|
|
@@ -392,17 +400,25 @@ def mtp_draft_bytes(profile: ModelProfile, window: int, *, slots: int) -> int:
|
|
|
392
400
|
return int(one_layer * window + state * (_MTP_RECURRENT_FACTOR - 1) + _MTP_DRAFT_COMPUTE_BYTES)
|
|
393
401
|
|
|
394
402
|
|
|
395
|
-
def
|
|
396
|
-
"""
|
|
403
|
+
def _kv_dtype_scale(profile: ModelProfile, kv_types: tuple[str, str]) -> float:
|
|
404
|
+
"""Bytes at ``kv_types`` per f16 byte of a layer's cache: K and V each at their own element
|
|
405
|
+
size, or K alone for an MLA cache (no V tensor, so the V type does not apply)."""
|
|
397
406
|
k_bpe = _KV_DTYPE_BYTES_PER_ELEM.get(kv_types[0], _F16_BYTES_PER_ELEM)
|
|
407
|
+
if profile.kv_k_only:
|
|
408
|
+
return k_bpe / _F16_BYTES_PER_ELEM
|
|
398
409
|
v_bpe = _KV_DTYPE_BYTES_PER_ELEM.get(kv_types[1], _F16_BYTES_PER_ELEM)
|
|
410
|
+
return (k_bpe + v_bpe) / (2 * _F16_BYTES_PER_ELEM)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def kv_pool_bytes(profile: ModelProfile, window: int, kv_types: tuple[str, str]) -> int:
|
|
414
|
+
"""The unified KV of a ``window``-token pool at the given K/V dtypes (SWA layers capped)."""
|
|
415
|
+
scale = _kv_dtype_scale(profile, kv_types)
|
|
399
416
|
kv = 0.0
|
|
400
417
|
for kind, per_token_f16 in profile.layers:
|
|
401
418
|
if kind == LayerKind.RECURRENT:
|
|
402
419
|
continue
|
|
403
420
|
tokens = min(window, profile.swa_window) if kind == LayerKind.SWA else window
|
|
404
|
-
|
|
405
|
-
kv += per_token_f16 * tokens * (k_bpe + v_bpe) / (2 * _F16_BYTES_PER_ELEM)
|
|
421
|
+
kv += per_token_f16 * tokens * scale
|
|
406
422
|
return int(kv)
|
|
407
423
|
|
|
408
424
|
|
|
@@ -427,10 +443,8 @@ def context_checkpoint_bytes(profile: ModelProfile, kv_types: tuple[str, str]) -
|
|
|
427
443
|
window; 0 for a model whose KV rolls back (no checkpoints). V16C: each of the 218 prompt-cache
|
|
428
444
|
entries llama-server logged as over its limit is KV(n_tokens) + (1 + k) x the 27B's 149.6 MiB
|
|
429
445
|
recurrent state for a whole k of 11-31, and anon grows about 300 MiB a request (two checkpoints)."""
|
|
430
|
-
k_bpe = _KV_DTYPE_BYTES_PER_ELEM.get(kv_types[0], _F16_BYTES_PER_ELEM)
|
|
431
|
-
v_bpe = _KV_DTYPE_BYTES_PER_ELEM.get(kv_types[1], _F16_BYTES_PER_ELEM)
|
|
432
446
|
swa = sum(b for kind, b in profile.layers if kind == LayerKind.SWA) * profile.swa_window
|
|
433
|
-
return recurrent_state_bytes(profile, slots=1) + int(swa * (
|
|
447
|
+
return recurrent_state_bytes(profile, slots=1) + int(swa * _kv_dtype_scale(profile, kv_types))
|
|
434
448
|
|
|
435
449
|
|
|
436
450
|
def llama_host_bytes(profile: ModelProfile, *, slots: int, kv_types: tuple[str, str]) -> int:
|
|
@@ -5,7 +5,7 @@ the Kokoro TTS server (tts_server.py).
|
|
|
5
5
|
file under ``<base_dir>/frontends/``, filled by uv or pip with ``--require-hashes``. A marker holds
|
|
6
6
|
the requirements digest; a matching marker and a runnable entry point make a rerun a no-op, and a
|
|
7
7
|
different digest rebuilds the venv from scratch. Nothing outside that directory is touched. The
|
|
8
|
-
venv is recorded with the owned archives, so ``stack remove
|
|
8
|
+
venv is recorded with the owned archives, so ``stack remove`` deletes it.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
from __future__ import annotations
|
|
@@ -19,7 +19,7 @@ from collections.abc import Callable
|
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
|
|
21
21
|
from localmodels import hosts
|
|
22
|
-
from localmodels.component import front_venv
|
|
22
|
+
from localmodels.component import front_venv, venv_python
|
|
23
23
|
from localmodels.records import Plan
|
|
24
24
|
|
|
25
25
|
REQUIREMENTS_DIR = Path(__file__).parent
|
|
@@ -45,7 +45,7 @@ def ready(base_dir: str, requirements: str) -> bool:
|
|
|
45
45
|
return (
|
|
46
46
|
marker.is_file()
|
|
47
47
|
and marker.read_text().strip() == _digest(requirements_path(requirements))
|
|
48
|
-
and (venv
|
|
48
|
+
and Path(venv_python(str(venv))).exists()
|
|
49
49
|
)
|
|
50
50
|
|
|
51
51
|
|
|
@@ -100,7 +100,7 @@ def install(
|
|
|
100
100
|
shutil.rmtree(venv)
|
|
101
101
|
venv.parent.mkdir(parents=True, exist_ok=True)
|
|
102
102
|
log(f"creating Python environment {venv}")
|
|
103
|
-
python = str(venv
|
|
103
|
+
python = venv_python(str(venv))
|
|
104
104
|
steps = [
|
|
105
105
|
[interpreter or sys.executable, "-m", "venv", "--without-pip", str(venv)],
|
|
106
106
|
_installer(python, source),
|
|
@@ -29,7 +29,9 @@ from localmodels import (
|
|
|
29
29
|
gateway_keys,
|
|
30
30
|
harness,
|
|
31
31
|
harness_gateway,
|
|
32
|
+
harness_probe,
|
|
32
33
|
hosts,
|
|
34
|
+
process_identity,
|
|
33
35
|
runtime_io,
|
|
34
36
|
runtime_process,
|
|
35
37
|
)
|
|
@@ -183,13 +185,13 @@ def _serve(plan: ToolPlan) -> None:
|
|
|
183
185
|
settings, {"noAutoUpdate": True, "noAutoDownload": True, "redactModelOff": True}
|
|
184
186
|
)
|
|
185
187
|
with (tools_dir / "magpie-serve.log").open("ab") as log:
|
|
186
|
-
proc =
|
|
188
|
+
proc = process_identity.spawn_detached(
|
|
187
189
|
[tool_path(plan, "magpie"), "serve"],
|
|
188
190
|
stdin=subprocess.DEVNULL,
|
|
189
191
|
stdout=log,
|
|
190
192
|
stderr=log,
|
|
191
|
-
start_new_session=True,
|
|
192
193
|
env=env,
|
|
194
|
+
cwd=str(tools_dir), # not where install ran: Windows cannot delete a directory in use
|
|
193
195
|
)
|
|
194
196
|
harness_gateway.record_started_child(proc, tools_dir)
|
|
195
197
|
|
|
@@ -449,6 +451,12 @@ def point_pi(plan: ToolPlan, before: str | None, target: str) -> str:
|
|
|
449
451
|
}
|
|
450
452
|
|
|
451
453
|
hosts.update_owned(replace_pi, plan["tools_dir"])
|
|
454
|
+
# Newer Magpie (0.1.3733, 2026-11-11) refuses a PI_CODING_AGENT_DIR that does not exist yet;
|
|
455
|
+
# the stack's own one lives in its private gateway home and is created private here.
|
|
456
|
+
agent = harness.gateway_environment(plan).get("PI_CODING_AGENT_DIR")
|
|
457
|
+
home = Path(plan["tools_dir"]).expanduser() / "gateway-home"
|
|
458
|
+
if agent and Path(agent).is_relative_to(home):
|
|
459
|
+
runtime_io.private_directory(Path(agent))
|
|
452
460
|
_require(_magpie(plan, "pi", target), "pi")
|
|
453
461
|
return f"pi → {model}"
|
|
454
462
|
|
|
@@ -459,11 +467,13 @@ def _pi_model(plan: ToolPlan) -> str | None:
|
|
|
459
467
|
|
|
460
468
|
def magpie_binary(doc: hosts.Owned) -> str | None:
|
|
461
469
|
"""The Magpie this tool installed, else the one PATH or ~/.local/bin offers."""
|
|
462
|
-
|
|
470
|
+
names = ("magpie", "magpie.exe") # this tool installs magpie.exe on Windows
|
|
471
|
+
ours = next((t["path"] for t in doc["tools"] if Path(t["path"]).name in names), None)
|
|
463
472
|
if ours and os.access(ours, os.X_OK):
|
|
464
473
|
return ours
|
|
465
474
|
search = os.pathsep.join([os.environ.get("PATH", ""), os.path.expanduser(harness.BIN_DIR)])
|
|
466
|
-
|
|
475
|
+
# As harness_probe.inspect: the Windows app's magpie.com shim stands for its magpie.exe.
|
|
476
|
+
return harness_probe.windows_program(shutil.which("magpie", path=search))
|
|
467
477
|
|
|
468
478
|
|
|
469
479
|
def unwire(
|