@bli-cockpit/telemetry-core 0.1.8 → 0.1.10

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.
@@ -342,13 +342,16 @@ export type RawEvidenceUploadCommitResponse = z.infer<typeof RawEvidenceUploadCo
342
342
  * cwd basename/hash) instead of being duplicated into every repo's evidence
343
343
  * pack or silently dropped. No content-bearing fields are allowed.
344
344
  */
345
+ export declare const CODEX_SESSION_ATTRIBUTION_STATES: readonly ["attributed", "attributed_fallback", "ambiguous", "unattributed", "skipped"];
345
346
  export declare const CodexSessionAttributionStateSchema: z.ZodEnum<{
346
347
  skipped: "skipped";
347
348
  attributed: "attributed";
349
+ attributed_fallback: "attributed_fallback";
348
350
  ambiguous: "ambiguous";
349
351
  unattributed: "unattributed";
350
352
  }>;
351
353
  export type CodexSessionAttributionState = z.infer<typeof CodexSessionAttributionStateSchema>;
354
+ export declare const CODEX_SESSION_ATTRIBUTION_STATE_RANK: Record<CodexSessionAttributionState, number>;
352
355
  export declare const CodexSessionUploadStateSchema: z.ZodEnum<{
353
356
  uploaded: "uploaded";
354
357
  reused_existing: "reused_existing";
@@ -377,6 +380,7 @@ export declare const CodexSessionAttributionSchema: z.ZodObject<{
377
380
  attribution_state: z.ZodEnum<{
378
381
  skipped: "skipped";
379
382
  attributed: "attributed";
383
+ attributed_fallback: "attributed_fallback";
380
384
  ambiguous: "ambiguous";
381
385
  unattributed: "unattributed";
382
386
  }>;
@@ -444,6 +448,7 @@ export declare const CodexSessionAttributionReportRequestSchema: z.ZodObject<{
444
448
  attribution_state: z.ZodEnum<{
445
449
  skipped: "skipped";
446
450
  attributed: "attributed";
451
+ attributed_fallback: "attributed_fallback";
447
452
  ambiguous: "ambiguous";
448
453
  unattributed: "unattributed";
449
454
  }>;
@@ -130,12 +130,21 @@ export const RawEvidenceUploadCommitResponseSchema = z
130
130
  * cwd basename/hash) instead of being duplicated into every repo's evidence
131
131
  * pack or silently dropped. No content-bearing fields are allowed.
132
132
  */
133
- export const CodexSessionAttributionStateSchema = z.enum([
133
+ export const CODEX_SESSION_ATTRIBUTION_STATES = [
134
134
  "attributed",
135
+ "attributed_fallback",
135
136
  "ambiguous",
136
137
  "unattributed",
137
138
  "skipped",
138
- ]);
139
+ ];
140
+ export const CodexSessionAttributionStateSchema = z.enum(CODEX_SESSION_ATTRIBUTION_STATES);
141
+ export const CODEX_SESSION_ATTRIBUTION_STATE_RANK = {
142
+ attributed: 4,
143
+ attributed_fallback: 3,
144
+ ambiguous: 2,
145
+ unattributed: 1,
146
+ skipped: 0,
147
+ };
139
148
  export const CodexSessionUploadStateSchema = z.enum([
140
149
  "uploaded",
141
150
  "reused_existing",
package/dist/index.d.ts CHANGED
@@ -9,5 +9,6 @@ export * from "./privacy.js";
9
9
  export * from "./risk-flags.js";
10
10
  export * from "./secret-guards.js";
11
11
  export * from "./source-adapter.js";
12
+ export * from "./ticket-id.js";
12
13
  export * from "./trace-sink.js";
13
14
  export * from "./work-context.js";
package/dist/index.js CHANGED
@@ -9,5 +9,6 @@ export * from "./privacy.js";
9
9
  export * from "./risk-flags.js";
10
10
  export * from "./secret-guards.js";
11
11
  export * from "./source-adapter.js";
12
+ export * from "./ticket-id.js";
12
13
  export * from "./trace-sink.js";
13
14
  export * from "./work-context.js";
@@ -1,4 +1,16 @@
1
1
  import { z } from "zod";
2
+ export declare const WorktreeInventoryItemSchema: z.ZodObject<{
3
+ repo: z.ZodString;
4
+ repo_label: z.ZodOptional<z.ZodString>;
5
+ repo_fingerprint: z.ZodOptional<z.ZodString>;
6
+ repo_origin_url: z.ZodOptional<z.ZodString>;
7
+ head_sha: z.ZodOptional<z.ZodString>;
8
+ worktree_label: z.ZodOptional<z.ZodString>;
9
+ worktree_fingerprint: z.ZodString;
10
+ worktree_is_primary: z.ZodOptional<z.ZodBoolean>;
11
+ branch: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strict>;
13
+ export type WorktreeInventoryItem = z.infer<typeof WorktreeInventoryItemSchema>;
2
14
  export declare const TelemetryEventTypeSchema: z.ZodEnum<{
3
15
  session_started: "session_started";
4
16
  session_ended: "session_ended";
@@ -475,6 +487,17 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
475
487
  work_context_id: z.ZodString;
476
488
  }, z.core.$strict>>;
477
489
  }, z.core.$strict>;
490
+ worktree_inventory: z.ZodDefault<z.ZodArray<z.ZodObject<{
491
+ repo: z.ZodString;
492
+ repo_label: z.ZodOptional<z.ZodString>;
493
+ repo_fingerprint: z.ZodOptional<z.ZodString>;
494
+ repo_origin_url: z.ZodOptional<z.ZodString>;
495
+ head_sha: z.ZodOptional<z.ZodString>;
496
+ worktree_label: z.ZodOptional<z.ZodString>;
497
+ worktree_fingerprint: z.ZodString;
498
+ worktree_is_primary: z.ZodOptional<z.ZodBoolean>;
499
+ branch: z.ZodOptional<z.ZodString>;
500
+ }, z.core.$strict>>>;
478
501
  events: z.ZodArray<z.ZodObject<{
479
502
  event_id: z.ZodString;
480
503
  event_type: z.ZodEnum<{
@@ -7,6 +7,19 @@ import { SourceScanResultSchema } from "./source-adapter.js";
7
7
  import { ExternalTraceSinkPointerSchema, NormalizedOtelTelemetrySchema, } from "./trace-sink.js";
8
8
  import { EvidenceCompletenessPayloadSchema } from "./evidence-completeness.js";
9
9
  import { LocalWorkContextSchema, TicketBindingCandidateSchema, } from "./work-context.js";
10
+ export const WorktreeInventoryItemSchema = z
11
+ .object({
12
+ repo: NonEmptyStringSchema,
13
+ repo_label: NonEmptyStringSchema.optional(),
14
+ repo_fingerprint: NonEmptyStringSchema.optional(),
15
+ repo_origin_url: NonEmptyStringSchema.optional(),
16
+ head_sha: NonEmptyStringSchema.optional(),
17
+ worktree_label: NonEmptyStringSchema.optional(),
18
+ worktree_fingerprint: NonEmptyStringSchema,
19
+ worktree_is_primary: z.boolean().optional(),
20
+ branch: NonEmptyStringSchema.optional(),
21
+ })
22
+ .strict();
10
23
  export const TelemetryEventTypeSchema = z.enum([
11
24
  "session_started",
12
25
  "session_ended",
@@ -83,6 +96,7 @@ export const TelemetryIngestEnvelopeSchema = z
83
96
  collector_version: NonEmptyStringSchema,
84
97
  session_reference: LocalUserSessionReferenceSchema,
85
98
  work_context: LocalWorkContextSchema,
99
+ worktree_inventory: z.array(WorktreeInventoryItemSchema).default([]),
86
100
  events: z.array(TelemetryIngestEventDtoSchema).min(1),
87
101
  source_scan_results: z.array(SourceScanResultSchema).default([]),
88
102
  })
@@ -0,0 +1 @@
1
+ export declare function parseTicketIdFromText(value: string): string | null;
@@ -0,0 +1,4 @@
1
+ export function parseTicketIdFromText(value) {
2
+ const match = value.match(/\b[A-Z][A-Z0-9]{1,12}-\d+\b/);
3
+ return match?.[0] ?? null;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bli-cockpit/telemetry-core",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",