@simplexai/localmodels-linux-arm64 0.1.0-dev.61 → 0.1.0-dev.63
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 +66 -63
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/bifrost_checks.py +19 -13
- package/modules/localmodels/bifrost_clients.py +38 -36
- package/modules/localmodels/bifrost_config.py +19 -6
- package/modules/localmodels/bifrost_log.py +3 -3
- package/modules/localmodels/bifrost_models.py +9 -8
- package/modules/localmodels/bifrost_pi.py +27 -72
- package/modules/localmodels/catalog.json +51 -58
- package/modules/localmodels/custom_hub.py +10 -1
- package/modules/localmodels/custom_hub_http.py +41 -107
- package/modules/localmodels/debug_mode.py +3 -3
- package/modules/localmodels/gateway.py +56 -55
- package/modules/localmodels/gateway_bifrost.py +70 -83
- package/modules/localmodels/gateway_clients.py +33 -116
- package/modules/localmodels/gateway_home.py +5 -5
- package/modules/localmodels/gateway_keys.py +8 -6
- package/modules/localmodels/gateway_probe.py +4 -4
- package/modules/localmodels/gateway_server.py +4 -4
- package/modules/localmodels/gateway_speed.py +2 -2
- package/modules/localmodels/harness.py +185 -401
- package/modules/localmodels/harness_core.py +409 -0
- package/modules/localmodels/harness_gateway.py +75 -73
- package/modules/localmodels/harness_probe.py +19 -216
- package/modules/localmodels/library_custom.py +51 -16
- package/modules/localmodels/library_elastic.py +1 -1
- package/modules/localmodels/library_gateway.py +59 -176
- package/modules/localmodels/library_jobs.py +4 -0
- package/modules/localmodels/library_model.py +23 -0
- package/modules/localmodels/library_pricing.py +2 -2
- package/modules/localmodels/library_serve.py +5 -3
- package/modules/localmodels/library_smoke.py +33 -21
- package/modules/localmodels/library_status.py +330 -2
- package/modules/localmodels/llm_rank.py +14 -5
- package/modules/localmodels/magpie_setup.py +5 -4
- package/modules/localmodels/magpie_windows.py +1 -1
- package/modules/localmodels/memcalc_load.py +9 -4
- package/modules/localmodels/pi_profile.py +384 -0
- package/modules/localmodels/process_identity.py +3 -3
- package/modules/localmodels/remote_ops_common.py +31 -90
- package/modules/localmodels/remote_ops_download.py +2 -0
- package/modules/localmodels/remote_ops_mirrors.py +1 -1
- package/modules/localmodels/remote_ops_ranges.py +4 -1
- package/modules/localmodels/remote_ops_redirect.py +393 -0
- package/modules/localmodels/runtime_cli.py +32 -46
- package/modules/localmodels/runtime_pi.py +1 -1
- package/modules/localmodels/source_byok.py +9 -16
- package/modules/localmodels/source_cli.py +136 -23
- package/modules/localmodels/speech_jobs.py +4 -0
- package/modules/localmodels/stack_binding.py +9 -7
- package/modules/localmodels/stack_clients.py +137 -21
- package/modules/localmodels/stack_doctor.py +6 -3
- package/modules/localmodels/stack_hardware.py +18 -0
- package/modules/localmodels/stack_lifecycle.py +3 -2
- package/modules/localmodels/stack_remove.py +2 -1
- package/modules/localmodels/stack_verify.py +2 -2
- package/modules/localmodels/stack_view_events.py +2 -2
- package/modules/localmodels/transport.py +1 -0
- package/modules/{simplex_localmodels-0.1.0.dev61.dist-info → simplex_localmodels-0.1.0.dev63.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev61.dist-info → simplex_localmodels-0.1.0.dev63.dist-info}/RECORD +63 -60
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/{simplex_localmodels-0.1.0.dev61.dist-info → simplex_localmodels-0.1.0.dev63.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev61.dist-info → simplex_localmodels-0.1.0.dev63.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev61.dist-info → simplex_localmodels-0.1.0.dev63.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev61.dist-info → simplex_localmodels-0.1.0.dev63.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import tempfile
|
|
6
5
|
from collections.abc import Callable
|
|
7
6
|
|
|
8
|
-
from localmodels import
|
|
9
|
-
from localmodels.
|
|
7
|
+
from localmodels import bifrost_clients, harness_core, harness_gateway, hosts, stack_clients
|
|
8
|
+
from localmodels.harness_core import ClientConfig
|
|
9
|
+
from localmodels.stack_clients import accept_clients as accept_clients
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def summary_lines(plan:
|
|
12
|
+
def summary_lines(plan: harness_core.GatewayPlan) -> list[str]:
|
|
13
13
|
return [
|
|
14
14
|
f" gateway {client} default model {before['model'] or 'native default'} → "
|
|
15
15
|
f"group/{plan['group']}; the config fingerprint is part of the approval, and remove "
|
|
@@ -18,18 +18,18 @@ def summary_lines(plan: harness.GatewayPlan) -> list[str]:
|
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def current_model(plan:
|
|
22
|
-
result =
|
|
23
|
-
[
|
|
21
|
+
def current_model(plan: harness_core.ToolPlan, client: str) -> str | None:
|
|
22
|
+
result = harness_core.run_tool(
|
|
23
|
+
[harness_core.tool_path(plan, "magpie"), client],
|
|
24
24
|
timeout=20,
|
|
25
|
-
env=
|
|
25
|
+
env=harness_gateway.checked_gateway_environment(plan),
|
|
26
26
|
)
|
|
27
27
|
if result.returncode:
|
|
28
|
-
raise
|
|
28
|
+
raise harness_core.HarnessError(f"cannot check the current {client} default model")
|
|
29
29
|
return stack_clients.shown_model(client, result.stdout)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def wire(plan:
|
|
32
|
+
def wire(plan: harness_core.HarnessPlan) -> list[str]:
|
|
33
33
|
target = f"group/{plan['gateway']['group']}"
|
|
34
34
|
return [
|
|
35
35
|
point(plan, plan["tools_dir"], client, before, target)
|
|
@@ -38,16 +38,16 @@ def wire(plan: harness.HarnessPlan) -> list[str]:
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def point(
|
|
41
|
-
plan:
|
|
41
|
+
plan: harness_core.ToolPlan, tools_dir: str, client: str, before: ClientConfig, target: str
|
|
42
42
|
) -> str:
|
|
43
43
|
"""Set ``client``'s default model to Magpie's ``target``, refusing when its native settings
|
|
44
44
|
changed since ``before`` was planned. The receipt is written first and keeps the model it
|
|
45
45
|
had before the first change, so a retry or a later re-point still restores the original."""
|
|
46
|
-
actual = stack_clients.config_files(client,
|
|
46
|
+
actual = stack_clients.config_files(client, harness_core.gateway_environment(plan))
|
|
47
47
|
previous = hosts.load_owned(tools_dir).get("clients", {}).get(client)
|
|
48
48
|
expected = previous["files"] if previous else before["files"]
|
|
49
49
|
if actual != expected:
|
|
50
|
-
raise
|
|
50
|
+
raise harness_core.HarnessError(
|
|
51
51
|
f"{client} config changed; existing config kept, review the plan again"
|
|
52
52
|
)
|
|
53
53
|
receipt: hosts.OwnedClient = {
|
|
@@ -61,38 +61,38 @@ def point(
|
|
|
61
61
|
|
|
62
62
|
hosts.update_owned(record, tools_dir)
|
|
63
63
|
try:
|
|
64
|
-
result =
|
|
65
|
-
[
|
|
64
|
+
result = harness_core.run_tool(
|
|
65
|
+
[harness_core.tool_path(plan, "magpie"), client, target],
|
|
66
66
|
timeout=60,
|
|
67
|
-
env=
|
|
67
|
+
env=harness_gateway.checked_gateway_environment(plan),
|
|
68
68
|
)
|
|
69
69
|
finally:
|
|
70
|
-
receipt["files"] = stack_clients.config_files(
|
|
70
|
+
receipt["files"] = stack_clients.config_files(
|
|
71
|
+
client, harness_core.gateway_environment(plan)
|
|
72
|
+
)
|
|
71
73
|
hosts.update_owned(record, tools_dir)
|
|
72
74
|
if result.returncode or current_model(plan, client) != target:
|
|
73
|
-
raise
|
|
75
|
+
raise harness_core.HarnessError(f"pointing the {client} default model at Magpie failed")
|
|
74
76
|
return f"{client} → {target}"
|
|
75
77
|
|
|
76
78
|
|
|
77
79
|
def unwire(
|
|
78
|
-
plan:
|
|
80
|
+
plan: harness_core.ToolPlan, tools_dir: str, *, migrating: bool = False
|
|
79
81
|
) -> list[dict[str, object]]:
|
|
80
|
-
from localmodels import bifrost_clients
|
|
81
|
-
|
|
82
82
|
results: list[dict[str, object]] = []
|
|
83
83
|
for client, receipt in hosts.load_owned(tools_dir).get("clients", {}).items():
|
|
84
84
|
if receipt["model"] == bifrost_clients.MODEL:
|
|
85
85
|
continue
|
|
86
86
|
try:
|
|
87
87
|
same = (
|
|
88
|
-
stack_clients.config_files(client,
|
|
88
|
+
stack_clients.config_files(client, harness_core.gateway_environment(plan))
|
|
89
89
|
== receipt["files"]
|
|
90
90
|
)
|
|
91
91
|
current = current_model(plan, client)
|
|
92
92
|
ok = True
|
|
93
93
|
detail = "kept the config the user changed since"
|
|
94
94
|
if not same and current == receipt["model"]:
|
|
95
|
-
raise
|
|
95
|
+
raise harness_core.HarnessError(
|
|
96
96
|
"config changed but still points at the local routing group; services kept,"
|
|
97
97
|
" deal with the client config first"
|
|
98
98
|
)
|
|
@@ -100,10 +100,10 @@ def unwire(
|
|
|
100
100
|
previous = receipt["previous"]
|
|
101
101
|
restore = previous if previous and "/" in previous else "default"
|
|
102
102
|
ok = (
|
|
103
|
-
|
|
104
|
-
[
|
|
103
|
+
harness_core.run_tool(
|
|
104
|
+
[harness_core.tool_path(plan, "magpie"), client, restore],
|
|
105
105
|
timeout=60,
|
|
106
|
-
env=
|
|
106
|
+
env=harness_gateway.checked_gateway_environment(plan),
|
|
107
107
|
).returncode
|
|
108
108
|
== 0
|
|
109
109
|
)
|
|
@@ -131,109 +131,26 @@ def unwire(
|
|
|
131
131
|
|
|
132
132
|
hosts.update_owned(clear, tools_dir)
|
|
133
133
|
results.append({"check": client, "ok": ok, "detail": detail})
|
|
134
|
-
except (OSError,
|
|
135
|
-
results.append(
|
|
136
|
-
{
|
|
137
|
-
"check": client,
|
|
138
|
-
"ok": False,
|
|
139
|
-
"detail": "client config cannot be restored safely; services and ownership"
|
|
140
|
-
" records kept",
|
|
141
|
-
}
|
|
142
|
-
)
|
|
134
|
+
except (OSError, harness_core.HarnessError, ValueError):
|
|
135
|
+
results.append(stack_clients.restore_failed_check(client))
|
|
143
136
|
return results
|
|
144
137
|
|
|
145
138
|
|
|
146
139
|
def accept(
|
|
147
|
-
plan:
|
|
140
|
+
plan: harness_core.HarnessPlan,
|
|
148
141
|
prompt: str,
|
|
149
142
|
expected: str,
|
|
150
143
|
timeout: float,
|
|
151
144
|
calls: Callable[[], int | None],
|
|
152
145
|
after: Callable[[int | None], int | None],
|
|
153
146
|
) -> list[dict[str, object]]:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
return accept_clients(
|
|
158
|
-
executables,
|
|
147
|
+
return stack_clients.accept_plan_clients(
|
|
148
|
+
plan,
|
|
159
149
|
prompt,
|
|
160
150
|
expected,
|
|
161
151
|
timeout,
|
|
162
152
|
calls,
|
|
163
153
|
after,
|
|
164
|
-
|
|
154
|
+
via="Magpie",
|
|
155
|
+
environment=harness_gateway.checked_gateway_environment(plan),
|
|
165
156
|
)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
def accept_clients(
|
|
169
|
-
executables: dict[str, str],
|
|
170
|
-
prompt: str,
|
|
171
|
-
expected: str,
|
|
172
|
-
timeout: float,
|
|
173
|
-
calls: Callable[[], int | None],
|
|
174
|
-
after: Callable[[int | None], int | None],
|
|
175
|
-
via: str = "Magpie",
|
|
176
|
-
*,
|
|
177
|
-
environment: dict[str, str],
|
|
178
|
-
) -> list[dict[str, object]]:
|
|
179
|
-
"""One real non-interactive prompt per client on its configured default; each passes only
|
|
180
|
-
with the expected answer and a new successful call in the gateway's log (``calls``)."""
|
|
181
|
-
results: list[dict[str, object]] = []
|
|
182
|
-
commands = {
|
|
183
|
-
"codex": [
|
|
184
|
-
"exec",
|
|
185
|
-
"--skip-git-repo-check",
|
|
186
|
-
"--ephemeral",
|
|
187
|
-
"--sandbox",
|
|
188
|
-
"read-only",
|
|
189
|
-
"-c",
|
|
190
|
-
'approval_policy="never"',
|
|
191
|
-
"-c",
|
|
192
|
-
"features.shell_tool=false",
|
|
193
|
-
],
|
|
194
|
-
"claude": [
|
|
195
|
-
"-p",
|
|
196
|
-
"--tools",
|
|
197
|
-
"",
|
|
198
|
-
"--strict-mcp-config",
|
|
199
|
-
"--mcp-config",
|
|
200
|
-
'{"mcpServers":{}}',
|
|
201
|
-
"--no-session-persistence",
|
|
202
|
-
"--max-turns",
|
|
203
|
-
"1",
|
|
204
|
-
"--disable-slash-commands",
|
|
205
|
-
"--setting-sources",
|
|
206
|
-
"user",
|
|
207
|
-
"--settings",
|
|
208
|
-
'{"disableAllHooks":true}',
|
|
209
|
-
],
|
|
210
|
-
}
|
|
211
|
-
env = environment.copy()
|
|
212
|
-
env["CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"] = "1"
|
|
213
|
-
for name in ("NO_PROXY", "no_proxy"):
|
|
214
|
-
env[name] = ",".join(filter(None, (env.get(name), "127.0.0.1,localhost")))
|
|
215
|
-
for client, executable in executables.items():
|
|
216
|
-
before = calls()
|
|
217
|
-
with tempfile.TemporaryDirectory(prefix=f"localmodels-{client}-") as cwd:
|
|
218
|
-
result = harness.run_tool(
|
|
219
|
-
[executable, *commands[client], prompt],
|
|
220
|
-
cwd=cwd,
|
|
221
|
-
env=env,
|
|
222
|
-
timeout=timeout,
|
|
223
|
-
)
|
|
224
|
-
count = after(before)
|
|
225
|
-
ok = (
|
|
226
|
-
result.returncode == 0
|
|
227
|
-
and expected.lower() in result.stdout.lower()
|
|
228
|
-
and before is not None
|
|
229
|
-
and count is not None
|
|
230
|
-
and count > before
|
|
231
|
-
)
|
|
232
|
-
results.append(
|
|
233
|
-
{
|
|
234
|
-
"check": f"{client} via {via}",
|
|
235
|
-
"ok": ok,
|
|
236
|
-
"detail": f"exit={result.returncode}; {via} provider calls {before} → {count}",
|
|
237
|
-
}
|
|
238
|
-
)
|
|
239
|
-
return results
|
|
@@ -19,7 +19,7 @@ import time
|
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
from typing import Any
|
|
21
21
|
|
|
22
|
-
from localmodels import
|
|
22
|
+
from localmodels import harness_core, pi_profile, runtime_io, runtime_windows_acl
|
|
23
23
|
|
|
24
24
|
ADMINISTRATORS_SID = "S-1-5-32-544"
|
|
25
25
|
STAGING = "gateway-home.recovering"
|
|
@@ -28,7 +28,7 @@ CAUSE = "GATEWAY_HOME_NOT_PRIVATE"
|
|
|
28
28
|
_REPARSE_POINT = 0x400
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
class GatewayHomeError(
|
|
31
|
+
class GatewayHomeError(harness_core.HarnessError):
|
|
32
32
|
"""``gateway-home`` is not this user's private folder and this tool cannot prove it its own:
|
|
33
33
|
``cause`` and ``path`` are the structured fields an installer maps to its own copy."""
|
|
34
34
|
|
|
@@ -50,7 +50,7 @@ def reclaim(tools_dir: str) -> Path | None:
|
|
|
50
50
|
the folder is missing or already private, nothing happens."""
|
|
51
51
|
if sys.platform != "win32":
|
|
52
52
|
return None
|
|
53
|
-
home =
|
|
53
|
+
home = pi_profile.gateway_home(tools_dir)
|
|
54
54
|
if not os.path.lexists(home):
|
|
55
55
|
return None
|
|
56
56
|
try:
|
|
@@ -122,11 +122,11 @@ def owner_sid(path: Path) -> str:
|
|
|
122
122
|
)
|
|
123
123
|
if error:
|
|
124
124
|
raise OSError(error, "cannot read the folder's owner")
|
|
125
|
-
return
|
|
125
|
+
return runtime_windows_acl.sid_text(api, kernel, owner)
|
|
126
126
|
finally:
|
|
127
127
|
if descriptor.value:
|
|
128
128
|
kernel.LocalFree(descriptor)
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
def _api() -> tuple[Any, Any]:
|
|
132
|
-
return
|
|
132
|
+
return runtime_windows_acl.api()
|
|
@@ -9,8 +9,11 @@ from __future__ import annotations
|
|
|
9
9
|
import re
|
|
10
10
|
from typing import TypedDict
|
|
11
11
|
|
|
12
|
-
from localmodels import
|
|
13
|
-
from localmodels.
|
|
12
|
+
from localmodels import harness_gateway, hosts
|
|
13
|
+
from localmodels.harness_core import (
|
|
14
|
+
CALLER_KEY as CALLER_KEY,
|
|
15
|
+
)
|
|
16
|
+
from localmodels.harness_core import (
|
|
14
17
|
GatewayPlan,
|
|
15
18
|
HarnessError,
|
|
16
19
|
HarnessPlan,
|
|
@@ -29,7 +32,6 @@ class Check(TypedDict):
|
|
|
29
32
|
# The gateway key a stack adds for its callers: every model, no limits. A fixed, published value
|
|
30
33
|
# the user chose (2026-10-31); Magpie refuses keys of one's own with its sk-magpie- prefix.
|
|
31
34
|
CALLER_KEY_NAME = "localmodels"
|
|
32
|
-
CALLER_KEY = "sk-local-123456"
|
|
33
35
|
# Magpie's reply when the secret is already some gateway key's (ours from an earlier run, or one
|
|
34
36
|
# the user added); `gateway-key list` shows only the last four characters.
|
|
35
37
|
CALLER_KEY_TAKEN = "Another gateway key already has this key"
|
|
@@ -52,7 +54,7 @@ def ids(plan: ToolPlan) -> set[str] | None:
|
|
|
52
54
|
out = run_tool(
|
|
53
55
|
[tool_path(plan, "magpie"), "gateway-key", "list"],
|
|
54
56
|
timeout=20,
|
|
55
|
-
env=
|
|
57
|
+
env=harness_gateway.checked_gateway_environment(plan),
|
|
56
58
|
)
|
|
57
59
|
if out.returncode != 0:
|
|
58
60
|
return None
|
|
@@ -73,7 +75,7 @@ def ensure(plan: HarnessPlan) -> str | None:
|
|
|
73
75
|
[magpie, "gateway-key", "add", name, "--key", "-"],
|
|
74
76
|
timeout=60,
|
|
75
77
|
stdin_text=CALLER_KEY + "\n",
|
|
76
|
-
env=
|
|
78
|
+
env=harness_gateway.checked_gateway_environment(plan),
|
|
77
79
|
)
|
|
78
80
|
if out.returncode != 0 and CALLER_KEY_TAKEN in out.stderr:
|
|
79
81
|
return f"gateway-key {name}: {CALLER_KEY} already exists, reused"
|
|
@@ -100,7 +102,7 @@ def remove(plan: ToolPlan, owned: list[str], tools_dir: str) -> list[Check]:
|
|
|
100
102
|
out = run_tool(
|
|
101
103
|
[tool_path(plan, "magpie"), "gateway-key", "remove", kid],
|
|
102
104
|
timeout=60,
|
|
103
|
-
env=
|
|
105
|
+
env=harness_gateway.checked_gateway_environment(plan),
|
|
104
106
|
)
|
|
105
107
|
results.append(
|
|
106
108
|
{
|
|
@@ -17,7 +17,7 @@ import sys
|
|
|
17
17
|
from collections.abc import Callable
|
|
18
18
|
from typing import Literal, TypedDict
|
|
19
19
|
|
|
20
|
-
from localmodels import console, harness, hosts, process_identity
|
|
20
|
+
from localmodels import console, harness, harness_core, hosts, process_identity
|
|
21
21
|
from localmodels.gateway import AUX_PROVIDERS
|
|
22
22
|
from localmodels.gateway import magpie_binary as magpie_binary
|
|
23
23
|
from localmodels.harness_probe import first_line, listener_uids, shown_pi_model
|
|
@@ -134,7 +134,7 @@ def inspect(
|
|
|
134
134
|
]
|
|
135
135
|
|
|
136
136
|
def ask(*args: str) -> tuple[int, str]:
|
|
137
|
-
out =
|
|
137
|
+
out = harness_core.run_tool([magpie, *args], timeout=20, env=env)
|
|
138
138
|
return out.returncode, out.stdout
|
|
139
139
|
|
|
140
140
|
found = [_version(magpie, env), _health(ask, want["addr"], doc["gateway"]["started"], reapply)]
|
|
@@ -150,7 +150,7 @@ def inspect(
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
def _version(magpie: str, env: dict[str, str]) -> Finding:
|
|
153
|
-
line = first_line(
|
|
153
|
+
line = first_line(harness_core.run_tool([magpie, "--version"], timeout=20, env=env))
|
|
154
154
|
if not line:
|
|
155
155
|
return finding("gateway.version", "fail", f"{magpie} does not run", "reinstall Magpie")
|
|
156
156
|
have, pinned = line.split()[-1], harness.load_lock()["magpie"]["version"]
|
|
@@ -269,7 +269,7 @@ def usage(
|
|
|
269
269
|
return finding(
|
|
270
270
|
"gateway.usage", "warn", "cannot verify who owns the gateway; usage not queried"
|
|
271
271
|
)
|
|
272
|
-
out =
|
|
272
|
+
out = harness_core.run_tool(
|
|
273
273
|
[magpie, "usage", "--csv", "--last", USAGE_WINDOW],
|
|
274
274
|
timeout=30,
|
|
275
275
|
env=env,
|
|
@@ -271,14 +271,14 @@ def configure(root: Path, state: dict[str, Any]) -> tuple[dict[str, str], bool]:
|
|
|
271
271
|
runtime_io.write_private_json(providers, catalog)
|
|
272
272
|
if existing:
|
|
273
273
|
plan = gateway_foundations.tool_plan(root, env)
|
|
274
|
-
if gateway.
|
|
275
|
-
gateway.
|
|
276
|
-
gateway.
|
|
274
|
+
if gateway.run_magpie(plan, "provider", "simplex-selected").returncode == 0:
|
|
275
|
+
gateway.require_magpie(
|
|
276
|
+
gateway.run_magpie(plan, "provider", "rm", "simplex-selected"),
|
|
277
277
|
"replace selected credential",
|
|
278
278
|
)
|
|
279
279
|
if provider:
|
|
280
280
|
field = next(name for name in ("chat", "responses", "anthropic") if name in provider)
|
|
281
|
-
gateway.
|
|
281
|
+
gateway.configure_provider(
|
|
282
282
|
plan,
|
|
283
283
|
"simplex-selected",
|
|
284
284
|
provider["name"],
|
|
@@ -21,7 +21,7 @@ import io
|
|
|
21
21
|
import os
|
|
22
22
|
from typing import TypedDict
|
|
23
23
|
|
|
24
|
-
from localmodels import gateway_probe, harness, hosts
|
|
24
|
+
from localmodels import gateway_probe, harness, harness_core, hosts
|
|
25
25
|
from localmodels.stack_plan import StackPlan
|
|
26
26
|
|
|
27
27
|
BASIS = "gateway observation, not a benchmark"
|
|
@@ -130,7 +130,7 @@ def observe(doc: hosts.Owned, plan: StackPlan | None, magpie: str | None = None)
|
|
|
130
130
|
magpie = magpie or gateway_probe.magpie_binary(doc)
|
|
131
131
|
if magpie is None:
|
|
132
132
|
return _read("cannot find magpie", [])
|
|
133
|
-
out =
|
|
133
|
+
out = harness_core.run_tool(
|
|
134
134
|
[magpie, "usage", "--csv", "--last", WINDOW],
|
|
135
135
|
timeout=TIMEOUT,
|
|
136
136
|
env={**os.environ, "MAGPIE_ADDR": gateway_probe.expected(doc, plan)["addr"]},
|