@deveye/types 0.25.3 → 0.25.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deveye/types",
3
- "version": "0.25.3",
3
+ "version": "0.25.5",
4
4
  "description": "Shared contracts (types + zod schemas) for DevEye apps",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -13,6 +13,7 @@ export const packageManagerIdSchema = z.enum([
13
13
  'flatpak',
14
14
  'snap',
15
15
  'zypper',
16
+ 'rpm-ostree',
16
17
  'brew',
17
18
  'softwareupdate',
18
19
  'winget',
@@ -24,10 +25,9 @@ export type PackageManagerId = z.infer<typeof packageManagerIdSchema>;
24
25
  /**
25
26
  * Update tooling the agent recognises on a machine but DevEye does not drive:
26
27
  * listed without a count, never upgraded, so a device's table says what else
27
- * keeps it up to date (an atomic image's rpm-ostree, firmware through fwupd…).
28
+ * keeps it up to date (a bootc image, firmware through fwupd…).
28
29
  */
29
30
  export const unmanagedUpdaterIdSchema = z.enum([
30
- 'rpm-ostree',
31
31
  'bootc',
32
32
  'fwupd',
33
33
  'nix',
@@ -15,6 +15,12 @@ export const SYNC_STORAGE_PATH_MAX = 1024;
15
15
  export const SYNC_CHUNK_MAX = 1_400_000;
16
16
  /** Nombre max d'entrées d'index par frame `sync.index`. */
17
17
  export const SYNC_INDEX_BATCH_MAX = 500;
18
+ /**
19
+ * Paths a `sync.scan` may ask the agent to restate (`paths`): the ones the
20
+ * server holds in error. Past this, it asks for none, and the fingerprint that
21
+ * follows forces the full walk.
22
+ */
23
+ export const SYNC_SCAN_PATHS_MAX = 2_000;
18
24
  /**
19
25
  * Blocks of an encrypted partial a resumed push can build on (1 MiB each). The
20
26
  * server keeps no more: their nonces must fit in one `sync.push` frame, and
@@ -106,11 +112,13 @@ export const cloudSyncProgressSchema = z.object({
106
112
  bytesTotal: z.number().int().nonnegative(),
107
113
  filesDone: z.number().int().nonnegative(),
108
114
  bytesDone: z.number().int().nonnegative(),
109
- /** Fichier en cours de transfert, pour la ligne discrète de l'UI. */
115
+ /** Fichier en cours de transfert, pour la ligne discrète de l'UI : le dernier commencé quand plusieurs passent à la fois. */
110
116
  currentPath: z.string().max(SYNC_REL_PATH_MAX).nullable(),
111
- /** Avancement dans le fichier en cours, pour qu'un gros fichier ne fige pas la barre. */
117
+ /** Avancement dans ce fichier, pour qu'un gros fichier ne fige pas la barre. */
112
118
  currentBytes: z.number().int().nonnegative(),
113
119
  currentTotal: z.number().int().nonnegative(),
120
+ /** Fichiers en transfert en même temps, `currentPath` compris. */
121
+ inFlight: z.number().int().nonnegative(),
114
122
  direction: syncDirectionSchema.nullable(),
115
123
  error: z.string().max(500).nullable()
116
124
  });
@@ -122,6 +130,12 @@ export const cloudSyncShareStateSchema = z.object({
122
130
  /** Précision facultative (ex. nom de l'appareil hors ligne ou en erreur). */
123
131
  detail: z.string().max(200).nullable(),
124
132
  /** Volumétrie fraîche : l'en-tête de l'UI se met à jour sans re-fetch. */
125
- stats: cloudSyncShareStatsSchema
133
+ stats: cloudSyncShareStatsSchema,
134
+ /**
135
+ * The open problems already seen before the session in progress (all of
136
+ * them outside one): what the card shows during a synchronization, which
137
+ * hides only what the current pass may still settle.
138
+ */
139
+ settledProblems: z.number().int().nonnegative()
126
140
  });
127
141
  export type CloudSyncShareState = z.infer<typeof cloudSyncShareStateSchema>;
@@ -2,11 +2,13 @@ import { z } from 'zod';
2
2
 
3
3
  /**
4
4
  * La page « Tests et débogage », réservée à l'administrateur du site : essais
5
- * de bout en bout, mesures, testeur de mails et suivi d'usage de DevEye.
5
+ * de bout en bout, mesures, montée en charge, testeur de mails et suivi
6
+ * d'usage de DevEye.
6
7
  *
7
8
  * Toutes ces commandes déclarent `admin: true` côté serveur. Un essai dure
8
- * plus longtemps qu'une commande : `debug.e2eStart` et `debug.benchStart`
9
- * rendent aussitôt un identifiant, que la page suit par `debug.runGet`.
9
+ * plus longtemps qu'une commande : `debug.e2eStart`, `debug.benchStart` et
10
+ * `debug.loadStart` rendent aussitôt un identifiant, que la page suit par
11
+ * `debug.runGet`.
10
12
  */
11
13
 
12
14
  const authorSchema = z.object({ id: z.number().int().positive(), username: z.string() });
@@ -20,7 +22,7 @@ export const debugInstanceSchema = z.object({
20
22
  startedAt: z.number().int().nonnegative()
21
23
  });
22
24
 
23
- export const debugRunKindSchema = z.enum(['e2e', 'bench']);
25
+ export const debugRunKindSchema = z.enum(['e2e', 'bench', 'load']);
24
26
  export const debugRunStatusSchema = z.enum(['running', 'passed', 'failed', 'aborted']);
25
27
 
26
28
  /** L'état d'une étape ou d'un scénario ; `pending` tant que son tour n'est pas venu. */
@@ -90,6 +92,81 @@ export const debugBenchReportSchema = z.object({
90
92
  context: debugBenchContextSchema.nullable()
91
93
  });
92
94
 
95
+ export const debugLoadPhaseSchema = z.enum(['prepare', 'ramp', 'hold', 'cleanup', 'done']);
96
+
97
+ /** Le temps passé par une fonctionnalité : commandes et tâches de fond, attente de la base comprise. */
98
+ const featureTimeSchema = z.object({
99
+ calls: z.number().int().nonnegative(),
100
+ /** Millisecondes écoulées, pas du CPU. */
101
+ ms: z.number().nonnegative()
102
+ });
103
+
104
+ /** Un seau de temps de la montée en charge. Durées en millisecondes. */
105
+ export const debugLoadSampleSchema = z.object({
106
+ /** Secondes depuis le début de la montée, à la fin du seau. */
107
+ t: z.number().nonnegative(),
108
+ /** Utilisateurs simulés connectés à la fin du seau. */
109
+ users: z.number().int().nonnegative(),
110
+ /** Toutes les sockets du serveur, vrais navigateurs compris. */
111
+ sockets: z.number().int().nonnegative(),
112
+ commands: z.number().int().nonnegative(),
113
+ /** Refus du serveur (droit, quota, validation) : il a répondu. */
114
+ refused: z.number().int().nonnegative(),
115
+ /** Échecs internes, délais dépassés, sockets perdues. */
116
+ errors: z.number().int().nonnegative(),
117
+ p50: z.number().nonnegative().nullable(),
118
+ p95: z.number().nonnegative().nullable(),
119
+ max: z.number().nonnegative().nullable(),
120
+ /** Utilisateurs arrivés pendant le seau. */
121
+ arrivals: z.number().int().nonnegative(),
122
+ cpuPct: z.number(),
123
+ loopP99: z.number(),
124
+ rssMb: z.number(),
125
+ /** Par clé de fonctionnalité (voir `features` du rapport), toutes sources confondues. */
126
+ features: z.record(z.string(), featureTimeSchema)
127
+ });
128
+
129
+ export const debugLoadFeatureSchema = featureTimeSchema.extend({
130
+ key: z.string(),
131
+ label: z.string()
132
+ });
133
+
134
+ /** Le moment d'un seuil : secondes depuis le début, et utilisateurs connectés alors. */
135
+ const loadMarkSchema = z.object({
136
+ t: z.number().nonnegative(),
137
+ users: z.number().int().nonnegative()
138
+ });
139
+
140
+ export const debugLoadReportSchema = z.object({
141
+ kind: z.literal('load'),
142
+ settings: z.object({
143
+ users: z.number().int().positive(),
144
+ durationMin: z.number().int().positive()
145
+ }),
146
+ phase: debugLoadPhaseSchema,
147
+ bucketS: z.number().int().positive(),
148
+ /** Les utilisateurs écrivent aussi (des notes) ; `false` sans le module Notes. */
149
+ writes: z.boolean(),
150
+ samples: z.array(debugLoadSampleSchema),
151
+ /** Les totaux de l'essai, du plus occupé au moins occupé. */
152
+ features: z.array(debugLoadFeatureSchema),
153
+ /** L'arrivée d'un utilisateur : connexion, session, socket et accueil. */
154
+ arrivals: z.object({
155
+ n: z.number().int().nonnegative(),
156
+ failed: z.number().int().nonnegative(),
157
+ p50: z.number().nonnegative().nullable(),
158
+ p95: z.number().nonnegative().nullable()
159
+ }),
160
+ /** Le p95 des premiers seaux, à peu d'utilisateurs : la référence des seuils. */
161
+ baselineP95: z.number().nonnegative().nullable(),
162
+ /** Le p95 a nettement dépassé la référence, deux seaux de suite. */
163
+ degradedAt: loadMarkSchema.nullable(),
164
+ /** Le garde-fou a arrêté la montée : le serveur ne suivait plus. */
165
+ saturatedAt: loadMarkSchema.extend({ reason: z.string() }).nullable(),
166
+ /** Comptes de test encore présents après le ménage final ; `null` tant qu'il n'a pas eu lieu. */
167
+ residueAfter: z.number().int().nonnegative().nullable()
168
+ });
169
+
93
170
  export const debugRunSchema = z.object({
94
171
  id: z.number().int().positive(),
95
172
  status: debugRunStatusSchema,
@@ -97,7 +174,11 @@ export const debugRunSchema = z.object({
97
174
  startedAt: z.number().int().nonnegative(),
98
175
  finishedAt: z.number().int().nonnegative().nullable(),
99
176
  launchedBy: authorSchema.nullable(),
100
- report: z.discriminatedUnion('kind', [debugE2eReportSchema, debugBenchReportSchema])
177
+ report: z.discriminatedUnion('kind', [
178
+ debugE2eReportSchema,
179
+ debugBenchReportSchema,
180
+ debugLoadReportSchema
181
+ ])
101
182
  });
102
183
 
103
184
  export type DebugE2eStep = z.infer<typeof debugE2eStepSchema>;
@@ -106,6 +187,10 @@ export type DebugE2eReport = z.infer<typeof debugE2eReportSchema>;
106
187
  export type DebugProbeResult = z.infer<typeof debugProbeResultSchema>;
107
188
  export type DebugBenchContext = z.infer<typeof debugBenchContextSchema>;
108
189
  export type DebugBenchReport = z.infer<typeof debugBenchReportSchema>;
190
+ export type DebugLoadSample = z.infer<typeof debugLoadSampleSchema>;
191
+ export type DebugLoadFeature = z.infer<typeof debugLoadFeatureSchema>;
192
+ export type DebugLoadReport = z.infer<typeof debugLoadReportSchema>;
193
+ export type DebugLoadPhase = z.infer<typeof debugLoadPhaseSchema>;
109
194
  export type DebugRun = z.infer<typeof debugRunSchema>;
110
195
  export type DebugRunKind = z.infer<typeof debugRunKindSchema>;
111
196
  export type DebugBenchProfile = z.infer<typeof debugBenchProfileSchema>;
@@ -213,6 +298,19 @@ export const debugPing = {
213
298
  output: z.object({ at: z.number().int().nonnegative() })
214
299
  };
215
300
 
301
+ /**
302
+ * Ajoute des utilisateurs simulés, un compte jetable chacun, jusqu'à `users`
303
+ * sur `durationMin` minutes, puis les supprime avec tout ce qu'ils ont créé.
304
+ */
305
+ export const debugLoadStart = {
306
+ command: 'debug.loadStart' as const,
307
+ input: z.object({
308
+ users: z.number().int().min(10).max(500),
309
+ durationMin: z.number().int().min(1).max(30)
310
+ }),
311
+ output: z.object({ runId: z.number().int().positive() })
312
+ };
313
+
216
314
  export const debugMailSenderKindSchema = z.enum(['server', 'workspace']);
217
315
 
218
316
  export const debugMailSampleSchema = z.object({
@@ -391,6 +489,7 @@ export const debugCommands = [
391
489
  debugBenchCatalog,
392
490
  debugBenchStart,
393
491
  debugPing,
492
+ debugLoadStart,
394
493
  debugMailCatalog,
395
494
  debugMailPreview,
396
495
  debugMailSend,
package/src/index.ts CHANGED
@@ -81,6 +81,7 @@ export {
81
81
  AGENT_SYNC_CONFIG,
82
82
  AGENT_SYNC_DELETE,
83
83
  AGENT_SYNC_MOVE,
84
+ AGENT_SYNC_RENAME,
84
85
  AGENT_SYNC_INDEX,
85
86
  AGENT_SYNC_OP_RESULT,
86
87
  AGENT_SYNC_DEVICE_KEY,
@@ -160,6 +161,7 @@ export {
160
161
  agentSyncConfigPayloadSchema,
161
162
  agentSyncDeletePayloadSchema,
162
163
  agentSyncMovePayloadSchema,
164
+ agentSyncRenamePayloadSchema,
163
165
  agentSyncIndexPayloadSchema,
164
166
  agentSyncOpResultPayloadSchema,
165
167
  agentSyncDeviceKeyPayloadSchema,
@@ -282,6 +284,7 @@ export type {
282
284
  AgentSyncDeletePayload,
283
285
  AgentSyncIndexPayload,
284
286
  AgentSyncMovePayload,
287
+ AgentSyncRenamePayload,
285
288
  AgentSyncOpResultPayload,
286
289
  AgentSyncDeviceKeyPayload,
287
290
  AgentSyncPushPayload,
@@ -454,6 +457,7 @@ export {
454
457
  SYNC_RESUME_MAX_BLOCKS,
455
458
  SYNC_RESUME_NONCES_MAX,
456
459
  SYNC_REL_PATH_MAX,
460
+ SYNC_SCAN_PATHS_MAX,
457
461
  SYNC_STORAGE_PATH_MAX,
458
462
  syncDirectionSchema,
459
463
  syncEntryKindSchema,
@@ -987,6 +991,11 @@ export {
987
991
  debugE2eStepSchema,
988
992
  debugE2eSweep,
989
993
  debugInstanceSchema,
994
+ debugLoadFeatureSchema,
995
+ debugLoadPhaseSchema,
996
+ debugLoadReportSchema,
997
+ debugLoadSampleSchema,
998
+ debugLoadStart,
990
999
  debugMailCatalog,
991
1000
  debugMailPreview,
992
1001
  debugMailPreviewSchema,
@@ -1021,6 +1030,10 @@ export type {
1021
1030
  DebugE2eScenario,
1022
1031
  DebugE2eScenarioReport,
1023
1032
  DebugE2eStep,
1033
+ DebugLoadFeature,
1034
+ DebugLoadPhase,
1035
+ DebugLoadReport,
1036
+ DebugLoadSample,
1024
1037
  DebugMailPreview,
1025
1038
  DebugMailSample,
1026
1039
  DebugProbe,
@@ -7,6 +7,7 @@ import {
7
7
  SYNC_RESUME_NONCES_MAX,
8
8
  SYNC_INDEX_BATCH_MAX,
9
9
  SYNC_REL_PATH_MAX,
10
+ SYNC_SCAN_PATHS_MAX,
10
11
  SYNC_STORAGE_PATH_MAX,
11
12
  syncEntryKindSchema,
12
13
  syncSkipReasonSchema,
@@ -551,13 +552,22 @@ export type AgentSyncBusyPayload = z.infer<typeof agentSyncBusyPayloadSchema>;
551
552
  * Issue d'une op locale : install atomique (`apply`), création de dossier vide
552
553
  * (`applyDir`), copie locale d'un contenu déjà présent (`applyLocal`), amorce
553
554
  * de download avec offset de reprise (`applyReady`), corbeille (`delete`),
554
- * upload (`push`).
555
+ * upload (`push`), renommage d'un nom non portable (`rename`).
555
556
  */
556
557
  export const AGENT_SYNC_OP_RESULT = 'sync.opResult' as const;
557
558
  export const agentSyncOpResultPayloadSchema = z.object({
558
559
  deviceId: z.uuid(),
559
560
  opId: syncOpId,
560
- op: z.enum(['apply', 'applyDir', 'applyLocal', 'applyReady', 'delete', 'move', 'push']),
561
+ op: z.enum([
562
+ 'apply',
563
+ 'applyDir',
564
+ 'applyLocal',
565
+ 'applyReady',
566
+ 'delete',
567
+ 'move',
568
+ 'push',
569
+ 'rename'
570
+ ]),
561
571
  ok: z.boolean(),
562
572
  /** `applyReady` seulement : octets de clair déjà détenus pour ce hash. */
563
573
  resumeFrom: z.number().int().nonnegative().optional(),
@@ -1093,7 +1103,15 @@ export const syncShareAssignmentSchema = z.object({
1093
1103
  encryption: z
1094
1104
  .object({ wrappedKey: z.string().max(256).nullable() })
1095
1105
  .nullable()
1096
- .default(null)
1106
+ .default(null),
1107
+ /**
1108
+ * The server may write into the share's sensitive folders: `.ssh`, the
1109
+ * login and service startup folders, a shell startup file in a home
1110
+ * folder. Off, the agent refuses every such write (what the share holds
1111
+ * there still goes up). On, a machine whose local policy refuses the
1112
+ * terminal still refuses them: such a write would give one.
1113
+ */
1114
+ sensitiveWrites: z.boolean().default(false)
1097
1115
  });
1098
1116
  export type SyncShareAssignment = z.infer<typeof syncShareAssignmentSchema>;
1099
1117
 
@@ -1116,11 +1134,20 @@ export const agentSyncScanPayloadSchema = z.object({
1116
1134
  */
1117
1135
  mode: syncScanModeSchema.default('full'),
1118
1136
  /**
1119
- * L'empreinte de la baseline que le serveur tient pour cet appareil. Un
1120
- * parcours complet qui la retrouve répond sans ses entrées (`delta: true`,
1121
- * rien de changé) : le serveur n'a alors rien à recharger.
1137
+ * The fingerprint of the baseline the server holds for this device. A full
1138
+ * walk that finds it again replies without its entries (`delta: true`,
1139
+ * nothing changed): the server then has nothing to reload. With `paths`,
1140
+ * it leaves their lines out, and the walk compares it to the fingerprint
1141
+ * of its index outside those paths.
1142
+ */
1143
+ expected: syncIndexFingerprintSchema.optional(),
1144
+ /**
1145
+ * Paths whose present state the reply must give even when unchanged for
1146
+ * the agent: an entry, `gone`, or a `skipped` line. The server sends the
1147
+ * ones it holds in error, where its baseline may not describe the device.
1148
+ * No fast reply while the list is not empty.
1122
1149
  */
1123
- expected: syncIndexFingerprintSchema.optional()
1150
+ paths: z.array(syncRelPath).max(SYNC_SCAN_PATHS_MAX).optional()
1124
1151
  });
1125
1152
  export type AgentSyncScanPayload = z.infer<typeof agentSyncScanPayloadSchema>;
1126
1153
 
@@ -1305,6 +1332,22 @@ export const agentSyncDeletePayloadSchema = z.object({
1305
1332
  });
1306
1333
  export type AgentSyncDeletePayload = z.infer<typeof agentSyncDeletePayloadSchema>;
1307
1334
 
1335
+ /**
1336
+ * Renames, on the device, a path whose name keeps it out of the share (one
1337
+ * Windows cannot hold): the agent renames it in place, in the same folder,
1338
+ * and replies `sync.opResult` (`op: 'rename'`); the next scan sees it under
1339
+ * its new name. `fromRelPath` is, by definition, not portable: the agent only
1340
+ * requires it to stay inside the share. `relPath` must be portable.
1341
+ */
1342
+ export const AGENT_SYNC_RENAME = 'sync.rename' as const;
1343
+ export const agentSyncRenamePayloadSchema = z.object({
1344
+ opId: syncOpId,
1345
+ shareId: z.number().int().positive(),
1346
+ fromRelPath: syncRelPath,
1347
+ relPath: syncRelPath
1348
+ });
1349
+ export type AgentSyncRenamePayload = z.infer<typeof agentSyncRenamePayloadSchema>;
1350
+
1308
1351
  /** Collection config the server pushes to an agent (on connect + on change). */
1309
1352
  export const agentConfigPayloadSchema = z.object({
1310
1353
  /**
@@ -1538,6 +1581,7 @@ export const SIGNED_AGENT_COMMANDS: ReadonlySet<string> = new Set([
1538
1581
  AGENT_SYNC_APPLY_LOCAL,
1539
1582
  AGENT_SYNC_MOVE,
1540
1583
  AGENT_SYNC_DELETE,
1584
+ AGENT_SYNC_RENAME,
1541
1585
  AGENT_SERVICE,
1542
1586
  AGENT_POWER,
1543
1587
  AGENT_DESTROY,
@@ -105,6 +105,12 @@ declare module 'deveye-sdk-client' {
105
105
  }
106
106
  /** Copies `value` to the clipboard and confirms through its icon for two seconds; a refused clipboard stays silent. */
107
107
  export const CopyButton: ComponentType<CopyButtonProps>;
108
+ /**
109
+ * A block that only makes sense in one state (rows under the switch that
110
+ * commands them, an action bar while a selection exists): it unfolds when
111
+ * `open` turns true and folds back when it turns false, instead of popping.
112
+ */
113
+ export const Reveal: ComponentType<{ open: boolean; children: ReactNode }>;
108
114
  export interface LoadingVeilProps {
109
115
  /** Read by screen readers, and shown under the spinner when given. */
110
116
  label?: string;
package/src/sdk/server.ts CHANGED
@@ -32,6 +32,7 @@ import type {
32
32
  AgentSyncDeletePayload,
33
33
  AgentSyncIndexPayload,
34
34
  AgentSyncMovePayload,
35
+ AgentSyncRenamePayload,
35
36
  AgentSyncOpResultPayload,
36
37
  AgentSyncPushPayload,
37
38
  AgentSyncPushAckPayload,
@@ -728,6 +729,7 @@ export interface AgentsFacade {
728
729
  requestSyncApplyLocal(deviceId: string, payload: AgentSyncApplyLocalPayload): boolean;
729
730
  requestSyncMove(deviceId: string, payload: AgentSyncMovePayload): boolean;
730
731
  requestSyncDelete(deviceId: string, payload: AgentSyncDeletePayload): boolean;
732
+ requestSyncRename(deviceId: string, payload: AgentSyncRenamePayload): boolean;
731
733
  /** Fan-out to the browsers subscribed to the payload's share. */
732
734
  publishSyncProgress(payload: CloudSyncProgressPush): void;
733
735
  publishSyncState(payload: CloudSyncStatePush): void;
@@ -318,6 +318,7 @@ function recordingAgents(recorded: RecordedCalls, docker: TestAgents = {}): DevE
318
318
  requestSyncApplyLocal: req('requestSyncApplyLocal'),
319
319
  requestSyncMove: req('requestSyncMove'),
320
320
  requestSyncDelete: req('requestSyncDelete'),
321
+ requestSyncRename: req('requestSyncRename'),
321
322
  publishSyncProgress: () => undefined,
322
323
  publishSyncState: () => undefined,
323
324
  requestDestroy: req('requestDestroy'),