Repository navigation
Expand file tree
/
Copy pathcloud-artifacts.ts
More file actions
87 lines (75 loc) · 2.51 KB
/
Copy pathcloud-artifacts.ts
File metadata and controls
87 lines (75 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import type { DaemonArtifactType } from '@agent-device/kernel/contracts';
import type { DeviceRotation } from './device-rotation.ts';
const CLOUD_ARTIFACT_KINDS = [
'video',
'appium-log',
'device-log',
'automation-log',
'provider-session',
'raw',
] as const;
export type CloudArtifactKind = (typeof CLOUD_ARTIFACT_KINDS)[number];
export type CloudArtifactAvailability = 'ready' | 'pending' | 'unavailable' | 'expired';
export type CloudArtifact = {
provider: string;
kind: CloudArtifactKind;
name: string;
url?: string;
providerSessionId?: string;
providerArtifactId?: string;
contentType?: string;
extension?: string;
availability?: CloudArtifactAvailability;
metadata?: Record<string, unknown>;
};
export type CloudArtifactsStatus = 'ready' | 'pending' | 'unavailable';
export type CloudArtifactsResult = {
provider: string;
status: CloudArtifactsStatus;
cloudArtifacts: CloudArtifact[];
providerSessionId?: string;
message?: string;
};
export type DaemonArtifactInventoryEntry = {
id: string;
// Optional on the wire (see DaemonArtifact.artifactType).
artifactType?: DaemonArtifactType;
filename: string;
mimeType: string;
sizeBytes: number;
createdAt: string;
expiresAt: string;
/** Display rotation a screenshot was rendered in; absent when the capture reported none. */
displayRotation?: DeviceRotation;
/**
* Public name of the session that produced the artifact, without a tenant prefix. Present on an
* artifact the daemon registered outside a request reply, such as a recording kept when its
* leased session was torn down.
*/
sessionName?: string;
};
export type DaemonArtifactsResult = {
source: 'daemon';
status: 'ready';
artifacts: DaemonArtifactInventoryEntry[];
message?: string;
};
export type AgentArtifactsResult = CloudArtifactsResult | DaemonArtifactsResult;
export type CloudArtifactsQuery = {
provider?: string;
leaseId?: string;
providerSessionId?: string;
};
export type CloudProviderSessionResult = {
provider?: string;
providerSessionId?: string;
cloudArtifacts?: CloudArtifactsResult;
} & Record<string, unknown>;
/**
* Return undefined only when this provider implementation does not handle the query.
* Return a CloudArtifactsResult with status "unavailable" when the provider handled the
* query but artifact retrieval failed, and "pending" when artifacts are not finalized yet.
*/
export type CloudArtifactProvider = {
listCloudArtifacts?: (query: CloudArtifactsQuery) => Promise<CloudArtifactsResult | undefined>;
};