mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
[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:
@@ -37,6 +37,7 @@ export type ToolPackCliOptions = {
|
||||
signed?: boolean;
|
||||
silent?: boolean;
|
||||
to?: string;
|
||||
updateAction?: string;
|
||||
};
|
||||
|
||||
export type ToolPackRoots = {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user