add a persistent update channel with a /nightly command (#2323) master
* add a persistent update channel with a /beta command Self-updates read latest.json or beta.json based on the running version's prerelease tag, with no way to choose. This adds an updateChannel setting, --beta/--stable flags on prime-agent update that persist it, a /beta slash command that switches to beta and updates immediately (/beta off returns to stable, /beta status reports the choice), and routes startup version notices and compiled-install updates through the same preference. * apply formatter output from pre-commit check * warn and confirm before switching updates to the beta channel /beta no longer flips the setting itself. The update command prints that beta builds are unreleased and may be broken, asks for confirmation unless --force is given, persists the channel only after a yes, and then continues into the existing busy-session confirmation. * let a channel switch install the current beta and read the channel from global settings A stable 1.2.3 never saw 1.2.3-beta.N as an update because prerelease ordering ranks it lower. isReleaseUpdateCandidate keeps same-channel updates strictly newer but accepts a different version with a base version that is not older when the user explicitly switched channels. The CLI, compiled updates, and startup notices use it. getUpdateChannel now reads global settings only, so a project settings file cannot override the user's choice, and ignores values other than stable or beta. * gate the beta switch before any update work and never persist it on cancel The public update command now accepts --beta and --stable. The beta warning and confirmation run before extensions are touched, the channel is persisted only after the busy-session confirmation succeeds or when nothing needs installing, and a beta manifest that cannot be resolved aborts instead of falling back to the stable registry package. Cancelled or refused updates exit with the not-attempted code when launched from the interactive client, so /beta declined is a no-op rather than a relaunch. * treat an unresolved beta manifest as a no-op for compiled installs and reject channel flags on extension-only updates getNativeUpdatePlan now throws NativeReleaseUnavailableError when the manifest cannot be resolved, and the self-update plan maps that to the same non-runnable beta-unavailable result the npm path uses, so /beta does not relaunch the client when nothing was installed. --beta and --stable are rejected for extension-only targets rather than being accepted and ignored, mirroring --rollback. * keep exit code 1 when the session-loss prompt is declined The interactive parent relies on a non-sentinel exit there, and an existing test pins it. The not-attempted sentinel stays for the beta-specific cancellations: the beta warning declined, the non-TTY refusal, and an unresolvable beta manifest. * map every failed compiled-release lookup to the unavailable plan and save a confirmed channel even without an updater Network, timeout, and malformed-manifest errors from the compiled release lookup now surface as NativeReleaseUnavailableError with the cause attached, so a /beta run on a compiled install is a no-op instead of a failed update that relaunches the client. When no self-update command exists for the install, the already-confirmed channel switch is still persisted before the manual-update guidance is printed. * benchmarks: clamp CPU deltas at zero when a child exits mid-measurement cpu_total() sums CPU time over the live process tree, so a process exiting between the start and end samples lowers the total and the raw delta can go slightly negative. The report schema rejects negative observations, which aborted the agents_view trial on the main baseline and left 19 measurements incomplete. cpu_delta() clamps at zero; all ten sites use it. * list the channel flags in the public update help The public command registry renders its own usage for prime-agent update --help; it still advertised only --force and --rollback. * rename the channel surface to nightly /nightly, --nightly, the saved updateChannel value, and every message now say nightly. The release bucket still publishes these builds as beta (beta.json and -beta.N version tags), so that mapping stays internal to version-check. * never install a lower base version, even with --force --force is also how a channel switch is scripted without a TTY, so it must not double as permission to downgrade. Both the npm and compiled update plans now refuse a release whose major.minor.patch is below the installed version and leave the channel unchanged; compiled installs are pointed at --rollback. * report being ahead of a channel as nothing to update A channel whose current release is below the installed base version is still never installed, but without --force that is now a green no-op with the not-attempted exit code, so a plain update or /nightly off while ahead does not fail or relaunch the client. With --force the refusal stays explicit. The compiled path returns the refusal in its plan instead of throwing, so the interactive client treats it the same way. * guard a missing nightly manifest by the effective channel A -beta install with no saved preference is on the nightly channel by inference, so an unresolvable manifest must abort for it too instead of falling through to the stable registry package. * reload settings after the updater child returns without relaunching /nightly persists the channel inside the update child. When that child installs nothing, the interactive parent keeps running with its in-memory settings, so /nightly status could report the old channel. Reload from disk before reporting. * say what was not updated instead of claiming nothing was installed With an all target, extensions may already have been updated before the nightly manifest lookup fails or a downgrade is refused. Both messages now state that Prime Agent itself was not updated. * keep a successful extension update when the self update is unavailable For an all target the extensions are updated before the self update is planned. A missing nightly manifest or refused downgrade now reports that Prime Agent was not updated without failing the run that already updated extensions. --------- Co-authored-by: Seth Karten <32787133+sethkarten@users.noreply.github.com>