dsh-plugin-local-infer 0.1.2 → 0.1.4
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 +32 -6
- package/cordis.patch.yml +7 -0
- package/docs/zh/README.md +24 -4
- package/dsh/client.js +4200 -4049
- package/package.json +33 -11
- package/packages/core/lib/adapter.d.ts +177 -11
- package/packages/core/lib/adapter.js +74 -1
- package/packages/core/lib/config.d.ts +1 -1
- package/packages/core/lib/config.js +1 -1
- package/packages/core/lib/debug.d.ts +1 -1
- package/packages/core/lib/debug.js +1 -1
- package/packages/core/lib/defaults.d.ts +1 -1
- package/packages/core/lib/defaults.js +1 -1
- package/packages/core/lib/deps.d.ts +48 -20
- package/packages/core/lib/deps.js +24 -8
- package/packages/core/lib/estimator.d.ts +1 -1
- package/packages/core/lib/estimator.js +1 -1
- package/packages/core/lib/guideline.d.ts +1 -1
- package/packages/core/lib/guideline.js +1 -1
- package/packages/core/lib/hardware.d.ts +1 -1
- package/packages/core/lib/hardware.js +1 -1
- package/packages/core/lib/hf-cache.d.ts +70 -0
- package/packages/core/lib/hf-cache.js +83 -0
- package/packages/core/lib/index.d.ts +16 -9
- package/packages/core/lib/index.js +10 -6
- package/packages/core/lib/infer-cache.d.ts +39 -0
- package/packages/core/lib/infer-cache.js +53 -0
- package/packages/core/lib/launch-command.d.ts +8 -4
- package/packages/core/lib/launch-command.js +13 -6
- package/packages/core/lib/launch-record.d.ts +1 -1
- package/packages/core/lib/launch-record.js +1 -1
- package/packages/core/lib/logs.d.ts +8 -1
- package/packages/core/lib/logs.js +12 -4
- package/packages/core/lib/models.d.ts +120 -14
- package/packages/core/lib/models.js +209 -17
- package/packages/core/lib/parameter.d.ts +31 -3
- package/packages/core/lib/parameter.js +1 -1
- package/packages/core/lib/progress.d.ts +54 -0
- package/packages/core/lib/progress.js +120 -0
- package/packages/core/lib/registrar.d.ts +25 -14
- package/packages/core/lib/registrar.js +30 -10
- package/packages/core/lib/reserve.d.ts +11 -3
- package/packages/core/lib/reserve.js +6 -4
- package/packages/core/lib/status.d.ts +12 -6
- package/packages/core/lib/status.js +21 -10
- package/packages/core/lib/sudo.d.ts +80 -0
- package/packages/core/lib/sudo.js +78 -0
- package/packages/core/package.json +1 -1
- package/packages/orchestrator/lib/config.d.ts +63 -0
- package/packages/orchestrator/lib/config.js +111 -0
- package/packages/orchestrator/lib/index.d.ts +51 -0
- package/packages/orchestrator/lib/index.js +73 -0
- package/packages/orchestrator/lib/route.d.ts +60 -0
- package/packages/orchestrator/lib/route.js +159 -0
- package/packages/orchestrator/locale/en.json +6 -0
- package/packages/orchestrator/package.json +39 -0
- package/packages/orchestrator/prompt.md +87 -0
- package/packages/providers/lib/acquire.d.ts +95 -15
- package/packages/providers/lib/acquire.js +239 -40
- package/packages/providers/lib/adapters.d.ts +155 -221
- package/packages/providers/lib/adapters.js +589 -935
- package/packages/providers/lib/debug.d.ts +1 -1
- package/packages/providers/lib/debug.js +1 -1
- package/packages/providers/lib/deps.d.ts +31 -212
- package/packages/providers/lib/deps.js +71 -205
- package/packages/providers/lib/engines/basalt/basalt.d.ts +130 -0
- package/packages/providers/lib/engines/basalt/basalt.js +304 -0
- package/packages/providers/lib/engines/basalt/basaltAdapter.d.ts +85 -0
- package/packages/providers/lib/engines/basalt/basaltAdapter.js +439 -0
- package/packages/providers/lib/engines/basalt/basaltLinux.d.ts +23 -0
- package/packages/providers/lib/engines/basalt/basaltLinux.js +47 -0
- package/packages/providers/lib/engines/basalt/basaltMacOS.d.ts +17 -0
- package/packages/providers/lib/engines/basalt/basaltMacOS.js +19 -0
- package/packages/providers/lib/engines/basalt/basaltWindows.d.ts +24 -0
- package/packages/providers/lib/engines/basalt/basaltWindows.js +49 -0
- package/packages/providers/lib/engines/engineOs.d.ts +24 -0
- package/packages/providers/lib/engines/engineOs.js +17 -0
- package/packages/providers/lib/{hyperqwen.d.ts → engines/hyperqwen/hyperqwen.d.ts} +2 -2
- package/packages/providers/lib/{hyperqwen.js → engines/hyperqwen/hyperqwen.js} +14 -2
- package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.d.ts +38 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.js +115 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.d.ts +10 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.js +14 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.js +9 -0
- package/packages/providers/lib/{infernix.d.ts → engines/infernix/infernix.d.ts} +7 -4
- package/packages/providers/lib/{infernix.js → engines/infernix/infernix.js} +53 -8
- package/packages/providers/lib/engines/infernix/infernixAdapter.d.ts +52 -0
- package/packages/providers/lib/engines/infernix/infernixAdapter.js +235 -0
- package/packages/providers/lib/engines/infernix/infernixArch.d.ts +9 -0
- package/packages/providers/lib/engines/infernix/infernixArch.js +9 -0
- package/packages/providers/lib/engines/infernix/infernixDebian.d.ts +9 -0
- package/packages/providers/lib/engines/infernix/infernixDebian.js +9 -0
- package/packages/providers/lib/engines/infernix/infernixFedora.d.ts +9 -0
- package/packages/providers/lib/engines/infernix/infernixFedora.js +9 -0
- package/packages/providers/lib/engines/infernix/infernixLinux.d.ts +17 -0
- package/packages/providers/lib/engines/infernix/infernixLinux.js +35 -0
- package/packages/providers/lib/engines/infernix/infernixMacOS.d.ts +16 -0
- package/packages/providers/lib/engines/infernix/infernixMacOS.js +18 -0
- package/packages/providers/lib/engines/infernix/infernixWindows.d.ts +16 -0
- package/packages/providers/lib/engines/infernix/infernixWindows.js +34 -0
- package/packages/providers/lib/{llamacpp.d.ts → engines/llamacpp/llamacpp.d.ts} +2 -2
- package/packages/providers/lib/{llamacpp.js → engines/llamacpp/llamacpp.js} +12 -2
- package/packages/providers/lib/engines/llamacpp/llamacppAdapter.d.ts +50 -0
- package/packages/providers/lib/engines/llamacpp/llamacppAdapter.js +274 -0
- package/packages/providers/lib/engines/llamacpp/llamacppArch.d.ts +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppArch.js +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppDebian.d.ts +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppDebian.js +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppFedora.d.ts +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppFedora.js +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppLinux.d.ts +17 -0
- package/packages/providers/lib/engines/llamacpp/llamacppLinux.js +28 -0
- package/packages/providers/lib/engines/llamacpp/llamacppMacOS.d.ts +15 -0
- package/packages/providers/lib/engines/llamacpp/llamacppMacOS.js +17 -0
- package/packages/providers/lib/engines/llamacpp/llamacppWindows.d.ts +15 -0
- package/packages/providers/lib/engines/llamacpp/llamacppWindows.js +26 -0
- package/packages/providers/lib/{ninfer.d.ts → engines/ninfer/ninfer.d.ts} +2 -2
- package/packages/providers/lib/{ninfer.js → engines/ninfer/ninfer.js} +25 -3
- package/packages/providers/lib/engines/ninfer/ninferAdapter.d.ts +81 -0
- package/packages/providers/lib/engines/ninfer/ninferAdapter.js +392 -0
- package/packages/providers/lib/engines/ninfer/ninferArch.d.ts +9 -0
- package/packages/providers/lib/engines/ninfer/ninferArch.js +9 -0
- package/packages/providers/lib/engines/ninfer/ninferDebian.d.ts +9 -0
- package/packages/providers/lib/engines/ninfer/ninferDebian.js +9 -0
- package/packages/providers/lib/engines/ninfer/ninferFedora.d.ts +9 -0
- package/packages/providers/lib/engines/ninfer/ninferFedora.js +9 -0
- package/packages/providers/lib/engines/ninfer/ninferLinux.d.ts +17 -0
- package/packages/providers/lib/engines/ninfer/ninferLinux.js +37 -0
- package/packages/providers/lib/engines/ninfer/ninferMacOS.d.ts +15 -0
- package/packages/providers/lib/engines/ninfer/ninferMacOS.js +17 -0
- package/packages/providers/lib/engines/ninfer/ninferWindows.d.ts +29 -0
- package/packages/providers/lib/engines/ninfer/ninferWindows.js +59 -0
- package/packages/providers/lib/engines/strata/strata.d.ts +1 -0
- package/packages/providers/lib/engines/strata/strata.js +264 -0
- package/packages/providers/lib/engines/strata/strataAdapter.d.ts +97 -0
- package/packages/providers/lib/engines/strata/strataAdapter.js +463 -0
- package/packages/providers/lib/engines/strata/strataArch.d.ts +9 -0
- package/packages/providers/lib/engines/strata/strataArch.js +9 -0
- package/packages/providers/lib/engines/strata/strataDebian.d.ts +9 -0
- package/packages/providers/lib/engines/strata/strataDebian.js +9 -0
- package/packages/providers/lib/engines/strata/strataFedora.d.ts +9 -0
- package/packages/providers/lib/engines/strata/strataFedora.js +9 -0
- package/packages/providers/lib/engines/strata/strataLinux.d.ts +21 -0
- package/packages/providers/lib/engines/strata/strataLinux.js +30 -0
- package/packages/providers/lib/engines/strata/strataMacOS.d.ts +16 -0
- package/packages/providers/lib/engines/strata/strataMacOS.js +17 -0
- package/packages/providers/lib/engines/strata/strataWindows.d.ts +27 -0
- package/packages/providers/lib/engines/strata/strataWindows.js +37 -0
- package/packages/providers/lib/engines.d.ts +8 -5
- package/packages/providers/lib/engines.js +22 -11
- package/packages/providers/lib/guidelines.d.ts +5 -4
- package/packages/providers/lib/guidelines.js +18 -5
- package/packages/providers/lib/index.d.ts +33 -24
- package/packages/providers/lib/index.js +46 -24
- package/packages/providers/lib/model-defaults.d.ts +10 -5
- package/packages/providers/lib/model-defaults.js +47 -5
- package/packages/providers/lib/platform.d.ts +8 -5
- package/packages/providers/lib/platform.js +27 -7
- package/packages/providers/lib/presets.d.ts +6 -4
- package/packages/providers/lib/presets.js +53 -5
- package/packages/providers/lib/systemDeps.d.ts +313 -0
- package/packages/providers/lib/systemDeps.js +284 -0
- package/packages/providers/lib/vram.d.ts +34 -8
- package/packages/providers/lib/vram.js +81 -8
- package/packages/providers/package.json +2 -2
- package/packages/service/lib/index.d.ts +187 -23
- package/packages/service/lib/index.js +667 -90
- package/packages/service/lib/launch-target.d.ts +19 -0
- package/packages/service/lib/launch-target.js +28 -0
- package/packages/service/lib/run-logs.d.ts +72 -0
- package/packages/service/lib/run-logs.js +125 -0
- package/packages/service/lib/types.d.ts +166 -8
- package/packages/service/lib/types.js +1 -1
- package/packages/service/package.json +2 -2
- package/packages/tool/lib/index.d.ts +1 -1
- package/packages/tool/lib/index.js +1 -1
- package/packages/tool/package.json +2 -2
- package/packages/ui/lib/config.d.ts +89 -0
- package/packages/ui/lib/config.js +251 -0
- package/packages/ui/lib/deps.d.ts +4 -4
- package/packages/ui/lib/deps.js +1 -1
- package/packages/ui/lib/form.d.ts +1 -1
- package/packages/ui/lib/form.js +1 -1
- package/packages/ui/lib/index.d.ts +7 -1
- package/packages/ui/lib/index.js +12 -2
- package/packages/ui/lib/meter.d.ts +1 -1
- package/packages/ui/lib/meter.js +1 -1
- package/packages/ui/lib/ops/engine.d.ts +216 -0
- package/packages/ui/lib/ops/engine.js +697 -0
- package/packages/ui/lib/ops/get-steps.d.ts +98 -0
- package/packages/ui/lib/ops/get-steps.js +359 -0
- package/packages/ui/lib/ops/hf.d.ts +42 -0
- package/packages/ui/lib/ops/hf.js +150 -0
- package/packages/ui/lib/ops/logs.d.ts +78 -0
- package/packages/ui/lib/ops/logs.js +119 -0
- package/packages/ui/lib/ops/model.d.ts +71 -0
- package/packages/ui/lib/ops/model.js +123 -0
- package/packages/ui/lib/request.d.ts +106 -0
- package/packages/ui/lib/request.js +80 -0
- package/packages/ui/lib/route.d.ts +106 -422
- package/packages/ui/lib/route.js +136 -1845
- package/packages/ui/lib/routes/chat-template.d.ts +1 -0
- package/packages/ui/lib/routes/chat-template.js +1 -0
- package/packages/ui/lib/routes/deps.d.ts +1 -0
- package/packages/ui/lib/routes/deps.js +1 -0
- package/packages/ui/lib/routes/download.d.ts +1 -0
- package/packages/ui/lib/routes/download.js +1 -0
- package/packages/ui/lib/routes/get.d.ts +1 -0
- package/packages/ui/lib/routes/get.js +106 -0
- package/packages/ui/lib/routes/install.d.ts +16 -0
- package/packages/ui/lib/routes/install.js +36 -0
- package/packages/ui/lib/routes/launch.d.ts +24 -0
- package/packages/ui/lib/routes/launch.js +74 -0
- package/packages/ui/lib/routes/logs.d.ts +57 -0
- package/packages/ui/lib/routes/logs.js +117 -0
- package/packages/ui/lib/routes/provider-delete.d.ts +15 -0
- package/packages/ui/lib/routes/provider-delete.js +37 -0
- package/packages/ui/lib/routes/register.d.ts +16 -0
- package/packages/ui/lib/routes/register.js +28 -0
- package/packages/ui/lib/routes/save.d.ts +18 -0
- package/packages/ui/lib/routes/save.js +159 -0
- package/packages/ui/lib/routes/stop.d.ts +19 -0
- package/packages/ui/lib/routes/stop.js +32 -0
- package/packages/ui/lib/routes/stream.d.ts +40 -0
- package/packages/ui/lib/routes/stream.js +68 -0
- package/packages/ui/lib/routes/summary.d.ts +15 -0
- package/packages/ui/lib/routes/summary.js +26 -0
- package/packages/ui/lib/routes/unregister.d.ts +14 -0
- package/packages/ui/lib/routes/unregister.js +26 -0
- package/packages/ui/lib/viewmodels/deps.d.ts +1 -0
- package/packages/ui/lib/viewmodels/deps.js +1 -0
- package/packages/ui/lib/viewmodels/depsHelpers.d.ts +1 -0
- package/packages/ui/lib/viewmodels/depsHelpers.js +94 -0
- package/packages/ui/lib/viewmodels/summary.d.ts +145 -0
- package/packages/ui/lib/viewmodels/summary.js +245 -0
- package/packages/ui/lib/viewmodels/summaryHelpers.d.ts +30 -0
- package/packages/ui/lib/viewmodels/summaryHelpers.js +42 -0
- package/packages/ui/lib/warnings.d.ts +1 -1
- package/packages/ui/lib/warnings.js +1 -1
- package/packages/ui/package.json +4 -4
- package/packages/providers/lib/strata.d.ts +0 -15
- package/packages/providers/lib/strata.js +0 -14
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The summary view model: the JSON the card renders. buildSummary assembles
|
|
3
|
+
* the engine list, the detected hardware, the form model for the selected
|
|
4
|
+
* engine, the VRAM meter model for the current config, the verdict the banner
|
|
5
|
+
* renders, the guideline warning model the red banner and inline warnings
|
|
6
|
+
* render from, and the config the form edits. The estimate is the single
|
|
7
|
+
* source the meter and the verdict banner agree on, and the guideline results
|
|
8
|
+
* are the single source the red banner and the inline warnings agree on.
|
|
9
|
+
* @module dsh-plugin-local-infer/ui/viewmodels/summary
|
|
10
|
+
*/
|
|
11
|
+
import { buildModelEntry, chatTemplatePresent, dshEngineCacheDirectory, hfChatTemplateCommand, hfDownloadCommand, modelArtifactPresent, modelCacheEntriesForEngine, modelEntriesForEngine, resolveModelDirectory, } from '../../../core/lib/index.js';
|
|
12
|
+
import { defaultModelFor, defaultModelsForEngine, ENGINES, enginePlatformDefaults, } from '../../../providers/lib/index.js';
|
|
13
|
+
import { readConfig } from "../config.js";
|
|
14
|
+
import { renderForm } from "../form.js";
|
|
15
|
+
import { renderMeter } from "../meter.js";
|
|
16
|
+
import { renderWarnings } from "../warnings.js";
|
|
17
|
+
import { relinkStoredProviders, resolveAdapter } from "../ops/engine.js";
|
|
18
|
+
import { resolveModelRow } from "../ops/model.js";
|
|
19
|
+
import { chatTemplateLabel, isHfRepoReference, resolveModelRegistryId } from "./summaryHelpers.js";
|
|
20
|
+
/**
|
|
21
|
+
* buildSummary assembles the card's read model for one engine and config: the
|
|
22
|
+
* static engine and model lists, the detected hardware, the form model the
|
|
23
|
+
* selected engine's parameter surface renders to, the meter model the
|
|
24
|
+
* service's estimate prices, and the warning model the service's guideline
|
|
25
|
+
* engine fires. The estimate is the single source the meter and the verdict
|
|
26
|
+
* banner agree on, and the guideline results are the single source the red
|
|
27
|
+
* banner and the inline warnings agree on.
|
|
28
|
+
*/
|
|
29
|
+
export async function buildSummary(localInfer, request) {
|
|
30
|
+
const stored = readConfig();
|
|
31
|
+
const engineId = request?.engine ?? stored.engine;
|
|
32
|
+
// ENGINES is a known non-empty constant, so the fallback is always defined.
|
|
33
|
+
const engine = ENGINES.find((entry) => entry.id === engineId) ?? ENGINES[0];
|
|
34
|
+
// The config the card edits is exactly what is stored or requested: the
|
|
35
|
+
// summary never backfills a default modelDirectory into it, so a Save of a
|
|
36
|
+
// default install writes no `modelDirectory` override and the card's field
|
|
37
|
+
// stays blank (blank means the derived default).
|
|
38
|
+
const config = request?.config ?? stored.config;
|
|
39
|
+
// The hub cache root: the plugin's model download home (created when
|
|
40
|
+
// absent), the base the cache-layout presence checks join onto and the
|
|
41
|
+
// fallback directory when nothing is cached yet.
|
|
42
|
+
const hubCacheRoot = localInfer.defaultModelDirectory();
|
|
43
|
+
const hardware = await localInfer.detectHardware();
|
|
44
|
+
// The model value the card carries maps onto the VramModel registry key the
|
|
45
|
+
// estimator prices: a default-model selection is already a registry key, a
|
|
46
|
+
// directory-scan selection is an artifact file name the default list maps
|
|
47
|
+
// to its registry key, and a missing value falls back to the engine's first
|
|
48
|
+
// default model. Pricing the resolved key is what keeps the meter from
|
|
49
|
+
// reading as not-measured (an empty chart) on a scanned model.
|
|
50
|
+
const modelId = resolveModelRegistryId(engine.id, config.model);
|
|
51
|
+
const pricedConfig = { ...config, model: modelId };
|
|
52
|
+
// Resolve the starting config over the registered presets and the engine's
|
|
53
|
+
// parameter surface, so the estimate and the model-aware guidelines price a
|
|
54
|
+
// sane budget (the preset's kvDtype and max-context) rather than a bare
|
|
55
|
+
// config that names no KV format. The resolved config carries the explicit
|
|
56
|
+
// values the user set over the preset defaults, and the engine's first
|
|
57
|
+
// default model when the user named none. The engine id rides into both
|
|
58
|
+
// entry points: the estimate's OS-reserve resolution runs the plugin-
|
|
59
|
+
// launched check against it, and the model-aware guidelines price the same
|
|
60
|
+
// usable budget the meter does.
|
|
61
|
+
const defaults = await localInfer.resolveDefaults(engine.id, modelId, hardware, pricedConfig);
|
|
62
|
+
const estimate = await localInfer.estimate(defaults.config, hardware, engine.id);
|
|
63
|
+
const guidelineResults = await localInfer.guidelines(defaults.config, hardware, engine.id);
|
|
64
|
+
// The selected default entry: the resolved directory, the model status, and
|
|
65
|
+
// the download commands all read it; undefined when no default names the
|
|
66
|
+
// model.
|
|
67
|
+
const entry = defaultModelFor(engine.id, modelId);
|
|
68
|
+
// The shared model-directory resolution reads the raw config field (never
|
|
69
|
+
// a backfilled copy): the override keeps the flat layout, and the hub-cache
|
|
70
|
+
// layout names the hf download result (the snapshot holding the selected
|
|
71
|
+
// artifact) or the hub cache root as the display directory, with the base
|
|
72
|
+
// the presence checks join onto. The display directory is never persisted
|
|
73
|
+
// back into the stored config.
|
|
74
|
+
const resolution = resolveModelDirectory(config.modelDirectory, entry, hubCacheRoot);
|
|
75
|
+
const modelDirectory = resolution.directory;
|
|
76
|
+
// The model scan lists the models the selected engine can serve: the hub
|
|
77
|
+
// cache's `models--*` directories (the repo ids, filtered by the engine's
|
|
78
|
+
// artifact types) when the model directory is the plugin default, else the
|
|
79
|
+
// flat directory's top-level entries. A missing directory reads as an empty
|
|
80
|
+
// list.
|
|
81
|
+
const modelFiles = resolution.useHubCache
|
|
82
|
+
? modelCacheEntriesForEngine(localInfer.listModelCache(), engine.id)
|
|
83
|
+
: modelEntriesForEngine(localInfer.listModelDirectory(modelDirectory), engine.id);
|
|
84
|
+
// The model status checks the selected model against the model directory
|
|
85
|
+
// and probes the hf CLI, so the card shows its Download row (or the URL
|
|
86
|
+
// row) only while the model is absent.
|
|
87
|
+
let modelStatus = null;
|
|
88
|
+
if (entry !== undefined) {
|
|
89
|
+
const present = modelArtifactPresent(entry, resolution.baseDir, resolution.useHubCache);
|
|
90
|
+
const hfCli = (await localInfer.hfCliAvailable()) !== null;
|
|
91
|
+
modelStatus = {
|
|
92
|
+
modelId: entry.modelId,
|
|
93
|
+
label: entry.label,
|
|
94
|
+
url: entry.url,
|
|
95
|
+
present,
|
|
96
|
+
hfCli,
|
|
97
|
+
downloadCommand: hfDownloadCommand(entry, modelDirectory, resolution.useHubCache),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// The chat-template status checks the selected template against the model
|
|
101
|
+
// directory and probes the hf CLI, so the card auto-downloads an absent
|
|
102
|
+
// template (and the System dependencies box shows the download command when
|
|
103
|
+
// the CLI is missing). Only HF repo references are downloadable; a local
|
|
104
|
+
// path or an empty template reads as null.
|
|
105
|
+
const chatTemplateValue = typeof config.chatTemplate === 'string' ? config.chatTemplate : '';
|
|
106
|
+
let chatTemplateStatus = null;
|
|
107
|
+
if (isHfRepoReference(chatTemplateValue)) {
|
|
108
|
+
const present = chatTemplatePresent(chatTemplateValue, resolution.baseDir, resolution.useHubCache);
|
|
109
|
+
const hfCli = (await localInfer.hfCliAvailable()) !== null;
|
|
110
|
+
chatTemplateStatus = {
|
|
111
|
+
repo: chatTemplateValue,
|
|
112
|
+
label: chatTemplateLabel(chatTemplateValue),
|
|
113
|
+
present,
|
|
114
|
+
hfCli,
|
|
115
|
+
downloadCommand: hfChatTemplateCommand(chatTemplateValue, modelDirectory, resolution.useHubCache),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// The restart re-link: a provider entry whose launch record names a still-
|
|
119
|
+
// running engine (the DSH that launched it died, and the engine re-parented
|
|
120
|
+
// to init) is re-adopted as plugin-launched, so its status dot reads as
|
|
121
|
+
// running for its model and the OS-reserve resolver keeps the default. A
|
|
122
|
+
// record whose engine is dead is cleared (the previous-pid list with it),
|
|
123
|
+
// so a recycled pid cannot re-link to a config whose engine is down. The
|
|
124
|
+
// adopted engines also get a liveness watcher, so a later pkill settles the
|
|
125
|
+
// stored state without waiting for another summary read.
|
|
126
|
+
const linkedProviders = await relinkStoredProviders(localInfer, stored);
|
|
127
|
+
// The provider list the card renders as collapsed entries: each saved
|
|
128
|
+
// config's engine and model feed the detector, which resolves the running-
|
|
129
|
+
// state its status dot paints. A provider the detector cannot tie to a
|
|
130
|
+
// confirmed model reads as unsure, so the dot never overstates a live
|
|
131
|
+
// engine. The config rides into the detector so the signature prices the
|
|
132
|
+
// provider's own build mode and port, not the adapter's default-port guess.
|
|
133
|
+
const providerRefs = linkedProviders.map((provider) => {
|
|
134
|
+
const model = typeof provider.config.model === 'string' ? provider.config.model : undefined;
|
|
135
|
+
// exactOptionalPropertyTypes: include the model key only when it is a
|
|
136
|
+
// string, so a config that names no model never writes `undefined`.
|
|
137
|
+
return model !== undefined
|
|
138
|
+
? { id: provider.id, engine: provider.engine, model, config: provider.config }
|
|
139
|
+
: { id: provider.id, engine: provider.engine, config: provider.config };
|
|
140
|
+
});
|
|
141
|
+
const providerStatuses = providerRefs.length > 0 ? await localInfer.providerStatuses(providerRefs) : {};
|
|
142
|
+
const providers = linkedProviders.map((provider) => ({
|
|
143
|
+
id: provider.id,
|
|
144
|
+
engine: provider.engine,
|
|
145
|
+
model: typeof provider.config.model === 'string' ? provider.config.model : '',
|
|
146
|
+
status: providerStatuses[provider.id] ?? 'unsure',
|
|
147
|
+
config: provider.config,
|
|
148
|
+
platform: provider.platform,
|
|
149
|
+
// exactOptionalPropertyTypes: carry the Auto Rebuild flag only when the
|
|
150
|
+
// stored entry has it, so an entry saved before the key existed carries
|
|
151
|
+
// no key and the card draws the checkbox unchecked.
|
|
152
|
+
...(provider.autoRebuild !== undefined ? { autoRebuild: provider.autoRebuild } : {}),
|
|
153
|
+
}));
|
|
154
|
+
// The "unsure" banner: shown when no provider is confirmed running but at
|
|
155
|
+
// least one reads as unsure (a foreign engine the detector saw but could
|
|
156
|
+
// not tie to a model, or a busy card). The banner offers the host-OS stop
|
|
157
|
+
// commands (Stop-Process on Windows, kill on Linux and macOS) for the engine
|
|
158
|
+
// processes the detector saw holding VRAM, so the user can stop a provider
|
|
159
|
+
// launched in another session.
|
|
160
|
+
const anyRunning = providers.some((p) => p.status === 'running');
|
|
161
|
+
const anyUnsure = providers.some((p) => p.status === 'unsure');
|
|
162
|
+
const unsureBanner = !anyRunning && anyUnsure
|
|
163
|
+
? {
|
|
164
|
+
message: 'Unable to link to a provider (it may have been launched in another session). \n To stop, run:',
|
|
165
|
+
killCommands: await localInfer.unsureBannerKillCommands(),
|
|
166
|
+
}
|
|
167
|
+
: null;
|
|
168
|
+
// The "Unknown Engine(s)" readout shows the VRAM the detector's foreign
|
|
169
|
+
// engine programs are holding: the OS-reserve segment is the GPU's used
|
|
170
|
+
// VRAM when a foreign engine is detected, so the readout names the
|
|
171
|
+
// footprint a provider launched in another session is eating off the
|
|
172
|
+
// card. Absent when no provider reads as unsure.
|
|
173
|
+
const unknownEngines = anyUnsure ? { bytes: estimate.breakdown.reserve } : null;
|
|
174
|
+
// The registered flag tells the card whether the current config's provider
|
|
175
|
+
// and model are already in the DSH settings, so the Remove button shows
|
|
176
|
+
// only when there is something to remove. A profile without the settings
|
|
177
|
+
// seam (a host that predates the typert remote) or a host without the
|
|
178
|
+
// engine adapter registered reads as unregistered. The row resolves through
|
|
179
|
+
// the same discovery plus modelRef fall-through the register step uses, so
|
|
180
|
+
// the flag names the same entry the register step wrote while the engine
|
|
181
|
+
// answers, and a down engine (no discovery) reads as unregistered.
|
|
182
|
+
let registered = false;
|
|
183
|
+
try {
|
|
184
|
+
const regAdapter = resolveAdapter(localInfer, engine.id);
|
|
185
|
+
const regPlan = regAdapter.renderLaunch(config, hardware);
|
|
186
|
+
const regRow = await resolveModelRow(regAdapter, regPlan, config);
|
|
187
|
+
const regEntry = buildModelEntry(regPlan, regRow);
|
|
188
|
+
registered = await localInfer.modelIsRegistered(regEntry.providerId, regRow.id);
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
// A missing adapter, a missing settings seam, or a refused read all
|
|
192
|
+
// read as unregistered, which hides the Remove button (a no-op removal).
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
engines: ENGINES.map((entry) => {
|
|
196
|
+
// The platform defaults ride the engine entry so the card's Engine
|
|
197
|
+
// platform section seeds the build-command and docker-tag placeholders
|
|
198
|
+
// from the same data the deploy step consumes. The build command is the
|
|
199
|
+
// engine's first build step for the detected host OS, so a Windows host
|
|
200
|
+
// seeds the vcpkg route and a Linux host seeds the cmake route.
|
|
201
|
+
const defaults = enginePlatformDefaults(entry.id, hardware.os);
|
|
202
|
+
return {
|
|
203
|
+
id: entry.id,
|
|
204
|
+
label: entry.label,
|
|
205
|
+
supports: entry.supports,
|
|
206
|
+
...(defaults.defaultBuildCommand !== undefined
|
|
207
|
+
? { defaultBuildCommand: defaults.defaultBuildCommand }
|
|
208
|
+
: {}),
|
|
209
|
+
...(defaults.defaultDockerTag !== undefined
|
|
210
|
+
? { defaultDockerTag: defaults.defaultDockerTag }
|
|
211
|
+
: {}),
|
|
212
|
+
defaultEngineDirectory: dshEngineCacheDirectory(entry.id),
|
|
213
|
+
};
|
|
214
|
+
}),
|
|
215
|
+
models: localInfer.registeredVramModels().map((model) => ({ id: model.id, source: model.source })),
|
|
216
|
+
hardware,
|
|
217
|
+
engineId: engine.id,
|
|
218
|
+
// The hardware profile prices the form's hardware-dependent controls (the
|
|
219
|
+
// host-KV slider cap), so the render model and the meter agree on the
|
|
220
|
+
// machine they run on.
|
|
221
|
+
formModel: renderForm(engine.parameters, config, hardware),
|
|
222
|
+
meterModel: renderMeter(estimate.breakdown, estimate.verdict, hardware.gpu?.vramGiB ?? 0, estimate.source, estimate.reserveSource, unknownEngines),
|
|
223
|
+
verdict: estimate.verdict,
|
|
224
|
+
warningsModel: renderWarnings(guidelineResults),
|
|
225
|
+
config,
|
|
226
|
+
platformConfigs: stored.platform,
|
|
227
|
+
defaults: { config: defaults.config, provenance: defaults.provenance },
|
|
228
|
+
modelDirectory,
|
|
229
|
+
modelDefaults: defaultModelsForEngine(engine.id).map((entry) => ({
|
|
230
|
+
id: entry.modelId,
|
|
231
|
+
label: entry.label,
|
|
232
|
+
url: entry.url,
|
|
233
|
+
})),
|
|
234
|
+
modelStatus,
|
|
235
|
+
chatTemplateStatus,
|
|
236
|
+
modelFiles,
|
|
237
|
+
showHelp: stored.showHelp,
|
|
238
|
+
providers,
|
|
239
|
+
logPath: stored.logPath,
|
|
240
|
+
lastLogs: stored.lastLogs,
|
|
241
|
+
unsureBanner,
|
|
242
|
+
registered,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The small pure helpers the summary view model prices: the HF repo
|
|
3
|
+
* reference check the chat-template status runs, the template display label,
|
|
4
|
+
* and the model-value-to-registry-key map the estimator prices.
|
|
5
|
+
* @module dsh-plugin-local-infer/ui/viewmodels/summaryHelpers
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* isHfRepoReference reports whether a chat template value is a Hugging Face
|
|
9
|
+
* repo reference (an owner/name pair) rather than a local path: it carries a
|
|
10
|
+
* slash and does not start with one. Only repo references are auto-downloaded
|
|
11
|
+
* into the model directory; a local path is used in place.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isHfRepoReference(value: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* chatTemplateLabel resolves the display label for a chat template repo: the
|
|
16
|
+
* preset's label when the repo is a shipped preset, else the repo itself.
|
|
17
|
+
*/
|
|
18
|
+
export declare function chatTemplateLabel(repo: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* resolveModelRegistryId maps the card's model value onto the VramModel
|
|
21
|
+
* registry key the estimator prices. The card's Model field carries either a
|
|
22
|
+
* registry key (a default-model selection) or an artifact file name (a
|
|
23
|
+
* directory-scan selection, e.g. a .ninfer file); the default list maps the
|
|
24
|
+
* file name to the registry key the estimator knows, so a scanned model prices
|
|
25
|
+
* a real VramModel rather than reading as not-measured. A value that is
|
|
26
|
+
* already a registry key passes through, and a missing value falls back to
|
|
27
|
+
* the engine's first default model.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveModelRegistryId(engineId: string, model: unknown): string;
|
|
30
|
+
//# sourceMappingURL=summaryHelpers.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The small pure helpers the summary view model prices: the HF repo
|
|
3
|
+
* reference check the chat-template status runs, the template display label,
|
|
4
|
+
* and the model-value-to-registry-key map the estimator prices.
|
|
5
|
+
* @module dsh-plugin-local-infer/ui/viewmodels/summaryHelpers
|
|
6
|
+
*/
|
|
7
|
+
import { CHAT_TEMPLATE_OPTIONS, defaultModelsForEngine } from '../../../providers/lib/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* isHfRepoReference reports whether a chat template value is a Hugging Face
|
|
10
|
+
* repo reference (an owner/name pair) rather than a local path: it carries a
|
|
11
|
+
* slash and does not start with one. Only repo references are auto-downloaded
|
|
12
|
+
* into the model directory; a local path is used in place.
|
|
13
|
+
*/
|
|
14
|
+
export function isHfRepoReference(value) {
|
|
15
|
+
return value !== '' && !value.startsWith('/') && value.includes('/');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* chatTemplateLabel resolves the display label for a chat template repo: the
|
|
19
|
+
* preset's label when the repo is a shipped preset, else the repo itself.
|
|
20
|
+
*/
|
|
21
|
+
export function chatTemplateLabel(repo) {
|
|
22
|
+
const preset = CHAT_TEMPLATE_OPTIONS.find((option) => option.value === repo);
|
|
23
|
+
return preset?.label ?? repo;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* resolveModelRegistryId maps the card's model value onto the VramModel
|
|
27
|
+
* registry key the estimator prices. The card's Model field carries either a
|
|
28
|
+
* registry key (a default-model selection) or an artifact file name (a
|
|
29
|
+
* directory-scan selection, e.g. a .ninfer file); the default list maps the
|
|
30
|
+
* file name to the registry key the estimator knows, so a scanned model prices
|
|
31
|
+
* a real VramModel rather than reading as not-measured. A value that is
|
|
32
|
+
* already a registry key passes through, and a missing value falls back to
|
|
33
|
+
* the engine's first default model.
|
|
34
|
+
*/
|
|
35
|
+
export function resolveModelRegistryId(engineId, model) {
|
|
36
|
+
if (typeof model === 'string' && model !== '') {
|
|
37
|
+
const entry = defaultModelsForEngine(engineId).find((candidate) => candidate.file === model);
|
|
38
|
+
return entry?.modelId ?? model;
|
|
39
|
+
}
|
|
40
|
+
return defaultModelsForEngine(engineId)[0]?.modelId ?? engineId;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=summaryHelpers.js.map
|
|
@@ -53,4 +53,4 @@ export declare function toneFor(level: GuidelineLevel): WarningTone;
|
|
|
53
53
|
* key so the form renders each warning next to the parameter it names.
|
|
54
54
|
*/
|
|
55
55
|
export declare function renderWarnings(results: readonly GuidelineResult[]): WarningsModel;
|
|
56
|
-
//# sourceMappingURL=warnings.d.ts.map
|
|
56
|
+
//# sourceMappingURL=warnings.d.ts.map
|
package/packages/ui/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-local-infer-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Web UI for the dsh local-inference plugin: the form-type-aware parameter form, the live VRAM Est. meter, the red hardware-warning banner, the engine lifecycle controls (build / deploy / stop), and the register-as-model confirmation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"dsh-plugin-local-infer-core": "workspace:^",
|
|
33
|
-
"dsh-plugin-local-infer-
|
|
34
|
-
"dsh-plugin-local-infer-
|
|
33
|
+
"dsh-plugin-local-infer-providers": "workspace:^",
|
|
34
|
+
"dsh-plugin-local-infer-service": "workspace:^"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/cordis": ">=4.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
40
|
+
"@deepseek-ai/cordis": "^4.0.6-alpha.2"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Strata parameter surface. Strata is the placeholder engine: the plan names
|
|
3
|
-
* it as a docker-only engine whose parameter data lands when the engine is
|
|
4
|
-
* available. The surface is empty until then, so the form renders no fields
|
|
5
|
-
* and the adapter renders a bare docker plan; adding a spec here is a data
|
|
6
|
-
* edit, never an adapter rewire.
|
|
7
|
-
* @module dsh-plugin-local-infer/providers/strata
|
|
8
|
-
*/
|
|
9
|
-
import type { ParameterSpec } from 'dsh-plugin-local-infer/core';
|
|
10
|
-
/**
|
|
11
|
-
* The Strata `ParameterSpec` surface, empty until the engine's flag set lands.
|
|
12
|
-
* The `StrataAdapter` composes this (currently nothing) into a docker plan.
|
|
13
|
-
*/
|
|
14
|
-
export declare const STRATA_PARAMETERS: readonly ParameterSpec[];
|
|
15
|
-
//# sourceMappingURL=strata.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Strata parameter surface. Strata is the placeholder engine: the plan names
|
|
3
|
-
* it as a docker-only engine whose parameter data lands when the engine is
|
|
4
|
-
* available. The surface is empty until then, so the form renders no fields
|
|
5
|
-
* and the adapter renders a bare docker plan; adding a spec here is a data
|
|
6
|
-
* edit, never an adapter rewire.
|
|
7
|
-
* @module dsh-plugin-local-infer/providers/strata
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* The Strata `ParameterSpec` surface, empty until the engine's flag set lands.
|
|
11
|
-
* The `StrataAdapter` composes this (currently nothing) into a docker plan.
|
|
12
|
-
*/
|
|
13
|
-
export const STRATA_PARAMETERS = [];
|
|
14
|
-
//# sourceMappingURL=strata.js.map
|