@deveye/types 0.21.7 → 0.21.9
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/package.json +1 -1
- package/src/domain/packages.ts +6 -4
- package/src/features/agent.ts +4 -3
- package/src/index.ts +6 -0
- package/src/protocol/agent.ts +28 -4
- package/src/sdk/client-ambient.d.ts +83 -7
package/package.json
CHANGED
package/src/domain/packages.ts
CHANGED
|
@@ -51,13 +51,12 @@ export function isManagedPackageManager(
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* One
|
|
55
|
-
*
|
|
54
|
+
* One update tool present on the machine. Presence is a file check, so the
|
|
55
|
+
* list arrives at once; a managed tool's pending count follows on its own
|
|
56
|
+
* (`pendingCountSchema`), as its probe can take a minute.
|
|
56
57
|
*/
|
|
57
58
|
export const packageManagerSchema = z.object({
|
|
58
59
|
id: z.union([packageManagerIdSchema, unmanagedUpdaterIdSchema]),
|
|
59
|
-
/** Pending update count; `null` when unknown (slow/best-effort probe). */
|
|
60
|
-
pendingCount: z.number().int().nonnegative().nullable(),
|
|
61
60
|
/** Applying this manager's updates requires root/admin. */
|
|
62
61
|
needsRoot: z.boolean(),
|
|
63
62
|
/** A reboot is pending for updates this manager already applied. */
|
|
@@ -65,3 +64,6 @@ export const packageManagerSchema = z.object({
|
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
export type PackageManager = z.infer<typeof packageManagerSchema>;
|
|
67
|
+
|
|
68
|
+
/** Pending update count of a managed tool; `null` when it gave none (probe failed or timed out). */
|
|
69
|
+
export const pendingCountSchema = z.number().int().nonnegative().nullable();
|
package/src/features/agent.ts
CHANGED
|
@@ -116,9 +116,10 @@ export const agentUpdate = {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* Ask the agent
|
|
120
|
-
*
|
|
121
|
-
*
|
|
119
|
+
* Ask the agent for its update tools and their pending updates. The tools
|
|
120
|
+
* present arrive as a `package.list` push event, then one `package.count` per
|
|
121
|
+
* managed tool as its probe finishes (the caller must be subscribed to the
|
|
122
|
+
* device). The command itself only acknowledges the request.
|
|
122
123
|
*/
|
|
123
124
|
export const agentListPackages = {
|
|
124
125
|
command: 'agent.listPackages' as const,
|
package/src/index.ts
CHANGED
|
@@ -48,6 +48,7 @@ export {
|
|
|
48
48
|
AGENT_DOCKER_STATS_RESULT,
|
|
49
49
|
AGENT_LOG_SOURCES_RESULT,
|
|
50
50
|
AGENT_METRICS_BATCH,
|
|
51
|
+
AGENT_PKG_COUNT,
|
|
51
52
|
AGENT_PKG_DONE,
|
|
52
53
|
AGENT_PKG_LIST,
|
|
53
54
|
AGENT_PKG_LIST_RESULT,
|
|
@@ -121,6 +122,7 @@ export {
|
|
|
121
122
|
agentDockerProgressPayloadSchema,
|
|
122
123
|
agentDockerStatsResultPayloadSchema,
|
|
123
124
|
agentLogSourcesResultPayloadSchema,
|
|
125
|
+
agentPkgCountPayloadSchema,
|
|
124
126
|
agentPkgDonePayloadSchema,
|
|
125
127
|
agentPkgListResultPayloadSchema,
|
|
126
128
|
agentPkgProgressPayloadSchema,
|
|
@@ -207,10 +209,12 @@ export {
|
|
|
207
209
|
deviceTermOutputPushSchema,
|
|
208
210
|
METRICS_PUSH_EVENT,
|
|
209
211
|
metricsPushSchema,
|
|
212
|
+
PACKAGE_COUNT_EVENT,
|
|
210
213
|
PACKAGE_DONE_EVENT,
|
|
211
214
|
PACKAGE_LIST_EVENT,
|
|
212
215
|
PACKAGE_PROGRESS_EVENT,
|
|
213
216
|
PACKAGE_STARTED_EVENT,
|
|
217
|
+
packageCountPushSchema,
|
|
214
218
|
packageDonePushSchema,
|
|
215
219
|
packageListPushSchema,
|
|
216
220
|
packageProgressPushSchema,
|
|
@@ -297,6 +301,7 @@ export type {
|
|
|
297
301
|
DeviceTermExitPush,
|
|
298
302
|
DeviceTermOutputPush,
|
|
299
303
|
MetricsPush,
|
|
304
|
+
PackageCountPush,
|
|
300
305
|
PackageDonePush,
|
|
301
306
|
PackageListPush,
|
|
302
307
|
PackageProgressPush,
|
|
@@ -665,6 +670,7 @@ export {
|
|
|
665
670
|
isManagedPackageManager,
|
|
666
671
|
packageManagerIdSchema,
|
|
667
672
|
packageManagerSchema,
|
|
673
|
+
pendingCountSchema,
|
|
668
674
|
unmanagedUpdaterIdSchema
|
|
669
675
|
} from './domain/packages';
|
|
670
676
|
export type { PackageManager, PackageManagerId, UnmanagedUpdaterId } from './domain/packages';
|
package/src/protocol/agent.ts
CHANGED
|
@@ -33,7 +33,11 @@ import {
|
|
|
33
33
|
dockerStatSchema
|
|
34
34
|
} from '../domain/deviceDocker';
|
|
35
35
|
import { metricsBatchSchema, metricSnapshotSchema } from '../domain/metrics';
|
|
36
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
packageManagerIdSchema,
|
|
38
|
+
packageManagerSchema,
|
|
39
|
+
pendingCountSchema
|
|
40
|
+
} from '../domain/packages';
|
|
37
41
|
import {
|
|
38
42
|
authWindowSchema,
|
|
39
43
|
deviceReportSchema,
|
|
@@ -101,7 +105,7 @@ export const agentPowerActionSchema = z.enum([
|
|
|
101
105
|
]);
|
|
102
106
|
export type AgentPowerAction = z.infer<typeof agentPowerActionSchema>;
|
|
103
107
|
|
|
104
|
-
/** Agent's reply to `pkg.list`: the
|
|
108
|
+
/** Agent's first reply to `pkg.list`: the update tools present on the host, without counts. */
|
|
105
109
|
export const AGENT_PKG_LIST_RESULT = 'pkg.listResult' as const;
|
|
106
110
|
|
|
107
111
|
export const agentPkgListResultPayloadSchema = z.object({
|
|
@@ -109,6 +113,19 @@ export const agentPkgListResultPayloadSchema = z.object({
|
|
|
109
113
|
managers: z.array(packageManagerSchema)
|
|
110
114
|
});
|
|
111
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Then one per managed tool of that list, as each probe finishes: its pending
|
|
118
|
+
* count. A tool whose probe fails still gets its frame (`null`), so the
|
|
119
|
+
* screen never waits for a count that will not come.
|
|
120
|
+
*/
|
|
121
|
+
export const AGENT_PKG_COUNT = 'pkg.count' as const;
|
|
122
|
+
|
|
123
|
+
export const agentPkgCountPayloadSchema = z.object({
|
|
124
|
+
deviceId: z.uuid(),
|
|
125
|
+
manager: packageManagerIdSchema,
|
|
126
|
+
pendingCount: pendingCountSchema
|
|
127
|
+
});
|
|
128
|
+
|
|
112
129
|
/** Live line of an in-progress `pkg.upgrade`. */
|
|
113
130
|
export const AGENT_PKG_PROGRESS = 'pkg.progress' as const;
|
|
114
131
|
|
|
@@ -560,6 +577,10 @@ export const agentClientMessageSchema = z.discriminatedUnion('command', [
|
|
|
560
577
|
command: z.literal(AGENT_PKG_LIST_RESULT),
|
|
561
578
|
payload: agentPkgListResultPayloadSchema
|
|
562
579
|
}),
|
|
580
|
+
z.object({
|
|
581
|
+
command: z.literal(AGENT_PKG_COUNT),
|
|
582
|
+
payload: agentPkgCountPayloadSchema
|
|
583
|
+
}),
|
|
563
584
|
z.object({
|
|
564
585
|
command: z.literal(AGENT_PKG_PROGRESS),
|
|
565
586
|
payload: agentPkgProgressPayloadSchema
|
|
@@ -741,7 +762,7 @@ export const AGENT_SERVICE = 'agent.service' as const;
|
|
|
741
762
|
export const agentServicePayloadSchema = z.object({ action: agentServiceActionSchema });
|
|
742
763
|
export type AgentServicePayload = z.infer<typeof agentServicePayloadSchema>;
|
|
743
764
|
|
|
744
|
-
/** Ask the agent
|
|
765
|
+
/** Ask the agent for its update tools (`pkg.listResult`), then their counts (one `pkg.count` each). */
|
|
745
766
|
export const AGENT_PKG_LIST = 'pkg.list' as const;
|
|
746
767
|
|
|
747
768
|
/** Ask the agent to apply all updates of one manager, streaming `pkg.progress`. */
|
|
@@ -1385,8 +1406,9 @@ export const SIGNED_AGENT_COMMANDS: ReadonlySet<string> = new Set([
|
|
|
1385
1406
|
export const METRICS_PUSH_EVENT = 'metrics.push' as const;
|
|
1386
1407
|
export const DEVICE_PRESENCE_EVENT = 'device.presence' as const;
|
|
1387
1408
|
export const DEVICE_REPORT_EVENT = 'device.report' as const;
|
|
1388
|
-
/**
|
|
1409
|
+
/** Update tools present, then one pending count per managed tool (Appareils panel). */
|
|
1389
1410
|
export const PACKAGE_LIST_EVENT = 'package.list' as const;
|
|
1411
|
+
export const PACKAGE_COUNT_EVENT = 'package.count' as const;
|
|
1390
1412
|
/**
|
|
1391
1413
|
* Une mise à jour vient d'être acceptée pour ce gestionnaire. Émis par le
|
|
1392
1414
|
* serveur avant la première ligne de sortie de l'outil, pour que tous les
|
|
@@ -1435,6 +1457,7 @@ export const CLOUD_SYNC_CHUNK_EVENT = 'cloudSync.chunk' as const;
|
|
|
1435
1457
|
export const packageListPushSchema = agentPkgListResultPayloadSchema.extend({
|
|
1436
1458
|
running: z.array(packageManagerIdSchema).default([])
|
|
1437
1459
|
});
|
|
1460
|
+
export const packageCountPushSchema = agentPkgCountPayloadSchema;
|
|
1438
1461
|
|
|
1439
1462
|
export const packageStartedPushSchema = z.object({
|
|
1440
1463
|
deviceId: z.uuid(),
|
|
@@ -1486,6 +1509,7 @@ export type DeviceDockerProgressPush = z.infer<typeof deviceDockerProgressPushSc
|
|
|
1486
1509
|
export type DeviceDockerDonePush = z.infer<typeof deviceDockerDonePushSchema>;
|
|
1487
1510
|
|
|
1488
1511
|
export type PackageListPush = z.infer<typeof packageListPushSchema>;
|
|
1512
|
+
export type PackageCountPush = z.infer<typeof packageCountPushSchema>;
|
|
1489
1513
|
export type PackageStartedPush = z.infer<typeof packageStartedPushSchema>;
|
|
1490
1514
|
export type PackageProgressPush = z.infer<typeof packageProgressPushSchema>;
|
|
1491
1515
|
export type PackageDonePush = z.infer<typeof packageDonePushSchema>;
|
|
@@ -16,8 +16,7 @@ declare module 'deveye-sdk-client' {
|
|
|
16
16
|
DragEvent,
|
|
17
17
|
InputHTMLAttributes,
|
|
18
18
|
ReactNode,
|
|
19
|
-
RefObject
|
|
20
|
-
SelectHTMLAttributes
|
|
19
|
+
RefObject
|
|
21
20
|
} from 'react';
|
|
22
21
|
import type { z, ZodType } from 'zod';
|
|
23
22
|
import type {
|
|
@@ -53,7 +52,55 @@ declare module 'deveye-sdk-client' {
|
|
|
53
52
|
export const TextInput: ComponentType<
|
|
54
53
|
InputHTMLAttributes<HTMLInputElement> & { enableShowHideButton?: boolean; error?: string }
|
|
55
54
|
>;
|
|
56
|
-
export
|
|
55
|
+
export interface CopyButtonProps {
|
|
56
|
+
value: string;
|
|
57
|
+
/** What gets copied, for the tooltip and screen readers ("Copier la clé"). */
|
|
58
|
+
label?: string;
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Copies `value` to the clipboard and confirms through its icon for two seconds; a refused clipboard stays silent. */
|
|
62
|
+
export const CopyButton: ComponentType<CopyButtonProps>;
|
|
63
|
+
export interface LoadingVeilProps {
|
|
64
|
+
/** Read by screen readers, and shown under the spinner when given. */
|
|
65
|
+
label?: string;
|
|
66
|
+
/** `top` for a long scrolling area: the spinner stays in view. */
|
|
67
|
+
align?: 'center' | 'top';
|
|
68
|
+
/** Appears after a quarter of a second: a brief read never flickers. */
|
|
69
|
+
delayed?: boolean;
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The veil of a re-read: a layer over an area, the previous content legible
|
|
74
|
+
* underneath, taking no click and no scroll. Mount it as a SIBLING of the
|
|
75
|
+
* scrolling area inside a `position: relative` parent (inside an
|
|
76
|
+
* `overflow: auto` it would scroll away). Dim what it covers with
|
|
77
|
+
* `filter: opacity()`, never `opacity`.
|
|
78
|
+
*/
|
|
79
|
+
export const LoadingVeil: ComponentType<LoadingVeilProps>;
|
|
80
|
+
export interface LogOutputProps {
|
|
81
|
+
/** The raw log, ANSI sequences included: the component cleans it. */
|
|
82
|
+
text: string;
|
|
83
|
+
/** A read in progress: the veil, over whatever is already shown. */
|
|
84
|
+
busy?: boolean;
|
|
85
|
+
/** Search, count and copy above the lines. Default `true`. */
|
|
86
|
+
toolbar?: boolean;
|
|
87
|
+
/** What reads when the log is empty. */
|
|
88
|
+
emptyText?: string;
|
|
89
|
+
/** Stays at the bottom when text arrives and the reader was there. Default `true`. */
|
|
90
|
+
follow?: boolean;
|
|
91
|
+
/** Caps the body's height outside a flex column (a block inside a sheet). */
|
|
92
|
+
maxHeight?: number;
|
|
93
|
+
className?: string;
|
|
94
|
+
'aria-label'?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A readable raw log: the output of a provider or a tool, cleaned of ANSI
|
|
98
|
+
* codes and coloured by what each line says (step, error, warning,
|
|
99
|
+
* success), timestamps and durations set back. The toolbar filters lines
|
|
100
|
+
* and copies what is shown. Inside a flex column (a `Dialog tall`) it
|
|
101
|
+
* takes the remaining room.
|
|
102
|
+
*/
|
|
103
|
+
export const LogOutput: ComponentType<LogOutputProps>;
|
|
57
104
|
export const Checkbox: ComponentType<{
|
|
58
105
|
checked: boolean;
|
|
59
106
|
/** Receives the state AFTER the click — no event to unwrap. */
|
|
@@ -109,11 +156,18 @@ declare module 'deveye-sdk-client' {
|
|
|
109
156
|
group?: string;
|
|
110
157
|
disabled?: boolean;
|
|
111
158
|
}
|
|
159
|
+
/** A chip under the search field that keeps only the options passing `test`. */
|
|
160
|
+
export interface SearchSelectFilter<T extends string = string> {
|
|
161
|
+
value: string;
|
|
162
|
+
label: string;
|
|
163
|
+
test: (option: SearchSelectOption<T>) => boolean;
|
|
164
|
+
/** Chips sharing a key exclude each other: activating one releases the others. */
|
|
165
|
+
exclusive?: string;
|
|
166
|
+
}
|
|
112
167
|
/**
|
|
113
|
-
*
|
|
114
|
-
* included)
|
|
115
|
-
*
|
|
116
|
-
* `SelectInput` stays simpler. Safe inside a Dialog: the panel is portaled.
|
|
168
|
+
* The app's dropdown. The search field (accent- and case-insensitive, group
|
|
169
|
+
* names included) only appears from eight choices on, or on request; filter
|
|
170
|
+
* chips can narrow the list. Safe inside a Dialog: the panel is portaled.
|
|
117
171
|
*/
|
|
118
172
|
export function SearchSelect<T extends string>(props: {
|
|
119
173
|
value: T;
|
|
@@ -124,6 +178,14 @@ declare module 'deveye-sdk-client' {
|
|
|
124
178
|
placeholder?: string;
|
|
125
179
|
searchPlaceholder?: string;
|
|
126
180
|
emptyText?: string;
|
|
181
|
+
/** The search field: `'auto'` (default) shows it from eight choices on. */
|
|
182
|
+
searchable?: boolean | 'auto';
|
|
183
|
+
/** Chips under the search, AND-combined, reset when the panel closes. */
|
|
184
|
+
filters?: readonly SearchSelectFilter<T>[];
|
|
185
|
+
/** The trigger's id, for a label's `htmlFor`. */
|
|
186
|
+
id?: string;
|
|
187
|
+
/** The field the opening Dialog focuses first (`data-autofocus`). */
|
|
188
|
+
autoFocus?: boolean;
|
|
127
189
|
disabled?: boolean;
|
|
128
190
|
className?: string;
|
|
129
191
|
}): ReactNode;
|
|
@@ -222,15 +284,29 @@ declare module 'deveye-sdk-client' {
|
|
|
222
284
|
open: boolean;
|
|
223
285
|
onClose: () => void;
|
|
224
286
|
title?: string;
|
|
287
|
+
/** A small line above the title: where this dialog sits. */
|
|
288
|
+
kicker?: ReactNode;
|
|
225
289
|
description?: ReactNode;
|
|
226
290
|
children?: ReactNode;
|
|
227
291
|
footer?: ReactNode;
|
|
228
292
|
/** Extra action in the top-right corner, left of the close button. */
|
|
229
293
|
headerAction?: ReactNode;
|
|
230
294
|
width?: number;
|
|
295
|
+
/** When false, overlay click and Escape no longer close the dialog. Default true. */
|
|
296
|
+
dismissible?: boolean;
|
|
231
297
|
onSubmit?: () => void;
|
|
298
|
+
/** Move focus to the first field on open. Default true. */
|
|
299
|
+
autoFocus?: boolean;
|
|
300
|
+
/** Unsaved changes: closing first asks; requires `onSave`. */
|
|
301
|
+
dirty?: boolean;
|
|
302
|
+
onSave?: () => void;
|
|
303
|
+
/** A viewport-tall flex column: title and footer pinned, the body scrolls. */
|
|
304
|
+
tall?: boolean;
|
|
305
|
+
/** The height follows the content up to the viewport, then the body scrolls. */
|
|
232
306
|
fill?: boolean;
|
|
233
307
|
holdSecrecy?: boolean;
|
|
308
|
+
/** Without the close button (a progress dialog). Default true. */
|
|
309
|
+
closeButton?: boolean;
|
|
234
310
|
}>;
|
|
235
311
|
/** The "Annuler" button of a Dialog footer: closes through the guarded close. */
|
|
236
312
|
export const DialogCancelButton: ComponentType<
|