@bli-cockpit/telemetry-core 0.1.0
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/README.md +8 -0
- package/dist/common.d.ts +45 -0
- package/dist/common.js +41 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/ingest-dto.d.ts +677 -0
- package/dist/ingest-dto.js +59 -0
- package/dist/local-config.d.ts +72 -0
- package/dist/local-config.js +46 -0
- package/dist/paths.d.ts +22 -0
- package/dist/paths.js +66 -0
- package/dist/privacy.d.ts +80 -0
- package/dist/privacy.js +110 -0
- package/dist/risk-flags.d.ts +102 -0
- package/dist/risk-flags.js +46 -0
- package/dist/source-adapter.d.ts +235 -0
- package/dist/source-adapter.js +37 -0
- package/dist/trace-sink.d.ts +58 -0
- package/dist/trace-sink.js +35 -0
- package/dist/work-context.d.ts +76 -0
- package/dist/work-context.js +37 -0
- package/package.json +38 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SourceAdapterIdentitySchema: z.ZodObject<{
|
|
3
|
+
capture_source: z.ZodEnum<{
|
|
4
|
+
unknown: "unknown";
|
|
5
|
+
codex_jsonl: "codex_jsonl";
|
|
6
|
+
codex_otel: "codex_otel";
|
|
7
|
+
car_state: "car_state";
|
|
8
|
+
git_state: "git_state";
|
|
9
|
+
github_state: "github_state";
|
|
10
|
+
linear_state: "linear_state";
|
|
11
|
+
mcp_local: "mcp_local";
|
|
12
|
+
claude_hooks: "claude_hooks";
|
|
13
|
+
manual_event: "manual_event";
|
|
14
|
+
collector_runtime: "collector_runtime";
|
|
15
|
+
}>;
|
|
16
|
+
adapter_name: z.ZodString;
|
|
17
|
+
capture_adapter_version: z.ZodString;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export type SourceAdapterIdentity = z.infer<typeof SourceAdapterIdentitySchema>;
|
|
20
|
+
export declare const SourceScanEventSummarySchema: z.ZodObject<{
|
|
21
|
+
source_event_id: z.ZodString;
|
|
22
|
+
event_type: z.ZodString;
|
|
23
|
+
occurred_at: z.ZodOptional<z.ZodString>;
|
|
24
|
+
redaction: z.ZodObject<{
|
|
25
|
+
privacy_classification: z.ZodEnum<{
|
|
26
|
+
metadata: "metadata";
|
|
27
|
+
redacted_summary: "redacted_summary";
|
|
28
|
+
local_only_raw_evidence: "local_only_raw_evidence";
|
|
29
|
+
remote_short_retention_raw_evidence: "remote_short_retention_raw_evidence";
|
|
30
|
+
}>;
|
|
31
|
+
redaction_status: z.ZodEnum<{
|
|
32
|
+
metadata_only: "metadata_only";
|
|
33
|
+
redacted: "redacted";
|
|
34
|
+
raw_local_only: "raw_local_only";
|
|
35
|
+
raw_remote_short_retention: "raw_remote_short_retention";
|
|
36
|
+
}>;
|
|
37
|
+
redacted_fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
38
|
+
raw_evidence_pointer_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
39
|
+
content_hash_sha256: z.ZodOptional<z.ZodString>;
|
|
40
|
+
redacted_summary: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
raw_evidence_pointers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
43
|
+
raw_evidence_pointer_id: z.ZodString;
|
|
44
|
+
privacy_classification: z.ZodEnum<{
|
|
45
|
+
local_only_raw_evidence: "local_only_raw_evidence";
|
|
46
|
+
remote_short_retention_raw_evidence: "remote_short_retention_raw_evidence";
|
|
47
|
+
}>;
|
|
48
|
+
retention_policy: z.ZodObject<{
|
|
49
|
+
mode: z.ZodEnum<{
|
|
50
|
+
local_only: "local_only";
|
|
51
|
+
remote_short_retention: "remote_short_retention";
|
|
52
|
+
}>;
|
|
53
|
+
privacy_classification: z.ZodEnum<{
|
|
54
|
+
local_only_raw_evidence: "local_only_raw_evidence";
|
|
55
|
+
remote_short_retention_raw_evidence: "remote_short_retention_raw_evidence";
|
|
56
|
+
}>;
|
|
57
|
+
remote_retention_days: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
storage_scope: z.ZodEnum<{
|
|
61
|
+
local_file: "local_file";
|
|
62
|
+
remote_object: "remote_object";
|
|
63
|
+
}>;
|
|
64
|
+
local_path: z.ZodOptional<z.ZodString>;
|
|
65
|
+
object_key: z.ZodOptional<z.ZodString>;
|
|
66
|
+
content_hash_sha256: z.ZodOptional<z.ZodString>;
|
|
67
|
+
byte_size: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
media_type: z.ZodOptional<z.ZodString>;
|
|
69
|
+
redacted_summary: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strict>>>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export type SourceScanEventSummary = z.infer<typeof SourceScanEventSummarySchema>;
|
|
73
|
+
export declare const SourceScanResultSchema: z.ZodObject<{
|
|
74
|
+
adapter: z.ZodObject<{
|
|
75
|
+
capture_source: z.ZodEnum<{
|
|
76
|
+
unknown: "unknown";
|
|
77
|
+
codex_jsonl: "codex_jsonl";
|
|
78
|
+
codex_otel: "codex_otel";
|
|
79
|
+
car_state: "car_state";
|
|
80
|
+
git_state: "git_state";
|
|
81
|
+
github_state: "github_state";
|
|
82
|
+
linear_state: "linear_state";
|
|
83
|
+
mcp_local: "mcp_local";
|
|
84
|
+
claude_hooks: "claude_hooks";
|
|
85
|
+
manual_event: "manual_event";
|
|
86
|
+
collector_runtime: "collector_runtime";
|
|
87
|
+
}>;
|
|
88
|
+
adapter_name: z.ZodString;
|
|
89
|
+
capture_adapter_version: z.ZodString;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
work_context_id: z.ZodOptional<z.ZodString>;
|
|
92
|
+
status: z.ZodEnum<{
|
|
93
|
+
ok: "ok";
|
|
94
|
+
partial: "partial";
|
|
95
|
+
skipped: "skipped";
|
|
96
|
+
failed: "failed";
|
|
97
|
+
}>;
|
|
98
|
+
started_at: z.ZodString;
|
|
99
|
+
finished_at: z.ZodOptional<z.ZodString>;
|
|
100
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
101
|
+
events: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
102
|
+
source_event_id: z.ZodString;
|
|
103
|
+
event_type: z.ZodString;
|
|
104
|
+
occurred_at: z.ZodOptional<z.ZodString>;
|
|
105
|
+
redaction: z.ZodObject<{
|
|
106
|
+
privacy_classification: z.ZodEnum<{
|
|
107
|
+
metadata: "metadata";
|
|
108
|
+
redacted_summary: "redacted_summary";
|
|
109
|
+
local_only_raw_evidence: "local_only_raw_evidence";
|
|
110
|
+
remote_short_retention_raw_evidence: "remote_short_retention_raw_evidence";
|
|
111
|
+
}>;
|
|
112
|
+
redaction_status: z.ZodEnum<{
|
|
113
|
+
metadata_only: "metadata_only";
|
|
114
|
+
redacted: "redacted";
|
|
115
|
+
raw_local_only: "raw_local_only";
|
|
116
|
+
raw_remote_short_retention: "raw_remote_short_retention";
|
|
117
|
+
}>;
|
|
118
|
+
redacted_fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
119
|
+
raw_evidence_pointer_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
120
|
+
content_hash_sha256: z.ZodOptional<z.ZodString>;
|
|
121
|
+
redacted_summary: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
raw_evidence_pointers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
124
|
+
raw_evidence_pointer_id: z.ZodString;
|
|
125
|
+
privacy_classification: z.ZodEnum<{
|
|
126
|
+
local_only_raw_evidence: "local_only_raw_evidence";
|
|
127
|
+
remote_short_retention_raw_evidence: "remote_short_retention_raw_evidence";
|
|
128
|
+
}>;
|
|
129
|
+
retention_policy: z.ZodObject<{
|
|
130
|
+
mode: z.ZodEnum<{
|
|
131
|
+
local_only: "local_only";
|
|
132
|
+
remote_short_retention: "remote_short_retention";
|
|
133
|
+
}>;
|
|
134
|
+
privacy_classification: z.ZodEnum<{
|
|
135
|
+
local_only_raw_evidence: "local_only_raw_evidence";
|
|
136
|
+
remote_short_retention_raw_evidence: "remote_short_retention_raw_evidence";
|
|
137
|
+
}>;
|
|
138
|
+
remote_retention_days: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
storage_scope: z.ZodEnum<{
|
|
142
|
+
local_file: "local_file";
|
|
143
|
+
remote_object: "remote_object";
|
|
144
|
+
}>;
|
|
145
|
+
local_path: z.ZodOptional<z.ZodString>;
|
|
146
|
+
object_key: z.ZodOptional<z.ZodString>;
|
|
147
|
+
content_hash_sha256: z.ZodOptional<z.ZodString>;
|
|
148
|
+
byte_size: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
media_type: z.ZodOptional<z.ZodString>;
|
|
150
|
+
redacted_summary: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strict>>>;
|
|
152
|
+
}, z.core.$strict>>>;
|
|
153
|
+
ticket_binding_candidates: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
154
|
+
ticket_id: z.ZodString;
|
|
155
|
+
binding_source: z.ZodEnum<{
|
|
156
|
+
active_work_context: "active_work_context";
|
|
157
|
+
branch_name: "branch_name";
|
|
158
|
+
linear_assignment: "linear_assignment";
|
|
159
|
+
car_ticket: "car_ticket";
|
|
160
|
+
github_pr: "github_pr";
|
|
161
|
+
mcp_context: "mcp_context";
|
|
162
|
+
manual_picker: "manual_picker";
|
|
163
|
+
}>;
|
|
164
|
+
confidence: z.ZodNumber;
|
|
165
|
+
evidence_labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
166
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strict>>>;
|
|
168
|
+
risk_flags: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
169
|
+
risk_flag_id: z.ZodString;
|
|
170
|
+
risk_type: z.ZodEnum<{
|
|
171
|
+
no_plan_signal_before_large_edit: "no_plan_signal_before_large_edit";
|
|
172
|
+
p1_or_p2_review_finding: "p1_or_p2_review_finding";
|
|
173
|
+
many_add_revert_loops: "many_add_revert_loops";
|
|
174
|
+
repeated_same_tool_input_shape: "repeated_same_tool_input_shape";
|
|
175
|
+
tool_call_loop: "tool_call_loop";
|
|
176
|
+
file_thrash_same_path: "file_thrash_same_path";
|
|
177
|
+
context_window_pressure: "context_window_pressure";
|
|
178
|
+
permission_denied_spike: "permission_denied_spike";
|
|
179
|
+
high_token_or_time_burn_no_pr: "high_token_or_time_burn_no_pr";
|
|
180
|
+
stuck_for_30_minutes: "stuck_for_30_minutes";
|
|
181
|
+
repeated_same_failing_command: "repeated_same_failing_command";
|
|
182
|
+
branch_ticket_mismatch: "branch_ticket_mismatch";
|
|
183
|
+
collector_stale: "collector_stale";
|
|
184
|
+
}>;
|
|
185
|
+
severity: z.ZodEnum<{
|
|
186
|
+
info: "info";
|
|
187
|
+
warning: "warning";
|
|
188
|
+
high: "high";
|
|
189
|
+
}>;
|
|
190
|
+
observed_at: z.ZodString;
|
|
191
|
+
evidence_labels: z.ZodArray<z.ZodEnum<{
|
|
192
|
+
missing_plan_signal: "missing_plan_signal";
|
|
193
|
+
large_edit: "large_edit";
|
|
194
|
+
p1_review_finding: "p1_review_finding";
|
|
195
|
+
p2_review_finding: "p2_review_finding";
|
|
196
|
+
add_revert_loop: "add_revert_loop";
|
|
197
|
+
same_tool_input_shape: "same_tool_input_shape";
|
|
198
|
+
tool_call_loop_window: "tool_call_loop_window";
|
|
199
|
+
same_path_churn: "same_path_churn";
|
|
200
|
+
token_pressure: "token_pressure";
|
|
201
|
+
permission_denied: "permission_denied";
|
|
202
|
+
approval_denied: "approval_denied";
|
|
203
|
+
no_pr_after_work: "no_pr_after_work";
|
|
204
|
+
idle_or_stuck_duration: "idle_or_stuck_duration";
|
|
205
|
+
same_failing_command: "same_failing_command";
|
|
206
|
+
branch_ticket_disagreement: "branch_ticket_disagreement";
|
|
207
|
+
collector_last_seen_stale: "collector_last_seen_stale";
|
|
208
|
+
}>>;
|
|
209
|
+
evidence_pointer_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
210
|
+
provenance: z.ZodObject<{
|
|
211
|
+
capture_source: z.ZodEnum<{
|
|
212
|
+
unknown: "unknown";
|
|
213
|
+
codex_jsonl: "codex_jsonl";
|
|
214
|
+
codex_otel: "codex_otel";
|
|
215
|
+
car_state: "car_state";
|
|
216
|
+
git_state: "git_state";
|
|
217
|
+
github_state: "github_state";
|
|
218
|
+
linear_state: "linear_state";
|
|
219
|
+
mcp_local: "mcp_local";
|
|
220
|
+
claude_hooks: "claude_hooks";
|
|
221
|
+
manual_event: "manual_event";
|
|
222
|
+
collector_runtime: "collector_runtime";
|
|
223
|
+
}>;
|
|
224
|
+
capture_adapter_version: z.ZodString;
|
|
225
|
+
collector_version: z.ZodString;
|
|
226
|
+
repo: z.ZodString;
|
|
227
|
+
branch: z.ZodString;
|
|
228
|
+
operator_id: z.ZodString;
|
|
229
|
+
session_id: z.ZodString;
|
|
230
|
+
work_context_id: z.ZodString;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
}, z.core.$strict>>>;
|
|
233
|
+
diagnostic_labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
234
|
+
}, z.core.$strict>;
|
|
235
|
+
export type SourceScanResult = z.infer<typeof SourceScanResultSchema>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CaptureSourceSchema, IsoDateTimeSchema, NonEmptyStringSchema, VersionStringSchema, } from "./common.js";
|
|
3
|
+
import { RawEvidencePointerSchema, RedactionMetadataSchema } from "./privacy.js";
|
|
4
|
+
import { RiskFlagSchema } from "./risk-flags.js";
|
|
5
|
+
import { TicketBindingCandidateSchema } from "./work-context.js";
|
|
6
|
+
export const SourceAdapterIdentitySchema = z
|
|
7
|
+
.object({
|
|
8
|
+
capture_source: CaptureSourceSchema,
|
|
9
|
+
adapter_name: NonEmptyStringSchema,
|
|
10
|
+
capture_adapter_version: VersionStringSchema,
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
export const SourceScanEventSummarySchema = z
|
|
14
|
+
.object({
|
|
15
|
+
source_event_id: NonEmptyStringSchema,
|
|
16
|
+
event_type: NonEmptyStringSchema,
|
|
17
|
+
occurred_at: IsoDateTimeSchema.optional(),
|
|
18
|
+
redaction: RedactionMetadataSchema,
|
|
19
|
+
raw_evidence_pointers: z.array(RawEvidencePointerSchema).default([]),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
export const SourceScanResultSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
adapter: SourceAdapterIdentitySchema,
|
|
25
|
+
work_context_id: NonEmptyStringSchema.optional(),
|
|
26
|
+
status: z.enum(["ok", "partial", "skipped", "failed"]),
|
|
27
|
+
started_at: IsoDateTimeSchema,
|
|
28
|
+
finished_at: IsoDateTimeSchema.optional(),
|
|
29
|
+
cursor: NonEmptyStringSchema.optional(),
|
|
30
|
+
events: z.array(SourceScanEventSummarySchema).default([]),
|
|
31
|
+
ticket_binding_candidates: z
|
|
32
|
+
.array(TicketBindingCandidateSchema)
|
|
33
|
+
.default([]),
|
|
34
|
+
risk_flags: z.array(RiskFlagSchema).default([]),
|
|
35
|
+
diagnostic_labels: z.array(NonEmptyStringSchema).default([]),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { TelemetryIngestEnvelope } from "./ingest-dto.js";
|
|
3
|
+
export declare const NormalizedOtelTelemetrySchema: z.ZodObject<{
|
|
4
|
+
trace_id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
span_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
parent_span_id: z.ZodOptional<z.ZodString>;
|
|
7
|
+
span_name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
span_kind: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
internal: "internal";
|
|
10
|
+
server: "server";
|
|
11
|
+
client: "client";
|
|
12
|
+
producer: "producer";
|
|
13
|
+
consumer: "consumer";
|
|
14
|
+
}>>;
|
|
15
|
+
log_severity: z.ZodOptional<z.ZodString>;
|
|
16
|
+
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]>>]>>>;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
export type NormalizedOtelTelemetry = z.infer<typeof NormalizedOtelTelemetrySchema>;
|
|
19
|
+
export declare const ExternalTraceSinkProviderSchema: z.ZodEnum<{
|
|
20
|
+
custom: "custom";
|
|
21
|
+
otel_collector: "otel_collector";
|
|
22
|
+
langfuse: "langfuse";
|
|
23
|
+
phoenix: "phoenix";
|
|
24
|
+
datadog: "datadog";
|
|
25
|
+
honeycomb: "honeycomb";
|
|
26
|
+
}>;
|
|
27
|
+
export type ExternalTraceSinkProvider = z.infer<typeof ExternalTraceSinkProviderSchema>;
|
|
28
|
+
export declare const ExternalTraceSinkPointerSchema: z.ZodObject<{
|
|
29
|
+
provider: z.ZodEnum<{
|
|
30
|
+
custom: "custom";
|
|
31
|
+
otel_collector: "otel_collector";
|
|
32
|
+
langfuse: "langfuse";
|
|
33
|
+
phoenix: "phoenix";
|
|
34
|
+
datadog: "datadog";
|
|
35
|
+
honeycomb: "honeycomb";
|
|
36
|
+
}>;
|
|
37
|
+
trace_id: z.ZodOptional<z.ZodString>;
|
|
38
|
+
span_id: z.ZodOptional<z.ZodString>;
|
|
39
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
40
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
41
|
+
exported_at: z.ZodOptional<z.ZodString>;
|
|
42
|
+
privacy_classification: z.ZodDefault<z.ZodEnum<{
|
|
43
|
+
metadata: "metadata";
|
|
44
|
+
redacted_summary: "redacted_summary";
|
|
45
|
+
local_only_raw_evidence: "local_only_raw_evidence";
|
|
46
|
+
remote_short_retention_raw_evidence: "remote_short_retention_raw_evidence";
|
|
47
|
+
}>>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
export type ExternalTraceSinkPointer = z.infer<typeof ExternalTraceSinkPointerSchema>;
|
|
50
|
+
export interface TraceSinkWriteResult {
|
|
51
|
+
accepted_event_count: number;
|
|
52
|
+
pointer?: ExternalTraceSinkPointer;
|
|
53
|
+
}
|
|
54
|
+
export interface TraceSink {
|
|
55
|
+
readonly sink_id: string;
|
|
56
|
+
readonly provider: ExternalTraceSinkProvider;
|
|
57
|
+
writeEnvelope(envelope: TelemetryIngestEnvelope): Promise<TraceSinkWriteResult>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { IsoDateTimeSchema, JsonAttributeRecordSchema, NonEmptyStringSchema, } from "./common.js";
|
|
3
|
+
import { PrivacyClassificationSchema } from "./privacy.js";
|
|
4
|
+
export const NormalizedOtelTelemetrySchema = z
|
|
5
|
+
.object({
|
|
6
|
+
trace_id: NonEmptyStringSchema.optional(),
|
|
7
|
+
span_id: NonEmptyStringSchema.optional(),
|
|
8
|
+
parent_span_id: NonEmptyStringSchema.optional(),
|
|
9
|
+
span_name: NonEmptyStringSchema.optional(),
|
|
10
|
+
span_kind: z
|
|
11
|
+
.enum(["internal", "server", "client", "producer", "consumer"])
|
|
12
|
+
.optional(),
|
|
13
|
+
log_severity: NonEmptyStringSchema.optional(),
|
|
14
|
+
attributes: JsonAttributeRecordSchema.default({}),
|
|
15
|
+
})
|
|
16
|
+
.strict();
|
|
17
|
+
export const ExternalTraceSinkProviderSchema = z.enum([
|
|
18
|
+
"otel_collector",
|
|
19
|
+
"langfuse",
|
|
20
|
+
"phoenix",
|
|
21
|
+
"datadog",
|
|
22
|
+
"honeycomb",
|
|
23
|
+
"custom",
|
|
24
|
+
]);
|
|
25
|
+
export const ExternalTraceSinkPointerSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
provider: ExternalTraceSinkProviderSchema,
|
|
28
|
+
trace_id: NonEmptyStringSchema.optional(),
|
|
29
|
+
span_id: NonEmptyStringSchema.optional(),
|
|
30
|
+
external_url: z.string().url().optional(),
|
|
31
|
+
project_id: NonEmptyStringSchema.optional(),
|
|
32
|
+
exported_at: IsoDateTimeSchema.optional(),
|
|
33
|
+
privacy_classification: PrivacyClassificationSchema.default("metadata"),
|
|
34
|
+
})
|
|
35
|
+
.strict();
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const TicketBindingSourceSchema: z.ZodEnum<{
|
|
3
|
+
active_work_context: "active_work_context";
|
|
4
|
+
branch_name: "branch_name";
|
|
5
|
+
linear_assignment: "linear_assignment";
|
|
6
|
+
car_ticket: "car_ticket";
|
|
7
|
+
github_pr: "github_pr";
|
|
8
|
+
mcp_context: "mcp_context";
|
|
9
|
+
manual_picker: "manual_picker";
|
|
10
|
+
}>;
|
|
11
|
+
export type TicketBindingSource = z.infer<typeof TicketBindingSourceSchema>;
|
|
12
|
+
export declare const TicketBindingCandidateSchema: z.ZodObject<{
|
|
13
|
+
ticket_id: z.ZodString;
|
|
14
|
+
binding_source: z.ZodEnum<{
|
|
15
|
+
active_work_context: "active_work_context";
|
|
16
|
+
branch_name: "branch_name";
|
|
17
|
+
linear_assignment: "linear_assignment";
|
|
18
|
+
car_ticket: "car_ticket";
|
|
19
|
+
github_pr: "github_pr";
|
|
20
|
+
mcp_context: "mcp_context";
|
|
21
|
+
manual_picker: "manual_picker";
|
|
22
|
+
}>;
|
|
23
|
+
confidence: z.ZodNumber;
|
|
24
|
+
evidence_labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
25
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export type TicketBindingCandidate = z.infer<typeof TicketBindingCandidateSchema>;
|
|
28
|
+
export declare const LocalWorkContextSchema: z.ZodObject<{
|
|
29
|
+
work_context_id: z.ZodString;
|
|
30
|
+
repo: z.ZodString;
|
|
31
|
+
branch: z.ZodString;
|
|
32
|
+
operator_id: z.ZodString;
|
|
33
|
+
session_id: z.ZodString;
|
|
34
|
+
started_at: z.ZodString;
|
|
35
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
36
|
+
active_ticket_id: z.ZodOptional<z.ZodString>;
|
|
37
|
+
ticket_binding_candidates: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
38
|
+
ticket_id: z.ZodString;
|
|
39
|
+
binding_source: z.ZodEnum<{
|
|
40
|
+
active_work_context: "active_work_context";
|
|
41
|
+
branch_name: "branch_name";
|
|
42
|
+
linear_assignment: "linear_assignment";
|
|
43
|
+
car_ticket: "car_ticket";
|
|
44
|
+
github_pr: "github_pr";
|
|
45
|
+
mcp_context: "mcp_context";
|
|
46
|
+
manual_picker: "manual_picker";
|
|
47
|
+
}>;
|
|
48
|
+
confidence: z.ZodNumber;
|
|
49
|
+
evidence_labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
50
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strict>>>;
|
|
52
|
+
pull_request_url: z.ZodOptional<z.ZodString>;
|
|
53
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
capture_source: z.ZodEnum<{
|
|
55
|
+
unknown: "unknown";
|
|
56
|
+
codex_jsonl: "codex_jsonl";
|
|
57
|
+
codex_otel: "codex_otel";
|
|
58
|
+
car_state: "car_state";
|
|
59
|
+
git_state: "git_state";
|
|
60
|
+
github_state: "github_state";
|
|
61
|
+
linear_state: "linear_state";
|
|
62
|
+
mcp_local: "mcp_local";
|
|
63
|
+
claude_hooks: "claude_hooks";
|
|
64
|
+
manual_event: "manual_event";
|
|
65
|
+
collector_runtime: "collector_runtime";
|
|
66
|
+
}>;
|
|
67
|
+
capture_adapter_version: z.ZodString;
|
|
68
|
+
collector_version: z.ZodString;
|
|
69
|
+
repo: z.ZodString;
|
|
70
|
+
branch: z.ZodString;
|
|
71
|
+
operator_id: z.ZodString;
|
|
72
|
+
session_id: z.ZodString;
|
|
73
|
+
work_context_id: z.ZodString;
|
|
74
|
+
}, z.core.$strict>>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
export type LocalWorkContext = z.infer<typeof LocalWorkContextSchema>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { IsoDateTimeSchema, NonEmptyStringSchema, CaptureProvenanceSchema, } from "./common.js";
|
|
3
|
+
export const TicketBindingSourceSchema = z.enum([
|
|
4
|
+
"active_work_context",
|
|
5
|
+
"branch_name",
|
|
6
|
+
"linear_assignment",
|
|
7
|
+
"car_ticket",
|
|
8
|
+
"github_pr",
|
|
9
|
+
"mcp_context",
|
|
10
|
+
"manual_picker",
|
|
11
|
+
]);
|
|
12
|
+
export const TicketBindingCandidateSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
ticket_id: NonEmptyStringSchema,
|
|
15
|
+
binding_source: TicketBindingSourceSchema,
|
|
16
|
+
confidence: z.number().min(0).max(1),
|
|
17
|
+
evidence_labels: z.array(NonEmptyStringSchema).default([]),
|
|
18
|
+
external_url: z.string().url().optional(),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
export const LocalWorkContextSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
work_context_id: NonEmptyStringSchema,
|
|
24
|
+
repo: NonEmptyStringSchema,
|
|
25
|
+
branch: NonEmptyStringSchema,
|
|
26
|
+
operator_id: NonEmptyStringSchema,
|
|
27
|
+
session_id: NonEmptyStringSchema,
|
|
28
|
+
started_at: IsoDateTimeSchema,
|
|
29
|
+
updated_at: IsoDateTimeSchema.optional(),
|
|
30
|
+
active_ticket_id: NonEmptyStringSchema.optional(),
|
|
31
|
+
ticket_binding_candidates: z
|
|
32
|
+
.array(TicketBindingCandidateSchema)
|
|
33
|
+
.default([]),
|
|
34
|
+
pull_request_url: z.string().url().optional(),
|
|
35
|
+
provenance: CaptureProvenanceSchema.optional(),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bli-cockpit/telemetry-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"prepack": "rm -rf dist && tsc",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "vitest run"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"zod": "^4.3.6"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "20.19.39",
|
|
35
|
+
"typescript": "5.9.3",
|
|
36
|
+
"vitest": "3.2.4"
|
|
37
|
+
}
|
|
38
|
+
}
|