Open History to see the last commit
1import * as Schema from "effect/Schema";
2
3import { NonNegativeInt, PositiveInt, TrimmedNonEmptyString } from "./baseSchemas.ts";
4import { HostPowerSnapshot } from "./background.ts";
5import { DesktopUpdateChannelSchema, DesktopUpdateStateSchema } from "./ipc.ts";
6
7export const RESOURCE_MONITOR_PROTOCOL_VERSION = 3 as const;
8
9export const HostResourcesSnapshot = Schema.Struct({
10 sampledAt: NonNegativeInt,
11 cpuUtilization: Schema.NullOr(Schema.Number.check(Schema.isBetween({ minimum: 0, maximum: 1 }))),
12 cpuCount: NonNegativeInt,
13 availableMemoryBytes: NonNegativeInt,
14 totalMemoryBytes: NonNegativeInt,
15});
16export type HostResourcesSnapshot = typeof HostResourcesSnapshot.Type;
17
18export const ResourceTelemetryIoSemantics = Schema.Literals([
19 "storage",
20 "logical",
21 "all-io",
22 "unavailable",
23]);
24export type ResourceTelemetryIoSemantics = typeof ResourceTelemetryIoSemantics.Type;
25
26export const ResourceTelemetryProcessCategory = Schema.Literals([
27 "server",
28 "server-child",
29 "provider-root",
30 "terminal-root",
31 "electron-main",
32 "electron-renderer",
33 "electron-gpu",
34 "electron-utility",
35 "resource-monitor",
36 "unknown-t3",
37]);
38export type ResourceTelemetryProcessCategory = typeof ResourceTelemetryProcessCategory.Type;
39
40export const ResourceTelemetrySourceStatus = Schema.Literals([
41 "starting",
42 "healthy",
43 "degraded",
44 "unavailable",
45 "stopped",
46]);
47export type ResourceTelemetrySourceStatus = typeof ResourceTelemetrySourceStatus.Type;
48
49export const ResourceTelemetryProcessIdentity = Schema.Struct({
50 pid: PositiveInt,
51 startTimeMs: NonNegativeInt,
52});
53export type ResourceTelemetryProcessIdentity = typeof ResourceTelemetryProcessIdentity.Type;
54
55export const ResourceMonitorExternalProcess = Schema.Struct({
56 pid: PositiveInt,
57 startTimeMs: Schema.optionalKey(NonNegativeInt),
58});
59export type ResourceMonitorExternalProcess = typeof ResourceMonitorExternalProcess.Type;
60
61export const ResourceMonitorCapabilities = Schema.Struct({
62 cumulativeCpuTime: Schema.Boolean,
63 currentCpuPercent: Schema.Boolean,
64 residentMemory: Schema.Boolean,
65 virtualMemory: Schema.Boolean,
66 ioBytes: Schema.Boolean,
67 processStartTime: Schema.Boolean,
68 processTree: Schema.Boolean,
69});
70export type ResourceMonitorCapabilities = typeof ResourceMonitorCapabilities.Type;
71
72export const ResourceMonitorProcessSample = Schema.Struct({
73 pid: PositiveInt,
74 ppid: NonNegativeInt,
75 startTimeMs: NonNegativeInt,
76 runTimeMs: NonNegativeInt,
77 name: Schema.String,
78 command: Schema.String,
79 status: Schema.String,
80 cpuPercent: Schema.Number,
81 cpuTimeMs: NonNegativeInt,
82 residentBytes: NonNegativeInt,
83 virtualBytes: NonNegativeInt,
84 ioReadBytes: NonNegativeInt,
85 ioWriteBytes: NonNegativeInt,
86 ioSemantics: Schema.Literals(["storage", "all-io"]),
87});
88export type ResourceMonitorProcessSample = typeof ResourceMonitorProcessSample.Type;
89
90export const ResourceMonitorConfigureCommand = Schema.Struct({
91 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
92 type: Schema.Literal("configure"),
93 rootPid: PositiveInt,
94 sampleIntervalMs: NonNegativeInt,
95 externalProcesses: Schema.Array(ResourceMonitorExternalProcess),
96});
97export type ResourceMonitorConfigureCommand = typeof ResourceMonitorConfigureCommand.Type;
98
99export const ResourceMonitorSetExternalProcessesCommand = Schema.Struct({
100 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
101 type: Schema.Literal("setExternalProcesses"),
102 processes: Schema.Array(ResourceMonitorExternalProcess),
103});
104export type ResourceMonitorSetExternalProcessesCommand =
105 typeof ResourceMonitorSetExternalProcessesCommand.Type;
106
107export const ResourceMonitorSampleNowCommand = Schema.Struct({
108 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
109 type: Schema.Literal("sampleNow"),
110 requestId: TrimmedNonEmptyString,
111});
112export type ResourceMonitorSampleNowCommand = typeof ResourceMonitorSampleNowCommand.Type;
113
114export const ResourceMonitorProcessTableCommand = Schema.Struct({
115 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
116 type: Schema.Literal("processTable"),
117 requestId: TrimmedNonEmptyString,
118});
119export type ResourceMonitorProcessTableCommand = typeof ResourceMonitorProcessTableCommand.Type;
120
121export const ResourceMonitorSetSampleIntervalCommand = Schema.Struct({
122 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
123 type: Schema.Literal("setSampleInterval"),
124 sampleIntervalMs: NonNegativeInt,
125});
126export type ResourceMonitorSetSampleIntervalCommand =
127 typeof ResourceMonitorSetSampleIntervalCommand.Type;
128
129export const ResourceMonitorSetStreamingCommand = Schema.Struct({
130 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
131 type: Schema.Literal("setStreaming"),
132 enabled: Schema.Boolean,
133});
134export type ResourceMonitorSetStreamingCommand = typeof ResourceMonitorSetStreamingCommand.Type;
135
136export const ResourceMonitorReadHistoryCommand = Schema.Struct({
137 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
138 type: Schema.Literal("readHistory"),
139 requestId: TrimmedNonEmptyString,
140 windowMs: NonNegativeInt,
141});
142export type ResourceMonitorReadHistoryCommand = typeof ResourceMonitorReadHistoryCommand.Type;
143
144export const ResourceMonitorShutdownCommand = Schema.Struct({
145 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
146 type: Schema.Literal("shutdown"),
147});
148export type ResourceMonitorShutdownCommand = typeof ResourceMonitorShutdownCommand.Type;
149
150export const ResourceMonitorCommand = Schema.Union([
151 ResourceMonitorConfigureCommand,
152 ResourceMonitorSetExternalProcessesCommand,
153 ResourceMonitorSetSampleIntervalCommand,
154 ResourceMonitorSetStreamingCommand,
155 ResourceMonitorSampleNowCommand,
156 ResourceMonitorProcessTableCommand,
157 ResourceMonitorReadHistoryCommand,
158 ResourceMonitorShutdownCommand,
159]);
160export type ResourceMonitorCommand = typeof ResourceMonitorCommand.Type;
161
162export const ResourceMonitorHelloEvent = Schema.Struct({
163 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
164 type: Schema.Literal("hello"),
165 sidecarVersion: TrimmedNonEmptyString,
166 sidecarPid: PositiveInt,
167 platform: TrimmedNonEmptyString,
168 arch: TrimmedNonEmptyString,
169 capabilities: ResourceMonitorCapabilities,
170});
171export type ResourceMonitorHelloEvent = typeof ResourceMonitorHelloEvent.Type;
172
173export const ResourceMonitorSnapshotEvent = Schema.Struct({
174 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
175 type: Schema.Literal("snapshot"),
176 sequence: NonNegativeInt,
177 sampledAtUnixMs: NonNegativeInt,
178 collectionDurationMicros: NonNegativeInt,
179 scannedProcessCount: NonNegativeInt,
180 retainedProcessCount: NonNegativeInt,
181 inaccessibleProcessCount: NonNegativeInt,
182 requestId: Schema.optionalKey(TrimmedNonEmptyString),
183 externalProcesses: Schema.optionalKey(Schema.Array(ResourceMonitorExternalProcess)),
184 processes: Schema.Array(ResourceMonitorProcessSample),
185});
186export type ResourceMonitorSnapshotEvent = typeof ResourceMonitorSnapshotEvent.Type;
187
188export const ResourceMonitorProcessTableEntry = Schema.Struct({
189 pid: PositiveInt,
190 ppid: NonNegativeInt,
191 name: Schema.String,
192});
193export type ResourceMonitorProcessTableEntry = typeof ResourceMonitorProcessTableEntry.Type;
194
195export const ResourceMonitorProcessTableEvent = Schema.Struct({
196 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
197 type: Schema.Literal("processTable"),
198 requestId: TrimmedNonEmptyString,
199 processes: Schema.Array(ResourceMonitorProcessTableEntry),
200});
201export type ResourceMonitorProcessTableEvent = typeof ResourceMonitorProcessTableEvent.Type;
202
203export const ResourceMonitorHistoryChunkEvent = Schema.Struct({
204 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
205 type: Schema.Literal("historyChunk"),
206 requestId: TrimmedNonEmptyString,
207 done: Schema.Boolean,
208 snapshots: Schema.Array(ResourceMonitorSnapshotEvent),
209});
210export type ResourceMonitorHistoryChunkEvent = typeof ResourceMonitorHistoryChunkEvent.Type;
211
212export const ResourceMonitorErrorEvent = Schema.Struct({
213 version: Schema.Literal(RESOURCE_MONITOR_PROTOCOL_VERSION),
214 type: Schema.Literal("error"),
215 code: TrimmedNonEmptyString,
216 message: TrimmedNonEmptyString,
217 recoverable: Schema.Boolean,
218});
219export type ResourceMonitorErrorEvent = typeof ResourceMonitorErrorEvent.Type;
220
221export const ResourceMonitorEvent = Schema.Union([
222 ResourceMonitorHelloEvent,
223 ResourceMonitorSnapshotEvent,
224 ResourceMonitorProcessTableEvent,
225 ResourceMonitorHistoryChunkEvent,
226 ResourceMonitorErrorEvent,
227]);
228export type ResourceMonitorEvent = typeof ResourceMonitorEvent.Type;
229
230export const DesktopElectronProcessType = Schema.Literals([
231 "Browser",
232 "Tab",
233 "Utility",
234 "Zygote",
235 "Sandbox helper",
236 "GPU",
237 "Pepper Plugin",
238 "Pepper Plugin Broker",
239 "Unknown",
240]);
241export type DesktopElectronProcessType = typeof DesktopElectronProcessType.Type;
242
243export const DesktopElectronProcessMetric = Schema.Struct({
244 pid: PositiveInt,
245 creationTimeMs: NonNegativeInt,
246 type: DesktopElectronProcessType,
247 name: Schema.optionalKey(Schema.String),
248 serviceName: Schema.optionalKey(Schema.String),
249 cpuPercent: Schema.Number,
250 cumulativeCpuSeconds: Schema.optionalKey(Schema.Number),
251 idleWakeupsPerSecond: Schema.Number,
252 workingSetBytes: NonNegativeInt,
253 peakWorkingSetBytes: NonNegativeInt,
254});
255export type DesktopElectronProcessMetric = typeof DesktopElectronProcessMetric.Type;
256
257const DesktopHostPowerSnapshot = Schema.Struct({
258 ...HostPowerSnapshot.fields,
259 updatedAt: Schema.DateTimeUtcFromString,
260});
261
262export const DesktopHostTelemetrySnapshot = Schema.Struct({
263 version: Schema.Literal(1),
264 type: Schema.Literal("desktopTelemetry"),
265 sequence: NonNegativeInt,
266 sampledAtUnixMs: NonNegativeInt,
267 electronPid: PositiveInt,
268 power: DesktopHostPowerSnapshot,
269 speedLimitPercent: Schema.OptionFromNullOr(Schema.Number),
270 electronProcesses: Schema.Array(DesktopElectronProcessMetric),
271});
272export type DesktopHostTelemetrySnapshot = typeof DesktopHostTelemetrySnapshot.Type;
273
274export const DesktopHostTelemetryHello = Schema.Struct({
275 version: Schema.Literal(1),
276 type: Schema.Literal("desktopTelemetryHello"),
277 electronPid: PositiveInt,
278});
279export type DesktopHostTelemetryHello = typeof DesktopHostTelemetryHello.Type;
280
281export const DesktopUpdateRemoteOutcome = Schema.Literals([
282 "ready-to-install",
283 "up-to-date",
284 "failed",
285]);
286export type DesktopUpdateRemoteOutcome = typeof DesktopUpdateRemoteOutcome.Type;
287
288export const DesktopUpdateStatusReport = Schema.Struct({
289 version: Schema.Literal(1),
290 type: Schema.Literal("desktopUpdateStatus"),
291 requestId: Schema.optionalKey(TrimmedNonEmptyString),
292 outcome: Schema.optionalKey(DesktopUpdateRemoteOutcome),
293 reason: Schema.optionalKey(TrimmedNonEmptyString),
294 state: DesktopUpdateStateSchema,
295});
296export type DesktopUpdateStatusReport = typeof DesktopUpdateStatusReport.Type;
297
298export const ShellEnvironmentPatch = Schema.Struct({
299 PATH: Schema.optionalKey(Schema.NullOr(Schema.String)),
300 DBUS_SESSION_BUS_ADDRESS: Schema.optionalKey(Schema.NullOr(Schema.String)),
301 DISPLAY: Schema.optionalKey(Schema.NullOr(Schema.String)),
302 LANG: Schema.optionalKey(Schema.NullOr(Schema.String)),
303 LC_ALL: Schema.optionalKey(Schema.NullOr(Schema.String)),
304 LC_CTYPE: Schema.optionalKey(Schema.NullOr(Schema.String)),
305 SSH_AUTH_SOCK: Schema.optionalKey(Schema.NullOr(Schema.String)),
306 HOMEBREW_PREFIX: Schema.optionalKey(Schema.NullOr(Schema.String)),
307 HOMEBREW_CELLAR: Schema.optionalKey(Schema.NullOr(Schema.String)),
308 HOMEBREW_REPOSITORY: Schema.optionalKey(Schema.NullOr(Schema.String)),
309 XDG_CONFIG_HOME: Schema.optionalKey(Schema.NullOr(Schema.String)),
310 XDG_CURRENT_DESKTOP: Schema.optionalKey(Schema.NullOr(Schema.String)),
311 XDG_DATA_HOME: Schema.optionalKey(Schema.NullOr(Schema.String)),
312 XDG_RUNTIME_DIR: Schema.optionalKey(Schema.NullOr(Schema.String)),
313 XDG_SESSION_DESKTOP: Schema.optionalKey(Schema.NullOr(Schema.String)),
314 XDG_SESSION_TYPE: Schema.optionalKey(Schema.NullOr(Schema.String)),
315 WAYLAND_DISPLAY: Schema.optionalKey(Schema.NullOr(Schema.String)),
316 SSL_CERT_FILE: Schema.optionalKey(Schema.NullOr(Schema.String)),
317 SSL_CERT_DIR: Schema.optionalKey(Schema.NullOr(Schema.String)),
318 NODE_EXTRA_CA_CERTS: Schema.optionalKey(Schema.NullOr(Schema.String)),
319 T3CODE_TELEMETRY_ENABLED: Schema.optionalKey(Schema.NullOr(Schema.String)),
320 T3CODE_GITHUB_APP_CLIENT_ID: Schema.optionalKey(Schema.NullOr(Schema.String)),
321 __MISE_DIFF: Schema.optionalKey(Schema.NullOr(Schema.String)),
322 JAVA_HOME: Schema.optionalKey(Schema.NullOr(Schema.String)),
323 FNM_DIR: Schema.optionalKey(Schema.NullOr(Schema.String)),
324 FNM_MULTISHELL_PATH: Schema.optionalKey(Schema.NullOr(Schema.String)),
325});
326export type ShellEnvironmentPatch = typeof ShellEnvironmentPatch.Type;
327
328export const DesktopShellEnvironmentSnapshot = Schema.Struct({
329 version: Schema.Literal(1),
330 type: Schema.Literal("shellEnvironment"),
331 discovered: Schema.Boolean,
332 platform: Schema.String,
333 environment: ShellEnvironmentPatch,
334});
335export type DesktopShellEnvironmentSnapshot = typeof DesktopShellEnvironmentSnapshot.Type;
336
337export const DesktopHostTelemetryMessage = Schema.Union([
338 DesktopHostTelemetryHello,
339 DesktopShellEnvironmentSnapshot,
340 DesktopHostTelemetrySnapshot,
341 DesktopUpdateStatusReport,
342]);
343export type DesktopHostTelemetryMessage = typeof DesktopHostTelemetryMessage.Type;
344
345export const DesktopTelemetrySetDiagnosticsDemand = Schema.Struct({
346 version: Schema.Literal(1),
347 type: Schema.Literal("setDiagnosticsDemand"),
348 enabled: Schema.Boolean,
349});
350export type DesktopTelemetrySetDiagnosticsDemand = typeof DesktopTelemetrySetDiagnosticsDemand.Type;
351
352export const DesktopTelemetrySetHostPowerIntervals = Schema.Struct({
353 version: Schema.Literal(1),
354 type: Schema.Literal("setHostPowerIntervals"),
355 activeIntervalMs: PositiveInt,
356 idleIntervalMs: PositiveInt,
357});
358export type DesktopTelemetrySetHostPowerIntervals =
359 typeof DesktopTelemetrySetHostPowerIntervals.Type;
360
361/** Runs check/download/quit-and-install without local confirmation; the remote RPC click supplies consent. */
362export const DesktopTelemetryRequestDesktopUpdate = Schema.Struct({
363 version: Schema.Literal(1),
364 type: Schema.Literal("requestDesktopUpdate"),
365 requestId: TrimmedNonEmptyString,
366 /** A track switch: move to this channel first, and install only `targetVersion`. */
367 channel: Schema.optionalKey(DesktopUpdateChannelSchema),
368 targetVersion: Schema.optionalKey(TrimmedNonEmptyString),
369});
370export type DesktopTelemetryRequestDesktopUpdate = typeof DesktopTelemetryRequestDesktopUpdate.Type;
371
372export const DesktopTelemetryCommitDesktopUpdate = Schema.Struct({
373 version: Schema.Literal(1),
374 type: Schema.Literal("commitDesktopUpdate"),
375 requestId: TrimmedNonEmptyString,
376});
377export type DesktopTelemetryCommitDesktopUpdate = typeof DesktopTelemetryCommitDesktopUpdate.Type;
378
379export const DesktopTelemetryCancelDesktopUpdate = Schema.Struct({
380 version: Schema.Literal(1),
381 type: Schema.Literal("cancelDesktopUpdate"),
382 requestId: TrimmedNonEmptyString,
383});
384export type DesktopTelemetryCancelDesktopUpdate = typeof DesktopTelemetryCancelDesktopUpdate.Type;
385
386export const DesktopTelemetryControlMessage = Schema.Union([
387 DesktopTelemetrySetDiagnosticsDemand,
388 DesktopTelemetrySetHostPowerIntervals,
389 DesktopTelemetryRequestDesktopUpdate,
390 DesktopTelemetryCommitDesktopUpdate,
391 DesktopTelemetryCancelDesktopUpdate,
392]);
393export type DesktopTelemetryControlMessage = typeof DesktopTelemetryControlMessage.Type;
394
395export const ResourceTelemetryProcess = Schema.Struct({
396 identity: ResourceTelemetryProcessIdentity,
397 ppid: NonNegativeInt,
398 childPids: Schema.Array(PositiveInt),
399 depth: NonNegativeInt,
400 name: Schema.String,
401 command: Schema.String,
402 status: Schema.String,
403 category: ResourceTelemetryProcessCategory,
404 electronType: Schema.optionalKey(DesktopElectronProcessType),
405 electronServiceName: Schema.optionalKey(Schema.String),
406 cpuPercent: Schema.Number,
407 cpuTimeMs: NonNegativeInt,
408 residentBytes: NonNegativeInt,
409 peakResidentBytes: NonNegativeInt,
410 virtualBytes: NonNegativeInt,
411 ioReadBytes: NonNegativeInt,
412 ioWriteBytes: NonNegativeInt,
413 ioReadBytesPerSecond: Schema.Number,
414 ioWriteBytesPerSecond: Schema.Number,
415 ioSemantics: ResourceTelemetryIoSemantics,
416 idleWakeupsPerSecond: Schema.optionalKey(Schema.Number),
417 runTimeMs: NonNegativeInt,
418 firstSeenAt: Schema.DateTimeUtc,
419 lastSeenAt: Schema.DateTimeUtc,
420});
421export type ResourceTelemetryProcess = typeof ResourceTelemetryProcess.Type;
422
423export const ResourceTelemetryAggregate = Schema.Struct({
424 processCount: NonNegativeInt,
425 currentCpuPercent: Schema.Number,
426 cpuTimeMs: NonNegativeInt,
427 currentRssBytes: NonNegativeInt,
428 peakRssBytes: NonNegativeInt,
429 ioReadBytes: NonNegativeInt,
430 ioWriteBytes: NonNegativeInt,
431 ioReadBytesPerSecond: Schema.Number,
432 ioWriteBytesPerSecond: Schema.Number,
433 processStarts: NonNegativeInt,
434 processExits: NonNegativeInt,
435});
436export type ResourceTelemetryAggregate = typeof ResourceTelemetryAggregate.Type;
437
438export const ResourceTelemetryGroups = Schema.Struct({
439 backend: ResourceTelemetryAggregate,
440 electron: ResourceTelemetryAggregate,
441 monitor: ResourceTelemetryAggregate,
442 allT3: ResourceTelemetryAggregate,
443});
444export type ResourceTelemetryGroups = typeof ResourceTelemetryGroups.Type;
445
446export const ResourceTelemetrySourceHealth = Schema.Struct({
447 status: ResourceTelemetrySourceStatus,
448 lastSampleAt: Schema.Option(Schema.DateTimeUtc),
449 lastError: Schema.Option(TrimmedNonEmptyString),
450});
451export type ResourceTelemetrySourceHealth = typeof ResourceTelemetrySourceHealth.Type;
452
453export const ResourceTelemetryHealth = Schema.Struct({
454 native: ResourceTelemetrySourceHealth,
455 desktop: ResourceTelemetrySourceHealth,
456 sidecarVersion: Schema.Option(TrimmedNonEmptyString),
457 sidecarPid: Schema.Option(PositiveInt),
458 restartCount: NonNegativeInt,
459 collectionDurationMicros: NonNegativeInt,
460 scannedProcessCount: NonNegativeInt,
461 retainedProcessCount: NonNegativeInt,
462 inaccessibleProcessCount: NonNegativeInt,
463});
464export type ResourceTelemetryHealth = typeof ResourceTelemetryHealth.Type;
465
466export const ResourceAttributionEntry = Schema.Struct({
467 component: TrimmedNonEmptyString,
468 operation: TrimmedNonEmptyString,
469 logicalReadBytes: NonNegativeInt,
470 logicalWriteBytes: NonNegativeInt,
471 count: NonNegativeInt,
472 durationMs: NonNegativeInt,
473});
474export type ResourceAttributionEntry = typeof ResourceAttributionEntry.Type;
475
476export const ResourceAttributionSnapshot = Schema.Struct({
477 readAt: Schema.DateTimeUtc,
478 entries: Schema.Array(ResourceAttributionEntry),
479});
480export type ResourceAttributionSnapshot = typeof ResourceAttributionSnapshot.Type;
481
482export const ResourceTelemetrySnapshot = Schema.Struct({
483 readAt: Schema.DateTimeUtc,
484 sampleIntervalMs: NonNegativeInt,
485 processes: Schema.Array(ResourceTelemetryProcess),
486 groups: ResourceTelemetryGroups,
487 power: HostPowerSnapshot,
488 speedLimitPercent: Schema.Option(Schema.Number),
489 attribution: ResourceAttributionSnapshot,
490 health: ResourceTelemetryHealth,
491});
492export type ResourceTelemetrySnapshot = typeof ResourceTelemetrySnapshot.Type;
493
494export const ResourceTelemetryHistoryInput = Schema.Struct({
495 windowMs: NonNegativeInt,
496 bucketMs: NonNegativeInt,
497});
498export type ResourceTelemetryHistoryInput = typeof ResourceTelemetryHistoryInput.Type;
499
500export const ResourceTelemetryHistoryBucket = Schema.Struct({
501 startedAt: Schema.DateTimeUtc,
502 endedAt: Schema.DateTimeUtc,
503 avgCpuPercent: Schema.Number,
504 maxCpuPercent: Schema.Number,
505 maxRssBytes: NonNegativeInt,
506 ioReadBytes: NonNegativeInt,
507 ioWriteBytes: NonNegativeInt,
508 maxProcessCount: NonNegativeInt,
509});
510export type ResourceTelemetryHistoryBucket = typeof ResourceTelemetryHistoryBucket.Type;
511
512export const ResourceTelemetryProcessSummary = Schema.Struct({
513 identity: ResourceTelemetryProcessIdentity,
514 ppid: NonNegativeInt,
515 depth: NonNegativeInt,
516 name: Schema.String,
517 command: Schema.String,
518 category: ResourceTelemetryProcessCategory,
519 firstSeenAt: Schema.DateTimeUtc,
520 lastSeenAt: Schema.DateTimeUtc,
521 currentCpuPercent: Schema.Number,
522 avgCpuPercent: Schema.Number,
523 maxCpuPercent: Schema.Number,
524 cpuTimeMs: NonNegativeInt,
525 currentRssBytes: NonNegativeInt,
526 peakRssBytes: NonNegativeInt,
527 ioReadBytes: NonNegativeInt,
528 ioWriteBytes: NonNegativeInt,
529 ioSemantics: ResourceTelemetryIoSemantics,
530 sampleCount: NonNegativeInt,
531});
532export type ResourceTelemetryProcessSummary = typeof ResourceTelemetryProcessSummary.Type;
533
534export const ResourceTelemetryHistory = Schema.Struct({
535 readAt: Schema.DateTimeUtc,
536 windowMs: NonNegativeInt,
537 bucketMs: NonNegativeInt,
538 sampleIntervalMs: NonNegativeInt,
539 retainedSampleCount: NonNegativeInt,
540 buckets: Schema.Array(ResourceTelemetryHistoryBucket),
541 topProcesses: Schema.Array(ResourceTelemetryProcessSummary),
542 health: ResourceTelemetryHealth,
543});
544export type ResourceTelemetryHistory = typeof ResourceTelemetryHistory.Type;
545
546export const ResourceTelemetryRetryResult = Schema.Struct({
547 accepted: Schema.Boolean,
548 snapshot: ResourceTelemetrySnapshot,
549});
550export type ResourceTelemetryRetryResult = typeof ResourceTelemetryRetryResult.Type;