Skip to main content

Module install_task

Module install_task 

Source
Expand description

The background task an install.start runs: take the install lock, reuse or clear what another instance left, run npm install (or a release download), publish every line of its output as install_chunk events, and end with one done event. Every way out releases the session and the provider.

install_handlers.rs owns the RPC handlers and the lookups; this file owns the run, one step per function, in the order the run takes them.

StructsΒ§

InstallJob πŸ”’
What install.start asked for, as the registry resolved it.
InstallRun πŸ”’
What one install session publishes to, and releases when it ends.

ConstantsΒ§

INSTALL_LOG_TAIL_LINES πŸ”’
How many lines of npm output a failed install logs.

FunctionsΒ§

acquire_install_lock πŸ”’
The shared dir is written by every AgentMux instance on this machine: serialize on its install lock. Waiting for another instance’s install must stay cancellable, so poll the lock and race install.cancel instead of blocking in it: a blocking wait would ignore cancel, keep the provider claimed, and could later report success for a cancelled session (#3927). The error is the message of the done event.
conclude_npm_exit πŸ”’
npm ended on its own: publish the one done event for how.
npm_install_args πŸ”’
The arguments of the one npm install run: the pinned package plus any companions (pi-acp’s pi) in one run, one dir, one completion marker, then the isolation flags.
push_tail πŸ”’
remove_partial_install πŸ”’
Wipe the partial install of a cancelled run so a retry doesn’t inherit a half-written package-lock.json. Best-effort β€” logging only on failure.
reuse_or_clear πŸ”’
Reuse only a FINISHED install (completion marker, not just a shim npm may have written early); clear a failed or interrupted one. Ok(true): there is a finished install to reuse.
run_download_install πŸ”’
An install.start for a provider that is a release download: fetch the pinned file, check its hash, unpack, publish. Output lines go to the session; install.cancel stops the transfer and removes the partial dir.
run_install πŸ”’
spawn_install_task πŸ”’
Run an install.start in the background.
spawn_npm πŸ”’

Type AliasesΒ§

OutputTail πŸ”’