feat(local-model): the launch refusal hook, and an honest name for a rebuilt log line

- `LocalModelService.launchRefusal(endpointId)`: what a session launch asks
  before it starts on the managed endpoint. It answers the error that
  refuses the launch (the runtime child is not alive, another program holds
  the port, the runtime keeps stopping, the model's digest changed) or
  nothing. New error code `runtime-not-running` with its sentence, for a
  runtime the person stopped: only a refused session start says it.
- The fake runtime's MacBook log line is rebuilt from the two values the
  measurement notes quote, so it is `INFERENCE_COMPUTE_LINE_MACBOOK` now.
  Only the Mac mini line is a verbatim capture and keeps `REAL_`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-06 20:23:58 +01:00
1 parent 771072c36b
commit 84c1017487
4 files changed
+24 -7

No files matched your search

+11
View File
@@ -84,6 +84,7 @@ import type {
LocalModelConflict,
LocalModelDeveloperTools,
LocalModelErrorCode,
LocalModelInstallError,
LocalModelInstallRequest,
LocalModelInstallState,
LocalModelInstallStep,
@@ -458,6 +459,16 @@ export interface LocalModelServiceDeps {
export interface LocalModelService {
/** The `install` object of the GET. Never throws. */
view(): Promise<LocalModelInstallView>;
/**
* Whether a session may be started on the saved endpoint `endpointId` right now. `undefined`:
* yes, which is also the answer for every endpoint that is not this feature's. Otherwise the
* error that refuses the launch, in this order: `runtime-not-running` (the runtime child
* Codeman started is not alive, so whatever answers on the port is not ours),
* `port-in-use`, `runtime-stopped`, `model-changed` (the digest is read again and is not the
* stored one). The session launch path asks this before it starts a session with the
* managed endpoint, and `boot()` asks it once. Never throws.
*/
launchRefusal(endpointId: string): Promise<LocalModelInstallError | undefined>;
/** What the GET passes to `recommend()`: the stored measured total and the runtime download that is still needed. */
recommendOptions(): Promise<RecommendOptions>;
/** `POST /api/local-model/install`. Answers once the job is STARTED; the job runs on in the server. */