@bli-cockpit/telemetry-core 0.1.101 → 0.1.103
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/dist/collector-heartbeat.d.ts +24 -0
- package/dist/collector-heartbeat.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/memory-hook-hours.d.ts +25 -0
- package/dist/memory-hook-hours.js +41 -0
- package/dist/memory-install-receipt.d.ts +7 -0
- package/dist/memory-install-receipt.js +7 -0
- package/package.json +1 -1
|
@@ -100,6 +100,19 @@ export declare const CollectorDiskReadingSchema: z.ZodObject<{
|
|
|
100
100
|
}>;
|
|
101
101
|
}, z.core.$strict>;
|
|
102
102
|
export type CollectorDiskReading = z.infer<typeof CollectorDiskReadingSchema>;
|
|
103
|
+
/**
|
|
104
|
+
* Ticket 24980. Raw evidence this machine staged and Tower never accepted, for longer than
|
|
105
|
+
* `STUCK_EVIDENCE_AFTER_HOURS`. Before this the count lived only in the laptop's own `cockpit status`:
|
|
106
|
+
* 65 objects on the reference Mac failed from 2026-10-17 while doctor, Setup and the ops board read green.
|
|
107
|
+
* A count and the reason most of them carry, nothing else. A staged copy whose bytes are gone from the
|
|
108
|
+
* disk is not counted: there is nothing left to send, and its session re-stages from the source.
|
|
109
|
+
*/
|
|
110
|
+
export declare const STUCK_EVIDENCE_AFTER_HOURS = 24;
|
|
111
|
+
export declare const RawEvidenceStuckReadingSchema: z.ZodObject<{
|
|
112
|
+
object_count: z.ZodNumber;
|
|
113
|
+
top_reason: z.ZodNullable<z.ZodString>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
export type RawEvidenceStuckReading = z.infer<typeof RawEvidenceStuckReadingSchema>;
|
|
103
116
|
export declare const CollectorHeartbeatSchema: z.ZodObject<{
|
|
104
117
|
schema_version: z.ZodLiteral<"collector-heartbeat.v1">;
|
|
105
118
|
generated_at: z.ZodString;
|
|
@@ -146,6 +159,10 @@ export declare const CollectorHeartbeatSchema: z.ZodObject<{
|
|
|
146
159
|
staging_at_cap: "staging_at_cap";
|
|
147
160
|
}>;
|
|
148
161
|
}, z.core.$strict>>;
|
|
162
|
+
raw_evidence_stuck: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
object_count: z.ZodNumber;
|
|
164
|
+
top_reason: z.ZodNullable<z.ZodString>;
|
|
165
|
+
}, z.core.$strict>>;
|
|
149
166
|
memory_install: z.ZodOptional<z.ZodObject<{
|
|
150
167
|
schema_version: z.ZodLiteral<"memory-install-receipt.v1">;
|
|
151
168
|
checked_at: z.ZodString;
|
|
@@ -202,6 +219,13 @@ export declare const CollectorHeartbeatSchema: z.ZodObject<{
|
|
|
202
219
|
hook_stop_failed_24h: z.ZodOptional<z.ZodNumber>;
|
|
203
220
|
hook_session_start_runs_24h: z.ZodOptional<z.ZodNumber>;
|
|
204
221
|
hook_session_start_failed_24h: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
hook_prompt_hours_24h: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
223
|
+
hour: z.ZodString;
|
|
224
|
+
runs: z.ZodNumber;
|
|
225
|
+
printed: z.ZodNumber;
|
|
226
|
+
timeouts: z.ZodNumber;
|
|
227
|
+
failed: z.ZodNumber;
|
|
228
|
+
}, z.core.$strict>>>;
|
|
205
229
|
hook_stats_reason: z.ZodOptional<z.ZodString>;
|
|
206
230
|
hook_performance: z.ZodOptional<z.ZodObject<{
|
|
207
231
|
schema_version: z.ZodLiteral<"memory-hook-performance.v1">;
|
|
@@ -98,6 +98,20 @@ export const CollectorDiskReadingSchema = z
|
|
|
98
98
|
gate: CollectorDiskGateSchema,
|
|
99
99
|
})
|
|
100
100
|
.strict();
|
|
101
|
+
/**
|
|
102
|
+
* Ticket 24980. Raw evidence this machine staged and Tower never accepted, for longer than
|
|
103
|
+
* `STUCK_EVIDENCE_AFTER_HOURS`. Before this the count lived only in the laptop's own `cockpit status`:
|
|
104
|
+
* 65 objects on the reference Mac failed from 2026-10-17 while doctor, Setup and the ops board read green.
|
|
105
|
+
* A count and the reason most of them carry, nothing else. A staged copy whose bytes are gone from the
|
|
106
|
+
* disk is not counted: there is nothing left to send, and its session re-stages from the source.
|
|
107
|
+
*/
|
|
108
|
+
export const STUCK_EVIDENCE_AFTER_HOURS = 24;
|
|
109
|
+
export const RawEvidenceStuckReadingSchema = z
|
|
110
|
+
.object({
|
|
111
|
+
object_count: z.number().int().nonnegative().max(1_000_000),
|
|
112
|
+
top_reason: z.string().trim().min(1).max(120).regex(/^[a-z0-9_:.-]+$/iu).nullable(),
|
|
113
|
+
})
|
|
114
|
+
.strict();
|
|
101
115
|
export const CollectorHeartbeatSchema = z
|
|
102
116
|
.object({
|
|
103
117
|
schema_version: z.literal(COLLECTOR_HEARTBEAT_SCHEMA_VERSION),
|
|
@@ -208,6 +222,8 @@ export const CollectorHeartbeatSchema = z
|
|
|
208
222
|
* predates it or could not measure", never "the disk is fine".
|
|
209
223
|
*/
|
|
210
224
|
disk: CollectorDiskReadingSchema.optional(),
|
|
225
|
+
/** Ticket 24980. Evidence never accepted for over a day. Absent: an older collector, or a read that failed. */
|
|
226
|
+
raw_evidence_stuck: RawEvidenceStuckReadingSchema.optional(),
|
|
211
227
|
/**
|
|
212
228
|
* BLI-3729. Is BLI Memory actually switched on for both agent hosts on
|
|
213
229
|
* this machine? Six words computed by reading the host configs BACK, not
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./ingest-dto.js";
|
|
|
26
26
|
export * from "./local-config.js";
|
|
27
27
|
export * from "./memory-daemon-endpoint.js";
|
|
28
28
|
export * from "./memory-hook-stats.js";
|
|
29
|
+
export * from "./memory-hook-hours.js";
|
|
29
30
|
export * from "./sync-revive-contract.js";
|
|
30
31
|
export * from "./memory-capture-contract.js";
|
|
31
32
|
export * from "./founder-standing-contract.js";
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./ingest-dto.js";
|
|
|
26
26
|
export * from "./local-config.js";
|
|
27
27
|
export * from "./memory-daemon-endpoint.js";
|
|
28
28
|
export * from "./memory-hook-stats.js";
|
|
29
|
+
export * from "./memory-hook-hours.js";
|
|
29
30
|
export * from "./sync-revive-contract.js";
|
|
30
31
|
export * from "./memory-capture-contract.js";
|
|
31
32
|
export * from "./founder-standing-contract.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE PROMPT HOOK, HOUR BY HOUR (ticket 24921).
|
|
3
|
+
*
|
|
4
|
+
* The memory receipt carried only 24-hour totals (`hook_runs_24h`, `hook_timeouts_24h`), and the server keeps only the
|
|
5
|
+
* newest receipt per machine, so "did the timeout rate drop since the database upgrade at 14:15?" could be answered
|
|
6
|
+
* from one laptop's own counter file and from nowhere else. The counter file already keeps hourly buckets; this sends
|
|
7
|
+
* the prompt hook's last 24 of them on the receipt, so the ops board can count from any hour inside that window.
|
|
8
|
+
*
|
|
9
|
+
* Counts and UTC hour labels only, like the file they come from. At most 24 entries; an hour in which the prompt hook
|
|
10
|
+
* never ran is left out rather than sent as zeroes.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { type MemoryHookStatsFile } from "./memory-hook-stats.js";
|
|
14
|
+
/** Hours the receipt carries: the same 24 the totals cover. */
|
|
15
|
+
export declare const MEMORY_HOOK_HOURS_MAX = 24;
|
|
16
|
+
export declare const MemoryHookHourSchema: z.ZodObject<{
|
|
17
|
+
hour: z.ZodString;
|
|
18
|
+
runs: z.ZodNumber;
|
|
19
|
+
printed: z.ZodNumber;
|
|
20
|
+
timeouts: z.ZodNumber;
|
|
21
|
+
failed: z.ZodNumber;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type MemoryHookHour = z.infer<typeof MemoryHookHourSchema>;
|
|
24
|
+
/** The prompt hook's hours inside the last 24 (the current hour included), oldest first, hours with no run left out. */
|
|
25
|
+
export declare function promptHookHours(file: MemoryHookStatsFile, now: Date): MemoryHookHour[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE PROMPT HOOK, HOUR BY HOUR (ticket 24921).
|
|
3
|
+
*
|
|
4
|
+
* The memory receipt carried only 24-hour totals (`hook_runs_24h`, `hook_timeouts_24h`), and the server keeps only the
|
|
5
|
+
* newest receipt per machine, so "did the timeout rate drop since the database upgrade at 14:15?" could be answered
|
|
6
|
+
* from one laptop's own counter file and from nowhere else. The counter file already keeps hourly buckets; this sends
|
|
7
|
+
* the prompt hook's last 24 of them on the receipt, so the ops board can count from any hour inside that window.
|
|
8
|
+
*
|
|
9
|
+
* Counts and UTC hour labels only, like the file they come from. At most 24 entries; an hour in which the prompt hook
|
|
10
|
+
* never ran is left out rather than sent as zeroes.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { MEMORY_HOOK_BUCKET_PATTERN, memoryHookHourBucket, } from "./memory-hook-stats.js";
|
|
14
|
+
/** Hours the receipt carries: the same 24 the totals cover. */
|
|
15
|
+
export const MEMORY_HOOK_HOURS_MAX = 24;
|
|
16
|
+
export const MemoryHookHourSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
/** `YYYY-MM-DDTHH`, UTC: the hour the counts belong to. */
|
|
19
|
+
hour: z.string().regex(MEMORY_HOOK_BUCKET_PATTERN),
|
|
20
|
+
runs: z.number().int().min(0),
|
|
21
|
+
printed: z.number().int().min(0),
|
|
22
|
+
timeouts: z.number().int().min(0),
|
|
23
|
+
failed: z.number().int().min(0),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
/** The prompt hook's hours inside the last 24 (the current hour included), oldest first, hours with no run left out. */
|
|
27
|
+
export function promptHookHours(file, now) {
|
|
28
|
+
const earliest = memoryHookHourBucket(new Date(now.getTime() - (MEMORY_HOOK_HOURS_MAX - 1) * 3_600_000));
|
|
29
|
+
const latest = memoryHookHourBucket(now);
|
|
30
|
+
const hours = [];
|
|
31
|
+
for (const [hour, events] of Object.entries(file.buckets)) {
|
|
32
|
+
// The key sorts chronologically as a string, which is why a string comparison may stand in for a date one.
|
|
33
|
+
if (hour < earliest || hour > latest)
|
|
34
|
+
continue;
|
|
35
|
+
const counts = events.prompt;
|
|
36
|
+
if (!counts || counts.runs === 0)
|
|
37
|
+
continue;
|
|
38
|
+
hours.push({ hour, runs: counts.runs, printed: counts.printed, timeouts: counts.timeouts, failed: counts.failed });
|
|
39
|
+
}
|
|
40
|
+
return hours.sort((left, right) => left.hour.localeCompare(right.hour));
|
|
41
|
+
}
|
|
@@ -124,6 +124,13 @@ export declare const MemoryInstallReceiptSchema: z.ZodObject<{
|
|
|
124
124
|
hook_stop_failed_24h: z.ZodOptional<z.ZodNumber>;
|
|
125
125
|
hook_session_start_runs_24h: z.ZodOptional<z.ZodNumber>;
|
|
126
126
|
hook_session_start_failed_24h: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
hook_prompt_hours_24h: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
|
+
hour: z.ZodString;
|
|
129
|
+
runs: z.ZodNumber;
|
|
130
|
+
printed: z.ZodNumber;
|
|
131
|
+
timeouts: z.ZodNumber;
|
|
132
|
+
failed: z.ZodNumber;
|
|
133
|
+
}, z.core.$strict>>>;
|
|
127
134
|
hook_stats_reason: z.ZodOptional<z.ZodString>;
|
|
128
135
|
hook_performance: z.ZodOptional<z.ZodObject<{
|
|
129
136
|
schema_version: z.ZodLiteral<"memory-hook-performance.v1">;
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import { z } from "zod";
|
|
35
35
|
import { IsoDateTimeSchema } from "./common.js";
|
|
36
|
+
import { MEMORY_HOOK_HOURS_MAX, MemoryHookHourSchema } from "./memory-hook-hours.js";
|
|
36
37
|
import { MemoryHookPerformanceSchema } from "./memory-hook-performance.js";
|
|
37
38
|
export const MEMORY_INSTALL_RECEIPT_SCHEMA_VERSION = "memory-install-receipt.v1";
|
|
38
39
|
/**
|
|
@@ -204,6 +205,12 @@ export const MemoryInstallReceiptSchema = z
|
|
|
204
205
|
hook_stop_failed_24h: z.number().int().min(0).optional(),
|
|
205
206
|
hook_session_start_runs_24h: z.number().int().min(0).optional(),
|
|
206
207
|
hook_session_start_failed_24h: z.number().int().min(0).optional(),
|
|
208
|
+
/**
|
|
209
|
+
* The prompt hook's last 24 hours, one entry per hour it ran (ticket 24921), so the ops board can count from a
|
|
210
|
+
* given hour (`cockpit ops status --memory --since`). Absent on a collector older than the field, which reads as
|
|
211
|
+
* "no hourly data", never as an idle machine.
|
|
212
|
+
*/
|
|
213
|
+
hook_prompt_hours_24h: z.array(MemoryHookHourSchema).max(MEMORY_HOOK_HOURS_MAX).optional(),
|
|
207
214
|
/** Named when the counts are absent because the file could not be read. */
|
|
208
215
|
hook_stats_reason: ReasonLabelSchema.optional(),
|
|
209
216
|
/** Observed ordinary invocations, not legacy floors or a full host trace. */
|