@bli-cockpit/telemetry-core 0.1.4 → 0.1.6

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.
@@ -0,0 +1,224 @@
1
+ import { z } from "zod";
2
+ export declare const AGENT_IMAGE_ARTIFACT_MAX_FILE_BYTES: number;
3
+ export declare const AGENT_IMAGE_ARTIFACT_MAX_REPORT_ITEMS = 100;
4
+ export declare const AgentArtifactSourceSchema: z.ZodEnum<{
5
+ codex: "codex";
6
+ claude_code: "claude_code";
7
+ }>;
8
+ export type AgentArtifactSource = z.infer<typeof AgentArtifactSourceSchema>;
9
+ export declare const AgentArtifactKindSchema: z.ZodEnum<{
10
+ screenshot: "screenshot";
11
+ image_attachment: "image_attachment";
12
+ }>;
13
+ export type AgentArtifactKind = z.infer<typeof AgentArtifactKindSchema>;
14
+ export declare const AgentArtifactCaptureOriginSchema: z.ZodEnum<{
15
+ agent_session_attachment: "agent_session_attachment";
16
+ }>;
17
+ export type AgentArtifactCaptureOrigin = z.infer<typeof AgentArtifactCaptureOriginSchema>;
18
+ export declare const AgentArtifactRedactionStatusSchema: z.ZodEnum<{
19
+ not_started: "not_started";
20
+ pending: "pending";
21
+ redacted: "redacted";
22
+ safe_for_metadata: "safe_for_metadata";
23
+ blocked: "blocked";
24
+ }>;
25
+ export type AgentArtifactRedactionStatus = z.infer<typeof AgentArtifactRedactionStatusSchema>;
26
+ export declare const AgentArtifactOcrStatusSchema: z.ZodEnum<{
27
+ not_started: "not_started";
28
+ pending: "pending";
29
+ completed: "completed";
30
+ failed: "failed";
31
+ skipped: "skipped";
32
+ }>;
33
+ export type AgentArtifactOcrStatus = z.infer<typeof AgentArtifactOcrStatusSchema>;
34
+ export declare const AgentImageArtifactMediaTypeSchema: z.ZodEnum<{
35
+ "image/png": "image/png";
36
+ "image/jpeg": "image/jpeg";
37
+ }>;
38
+ export type AgentImageArtifactMediaType = z.infer<typeof AgentImageArtifactMediaTypeSchema>;
39
+ export declare const AgentImageArtifactStorageBucketSchema: z.ZodLiteral<"ambient-raw-evidence">;
40
+ export type AgentImageArtifactStorageBucket = z.infer<typeof AgentImageArtifactStorageBucketSchema>;
41
+ export declare const AgentImageArtifactStorageMetadataSchema: z.ZodObject<{
42
+ storage_bucket: z.ZodLiteral<"ambient-raw-evidence">;
43
+ object_key: z.ZodString;
44
+ content_hash_sha256: z.ZodString;
45
+ byte_size: z.ZodNumber;
46
+ media_type: z.ZodEnum<{
47
+ "image/png": "image/png";
48
+ "image/jpeg": "image/jpeg";
49
+ }>;
50
+ width: z.ZodOptional<z.ZodNumber>;
51
+ height: z.ZodOptional<z.ZodNumber>;
52
+ perceptual_hash: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strict>;
54
+ export type AgentImageArtifactStorageMetadata = z.infer<typeof AgentImageArtifactStorageMetadataSchema>;
55
+ export declare const AgentImageArtifactBindingSchema: z.ZodObject<{
56
+ operator_user_id: z.ZodOptional<z.ZodString>;
57
+ team_id: z.ZodOptional<z.ZodString>;
58
+ work_session_id: z.ZodOptional<z.ZodString>;
59
+ task_id: z.ZodOptional<z.ZodString>;
60
+ ticket_id: z.ZodOptional<z.ZodString>;
61
+ repo_fingerprint: z.ZodOptional<z.ZodString>;
62
+ worktree_fingerprint: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strict>;
64
+ export type AgentImageArtifactBinding = z.infer<typeof AgentImageArtifactBindingSchema>;
65
+ export declare const AgentImageArtifactSchema: z.ZodObject<{
66
+ storage_bucket: z.ZodLiteral<"ambient-raw-evidence">;
67
+ object_key: z.ZodString;
68
+ content_hash_sha256: z.ZodString;
69
+ byte_size: z.ZodNumber;
70
+ media_type: z.ZodEnum<{
71
+ "image/png": "image/png";
72
+ "image/jpeg": "image/jpeg";
73
+ }>;
74
+ width: z.ZodOptional<z.ZodNumber>;
75
+ height: z.ZodOptional<z.ZodNumber>;
76
+ perceptual_hash: z.ZodOptional<z.ZodString>;
77
+ operator_user_id: z.ZodOptional<z.ZodString>;
78
+ team_id: z.ZodOptional<z.ZodString>;
79
+ work_session_id: z.ZodOptional<z.ZodString>;
80
+ task_id: z.ZodOptional<z.ZodString>;
81
+ ticket_id: z.ZodOptional<z.ZodString>;
82
+ repo_fingerprint: z.ZodOptional<z.ZodString>;
83
+ worktree_fingerprint: z.ZodOptional<z.ZodString>;
84
+ artifact_id: z.ZodOptional<z.ZodString>;
85
+ raw_evidence_pointer_id: z.ZodString;
86
+ agent_source: z.ZodEnum<{
87
+ codex: "codex";
88
+ claude_code: "claude_code";
89
+ }>;
90
+ source_session_id: z.ZodString;
91
+ source_message_id: z.ZodOptional<z.ZodString>;
92
+ turn_index: z.ZodOptional<z.ZodNumber>;
93
+ occurred_at: z.ZodString;
94
+ artifact_kind: z.ZodDefault<z.ZodEnum<{
95
+ screenshot: "screenshot";
96
+ image_attachment: "image_attachment";
97
+ }>>;
98
+ capture_origin: z.ZodDefault<z.ZodEnum<{
99
+ agent_session_attachment: "agent_session_attachment";
100
+ }>>;
101
+ redaction_status: z.ZodDefault<z.ZodEnum<{
102
+ not_started: "not_started";
103
+ pending: "pending";
104
+ redacted: "redacted";
105
+ safe_for_metadata: "safe_for_metadata";
106
+ blocked: "blocked";
107
+ }>>;
108
+ ocr_status: z.ZodDefault<z.ZodEnum<{
109
+ not_started: "not_started";
110
+ pending: "pending";
111
+ completed: "completed";
112
+ failed: "failed";
113
+ skipped: "skipped";
114
+ }>>;
115
+ ocr_text_redacted: z.ZodOptional<z.ZodString>;
116
+ labels: z.ZodDefault<z.ZodObject<{
117
+ attachment_role: z.ZodOptional<z.ZodString>;
118
+ collector_upload_state: z.ZodOptional<z.ZodEnum<{
119
+ uploaded: "uploaded";
120
+ reused_existing: "reused_existing";
121
+ }>>;
122
+ source_sidecar_id: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$strict>>;
124
+ }, z.core.$strict>;
125
+ export type AgentImageArtifact = z.infer<typeof AgentImageArtifactSchema>;
126
+ export declare const AgentImageArtifactReportRequestSchema: z.ZodObject<{
127
+ schema_version: z.ZodLiteral<"ambient-agent-image-artifacts.v1">;
128
+ generated_at: z.ZodString;
129
+ provenance: z.ZodObject<{
130
+ capture_source: z.ZodEnum<{
131
+ unknown: "unknown";
132
+ codex_jsonl: "codex_jsonl";
133
+ codex_otel: "codex_otel";
134
+ car_state: "car_state";
135
+ git_state: "git_state";
136
+ github_state: "github_state";
137
+ linear_state: "linear_state";
138
+ mcp_local: "mcp_local";
139
+ claude_jsonl: "claude_jsonl";
140
+ claude_hooks: "claude_hooks";
141
+ manual_event: "manual_event";
142
+ collector_runtime: "collector_runtime";
143
+ }>;
144
+ capture_adapter_version: z.ZodString;
145
+ collector_version: z.ZodString;
146
+ repo: z.ZodString;
147
+ branch: z.ZodString;
148
+ repo_label: z.ZodOptional<z.ZodString>;
149
+ repo_fingerprint: z.ZodOptional<z.ZodString>;
150
+ repo_origin_url: z.ZodOptional<z.ZodString>;
151
+ worktree_label: z.ZodOptional<z.ZodString>;
152
+ worktree_fingerprint: z.ZodOptional<z.ZodString>;
153
+ worktree_is_primary: z.ZodOptional<z.ZodBoolean>;
154
+ operator_id: z.ZodString;
155
+ session_id: z.ZodString;
156
+ work_context_id: z.ZodString;
157
+ }, z.core.$strict>;
158
+ artifacts: z.ZodArray<z.ZodObject<{
159
+ storage_bucket: z.ZodLiteral<"ambient-raw-evidence">;
160
+ object_key: z.ZodString;
161
+ content_hash_sha256: z.ZodString;
162
+ byte_size: z.ZodNumber;
163
+ media_type: z.ZodEnum<{
164
+ "image/png": "image/png";
165
+ "image/jpeg": "image/jpeg";
166
+ }>;
167
+ width: z.ZodOptional<z.ZodNumber>;
168
+ height: z.ZodOptional<z.ZodNumber>;
169
+ perceptual_hash: z.ZodOptional<z.ZodString>;
170
+ operator_user_id: z.ZodOptional<z.ZodString>;
171
+ team_id: z.ZodOptional<z.ZodString>;
172
+ work_session_id: z.ZodOptional<z.ZodString>;
173
+ task_id: z.ZodOptional<z.ZodString>;
174
+ ticket_id: z.ZodOptional<z.ZodString>;
175
+ repo_fingerprint: z.ZodOptional<z.ZodString>;
176
+ worktree_fingerprint: z.ZodOptional<z.ZodString>;
177
+ artifact_id: z.ZodOptional<z.ZodString>;
178
+ raw_evidence_pointer_id: z.ZodString;
179
+ agent_source: z.ZodEnum<{
180
+ codex: "codex";
181
+ claude_code: "claude_code";
182
+ }>;
183
+ source_session_id: z.ZodString;
184
+ source_message_id: z.ZodOptional<z.ZodString>;
185
+ turn_index: z.ZodOptional<z.ZodNumber>;
186
+ occurred_at: z.ZodString;
187
+ artifact_kind: z.ZodDefault<z.ZodEnum<{
188
+ screenshot: "screenshot";
189
+ image_attachment: "image_attachment";
190
+ }>>;
191
+ capture_origin: z.ZodDefault<z.ZodEnum<{
192
+ agent_session_attachment: "agent_session_attachment";
193
+ }>>;
194
+ redaction_status: z.ZodDefault<z.ZodEnum<{
195
+ not_started: "not_started";
196
+ pending: "pending";
197
+ redacted: "redacted";
198
+ safe_for_metadata: "safe_for_metadata";
199
+ blocked: "blocked";
200
+ }>>;
201
+ ocr_status: z.ZodDefault<z.ZodEnum<{
202
+ not_started: "not_started";
203
+ pending: "pending";
204
+ completed: "completed";
205
+ failed: "failed";
206
+ skipped: "skipped";
207
+ }>>;
208
+ ocr_text_redacted: z.ZodOptional<z.ZodString>;
209
+ labels: z.ZodDefault<z.ZodObject<{
210
+ attachment_role: z.ZodOptional<z.ZodString>;
211
+ collector_upload_state: z.ZodOptional<z.ZodEnum<{
212
+ uploaded: "uploaded";
213
+ reused_existing: "reused_existing";
214
+ }>>;
215
+ source_sidecar_id: z.ZodOptional<z.ZodString>;
216
+ }, z.core.$strict>>;
217
+ }, z.core.$strict>>;
218
+ }, z.core.$strict>;
219
+ export type AgentImageArtifactReportRequest = z.infer<typeof AgentImageArtifactReportRequestSchema>;
220
+ export declare const AgentImageArtifactReportResponseSchema: z.ZodObject<{
221
+ ok: z.ZodLiteral<true>;
222
+ recorded_count: z.ZodNumber;
223
+ }, z.core.$strict>;
224
+ export type AgentImageArtifactReportResponse = z.infer<typeof AgentImageArtifactReportResponseSchema>;
@@ -0,0 +1,141 @@
1
+ import { z } from "zod";
2
+ import { CaptureProvenanceSchema, IsoDateTimeSchema, NonEmptyStringSchema, Sha256Schema, } from "./common.js";
3
+ export const AGENT_IMAGE_ARTIFACT_MAX_FILE_BYTES = 10 * 1024 * 1024;
4
+ export const AGENT_IMAGE_ARTIFACT_MAX_REPORT_ITEMS = 100;
5
+ const UuidSchema = z.string().uuid();
6
+ export const AgentArtifactSourceSchema = z.enum(["codex", "claude_code"]);
7
+ export const AgentArtifactKindSchema = z.enum([
8
+ "screenshot",
9
+ "image_attachment",
10
+ ]);
11
+ export const AgentArtifactCaptureOriginSchema = z.enum([
12
+ "agent_session_attachment",
13
+ ]);
14
+ export const AgentArtifactRedactionStatusSchema = z.enum([
15
+ "not_started",
16
+ "pending",
17
+ "redacted",
18
+ "safe_for_metadata",
19
+ "blocked",
20
+ ]);
21
+ export const AgentArtifactOcrStatusSchema = z.enum([
22
+ "not_started",
23
+ "pending",
24
+ "completed",
25
+ "failed",
26
+ "skipped",
27
+ ]);
28
+ export const AgentImageArtifactMediaTypeSchema = z.enum([
29
+ "image/png",
30
+ "image/jpeg",
31
+ ]);
32
+ export const AgentImageArtifactStorageBucketSchema = z.literal("ambient-raw-evidence");
33
+ const AgentImageArtifactLabelsSchema = z
34
+ .object({
35
+ attachment_role: NonEmptyStringSchema.max(160).optional(),
36
+ collector_upload_state: z
37
+ .enum(["uploaded", "reused_existing"])
38
+ .optional(),
39
+ source_sidecar_id: NonEmptyStringSchema.max(160).optional(),
40
+ })
41
+ .strict();
42
+ const AgentImageArtifactStorageMetadataShape = {
43
+ storage_bucket: AgentImageArtifactStorageBucketSchema,
44
+ object_key: NonEmptyStringSchema,
45
+ content_hash_sha256: Sha256Schema,
46
+ byte_size: z
47
+ .number()
48
+ .int()
49
+ .positive()
50
+ .max(AGENT_IMAGE_ARTIFACT_MAX_FILE_BYTES),
51
+ media_type: AgentImageArtifactMediaTypeSchema,
52
+ width: z.number().int().positive().optional(),
53
+ height: z.number().int().positive().optional(),
54
+ perceptual_hash: NonEmptyStringSchema.optional(),
55
+ };
56
+ export const AgentImageArtifactStorageMetadataSchema = z
57
+ .object(AgentImageArtifactStorageMetadataShape)
58
+ .strict()
59
+ .superRefine((metadata, context) => {
60
+ if ((metadata.width === undefined && metadata.height !== undefined) ||
61
+ (metadata.width !== undefined && metadata.height === undefined)) {
62
+ context.addIssue({
63
+ code: "custom",
64
+ message: "image dimensions must include both width and height",
65
+ path: metadata.width === undefined ? ["width"] : ["height"],
66
+ });
67
+ }
68
+ });
69
+ const AgentImageArtifactBindingShape = {
70
+ operator_user_id: UuidSchema.optional(),
71
+ team_id: UuidSchema.optional(),
72
+ work_session_id: UuidSchema.optional(),
73
+ task_id: UuidSchema.optional(),
74
+ ticket_id: NonEmptyStringSchema.max(80).optional(),
75
+ repo_fingerprint: NonEmptyStringSchema.max(160).optional(),
76
+ worktree_fingerprint: NonEmptyStringSchema.max(160).optional(),
77
+ };
78
+ export const AgentImageArtifactBindingSchema = z
79
+ .object(AgentImageArtifactBindingShape)
80
+ .strict();
81
+ export const AgentImageArtifactSchema = z
82
+ .object({
83
+ artifact_id: UuidSchema.optional(),
84
+ raw_evidence_pointer_id: NonEmptyStringSchema,
85
+ agent_source: AgentArtifactSourceSchema,
86
+ source_session_id: NonEmptyStringSchema.max(160),
87
+ source_message_id: NonEmptyStringSchema.max(240).optional(),
88
+ turn_index: z.number().int().nonnegative().optional(),
89
+ occurred_at: IsoDateTimeSchema,
90
+ artifact_kind: AgentArtifactKindSchema.default("image_attachment"),
91
+ capture_origin: AgentArtifactCaptureOriginSchema.default("agent_session_attachment"),
92
+ redaction_status: AgentArtifactRedactionStatusSchema.default("not_started"),
93
+ ocr_status: AgentArtifactOcrStatusSchema.default("not_started"),
94
+ ocr_text_redacted: z.string().trim().min(1).max(50000).optional(),
95
+ labels: AgentImageArtifactLabelsSchema.default({}),
96
+ ...AgentImageArtifactBindingShape,
97
+ ...AgentImageArtifactStorageMetadataShape,
98
+ })
99
+ .strict()
100
+ .superRefine((artifact, context) => {
101
+ if ((artifact.width === undefined && artifact.height !== undefined) ||
102
+ (artifact.width !== undefined && artifact.height === undefined)) {
103
+ context.addIssue({
104
+ code: "custom",
105
+ message: "image dimensions must include both width and height",
106
+ path: artifact.width === undefined ? ["width"] : ["height"],
107
+ });
108
+ }
109
+ if (artifact.ocr_text_redacted && artifact.ocr_status !== "completed") {
110
+ context.addIssue({
111
+ code: "custom",
112
+ message: "redacted OCR text requires completed OCR status",
113
+ path: ["ocr_status"],
114
+ });
115
+ }
116
+ if (artifact.ocr_text_redacted &&
117
+ !["redacted", "safe_for_metadata"].includes(artifact.redaction_status)) {
118
+ context.addIssue({
119
+ code: "custom",
120
+ message: "redacted OCR text requires redacted metadata status",
121
+ path: ["redaction_status"],
122
+ });
123
+ }
124
+ });
125
+ export const AgentImageArtifactReportRequestSchema = z
126
+ .object({
127
+ schema_version: z.literal("ambient-agent-image-artifacts.v1"),
128
+ generated_at: IsoDateTimeSchema,
129
+ provenance: CaptureProvenanceSchema,
130
+ artifacts: z
131
+ .array(AgentImageArtifactSchema)
132
+ .min(1)
133
+ .max(AGENT_IMAGE_ARTIFACT_MAX_REPORT_ITEMS),
134
+ })
135
+ .strict();
136
+ export const AgentImageArtifactReportResponseSchema = z
137
+ .object({
138
+ ok: z.literal(true),
139
+ recorded_count: z.number().int().nonnegative(),
140
+ })
141
+ .strict();
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ export declare const EvidenceCompletenessStatusSchema: z.ZodEnum<{
3
+ unknown: "unknown";
4
+ failed: "failed";
5
+ complete: "complete";
6
+ partial: "partial";
7
+ empty: "empty";
8
+ }>;
9
+ export type EvidenceCompletenessStatus = z.infer<typeof EvidenceCompletenessStatusSchema>;
10
+ export declare const EvidenceCompletenessSourceCountSchema: z.ZodObject<{
11
+ source: z.ZodString;
12
+ scanned_count: z.ZodNumber;
13
+ included_count: z.ZodNumber;
14
+ skipped_count: z.ZodNumber;
15
+ truncated_count: z.ZodNumber;
16
+ deferred_count: z.ZodNumber;
17
+ reused_count: z.ZodNumber;
18
+ }, z.core.$strict>;
19
+ export type EvidenceCompletenessSourceCount = z.infer<typeof EvidenceCompletenessSourceCountSchema>;
20
+ export declare const EvidenceCompletenessTotalsSchema: z.ZodObject<{
21
+ scanned_count: z.ZodNumber;
22
+ included_count: z.ZodNumber;
23
+ skipped_count: z.ZodNumber;
24
+ truncated_count: z.ZodNumber;
25
+ deferred_count: z.ZodNumber;
26
+ reused_count: z.ZodNumber;
27
+ }, z.core.$strict>;
28
+ export type EvidenceCompletenessTotals = z.infer<typeof EvidenceCompletenessTotalsSchema>;
29
+ export declare const EvidenceCompletenessCapSchema: z.ZodObject<{
30
+ source: z.ZodString;
31
+ cap_type: z.ZodString;
32
+ limit: z.ZodNumber;
33
+ observed: z.ZodOptional<z.ZodNumber>;
34
+ applied: z.ZodBoolean;
35
+ }, z.core.$strict>;
36
+ export type EvidenceCompletenessCap = z.infer<typeof EvidenceCompletenessCapSchema>;
37
+ export declare const EvidenceCompletenessSkipReasonSchema: z.ZodObject<{
38
+ source: z.ZodString;
39
+ reason: z.ZodString;
40
+ count: z.ZodNumber;
41
+ }, z.core.$strict>;
42
+ export type EvidenceCompletenessSkipReason = z.infer<typeof EvidenceCompletenessSkipReasonSchema>;
43
+ export declare const EvidenceCompletenessTruncationMarkerSchema: z.ZodObject<{
44
+ source: z.ZodString;
45
+ reason: z.ZodString;
46
+ count: z.ZodNumber;
47
+ max_bytes: z.ZodOptional<z.ZodNumber>;
48
+ observed_bytes: z.ZodOptional<z.ZodNumber>;
49
+ included_bytes: z.ZodOptional<z.ZodNumber>;
50
+ }, z.core.$strict>;
51
+ export type EvidenceCompletenessTruncationMarker = z.infer<typeof EvidenceCompletenessTruncationMarkerSchema>;
52
+ export declare const EvidenceCompletenessPayloadSchema: z.ZodObject<{
53
+ schema_version: z.ZodLiteral<"evidence-completeness.v1">;
54
+ status: z.ZodEnum<{
55
+ unknown: "unknown";
56
+ failed: "failed";
57
+ complete: "complete";
58
+ partial: "partial";
59
+ empty: "empty";
60
+ }>;
61
+ generated_at: z.ZodString;
62
+ scan_window: z.ZodObject<{
63
+ started_at: z.ZodString;
64
+ finished_at: z.ZodString;
65
+ since_minutes: z.ZodOptional<z.ZodNumber>;
66
+ }, z.core.$strict>;
67
+ source_counts: z.ZodDefault<z.ZodArray<z.ZodObject<{
68
+ source: z.ZodString;
69
+ scanned_count: z.ZodNumber;
70
+ included_count: z.ZodNumber;
71
+ skipped_count: z.ZodNumber;
72
+ truncated_count: z.ZodNumber;
73
+ deferred_count: z.ZodNumber;
74
+ reused_count: z.ZodNumber;
75
+ }, z.core.$strict>>>;
76
+ totals: z.ZodObject<{
77
+ scanned_count: z.ZodNumber;
78
+ included_count: z.ZodNumber;
79
+ skipped_count: z.ZodNumber;
80
+ truncated_count: z.ZodNumber;
81
+ deferred_count: z.ZodNumber;
82
+ reused_count: z.ZodNumber;
83
+ }, z.core.$strict>;
84
+ caps: z.ZodDefault<z.ZodArray<z.ZodObject<{
85
+ source: z.ZodString;
86
+ cap_type: z.ZodString;
87
+ limit: z.ZodNumber;
88
+ observed: z.ZodOptional<z.ZodNumber>;
89
+ applied: z.ZodBoolean;
90
+ }, z.core.$strict>>>;
91
+ skip_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
92
+ source: z.ZodString;
93
+ reason: z.ZodString;
94
+ count: z.ZodNumber;
95
+ }, z.core.$strict>>>;
96
+ truncation_markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
97
+ source: z.ZodString;
98
+ reason: z.ZodString;
99
+ count: z.ZodNumber;
100
+ max_bytes: z.ZodOptional<z.ZodNumber>;
101
+ observed_bytes: z.ZodOptional<z.ZodNumber>;
102
+ included_bytes: z.ZodOptional<z.ZodNumber>;
103
+ }, z.core.$strict>>>;
104
+ notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
105
+ }, z.core.$strict>;
106
+ export type EvidenceCompletenessPayload = z.infer<typeof EvidenceCompletenessPayloadSchema>;
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ import { IsoDateTimeSchema, NonEmptyStringSchema } from "./common.js";
3
+ const EvidenceCountSchema = z.number().int().nonnegative();
4
+ export const EvidenceCompletenessStatusSchema = z.enum([
5
+ "complete",
6
+ "partial",
7
+ "empty",
8
+ "failed",
9
+ "unknown",
10
+ ]);
11
+ export const EvidenceCompletenessSourceCountSchema = z
12
+ .object({
13
+ source: NonEmptyStringSchema,
14
+ scanned_count: EvidenceCountSchema,
15
+ included_count: EvidenceCountSchema,
16
+ skipped_count: EvidenceCountSchema,
17
+ truncated_count: EvidenceCountSchema,
18
+ deferred_count: EvidenceCountSchema,
19
+ reused_count: EvidenceCountSchema,
20
+ })
21
+ .strict();
22
+ export const EvidenceCompletenessTotalsSchema = EvidenceCompletenessSourceCountSchema.omit({ source: true }).strict();
23
+ export const EvidenceCompletenessCapSchema = z
24
+ .object({
25
+ source: NonEmptyStringSchema,
26
+ cap_type: NonEmptyStringSchema,
27
+ limit: EvidenceCountSchema,
28
+ observed: EvidenceCountSchema.optional(),
29
+ applied: z.boolean(),
30
+ })
31
+ .strict();
32
+ export const EvidenceCompletenessSkipReasonSchema = z
33
+ .object({
34
+ source: NonEmptyStringSchema,
35
+ reason: NonEmptyStringSchema,
36
+ count: EvidenceCountSchema,
37
+ })
38
+ .strict();
39
+ export const EvidenceCompletenessTruncationMarkerSchema = z
40
+ .object({
41
+ source: NonEmptyStringSchema,
42
+ reason: NonEmptyStringSchema,
43
+ count: EvidenceCountSchema,
44
+ max_bytes: EvidenceCountSchema.optional(),
45
+ observed_bytes: EvidenceCountSchema.optional(),
46
+ included_bytes: EvidenceCountSchema.optional(),
47
+ })
48
+ .strict();
49
+ export const EvidenceCompletenessPayloadSchema = z
50
+ .object({
51
+ schema_version: z.literal("evidence-completeness.v1"),
52
+ status: EvidenceCompletenessStatusSchema,
53
+ generated_at: IsoDateTimeSchema,
54
+ scan_window: z
55
+ .object({
56
+ started_at: IsoDateTimeSchema,
57
+ finished_at: IsoDateTimeSchema,
58
+ since_minutes: EvidenceCountSchema.optional(),
59
+ })
60
+ .strict(),
61
+ source_counts: z.array(EvidenceCompletenessSourceCountSchema).default([]),
62
+ totals: EvidenceCompletenessTotalsSchema,
63
+ caps: z.array(EvidenceCompletenessCapSchema).default([]),
64
+ skip_reasons: z.array(EvidenceCompletenessSkipReasonSchema).default([]),
65
+ truncation_markers: z
66
+ .array(EvidenceCompletenessTruncationMarkerSchema)
67
+ .default([]),
68
+ notes: z.array(NonEmptyStringSchema.max(160)).default([]),
69
+ })
70
+ .strict();
@@ -265,10 +265,10 @@ export type RawEvidenceUploadCommitResponse = z.infer<typeof RawEvidenceUploadCo
265
265
  * pack or silently dropped. No content-bearing fields are allowed.
266
266
  */
267
267
  export declare const CodexSessionAttributionStateSchema: z.ZodEnum<{
268
+ skipped: "skipped";
268
269
  attributed: "attributed";
269
270
  ambiguous: "ambiguous";
270
271
  unattributed: "unattributed";
271
- skipped: "skipped";
272
272
  }>;
273
273
  export type CodexSessionAttributionState = z.infer<typeof CodexSessionAttributionStateSchema>;
274
274
  export declare const CodexSessionUploadStateSchema: z.ZodEnum<{
@@ -297,10 +297,10 @@ export declare const CodexSessionAttributionSchema: z.ZodObject<{
297
297
  }>>;
298
298
  observed_at: z.ZodString;
299
299
  attribution_state: z.ZodEnum<{
300
+ skipped: "skipped";
300
301
  attributed: "attributed";
301
302
  ambiguous: "ambiguous";
302
303
  unattributed: "unattributed";
303
- skipped: "skipped";
304
304
  }>;
305
305
  attribution_reason: z.ZodString;
306
306
  attribution_score: z.ZodOptional<z.ZodNumber>;
@@ -364,10 +364,10 @@ export declare const CodexSessionAttributionReportRequestSchema: z.ZodObject<{
364
364
  }>>;
365
365
  observed_at: z.ZodString;
366
366
  attribution_state: z.ZodEnum<{
367
+ skipped: "skipped";
367
368
  attributed: "attributed";
368
369
  ambiguous: "ambiguous";
369
370
  unattributed: "unattributed";
370
- skipped: "skipped";
371
371
  }>;
372
372
  attribution_reason: z.ZodString;
373
373
  attribution_score: z.ZodOptional<z.ZodNumber>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ export * from "./agent-artifacts.js";
1
2
  export * from "./common.js";
3
+ export * from "./evidence-completeness.js";
2
4
  export * from "./evidence-upload.js";
3
5
  export * from "./ingest-dto.js";
4
6
  export * from "./local-config.js";
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
+ export * from "./agent-artifacts.js";
1
2
  export * from "./common.js";
3
+ export * from "./evidence-completeness.js";
2
4
  export * from "./evidence-upload.js";
3
5
  export * from "./ingest-dto.js";
4
6
  export * from "./local-config.js";
@@ -74,8 +74,8 @@ export declare const TelemetryIngestEventDtoSchema: z.ZodObject<{
74
74
  remote_durable_raw_evidence: "remote_durable_raw_evidence";
75
75
  }>;
76
76
  redaction_status: z.ZodEnum<{
77
- metadata_only: "metadata_only";
78
77
  redacted: "redacted";
78
+ metadata_only: "metadata_only";
79
79
  raw_local_only: "raw_local_only";
80
80
  raw_remote_short_retention: "raw_remote_short_retention";
81
81
  raw_remote_durable: "raw_remote_durable";
@@ -88,6 +88,60 @@ export declare const TelemetryIngestEventDtoSchema: z.ZodObject<{
88
88
  redacted_summary: z.ZodOptional<z.ZodString>;
89
89
  metrics: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
90
90
  attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>>>;
91
+ evidence_completeness: z.ZodOptional<z.ZodObject<{
92
+ schema_version: z.ZodLiteral<"evidence-completeness.v1">;
93
+ status: z.ZodEnum<{
94
+ unknown: "unknown";
95
+ failed: "failed";
96
+ complete: "complete";
97
+ partial: "partial";
98
+ empty: "empty";
99
+ }>;
100
+ generated_at: z.ZodString;
101
+ scan_window: z.ZodObject<{
102
+ started_at: z.ZodString;
103
+ finished_at: z.ZodString;
104
+ since_minutes: z.ZodOptional<z.ZodNumber>;
105
+ }, z.core.$strict>;
106
+ source_counts: z.ZodDefault<z.ZodArray<z.ZodObject<{
107
+ source: z.ZodString;
108
+ scanned_count: z.ZodNumber;
109
+ included_count: z.ZodNumber;
110
+ skipped_count: z.ZodNumber;
111
+ truncated_count: z.ZodNumber;
112
+ deferred_count: z.ZodNumber;
113
+ reused_count: z.ZodNumber;
114
+ }, z.core.$strict>>>;
115
+ totals: z.ZodObject<{
116
+ scanned_count: z.ZodNumber;
117
+ included_count: z.ZodNumber;
118
+ skipped_count: z.ZodNumber;
119
+ truncated_count: z.ZodNumber;
120
+ deferred_count: z.ZodNumber;
121
+ reused_count: z.ZodNumber;
122
+ }, z.core.$strict>;
123
+ caps: z.ZodDefault<z.ZodArray<z.ZodObject<{
124
+ source: z.ZodString;
125
+ cap_type: z.ZodString;
126
+ limit: z.ZodNumber;
127
+ observed: z.ZodOptional<z.ZodNumber>;
128
+ applied: z.ZodBoolean;
129
+ }, z.core.$strict>>>;
130
+ skip_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
131
+ source: z.ZodString;
132
+ reason: z.ZodString;
133
+ count: z.ZodNumber;
134
+ }, z.core.$strict>>>;
135
+ truncation_markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
136
+ source: z.ZodString;
137
+ reason: z.ZodString;
138
+ count: z.ZodNumber;
139
+ max_bytes: z.ZodOptional<z.ZodNumber>;
140
+ observed_bytes: z.ZodOptional<z.ZodNumber>;
141
+ included_bytes: z.ZodOptional<z.ZodNumber>;
142
+ }, z.core.$strict>>>;
143
+ notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
144
+ }, z.core.$strict>>;
91
145
  ticket_binding: z.ZodOptional<z.ZodObject<{
92
146
  ticket_id: z.ZodString;
93
147
  binding_source: z.ZodEnum<{
@@ -305,6 +359,50 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
305
359
  evidence_labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
306
360
  external_url: z.ZodOptional<z.ZodString>;
307
361
  }, z.core.$strict>>>;
362
+ topic_label: z.ZodOptional<z.ZodString>;
363
+ topic_summary_redacted: z.ZodOptional<z.ZodString>;
364
+ work_intent: z.ZodOptional<z.ZodEnum<{
365
+ unknown: "unknown";
366
+ implementation: "implementation";
367
+ bug_fix: "bug_fix";
368
+ root_cause_analysis: "root_cause_analysis";
369
+ planning: "planning";
370
+ discovery: "discovery";
371
+ review: "review";
372
+ testing: "testing";
373
+ documentation: "documentation";
374
+ release: "release";
375
+ learning: "learning";
376
+ coordination: "coordination";
377
+ maintenance: "maintenance";
378
+ analysis: "analysis";
379
+ other: "other";
380
+ }>>;
381
+ work_phase: z.ZodOptional<z.ZodEnum<{
382
+ unknown: "unknown";
383
+ implementation: "implementation";
384
+ planning: "planning";
385
+ discovery: "discovery";
386
+ review: "review";
387
+ testing: "testing";
388
+ documentation: "documentation";
389
+ release: "release";
390
+ analysis: "analysis";
391
+ other: "other";
392
+ debugging: "debugging";
393
+ handoff: "handoff";
394
+ }>>;
395
+ intent_source: z.ZodOptional<z.ZodEnum<{
396
+ unknown: "unknown";
397
+ explicit_user: "explicit_user";
398
+ linear_ticket: "linear_ticket";
399
+ git_branch: "git_branch";
400
+ collector_heuristic: "collector_heuristic";
401
+ agent_heuristic: "agent_heuristic";
402
+ llm_inference: "llm_inference";
403
+ manual: "manual";
404
+ }>>;
405
+ intent_confidence: z.ZodOptional<z.ZodNumber>;
308
406
  pull_request_url: z.ZodOptional<z.ZodString>;
309
407
  provenance: z.ZodOptional<z.ZodObject<{
310
408
  capture_source: z.ZodEnum<{
@@ -397,8 +495,8 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
397
495
  remote_durable_raw_evidence: "remote_durable_raw_evidence";
398
496
  }>;
399
497
  redaction_status: z.ZodEnum<{
400
- metadata_only: "metadata_only";
401
498
  redacted: "redacted";
499
+ metadata_only: "metadata_only";
402
500
  raw_local_only: "raw_local_only";
403
501
  raw_remote_short_retention: "raw_remote_short_retention";
404
502
  raw_remote_durable: "raw_remote_durable";
@@ -411,6 +509,60 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
411
509
  redacted_summary: z.ZodOptional<z.ZodString>;
412
510
  metrics: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
413
511
  attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>>>;
512
+ evidence_completeness: z.ZodOptional<z.ZodObject<{
513
+ schema_version: z.ZodLiteral<"evidence-completeness.v1">;
514
+ status: z.ZodEnum<{
515
+ unknown: "unknown";
516
+ failed: "failed";
517
+ complete: "complete";
518
+ partial: "partial";
519
+ empty: "empty";
520
+ }>;
521
+ generated_at: z.ZodString;
522
+ scan_window: z.ZodObject<{
523
+ started_at: z.ZodString;
524
+ finished_at: z.ZodString;
525
+ since_minutes: z.ZodOptional<z.ZodNumber>;
526
+ }, z.core.$strict>;
527
+ source_counts: z.ZodDefault<z.ZodArray<z.ZodObject<{
528
+ source: z.ZodString;
529
+ scanned_count: z.ZodNumber;
530
+ included_count: z.ZodNumber;
531
+ skipped_count: z.ZodNumber;
532
+ truncated_count: z.ZodNumber;
533
+ deferred_count: z.ZodNumber;
534
+ reused_count: z.ZodNumber;
535
+ }, z.core.$strict>>>;
536
+ totals: z.ZodObject<{
537
+ scanned_count: z.ZodNumber;
538
+ included_count: z.ZodNumber;
539
+ skipped_count: z.ZodNumber;
540
+ truncated_count: z.ZodNumber;
541
+ deferred_count: z.ZodNumber;
542
+ reused_count: z.ZodNumber;
543
+ }, z.core.$strict>;
544
+ caps: z.ZodDefault<z.ZodArray<z.ZodObject<{
545
+ source: z.ZodString;
546
+ cap_type: z.ZodString;
547
+ limit: z.ZodNumber;
548
+ observed: z.ZodOptional<z.ZodNumber>;
549
+ applied: z.ZodBoolean;
550
+ }, z.core.$strict>>>;
551
+ skip_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
552
+ source: z.ZodString;
553
+ reason: z.ZodString;
554
+ count: z.ZodNumber;
555
+ }, z.core.$strict>>>;
556
+ truncation_markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
557
+ source: z.ZodString;
558
+ reason: z.ZodString;
559
+ count: z.ZodNumber;
560
+ max_bytes: z.ZodOptional<z.ZodNumber>;
561
+ observed_bytes: z.ZodOptional<z.ZodNumber>;
562
+ included_bytes: z.ZodOptional<z.ZodNumber>;
563
+ }, z.core.$strict>>>;
564
+ notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
565
+ }, z.core.$strict>>;
414
566
  ticket_binding: z.ZodOptional<z.ZodObject<{
415
567
  ticket_id: z.ZodString;
416
568
  binding_source: z.ZodEnum<{
@@ -590,10 +742,10 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
590
742
  }, z.core.$strict>;
591
743
  work_context_id: z.ZodOptional<z.ZodString>;
592
744
  status: z.ZodEnum<{
593
- ok: "ok";
745
+ failed: "failed";
594
746
  skipped: "skipped";
747
+ ok: "ok";
595
748
  partial: "partial";
596
- failed: "failed";
597
749
  }>;
598
750
  started_at: z.ZodString;
599
751
  finished_at: z.ZodOptional<z.ZodString>;
@@ -611,8 +763,8 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
611
763
  remote_durable_raw_evidence: "remote_durable_raw_evidence";
612
764
  }>;
613
765
  redaction_status: z.ZodEnum<{
614
- metadata_only: "metadata_only";
615
766
  redacted: "redacted";
767
+ metadata_only: "metadata_only";
616
768
  raw_local_only: "raw_local_only";
617
769
  raw_remote_short_retention: "raw_remote_short_retention";
618
770
  raw_remote_durable: "raw_remote_durable";
@@ -5,6 +5,7 @@ import { PrivacyClassificationSchema, RawEvidencePointerSchema, RedactionMetadat
5
5
  import { RiskFlagSchema } from "./risk-flags.js";
6
6
  import { SourceScanResultSchema } from "./source-adapter.js";
7
7
  import { ExternalTraceSinkPointerSchema, NormalizedOtelTelemetrySchema, } from "./trace-sink.js";
8
+ import { EvidenceCompletenessPayloadSchema } from "./evidence-completeness.js";
8
9
  import { LocalWorkContextSchema, TicketBindingCandidateSchema, } from "./work-context.js";
9
10
  export const TelemetryEventTypeSchema = z.enum([
10
11
  "session_started",
@@ -30,6 +31,7 @@ export const TelemetryIngestEventDtoSchema = z
30
31
  redacted_summary: z.string().trim().min(1).max(4000).optional(),
31
32
  metrics: z.record(z.string(), z.number()).default({}),
32
33
  attributes: JsonAttributeRecordSchema.default({}),
34
+ evidence_completeness: EvidenceCompletenessPayloadSchema.optional(),
33
35
  ticket_binding: TicketBindingCandidateSchema.optional(),
34
36
  risk_flags: z.array(RiskFlagSchema).default([]),
35
37
  raw_evidence_pointers: z.array(RawEvidencePointerSchema).default([]),
package/dist/privacy.d.ts CHANGED
@@ -77,8 +77,8 @@ export declare const RedactionMetadataSchema: z.ZodObject<{
77
77
  remote_durable_raw_evidence: "remote_durable_raw_evidence";
78
78
  }>;
79
79
  redaction_status: z.ZodEnum<{
80
- metadata_only: "metadata_only";
81
80
  redacted: "redacted";
81
+ metadata_only: "metadata_only";
82
82
  raw_local_only: "raw_local_only";
83
83
  raw_remote_short_retention: "raw_remote_short_retention";
84
84
  raw_remote_durable: "raw_remote_durable";
@@ -31,8 +31,8 @@ export declare const SourceScanEventSummarySchema: z.ZodObject<{
31
31
  remote_durable_raw_evidence: "remote_durable_raw_evidence";
32
32
  }>;
33
33
  redaction_status: z.ZodEnum<{
34
- metadata_only: "metadata_only";
35
34
  redacted: "redacted";
35
+ metadata_only: "metadata_only";
36
36
  raw_local_only: "raw_local_only";
37
37
  raw_remote_short_retention: "raw_remote_short_retention";
38
38
  raw_remote_durable: "raw_remote_durable";
@@ -98,10 +98,10 @@ export declare const SourceScanResultSchema: z.ZodObject<{
98
98
  }, z.core.$strict>;
99
99
  work_context_id: z.ZodOptional<z.ZodString>;
100
100
  status: z.ZodEnum<{
101
- ok: "ok";
101
+ failed: "failed";
102
102
  skipped: "skipped";
103
+ ok: "ok";
103
104
  partial: "partial";
104
- failed: "failed";
105
105
  }>;
106
106
  started_at: z.ZodString;
107
107
  finished_at: z.ZodOptional<z.ZodString>;
@@ -119,8 +119,8 @@ export declare const SourceScanResultSchema: z.ZodObject<{
119
119
  remote_durable_raw_evidence: "remote_durable_raw_evidence";
120
120
  }>;
121
121
  redaction_status: z.ZodEnum<{
122
- metadata_only: "metadata_only";
123
122
  redacted: "redacted";
123
+ metadata_only: "metadata_only";
124
124
  raw_local_only: "raw_local_only";
125
125
  raw_remote_short_retention: "raw_remote_short_retention";
126
126
  raw_remote_durable: "raw_remote_durable";
@@ -25,6 +25,50 @@ export declare const TicketBindingCandidateSchema: z.ZodObject<{
25
25
  external_url: z.ZodOptional<z.ZodString>;
26
26
  }, z.core.$strict>;
27
27
  export type TicketBindingCandidate = z.infer<typeof TicketBindingCandidateSchema>;
28
+ export declare const WorkIntentSchema: z.ZodEnum<{
29
+ unknown: "unknown";
30
+ implementation: "implementation";
31
+ bug_fix: "bug_fix";
32
+ root_cause_analysis: "root_cause_analysis";
33
+ planning: "planning";
34
+ discovery: "discovery";
35
+ review: "review";
36
+ testing: "testing";
37
+ documentation: "documentation";
38
+ release: "release";
39
+ learning: "learning";
40
+ coordination: "coordination";
41
+ maintenance: "maintenance";
42
+ analysis: "analysis";
43
+ other: "other";
44
+ }>;
45
+ export type WorkIntent = z.infer<typeof WorkIntentSchema>;
46
+ export declare const WorkPhaseSchema: z.ZodEnum<{
47
+ unknown: "unknown";
48
+ implementation: "implementation";
49
+ planning: "planning";
50
+ discovery: "discovery";
51
+ review: "review";
52
+ testing: "testing";
53
+ documentation: "documentation";
54
+ release: "release";
55
+ analysis: "analysis";
56
+ other: "other";
57
+ debugging: "debugging";
58
+ handoff: "handoff";
59
+ }>;
60
+ export type WorkPhase = z.infer<typeof WorkPhaseSchema>;
61
+ export declare const IntentSourceSchema: z.ZodEnum<{
62
+ unknown: "unknown";
63
+ explicit_user: "explicit_user";
64
+ linear_ticket: "linear_ticket";
65
+ git_branch: "git_branch";
66
+ collector_heuristic: "collector_heuristic";
67
+ agent_heuristic: "agent_heuristic";
68
+ llm_inference: "llm_inference";
69
+ manual: "manual";
70
+ }>;
71
+ export type IntentSource = z.infer<typeof IntentSourceSchema>;
28
72
  export declare const LocalWorkContextSchema: z.ZodObject<{
29
73
  work_context_id: z.ZodString;
30
74
  repo: z.ZodString;
@@ -56,6 +100,50 @@ export declare const LocalWorkContextSchema: z.ZodObject<{
56
100
  evidence_labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
57
101
  external_url: z.ZodOptional<z.ZodString>;
58
102
  }, z.core.$strict>>>;
103
+ topic_label: z.ZodOptional<z.ZodString>;
104
+ topic_summary_redacted: z.ZodOptional<z.ZodString>;
105
+ work_intent: z.ZodOptional<z.ZodEnum<{
106
+ unknown: "unknown";
107
+ implementation: "implementation";
108
+ bug_fix: "bug_fix";
109
+ root_cause_analysis: "root_cause_analysis";
110
+ planning: "planning";
111
+ discovery: "discovery";
112
+ review: "review";
113
+ testing: "testing";
114
+ documentation: "documentation";
115
+ release: "release";
116
+ learning: "learning";
117
+ coordination: "coordination";
118
+ maintenance: "maintenance";
119
+ analysis: "analysis";
120
+ other: "other";
121
+ }>>;
122
+ work_phase: z.ZodOptional<z.ZodEnum<{
123
+ unknown: "unknown";
124
+ implementation: "implementation";
125
+ planning: "planning";
126
+ discovery: "discovery";
127
+ review: "review";
128
+ testing: "testing";
129
+ documentation: "documentation";
130
+ release: "release";
131
+ analysis: "analysis";
132
+ other: "other";
133
+ debugging: "debugging";
134
+ handoff: "handoff";
135
+ }>>;
136
+ intent_source: z.ZodOptional<z.ZodEnum<{
137
+ unknown: "unknown";
138
+ explicit_user: "explicit_user";
139
+ linear_ticket: "linear_ticket";
140
+ git_branch: "git_branch";
141
+ collector_heuristic: "collector_heuristic";
142
+ agent_heuristic: "agent_heuristic";
143
+ llm_inference: "llm_inference";
144
+ manual: "manual";
145
+ }>>;
146
+ intent_confidence: z.ZodOptional<z.ZodNumber>;
59
147
  pull_request_url: z.ZodOptional<z.ZodString>;
60
148
  provenance: z.ZodOptional<z.ZodObject<{
61
149
  capture_source: z.ZodEnum<{
@@ -18,6 +18,47 @@ export const TicketBindingCandidateSchema = z
18
18
  external_url: z.string().url().optional(),
19
19
  })
20
20
  .strict();
21
+ export const WorkIntentSchema = z.enum([
22
+ "implementation",
23
+ "bug_fix",
24
+ "root_cause_analysis",
25
+ "planning",
26
+ "discovery",
27
+ "review",
28
+ "testing",
29
+ "documentation",
30
+ "release",
31
+ "learning",
32
+ "coordination",
33
+ "maintenance",
34
+ "analysis",
35
+ "unknown",
36
+ "other",
37
+ ]);
38
+ export const WorkPhaseSchema = z.enum([
39
+ "planning",
40
+ "discovery",
41
+ "implementation",
42
+ "debugging",
43
+ "review",
44
+ "testing",
45
+ "documentation",
46
+ "release",
47
+ "handoff",
48
+ "analysis",
49
+ "unknown",
50
+ "other",
51
+ ]);
52
+ export const IntentSourceSchema = z.enum([
53
+ "explicit_user",
54
+ "linear_ticket",
55
+ "git_branch",
56
+ "collector_heuristic",
57
+ "agent_heuristic",
58
+ "llm_inference",
59
+ "manual",
60
+ "unknown",
61
+ ]);
21
62
  export const LocalWorkContextSchema = z
22
63
  .object({
23
64
  work_context_id: NonEmptyStringSchema,
@@ -38,6 +79,12 @@ export const LocalWorkContextSchema = z
38
79
  ticket_binding_candidates: z
39
80
  .array(TicketBindingCandidateSchema)
40
81
  .default([]),
82
+ topic_label: NonEmptyStringSchema.max(120).optional(),
83
+ topic_summary_redacted: z.string().trim().min(1).max(500).optional(),
84
+ work_intent: WorkIntentSchema.optional(),
85
+ work_phase: WorkPhaseSchema.optional(),
86
+ intent_source: IntentSourceSchema.optional(),
87
+ intent_confidence: z.number().min(0).max(1).optional(),
41
88
  pull_request_url: z.string().url().optional(),
42
89
  provenance: CaptureProvenanceSchema.optional(),
43
90
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bli-cockpit/telemetry-core",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",