@crossworks/client-types 0.500.18 → 0.500.24
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/dto/box-status.ts +109 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This box's status as numbers (schema 1): what the box_status tool returns
|
|
3
|
+
* (@mantle/tools box-status-bridge.ts, collected by server/web
|
|
4
|
+
* lib/box-status.ts) and what GET /api/box-status serves the Status screen,
|
|
5
|
+
* beside the containers docker reports. Numbers, booleans and fixed words
|
|
6
|
+
* only: the boxes belong to clients, so nothing here names an item, a
|
|
7
|
+
* person, a host or anything a user wrote.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** A probe that did not answer in time names itself in `degraded` (our code's
|
|
11
|
+
* fixed names, e.g. `host.cpu`, `postgres`). */
|
|
12
|
+
export type BoxStatus = {
|
|
13
|
+
schema: 1;
|
|
14
|
+
/** When it was collected (ISO). */
|
|
15
|
+
ts: string;
|
|
16
|
+
build: { version: string; gitSha: string | null; buildTime: string | null };
|
|
17
|
+
process: { uptimeSec: number; heapUsedBytes: number; rssBytes: number };
|
|
18
|
+
host: {
|
|
19
|
+
/** `container`: the web container's own view; `host`: the host's /proc
|
|
20
|
+
* (MANTLE_HOST_PROC). */
|
|
21
|
+
scope: 'container' | 'host';
|
|
22
|
+
cpuLoadPct: number | null;
|
|
23
|
+
loadAvg: [number, number, number];
|
|
24
|
+
cores: number;
|
|
25
|
+
mem: { usedBytes: number; totalBytes: number; usedPct: number } | null;
|
|
26
|
+
disk: { usedBytes: number; totalBytes: number; freeBytes: number; usedPct: number } | null;
|
|
27
|
+
};
|
|
28
|
+
postgres: {
|
|
29
|
+
up: boolean;
|
|
30
|
+
dbSizeBytes: number | null;
|
|
31
|
+
connections: number | null;
|
|
32
|
+
cacheHitPct: number | null;
|
|
33
|
+
};
|
|
34
|
+
/** Up (true), down (false), or switched off or not known (null). */
|
|
35
|
+
services: {
|
|
36
|
+
objectStore: boolean | null;
|
|
37
|
+
parser: { up: boolean; running: number | null; queued: number | null };
|
|
38
|
+
browser: boolean | null;
|
|
39
|
+
documents: boolean | null;
|
|
40
|
+
embedder: boolean | null;
|
|
41
|
+
sandboxes: boolean | null;
|
|
42
|
+
network: boolean | null;
|
|
43
|
+
};
|
|
44
|
+
/** Model spend in micro-USD over rolling windows, and the traces of the
|
|
45
|
+
* last 24 hours: all of them, the assistant turns, the failed. */
|
|
46
|
+
spend: {
|
|
47
|
+
last24hMicroUsd: number;
|
|
48
|
+
last7dMicroUsd: number;
|
|
49
|
+
last30dMicroUsd: number;
|
|
50
|
+
traces24h: number;
|
|
51
|
+
turns24h: number;
|
|
52
|
+
errors24h: number;
|
|
53
|
+
} | null;
|
|
54
|
+
/** The corpus against the split policy (@mantle/content corpusCapacity). */
|
|
55
|
+
capacity: {
|
|
56
|
+
docs: number;
|
|
57
|
+
chunkVectors: number;
|
|
58
|
+
zone: 'green' | 'watch' | 'split';
|
|
59
|
+
pctOfSplit: number;
|
|
60
|
+
} | null;
|
|
61
|
+
extraction: {
|
|
62
|
+
running: number;
|
|
63
|
+
waiting: number;
|
|
64
|
+
retrying: number;
|
|
65
|
+
doneLast10Min: number;
|
|
66
|
+
deadLettered: number;
|
|
67
|
+
} | null;
|
|
68
|
+
/** Logins by display role (enabled), and the disabled ones. */
|
|
69
|
+
logins: { admin: number; member: number; disabled: number; total: number } | null;
|
|
70
|
+
degraded: string[];
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/** One long-running container as the updater sidecar saw it (`docker
|
|
74
|
+
* inspect`, every ~5 minutes and after a roll or a switch). */
|
|
75
|
+
export type BoxContainerState = {
|
|
76
|
+
/** docker's State.Status: 'running', 'restarting', 'exited', 'created',
|
|
77
|
+
* 'paused', 'removing', 'dead'; 'absent' when the box does not run it;
|
|
78
|
+
* 'unknown' when the updater's file said anything else. */
|
|
79
|
+
container: string;
|
|
80
|
+
/** The healthcheck: 'healthy', 'unhealthy', 'starting', 'none', or
|
|
81
|
+
* 'unknown'. */
|
|
82
|
+
health: string;
|
|
83
|
+
/** docker's restart count: restarts by its own restart policy only. It
|
|
84
|
+
* does NOT count autoheal's (`docker restart`), so a worker autoheal
|
|
85
|
+
* keeps restarting can read 0 here; `startedAt` is the signal for those
|
|
86
|
+
* (a long-running container that started recently, well after the rest
|
|
87
|
+
* of the stack). */
|
|
88
|
+
restarts: number;
|
|
89
|
+
/** When it last started (ISO, to the second), or null. */
|
|
90
|
+
startedAt: string | null;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* GET /api/box-status (settings area, read-only): the box status, and every
|
|
95
|
+
* long-running container of the stack by its compose service name
|
|
96
|
+
* (`postgres`, `objectstore`, `gotenberg`, `worker_email`, `client_web`,
|
|
97
|
+
* ...: @mantle/config BOX_CONTAINERS). `containers` is null where the brain
|
|
98
|
+
* cannot read the updater's services.json (no updater, an updater before the
|
|
99
|
+
* field, a dev process).
|
|
100
|
+
*/
|
|
101
|
+
export type BoxStatusView = {
|
|
102
|
+
box: BoxStatus;
|
|
103
|
+
containers: Record<string, BoxContainerState> | null;
|
|
104
|
+
/** When the updater last wrote them (ISO), or null. */
|
|
105
|
+
containersCheckedAt: string | null;
|
|
106
|
+
/** The 4 GB core shape (docker-compose.core.yml): some workers and the
|
|
107
|
+
* browser run only with a profile there. Null when not known. */
|
|
108
|
+
core: boolean | null;
|
|
109
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from './dto/views';
|
|
|
35
35
|
export * from './dto/recall';
|
|
36
36
|
export * from './dto/contact-shares';
|
|
37
37
|
export * from './dto/services';
|
|
38
|
+
export * from './dto/box-status';
|
|
38
39
|
export * from './dto/present-checks';
|
|
39
40
|
// Types only; ACCESS_LEVELS (runtime) is the `@mantle/client-types/dto/access` subpath.
|
|
40
41
|
export type {
|