dsh-plugin-local-infer 0.1.3 → 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 +22 -4
- package/cordis.patch.yml +7 -0
- package/docs/zh/README.md +14 -2
- package/dsh/client.js +4195 -4522
- package/package.json +28 -11
- package/packages/core/lib/adapter.d.ts +133 -9
- 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 +44 -17
- 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 +20 -9
- package/packages/core/lib/registrar.js +27 -7
- 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 +92 -14
- package/packages/providers/lib/acquire.js +215 -37
- package/packages/providers/lib/adapters.d.ts +136 -12
- package/packages/providers/lib/adapters.js +597 -70
- package/packages/providers/lib/debug.d.ts +1 -1
- package/packages/providers/lib/debug.js +1 -1
- package/packages/providers/lib/deps.d.ts +27 -230
- package/packages/providers/lib/deps.js +61 -214
- 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/engines/{hyperqwen.d.ts → hyperqwen/hyperqwen.d.ts} +2 -2
- package/packages/providers/lib/engines/{hyperqwen.js → hyperqwen/hyperqwen.js} +14 -2
- package/packages/providers/lib/engines/{hyperqwenAdapter.d.ts → hyperqwen/hyperqwenAdapter.d.ts} +6 -6
- package/packages/providers/lib/engines/{hyperqwenAdapter.js → hyperqwen/hyperqwenAdapter.js} +24 -14
- 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/engines/{infernix.d.ts → infernix/infernix.d.ts} +7 -4
- package/packages/providers/lib/engines/{infernix.js → infernix/infernix.js} +52 -7
- package/packages/providers/lib/engines/{infernixAdapter.d.ts → infernix/infernixAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{infernixAdapter.js → infernix/infernixAdapter.js} +75 -42
- 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/engines/{llamacpp.d.ts → llamacpp/llamacpp.d.ts} +2 -2
- package/packages/providers/lib/engines/{llamacpp.js → llamacpp/llamacpp.js} +12 -2
- package/packages/providers/lib/engines/{llamacppAdapter.d.ts → llamacpp/llamacppAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{llamacppAdapter.js → llamacpp/llamacppAdapter.js} +87 -45
- 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/engines/{ninfer.d.ts → ninfer/ninfer.d.ts} +2 -2
- package/packages/providers/lib/engines/{ninfer.js → ninfer/ninfer.js} +24 -2
- package/packages/providers/lib/engines/{ninferAdapter.d.ts → ninfer/ninferAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{ninferAdapter.js → ninfer/ninferAdapter.js} +123 -55
- 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.js → strata/strata.js} +70 -3
- package/packages/providers/lib/engines/{strataAdapter.d.ts → strata/strataAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{strataAdapter.js → strata/strataAdapter.js} +147 -111
- 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 +7 -5
- package/packages/providers/lib/engines.js +21 -10
- 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 -29
- package/packages/providers/lib/index.js +45 -33
- package/packages/providers/lib/model-defaults.d.ts +5 -1
- package/packages/providers/lib/model-defaults.js +25 -1
- package/packages/providers/lib/platform.d.ts +8 -5
- package/packages/providers/lib/platform.js +23 -9
- 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 +176 -21
- package/packages/service/lib/index.js +589 -86
- 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 +163 -6
- 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 +12 -2
- package/packages/ui/lib/config.js +18 -2
- package/packages/ui/lib/deps.d.ts +1 -1
- 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 +142 -34
- package/packages/ui/lib/ops/engine.js +469 -265
- 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 +26 -11
- package/packages/ui/lib/ops/hf.js +115 -25
- package/packages/ui/lib/ops/logs.d.ts +70 -15
- package/packages/ui/lib/ops/logs.js +96 -35
- package/packages/ui/lib/ops/model.d.ts +2 -10
- package/packages/ui/lib/ops/model.js +9 -16
- package/packages/ui/lib/request.d.ts +1 -1
- package/packages/ui/lib/request.js +1 -1
- package/packages/ui/lib/route.d.ts +22 -6
- package/packages/ui/lib/route.js +32 -9
- package/packages/ui/lib/routes/chat-template.d.ts +1 -14
- package/packages/ui/lib/routes/chat-template.js +1 -37
- package/packages/ui/lib/routes/deps.d.ts +1 -16
- package/packages/ui/lib/routes/deps.js +1 -27
- package/packages/ui/lib/routes/download.d.ts +1 -16
- package/packages/ui/lib/routes/download.js +1 -48
- package/packages/ui/lib/routes/get.d.ts +1 -18
- package/packages/ui/lib/routes/get.js +66 -17
- package/packages/ui/lib/routes/install.d.ts +1 -1
- package/packages/ui/lib/routes/install.js +1 -1
- package/packages/ui/lib/routes/launch.d.ts +13 -7
- package/packages/ui/lib/routes/launch.js +33 -9
- 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 +1 -1
- package/packages/ui/lib/routes/provider-delete.js +1 -1
- package/packages/ui/lib/routes/register.d.ts +1 -1
- package/packages/ui/lib/routes/register.js +1 -1
- package/packages/ui/lib/routes/save.d.ts +1 -1
- package/packages/ui/lib/routes/save.js +22 -2
- package/packages/ui/lib/routes/stop.d.ts +7 -4
- package/packages/ui/lib/routes/stop.js +7 -4
- 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 +1 -1
- package/packages/ui/lib/routes/summary.js +1 -1
- package/packages/ui/lib/routes/unregister.d.ts +1 -1
- package/packages/ui/lib/routes/unregister.js +1 -1
- package/packages/ui/lib/viewmodels/deps.d.ts +1 -31
- package/packages/ui/lib/viewmodels/deps.js +1 -89
- package/packages/ui/lib/viewmodels/depsHelpers.d.ts +1 -28
- package/packages/ui/lib/viewmodels/depsHelpers.js +72 -11
- package/packages/ui/lib/viewmodels/summary.d.ts +7 -2
- package/packages/ui/lib/viewmodels/summary.js +55 -35
- package/packages/ui/lib/viewmodels/summaryHelpers.d.ts +1 -1
- package/packages/ui/lib/viewmodels/summaryHelpers.js +1 -1
- 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/engines/strata.d.ts +0 -53
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stored provider entry a launch, stop, or run-log write targets. The
|
|
3
|
+
* rule the ui's launch-record paths carried privately moves here so the
|
|
4
|
+
* record persistence and the run-log key rule share one matcher.
|
|
5
|
+
* @module dsh-plugin-local-infer/service/launch-target
|
|
6
|
+
*/
|
|
7
|
+
import type { Config } from 'dsh-plugin-local-infer/core';
|
|
8
|
+
import type { LaunchTargetEntry } from './types.ts';
|
|
9
|
+
/**
|
|
10
|
+
* findLaunchTarget resolves the stored provider entry a launch, stop, or
|
|
11
|
+
* run targets: the entry the request names by id, or (an id the card does
|
|
12
|
+
* not send, a launch of the active config) the stored entry with the same
|
|
13
|
+
* engine and model. A request with no resolvable entry reads as undefined,
|
|
14
|
+
* which the launch-record paths take as "no provider config to re-link" and
|
|
15
|
+
* the run-log key rule takes as "key on the engine id". The entry type
|
|
16
|
+
* stays generic so each caller keeps its own stored entry shape.
|
|
17
|
+
*/
|
|
18
|
+
export declare function findLaunchTarget<T extends LaunchTargetEntry>(providers: readonly T[], engineId: string, providerId: string | undefined, config: Config): T | undefined;
|
|
19
|
+
//# sourceMappingURL=launch-target.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stored provider entry a launch, stop, or run-log write targets. The
|
|
3
|
+
* rule the ui's launch-record paths carried privately moves here so the
|
|
4
|
+
* record persistence and the run-log key rule share one matcher.
|
|
5
|
+
* @module dsh-plugin-local-infer/service/launch-target
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* findLaunchTarget resolves the stored provider entry a launch, stop, or
|
|
9
|
+
* run targets: the entry the request names by id, or (an id the card does
|
|
10
|
+
* not send, a launch of the active config) the stored entry with the same
|
|
11
|
+
* engine and model. A request with no resolvable entry reads as undefined,
|
|
12
|
+
* which the launch-record paths take as "no provider config to re-link" and
|
|
13
|
+
* the run-log key rule takes as "key on the engine id". The entry type
|
|
14
|
+
* stays generic so each caller keeps its own stored entry shape.
|
|
15
|
+
*/
|
|
16
|
+
export function findLaunchTarget(providers, engineId, providerId, config) {
|
|
17
|
+
if (providerId !== undefined) {
|
|
18
|
+
const byId = providers.find((entry) => entry.id === providerId);
|
|
19
|
+
if (byId !== undefined)
|
|
20
|
+
return byId;
|
|
21
|
+
}
|
|
22
|
+
const model = typeof config.model === 'string' ? config.model : undefined;
|
|
23
|
+
if (model === undefined)
|
|
24
|
+
return undefined;
|
|
25
|
+
return providers.find((entry) => entry.engine === engineId &&
|
|
26
|
+
(typeof entry.config.model === 'string' ? entry.config.model : undefined) === model);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=launch-target.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-key live run-log hub: one bounded buffer per run key with fan-out
|
|
3
|
+
* to subscribers, so every provider process (Get, Launch, Prereqs, Download,
|
|
4
|
+
* Install, Stop) writes its output to one place the streaming web route
|
|
5
|
+
* serves. The LocalInfer facade publishes the five operations (begin,
|
|
6
|
+
* append, read, subscribe, end); runLogKey names the key rule every caller
|
|
7
|
+
* shares.
|
|
8
|
+
* @module dsh-plugin-local-infer/service/run-logs
|
|
9
|
+
*/
|
|
10
|
+
import type { Config } from 'dsh-plugin-local-infer/core';
|
|
11
|
+
import type { LaunchTargetEntry, RunLogListener, RunLogSnapshot } from './types.ts';
|
|
12
|
+
/**
|
|
13
|
+
* RunLogStore holds one RunBuffer per run key and fans RunLogEvents out to
|
|
14
|
+
* the key's subscribers. A throwing listener is isolated per notify, so a
|
|
15
|
+
* broken stream connection never blocks a writer or another subscriber.
|
|
16
|
+
*/
|
|
17
|
+
export declare class RunLogStore {
|
|
18
|
+
private readonly buffers;
|
|
19
|
+
/**
|
|
20
|
+
* begin resets the key's buffer to the seed line, restarts the seq at 0,
|
|
21
|
+
* marks the run running, and notifies subscribers with the reset event so
|
|
22
|
+
* a mid-run attached reader replaces its display instead of appending
|
|
23
|
+
* onto the previous run.
|
|
24
|
+
*/
|
|
25
|
+
begin(key: string, seed: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* append grows the key's text (tail-capped to LOG_TAIL_BYTES, the same
|
|
28
|
+
* rule the stored last-run logs use), counts the append, and notifies
|
|
29
|
+
* subscribers with the chunk. A key with no open run opens one lazily
|
|
30
|
+
* without a seed, and an append to a settled run reopens it, so a note
|
|
31
|
+
* that lands after the run (an engine-death line) still streams; the
|
|
32
|
+
* caller that opens a run this way closes it with its own end.
|
|
33
|
+
*/
|
|
34
|
+
append(key: string, chunk: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* read answers the key's catch-up snapshot. A key that never ran reads as
|
|
37
|
+
* an empty stopped snapshot.
|
|
38
|
+
*/
|
|
39
|
+
read(key: string): RunLogSnapshot;
|
|
40
|
+
/**
|
|
41
|
+
* subscribe registers a listener for the key's events and returns the
|
|
42
|
+
* disposer. Registering the same function twice delivers once (Set
|
|
43
|
+
* semantics); each connection registers its own closure.
|
|
44
|
+
*/
|
|
45
|
+
subscribe(key: string, listener: RunLogListener): () => void;
|
|
46
|
+
/**
|
|
47
|
+
* end clears the running flag and emits the end event; the text stays
|
|
48
|
+
* readable until the next begin. A key with no open run is a no-op, so a
|
|
49
|
+
* repeated end never emits a second end event.
|
|
50
|
+
*/
|
|
51
|
+
end(key: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* bufferFor reads the key's buffer, starting an empty stopped one for a
|
|
54
|
+
* key that has none.
|
|
55
|
+
*/
|
|
56
|
+
private bufferFor;
|
|
57
|
+
/**
|
|
58
|
+
* notify hands one event to each listener of one buffer. It iterates a
|
|
59
|
+
* copy so a disposer running inside a listener cannot disturb the pass,
|
|
60
|
+
* and it swallows listener throws: a broken connection must never fail
|
|
61
|
+
* the writer.
|
|
62
|
+
*/
|
|
63
|
+
private notify;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* runLogKey names the run key every run path and the logs route share, so
|
|
67
|
+
* the client can always predict the key for its request: the request's
|
|
68
|
+
* providerId when it names one, else the stored entry findLaunchTarget
|
|
69
|
+
* matches by engine and model, else the engine id.
|
|
70
|
+
*/
|
|
71
|
+
export declare function runLogKey(providers: readonly LaunchTargetEntry[], engineId: string, providerId: string | undefined, config: Config): string;
|
|
72
|
+
//# sourceMappingURL=run-logs.d.ts.map
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-key live run-log hub: one bounded buffer per run key with fan-out
|
|
3
|
+
* to subscribers, so every provider process (Get, Launch, Prereqs, Download,
|
|
4
|
+
* Install, Stop) writes its output to one place the streaming web route
|
|
5
|
+
* serves. The LocalInfer facade publishes the five operations (begin,
|
|
6
|
+
* append, read, subscribe, end); runLogKey names the key rule every caller
|
|
7
|
+
* shares.
|
|
8
|
+
* @module dsh-plugin-local-infer/service/run-logs
|
|
9
|
+
*/
|
|
10
|
+
import { LOG_TAIL_BYTES } from '../../core/lib/index.js';
|
|
11
|
+
import { findLaunchTarget } from "./launch-target.js";
|
|
12
|
+
/**
|
|
13
|
+
* RunLogStore holds one RunBuffer per run key and fans RunLogEvents out to
|
|
14
|
+
* the key's subscribers. A throwing listener is isolated per notify, so a
|
|
15
|
+
* broken stream connection never blocks a writer or another subscriber.
|
|
16
|
+
*/
|
|
17
|
+
export class RunLogStore {
|
|
18
|
+
buffers = new Map();
|
|
19
|
+
/**
|
|
20
|
+
* begin resets the key's buffer to the seed line, restarts the seq at 0,
|
|
21
|
+
* marks the run running, and notifies subscribers with the reset event so
|
|
22
|
+
* a mid-run attached reader replaces its display instead of appending
|
|
23
|
+
* onto the previous run.
|
|
24
|
+
*/
|
|
25
|
+
begin(key, seed) {
|
|
26
|
+
const buffer = this.bufferFor(key);
|
|
27
|
+
buffer.text = seed;
|
|
28
|
+
buffer.seq = 0;
|
|
29
|
+
buffer.running = true;
|
|
30
|
+
this.notify(buffer, { kind: 'reset', seq: 0, text: seed });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* append grows the key's text (tail-capped to LOG_TAIL_BYTES, the same
|
|
34
|
+
* rule the stored last-run logs use), counts the append, and notifies
|
|
35
|
+
* subscribers with the chunk. A key with no open run opens one lazily
|
|
36
|
+
* without a seed, and an append to a settled run reopens it, so a note
|
|
37
|
+
* that lands after the run (an engine-death line) still streams; the
|
|
38
|
+
* caller that opens a run this way closes it with its own end.
|
|
39
|
+
*/
|
|
40
|
+
append(key, chunk) {
|
|
41
|
+
const buffer = this.bufferFor(key);
|
|
42
|
+
buffer.text += chunk;
|
|
43
|
+
if (buffer.text.length > LOG_TAIL_BYTES) {
|
|
44
|
+
buffer.text = buffer.text.slice(-LOG_TAIL_BYTES);
|
|
45
|
+
}
|
|
46
|
+
buffer.running = true;
|
|
47
|
+
buffer.seq += 1;
|
|
48
|
+
this.notify(buffer, { kind: 'log', seq: buffer.seq, text: chunk });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* read answers the key's catch-up snapshot. A key that never ran reads as
|
|
52
|
+
* an empty stopped snapshot.
|
|
53
|
+
*/
|
|
54
|
+
read(key) {
|
|
55
|
+
const buffer = this.buffers.get(key);
|
|
56
|
+
if (buffer === undefined)
|
|
57
|
+
return { seq: 0, text: '', running: false };
|
|
58
|
+
return { seq: buffer.seq, text: buffer.text, running: buffer.running };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* subscribe registers a listener for the key's events and returns the
|
|
62
|
+
* disposer. Registering the same function twice delivers once (Set
|
|
63
|
+
* semantics); each connection registers its own closure.
|
|
64
|
+
*/
|
|
65
|
+
subscribe(key, listener) {
|
|
66
|
+
const buffer = this.bufferFor(key);
|
|
67
|
+
buffer.listeners.add(listener);
|
|
68
|
+
return () => {
|
|
69
|
+
buffer.listeners.delete(listener);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* end clears the running flag and emits the end event; the text stays
|
|
74
|
+
* readable until the next begin. A key with no open run is a no-op, so a
|
|
75
|
+
* repeated end never emits a second end event.
|
|
76
|
+
*/
|
|
77
|
+
end(key) {
|
|
78
|
+
const buffer = this.buffers.get(key);
|
|
79
|
+
if (buffer === undefined || !buffer.running)
|
|
80
|
+
return;
|
|
81
|
+
buffer.running = false;
|
|
82
|
+
this.notify(buffer, { kind: 'end', seq: buffer.seq });
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* bufferFor reads the key's buffer, starting an empty stopped one for a
|
|
86
|
+
* key that has none.
|
|
87
|
+
*/
|
|
88
|
+
bufferFor(key) {
|
|
89
|
+
let buffer = this.buffers.get(key);
|
|
90
|
+
if (buffer === undefined) {
|
|
91
|
+
buffer = { text: '', seq: 0, running: false, listeners: new Set() };
|
|
92
|
+
this.buffers.set(key, buffer);
|
|
93
|
+
}
|
|
94
|
+
return buffer;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* notify hands one event to each listener of one buffer. It iterates a
|
|
98
|
+
* copy so a disposer running inside a listener cannot disturb the pass,
|
|
99
|
+
* and it swallows listener throws: a broken connection must never fail
|
|
100
|
+
* the writer.
|
|
101
|
+
*/
|
|
102
|
+
notify(buffer, event) {
|
|
103
|
+
for (const listener of [...buffer.listeners]) {
|
|
104
|
+
try {
|
|
105
|
+
listener(event);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// The connection is broken; its own route tears it down.
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* runLogKey names the run key every run path and the logs route share, so
|
|
115
|
+
* the client can always predict the key for its request: the request's
|
|
116
|
+
* providerId when it names one, else the stored entry findLaunchTarget
|
|
117
|
+
* matches by engine and model, else the engine id.
|
|
118
|
+
*/
|
|
119
|
+
export function runLogKey(providers, engineId, providerId, config) {
|
|
120
|
+
if (providerId !== undefined && providerId.trim() !== '')
|
|
121
|
+
return providerId;
|
|
122
|
+
const target = findLaunchTarget(providers, engineId, undefined, config);
|
|
123
|
+
return target?.id ?? engineId;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=run-logs.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BuildMode, CommandOutcome, Config, DefaultModel, ModelDirectoryEntry, EngineAdapter, EngineDepPlan, EngineLaunchState, EnginePlatformConfig, Guideline, GuidelineResult, GpuUsageProbe, HardwareProfile, InstallResult, LaunchPlan, LaunchProgress, ModelRow, Preset, PresetSource, ProcessLine, ProviderLaunchRecord, ProviderRef, ProviderStatus, ReLinkOutcome, RegisterResult, ReserveResolution, ReserveSource, ResolvedDefaults, SettingsOp, SystemDep, VramBreakdown, VramModel, VramVerdict } from 'dsh-plugin-local-infer/core';
|
|
1
|
+
import type { BuildMode, CommandLogger, CommandOutcome, CommandRunner, Config, DefaultModel, ModelCacheEntry, ModelDirectoryEntry, EngineAdapter, EngineDepPlan, EngineLaunchState, EnginePlatformConfig, Guideline, GuidelineResult, GpuUsageProbe, HardwareProfile, InstallResult, LaunchPlan, LaunchProgress, ModelRow, Preset, PresetSource, ProcessLine, ProviderLaunchRecord, ProviderRef, ProviderStatus, ReLinkOutcome, RegisterResult, ReserveResolution, ReserveSource, ResolvedDefaults, SettingsOp, SystemDep, VramBreakdown, VramModel, VramVerdict } from 'dsh-plugin-local-infer/core';
|
|
2
2
|
/**
|
|
3
3
|
* EstimateResult is the answer to an estimate call: the full VRAM breakdown,
|
|
4
4
|
* the one-word verdict the meter renders, the source the numbers came from,
|
|
@@ -93,7 +93,11 @@ export interface LaunchResult {
|
|
|
93
93
|
* (on) or is written to the card's Logs section (off). `autoRebuild` is the
|
|
94
94
|
* card's "Auto Rebuild" checkbox: when false, the deploy step skips the git
|
|
95
95
|
* sync (fetch, rebase, rebuild) and launches the checkout as-is. Absent reads
|
|
96
|
-
* as true (the rebuild runs).
|
|
96
|
+
* as true (the rebuild runs). `onLog` is the launch run's log sink: the
|
|
97
|
+
* deploy step writes the `$ <command>` line of every mutating command it runs
|
|
98
|
+
* (image pull, model download) through it before the child spawns, and the
|
|
99
|
+
* health poll (these options ride straight into the adapter's HealthCheckOptions)
|
|
100
|
+
* writes its `> GET <healthUrl>` line and settled verdict through it.
|
|
97
101
|
*/
|
|
98
102
|
export interface LaunchOptions {
|
|
99
103
|
pollMs?: number;
|
|
@@ -101,6 +105,7 @@ export interface LaunchOptions {
|
|
|
101
105
|
onProgress?: LaunchProgress;
|
|
102
106
|
allowRunDeps?: boolean;
|
|
103
107
|
autoRebuild?: boolean;
|
|
108
|
+
onLog?: CommandLogger;
|
|
104
109
|
}
|
|
105
110
|
/**
|
|
106
111
|
* RegisterModelOptions tunes the model registration: agentDefault points the
|
|
@@ -110,6 +115,18 @@ export interface LaunchOptions {
|
|
|
110
115
|
export interface RegisterModelOptions {
|
|
111
116
|
agentDefault?: boolean;
|
|
112
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* RunInstallOptions tunes the Play/Run install: `onLog` is the install run's
|
|
120
|
+
* log sink, and the service writes each command the runner is about to
|
|
121
|
+
* execute as a `$ <command>` line through it before the child spawns, so the
|
|
122
|
+
* run reads command first and per-dep results after. `runner` injects the
|
|
123
|
+
* command runner, so a test captures the command lines without spawning a
|
|
124
|
+
* real shell (the way downloadModel injects its download runner).
|
|
125
|
+
*/
|
|
126
|
+
export interface RunInstallOptions {
|
|
127
|
+
onLog?: CommandLogger;
|
|
128
|
+
runner?: CommandRunner;
|
|
129
|
+
}
|
|
113
130
|
/**
|
|
114
131
|
* FetchPresetResult is the answer to a mod-search preset fetch: the tagged
|
|
115
132
|
* preset when the bridge fetched and extracted it, a storage flag, and a
|
|
@@ -149,9 +166,27 @@ export interface DownloadResult {
|
|
|
149
166
|
/**
|
|
150
167
|
* DownloadModelOptions tunes the model download: runner injects the command
|
|
151
168
|
* runner, so a test captures the rendered hf CLI command without a live hf.
|
|
169
|
+
* onChunk is the callback the runner hands each streamed stdout and stderr
|
|
170
|
+
* chunk to, so the card's Logs pane reads the hf CLI's progress live while a
|
|
171
|
+
* long download runs. useHubCache selects the hub-cache layout (no
|
|
172
|
+
* `--local-dir`, the `models--{ns}--{name}` directories) when the model
|
|
173
|
+
* directory is the plugin default; a user-overridden directory keeps the flat
|
|
174
|
+
* `--local-dir` target. signal is the card's cancel: an abort interrupts the
|
|
175
|
+
* in-flight hf child (SIGINT, then SIGTERM). Resume is within-invocation only
|
|
176
|
+
* (the hf CLI resumes a network blip via HTTP Range inside one run); a killed
|
|
177
|
+
* run re-downloads from zero on the re-run, and the orphaned `.incomplete`
|
|
178
|
+
* blob lingers until `hf cache prune`.
|
|
179
|
+
* onLog is the run's log-text sink: the service writes the rendered command's
|
|
180
|
+
* `$ <hf download ...>` line through it before the runner spawns the child,
|
|
181
|
+
* so every download path (Get step, launch, download route) logs the command
|
|
182
|
+
* exactly once, from the exec site, ahead of its output.
|
|
152
183
|
*/
|
|
153
184
|
export interface DownloadModelOptions {
|
|
154
|
-
runner?: (command: string) => Promise<CommandOutcome>;
|
|
185
|
+
runner?: (command: string, signal?: AbortSignal, onChunk?: (chunk: string) => void) => Promise<CommandOutcome>;
|
|
186
|
+
onChunk?: (chunk: string) => void;
|
|
187
|
+
onLog?: CommandLogger;
|
|
188
|
+
useHubCache?: boolean;
|
|
189
|
+
signal?: AbortSignal;
|
|
155
190
|
}
|
|
156
191
|
/**
|
|
157
192
|
* SettingsNamespaceDescriptor is the structural view of one profile plugin
|
|
@@ -210,6 +245,71 @@ export interface SettingsForms {
|
|
|
210
245
|
}): Promise<SettingsDescribeAnswer>;
|
|
211
246
|
mutate(ns: string, ops: readonly SettingsOp[], expectedRevision?: number): Promise<SettingsRemoteResponse<unknown> | undefined>;
|
|
212
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* LaunchTargetEntry is the stored provider entry shape findLaunchTarget
|
|
250
|
+
* reads: the entry id, the engine id, and the config whose model field the
|
|
251
|
+
* engine-and-model match prices. The ui store's StoredProviderConfig
|
|
252
|
+
* satisfies it structurally, so the matcher stays free of the store shape.
|
|
253
|
+
*/
|
|
254
|
+
export interface LaunchTargetEntry {
|
|
255
|
+
id: string;
|
|
256
|
+
engine: string;
|
|
257
|
+
config: Config;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* RunLogSnapshot is the catch-up read of one run key's live log: the append
|
|
261
|
+
* count reached (the `seq` every later stream event continues), the bounded
|
|
262
|
+
* tail text (LOG_TAIL_BYTES), and whether a run is still writing. A mid-run
|
|
263
|
+
* page refresh or a late-opened Logs pane renders from this snapshot and
|
|
264
|
+
* then follows the live events, so it shows the same text a continuously
|
|
265
|
+
* attached reader has.
|
|
266
|
+
*/
|
|
267
|
+
export interface RunLogSnapshot {
|
|
268
|
+
seq: number;
|
|
269
|
+
text: string;
|
|
270
|
+
running: boolean;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* RunLogResetEvent announces a beginRun for the subscribed key: the buffer
|
|
274
|
+
* restarted at the seed text with seq 0, so a reader replaces its display
|
|
275
|
+
* instead of appending onto the previous run's text.
|
|
276
|
+
*/
|
|
277
|
+
export interface RunLogResetEvent {
|
|
278
|
+
kind: 'reset';
|
|
279
|
+
seq: number;
|
|
280
|
+
text: string;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* RunLogAppendEvent carries one live log append: `text` is the appended
|
|
284
|
+
* chunk (not the buffer), and `seq` is the buffer's append count after the
|
|
285
|
+
* chunk landed, so a reader that caught up from a snapshot can drop events
|
|
286
|
+
* it already holds.
|
|
287
|
+
*/
|
|
288
|
+
export interface RunLogAppendEvent {
|
|
289
|
+
kind: 'log';
|
|
290
|
+
seq: number;
|
|
291
|
+
text: string;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* RunLogEndEvent announces endRun for the subscribed key: the run stopped
|
|
295
|
+
* writing at `seq`. The text stays readable (readRunLog) until the next
|
|
296
|
+
* beginRun for that key.
|
|
297
|
+
*/
|
|
298
|
+
export interface RunLogEndEvent {
|
|
299
|
+
kind: 'end';
|
|
300
|
+
seq: number;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* RunLogEvent is one live update on a subscribed run key: the buffer reset
|
|
304
|
+
* by a begin, one appended chunk, or the run's end.
|
|
305
|
+
*/
|
|
306
|
+
export type RunLogEvent = RunLogResetEvent | RunLogAppendEvent | RunLogEndEvent;
|
|
307
|
+
/**
|
|
308
|
+
* RunLogListener receives a subscribed key's RunLogEvents. Listeners are
|
|
309
|
+
* independent per connection: a throwing or removed listener never blocks
|
|
310
|
+
* the writer or another subscriber.
|
|
311
|
+
*/
|
|
312
|
+
export type RunLogListener = (event: RunLogEvent) => void;
|
|
213
313
|
/**
|
|
214
314
|
* LocalInferService is the surface the service publishes on ctx.localInfer.
|
|
215
315
|
* Providers register engines, presets, and guidelines against the registries;
|
|
@@ -242,9 +342,9 @@ export interface LocalInferService {
|
|
|
242
342
|
guidelines(config: Config, hw: HardwareProfile, engineId?: string): Promise<GuidelineResult[]>;
|
|
243
343
|
deps(engineId: string, buildMode: BuildMode, hw: HardwareProfile): Promise<readonly SystemDep[]>;
|
|
244
344
|
installString(engineId: string, buildMode: BuildMode, hw: HardwareProfile): Promise<string>;
|
|
245
|
-
runInstall(engineId: string, buildMode: BuildMode, hw: HardwareProfile): Promise<InstallResult>;
|
|
345
|
+
runInstall(engineId: string, buildMode: BuildMode, hw: HardwareProfile, options?: RunInstallOptions): Promise<InstallResult>;
|
|
246
346
|
launch(plan: LaunchPlan, options?: LaunchOptions): Promise<LaunchResult>;
|
|
247
|
-
stop(plan: LaunchPlan): Promise<void>;
|
|
347
|
+
stop(plan: LaunchPlan, log?: CommandLogger): Promise<void>;
|
|
248
348
|
reLinkProviders(entries: readonly {
|
|
249
349
|
id: string;
|
|
250
350
|
record: ProviderLaunchRecord;
|
|
@@ -259,15 +359,72 @@ export interface LocalInferService {
|
|
|
259
359
|
* clears it, which the route's effect does on dispose.
|
|
260
360
|
*/
|
|
261
361
|
setEngineDeathObserver(observer: ((event: EngineDeathEvent) => void) | undefined): void;
|
|
362
|
+
/**
|
|
363
|
+
* registerSudoObserver reserves `key`'s slot (the runLogKey rule every run
|
|
364
|
+
* path shares) for the callback one run registers to hear that a sudo
|
|
365
|
+
* command is waiting for the user's password on the CLI: the observer
|
|
366
|
+
* writes the note line into its own run's Logs so the card user learns
|
|
367
|
+
* where the prompt landed. Registering a key that is taken replaces the
|
|
368
|
+
* old hook, and the returned disposer removes only its own hook, so
|
|
369
|
+
* concurrent runs never clobber each other's note routing and a settle
|
|
370
|
+
* never clears another run's slot.
|
|
371
|
+
*/
|
|
372
|
+
registerSudoObserver(key: string, observer: (command: string) => void): () => void;
|
|
373
|
+
/**
|
|
374
|
+
* notifySudoNeeded is the seam a command runner reports a waiting sudo
|
|
375
|
+
* prompt through: a guarded runner calls it when its probe finds no cached
|
|
376
|
+
* credentials, and the service forwards the command to every observer the
|
|
377
|
+
* runs registered (the shared CLI password wait can block any run, and
|
|
378
|
+
* the announce seam does not name the triggering run). No observer, or a
|
|
379
|
+
* throwing one, never fails the run that is already racing the sudo
|
|
380
|
+
* deadline.
|
|
381
|
+
*/
|
|
382
|
+
notifySudoNeeded(command: string): void;
|
|
383
|
+
/**
|
|
384
|
+
* beginRun starts one provider process's run under `key` (the runLogKey
|
|
385
|
+
* rule every run path shares): the live buffer resets to the `seed` line
|
|
386
|
+
* (the `--- <process>...` separator), the running flag goes true, the
|
|
387
|
+
* monotone seq restarts, and subscribers get a reset notice so a mid-run
|
|
388
|
+
* attached reader replaces rather than appends.
|
|
389
|
+
*/
|
|
390
|
+
beginRun(key: string, seed: string): void;
|
|
391
|
+
/**
|
|
392
|
+
* appendRunLog appends one chunk to `key`'s live buffer (tail-capped to
|
|
393
|
+
* LOG_TAIL_BYTES) and notifies subscribers with the chunk. Appending with
|
|
394
|
+
* no open run opens one lazily without a seed, so a note that lands after
|
|
395
|
+
* a settled run (an engine-death line, for example) still reaches the
|
|
396
|
+
* Logs.
|
|
397
|
+
*/
|
|
398
|
+
appendRunLog(key: string, text: string): void;
|
|
399
|
+
/**
|
|
400
|
+
* readRunLog answers `key`'s catch-up snapshot (mid-run page refresh,
|
|
401
|
+
* late pane open): the seq reached, the bounded tail text, and the
|
|
402
|
+
* running flag. A key that never ran reads as an empty stopped snapshot.
|
|
403
|
+
*/
|
|
404
|
+
readRunLog(key: string): RunLogSnapshot;
|
|
405
|
+
/**
|
|
406
|
+
* subscribeRunLog registers a listener for `key`'s RunLogEvents (appends,
|
|
407
|
+
* run begin, run end) and returns the disposer. Listeners are independent
|
|
408
|
+
* per connection; a slow or closed connection never blocks a writer.
|
|
409
|
+
*/
|
|
410
|
+
subscribeRunLog(key: string, listener: RunLogListener): () => void;
|
|
411
|
+
/**
|
|
412
|
+
* endRun clears `key`'s running flag and emits the end event. The text
|
|
413
|
+
* stays readable (readRunLog) until the next beginRun for that key. An
|
|
414
|
+
* end on a key with no open run is a no-op.
|
|
415
|
+
*/
|
|
416
|
+
endRun(key: string): void;
|
|
262
417
|
registerModel(plan: LaunchPlan, model: ModelRow, options?: RegisterModelOptions): Promise<RegisterResult>;
|
|
263
418
|
removeModel(providerId: string, modelId: string): Promise<void>;
|
|
264
419
|
resolveDefaults(engineId: string, modelId: string, hw: HardwareProfile, explicit?: Config): Promise<ResolvedDefaults>;
|
|
265
420
|
fetchPreset(source: PresetSource, options?: FetchPresetOptions): Promise<FetchPresetResult>;
|
|
266
421
|
defaultModelDirectory(): string;
|
|
422
|
+
defaultDatasetDirectory(): string;
|
|
267
423
|
hfCliAvailable(options?: HfCliOptions): Promise<string | null>;
|
|
268
424
|
downloadModel(entry: DefaultModel, directory: string, options?: DownloadModelOptions): Promise<DownloadResult>;
|
|
269
425
|
downloadChatTemplate(repo: string, directory: string, options?: DownloadModelOptions): Promise<DownloadResult>;
|
|
270
426
|
modelIsRegistered(providerId: string, modelId: string): Promise<boolean>;
|
|
271
427
|
listModelDirectory(directory: string): ModelDirectoryEntry[];
|
|
428
|
+
listModelCache(): ModelCacheEntry[];
|
|
272
429
|
}
|
|
273
|
-
//# sourceMappingURL=types.d.ts.map
|
|
430
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-local-infer-service",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Service Definition for the dsh local-inference capability seam (ctx.localInfer): the engine, preset, and guideline registries plus the orchestration entry points (estimate, guidelines, deps, installString, runInstall, launch, registerModel). Carries no store of its own.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
"@deepseek-ai/cordis": ">=4.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
39
|
+
"@deepseek-ai/cordis": "^4.0.6-alpha.2"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-local-infer-tool",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Model-facing tools for the dsh local-inference plugin: local_infer_estimate, local_infer_launch, local_infer_status, and local_infer_register, each on its own timeout budget, plus the system-prompt section that tells the agent when to use them",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
"@deepseek-ai/cordis": ">=4.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
39
|
+
"@deepseek-ai/cordis": "^4.0.6-alpha.2"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -28,7 +28,8 @@ export interface StoredPlatformConfig {
|
|
|
28
28
|
* StoredProviderConfig is one saved provider model+engine config the card
|
|
29
29
|
* lists: a stable id the card edits and deletes against, the engine and the
|
|
30
30
|
* full parameter config it serves, the per-engine platform config the deploy
|
|
31
|
-
* step consumes,
|
|
31
|
+
* step consumes, the per-provider Auto Rebuild flag the card's checkbox
|
|
32
|
+
* stores, and the launch record the launch step persists when it
|
|
32
33
|
* starts the entry's engine (the engine pid, start time, launch arguments,
|
|
33
34
|
* and the DSH process pid that launched it). The record is what a DSH
|
|
34
35
|
* restart re-links a surviving engine to its config; a stop clears it.
|
|
@@ -38,6 +39,7 @@ export interface StoredProviderConfig {
|
|
|
38
39
|
engine: string;
|
|
39
40
|
config: Config;
|
|
40
41
|
platform: StoredPlatformConfig;
|
|
42
|
+
autoRebuild?: boolean;
|
|
41
43
|
launch?: ProviderLaunchRecord;
|
|
42
44
|
}
|
|
43
45
|
export interface StoredConfig {
|
|
@@ -63,6 +65,14 @@ export declare function readConfig(): StoredConfig;
|
|
|
63
65
|
* configs, and the help toggle, creating the directory tree on first write.
|
|
64
66
|
*/
|
|
65
67
|
export declare function writeConfig(engine: string, config: Config, allowRunDeps: boolean, platform?: Record<string, StoredPlatformConfig>, showHelp?: boolean, providers?: StoredProviderConfig[], logPath?: string, lastLogs?: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* writeStored persists a read StoredConfig with a patch over one or more of
|
|
70
|
+
* its fields, leaving every unpatched field as the read returned it. The
|
|
71
|
+
* eight stored fields travel as one value through the ops, so a caller names
|
|
72
|
+
* only the field it changes (the providers list, the last-run logs) instead
|
|
73
|
+
* of re-passing every field the read returned.
|
|
74
|
+
*/
|
|
75
|
+
export declare function writeStored(stored: StoredConfig, patch?: Partial<StoredConfig>): void;
|
|
66
76
|
/**
|
|
67
77
|
* parsePlatformConfigs reads the stored platform map, keeping only entries
|
|
68
78
|
* whose fields are strings. A non-object map or a non-object entry reads as
|
|
@@ -76,4 +86,4 @@ export declare function parsePlatformConfigs(raw: unknown): Record<string, Store
|
|
|
76
86
|
* entry the save route synced.
|
|
77
87
|
*/
|
|
78
88
|
export declare function parseStoredPlatformConfig(raw: unknown): StoredPlatformConfig | undefined;
|
|
79
|
-
//# sourceMappingURL=config.d.ts.map
|
|
89
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -77,7 +77,9 @@ export function readConfig() {
|
|
|
77
77
|
* non-blank string id. A non-object entry or an entry with no id is dropped,
|
|
78
78
|
* so a by-hand edit never poisons the card's provider list. The per-engine
|
|
79
79
|
* platform config is read through the same string-field rule the platform map
|
|
80
|
-
* uses, so a provider never carries a platform field it cannot price.
|
|
80
|
+
* uses, so a provider never carries a platform field it cannot price. A
|
|
81
|
+
* non-boolean autoRebuild is dropped by the same by-hand-edit rule, so only
|
|
82
|
+
* a stored true or false reaches the launch skip.
|
|
81
83
|
*/
|
|
82
84
|
function parseProviders(raw) {
|
|
83
85
|
if (raw === null || typeof raw !== 'object' || !Array.isArray(raw)) {
|
|
@@ -94,6 +96,9 @@ function parseProviders(raw) {
|
|
|
94
96
|
const config = fields.config && typeof fields.config === 'object' ? fields.config : {};
|
|
95
97
|
const platform = parseStoredPlatformConfig(fields.platform) ?? {};
|
|
96
98
|
const provider = { id: fields.id, engine, config, platform };
|
|
99
|
+
if (typeof fields.autoRebuild === 'boolean') {
|
|
100
|
+
provider.autoRebuild = fields.autoRebuild;
|
|
101
|
+
}
|
|
97
102
|
const launch = parseLaunchRecord(fields.launch);
|
|
98
103
|
if (launch !== undefined) {
|
|
99
104
|
provider.launch = launch;
|
|
@@ -163,6 +168,17 @@ export function writeConfig(engine, config, allowRunDeps, platform, showHelp, pr
|
|
|
163
168
|
lastLogs: lastLogs ?? '',
|
|
164
169
|
}, null, 2));
|
|
165
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* writeStored persists a read StoredConfig with a patch over one or more of
|
|
173
|
+
* its fields, leaving every unpatched field as the read returned it. The
|
|
174
|
+
* eight stored fields travel as one value through the ops, so a caller names
|
|
175
|
+
* only the field it changes (the providers list, the last-run logs) instead
|
|
176
|
+
* of re-passing every field the read returned.
|
|
177
|
+
*/
|
|
178
|
+
export function writeStored(stored, patch = {}) {
|
|
179
|
+
const next = { ...stored, ...patch };
|
|
180
|
+
writeConfig(next.engine, next.config, next.allowRunDeps, next.platform, next.showHelp, next.providers, next.logPath, next.lastLogs);
|
|
181
|
+
}
|
|
166
182
|
/**
|
|
167
183
|
* parsePlatformConfigs reads the stored platform map, keeping only entries
|
|
168
184
|
* whose fields are strings. A non-object map or a non-object entry reads as
|
|
@@ -232,4 +248,4 @@ export function parseStoredPlatformConfig(raw) {
|
|
|
232
248
|
}
|
|
233
249
|
return stored;
|
|
234
250
|
}
|
|
235
|
-
//# sourceMappingURL=config.js.map
|
|
251
|
+
//# sourceMappingURL=config.js.map
|
package/packages/ui/lib/deps.js
CHANGED
|
@@ -95,4 +95,4 @@ export declare function resolveValue(spec: ParameterSpec, config: Config): unkno
|
|
|
95
95
|
* that message, which is how the form expresses cross-param gating.
|
|
96
96
|
*/
|
|
97
97
|
export declare function renderForm(specs: readonly ParameterSpec[], config: Config, hw?: HardwareProfile): FormModel;
|
|
98
|
-
//# sourceMappingURL=form.d.ts.map
|
|
98
|
+
//# sourceMappingURL=form.d.ts.map
|
package/packages/ui/lib/form.js
CHANGED
|
@@ -25,6 +25,12 @@ export { renderDeps } from './deps.ts';
|
|
|
25
25
|
export type { ChatTemplateDepModel, DepItemModel, DepsModel } from './deps.ts';
|
|
26
26
|
export { renderWarnings, toneFor } from './warnings.ts';
|
|
27
27
|
export type { WarningBannerModel, WarningModel, WarningsModel, WarningTone, } from './warnings.ts';
|
|
28
|
+
export type { StoredPlatformConfig } from './config.ts';
|
|
29
|
+
export type { InstallResponse } from './viewmodels/depsHelpers.ts';
|
|
30
|
+
export type { ChatTemplateStatusModel, LocalInferSummary, ProviderSummaryEntry, } from './viewmodels/summary.ts';
|
|
31
|
+
export type { Config, CustomArg, RegisterResult } from 'dsh-plugin-local-infer/core';
|
|
32
|
+
export type { DownloadResult, LaunchResult } from 'dsh-plugin-local-infer/service';
|
|
33
|
+
export type { LogsStreamEvent } from './routes/logs.ts';
|
|
28
34
|
/**
|
|
29
35
|
* Mount the Web UI. The browser card (dsh/client.js) registers into the
|
|
30
36
|
* Plugins page's `plugins.bundle.config` slot and talks to the settings route
|
|
@@ -38,4 +44,4 @@ declare const plugin: {
|
|
|
38
44
|
apply: typeof apply;
|
|
39
45
|
};
|
|
40
46
|
export default plugin;
|
|
41
|
-
//# sourceMappingURL=index.d.ts.map
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|