@bli-cockpit/telemetry-core 0.1.5 → 0.1.7
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/evidence-completeness.d.ts +123 -0
- package/dist/evidence-completeness.js +102 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ingest-dto.d.ts +168 -0
- package/dist/ingest-dto.js +30 -0
- package/dist/secret-guards.js +7 -0
- package/dist/work-context.d.ts +88 -0
- package/dist/work-context.js +47 -0
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
unavailable: "unavailable";
|
|
9
|
+
}>;
|
|
10
|
+
export type EvidenceCompletenessStatus = z.infer<typeof EvidenceCompletenessStatusSchema>;
|
|
11
|
+
export declare const EvidenceCompletenessSourceCountSchema: z.ZodObject<{
|
|
12
|
+
source: z.ZodString;
|
|
13
|
+
scanned_count: z.ZodNumber;
|
|
14
|
+
included_count: z.ZodNumber;
|
|
15
|
+
skipped_count: z.ZodNumber;
|
|
16
|
+
truncated_count: z.ZodNumber;
|
|
17
|
+
deferred_count: z.ZodNumber;
|
|
18
|
+
reused_count: z.ZodNumber;
|
|
19
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type EvidenceCompletenessSourceCount = z.infer<typeof EvidenceCompletenessSourceCountSchema>;
|
|
22
|
+
export declare const EvidenceCompletenessTotalsSchema: z.ZodObject<{
|
|
23
|
+
scanned_count: z.ZodNumber;
|
|
24
|
+
included_count: z.ZodNumber;
|
|
25
|
+
skipped_count: z.ZodNumber;
|
|
26
|
+
truncated_count: z.ZodNumber;
|
|
27
|
+
deferred_count: z.ZodNumber;
|
|
28
|
+
reused_count: z.ZodNumber;
|
|
29
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type EvidenceCompletenessTotals = z.infer<typeof EvidenceCompletenessTotalsSchema>;
|
|
32
|
+
export declare const EvidenceCompletenessCapSchema: z.ZodObject<{
|
|
33
|
+
source: z.ZodString;
|
|
34
|
+
cap_type: z.ZodString;
|
|
35
|
+
limit: z.ZodNumber;
|
|
36
|
+
observed: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
applied: z.ZodBoolean;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type EvidenceCompletenessCap = z.infer<typeof EvidenceCompletenessCapSchema>;
|
|
40
|
+
export declare const EvidenceCompletenessSkipReasonSchema: z.ZodObject<{
|
|
41
|
+
source: z.ZodString;
|
|
42
|
+
reason: z.ZodString;
|
|
43
|
+
count: z.ZodNumber;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type EvidenceCompletenessSkipReason = z.infer<typeof EvidenceCompletenessSkipReasonSchema>;
|
|
46
|
+
export declare const EvidenceCompletenessFailureReasonSchema: z.ZodObject<{
|
|
47
|
+
source: z.ZodString;
|
|
48
|
+
reason: z.ZodString;
|
|
49
|
+
count: z.ZodNumber;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export type EvidenceCompletenessFailureReason = z.infer<typeof EvidenceCompletenessFailureReasonSchema>;
|
|
52
|
+
export declare const EvidenceCompletenessTruncationMarkerSchema: z.ZodObject<{
|
|
53
|
+
source: z.ZodString;
|
|
54
|
+
reason: z.ZodString;
|
|
55
|
+
count: z.ZodNumber;
|
|
56
|
+
max_bytes: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
observed_bytes: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
included_bytes: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export type EvidenceCompletenessTruncationMarker = z.infer<typeof EvidenceCompletenessTruncationMarkerSchema>;
|
|
61
|
+
export declare const EvidenceCompletenessPayloadSchema: z.ZodObject<{
|
|
62
|
+
schema_version: z.ZodLiteral<"evidence-completeness.v1">;
|
|
63
|
+
status: z.ZodEnum<{
|
|
64
|
+
unknown: "unknown";
|
|
65
|
+
failed: "failed";
|
|
66
|
+
complete: "complete";
|
|
67
|
+
partial: "partial";
|
|
68
|
+
empty: "empty";
|
|
69
|
+
unavailable: "unavailable";
|
|
70
|
+
}>;
|
|
71
|
+
generated_at: z.ZodString;
|
|
72
|
+
scan_window: z.ZodObject<{
|
|
73
|
+
started_at: z.ZodString;
|
|
74
|
+
finished_at: z.ZodString;
|
|
75
|
+
since_minutes: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
source_counts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
78
|
+
source: z.ZodString;
|
|
79
|
+
scanned_count: z.ZodNumber;
|
|
80
|
+
included_count: z.ZodNumber;
|
|
81
|
+
skipped_count: z.ZodNumber;
|
|
82
|
+
truncated_count: z.ZodNumber;
|
|
83
|
+
deferred_count: z.ZodNumber;
|
|
84
|
+
reused_count: z.ZodNumber;
|
|
85
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
86
|
+
}, z.core.$strict>>>;
|
|
87
|
+
totals: z.ZodObject<{
|
|
88
|
+
scanned_count: z.ZodNumber;
|
|
89
|
+
included_count: z.ZodNumber;
|
|
90
|
+
skipped_count: z.ZodNumber;
|
|
91
|
+
truncated_count: z.ZodNumber;
|
|
92
|
+
deferred_count: z.ZodNumber;
|
|
93
|
+
reused_count: z.ZodNumber;
|
|
94
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
caps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
97
|
+
source: z.ZodString;
|
|
98
|
+
cap_type: z.ZodString;
|
|
99
|
+
limit: z.ZodNumber;
|
|
100
|
+
observed: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
applied: z.ZodBoolean;
|
|
102
|
+
}, z.core.$strict>>>;
|
|
103
|
+
skip_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
104
|
+
source: z.ZodString;
|
|
105
|
+
reason: z.ZodString;
|
|
106
|
+
count: z.ZodNumber;
|
|
107
|
+
}, z.core.$strict>>>;
|
|
108
|
+
failure_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
109
|
+
source: z.ZodString;
|
|
110
|
+
reason: z.ZodString;
|
|
111
|
+
count: z.ZodNumber;
|
|
112
|
+
}, z.core.$strict>>>;
|
|
113
|
+
truncation_markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
114
|
+
source: z.ZodString;
|
|
115
|
+
reason: z.ZodString;
|
|
116
|
+
count: z.ZodNumber;
|
|
117
|
+
max_bytes: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
observed_bytes: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
included_bytes: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
}, z.core.$strict>>>;
|
|
121
|
+
notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
export type EvidenceCompletenessPayload = z.infer<typeof EvidenceCompletenessPayloadSchema>;
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
"unavailable",
|
|
10
|
+
"unknown",
|
|
11
|
+
]);
|
|
12
|
+
export const EvidenceCompletenessSourceCountSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
source: NonEmptyStringSchema,
|
|
15
|
+
scanned_count: EvidenceCountSchema,
|
|
16
|
+
included_count: EvidenceCountSchema,
|
|
17
|
+
skipped_count: EvidenceCountSchema,
|
|
18
|
+
truncated_count: EvidenceCountSchema,
|
|
19
|
+
deferred_count: EvidenceCountSchema,
|
|
20
|
+
reused_count: EvidenceCountSchema,
|
|
21
|
+
failed_count: EvidenceCountSchema.default(0),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
export const EvidenceCompletenessTotalsSchema = EvidenceCompletenessSourceCountSchema.omit({ source: true }).strict();
|
|
25
|
+
export const EvidenceCompletenessCapSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
source: NonEmptyStringSchema,
|
|
28
|
+
cap_type: NonEmptyStringSchema,
|
|
29
|
+
limit: EvidenceCountSchema,
|
|
30
|
+
observed: EvidenceCountSchema.optional(),
|
|
31
|
+
applied: z.boolean(),
|
|
32
|
+
})
|
|
33
|
+
.strict();
|
|
34
|
+
export const EvidenceCompletenessSkipReasonSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
source: NonEmptyStringSchema,
|
|
37
|
+
reason: NonEmptyStringSchema,
|
|
38
|
+
count: EvidenceCountSchema,
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
export const EvidenceCompletenessFailureReasonSchema = EvidenceCompletenessSkipReasonSchema;
|
|
42
|
+
export const EvidenceCompletenessTruncationMarkerSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
source: NonEmptyStringSchema,
|
|
45
|
+
reason: NonEmptyStringSchema,
|
|
46
|
+
count: EvidenceCountSchema,
|
|
47
|
+
max_bytes: EvidenceCountSchema.optional(),
|
|
48
|
+
observed_bytes: EvidenceCountSchema.optional(),
|
|
49
|
+
included_bytes: EvidenceCountSchema.optional(),
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
export const EvidenceCompletenessPayloadSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
schema_version: z.literal("evidence-completeness.v1"),
|
|
55
|
+
status: EvidenceCompletenessStatusSchema,
|
|
56
|
+
generated_at: IsoDateTimeSchema,
|
|
57
|
+
scan_window: z
|
|
58
|
+
.object({
|
|
59
|
+
started_at: IsoDateTimeSchema,
|
|
60
|
+
finished_at: IsoDateTimeSchema,
|
|
61
|
+
since_minutes: EvidenceCountSchema.optional(),
|
|
62
|
+
})
|
|
63
|
+
.strict(),
|
|
64
|
+
source_counts: z.array(EvidenceCompletenessSourceCountSchema).default([]),
|
|
65
|
+
totals: EvidenceCompletenessTotalsSchema,
|
|
66
|
+
caps: z.array(EvidenceCompletenessCapSchema).default([]),
|
|
67
|
+
skip_reasons: z.array(EvidenceCompletenessSkipReasonSchema).default([]),
|
|
68
|
+
failure_reasons: z
|
|
69
|
+
.array(EvidenceCompletenessFailureReasonSchema)
|
|
70
|
+
.default([]),
|
|
71
|
+
truncation_markers: z
|
|
72
|
+
.array(EvidenceCompletenessTruncationMarkerSchema)
|
|
73
|
+
.default([]),
|
|
74
|
+
notes: z.array(NonEmptyStringSchema.max(160)).default([]),
|
|
75
|
+
})
|
|
76
|
+
.strict()
|
|
77
|
+
.superRefine((payload, context) => {
|
|
78
|
+
const hasGap = payload.totals.skipped_count > 0 ||
|
|
79
|
+
payload.totals.truncated_count > 0 ||
|
|
80
|
+
payload.totals.deferred_count > 0 ||
|
|
81
|
+
payload.totals.failed_count > 0 ||
|
|
82
|
+
payload.caps.some((cap) => cap.applied) ||
|
|
83
|
+
payload.skip_reasons.length > 0 ||
|
|
84
|
+
payload.failure_reasons.length > 0 ||
|
|
85
|
+
payload.truncation_markers.length > 0;
|
|
86
|
+
if (payload.status === "complete" && hasGap) {
|
|
87
|
+
context.addIssue({
|
|
88
|
+
code: "custom",
|
|
89
|
+
message: "complete evidence completeness cannot include skips, caps, truncations, deferrals, or failures",
|
|
90
|
+
path: ["status"],
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (payload.status === "failed" &&
|
|
94
|
+
payload.totals.failed_count === 0 &&
|
|
95
|
+
payload.failure_reasons.length === 0) {
|
|
96
|
+
context.addIssue({
|
|
97
|
+
code: "custom",
|
|
98
|
+
message: "failed evidence completeness must include a failed count or failure reason",
|
|
99
|
+
path: ["failure_reasons"],
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/ingest-dto.d.ts
CHANGED
|
@@ -88,6 +88,68 @@ 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
|
+
unavailable: "unavailable";
|
|
100
|
+
}>;
|
|
101
|
+
generated_at: z.ZodString;
|
|
102
|
+
scan_window: z.ZodObject<{
|
|
103
|
+
started_at: z.ZodString;
|
|
104
|
+
finished_at: z.ZodString;
|
|
105
|
+
since_minutes: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
source_counts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
108
|
+
source: z.ZodString;
|
|
109
|
+
scanned_count: z.ZodNumber;
|
|
110
|
+
included_count: z.ZodNumber;
|
|
111
|
+
skipped_count: z.ZodNumber;
|
|
112
|
+
truncated_count: z.ZodNumber;
|
|
113
|
+
deferred_count: z.ZodNumber;
|
|
114
|
+
reused_count: z.ZodNumber;
|
|
115
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
116
|
+
}, z.core.$strict>>>;
|
|
117
|
+
totals: z.ZodObject<{
|
|
118
|
+
scanned_count: z.ZodNumber;
|
|
119
|
+
included_count: z.ZodNumber;
|
|
120
|
+
skipped_count: z.ZodNumber;
|
|
121
|
+
truncated_count: z.ZodNumber;
|
|
122
|
+
deferred_count: z.ZodNumber;
|
|
123
|
+
reused_count: z.ZodNumber;
|
|
124
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
125
|
+
}, z.core.$strict>;
|
|
126
|
+
caps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
127
|
+
source: z.ZodString;
|
|
128
|
+
cap_type: z.ZodString;
|
|
129
|
+
limit: z.ZodNumber;
|
|
130
|
+
observed: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
applied: z.ZodBoolean;
|
|
132
|
+
}, z.core.$strict>>>;
|
|
133
|
+
skip_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
134
|
+
source: z.ZodString;
|
|
135
|
+
reason: z.ZodString;
|
|
136
|
+
count: z.ZodNumber;
|
|
137
|
+
}, z.core.$strict>>>;
|
|
138
|
+
failure_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
139
|
+
source: z.ZodString;
|
|
140
|
+
reason: z.ZodString;
|
|
141
|
+
count: z.ZodNumber;
|
|
142
|
+
}, z.core.$strict>>>;
|
|
143
|
+
truncation_markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
144
|
+
source: z.ZodString;
|
|
145
|
+
reason: z.ZodString;
|
|
146
|
+
count: z.ZodNumber;
|
|
147
|
+
max_bytes: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
observed_bytes: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
included_bytes: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
}, z.core.$strict>>>;
|
|
151
|
+
notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
152
|
+
}, z.core.$strict>>;
|
|
91
153
|
ticket_binding: z.ZodOptional<z.ZodObject<{
|
|
92
154
|
ticket_id: z.ZodString;
|
|
93
155
|
binding_source: z.ZodEnum<{
|
|
@@ -305,6 +367,50 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
|
|
|
305
367
|
evidence_labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
306
368
|
external_url: z.ZodOptional<z.ZodString>;
|
|
307
369
|
}, z.core.$strict>>>;
|
|
370
|
+
topic_label: z.ZodOptional<z.ZodString>;
|
|
371
|
+
topic_summary_redacted: z.ZodOptional<z.ZodString>;
|
|
372
|
+
work_intent: z.ZodOptional<z.ZodEnum<{
|
|
373
|
+
unknown: "unknown";
|
|
374
|
+
implementation: "implementation";
|
|
375
|
+
bug_fix: "bug_fix";
|
|
376
|
+
root_cause_analysis: "root_cause_analysis";
|
|
377
|
+
planning: "planning";
|
|
378
|
+
discovery: "discovery";
|
|
379
|
+
review: "review";
|
|
380
|
+
testing: "testing";
|
|
381
|
+
documentation: "documentation";
|
|
382
|
+
release: "release";
|
|
383
|
+
learning: "learning";
|
|
384
|
+
coordination: "coordination";
|
|
385
|
+
maintenance: "maintenance";
|
|
386
|
+
analysis: "analysis";
|
|
387
|
+
other: "other";
|
|
388
|
+
}>>;
|
|
389
|
+
work_phase: z.ZodOptional<z.ZodEnum<{
|
|
390
|
+
unknown: "unknown";
|
|
391
|
+
implementation: "implementation";
|
|
392
|
+
planning: "planning";
|
|
393
|
+
discovery: "discovery";
|
|
394
|
+
review: "review";
|
|
395
|
+
testing: "testing";
|
|
396
|
+
documentation: "documentation";
|
|
397
|
+
release: "release";
|
|
398
|
+
analysis: "analysis";
|
|
399
|
+
other: "other";
|
|
400
|
+
debugging: "debugging";
|
|
401
|
+
handoff: "handoff";
|
|
402
|
+
}>>;
|
|
403
|
+
intent_source: z.ZodOptional<z.ZodEnum<{
|
|
404
|
+
unknown: "unknown";
|
|
405
|
+
explicit_user: "explicit_user";
|
|
406
|
+
linear_ticket: "linear_ticket";
|
|
407
|
+
git_branch: "git_branch";
|
|
408
|
+
collector_heuristic: "collector_heuristic";
|
|
409
|
+
agent_heuristic: "agent_heuristic";
|
|
410
|
+
llm_inference: "llm_inference";
|
|
411
|
+
manual: "manual";
|
|
412
|
+
}>>;
|
|
413
|
+
intent_confidence: z.ZodOptional<z.ZodNumber>;
|
|
308
414
|
pull_request_url: z.ZodOptional<z.ZodString>;
|
|
309
415
|
provenance: z.ZodOptional<z.ZodObject<{
|
|
310
416
|
capture_source: z.ZodEnum<{
|
|
@@ -411,6 +517,68 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
|
|
|
411
517
|
redacted_summary: z.ZodOptional<z.ZodString>;
|
|
412
518
|
metrics: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
413
519
|
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]>>]>>>;
|
|
520
|
+
evidence_completeness: z.ZodOptional<z.ZodObject<{
|
|
521
|
+
schema_version: z.ZodLiteral<"evidence-completeness.v1">;
|
|
522
|
+
status: z.ZodEnum<{
|
|
523
|
+
unknown: "unknown";
|
|
524
|
+
failed: "failed";
|
|
525
|
+
complete: "complete";
|
|
526
|
+
partial: "partial";
|
|
527
|
+
empty: "empty";
|
|
528
|
+
unavailable: "unavailable";
|
|
529
|
+
}>;
|
|
530
|
+
generated_at: z.ZodString;
|
|
531
|
+
scan_window: z.ZodObject<{
|
|
532
|
+
started_at: z.ZodString;
|
|
533
|
+
finished_at: z.ZodString;
|
|
534
|
+
since_minutes: z.ZodOptional<z.ZodNumber>;
|
|
535
|
+
}, z.core.$strict>;
|
|
536
|
+
source_counts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
537
|
+
source: z.ZodString;
|
|
538
|
+
scanned_count: z.ZodNumber;
|
|
539
|
+
included_count: z.ZodNumber;
|
|
540
|
+
skipped_count: z.ZodNumber;
|
|
541
|
+
truncated_count: z.ZodNumber;
|
|
542
|
+
deferred_count: z.ZodNumber;
|
|
543
|
+
reused_count: z.ZodNumber;
|
|
544
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
545
|
+
}, z.core.$strict>>>;
|
|
546
|
+
totals: z.ZodObject<{
|
|
547
|
+
scanned_count: z.ZodNumber;
|
|
548
|
+
included_count: z.ZodNumber;
|
|
549
|
+
skipped_count: z.ZodNumber;
|
|
550
|
+
truncated_count: z.ZodNumber;
|
|
551
|
+
deferred_count: z.ZodNumber;
|
|
552
|
+
reused_count: z.ZodNumber;
|
|
553
|
+
failed_count: z.ZodDefault<z.ZodNumber>;
|
|
554
|
+
}, z.core.$strict>;
|
|
555
|
+
caps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
556
|
+
source: z.ZodString;
|
|
557
|
+
cap_type: z.ZodString;
|
|
558
|
+
limit: z.ZodNumber;
|
|
559
|
+
observed: z.ZodOptional<z.ZodNumber>;
|
|
560
|
+
applied: z.ZodBoolean;
|
|
561
|
+
}, z.core.$strict>>>;
|
|
562
|
+
skip_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
563
|
+
source: z.ZodString;
|
|
564
|
+
reason: z.ZodString;
|
|
565
|
+
count: z.ZodNumber;
|
|
566
|
+
}, z.core.$strict>>>;
|
|
567
|
+
failure_reasons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
568
|
+
source: z.ZodString;
|
|
569
|
+
reason: z.ZodString;
|
|
570
|
+
count: z.ZodNumber;
|
|
571
|
+
}, z.core.$strict>>>;
|
|
572
|
+
truncation_markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
573
|
+
source: z.ZodString;
|
|
574
|
+
reason: z.ZodString;
|
|
575
|
+
count: z.ZodNumber;
|
|
576
|
+
max_bytes: z.ZodOptional<z.ZodNumber>;
|
|
577
|
+
observed_bytes: z.ZodOptional<z.ZodNumber>;
|
|
578
|
+
included_bytes: z.ZodOptional<z.ZodNumber>;
|
|
579
|
+
}, z.core.$strict>>>;
|
|
580
|
+
notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
581
|
+
}, z.core.$strict>>;
|
|
414
582
|
ticket_binding: z.ZodOptional<z.ZodObject<{
|
|
415
583
|
ticket_id: z.ZodString;
|
|
416
584
|
binding_source: z.ZodEnum<{
|
package/dist/ingest-dto.js
CHANGED
|
@@ -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([]),
|
|
@@ -45,6 +47,34 @@ export const TelemetryIngestEventDtoSchema = z
|
|
|
45
47
|
path: ["redaction", "privacy_classification"],
|
|
46
48
|
});
|
|
47
49
|
}
|
|
50
|
+
const summaryStatus = event.attributes["evidence_completeness_status"];
|
|
51
|
+
const summarySchemaVersion = event.attributes["evidence_completeness_schema_version"];
|
|
52
|
+
if (event.evidence_completeness) {
|
|
53
|
+
if (summaryStatus !== undefined &&
|
|
54
|
+
summaryStatus !== event.evidence_completeness.status) {
|
|
55
|
+
context.addIssue({
|
|
56
|
+
code: "custom",
|
|
57
|
+
message: "evidence completeness status attribute must match payload",
|
|
58
|
+
path: ["attributes", "evidence_completeness_status"],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (summarySchemaVersion !== undefined &&
|
|
62
|
+
summarySchemaVersion !== event.evidence_completeness.schema_version) {
|
|
63
|
+
context.addIssue({
|
|
64
|
+
code: "custom",
|
|
65
|
+
message: "evidence completeness schema version attribute must match payload",
|
|
66
|
+
path: ["attributes", "evidence_completeness_schema_version"],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (typeof summaryStatus === "string" &&
|
|
71
|
+
summaryStatus !== "unknown") {
|
|
72
|
+
context.addIssue({
|
|
73
|
+
code: "custom",
|
|
74
|
+
message: "typed evidence completeness payload is required when status is known",
|
|
75
|
+
path: ["evidence_completeness"],
|
|
76
|
+
});
|
|
77
|
+
}
|
|
48
78
|
});
|
|
49
79
|
export const TelemetryIngestEnvelopeSchema = z
|
|
50
80
|
.object({
|
package/dist/secret-guards.js
CHANGED
|
@@ -29,6 +29,9 @@ export function isSecretLikePathSegment(value) {
|
|
|
29
29
|
// this source file (the public-package pack scanner bans it as a content
|
|
30
30
|
// pattern, just as the original guard did).
|
|
31
31
|
const PRIVILEGED_SUPABASE_KEY_NAME = ["SUPABASE", "SERVICE", "ROLE", "KEY"].join("_");
|
|
32
|
+
const SUPABASE_SERVICE_ROLE_NAME = ["SUPABASE", "SERVICE", "ROLE"].join("_");
|
|
33
|
+
const OPENAI_KEY_NAME = ["OPENAI", "API", "KEY"].join("_");
|
|
34
|
+
const MEM0_KEY_NAME = ["MEM0", "API", "KEY"].join("_");
|
|
32
35
|
/**
|
|
33
36
|
* Credential names that are only a leak when assigned a value (D13). The value
|
|
34
37
|
* shape mirrors the long-standing generic pattern: an assignment operator
|
|
@@ -39,6 +42,9 @@ const PRIVILEGED_SUPABASE_KEY_NAME = ["SUPABASE", "SERVICE", "ROLE", "KEY"].join
|
|
|
39
42
|
const SECRET_NAME_WITH_VALUE_PATTERN = new RegExp(`\\b(?:${[
|
|
40
43
|
"(?:NEXT_PUBLIC_)?SUPABASE_ANON_KEY",
|
|
41
44
|
PRIVILEGED_SUPABASE_KEY_NAME,
|
|
45
|
+
SUPABASE_SERVICE_ROLE_NAME,
|
|
46
|
+
OPENAI_KEY_NAME,
|
|
47
|
+
MEM0_KEY_NAME,
|
|
42
48
|
"SERVICE[_\\s-]?ROLE(?:[_\\s-]?KEY)?",
|
|
43
49
|
"LANGFUSE_(?:PUBLIC|SECRET)_KEY",
|
|
44
50
|
"api[_-]?key",
|
|
@@ -65,6 +71,7 @@ const SECRET_VALUE_PATTERNS = [
|
|
|
65
71
|
/\bxox[baprs]-[A-Za-z0-9-]{16,}/,
|
|
66
72
|
/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/,
|
|
67
73
|
/\b(?:pk|sk)-lf-[A-Za-z0-9_-]{16,}\b/i,
|
|
74
|
+
/\bm0[-_][A-Za-z0-9_-]{16,}\b/i,
|
|
68
75
|
];
|
|
69
76
|
const SECRET_LIKE_CONTENT_PATTERNS = [
|
|
70
77
|
SECRET_NAME_WITH_VALUE_PATTERN,
|
package/dist/work-context.d.ts
CHANGED
|
@@ -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<{
|
package/dist/work-context.js
CHANGED
|
@@ -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
|
})
|