mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-17 11:49:33 +01:00
feat(local-model): install a model from the server, with a job that can pause
POST /api/local-model/install, cancel, resume and runtime, and DELETE /api/local-model. The GET gains an `install` object the window polls. All of it is experimental and admin only in multi-user mode. One job of five steps (runtime, model, verify, agent, connect) driven by a pure reducer over explicit state, step and transition tables. One job at a time (409). The consent is bound to the size shown: `acknowledgedBytes` must be the server's own total (409 size-changed). A job a server restart interrupted comes back paused and never continues without a click. Every failure is a code with one next step. The model is judged against the budget the runtime measured before it is downloaded. A missing coding agent is installed with its stock command through the shared runner, audited. Connect writes one endpoint record under the reserved id through mutateCustomModelHosts() and switches customModelEndpointsEnabled on through mutateSettingsFile(), remembering the flag's value. The model's digest is stored and read again at boot and before every session start on that endpoint; a changed model refuses the launch. Remove answers 409 with the session names while a live session uses the endpoint, undoes the two writes first, restores the flag only when this feature switched it on and no other endpoint is saved, and deletes only inside local-model/. The coding agent stays. The server starts the runtime at boot when a model is installed and stops it at shutdown beside stopDeepSeekWeb(). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
a864acc52c
commit
3af94df4f6
17 files changed
+6290
-156
No files matched your search
+17
-1
@@ -146,6 +146,7 @@ import { probeLocalPaths, readClaudeEditSources, resolveClaudeTranscript } from
|
||||
import { remoteLocateClaudeTranscript, remoteProbePaths, remoteReadClaudeEditSources } from '../remote-files.js';
|
||||
import { remoteTmuxLocation } from '../tmux-manager.js';
|
||||
import { stopDeepSeekWeb } from '../deepseek-web-server.js';
|
||||
import { getLocalModelService } from '../local-model/install-job.js';
|
||||
import {
|
||||
wireRespawnListeners,
|
||||
setupTimedRespawn,
|
||||
@@ -1418,7 +1419,7 @@ export class WebServer extends EventEmitter {
|
||||
registerDoctorRoutes(this.app);
|
||||
registerCustomModelRoutes(this.app);
|
||||
registerCliRegistryRoutes(this.app);
|
||||
registerLocalModelRoutes(this.app);
|
||||
registerLocalModelRoutes(this.app, ctx);
|
||||
|
||||
// Cron: build the service from the same context, recompute
|
||||
// due times for any persisted jobs, then expose it to its routes.
|
||||
@@ -3441,6 +3442,14 @@ export class WebServer extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// The model Codeman runs on this Mac (src/local-model/): a job a restart interrupted comes
|
||||
// back paused and waits for a click, and an installed runtime that was not stopped is
|
||||
// started again (an own orphan on its port is adopted or replaced). Off the startup path:
|
||||
// boot() never throws, and nothing waits for a runtime to answer. Not in tests.
|
||||
if (!this.testMode) {
|
||||
void getLocalModelService().boot();
|
||||
}
|
||||
|
||||
// Sweep agent preamble caches whose sessions are gone (see
|
||||
// pruneAgentSessionPreambles). Once per boot, after restore, so every session this
|
||||
// instance owns is in the keep set. Best-effort and off the startup critical path.
|
||||
@@ -4590,6 +4599,13 @@ export class WebServer extends EventEmitter {
|
||||
// got wrong once.
|
||||
void stopDeepSeekWeb();
|
||||
|
||||
// The local model runtime is a non-detached child, but a child is not ended by its
|
||||
// parent's exit: it gets SIGTERM here, and an install job in flight is interrupted (the
|
||||
// next start reads it as paused). An orphan a hard kill leaves is adopted at the next boot.
|
||||
if (!this.testMode) {
|
||||
void getLocalModelService().shutdown();
|
||||
}
|
||||
|
||||
// The header's GPU / CPU clock sampler is a Windows child process under WSL, and its idle sweep a timer.
|
||||
stopHostSensors();
|
||||
|
||||
|
||||
Reference in new issue
Block a user