@deveye/types 0.21.8 → 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/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>;
|