feat(update): integrate managed installs and recoverable in-app updates (#6168)
Add owner-aware Stable and Preview updates with explicit consent, verified release plans, protected process handoff and bounded service recovery. Keep configuration and conversations separate from program rollback. Include the compact About controls, Windows long-path support, native package recovery checks and optional macOS Dock lifecycle integration. Preserve documented guidance for installations owned by other managers. This code integration does not publish packages, enable signing or advance the public update channel. Co-authored-by: chengyongru <61816729+chengyongru@users.noreply.github.com>
This commit is contained in:
1 parent
76da55994b
commit
fbb61a373f
216 files changed
+27948
-1084
No files matched your search
+85
-2
@@ -763,26 +763,42 @@ export async function fetchSettingsUsage(
|
||||
);
|
||||
}
|
||||
|
||||
export type UpdateChannel = "stable" | "preview";
|
||||
export interface ReleaseStatus {
|
||||
channel: UpdateChannel;
|
||||
revision: number;
|
||||
currentVersion: string;
|
||||
state: "available" | "current" | "ahead" | "waiting_stable" | "withdrawn" | "unavailable" | "publishing" | "unsupported";
|
||||
}
|
||||
export interface VersionCheckResult {
|
||||
installation_method?: UpdateMethod | null;
|
||||
releaseStatus?: ReleaseStatus;
|
||||
can_change_channel?: boolean;
|
||||
updateAvailable: {
|
||||
currentVersion: string;
|
||||
latestVersion: string;
|
||||
pypiUrl?: string;
|
||||
releaseUrl?: string;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export async function checkVersion(
|
||||
token: string,
|
||||
base: string = "",
|
||||
channelStatus = false,
|
||||
): Promise<VersionCheckResult> {
|
||||
return request<VersionCheckResult>(
|
||||
`${base}/api/settings/version-check`,
|
||||
`${base}/api/settings/version-check${channelStatus ? "?channel_status=1" : ""}`,
|
||||
token,
|
||||
undefined,
|
||||
10_000,
|
||||
90_000,
|
||||
);
|
||||
}
|
||||
|
||||
export function changeUpdateChannel(transport: WebUIMutationTransport, channel: UpdateChannel, revision: number): Promise<{ channel: UpdateChannel; revision: number }> {
|
||||
return mutation(transport, "settings.nanobot.update.channel", { channel, revision });
|
||||
}
|
||||
|
||||
export async function fetchWorkspaces(
|
||||
token: string,
|
||||
base: string = "",
|
||||
@@ -795,6 +811,73 @@ export async function fetchWorkspaces(
|
||||
);
|
||||
}
|
||||
|
||||
export type UpdateMethod = "managed" | "uv" | "pipx" | "pip" | "source" | "container" | "system";
|
||||
export interface UpdateGuide {
|
||||
method: UpdateMethod;
|
||||
host: string;
|
||||
environment: string;
|
||||
shell: "sh" | "powershell";
|
||||
inspect_command: string | null;
|
||||
update_command: string | null;
|
||||
verify_command: string | null;
|
||||
reason: "registry" | "preview" | "policy" | "extras" | "manager" | "source" | "container" | "system" | "review" | "restart";
|
||||
}
|
||||
export interface UpdateReview {
|
||||
id: string;
|
||||
installation_id: string;
|
||||
host: string;
|
||||
running_version: string;
|
||||
target_version: string;
|
||||
channel?: UpdateChannel;
|
||||
action: "upgrade" | "downgrade" | "restart" | "none";
|
||||
validity: "current" | "expired" | "installation_changed" | "profiles_changed" | "channel_changed";
|
||||
execution_blocked_reason: string | null;
|
||||
automatic_recovery?: boolean;
|
||||
guide?: UpdateGuide | null;
|
||||
profiles: { id: string; workspace: string; reviewed_state: string; stop: boolean; restart: boolean }[];
|
||||
}
|
||||
export interface UpdateReviewResponse {
|
||||
plan: UpdateReview;
|
||||
installation_allowed: boolean;
|
||||
execution_available: boolean;
|
||||
}
|
||||
export type UpdateJobPhase = "preparation_requested" | "preparing" | "preparation_failed" | "ready"
|
||||
| "checking" | "stopping" | "handoff_failed" | "backing_up" | "installing" | "verifying"
|
||||
| "installed" | "restarting" | "activating" | "finalizing" | "restart_failed" | "succeeded" | "failed" | "cancelled";
|
||||
export interface UpdateJob {
|
||||
id: string;
|
||||
installation_id: string;
|
||||
target_version: string;
|
||||
running_version: string;
|
||||
recorded_phase: UpdateJobPhase;
|
||||
recovery_active?: boolean;
|
||||
service_restored?: boolean;
|
||||
automatic_recovery?: boolean;
|
||||
previous_version?: string;
|
||||
mutation_started: boolean;
|
||||
execution_confirmation_id: string | null;
|
||||
recovery_command?: string;
|
||||
}
|
||||
export function createUpdateReview(transport: WebUIMutationTransport): Promise<UpdateReviewResponse> {
|
||||
return mutation(transport, "settings.nanobot.update.plan", { restart_running: true }, 60_000);
|
||||
}
|
||||
export function readUpdateReview(token: string, id: string): Promise<UpdateReviewResponse> {
|
||||
return request(`/api/settings/nanobot-update/plan?id=${encodeURIComponent(id)}`, token, undefined, API_READ_TIMEOUT_MS);
|
||||
}
|
||||
export function readUpdateJob(token: string, id: string): Promise<{ job: UpdateJob }> {
|
||||
return request(`/api/settings/nanobot-update/job?id=${encodeURIComponent(id)}`, token, undefined, API_READ_TIMEOUT_MS);
|
||||
}
|
||||
export function prepareUpdate(transport: WebUIMutationTransport, id: string): Promise<{ job: UpdateJob }> {
|
||||
return mutation(transport, "settings.nanobot.update.prepare", { id });
|
||||
}
|
||||
export function settleUpdate(transport: WebUIMutationTransport, id: string): Promise<{ job: UpdateJob }> {
|
||||
return mutation(transport, "settings.nanobot.update.settle", { id });
|
||||
}
|
||||
export function executeUpdate(transport: WebUIMutationTransport, id: string, previousConfirmation?: string): Promise<{ job: UpdateJob }> {
|
||||
return mutation(transport, previousConfirmation ? "settings.nanobot.update.retry" : "settings.nanobot.update.execute",
|
||||
{ id, confirm_restart: true, ...(previousConfirmation ? { previous_confirmation_id: previousConfirmation } : {}) });
|
||||
}
|
||||
|
||||
export async function fetchWorkspaceDirectories(
|
||||
token: string,
|
||||
path: string,
|
||||
|
||||
Reference in new issue
Block a user