[codex] Add packaged desktop auto-update (#1375)

* Add packaged desktop auto-update

* Handle counted beta nightly update versions

* Refresh desktop auto-update branch for main

* Serialize desktop updater operations

* Refresh auto-update branch for packaged paths
This commit is contained in:
PerishFire
2026-05-19 11:20:05 +08:00
committed by GitHub
parent 56988e406c
commit 4424f08be0
38 changed files with 2443 additions and 15 deletions
+1
View File
@@ -37,6 +37,7 @@ export type ToolPackCliOptions = {
signed?: boolean;
silent?: boolean;
to?: string;
updateAction?: string;
};
export type ToolPackRoots = {
+2 -1
View File
@@ -67,7 +67,8 @@ function addSharedOptions(command: CacCommand) {
.option("--json", "print JSON")
.option("--namespace <name>", "runtime namespace")
.option("--expr <expression>", "desktop inspect eval expression")
.option("--path <path>", "desktop inspect screenshot path");
.option("--path <path>", "desktop inspect screenshot path")
.option("--update-action <action>", "desktop update action: status|check|download|install");
}
// Per-platform `--to` help text mirroring resolveToolPackBuildOutput in
+16 -1
View File
@@ -12,6 +12,7 @@ import {
type DesktopEvalResult,
type DesktopScreenshotResult,
type DesktopStatusSnapshot,
type DesktopUpdateResult,
type SidecarStamp,
} from "@open-design/sidecar-proto";
import { createSidecarLaunchEnv, requestJsonIpc, resolveAppIpcPath } from "@open-design/sidecar";
@@ -675,13 +676,20 @@ export async function readPackedMacLogs(config: ToolPackConfig) {
};
}
export async function inspectPackedMacApp(config: ToolPackConfig, options: { expr?: string; path?: string }): Promise<MacInspectResult> {
function resolveUpdateAction(value: string | undefined): "status" | "check" | "download" | "install" | null {
if (value == null) return null;
if (value === "status" || value === "check" || value === "download" || value === "install") return value;
throw new Error("--update-action must be status, check, download, or install");
}
export async function inspectPackedMacApp(config: ToolPackConfig, options: { expr?: string; path?: string; updateAction?: string }): Promise<MacInspectResult> {
const stamp = desktopStamp(config);
const status = await requestJsonIpc<DesktopStatusSnapshot>(
stamp.ipc,
{ type: SIDECAR_MESSAGES.STATUS },
{ timeoutMs: 2000 },
).catch(() => null);
const updateAction = resolveUpdateAction(options.updateAction);
return {
...(options.expr == null ? {} : {
@@ -698,6 +706,13 @@ export async function inspectPackedMacApp(config: ToolPackConfig, options: { exp
{ timeoutMs: 10000 },
),
}),
...(updateAction == null ? {} : {
update: await requestJsonIpc<DesktopUpdateResult>(
stamp.ipc,
{ input: { action: updateAction }, type: SIDECAR_MESSAGES.UPDATE },
{ timeoutMs: 60000 },
),
}),
status,
};
}
+2 -1
View File
@@ -1,4 +1,4 @@
import type { DesktopEvalResult, DesktopScreenshotResult, DesktopStatusSnapshot, SidecarStamp } from "@open-design/sidecar-proto";
import type { DesktopEvalResult, DesktopScreenshotResult, DesktopStatusSnapshot, DesktopUpdateResult, SidecarStamp } from "@open-design/sidecar-proto";
import type { CacheReport } from "../cache.js";
import type { ToolPackBuildOutput, ToolPackConfig } from "../config.js";
import type { INTERNAL_PACKAGES } from "./constants.js";
@@ -81,6 +81,7 @@ export type MacInspectResult = {
eval?: DesktopEvalResult;
screenshot?: DesktopScreenshotResult;
status: DesktopStatusSnapshot | null;
update?: DesktopUpdateResult;
};
export type DesktopRootIdentityMarker = {
+16 -1
View File
@@ -10,6 +10,7 @@ import {
type DesktopEvalResult,
type DesktopScreenshotResult,
type DesktopStatusSnapshot,
type DesktopUpdateResult,
type SidecarStamp,
} from "@open-design/sidecar-proto";
import { createSidecarLaunchEnv, requestJsonIpc, resolveAppIpcPath } from "@open-design/sidecar";
@@ -406,9 +407,16 @@ export async function resetPackedWinNamespaces(config: ToolPackConfig): Promise<
return { namespaces, results };
}
export async function inspectPackedWinApp(config: ToolPackConfig, options: { expr?: string; path?: string }): Promise<WinInspectResult> {
function resolveUpdateAction(value: string | undefined): "status" | "check" | "download" | "install" | null {
if (value == null) return null;
if (value === "status" || value === "check" || value === "download" || value === "install") return value;
throw new Error("--update-action must be status, check, download, or install");
}
export async function inspectPackedWinApp(config: ToolPackConfig, options: { expr?: string; path?: string; updateAction?: string }): Promise<WinInspectResult> {
const stamp = desktopStamp(config);
const status = await requestJsonIpc<DesktopStatusSnapshot>(stamp.ipc, { type: SIDECAR_MESSAGES.STATUS }, { timeoutMs: 2000 }).catch(() => null);
const updateAction = resolveUpdateAction(options.updateAction);
return {
...(options.expr == null ? {} : {
eval: await requestJsonIpc<DesktopEvalResult>(
@@ -424,6 +432,13 @@ export async function inspectPackedWinApp(config: ToolPackConfig, options: { exp
{ timeoutMs: 10000 },
),
}),
...(updateAction == null ? {} : {
update: await requestJsonIpc<DesktopUpdateResult>(
stamp.ipc,
{ input: { action: updateAction }, type: SIDECAR_MESSAGES.UPDATE },
{ timeoutMs: 60000 },
),
}),
status,
};
}
+2 -1
View File
@@ -1,4 +1,4 @@
import type { DesktopEvalResult, DesktopScreenshotResult, DesktopStatusSnapshot } from "@open-design/sidecar-proto";
import type { DesktopEvalResult, DesktopScreenshotResult, DesktopStatusSnapshot, DesktopUpdateResult } from "@open-design/sidecar-proto";
import type { CacheReport } from "../cache.js";
import type { ToolPackConfig } from "../config.js";
import type { INTERNAL_PACKAGES } from "./constants.js";
@@ -314,4 +314,5 @@ export type WinInspectResult = {
eval?: DesktopEvalResult;
screenshot?: DesktopScreenshotResult;
status: DesktopStatusSnapshot | null;
update?: DesktopUpdateResult;
};