@omercnet/paseo-omp 5.4.0-next.401.1 → 5.4.0-next.402.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/omp-config-surface.tsx +42 -16
- package/client/omp-update-row.tsx +87 -0
- package/index.server.ts +4 -0
- package/package.json +1 -1
- package/server/omp-update.ts +203 -0
- package/server/package-version.ts +1 -1
- package/shared/omp-update.ts +27 -0
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
updateOmpSettings,
|
|
26
26
|
} from "../shared/omp-settings";
|
|
27
27
|
import { type OmpStore, storeLabel } from "../shared/omp-store";
|
|
28
|
+
import { getOmpUpdateStatus } from "../shared/omp-update";
|
|
28
29
|
import { getOmpProviderHealth, type OmpProviderHealth } from "../shared/provider-diagnostics";
|
|
29
30
|
import { getOmpSupportReport, OMP_SUPPORT_ISSUE_URL } from "../shared/support-diagnostics";
|
|
30
31
|
import { ComposerPillSettingsSection } from "./composer-pill-settings";
|
|
@@ -47,6 +48,7 @@ import { OmpRulesSection } from "./omp-rules-section";
|
|
|
47
48
|
import { OmpSkillsSection } from "./omp-skills-section";
|
|
48
49
|
import { OmpStorePicker } from "./omp-store-picker";
|
|
49
50
|
import { ompStoreKey } from "./omp-store-state";
|
|
51
|
+
import { OmpUpdateRow, UPDATE_QUERY_KEY } from "./omp-update-row";
|
|
50
52
|
import {
|
|
51
53
|
type BinaryHealthSummary,
|
|
52
54
|
loadReadyProviderSnapshot,
|
|
@@ -222,10 +224,14 @@ function BinarySection({
|
|
|
222
224
|
theme,
|
|
223
225
|
styles,
|
|
224
226
|
health,
|
|
227
|
+
workspaceScoped,
|
|
228
|
+
onUpdateInstalled,
|
|
225
229
|
}: {
|
|
226
230
|
theme: PluginSurfaceProps["theme"];
|
|
227
231
|
styles: OmpConfigStyles;
|
|
228
232
|
health: OmpProviderHealth;
|
|
233
|
+
workspaceScoped: boolean;
|
|
234
|
+
onUpdateInstalled(): void;
|
|
229
235
|
}) {
|
|
230
236
|
const summary = summarizeBinaryHealth(health.binary);
|
|
231
237
|
return (
|
|
@@ -247,6 +253,9 @@ function BinarySection({
|
|
|
247
253
|
valueColor={theme.colors.statusDanger}
|
|
248
254
|
/>
|
|
249
255
|
) : null}
|
|
256
|
+
{health.binary.installed && !workspaceScoped ? (
|
|
257
|
+
<OmpUpdateRow styles={styles} theme={theme} onInstalled={onUpdateInstalled} />
|
|
258
|
+
) : null}
|
|
250
259
|
</SectionCard>
|
|
251
260
|
);
|
|
252
261
|
}
|
|
@@ -374,8 +383,10 @@ function ProviderHealthSection({
|
|
|
374
383
|
const paseo = usePaseo();
|
|
375
384
|
const queryClient = useQueryClient();
|
|
376
385
|
const loadHealth = useRpc(getOmpProviderHealth);
|
|
386
|
+
const loadUpdateStatus = useRpc(getOmpUpdateStatus);
|
|
387
|
+
const healthKey = [...HEALTH_QUERY_KEY, ompStoreKey(store), cwd ?? "global"];
|
|
377
388
|
const health = useQuery({
|
|
378
|
-
queryKey:
|
|
389
|
+
queryKey: healthKey,
|
|
379
390
|
queryFn: () => loadHealth({ store, ...(cwd ? { cwd } : {}) }),
|
|
380
391
|
});
|
|
381
392
|
const providers = useQuery({
|
|
@@ -384,23 +395,30 @@ function ProviderHealthSection({
|
|
|
384
395
|
});
|
|
385
396
|
const refresh = useMutation({
|
|
386
397
|
mutationFn: async () => {
|
|
387
|
-
const result = await
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
),
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
const [result, update] = await Promise.all([
|
|
399
|
+
refreshProviderDiagnostics({
|
|
400
|
+
providers: paseo.providers,
|
|
401
|
+
providerIds: [
|
|
402
|
+
...selectKnownOmpProviders(providers.data?.entries ?? []).map(
|
|
403
|
+
(provider) => provider.id,
|
|
404
|
+
),
|
|
405
|
+
...(store?.profile ? [`omp-plugin-${store.profile}`] : []),
|
|
406
|
+
],
|
|
407
|
+
loadForcedHealth: () => loadHealth({ store, force: true, ...(cwd ? { cwd } : {}) }),
|
|
408
|
+
cacheHealth: (value) => queryClient.setQueryData(healthKey, value),
|
|
409
|
+
cacheProviders: (value) => queryClient.setQueryData(PROVIDERS_QUERY_KEY, value),
|
|
410
|
+
}),
|
|
411
|
+
cwd ? undefined : loadUpdateStatus({ force: true }).catch(() => undefined),
|
|
412
|
+
]);
|
|
413
|
+
if (update) queryClient.setQueryData(UPDATE_QUERY_KEY, update);
|
|
401
414
|
if (result.failed) throw new Error("Could not fully refresh OMP provider health.");
|
|
402
415
|
},
|
|
403
416
|
});
|
|
417
|
+
// After an update the version row is stale; the install already returned the fresh update status.
|
|
418
|
+
const reloadHealth = useMutation({
|
|
419
|
+
mutationFn: () => loadHealth({ store, force: true, ...(cwd ? { cwd } : {}) }),
|
|
420
|
+
onSuccess: (value) => queryClient.setQueryData(healthKey, value),
|
|
421
|
+
});
|
|
404
422
|
const isRefreshing = refresh.isPending || health.isFetching || providers.isFetching;
|
|
405
423
|
const knownProviders = providers.data ? selectKnownOmpProviders(providers.data.entries) : [];
|
|
406
424
|
|
|
@@ -434,7 +452,15 @@ function ProviderHealthSection({
|
|
|
434
452
|
{refresh.error ? (
|
|
435
453
|
<Text style={styles.error}>Could not fully refresh provider health. Try again.</Text>
|
|
436
454
|
) : null}
|
|
437
|
-
{health.data ?
|
|
455
|
+
{health.data ? (
|
|
456
|
+
<BinarySection
|
|
457
|
+
theme={theme}
|
|
458
|
+
styles={styles}
|
|
459
|
+
health={health.data}
|
|
460
|
+
workspaceScoped={cwd !== undefined}
|
|
461
|
+
onUpdateInstalled={() => reloadHealth.mutate()}
|
|
462
|
+
/>
|
|
463
|
+
) : null}
|
|
438
464
|
{health.data ? (
|
|
439
465
|
<CapabilitiesSection theme={theme} styles={styles} health={health.data} />
|
|
440
466
|
) : null}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Text, View } from "react-native";
|
|
5
|
+
import { getOmpUpdateStatus, installOmpUpdate, type OmpUpdateStatus } from "../shared/omp-update";
|
|
6
|
+
import { ActionButton, ConfirmModal } from "./omp-accounts-section";
|
|
7
|
+
import type { OmpConfigStyles } from "./omp-config-styles";
|
|
8
|
+
|
|
9
|
+
export const UPDATE_QUERY_KEY = ["paseo-omp", "update-status"] as const;
|
|
10
|
+
|
|
11
|
+
export function summarizeUpdateStatus(status: OmpUpdateStatus): string {
|
|
12
|
+
if (status.state === "available") return `${status.version} available`;
|
|
13
|
+
if (status.state === "up-to-date") return "Up to date";
|
|
14
|
+
return "Could not check for updates";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The "Update available" line for the omp binary card, with a confirmed Update button. */
|
|
18
|
+
export function OmpUpdateRow({
|
|
19
|
+
styles,
|
|
20
|
+
theme,
|
|
21
|
+
onInstalled,
|
|
22
|
+
}: {
|
|
23
|
+
styles: OmpConfigStyles;
|
|
24
|
+
theme: PluginSurfaceProps["theme"];
|
|
25
|
+
onInstalled(): void;
|
|
26
|
+
}) {
|
|
27
|
+
const queryClient = useQueryClient();
|
|
28
|
+
const loadStatus = useRpc(getOmpUpdateStatus);
|
|
29
|
+
const install = useRpc(installOmpUpdate);
|
|
30
|
+
const status = useQuery({ queryKey: UPDATE_QUERY_KEY, queryFn: () => loadStatus({}) });
|
|
31
|
+
const [confirming, setConfirming] = useState(false);
|
|
32
|
+
const [message, setMessage] = useState<{ ok: boolean; text: string } | null>(null);
|
|
33
|
+
const update = useMutation({
|
|
34
|
+
mutationFn: () => install({}),
|
|
35
|
+
onSuccess: async (result) => {
|
|
36
|
+
await queryClient.cancelQueries({ queryKey: UPDATE_QUERY_KEY });
|
|
37
|
+
queryClient.setQueryData(UPDATE_QUERY_KEY, result.status);
|
|
38
|
+
setMessage({ ok: result.ok, text: result.message });
|
|
39
|
+
onInstalled();
|
|
40
|
+
},
|
|
41
|
+
onError: () => setMessage({ ok: false, text: "Could not update OMP. Try again." }),
|
|
42
|
+
onSettled: () => setConfirming(false),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (status.isLoading) return <Text style={styles.muted}>Checking for an OMP update…</Text>;
|
|
46
|
+
const current = status.data ?? { state: "unknown" as const };
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<View style={styles.row}>
|
|
50
|
+
<Text style={styles.rowLabel}>Update</Text>
|
|
51
|
+
<Text
|
|
52
|
+
style={[
|
|
53
|
+
styles.rowValue,
|
|
54
|
+
current.state === "available" ? { color: theme.colors.statusWarning } : null,
|
|
55
|
+
]}
|
|
56
|
+
>
|
|
57
|
+
{summarizeUpdateStatus(current)}
|
|
58
|
+
</Text>
|
|
59
|
+
{current.state === "available" ? (
|
|
60
|
+
<ActionButton
|
|
61
|
+
styles={styles}
|
|
62
|
+
theme={theme}
|
|
63
|
+
label={update.isPending ? "Updating…" : "Update"}
|
|
64
|
+
disabled={update.isPending}
|
|
65
|
+
onPress={() => setConfirming(true)}
|
|
66
|
+
/>
|
|
67
|
+
) : null}
|
|
68
|
+
</View>
|
|
69
|
+
{message ? (
|
|
70
|
+
<Text style={message.ok ? styles.muted : styles.error}>{message.text}</Text>
|
|
71
|
+
) : null}
|
|
72
|
+
{confirming ? (
|
|
73
|
+
<ConfirmModal
|
|
74
|
+
styles={styles}
|
|
75
|
+
theme={theme}
|
|
76
|
+
title="Update OMP"
|
|
77
|
+
body="Installs the newest OMP on this host. Agents that are running keep the old version until they restart."
|
|
78
|
+
confirmLabel="Update"
|
|
79
|
+
tone="primary"
|
|
80
|
+
busy={update.isPending}
|
|
81
|
+
onConfirm={() => update.mutate()}
|
|
82
|
+
onCancel={() => setConfirming(false)}
|
|
83
|
+
/>
|
|
84
|
+
) : null}
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
}
|
package/index.server.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
resolveListOmpSkills,
|
|
26
26
|
resolveSetOmpSkillEnabled,
|
|
27
27
|
} from "./server/omp-skills";
|
|
28
|
+
import { resolveGetOmpUpdateStatus, resolveInstallOmpUpdate } from "./server/omp-update";
|
|
28
29
|
import { OmpOperationalFailureCollector } from "./server/operational-failure-diagnostics";
|
|
29
30
|
import { withOmpStore } from "./server/paths";
|
|
30
31
|
import { OmpProtocolViolationCollector } from "./server/protocol-violation-diagnostics";
|
|
@@ -84,6 +85,7 @@ import { listOmpRules } from "./shared/omp-rules";
|
|
|
84
85
|
import { listOmpSettings, updateOmpSettings } from "./shared/omp-settings";
|
|
85
86
|
import { deleteOmpManagedSkill, listOmpSkills, setOmpSkillEnabled } from "./shared/omp-skills";
|
|
86
87
|
import { listOmpStores, type OmpStore } from "./shared/omp-store";
|
|
88
|
+
import { getOmpUpdateStatus, installOmpUpdate } from "./shared/omp-update";
|
|
87
89
|
import { getOmpProviderHealth } from "./shared/provider-diagnostics";
|
|
88
90
|
import { getOmpImage } from "./shared/provider-image";
|
|
89
91
|
import { providerLaunchSettings } from "./shared/provider-launch-settings";
|
|
@@ -213,6 +215,8 @@ export default function contribute(server: PluginServerContext) {
|
|
|
213
215
|
server.handle(listOmpSettings, scoped(resolveListOmpSettings));
|
|
214
216
|
server.handle(updateOmpSettings, scoped(resolveUpdateOmpSettings));
|
|
215
217
|
server.handle(getOmpProviderHealth, scoped(resolveGetOmpProviderHealth));
|
|
218
|
+
server.handle(getOmpUpdateStatus, resolveGetOmpUpdateStatus);
|
|
219
|
+
server.handle(installOmpUpdate, resolveInstallOmpUpdate);
|
|
216
220
|
server.handle(getOmpImage, (input) => resolveGetOmpImage(input, ompImageCache()));
|
|
217
221
|
server.handle(
|
|
218
222
|
getOmpSupportReport,
|
package/package.json
CHANGED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { tmpdir } from "node:os";
|
|
2
|
+
import { delimiter, dirname, parse } from "node:path";
|
|
3
|
+
import type { RpcInput } from "@getpaseo/plugin";
|
|
4
|
+
import {
|
|
5
|
+
type getOmpUpdateStatus,
|
|
6
|
+
type installOmpUpdate,
|
|
7
|
+
type OmpUpdateStatus,
|
|
8
|
+
OmpUpdateStatusSchema,
|
|
9
|
+
} from "../shared/omp-update";
|
|
10
|
+
import { SerialMutationQueue } from "./mutation-queue";
|
|
11
|
+
import { resolveOmpExecutable } from "./omp-settings";
|
|
12
|
+
import { currentOmpEnvironment } from "./paths";
|
|
13
|
+
import {
|
|
14
|
+
type BoundedRun,
|
|
15
|
+
buildStatefulCommandEnv,
|
|
16
|
+
defaultSpawn,
|
|
17
|
+
runBounded,
|
|
18
|
+
} from "./provider-diagnostics";
|
|
19
|
+
|
|
20
|
+
const CHECK_TIMEOUT_MS = 20_000;
|
|
21
|
+
const INSTALL_TIMEOUT_MS = 5 * 60_000;
|
|
22
|
+
const KILL_GRACE_MS = 1_000;
|
|
23
|
+
const MAX_OUTPUT_BYTES = 64 * 1024;
|
|
24
|
+
const CHECK_CACHE_TTL_MS = 10 * 60_000;
|
|
25
|
+
// Network and install-root settings an npm, bun or binary self-update needs. Credentials and
|
|
26
|
+
// tokens stay excluded.
|
|
27
|
+
const UPDATE_ENV = [
|
|
28
|
+
"HTTPS_PROXY",
|
|
29
|
+
"HTTP_PROXY",
|
|
30
|
+
"NO_PROXY",
|
|
31
|
+
"https_proxy",
|
|
32
|
+
"http_proxy",
|
|
33
|
+
"no_proxy",
|
|
34
|
+
"BUN_INSTALL",
|
|
35
|
+
"NODE_EXTRA_CA_CERTS",
|
|
36
|
+
"SSL_CERT_FILE",
|
|
37
|
+
"SSL_CERT_DIR",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export interface OmpUpdateDependencies {
|
|
41
|
+
resolveExecutable(): Promise<string | null>;
|
|
42
|
+
run(executable: string, args: readonly string[], timeoutMs: number): Promise<BoundedRun>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface OmpInstallResult {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
message: string;
|
|
48
|
+
status: OmpUpdateStatus;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* `omp update` finds the install to replace by looking up `omp` on PATH, not by its own path, so
|
|
53
|
+
* the directory of the executable we run goes first: the check and the update then act on the
|
|
54
|
+
* install the Diagnostics card shows.
|
|
55
|
+
*/
|
|
56
|
+
export function updateEnvironment(executable: string): NodeJS.ProcessEnv {
|
|
57
|
+
const source = currentOmpEnvironment();
|
|
58
|
+
const env = buildStatefulCommandEnv(source);
|
|
59
|
+
for (const name of UPDATE_ENV) {
|
|
60
|
+
const value = source[name];
|
|
61
|
+
if (value !== undefined) env[name] = value;
|
|
62
|
+
}
|
|
63
|
+
env.PATH = [dirname(executable), env.PATH].filter(Boolean).join(delimiter);
|
|
64
|
+
env.NO_COLOR = "1";
|
|
65
|
+
return env;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function runOmp(executable: string, args: readonly string[], timeoutMs: number) {
|
|
69
|
+
return runBounded(
|
|
70
|
+
defaultSpawn,
|
|
71
|
+
executable,
|
|
72
|
+
args,
|
|
73
|
+
updateEnvironment(executable),
|
|
74
|
+
timeoutMs,
|
|
75
|
+
KILL_GRACE_MS,
|
|
76
|
+
MAX_OUTPUT_BYTES,
|
|
77
|
+
tmpdir(),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** An executable under another name cannot be found by omp's PATH lookup, so it is refused. */
|
|
82
|
+
async function resolveUpdateTarget(): Promise<string | null> {
|
|
83
|
+
const executable = await resolveOmpExecutable();
|
|
84
|
+
return executable && parse(executable).name.toLowerCase() === "omp" ? executable : null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function succeeded(run: BoundedRun): boolean {
|
|
88
|
+
return (
|
|
89
|
+
run.outcome === "exited" &&
|
|
90
|
+
run.exitCode === 0 &&
|
|
91
|
+
run.signal === null &&
|
|
92
|
+
!run.truncated &&
|
|
93
|
+
!run.cleanupFailed
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Reads the two lines `omp update --check` documents: "New version available" or "Already up to date". */
|
|
98
|
+
export function parseOmpUpdateCheck(stdout: string): OmpUpdateStatus {
|
|
99
|
+
const available = /^New version available: (\S+)\s*$/m.exec(stdout);
|
|
100
|
+
if (available) {
|
|
101
|
+
const parsed = OmpUpdateStatusSchema.safeParse({ state: "available", version: available[1] });
|
|
102
|
+
return parsed.success ? parsed.data : { state: "unknown" };
|
|
103
|
+
}
|
|
104
|
+
return /Already up to date/.test(stdout) ? { state: "up-to-date" } : { state: "unknown" };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function installMessage(run: BoundedRun, status: OmpUpdateStatus): string {
|
|
108
|
+
if (run.cleanupFailed) return "OMP update process cleanup could not be confirmed.";
|
|
109
|
+
if (run.outcome === "timeout") return "OMP update timed out. The install may be incomplete.";
|
|
110
|
+
if (!succeeded(run)) return "OMP could not update itself. Update it the way it was installed.";
|
|
111
|
+
if (status.state === "available") {
|
|
112
|
+
return "OMP is still on the old version. If a package manager installed it, update it there.";
|
|
113
|
+
}
|
|
114
|
+
if (status.state === "unknown") return "OMP update finished, but the new version is unconfirmed.";
|
|
115
|
+
return "OMP updated. Running agents keep the old version until they restart.";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Owns the update check cache. `omp update --check` goes to the network, so a recent answer is
|
|
120
|
+
* reused and concurrent callers share one run. A failed check is never cached. An install
|
|
121
|
+
* invalidates every check that started before it ended, so a slow check cannot write a stale
|
|
122
|
+
* answer over the post-install one.
|
|
123
|
+
*/
|
|
124
|
+
export function createOmpUpdateService(
|
|
125
|
+
dependencies: OmpUpdateDependencies,
|
|
126
|
+
now: () => number = Date.now,
|
|
127
|
+
) {
|
|
128
|
+
let cached: { status: OmpUpdateStatus; expiresAt: number } | null = null;
|
|
129
|
+
let inFlight: Promise<OmpUpdateStatus> | null = null;
|
|
130
|
+
let generation = 0;
|
|
131
|
+
const installs = new SerialMutationQueue();
|
|
132
|
+
|
|
133
|
+
async function checkNow(): Promise<OmpUpdateStatus> {
|
|
134
|
+
const executable = await dependencies.resolveExecutable();
|
|
135
|
+
if (!executable) return { state: "unknown" };
|
|
136
|
+
const run = await dependencies.run(executable, ["update", "--check"], CHECK_TIMEOUT_MS);
|
|
137
|
+
return succeeded(run) ? parseOmpUpdateCheck(run.stdout) : { state: "unknown" };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function check(force: boolean): Promise<OmpUpdateStatus> {
|
|
141
|
+
if (!force && cached && cached.expiresAt > now()) return Promise.resolve(cached.status);
|
|
142
|
+
if (inFlight) return inFlight;
|
|
143
|
+
const started = generation;
|
|
144
|
+
const request = checkNow()
|
|
145
|
+
.then((status) => {
|
|
146
|
+
if (started === generation && status.state !== "unknown") {
|
|
147
|
+
cached = { status, expiresAt: now() + CHECK_CACHE_TTL_MS };
|
|
148
|
+
}
|
|
149
|
+
return status;
|
|
150
|
+
})
|
|
151
|
+
.finally(() => {
|
|
152
|
+
if (inFlight === request) inFlight = null;
|
|
153
|
+
});
|
|
154
|
+
inFlight = request;
|
|
155
|
+
return request;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function invalidate(): void {
|
|
159
|
+
generation += 1;
|
|
160
|
+
cached = null;
|
|
161
|
+
inFlight = null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function install(): Promise<OmpInstallResult> {
|
|
165
|
+
const executable = await dependencies.resolveExecutable();
|
|
166
|
+
if (!executable) {
|
|
167
|
+
return {
|
|
168
|
+
ok: false,
|
|
169
|
+
message: "OMP can only be updated when its executable is named omp.",
|
|
170
|
+
status: { state: "unknown" },
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
invalidate();
|
|
174
|
+
const run = await dependencies.run(executable, ["update"], INSTALL_TIMEOUT_MS);
|
|
175
|
+
invalidate();
|
|
176
|
+
const status = await check(true);
|
|
177
|
+
return {
|
|
178
|
+
ok: succeeded(run) && status.state === "up-to-date",
|
|
179
|
+
message: installMessage(run, status),
|
|
180
|
+
status,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
status: (input: RpcInput<typeof getOmpUpdateStatus>) => check(input.force === true),
|
|
186
|
+
install: () => installs.run(install),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Binary-global, so the handlers are not store-scoped: a selected profile changes nothing here.
|
|
191
|
+
const service = createOmpUpdateService({ resolveExecutable: resolveUpdateTarget, run: runOmp });
|
|
192
|
+
|
|
193
|
+
export function resolveGetOmpUpdateStatus(
|
|
194
|
+
input: RpcInput<typeof getOmpUpdateStatus>,
|
|
195
|
+
): Promise<OmpUpdateStatus> {
|
|
196
|
+
return service.status(input);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function resolveInstallOmpUpdate(
|
|
200
|
+
_input: RpcInput<typeof installOmpUpdate>,
|
|
201
|
+
): Promise<OmpInstallResult> {
|
|
202
|
+
return service.install();
|
|
203
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Release Please keeps this bundle-safe constant aligned with package.json. */
|
|
2
|
-
export const PASEO_OMP_PACKAGE_VERSION = "5.4.0-next.
|
|
2
|
+
export const PASEO_OMP_PACKAGE_VERSION = "5.4.0-next.402.1"; // x-release-please-version
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineRpc } from "@getpaseo/plugin";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/** Bounded so nothing unbounded from `omp update --check` output crosses the RPC. */
|
|
5
|
+
const OmpUpdateVersionSchema = z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^\d{1,4}\.\d{1,4}\.\d{1,4}(?:-[0-9A-Za-z.]{1,32})?$/);
|
|
8
|
+
|
|
9
|
+
/** `unknown` means the check could not run or its output was not understood: never a guess. */
|
|
10
|
+
export const OmpUpdateStatusSchema = z.discriminatedUnion("state", [
|
|
11
|
+
z.object({ state: z.literal("up-to-date") }),
|
|
12
|
+
z.object({ state: z.literal("available"), version: OmpUpdateVersionSchema }),
|
|
13
|
+
z.object({ state: z.literal("unknown") }),
|
|
14
|
+
]);
|
|
15
|
+
export type OmpUpdateStatus = z.infer<typeof OmpUpdateStatusSchema>;
|
|
16
|
+
|
|
17
|
+
export const getOmpUpdateStatus = defineRpc({
|
|
18
|
+
name: "paseo-omp.get-update-status",
|
|
19
|
+
input: z.object({ force: z.boolean().optional() }),
|
|
20
|
+
output: OmpUpdateStatusSchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const installOmpUpdate = defineRpc({
|
|
24
|
+
name: "paseo-omp.install-update",
|
|
25
|
+
input: z.object({}),
|
|
26
|
+
output: z.object({ ok: z.boolean(), message: z.string(), status: OmpUpdateStatusSchema }),
|
|
27
|
+
});
|