@replayci/replay 0.1.1 → 0.1.3
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.cjs +645 -45
- package/dist/index.d.cts +72 -8
- package/dist/index.d.ts +72 -8
- package/dist/index.js +651 -41
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -16,23 +16,83 @@ type ValidationResult = {
|
|
|
16
16
|
evaluation_ms: number;
|
|
17
17
|
};
|
|
18
18
|
type CapturePrivacyTier = "metadata" | "redacted" | "full";
|
|
19
|
+
type ObserveActivationReasonCode = "active" | "disabled" | "missing_api_key" | "unsupported_client" | "double_wrap" | "patch_target_unwritable" | "internal_error";
|
|
20
|
+
type ObserveSessionState = "active" | "inactive" | "stopped" | "stale";
|
|
21
|
+
type ObserveHealthSnapshot = {
|
|
22
|
+
schema_version: "1.0";
|
|
23
|
+
session_id: string;
|
|
24
|
+
agent: string;
|
|
25
|
+
provider: "openai" | "anthropic" | null;
|
|
26
|
+
patch_target: string | null;
|
|
27
|
+
state: ObserveSessionState;
|
|
28
|
+
activation: {
|
|
29
|
+
active: boolean;
|
|
30
|
+
reason_code: ObserveActivationReasonCode;
|
|
31
|
+
detail?: string;
|
|
32
|
+
activated_at: string;
|
|
33
|
+
};
|
|
34
|
+
process: {
|
|
35
|
+
pid: number | null;
|
|
36
|
+
cwd: string;
|
|
37
|
+
node_version: string;
|
|
38
|
+
sdk_version: string;
|
|
39
|
+
};
|
|
40
|
+
runtime: {
|
|
41
|
+
captures_seen: number;
|
|
42
|
+
dropped_overflow: number;
|
|
43
|
+
last_capture_at: string | null;
|
|
44
|
+
last_flush_attempt_at: string | null;
|
|
45
|
+
last_flush_success_at: string | null;
|
|
46
|
+
last_flush_error_at: string | null;
|
|
47
|
+
last_flush_error: string | null;
|
|
48
|
+
queue_size: number;
|
|
49
|
+
consecutive_failures: number;
|
|
50
|
+
circuit_open_until: string | null;
|
|
51
|
+
remote_disabled: boolean;
|
|
52
|
+
};
|
|
53
|
+
stopped_at: string | null;
|
|
54
|
+
last_heartbeat_at: string;
|
|
55
|
+
last_health_store_error_at: string | null;
|
|
56
|
+
last_health_store_error: string | null;
|
|
57
|
+
};
|
|
19
58
|
type ObserveDiagnosticEvent = {
|
|
20
|
-
type: "
|
|
21
|
-
|
|
22
|
-
|
|
59
|
+
type: "observe_activated";
|
|
60
|
+
session_id: string;
|
|
61
|
+
provider: "openai" | "anthropic";
|
|
62
|
+
agent: string;
|
|
63
|
+
patch_target: string;
|
|
23
64
|
} | {
|
|
24
|
-
type: "
|
|
25
|
-
|
|
65
|
+
type: "observe_inactive";
|
|
66
|
+
reason_code: ObserveActivationReasonCode;
|
|
67
|
+
detail?: string;
|
|
26
68
|
} | {
|
|
27
|
-
type: "
|
|
28
|
-
|
|
69
|
+
type: "capture_seen";
|
|
70
|
+
session_id: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: "flush_succeeded";
|
|
73
|
+
batch_size: number;
|
|
29
74
|
} | {
|
|
30
75
|
type: "flush_error";
|
|
31
76
|
error: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: "buffer_overflow";
|
|
79
|
+
dropped: number;
|
|
32
80
|
} | {
|
|
33
81
|
type: "circuit_open";
|
|
34
82
|
failures: number;
|
|
35
83
|
backoffMs: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "remote_disabled";
|
|
86
|
+
} | {
|
|
87
|
+
type: "health_store_error";
|
|
88
|
+
detail: string;
|
|
89
|
+
} | {
|
|
90
|
+
type: "double_wrap";
|
|
91
|
+
mode: "observe" | "replay";
|
|
92
|
+
} | {
|
|
93
|
+
type: "unsupported_client";
|
|
94
|
+
mode: "observe";
|
|
95
|
+
detail: string;
|
|
36
96
|
};
|
|
37
97
|
type ObserveOptions = {
|
|
38
98
|
agent?: string;
|
|
@@ -43,11 +103,15 @@ type ObserveOptions = {
|
|
|
43
103
|
maxBuffer?: number;
|
|
44
104
|
flushMs?: number;
|
|
45
105
|
timeoutMs?: number;
|
|
106
|
+
/** Override state directory for health files (spec §2.2). */
|
|
107
|
+
stateDir?: string;
|
|
46
108
|
diagnostics?: (event: ObserveDiagnosticEvent) => void;
|
|
47
109
|
};
|
|
48
110
|
type ObserveHandle<T> = {
|
|
49
111
|
client: T;
|
|
112
|
+
flush: () => Promise<void>;
|
|
50
113
|
restore: () => void;
|
|
114
|
+
getHealth: () => ObserveHealthSnapshot;
|
|
51
115
|
};
|
|
52
116
|
|
|
53
117
|
declare function observe<T extends object>(client: T, opts?: ObserveOptions): ObserveHandle<T>;
|
|
@@ -59,4 +123,4 @@ type ValidateOptions = {
|
|
|
59
123
|
declare function prepareContracts(input: string | string[] | Contract | Contract[]): Contract[];
|
|
60
124
|
declare function validate(response: unknown, opts?: ValidateOptions): ValidationResult;
|
|
61
125
|
|
|
62
|
-
export { type ContractFailure, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveOptions, type ValidationResult, observe, prepareContracts, validate };
|
|
126
|
+
export { type ContractFailure, type ObserveActivationReasonCode, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveHealthSnapshot, type ObserveOptions, type ObserveSessionState, type ValidationResult, observe, prepareContracts, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,23 +16,83 @@ type ValidationResult = {
|
|
|
16
16
|
evaluation_ms: number;
|
|
17
17
|
};
|
|
18
18
|
type CapturePrivacyTier = "metadata" | "redacted" | "full";
|
|
19
|
+
type ObserveActivationReasonCode = "active" | "disabled" | "missing_api_key" | "unsupported_client" | "double_wrap" | "patch_target_unwritable" | "internal_error";
|
|
20
|
+
type ObserveSessionState = "active" | "inactive" | "stopped" | "stale";
|
|
21
|
+
type ObserveHealthSnapshot = {
|
|
22
|
+
schema_version: "1.0";
|
|
23
|
+
session_id: string;
|
|
24
|
+
agent: string;
|
|
25
|
+
provider: "openai" | "anthropic" | null;
|
|
26
|
+
patch_target: string | null;
|
|
27
|
+
state: ObserveSessionState;
|
|
28
|
+
activation: {
|
|
29
|
+
active: boolean;
|
|
30
|
+
reason_code: ObserveActivationReasonCode;
|
|
31
|
+
detail?: string;
|
|
32
|
+
activated_at: string;
|
|
33
|
+
};
|
|
34
|
+
process: {
|
|
35
|
+
pid: number | null;
|
|
36
|
+
cwd: string;
|
|
37
|
+
node_version: string;
|
|
38
|
+
sdk_version: string;
|
|
39
|
+
};
|
|
40
|
+
runtime: {
|
|
41
|
+
captures_seen: number;
|
|
42
|
+
dropped_overflow: number;
|
|
43
|
+
last_capture_at: string | null;
|
|
44
|
+
last_flush_attempt_at: string | null;
|
|
45
|
+
last_flush_success_at: string | null;
|
|
46
|
+
last_flush_error_at: string | null;
|
|
47
|
+
last_flush_error: string | null;
|
|
48
|
+
queue_size: number;
|
|
49
|
+
consecutive_failures: number;
|
|
50
|
+
circuit_open_until: string | null;
|
|
51
|
+
remote_disabled: boolean;
|
|
52
|
+
};
|
|
53
|
+
stopped_at: string | null;
|
|
54
|
+
last_heartbeat_at: string;
|
|
55
|
+
last_health_store_error_at: string | null;
|
|
56
|
+
last_health_store_error: string | null;
|
|
57
|
+
};
|
|
19
58
|
type ObserveDiagnosticEvent = {
|
|
20
|
-
type: "
|
|
21
|
-
|
|
22
|
-
|
|
59
|
+
type: "observe_activated";
|
|
60
|
+
session_id: string;
|
|
61
|
+
provider: "openai" | "anthropic";
|
|
62
|
+
agent: string;
|
|
63
|
+
patch_target: string;
|
|
23
64
|
} | {
|
|
24
|
-
type: "
|
|
25
|
-
|
|
65
|
+
type: "observe_inactive";
|
|
66
|
+
reason_code: ObserveActivationReasonCode;
|
|
67
|
+
detail?: string;
|
|
26
68
|
} | {
|
|
27
|
-
type: "
|
|
28
|
-
|
|
69
|
+
type: "capture_seen";
|
|
70
|
+
session_id: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: "flush_succeeded";
|
|
73
|
+
batch_size: number;
|
|
29
74
|
} | {
|
|
30
75
|
type: "flush_error";
|
|
31
76
|
error: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: "buffer_overflow";
|
|
79
|
+
dropped: number;
|
|
32
80
|
} | {
|
|
33
81
|
type: "circuit_open";
|
|
34
82
|
failures: number;
|
|
35
83
|
backoffMs: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "remote_disabled";
|
|
86
|
+
} | {
|
|
87
|
+
type: "health_store_error";
|
|
88
|
+
detail: string;
|
|
89
|
+
} | {
|
|
90
|
+
type: "double_wrap";
|
|
91
|
+
mode: "observe" | "replay";
|
|
92
|
+
} | {
|
|
93
|
+
type: "unsupported_client";
|
|
94
|
+
mode: "observe";
|
|
95
|
+
detail: string;
|
|
36
96
|
};
|
|
37
97
|
type ObserveOptions = {
|
|
38
98
|
agent?: string;
|
|
@@ -43,11 +103,15 @@ type ObserveOptions = {
|
|
|
43
103
|
maxBuffer?: number;
|
|
44
104
|
flushMs?: number;
|
|
45
105
|
timeoutMs?: number;
|
|
106
|
+
/** Override state directory for health files (spec §2.2). */
|
|
107
|
+
stateDir?: string;
|
|
46
108
|
diagnostics?: (event: ObserveDiagnosticEvent) => void;
|
|
47
109
|
};
|
|
48
110
|
type ObserveHandle<T> = {
|
|
49
111
|
client: T;
|
|
112
|
+
flush: () => Promise<void>;
|
|
50
113
|
restore: () => void;
|
|
114
|
+
getHealth: () => ObserveHealthSnapshot;
|
|
51
115
|
};
|
|
52
116
|
|
|
53
117
|
declare function observe<T extends object>(client: T, opts?: ObserveOptions): ObserveHandle<T>;
|
|
@@ -59,4 +123,4 @@ type ValidateOptions = {
|
|
|
59
123
|
declare function prepareContracts(input: string | string[] | Contract | Contract[]): Contract[];
|
|
60
124
|
declare function validate(response: unknown, opts?: ValidateOptions): ValidationResult;
|
|
61
125
|
|
|
62
|
-
export { type ContractFailure, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveOptions, type ValidationResult, observe, prepareContracts, validate };
|
|
126
|
+
export { type ContractFailure, type ObserveActivationReasonCode, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveHealthSnapshot, type ObserveOptions, type ObserveSessionState, type ValidationResult, observe, prepareContracts, validate };
|