@gobing-ai/ts-laya-mlx 0.5.22 → 0.5.24
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 +6 -0
- package/dist/driver.d.ts.map +1 -1
- package/dist/driver.js +4 -0
- package/package.json +3 -3
- package/src/driver.ts +4 -0
package/README.md
CHANGED
|
@@ -59,6 +59,11 @@ Measured on an Apple Silicon Mac (official checkpoint, f16, 3-question batch, 20
|
|
|
59
59
|
createLayaDriver({ core: 'mlx-native', modelPath: '/models/laya-ft-kk' });
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
The returned driver implements `dispose()`, which closes the client it was built with — the
|
|
63
|
+
`mlx-python` worker is held warm for the client's lifetime, and its open pipes otherwise keep a
|
|
64
|
+
one-shot parent process alive after the last answer. Call it through `maker.dispose()` (from
|
|
65
|
+
`createDecisionMaker`) or `registry.dispose('laya-local')`.
|
|
66
|
+
|
|
62
67
|
---
|
|
63
68
|
|
|
64
69
|
## Backend selection (`ts-ai-runner`)
|
|
@@ -99,6 +104,7 @@ Resolution order: `options.driver` (custom driver double) → `options.backend`
|
|
|
99
104
|
| Dimension | Hosted TypeSafe (`ts-ai-runner`) | Local Laya (`ts-laya-mlx`) | Notes |
|
|
100
105
|
|-----------|----------------------------------|---------------------------|-------|
|
|
101
106
|
| **Factory** | `createTypesafeDriver(config)` | `createLayaDriver(options)` | Both return `DecisionDriver` with single `ask()` method. |
|
|
107
|
+
| **Release** | none (stateless HTTP) | `dispose()` closes the warm worker | A `laya-local` maker must be disposed or a one-shot parent never exits. |
|
|
102
108
|
| **Driver name** | `'typesafe'` | `'laya-local'` | Available on `driver.name`. |
|
|
103
109
|
| **Credentials** | `apiKey: string` (`TYPESAFE_API_KEY`) | `env.HF_TOKEN` (optional) | Local inference needs no key; token only for gated HF repos. |
|
|
104
110
|
| **Model selector** | `model?: string` | `modelId?: string` | Default: `'convaiinnovations/laya-multilingual'`. |
|
package/dist/driver.d.ts.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AQ,EAAE,QAAQ,GAAG,cAAc,CA8BnE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CA2E9E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,cAAc,CAwChF"}
|
package/dist/driver.js
CHANGED
|
@@ -210,6 +210,10 @@ export function createLayaDriver(options = {}) {
|
|
|
210
210
|
const client = options.client ?? createLayaClient(options);
|
|
211
211
|
return {
|
|
212
212
|
name: 'laya-local',
|
|
213
|
+
// The client holds a warm Python worker for its lifetime (and the worker's open pipes keep
|
|
214
|
+
// a one-shot parent alive), so the driver exposes the release the client already owns; a
|
|
215
|
+
// consumer that made no call has nothing to close and every dispose is idempotent.
|
|
216
|
+
dispose: () => client.dispose(),
|
|
213
217
|
async ask({ state, questions, }) {
|
|
214
218
|
if (!questions || typeof questions !== 'object' || Object.keys(questions).length === 0) {
|
|
215
219
|
throw new DecisionRequestError('expected a nonempty question map', undefined, undefined);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-laya-mlx",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.24",
|
|
4
4
|
"description": "@gobing-ai/ts-laya-mlx — Local Laya decision backend driving the vendored MLX runtime over a process bridge.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-laya-mlx-v<version> && git push --tags' && exit 1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@gobing-ai/ts-ai-runner": "^0.5.
|
|
56
|
-
"@gobing-ai/ts-runtime": "^0.5.
|
|
55
|
+
"@gobing-ai/ts-ai-runner": "^0.5.24",
|
|
56
|
+
"@gobing-ai/ts-runtime": "^0.5.24",
|
|
57
57
|
"@johnhenry/laya": "0.3.2"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
package/src/driver.ts
CHANGED
|
@@ -262,6 +262,10 @@ export function createLayaDriver(options: LayaDriverOptions = {}): DecisionDrive
|
|
|
262
262
|
|
|
263
263
|
return {
|
|
264
264
|
name: 'laya-local',
|
|
265
|
+
// The client holds a warm Python worker for its lifetime (and the worker's open pipes keep
|
|
266
|
+
// a one-shot parent alive), so the driver exposes the release the client already owns; a
|
|
267
|
+
// consumer that made no call has nothing to close and every dispose is idempotent.
|
|
268
|
+
dispose: () => client.dispose(),
|
|
265
269
|
async ask({
|
|
266
270
|
state,
|
|
267
271
|
questions,
|