@opencraw/driver 0.7.10 → 0.7.11

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.
Files changed (35) hide show
  1. package/README.md +1 -77
  2. package/package.json +4 -45
  3. package/dist/index.esm.js +0 -655
  4. package/dist/main.esm.js +0 -563
  5. package/dist/src/callout-bridge/client-hooks.client.d.ts +0 -47
  6. package/dist/src/callout-bridge/index.d.ts +0 -3
  7. package/dist/src/index.d.ts +0 -16
  8. package/dist/src/main.d.ts +0 -3
  9. package/dist/src/protocol/driver-json-schema.mapper.d.ts +0 -9
  10. package/dist/src/protocol/driver-message.contract.d.ts +0 -492
  11. package/dist/src/protocol/index.d.ts +0 -4
  12. package/dist/src/record-files/diff-record-files.use-case.d.ts +0 -10
  13. package/dist/src/record-files/export-record-files.use-case.d.ts +0 -11
  14. package/dist/src/record-files/index.d.ts +0 -3
  15. package/dist/src/runtime-manifest/index.d.ts +0 -4
  16. package/dist/src/runtime-manifest/runtime-manifest-json-schema.mapper.d.ts +0 -8
  17. package/dist/src/runtime-manifest/runtime-manifest.contract.d.ts +0 -28
  18. package/dist/src/server/index.d.ts +0 -3
  19. package/dist/src/server/serve-driver.use-case.d.ts +0 -17
  20. package/dist/src/session/index.d.ts +0 -5
  21. package/dist/src/session/recipe-loading.use-case.d.ts +0 -23
  22. package/dist/src/session/run-session.use-case.d.ts +0 -35
  23. package/dist/src/session/streaming-sink.repository.d.ts +0 -8
  24. package/dist/src/site-access/index.d.ts +0 -3
  25. package/dist/src/site-access/resolve-site-access.use-case.d.ts +0 -26
  26. package/dist/src/site-probe/index.d.ts +0 -2
  27. package/dist/src/site-probe/probe-site.use-case.d.ts +0 -13
  28. package/dist/src/transport/index.d.ts +0 -5
  29. package/dist/src/transport/json-rpc.contract.d.ts +0 -31
  30. package/dist/src/transport/line-channel.client.d.ts +0 -27
  31. package/dist/src/work-bridge/client-work-source.client.d.ts +0 -17
  32. package/dist/src/work-bridge/index.d.ts +0 -2
  33. package/schemas/driver-protocol.schema.json +0 -1104
  34. package/schemas/driver-runtime.fixture.json +0 -9
  35. package/schemas/driver-runtime.schema.json +0 -63
