@mlx-node/server 0.0.9 → 0.0.12
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/dist/chat-session-warm-reuse.d.ts +10 -12
- package/dist/chat-session-warm-reuse.d.ts.map +1 -1
- package/dist/chat-session-warm-reuse.js +10 -12
- package/dist/endpoints/messages.d.ts +2 -2
- package/dist/endpoints/messages.d.ts.map +1 -1
- package/dist/endpoints/messages.js +492 -349
- package/dist/endpoints/responses.d.ts +1 -1
- package/dist/endpoints/responses.d.ts.map +1 -1
- package/dist/endpoints/responses.js +1149 -1055
- package/dist/handler.d.ts.map +1 -1
- package/dist/handler.js +1 -1
- package/dist/health.d.ts +4 -6
- package/dist/health.d.ts.map +1 -1
- package/dist/host/discover.d.ts +1 -2
- package/dist/host/discover.d.ts.map +1 -1
- package/dist/host/discover.js +3 -6
- package/dist/host/index.d.ts +6 -1
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +3 -2
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -9
- package/dist/mappers/anthropic-request.d.ts.map +1 -1
- package/dist/mappers/anthropic-request.js +5 -1
- package/dist/mappers/request.d.ts +12 -2
- package/dist/mappers/request.d.ts.map +1 -1
- package/dist/mappers/request.js +26 -2
- package/dist/model-work-coordinator.d.ts +50 -0
- package/dist/model-work-coordinator.d.ts.map +1 -1
- package/dist/model-work-coordinator.js +161 -0
- package/dist/registry.d.ts +15 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +51 -0
- package/dist/server.d.ts +21 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +30 -6
- package/dist/session-registry.d.ts +266 -86
- package/dist/session-registry.d.ts.map +1 -1
- package/dist/session-registry.js +421 -107
- package/dist/streaming.d.ts +37 -2
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +122 -1
- package/dist/transport-visibility.d.ts +5 -4
- package/dist/transport-visibility.d.ts.map +1 -1
- package/dist/transport-visibility.js +5 -4
- package/dist/types-anthropic.d.ts +7 -0
- package/dist/types-anthropic.d.ts.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/presets.d.ts +0 -82
- package/dist/presets.d.ts.map +0 -1
- package/dist/presets.js +0 -98
|
@@ -7,19 +7,17 @@
|
|
|
7
7
|
* and nothing re-exports it. Callers are the two server endpoints —
|
|
8
8
|
* `endpoints/responses.ts` (tier-1 / tier-2 HIT branch) and
|
|
9
9
|
* `endpoints/messages.ts` (`getOrCreateWarmAny` HIT branch) — each
|
|
10
|
-
* invoking the helper
|
|
10
|
+
* invoking the helper only when native cache reuse is authorized: either a
|
|
11
|
+
* `SessionRegistry` hit or a block-paged model whose allocator validates
|
|
12
|
+
* reusable prefixes by content hash and isolates live cache owners.
|
|
11
13
|
*
|
|
12
|
-
* Why this helper exists at all: `ChatSession.reset()`
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* DOES have that HIT gate — the registry's own `getOrCreate` hit
|
|
20
|
-
* signal is the authoritative proof that the native cache genuinely
|
|
21
|
-
* belongs to this chain — so a JS-state-only reset that preserves the
|
|
22
|
-
* native cache is correct there and only there.
|
|
14
|
+
* Why this helper exists at all: public `ChatSession.reset()` invalidates the
|
|
15
|
+
* current session's native state — owner-scoped on block-paged models and
|
|
16
|
+
* model-wide on exclusive/flat models. A warm registry HIT instead needs to
|
|
17
|
+
* preserve the already-authorized native prefix while clearing only the JS
|
|
18
|
+
* conversation wrapper. Warm leases provide the ownership gate; block-paged
|
|
19
|
+
* adapters provide the content-verification gate. A JS-state-only reset is
|
|
20
|
+
* valid in either case.
|
|
23
21
|
*
|
|
24
22
|
* Fields accessed: `inFlight`, `history`, `lastImagesKey`, `lastAudioKey`, `turnCount`,
|
|
25
23
|
* `unresolvedOkToolCallCount`, `needsFullReplay`, `defaultConfig`, `activeTools`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-session-warm-reuse.d.ts","sourceRoot":"","sources":["../src/chat-session-warm-reuse.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chat-session-warm-reuse.d.ts","sourceRoot":"","sources":["../src/chat-session-warm-reuse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAc,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAqBjF;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,sCAAsC,CAAC,CAAC,SAAS,mBAAmB,EACxF,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|
|
@@ -7,19 +7,17 @@
|
|
|
7
7
|
* and nothing re-exports it. Callers are the two server endpoints —
|
|
8
8
|
* `endpoints/responses.ts` (tier-1 / tier-2 HIT branch) and
|
|
9
9
|
* `endpoints/messages.ts` (`getOrCreateWarmAny` HIT branch) — each
|
|
10
|
-
* invoking the helper
|
|
10
|
+
* invoking the helper only when native cache reuse is authorized: either a
|
|
11
|
+
* `SessionRegistry` hit or a block-paged model whose allocator validates
|
|
12
|
+
* reusable prefixes by content hash and isolates live cache owners.
|
|
11
13
|
*
|
|
12
|
-
* Why this helper exists at all: `ChatSession.reset()`
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* DOES have that HIT gate — the registry's own `getOrCreate` hit
|
|
20
|
-
* signal is the authoritative proof that the native cache genuinely
|
|
21
|
-
* belongs to this chain — so a JS-state-only reset that preserves the
|
|
22
|
-
* native cache is correct there and only there.
|
|
14
|
+
* Why this helper exists at all: public `ChatSession.reset()` invalidates the
|
|
15
|
+
* current session's native state — owner-scoped on block-paged models and
|
|
16
|
+
* model-wide on exclusive/flat models. A warm registry HIT instead needs to
|
|
17
|
+
* preserve the already-authorized native prefix while clearing only the JS
|
|
18
|
+
* conversation wrapper. Warm leases provide the ownership gate; block-paged
|
|
19
|
+
* adapters provide the content-verification gate. A JS-state-only reset is
|
|
20
|
+
* valid in either case.
|
|
23
21
|
*
|
|
24
22
|
* Fields accessed: `inFlight`, `history`, `lastImagesKey`, `lastAudioKey`, `turnCount`,
|
|
25
23
|
* `unresolvedOkToolCallCount`, `needsFullReplay`, `defaultConfig`, `activeTools`.
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* * **Non-paged path** (Qwen3.5 dense + MoE — default-off pending a
|
|
32
32
|
* perf decision; the Qianfan-OCR VLM — no adapter wired). Each
|
|
33
33
|
* request looks up the warm slot via
|
|
34
|
-
* `SessionRegistry.getOrCreateWarmAny(requestedSystem)`. On a
|
|
34
|
+
* `SessionRegistry.getOrCreateWarmAny(requestedSystem, cacheSalt)`. On a
|
|
35
35
|
* HIT we keep the underlying native KV cache alive
|
|
36
36
|
* (`resetPreservingNativeCacheForWarmReuse` wipes only JS-side
|
|
37
37
|
* session state) so the native `verify_cache_prefix_direct` can
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
*/
|
|
59
59
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
60
60
|
import type { IdleSweeper } from '../idle-sweeper.js';
|
|
61
|
-
import type
|
|
61
|
+
import { type ModelWorkCoordinator } from '../model-work-coordinator.js';
|
|
62
62
|
import type { ModelRegistry } from '../registry.js';
|
|
63
63
|
import type { AnthropicMessagesRequest } from '../types-anthropic.js';
|
|
64
64
|
export declare function handleCreateMessage(res: ServerResponse, body: AnthropicMessagesRequest, registry: ModelRegistry, httpReq?: IncomingMessage, idleSweeper?: IdleSweeper | null, resolveModel?: (name: string) => Promise<void>, modelWorkCoordinator?: ModelWorkCoordinator): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/endpoints/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAajE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAgBtD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/endpoints/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAajE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAgBtD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAsBpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AA64BtE,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,wBAAwB,EAC9B,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,eAAe,EACzB,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,EAChC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC9C,oBAAoB,CAAC,EAAE,oBAAoB,GAC1C,OAAO,CAAC,IAAI,CAAC,CAiwBf"}
|