mock-mcp 0.3.1 → 0.5.1
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 +212 -124
- package/dist/adapter/index.cjs +875 -0
- package/dist/adapter/index.d.cts +142 -0
- package/dist/adapter/index.d.ts +142 -0
- package/dist/adapter/index.js +835 -0
- package/dist/client/connect.cjs +991 -0
- package/dist/client/connect.d.cts +218 -0
- package/dist/client/connect.d.ts +211 -7
- package/dist/client/connect.js +941 -20
- package/dist/client/index.cjs +992 -0
- package/dist/client/index.d.cts +3 -0
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.js +951 -2
- package/dist/daemon/index.cjs +717 -0
- package/dist/daemon/index.d.cts +62 -0
- package/dist/daemon/index.d.ts +62 -0
- package/dist/daemon/index.js +678 -0
- package/dist/index.cjs +2708 -0
- package/dist/index.d.cts +602 -0
- package/dist/index.d.ts +602 -11
- package/dist/index.js +2651 -53
- package/dist/shared/index.cjs +506 -0
- package/dist/shared/index.d.cts +241 -0
- package/dist/shared/index.d.ts +241 -0
- package/dist/shared/index.js +423 -0
- package/dist/types-bEGXLBF0.d.cts +190 -0
- package/dist/types-bEGXLBF0.d.ts +190 -0
- package/package.json +45 -4
- package/dist/client/batch-mock-collector.d.ts +0 -111
- package/dist/client/batch-mock-collector.js +0 -308
- package/dist/client/util.d.ts +0 -1
- package/dist/client/util.js +0 -3
- package/dist/connect.cjs +0 -400
- package/dist/connect.d.cts +0 -82
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.js +0 -1
- package/dist/server/test-mock-mcp-server.d.ts +0 -73
- package/dist/server/test-mock-mcp-server.js +0 -419
- package/dist/types.d.ts +0 -45
- package/dist/types.js +0 -2
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { a as MockRequestDescriptor, M as MockResponseDescriptor } from '../types-bEGXLBF0.cjs';
|
|
2
|
+
export { A as ActiveDaemonEntry, v as ActiveDaemonsIndex, q as DaemonPaths, D as DaemonRegistry, E as EnsureDaemonOptions, o as cleanupGlobalIndex, c as computeProjectId, p as discoverAllDaemons, j as ensureDaemonRunning, g as getCacheDir, i as getDaemonEntryPath, k as getGlobalIndexPath, b as getPaths, h as healthCheck, f as randomToken, l as readGlobalIndex, d as readRegistry, n as registerDaemonGlobally, e as releaseLock, r as resolveProjectRoot, s as sleep, t as tryAcquireLock, u as unregisterDaemonGlobally, m as writeGlobalIndex, w as writeRegistry } from '../types-bEGXLBF0.cjs';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Protocol definitions for mock-mcp Daemon communication.
|
|
7
|
+
*
|
|
8
|
+
* Defines message types for:
|
|
9
|
+
* - Test channel (WebSocket /test): Test process ↔ Daemon
|
|
10
|
+
* - Control channel (HTTP /control): Adapter ↔ Daemon (JSON-RPC)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare const HELLO_TEST: "HELLO_TEST";
|
|
14
|
+
declare const HELLO_ACK: "HELLO_ACK";
|
|
15
|
+
declare const BATCH_MOCK_REQUEST: "BATCH_MOCK_REQUEST";
|
|
16
|
+
declare const BATCH_MOCK_RESULT: "BATCH_MOCK_RESULT";
|
|
17
|
+
declare const HEARTBEAT: "HEARTBEAT";
|
|
18
|
+
declare const HEARTBEAT_ACK: "HEARTBEAT_ACK";
|
|
19
|
+
declare const RPC_GET_STATUS: "getStatus";
|
|
20
|
+
declare const RPC_LIST_RUNS: "listRuns";
|
|
21
|
+
declare const RPC_CLAIM_NEXT_BATCH: "claimNextBatch";
|
|
22
|
+
declare const RPC_PROVIDE_BATCH: "provideBatch";
|
|
23
|
+
declare const RPC_RELEASE_BATCH: "releaseBatch";
|
|
24
|
+
declare const RPC_GET_BATCH: "getBatch";
|
|
25
|
+
/**
|
|
26
|
+
* HELLO message from test process to daemon.
|
|
27
|
+
* Must be the first message after WebSocket connection.
|
|
28
|
+
*/
|
|
29
|
+
interface HelloTestMessage {
|
|
30
|
+
type: typeof HELLO_TEST;
|
|
31
|
+
token: string;
|
|
32
|
+
runId: string;
|
|
33
|
+
pid: number;
|
|
34
|
+
cwd: string;
|
|
35
|
+
testMeta?: {
|
|
36
|
+
testFile?: string;
|
|
37
|
+
testName?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Acknowledgment of HELLO from daemon.
|
|
42
|
+
*/
|
|
43
|
+
interface HelloAckMessage {
|
|
44
|
+
type: typeof HELLO_ACK;
|
|
45
|
+
runId: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Batch mock request from test process.
|
|
49
|
+
*/
|
|
50
|
+
interface BatchMockRequestMessage {
|
|
51
|
+
type: typeof BATCH_MOCK_REQUEST;
|
|
52
|
+
runId: string;
|
|
53
|
+
requests: MockRequestDescriptor[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Batch mock result from daemon to test process.
|
|
57
|
+
*/
|
|
58
|
+
interface BatchMockResultMessage {
|
|
59
|
+
type: typeof BATCH_MOCK_RESULT;
|
|
60
|
+
batchId: string;
|
|
61
|
+
mocks: MockResponseDescriptor[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Heartbeat from test process.
|
|
65
|
+
*/
|
|
66
|
+
interface HeartbeatMessage {
|
|
67
|
+
type: typeof HEARTBEAT;
|
|
68
|
+
runId: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Heartbeat acknowledgment from daemon.
|
|
72
|
+
*/
|
|
73
|
+
interface HeartbeatAckMessage {
|
|
74
|
+
type: typeof HEARTBEAT_ACK;
|
|
75
|
+
runId: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Union type for all test channel messages (from test process).
|
|
79
|
+
*/
|
|
80
|
+
type TestChannelIncomingMessage = HelloTestMessage | BatchMockRequestMessage | HeartbeatMessage;
|
|
81
|
+
/**
|
|
82
|
+
* Union type for all test channel messages (from daemon).
|
|
83
|
+
*/
|
|
84
|
+
type TestChannelOutgoingMessage = HelloAckMessage | BatchMockResultMessage | HeartbeatAckMessage;
|
|
85
|
+
/**
|
|
86
|
+
* JSON-RPC 2.0 request structure.
|
|
87
|
+
*/
|
|
88
|
+
interface JsonRpcRequest {
|
|
89
|
+
jsonrpc: "2.0";
|
|
90
|
+
id: string | number;
|
|
91
|
+
method: string;
|
|
92
|
+
params?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* JSON-RPC 2.0 response structure.
|
|
96
|
+
*/
|
|
97
|
+
interface JsonRpcResponse {
|
|
98
|
+
jsonrpc: "2.0";
|
|
99
|
+
id: string | number;
|
|
100
|
+
result?: unknown;
|
|
101
|
+
error?: JsonRpcError;
|
|
102
|
+
}
|
|
103
|
+
interface JsonRpcError {
|
|
104
|
+
code: number;
|
|
105
|
+
message: string;
|
|
106
|
+
data?: unknown;
|
|
107
|
+
}
|
|
108
|
+
declare const RPC_ERROR_PARSE = -32700;
|
|
109
|
+
declare const RPC_ERROR_INVALID_REQUEST = -32600;
|
|
110
|
+
declare const RPC_ERROR_METHOD_NOT_FOUND = -32601;
|
|
111
|
+
declare const RPC_ERROR_INVALID_PARAMS = -32602;
|
|
112
|
+
declare const RPC_ERROR_INTERNAL = -32603;
|
|
113
|
+
declare const RPC_ERROR_NOT_FOUND = -32000;
|
|
114
|
+
declare const RPC_ERROR_UNAUTHORIZED = -32001;
|
|
115
|
+
declare const RPC_ERROR_CONFLICT = -32002;
|
|
116
|
+
declare const RPC_ERROR_EXPIRED = -32003;
|
|
117
|
+
/**
|
|
118
|
+
* Parameters for claimNextBatch RPC.
|
|
119
|
+
*/
|
|
120
|
+
interface ClaimNextBatchParams {
|
|
121
|
+
adapterId: string;
|
|
122
|
+
runId?: string;
|
|
123
|
+
leaseMs?: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Result of claimNextBatch RPC.
|
|
127
|
+
*/
|
|
128
|
+
interface ClaimNextBatchResult {
|
|
129
|
+
batchId: string;
|
|
130
|
+
runId: string;
|
|
131
|
+
requests: MockRequestDescriptor[];
|
|
132
|
+
claimToken: string;
|
|
133
|
+
leaseUntil: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Parameters for provideBatch RPC.
|
|
137
|
+
*/
|
|
138
|
+
interface ProvideBatchParams {
|
|
139
|
+
adapterId: string;
|
|
140
|
+
batchId: string;
|
|
141
|
+
claimToken: string;
|
|
142
|
+
mocks: MockResponseDescriptor[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Result of provideBatch RPC.
|
|
146
|
+
*/
|
|
147
|
+
interface ProvideBatchResult {
|
|
148
|
+
ok: boolean;
|
|
149
|
+
message?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Parameters for releaseBatch RPC.
|
|
153
|
+
*/
|
|
154
|
+
interface ReleaseBatchParams {
|
|
155
|
+
adapterId: string;
|
|
156
|
+
batchId: string;
|
|
157
|
+
claimToken: string;
|
|
158
|
+
reason?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Parameters for getBatch RPC.
|
|
162
|
+
*/
|
|
163
|
+
interface GetBatchParams {
|
|
164
|
+
batchId: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Result of getStatus RPC.
|
|
168
|
+
*/
|
|
169
|
+
interface GetStatusResult {
|
|
170
|
+
version: string;
|
|
171
|
+
projectId: string;
|
|
172
|
+
projectRoot: string;
|
|
173
|
+
pid: number;
|
|
174
|
+
uptime: number;
|
|
175
|
+
runs: number;
|
|
176
|
+
pending: number;
|
|
177
|
+
claimed: number;
|
|
178
|
+
totalBatches: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Result of listRuns RPC.
|
|
182
|
+
*/
|
|
183
|
+
interface ListRunsResult {
|
|
184
|
+
runs: RunInfo[];
|
|
185
|
+
}
|
|
186
|
+
interface RunInfo {
|
|
187
|
+
runId: string;
|
|
188
|
+
pid: number;
|
|
189
|
+
cwd: string;
|
|
190
|
+
startedAt: string;
|
|
191
|
+
lastSeen: number;
|
|
192
|
+
pendingBatches: number;
|
|
193
|
+
testMeta?: {
|
|
194
|
+
testFile?: string;
|
|
195
|
+
testName?: string;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Result of getBatch RPC.
|
|
200
|
+
*/
|
|
201
|
+
interface GetBatchResult {
|
|
202
|
+
batchId: string;
|
|
203
|
+
runId: string;
|
|
204
|
+
requests: MockRequestDescriptor[];
|
|
205
|
+
status: BatchStatus;
|
|
206
|
+
createdAt: number;
|
|
207
|
+
claim?: {
|
|
208
|
+
adapterId: string;
|
|
209
|
+
leaseUntil: number;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
type BatchStatus = "pending" | "claimed" | "fulfilled" | "expired";
|
|
213
|
+
interface RunRecord {
|
|
214
|
+
runId: string;
|
|
215
|
+
pid: number;
|
|
216
|
+
cwd: string;
|
|
217
|
+
startedAt: string;
|
|
218
|
+
lastSeen: number;
|
|
219
|
+
testMeta?: {
|
|
220
|
+
testFile?: string;
|
|
221
|
+
testName?: string;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
interface BatchRecord {
|
|
225
|
+
batchId: string;
|
|
226
|
+
runId: string;
|
|
227
|
+
requests: MockRequestDescriptor[];
|
|
228
|
+
createdAt: number;
|
|
229
|
+
status: BatchStatus;
|
|
230
|
+
claim?: {
|
|
231
|
+
adapterId: string;
|
|
232
|
+
claimToken: string;
|
|
233
|
+
leaseUntil: number;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
declare function isHelloTestMessage(msg: unknown): msg is HelloTestMessage;
|
|
237
|
+
declare function isBatchMockRequestMessage(msg: unknown): msg is BatchMockRequestMessage;
|
|
238
|
+
declare function isHeartbeatMessage(msg: unknown): msg is HeartbeatMessage;
|
|
239
|
+
declare function isJsonRpcRequest(msg: unknown): msg is JsonRpcRequest;
|
|
240
|
+
|
|
241
|
+
export { BATCH_MOCK_REQUEST, BATCH_MOCK_RESULT, type BatchMockRequestMessage, type BatchMockResultMessage, type BatchRecord, type BatchStatus, type ClaimNextBatchParams, type ClaimNextBatchResult, type GetBatchParams, type GetBatchResult, type GetStatusResult, HEARTBEAT, HEARTBEAT_ACK, HELLO_ACK, HELLO_TEST, type HeartbeatAckMessage, type HeartbeatMessage, type HelloAckMessage, type HelloTestMessage, type JsonRpcError, type JsonRpcRequest, type JsonRpcResponse, type ListRunsResult, type ProvideBatchParams, type ProvideBatchResult, RPC_CLAIM_NEXT_BATCH, RPC_ERROR_CONFLICT, RPC_ERROR_EXPIRED, RPC_ERROR_INTERNAL, RPC_ERROR_INVALID_PARAMS, RPC_ERROR_INVALID_REQUEST, RPC_ERROR_METHOD_NOT_FOUND, RPC_ERROR_NOT_FOUND, RPC_ERROR_PARSE, RPC_ERROR_UNAUTHORIZED, RPC_GET_BATCH, RPC_GET_STATUS, RPC_LIST_RUNS, RPC_PROVIDE_BATCH, RPC_RELEASE_BATCH, type ReleaseBatchParams, type RunInfo, type RunRecord, type TestChannelIncomingMessage, type TestChannelOutgoingMessage, isBatchMockRequestMessage, isHeartbeatMessage, isHelloTestMessage, isJsonRpcRequest };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { a as MockRequestDescriptor, M as MockResponseDescriptor } from '../types-bEGXLBF0.js';
|
|
2
|
+
export { A as ActiveDaemonEntry, v as ActiveDaemonsIndex, q as DaemonPaths, D as DaemonRegistry, E as EnsureDaemonOptions, o as cleanupGlobalIndex, c as computeProjectId, p as discoverAllDaemons, j as ensureDaemonRunning, g as getCacheDir, i as getDaemonEntryPath, k as getGlobalIndexPath, b as getPaths, h as healthCheck, f as randomToken, l as readGlobalIndex, d as readRegistry, n as registerDaemonGlobally, e as releaseLock, r as resolveProjectRoot, s as sleep, t as tryAcquireLock, u as unregisterDaemonGlobally, m as writeGlobalIndex, w as writeRegistry } from '../types-bEGXLBF0.js';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Protocol definitions for mock-mcp Daemon communication.
|
|
7
|
+
*
|
|
8
|
+
* Defines message types for:
|
|
9
|
+
* - Test channel (WebSocket /test): Test process ↔ Daemon
|
|
10
|
+
* - Control channel (HTTP /control): Adapter ↔ Daemon (JSON-RPC)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare const HELLO_TEST: "HELLO_TEST";
|
|
14
|
+
declare const HELLO_ACK: "HELLO_ACK";
|
|
15
|
+
declare const BATCH_MOCK_REQUEST: "BATCH_MOCK_REQUEST";
|
|
16
|
+
declare const BATCH_MOCK_RESULT: "BATCH_MOCK_RESULT";
|
|
17
|
+
declare const HEARTBEAT: "HEARTBEAT";
|
|
18
|
+
declare const HEARTBEAT_ACK: "HEARTBEAT_ACK";
|
|
19
|
+
declare const RPC_GET_STATUS: "getStatus";
|
|
20
|
+
declare const RPC_LIST_RUNS: "listRuns";
|
|
21
|
+
declare const RPC_CLAIM_NEXT_BATCH: "claimNextBatch";
|
|
22
|
+
declare const RPC_PROVIDE_BATCH: "provideBatch";
|
|
23
|
+
declare const RPC_RELEASE_BATCH: "releaseBatch";
|
|
24
|
+
declare const RPC_GET_BATCH: "getBatch";
|
|
25
|
+
/**
|
|
26
|
+
* HELLO message from test process to daemon.
|
|
27
|
+
* Must be the first message after WebSocket connection.
|
|
28
|
+
*/
|
|
29
|
+
interface HelloTestMessage {
|
|
30
|
+
type: typeof HELLO_TEST;
|
|
31
|
+
token: string;
|
|
32
|
+
runId: string;
|
|
33
|
+
pid: number;
|
|
34
|
+
cwd: string;
|
|
35
|
+
testMeta?: {
|
|
36
|
+
testFile?: string;
|
|
37
|
+
testName?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Acknowledgment of HELLO from daemon.
|
|
42
|
+
*/
|
|
43
|
+
interface HelloAckMessage {
|
|
44
|
+
type: typeof HELLO_ACK;
|
|
45
|
+
runId: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Batch mock request from test process.
|
|
49
|
+
*/
|
|
50
|
+
interface BatchMockRequestMessage {
|
|
51
|
+
type: typeof BATCH_MOCK_REQUEST;
|
|
52
|
+
runId: string;
|
|
53
|
+
requests: MockRequestDescriptor[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Batch mock result from daemon to test process.
|
|
57
|
+
*/
|
|
58
|
+
interface BatchMockResultMessage {
|
|
59
|
+
type: typeof BATCH_MOCK_RESULT;
|
|
60
|
+
batchId: string;
|
|
61
|
+
mocks: MockResponseDescriptor[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Heartbeat from test process.
|
|
65
|
+
*/
|
|
66
|
+
interface HeartbeatMessage {
|
|
67
|
+
type: typeof HEARTBEAT;
|
|
68
|
+
runId: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Heartbeat acknowledgment from daemon.
|
|
72
|
+
*/
|
|
73
|
+
interface HeartbeatAckMessage {
|
|
74
|
+
type: typeof HEARTBEAT_ACK;
|
|
75
|
+
runId: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Union type for all test channel messages (from test process).
|
|
79
|
+
*/
|
|
80
|
+
type TestChannelIncomingMessage = HelloTestMessage | BatchMockRequestMessage | HeartbeatMessage;
|
|
81
|
+
/**
|
|
82
|
+
* Union type for all test channel messages (from daemon).
|
|
83
|
+
*/
|
|
84
|
+
type TestChannelOutgoingMessage = HelloAckMessage | BatchMockResultMessage | HeartbeatAckMessage;
|
|
85
|
+
/**
|
|
86
|
+
* JSON-RPC 2.0 request structure.
|
|
87
|
+
*/
|
|
88
|
+
interface JsonRpcRequest {
|
|
89
|
+
jsonrpc: "2.0";
|
|
90
|
+
id: string | number;
|
|
91
|
+
method: string;
|
|
92
|
+
params?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* JSON-RPC 2.0 response structure.
|
|
96
|
+
*/
|
|
97
|
+
interface JsonRpcResponse {
|
|
98
|
+
jsonrpc: "2.0";
|
|
99
|
+
id: string | number;
|
|
100
|
+
result?: unknown;
|
|
101
|
+
error?: JsonRpcError;
|
|
102
|
+
}
|
|
103
|
+
interface JsonRpcError {
|
|
104
|
+
code: number;
|
|
105
|
+
message: string;
|
|
106
|
+
data?: unknown;
|
|
107
|
+
}
|
|
108
|
+
declare const RPC_ERROR_PARSE = -32700;
|
|
109
|
+
declare const RPC_ERROR_INVALID_REQUEST = -32600;
|
|
110
|
+
declare const RPC_ERROR_METHOD_NOT_FOUND = -32601;
|
|
111
|
+
declare const RPC_ERROR_INVALID_PARAMS = -32602;
|
|
112
|
+
declare const RPC_ERROR_INTERNAL = -32603;
|
|
113
|
+
declare const RPC_ERROR_NOT_FOUND = -32000;
|
|
114
|
+
declare const RPC_ERROR_UNAUTHORIZED = -32001;
|
|
115
|
+
declare const RPC_ERROR_CONFLICT = -32002;
|
|
116
|
+
declare const RPC_ERROR_EXPIRED = -32003;
|
|
117
|
+
/**
|
|
118
|
+
* Parameters for claimNextBatch RPC.
|
|
119
|
+
*/
|
|
120
|
+
interface ClaimNextBatchParams {
|
|
121
|
+
adapterId: string;
|
|
122
|
+
runId?: string;
|
|
123
|
+
leaseMs?: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Result of claimNextBatch RPC.
|
|
127
|
+
*/
|
|
128
|
+
interface ClaimNextBatchResult {
|
|
129
|
+
batchId: string;
|
|
130
|
+
runId: string;
|
|
131
|
+
requests: MockRequestDescriptor[];
|
|
132
|
+
claimToken: string;
|
|
133
|
+
leaseUntil: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Parameters for provideBatch RPC.
|
|
137
|
+
*/
|
|
138
|
+
interface ProvideBatchParams {
|
|
139
|
+
adapterId: string;
|
|
140
|
+
batchId: string;
|
|
141
|
+
claimToken: string;
|
|
142
|
+
mocks: MockResponseDescriptor[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Result of provideBatch RPC.
|
|
146
|
+
*/
|
|
147
|
+
interface ProvideBatchResult {
|
|
148
|
+
ok: boolean;
|
|
149
|
+
message?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Parameters for releaseBatch RPC.
|
|
153
|
+
*/
|
|
154
|
+
interface ReleaseBatchParams {
|
|
155
|
+
adapterId: string;
|
|
156
|
+
batchId: string;
|
|
157
|
+
claimToken: string;
|
|
158
|
+
reason?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Parameters for getBatch RPC.
|
|
162
|
+
*/
|
|
163
|
+
interface GetBatchParams {
|
|
164
|
+
batchId: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Result of getStatus RPC.
|
|
168
|
+
*/
|
|
169
|
+
interface GetStatusResult {
|
|
170
|
+
version: string;
|
|
171
|
+
projectId: string;
|
|
172
|
+
projectRoot: string;
|
|
173
|
+
pid: number;
|
|
174
|
+
uptime: number;
|
|
175
|
+
runs: number;
|
|
176
|
+
pending: number;
|
|
177
|
+
claimed: number;
|
|
178
|
+
totalBatches: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Result of listRuns RPC.
|
|
182
|
+
*/
|
|
183
|
+
interface ListRunsResult {
|
|
184
|
+
runs: RunInfo[];
|
|
185
|
+
}
|
|
186
|
+
interface RunInfo {
|
|
187
|
+
runId: string;
|
|
188
|
+
pid: number;
|
|
189
|
+
cwd: string;
|
|
190
|
+
startedAt: string;
|
|
191
|
+
lastSeen: number;
|
|
192
|
+
pendingBatches: number;
|
|
193
|
+
testMeta?: {
|
|
194
|
+
testFile?: string;
|
|
195
|
+
testName?: string;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Result of getBatch RPC.
|
|
200
|
+
*/
|
|
201
|
+
interface GetBatchResult {
|
|
202
|
+
batchId: string;
|
|
203
|
+
runId: string;
|
|
204
|
+
requests: MockRequestDescriptor[];
|
|
205
|
+
status: BatchStatus;
|
|
206
|
+
createdAt: number;
|
|
207
|
+
claim?: {
|
|
208
|
+
adapterId: string;
|
|
209
|
+
leaseUntil: number;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
type BatchStatus = "pending" | "claimed" | "fulfilled" | "expired";
|
|
213
|
+
interface RunRecord {
|
|
214
|
+
runId: string;
|
|
215
|
+
pid: number;
|
|
216
|
+
cwd: string;
|
|
217
|
+
startedAt: string;
|
|
218
|
+
lastSeen: number;
|
|
219
|
+
testMeta?: {
|
|
220
|
+
testFile?: string;
|
|
221
|
+
testName?: string;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
interface BatchRecord {
|
|
225
|
+
batchId: string;
|
|
226
|
+
runId: string;
|
|
227
|
+
requests: MockRequestDescriptor[];
|
|
228
|
+
createdAt: number;
|
|
229
|
+
status: BatchStatus;
|
|
230
|
+
claim?: {
|
|
231
|
+
adapterId: string;
|
|
232
|
+
claimToken: string;
|
|
233
|
+
leaseUntil: number;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
declare function isHelloTestMessage(msg: unknown): msg is HelloTestMessage;
|
|
237
|
+
declare function isBatchMockRequestMessage(msg: unknown): msg is BatchMockRequestMessage;
|
|
238
|
+
declare function isHeartbeatMessage(msg: unknown): msg is HeartbeatMessage;
|
|
239
|
+
declare function isJsonRpcRequest(msg: unknown): msg is JsonRpcRequest;
|
|
240
|
+
|
|
241
|
+
export { BATCH_MOCK_REQUEST, BATCH_MOCK_RESULT, type BatchMockRequestMessage, type BatchMockResultMessage, type BatchRecord, type BatchStatus, type ClaimNextBatchParams, type ClaimNextBatchResult, type GetBatchParams, type GetBatchResult, type GetStatusResult, HEARTBEAT, HEARTBEAT_ACK, HELLO_ACK, HELLO_TEST, type HeartbeatAckMessage, type HeartbeatMessage, type HelloAckMessage, type HelloTestMessage, type JsonRpcError, type JsonRpcRequest, type JsonRpcResponse, type ListRunsResult, type ProvideBatchParams, type ProvideBatchResult, RPC_CLAIM_NEXT_BATCH, RPC_ERROR_CONFLICT, RPC_ERROR_EXPIRED, RPC_ERROR_INTERNAL, RPC_ERROR_INVALID_PARAMS, RPC_ERROR_INVALID_REQUEST, RPC_ERROR_METHOD_NOT_FOUND, RPC_ERROR_NOT_FOUND, RPC_ERROR_PARSE, RPC_ERROR_UNAUTHORIZED, RPC_GET_BATCH, RPC_GET_STATUS, RPC_LIST_RUNS, RPC_PROVIDE_BATCH, RPC_RELEASE_BATCH, type ReleaseBatchParams, type RunInfo, type RunRecord, type TestChannelIncomingMessage, type TestChannelOutgoingMessage, isBatchMockRequestMessage, isHeartbeatMessage, isHelloTestMessage, isJsonRpcRequest };
|