prism-mcp-server 20.21.27 → 20.22.1
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/README.md +118 -0
- package/dist/tools/prismInferHandler.js +368 -78
- package/dist/utils/checkpointIdentity.js +230 -0
- package/dist/utils/layer1.js +115 -8
- package/dist/utils/omlxControl.js +73 -0
- package/dist/utils/omlxJobControl.js +373 -0
- package/dist/utils/omlxLayer1.js +59 -0
- package/dist/utils/omlxOwned.js +164 -0
- package/dist/utils/omlxProvider.js +791 -0
- package/dist/utils/workloadRouting.js +208 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,71 @@ A paid subscription adds cloud sync, higher model tiers, and team features throu
|
|
|
59
59
|
never sent to the cloud), and local/cloud usage is recorded for
|
|
60
60
|
review.
|
|
61
61
|
|
|
62
|
+
### Explicit on-device oMLX drafts
|
|
63
|
+
|
|
64
|
+
`prism_infer` keeps Ollama's four-tier routing by default. For an explicitly
|
|
65
|
+
selected text-only code or advisory reviewer draft, pass `local_backend: "omlx"`,
|
|
66
|
+
`mode: "code"`, and optionally `local_model` with the exact advertised model ID.
|
|
67
|
+
This path authenticates `/v1/models` before classification or any Ollama unload;
|
|
68
|
+
an unavailable, unauthenticated, or mismatched model refuses without substitution.
|
|
69
|
+
It reads `OMLX_API_KEY` or the local `~/.omlx/settings.json` key, and model/context
|
|
70
|
+
settings from `~/.omlx/model_settings.json`; `OMLX_MODEL` and a loopback-only
|
|
71
|
+
`OMLX_BASE_URL` can select local configuration. Redirects are refused.
|
|
72
|
+
|
|
73
|
+
**Requires** an oMLX build with Prism's control routes: the
|
|
74
|
+
[`prism-v0.7.1rc1` branch of dcostenco/omlx](https://github.com/dcostenco/omlx/tree/prism-v0.7.1rc1), upstream oMLX
|
|
75
|
+
0.7.1rc1 plus those routes ([install and settings](https://github.com/dcostenco/omlx/blob/prism-v0.7.1rc1/PRISM.md)). With stock
|
|
76
|
+
oMLX every call is refused. Generation runs as an owned
|
|
77
|
+
job through those routes, so a timeout or cancel is reported only once the
|
|
78
|
+
server confirms the request stopped. An unconfirmed stop refuses later calls
|
|
79
|
+
(`omlx_stop_unproved`, `omlx_provider_busy`).
|
|
80
|
+
|
|
81
|
+
Before classification, Prism unloads every model Ollama has loaded
|
|
82
|
+
(`keep_alive: 0`; the weights stay on disk and reload on the next Ollama call)
|
|
83
|
+
and waits up to 10 seconds for Ollama to report none. A failed unload, a model
|
|
84
|
+
that does not drain, or one loading meanwhile refuses the call; a newcomer is
|
|
85
|
+
never unloaded. Ollama must be reachable for this step. An OS-owned loopback
|
|
86
|
+
lease on port 19438 excludes other candidate MCP processes; ordinary calls within
|
|
87
|
+
one process share this lease. A busy lease refuses (`omlx_resource_busy`) before
|
|
88
|
+
classification or unloading, and process exit releases it without lock-file
|
|
89
|
+
cleanup. In-process inference and classification wait while an oMLX call owns
|
|
90
|
+
the device. Unknown Ollama state, newly loaded Ollama weights, or available
|
|
91
|
+
memory below a 2 GiB reserve aborts/withholds the generation. Model caches and
|
|
92
|
+
daemons remain in place. Legacy/unmodified MCP processes do not honor the lease;
|
|
93
|
+
their contention is observed and rejected by the watcher.
|
|
94
|
+
|
|
95
|
+
**Safety screen.** The classifier on this path is the public
|
|
96
|
+
`dcostenco/prism-coder-9b-mlx-8bit`, installed under the name
|
|
97
|
+
`prism-coder-9b-mlx-8bit` in oMLX's model folder (about 9.2 GB while loaded).
|
|
98
|
+
Layer 1's rules only refuse here; the classifier reads everything else, and a
|
|
99
|
+
prompt over 4,000 characters is read whole in 3,600-character windows (the most
|
|
100
|
+
severe verdict stands), never as an excerpt. A classifier failure, an unreadable
|
|
101
|
+
answer, or a missing classifier refuses the call; there is no keyword or Ollama
|
|
102
|
+
fallback. Each classifier read is bounded by 90 seconds and by the call's
|
|
103
|
+
remaining `timeout_ms`, so a classifier that macOS paged out during a long idle
|
|
104
|
+
is waited for rather than refused, and an oversize prompt read in windows
|
|
105
|
+
cannot outlast the call budget; the first unrecoverable read ends the
|
|
106
|
+
classification.
|
|
107
|
+
|
|
108
|
+
Configured oMLX sampling and reasoning are preserved unless `temperature` or
|
|
109
|
+
`think` is explicit, including through repairs. Generic thinking-disable retries
|
|
110
|
+
are disabled for oMLX, so a model with no thinking budget in oMLX's model
|
|
111
|
+
settings can spend its whole answer reasoning and is refused `think_only`: give
|
|
112
|
+
it a budget there, or pass `think: false`. The default 300-second budget bounds
|
|
113
|
+
oMLX generation, repairs, and history answer checks; `timeout_ms` may override it
|
|
114
|
+
up to 900 seconds. Context sizing uses conservative UTF-8 bytes and the
|
|
115
|
+
configured window.
|
|
116
|
+
|
|
117
|
+
The same entitlement, reserved-content, history, quality, output-safety, and
|
|
118
|
+
verification policies apply. Explicit oMLX never falls back to Ollama/cloud
|
|
119
|
+
inference. `cloud_fallback: false`, `verify: false`, and `route_guard: "local"`
|
|
120
|
+
keep content-bearing cloud channels disabled for a local draft. Result metadata
|
|
121
|
+
reports `backend: "omlx"`, the selected model, tokens, and `gate_outcome`.
|
|
122
|
+
The MCP envelope carries this public metadata in `structuredContent` alongside
|
|
123
|
+
the existing human header/output text; `next_step` remains available in both.
|
|
124
|
+
Runtime authentication and internal verifier traces are excluded.
|
|
125
|
+
A draft is advisory and requires independent host review; it is not final sign-off.
|
|
126
|
+
|
|
62
127
|
## Get started
|
|
63
128
|
|
|
64
129
|
Memory search automatically applies ACT-R ranking: relevance plus recency,
|
|
@@ -170,6 +235,59 @@ or by re-enabling after each run.
|
|
|
170
235
|
<details>
|
|
171
236
|
<summary>Release history (optional)</summary>
|
|
172
237
|
|
|
238
|
+
## What's New in v20.22.1
|
|
239
|
+
|
|
240
|
+
**Why it matters:** on explicit oMLX, a long prompt could keep the device busy
|
|
241
|
+
for minutes while being classified, and `timeout_ms` did not limit it.
|
|
242
|
+
|
|
243
|
+
- **The call budget now covers classification.** `timeout_ms` (default 300 s)
|
|
244
|
+
starts before the safety screen, and each classifier read is bounded by the
|
|
245
|
+
remaining budget as well as its own 90 s.
|
|
246
|
+
- **A failed read ends the classification.** An oversize prompt is read in
|
|
247
|
+
3,600-character windows; a read that fails already means refusal on this
|
|
248
|
+
path, so the remaining windows are no longer read. Before, a stalled server
|
|
249
|
+
could cost about four minutes per window.
|
|
250
|
+
- **Tests:** the owned-job marker tests pin the size limit and the
|
|
251
|
+
non-blocking open directly.
|
|
252
|
+
|
|
253
|
+
## What's New in v20.22.0
|
|
254
|
+
|
|
255
|
+
**Why it matters:** on Apple Silicon, `prism_infer` can now draft code on an
|
|
256
|
+
oMLX server instead of Ollama, opt-in per call, behind its own safety screen.
|
|
257
|
+
Separately, Layer 1 now marks two more kinds of auth request reserved, on every
|
|
258
|
+
path.
|
|
259
|
+
|
|
260
|
+
- **Opt-in oMLX backend:** `local_backend: "omlx"` with `mode: "code"`, text
|
|
261
|
+
only. Nothing changes for calls that do not ask for it. It **requires** the
|
|
262
|
+
oMLX build with Prism's control routes, published as the
|
|
263
|
+
[`prism-v0.7.1rc1` branch of dcostenco/omlx](https://github.com/dcostenco/omlx/tree/prism-v0.7.1rc1)
|
|
264
|
+
([install and settings](https://github.com/dcostenco/omlx/blob/prism-v0.7.1rc1/PRISM.md)); with stock oMLX every call is refused.
|
|
265
|
+
- **Its own safety screen:** the 9b classifier on the same oMLX server reads
|
|
266
|
+
every request; rules only refuse. In our tests, of 327 labelled sensitive
|
|
267
|
+
requests, the 9b alone let 2 run locally, against 19 for the 4b classifier
|
|
268
|
+
on Ollama; two rules written after reviewing those rows bring this path to
|
|
269
|
+
0, so 0 is not an out-of-sample figure. Of 294 routine requests, 2 were
|
|
270
|
+
escalated (27 on Ollama). Of 135 adversarial probes, 3 ran locally, all one
|
|
271
|
+
shape (a documentation field).
|
|
272
|
+
- **Speed and cost:** a classifier read took about 0.37 s at the 95th
|
|
273
|
+
percentile on an idle machine and up to 0.65 s under load. The first read
|
|
274
|
+
after a long idle took 14.5 s, because macOS had paged the classifier out,
|
|
275
|
+
so Prism waits up to 90 s for it instead of refusing. The classifier holds
|
|
276
|
+
about 9.2 GB while loaded (9.7 GB peak).
|
|
277
|
+
- **Fails closed:** a classifier failure, an unreadable answer or a missing
|
|
278
|
+
model refuses the call; it never falls back to a keyword check or to
|
|
279
|
+
Ollama. A long prompt is read whole, in windows, not as an excerpt.
|
|
280
|
+
- **Frees memory first:** Ollama's loaded models are unloaded before the call
|
|
281
|
+
(they reload on the next Ollama call), so the two runtimes do not hold large
|
|
282
|
+
models at once.
|
|
283
|
+
- **Layer 1, every path:** a request that decides whether signed-out,
|
|
284
|
+
anonymous or guest users may reach a route, page or endpoint (granting or
|
|
285
|
+
blocking it), makes one public, or gives them admin rights is marked
|
|
286
|
+
reserved by rule, and so is code that exchanges an authorization code for
|
|
287
|
+
tokens. Measured on the 327 sensitive requests on
|
|
288
|
+
the default Ollama path: 18 now run locally, against 19 before; routine
|
|
289
|
+
escalations are unchanged (27 of 294).
|
|
290
|
+
|
|
173
291
|
## What's New in v20.21.27
|
|
174
292
|
|
|
175
293
|
**Why it matters:** a script that feeds Prism Browser through a pipe can
|