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
package/packages/ui/lib/index.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* from; Phase 8 wires them into one panel with the lifecycle controls.
|
|
10
10
|
* @module dsh-plugin-local-infer/ui
|
|
11
11
|
*/
|
|
12
|
+
import { createNodeLifecycleHost } from '../../providers/lib/index.js';
|
|
12
13
|
import { registerLocalInferRoute } from "./route.js";
|
|
13
14
|
export const name = 'local-infer-ui';
|
|
14
15
|
export const inject = ['localInfer'];
|
|
@@ -32,7 +33,16 @@ export function apply(ctx) {
|
|
|
32
33
|
if (typeof ctx.inject === 'function') {
|
|
33
34
|
ctx.inject(['webServer'], (scope) => {
|
|
34
35
|
try {
|
|
35
|
-
|
|
36
|
+
// The route host is built here (not the bare node default) so its
|
|
37
|
+
// sudo hook reaches the service: a guarded command whose credential
|
|
38
|
+
// probe found nothing announces through notifySudoNeeded, and the
|
|
39
|
+
// launch run's sudo observer (ops/engine.ts) turns it into the
|
|
40
|
+
// streamed sudo event and the Logs note. The same host drives the
|
|
41
|
+
// Get and launch routes' Get steps.
|
|
42
|
+
const host = createNodeLifecycleHost(undefined, {
|
|
43
|
+
notify: (command) => localInfer.notifySudoNeeded(command),
|
|
44
|
+
});
|
|
45
|
+
registerLocalInferRoute(scope, localInfer, host, host);
|
|
36
46
|
}
|
|
37
47
|
catch (error) {
|
|
38
48
|
console.error(`[local-infer] settings route skipped: ${error}`);
|
|
@@ -42,4 +52,4 @@ export function apply(ctx) {
|
|
|
42
52
|
}
|
|
43
53
|
const plugin = { name, inject, apply };
|
|
44
54
|
export default plugin;
|
|
45
|
-
//# sourceMappingURL=index.js.map
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -57,4 +57,4 @@ export interface MeterModel {
|
|
|
57
57
|
* the dark segment's value came from.
|
|
58
58
|
*/
|
|
59
59
|
export declare function renderMeter(breakdown: VramBreakdown, verdict: VramVerdict, vramGiB: number, source: 'measured' | 'estimated' | 'not-measured', reserveSource?: ReserveSource, unknownEngines?: UnknownEnginesModel | null): MeterModel;
|
|
60
|
-
//# sourceMappingURL=meter.d.ts.map
|
|
60
|
+
//# sourceMappingURL=meter.d.ts.map
|
package/packages/ui/lib/meter.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The engine lifecycle operations: launchEngine
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
2
|
+
* The engine lifecycle operations: launchEngine runs the shared Get-steps
|
|
3
|
+
* routine (idempotent) and then renders the plan the registered adapter
|
|
4
|
+
* produces and runs the service's launch entry point (deploy, then the health
|
|
5
|
+
* poll), preserving the Get-step logs in the persisted last-run logs;
|
|
6
|
+
* stopEngine stops the exact container or process the launch started (a
|
|
7
|
+
* re-adopted engine through the record's pid), and a failed stop persists a
|
|
8
|
+
* note to the last-run logs and the log file; getEngine is a thin wrapper
|
|
9
|
+
* over the shared Get-steps routine (deps, git sync, build, model download,
|
|
10
|
+
* chat-template download). The launch record (the engine pid, start time,
|
|
11
|
+
* launch arguments, and the DSH process pid that launched it) is what a DSH
|
|
12
|
+
* restart re-links a surviving engine to its config:
|
|
9
13
|
* relinkStoredProviders re-adopts surviving engines on mount and per summary
|
|
10
14
|
* read, handleEngineDeath settles the stored state the moment an engine dies
|
|
11
15
|
* outside the stop path, and persistLaunchLogs stores the captured output.
|
|
@@ -17,24 +21,99 @@ import type { Config, LaunchStep, LifecycleHost } from 'dsh-plugin-local-infer/c
|
|
|
17
21
|
import type { EngineDeathEvent, LaunchResult, LocalInferService } from 'dsh-plugin-local-infer/service';
|
|
18
22
|
import type { StoredConfig, StoredProviderConfig } from '../config.ts';
|
|
19
23
|
import type { GetRequest, LaunchRequest } from '../request.ts';
|
|
24
|
+
/**
|
|
25
|
+
* CANCELED_LINE names the shared "Canceled" run line; it lives with the other
|
|
26
|
+
* run-line constants in ops/logs.ts and is re-exported here for the launch
|
|
27
|
+
* persisters' import surface.
|
|
28
|
+
*/
|
|
29
|
+
export { CANCELED_LINE } from './logs.ts';
|
|
30
|
+
/**
|
|
31
|
+
* GET_EVENT_PREFIX leads a Get run's event lines in the streamed and
|
|
32
|
+
* persisted run (the route's `get failed` line and getEngine's sudo CLI
|
|
33
|
+
* note), so both read alike and the `!!` marker has one home (routes/get.ts
|
|
34
|
+
* and getEngine both build it from here).
|
|
35
|
+
*/
|
|
36
|
+
export declare const GET_EVENT_PREFIX = "!! ";
|
|
20
37
|
/**
|
|
21
38
|
* resolveAdapter picks the registered engine adapter an engine id routes to. A
|
|
22
39
|
* card that names an engine no adapter serves gets a 404, not a blank panel.
|
|
23
40
|
*/
|
|
24
41
|
export declare function resolveAdapter(localInfer: LocalInferService, engineId: string): import("dsh-plugin-local-infer/core").EngineAdapter;
|
|
25
42
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
* resolveStoredRequest resolves a route request's engine and config against
|
|
44
|
+
* the stored config: the request's fields win, and an absent field falls back
|
|
45
|
+
* to the stored value, the same rule every route applies. The Get route
|
|
46
|
+
* reads it for its run-log key before delegating to getEngine.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveStoredRequest(request: {
|
|
49
|
+
engine?: string;
|
|
50
|
+
config?: Config;
|
|
51
|
+
}): {
|
|
52
|
+
stored: StoredConfig;
|
|
53
|
+
engineId: string;
|
|
54
|
+
config: Config;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* registerSudoObserver registers the run's sudo hook on the service under
|
|
58
|
+
* the run's key (the hub's own keying) and returns the disposer that removes
|
|
59
|
+
* only this hook: concurrent runs each keep their own slot, a re-launch
|
|
60
|
+
* under the same key takes the slot from the older run, and the first settle
|
|
61
|
+
* never clears another run's note routing. The service hands every guarded
|
|
62
|
+
* announcement to every registered hook (the shared CLI password wait can
|
|
63
|
+
* block any run, and the announce seam does not name the triggering run), so
|
|
64
|
+
* one wait notes every run in flight. launchEngine and getEngine share the
|
|
65
|
+
* helper so the sudo-note rule has one home: the hook appends noteLine to
|
|
66
|
+
* the run's own sink (the note rides the streamed run and the run text
|
|
67
|
+
* persisted when the step settles) and through persistProcessLog (so a run
|
|
68
|
+
* still hung on the prompt reads the note in the Logs section and the log
|
|
69
|
+
* file before it settles), then calls onSudo, the route's stream event; a
|
|
70
|
+
* Get passes none because its control keeps its throbber. The caller invokes
|
|
71
|
+
* the disposer in a finally so a failed run leaves no hook behind.
|
|
72
|
+
*/
|
|
73
|
+
export declare function registerSudoObserver(localInfer: LocalInferService, runKey: string, noteLine: string, noteTo: (text: string) => void, onSudo?: () => void): () => void;
|
|
74
|
+
/**
|
|
75
|
+
* launchEngine runs the shared Get-steps routine (idempotent: deps, git sync,
|
|
76
|
+
* build, model download, chat-template download, each skipped when already
|
|
77
|
+
* satisfied) and then renders the plan the registered adapter produces for
|
|
78
|
+
* the config and the detected hardware, and runs the service's launch entry
|
|
79
|
+
* point (deploy, then the health poll). A git sync of an existing checkout
|
|
80
|
+
* that fails under the continueOnSyncFailure override (always on for a
|
|
81
|
+
* launch) keeps the Get run going with the checkout's current version and
|
|
82
|
+
* reports syncFailed on the result; the launch then threads autoRebuild:
|
|
83
|
+
* false into the deploy step, which skips its own git sync (it would hit the
|
|
84
|
+
* same rebase conflict) and launches the current version, while the Get
|
|
85
|
+
* error line persists in the last-run logs and the log file. The detail the
|
|
86
|
+
* launch returns names the broken step when the engine does not come up.
|
|
87
|
+
* The launch line (the
|
|
88
|
+
* engine binary and its arguments) leads the engine output in the run logs
|
|
89
|
+
* the card's Logs section and the log file carry, and the Get-step output the
|
|
90
|
+
* launch ran leads it, so a broken setup diagnoses against the exact steps
|
|
91
|
+
* and child process the launch started, and the Get logs are preserved, not
|
|
92
|
+
* wiped, by the launch's persistence. The launch step persists the
|
|
33
93
|
* launch record (the engine pid, start time, launch arguments, and the DSH
|
|
34
94
|
* process pid that launched it) on the request's provider entry, so a DSH
|
|
35
|
-
* restart can re-link a surviving engine to its config.
|
|
95
|
+
* restart can re-link a surviving engine to its config. The optional signal
|
|
96
|
+
* is the card's cancel: an abort interrupts the in-flight Get-step download
|
|
97
|
+
* child, and the persisted run carries a "Canceled" line. The optional
|
|
98
|
+
* onChunk is the hf download's raw stderr progress sink: the download runner
|
|
99
|
+
* hands each streamed chunk to it as it lands, so a launch that runs the Get
|
|
100
|
+
* steps streams the download progress the same way a Get does. The optional
|
|
101
|
+
* onSudo is the route's sudo-event writer: while the run is in flight, the
|
|
102
|
+
* service's sudo observer answers a guarded command waiting for a password on
|
|
103
|
+
* the launching CLI by landing the core CLI note in the run logs and the log
|
|
104
|
+
* file and calling onSudo; the observer is unregistered when the run settles,
|
|
105
|
+
* failed or not, so a failing run leaves none behind. The whole run brackets
|
|
106
|
+
* one live hub run under the runLogKey rule (the "--- Launching..." seed,
|
|
107
|
+
* the Get-steps sink, the command note, the deploy and engine output at
|
|
108
|
+
* settle, end in a finally), so the streaming logs route reads the launch.
|
|
109
|
+
*/
|
|
110
|
+
export declare function launchEngine(localInfer: LocalInferService, request: LaunchRequest, onProgress?: (step: LaunchStep) => void, host?: LifecycleHost, signal?: AbortSignal, onChunk?: (chunk: string) => void, onSudo?: () => void): Promise<LaunchResult>;
|
|
111
|
+
/**
|
|
112
|
+
* RunLogWriter is the hub slice handleEngineDeath needs: the catch-up read,
|
|
113
|
+
* the append, and the settle. The LocalInfer service satisfies it, so the
|
|
114
|
+
* route's observer closure can hand the service itself to the note path.
|
|
36
115
|
*/
|
|
37
|
-
export
|
|
116
|
+
export type RunLogWriter = Pick<LocalInferService, 'readRunLog' | 'appendRunLog' | 'endRun'>;
|
|
38
117
|
/**
|
|
39
118
|
* handleEngineDeath persists a provider entry's state when its engine process
|
|
40
119
|
* dies outside the plugin's stop path: a crash, a pkill of a plugin-launched
|
|
@@ -45,23 +124,38 @@ export declare function launchEngine(localInfer: LocalInferService, request: Lau
|
|
|
45
124
|
* line lands in the card's last-run logs beside the engine's own output. An
|
|
46
125
|
* event that matches no entry carrying a record (a stop the route already
|
|
47
126
|
* cleared, an engine the plugin never tracked) is a no-op, which keeps an
|
|
48
|
-
* expected stop quiet.
|
|
127
|
+
* expected stop quiet. With a run-log hub (the route's observer closure
|
|
128
|
+
* captures the service), the same note line also lands in the dead entry's
|
|
129
|
+
* live buffer: the snapshot is read first, and if the run was NOT already
|
|
130
|
+
* running, the append's lazy reopen is settled with endRun right after, so a
|
|
131
|
+
* late note streams without stranding the key as running.
|
|
49
132
|
*/
|
|
50
|
-
export declare function handleEngineDeath(event: EngineDeathEvent): void;
|
|
133
|
+
export declare function handleEngineDeath(event: EngineDeathEvent, runLogs?: RunLogWriter): void;
|
|
51
134
|
/**
|
|
52
135
|
* persistLaunchLogs stores a launch's captured output as the last run and
|
|
53
|
-
* writes it to the configured log file. The
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
136
|
+
* writes it to the configured log file. The Get-step output the launch ran
|
|
137
|
+
* (the optional runText) leads the persisted run, so the Logs section and the
|
|
138
|
+
* log file show the Get steps followed by the launch, not the launch wiping
|
|
139
|
+
* the Get logs. The stored last-run logs ride the shared capRunLogs tail rule
|
|
140
|
+
* (ops/logs.ts), the same cap the append paths and the live hub apply. The
|
|
141
|
+
* log file is only written when the run produced output and the log location
|
|
142
|
+
* is set; the last-run logs are always persisted (an empty string clears a
|
|
143
|
+
* stale run) so the card's Logs section shows the previous run after a
|
|
144
|
+
* reload.
|
|
57
145
|
*/
|
|
58
|
-
export declare function persistLaunchLogs(result: LaunchResult, engineId: string, config: Config): void;
|
|
146
|
+
export declare function persistLaunchLogs(result: LaunchResult, engineId: string, config: Config, runText?: string): void;
|
|
59
147
|
/**
|
|
60
148
|
* stopEngine renders the same plan and runs the service's stop entry point, so
|
|
61
149
|
* the stop step targets the exact container or process the launch started. The
|
|
62
150
|
* stop then clears the target entry's launch record (the engine pid and the
|
|
63
151
|
* previous-pid list with it), so a recycled pid cannot re-link an engine the
|
|
64
|
-
* user just stopped.
|
|
152
|
+
* user just stopped. An engine a DSH restart re-adopted carries no tracked
|
|
153
|
+
* child handle in the adapter, so the stop stamps the record's pid on the
|
|
154
|
+
* plan and the adapter signals it through the host; a stop that fails
|
|
155
|
+
* persists a note (the engine, the model, and the host's message) to the
|
|
156
|
+
* stored last-run logs and the log file, so the card's Logs section names the
|
|
157
|
+
* broken step, and re-throws, so the route answers 500 and the card's stop
|
|
158
|
+
* deadline settles the entry to the red Logs state.
|
|
65
159
|
*/
|
|
66
160
|
export declare function stopEngine(localInfer: LocalInferService, request: LaunchRequest): Promise<void>;
|
|
67
161
|
/**
|
|
@@ -88,16 +182,30 @@ export type GetOutcome = {
|
|
|
88
182
|
detail?: string;
|
|
89
183
|
};
|
|
90
184
|
/**
|
|
91
|
-
* getEngine is the Get step:
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
185
|
+
* getEngine is the Get step: a thin wrapper over the shared Get-steps routine
|
|
186
|
+
* (the system dependencies, the git sync, the build, the model download, and
|
|
187
|
+
* the chat-template download), streaming every step through log as it lands,
|
|
188
|
+
* so the card appends it to the Logs section live. The dependency install
|
|
189
|
+
* only runs while the Play/Run trust gate is on; with the gate off the deps
|
|
190
|
+
* are re-checked and a missing one aborts the step with the copy/paste note.
|
|
191
|
+
* The optional signal is the card's cancel: an abort interrupts the in-flight
|
|
192
|
+
* hf download child (SIGINT, then SIGTERM). Resume is within-invocation only:
|
|
193
|
+
* the hf CLI (huggingface_hub 2.x) resumes a network blip via HTTP Range inside
|
|
194
|
+
* one `hf download` run, but a killed run re-downloads from zero on the re-run
|
|
195
|
+
* (each run writes a process-unique `.incomplete` temp blob and unlinks it on
|
|
196
|
+
* failure), so an orphaned partial blob lingers until `hf cache prune`. The
|
|
197
|
+
* optional onChunk is the hf download's raw stderr progress sink: the
|
|
198
|
+
* download runner hands each streamed chunk to it as it lands, separate from
|
|
199
|
+
* the log sink, so the route parses the tqdm lines into progress events. The
|
|
200
|
+
* run registers the same sudo observer a launch does: a guarded command
|
|
201
|
+
* waiting for the user's password on the launching CLI writes the core CLI
|
|
202
|
+
* note through log as a GET_EVENT_PREFIX line, the same marker the route's
|
|
203
|
+
* own failure line uses, so the note rides the streamed run and the run text
|
|
204
|
+
* the route persists, and through persistProcessLog so a run still hung on
|
|
205
|
+
* the prompt reads it before it settles. The Get control keeps its throbber,
|
|
206
|
+
* so the observer announces nothing beyond the note line.
|
|
99
207
|
*/
|
|
100
|
-
export declare function getEngine(localInfer: LocalInferService, request: GetRequest, log: (chunk: string) => void, host?: LifecycleHost): Promise<GetOutcome>;
|
|
208
|
+
export declare function getEngine(localInfer: LocalInferService, request: GetRequest, log: (chunk: string) => void, host?: LifecycleHost, signal?: AbortSignal, onChunk?: (chunk: string) => void): Promise<GetOutcome>;
|
|
101
209
|
/**
|
|
102
210
|
* syncPlatformConfigs re-syncs the service registry with the stored platform
|
|
103
211
|
* map: it registers (or re-registers) every engine that carries a config, and
|
|
@@ -105,4 +213,4 @@ export declare function getEngine(localInfer: LocalInferService, request: GetReq
|
|
|
105
213
|
* platform config the user last saved.
|
|
106
214
|
*/
|
|
107
215
|
export declare function syncPlatformConfigs(localInfer: LocalInferService, stored: StoredConfig): void;
|
|
108
|
-
//# sourceMappingURL=engine.d.ts.map
|
|
216
|
+
//# sourceMappingURL=engine.d.ts.map
|