@@ -1,492 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * The driver protocol's version, separate from the package's: a client pins a major and the driver refuses
4
- * another. Additions (methods, optional fields) raise the minor; anything a client could break on, the major.
5
- */
6
- export declare const PROTOCOL_VERSION = "1.2.0";
7
- export declare const initializeParamsSchema: z.ZodObject<{
8
- clientName: z.ZodString;
9
- clientVersion: z.ZodString;
10
- protocolVersion: z.ZodString;
11
- }, z.core.$strict>;
12
- export type InitializeParams = z.infer<typeof initializeParamsSchema>;
13
- export declare const initializeResultSchema: z.ZodObject<{
14
- driverVersion: z.ZodString;
15
- protocolVersion: z.ZodString;
16
- methods: z.ZodArray<z.ZodString>;
17
- }, z.core.$strict>;
18
- export type InitializeResult = z.infer<typeof initializeResultSchema>;
19
- export declare const validateParamsSchema: z.ZodObject<{
20
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
- recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
22
- only: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
- }, z.core.$strict>;
24
- export type ValidateParams = z.infer<typeof validateParamsSchema>;
25
- export declare const validateResultSchema: z.ZodObject<{
26
- ok: z.ZodBoolean;
27
- inputs: z.ZodArray<z.ZodString>;
28
- hooks: z.ZodArray<z.ZodString>;
29
- issues: z.ZodArray<z.ZodObject<{
30
- source: z.ZodOptional<z.ZodString>;
31
- recipeId: z.ZodOptional<z.ZodString>;
32
- path: z.ZodString;
33
- message: z.ZodString;
34
- }, z.core.$strict>>;
35
- }, z.core.$strict>;
36
- export type ValidateResult = z.infer<typeof validateResultSchema>;
37
- export declare const runParamsSchema: z.ZodObject<{
38
- accessConfig: z.ZodOptional<z.ZodString>;
39
- access: z.ZodOptional<z.ZodString>;
40
- accessPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
- recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
43
- only: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
- out: z.ZodOptional<z.ZodString>;
45
- append: z.ZodOptional<z.ZodBoolean>;
46
- resume: z.ZodOptional<z.ZodBoolean>;
47
- dryRun: z.ZodOptional<z.ZodBoolean>;
48
- parallel: z.ZodOptional<z.ZodNumber>;
49
- browser: z.ZodOptional<z.ZodObject<{
50
- headless: z.ZodOptional<z.ZodBoolean>;
51
- executablePath: z.ZodOptional<z.ZodString>;
52
- ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
53
- }, z.core.$strict>>;
54
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
- captchaSolvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
56
- }, z.core.$strict>;
57
- export type RunParams = z.infer<typeof runParamsSchema>;
58
- export declare const runResultSchema: z.ZodObject<{
59
- runId: z.ZodString;
60
- }, z.core.$strict>;
61
- export declare const workParamsSchema: z.ZodObject<{
62
- accessConfig: z.ZodOptional<z.ZodString>;
63
- access: z.ZodOptional<z.ZodString>;
64
- accessPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
- recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
67
- only: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
- out: z.ZodOptional<z.ZodString>;
69
- append: z.ZodOptional<z.ZodBoolean>;
70
- browser: z.ZodOptional<z.ZodObject<{
71
- headless: z.ZodOptional<z.ZodBoolean>;
72
- executablePath: z.ZodOptional<z.ZodString>;
73
- ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
74
- }, z.core.$strict>>;
75
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
- captchaSolvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
- windows: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
78
- }, z.core.$strict>;
79
- export type WorkParams = z.infer<typeof workParamsSchema>;
80
- export declare const workItemSchema: z.ZodObject<{
81
- id: z.ZodString;
82
- vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
83
- recipe: z.ZodOptional<z.ZodString>;
84
- }, z.core.$strict>;
85
- export type WorkItemMessage = z.infer<typeof workItemSchema>;
86
- export type RunResult = z.infer<typeof runResultSchema>;
87
- export declare const cancelParamsSchema: z.ZodObject<{
88
- runId: z.ZodString;
89
- }, z.core.$strict>;
90
- export type CancelParams = z.infer<typeof cancelParamsSchema>;
91
- export declare const cancelResultSchema: z.ZodObject<{
92
- cancelled: z.ZodBoolean;
93
- }, z.core.$strict>;
94
- export type CancelResult = z.infer<typeof cancelResultSchema>;
95
- export declare const probeParamsSchema: z.ZodObject<{
96
- accessConfig: z.ZodOptional<z.ZodString>;
97
- access: z.ZodOptional<z.ZodString>;
98
- accessPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
- url: z.ZodString;
100
- browser: z.ZodOptional<z.ZodBoolean>;
101
- browserPath: z.ZodOptional<z.ZodString>;
102
- insecureTls: z.ZodOptional<z.ZodBoolean>;
103
- userAgent: z.ZodOptional<z.ZodString>;
104
- }, z.core.$strict>;
105
- export type ProbeParams = z.infer<typeof probeParamsSchema>;
106
- /** What the page holds and how a recipe could reach it (`ProbeResult`); its shape is the probe's, versioned with it. */
107
- export declare const probeResultSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
108
- export declare const diffParamsSchema: z.ZodObject<{
109
- previous: z.ZodString;
110
- current: z.ZodString;
111
- key: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
- ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
- limit: z.ZodOptional<z.ZodNumber>;
114
- }, z.core.$strict>;
115
- export type DiffParams = z.infer<typeof diffParamsSchema>;
116
- export declare const diffResultSchema: z.ZodObject<{
117
- added: z.ZodNumber;
118
- removed: z.ZodNumber;
119
- changed: z.ZodNumber;
120
- unchanged: z.ZodNumber;
121
- shrunk: z.ZodOptional<z.ZodObject<{
122
- previous: z.ZodNumber;
123
- current: z.ZodNumber;
124
- }, z.core.$strict>>;
125
- summary: z.ZodArray<z.ZodString>;
126
- changes: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
127
- truncated: z.ZodBoolean;
128
- }, z.core.$strict>;
129
- export type DiffResult = z.infer<typeof diffResultSchema>;
130
- export declare const exportParamsSchema: z.ZodObject<{
131
- records: z.ZodString;
132
- output: z.ZodString;
133
- out: z.ZodString;
134
- }, z.core.$strict>;
135
- export type ExportParams = z.infer<typeof exportParamsSchema>;
136
- export declare const exportResultSchema: z.ZodObject<{
137
- written: z.ZodNumber;
138
- location: z.ZodString;
139
- }, z.core.$strict>;
140
- export type ExportResult = z.infer<typeof exportResultSchema>;
141
- export declare const shutdownResultSchema: z.ZodObject<{}, z.core.$strict>;
142
- /** A window wants its next item. The client may hold the answer until it has one; `null` ends the work. */
143
- export declare const workNextParamsSchema: z.ZodObject<{
144
- runId: z.ZodString;
145
- }, z.core.$strict>;
146
- export declare const workNextResultSchema: z.ZodObject<{
147
- item: z.ZodNullable<z.ZodObject<{
148
- id: z.ZodString;
149
- vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
150
- recipe: z.ZodOptional<z.ZodString>;
151
- }, z.core.$strict>>;
152
- }, z.core.$strict>;
153
- export type WorkNextResult = z.infer<typeof workNextResultSchema>;
154
- /** An item succeeded: its report (`RecipeReport`) and its records. */
155
- export declare const workDoneParamsSchema: z.ZodObject<{
156
- runId: z.ZodString;
157
- item: z.ZodObject<{
158
- id: z.ZodString;
159
- vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
160
- recipe: z.ZodOptional<z.ZodString>;
161
- }, z.core.$strict>;
162
- report: z.ZodRecord<z.ZodString, z.ZodUnknown>;
163
- records: z.ZodArray<z.ZodObject<{
164
- key: z.ZodNullable<z.ZodString>;
165
- data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
166
- }, z.core.$strict>>;
167
- }, z.core.$strict>;
168
- export type WorkDoneParams = z.infer<typeof workDoneParamsSchema>;
169
- /** An item failed (`failure`) or came out neither way (`neutral`, such as a captcha it could not pass). */
170
- export declare const workFailedParamsSchema: z.ZodObject<{
171
- runId: z.ZodString;
172
- item: z.ZodObject<{
173
- id: z.ZodString;
174
- vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
175
- recipe: z.ZodOptional<z.ZodString>;
176
- }, z.core.$strict>;
177
- report: z.ZodRecord<z.ZodString, z.ZodUnknown>;
178
- outcome: z.ZodEnum<{
179
- failure: "failure";
180
- neutral: "neutral";
181
- }>;
182
- }, z.core.$strict>;
183
- export type WorkFailedParams = z.infer<typeof workFailedParamsSchema>;
184
- /** Every crawl event, as core reports it (`CrawlEvent`); its shape is core's, versioned with core. */
185
- export declare const eventParamsSchema: z.ZodObject<{
186
- runId: z.ZodString;
187
- event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
188
- }, z.core.$strict>;
189
- export type EventParams = z.infer<typeof eventParamsSchema>;
190
- export declare const recordParamsSchema: z.ZodObject<{
191
- runId: z.ZodString;
192
- recipeId: z.ZodString;
193
- key: z.ZodNullable<z.ZodString>;
194
- data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
195
- }, z.core.$strict>;
196
- export type RecordParams = z.infer<typeof recordParamsSchema>;
197
- export declare const finishedParamsSchema: z.ZodObject<{
198
- runId: z.ZodString;
199
- report: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
200
- error: z.ZodOptional<z.ZodString>;
201
- }, z.core.$strict>;
202
- export type FinishedParams = z.infer<typeof finishedParamsSchema>;
203
- /** A hook, captcha solver or access plugin the client serves (`request.kind`): core's own callout request, answered with core's callout response. */
204
- export declare const calloutParamsSchema: z.ZodObject<{
205
- runId: z.ZodString;
206
- request: z.ZodObject<{
207
- kind: z.ZodEnum<{
208
- access: "access";
209
- captcha: "captcha";
210
- hook: "hook";
211
- }>;
212
- name: z.ZodString;
213
- input: z.ZodOptional<z.ZodUnknown>;
214
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
215
- context: z.ZodObject<{
216
- recipeId: z.ZodString;
217
- scope: z.ZodRecord<z.ZodString, z.ZodUnknown>;
218
- }, z.core.$strict>;
219
- idempotencyKey: z.ZodString;
220
- callback: z.ZodOptional<z.ZodObject<{
221
- url: z.ZodString;
222
- }, z.core.$strict>>;
223
- }, z.core.$strict>;
224
- }, z.core.$strict>;
225
- export type CalloutParams = z.infer<typeof calloutParamsSchema>;
226
- export declare const calloutResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
227
- status: z.ZodLiteral<"ok">;
228
- output: z.ZodOptional<z.ZodUnknown>;
229
- }, z.core.$strict>, z.ZodObject<{
230
- status: z.ZodLiteral<"error">;
231
- error: z.ZodString;
232
- }, z.core.$strict>, z.ZodObject<{
233
- status: z.ZodLiteral<"pending">;
234
- retryAfterMs: z.ZodOptional<z.ZodNumber>;
235
- }, z.core.$strict>], "status">;
236
- /** Every method and notification, by name: what the generated schema and the clients' models are made from. */
237
- export declare const MESSAGES: {
238
- readonly initialize: {
239
- readonly direction: 'client-to-driver';
240
- readonly params: z.ZodObject<{
241
- clientName: z.ZodString;
242
- clientVersion: z.ZodString;
243
- protocolVersion: z.ZodString;
244
- }, z.core.$strict>;
245
- readonly result: z.ZodObject<{
246
- driverVersion: z.ZodString;
247
- protocolVersion: z.ZodString;
248
- methods: z.ZodArray<z.ZodString>;
249
- }, z.core.$strict>;
250
- };
251
- readonly validate: {
252
- readonly direction: 'client-to-driver';
253
- readonly params: z.ZodObject<{
254
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
255
- recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
256
- only: z.ZodOptional<z.ZodArray<z.ZodString>>;
257
- }, z.core.$strict>;
258
- readonly result: z.ZodObject<{
259
- ok: z.ZodBoolean;
260
- inputs: z.ZodArray<z.ZodString>;
261
- hooks: z.ZodArray<z.ZodString>;
262
- issues: z.ZodArray<z.ZodObject<{
263
- source: z.ZodOptional<z.ZodString>;
264
- recipeId: z.ZodOptional<z.ZodString>;
265
- path: z.ZodString;
266
- message: z.ZodString;
267
- }, z.core.$strict>>;
268
- }, z.core.$strict>;
269
- };
270
- readonly run: {
271
- readonly direction: 'client-to-driver';
272
- readonly params: z.ZodObject<{
273
- accessConfig: z.ZodOptional<z.ZodString>;
274
- access: z.ZodOptional<z.ZodString>;
275
- accessPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
276
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
277
- recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
278
- only: z.ZodOptional<z.ZodArray<z.ZodString>>;
279
- out: z.ZodOptional<z.ZodString>;
280
- append: z.ZodOptional<z.ZodBoolean>;
281
- resume: z.ZodOptional<z.ZodBoolean>;
282
- dryRun: z.ZodOptional<z.ZodBoolean>;
283
- parallel: z.ZodOptional<z.ZodNumber>;
284
- browser: z.ZodOptional<z.ZodObject<{
285
- headless: z.ZodOptional<z.ZodBoolean>;
286
- executablePath: z.ZodOptional<z.ZodString>;
287
- ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
288
- }, z.core.$strict>>;
289
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
290
- captchaSolvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
291
- }, z.core.$strict>;
292
- readonly result: z.ZodObject<{
293
- runId: z.ZodString;
294
- }, z.core.$strict>;
295
- };
296
- readonly work: {
297
- readonly direction: 'client-to-driver';
298
- readonly params: z.ZodObject<{
299
- accessConfig: z.ZodOptional<z.ZodString>;
300
- access: z.ZodOptional<z.ZodString>;
301
- accessPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
302
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
303
- recipes: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
304
- only: z.ZodOptional<z.ZodArray<z.ZodString>>;
305
- out: z.ZodOptional<z.ZodString>;
306
- append: z.ZodOptional<z.ZodBoolean>;
307
- browser: z.ZodOptional<z.ZodObject<{
308
- headless: z.ZodOptional<z.ZodBoolean>;
309
- executablePath: z.ZodOptional<z.ZodString>;
310
- ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
311
- }, z.core.$strict>>;
312
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
313
- captchaSolvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
314
- windows: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
315
- }, z.core.$strict>;
316
- readonly result: z.ZodObject<{
317
- runId: z.ZodString;
318
- }, z.core.$strict>;
319
- };
320
- readonly cancel: {
321
- readonly direction: 'client-to-driver';
322
- readonly params: z.ZodObject<{
323
- runId: z.ZodString;
324
- }, z.core.$strict>;
325
- readonly result: z.ZodObject<{
326
- cancelled: z.ZodBoolean;
327
- }, z.core.$strict>;
328
- };
329
- readonly probe: {
330
- readonly direction: 'client-to-driver';
331
- readonly params: z.ZodObject<{
332
- accessConfig: z.ZodOptional<z.ZodString>;
333
- access: z.ZodOptional<z.ZodString>;
334
- accessPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
335
- url: z.ZodString;
336
- browser: z.ZodOptional<z.ZodBoolean>;
337
- browserPath: z.ZodOptional<z.ZodString>;
338
- insecureTls: z.ZodOptional<z.ZodBoolean>;
339
- userAgent: z.ZodOptional<z.ZodString>;
340
- }, z.core.$strict>;
341
- readonly result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
342
- };
343
- readonly diff: {
344
- readonly direction: 'client-to-driver';
345
- readonly params: z.ZodObject<{
346
- previous: z.ZodString;
347
- current: z.ZodString;
348
- key: z.ZodOptional<z.ZodArray<z.ZodString>>;
349
- ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
350
- limit: z.ZodOptional<z.ZodNumber>;
351
- }, z.core.$strict>;
352
- readonly result: z.ZodObject<{
353
- added: z.ZodNumber;
354
- removed: z.ZodNumber;
355
- changed: z.ZodNumber;
356
- unchanged: z.ZodNumber;
357
- shrunk: z.ZodOptional<z.ZodObject<{
358
- previous: z.ZodNumber;
359
- current: z.ZodNumber;
360
- }, z.core.$strict>>;
361
- summary: z.ZodArray<z.ZodString>;
362
- changes: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
363
- truncated: z.ZodBoolean;
364
- }, z.core.$strict>;
365
- };
366
- readonly export: {
367
- readonly direction: 'client-to-driver';
368
- readonly params: z.ZodObject<{
369
- records: z.ZodString;
370
- output: z.ZodString;
371
- out: z.ZodString;
372
- }, z.core.$strict>;
373
- readonly result: z.ZodObject<{
374
- written: z.ZodNumber;
375
- location: z.ZodString;
376
- }, z.core.$strict>;
377
- };
378
- readonly shutdown: {
379
- readonly direction: 'client-to-driver';
380
- readonly params: undefined;
381
- readonly result: z.ZodObject<{}, z.core.$strict>;
382
- };
383
- readonly callout: {
384
- readonly direction: 'driver-to-client';
385
- readonly params: z.ZodObject<{
386
- runId: z.ZodString;
387
- request: z.ZodObject<{
388
- kind: z.ZodEnum<{
389
- access: "access";
390
- captcha: "captcha";
391
- hook: "hook";
392
- }>;
393
- name: z.ZodString;
394
- input: z.ZodOptional<z.ZodUnknown>;
395
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
396
- context: z.ZodObject<{
397
- recipeId: z.ZodString;
398
- scope: z.ZodRecord<z.ZodString, z.ZodUnknown>;
399
- }, z.core.$strict>;
400
- idempotencyKey: z.ZodString;
401
- callback: z.ZodOptional<z.ZodObject<{
402
- url: z.ZodString;
403
- }, z.core.$strict>>;
404
- }, z.core.$strict>;
405
- }, z.core.$strict>;
406
- readonly result: z.ZodDiscriminatedUnion<[z.ZodObject<{
407
- status: z.ZodLiteral<"ok">;
408
- output: z.ZodOptional<z.ZodUnknown>;
409
- }, z.core.$strict>, z.ZodObject<{
410
- status: z.ZodLiteral<"error">;
411
- error: z.ZodString;
412
- }, z.core.$strict>, z.ZodObject<{
413
- status: z.ZodLiteral<"pending">;
414
- retryAfterMs: z.ZodOptional<z.ZodNumber>;
415
- }, z.core.$strict>], "status">;
416
- };
417
- readonly 'work.next': {
418
- readonly direction: 'driver-to-client';
419
- readonly params: z.ZodObject<{
420
- runId: z.ZodString;
421
- }, z.core.$strict>;
422
- readonly result: z.ZodObject<{
423
- item: z.ZodNullable<z.ZodObject<{
424
- id: z.ZodString;
425
- vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
426
- recipe: z.ZodOptional<z.ZodString>;
427
- }, z.core.$strict>>;
428
- }, z.core.$strict>;
429
- };
430
- readonly 'work.done': {
431
- readonly direction: 'driver-to-client';
432
- readonly params: z.ZodObject<{
433
- runId: z.ZodString;
434
- item: z.ZodObject<{
435
- id: z.ZodString;
436
- vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
437
- recipe: z.ZodOptional<z.ZodString>;
438
- }, z.core.$strict>;
439
- report: z.ZodRecord<z.ZodString, z.ZodUnknown>;
440
- records: z.ZodArray<z.ZodObject<{
441
- key: z.ZodNullable<z.ZodString>;
442
- data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
443
- }, z.core.$strict>>;
444
- }, z.core.$strict>;
445
- readonly result: undefined;
446
- };
447
- readonly 'work.failed': {
448
- readonly direction: 'driver-to-client';
449
- readonly params: z.ZodObject<{
450
- runId: z.ZodString;
451
- item: z.ZodObject<{
452
- id: z.ZodString;
453
- vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
454
- recipe: z.ZodOptional<z.ZodString>;
455
- }, z.core.$strict>;
456
- report: z.ZodRecord<z.ZodString, z.ZodUnknown>;
457
- outcome: z.ZodEnum<{
458
- failure: "failure";
459
- neutral: "neutral";
460
- }>;
461
- }, z.core.$strict>;
462
- readonly result: undefined;
463
- };
464
- readonly event: {
465
- readonly direction: 'driver-to-client';
466
- readonly params: z.ZodObject<{
467
- runId: z.ZodString;
468
- event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
469
- }, z.core.$strict>;
470
- readonly result: undefined;
471
- };
472
- readonly record: {
473
- readonly direction: 'driver-to-client';
474
- readonly params: z.ZodObject<{
475
- runId: z.ZodString;
476
- recipeId: z.ZodString;
477
- key: z.ZodNullable<z.ZodString>;
478
- data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
479
- }, z.core.$strict>;
480
- readonly result: undefined;
481
- };
482
- readonly finished: {
483
- readonly direction: 'driver-to-client';
484
- readonly params: z.ZodObject<{
485
- runId: z.ZodString;
486
- report: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
487
- error: z.ZodOptional<z.ZodString>;
488
- }, z.core.$strict>;
489
- readonly result: undefined;
490
- };
491
- };
492
- //# sourceMappingURL=driver-message.contract.d.ts.map
@@ -1,4 +0,0 @@
1
- export { PROTOCOL_VERSION, MESSAGES, initializeParamsSchema, initializeResultSchema, validateParamsSchema, validateResultSchema, runParamsSchema, runResultSchema, cancelParamsSchema, cancelResultSchema, shutdownResultSchema, eventParamsSchema, recordParamsSchema, finishedParamsSchema, calloutParamsSchema, calloutResultSchema, probeParamsSchema, probeResultSchema, diffParamsSchema, diffResultSchema, exportParamsSchema, exportResultSchema, workParamsSchema, workItemSchema, workNextParamsSchema, workNextResultSchema, workDoneParamsSchema, workFailedParamsSchema, } from './driver-message.contract.js';
2
- export type { InitializeParams, InitializeResult, ValidateParams, ValidateResult, RunParams, RunResult, CancelParams, CancelResult, EventParams, RecordParams, FinishedParams, CalloutParams, ProbeParams, DiffParams, DiffResult, ExportParams, ExportResult, WorkParams, WorkItemMessage, WorkNextResult, WorkDoneParams, WorkFailedParams, } from './driver-message.contract.js';
3
- export { driverProtocolJsonSchema } from './driver-json-schema.mapper.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,10 +0,0 @@
1
- import type { DiffParams, DiffResult } from '../protocol/index.js';
2
- /**
3
- * Compares two runs' JSON Lines files by key: how many records were added, removed, changed and left
4
- * alone, the report a person reads, and the changes themselves, up to `limit`.
5
- *
6
- * @param params - The two files, the key fields, the fields to ignore and the limit.
7
- * @returns The comparison.
8
- */
9
- export declare function diffRecordFiles(params: DiffParams): Promise<DiffResult>;
10
- //# sourceMappingURL=diff-record-files.use-case.d.ts.map
@@ -1,11 +0,0 @@
1
- import type { ExportParams, ExportResult } from '../protocol/index.js';
2
- /**
3
- * Writes a finished run's JSON Lines file again in another format, the extension of `out` naming it, as
4
- * the CLI's `export` does. The output recipe gives the columns: its fields, in order, with their types.
5
- *
6
- * @param params - The records, the output recipe and the file to write.
7
- * @returns How many records were written, and where.
8
- * @throws RecipeValidationError When `output` is not an output recipe.
9
- */
10
- export declare function exportRecordFiles(params: ExportParams): Promise<ExportResult>;
11
- //# sourceMappingURL=export-record-files.use-case.d.ts.map
@@ -1,3 +0,0 @@
1
- export { diffRecordFiles } from './diff-record-files.use-case.js';
2
- export { exportRecordFiles } from './export-record-files.use-case.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +0,0 @@
1
- export { RUNTIME_PLATFORMS, runtimeManifestSchema } from './runtime-manifest.contract.js';
2
- export type { RuntimeManifest, RuntimePlatform } from './runtime-manifest.contract.js';
3
- export { runtimeManifestJsonSchema } from './runtime-manifest-json-schema.mapper.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,8 +0,0 @@
1
- /**
2
- * `driver-runtime.json`'s JSON Schema, written to `schemas/driver-runtime.schema.json`: what clients in
3
- * other languages generate their manifest model from.
4
- *
5
- * @returns The schema.
6
- */
7
- export declare function runtimeManifestJsonSchema(): Record<string, unknown>;
8
- //# sourceMappingURL=runtime-manifest-json-schema.mapper.d.ts.map
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
2
- /** The platforms the driver's runtime is built for: `<process.platform>-<process.arch>`. */
3
- export declare const RUNTIME_PLATFORMS: readonly ['win32-x64', 'darwin-arm64', 'darwin-x64', 'linux-x64', 'linux-arm64'];
4
- export type RuntimePlatform = typeof RUNTIME_PLATFORMS[number];
5
- /**
6
- * `driver-runtime.json`, an asset of each driver release beside the archives: what a client in any
7
- * language reads to download the runtime for its platform, check it and start it. The archive holds a
8
- * Node binary, the driver and its dependencies, and `runtime.json` (`command`: the Node binary and the
9
- * driver's entry, both relative to the folder the archive is unpacked into).
10
- */
11
- export declare const runtimeManifestSchema: z.ZodObject<{
12
- driverVersion: z.ZodString;
13
- protocolVersion: z.ZodString;
14
- node: z.ZodString;
15
- archives: z.ZodRecord<z.ZodEnum<{
16
- "darwin-arm64": "darwin-arm64";
17
- "darwin-x64": "darwin-x64";
18
- "linux-arm64": "linux-arm64";
19
- "linux-x64": "linux-x64";
20
- "win32-x64": "win32-x64";
21
- }> & z.core.$partial, z.ZodObject<{
22
- file: z.ZodString;
23
- sha256: z.ZodString;
24
- size: z.ZodNumber;
25
- }, z.core.$strict>>;
26
- }, z.core.$strict>;
27
- export type RuntimeManifest = z.infer<typeof runtimeManifestSchema>;
28
- //# sourceMappingURL=runtime-manifest.contract.d.ts.map
@@ -1,3 +0,0 @@
1
- export { serveDriver } from './serve-driver.use-case.js';
2
- export type { DriverIdentity } from './serve-driver.use-case.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,17 +0,0 @@
1
- import type { Readable, Writable } from 'node:stream';
2
- /** What the driver says about itself in `initialize`. */
3
- export interface DriverIdentity {
4
- driverVersion: string;
5
- }
6
- /**
7
- * Serves the driver protocol on a stream pair until the client closes its end or asks for `shutdown`.
8
- * Every method but `initialize` is refused until the client has initialized with a protocol of the same
9
- * major. On close, every run still going is closed.
10
- *
11
- * @param input - Where the client's messages arrive (stdin).
12
- * @param output - Where the driver's go (stdout). Nothing else may write to it.
13
- * @param identity - The driver's version, for `initialize`.
14
- * @returns Settles once the driver has stopped.
15
- */
16
- export declare function serveDriver(input: Readable, output: Writable, identity: DriverIdentity): Promise<void>;
17
- //# sourceMappingURL=serve-driver.use-case.d.ts.map
@@ -1,5 +0,0 @@
1
- export { runSessions } from './run-session.use-case.js';
2
- export type { LocalPlugins, RunSessions } from './run-session.use-case.js';
3
- export { validateRecipes, hooksOf, loadRecipes, sourceOf } from './recipe-loading.use-case.js';
4
- export { streamingSink } from './streaming-sink.repository.js';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,23 +0,0 @@
1
- import type { RecipeSet, RecipeSource } from '@opencraw/core';
2
- import type { ValidateParams, ValidateResult } from '../protocol/index.js';
3
- /** The recipes a method names: files and folders, or the recipes themselves. Exactly one of the two. */
4
- export declare function sourceOf(params: {
5
- paths?: string[];
6
- recipes?: Record<string, unknown>[];
7
- }): RecipeSource;
8
- /** Loads and binds a method's recipes, keeping the input ids in `only`. */
9
- export declare function loadRecipes(params: {
10
- paths?: string[];
11
- recipes?: Record<string, unknown>[];
12
- only?: string[];
13
- }): Promise<RecipeSet>;
14
- /** Every hook the set's input recipes call, once each, sorted. */
15
- export declare function hooksOf(set: RecipeSet): string[];
16
- /**
17
- * Checks recipes the way `run` would load them, without running them.
18
- *
19
- * @param params - The recipes and the input ids to keep.
20
- * @returns Whether they load, the inputs and hooks a run would have, and every problem with its path.
21
- */
22
- export declare function validateRecipes(params: ValidateParams): Promise<ValidateResult>;
23
- //# sourceMappingURL=recipe-loading.use-case.d.ts.map
@@ -1,35 +0,0 @@
1
- import { RecipeSet } from '@opencraw/core';
2
- import type { AccessPlugin, CaptchaSolver, HookMap } from '@opencraw/core';
3
- import type { AskClient, NotifyClient } from '../callout-bridge/index.js';
4
- import type { RunParams, WorkParams } from '../protocol/index.js';
5
- /** The runs a driver has going, by id, so `cancel` can reach them and `shutdown` close them all. */
6
- export interface RunSessions {
7
- start: (params: RunParams) => Promise<string>;
8
- /** As `start`, for recipes the host has already loaded and bound (`params`' recipe source is ignored). */
9
- startLoaded: (set: RecipeSet, params: Omit<RunParams, 'paths' | 'recipes'>) => Promise<string>;
10
- startWork: (params: WorkParams) => Promise<string>;
11
- cancel: (runId: string) => Promise<boolean>;
12
- closeAll: () => Promise<void>;
13
- }
14
- /** What the host serves itself, in process, besides what the client serves: an MCP server's plugins module. */
15
- export interface LocalPlugins {
16
- hooks?: HookMap;
17
- captchaSolvers?: CaptchaSolver[];
18
- accessPlugins?: AccessPlugin[];
19
- }
20
- /**
21
- * Starts and tracks runs and worker pools. `start` and `startWork` load and bind the recipes (a bad
22
- * recipe fails the request itself, with its problems), answer with a run id at once, and crawl in the
23
- * background: every crawl event goes to the client as an `event` notification, every record as a
24
- * `record` one unless `out` names a file, and the end as `finished` with the report. A hook the client
25
- * serves is asked back with a `callout` request, and so are the captcha solvers and access plugins it
26
- * serves; a worker pool asks the client for its items (`work.next`). `cancel` closes the run's crawler,
27
- * which stops its recipes; the run still ends with `finished`.
28
- *
29
- * @param notify - The channel's notify.
30
- * @param ask - The channel's request, for callouts and work.
31
- * @param local - Hooks, captcha solvers and access plugins the host serves itself, beside the client's.
32
- * @returns The sessions.
33
- */
34
- export declare function runSessions(notify: NotifyClient, ask: AskClient, local?: LocalPlugins): RunSessions;
35
- //# sourceMappingURL=run-session.use-case.d.ts.map