@a4anthony/proctorkit-types 0.2.0 → 0.4.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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/integrity.d.ts +9 -0
- package/dist/integrity.d.ts.map +1 -1
- package/dist/integrity.js +20 -0
- package/dist/integrity.js.map +1 -1
- package/dist/investigation/support-event-policy.d.ts +140 -0
- package/dist/investigation/support-event-policy.d.ts.map +1 -0
- package/dist/investigation/support-event-policy.js +353 -0
- package/dist/investigation/support-event-policy.js.map +1 -0
- package/dist/investigation/version.d.ts +4 -0
- package/dist/investigation/version.d.ts.map +1 -0
- package/dist/investigation/version.js +4 -0
- package/dist/investigation/version.js.map +1 -0
- package/dist/proctorkit-support-event-policy.json +534 -0
- package/dist/proctorkit-support-event-policy.schema.json +1509 -0
- package/dist/support-context.d.ts +271 -0
- package/dist/support-context.d.ts.map +1 -0
- package/dist/support-context.js +13 -0
- package/dist/support-context.js.map +1 -0
- package/dist/worker-protocol.d.ts +1 -1
- package/dist/worker-protocol.d.ts.map +1 -1
- package/package.json +15 -3
- package/src/index.ts +1 -0
- package/src/integrity.ts +21 -0
- package/src/investigation/support-event-policy.ts +548 -0
- package/src/investigation/version.ts +3 -0
- package/src/support-context.ts +388 -0
- package/src/worker-protocol.ts +1 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import type { SessionStatus } from "./session.js";
|
|
2
|
+
|
|
3
|
+
/** Version of the normalized support-context response shape. */
|
|
4
|
+
export type SupportContextSchemaVersion = "1";
|
|
5
|
+
|
|
6
|
+
declare const supportStableCodeBrand: unique symbol;
|
|
7
|
+
declare const supportStableTokenBrand: unique symbol;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A server-normalized machine code. Domain-owned mappers must use closed
|
|
11
|
+
* mappings with an `unknown` fallback; never cast or copy raw telemetry.
|
|
12
|
+
*/
|
|
13
|
+
export type SupportStableCode = "unknown" | (string & { readonly [supportStableCodeBrand]: true });
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A server-normalized categorical token. Domain-owned mappers must use closed
|
|
17
|
+
* mappings with an `unknown` fallback; never cast or copy raw telemetry.
|
|
18
|
+
*/
|
|
19
|
+
export type SupportStableToken =
|
|
20
|
+
| "unknown"
|
|
21
|
+
| (string & { readonly [supportStableTokenBrand]: true });
|
|
22
|
+
|
|
23
|
+
export type SupportSemanticVersion = `${number}.${number}.${number}`;
|
|
24
|
+
export type SupportSha256Digest = `sha256:${string}`;
|
|
25
|
+
export type SupportPolicyHref = `/v1/support-context/interpretation/${string}/support-policy`;
|
|
26
|
+
|
|
27
|
+
export type SupportObservationState = "not_started" | "in_progress" | "complete" | "unavailable";
|
|
28
|
+
|
|
29
|
+
export type SupportCheckState =
|
|
30
|
+
| "not_observed"
|
|
31
|
+
| "pending"
|
|
32
|
+
| "checking"
|
|
33
|
+
| "passed"
|
|
34
|
+
| "failed"
|
|
35
|
+
| "skipped";
|
|
36
|
+
|
|
37
|
+
export type SupportCheckKind =
|
|
38
|
+
| "browser"
|
|
39
|
+
| "device"
|
|
40
|
+
| "layout"
|
|
41
|
+
| "monitor"
|
|
42
|
+
| "connection"
|
|
43
|
+
| "microphone"
|
|
44
|
+
| "speaker"
|
|
45
|
+
| "camera"
|
|
46
|
+
| "screen-share";
|
|
47
|
+
|
|
48
|
+
export type SupportContextSection =
|
|
49
|
+
| "lifecycle"
|
|
50
|
+
| "policy"
|
|
51
|
+
| "preflight"
|
|
52
|
+
| "resume"
|
|
53
|
+
| "runtime"
|
|
54
|
+
| "writing";
|
|
55
|
+
|
|
56
|
+
export type SupportContextCompletenessState = "empty" | "partial" | "complete";
|
|
57
|
+
|
|
58
|
+
export type SupportContextWarningCode =
|
|
59
|
+
| "telemetry_best_effort"
|
|
60
|
+
| "history_truncated"
|
|
61
|
+
| "section_unavailable";
|
|
62
|
+
|
|
63
|
+
export type SupportActivityState = "live" | "inactive" | "suspended";
|
|
64
|
+
|
|
65
|
+
export type SupportJourneyStage = "opened" | "preflight" | "ready" | "assessment" | "completed";
|
|
66
|
+
|
|
67
|
+
export type SupportPolicyDecision = "allowed" | "blocked" | "unknown";
|
|
68
|
+
|
|
69
|
+
export type SupportPreflightVerdict = "not_started" | "in_progress" | "passed" | "failed";
|
|
70
|
+
|
|
71
|
+
export type SupportDeviceCategory = "built_in" | "usb" | "bluetooth" | "virtual" | "unknown";
|
|
72
|
+
|
|
73
|
+
export type SupportDeviceKind = "microphone" | "speaker" | "camera";
|
|
74
|
+
|
|
75
|
+
export type SupportConnectionBand = "fair" | "good" | "excellent";
|
|
76
|
+
|
|
77
|
+
export type SupportRecordingUploadMode = "direct" | "segments" | "post";
|
|
78
|
+
|
|
79
|
+
export type SupportResumeCheckState = "checking" | "passed" | "warning" | "failed";
|
|
80
|
+
|
|
81
|
+
export const SUPPORT_ISSUE_CATEGORIES = [
|
|
82
|
+
"monitor",
|
|
83
|
+
"connection",
|
|
84
|
+
"permissions",
|
|
85
|
+
"camera",
|
|
86
|
+
"audio",
|
|
87
|
+
"screen_share",
|
|
88
|
+
"compatibility",
|
|
89
|
+
"runtime_delivery",
|
|
90
|
+
"device_change",
|
|
91
|
+
"unknown",
|
|
92
|
+
] as const;
|
|
93
|
+
|
|
94
|
+
export type SupportIssueCategory = (typeof SUPPORT_ISSUE_CATEGORIES)[number];
|
|
95
|
+
|
|
96
|
+
export type SupportIssuePhase = "preflight" | "resume" | "runtime" | "writing";
|
|
97
|
+
|
|
98
|
+
export type SupportBlockedClipboardAction = "paste" | "copy" | "cut";
|
|
99
|
+
|
|
100
|
+
export type SupportResumeClass =
|
|
101
|
+
| "refresh"
|
|
102
|
+
| "brief"
|
|
103
|
+
| "interruption"
|
|
104
|
+
| "returned-after-absence"
|
|
105
|
+
| "unknown";
|
|
106
|
+
|
|
107
|
+
export type SupportNavigationType =
|
|
108
|
+
| "navigate"
|
|
109
|
+
| "reload"
|
|
110
|
+
| "back_forward"
|
|
111
|
+
| "prerender"
|
|
112
|
+
| "unknown";
|
|
113
|
+
|
|
114
|
+
export type SupportRuntimeBlockerCategory =
|
|
115
|
+
| "device"
|
|
116
|
+
| "permission"
|
|
117
|
+
| "screen_share"
|
|
118
|
+
| "connection"
|
|
119
|
+
| "media"
|
|
120
|
+
| "reverification"
|
|
121
|
+
| "unknown";
|
|
122
|
+
|
|
123
|
+
export type SupportRuntimeBlockerState = "active" | "cleared" | "unknown";
|
|
124
|
+
|
|
125
|
+
export type SupportCoarseDeviceType = "desktop" | "laptop" | "tablet" | "mobile" | "unknown";
|
|
126
|
+
|
|
127
|
+
export type SupportCoarseBrowser = "chrome" | "edge" | "firefox" | "safari" | "other" | "unknown";
|
|
128
|
+
|
|
129
|
+
export type SupportCoarseOperatingSystem =
|
|
130
|
+
| "windows"
|
|
131
|
+
| "macos"
|
|
132
|
+
| "linux"
|
|
133
|
+
| "ios"
|
|
134
|
+
| "android"
|
|
135
|
+
| "chromeos"
|
|
136
|
+
| "other"
|
|
137
|
+
| "unknown";
|
|
138
|
+
|
|
139
|
+
export type SupportCoarsePlatform = "desktop" | "tablet" | "mobile" | "unknown";
|
|
140
|
+
|
|
141
|
+
export type SupportScreenSizeBucket = "small" | "medium" | "large" | "extra_large" | "unknown";
|
|
142
|
+
|
|
143
|
+
export type SupportLogicalCoreBucket = "1_2" | "3_4" | "5_8" | "9_16" | "17_plus" | "unknown";
|
|
144
|
+
|
|
145
|
+
export type SupportMemoryBucket =
|
|
146
|
+
| "under_4_gb"
|
|
147
|
+
| "4_7_gb"
|
|
148
|
+
| "8_15_gb"
|
|
149
|
+
| "16_31_gb"
|
|
150
|
+
| "32_plus_gb"
|
|
151
|
+
| "unknown";
|
|
152
|
+
|
|
153
|
+
export interface SupportContextInterpretationIdentity {
|
|
154
|
+
contextFormatVersion: SupportSemanticVersion;
|
|
155
|
+
telemetrySchemaVersion: SupportSemanticVersion;
|
|
156
|
+
supportProjectionVersion: SupportSemanticVersion;
|
|
157
|
+
/** Lowercase SHA-256 digest with the `sha256:` prefix. */
|
|
158
|
+
supportPolicySha256: SupportSha256Digest;
|
|
159
|
+
supportPolicyHref: SupportPolicyHref;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface SupportContextWarning {
|
|
163
|
+
code: SupportContextWarningCode;
|
|
164
|
+
section?: SupportContextSection;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface SupportContextCompleteness {
|
|
168
|
+
state: SupportContextCompletenessState;
|
|
169
|
+
observedSections: SupportContextSection[];
|
|
170
|
+
/**
|
|
171
|
+
* Known sections that could not be observed. Values are stable server codes,
|
|
172
|
+
* never raw exception text.
|
|
173
|
+
*/
|
|
174
|
+
missingSections: SupportContextSection[];
|
|
175
|
+
warnings: SupportContextWarning[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface SupportContextResponse {
|
|
179
|
+
data: SupportContext;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface SupportContext {
|
|
183
|
+
schemaVersion: SupportContextSchemaVersion;
|
|
184
|
+
interpretation: SupportContextInterpretationIdentity;
|
|
185
|
+
/** ISO-8601 timestamp. */
|
|
186
|
+
generatedAt: string;
|
|
187
|
+
/** ISO-8601 timestamp of the newest persisted source included. */
|
|
188
|
+
sourceUpdatedAt: string;
|
|
189
|
+
completeness: SupportContextCompleteness;
|
|
190
|
+
identity: SupportContextIdentity;
|
|
191
|
+
lifecycle: SupportLifecycleContext;
|
|
192
|
+
policy: SupportPolicyContext;
|
|
193
|
+
preflight: SupportPreflightContext;
|
|
194
|
+
resume: SupportResumeContext;
|
|
195
|
+
runtime: SupportRuntimeContext;
|
|
196
|
+
writing: SupportWritingContext;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface SupportContextIdentity {
|
|
200
|
+
/** Server-normalized opaque digest of the customer correlation value. */
|
|
201
|
+
correlationId: string;
|
|
202
|
+
sessionId: string;
|
|
203
|
+
attemptNumber: number;
|
|
204
|
+
mode: SupportStableToken;
|
|
205
|
+
resolvedBy: "correlation_id" | "session_id";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface SupportLifecycleContext {
|
|
209
|
+
observationState: SupportObservationState;
|
|
210
|
+
sessionStatus: SessionStatus;
|
|
211
|
+
activityState: SupportActivityState;
|
|
212
|
+
journeyStage: SupportJourneyStage;
|
|
213
|
+
/** Stable machine code, never rendered or exception prose. */
|
|
214
|
+
summaryCode: SupportStableCode;
|
|
215
|
+
startedAt: string;
|
|
216
|
+
preflightStartedAt: string | null;
|
|
217
|
+
runtimeStartedAt: string | null;
|
|
218
|
+
lastActivityAt: string;
|
|
219
|
+
endedAt: string | null;
|
|
220
|
+
lockedAt: string | null;
|
|
221
|
+
/** Stable end-reason code. */
|
|
222
|
+
endReason: SupportStableCode | null;
|
|
223
|
+
requiresReverification: boolean;
|
|
224
|
+
sittingCount: number;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface SupportPolicyContext {
|
|
228
|
+
observationState: SupportObservationState;
|
|
229
|
+
/** Stable configured mode, or null when policy has not been observed. */
|
|
230
|
+
preflightMode: SupportStableToken | null;
|
|
231
|
+
requiredChecks: SupportCheckKind[];
|
|
232
|
+
optionalChecks: SupportCheckKind[];
|
|
233
|
+
disabledChecks: SupportCheckKind[];
|
|
234
|
+
clipboard: {
|
|
235
|
+
copy: SupportPolicyDecision;
|
|
236
|
+
paste: SupportPolicyDecision;
|
|
237
|
+
cut: SupportPolicyDecision;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface SupportPreflightContext {
|
|
242
|
+
observationState: SupportObservationState;
|
|
243
|
+
verdict: SupportPreflightVerdict;
|
|
244
|
+
startedAt: string | null;
|
|
245
|
+
completedAt: string | null;
|
|
246
|
+
durationMs: number | null;
|
|
247
|
+
checks: SupportCheck[];
|
|
248
|
+
devices: Partial<Record<SupportDeviceKind, SupportObservedDeviceSet>>;
|
|
249
|
+
attemptHistory: SupportPreflightAttempt[];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface SupportObservedDeviceSet {
|
|
253
|
+
selected: {
|
|
254
|
+
category: SupportDeviceCategory;
|
|
255
|
+
virtual: boolean | null;
|
|
256
|
+
} | null;
|
|
257
|
+
availableCount: number;
|
|
258
|
+
virtualCount: number;
|
|
259
|
+
lastObservedAt: string | null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface SupportCheck {
|
|
263
|
+
kind: SupportCheckKind;
|
|
264
|
+
required: boolean;
|
|
265
|
+
state: SupportCheckState;
|
|
266
|
+
/** Stable support code, never raw browser or exception text. */
|
|
267
|
+
code: SupportStableCode | null;
|
|
268
|
+
retryCount: number;
|
|
269
|
+
durationMs: number | null;
|
|
270
|
+
lastObservedAt: string | null;
|
|
271
|
+
connection: SupportConnectionObservation | null;
|
|
272
|
+
microphoneVerification: SupportMicrophoneVerification | null;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface SupportConnectionObservation {
|
|
276
|
+
downloadMbps: number | null;
|
|
277
|
+
uploadMbps: number | null;
|
|
278
|
+
latencyMs: number | null;
|
|
279
|
+
jitterMs: number | null;
|
|
280
|
+
band: SupportConnectionBand | null;
|
|
281
|
+
recordingUploadMode: SupportRecordingUploadMode | null;
|
|
282
|
+
readinessMedianMs: number | null;
|
|
283
|
+
readinessWindowMs: number | null;
|
|
284
|
+
readinessSampleCount: number | null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface SupportMicrophoneVerification {
|
|
288
|
+
/** Stable verification mode. */
|
|
289
|
+
mode: SupportStableToken | null;
|
|
290
|
+
/** Stable fallback code, never raw error detail. */
|
|
291
|
+
fallbackReason: SupportStableCode | null;
|
|
292
|
+
preparationMs: number | null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface SupportPreflightAttempt {
|
|
296
|
+
attemptNumber: number;
|
|
297
|
+
origin: "wizard" | "runtime" | "unknown";
|
|
298
|
+
verdict: "in_progress" | "passed" | "failed";
|
|
299
|
+
startedAt: string;
|
|
300
|
+
completedAt: string | null;
|
|
301
|
+
durationMs: number | null;
|
|
302
|
+
sameAsCanonicalDevice: boolean | null;
|
|
303
|
+
device: SupportCoarseDeviceEnvironment | null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface SupportCoarseDeviceEnvironment {
|
|
307
|
+
type: SupportCoarseDeviceType;
|
|
308
|
+
browser: SupportCoarseBrowser;
|
|
309
|
+
os: SupportCoarseOperatingSystem;
|
|
310
|
+
platform: SupportCoarsePlatform;
|
|
311
|
+
screenSize: SupportScreenSizeBucket;
|
|
312
|
+
logicalCores: SupportLogicalCoreBucket;
|
|
313
|
+
memory: SupportMemoryBucket;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface SupportResumeContext {
|
|
317
|
+
observationState: SupportObservationState;
|
|
318
|
+
totalResumes: number;
|
|
319
|
+
currentOrLatest: SupportResumeObservation | null;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export interface SupportResumeObservation {
|
|
323
|
+
observedAt: string;
|
|
324
|
+
class: SupportResumeClass;
|
|
325
|
+
awayMs: number | null;
|
|
326
|
+
navigationType: SupportNavigationType | null;
|
|
327
|
+
completed: boolean;
|
|
328
|
+
checks: SupportResumeCheck[];
|
|
329
|
+
changedDevices: SupportCheckKind[];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface SupportResumeCheck {
|
|
333
|
+
kind: SupportCheckKind;
|
|
334
|
+
state: SupportResumeCheckState;
|
|
335
|
+
/** Stable reason code. */
|
|
336
|
+
reason: SupportStableCode | null;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface SupportRuntimeContext {
|
|
340
|
+
observationState: SupportObservationState;
|
|
341
|
+
activeBlocker: SupportRuntimeBlocker | null;
|
|
342
|
+
primaryIssue: SupportIssue | null;
|
|
343
|
+
issues: SupportIssue[];
|
|
344
|
+
delivery: SupportDeliverySummary;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface SupportRuntimeBlocker {
|
|
348
|
+
openedAt: string;
|
|
349
|
+
category: SupportRuntimeBlockerCategory;
|
|
350
|
+
state: SupportRuntimeBlockerState;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export interface SupportIssue {
|
|
354
|
+
category: SupportIssueCategory;
|
|
355
|
+
phase: SupportIssuePhase;
|
|
356
|
+
check: SupportCheckKind | null;
|
|
357
|
+
/** Stable support code. */
|
|
358
|
+
code: SupportStableCode;
|
|
359
|
+
occurrences: number;
|
|
360
|
+
firstSeenAt: string | null;
|
|
361
|
+
lastSeenAt: string;
|
|
362
|
+
blocking: boolean;
|
|
363
|
+
resolvedAt: string | null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface SupportDeliverySummary {
|
|
367
|
+
sdkErrors: number;
|
|
368
|
+
uploadFailures: number;
|
|
369
|
+
mediaFailures: number;
|
|
370
|
+
workerFailures: number;
|
|
371
|
+
drainTimeouts: number;
|
|
372
|
+
lastFailureAt: string | null;
|
|
373
|
+
/** Stable failure code, never raw exception text. */
|
|
374
|
+
lastFailureCode: SupportStableCode | null;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export interface SupportWritingContext {
|
|
378
|
+
observationState: SupportObservationState;
|
|
379
|
+
saveFailures: number;
|
|
380
|
+
lastSaveFailure: { code: SupportStableCode; observedAt: string } | null;
|
|
381
|
+
clipboard: {
|
|
382
|
+
blockedPasteAttempts: number;
|
|
383
|
+
blockedCopyAttempts: number;
|
|
384
|
+
blockedCutAttempts: number;
|
|
385
|
+
lastBlockedAction: SupportBlockedClipboardAction | null;
|
|
386
|
+
lastBlockedAt: string | null;
|
|
387
|
+
};
|
|
388
|
+
}
|
package/src/worker-protocol.ts
CHANGED
|
@@ -44,6 +44,7 @@ export type DeliveryReadinessErrorCode =
|
|
|
44
44
|
| "upload-config-unreachable"
|
|
45
45
|
| "upload-config-invalid"
|
|
46
46
|
| "media-storage-timeout"
|
|
47
|
+
| "media-storage-too-slow"
|
|
47
48
|
| "media-storage-unreachable"
|
|
48
49
|
| "media-storage-rejected"
|
|
49
50
|
| "media-storage-invalid-response";
|