@hyperwindmill/caretaker-cli 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/web/voice_backend.d.ts +8 -2
- package/dist/cli/web/voice_backend.d.ts.map +1 -1
- package/dist/cli/web/voice_backend.js +29 -2
- package/dist/webview/standalone.css +4 -0
- package/dist/webview/standalone.css.map +2 -2
- package/dist/webview/standalone.js +45 -3
- package/dist/webview/standalone.js.map +2 -2
- package/package.json +3 -3
|
@@ -32,6 +32,7 @@ interface BackendDeps {
|
|
|
32
32
|
runContainer: (args: string[]) => Promise<void>;
|
|
33
33
|
startContainer: (name: string) => Promise<void>;
|
|
34
34
|
stopContainer: (name: string) => Promise<void>;
|
|
35
|
+
removeContainer: (name: string) => Promise<void>;
|
|
35
36
|
}
|
|
36
37
|
/** @internal Test-only seam: swap the docker layer so tests never need a real
|
|
37
38
|
* Docker daemon. Pass null to restore the real implementation. */
|
|
@@ -41,9 +42,14 @@ export declare function loopbackPort(endpoint: string): number | null;
|
|
|
41
42
|
export declare function probeBackend(endpoint: string): Promise<BackendStatus>;
|
|
42
43
|
export declare function startBackend(voice: VoiceConfig): AsyncGenerator<StartProgress>;
|
|
43
44
|
/** `docker stop` only — never `rm`, never touches the volume. Stopping must
|
|
44
|
-
* not cost a multi-gigabyte re-download
|
|
45
|
-
*
|
|
45
|
+
* not cost a multi-gigabyte re-download. Removing the container (and only
|
|
46
|
+
* the container — the model-cache volume and the image survive) is its own
|
|
47
|
+
* affordance, `deleteBackend`, so a container that froze stale state at
|
|
48
|
+
* creation (e.g. the network's DNS) can be recreated by the next Start. */
|
|
46
49
|
export declare function stopBackend(): Promise<void>;
|
|
50
|
+
/** `docker rm -f` on the managed container. Handles running and stopped
|
|
51
|
+
* alike; never touches the `caretaker-hf-hub-cache` volume or the image. */
|
|
52
|
+
export declare function deleteBackend(): Promise<void>;
|
|
47
53
|
/** @internal Test-only seam: observe the in-flight guard without inferring it
|
|
48
54
|
* from side effects (call counts, timing) — deterministic instead of racy. */
|
|
49
55
|
export declare function isBackendStartInFlightForTest(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice_backend.d.ts","sourceRoot":"","sources":["../../../src/cli/web/voice_backend.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAoBnD,MAAM,MAAM,aAAa,GAAG;IAC1B,qFAAqF;IACrF,MAAM,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5C,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,wEAAwE;IACxE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,uEAAuE;IACvE,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAIF,UAAU,WAAW;IACnB,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC;IAC5E,UAAU,EAAE,MAAM,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvF,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,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EvD;AAsBD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAgDpD;AAED;;;mEAGmE;AACnE,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
|
|
@@ -110,6 +110,9 @@ const defaultDeps = {
|
|
|
110
110
|
async stopContainer(name) {
|
|
111
111
|
await dockerExec(['stop', name]);
|
|
112
112
|
},
|
|
113
|
+
async removeContainer(name) {
|
|
114
|
+
await dockerExec(['rm', '-f', name]);
|
|
115
|
+
},
|
|
113
116
|
};
|
|
114
117
|
let deps = defaultDeps;
|
|
115
118
|
/** @internal Test-only seam: swap the docker layer so tests never need a real
|
|
@@ -299,11 +302,18 @@ export async function* startBackend(voice) {
|
|
|
299
302
|
yield { step: 'done', message: 'Backend started.', status: await probeBackend(endpoint) };
|
|
300
303
|
}
|
|
301
304
|
/** `docker stop` only — never `rm`, never touches the volume. Stopping must
|
|
302
|
-
* not cost a multi-gigabyte re-download
|
|
303
|
-
*
|
|
305
|
+
* not cost a multi-gigabyte re-download. Removing the container (and only
|
|
306
|
+
* the container — the model-cache volume and the image survive) is its own
|
|
307
|
+
* affordance, `deleteBackend`, so a container that froze stale state at
|
|
308
|
+
* creation (e.g. the network's DNS) can be recreated by the next Start. */
|
|
304
309
|
export async function stopBackend() {
|
|
305
310
|
await deps.stopContainer(CONTAINER_NAME);
|
|
306
311
|
}
|
|
312
|
+
/** `docker rm -f` on the managed container. Handles running and stopped
|
|
313
|
+
* alike; never touches the `caretaker-hf-hub-cache` volume or the image. */
|
|
314
|
+
export async function deleteBackend() {
|
|
315
|
+
await deps.removeContainer(CONTAINER_NAME);
|
|
316
|
+
}
|
|
307
317
|
// --- HTTP surface + auto-start -------------------------------------------
|
|
308
318
|
// The realistic collision here is auto-start-at-boot racing the user
|
|
309
319
|
// pressing Start; there is never more than one caretaker web-server process
|
|
@@ -368,6 +378,23 @@ export function registerVoiceBackend(app) {
|
|
|
368
378
|
const status = await probeBackend(config.voice?.endpoint ?? '');
|
|
369
379
|
return c.json(status);
|
|
370
380
|
});
|
|
381
|
+
app.post('/api/voice/backend/delete', async (c) => {
|
|
382
|
+
// Never tear the container down mid-pull/mid-install: the start flow
|
|
383
|
+
// assumes the container it just created is still there.
|
|
384
|
+
if (backendStarting) {
|
|
385
|
+
return c.text('A start is in progress; wait for it to finish before deleting.', 409);
|
|
386
|
+
}
|
|
387
|
+
const config = await loadConfig();
|
|
388
|
+
try {
|
|
389
|
+
await deleteBackend();
|
|
390
|
+
}
|
|
391
|
+
catch {
|
|
392
|
+
// No such container, daemon unreachable, etc. — the truth is in the
|
|
393
|
+
// re-probe below, not in a 500 for an action that is already done.
|
|
394
|
+
}
|
|
395
|
+
const status = await probeBackend(config.voice?.endpoint ?? '');
|
|
396
|
+
return c.json(status);
|
|
397
|
+
});
|
|
371
398
|
}
|
|
372
399
|
/** Fire-and-forget: called once right after `serve()` in server.ts. Must
|
|
373
400
|
* never block server boot (a first run pulls 2.08 GB) and must never throw
|
|
@@ -2752,6 +2752,10 @@ body.vscode-light .composer__attachment {
|
|
|
2752
2752
|
border: 1px solid rgba(127, 127, 127, 0.3);
|
|
2753
2753
|
border-radius: 4px;
|
|
2754
2754
|
}
|
|
2755
|
+
.composer__voice-mode option {
|
|
2756
|
+
background: var(--vscode-dropdown-background, #252526);
|
|
2757
|
+
color: var(--vscode-dropdown-foreground, #cccccc);
|
|
2758
|
+
}
|
|
2755
2759
|
.composer__voice-status {
|
|
2756
2760
|
font-size: 11px;
|
|
2757
2761
|
opacity: 0.7;
|