@bli-cockpit/telemetry-core 0.1.48 → 0.1.49

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.
@@ -495,6 +495,20 @@ export declare const CodexSessionUploadStateSchema: z.ZodEnum<{
495
495
  not_uploaded: "not_uploaded";
496
496
  }>;
497
497
  export type CodexSessionUploadState = z.infer<typeof CodexSessionUploadStateSchema>;
498
+ /**
499
+ * BLI-10734 (Edward, 2026-09-17: "roots are labels, not gates"). Whether this
500
+ * session's working directory fell inside an operator-approved collection
501
+ * root. Both scopes upload; this is a label the collector already computed
502
+ * (the same `OUTSIDE_APPROVED_ROOT_REASONS` check `session-sync-health.ts` and
503
+ * `session-sync-counters.ts` already trust), sent explicitly so the server
504
+ * never has to re-derive it from `attribution_reason` string matching.
505
+ * Optional because an already-published CLI sends none.
506
+ */
507
+ export declare const RootScopeSchema: z.ZodEnum<{
508
+ inside: "inside";
509
+ outside: "outside";
510
+ }>;
511
+ export type RootScope = z.infer<typeof RootScopeSchema>;
498
512
  /**
499
513
  * The agent that produced a session transcript. `codex_session_id` keeps its
500
514
  * historical name across sources; `source` disambiguates. Defaulting to
@@ -566,6 +580,10 @@ export declare const CodexSessionAttributionSchema: z.ZodObject<{
566
580
  worktree_fingerprint: z.ZodOptional<z.ZodString>;
567
581
  repo_label: z.ZodOptional<z.ZodString>;
568
582
  branch: z.ZodOptional<z.ZodString>;
583
+ root_scope: z.ZodOptional<z.ZodEnum<{
584
+ inside: "inside";
585
+ outside: "outside";
586
+ }>>;
569
587
  cwd_basename: z.ZodOptional<z.ZodString>;
570
588
  cwd_hash: z.ZodOptional<z.ZodString>;
571
589
  raw_evidence_pointer_id: z.ZodOptional<z.ZodString>;
@@ -670,6 +688,10 @@ export declare const CodexSessionAttributionReportRequestSchema: z.ZodObject<{
670
688
  worktree_fingerprint: z.ZodOptional<z.ZodString>;
671
689
  repo_label: z.ZodOptional<z.ZodString>;
672
690
  branch: z.ZodOptional<z.ZodString>;
691
+ root_scope: z.ZodOptional<z.ZodEnum<{
692
+ inside: "inside";
693
+ outside: "outside";
694
+ }>>;
673
695
  cwd_basename: z.ZodOptional<z.ZodString>;
674
696
  cwd_hash: z.ZodOptional<z.ZodString>;
675
697
  raw_evidence_pointer_id: z.ZodOptional<z.ZodString>;
@@ -263,6 +263,16 @@ export const CodexSessionUploadStateSchema = z.enum([
263
263
  "upload_failed",
264
264
  "not_uploaded",
265
265
  ]);
266
+ /**
267
+ * BLI-10734 (Edward, 2026-09-17: "roots are labels, not gates"). Whether this
268
+ * session's working directory fell inside an operator-approved collection
269
+ * root. Both scopes upload; this is a label the collector already computed
270
+ * (the same `OUTSIDE_APPROVED_ROOT_REASONS` check `session-sync-health.ts` and
271
+ * `session-sync-counters.ts` already trust), sent explicitly so the server
272
+ * never has to re-derive it from `attribution_reason` string matching.
273
+ * Optional because an already-published CLI sends none.
274
+ */
275
+ export const RootScopeSchema = z.enum(["inside", "outside"]);
266
276
  /**
267
277
  * The agent that produced a session transcript. `codex_session_id` keeps its
268
278
  * historical name across sources; `source` disambiguates. Defaulting to
@@ -301,6 +311,7 @@ export const CodexSessionAttributionSchema = z
301
311
  worktree_fingerprint: SafeLabelSchema.optional(),
302
312
  repo_label: BasenameSchema.optional(),
303
313
  branch: z.string().trim().min(1).max(200).optional(),
314
+ root_scope: RootScopeSchema.optional(),
304
315
  cwd_basename: BasenameSchema.optional(),
305
316
  cwd_hash: z
306
317
  .string()
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from "./outbound-guard.js";
18
18
  export * from "./paths.js";
19
19
  export * from "./privacy.js";
20
20
  export * from "./risk-flags.js";
21
+ export * from "./run-verdict.js";
21
22
  export * from "./secret-guards.js";
22
23
  export * from "./session-facts.js";
23
24
  export * from "./source-adapter.js";
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export * from "./outbound-guard.js";
18
18
  export * from "./paths.js";
19
19
  export * from "./privacy.js";
20
20
  export * from "./risk-flags.js";
21
+ export * from "./run-verdict.js";
21
22
  export * from "./secret-guards.js";
22
23
  export * from "./session-facts.js";
23
24
  export * from "./source-adapter.js";
@@ -0,0 +1,40 @@
1
+ /**
2
+ * BLI-10729: a shared verdict word for "did this cron's firing do real work,
3
+ * or did it say exactly why not" — the gap `careers-grade` fell into
4
+ * (`docs/engineering/railway-crash-rules.md`, "A named limitation this ticket
5
+ * does not close"): it ran with no `git` binary for days, every row's grade
6
+ * attempt recorded as a `stage_reason`, and nothing about that reads as a
7
+ * process failure, because it was not one — the RUN happened, it just did
8
+ * nothing useful on every unit it touched.
9
+ *
10
+ * This is the ONE place that turns "N units attempted, M of them failed" into
11
+ * a closed verdict, so `careers-grade`, `notes-sync`, `slack-sync` and
12
+ * `granola-sync` all print the same word for the same shape of outcome rather
13
+ * than four scripts each inventing their own threshold.
14
+ */
15
+ export type RunVerdict = "ok" | "nothing_to_do" | "degraded" | "failing";
16
+ export interface RunVerdictInput {
17
+ /** Units this firing actually looked at — rows claimed, channels read, accounts synced. */
18
+ attempted: number;
19
+ /** Of those, how many did NOT come out clean. */
20
+ failed: number;
21
+ /**
22
+ * Said when `attempted` is 0. Never left blank: "no submitted rows to
23
+ * grade" and "the claim read itself failed" are both zero, and only one of
24
+ * them is fine.
25
+ */
26
+ nothingToDoReason: string;
27
+ }
28
+ export interface RunVerdictResult {
29
+ verdict: RunVerdict;
30
+ /** A closed label when non-`ok`, always with the counts baked in for `degraded`/`failing`. */
31
+ reason: string;
32
+ }
33
+ /**
34
+ * `ok` — every attempted unit came out clean.
35
+ * `nothing_to_do` — the firing found nothing to attempt, named why.
36
+ * `degraded` — attempted something and SOME of it failed.
37
+ * `failing` — attempted something and ALL of it failed (the BLI-4568 shape:
38
+ * a firing that "ran" 60 times a day and failed every single row).
39
+ */
40
+ export declare function classifyRunVerdict(input: RunVerdictInput): RunVerdictResult;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * BLI-10729: a shared verdict word for "did this cron's firing do real work,
3
+ * or did it say exactly why not" — the gap `careers-grade` fell into
4
+ * (`docs/engineering/railway-crash-rules.md`, "A named limitation this ticket
5
+ * does not close"): it ran with no `git` binary for days, every row's grade
6
+ * attempt recorded as a `stage_reason`, and nothing about that reads as a
7
+ * process failure, because it was not one — the RUN happened, it just did
8
+ * nothing useful on every unit it touched.
9
+ *
10
+ * This is the ONE place that turns "N units attempted, M of them failed" into
11
+ * a closed verdict, so `careers-grade`, `notes-sync`, `slack-sync` and
12
+ * `granola-sync` all print the same word for the same shape of outcome rather
13
+ * than four scripts each inventing their own threshold.
14
+ */
15
+ /**
16
+ * `ok` — every attempted unit came out clean.
17
+ * `nothing_to_do` — the firing found nothing to attempt, named why.
18
+ * `degraded` — attempted something and SOME of it failed.
19
+ * `failing` — attempted something and ALL of it failed (the BLI-4568 shape:
20
+ * a firing that "ran" 60 times a day and failed every single row).
21
+ */
22
+ export function classifyRunVerdict(input) {
23
+ const { attempted, failed, nothingToDoReason } = input;
24
+ if (attempted <= 0) {
25
+ return { verdict: "nothing_to_do", reason: nothingToDoReason };
26
+ }
27
+ if (failed <= 0) {
28
+ return { verdict: "ok", reason: "ok" };
29
+ }
30
+ if (failed >= attempted) {
31
+ return { verdict: "failing", reason: `all_failed:${failed}/${attempted}` };
32
+ }
33
+ return { verdict: "degraded", reason: `partial_failures:${failed}/${attempted}` };
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bli-cockpit/telemetry-core",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",